Commit d9b2155b authored by pengguangpu's avatar pengguangpu

支付结果页初步联调;

parent e52078b1
......@@ -504,14 +504,14 @@
/* 结算页 */
page{
/* page{
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
box-sizing: border-box;
align-items: center;
}
} */
.topView{
position: relative;
......
......@@ -21,7 +21,7 @@
</view>
</view>
</view>
<!--扫码页-->
<view hidden="{{!pageShow['landscan']}}">
<view class="{{scene != 0 ? 'pfilter' : 'pageland' }}">
......@@ -176,13 +176,13 @@
</block>
<block a:else>
<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>
</block>
</view>
</view>
<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>
</block>
<block a:else>
......
......@@ -10,19 +10,19 @@ Page({
data: {
//页面控制相关参数
pageShow: {
"home": true,
"landscan": false,
"waitoperate":false,
"home": false,
"landscan": true,
"waitoperate": false,
"payresult": false
},
storeName:"--",
storeName: "--",
/**支付结果页相关参数 */
payFailedReason: "xxxxxxxxxxx",
isPaySuccess: true,
payPriceYuan: "--.--",
printResult: "正在打印小票...",
isPrinting: false,
isPrintSuccess: true,
isPrintSuccess: false,
/**商品扫码页相关参数 */
//是否正在用券
couponUseing: false,
......@@ -40,15 +40,26 @@ Page({
/**跳转页面方法 */
goPage(pageName) {
var pageShowTemp = {
"home": false,
"landscan": false,
"waitoperate": false,
"payresult": false
};
//遍历pageShow
for (var key in this.data.pageShow) {
for (var key in pageShowTemp) {
if (key == pageName) {
this.data.pageShow[key] = true;
pageShowTemp[key] = true;
my.showToast({
content: "跳页"
});
} else {
this.data.pageShow[key] = false;
pageShowTemp[key] = false;
}
}
this.setData({
pageShow: pageShowTemp
});
},
......@@ -61,13 +72,32 @@ Page({
},
onShow() {
// 页面显示
let context = this;
//开启后屏监听
my.ix.onBuddyMessage({
success: (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) {
//商品信息同步
my.hideLoading();
......@@ -80,7 +110,7 @@ Page({
totalDisc: viewGoodsInfo.totalDisc,
})
}
} else if(res.action == ACTION){
} else if (res.action == ACTION) {
//未知指令
}
}
......@@ -118,7 +148,7 @@ Page({
//通知前屏重新打印
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: "****************",
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_REPRINT,
data: null
......@@ -132,6 +162,16 @@ Page({
});
},
onNextPayFromPayResult() {
//重制打印状态
this.setData({
isPrinting: true,
printResult: "正在打印..."
});
//跳转首页
this.goPage('home');
},
/**landscan页面逻辑方法 */
//把所有的商品数据发送到后屏
......@@ -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