|
@@ -29,10 +29,16 @@ Page({
|
|
|
logo: './images/wait.png',
|
|
|
title: '等待使用',
|
|
|
content: '请尽快扫描下方二维码进行激活'
|
|
|
+ },
|
|
|
+ REFUNDED: {
|
|
|
+ logo: './images/wait.png',
|
|
|
+ title: '退款成功',
|
|
|
+ content: '您的退款已成功处理,感谢您的理解和支持'
|
|
|
}
|
|
|
},
|
|
|
goodsInfo: {} as any,
|
|
|
orderNo: "" as string,
|
|
|
+ showCanvas: false, // 是否显示二维码
|
|
|
canvasImg: "" as string
|
|
|
},
|
|
|
|
|
@@ -41,6 +47,7 @@ Page({
|
|
|
*/
|
|
|
onLoad(options: any) {
|
|
|
if (options.orderNo) {
|
|
|
+ console.log(options, 'options')
|
|
|
this.setData({
|
|
|
orderNo: options.orderNo
|
|
|
}, () => {
|
|
@@ -58,24 +65,36 @@ Page({
|
|
|
goodsInfos.forEach((item: any) => {
|
|
|
tempGoods.push({
|
|
|
...item,
|
|
|
+ shortUrl: item.activationCodeInfo.shortUrl,
|
|
|
originalPrice: this.formatPrice(item.paymentCashAmount, 'ALL'),
|
|
|
typeName: this.formatPeriod(item.goodsNum, item.activationCodeInfo.type)
|
|
|
})
|
|
|
})
|
|
|
+ const firstGoods = tempGoods[0]
|
|
|
+ let refundStyleStr = ''
|
|
|
+ if(firstGoods?.refundStyle === 'TURN_BACK') {
|
|
|
+ refundStyleStr = '原路返回'
|
|
|
+ } else if(firstGoods?.refundStyle === 'OFFLINE') {
|
|
|
+ refundStyleStr = '线下'
|
|
|
+ }
|
|
|
const goodsInfo = {
|
|
|
orderNo: result.orderNo,
|
|
|
createTime: result.createTime,
|
|
|
wechatStatus: result.wechatStatus,
|
|
|
- goods: tempGoods
|
|
|
+ goods: tempGoods,
|
|
|
+ refundTime: firstGoods.refundTime,
|
|
|
+ refundAmount: firstGoods.refundAmount,
|
|
|
+ refundStyleStr
|
|
|
}
|
|
|
this.setData({
|
|
|
goodsInfo,
|
|
|
status: result.wechatStatus
|
|
|
})
|
|
|
if(result.wechatStatus != 'CLOSED') {
|
|
|
- this.createQrCode(
|
|
|
- 'https://www.baidu.com/',
|
|
|
- 'canvasCode')
|
|
|
+ const firstGoods = tempGoods[0]
|
|
|
+ if(firstGoods?.shortUrl) {
|
|
|
+ this.createQrCode(firstGoods?.shortUrl, 'canvasCode')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -126,38 +145,13 @@ Page({
|
|
|
}
|
|
|
return size;
|
|
|
},
|
|
|
- setLogoSize() {
|
|
|
- var size = {} as any;
|
|
|
- try {
|
|
|
- var res = wx.getSystemInfoSync();
|
|
|
- var scale = 750 / 48; //不同屏幕下canvas的适配比例;设计稿是750宽
|
|
|
- var width = res.windowWidth / scale;
|
|
|
- var height = width; //canvas画布为正方形
|
|
|
- size.w = width;
|
|
|
- size.h = height;
|
|
|
- } catch (e) {
|
|
|
- // Do something when catch error
|
|
|
- console.log("获取设备信息失败" + e);
|
|
|
- }
|
|
|
- return size;
|
|
|
- },
|
|
|
createQrCode(content: any, canvasId: any) {
|
|
|
const size = this.setCanvasSize();
|
|
|
- // const logoSize = this.setLogoSize();
|
|
|
drawQrcode({
|
|
|
width: size.w,
|
|
|
height: size.h,
|
|
|
canvasId: canvasId,
|
|
|
- // ctx: wx.createCanvasContext('myQrcode'),
|
|
|
text: content,
|
|
|
- // v1.0.0+版本支持在二维码上绘制图片
|
|
|
- // image: {
|
|
|
- // imageResource: "./images/codeLogo.png",
|
|
|
- // dx: (size.w - logoSize.w) / 2,
|
|
|
- // dy: (size.h - logoSize.h) / 2,
|
|
|
- // dWidth: logoSize.w,
|
|
|
- // dHeight: logoSize.h,
|
|
|
- // },
|
|
|
callback: () => {
|
|
|
// 安卓机上不准确,生成的二维码无法扫描,加延时解决
|
|
|
setTimeout(() => {
|
|
@@ -166,6 +160,7 @@ Page({
|
|
|
canvasId: canvasId,
|
|
|
success: (res) => {
|
|
|
this.setData({
|
|
|
+ showCanvas: true,
|
|
|
canvasImg: res.tempFilePath,
|
|
|
});
|
|
|
},
|