Commit c228b6f2 authored by jiangjiantao's avatar jiangjiantao

bugfix

parents 6d241afb 757ec9df
......@@ -16,6 +16,9 @@ export const ACTION_REQUEST_GOOD_INFO = "ACTION_REQUEST_GOOD_INFO";
//去扫码页面
export const ACTION_GO_SCAN = "ACTION_GO_SCAN";
//会员登录
export const ACTION_MEMBER = "ACTION_MEMBER";
//获取店铺信息
export const ACTION_STORE_INFO = "ACTION_STORE_INFO";
......@@ -56,9 +59,10 @@ export const ACTION_PRINT_LAST_ORDER = "ACTION_PRINT_LAST_ORDER";
export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";
const FLOW_REFUND = "refund";
const FLOW_COLLECTIONS = "collections";//收款
const FLOW_REFUND = "refund";//退款
const FLOW_DIRECT_PAYMENT = "direct_payment"
export {
FLOW_IDLE,FLOW_COLLECTIONS,FLOW_REFUND
FLOW_IDLE,FLOW_COLLECTIONS,FLOW_REFUND,FLOW_DIRECT_PAYMENT
}
......@@ -29,8 +29,6 @@ Component({
scenes: nextProps.scene,
});
console.log("scenes:"+this.data.scenes);
},
methods: {
......
......@@ -222,6 +222,16 @@
font-size: 19rpx
}
.land-scan-member {
margin-left: 19rpx;
text-align: left;
font-size: 19rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);
line-height: 21rpx;
}
/* 顶部收银字体样式 */
.cashier-text {
......@@ -619,11 +629,32 @@
border: 2px solid red;
}
/* 结算页 */
/* 等待操作页 */
.waitOperate {
display: flex;
flex-direction: column;
position: absolute;
width: 100%;
height: 100%;
left: 0rpx;
top: 0rpx;
}
.waitOperateBackButton {
color: #333333;
font-size: 19rpx;
line-height: 60rpx;
height: 60rpx;
width: 110rpx;
text-align: center;
/* border: 2px solid red; */
position: relative;
}
.balanceTopView {
position: relative;
width: 768rpx;
width: 750rpx;
height: 60rpx;
background: rgba(255, 255, 255, 1);
/* border: 2px solid red; */
......@@ -634,11 +665,11 @@
display: flex;
flex-direction: row;
position: relative;
width: 768rpx;
height: 372rpx;
width: 750rpx;
height: 362rpx;
box-sizing: border-box;
align-items: center;
background: #F3F7F9;
background: #FFFFFF;
}
.leftBody {
......@@ -647,6 +678,7 @@
position: relative;
width: 52.8%;
height: 100%;
background: rgba(243, 247, 249, 1);
box-sizing: border-box;
}
......@@ -960,3 +992,69 @@
position: absolute;
top: 89rpx;
}
/* 取消等待操作页的操作。名称为recheck*/
.recheckPage {
width: 100%;
height: 100%;
position: absolute;
background: rgba(0, 0, 0, 0.65);
display: flex;
flex-direction: column;
align-items: center;
z-index: 1;
}
.recheckDialog {
width: 516rpx;
height: 292rpx;
background: rgba(255, 255, 255, 1);
border-radius: 5px;
margin-top: 65rpx;
display: flex;
position: relative;
flex-direction: column;
align-items: center;
}
.recheckRemind {
font-size: 21rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 26rpx;
margin-top: 60rpx;
}
.recheckButtonConfirm {
width: 246rpx;
height: 60rpx;
background: rgba(0, 122, 255, 1);
border-radius: 5rpx;
position: relative;
box-sizing: border-box;
margin-top: 32rpx;
}
.recheckButtonCancel {
width: 252rpx;
height: 60rpx;
background: rgba(255, 255, 255, 1);
border-radius: 5rpx;
border: 2rpx solid rgba(0, 122, 255, 1);
position: relative;
box-sizing: border-box;
margin-top: 19rpx;
}
.recheckButtonText {
width: 100%;
height: 60rpx;
margin: 0 auto;
text-align: center;
font-size: 24rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
line-height: 60rpx;
}
\ No newline at end of file
......@@ -6,10 +6,10 @@
<text style="position:absolute;font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(0,0,0,0.85);line-height:22rpx;left:55rpx;top:19rpx;">{{storeName}}</text>
</view>
<view style="position:absolute;font-size:22rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(51,51,51,1);line-height:22rpx;left:0rpx;top:19rpx;width:100%;text-align:center;">首页</view>
<view style="display:flex;flex-direction:row-reverse;position:absolute;right:19rpx;top:19rpx;width:auto;background:#ffffff;">
<!-- <view style="display:flex;flex-direction:row-reverse;position:absolute;right:19rpx;top:19rpx;width:auto;background:#ffffff;">
<view style="font-size:19rpx;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:rgba(51,51,51,1);line-height:22rpx;">退出</view>
<image mode="aspectFit" src="/images/icon_exit.png" style="position:relative;width:19rpx;height:19rpx;margin-right:8rpx;margin-top:1rpx;"/>
</view>
</view> -->
</view>
<view class="homeBodyView" style="height:100%;">
<swiper indicator-dots="{{true}}">
......@@ -118,7 +118,8 @@
<view hidden="{{!pageShow['landscan']}}">
<view class="{{scene != 0 ? 'pfilter' : 'pageland' }}">
<view class="land-scan-top">
<button class="land-scan-top-member-login" size="default" type="ghost">会员登陆</button>
<button class="land-scan-top-member-login" size="default" type="ghost" catchTap="onMemberTap" a:if="{{memberPhoneShown == ''}}">会员登录</button>
<view class="land-scan-member" hidden="{{memberPhoneShown == ''}}">会员,{{memberPhoneShown}}</view>
<text class="cashier-text">收银</text>
<view onTap="goHome">
<image class="go-home-icon" mode="aspectFit" src="/images/icon_home.png"/>
......@@ -204,11 +205,11 @@
</view>
</view>
</view>
<!-- 结算页 -->
<view class="balance" hidden="{{!pageShow['waitoperate']}}">
<!-- 等待操作页 -->
<view class="waitOperate" hidden="{{!pageShow['waitoperate']}}">
<view class="balanceTopView">
<!--back button-->
<view catchTap="waitOperateBack" class="backButton">
<view catchTap="waitOperateBack" class="waitOperateBackButton">
<image mode="aspectFit" style="position:absolute;width:11rpx;height:17rpx;left: 18rpx;top:22rpx;" src="/images/icon_back.png"/>
<text>返回</text>
</view>
......@@ -216,26 +217,27 @@
<!-- 界面主体 -->
<view class="bodyContainer">
<view class="leftBody">
<view class="contentLine" style="margin-top:29rpx;">
<view class="contentLine" style="margin-top:29rpx;" hidden="{{flowType!='collections'}}">
<view class="descText">合计金额:</view>
<view class="totalPrice">¥{{totalPrice}}</view>
</view>
<view class="contentLine" style="margin-top: 14.5rpx;">
<view class="contentLine" style="margin-top: 14.5rpx;" hidden="{{flowType!='collections'}}">
<view class="descText">商家优惠:</view>
<view class="totalCoupon">¥{{totalDisc}}</view>
<view class="totalCoupon">¥{{discCouponPrice}}</view>
</view>
<view style="position: absolute;display: flex;flex-direction: row;align-items: baseline;bottom:22rpx;left:0rpx;padding-left: 29rpx;">
<view class="descText">应收款:</view>
<view class="descText">{{waitOperateMoneyRemind}}</view>
<view class="moneySign">¥</view>
<view class="payPrice">{{totalPrice - totalDisc}}</view>
<view class="descText">(共{{totalQuantity}}件)</view>
<view class="payPrice">{{waitOperateAmount}}</view>
<view class="descText" hidden="{{flowType!='collections'}}">(共{{totalQuantity}}件)</view>
</view>
</view>
<view class="rightBody">
<view class="remindText">等待顾客付款…</view>
<view class="remindText">{{waitOperateRemindText}}</view>
<image mode="aspectFit" style="width:166rpx;height:143rpx;margin-top:39rpx;" src="/images/icon_wait_operate.png"/>
<view catchTap="waitOperateBack" style="width:252rpx;height:60rpx;background:rgba(255,255,255,1);border-radius:5rpx;border:2rpx solid rgba(0,122,255,1);position:relative;box-sizing: border-box;margin-top:32rpx;">
<view catchTap="cancelCollect" style="width:100%;height:60rpx;margin:0 auto;text-align:center;font-size:24rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(0,122,255,1);line-height:60rpx;">取消收款</view>
<view catchTap="waitOperateCancel" style="width:252rpx;height:60rpx;background:rgba(255,255,255,1);border-radius:5rpx;border:2rpx solid rgba(0,122,255,1);position:relative;box-sizing: border-box;margin-top:32rpx;">
<view style="width:100%;height:60rpx;margin:0 auto;text-align:center;font-size:24rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(0,122,255,1);line-height:60rpx;">{{waitOperateCancelText}}</view>
</view>
</view>
</view>
......@@ -349,12 +351,6 @@
<!-- 键盘 -->
<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"/>
<view class="login-waiting-right">
<image class="login-waiting-right-image" mode="aspectFit" src="/images/login_waiting_right.png"/>
</view>
<!-- 操作结果页 -->
<view hidden="{{!pageShow['operateResult']}}">
<view class="operateTopView"></view>
......@@ -365,7 +361,7 @@
<view class="operateResultDesc">{{operateSuccessDesc}}</view>
<view class="operateResultBtnContainer">
<view class="operateResultConfirmBtn">
<view class="operateResultConfirmBtnText">确定</view>
<view class="operateResultConfirmBtnText" onTap="operateResultClose">确定</view>
</view>
</view>
</block>
......@@ -375,13 +371,25 @@
<view class="operateResultDesc">{{operateFailedDesc}}</view>
<view class="operateResultBtnContainer">
<view class="operateResultCloseBtn">
<view class="operateResultCloseBtnText">关闭</view>
<view class="operateResultCloseBtnText" onTap="operateResultClose">关闭</view>
</view>
<view class="operateResultConfirmBtn">
<view class="operateResultConfirmBtnText">重新退款</view>
<view class="operateResultConfirmBtnText" onTap="operateResultReOperate">{{operateReDo}}</view>
</view>
</view>
</block>
</view>
</view>
<!-- 重新检查弹窗 -->
<view class="recheckPage" hidden="{{!recheckShow}}">
<view class="recheckDialog">
<view class="recheckRemind">{{recheckRemind}}</view>
<view class="recheckButtonConfirm" onTap="recheckConfirm">
<view class="recheckButtonText" style="color:#ffffff;">确定</view>
</view>
<view class="recheckButtonCancel" onTap="recheckCancel">
<view class="recheckButtonText" style="color:rgba(0,122,255,1);">取消</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
var api = require("../../utils/api.js");
import { API_SCAN } from '../../const/apiurl'
import { ACTION_GOODS } from '../../const/actioncmd'
import { ACTION_MEMBER } from '../../const/actioncmd'
import { ACTION_GO_BALANCE } from '../../const/actioncmd'
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd'
import { ACTION_PRINT_RESULT } from '../../const/actioncmd'
......@@ -17,8 +18,8 @@ import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { ACTION_PRINT_LAST_ORDER } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND } from '../../const/actioncmd'
import { ACTION_USE_COUPON } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT } from '../../const/actioncmd'
Page({
......@@ -65,17 +66,38 @@ Page({
totalDisc: 0.00,
goods: [
],
memberPhone: '',
memberPhoneShown: '',
//打印上一单页面
printLastOrderPrintStatusHint: "正在打印上一单...",
//是否打印成功
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting: true,
/** 等待操作页面的参数 */
//左上角的显示隐藏,左下角的文字提示
waitOperateRemindText: "等待顾客付款…",
waitOperateCancelText: "取消收款",
waitOperateCancelRecheckShow: false,
waitOperateMoneyRemind: "应收款:",
waitOperateAmount: 0.00,
/** 操作结果页参数 */
//在操作中携带的内容,可自定义内容,每次操作的开始和结束应当把该值给重置
operateContext: {},
operateSuccess: false,
operateSuccessRemind: "退款成功",
operateSuccessDesc: "退款完成!会在1~2个工作日返还到付款账户",
operateFailedRemind: "退款失败",
operateFailedDesc: "核销失败!无效的订单码",
operateReDo: "重新退款",
//打印上一单页面
printLastOrderPrintStatusHint: "正在打印上一单...",
//是否打印成功
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting: true
/** 重新检查的窗口 */
recheckBlock: false,//屏蔽取消操作,防止在实际已经进行了接口请求时还能取消,使得流程混乱
recheckShow: false,
recheckRemind: "确定要取消此收款订单吗?",
},
/**跳转页面方法 */
......@@ -142,12 +164,13 @@ Page({
isPrinting: true,
printResult: "正在打印...",
payPriceYuan: "--.--",
payPriceFen: 0
payPriceFen: 0,
});
//跳首页
context.goPage('home');
setData({
context.setData({
flowType: FLOW_IDLE,
operateContext: {},//重新初始化
})
} else if (res.action == ACTION_GOODS) {
//商品信息同步
......@@ -164,9 +187,6 @@ Page({
} else if (res.action == ACTION_GO_SCAN) {
//跳转到
context.goPage('landscan');
} else if (res.action == ACTION_GO_BALANCE) {
//跳转
context.goPage('waitoperate');
} else if (res.action == ACTION_ON_PAY_SUCCESS) {
//分转元
......@@ -192,7 +212,7 @@ Page({
} else if (res.action == ACTION_DIRECT_PAYMENT) {
//直接收款
if (res.data != null) {
context.setData({ totalPrice: res.data })
context.setData({ waitOperateAmount: res.data })
}
context.goPage('waitoperate');
} else if (res.action == ACTION_CONVERT_COUPON) {
......@@ -203,14 +223,20 @@ Page({
}
} else if (res.action == ACTION_LOGIN_OK) {
//前屏登录完成
context.setData({ isFrontScreenLoginOK: true,storeName:res.data })
context.setData({ isFrontScreenLoginOK: true, storeName: res.data })
} else if (res.action == ACTION_REFUND_SUCCESS) {
//跳转到成功页面
context.setData({
operateSuccess: true,
operateSuccessRemind: "退款成功",
operateSuccessDesc: "退款完成!会在1~2个工作日返还到付款账户",
});
context.goPage('operateResult');
} else if (res.action == ACTION_REFUND_FAILED) {
context.setData({
isPaySuccess: false,
operateSuccess: false,
operateFailedRemind: "退款失败",
operateFailedDesc: res.data,
});
context.goPage('operateResult');
} else if (res.action == ACTION_PRINT_LAST_ORDER && context.data.pageShow['printlastorder'] == true) {
......@@ -224,13 +250,13 @@ Page({
//打印成功
context.setData({
printLastOrderIsPrintSuccess: true,
printLastOrderPrintStatusHint:"打印完成"
printLastOrderPrintStatusHint: "打印完成"
});
} else {
//打印失败
context.setData({
printLastOrderIsPrintSuccess: false,
printLastOrderPrintStatusHint:"打印失败"
printLastOrderPrintStatusHint: "打印失败"
});
}
}else if(res.action == ACTION_USE_COUPON){
......@@ -267,7 +293,7 @@ Page({
//回到首页
goHome(){
goHome() {
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
......@@ -277,6 +303,8 @@ Page({
},
success: (res) => {
context.goPage('home');
context.reinitData();
console.log("通知前屏回到首页 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
......@@ -285,6 +313,16 @@ Page({
});
},
//重置部分必须重置的内容
reinitData() {
this.setData({
flowType: FLOW_IDLE,
operateContext: {},//重新初始化
memberPhone: '',
memberPhoneShown: '',
})
},
onShareAppMessage() {
// 返回自定义分享信息
return {
......@@ -313,7 +351,8 @@ Page({
/**首页相关 */
/**立即收款 */
onHomeCashierImmediatelyClicked() {
this.setData({ scene: 3 })
this.setData({ scene: 3, flowType: FLOW_DIRECT_PAYMENT })
},
/**
......@@ -463,15 +502,21 @@ Page({
action: ACTION_GO_SCAN,
data: null
};
var context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: commonRequest,
success: (res) => {
flowType = FLOW_COLLECTIONS;
context.setData({
flowType: FLOW_COLLECTIONS
})
console.log("发送收银事件到前屏小程序 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
flowType = FLOW_IDLE;
context.setData({
flowType: FLOW_IDLE
})
console.log("发送收银事件到前屏小程序 失败 ===》 " + JSON.stringify(res));
//发送失败重试
// context.sendGoToCollections();
......@@ -536,9 +581,13 @@ Page({
this.sendPaymentToFront(result)
} else if (this.data.scene == 1) {
this.sendGoodsInfoToFront(result)
} else if (this.data.scene == 2) {
if(result.length !=11){
return;//键盘不给消失
}
this.sendMemberLogin(result);
} else if (this.data.scene == 4) {
this.sendRefund(result);
return;
}
this.onKeyBordClose();
},
......@@ -582,6 +631,10 @@ Page({
this.setData({ scene: 1 })
},
onMemberTap() {
this.setData({ scene: 2 })
},
//清空商品信息
clearGood(e) {
this.setData({ goods: [] })
......@@ -657,10 +710,36 @@ Page({
this.sendGoodInfoToFront()
},
sendMemberLogin(result) {
this.setData({
memberPhone: result
})
var phoneShown = this.data.memberPhone.substr(0, 3) + "****" + this.data.memberPhone.substr(7);
this.setData({
memberPhoneShown: phoneShown
})
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_MEMBER,
data: result
},
success: (res) => {
console.log("通知前屏会员登录 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
console.log("通知前屏会员登录 失败 ===》 " + JSON.stringify(res));
}
})
},
//跳转到结算等待页
goPay(e) {
//购物车不能为空
if(this.data.goods.length == 0){
if (this.data.goods.length == 0) {
my.showToast({
type: 'fail',
content: '等待收银员录入商品',
......@@ -671,6 +750,7 @@ Page({
return
}
//发送指令,前屏跳转
var commonRequest = {
action: ACTION_GO_BALANCE,
data: ""
......@@ -693,13 +773,22 @@ Page({
},
});
}
})
});
//后屏跳转
this.goPage('waitoperate');
var amount = this.data.totalPrice - this.data.totalDisc;
this.setData({
waitOperateAmount: amount,
});
},
waitOperateBack() {
//直接返回到扫码页面,并且通知前屏返回
if (this.data.flowType == FLOW_REFUND) {
this.operateResultClose();
} else if (this.data.flowType == FLOW_COLLECTIONS) {
this.goPage('landscan');
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
......@@ -720,9 +809,34 @@ Page({
});
}
})
} else if (this.data.flowType == FLOW_DIRECT_PAYMENT) {
this.goHome();
}
},
//等待操作页,取消付款/收款等按钮
waitOperateCancel() {
//todo 是否需要加上当接口在请求时,则屏蔽取消按钮的操作?
console.log("取消操作等待页");
if (this.data.flowType == FLOW_COLLECTIONS) {
this.setData({
recheckRemind: "确定要取消此收款订单吗?",
recheckShow: true,
});
} else if (this.data.flowType == FLOW_REFUND) {
this.setData({
recheckRemind: "确定要取消此退款订单吗?",
recheckShow: true,
});
} else if (this.data.flowType == FLOW_DIRECT_PAYMENT) {
this.setData({
recheckRemind: "确定要取消此支付订单吗?",
recheckShow: true,
});
}
},
//兑换券界面关闭
convertCouponClose(e) {
......@@ -766,7 +880,6 @@ Page({
},
fail: (fres) => {
console.log("兑换券通知前屏 失败 ===》 " + JSON.stringify(fres));
context.sendConvertCouponToFront(res)
}
})
},
......@@ -787,6 +900,28 @@ Page({
//发送退款金额.以分为单位
sendRefund(amount) {
var object = this.data.operateContext;
if (amount == null) {
if (object != null && object.refundAmount != null) {
amount = object.refundAmount;
} else {
console.log("refund failed");
return;
}
} else {
object.refundAmount = amount;
}
this.goPage('waitoperate');
this.setData({
waitOperateMoneyRemind: "应退款:",
waitOperateRemindText: "等待顾客扫描订单条码…",
waitOperateCancelText: "取消退款",
waitOperateAmount: amount,
})
//todo 修改等待操作界面的内容
var miyapay = require("/utils/miyapay4.js");
var refundAmount = miyapay.yuan2Fen(amount);
console.log("amount" + refundAmount);
......@@ -849,6 +984,58 @@ Page({
printLastOrderPrintStatusHint: "正在打印上一单"
});
this.goPage('home');
},
//结果页面关闭
operateResultClose() {
this.goPage('home');
this.setData({
flowType: FLOW_IDLE,
})
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_GO_HOME,
data: null
},
success: (res) => {
//成功发送则
console.log("发送退款金额到前屏小程序成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
my.showToast({
type: 'fail',
content: '发送关闭前屏操作结果页失败',
duration: 3000,
success: () => {
},
});
}
})
},
//操作没成功,重新操作
operateResultReOperate() {
if (this.data.flowType == FLOW_REFUND) {
//重新进行退款操作,后屏重新进入
this.sendRefund(null);
}
},
//重检查提示点击确定
recheckConfirm() {
this.setData({
recheckShow: false,
});
this.goHome();
},
recheckCancel() {
this.setData({
recheckShow: false,
});
},
});
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