|
@@ -13,8 +13,8 @@
|
|
|
<view class="product-area">
|
|
<view class="product-area">
|
|
|
<view class="first-area">
|
|
<view class="first-area">
|
|
|
<text class="name">{{res.name}}</text>
|
|
<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>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -36,8 +36,7 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
flowersItemInfo:'',
|
|
flowersItemInfo:'',
|
|
|
flowersList:[],
|
|
flowersList:[],
|
|
|
- productList:[],
|
|
|
|
|
- costChangeIds:[]
|
|
|
|
|
|
|
+ productList:[]
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onShow(){
|
|
onShow(){
|
|
@@ -50,18 +49,11 @@ export default {
|
|
|
uni.removeStorageSync('flowersItemInfo');
|
|
uni.removeStorageSync('flowersItemInfo');
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
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(){
|
|
getList(){
|
|
|
let productIdArr = '';
|
|
let productIdArr = '';
|
|
@@ -70,24 +62,31 @@ export default {
|
|
|
getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
|
|
getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
|
|
|
that.flowersList = res.data.list;
|
|
that.flowersList = res.data.list;
|
|
|
that.productList = [];
|
|
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 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)=>{
|
|
let arr = this.productList.map((ele)=>{
|
|
|
if(ele.id == id){
|
|
if(ele.id == id){
|
|
|
- return {id:id,price:price}
|
|
|
|
|
|
|
+ return {id:id,price:price,skPrice:skPrice}
|
|
|
}
|
|
}
|
|
|
return ele
|
|
return ele
|
|
|
})
|
|
})
|