Commit e7d8777a authored by gaodapeng's avatar gaodapeng

增加退出的逻辑

parent 7df4cb78
...@@ -83,6 +83,9 @@ export const ACTION_VERIFY_FAILED = "ACTION_VERIFY_FAILED"; ...@@ -83,6 +83,9 @@ export const ACTION_VERIFY_FAILED = "ACTION_VERIFY_FAILED";
//提货 //提货
export const ACTION_PICK_UP_GOODS = "ACTION_PICK_UP_GOODS"; export const ACTION_PICK_UP_GOODS = "ACTION_PICK_UP_GOODS";
//退出
export const ACTION_QUIT = "ACTION_QUIT";
const FLOW_IDLE = "idle"; const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";//收款 const FLOW_COLLECTIONS = "collections";//收款
const FLOW_REFUND = "refund";//退款 const FLOW_REFUND = "refund";//退款
......
...@@ -3,7 +3,7 @@ Component({ ...@@ -3,7 +3,7 @@ Component({
data: { data: {
result: "", result: "",
scenes: 2, scenes: 2,
errMsg:"" errMsg: ""
}, },
props: { props: {
...@@ -11,7 +11,7 @@ Component({ ...@@ -11,7 +11,7 @@ Component({
//场景 1.输入商品码 2.会员 3.收款 4.退款 //场景 1.输入商品码 2.会员 3.收款 4.退款
scene: 1, scene: 1,
//错误提示 //错误提示
errMsg:'' errMsg: ''
}, },
didMount() { }, didMount() { },
didUpdate() { }, didUpdate() { },
...@@ -22,7 +22,7 @@ Component({ ...@@ -22,7 +22,7 @@ Component({
if (nextProps.scene == 0) { if (nextProps.scene == 0) {
this.setData({ this.setData({
result: '', result: '',
errMsg:'', errMsg: '',
}); });
} }
...@@ -67,18 +67,24 @@ Component({ ...@@ -67,18 +67,24 @@ Component({
this.setData({ result: '' }); this.setData({ result: '' });
} }
}, finish(e) { }, finish(e) {
this.setData({ errMsg: "" })
if (this.data.scenes == 3 || this.data.scenes == 4) { if (this.data.scenes == 3 || this.data.scenes == 4) {
//判断价格是否参数合法 //判断价格是否参数合法
var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/; var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
if (!priceReg.test(this.data.result)) { if (!priceReg.test(this.data.result)) {
//错误提示 //错误提示
this.setData({errMsg:"金额格式有误"}) this.setData({ errMsg: "金额格式有误" })
return
}
} else if (this.data.scenes == 2) {
if (this.data.result == null || this.data.result.length != 11) {
this.setData({ errMsg: "会员号格式有误" })
return return
} }
} }
this.props.onKeyBordFinished(this.data.result); this.props.onKeyBordFinished(this.data.result);
},closeKeybord(e){ }, closeKeybord(e) {
this.props.onKeyBordClose(); this.props.onKeyBordClose();
} }
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<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> <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>
<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="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="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 style="display:flex;flex-direction:row-reverse;position:absolute;right:19rpx;top:19rpx;width:auto;background:#ffffff;" onTap="onQuit">
<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%;"> <view class="homeBodyView" style="height:100%;">
<swiper indicator-dots="{{true}}"> <swiper indicator-dots="{{true}}">
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
ACTION_USE_COUPON, ACTION_GOODS, ACTION_MEMBER, ACTION_USE_COUPON, ACTION_GOODS, ACTION_MEMBER,
ACTION_GO_BALANCE, ACTION_REQUEST_GOOD_INFO, ACTION_PRINT_RESULT, ACTION_GO_BALANCE, ACTION_REQUEST_GOOD_INFO, ACTION_PRINT_RESULT,
ACTION_REPRINT, ACTION_GO_SCAN, ACTION_ON_PAY_SUCCESS, ACTION_REPRINT, ACTION_GO_SCAN, ACTION_ON_PAY_SUCCESS,
ACTION_ON_PAY_FAILED, ACTION_GO_HOME, ACTION_ON_PAY_FAILED, ACTION_GO_HOME, ACTION_QUIT,
ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON, ACTION_LOGIN_OK, ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON, ACTION_LOGIN_OK,
ACTION_REFUND, ACTION_REFUND_SUCCESS, ACTION_REFUND_FAILED, ACTION_REFUND, ACTION_REFUND_SUCCESS, ACTION_REFUND_FAILED,
ACTION_PRINT_LAST_ORDER, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD, ACTION_PRINT_LAST_ORDER, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD,
...@@ -115,6 +115,9 @@ Page({ ...@@ -115,6 +115,9 @@ Page({
{ url: "/images/img_ad1.png", selected: true }, { url: "/images/img_ad1.png", selected: true },
{ url: "/images/img_ad2.png", selected: false }, { url: "/images/img_ad2.png", selected: false },
], ],
/**键盘 */
keyboardErrMsg: "",
}, },
/** /**
...@@ -424,6 +427,32 @@ Page({ ...@@ -424,6 +427,32 @@ Page({
// 页面被拉到底部 // 页面被拉到底部
}, },
onQuit() {
console.log("onQuit");
this.setData({
isFrontScreenLoginOK: false,
storeName: "--",
storeId: "--",
userName: "--",
})
this.goPage('home')
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_QUIT,
data: null
},
success: (res) => {
console.log("通知前屏退出 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
console.log("通知前屏退出 失败 ===》" + JSON.stringify(res));
}
})
},
//回到首页 //回到首页
goHome() { goHome() {
...@@ -795,9 +824,6 @@ Page({ ...@@ -795,9 +824,6 @@ Page({
} else if (this.data.scene == 1) { } else if (this.data.scene == 1) {
this.sendGoodsInfoToFront(result) this.sendGoodsInfoToFront(result)
} else if (this.data.scene == 2) { } else if (this.data.scene == 2) {
if (result.length != 11) {
return;//键盘不给消失
}
this.sendMemberLogin(result); this.sendMemberLogin(result);
} else if (this.data.scene == 4) { } else if (this.data.scene == 4) {
this.sendRefund(result); this.sendRefund(result);
...@@ -850,7 +876,7 @@ Page({ ...@@ -850,7 +876,7 @@ Page({
//清空商品信息 //清空商品信息
clearGood(e) { clearGood(e) {
this.setData({ goods: [],discCouponPrice:0 }) this.setData({ goods: [], discCouponPrice: 0 })
this.calculation([]); this.calculation([]);
}, },
...@@ -925,14 +951,13 @@ Page({ ...@@ -925,14 +951,13 @@ Page({
this.sendGoodInfoToFront() this.sendGoodInfoToFront()
}, },
fen2Yuan(num) { fen2Yuan(num) {
if (typeof num !== "number" || isNaN(num)) return null; if (typeof num !== "number" || isNaN(num)) return null;
return (num / 100).toFixed(2); return (num / 100).toFixed(2);
}, },
sendMemberLogin(result) { sendMemberLogin(result) {
this.setData({ this.setData({
memberPhone: result memberPhone: result
}) })
...@@ -1130,10 +1155,10 @@ Page({ ...@@ -1130,10 +1155,10 @@ Page({
//使用券 //使用券
useCoupon(e) { useCoupon(e) {
if(this.data.goods.length == 0){ if (this.data.goods.length == 0) {
this.showToast("请先录入商品") this.showToast("请先录入商品")
return return
} }
this.setData({ discCouponState: 1 }) this.setData({ discCouponState: 1 })
var request = {}; var request = {};
......
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