订单相关修改同步test

This commit is contained in:
GaoHao
2024-10-16 09:05:52 +08:00
parent 3288d1ed9b
commit 3ad4d7af68
16 changed files with 363 additions and 4678 deletions

View File

@@ -1,5 +1,27 @@
<template>
<view class="container">
<view class="headStatus" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
<view class="status">
<u-icon name="checkmark-circle-fill" color="#03C061" size="46"></u-icon>
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单成功</view>
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view>
</view>
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单时间{{listinfo.createdAt}}</view>
<view class="time" v-if="listinfo.status=='closed'">付款时间{{listinfo.paidTime}}</view>
</view>
<view class="wxQrcode" v-if="listinfo.shopQrcode">
<view class="left">
<text class="title">扫码加好友优惠多多</text>
<text>优惠活动多</text>
<text>充值有好礼</text>
<text>会员享低价</text>
<text>长按保存微信内扫一扫加好友</text>
</view>
<u-image width="152" height="152" radius="16" :src="listinfo.shopQrcode" ></u-image>
</view>
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
@@ -64,13 +86,12 @@
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
async onLoad(e) {
onLoad(e) {
console.log(e)
this.orderId = e.orderId
},
onShow() {
this.orderorderInfo()
this.getAount();
},
onUnload() {
this.ispws = false
@@ -78,6 +99,12 @@
url: '/pages/order/order'
})
},
onNavigationBarButtonTap ( e ) {
console.log(e)
},
onBackPress ( e ) {
console.log(e)
},
methods: {
/**
@@ -85,7 +112,7 @@
*/
async getAount() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopId'),
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
@@ -108,10 +135,11 @@
if (res.code == 0) {
this.listinfo = res.data;
this.listinfoid = res.data.orderId;
uni.cache.set('shopId',res.data.shopId)
this.shopId = res.data.shopId;
if (this.listinfo.useType == " ") {
//堂食先付费
}
this.getAount();
}
},
@@ -223,7 +251,7 @@
* 微信支付
*/
async wechatPay() {
let res = await this.api.payorderPay({
let res = await this.api.orderPay({
orderId: this.orderId,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
@@ -237,8 +265,8 @@
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -246,14 +274,21 @@
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
let _this = this
uni.showToast({
title: "支付成功"
})
// #ifdef MP-WEIXIN
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
this.paymodfiyOrderInfo()
setTimeout(res => {
uni.hideLoading()
@@ -263,8 +298,19 @@
}, 500)
},
})
// #endif
// #ifdef MP-ALIPAY
_this.paymodfiyOrderInfo()
uni.switchTab({
url: '/pages/order/order'
});
// #endif
},
fail: (err) => {
fail: async(err) => {
let res = await this.api.cancelOrderPay({
orderId: this.orderId,
}) //判断是否支付成功
uni.showToast({
icon: 'none',
title: '支付失败'
@@ -278,35 +324,7 @@
}
});
// #endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
success: (res) => {
let _this = this
// uni.requestSubscribeMessage({
// tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
// complete() {
// uni.showToast({
// title: "支付成功"
// })
// // uni.cache.set('shopUser', '') //删除shopUser
// },
// })
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this.listinfoid
});
},
fail: () => {
uni.hideLoading()
}
});
// #endif
}
},
@@ -347,7 +365,51 @@
.container {
padding: 32rpx 28rpx 224rpx 28rpx;
}
.headStatus{
display: flex;
flex-direction: column;
margin-bottom: 32rpx;
align-items: center;
.status{
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 36rpx;
color: #333333;
.statusName{
margin-left: 16rpx;
}
}
.time{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 18rpx;
}
}
.wxQrcode{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 24rpx;
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32rpx;
.left{
display: flex;
flex-direction: column;
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
}
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
@@ -700,15 +762,12 @@
}
.fixedview_tow {
width: 140rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border-radius: 36rpx;
font-weight: 400;
font-size: 28rpx;
font-size: 32rpx;
color: #FFFFFF;
padding: 14rpx 44rpx;
}
}
}