Commit d9b2155b authored by pengguangpu's avatar pengguangpu

支付结果页初步联调;

parent e52078b1
...@@ -504,14 +504,14 @@ ...@@ -504,14 +504,14 @@
/* 结算页 */ /* 结算页 */
page{ /* page{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
align-items: center; align-items: center;
} } */
.topView{ .topView{
position: relative; position: relative;
......
...@@ -176,13 +176,13 @@ ...@@ -176,13 +176,13 @@
</block> </block>
<block a:else> <block a:else>
<view hidden="{{isPrinting}}"> <view hidden="{{isPrinting}}">
<button type="ghost" style="height:40rpx;margin:0 auto;border-radius:20rpx;border-color:#FF7F19;color:#FF7F19;width:166rpx;" hover-class="loginButtonHover" onTap="onReprint">重新打印</button> <button type="ghost" style="margin:0 auto;font-size:28rpx;height:40rpx;border-radius:20rpx;border-color:#FF7F19;color:#FF7F19;width:166rpx;" onTap="onReprint">重新打印</button>
</view> </view>
</block> </block>
</view> </view>
</view> </view>
<view hidden="{{isPrinting}}"> <view hidden="{{isPrinting}}">
<button type="primary" style="height:60rpx;margin-top:8rpx;border-radius:5rpx;background-color:#007AFF;border-color:#007AFF;opacity: 0.7;width:252rpx;" hover-class="loginButtonHover" onTap="">继续付款</button> <button type="primary" style="height:60rpx;margin-top:8rpx;border-radius:5rpx;background-color:#007AFF;border-color:#007AFF;opacity: 0.7;width:252rpx;" hover-class="loginButtonHover" onTap="onNextPayFromPayResult">继续付款</button>
</view> </view>
</block> </block>
<block a:else> <block a:else>
......
...@@ -10,19 +10,19 @@ Page({ ...@@ -10,19 +10,19 @@ Page({
data: { data: {
//页面控制相关参数 //页面控制相关参数
pageShow: { pageShow: {
"home": true, "home": false,
"landscan": false, "landscan": true,
"waitoperate":false, "waitoperate": false,
"payresult": false "payresult": false
}, },
storeName:"--", storeName: "--",
/**支付结果页相关参数 */ /**支付结果页相关参数 */
payFailedReason: "xxxxxxxxxxx", payFailedReason: "xxxxxxxxxxx",
isPaySuccess: true, isPaySuccess: true,
payPriceYuan: "--.--", payPriceYuan: "--.--",
printResult: "正在打印小票...", printResult: "正在打印小票...",
isPrinting: false, isPrinting: false,
isPrintSuccess: true, isPrintSuccess: false,
/**商品扫码页相关参数 */ /**商品扫码页相关参数 */
//是否正在用券 //是否正在用券
couponUseing: false, couponUseing: false,
...@@ -40,15 +40,26 @@ Page({ ...@@ -40,15 +40,26 @@ Page({
/**跳转页面方法 */ /**跳转页面方法 */
goPage(pageName) { goPage(pageName) {
var pageShowTemp = {
"home": false,
"landscan": false,
"waitoperate": false,
"payresult": false
};
//遍历pageShow //遍历pageShow
for (var key in this.data.pageShow) { for (var key in pageShowTemp) {
if (key == pageName) { if (key == pageName) {
this.data.pageShow[key] = true; pageShowTemp[key] = true;
my.showToast({
content: "跳页"
});
} else { } else {
this.data.pageShow[key] = false; pageShowTemp[key] = false;
} }
} }
this.setData({
pageShow: pageShowTemp
});
}, },
...@@ -61,13 +72,32 @@ Page({ ...@@ -61,13 +72,32 @@ Page({
}, },
onShow() { onShow() {
// 页面显示 // 页面显示
let context = this;
//开启后屏监听 //开启后屏监听
my.ix.onBuddyMessage({ my.ix.onBuddyMessage({
success: (res) => { success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`); console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if (res.action == ACTION_PRINT_RESULT) { my.showToast({
content: JSON.stringify(res)
});
if (res.action == ACTION_PRINT_RESULT && context.data.pageShow['payresult'] == true) {
//获取到打印结果 //获取到打印结果
var printResult = res.data; var printResultData = res.data;
if (printResultData.code == 0) {
//打印成功
context.setData({
isPrintSuccess: true,
isPrinting: false,
printResult: "打印成功"
});
} else {
//打印失败
context.setData({
isPrintSuccess: false,
isPrinting: false,
printResult: "打印失败"
});
}
} else if (res.action == ACTION_GOODS) { } else if (res.action == ACTION_GOODS) {
//商品信息同步 //商品信息同步
my.hideLoading(); my.hideLoading();
...@@ -80,7 +110,7 @@ Page({ ...@@ -80,7 +110,7 @@ Page({
totalDisc: viewGoodsInfo.totalDisc, totalDisc: viewGoodsInfo.totalDisc,
}) })
} }
} else if(res.action == ACTION){ } else if (res.action == ACTION) {
//未知指令 //未知指令
} }
} }
...@@ -118,7 +148,7 @@ Page({ ...@@ -118,7 +148,7 @@ Page({
//通知前屏重新打印 //通知前屏重新打印
my.ix.sendBuddyMessage({ my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID // 填入目标小程序的 AppID
target: "****************", target: getApp().globalData.frontScreenAppId,
data: { data: {
action: ACTION_REPRINT, action: ACTION_REPRINT,
data: null data: null
...@@ -132,6 +162,16 @@ Page({ ...@@ -132,6 +162,16 @@ Page({
}); });
}, },
onNextPayFromPayResult() {
//重制打印状态
this.setData({
isPrinting: true,
printResult: "正在打印..."
});
//跳转首页
this.goPage('home');
},
/**landscan页面逻辑方法 */ /**landscan页面逻辑方法 */
//把所有的商品数据发送到后屏 //把所有的商品数据发送到后屏
...@@ -294,7 +334,8 @@ Page({ ...@@ -294,7 +334,8 @@ Page({
}); });
} }
}) })
//跳转结算页
this.goPage('waitoperate');
}, },
//用券返回 //用券返回
......
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