From f8867b8df117d1ac0f1311970994e15059c3da03 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期四, 05 九月 2024 15:57:36 +0800
Subject: [PATCH] add 兼容扫码问题

---
 pages/order/order-detail.vue |  179 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 115 insertions(+), 64 deletions(-)

diff --git a/pages/order/order-detail.vue b/pages/order/order-detail.vue
index 89a2f95..4ff01fd 100644
--- a/pages/order/order-detail.vue
+++ b/pages/order/order-detail.vue
@@ -149,18 +149,64 @@
 					break
 					case 'confirm': {
 						await this.$message.confirm('是否确定收货')
-						// 发送请求
-						this.$message.showLoading()
-						const {
-							code
-						} = await this.$http.request('get', '/api/customer/order/receive/confirm', {
-							params: {
-								id: this.id,
+
+						var tryCallWx = false
+						// #ifdef MP
+						let tmp = this
+						if (wx.openBusinessView && tmp.dto && tmp.dto.paymentTrId) {
+							tryCallWx = true
+							wx.openBusinessView({
+								businessType: 'weappOrderConfirm',
+								extraData: {
+									// merchant_id: '',
+									// merchant_trade_no: '',
+									transaction_id: tmp.dto && tmp.dto.paymentTrId || ''
+								},
+								async success() {
+									//dosomething
+									// 发送请求
+									tmp.$message.showLoading()
+									const {
+										code
+									} = await tmp.$http.request('get',
+										'/api/customer/order/receive/confirm', {
+											params: {
+												id: tmp.id,
+											}
+										})
+									tmp.$message.hideLoading()
+									if (code === 0) {
+										tmp.getDetail()
+									}
+								},
+								fail(e) {
+									//dosomething
+									console.log('error fail', e)
+									tmp.$message.showToast('收货失败')
+								},
+								complete() {
+									//dosomething
+								}
+							});
+						}
+
+						// #endif
+
+						if (!tryCallWx) {
+
+							// 发送请求
+							this.$message.showLoading()
+							const {
+								code
+							} = await this.$http.request('get', '/api/customer/order/receive/confirm', {
+								params: {
+									id: this.id,
+								}
+							})
+							this.$message.hideLoading()
+							if (code === 0) {
+								this.getDetail()
 							}
-						})
-						this.$message.hideLoading()
-						if (code === 0) {
-							this.getDetail()
 						}
 
 					}
@@ -177,6 +223,7 @@
 								id: this.id,
 							}
 						})
+						
 						this.$message.hideLoading()
 						if (code === 0) {
 							//微信接口
@@ -185,10 +232,8 @@
 								...data,
 								async success(res) {
 									console.log('pay success', res)
-									that.$message.showToast('支付成功')
-									setTimeout(() => {
-										that.getDetail()
-									}, 200)
+									await that.$message.showToast('支付成功')
+									that.getDetail()
 								},
 								fail(err) {
 									console.error('pay fail', err)
@@ -349,12 +394,13 @@
 				})
 				this.$message.hideLoading()
 				if (code == 0) {
-					this.$message.showToast('提交成功')
-					this.showSales = false
-					this.$forceUpdate()
-					setTimeout(() => {
-						uni.navigateBack()
-					}, 1200)
+					await this.$message.showToast('提交成功')
+					uni.navigateBack()
+					// this.showSales = false
+					// this.$forceUpdate()
+					// setTimeout(() => {
+						// uni.navigateBack()
+					// }, 1200)
 				}
 			},
 		},
@@ -389,59 +435,64 @@
 				</view>
 			</view>
 		</view>
-		<view class="flower-info m-b-20 m-t-12 br-4" v-for="(item,index) of list" :key="index">
-			<view class="supplier-name ">
-				<image class="icon-dp" src="/static/common/icon-dp.png"></image>
-				{{ item.supplierName || ''}}
-			</view>
-			<view class="flex m-t-12">
-				<radio v-if="showSales" disabled :checked="submitForm.orderItemId == item.id"></radio>
-				<!-- @click="changeSalesOrderItem(item)" -->
-				<!-- :checked="submitForm.orderItems.indexOf(item.id)>=0" -->
+		<view v-for="(item,index) of list" :key="index">
+			<view class="flower-info m-b-20 m-t-12 br-4" v-if="!showSales||showSales&&(submitForm.orderItemId == item.id)">
+				<view class="supplier-name ">
+					<image class="icon-dp" src="/static/common/icon-dp.png"></image>
+					{{ item.supplierName || ''}}
+				</view>
+				<!-- submitForm.orderItemId:{{submitForm.orderItemId}} -->
+				<!-- itemId:{{item.id}} -->
+				<view class="flex m-t-12">
+					<!-- <radio v-if="showSales" disabled :checked="submitForm.orderItemId == item.id"></radio> -->
+					<!-- @click="changeSalesOrderItem(item)" -->
+					<!-- :checked="submitForm.orderItems.indexOf(item.id)>=0" -->
 
-				<image class="flower-img img100 br-4 m-r-6" :src="item.flowerCover"
-					@click="previewImg(item.flowerCover)">
-				</image>
-				<view class="flex1">
-					<view class=" flex">
-						<view class="title"><span class="level">{{ item.flowerCategory || ''}}</span><span
-								class="level">{{ item.flowerLevelStr || ''}}</span>{{ item.flowerName || ''}}
-						</view>
-					</view>
-					<view class="each-list">
-						<view class="each-item">
-							<view class="label">货位号</view>
-							<view class="value">{{ item.warehouseLocationCode || dto.warehouseLocationCode  || '-' }}
+					<image class="flower-img img100 br-4 m-r-6" :src="item.flowerCover"
+						@click="previewImg(item.flowerCover)">
+					</image>
+					<view class="flex1">
+						<view class=" flex">
+							<view class="title"><span class="level">{{ item.flowerCategory || ''}}</span><span
+									class="level">{{ item.flowerLevelStr || ''}}</span>{{ item.flowerName || ''}}
 							</view>
 						</view>
+						<view class="each-list">
+							<view class="each-item">
+								<view class="label">货位号</view>
+								<view class="value">
+									{{ item.warehouseLocationCode || dto.warehouseLocationCode  || '-' }}
+								</view>
+							</view>
 
-						<view class="each-item">
-							<view class="label">颜色</view>
-							<view class="value">{{ item.flowerColor || '-' }}</view>
+							<view class="each-item">
+								<view class="label">颜色</view>
+								<view class="value">{{ item.flowerColor || '-' }}</view>
 
-						</view>
-						<view class="each-item">
-							<view class="label">规格</view>
-							<view class="value">{{ item.flowerUnit || '-' }}</view>
-						</view>
+							</view>
+							<view class="each-item">
+								<view class="label">规格</view>
+								<view class="value">{{ item.flowerUnit || '-' }}</view>
+							</view>
 
-						<view class="each-item">
-							<view class="label">数量</view>
-							<view class="value">{{ item.num || 0 }}</view>
+							<view class="each-item">
+								<view class="label">数量</view>
+								<view class="value">{{ item.num || 0 }}</view>
 
-						</view>
-						<view class="each-item">
-							<view class="label">售价</view>
-							<view class="value">¥{{ item.price || '-' }}</view>
-						</view>
-						<view class="each-item">
-							<view class="label">总金额</view>
-							<view class="value t-red">¥{{ item.total || '-' }}</view>
+							</view>
+							<view class="each-item">
+								<view class="label">售价</view>
+								<view class="value">¥{{ item.price || '-' }}</view>
+							</view>
+							<view class="each-item">
+								<view class="label">总金额</view>
+								<view class="value t-red">¥{{ item.total || '-' }}</view>
+							</view>
 						</view>
 					</view>
 				</view>
-			</view>
 
+			</view>
 		</view>
 		<view class="info-container bg-white br-4" v-if="!showSales">
 			<view class="form-item">
@@ -612,7 +663,7 @@
 			</view>
 			<!-- ||dto.status=='COMPLETED' -->
 			<!-- 在外面申请了,里面不允许了 -->
-		<!-- 	<view class="button button-1" @click="buttonClick('sales')" v-if=" dto.status === 'RECEIVE'"> 申请售后
+			<!-- 	<view class="button button-1" @click="buttonClick('sales')" v-if=" dto.status === 'RECEIVE'"> 申请售后
 			</view> -->
 		</view>
 		<view v-if="showSales">

--
Gitblit v1.9.3