Commit fc55a09d authored by pengguangpu's avatar pengguangpu

合并远程代码;

parents 8c378b56 c94529d1
...@@ -61,6 +61,8 @@ export const ACTION_GET_CUR_AD = "ACTION_GET_CUR_AD"; ...@@ -61,6 +61,8 @@ export const ACTION_GET_CUR_AD = "ACTION_GET_CUR_AD";
//发送选中的广告url给前屏 //发送选中的广告url给前屏
export const ACTION_SEND_SEL_AD = "ACTION_SEND_SEL_AD"; export const ACTION_SEND_SEL_AD = "ACTION_SEND_SEL_AD";
//使用优惠券
export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
const FLOW_IDLE = "idle"; const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";//收款 const FLOW_COLLECTIONS = "collections";//收款
......
...@@ -370,7 +370,27 @@ ...@@ -370,7 +370,27 @@
font-family: AlibabaPuHuiTiB; font-family: AlibabaPuHuiTiB;
color: rgba(0, 122, 255, 1); color: rgba(0, 122, 255, 1);
line-height: 49px; line-height: 49px;
/* margin-left: 15rpx; */
}
/* 价格容器 */
.total-price-container {
display: flex;
flex-direction: row;
margin-left: 15rpx; margin-left: 15rpx;
align-items: center
}
/* 优惠券抵扣金额 */
.pay-coupon {
font-size: 18rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: rgba(249, 97, 70, 1);
line-height: 18rpx;
margin-left: 5rpx;
} }
/* 去付款 */ /* 去付款 */
......
...@@ -160,26 +160,45 @@ ...@@ -160,26 +160,45 @@
</view> </view>
<view class="operating-bottom"> <view class="operating-bottom">
<text class="total-num">共{{totalQuantity}}件商品,合计金额</text> <text class="total-num">共{{totalQuantity}}件商品,合计金额</text>
<view class="total-price-container">
<text class="pay-price">¥{{totalPrice}}</text> <text class="pay-price">¥{{totalPrice}}</text>
<text class="pay-coupon" a:if="{{discCouponPrice != 0}}">-¥{{discCouponPrice}}</text>
</view>
<button class="go-pay" size="default" type="primary" onTap="goPay">收款</button> <button class="go-pay" size="default" type="primary" onTap="goPay">收款</button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 扫描优惠券 --> <!-- 扫描优惠券 -->
<view class="page-coupon" a:if="{{couponUseing}}"> <view class="page-coupon" a:if="{{discCouponState != 0 && discCouponState != 3 }}">
<view class="coupon-top"> <view class="coupon-top">
<view class="coupon-back-container" onTap="couponBack"> <view class="coupon-back-container" onTap="convertCouponClose" a:if="{{discCouponState == 1}}">
<image class="coupon-back-icon" mode="aspectFit" src="/images/icon_back.png"/> <image class="coupon-back-icon" mode="aspectFit" src="/images/icon_back.png"/>
<text class="coupon-back-text">返回</text> <text class="coupon-back-text">返回</text>
</view> </view>
<view class="coupon-title">优惠券</view> <view class="coupon-title" a:if="{{discCouponState == 1}}">优惠券</view>
<view></view> <view></view>
</view> </view>
<view class="coupon-bottom"> <!-- 等待扫描 -->
<view class="coupon-bottom" a:if="{{discCouponState == 1}}">
<text class="scan-coupon-text">等待顾客扫描优惠券码…</text> <text class="scan-coupon-text">等待顾客扫描优惠券码…</text>
<image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/> <image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/>
<button class="cancel-use-coupon" size="default" type="ghost" onTap="couponBack">取消</button> <button class="cancel-use-coupon" size="default" type="ghost" onTap="couponBack">关闭</button>
</view>
<!-- 录入中 -->
<view class="coupon-bottom" a:if="{{discCouponState == 2}}">
<text class="scan-coupon-text">正在录入优惠券…</text>
<image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/>
</view>
<!-- 录入失败 -->
<view class="coupon-bottom-fail" a:if="{{discCouponState == 4}}">
<image class="scan-coupon-fail" mode="aspectFit" src="/images/icon_failed.png"/>
<text class="scan-coupon-text-fail">录入失败</text>
<text class="scan-coupon-text-fail-desr">{{discCouponMsg}}</text>
<view class="failure-operation">
<button class="close-use-coupon" type="ghost" size="default" onTap="couponBack">关闭</button>
<button class="again-use-coupon" type="primary" size="default" onTap="useCoupon">重新录入</button>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -201,11 +220,12 @@ ...@@ -201,11 +220,12 @@
</view> </view>
<view class="contentLine" style="margin-top: 14.5rpx;" hidden="{{flowType!='collections'}}"> <view class="contentLine" style="margin-top: 14.5rpx;" hidden="{{flowType!='collections'}}">
<view class="descText">商家优惠:</view> <view class="descText">商家优惠:</view>
<view class="totalCoupon">¥{{totalDisc}}</view> <view class="totalCoupon">¥{{discCouponPrice}}</view>
</view> </view>
<view style="position: absolute;display: flex;flex-direction: row;align-items: baseline;bottom:22rpx;left:0rpx;padding-left: 29rpx;"> <view style="position: absolute;display: flex;flex-direction: row;align-items: baseline;bottom:22rpx;left:0rpx;padding-left: 29rpx;">
<view class="descText">{{waitOperateMoneyRemind}}</view> <view class="descText">{{waitOperateMoneyRemind}}</view>
<view class="moneySign">¥</view> <view class="moneySign">¥</view>
<view class="payPrice">{{waitOperateAmount}}</view> <view class="payPrice">{{waitOperateAmount}}</view>
<view class="descText" hidden="{{flowType!='collections'}}">(共{{totalQuantity}}件)</view> <view class="descText" hidden="{{flowType!='collections'}}">(共{{totalQuantity}}件)</view>
</view> </view>
......
var api = require("../../utils/api.js"); var api = require("../../utils/api.js");
import { API_SCAN } from '../../const/apiurl' import {
import { ACTION_GOODS } from '../../const/actioncmd' ACTION_USE_COUPON,ACTION_GOODS,ACTION_MEMBER,
import { ACTION_MEMBER } from '../../const/actioncmd' ACTION_GO_BALANCE,ACTION_REQUEST_GOOD_INFO,ACTION_PRINT_RESULT,
import { ACTION_GO_BALANCE } from '../../const/actioncmd' ACTION_REPRINT,ACTION_GO_SCAN,ACTION_ON_PAY_SUCCESS,
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd' ACTION_ON_PAY_FAILED,ACTION_GO_HOME,ACTION_GET_ACCOUNT,
import { ACTION_PRINT_RESULT } from '../../const/actioncmd' ACTION_DIRECT_PAYMENT,ACTION_CONVERT_COUPON,ACTION_LOGIN_OK,
import { ACTION_REPRINT } from '../../const/actioncmd' ACTION_REFUND,ACTION_REFUND_SUCCESS,ACTION_REFUND_FAILED,
import { ACTION_GO_SCAN } from '../../const/actioncmd' ACTION_PRINT_LAST_ORDER, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD,
import { ACTION_ON_PAY_SUCCESS } from '../../const/actioncmd' } from '../../const/actioncmd'
import { ACTION_ON_PAY_FAILED } from '../../const/actioncmd'
import { ACTION_GO_HOME } from '../../const/actioncmd'
import { ACTION_GET_ACCOUNT } from '../../const/actioncmd'
import { ACTION_DIRECT_PAYMENT } from '../../const/actioncmd'
import { ACTION_CONVERT_COUPON } from '../../const/actioncmd'
import { ACTION_LOGIN_OK } from '../../const/actioncmd'
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, ACTION_GET_CUR_AD, ACTION_SEND_SEL_AD } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT } from '../../const/actioncmd' import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT } from '../../const/actioncmd'
...@@ -47,8 +37,10 @@ Page({ ...@@ -47,8 +37,10 @@ Page({
payPriceFen: 0, payPriceFen: 0,
/**商品扫码页相关参数 */ /**商品扫码页相关参数 */
//是否正在用券 //优惠券 0关闭 录入券弹窗 1等待录入 2.录入中 3.录入成功 4.录入失败
couponUseing: false, discCouponState: 0,
discCouponMsg: "录入失败!无效的优惠券码",
discCouponPrice : 0,
//兑换券 0关闭兑换券弹窗 1等待兑换 2.兑换中 3.兑换成功 4.兑换失败 //兑换券 0关闭兑换券弹窗 1等待兑换 2.兑换中 3.兑换成功 4.兑换失败
convertCouponState: 0, convertCouponState: 0,
...@@ -275,6 +267,14 @@ Page({ ...@@ -275,6 +267,14 @@ Page({
}); });
//跳转广告页面 //跳转广告页面
context.goPage('poster'); context.goPage('poster');
}else if(res.action == ACTION_USE_COUPON){
//优惠券
let coupon = res.data
context.setData({
discCouponState:coupon.discCouponState,
discCouponMsg:coupon.discCouponMsg,
discCouponPrice:coupon.discCouponPrice
})
} }
} }
...@@ -498,7 +498,6 @@ Page({ ...@@ -498,7 +498,6 @@ Page({
}, },
fail: (res) => { fail: (res) => {
console.log("发送收银事件到前屏小程序 失败 ===》 " + JSON.stringify(res)); console.log("发送收银事件到前屏小程序 失败 ===》 " + JSON.stringify(res));
}, },
}); });
}, },
...@@ -515,6 +514,9 @@ Page({ ...@@ -515,6 +514,9 @@ Page({
totalDisc: 0.00, totalDisc: 0.00,
goods: [ goods: [
], ],
discCouponState:0,
discCouponMsg:"",
discCouponPrice:0,
}) })
var commonRequest = { var commonRequest = {
...@@ -774,10 +776,12 @@ Page({ ...@@ -774,10 +776,12 @@ Page({
action: ACTION_GO_BALANCE, action: ACTION_GO_BALANCE,
data: "" data: ""
}; };
let context = this;
my.ix.sendBuddyMessage({ my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId, target: getApp().globalData.frontScreenAppId,
data: commonRequest, data: commonRequest,
success: (res) => { success: (res) => {
context.goPage('waitoperate');
console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res)); console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res));
}, },
fail: (res) => { fail: (res) => {
...@@ -794,7 +798,7 @@ Page({ ...@@ -794,7 +798,7 @@ Page({
//后屏跳转 //后屏跳转
this.goPage('waitoperate'); this.goPage('waitoperate');
var amount = this.data.totalPrice; var amount = this.data.totalPrice - this.data.discCouponPrice;
this.setData({ this.setData({
waitOperateAmount: amount, waitOperateAmount: amount,
}); });
...@@ -810,7 +814,7 @@ Page({ ...@@ -810,7 +814,7 @@ Page({
target: getApp().globalData.frontScreenAppId, target: getApp().globalData.frontScreenAppId,
data: { data: {
action: ACTION_GO_SCAN, action: ACTION_GO_SCAN,
data: null data: this.data
}, },
success: (res) => { success: (res) => {
console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res)); console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res));
...@@ -858,10 +862,31 @@ Page({ ...@@ -858,10 +862,31 @@ Page({
//兑换券界面关闭 //兑换券界面关闭
convertCouponClose(e) { convertCouponClose(e) {
this.setData({ convertCouponState: 0 }) this.setData({ convertCouponState: 0 })
this.sendConvertCouponToFront(0) var request = {};
request.convertCouponState = 0;
this.sendConvertCouponToFront(request)
}, },
//发送优惠券到前屏
sendDiscCouponToFront(res) {
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_USE_COUPON,
data: res
},
success: (sres) => {
console.log("优惠通知前屏 成功 ===》" + JSON.stringify(sres));
},
fail: (fres) => {
console.log("优惠券通知前屏 失败 ===》 " + JSON.stringify(fres));
context.sendDiscCouponToFront(res)
}
})
},
//发生兑换券到前屏 //发生兑换券到前屏
sendConvertCouponToFront(res) { sendConvertCouponToFront(res) {
let context = this; let context = this;
...@@ -882,11 +907,16 @@ Page({ ...@@ -882,11 +907,16 @@ Page({
//用券返回 //用券返回
couponBack(e) { couponBack(e) {
this.setData({ couponUseing: false }) this.setData({ discCouponState: 0 })
this.sendDiscCouponToFront(0)
}, },
//使用券 //使用券
useCoupon(e) { useCoupon(e) {
// this.setData({ couponUseing: true }) this.setData({ discCouponState: 1 })
var request = {};
request.discCouponState = 1;
request.discCouponPrice = this.data.discCouponPrice
this.sendDiscCouponToFront(request)
}, },
//发送退款金额.以分为单位 //发送退款金额.以分为单位
...@@ -1073,6 +1103,8 @@ Page({ ...@@ -1073,6 +1103,8 @@ Page({
// 海报返回按钮 // 海报返回按钮
onPosterPageBack(event) { onPosterPageBack(event) {
console.log("event==>" + JSON.stringify(event)); console.log("event==>" + JSON.stringify(event));
//回首页
this.goPage('home');
} }
}); });
...@@ -4,6 +4,7 @@ import { ACTION_GOODS } from '../../const/actioncmd' ...@@ -4,6 +4,7 @@ import { ACTION_GOODS } from '../../const/actioncmd'
import { ACTION_GO_BALANCE } from '../../const/actioncmd' import { ACTION_GO_BALANCE } from '../../const/actioncmd'
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd' import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd'
Page({ Page({
data: { data: {
//是否正在用券 //是否正在用券
......
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