|
|
|
@@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
const config = require('../../config/config.js') |
|
|
|
const Common = require('../../common/common.js') |
|
|
|
const format = require('../../utils/util.js') |
|
|
|
@@ -8,12 +7,12 @@ Page({ |
|
|
|
val: '请输入券码', |
|
|
|
couponOrderId: null, |
|
|
|
couponOrderDetail: null, |
|
|
|
statusImg: '', |
|
|
|
statusImg: '', |
|
|
|
statusText: '', |
|
|
|
flag: false, |
|
|
|
detail: '', |
|
|
|
remark: '', |
|
|
|
contentType: 0, |
|
|
|
contentType: 0, |
|
|
|
|
|
|
|
}, |
|
|
|
rule() { |
|
|
|
@@ -24,108 +23,108 @@ Page({ |
|
|
|
onLoad(options) { |
|
|
|
if (tt.getStorageSync("couponOrderId")) { |
|
|
|
this.setData({ |
|
|
|
couponOrderId: tt.getStorageSync("couponOrderId") |
|
|
|
couponOrderId: tt.getStorageSync("couponOrderId"), |
|
|
|
couponTenantId: tt.getStorageSync("couponTenantId") |
|
|
|
}) |
|
|
|
this.detailInfo(tt.getStorageSync("couponOrderId")) |
|
|
|
this.detailInfo(tt.getStorageSync("couponOrderId"), tt.getStorageSync("couponTenantId")) |
|
|
|
} |
|
|
|
}, |
|
|
|
detailInfo(couponOrderId) { |
|
|
|
detailInfo(couponOrderId, couponTenantId) { |
|
|
|
var that = this; |
|
|
|
Common.getCouponOrderDetail(couponOrderId) |
|
|
|
.then(res => { |
|
|
|
console.log(res,"res123") |
|
|
|
if (res.code == 200) { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
contentType: res.data.contentType ? res.data.contentType : 0 |
|
|
|
}) |
|
|
|
console.log(this.data.contentType) |
|
|
|
if (res.data.contentType != undefined && res.data.contentType == 1) { |
|
|
|
Common.getHtml(couponOrderId).then(res => { |
|
|
|
if (res.data.html && res.data.html != '') { |
|
|
|
app.globalData.curHtml = decodeURI(res.data.html); |
|
|
|
} |
|
|
|
Common.getCouponOrderDetail(couponOrderId, couponTenantId) |
|
|
|
.then(res => { |
|
|
|
console.log(res, "res123") |
|
|
|
if (res.code == 200) { |
|
|
|
this.setData({ |
|
|
|
contentType: res.data.contentType ? res.data.contentType : 0 |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
res.data.createDate = format.formatTime(res.data.createDate, 'yyyy-MM-dddd hh:mm:ss') |
|
|
|
res.data.expiredTime = format.formatTime(res.data.expiredTime, 'yyyy-MM-dddd hh:mm:ss') |
|
|
|
switch (res.data.couponOrderStatus) { |
|
|
|
case 0: |
|
|
|
//待使用 |
|
|
|
that.setData({ |
|
|
|
statusText: '未核销', |
|
|
|
flag: true |
|
|
|
}) |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
//已核销 |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/use.png', |
|
|
|
statusText: '已核销', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/beOverdue.png', |
|
|
|
statusText: '已过期', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
//已过期 |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/refund.png', |
|
|
|
statusText: '已退款', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
//已作废 |
|
|
|
break; |
|
|
|
default: |
|
|
|
tt.showToast({ |
|
|
|
title: '数据有误', |
|
|
|
image:'../../static/images/fail.png' |
|
|
|
console.log(this.data.contentType) |
|
|
|
if (res.data.contentType != undefined && res.data.contentType == 1) { |
|
|
|
Common.getHtml(couponOrderId).then(res => { |
|
|
|
if (res.data.html && res.data.html != '') { |
|
|
|
app.globalData.curHtml = decodeURI(res.data.html); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
res.data.createDate = format.formatTime(res.data.createDate, 'yyyy-MM-dddd hh:mm:ss') |
|
|
|
res.data.expiredTime = format.formatTime(res.data.expiredTime, 'yyyy-MM-dddd hh:mm:ss') |
|
|
|
switch (res.data.couponOrderStatus) { |
|
|
|
case 0: |
|
|
|
//待使用 |
|
|
|
that.setData({ |
|
|
|
statusText: '未核销', |
|
|
|
flag: true |
|
|
|
}) |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
//已核销 |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/use.png', |
|
|
|
statusText: '已核销', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/beOverdue.png', |
|
|
|
statusText: '已过期', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
//已过期 |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
that.setData({ |
|
|
|
statusImg: '/static/images/refund.png', |
|
|
|
statusText: '已退款', |
|
|
|
flag: false |
|
|
|
}) |
|
|
|
//已作废 |
|
|
|
break; |
|
|
|
default: |
|
|
|
tt.showToast({ |
|
|
|
title: '数据有误', |
|
|
|
image: '../../static/images/fail.png' |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(res) |
|
|
|
console.log("我是请求回来的数据") |
|
|
|
that.setData({ |
|
|
|
couponOrderDetail: res.data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
tt.reLaunch({ |
|
|
|
url: 'pages/main/writeoffPage/errorPage/errorPage', |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(res) |
|
|
|
console.log("我是请求回来的数据") |
|
|
|
that.setData({ |
|
|
|
couponOrderDetail: res.data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
tt.reLaunch({ |
|
|
|
url: 'pages/main/writeoffPage/errorPage/errorPage', |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
user() { |
|
|
|
console.log(tt.getStorageSync("verifyRemark")) |
|
|
|
// return |
|
|
|
Common.couponOrderVerify(this.data.couponOrderId, tt.getStorageSync("verifyRemark")) |
|
|
|
.then(res => { |
|
|
|
console.log(res) |
|
|
|
if (res.code == 200) { |
|
|
|
tt.redirectTo({ |
|
|
|
url: '../success/success', |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
.then(res => { |
|
|
|
console.log(res) |
|
|
|
if (res.code == 200) { |
|
|
|
tt.redirectTo({ |
|
|
|
url: '../success/success', |
|
|
|
}) |
|
|
|
} else { |
|
|
|
tt.showModal({ |
|
|
|
title: '抱歉', |
|
|
|
content: res.message, |
|
|
|
showCancel: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error) |
|
|
|
tt.showModal({ |
|
|
|
title: '抱歉', |
|
|
|
content: res.message, |
|
|
|
showCancel:false |
|
|
|
content: error.message, |
|
|
|
showCancel: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error=>{ |
|
|
|
console.log(error) |
|
|
|
tt.showModal({ |
|
|
|
title: '抱歉', |
|
|
|
content: error.message, |
|
|
|
showCancel: false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
reBuck() { |
|
|
|
tt.switchTab({ |
|
|
|
|