|
@@ -55,7 +55,7 @@
|
|
|
v-if="orderType == 1">
|
|
|
<view>
|
|
|
<text class="order-text-left">{{coupon.couponName}}</text>
|
|
|
- <text class="order-text-right">-¥{{coupon.discountAmount}}</text>
|
|
|
+ <text class="order-text-right">{{couponList.length ? ('-¥'+coupon.discountAmount) : '无可用优惠券'}}</text>
|
|
|
</view>
|
|
|
</u-cell-item>
|
|
|
<u-field label="备注" v-model="notes" placeholder="请输入备注" :border-bottom="false" label-align="right" label-width="170"
|
|
@@ -131,6 +131,7 @@
|
|
|
couponList: [],
|
|
|
notes: '',
|
|
|
paySum: 0,
|
|
|
+ mineIntegral: {}
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -162,7 +163,7 @@
|
|
|
}
|
|
|
if (this.orderType == 1) {
|
|
|
NET.request(API.getIntegral, {}, 'POST').then(res => {
|
|
|
- this.mineIntegral = res.data.usableIntegral
|
|
|
+ this.integral = res.data.usableIntegral
|
|
|
}).catch(error => {
|
|
|
this.$refs.uTips.show({
|
|
|
title: '获取个人积分失败',
|
|
@@ -176,7 +177,7 @@
|
|
|
this.couponList = res.data
|
|
|
}).catch(error => {
|
|
|
this.$refs.uTips.show({
|
|
|
- title: '获取优惠券列表失败',
|
|
|
+ title: res.msg,
|
|
|
type: 'warning',
|
|
|
})
|
|
|
})
|
|
@@ -228,6 +229,9 @@
|
|
|
},
|
|
|
// 显示优惠券弹窗
|
|
|
showCoupon() {
|
|
|
+ if (!this.couponList.length) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$refs.popup.open()
|
|
|
},
|
|
|
// 选择优惠券
|
|
@@ -291,30 +295,44 @@
|
|
|
// 备注
|
|
|
notes: this.notes,
|
|
|
}, 'POST').then(res => {
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'wxpay',
|
|
|
- timeStamp: res.data.timeStamp,
|
|
|
- nonceStr: res.data.nonceStr,
|
|
|
- package: res.data.packageValue,
|
|
|
- signType: res.data.signType,
|
|
|
- paySign: res.data.paySign,
|
|
|
- success: (payRes) => {
|
|
|
- console.log('success:' + JSON.stringify(payRes));
|
|
|
+ if (res.isSuccess) {
|
|
|
+ if (res.data) {
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: res.data.timeStamp,
|
|
|
+ nonceStr: res.data.nonceStr,
|
|
|
+ package: res.data.packageValue,
|
|
|
+ signType: res.data.signType,
|
|
|
+ paySign: res.data.paySign,
|
|
|
+ success: (payRes) => {
|
|
|
+ console.log('success:' + JSON.stringify(payRes));
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pagesMain/paySuccess'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ console.log('fail:' + JSON.stringify(error));
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '支付失败',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pagesMain/orderList?type=' + 1
|
|
|
+ });
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
uni.reLaunch({
|
|
|
url: '/pagesMain/paySuccess'
|
|
|
});
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- console.log('fail:' + JSON.stringify(error));
|
|
|
- this.$refs.uTips.show({
|
|
|
- title: '支付失败',
|
|
|
- type: 'warning',
|
|
|
- })
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
}).catch(error => {
|
|
|
+ console.log('error提交订单失败:', error);
|
|
|
this.$refs.uTips.show({
|
|
|
- title: '提交订单失败',
|
|
|
+ title: error.data.msg,
|
|
|
type: 'warning',
|
|
|
})
|
|
|
})
|