@@ -25,11 +25,13 @@ Page({ | |||
}); | |||
//获得优惠券的详情 | |||
if ( | |||
options.quancode != null && | |||
(options.quancode != "" && options.quancode) != undefined | |||
) { | |||
that.data.setInter = setInterval(function(){ | |||
that.data.setInter = setInterval(function() { | |||
if ( | |||
options.quancode != null && | |||
options.quancode != "" && | |||
options.quancode != undefined && | |||
options.couponorderstatus == 0 | |||
) { | |||
Http.get({ | |||
url: config.api.couponOrderDetail, | |||
data: { | |||
@@ -46,10 +48,29 @@ Page({ | |||
createDate: util.fmtDate(that.data.data.createDate) | |||
}); | |||
}); | |||
}, 200); | |||
} | |||
util.barcode("barcode", options.quancode, 510, 100); | |||
util.qrcode("qrcode", options.quancode, 350, 350); | |||
} | |||
}, 2000); | |||
// if (options.couponorderstatus != "0") { | |||
Http.get({ | |||
url: config.api.couponOrderDetail, | |||
data: { | |||
couponOrderId: options.quancode | |||
} | |||
}).then(res => { | |||
console.log(res); | |||
that.setData({ | |||
data: res.data | |||
}); | |||
that.setData({ | |||
expiredTime: util.fmtDate(that.data.data.expiredTime), | |||
updateDate: util.fmtDate(that.data.data.updateDate), | |||
createDate: util.fmtDate(that.data.data.createDate) | |||
}); | |||
util.barcode("barcode", options.quancode, 510, 100); | |||
util.qrcode("qrcode", options.quancode, 350, 350); | |||
}); | |||
// } | |||
}, | |||
phone: function() { | |||
let that = this; | |||
@@ -35,12 +35,11 @@ Page({ | |||
//点击跳转到券详情页面 | |||
gotouse: function(e) { | |||
console.log(e.currentTarget.dataset.quancode); | |||
console.log(e.currentTarget.dataset.couponorderstatus); | |||
console.log("点击跳转到券详情"); | |||
wx.navigateTo({ | |||
url: `/pages/couponorder/detail/index?quancode=${ | |||
e.currentTarget.dataset.quancode | |||
}` | |||
e.currentTarget.dataset.quancode}&couponorderstatus=${e.currentTarget.dataset.couponorderstatus}` | |||
}); | |||
}, | |||
getList(key, pageNum) { | |||
@@ -12,7 +12,7 @@ | |||
</navigator> | |||
</view> | |||
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}"> | |||
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}"> | |||
<view class='detail_msg'> | |||
<view class='logo'> | |||
<image src='{{item.coverImg}}'></image> | |||
@@ -25,8 +25,8 @@ | |||
<text class="txt1">有效期至:</text> | |||
<text class="txt2">{{item.expiredTime}}</text> | |||
</view> | |||
<view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view> | |||
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view> | |||
<view wx:if="{{item.couponOrderStatus==0}}" class="btns">立即使用</view> | |||
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -29,7 +29,7 @@ Page({ | |||
// 2 已过期 | |||
// 3 已经退款 | |||
console.log(e); | |||
if (that.data.mystatus == null || that.data.mystatus == undefined) { | |||
if (that.data.mystatus == "" || that.data.mystatus == undefined) { | |||
wx.navigateTo({ | |||
url: `/pages/orderquanma/index?quancode=${ | |||
e.currentTarget.dataset.quancode | |||
@@ -213,7 +213,6 @@ Page({ | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onShow: function() { | |||
console.log(this.data.mystatus) | |||
}, | |||
/** | |||
@@ -11,6 +11,8 @@ Page({ | |||
let that = this; | |||
util.barcode("barcode", options.quancode, 500, 100); | |||
util.qrcode("qrcode", options.quancode, 350, 350); | |||
console.log("zhuangtai"); | |||
that.setData({ | |||
code: options.quancode, | |||
title: options.title, | |||
@@ -18,6 +20,12 @@ Page({ | |||
remark: options.remark, | |||
couponorderstatus: options.couponorderstatus | |||
}); | |||
console.log(options.couponorderstatus); | |||
console.log("我是状态"); | |||
/** | |||
* 如果没有核销 | |||
*/ | |||
that.data.setInter = setInterval(function() { | |||
if (that.data.couponorderstatus == 0) { | |||
Http.get({ | |||
@@ -30,20 +38,38 @@ Page({ | |||
that.setData({ | |||
couponorderstatus: res.data.CouponOrderStatus | |||
}); | |||
/** | |||
* 动态改变上一级页面的核销状态 | |||
*/ | |||
var pages = getCurrentPages(); | |||
var currPage = pages[pages.length - 1]; //当前页面 | |||
var prevPage = pages[pages.length - 2]; //上一个页面 | |||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||
prevPage.setData({ | |||
mystatus:res.data.CouponOrderStatus | |||
}); | |||
if (res.data.CouponOrderStatus == 1) { | |||
/** | |||
* 动态改变上一级页面的核销状态 | |||
*/ | |||
var pages = getCurrentPages(); | |||
var prevPage = pages[pages.length - 2]; //上一个页面 | |||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||
prevPage.setData({ | |||
mystatus: res.data.CouponOrderStatus | |||
}); | |||
} | |||
}); | |||
} | |||
}, 2000); | |||
if (that.data.couponorderstatus == 1) { | |||
/** | |||
* 如果已经核销 | |||
* 不需要循环 | |||
*/ | |||
Http.get({ | |||
url: config.api.getStatus, | |||
data: { | |||
couponOrderId: options.quancode | |||
} | |||
}).then(res => { | |||
console.log(res); | |||
that.setData({ | |||
couponorderstatus: res.data.CouponOrderStatus | |||
}); | |||
}); | |||
} | |||
/** | |||
* couponorderstatus | |||
* 0 没有核销 | |||
@@ -1,5 +1,5 @@ | |||
{ | |||
"description": "项目�置文件。", | |||
"description": "项目é…�置文件ã€, | |||
"packOptions": { | |||
"ignore": [] | |||
}, | |||
@@ -11,7 +11,7 @@ | |||
"newFeature": true | |||
}, | |||
"compileType": "miniprogram", | |||
"libVersion": "2.2.4", | |||
"libVersion": "2.2.5", | |||
"appid": "wxb11603577a84a86d", | |||
"projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2%E6%B5%8B%E8%AF%95", | |||
"isGameTourist": false, | |||