浏览代码

动态码数据新增

soldDate
HolyKnightIX 2 年前
父节点
当前提交
ce306722c2
共有 7 个文件被更改,包括 233 次插入171 次删除
  1. +26
    -8
      pages/coupon/confirmation/confirmation.js
  2. +5
    -2
      pages/coupon/detail/index.js
  3. +84
    -66
      pages/couponorder/detail/index.js
  4. +33
    -25
      pages/integralmall/payIntegcoupondetail/index.js
  5. +1
    -2
      pages/main/index.js
  6. +26
    -10
      pages/order/detail/index.js
  7. +58
    -58
      pages/orderquanma/index.js

+ 26
- 8
pages/coupon/confirmation/confirmation.js 查看文件

@@ -16,13 +16,18 @@ Page({
mallTenantId: '' mallTenantId: ''
}, },
onLoad: function (options) { onLoad: function (options) {
console.log(options);
console.log(options, 'options');


if (options.mallTenantId) { if (options.mallTenantId) {
this.setData({ this.setData({
mallTenantId: options.mallTenantId, mallTenantId: options.mallTenantId,
}) })
} else {
this.setData({
mallTenantId: tt.getStorageSync('mallTenantId'),
})
} }
console.log(this.data.mallTenantId, 'mallTenantId');


tt.showLoading({ tt.showLoading({
title: "加载中..." title: "加载中..."
@@ -298,8 +303,9 @@ Page({
/** /**
* 支付订单更新 * 支付订单更新
*/ */
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => {
payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType) {
let that = this; let that = this;

// 支付成功 // 支付成功
Http.post({ Http.post({
url: config.api.payOrderUpdate, url: config.api.payOrderUpdate,
@@ -307,21 +313,31 @@ Page({
payOrderId: payOrderId, payOrderId: payOrderId,
composeOrderId: orderId, composeOrderId: orderId,
status: status, status: status,
reason: reason
reason: reason,
mallTenantId: that.data.mallTenantId
} }
}) })
.then(res => { .then(res => {
tt.hideLoading() tt.hideLoading()
// 有价券 // 有价券
if (!type && type != 'free') { if (!type && type != 'free') {
tt.navigateTo({
url: `/pages/order/detail/index?orderId=${orderId
}`
});
setTimeout(() => {
let url = ""
if (_this.data.orderFlag) {
tt.redirectTo({
url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order}&mallTenantId=${that.data.mallTenantId}`
});
} else {
tt.redirectTo({
url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}`
});
}

}, 1600);
} else if (type == 'free') { } else if (type == 'free') {
tt.navigateTo({ tt.navigateTo({
url: `/pages/order/detail/index?orderId=${orderId url: `/pages/order/detail/index?orderId=${orderId
}`
}&mallTenantId=${that.data.mallTenantId}`
}); });
} }
}) })
@@ -509,6 +525,7 @@ Page({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
payment: res.data.payment, payment: res.data.payment,
success: res => { success: res => {
console.log('save,success!');
tt.hideLoading(); tt.hideLoading();
that.setData({ that.setData({
showbutton: false, showbutton: false,
@@ -524,6 +541,7 @@ Page({
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, '');
}, },
fail: res => { fail: res => {
console.log('save,fail!');
const { const {
orderId, orderId,
outOrderNo, outOrderNo,


+ 5
- 2
pages/coupon/detail/index.js 查看文件

@@ -483,7 +483,7 @@ Page({
* 获取用户信息 * 获取用户信息
*/ */
onLoad(options) { onLoad(options) {
console.log(options);
console.log(options, 'options');
if (options.mallTenantId) { if (options.mallTenantId) {
this.setData({ this.setData({
mallTenantId: options.mallTenantId, mallTenantId: options.mallTenantId,
@@ -837,6 +837,8 @@ Page({
data: tempObj data: tempObj
}) })
console.log(this.data.data, "data"); console.log(this.data.data, "data");
const mallTenantId = this.data.data.tenantId
tt.setStorageSync('mallTenantId', mallTenantId)
} }
}).catch(err => { }).catch(err => {
tt.showToast({ tt.showToast({
@@ -871,7 +873,8 @@ Page({
payOrderId: payOrderId, payOrderId: payOrderId,
composeOrderId: orderId, composeOrderId: orderId,
status: status, status: status,
reason: reason
reason: reason,
mallTenantId: this.data.mallTenantId || ''
} }
}) })
.then(res => { .then(res => {


+ 84
- 66
pages/couponorder/detail/index.js 查看文件

@@ -6,31 +6,33 @@ const util = require("../../../utils/util");
const QR = require("../../../utils/memberqrcode.js"); const QR = require("../../../utils/memberqrcode.js");
Page({ Page({
data: { data: {
showIdFalg:false,
showIdFalg: false,
navigationBarHeight, navigationBarHeight,
couponorderstatus:"",
quancode:"",
setInter:"",
validStartDate:"",
validEndDate:"",
pickStartDate:"",
pickEndDate:"",
expiredTime:"",
updateDate:"",
createDate:"",
code:"",
data:{
couponorderstatus: "",
quancode: "",
setInter: "",
validStartDate: "",
validEndDate: "",
pickStartDate: "",
pickEndDate: "",
expiredTime: "",
updateDate: "",
createDate: "",
code: "",
data: {
}, },
showhieRq:false,
dynamicRq:"",
expiredSeconds:0,
templTiem:"",
curHtml:"",
showhieRq: false,
dynamicRq: "",
expiredSeconds: 0,
couponTenantId: '',
templTiem: "",
curHtml: "",
tenantId: ''
}, },
showId(){
showId() {
let this_ = this; let this_ = this;
if(!this_.data.showIdFalg){
if (!this_.data.showIdFalg) {
tt.showModal({ tt.showModal({
// title: "查看券码", // title: "查看券码",
content: "是否查看完整券码", content: "是否查看完整券码",
@@ -38,7 +40,7 @@ Page({
if (res.confirm) { if (res.confirm) {
console.log("confirm, continued"); console.log("confirm, continued");
this_.setData({ this_.setData({
showIdFalg:true
showIdFalg: true
}) })
} else if (res.cancel) { } else if (res.cancel) {
//取消 //取消
@@ -51,12 +53,12 @@ Page({
console.log(`showModal 调用失败`, err); console.log(`showModal 调用失败`, err);
}, },
}); });
}else{
} else {
this.setData({ this.setData({
showIdFalg:false
showIdFalg: false
}) })
} }
}, },
getHtml(couponOrderId) { getHtml(couponOrderId) {
Http.get({ Http.get({
@@ -80,15 +82,15 @@ Page({
console.log(options); console.log(options);
that.setData({ that.setData({
code: options.quancode, code: options.quancode,
codeS: options.quancode.slice(0,4)+`******`+options.quancode.slice(14),
codeS: options.quancode.slice(0, 4) + `******` + options.quancode.slice(14),
couponorderstatus: options.couponorderstatus, couponorderstatus: options.couponorderstatus,
validStatus:options.validStatus
validStatus: options.validStatus
}); });


if(options.couponorderstatus==0&&options.validStatus!=0){
that.setRq()//动态二维码 //这个方法必须在拿到 options.quancode 后调用
if (options.couponorderstatus == 0 && options.validStatus != 0) {
that.setRq() //动态二维码 //这个方法必须在拿到 options.quancode 后调用
} }
//初始数据不能延时收到写一边 //初始数据不能延时收到写一边
Http.get({ Http.get({
url: config.api.couponOrderDetail, url: config.api.couponOrderDetail,
@@ -96,6 +98,12 @@ Page({
couponOrderId: options.quancode couponOrderId: options.quancode
} }
}).then(res => { }).then(res => {
if (res.data.tenantId) {
that.setData({
tenantId: res.data.tenantId
})
that.setRq()
}
that.setData({ that.setData({
couponorderstatus: res.data.couponOrderStatus, couponorderstatus: res.data.couponOrderStatus,
data: res.data, data: res.data,
@@ -120,19 +128,19 @@ Page({
// pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"),
}) })
} }
}).catch(err => { }).catch(err => {
tt.showToast({
title: err.message?err.message:err.data,
icon: 'none',
duration: 2000,
mask: false
});
tt.showToast({
title: err.message ? err.message : err.data,
icon: 'none',
duration: 2000,
mask: false
});
}) })
// //






//获得优惠券的详情 //获得优惠券的详情
let setInter = setInterval(function () { let setInter = setInterval(function () {
@@ -140,18 +148,25 @@ Page({
options.quancode && options.quancode &&
that.data.couponorderstatus == 0 that.data.couponorderstatus == 0
) { ) {
Http.get({ Http.get({
url: config.api.couponOrderDetail, url: config.api.couponOrderDetail,
data: { data: {
couponOrderId: options.quancode couponOrderId: options.quancode
} }
}).then(res => { }).then(res => {
console.log(res.data, '1233211234567');
that.setData({ that.setData({
couponorderstatus: res.data.couponOrderStatus, couponorderstatus: res.data.couponOrderStatus,
data: res.data, data: res.data,
}); });
if (res.data.tenantId) {
that.setData({
tenantId: res.data.tenantId
})
that.setRq()
}
console.log(that.data.tenantId, 'tenantId');
that.setData({ that.setData({
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
@@ -165,62 +180,65 @@ Page({
// pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"),
}) })
} }
}).catch(err => { }).catch(err => {
tt.showToast({
title: err.message?err.message:err.data,
icon: 'none',
duration: 2000,
mask: false
});
})
tt.showToast({
title: err.message ? err.message : err.data,
icon: 'none',
duration: 2000,
mask: false
});
})
} }
}, 2000); }, 2000);
that.setData({ that.setData({
setInter:setInter
setInter: setInter
}) })
}, },
setRq(){
setRq() {
let _this = this let _this = this
_this.setData({ _this.setData({
showhieRq: false, showhieRq: false,
}) })
Http.get({//获取动态二维码
Http.get({ //获取动态二维码
url: config.api.dynamicId, url: config.api.dynamicId,
data: { data: {
couponOrderId: _this.data.code
couponOrderId: _this.data.code,
couponTenantId: _this.data.tenantId || ''
} }
}).then(res => { }).then(res => {
console.log(res, "res") console.log(res, "res")
_this.setData({ _this.setData({
dynamicRq: res.data.dynamicId, dynamicRq: res.data.dynamicId,
expiredSeconds: res.data.expiredSeconds
expiredSeconds: res.data.expiredSeconds,
couponTenantId: res.data.couponTenantId
}) })


let url = JSON.stringify({ let url = JSON.stringify({
END: "C", END: "C",
TYPE: "couponorder", TYPE: "couponorder",
ID: _this.data.dynamicRq
ID: _this.data.dynamicRq,
couponTenantId: _this.data.couponTenantId
}) })
if(res.data.expiredSeconds==0){
if (res.data.expiredSeconds == 0) {


}else{
let inre = setInterval(()=>{
if(_this.data.expiredSeconds>1){
} else {
let inre = setInterval(() => {
if (_this.data.expiredSeconds > 1) {
_this.setData({ _this.setData({
expiredSeconds: _this.data.expiredSeconds-1
expiredSeconds: _this.data.expiredSeconds - 1
}) })
console.log("有效",_this.data.expiredSeconds)
}else{
console.log("有效", _this.data.expiredSeconds)
} else {
console.log("无效", _this.data.expiredSeconds) console.log("无效", _this.data.expiredSeconds)
clearInterval(_this.data.templTiem) clearInterval(_this.data.templTiem)
_this.setData({ _this.setData({
showhieRq:true
showhieRq: true
}) })
}
},1000)
}
}, 1000)
_this.setData({ _this.setData({
templTiem:inre
templTiem: inre
}) })
} }
// util.qrcode("qrcode", url, 350, 350); // util.qrcode("qrcode", url, 350, 350);
@@ -238,7 +256,7 @@ Page({
createQrCode: function (url, canvasId, cavW, cavH) { createQrCode: function (url, canvasId, cavW, cavH) {
//调用插件中的draw方法,绘制二维码图片 //调用插件中的draw方法,绘制二维码图片
let that = this; let that = this;
QR.api.draw(url, canvasId, cavW, cavH, function (res) {
QR.api.draw(url, canvasId, cavW, cavH, function (res) {
that.setData({ that.setData({
tempFilePath: res tempFilePath: res
}) })


+ 33
- 25
pages/integralmall/payIntegcoupondetail/index.js 查看文件

@@ -3,7 +3,9 @@ const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px';
var config = require("../../../config/config.js"); var config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics"); const Http = require("../../../utils/HttpBasics");
const imgurl = require("../../../utils/imgurl"); const imgurl = require("../../../utils/imgurl");
const { spellStatus } = require("../../../utils/spell");
const {
spellStatus
} = require("../../../utils/spell");
Page({ Page({


/** /**
@@ -20,25 +22,25 @@ Page({
data: null, data: null,
showErr: false, showErr: false,
showAlert: false, showAlert: false,
remainingPoints:0,
submitAble:true
remainingPoints: 0,
submitAble: true
}, },
getUserInfo: function () { getUserInfo: function () {
let that = this; let that = this;
// 获取用户信息 // 获取用户信息
Http.get({ Http.get({
url: config.api.getScore,
data: {}
})
url: config.api.getScore,
data: {}
})
.then(res => { .then(res => {
console.log(res) console.log(res)
that.setData({ that.setData({
remainingPoints: Number(res.data.credit) - Number(that.data.data.creditPrice), remainingPoints: Number(res.data.credit) - Number(that.data.data.creditPrice),
userInfo:res.data
userInfo: res.data
}) })
}) })
}, },
cannotPay(){
cannotPay() {
tt.showToast({ tt.showToast({
title: "您的积分不足", title: "您的积分不足",
image: './../../../assets/images/fail.png', image: './../../../assets/images/fail.png',
@@ -56,7 +58,7 @@ Page({
url: `/pages/spellGroup/spellGroup`, url: `/pages/spellGroup/spellGroup`,
}) })
}, },
onShow:function(){
onShow: function () {
this.setData({ this.setData({
submitAble: true submitAble: true
}) })
@@ -68,23 +70,28 @@ Page({
this.setData({ this.setData({
paramData: options paramData: options
}) })
if (options.mallTenantId) {
this.setData({
mallTenantId: options.mallTenantId,
})
}
this.getDetail(options.couponChannelId); this.getDetail(options.couponChannelId);


// 关闭来自于左上角的分享 // 关闭来自于左上角的分享
tt.hideShareMenu() tt.hideShareMenu()
}, },
/** /**
* 发起支付
*/
* 发起支付
*/
gotoPay() { gotoPay() {
var that = this; var that = this;
that.setData({ that.setData({
submitAble: false submitAble: false
}) })
Http.get({ Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => { .then(res => {
var data = { var data = {
couponChannelId: "" + that.data.paramData.couponChannelId, couponChannelId: "" + that.data.paramData.couponChannelId,
@@ -180,7 +187,7 @@ Page({
*/ */
tt.redirectTo({ tt.redirectTo({
url: "/pages/getphoneInfo/index?couponChannelId=" + url: "/pages/getphoneInfo/index?couponChannelId=" +
that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId +"&path=jifen"
that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId + "&path=jifen"
}); });
} else if (err.code == 11006) { } else if (err.code == 11006) {
// 用户手机已加密 // 用户手机已加密
@@ -206,7 +213,7 @@ Page({
}); });
// console.log(that.data.type) // console.log(that.data.type)
// 免费券 // 免费券
that.payOrderUpdate(orderId, "0", 1, '',that);
that.payOrderUpdate(orderId, "0", 1, '', that);
// that.payOrderUpdate(that.data.orderId, '', 1, '', that); // that.payOrderUpdate(that.data.orderId, '', 1, '', that);
if (that.data.cardType == 100) { if (that.data.cardType == 100) {
tt.setStorage({ tt.setStorage({
@@ -229,14 +236,15 @@ Page({
let that = this; let that = this;
// 支付成功 // 支付成功
Http.post({ Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
composeOrderId: orderId,
status: status,
reason: reason
}
})
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
composeOrderId: orderId,
status: status,
reason: reason,
mallTenantId: this.data.mallTenantId || ''
}
})
.then(res => { .then(res => {
tt.hideLoading() tt.hideLoading()
tt.navigateTo({ tt.navigateTo({
@@ -256,7 +264,7 @@ Page({
*/ */
getDetail(couponChannelId) { getDetail(couponChannelId) {
let that = this; let that = this;
Http.get({
Http.get({
url: config.api.couponDetail, url: config.api.couponDetail,
data: { data: {
couponChannelId: couponChannelId couponChannelId: couponChannelId


+ 1
- 2
pages/main/index.js 查看文件

@@ -180,7 +180,7 @@ Page({
if (options && options.orderId && app.globalData.type == 'dt') { if (options && options.orderId && app.globalData.type == 'dt') {
//订单详情 //订单详情
tt.redirectTo({ tt.redirectTo({
url: `/pages/order/detail/index?orderId=${options.orderId}`
url: `/pages/order/detail/index?orderId=${options.orderId}&mallTenantId=${options.tenantId}`
}) })
} else if (options && options.orderGroupId) { } else if (options && options.orderGroupId) {
tt.redirectTo({ tt.redirectTo({
@@ -577,7 +577,6 @@ Page({
} }
}) })
} }

}, },


getGameOne: function (token, id) { getGameOne: function (token, id) {


+ 26
- 10
pages/order/detail/index.js 查看文件

@@ -18,6 +18,7 @@ Page({
serviceUrl: '', //客服外部链接 serviceUrl: '', //客服外部链接
dynamicRq: "", dynamicRq: "",
expiredSeconds: 0, expiredSeconds: 0,
couponTenantId: '',
showhieRq: false, showhieRq: false,
mouldType: 0, mouldType: 0,
showFlag: false, showFlag: false,
@@ -50,6 +51,7 @@ Page({
cardIf: false, cardIf: false,
contentType: 0, contentType: 0,
orderFlag: false, //判断是不是线上配送 orderFlag: false, //判断是不是线上配送
tenantId: ''
}, },
handleRefund(event) { handleRefund(event) {
const { const {
@@ -227,6 +229,11 @@ Page({
} }
}).then(res => { }).then(res => {
tt.hideLoading(); tt.hideLoading();
if (res.data.tenantId) {
that.setData({
tenantId: res.data.tenantId
})
}
var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd"); var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd");
let tempData = res.data.orders[0] let tempData = res.data.orders[0]
tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : "" tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : ""
@@ -458,19 +465,22 @@ Page({
Http.get({ //获取动态二维码 Http.get({ //获取动态二维码
url: config.api.dynamicId, url: config.api.dynamicId,
data: { data: {
couponOrderId: _this.data.order.couponOrderId
couponOrderId: _this.data.order.couponOrderId,
couponTenantId: _this.data.tenantId || ''
} }
}).then(res => { }).then(res => {
console.log(res, "res") console.log(res, "res")
_this.setData({ _this.setData({
dynamicRq: res.data.dynamicId, dynamicRq: res.data.dynamicId,
expiredSeconds: res.data.expiredSeconds
expiredSeconds: res.data.expiredSeconds,
couponTenantId: res.data.couponTenantId
}) })


let url = JSON.stringify({ let url = JSON.stringify({
END: "C", END: "C",
TYPE: "couponorder", TYPE: "couponorder",
ID: _this.data.dynamicRq
ID: _this.data.dynamicRq,
couponTenantId: _this.data.couponTenantId
}) })
if (res.data.expiredSeconds == 0) { if (res.data.expiredSeconds == 0) {
//倒计时为零直接显示券码 //倒计时为零直接显示券码
@@ -721,7 +731,7 @@ Page({
}) })
.then(res => { .then(res => {
tt.redirectTo({ tt.redirectTo({
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}`
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}&mallTenantId=${this.data.mallTenantId}`
}); });
}) })
.catch(err => { .catch(err => {
@@ -773,7 +783,10 @@ Page({
orderId, orderId,
outOrderNo outOrderNo
} = res; } = res;
// that.setData({ orderId, outOrderNo });
// that.setData({
// orderId,
// outOrderNo
// });
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, '');
}, },
fail: res => { fail: res => {
@@ -1018,7 +1031,7 @@ Page({
/** /**
* 支付订单更新 * 支付订单更新
*/ */
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
payOrderUpdate(orderId, payOrderId, status, reason, type, _this) {
// 支付成功 // 支付成功
Http.post({ Http.post({
url: config.api.payOrderUpdate, url: config.api.payOrderUpdate,
@@ -1026,7 +1039,8 @@ Page({
payOrderId: payOrderId, payOrderId: payOrderId,
composeOrderId: orderId, composeOrderId: orderId,
status: status, status: status,
reason: reason
reason: reason,
mallTenantId: this.data.mallTenantId || ''
} }
}) })
.then(res => { .then(res => {
@@ -1048,14 +1062,15 @@ Page({
tt.hideLoading(); tt.hideLoading();
}, 1600); }, 1600);
setTimeout(() => { setTimeout(() => {
console.log('Here1');
let url = "" let url = ""
if (_this.data.orderFlag) { if (_this.data.orderFlag) {
tt.redirectTo({ tt.redirectTo({
url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order`
url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order}&mallTenantId=${that.data.mallTenantId}`
}); });
} else { } else {
tt.redirectTo({ tt.redirectTo({
url: `/pages/order/detail/index?orderId=${orderId}`
url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}`
}); });
} }


@@ -1063,8 +1078,9 @@ Page({
} }
}); });
} else if (type == 'free') { } else if (type == 'free') {
console.log('Here2');
tt.redirectTo({ tt.redirectTo({
url: `/pages/order/detail/index?orderId=${orderId}`
url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}`
}); });
} }
}) })


+ 58
- 58
pages/orderquanma/index.js 查看文件

@@ -39,20 +39,20 @@ Page({
getStaticGame(token) { getStaticGame(token) {
let _this = this; let _this = this;
Http.get({ Http.get({
url: config.api.getGame,
data: {
triggleAction: 4 // 核销触发
}
}).then(res => {
if (res.data.id) {
url: config.api.getGame,
data: {
triggleAction: 4 // 核销触发
}
}).then(res => {
if (res.data.id) {
_this.setData({
showIf: true
})
}
_this.setData({ _this.setData({
showIf: true
staticGamedata: res.data
}) })
}
_this.setData({
staticGamedata: res.data
}) })
})
.catch(err => { .catch(err => {
tt.showToast({ tt.showToast({
title: err.errMsg, title: err.errMsg,
@@ -68,7 +68,7 @@ Page({
_this.setData({ _this.setData({
showhieRq: false, showhieRq: false,
}) })
Http.get({//获取动态二维码
Http.get({ //获取动态二维码
url: config.api.dynamicId, url: config.api.dynamicId,
data: { data: {
couponOrderId: _this.data.code couponOrderId: _this.data.code
@@ -85,9 +85,9 @@ Page({
TYPE: "couponorder", TYPE: "couponorder",
ID: _this.data.dynamicRq ID: _this.data.dynamicRq
}) })
if(res.data.expiredSeconds==0){
if (res.data.expiredSeconds == 0) {


}else{
} else {
let inre = setInterval(() => { let inre = setInterval(() => {
if (_this.data.expiredSeconds > 1) { if (_this.data.expiredSeconds > 1) {
_this.setData({ _this.setData({
@@ -106,17 +106,17 @@ Page({
templTiem: inre templTiem: inre
}) })
} }
// util.qrcode("qrcode", url, 350, 350); // util.qrcode("qrcode", url, 350, 350);
_this.createQrCode(url, "qrcode", 350, 350); _this.createQrCode(url, "qrcode", 350, 350);
}).catch(err => {
tt.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
}).catch(err => {
tt.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
}, },


onLoad: function (options) { //quancode onLoad: function (options) { //quancode
@@ -134,11 +134,11 @@ Page({
validStatus: options.validstatus, validStatus: options.validstatus,
contentType: options.contentType contentType: options.contentType
}); });
if (options.couponorderstatus==0){
that.setRq()//动态获取二维码 这个方法必须在拿到 options.quancode 后调用
if (options.couponorderstatus == 0) {
that.setRq() //动态获取二维码 这个方法必须在拿到 options.quancode 后调用
} }
if (options.contentType != undefined && options.contentType==1) {
if (options.contentType != undefined && options.contentType == 1) {
this.setData({ this.setData({
curHtml: app.globalData.curHtml curHtml: app.globalData.curHtml
}) })
@@ -149,28 +149,28 @@ Page({
that.data.setInter = setInterval(function () { that.data.setInter = setInterval(function () {
if (that.data.couponorderstatus == 0) { if (that.data.couponorderstatus == 0) {
Http.get({ Http.get({
url: config.api.getStatus,
data: {
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
if (res.data.CouponOrderStatus == 1) {
/**
* 动态改变上一级页面的核销状态
*/
that.getStaticGame()
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
mystatus: res.data.CouponOrderStatus
url: config.api.getStatus,
data: {
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
couponorderstatus: res.data.CouponOrderStatus
}); });
}
})
if (res.data.CouponOrderStatus == 1) {
/**
* 动态改变上一级页面的核销状态
*/
that.getStaticGame()
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
mystatus: res.data.CouponOrderStatus
});
}
})
.catch(err => { .catch(err => {
tt.showToast({ tt.showToast({
title: err.errMsg, title: err.errMsg,
@@ -188,15 +188,15 @@ Page({
* 不需要循环 * 不需要循环
*/ */
Http.get({ Http.get({
url: config.api.getStatus,
data: {
couponOrderId: options.quancode
}
}).then(res => {
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
})
url: config.api.getStatus,
data: {
couponOrderId: options.quancode
}
}).then(res => {
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
})
.catch(err => { .catch(err => {
tt.showToast({ tt.showToast({
title: err.errMsg, title: err.errMsg,
@@ -237,4 +237,4 @@ Page({
// value: app.globalData.sight, // value: app.globalData.sight,
// }) // })
// } // }
});
});

正在加载...
取消
保存