hookehuyr

feat(订单管理): 添加微信小程序确认收货功能

使用微信开放能力实现确认收货流程,当微信版本不支持时提示用户升级
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-06 15:30:03 4 + * @LastEditTime: 2025-08-08 17:38:16
5 * @FilePath: /jgdl/src/pages/myOrders/index.vue 5 * @FilePath: /jgdl/src/pages/myOrders/index.vue
6 * @Description: 订单管理页面 6 * @Description: 订单管理页面
7 --> 7 -->
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
52 <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)"> 52 <view class="tab-item" :class="{ active: activeTab === 9 }" @click="setActiveTab(9)">
53 待收货 53 待收货
54 </view> 54 </view>
55 - <view class="tab-item" :class="{ active: activeTab === 'profit_sharing' }" @click="setActiveTab('profit_sharing')"> 55 + <view class="tab-item" :class="{ active: activeTab === 'profit_sharing' }"
56 + @click="setActiveTab('profit_sharing')">
56 分账 57 分账
57 </view> 58 </view>
58 <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)"> 59 <view class="tab-item" :class="{ active: activeTab === 7 }" @click="setActiveTab(7)">
...@@ -1290,20 +1291,35 @@ const performConfirmReceive = async (orderId) => { ...@@ -1290,20 +1291,35 @@ const performConfirmReceive = async (orderId) => {
1290 try { 1291 try {
1291 const order = boughtOrders.value.find(o => o.id === orderId) 1292 const order = boughtOrders.value.find(o => o.id === orderId)
1292 1293
1293 - // 调用确认收货API 1294 + if (wx.openBusinessView) {
1294 - if (order) { 1295 + wx.openBusinessView({
1295 - // 调用买家查询收货状态接口 1296 + businessType: 'weappOrderConfirm',
1296 - const response = await receiveOrderAPI({ order_id: order.id }) 1297 + extraData: {
1297 - 1298 + merchant_id: order.merchant_id || '',
1298 - if (response.code) { 1299 + merchant_trade_no: order.id,
1299 - order.status = 11 // 更新为已完成状态 1300 + transaction_id: order.transaction_id || ''
1300 - 1301 + },
1302 + success() {
1303 + // 确认收货组件调用成功
1304 + },
1305 + fail(err) {
1301 Taro.showToast({ 1306 Taro.showToast({
1302 - title: '确认收货成功', 1307 + title: '确认收货失败',
1303 - icon: 'success', 1308 + icon: 'error',
1304 duration: 2000 1309 duration: 2000
1305 }) 1310 })
1311 + },
1312 + complete() {
1313 + receivingOrderId.value = ''
1306 } 1314 }
1315 + });
1316 + } else {
1317 + // 引导用户升级微信版本
1318 + Taro.showModal({
1319 + title: '提示',
1320 + content: '当前微信版本过低,请升级微信版本后重试',
1321 + showCancel: false
1322 + })
1307 } 1323 }
1308 } catch (error) { 1324 } catch (error) {
1309 Taro.showToast({ 1325 Taro.showToast({
......