|
|
|
@ -169,9 +169,10 @@ Component({ |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
leftIndex = (leftIndex-1)>=0?(leftIndex-1):0; |
|
|
|
this.setData({ |
|
|
|
scrollLeft: 70*leftIndex |
|
|
|
// scrollLeft: 70*leftIndex
|
|
|
|
scrollLeft: "scroll-item-"+leftIndex |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
this.changeDate(seldDate) |
|
|
|
@ -211,13 +212,16 @@ Component({ |
|
|
|
}, |
|
|
|
changeDate: function (e) { |
|
|
|
let date = e.currentTarget ? e.currentTarget.dataset.date : e |
|
|
|
let index = e.currentTarget.dataset.index; |
|
|
|
if (date.stock <= 0) return; |
|
|
|
if (date.stock == null) return; |
|
|
|
if (date.price == null) return; |
|
|
|
index = (index-1)>=0?(index-1):0; |
|
|
|
this.setData({ |
|
|
|
activeDate: date, |
|
|
|
moreFlag: true, |
|
|
|
date_price:date.price |
|
|
|
date_price:date.price, |
|
|
|
scrollLeft: "scroll-item-"+index |
|
|
|
}) |
|
|
|
this.triggerEvent("onChangeDate", this.data.activeDate) |
|
|
|
this.getTimeStock() |
|
|
|
@ -225,17 +229,20 @@ Component({ |
|
|
|
// 修改日期
|
|
|
|
onTapDay: function (e) { |
|
|
|
let threeDays = this.data.threeDays, flag = false; |
|
|
|
threeDays.map(item => { |
|
|
|
threeDays.map((item,i) => { |
|
|
|
if (item.date == e.detail.date) { |
|
|
|
flag = true |
|
|
|
} |
|
|
|
}) |
|
|
|
let index = this.data.datelist.findIndex(v=>v.date == e.detail.date) |
|
|
|
e.detail.short_date = e.detail.date.substr(5, 5); |
|
|
|
e.detail.date_price = this.data.activeDate.price; |
|
|
|
index = (index-1)>=0?(index-1):0; |
|
|
|
this.setData({ |
|
|
|
activeDate: e.detail, |
|
|
|
showMoreDateFlag: false, |
|
|
|
moreFlag: flag |
|
|
|
moreFlag: flag, |
|
|
|
scrollLeft: "scroll-item-"+index |
|
|
|
}) |
|
|
|
app.globalData.product.price = this.data.activeDate.price |
|
|
|
this.triggerEvent("onChangeDate", this.data.activeDate) |
|
|
|
|