Commit 0e3880a1 authored by jiangjiantao's avatar jiangjiantao

核销券

parents 87d52a91 edf4cae0
......@@ -26,15 +26,14 @@ Page({
},
homeTap() {
this.showDialog();
// this.showDialog();
//FIXME 这里是跳转到新的界面
// my.navigateTo({
// url: "/pages/balance/balance"
// });
my.navigateTo({
url: "/pages/balance/balance"
});
},
//外接扫码枪事件
onKeyPress(r) {
console.log(" onKeyPress==>" + r);
......@@ -49,12 +48,12 @@ Page({
},
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
showDialog() {
this.setData({
scanDialogDisplay: 1
}
)
console.log(this.data.scanDialogDisplay);
},
......@@ -95,4 +94,5 @@ Page({
});
<view class="page">
<view class="topTitle">
<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;">
<text>支付成功</text>
</view>
......@@ -25,7 +25,7 @@
</view>
</view>
<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="display: absolute;margin:0 auto;align-content: center;align-items: center;text-align:center;line-height:186rpx;">
<text>{{printerStatus}}</text>
......
Page({
data: {
orderPriceYuan: "--.--",
orderPriceFen: 0,
couponPriceYuan: "--.--",
couponPriceFen: 0,
payPriceYuan: "--.--",
totalCount: "0",
payPriceFen: 0,
totalCount: 0,
printerStatus: "小票打印中",
couponPriceYuan: "--.--",
couponHint: "xxxxxx",
couponName: "xxxxxxxx",
couponDateDuration: "xxxx.xx.xx-xxxx.xx.xx",
isShowCoupon: true
isShowCoupon: false,
isShowPrinting: true
},
onLoad(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() {
......@@ -63,6 +77,20 @@ Page({
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
this.setData({
isShowPrinting: false
});
if (res.code == -1) {
//打印失败
this.setData({
printerStatus: "打印失败"
});
} else {
//打印成功
this.setData({
printerStatus: "打印成功"
});
}
},
onShow() {
......
......@@ -50,10 +50,14 @@ function createCommonRequest() {
};
commonRequest.appId = app.globalData.appId;
//token 设置到公共请求体
if(app.globalData.localAccountInfo != null){
if (app.globalData.localAccountInfo != null) {
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.timestamp = timestampToTime();
commonRequest.format = "JSON";
......@@ -70,7 +74,7 @@ function timestampToTime() {
var date = new Date();
var Y = date.getFullYear() + '-';
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 m = date.getMinutes() + ':';
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