优惠券相关更新
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<view class="listStyle_left">
|
||||
<view class="listrigth">
|
||||
<view>{{active == 1 ? item.biz_name : item.content}}</view>
|
||||
<view :class="[item.type == '+'?'colorStyle':'']">
|
||||
<view :class="{colorStyle: (active==1&&item.type == '+') || (active==2&&item.floatType=='add')}">
|
||||
{{ active == 1 ? item.type : (item.floatType == 'add'?'+':'')}}
|
||||
{{active == 1 ? item.amount : item.floatPoints}}
|
||||
</view>
|
||||
@@ -178,7 +178,7 @@
|
||||
|
||||
.listrigth {
|
||||
.colorStyle {
|
||||
// color: #FF7127;
|
||||
color: #FF7127;
|
||||
}
|
||||
|
||||
>view {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="containertop">
|
||||
<view class="containertop" :class="{select: type == 'confirm_order_coupon' || type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product'}">
|
||||
<view class="containertopbox">
|
||||
<view class="containertopboxitem flex-start" v-for="(item,index) in list" :key="index">
|
||||
<view class="containertopboxitemleft flex-colum"
|
||||
@@ -69,7 +69,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btnBox" v-if="type == 'confirm_order_coupon' || type == 'confirm_order_product'">
|
||||
<view class="btnBox" v-if="type == 'confirm_order_coupon' || type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product'">
|
||||
<view class="btn" @click="cancelCoupon" >暂不使用券</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -148,9 +148,9 @@
|
||||
if (res.code == 0) {
|
||||
console.log(res)
|
||||
let list = [];
|
||||
if ( this.type == 'confirm_order_coupon') {
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon') {
|
||||
list = res.data.filter(v => v.type == 1);
|
||||
}else if ( this.type == 'confirm_order_product') {
|
||||
}else if ( this.type == 'confirm_order_product' || this.type == 'orderInfo_product') {
|
||||
list = res.data.filter(v => v.type == 2);
|
||||
} else {
|
||||
list = res.data;
|
||||
@@ -166,6 +166,7 @@
|
||||
* 去使用优惠券
|
||||
*/
|
||||
navigatorGo ( item ) {
|
||||
|
||||
uni.cache.set('shopId',item.shopId)
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product' ) {
|
||||
if ( item.type == 1 ) {
|
||||
@@ -176,6 +177,13 @@
|
||||
})
|
||||
return;
|
||||
}
|
||||
if( this.payAmount < item.discountAmount) {
|
||||
uni.showToast({
|
||||
title: "当前订单金额不足抵扣金额",
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
let selectCouponData = uni.cache.get('selectCouponData') || [];
|
||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||
@@ -330,6 +338,7 @@
|
||||
.towcontent {
|
||||
padding: 0 28rpx;
|
||||
border-top: 16rpx solid #f7f7f7;
|
||||
|
||||
.towcontentlistxitem {
|
||||
width: 100%;
|
||||
margin-top: 32rpx;
|
||||
@@ -385,6 +394,7 @@
|
||||
position: relative;
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
overflow: hidden;
|
||||
.containertopboxitemleft {
|
||||
position: relative;
|
||||
width: 182rpx;
|
||||
@@ -449,23 +459,22 @@
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0rpx -13rpx 7rpx -6rpx rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0rpx 1rpx 9rpx 21rpx rgba(0, 0, 0, 0.04);
|
||||
z-index: 999;
|
||||
}
|
||||
.containertopboxitemleft::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -20rpx;
|
||||
left: 166rpx;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0rpx 0rpx 15rpx 1rpx rgba(0, 0, 0, 0.1);
|
||||
z-index: 999;
|
||||
}
|
||||
.containertopboxitemleft::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -20rpx;
|
||||
left: 166rpx;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0rpx 25rpx 15rpx -4rpx rgba(0, 0, 0, 0.1);
|
||||
z-index: 999;
|
||||
|
||||
}
|
||||
.containertopboxitemleft_vip{
|
||||
background-color: #E1D4B2;
|
||||
}
|
||||
@@ -543,11 +552,15 @@
|
||||
|
||||
}
|
||||
}
|
||||
.select{
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
.btnBox{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
background-color: #fff;
|
||||
padding: 30rpx 30rpx 50rpx 30rpx;
|
||||
.btn{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<view class="tabContent">
|
||||
<view class="tabContent_item" v-for="(item,index) in shareRecordData.list" :key="index">
|
||||
<view class="top">
|
||||
<view class="name">{{item.invitedName||""}}</view>
|
||||
<view class="name">{{item.invitedName||("用户"+item.id)}}</view>
|
||||
<view class="status" :style="{color: item.success ? '#333' : '#FF534B'}">{{
|
||||
item.success ? '邀请成功' : '未邀请成功'
|
||||
}}</view>
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
|
||||
minCouponList.map((v,indexs) => {
|
||||
for (let i = 0; i < v.num; i++){
|
||||
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.price) < (this.listinfo.payAmount - productPayAmount) )) {
|
||||
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.price) <= (this.listinfo.payAmount - productPayAmount) )) {
|
||||
productNum++
|
||||
productAllNum++
|
||||
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.price
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="cell-item column" v-if="listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
|
||||
<view class="cell-item column" v-if="listinfo.orderInfo&&listinfo.orderInfo.couponInfoList && listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
|
||||
<view class="label">商品券</view>
|
||||
<view class="val column">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.orderInfo.couponInfoList.productCoupon" :key="index">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-radio activeColor="#E8AD7B" :disabled="freeCheck&&index==0" icon-size="36" size="36" :name="item.type">
|
||||
<u-radio activeColor="#E8AD7B" :disabled="(freeCheck&&index==0) || (index!=0&&payAmount<=0) || (rechargeFreeChecked&&index==0)" icon-size="36" size="36" :name="item.type">
|
||||
</u-radio>
|
||||
</view>
|
||||
|
||||
@@ -55,6 +55,12 @@
|
||||
}
|
||||
},
|
||||
props:{
|
||||
rechargeFreeChecked:{
|
||||
type: Boolean
|
||||
},
|
||||
payAmount:{
|
||||
type: Number
|
||||
},
|
||||
amountVIP:{
|
||||
type: Object
|
||||
},
|
||||
@@ -77,6 +83,31 @@
|
||||
// this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
// }
|
||||
// }
|
||||
payAmount:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
if ( newVal <= 0 ) {
|
||||
this.radiovalue = 1
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
rechargeFreeChecked:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
if ( newVal ) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.radiovalue = 2
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
this.radiovalue = 3
|
||||
// #endif
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
freeCheck:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
@@ -88,14 +119,13 @@
|
||||
this.radiovalue = 3
|
||||
// #endif
|
||||
let name = this.paymentMethodName[this.radiovalue-1].name;
|
||||
console.log({type:this.radiovalue ,name: name })
|
||||
this.$emit("groupChange",{type:this.radiovalue ,name: name })
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.amountVIP)
|
||||
// console.log(this.amountVIP)
|
||||
// this.getAount();
|
||||
|
||||
},
|
||||
@@ -105,10 +135,12 @@
|
||||
* @param {Object}
|
||||
*/
|
||||
groupChange(type) {
|
||||
console.log(type)
|
||||
if ( this.freeCheck && type == 1 ) {
|
||||
return;
|
||||
}
|
||||
if ( this.payAmount<=0 && type != 1 ) {
|
||||
return;
|
||||
}
|
||||
this.radiovalue = type;
|
||||
let name = this.paymentMethodName[type-1].name;
|
||||
this.$emit("groupChange",{type:type ,name: name })
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="rechargeFree_bg" @click="changeFree">
|
||||
<view class="left">
|
||||
<view class="icon">优惠</view>
|
||||
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}倍(订单满¥{{freeDingConfig.rechargeThreshold}}远可用),本单立享免单!</view>
|
||||
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}倍(订单满¥{{freeDingConfig.rechargeThreshold}}元可用),本单立享免单!</view>
|
||||
</view>
|
||||
<u-checkbox-group iconPlacement="right" >
|
||||
<u-checkbox :disabled="freeDisabled" v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
||||
@@ -18,8 +18,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
rechargeFreeChecked: false,
|
||||
disabled: false,
|
||||
freeDisabled: false,
|
||||
}
|
||||
},
|
||||
props:{
|
||||
@@ -32,26 +31,22 @@
|
||||
payAmount: {
|
||||
type: Number
|
||||
},
|
||||
freeDisabled: {
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
watch: {
|
||||
freeDisabled (newVal) {
|
||||
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
}
|
||||
},
|
||||
payAmount (newVal) {
|
||||
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
} else {
|
||||
this.freeDisabled = false
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -62,9 +57,6 @@
|
||||
if ( this.freeDisabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.rechargeFreeChecked = !this.rechargeFreeChecked;
|
||||
|
||||
this.$emit("changeFree",this.rechargeFreeChecked)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<view>{{(shopTableInfo.seatNum*storeInfo.tableFee).toFixed(2)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item,index) in favorable" :key="index" v-if="storeInfo.registerType == 'munchies'">
|
||||
<view v-for="(item,index) in favorable" :key="index" v-if="storeInfo.registerType == 'munchies'&&!rechargeFreeChecked">
|
||||
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}" @click="goUrl(item)">
|
||||
<view class="favorable_left">
|
||||
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
|
||||
@@ -140,13 +140,13 @@
|
||||
|
||||
<!-- 充值免单 -->
|
||||
<view style="padding: 0 20rpx;">
|
||||
<rechargeFree v-if="freeDingConfig.enable == 1&&storeInfo.registerType == 'munchies'" ref="rechargeFree" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
|
||||
<rechargeFree v-if="freeDingConfig.enable == 1&&storeInfo.registerType == 'munchies'" ref="rechargeFree" :rechargeFreeChecked="rechargeFreeChecked" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
|
||||
</view>
|
||||
<!-- 充值活动 -->
|
||||
<topUpActivity v-if="storeInfo.registerType == 'munchies'" ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
|
||||
<!-- 支付方式 -->
|
||||
<view style="padding: 0 20rpx;">
|
||||
<paymentMethod ref="paymentMethod" :freeCheck="freeCheck" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
|
||||
<paymentMethod ref="paymentMethod" :freeCheck="freeCheck" :rechargeFreeChecked="rechargeFreeChecked" :payAmount="listinfo.payAmount" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
|
||||
</view>
|
||||
<view style="width: 100%;height: 200rpx;"> </view>
|
||||
<view class="bottom">
|
||||
@@ -254,6 +254,7 @@
|
||||
tableCode: null,
|
||||
packFee: null,
|
||||
isShow: false,
|
||||
rechargeFreeChecked: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -279,9 +280,10 @@
|
||||
this.storeInfo = JSON.parse(decodeURIComponent(options.storeInfo));
|
||||
}
|
||||
this.shopId = this.storeInfo.id;
|
||||
this.cartLists = JSON.parse(options.cartLists);
|
||||
this.listinfo.name = this.storeInfo.shopName;
|
||||
this.listinfo.details = JSON.parse(options.cartLists).data;
|
||||
this.cartLists = JSON.parse(options.cartLists);
|
||||
this.listinfo.payAmount = this.cartLists.memberAmount && this.cartLists.memberAmount > 0 ? this.cartLists.memberAmount : this.cartLists.amount
|
||||
if ( options.tableCode ) { this.tableCode = options.tableCode;}
|
||||
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
|
||||
this.eatModel = "dine-in";
|
||||
@@ -307,20 +309,14 @@
|
||||
}
|
||||
})
|
||||
|
||||
this.userCouponInfos = [];
|
||||
this.favorable[0].value = ""
|
||||
this.favorable[1].value = []
|
||||
this.selectCouponData = uni.cache.get('selectCouponData') || []
|
||||
|
||||
this.getchoseEatModel('index',this.is_type)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听优惠券/商品券选择
|
||||
* @param {Object} data
|
||||
*/
|
||||
changeCoupon ( data ) {
|
||||
|
||||
|
||||
changeCoupon ( cartLists ) {
|
||||
// 优惠券数据
|
||||
let couponList = this.selectCouponData.filter(v => v.type == 1);
|
||||
// 商品券列表
|
||||
@@ -331,14 +327,16 @@
|
||||
let couponData = couponList[0]
|
||||
//不包含优惠券的金额
|
||||
let currentPayAmount = (this.userCouponInfos.filter(v => v.type == 1).length > 0 ? Number(this.listinfo.payAmount) + couponData.discountAmount : this.listinfo.payAmount)
|
||||
console.log(this.listinfo.payAmount)
|
||||
// 判断优惠金额不能大于支付金额
|
||||
if ( couponData.discountAmount < currentPayAmount) {
|
||||
|
||||
if ( this.isPointsChecked ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
} else {
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
console.log(this.calcUsablePointsData)
|
||||
// if ( this.isPointsChecked && this.calcUsablePointsData) {
|
||||
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
// } else {
|
||||
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
// }
|
||||
console.log(this.listinfo.payAmount)
|
||||
this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
|
||||
this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
|
||||
@@ -349,7 +347,7 @@
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
|
||||
|
||||
console.log(this.listinfo.payAmount)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
@@ -358,6 +356,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
console.log(2)
|
||||
console.log(this.listinfo.payAmount)
|
||||
// 商品券处理
|
||||
if ( productList.length > 0 ) {
|
||||
//商品券使用数量
|
||||
@@ -379,7 +379,10 @@
|
||||
|
||||
minCouponList.map((v,indexs) => {
|
||||
for (let i = 0; i < v.number; i++){
|
||||
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.salePrice) < (this.listinfo.payAmount - productPayAmount) )) {
|
||||
if ( ((v.memberPrice > 0 ? v.memberPrice : v.salePrice) < (this.listinfo.payAmount - productPayAmount) ) ){
|
||||
|
||||
}
|
||||
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.salePrice) <= (this.listinfo.payAmount - productPayAmount) )) {
|
||||
productNum++
|
||||
productAllNum++
|
||||
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.salePrice
|
||||
@@ -410,22 +413,22 @@
|
||||
if ( this.userCouponInfos.length > 0 ) {
|
||||
console.log(this.userCouponInfos)
|
||||
this.userCouponInfos.forEach(item => {
|
||||
if ( item.type == 1 ) {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
}
|
||||
// if ( item.type == 1 ) {
|
||||
// if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
// this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
// }
|
||||
// }
|
||||
if ( item.type == 2 ) {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
// this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.isPointsChecked = false;
|
||||
this.getCalcUsablePoints()
|
||||
},
|
||||
setPayAmount ( cartLists ) {
|
||||
let tableFee;
|
||||
@@ -440,39 +443,70 @@
|
||||
} else {
|
||||
this.listinfo.payAmount = (Number(cartLists.amount)+tableFee).toFixed(2)
|
||||
}
|
||||
if ( this.userCouponInfos.length > 0 ) {
|
||||
console.log(this.userCouponInfos)
|
||||
this.userCouponInfos.forEach(item => {
|
||||
if ( item.type == 1 ) {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
}
|
||||
if ( item.type == 2 ) {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if ( this.freeDingConfig && this.listinfo.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
}
|
||||
|
||||
console.log(1)
|
||||
// if ( this.userCouponInfos.length > 0 ) {
|
||||
// console.log(this.userCouponInfos)
|
||||
// this.userCouponInfos.forEach(item => {
|
||||
// if ( item.type == 1 ) {
|
||||
// if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
// this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
// }
|
||||
// }
|
||||
// if ( item.type == 2 ) {
|
||||
// if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
// this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
this.userCouponInfos = [];
|
||||
this.favorable[0].value = ""
|
||||
this.favorable[1].value = []
|
||||
this.rechargeFreeChecked = false;
|
||||
this.freeDisabled = false;
|
||||
this.selectCouponData = uni.cache.get('selectCouponData') || []
|
||||
this.changeCoupon()
|
||||
this.isPointsChecked = false;
|
||||
this.getCalcUsablePoints()
|
||||
|
||||
},
|
||||
/**
|
||||
* 免单状态监听
|
||||
* @param {Object} val
|
||||
*/
|
||||
changeFree ( val ) {
|
||||
this.freeCheck = val;
|
||||
if ( val ) {
|
||||
// this.freeCheck = val;
|
||||
this.rechargeFreeChecked = !val;
|
||||
|
||||
|
||||
// let couponList = this.userCouponInfos.filter(v => v.type == 1);
|
||||
let productList = this.userCouponInfos
|
||||
if ( this.rechargeFreeChecked ) {
|
||||
if ( this.isPointsChecked ) {
|
||||
this.isPointsChecked = false;
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
console.log(Number(this.listinfo.payAmount))
|
||||
console.log(item.discountAmount)
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) + item.discountAmount
|
||||
})
|
||||
}
|
||||
// if ( couponList.length > 0) {
|
||||
// this.listinfo.payAmount = Number(this.listinfo.payAmount) + couponList[0].discountAmount
|
||||
// }
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount*this.freeDingConfig.rechargeTimes).toFixed(2)
|
||||
} else {
|
||||
this.isPointsChecked = false;
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount/this.freeDingConfig.rechargeTimes).toFixed(2)
|
||||
// if ( couponList.length > 0) {
|
||||
// this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) - couponList[0].discountAmount : this.listinfo.payAmount)
|
||||
// }
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) - item.discountAmount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -538,6 +572,10 @@
|
||||
if ( this.calcUsablePointsData && this.calcUsablePointsData.usable && this.listinfo.payAmount >= this.calcUsablePointsData.minPaymentAmount) {
|
||||
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
|
||||
}
|
||||
if ( this.freeDingConfig && this.listinfo.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
||||
this.freeDisabled = true
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -681,7 +719,13 @@
|
||||
* @param {Object} val
|
||||
*/
|
||||
tabClick ( index, item ) {
|
||||
|
||||
this.userCouponInfos = [];
|
||||
this.favorable[0].value = ""
|
||||
this.favorable[1].value = []
|
||||
this.rechargeFreeChecked = false;
|
||||
this.freeDisabled = false;
|
||||
this.selectCouponData = [];
|
||||
uni.cache.set('selectCouponData',[])
|
||||
this.getchoseEatModel('tabClick', index, item);
|
||||
|
||||
},
|
||||
@@ -719,9 +763,13 @@
|
||||
this.eatModel.push(item.val);
|
||||
}
|
||||
}
|
||||
this.listinfo = res.data;
|
||||
this.listinfo.details = res.data.info;
|
||||
this.listinfo.name = this.storeInfo.shopName;
|
||||
this.listinfo.payAmount = res.data.memberAmount && res.data.memberAmount > 0 ? res.data.memberAmount : res.data.amount
|
||||
this.packFee = res.data.packFee;
|
||||
this.setPayAmount(res.data)
|
||||
this.setPayAmount(this.listinfo)
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -900,7 +948,7 @@
|
||||
*/
|
||||
async showpopupclickdds() {
|
||||
let res;
|
||||
if ( !this.freeCheck ) {
|
||||
if ( !this.rechargeFreeChecked ) {
|
||||
res = await this.api.orderPay({
|
||||
orderId: this.listinfoid,
|
||||
// #ifdef MP-WEIXIN
|
||||
|
||||
@@ -31,9 +31,15 @@
|
||||
<!-- 先支付后下单 -->
|
||||
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
|
||||
<!-- 充值免单 -->
|
||||
<rechargeFree v-if="listinfo.freeDingConfig.enable == 1&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')" ref="rechargeFree" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
|
||||
<rechargeFree
|
||||
:rechargeFreeChecked="rechargeFreeChecked"
|
||||
v-if="listinfo.freeDingConfig.enable == 1&&(!listinfo.orderInfo.couponInfoList&&listinfo.orderInfo.pointsDiscountAmount<=0)&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')"
|
||||
ref="rechargeFree"
|
||||
:freeDisabled="freeDisabled"
|
||||
:payAmount="listinfo.payAmount"
|
||||
:freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
|
||||
|
||||
<paymentMethod ref="paymentMethod" v-if="amountVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck" :amountVIP="amountVIP" @groupChange="groupChange"></paymentMethod>
|
||||
<paymentMethod ref="paymentMethod" :rechargeFreeChecked="rechargeFreeChecked" v-if="amountVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck" :payAmount="listinfo.payAmount" :amountVIP="amountVIP" @groupChange="groupChange"></paymentMethod>
|
||||
|
||||
<view class="fixedview">
|
||||
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||
@@ -126,7 +132,6 @@
|
||||
methods: {
|
||||
|
||||
setPayAmount(data) {
|
||||
console.log(data)
|
||||
// this.changeFree(this.freeDisabled)
|
||||
this.listinfo.payAmount = data.payAmount
|
||||
this.couopnInfo = data;
|
||||
@@ -143,46 +148,49 @@
|
||||
* @param {Object} val
|
||||
*/
|
||||
changeFree ( val ) {
|
||||
this.freeCheck = val;
|
||||
this.rechargeFreeChecked = val
|
||||
if ( this.couopnInfo && val) {
|
||||
if ( this.couopnInfo.isPointsChecked ) {
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.couopnInfo.calcUsablePointsData.pointsNum/this.couopnInfo.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0) {
|
||||
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) + couponList[0].discountAmount : this.listinfo.payAmount)
|
||||
}
|
||||
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) + item.discountAmount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// this.freeCheck = val;
|
||||
this.rechargeFreeChecked = !val
|
||||
|
||||
if ( val ) {
|
||||
|
||||
if ( this.rechargeFreeChecked ) {
|
||||
if ( this.couopnInfo) {
|
||||
if ( this.couopnInfo.isPointsChecked ) {
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.couopnInfo.calcUsablePointsData.pointsNum/this.couopnInfo.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0) {
|
||||
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) + couponList[0].discountAmount : this.listinfo.payAmount)
|
||||
}
|
||||
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) + item.discountAmount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount*this.listinfo.freeDingConfig.rechargeTimes).toFixed(2)
|
||||
} else {
|
||||
this.couopnInfo.isPointsChecked = false;
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount/this.listinfo.freeDingConfig.rechargeTimes).toFixed(2)
|
||||
if ( this.couopnInfo) {
|
||||
|
||||
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0) {
|
||||
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) - couponList[0].discountAmount : this.listinfo.payAmount)
|
||||
}
|
||||
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) - item.discountAmount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.couopnInfo && !val) {
|
||||
|
||||
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0) {
|
||||
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) - couponList[0].discountAmount : this.listinfo.payAmount)
|
||||
}
|
||||
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
|
||||
if ( productList .length > 0 ) {
|
||||
productList.map(item=> {
|
||||
this.listinfo.payAmount = Number(this.listinfo.payAmount) - item.discountAmount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
console.log(this.freeCheck)
|
||||
},
|
||||
saveImage (url) {
|
||||
@@ -359,8 +367,8 @@
|
||||
*/
|
||||
async wechatPay() {
|
||||
let res;
|
||||
console.log(this.freeCheck)
|
||||
if ( !this.freeCheck ) {
|
||||
console.log(this.rechargeFreeChecked)
|
||||
if ( !this.rechargeFreeChecked ) {
|
||||
res = await this.api.orderPay({
|
||||
orderId: this.orderId,
|
||||
// #ifdef MP-WEIXIN
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="listItem " v-for="(item,index) in list" :key="index">
|
||||
<view class="top">
|
||||
<view class="title">{{item.content}}</view>
|
||||
<view class="num">{{item.floatType == 'add' ? '+' : ''}}{{item.floatPoints}}</view>
|
||||
<view class="num" :class="{colorStyle: item.floatType=='add'}">{{item.floatType == 'add' ? '+' : ''}}{{item.floatPoints}}</view>
|
||||
</view>
|
||||
<view class="time">{{item.createTime}}</view>
|
||||
</view>
|
||||
@@ -112,6 +112,9 @@
|
||||
.num{
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.colorStyle {
|
||||
color: #FF7127;
|
||||
}
|
||||
}
|
||||
.time{
|
||||
font-weight: normal;
|
||||
|
||||
Reference in New Issue
Block a user