shish há 4 anos atrás
pai
commit
c6892e0fb7
1 ficheiros alterados com 25 adições e 26 exclusões
  1. 25 26
      ghsApp/src/pagesPurchase/components/pageSuccess.vue

+ 25 - 26
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -13,8 +13,8 @@
 							<view class="product-area">
 								<view class="first-area">
 									<text class="name">{{res.name}}</text>
-									<input type="digit" v-model="res.hdPrice" placeholder="花店价" @focus="priceFocus(i,res)" @input="modifyPrice(res)" />
-									<input type="digit" v-model="res.skPrice" placeholder="散客价" />
+									<input type="digit" v-model="res.autoPrice" placeholder="花店价" @focus="priceFocus(i)" @input="modifyPrice(i,res)" />
+									<input type="digit" v-model="res.autoSkPrice" placeholder="散客价" @focus="skPriceFocus(i)" @input="modifySkPrice(res)" />
 								</view>
 							</view>
 						</view>
@@ -36,8 +36,7 @@ export default {
 		return {
 			flowersItemInfo:'',
 			flowersList:[],
-			productList:[],
-			costChangeIds:[]
+			productList:[]
 		};
 	},
 	onShow(){
@@ -50,18 +49,11 @@ export default {
 		uni.removeStorageSync('flowersItemInfo');
 	},
 	methods: {
-		checkboxChange(e) {
-			this.costChangeIds = e.detail.value
+		priceFocus(i){
+			this.flowersList[i].autoPrice = ''
 		},
-		priceFocus(i,res){
-			this.flowersList[i].hdPrice = ''
-			let id = res.id
-			if(parseFloat(res.hdPrice)==parseFloat(Number(res.addPrice)+Number(res.cost)) || parseFloat(Number(res.hdPrice)-Number(res.cost)) < 0){
-				let i = this.costChangeIds.indexOf(id)
-				if(i > -1){
-					this.costChangeIds.splice(i,1)
-				}
-			}
+		skPriceFocus(i){
+			this.flowersList[i].autoSkPrice = ''
 		},
 		getList(){
 			let productIdArr = '';
@@ -70,24 +62,31 @@ export default {
 			getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
 				that.flowersList = res.data.list;
 				that.productList = [];
-				that.flowersList.forEach(function(item,index,arr){
-					that.productList.push({id:item.id,price:item.hdPrice})
+				that.flowersList.forEach(function(item){
+					that.productList.push({id:item.id,price:item.autoPrice,skPrice:item.skPrice,skMore:item.skMore})
 				})
 			});
 		},
-		modifyPrice(res){
+		modifyPrice(i,res){
 			let id = res.id
-			let price = res.hdPrice
-
-			if(parseFloat(res.hdPrice)==parseFloat(Number(res.addPrice)+Number(res.cost)) || parseFloat(Number(res.hdPrice)-Number(res.cost)) < 0){
-				let i = this.costChangeIds.indexOf(id)
-				if(i > -1){
-					this.costChangeIds.splice(i,1)
+			let price = res.autoPrice
+			let skPrice = res.autoSkPrice
+			let skMore = res.skMore
+			let arr = this.productList.map((ele)=>{
+				if(ele.id == id){
+					return {id:id,price:price,skPrice:skPrice,skMore:skMore}
 				}
-			}
+				return ele
+			})
+			this.productList = arr
+		},
+		modifySkPrice(res){
+			let id = res.id
+			let price = res.autoPrice
+			let skPrice = res.autoSkPrice
 			let arr = this.productList.map((ele)=>{
 				if(ele.id == id){
-					return {id:id,price:price}
+					return {id:id,price:price,skPrice:skPrice}
 				}
 				return ele
 			})