feat: 订单下单支付跳转
parent
49c9611182
commit
eab653230d
|
@ -8,8 +8,8 @@
|
|||
</view>
|
||||
<view class="count-down">
|
||||
支付剩余时间
|
||||
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''" :minute-text="' : '"
|
||||
:second-text="' '" :datatime="invalidTime"></countDown>
|
||||
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''"
|
||||
:minute-text="' : '" :second-text="' '" :datatime="invalidTime"></countDown>
|
||||
</view>
|
||||
</view>
|
||||
<view class="payment">
|
||||
|
@ -33,15 +33,15 @@
|
|||
</view>
|
||||
<view class="btn">
|
||||
<view class="button acea-row row-center-wrapper pay-button" @click='goPay'>确认支付</view>
|
||||
<view class="wait-pay" @click="waitPay">暂不支付</view>
|
||||
<view class="wait-pay" @click="cancelPayModalShow = true">暂不支付</view>
|
||||
</view>
|
||||
<view v-show="false" v-html="formContent"></view>
|
||||
<u-modal :show="cancelPayModalShow" width="519rpx">
|
||||
<view class="modal-wrap">
|
||||
<view class="count-down">
|
||||
支付剩余时间
|
||||
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''" :minute-text="' : '"
|
||||
:second-text="' '" :datatime="invalidTime"></countDown>
|
||||
<countDown :is-day="false" :is-show-hour='false' :tip-text="''" :day-text="''" :hour-text="''"
|
||||
:minute-text="' : '" :second-text="' '" :datatime="invalidTime"></countDown>
|
||||
</view>
|
||||
<view class="model-content">确认要放弃付款吗?</view>
|
||||
</view>
|
||||
|
@ -53,7 +53,7 @@
|
|||
</view>
|
||||
</u-modal>
|
||||
<!-- 支付宝支付链接复制组件 -->
|
||||
<alipay-link-copy :show.sync="alipayShow" :alipayLink="alipayLink"/>
|
||||
<alipay-link-copy :show.sync="alipayShow" :alipayLink="alipayLink" @confirm="onConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -76,9 +76,11 @@
|
|||
data() {
|
||||
return {
|
||||
cancelPayModalShow: false,
|
||||
backPayModalShow: true,
|
||||
alipayShow: false,
|
||||
alipayLink: '',
|
||||
checked: false,
|
||||
isClickGiveUpBtn: true,
|
||||
//支付方式
|
||||
cartArr: [{
|
||||
"name": '微信支付',
|
||||
|
@ -95,6 +97,7 @@
|
|||
payStatus: 1,
|
||||
}
|
||||
],
|
||||
paytype: 'WXPAY',
|
||||
orderId: 0,
|
||||
active: 0,
|
||||
payPrice: 10.00,
|
||||
|
@ -113,7 +116,8 @@
|
|||
},
|
||||
onShow() {
|
||||
let options = wx.getEnterOptionsSync();
|
||||
console.log(options)
|
||||
window.history.pushState(null, null, document.url)
|
||||
window.addEventListener('popstate', this.backShowPayModal)
|
||||
/*
|
||||
if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) {
|
||||
// 代表从收银台小程序返回
|
||||
|
@ -153,10 +157,25 @@
|
|||
}
|
||||
}*/
|
||||
},
|
||||
onHide() {
|
||||
window.removeEventListener('popstate', this.backShowPayModal)
|
||||
},
|
||||
onUnload() {
|
||||
window.removeEventListener('popstate', this.backShowPayModal)
|
||||
},
|
||||
methods: {
|
||||
backShowPayModal() {
|
||||
this.isClickGiveUpBtn = false
|
||||
this.cancelPayModalShow = this.backPayModalShow
|
||||
},
|
||||
onGiveUpPay() {
|
||||
if (this.isClickGiveUpBtn) {
|
||||
window.history.back()
|
||||
}
|
||||
this.cancelPayModalShow = false
|
||||
// uni.navigateBack()
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
getCashierOrder() {
|
||||
uni.showLoading({
|
||||
|
@ -164,6 +183,7 @@
|
|||
});
|
||||
getOrderDetail(this.orderId).then(res => {
|
||||
const orderInfo = res.data
|
||||
this.invalidTime = new Date(res.data.endTime).getTime()
|
||||
this.payPrice = parseFloat(orderInfo.proTotalPrice).toFixed(2)
|
||||
this.payPriceShow = parseFloat(orderInfo.proTotalPrice).toFixed(2)
|
||||
}).catch(err => {
|
||||
|
@ -176,12 +196,28 @@
|
|||
this.active = index;
|
||||
this.paytype = paytype;
|
||||
},
|
||||
waitPay() {
|
||||
this.cancelPayModalShow = true
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=取消支付&type=3' +
|
||||
// '&status=2&totalPrice=' + this.payPriceShow
|
||||
// })
|
||||
onConfirm() {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您是否已支付?',
|
||||
cancelText: '未支付',
|
||||
confirmText: '已支付',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// 如果是支付成功跳转到订单列表,触发popstate事件时,不需要弹出支付确认框
|
||||
that.backPayModalShow = false
|
||||
window.history.back()
|
||||
setTimeout(()=>{
|
||||
uni.redirectTo({
|
||||
url: '/pages/users/order_list/index'
|
||||
})
|
||||
}, 200)
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
goPay() {
|
||||
let that = this;
|
||||
|
@ -205,6 +241,9 @@
|
|||
},
|
||||
wxPaySuccess: () => {
|
||||
// window.location.reload()
|
||||
uni.redirectTo({
|
||||
url: '/pages/users/order_list/index'
|
||||
})
|
||||
},
|
||||
aliPaySuccess: (link) => {
|
||||
that.alipayLink = link
|
||||
|
@ -224,6 +263,7 @@
|
|||
.count-down .time {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.modal-btn-wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
@ -293,7 +293,7 @@
|
|||
preOrderNo: '' //预下单订单号
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'systemPlatform', 'productType']),
|
||||
computed: mapGetters(['isLogin', 'systemPlatform', 'productType', 'tenantId']),
|
||||
watch: {
|
||||
isLogin: {
|
||||
handler: function(newV, oldV) {
|
||||
|
@ -628,7 +628,7 @@
|
|||
},
|
||||
getOrderPay: function(orderNo, message) {
|
||||
let that = this;
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods_cashier/index?order_id=' + orderNo
|
||||
})
|
||||
// wechatOrderPay({
|
||||
|
|
Loading…
Reference in New Issue