Commit f53a33e8 authored by pengguangpu's avatar pengguangpu

添加支付成功页本地数据获取逻辑;

parent 0341da15
...@@ -13,20 +13,33 @@ Page({ ...@@ -13,20 +13,33 @@ Page({
couponName: "xxxxxxxx", couponName: "xxxxxxxx",
couponDateDuration: "xxxx.xx.xx-xxxx.xx.xx", couponDateDuration: "xxxx.xx.xx-xxxx.xx.xx",
isShowCoupon: false, isShowCoupon: false,
isShowPrinting: true isShowPrinting: true,
goodsList: [],
payChannel: "未知",
paySuccessResponse: null
}, },
onLoad(query) { onLoad(query) {
console.info(`Page onLoad with query: ${JSON.stringify(query)}`); console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
//从本地获取相关数据
this.data.goodsList.push(my.getStorageSync({ key: 'paySuccessGoodsList' }).data);
this.data.paySuccessResponse = my.getStorageSync({ key: 'paySuccessResponse' }).data;
//单位转换&赋值 //单位转换&赋值
this.data.orderPriceFen = query.orderPrice; this.data.orderPriceFen = this.data.paySuccessResponse.tradeAmount;
this.data.couponPriceFen = query.couponPrice; this.data.couponPriceFen = this.data.paySuccessResponse.mdiscount + this.data.paySuccessResponse.discount;
this.data.payPriceFen = query.payPrice; this.data.payPriceFen = this.data.paySuccessResponse.tradeAmount - (this.data.paySuccessResponse.mdiscount + this.data.paySuccessResponse.discount);
this.data.totalCount = query.totalCount; this.data.totalCount = query.totalCount;
var miyapay = require("../../utils/miyapay4.js"); var miyapay = require("../../utils/miyapay4.js");
this.data.orderPriceYuan = miyapay.fen2Yuan(this.data.orderPriceFen); this.data.orderPriceYuan = miyapay.fen2Yuan(this.data.orderPriceFen);
this.data.couponPriceYuan = miyapay.fen2Yuan(this.data.couponPriceFen); this.data.couponPriceYuan = miyapay.fen2Yuan(this.data.couponPriceFen);
this.data.payPriceYuan = miyapay.fen2Yuan(this.data.payPriceFen); this.data.payPriceYuan = miyapay.fen2Yuan(this.data.payPriceFen);
//支付渠道
if (this.data.paySuccessResponse.channel == 1) {
this.data.payChannel = "微信";
} else if (this.data.paySuccessResponse.channel == 3) {
this.data.payChannel = "支付宝";
}
}, },
print() { print() {
...@@ -35,24 +48,29 @@ Page({ ...@@ -35,24 +48,29 @@ Page({
var printCallbackTemp = this.printCallback.bind(this); var printCallbackTemp = this.printCallback.bind(this);
var cmds = [ var cmds = [
printer.setAlign(printer.ALIGN_CENTER), printer.setAlign(printer.ALIGN_CENTER),
printer.printText("storeName"), printer.printText(getApp().globalData.localAccountInfo.storeName),
printer.printDivide("-"), printer.printDivide("-"),
printer.setAlign(printer.ALIGN_LEFT), printer.setAlign(printer.ALIGN_LEFT),
printer.printText("门店号:"), printer.printText("门店号:" + this.paySuccessResponse.storeId),
printer.printText("收银员账号:"), printer.printText("收银员账号:" + this.paySuccessResponse.operatorId),
printer.printText("订单号:"), printer.printText("订单号:" + this.paySuccessResponse.tradeNo),
printer.printNowDate(), printer.printNowDate(),
printer.printDivide("-"), printer.printDivide("-"),
printer.printText("活动商品"), printer.printText("活动商品"),
printer.printText("活动名称 " + " 编码 " + " 数量"), printer.printText("商品名称 " + " 编码 " + " 数量"),
]; ];
for (var i = 0; i < 10; i++) { for (var i = 0; i < this.data.goodsList.length; i++) {
//循环取出商品数据 //循环取出商品数据
// cmds.push(); cmds.push(printer.setAlign(printer.ALIGN_LEFT));
cmds.push(printer.printText(goodsList[i].goodsName));
cmds.push(printer.printText(goodsList[i].barcode));
cmds.push(printer.setAlign(printer.ALIGN_RIGHT));
cmds.push(printer.printText(goodsList[i].goodsCount));
} }
cmds.push(printer.setAlign(printer.ALIGN_LEFT));
cmds.push(printer.printDivide("-")); cmds.push(printer.printDivide("-"));
cmds.push(printer.printText("应收金额:")); cmds.push(printer.printText("应收金额:" + this.data.orderPriceYuan));
cmds.push(printer.printText("支付方式实付:")); cmds.push(printer.printText("支付方式实付:" + this.data.payPriceYuan));
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
cmds.push(printer.feedPaper()); cmds.push(printer.feedPaper());
} }
......
...@@ -18,7 +18,7 @@ function login({ baseUrl, name, password, callback }) { ...@@ -18,7 +18,7 @@ function login({ baseUrl, name, password, callback }) {
timeout: 30000, timeout: 30000,
data: loginRequest, data: loginRequest,
success: (res) => { success: (res) => {
console.log("login success==>" + JSON.stringify(res)); console.log("login success==>" + JSON.stringify(res.data));
if (callback != null) { if (callback != null) {
if (res.data.success != true) { if (res.data.success != true) {
......
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