소스 검색

退款 支付修改

wcni 5 년 전
부모
커밋
bc5a2bf0b0
3개의 변경된 파일42개의 추가작업 그리고 20개의 파일을 삭제
  1. 23 9
      pages/index/shop.vue
  2. 3 3
      pages/myOrder/order.vue
  3. 16 8
      pages/myOrder/paymoment.vue

+ 23 - 9
pages/index/shop.vue

@@ -117,10 +117,11 @@
  					<view class="right">
  						<text class="price" style="font-size: 36upx;color: #303133">¥{{totalprice==0?datalist.goods_price:totalprice}}</text>
 						<view v-if="datalist.spec_list.length > 0 ">
-							<view class="selected" v-if="specSelected.length > 0 ">
-								<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">
-									{{sItem.value_name}}X {{shopnumber}}
+							<view class="selected" v-if="chosename.length > 0 ">
+								<text class="selected-text" v-for="(sItem, sIndex) in chosename" :key="sIndex">
+									{{sItem.value_name}}
 								</text>
+								X {{shopnumber}}
 							</view>
 							<view class="selected" v-else>
 								<text class="selected-text">
@@ -144,7 +145,7 @@
  							v-for="(childItem, childIndex) in item.value_list" 
  							:key="childIndex" class="tit"
  							:class="{selected: childItem.selected, disabled: childItem.goods_storage==0}"
- 							@click="selectSpec(index, childItem.value_id, childItem.value_name, childItem.goods_storage)"
+ 							@click="selectSpec(index, childItem.value_id, childItem, item,childItem.goods_storage)"
  						>
  							{{childItem.value_name}}
  						</text>
@@ -203,6 +204,7 @@
  		data() {
  			return {
 				isTop: false,
+				chosename: [],
 				arrayId:[],
 				bottomtop: '55upx',
 				scopemapId: 0,
@@ -506,11 +508,19 @@
 				this.specClass = 'none';
 			},
  			//选择规格
- 			selectSpec(index, pid,value_name,goods_storage){
+ 			selectSpec(index, pid,chose,first,goods_storage){
 				if(goods_storage == 0) {
 					this.$msg("商品没库存啦");
 					return;
 				}
+				
+				let obj = {};
+				obj.spec_id = first.spec_id;
+				obj.value_name = chose.value_name;
+				if(this.datalist.spec_list.length == this.chosename.length) {
+				}else {
+					this.chosename.push(obj);
+				}
 				this.specSelected = []; 
  				let list = this.datalist.spec_list[index].value_list;
  				this.datalist.spec_list[index].value_list.forEach(item=>{
@@ -520,9 +530,13 @@
 						this.$set(item, 'selected', false);
 					}
  				})
-				if(goods_storage == 0) {
-					this.$msg("商品没库存啦")
-				}
+				this.chosename.forEach(items => {
+					if(items.spec_id == first.spec_id) {
+						items.value_name = chose.value_name
+					};
+				
+				})
+				
 				let array = [];	
 			    for(let i = 0; i < this.datalist.spec_list.length; i++) {
 					for(let j = 0; j<this.datalist.spec_list[i].value_list.length;j++) {
@@ -536,7 +550,7 @@
 					this.scopemapId = array.join("_");
 					let goodId = this.datalist.spec_map[this.scopemapId]; //
 					let items = this.datalist.goods_list[goodId]
-					items.value_name = value_name;
+					items.value_name = chose.value_name;
 					this.nuberImg = items.spec_img;
 					this.specSelected.push(items)
 					this.goods_storage = items.goods_storage;

+ 3 - 3
pages/myOrder/order.vue

@@ -212,11 +212,11 @@
 				this.orderCancel = true;
 			},
 			cancelDialog() {
+				this.orderCancel = false;
 				this.isreturn = false;
 				this.isCancel = false;
 				this.isDelete = false;
 				this.isGet = false;
-				this.orderCancel = false;
 			},
 			confirmOrder() {
 				let url = '';
@@ -249,13 +249,13 @@
 						}else if(this.isreturn) {
 							this.$msg("退款成功");
 						}
+						uni.$emit("refehlist");
 						if(this.isreturn) {
 							this.getDetail();
 						}else {
 							setTimeout(()=> {
-								uni.$emit("refehlist");
 								uni.navigateBack();
-							}, 2000)
+							}, 1000)
 						}
 						
 						

+ 16 - 8
pages/myOrder/paymoment.vue

@@ -104,6 +104,9 @@
 			// 圈币确定支付
 			confirmOrder() {
 				this.orderCancel = false;
+				uni.showLoading({
+					title: '支付中'  
+				}); 
 				this.request({
 					url:'/v1/payment/pay',
 					method:'POST',
@@ -113,14 +116,12 @@
 					},
 					success: (res) => {
 						if(res.data.code == 1000) {
-							setTimeout(()=> {
 								let isform = this.isform;
 								let store_id = this.store_id;
 								uni.redirectTo({
 									url: `/pages/myOrder/finsh?isform=${isform}&order_id=${this.order_id}&store_id=${store_id}`
 								})
 								//uni.navigateBack()
-							}, 1000)
 						}
 						
 					}
@@ -132,6 +133,7 @@
 			payMoney() {
 				if(this.radio == 0) {
 					// 微信支付
+					 
 					this.request({
 						url:'/v1/payment/pay',
 						method: 'post',
@@ -142,6 +144,9 @@
 						},
 						success:(res) => {
 							let { wx } = res.data.data;
+							// uni.showLoading({
+							// 	title: '支付中'  
+							// });
 							uni.requestPayment({
 								    provider: 'wxpay',
 								    timeStamp: wx.timeStamp,
@@ -149,19 +154,22 @@
 								    package:  wx.package,
 								    signType: 'MD5',
 								    paySign: wx.paySign,
+									
 								    success:  (res) => {
+										console.log("成功")
 										let isform = this.isform;
 										let order_id = this.order_id;
+										let store_id =  this.store_id;
 										uni.redirectTo({
 											url: `/pages/myOrder/finsh?isform=${isform}&order_id=${order_id}&store_id=${store_id}`
 										})
 								    },
-								    fail: (err) => {
-										let order_id = this.order_id ;
-										uni.redirectTo({
-										        url: `/pages/myOrder/order?id=${order_id}`
-										});
-								    }
+								  //   fail: (err) => {
+										// let order_id = this.order_id ;
+										// uni.redirectTo({
+										//         url: `/pages/myOrder/order?id=${order_id}`
+										// });
+								  //   }
 							})
 						},
 						fail:(res) => {