核销流程优化

This commit is contained in:
丁杰 2026-06-10 11:21:43 +08:00
parent b38847ada8
commit 0eb6237e41
1 changed files with 68 additions and 3 deletions

View File

@ -59,8 +59,9 @@
</scroll-view>
<view class="bottom-btn-wrapper">
<view class="confirm-btn" @tap="confirmVerify" :class="{ 'btn-disabled': isVerifying }">
<text class="btn-text">{{ isVerifying ? '核销中...' : '确认核销' }}</text>
<view class="confirm-btn" @tap="isVerified ? goHomePage() : confirmVerify()"
:class="{ 'btn-disabled': isVerifying }">
<text class="btn-text">{{ isVerified ? '核销成功,返回首页' : (isVerifying ? '核销中...' : '确认核销') }}</text>
</view>
</view>
</view>
@ -101,7 +102,9 @@ export default {
payPrice: 0,
settlePrice: 0
},
isVerifying: false
isVerifying: false,
isVerified: false, //
userInfo: {} // sjid
};
},
onLoad(options) {
@ -124,6 +127,23 @@ export default {
console.log('未获取到订单信息');
}
},
async onShow() {
//
if (this.orderData.orderId) {
// sjid
if (!this.userInfo.id) {
try {
const res = await request.post('/user/getuser', { type: 3 });
if (res.data) {
this.userInfo = res.data;
}
} catch (e) {
console.error('获取用户信息失败', e);
}
}
this.checkVerifyStatus();
}
},
methods: {
// /sj/poster/getOrderByCode data
mapOrderData(data) {
@ -152,6 +172,48 @@ export default {
goBack() {
uni.navigateBack();
},
//
checkVerifyStatus() {
if (!this.orderData.orderId) return;
//
const orderType = this.orderData.orderType;
let detailUrl = '';
let params = { id: this.orderData.orderId };
if (orderType == 3) {
//
detailUrl = '/syr/workHourOrder/details';
} else if (orderType == 4) {
//
detailUrl = '/sj/workSeatOrder/details';
} else if (orderType == 6) {
//
detailUrl = '/sj/orderSelf/details';
params.sjid = this.userInfo.id || ''; // sjid
} else {
// (orderType 1, 2, 5)
detailUrl = '/sj/yhorderdetail';
params.sjid = this.userInfo.id || '';
}
request.post(detailUrl, params).then(res => {
if (res.code === 200 && res.data) {
const orderState = res.data.state;
// 1/2/3 4/5/6/7
if (orderState >= 4) {
this.isVerified = true;
}
}
}).catch(err => {
console.error('检查核销状态失败', err);
});
},
//
goHomePage() {
uni.switchTab({
url: '/pages/home/home'
});
},
confirmVerify() {
if (this.isVerifying) return;
if (!this.orderData.orderId) {
@ -182,6 +244,9 @@ export default {
uni.hideLoading();
if (res.code === 200) {
uni.showToast({ title: '核销成功', icon: 'success' });
this.isVerified = true;
this.isVerifying = false;
//
const orderId = this.orderData.orderId;
const orderType = this.orderData.orderType;
let url = '';