Commit e195f375 authored by pengguangpu's avatar pengguangpu

整合打印上一单页面至index;

parent 242d45e7
......@@ -852,3 +852,71 @@
width: 100%;
height: auto;
}
/**打印上一单*/
.printLastOrderPage {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
position: absolute;
}
.topView {
position: absolute;
top: 0rpx;
width: 100%;
height: 60rpx;
background: #ffffff;
box-shadow: 0rpx 2rpx 7rpx 0rpx rgba(153, 153, 153, 0.16);
/* border: 2px solid red; */
}
.printLastOrderTitleText {
position: absolute;
line-height: 60rpx;
height: 100%;
font-size: 22rpx;
font-weight: bold;
text-align: center;
align-items: center;
width: 100%;
color: #333333;
align-content: center;
/* border: 2px solid red; */
}
.printLastOrderBackButton {
position: absolute;
height: 60rpx;
text-align: center;
align-items: center;
align-content: center;
font-size: 19rpx;
line-height: 60rpx;
/* border: 2px solid red; */
padding-left: 19rpx;
padding-right: 19rpx;
}
.printLastOrderBottomView {
height: 100%;
background: white;
width: 100%;
position: absolute;
/* display: flex;
flex-direction: column; */
/* border: 2px solid red; */
}
.printLastOrderPrintStatusHint {
color: #333333;
font-size: 26rpx;
margin: 0 auto;
width: 100%;
text-align: center;
font-weight: bold;
position: absolute;
top: 89rpx;
}
\ No newline at end of file
......@@ -11,7 +11,6 @@
<image mode="aspectFit" src="/images/icon_exit.png" style="position:relative;width:19rpx;height:19rpx;margin-right:8rpx;margin-top:1rpx;"/>
</view>
</view>
<view class="homeBodyView" style="height:100%;">
<swiper indicator-dots="{{true}}">
<swiper-item>
......@@ -76,10 +75,9 @@
</swiper-item>
</swiper>
</view>
<!-- 兑换优惠券 -->
<view class="page-coupon" a:if="{{convertCouponState != 0}}">
<view class="coupon-top" >
<view class="coupon-top">
<view class="coupon-back-container" onTap="convertCouponClose" a:if="{{convertCouponState == 1}}">
<image class="coupon-back-icon" mode="aspectFit" src="/images/icon_back.png"/>
<text class="coupon-back-text">返回</text>
......@@ -280,10 +278,56 @@
</view>
</view>
</view>
<!--打印上一单-->
<view hidden="{{!pageShow['printlastorder']}}">
<view class="printLastOrderPage">
<!--下半部分布局-->
<view class="printLastOrderBottomView">
<text class="printLastOrderPrintStatusHint">{{printLastOrderPrintStatusHint}}</text>
<!--层叠布局-->
<view style="width:277rpx;height:196rpx;margin:0 auto;position:absolute;top:132rpx;left:0rpx;right:0rpx;display:relative;">
<image mode="aspectFit" style="width:277rpx;height:196rpx;margin:0 auto;" src="/images/bg_paper.png"/>
<block a:if="{{!printLastOrderIsPrinting}}">
<block a:if="{{!printLastOrderIsPrintSuccess}}">
<view style="position:absolute;margin:0 auto;top:107rpx;left:0rpx;right:0rpx;width:124rpx;height:41rpx;font-size:19rpx;">
<button size="mini" type="ghost" style="border-radius:20rpx;height:41rpx;width:124rpx;border-color:#F96146;" onTap="onPrintLastOrderRePrintClicked">
<text style="font-size:19rpx;color:#F96146;line-height:41rpx;text-align:center;position:absolute;top:0rpx;left:0rpx;right:0rpx;">重新打印</text></button>
</view>
</block>
<block a:else>
<!--打印成功-->
<text style="color:#333333;font-size:19rpx;position:absolute;left:0rpx;right:0rpx;margin:0 auto;width:100%;text-align:center;top:93rpx;">提示顾客带好小票</text>
</block>
</block>
</view>
<view style="position:absolute;top:342rpx;margin:0 auto;left:0rpx;right:0rpx;width:252rpx;height:60rpx;text-align:center;">
<block a:if="{{!printLastOrderIsPrintSuccess}}">
<button size="default" type="ghost" style="width:252rpx;height:60rpx;text-align:center;border-color:#007AFF;" onTap="onPrintLastOrderCancelClicked">
<text style="color:#007AFF;position:absolute;line-height:60rpx;left:0rpx;right:0rpx;font-size:24rpx;font-weight:bold;">取消</text></button>
</block>
<block a:else>
<button size="default" type="primary" style="width:252rpx;height:60rpx;text-align:center;border-color:#007AFF;color:#007AFF;" onTap="onPrintLastOrderConfirmClicked">
<text style="color:#ffffff;position:absolute;line-height:60rpx;left:0rpx;right:0rpx;font-size:24rpx;font-weight:bold;">确定</text></button>
</block>
</view>
</view>
<!--topTitle-->
<view class="topView" onTap="onPrintLastOrderBackClicked">
<!--title-->
<view class="printLastOrderTitleText">
<text>打印上一单</text>
</view>
<!--返回键-->
<view class="printLastOrderBackButton">
<image mode="aspectFit" style="width:9rpx;height:18rpx;margin-right:8rpx;" src="/images/icon_back.png"/>
<text>返回</text>
</view>
</view>
</view>
</view>
<!-- 键盘 -->
<land-keybord scene="{{scene}}" onKeyBordFinished="onKeyBordFinished" onKeyBordClose="onKeyBordClose">
</land-keybord>
<!-- 等待前屏登录 -->
<view class="login-waiting-page" a:if="{{!isFrontScreenLoginOK}}">
<image class="login-waiting-left" mode="aspectFill" src="/images/login_wait_left.png"/>
......@@ -293,7 +337,6 @@
<!-- 操作结果页 -->
<view hidden="{{!pageShow['operateResult']}}">
<view class="operateTopView"></view>
<view class="operateBodyView">
<block a:if="{{operateSuccess}}">
<image class="operateResultIcon" mode="aspectFit" src="/images/icon_success.png"/>
......@@ -304,7 +347,6 @@
<view class="operateResultConfirmBtnText">确定</view>
</view>
</view>
</block>
<block a:else>
<image class="operateResultIcon" mode="aspectFit" src="/images/icon_failed.png"/>
......@@ -317,11 +359,8 @@
<view class="operateResultConfirmBtn">
<view class="operateResultConfirmBtnText">重新退款</view>
</view>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file
</view>
\ No newline at end of file
......@@ -17,7 +17,7 @@ import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND} from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND } from '../../const/actioncmd'
Page({
data: {
//页面控制相关参数
......@@ -26,11 +26,12 @@ Page({
"landscan": false,
"waitoperate": false,
"payresult": false,
"operateResult":false
"operateResult": false,
"printlastorder": false,
},
// 前屏是否完成登录
isFrontScreenLoginOK:false,
flowType:"", //流程类型:用于区分易混淆的流程,以及共同界面使用时用该标识位作为区分
isFrontScreenLoginOK: true,
flowType: "", //流程类型:用于区分易混淆的流程,以及共同界面使用时用该标识位作为区分
storeName: "--",
/**支付结果页相关参数 */
payFailedReason: "xxxxxxxxxxx",
......@@ -61,11 +62,17 @@ Page({
totalDisc: 0.00,
goods: [
],
operateSuccess:false,
operateSuccessRemind:"退款成功",
operateSuccessDesc:"退款完成!会在1~2个工作日返还到付款账户",
operateFailedRemind:"退款失败",
operateFailedDesc:"核销失败!无效的订单码",
operateSuccess: false,
operateSuccessRemind: "退款成功",
operateSuccessDesc: "退款完成!会在1~2个工作日返还到付款账户",
operateFailedRemind: "退款失败",
operateFailedDesc: "核销失败!无效的订单码",
//打印上一单页面
printLastOrderPrintStatusHint: "正在打印上一单...",
//是否打印成功
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting:true
},
/**跳转页面方法 */
......@@ -75,7 +82,8 @@ Page({
"landscan": false,
"waitoperate": false,
"payresult": false,
"operateResult":false,
"operateResult": false,
"printlastorder":false
};
//遍历pageShow
for (var key in pageShowTemp) {
......@@ -178,26 +186,26 @@ Page({
context.setData({
storeName: res.data.storeName
});
}else if(res.action == ACTION_DIRECT_PAYMENT){
} else if (res.action == ACTION_DIRECT_PAYMENT) {
//直接收款
if(res.data != null){
context.setData({totalPrice:res.data})
if (res.data != null) {
context.setData({ totalPrice: res.data })
}
context.goPage('waitoperate');
}else if(res.action == ACTION_CONVERT_COUPON){
} else if (res.action == ACTION_CONVERT_COUPON) {
//兑换券
context.setData({convertCouponState:res.data.state})
if(null != res.data.msg){
context.setData({convertCouponMsg:res.data.msg})
context.setData({ convertCouponState: res.data.state })
if (null != res.data.msg) {
context.setData({ convertCouponMsg: res.data.msg })
}
}else if(res.action == ACTION_LOGIN_OK){
} else if (res.action == ACTION_LOGIN_OK) {
//前屏登录完成
context.setData({isFrontScreenLoginOK:true})
} else if(res.action == ACTION_REFUND_SUCCESS){
context.setData({ isFrontScreenLoginOK: true })
} else if (res.action == ACTION_REFUND_SUCCESS) {
//跳转到成功页面
context.goPage('operateResult');
} else if(res.action == ACTION_REFUND_FAILED) {
} else if (res.action == ACTION_REFUND_FAILED) {
context.setData({
isPaySuccess: false,
});
......@@ -255,14 +263,14 @@ Page({
/**首页相关 */
/**立即收款 */
onHomeCashierImmediatelyClicked() {
this.setData({scene:3})
this.setData({ scene: 3 })
},
/**
* 兑换
*/
onHomeExchangeClicked() {
this.setData({convertCouponState:1})
this.setData({ convertCouponState: 1 })
this.sendConvertCouponToFront(1)
},
......@@ -278,17 +286,18 @@ Page({
*/
onHomeRefundClicked() {
this.setData({
flowType :FLOW_REFUND,
scene:4
flowType: FLOW_REFUND,
scene: 4
})
console.log("scene:"+this.data.scene)
console.log("scene:" + this.data.scene)
},
/**
* 打印上一单
*/
onHomePrintLastOrderClicked() {
//跳转至打印上一单页面
this.goPage('printlastorder');
},
/**
......@@ -442,11 +451,11 @@ Page({
//键盘完成
onKeyBordFinished(result) {
if(this.data.scene == 3){
if (this.data.scene == 3) {
this.sendPaymentToFront(result)
}else if(this.data.scene == 1){
} else if (this.data.scene == 1) {
this.sendGoodsInfoToFront(result)
}else if(this.data.scene ==4){
} else if (this.data.scene == 4) {
this.sendRefund(result);
return;
}
......@@ -620,21 +629,21 @@ Page({
//兑换券界面关闭
convertCouponClose(e){
this.setData({convertCouponState:0})
//兑换券界面关闭
convertCouponClose(e) {
this.setData({ convertCouponState: 0 })
this.sendConvertCouponToFront(0)
},
//发生兑换券到前屏
sendConvertCouponToFront(res){
sendConvertCouponToFront(res) {
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action:ACTION_CONVERT_COUPON,
data:res
action: ACTION_CONVERT_COUPON,
data: res
},
success: (sres) => {
console.log("兑换券通知前屏 成功 ===》" + JSON.stringify(sres));
......@@ -656,21 +665,21 @@ Page({
},
//发送退款金额.以分为单位
sendRefund(amount){
sendRefund(amount) {
var miyapay = require("/utils/miyapay4.js");
var refundAmount = miyapay.yuan2Fen(amount);
console.log("amount"+refundAmount);
console.log("amount" + refundAmount);
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data:{
data: {
action: ACTION_REFUND,
data: refundAmount
},
success:(res)=>{
success: (res) => {
//成功发送则
console.log("发送退款金额到前屏小程序成功 ===》" + JSON.stringify(res));
},
fail:(res)=>{
fail: (res) => {
my.showToast({
type: 'fail',
content: '发送退款金额到前屏失败',
......@@ -680,5 +689,18 @@ Page({
});
}
})
}
},
/**
* 打印上一单页面
*/
onPrintLastOrderCancelClicked() { },
onPrintLastOrderConfirmClicked() { },
onPrintLastOrderRePrintClicked() { },
onPrintLastOrderBackClicked(){}
});
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