Browse Source

修改订单模块

zhengjinyi 3 years ago
parent
commit
5bdbe2be2e
2 changed files with 41 additions and 4 deletions
  1. 15 2
      pages/seller/order/create-order.vue
  2. 26 2
      pages/user/order/create-order.vue

+ 15 - 2
pages/seller/order/create-order.vue

@@ -274,11 +274,11 @@
 						this.confirmType = 1
 						this.productParam.productCount = data.data.productCount
 						this.productParam.productId = data.data.productIds
-						this.productIds = this.postageParam.productIds = data.data.productIds
+						this.productIds =  data.data.productIds
 						this.getInitProdcutCrearOrder()
 					}else{
 						this.confirmType = 2
-						this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
+						this.productIds = this.cartParam.productIds = data.data.productIds
 						this.getInitCrearOrder()
 					}
 			},
@@ -294,6 +294,8 @@
 					this.allPrice = data.totalPrice
 					this.rechargeGoods = data.includeRecharge
 					this.clauseList = data.clauseList
+					this.postageParam.productIds = this.getProductIds(data.list)
+					this.getAddressData()
 					this.isCouponShow = true
 					if(this.couponList.length>0){
 						this.couponAmount = data.couponList[0].couponAmount
@@ -328,6 +330,17 @@
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			// 获取订单商品id列表
+			getProductIds(list){
+				const productIds = []
+				list.forEach(function(supplier){
+					supplier.cartList.forEach(function(product){
+						productIds.push(product.productId)
+					})
+				})
+				// console.log(list);
+				return productIds.join(',')
+			},
 			getFreightData(){//获取邮费信息
 				this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
 					const data = response.data

+ 26 - 2
pages/user/order/create-order.vue

@@ -213,6 +213,7 @@
 		},	
 		methods: {
 			async initStorage(option){
+				console.log(option)
 				const data = JSON.parse(option.data)
 				const userInfo = await this.$api.getStorage()
 				console.log('infodata',data)
@@ -223,12 +224,14 @@
 					this.confirmParam.cartType = 2 
 					this.productParam.productCount = data.data.productCount
 					this.productParam.productId = data.data.productIds
-					this.productIds = this.postageParam.productIds = data.data.productIds
+					// this.productIds = this.postageParam.productIds = data.data.productIds
+					this.productIds = data.data.productIds
 					this.GetProductCreateOrderInfo()
 				}else{
 					this.confirmParam.cartType = 1
 					this.confirmType = 2
-					this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
+					// this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
+					this.productIds = this.cartParam.productIds = data.data.productIds
 					this.CartCreateOrderInfo()
 				}
 			},
@@ -250,6 +253,8 @@
 					}
 					this.orderShouldPayFee = this.allPrice - this.couponAmount
 					this.totalDiscountAmount = this.reducedPrice + this.couponAmount
+					this.postageParam.productIds = this.getProductIds(data.list)
+					this.getAddressData()
 				})
 				.catch(error =>{
 					this.$util.msg(error.msg,2000)
@@ -259,6 +264,7 @@
 				this.OrderService.CartCreateOrderInfo(this.cartParam).then(response =>{
 					let data = response.data
 					this.isRequest = true
+					debugger
 					this.goodsData = data.list
 					this.couponList = data.couponList
 					this.userMoney = data.userMoney
@@ -273,11 +279,25 @@
 					}
 					this.orderShouldPayFee = this.allPrice - this.couponAmount
 					this.totalDiscountAmount = this.reducedPrice + this.couponAmount
+					this.postageParam.productIds = this.getProductIds(data.list)
+					this.getAddressData()
 				})
 				.catch(error =>{
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			// 获取订单商品id列表
+			getProductIds(list){
+				const productIds = []
+				list.forEach(function(supplier){
+					supplier.cartList.forEach(function(product){
+						productIds.push(product.productId)
+					})
+				})
+				// console.log(list);
+				return productIds.join(',')
+			},
+			
 			getFreightData(){// 获取邮费信息
 				this.isFreight = false
 				this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
@@ -359,6 +379,7 @@
 			},
 			hanldFreightBeans(data){//是否勾选采美豆抵扣
 				this.isCheckedBeans = data
+				console.log(this.confirmParam.payInfo)
 				if(this.isCheckedBeans){
 					// 判断如果采美豆大于等于运费*100
 					if( this.freightData.userBeans > 0 ){
@@ -537,6 +558,9 @@
 					}
 				}).catch(error =>{
 					this.isSubLoading = false
+					this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
+					this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
+					this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
 					this.$util.msg(error.msg,3000)
 				})
 			},