Przeglądaj źródła

[优惠券详情页面][修改]:优惠券详情页面 剩余时间的修改

tags/2.2.4
meo 6 lat temu
rodzic
commit
196aff2f75
3 zmienionych plików z 8 dodań i 32 usunięć
  1. BIN
      assets/img/success.png
  2. +7
    -31
      pages/coupon/detail/index.js
  3. +1
    -1
      pages/coupon/detail/index.wxml

BIN
assets/img/success.png Wyświetl plik

Przed Po
Szerokość: 200  |  Wysokość: 200  |  Rozmiar: 8.3 KiB

+ 7
- 31
pages/coupon/detail/index.js Wyświetl plik

@@ -27,10 +27,6 @@ Page({
console.log("couponChannelId" + options.couponChannelId);
console.log("couponId" + options.couponId);
console.log("传的变量的名字叫couponId");
/**
* 首页banner detail couponlist传过来的值
* iambannercoupon
*/
wx.showLoading({
title: "加载中..."
});
@@ -58,31 +54,12 @@ Page({
console.log(res);
console.log("details");
//当前时间与优惠券下架时间做计算
var startTime = util.fmtDate(res.data.endTime);
console.log(startTime);
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
var runTime = runTime % (86400 * 365);
var month = Math.floor(runTime / 86400 / 30);
var runTime = runTime % (86400 * 30);
var day = Math.floor(runTime / 86400);
var runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
var runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
var runTime = runTime % 60;
var second = runTime;
console.log(year, month, day, hour, minute, second);
var endTime = util.fmtDate(res.data.endTime);
util.timechuo(endTime)
console.log(util.timechuo(endTime));
that.setData({
year: year,
month: month,
day: day,
hour: hour,
minute: minute
});
console.log(that.data.day);
endtime:util.timechuo(endTime)
})
wx.hideLoading();
that.setData({
data: res.data
@@ -235,8 +212,6 @@ Page({
complete: res => {
console.log(res);
console.log("支付完成");
// var url = res.data.url;
// console.log("get url", url);
if (res.errMsg == "requestPayment:ok") {
} else {
wx.showToast({
@@ -261,7 +236,8 @@ Page({
that.payOrderUpdate(orderId, "0", 1);
wx.showToast({
title: "领取成功",
duration: 3000
duration: 3000,
image: "./../../../assets/img/success.png",
});
}
}


+ 1
- 1
pages/coupon/detail/index.wxml Wyświetl plik

@@ -7,7 +7,7 @@
<view class='coupons_info'>
<view>
<text>{{data.title}}<text>限购{{data.useLimitQuantity}}件</text></text>
<text wx:if="{{data.endTime!=undefined}}">剩余时间:<text>{{day}}天</text><text>{{hour}}小时</text><text>{{minute}}分钟</text></text>
<text wx:if="{{data.endTime!=undefined}}">剩余时间:<text>{{endtime}}</text></text>
<text>剩余件数:<text>{{data.remainInventory}}件</text></text>
</view>
<view>


Ładowanie…
Anuluj
Zapisz