Commit edf4cae0 authored by pengguangpu's avatar pengguangpu

解决home.js冲突;添加支付结果页的参数获取逻辑、打印回调逻辑;

parent 0b3d1e22
...@@ -30,7 +30,6 @@ Page({ ...@@ -30,7 +30,6 @@ Page({
}); });
}, },
<<<<<<< HEAD
//外接扫码枪事件 //外接扫码枪事件
onKeyPress(r) { onKeyPress(r) {
...@@ -40,15 +39,12 @@ Page({ ...@@ -40,15 +39,12 @@ Page({
url: "/pages/scan/scan?barcode=" + r, url: "/pages/scan/scan?barcode=" + r,
}); });
}, },
=======
//显示弹窗,>1为显示,2loading 3 result success 4 result failed //显示弹窗,>1为显示,2loading 3 result success 4 result failed
showDialog(){ showDialog(){
this.setData( this.setData(
this.data.scanDialogDisplay = this.data.scanDialogDisplay+1 this.data.scanDialogDisplay = this.data.scanDialogDisplay+1
) )
} }
>>>>>>> b85311896b3b12a7e29afcc50be66f821096a0f3
}); });
<view class="page"> <view class="page">
<view class="topTitle"> <view class="topTitle">
<view style="margin:0 auto;margin-top:38rpx;"> <view style="margin:0 auto;margin-top:38rpx;">
<image mode="aspectFit" style="width:53rpx;height:53rpx;margin-right:26rpx;float:left;" src="/images/ic_success.png"/> <image mode="aspectFit" style="width:53rpx;height:53rpx;margin-right:26rpx;float:left;" src="/images/icon_success.png"/>
<view style="height:53rpx;display:flex;"> <view style="height:53rpx;display:flex;">
<text>支付成功</text> <text>支付成功</text>
</view> </view>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</view> </view>
</view> </view>
<view class="printLoading"> <view class="printLoading">
<i-spin></i-spin> <i-spin hidden="{{!isShowPrinting}}"></i-spin>
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;color:#000000;font-weight:bold;"> <view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;color:#000000;font-weight:bold;">
<view style="display: absolute;margin:0 auto;align-content: center;align-items: center;text-align:center;line-height:186rpx;"> <view style="display: absolute;margin:0 auto;align-content: center;align-items: center;text-align:center;line-height:186rpx;">
<text>{{printerStatus}}</text> <text>{{printerStatus}}</text>
......
Page({ Page({
data: { data: {
orderPriceYuan: "--.--", orderPriceYuan: "--.--",
orderPriceFen: 0,
couponPriceYuan: "--.--", couponPriceYuan: "--.--",
couponPriceFen: 0,
payPriceYuan: "--.--", payPriceYuan: "--.--",
totalCount: "0", payPriceFen: 0,
totalCount: 0,
printerStatus: "小票打印中", printerStatus: "小票打印中",
couponPriceYuan: "--.--", couponPriceYuan: "--.--",
couponHint: "xxxxxx", couponHint: "xxxxxx",
couponName: "xxxxxxxx", couponName: "xxxxxxxx",
couponDateDuration: "xxxx.xx.xx-xxxx.xx.xx", couponDateDuration: "xxxx.xx.xx-xxxx.xx.xx",
isShowCoupon: true isShowCoupon: false,
isShowPrinting: true
}, },
onLoad(query) { onLoad(query) {
console.info(`Page onLoad with query: ${JSON.stringify(query)}`); console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
//单位转换&赋值
this.data.orderPriceFen = query.orderPrice;
this.data.couponPriceFen = query.couponPrice;
this.data.payPriceFen = query.payPrice;
this.data.totalCount = query.totalCount;
var miyapay = require("../../utils/miyapay4.js");
this.data.orderPriceYuan = miyapay.fen2Yuan(this.data.orderPriceFen);
this.data.couponPriceYuan = miyapay.fen2Yuan(this.data.couponPriceFen);
this.data.payPriceYuan = miyapay.fen2Yuan(this.data.payPriceFen);
}, },
print() { print() {
...@@ -63,6 +77,20 @@ Page({ ...@@ -63,6 +77,20 @@ Page({
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
} }
}); });
this.setData({
isShowPrinting: false
});
if (res.code == -1) {
//打印失败
this.setData({
printerStatus: "打印失败"
});
} else {
//打印成功
this.setData({
printerStatus: "打印成功"
});
}
}, },
onShow() { onShow() {
......
...@@ -50,10 +50,14 @@ function createCommonRequest() { ...@@ -50,10 +50,14 @@ function createCommonRequest() {
}; };
commonRequest.appId = app.globalData.appId; commonRequest.appId = app.globalData.appId;
//token 设置到公共请求体 //token 设置到公共请求体
if(app.globalData.localAccountInfo != null){ if (app.globalData.localAccountInfo != null) {
commonRequest.token = app.globalData.localAccountInfo.token; commonRequest.token = app.globalData.localAccountInfo.token;
} }
commonRequest.deviceNo = app.globalData.sn; if (app.globalData.sn == null || app.globalData.sn == "") {
commonRequest.deviceNo = "unknow";
} else {
commonRequest.deviceNo = app.globalData.sn;
}
commonRequest.batchNo = ""; commonRequest.batchNo = "";
commonRequest.timestamp = timestampToTime(); commonRequest.timestamp = timestampToTime();
commonRequest.format = "JSON"; commonRequest.format = "JSON";
...@@ -70,7 +74,7 @@ function timestampToTime() { ...@@ -70,7 +74,7 @@ function timestampToTime() {
var date = new Date(); var date = new Date();
var Y = date.getFullYear() + '-'; var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() < 10 ? '0'+date.getDate()+ ' ' : date.getDate()+ ' '; var D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
var h = date.getHours() + ':'; var h = date.getHours() + ':';
var m = date.getMinutes() + ':'; var m = date.getMinutes() + ':';
var s = date.getSeconds(); var s = date.getSeconds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment