m 1 жил өмнө
parent
commit
f6b6e447c9

+ 99 - 8
src/packagePrize/prize/index.vue

@@ -221,6 +221,7 @@
 <script>
 	import env from '../../config/env.js'
 	import $http from '@/utils/request.js'
+	import appId from '@/config/appId.js'
 	import skuPopup from '../components/sku-popup/sku-popup.vue'
 	export default {
 		components: {
@@ -229,6 +230,12 @@
 		data() {
 			return {
 				status: 'nomore',//上拉刷新状态
+				ids: [],
+				info: {},
+				addr: {},
+				list: [],
+				loading: false,
+				addrId: '',
 				loading: false,
 				drawLoading: false,
 				stateArr: [{
@@ -495,11 +502,11 @@
 			// 立即提货
 			toSettlement() {
 				let arr = []
-        this.list.forEach(item => {
-          if (item.checked) {
-            arr.push(item)
-          }
-        })
+				this.list.forEach(item => {
+				  if (item.checked) {
+					arr.push(item)
+				  }
+				})
         if (!arr.length) {
           uni.$u.toast('请选择商品');
           return
@@ -561,11 +568,95 @@
 				// uni.navigateTo({
 				// 	url: `/packageGoods/order/settlement?ids=${ ids }`
 				// }) 
-				uni.navigateTo({
-					url: `/packageGoods/order/settlement?ids=${ ids }&goodsType=${ goodsType }`
+				// uni.navigateTo({
+				// 	url: `/packageGoods/order/settlement?ids=${ ids }&goodsType=${ goodsType }`
+				// })
+				if(goodsType==2){//卡密商品
+					this.getDetail(ids);
+				}else{
+					uni.navigateTo({
+						url: `/packageGoods/order/settlement?ids=${ ids }&goodsType=${ goodsType }`
+					})
+				}
+				
+			},
+			getDetail(ids) {
+				uni.showLoading({
+					title: '加载中'
+				});
+				let data = {
+					ids: JSON.parse(ids),
+					appSource:appId
+				}
+				// if(this.payment != ""){
+				// 	data = this.payment
+				// }
+				// data.appSource = appId;
+				$http.post('/api/v1/mp/user/deliver/order/settle', data ).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.info = res.data
+						this.addr = res.data.addr
+						res.data.prizeList.forEach(item => {
+							let picUrlArr = item.picUrl.split(',')
+							item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
+						})
+						this.list = res.data.prizeList;
+						this.save();
+					}
+				}).catch(() => {
+					uni.hideLoading();
 				})
 			},
-
+            save() { 
+            	let _this = this
+            	let payIng = false
+            	if (payIng) return
+            	uni.showLoading({
+            		title: '加载中'
+            	});
+            	$http.post('/api/v1/mp/user/deliver/order/submit', { 
+            		goodsType:2
+            	}).then(res => {
+            		payIng = true
+					console.log("deliver/order/submit");
+					console.log(res);
+            		uni.hideLoading();
+            		if (res.code == 0) {
+						
+            			if (res.data.needPay == 0) {
+							uni.showToast({
+								title: '提交成功',
+								icon: 'success',
+								duration: 2000
+							})
+							let orderId = res.data.orderId;
+							//跳转订单详情
+							// if(orderId){
+							// 	setTimeout(() => { 
+							// 		uni.navigateTo({
+							// 		  url: `/packageGoods/order/detail?id=${orderId}`
+							// 		})
+							// 	}, 500)
+							// }
+							//跳转订单列表
+							setTimeout(() => {
+								uni.redirectTo({
+									url: `/packageGoods/order/index`
+								})
+							}, 500)
+						}
+            			
+            		} else {
+            			payIng = false
+            			uni.$u.toast(res.msg);
+            		}
+            	}).catch(() => {
+            		payIng = false
+            		uni.$u.toast('订单创建失败');
+            		uni.hideLoading();
+            	})
+            },
 			couponNum() {
 				$http.post(`/api/v1/mp/user/mine/prize/list?pageNum=1&pageSize=20`, {