更新小程序仓库
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
// pages/payInfo/payInfo.js
|
||||
const app = getApp()
|
||||
import {
|
||||
payPrescription
|
||||
} from "../../api/prescription"
|
||||
import {createProduct} from "../../api/medinceOrder"
|
||||
import {throttle} from "../../utils/util"
|
||||
import {client_type} from "../../utils/isPc"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
order_prescription_id: '',
|
||||
address_id:'',
|
||||
product_ids:[],
|
||||
btnLock:false,
|
||||
prevData:'',
|
||||
fromType:'',
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static',
|
||||
order: {
|
||||
|
||||
}
|
||||
},
|
||||
goAddress(event) {
|
||||
let address_id = event.currentTarget.dataset.id;
|
||||
app.method.navigateTo({
|
||||
url: '/pages/address/address?address_id=' + address_id + "&order_prescription_id=" + this.data.order_prescription_id
|
||||
})
|
||||
},
|
||||
goAddAddress:throttle(function() {
|
||||
app.method.navigateTo({
|
||||
url: '/pages/address/address?address_id=add&order_prescription_id='+ this.data.order_prescription_id
|
||||
})
|
||||
}),
|
||||
handleThrottle:throttle(function(){
|
||||
this.handleCreateProduct()
|
||||
}),
|
||||
//创建药品支付订单
|
||||
handleCreateProduct(){
|
||||
let {order_prescription_id,address_id,product_ids,fromType}=this.data;
|
||||
|
||||
if(!address_id){
|
||||
wx.showToast({
|
||||
title:'请选择收货地址',
|
||||
icon:'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.setData({
|
||||
btnLock:true
|
||||
})
|
||||
createProduct({
|
||||
order_prescription_id,
|
||||
address_id,
|
||||
product_ids:product_ids,
|
||||
client_type:client_type
|
||||
}).then(data=>{
|
||||
let {inquiry_no,order_product_id}=data;
|
||||
this.setData({
|
||||
btnLock:false
|
||||
});
|
||||
this.setData({
|
||||
fromType:encodeURIComponent('pages/medinceOrder/medinceOrder')
|
||||
})
|
||||
// if(fromType){
|
||||
// this.setData({
|
||||
// fromType:encodeURIComponent('pages/medinceOrder/medinceOrder')
|
||||
// })
|
||||
// }
|
||||
app.method.navigateTo({
|
||||
url: '/pages/payOrder/payOrder?inquiry_no='+ inquiry_no +"&order_product_id="+order_product_id+"&order_type=2&order_prescription_id="+order_prescription_id+"&fromType="+this.data.fromType
|
||||
})
|
||||
})
|
||||
},
|
||||
handlepayPrescription(id, address) {
|
||||
payPrescription(id).then(data => {
|
||||
this.setData({
|
||||
order: data
|
||||
});
|
||||
let product_ids=[];
|
||||
let product=data.order_prescription_product;
|
||||
product.forEach((item)=>{
|
||||
product_ids.push(item.product_id)
|
||||
})
|
||||
this.setData({
|
||||
address_id:data.user_ship_address?data.user_ship_address.address_id:'',
|
||||
product_ids:product_ids
|
||||
});
|
||||
if(!data.user_ship_address){
|
||||
this.setData({
|
||||
prevData:'',
|
||||
'order.user_ship_address':null,
|
||||
address_id:''
|
||||
})
|
||||
}else{
|
||||
if (address) {
|
||||
let addressInfo = JSON.parse(address);
|
||||
this.setData({
|
||||
'order.user_ship_address.province': addressInfo.province,
|
||||
'order.user_ship_address.city': addressInfo.city,
|
||||
'order.user_ship_address.county': addressInfo.country,
|
||||
'order.user_ship_address.address': addressInfo.address,
|
||||
'order.user_ship_address.consignee_name': addressInfo.name,
|
||||
'order.user_ship_address.consignee_tel': addressInfo.phone,
|
||||
'order.user_ship_address.address_id': addressInfo.address_id,
|
||||
address_id:addressInfo.address_id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
goPayOrder:throttle(function() {
|
||||
let order_prescription_id = this.data.order_prescription_id;
|
||||
app.method.navigateTo({
|
||||
url: '/pages/payOrder/payOrder?order_prescription_id='+order_prescription_id + "&order_type=2"
|
||||
})
|
||||
}),
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
let id = options.order_prescription_id;
|
||||
if(options.fromType){
|
||||
this.setData({
|
||||
fromType:options.fromType
|
||||
})
|
||||
};
|
||||
let address = options.address;
|
||||
this.setData({
|
||||
order_prescription_id: id
|
||||
})
|
||||
this.handlepayPrescription(id, address);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
let {prevData,order_prescription_id}=this.data;
|
||||
this.setData({
|
||||
img_host:app.hostConfig().imghost
|
||||
})
|
||||
if(prevData){
|
||||
this.handlepayPrescription(order_prescription_id,prevData);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"nav":"../../components/nav/nav"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<!--pages/payInfo/payInfo.wxml-->
|
||||
<wxs src="../../filters/filter.wxs" module="timeModule"></wxs>
|
||||
<nav navName="结算"></nav>
|
||||
<view class="page">
|
||||
<view class="mypaybox">
|
||||
<view class="addressbox" wx:if="{{order.user_ship_address && order.user_ship_address.address}}" bindtap="goAddress" data-id="{{order.user_ship_address.address_id}}">
|
||||
<view class="left">
|
||||
<image src="{{img_host+'/addressicon.png'}}" class="icon"></image>
|
||||
<view class="info">
|
||||
<view class="name">{{order.user_ship_address.consignee_name}} {{order.user_ship_address.consignee_tel}}</view>
|
||||
<view class="address">{{order.user_ship_address.province}}{{order.user_ship_address.city}}{{order.user_ship_address.county}}{{order.user_ship_address.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image src="{{img_host+'/ricon.png'}}" class="ricon"></image>
|
||||
</view>
|
||||
<view class="add" bindtap="goAddAddress" wx:else><image src="{{img_host+'/addAddress.png'}}" class="addicon"></image><text decode="true"> 新建收货地址</text></view>
|
||||
|
||||
<view class="infobox">
|
||||
<view class="title">药品信息</view>
|
||||
<view class="medincebox {{item.status==1?'':'active'}}" wx:for="{{order.order_prescription_product}}" wx:key="product_id" >
|
||||
<view class="cell">
|
||||
<view class="imgbox">
|
||||
<image src="{{img_host+'/nomedince.png'}}" class="yaoimg"></image>
|
||||
<view class="desc">
|
||||
<view class="tip">处方药品</view>
|
||||
<view class="tip">依据法规不展示包装</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rightinfo">
|
||||
<view class="name">{{item.product_name}}{{item.product_spec}}</view>
|
||||
<view class="own">
|
||||
<view class="company">{{item.manufacturer}}</view>
|
||||
<view class="num">数量:{{item.prescription_product_num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nogoods" wx:if="{{item.status==0}}">库存不足</view>
|
||||
</view>
|
||||
|
||||
<view class="title">订单信息</view>
|
||||
<view class="orderinfo">
|
||||
<!-- <view class="row">
|
||||
<view class="name">订单编号:</view>
|
||||
<view class="desc">{{order_prescription_id}}</view>
|
||||
</view> -->
|
||||
<view class="row">
|
||||
<view class="name">药品金额</view>
|
||||
<view class="dot" >:</view>
|
||||
<view class="desc price">¥{{order.amount_total}}</view>
|
||||
</view>
|
||||
|
||||
<view class="row">
|
||||
<view class="name"><text>邮</text><text>费</text></view>
|
||||
<view class="dot">:</view>
|
||||
<view class="desc price" wx:if="{{order.logistics_fee>0}}">¥{{order.logistics_fee}}(包邮)</view>
|
||||
<view class="desc price" wx:else>¥0.00(包邮)</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="name"><view class="textyou"><view >优</view><view>惠</view><view>券</view></view></view>
|
||||
<view class="dot">:</view>
|
||||
<view class="desc">
|
||||
<text wx:if="{{timeModule.formatMoney(order.coupon_amount_total)>0}}">- ¥{{timeModule.formatMoney(order.coupon_amount_total)}}</text>
|
||||
<text wx:else>无</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="name"> 支付金额</view>
|
||||
<view class="dot">:</view>
|
||||
<view class="desc price">¥{{order.payment_amount_total}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="btn" type="primary" bindtap="handleThrottle" disabled="{{btnLock}}">
|
||||
立即支付:{{order.payment_amount_total}}元
|
||||
</button>
|
||||
</view>
|
||||
@@ -0,0 +1,245 @@
|
||||
/* pages/payInfo/payInfo.wxss */
|
||||
.page{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.mypaybox{
|
||||
flex:1;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
margin-top: 172rpx;
|
||||
margin-bottom: 124rpx;
|
||||
}
|
||||
.add {
|
||||
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 120rpx;
|
||||
background: #FFFFFF;
|
||||
font-weight: 600;
|
||||
color: #ED9C00;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.addicon{
|
||||
width: 40rpx;
|
||||
height:40rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.addressbox {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.addressbox .left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.addressbox .icon {
|
||||
width: 40rpx;
|
||||
flex-shrink: 0;
|
||||
height: 47rpx;
|
||||
|
||||
}
|
||||
|
||||
.addressbox .info {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.addressbox .ricon {
|
||||
width: 24rpx;
|
||||
flex-shrink: 0;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.info .name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333333
|
||||
}
|
||||
|
||||
.info .address {
|
||||
margin-right:15rpx;
|
||||
word-break: break-all;
|
||||
margin-top: 10rpx;
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.infobox {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.infobox .title {
|
||||
padding: 0 32rpx;
|
||||
background-color: #fff;
|
||||
font-size: 32rpx;
|
||||
height: 112rpx;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1rpx solid #E3E4E5;
|
||||
}
|
||||
|
||||
.imgbox {
|
||||
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.yaoimg {
|
||||
width: 120rpx;
|
||||
height: 128rpx;
|
||||
}
|
||||
|
||||
.imgbox .desc {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 30rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.imgbox .desc .tip {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.medincebox {
|
||||
background-color: #fff;
|
||||
}
|
||||
.medincebox.active{
|
||||
background: rgba(228,228,228,0.7);
|
||||
}
|
||||
.medincebox .nogoods{
|
||||
position: absolute;
|
||||
width:100%;
|
||||
top:0;
|
||||
bottom:0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #EF4F20;
|
||||
}
|
||||
.medincebox .cell {
|
||||
padding: 30rpx 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #E3E4E5;
|
||||
}
|
||||
|
||||
.rightinfo {
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.medincebox .cell .name {
|
||||
word-break: break-all;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2;
|
||||
/* 这里是超出几行省略 */
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rightinfo .own {
|
||||
margin-top: 47rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
.own .num{
|
||||
margin-top: 3rpx;
|
||||
margin-left: 25rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.orderinfo {
|
||||
background: #FFFFFF;
|
||||
padding: 30rpx 32rpx;
|
||||
}
|
||||
|
||||
.orderinfo .row {
|
||||
line-height: 52rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.row .name {
|
||||
color: #333333;
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
width:115rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.row .dot{
|
||||
display: flex;
|
||||
font-weight: 600;
|
||||
align-items: baseline;
|
||||
}
|
||||
.row .desc {
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.row .price {
|
||||
font-weight: 600;
|
||||
font-size: 34rpx;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
color: #EF4F20;
|
||||
}
|
||||
|
||||
.btn {
|
||||
position: fixed;
|
||||
bottom: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
font-size: 36rpx;
|
||||
left: 32rpx;
|
||||
right: 32rpx;
|
||||
height: 94rpx;
|
||||
background: #3CC7C0!important;
|
||||
border-radius: 47rpx;
|
||||
}
|
||||
.textyou{
|
||||
width:112rpx;
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
}
|
||||
Reference in New Issue
Block a user