Przeglądaj źródła

[券码,消费卡][修改]:[生成码和消费卡扫码修改]

tags/同保楼3.3.1
meo 6 lat temu
rodzic
commit
528f5aa67a
5 zmienionych plików z 65 dodań i 27 usunięć
  1. +33
    -21
      pages/cardorder/index/index.js
  2. +2
    -2
      pages/orderquanma/index.js
  3. +2
    -2
      pages/orderquanma/index.wxml
  4. +1
    -1
      pages/orderquanma/index.wxss
  5. +27
    -1
      utils/util.js

+ 33
- 21
pages/cardorder/index/index.js Wyświetl plik

@@ -54,28 +54,36 @@ Page({
let that = this;
wx.scanCode({
success: (res) => {
let value = JSON.parse(res.result);
if (value.END == 'B' && value.TYPE == 'merchant' && value.ID){
Http.get({
url: config.api.findByCode,
data: {
merchantCode:value.ID,
}
})
.then(res => {
if (res.code == 200) {
let merChantDetail = JSON.stringify(res.data);
if (merChantDetail && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) {
wx.navigateTo({
url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`,
})
if (util.isJSON(res.result)) {
let value = JSON.parse(res.result);
if (value.END == 'B' && value.TYPE == 'merchant' && value.ID) {
Http.get({
url: config.api.findByCode,
data: {
merchantCode: value.ID,
}
}
})
.catch(err => {
console.log(err)
})
.then(res => {
if (res.code == 200) {
let merChantDetail = JSON.stringify(res.data);
if (merChantDetail && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) {
wx.navigateTo({
url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`,
})
}
}
})
.catch(err => {
console.log(err)
})
} else {
wx.showToast({
title: "未识别到商户二维码",
icon: "none",
mask: false
})
}else{
}
} else {
wx.showToast({
title: "未识别到商户二维码",
icon: "none",
@@ -84,7 +92,11 @@ Page({
}
},
fail: (res) => {
console.log(res);
wx.showToast({
title: "未识别到商户二维码",
icon: "none",
mask: false
})
}
})
},


+ 2
- 2
pages/orderquanma/index.js Wyświetl plik

@@ -51,8 +51,8 @@ Page({
onLoad: function (options) {
let that = this;
let value = JSON.stringify({ END: "C", TYPE: "couponorder", ID: options.quancode})
util.barcode("barcode", value.ID, 500, 100);
util.qrcode("qrcode", options.quancode, 350, 350);
// util.barcode("barcode", value, 500, 100);
util.qrcode("qrcode", value, 350, 350);
that.setData({
code: options.quancode,
title: options.title,


+ 2
- 2
pages/orderquanma/index.wxml Wyświetl plik

@@ -15,9 +15,9 @@
<image wx:if="{{couponorderstatus==2}}" src="{{wm02Url}}" mode='widthFix'></image>
<image wx:if="{{couponorderstatus==3}}" src="{{wm03Url}}" mode='widthFix'></image>
<view class="panel" wx:if="{{couponorderstatus==0}}">
<view class="barcode">
<!-- <view class="barcode">
<canvas canvas-id="barcode" />
</view>
</view> -->
<view class="qrcode">
<canvas canvas-id="qrcode" />
</view>


+ 1
- 1
pages/orderquanma/index.wxss Wyświetl plik

@@ -40,7 +40,7 @@ page {
width:600rpx;
display:block;
border-radius:10rpx;
margin:38rpx auto 0;
margin:0 auto;
padding:0;
z-index:10000000000;



+ 27
- 1
utils/util.js Wyświetl plik

@@ -114,11 +114,37 @@ function timecha(endTime,startTime) {
var second = runTime;
return (month+"月"+day+"天"+hour+"小时"+minute+"分钟")
}

function isJSON(str) {
if (typeof str == 'string') {
console.log("string")
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log(e);
wx.showToast({
title: '请扫描正确的二维码',
icon: 'none',
duration: 1300
})
}
} else {
wx.showToast({
title: '请扫描正确的二维码',
icon: 'none',
duration: 1300
})
}
}
module.exports = {
formatTime: formatTime,
barcode: barc,
qrcode: qrc,
isJSON: isJSON,
fmtDate: fmtDate,
timechuo:timechuo,
timecha:timecha


Ładowanie…
Anuluj
Zapisz