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";
//发送选中的广告url给前屏
export const ACTION_SEND_SEL_AD = "ACTION_SEND_SEL_AD";
//使用优惠券
export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";//收款
......
......@@ -370,7 +370,27 @@
font-family: AlibabaPuHuiTiB;
color: rgba(0, 122, 255, 1);
line-height: 49px;
/* margin-left: 15rpx; */
}
/* 价格容器 */
.total-price-container {
display: flex;
flex-direction: row;
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 @@
</view>
<view class="operating-bottom">
<text class="total-num">共{{totalQuantity}}件商品,合计金额</text>
<view class="total-price-container">
<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>
</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-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"/>
<text class="coupon-back-text">返回</text>
</view>
<view class="coupon-title">优惠券</view>
<view class="coupon-title" a:if="{{discCouponState == 1}}">优惠券</view>
<view></view>
</view>
<view class="coupon-bottom">
<!-- 等待扫描 -->
<view class="coupon-bottom" a:if="{{discCouponState == 1}}">
<text class="scan-coupon-text">等待顾客扫描优惠券码…</text>
<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>
......@@ -201,11 +220,12 @@
</view>
<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">{{waitOperateMoneyRemind}}</view>
<view class="moneySign">¥</view>
<view class="payPrice">{{waitOperateAmount}}</view>
<view class="descText" hidden="{{flowType!='collections'}}">(共{{totalQuantity}}件)</view>
</view>
......
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'
import { ACTION_REPRINT } from '../../const/actioncmd'
import { ACTION_GO_SCAN } from '../../const/actioncmd'
import { ACTION_ON_PAY_SUCCESS } 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 {
ACTION_USE_COUPON,ACTION_GOODS,ACTION_MEMBER,
ACTION_GO_BALANCE,ACTION_REQUEST_GOOD_INFO,ACTION_PRINT_RESULT,
ACTION_REPRINT,ACTION_GO_SCAN,ACTION_ON_PAY_SUCCESS,
ACTION_ON_PAY_FAILED,ACTION_GO_HOME,ACTION_GET_ACCOUNT,
ACTION_DIRECT_PAYMENT,ACTION_CONVERT_COUPON,ACTION_LOGIN_OK,
ACTION_REFUND,ACTION_REFUND_SUCCESS,ACTION_REFUND_FAILED,
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'
......@@ -47,8 +37,10 @@ Page({
payPriceFen: 0,
/**商品扫码页相关参数 */
//是否正在用券
couponUseing: false,
//优惠券 0关闭 录入券弹窗 1等待录入 2.录入中 3.录入成功 4.录入失败
discCouponState: 0,
discCouponMsg: "录入失败!无效的优惠券码",
discCouponPrice : 0,
//兑换券 0关闭兑换券弹窗 1等待兑换 2.兑换中 3.兑换成功 4.兑换失败
convertCouponState: 0,
......@@ -275,6 +267,14 @@ Page({
});
//跳转广告页面
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({
},
fail: (res) => {
console.log("发送收银事件到前屏小程序 失败 ===》 " + JSON.stringify(res));
},
});
},
......@@ -515,6 +514,9 @@ Page({
totalDisc: 0.00,
goods: [
],
discCouponState:0,
discCouponMsg:"",
discCouponPrice:0,
})
var commonRequest = {
......@@ -774,10 +776,12 @@ Page({
action: ACTION_GO_BALANCE,
data: ""
};
let context = this;
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data: commonRequest,
success: (res) => {
context.goPage('waitoperate');
console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
......@@ -794,7 +798,7 @@ Page({
//后屏跳转
this.goPage('waitoperate');
var amount = this.data.totalPrice;
var amount = this.data.totalPrice - this.data.discCouponPrice;
this.setData({
waitOperateAmount: amount,
});
......@@ -810,7 +814,7 @@ Page({
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_GO_SCAN,
data: null
data: this.data
},
success: (res) => {
console.log("通知前屏跳转到结算页面 成功 ===》" + JSON.stringify(res));
......@@ -858,10 +862,31 @@ Page({
//兑换券界面关闭
convertCouponClose(e) {
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) {
let context = this;
......@@ -882,11 +907,16 @@ Page({
//用券返回
couponBack(e) {
this.setData({ couponUseing: false })
this.setData({ discCouponState: 0 })
this.sendDiscCouponToFront(0)
},
//使用券
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({
// 海报返回按钮
onPosterPageBack(event) {
console.log("event==>" + JSON.stringify(event));
//回首页
this.goPage('home');
}
});
......@@ -4,6 +4,7 @@ import { ACTION_GOODS } from '../../const/actioncmd'
import { ACTION_GO_BALANCE } from '../../const/actioncmd'
import { ACTION_REQUEST_GOOD_INFO } from '../../const/actioncmd'
Page({
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