liujiaxin 3 недель назад
Родитель
Сommit
b284a05517
3 измененных файлов с 34 добавлено и 8 удалено
  1. 3 0
      api/storeOrder.js
  2. 10 1
      pages/shopping/paymentOrder.vue
  3. 21 7
      pages_shopping/live/paymentOrder.vue

+ 3 - 0
api/storeOrder.js

@@ -77,5 +77,8 @@ let request = new Request().http
  export function orderBindUser(data) {
  	 return request('/app/storeOrder/orderBindUser',data,'POST','application/json;charset=UTF-8');
  }  
+ export function clearPayType(data) {
+  	 return request('/app/live/liveOrder/clearPayType',data,'POST','application/json;charset=UTF-8');
+  }
  
  

+ 10 - 1
pages/shopping/paymentOrder.vue

@@ -165,7 +165,8 @@
 		editPayType,
 		pay,
 		getStoreOrderById,
-		orderBindUser
+		orderBindUser,
+		clearPayType
 	} from '@/api/storeOrder'
 	export default {
 		data() {
@@ -178,6 +179,7 @@
 				payLimitTime: null,
 				order: null,
 				user: null,
+				payParams:null
 			}
 		},
 		onLoad(option) {
@@ -192,6 +194,9 @@
 			// 	menus:["shareAppMessage"] //不设置默认发送给朋友
 			// })
 		},
+		onUnload() {
+			this.clearPayTypeFun()
+		},
 		//发送给朋友
 		// onShareAppMessage(res) {
 		// 	return {
@@ -202,6 +207,9 @@
 
 		// },
 		methods: {
+			async clearPayTypeFun() {
+				this.payParams && this.payParams.orderId && await clearPayType(this.payParams)
+			},
 			// 防抖函数
 			debounce(func, wait = 1000) {
 				return (...args) => {
@@ -328,6 +336,7 @@
 					orderId: this.orderId,
 					payType: payType
 				};
+				this.payParams = data
 				var that = this;
 				uni.showLoading();
 

+ 21 - 7
pages_shopping/live/paymentOrder.vue

@@ -16,7 +16,9 @@
 				<radio-group @change="handlePayTypeChange">
 					<view class="item">
 						<view class="left">
-							<image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/wecha_pay.png" mode=""></image>
+							<image
+								src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/wecha_pay.png"
+								mode=""></image>
 							<text class="text">微信支付</text>
 						</view>
 						<label>
@@ -26,7 +28,8 @@
 					<!-- #ifdef APP-PLUS||H5 -->
 					<view class="item">
 						<view class="left">
-							<image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/zfb.png" mode=""></image>
+							<image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/zfb.png"
+								mode=""></image>
 							<text class="text">支付宝</text>
 						</view>
 						<label>
@@ -72,6 +75,9 @@
 </template>
 
 <script>
+	import {
+		clearPayType
+	} from '@/api/storeOrder'
 	import dayjs from 'dayjs';
 	import {
 		weChatPayment
@@ -86,7 +92,7 @@
 	export default {
 		data() {
 			return {
-				type:'',
+				type: '',
 				payPrice: null,
 				newOrder: {},
 				payType: 2,
@@ -97,7 +103,8 @@
 				config: null,
 				payType: 1,
 				user: null,
-				couponUserId: null
+				couponUserId: null,
+				payParams:null
 			}
 		},
 		computed: {
@@ -133,6 +140,9 @@
 				}
 			}
 		},
+		onUnload() {
+			this.clearPayTypeFun()
+		},
 		// //发送给朋友
 		// onShareAppMessage(res) {
 		// 	const combinationOrderId = this.combinationOrderId ?
@@ -145,6 +155,9 @@
 
 		// },
 		methods: {
+			async clearPayTypeFun() {
+				this.payParams && this.payParams.orderId && await clearPayType(this.payParams)
+			},
 			weixinPayOrder() {
 				var data = {
 					orderId: this.order.orderId,
@@ -210,7 +223,7 @@
 			payOrder() {
 				if (this.type == 'win') {
 					this.toPayConfirmReward()
-					
+
 				} else {
 					if (this.payType == 1) {
 						console.log("这个order", this.order)
@@ -236,8 +249,8 @@
 				console.log('当前选中:', this.payType);
 			},
 			toPayConfirmReward() {
-				let data={
-					orderId:this.order.orderId
+				let data = {
+					orderId: this.order.orderId
 				}
 				payConfirmReward(data).then(
 					res => {
@@ -304,6 +317,7 @@
 					orderId: this.orderId,
 					payType: payType
 				};
+				this.payParams = data
 				var that = this;
 				uni.showLoading();
 				editPayType(data).then(