Просмотр исходного кода

[限时抢购,券详情][修改]:[限时抢购和券的详情倒计时的修改]

tags/富茂链客4.1.0
meo 6 лет назад
Родитель
Сommit
ecbb193db7
5 измененных файлов: 23 добавлений и 50 удалений
  1. +1
    -1
      ext.json
  2. +18
    -43
      pages/coupon/detail/index.js
  3. +2
    -2
      pages/coupon/detail/index.wxml
  4. +0
    -2
      pages/rushToBuy/index.js
  5. +2
    -2
      pages/rushToBuy/index.wxml

+ 1
- 1
ext.json Просмотреть файл

@@ -4,7 +4,7 @@
"ext": {
"weappId": "wxea71200db93d756b",
"name": "富茂客官开发",
"appVersion": "C.3.5.6",
"appVersion": "C.3.5.8",
"attr": {
"ifHaveCarModular": "1",
"etcpversion": "release",


+ 18
- 43
pages/coupon/detail/index.js Просмотреть файл

@@ -39,7 +39,6 @@ Page({
result: [],
end_time: null,
checked: false,
clock: "已经截止",
questionnaire: {},
questionId: null,
widthScreen: null,
@@ -60,7 +59,7 @@ Page({
statusText: '',
isReceived: false,
receivedDisabled: false,
clock: "00",
clock: "结束",
day: "00",
hour: "00",
min: "00",
@@ -300,6 +299,7 @@ Page({
var total_micro_second = EndTime - NowTime || [];
// 渲染倒计时时钟
let obj = that.dateformat(total_micro_second);
console.log(total_micro_second)
if (total_micro_second > 0) {
that.setData({
clock: obj,
@@ -316,41 +316,12 @@ Page({
min: "00",
sec: "00",
})
that.getDetail(that.data.couponChannelId);
//如果倒计时结束,需要重新查询一下券的状态
// 给getDetail一个标识
that.getDetail(that.data.couponChannelId,'endclock');
}
total_micro_second -= 1000;
},
// countdown02(end_time) {
// let that = this;
// var EndTime = end_time;
// var NowTime = new Date().getTime();
// var total_micro_second = EndTime - NowTime || [];
// // 渲染倒计时时钟
// let obj = that.dateformat(total_micro_second);
// if (total_micro_second > 0) {
// that.setData({
// clock02: obj,
// day02: obj.a1,
// hour02: obj.b1,
// min02: obj.c1,
// sec02: obj.d1,
// })
// } else {
// that.setData({
// clock02: "00",
// day02: "0",
// hour02: "00",
// min02: "00",
// sec02: "00",
// showbutton1: false
// })
// }
// console.log(that.data.showbutton1)
// setTimeout(function() {
// total_micro_second -= 1000;
// that.countdown02(end_time);
// }, 1000)
// },
countdown: function(end_time) {
let that = this;
that.setIntervalTime(end_time);
@@ -387,7 +358,7 @@ Page({
wx.showLoading({
title: "加载中..."
});
that.getDetail(options.couponChannelId);
that.getDetail(options.couponChannelId,'notendclock');
/**
* 转赠判断
*/
@@ -408,7 +379,7 @@ Page({
})
}
},
getDetail: function(couponChannelId) {
getDetail: function (couponChannelId, flag) {
let that = this;
var parmer = {
url: config.api.couponDetail,
@@ -438,19 +409,19 @@ Page({
showbutton1: true
})
}
//如果是砍价券
// if (res.data.type == 8) {
// that.countdown02(res.data.validStartDate);
// }
console.log(flag);
if (res.data.endTime && res.data.beginTime) {
//activityStatus==0 活动未开始
//activityStatus==1 活动已开始
if (res.data.activityStatus == 0) {
// flag == endclock 说明倒计时已经结束
if (res.data.activityStatus == 0 && flag != 'endclock') {
that.countdown(res.data.beginTime);
} else {
} else if (res.data.activityStatus != 0 && flag != 'endclock'){
that.countdown(res.data.endTime);
}else{
clearInterval(that.data.setInterval)
}
//当前时间与优惠券下架时间做计算
if (res.data.activityStatus == 0) {
var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss");
if (util.timechuo(beginTime).indexOf('-') == 0) {
@@ -833,6 +804,10 @@ Page({
showbutton1:false
})
},
onUnload:function(){
let that = this;
clearInterval(that.data.setInterval)
},
onShareAppMessage: function(options) {
var that = this;
var shareObj = {


+ 2
- 2
pages/coupon/detail/index.wxml Просмотреть файл

@@ -17,10 +17,10 @@
<text class="qiang" wx:if="{{data.activityStatus!=0}}">距结束 :</text>
<text class="qiang" wx:if="{{data.activityStatus==0}}">距开始 :</text>
</view>
<view wx:if="{{clock=='已经截止'||data.remainInventory==0||data.status==1}}" class='times'>
<view wx:if="{{clock=='00'||data.status==1}}" class='times'>
已经结束
</view>
<view wx:if="{{clock!='已经截止'&&data.remainInventory!=0}}" class='times'>
<view wx:if="{{clock!='00'}}" class='times'>
<view style="display:inline-block;" wx:if="{{day!=0}}">
<text>{{day}}</text>天:
</view>


+ 0
- 2
pages/rushToBuy/index.js Просмотреть файл

@@ -71,7 +71,6 @@ Page({
for (let i = 0; i < that.data.list.length; i++) {
var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dd hh:mm:ss");
var beginTimes = util.formatTime(that.data.list[i].beginTime, "yyyy-MM-dd hh:mm:ss");
console.log(that.data.list[i].activityStatus)
var alsell = Math.floor((that.data.list[i].inventory - (that.data.list[i].remainInventory))/(that.data.list[i].inventory)*100);
/**
* 修改list的endtime
@@ -82,7 +81,6 @@ Page({
var flags = 'list[' + i + '].flags';
var alsells = 'list[' + i + '].alsells';
//活动未开始
console.log(beginTime)
if (that.data.list[i].activityStatus==0){
if (util.timechuo(beginTime).indexOf('-') == 0) {
that.setData({


+ 2
- 2
pages/rushToBuy/index.wxml Просмотреть файл

@@ -20,9 +20,9 @@
<view class='flashSaleItemBottom'>
<view class='flashSaleItemBottomTop'>
<text class='remainingTime' wx:if="{{item.activityStatus==1}}">距结束:</text>
<text class='remainingTime' wx:if="{{item.activityStatus==0}}">距开始还有:</text>
<text class='remainingTime' wx:if="{{item.activityStatus==0}}">距开始:</text>
<text wx:if="{{item.flags=='end'&&item.activityStatus==2}}" class='realRemainingTime'>活动已结束</text>
<text wx:if="{{item.flags!='end'&&item.activityStatus==1}}" class='realRemainingTime'>{{item.endtime}}</text> {{beginTime}}
<text wx:if="{{item.flags!='end'&&item.activityStatus==1}}" class='realRemainingTime'>{{item.endtime}}</text>
<text wx:if="{{item.flags!='end'&&item.activityStatus==0}}" class='realRemainingTime'>{{item.beginTime}}</text>
</view>
<view class='flashSaleItemBottomBottm'>


Загрузка…
Отмена
Сохранить