Authored by QC-L

修复倒计时结束后,内容展示不正确的问题

... ... @@ -30,7 +30,7 @@
"list": []
},
"miniprogram": {
"current": 13,
"current": 12,
"list": [
{
"id": -1,
... ... @@ -108,7 +108,7 @@
"id": 12,
"name": "商品详情线下店",
"pathName": "pages/productDetail/index",
"query": "q=https%3A%2F%2Fo.yohobuy.com%2Fufo%3Fp%3D6096%2C70%26skup%3D6096",
"query": "q=https%3a%2f%2fo.yohobuy.com%2fufo%3fp%3d6284%2c70%26skup%3d6284%26skn%3d10001240",
"scene": "1011"
},
{
... ...
... ... @@ -7,7 +7,9 @@ const BUY_AGAIN = 'buy_again';
const NOW_BUY = 'now_buy';
const SHOW_DETAIL = 'show_detail';
const SHOW_EXPRESS = 'show_express';
import event from '../../utils/event'
import event from '../../utils/event';
let interval;
Component({
/**
... ... @@ -53,27 +55,28 @@ attached: function () {
let leftTime = that.data.lefttime;
let timer = that.data.timer;
if(timer > 0){
let interval = setInterval(() => {
if (timer > 0){
interval = setInterval(() => {
timer = timer - 1;
leftTime = formatTimeByMin(timer, 'm:s');
leftTime = formatTimeByMin(timer, 'm:s');
if (timer <= 0) {
leftTime = '00:00'
event.emit('refresh-order');
leftTime = '00:00';
setTimeout(() => {
event.emit('refresh-order');
}, 2000);
clearInterval(interval);
}
that.setData({
lefttime: leftTime,
timer: timer
});
}, 1000);
that.setData({ interval: interval});
}
}
},
detached: function () {
let interval = this.interval;
if (interval){
clearInterval(interval);
}
... ...
... ... @@ -8,7 +8,7 @@ import router from '../../router/index.js'
const BUY_AGAIN = 'buy_again';
const NOW_BUY = 'now_buy';
const SHOW_EXPRESS = 'show_express';
var interval;
let interval;
Page({
/**
... ... @@ -61,7 +61,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
if(interval){
if (interval) {
clearInterval(interval);
}
... ... @@ -112,20 +112,28 @@ Page({
if (data.statusDetail && data.statusDetail.leftTime){
let leftTime = data.statusDetail.leftTime;
// let leftTime = 30;
let timer = that.data.timer;
if (leftTime > 0){
interval = setInterval(() => {
leftTime = leftTime - 1;
timer = formatTimeByMin(leftTime, 'm:s');
if (timer <= 0) {
timer = '00:00'
this.fetchOrderDetail(code);
if (leftTime <= 0) {
timer = '00:00';
setTimeout(() => {
that.fetchOrderDetail(code);
}, 2000);
clearInterval(interval);
}
that.setData({
timer: timer,
});
}, 1000);
}
} else {
that.setData({
timer: null,
});
}
})
... ...
... ... @@ -58,10 +58,10 @@ Page({
});
event.one('refresh-order', () => {
// console.log("======refresh-order")
debugger
let currentType = that.data.activeIndex + 2;
this.fetchOrderList(currentType,1);
console.log('currentType: ', currentType);
this.fetchOrderList(currentType, 1);
});
},
bindChange: function (e) {
... ... @@ -156,6 +156,7 @@ Page({
this.data.api.getOrderListInfo(params, () => {
wx.hideLoading();
}).then(data => {
debugger
let products = data.data;
for (let index in products) {
let productInfo = products[index];
... ...
... ... @@ -110,7 +110,7 @@ export default class ProductDetail extends Component {
})
this.loadStoreProductInfo(queryObj.skup, storeId);
} else {
this.loadElement({id: queryObj.productId || queryObj.skn});
this.loadElement({ id: queryObj.productId || queryObj.skn });
}
}
} else {
... ...