Commit a41a7a3e authored by youjie's avatar youjie

优化最低价格

parent 5eecc271
...@@ -207,18 +207,7 @@ ...@@ -207,18 +207,7 @@
} }
this.d.push(obj) this.d.push(obj)
} }
for (let i = 0; i < this.priceList.length; i++) { this.getMinPrice()
let datas = this.priceList[i].attr_name.split('-')
for (let j = 0; j < this.d.length; j++) {
let m = this.d[j].Month > 9 ? this.d[j].Month : '0' + this.d[j].Month
if (datas[1] == m) {
this.d[j].prices.push(this.priceList[i].newPrice)
}
}
}
this.d.forEach(x => {
x.minprices = Math.min.apply(null, x.prices)
})
this.activeMonth = this.d[0] this.activeMonth = this.d[0]
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
...@@ -278,9 +267,27 @@ ...@@ -278,9 +267,27 @@
}, },
priceList(newVal) { priceList(newVal) {
this.priceStauts = this.initPrice(); this.priceStauts = this.initPrice();
this.getMinPrice()
} }
}, },
methods: { methods: {
getMinPrice(){
this.d.forEach(x=>{
x.prices = []
})
for (let i = 0; i < this.priceList.length; i++) {
let datas = this.priceList[i].attr_name.split('-')
for (let j = 0; j < this.d.length; j++) {
let m = this.d[j].Month > 9 ? this.d[j].Month : '0' + this.d[j].Month
if (datas[1] == m) {
this.d[j].prices.push(this.priceList[i].newPrice)
}
}
}
this.d.forEach(x => {
x.minprices = Math.min.apply(null, x.prices)
})
},
changeHandler(i) { changeHandler(i) {
this.active = i; this.active = i;
this.$emit('getMonth') this.$emit('getMonth')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment