|
|
@@ -26,7 +26,7 @@
|
|
|
<swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
|
|
|
<swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index">
|
|
|
<view>
|
|
|
- <mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" @openPay="openPay">
|
|
|
+ <mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" @openPay="openPay" @openPayAppointment="openPayAppointment">
|
|
|
</mescroll-item>
|
|
|
</view>
|
|
|
</swiper-item>
|
|
|
@@ -181,7 +181,9 @@
|
|
|
userInfo:{},
|
|
|
curServiceTab:1,
|
|
|
tradeNo:'',
|
|
|
- password:''
|
|
|
+ password:'',
|
|
|
+ openType:0,//开启的支付类型:1一键支付子订单费用,2:支付预约费用
|
|
|
+ appointmentOrder:{}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
@@ -198,6 +200,8 @@
|
|
|
},
|
|
|
|
|
|
onShow(){
|
|
|
+ this.userInfo = uni.getStorageSync('userInfo')
|
|
|
+
|
|
|
if (uni.getStorageSync('orderListIndex')){
|
|
|
this.tabIndex = uni.getStorageSync('orderListIndex')
|
|
|
}
|
|
|
@@ -206,9 +210,58 @@
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
- getUserInfo() {
|
|
|
- this.userInfo = uni.getStorageSync('userInfo');
|
|
|
- },
|
|
|
+
|
|
|
+ openPayAppointment(order,number){
|
|
|
+ console.log(order)
|
|
|
+ console.log(number)
|
|
|
+ this.appointmentOrder = order
|
|
|
+ this.openType=number
|
|
|
+ this.$refs.popup.open()
|
|
|
+ },
|
|
|
+
|
|
|
+ //微信支付预约费用
|
|
|
+ wechatPay(){
|
|
|
+ let that = this;
|
|
|
+ // 发起微信支付
|
|
|
+ this.$api.wechatPay({
|
|
|
+ orderNo:this.appointmentOrder.subOrderNo
|
|
|
+ }).then((res)=>{
|
|
|
+ var param = res.data.data;
|
|
|
+ uni.requestPayment({
|
|
|
+ appId: param.appid,
|
|
|
+ timeStamp: param.timestamp+"",
|
|
|
+ nonceStr: param.noncestr,
|
|
|
+ package: "prepay_id="+param.prepayid,
|
|
|
+ signType: "RSA",
|
|
|
+ paySign: param.sign,
|
|
|
+ success: res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功!'
|
|
|
+ });
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ console.log(res)
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon: 'error'
|
|
|
+ });
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch(() =>{
|
|
|
+ uni.showToast({
|
|
|
+ title: "操作失败",
|
|
|
+ icon:'error'
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
balancePay(){
|
|
|
|
|
|
@@ -221,18 +274,49 @@
|
|
|
}
|
|
|
this.$refs.passwordPopup.close()
|
|
|
// 用户信息
|
|
|
- this.$api.trade({
|
|
|
- tradeNo: this.tradeNo,
|
|
|
- password: this.password
|
|
|
- }).then((res)=>{
|
|
|
- uni.switchTab({
|
|
|
- url:'/pages/order/index'
|
|
|
- })
|
|
|
- }).catch(() =>{
|
|
|
- uni.showToast({
|
|
|
- title: "操作失败"
|
|
|
- })
|
|
|
- });
|
|
|
+
|
|
|
+ if (this.openType == 2){
|
|
|
+ //支付预约费用
|
|
|
+ this.$api.balancePay({
|
|
|
+ orderNo: this.appointmentOrder.subOrderNo,
|
|
|
+ password: this.password
|
|
|
+ }).then((res)=>{
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功'
|
|
|
+ })
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ that.password = ''
|
|
|
+ }).catch((err) =>{
|
|
|
+ uni.showToast({
|
|
|
+ title: err.msg,
|
|
|
+ icon:'error'
|
|
|
+ })
|
|
|
+ that.password = ''
|
|
|
+ });
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //支付子订单费用
|
|
|
+ this.$api.trade({
|
|
|
+ tradeNo: this.tradeNo,
|
|
|
+ password: this.password
|
|
|
+ }).then((res)=>{
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功'
|
|
|
+ })
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ that.password = ''
|
|
|
+ }).catch((err) =>{
|
|
|
+ uni.showToast({
|
|
|
+ title: err.msg,
|
|
|
+ icon:'error'
|
|
|
+ })
|
|
|
+ that.password = ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|
|
|
@@ -247,58 +331,80 @@
|
|
|
this.$refs.popup.close()
|
|
|
},
|
|
|
|
|
|
- openPay(order){
|
|
|
- this.getUserInfo();
|
|
|
+
|
|
|
+ //一键支付子订单
|
|
|
+ openPay(order,number){
|
|
|
+ console.log(order)
|
|
|
+ console.log(number)
|
|
|
+ this.openType=number
|
|
|
this.$api.oneClickPay({
|
|
|
orderId:order.orderId
|
|
|
}).then(res=>{
|
|
|
this.tradeNo = res.data.data.tradeNo
|
|
|
this.$refs.popup.open()
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
|
|
|
commonGeneralOrder(){
|
|
|
let that =this
|
|
|
if (this.curServiceTab===1){
|
|
|
this.$refs.popup.close()
|
|
|
+ that.password = ''
|
|
|
this.$refs.passwordPopup.open()
|
|
|
}else {
|
|
|
- this.$api.wechatPayTradeNo({tradeNo:this.tradeNo}).then(res=>{
|
|
|
- var param = res.data.data;
|
|
|
- uni.requestPayment({
|
|
|
- appId: param.appid,
|
|
|
- timeStamp: param.timestamp+"",
|
|
|
- nonceStr: param.noncestr,
|
|
|
- package: "prepay_id="+param.prepayid,
|
|
|
- signType: "RSA",
|
|
|
- paySign: param.sign,
|
|
|
- success: res => {
|
|
|
- uni.showToast({
|
|
|
- title: '支付成功!'
|
|
|
- });
|
|
|
- that.$refs.popup.close()
|
|
|
- that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
- },
|
|
|
- fail: res => {
|
|
|
- console.log(res)
|
|
|
- uni.showModal({
|
|
|
- content: '支付失败',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- that.$refs.popup.close()
|
|
|
- that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
- }
|
|
|
+
|
|
|
+ if (this.openType == 2){
|
|
|
+ //支付预约费用
|
|
|
+ this.wechatPay()
|
|
|
+ }else{
|
|
|
+ //支付子订单费用
|
|
|
+ this.$api.wechatPayTradeNo({tradeNo:this.tradeNo}).then(res=>{
|
|
|
+ var param = res.data.data;
|
|
|
+ uni.requestPayment({
|
|
|
+ appId: param.appid,
|
|
|
+ timeStamp: param.timestamp+"",
|
|
|
+ nonceStr: param.noncestr,
|
|
|
+ package: "prepay_id="+param.prepayid,
|
|
|
+ signType: "RSA",
|
|
|
+ paySign: param.sign,
|
|
|
+ success: res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功!'
|
|
|
+ });
|
|
|
+ that.$refs.popup.close()
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ console.log(res)
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon: 'error'
|
|
|
+ });
|
|
|
+ that.$refs.popup.close()
|
|
|
+ that.$refs.MescrollItem[that.tabIndex].downCallback()
|
|
|
+ that.getUserInfo()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch(() =>{
|
|
|
+ uni.showToast({
|
|
|
+ title: "操作失败"
|
|
|
+ })
|
|
|
});
|
|
|
- }).catch(() =>{
|
|
|
- uni.showToast({
|
|
|
- title: "操作失败"
|
|
|
- })
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ getUserInfo() {
|
|
|
+ let that = this
|
|
|
+ this.$api.getUserInfo().then(function (res) {
|
|
|
+ that.userInfo = res.data.data
|
|
|
+ uni.setStorageSync('userInfo', res.data.data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
clickTab(e) {
|
|
|
this.tabIndex = e.index
|
|
|
},
|