Merge branch 'dev' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into wwz
This commit is contained in:
commit
433479fee7
|
|
@ -21,6 +21,9 @@ export function canTuiKuan(orderInfo, item) {
|
|||
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
|
||||
'refunding' && !item.userCouponId
|
||||
}
|
||||
export function isTuiCai(item) {
|
||||
return item.status == 'return'
|
||||
}
|
||||
export function isTui(item) {
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ import infoBox from "@/commons/utils/infoBox.js"
|
|||
import go from '@/commons/utils/go.js';
|
||||
import { reject } from 'lodash';
|
||||
// 测试服
|
||||
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
充值设置
|
||||
</view>
|
||||
<view class="boxconstantbox_tow">
|
||||
<text>用户消费结账时,成功充值成功</text>
|
||||
<input class="text" v-model="form.rechargeTimes"></input>
|
||||
<text>用户消费结账时,成功充值</text>
|
||||
<input class="number" v-model="form.rechargeTimes"></input>
|
||||
<text>倍的金额本单即可享受免单</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
</view>
|
||||
<view class="boxconstantbox_tow">
|
||||
<text>订单支付金额需满</text>
|
||||
<input class="text" v-model="form.rechargeThreshold"></input>
|
||||
<input class="number" v-model="form.rechargeThreshold"></input>
|
||||
<text> 元,才能使用</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">使用门槛</view>
|
||||
<view class="lable">使用门槛2</view>
|
||||
<view class="value">
|
||||
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元</view>,<view>减</view><input v-model="formData.discountAmount" placeholder="填写金额" border="none"></input><view>元</view>
|
||||
<view>满</view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view>,<view>减</view><input v-model="formData.discountAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -35,13 +35,15 @@
|
|||
<view class="item">
|
||||
<view class="lable">有效期(天)</view>
|
||||
<view class="value">
|
||||
<up-input v-model="formData.validDays" placeholder="填写天数" border="none"></up-input>
|
||||
<up-input v-model="formData.validDays" type="number" placeholder="填写天数" border="none"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">隔天生效<up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon></view>
|
||||
<view class="lable">隔天生效
|
||||
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
|
||||
</view>
|
||||
<view class="value">
|
||||
<view>隔</view><input v-model="formData.daysToTakeEffect" placeholder="填写天数" border="none" ></input><view>天生效</view>
|
||||
<view>隔</view><input v-model="formData.daysToTakeEffect" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
|
|
@ -79,7 +81,7 @@
|
|||
<view class="card">
|
||||
<view class="item">
|
||||
<view class="lable">总发放数量
|
||||
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
|
||||
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
|
||||
</view>
|
||||
<view class="value">
|
||||
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||
|
|
@ -311,6 +313,7 @@
|
|||
height: 150rpx;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
z-index: 9;
|
||||
>button {
|
||||
width: 530rpx;
|
||||
margin: 30rpx 0;
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
<view class="item">
|
||||
<view class="lable">使用门槛</view>
|
||||
<view class="value">
|
||||
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||
<view>满</view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">总发放数量</view>
|
||||
<view class="value">
|
||||
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||
<up-input v-model="formData.number" type="number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@
|
|||
<view v-if="item.type == 1"> 满 {{ item.fullAmount }} 元减 {{ item.discountAmount }} 元 </view>
|
||||
<view v-if="item.type == 2"> 满 {{ item.fullAmount }} 元可用 </view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <view>
|
||||
<view> 领取方式 </view>
|
||||
<view> 用户不可自行领取 </view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view v-if="item.type == 1">
|
||||
<view> 有效期 </view>
|
||||
<view> 领券后{{ item.validDays }}天过期 </view>
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
padding: 32rpx 28rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
top: 79rpx;
|
||||
top: 0rpx;
|
||||
z-index: 999;
|
||||
.tag-item {
|
||||
display: inline-block;
|
||||
|
|
@ -253,7 +253,7 @@
|
|||
/* height: 544rpx; */
|
||||
margin: 32rpx auto 0;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 122rpx 28rpx 182rpx 28rpx;
|
||||
padding: 70rpx 28rpx 182rpx 28rpx;
|
||||
}
|
||||
.couponContent {
|
||||
/* background-color: #f9f9f9; */
|
||||
|
|
|
|||
|
|
@ -164,11 +164,11 @@
|
|||
icon: '/static/indexImg/icon-line-up.svg',
|
||||
pageUrl: 'PAGES_LINE_UP'
|
||||
},
|
||||
// {
|
||||
// title: '霸王餐',
|
||||
// icon: '/static/indexImg/icon-bwc.svg',
|
||||
// pageUrl: 'PAGES_BWC'
|
||||
// },
|
||||
{
|
||||
title: '霸王餐',
|
||||
icon: '/static/indexImg/icon-bwc.svg',
|
||||
pageUrl: 'PAGES_BWC'
|
||||
},
|
||||
// {
|
||||
// title: '成员管理',
|
||||
// icon: '/static/indexImg/icon-staff.svg',
|
||||
|
|
@ -184,11 +184,11 @@
|
|||
// icon: '/static/indexImg/icon-cashier.svg',
|
||||
// pageUrl: 'PAGES_SHOP_SETUP',
|
||||
// },
|
||||
// {
|
||||
// title: '优惠券',
|
||||
// icon: '/static/coupon/icon_coupon.svg',
|
||||
// pageUrl: 'PAGES_COUPON_INDEX',
|
||||
// },
|
||||
{
|
||||
title: '优惠券',
|
||||
icon: '/static/coupon/icon_coupon.svg',
|
||||
pageUrl: 'PAGES_COUPON_INDEX',
|
||||
},
|
||||
{
|
||||
title: '订阅通知',
|
||||
icon: '/static/indexImg/icon-notification.svg',
|
||||
|
|
|
|||
|
|
@ -17,15 +17,17 @@
|
|||
<!-- <view class="headeimg">
|
||||
<image class="img" :src="user.headImg" mode=""></image>
|
||||
</view> -->
|
||||
<view class="u-m-l-20">{{user.nickName}}</view>
|
||||
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
||||
<view class="u-m-l-20">
|
||||
<!-- <view class="color-main u-font-24 no-wrap">{{user.isVip?'会员':'' }}</view> -->
|
||||
<view class="">{{user.nickName}}</view>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30 u-text-center"><text>余额:</text><text
|
||||
class="color-main">{{user.amount}}</text>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
||||
<view class="u-font-24 u-m-l-30 u-text-center"><text>积分:</text><text
|
||||
class="color-main">{{user.accountPoints}}</text></view>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
<uni-icons type="right" color="#999" size="20" bold></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class=" ">
|
||||
|
|
@ -88,8 +90,8 @@
|
|||
<view class="color-333 u-m-l-10"> {{user.accountPoints}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>已消费</view>
|
||||
<view class="color-333 u-m-l-10"> 0.00</view>
|
||||
<view class="u-text-center">订单数量</view>
|
||||
<view class="color-333 u-m-l-10">{{user.orderNumber||0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -168,7 +170,7 @@
|
|||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="isVip&&item.memberPrice&&item.memberPrice!=item.salePrice">
|
||||
<template v-if="isVip&&item.memberPrice&&item.memberPrice*1!=item.salePrice*1">
|
||||
<text
|
||||
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||
|
|
@ -239,10 +241,17 @@
|
|||
|
||||
|
||||
|
||||
<view class="u-flex u-row-right u-m-t-38">
|
||||
<view class="u-flex u-row-between u-m-t-38">
|
||||
<!-- <template v-if="$shop.registerType=='munchies'">
|
||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||
</template> -->
|
||||
<view class="u-flex">
|
||||
<view class="u-flex price" v-if="youhui*1>0">
|
||||
<view class="">优惠金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex price u-m-l-32">
|
||||
<view class="">实收金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||
|
|
@ -512,13 +521,12 @@
|
|||
totalAmount: 0,
|
||||
})
|
||||
const isVip=computed(()=>{
|
||||
return user.value&&user.value.id&&user.value.isVip
|
||||
return $shop.value.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
||||
})
|
||||
const goodsPrice = computed(() => {
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const memberPrice=cur.memberPrice?cur.memberPrice:cur.salePrice
|
||||
const tPrice = (isVip.value? memberPrice:cur.salePrice) * cur.number
|
||||
console.log(cur.isPack);
|
||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
||||
}, 0)
|
||||
|
|
@ -533,6 +541,19 @@
|
|||
// }, 0)
|
||||
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||
})
|
||||
const youhui=computed(()=>{
|
||||
if(user.value&&user.value.id&&user.value.isVip){
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const tPrice = cur.salePrice * cur.number
|
||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||
return prve + tPrice + tpackFee
|
||||
}, 0)
|
||||
return goodsTotalPrice-allPrice.value
|
||||
}else{
|
||||
return 0
|
||||
}
|
||||
return goodsTotalPrice
|
||||
})
|
||||
|
||||
function setGoodsItem(key, val) {
|
||||
item[key] = val
|
||||
|
|
@ -552,12 +573,17 @@
|
|||
records,
|
||||
seatFee
|
||||
} = await Api.getCart(par)
|
||||
let useType=''
|
||||
if (seatFee && seatFee.useType) {
|
||||
$storageManage.useType(seatFee.useType)
|
||||
// uni.setStorageSync('useType',seatFee.useType);
|
||||
eatTypes.active = seatFee.useType == 'takeout' ? seatFee.useType : seatFee.useType.replace(
|
||||
/-after|-before/g, '');
|
||||
useType=seatFee.useType
|
||||
$storageManage.useType(useType)
|
||||
}else{
|
||||
useType=records[0].info[0].useType
|
||||
$storageManage.useType(useType)
|
||||
}
|
||||
console.log(useType);
|
||||
eatTypes.active =useType == 'takeout' ? useType : useType.replace(
|
||||
/-after|-before/g, '');
|
||||
goods.list = getNowCart(records)
|
||||
if (seatFee && seatFee.totalNumber) {
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber - 1 || 0
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@
|
|||
itemId: '', // 栏目右边scroll-view用于滚动的id
|
||||
tabbar: storageManage.cacheGoods() || [],
|
||||
menuItemPos: [],
|
||||
arr: storageManage.cacheGoodsNode() || [], //左右联动布局节点信息
|
||||
arr: [], //左右联动布局节点信息
|
||||
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
|
||||
timer: null, // 定时器
|
||||
topZhanwei: 136 + 24,
|
||||
|
|
@ -1110,7 +1110,6 @@
|
|||
})
|
||||
data.arr = arr
|
||||
console.log(data.arr);
|
||||
storageManage.cacheGoodsNode(data.arr)
|
||||
resolve();
|
||||
}).exec()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -53,12 +53,7 @@
|
|||
returnCanComputedGoodsArr,canComputedPackFee,
|
||||
returnPackFee
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
function extraCanTuicai(orderInfo,data){
|
||||
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
|
||||
}
|
||||
function extraCanTuiKuan(orderInfo,data){
|
||||
return orderInfo.status=='closed'&&data.status!='return'&&data.priceAmount*1>0
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
|
|
@ -77,6 +72,12 @@
|
|||
default: () => {}
|
||||
}
|
||||
})
|
||||
function extraCanTuicai(orderInfo,data){
|
||||
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
|
||||
}
|
||||
function extraCanTuiKuan(orderInfo,data){
|
||||
return orderInfo.status=='closed'&&data.status!='refund'&&data.priceAmount*1>0
|
||||
}
|
||||
const packeNumbber = computed(() => {
|
||||
if (!props.orderInfo.detailList) {
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
<view class="u-text-right u-m-t-28">
|
||||
<template v-if="isTui(item)">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||
<view class="line-th color-666 " >¥{{returnTotalMoney(item)}}
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="isGift(item)||item.userCouponId">
|
||||
|
|
@ -67,7 +67,8 @@
|
|||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="user.isVip&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
||||
<template
|
||||
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
||||
<view>¥{{returnVipMoney(item)}}</view>
|
||||
<view class=" color-666 line-th">
|
||||
¥{{returnTotalMoney(item)}}</view>
|
||||
|
|
@ -120,21 +121,21 @@
|
|||
|
||||
<view class="u-flex">
|
||||
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
||||
<view class="color-red u-m-r-6 " >
|
||||
<view class="color-red u-m-r-6 ">
|
||||
已优惠¥{{youhuiAllPrice}}
|
||||
</view>
|
||||
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
|
||||
</view>
|
||||
|
||||
|
||||
<view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="orderInfo.status=='refund'">
|
||||
<template v-if="orderInfo.refundAmount">
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款金额</view>
|
||||
<view class="color-999">
|
||||
|
|
@ -165,32 +166,47 @@
|
|||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide" >
|
||||
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
|
||||
<view class="u-p-30" style="width: 80vw;">
|
||||
<view class="font-bold u-text-center">优惠详情</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="u-flex u-row-between u-m-b-18">
|
||||
<view>会员优惠</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{vipDiscountPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-b-18" v-if="orderInfo.discountAmount*1>0">
|
||||
<view>打折</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{to2(orderInfo.discountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
|
||||
<view>满减券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{orderInfo.fullCouponDiscountAmount}}</text>
|
||||
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-18">
|
||||
<view class="u-flex u-row-between u-m-t-18"
|
||||
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||
<view>商品券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{orderInfo.productCouponDiscountAmount}}</text>
|
||||
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-18">
|
||||
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
|
||||
<view>积分抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{orderInfo.pointsDiscountAmount}}</text>
|
||||
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
|
|
@ -199,26 +215,31 @@
|
|||
|
||||
<script setup>
|
||||
import {
|
||||
computed, reactive
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
isTui,isGift,
|
||||
isTui,
|
||||
isTuiCai,
|
||||
isGift,
|
||||
canTuiKuan,
|
||||
canTuicai,
|
||||
numSum
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
const pop=reactive({
|
||||
youhui:false
|
||||
const pop = reactive({
|
||||
youhui: false
|
||||
})
|
||||
function youhuiDetailShow(){
|
||||
pop.youhui=true
|
||||
|
||||
function youhuiDetailShow() {
|
||||
pop.youhui = true
|
||||
}
|
||||
function youhuiDetailHide(){
|
||||
pop.youhui=false
|
||||
|
||||
function youhuiDetailHide() {
|
||||
pop.youhui = false
|
||||
}
|
||||
const props = defineProps({
|
||||
orderInfo: {
|
||||
|
|
@ -284,7 +305,7 @@
|
|||
if (!props.seatFee.priceAmount) {
|
||||
return 0
|
||||
}
|
||||
const n = props.seatFee.priceAmount * (props.seatFee.status == 'return' ? 0 : 1)
|
||||
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||
return n.toFixed(2)
|
||||
})
|
||||
const goodsOriginAllPrice = computed(() => {
|
||||
|
|
@ -297,12 +318,13 @@
|
|||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const freePrice = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.gift == true || isTui(v)).reduce((a,
|
||||
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
|
||||
b) => {
|
||||
return a + (b.num * b.price)
|
||||
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
|
||||
return a + (b.num * price)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
|
|
@ -313,16 +335,43 @@
|
|||
return 0
|
||||
}
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return"&&v.memberPrice&&(v.memberPrice!=v.price)).reduce((a,
|
||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && !v
|
||||
.userCouponId && (v.isMember && v.memberPrice) && (v.memberPrice != v.price)).reduce((
|
||||
a,
|
||||
b) => {
|
||||
return a + (b.num * (b.price-b.memberPrice))
|
||||
return a + (b.num * (b.price - b.memberPrice))
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
const youhuiAllPrice=computed(()=>{
|
||||
return (freePrice.value*1+vipDiscountPrice.value*1+props.orderInfo.fullCouponDiscountAmount+props.orderInfo.productCouponDiscountAmount+props.orderInfo.pointsDiscountAmount).toFixed(2)
|
||||
|
||||
const productCoupPrice = computed(() => {
|
||||
if (props.orderInfo.status == 'closed') {
|
||||
return props.orderInfo.productCouponDiscountAmount
|
||||
}
|
||||
const goodsPrice = props.data.reduce((a, b) => {
|
||||
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
|
||||
cur) => {
|
||||
const isVip = props.user.isVip && cur.isMember
|
||||
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||
const price = isVip ? memberPrice : cur.price
|
||||
const curTotal = price * cur.num
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return a + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
const youhuiAllPrice = computed(() => {
|
||||
console.log(freePrice.value * 1 , vipDiscountPrice.value * 1 , props.orderInfo.fullCouponDiscountAmount ,props
|
||||
.orderInfo.pointsDiscountAmount , productCoupPrice.value * 1 , props.orderInfo.discountAmount);
|
||||
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
|
||||
.orderInfo.pointsDiscountAmount + productCoupPrice.value * 1 + (props.orderInfo.discountAmount ||
|
||||
0)).toFixed(2)
|
||||
|
||||
|
||||
})
|
||||
const packFee = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
|
|
@ -336,7 +385,8 @@
|
|||
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return (goodsOriginAllPrice.value-youhuiAllPrice.value).toFixed(2)
|
||||
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
})
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@
|
|||
<view class="color-666 u-m-t-8 u-font-24">积分</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="font-bold">0.00</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">已消费</view>
|
||||
<view class="font-bold u-text-center">{{user.orderNumber||0}}</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">订单数量</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
}
|
||||
|
||||
function goodsVipPriceAmount(item) {
|
||||
const price = props.data.memberId ? item.memberPrice : item.price
|
||||
const price = item.memberPrice ? item.memberPrice : item.price
|
||||
return (price * item.num).toFixed(2)
|
||||
}
|
||||
// const packeFee=computed(()=>{
|
||||
|
|
|
|||
|
|
@ -1,18 +1,25 @@
|
|||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 color-666">
|
||||
<view class="u-text-left u-p-30 color-666 u-font-28">
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<view class="color-red">*</view>
|
||||
<view class="u-m-l-32">
|
||||
<view class="" v-if="accountPoints.calcRes.usable">
|
||||
<text class="color-red">*</text>
|
||||
<text class=""
|
||||
v-if="accountPoints.calcRes.equivalentPoints">100积分等于{{to2(accountPoints.calcRes.equivalentPoints*100)}}元,</text>
|
||||
<text>
|
||||
最大抵扣积分{{accountPoints.calcRes.maxUsablePoints}}
|
||||
</text>
|
||||
<text>,
|
||||
最小抵扣积分0
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 u-flex ">
|
||||
<view>积分</view>
|
||||
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
|
||||
<uni-easyinput type="number" @input="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
|
||||
v-model="form.currentPrice"
|
||||
placeholder="输入实际金额"></uni-easyinput>
|
||||
<uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
|
||||
:inputBorder="false" v-model="form.points" placeholder="输入积分抵扣数量"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -20,9 +27,9 @@
|
|||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700" >修改</my-button>
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700">修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -34,7 +41,8 @@
|
|||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,watch
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
|
|
@ -45,76 +53,68 @@
|
|||
type: String,
|
||||
default: '积分抵扣'
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
discount:{
|
||||
type: [Number,String],
|
||||
default:100
|
||||
accountPoints:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return {
|
||||
calcRes:{
|
||||
usable: false,
|
||||
unusableReason: '',
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
price: {
|
||||
type: [Number,String],
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
function currentPriceInput(newval){
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
}
|
||||
function discountInput(newval){
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
}
|
||||
function currentPriceChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=0
|
||||
form.discount=100
|
||||
return infoBox.showToast('实收金额不能小于0')
|
||||
}
|
||||
if(newval>props.price){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('实收金额不能大于应付金额')
|
||||
}
|
||||
}
|
||||
function discountChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('优惠折扣不能小于0')
|
||||
}
|
||||
if(newval>100){
|
||||
form.discount=100
|
||||
form.currentPrice=0
|
||||
return infoBox.showToast('优惠折扣不能大于100')
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
return ''
|
||||
}
|
||||
return n.toFixed(2)
|
||||
}
|
||||
|
||||
const $form = {
|
||||
price:props.price,
|
||||
currentPrice: props.price,
|
||||
discount: 100
|
||||
function pointsInput(e){
|
||||
setTimeout(()=>{
|
||||
form.points=Math.floor(e)
|
||||
},100)
|
||||
}
|
||||
|
||||
|
||||
function pointsChange(newval) {
|
||||
form.points=Math.floor(newval)
|
||||
if (newval < 0) {
|
||||
form.points = 0
|
||||
return infoBox.showToast('积分抵扣不能小于0')
|
||||
}
|
||||
if (newval > props.accountPoints.calcRes.maxUsablePoints) {
|
||||
form.points = props.price
|
||||
return infoBox.showToast('积分抵扣不能大于'+props.accountPoints.calcRes.maxUsablePoints)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const form = reactive({
|
||||
...$form
|
||||
points: props.price,
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
watch(() => props.price, (newval) => {
|
||||
form.points = newval
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
form.points=0
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.currentPrice=props.price
|
||||
form.discount=props.discount
|
||||
form.points = props.price
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
@ -123,8 +123,7 @@
|
|||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
emits('confirm',Math.floor(form.points) )
|
||||
close()
|
||||
}
|
||||
defineExpose({
|
||||
|
|
@ -134,11 +133,12 @@
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.border{
|
||||
.border {
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
.lh34 {
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,15 +46,22 @@
|
|||
<view class="u-m-l-18">{{item.name}}</view>
|
||||
<view class="u-m-l-18 color-999">x{{item.num}}</view>
|
||||
</view>
|
||||
<view class="color-red">
|
||||
-¥{{item.discountAmount}}
|
||||
<view class="u-flex">
|
||||
<view class="color-red">
|
||||
-¥{{item.discountAmount}}
|
||||
</view>
|
||||
<view class="u-m-l-12" @click="delQuan(index)">
|
||||
<up-icon :size="16" name="minus-circle-fill" color="rgb(255, 0, 0)"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="border-bottom u-p-b-30" v-if="discount.price||accountPoints.sel">
|
||||
<view class="border-bottom u-p-b-30" v-if="(discount.price&&discount.currentPrice!=order.amount)||accountPoints.sel">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||
<view>服务员改价</view>
|
||||
|
|
@ -77,7 +84,7 @@
|
|||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||
<template v-if="pays.selIndex==0">
|
||||
<view class="list">
|
||||
<view class="item" @click="changePayType(index,item)"
|
||||
<view class="item" @click="changePayType(index,item)" :class="{disabled:item.disabled}"
|
||||
v-for="(item,index) in pays.payTypes.list" :key="index">
|
||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||
<view class="u-flex">
|
||||
|
|
@ -99,16 +106,18 @@
|
|||
<text>{{user.accountPoints||'0'}}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<my-radio @click="changePayType(index,item)"
|
||||
:modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
<view :class="{op3:item.disabled}">
|
||||
<my-radio @click="changePayType(index,item)"
|
||||
:modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom-dashed "></view>
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id&&user.accountPoints"
|
||||
@click="changeAccountPoints">
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id" @click="changeAccountPoints">
|
||||
<view class="u-flex ">
|
||||
<view class="">积分抵扣</view>
|
||||
<view class="color-999 u-m-l-10">
|
||||
|
|
@ -120,9 +129,9 @@
|
|||
</view>
|
||||
<view class="u-flex">
|
||||
|
||||
<view class="u-flex" @click.stop="refPointsOpen">
|
||||
<view class="u-flex">
|
||||
<view><text>{{accountPoints.num}}</text></view>
|
||||
<view v-if="accountPoints.calcRes.usable">
|
||||
<view v-if="accountPoints.calcRes.usable" @click.stop="refPointsOpen">
|
||||
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -196,7 +205,12 @@
|
|||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="order.amount"></edit-discount>
|
||||
|
||||
<edit-accountPoints ref="refPoints"></edit-accountPoints>
|
||||
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
@cancel="confirmModelCancel" @close="confirmModelCancel" width="300px" />
|
||||
|
||||
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints"
|
||||
ref="refPoints"></edit-accountPoints>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -227,13 +241,49 @@
|
|||
import editDiscount from '@/components/my-components/edit-discount.vue'
|
||||
import editAccountPoints from './components/edit-accountPoints.vue'
|
||||
import {
|
||||
returnGoodsPayPriceMap,returnProCoupStartIndex ,returnProductCoupAllPrice
|
||||
returnGoodsPayPriceMap,
|
||||
returnProCoupStartIndex,
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
cancelText: '取消',
|
||||
confirmText: '确认',
|
||||
content: '',
|
||||
key: 'cash',
|
||||
show: false,
|
||||
data: ''
|
||||
})
|
||||
|
||||
function confirmModelCancel() {
|
||||
modal.show=false
|
||||
modal.key=''
|
||||
modal.data=''
|
||||
}
|
||||
|
||||
function cashConfirmShow() {
|
||||
modal.content = '是否确认已现金收款' + payPrice.value
|
||||
modal.key='cash'
|
||||
modal.show=true
|
||||
}
|
||||
async function confirmModelConfirm() {
|
||||
if (modal.key == 'cash') {
|
||||
await pay()
|
||||
confirmModelCancel()
|
||||
}
|
||||
}
|
||||
|
||||
//商品数量从0到n每一个对应的价格
|
||||
let $goodsPayPriceMap={}
|
||||
|
||||
let $goodsPayPriceMap = {}
|
||||
|
||||
const refPoints = ref(null)
|
||||
|
||||
function delQuan(i) {
|
||||
pays.quan.splice(i, 1)
|
||||
}
|
||||
|
||||
function refPointsOpen() {
|
||||
if (!accountPoints.calcRes.usable && accountPoints.sel) {
|
||||
return
|
||||
|
|
@ -251,6 +301,10 @@
|
|||
},
|
||||
price: 0
|
||||
})
|
||||
|
||||
function pointsConfirm(e) {
|
||||
accountPoints.num = e
|
||||
}
|
||||
async function calcUsablePoints() {
|
||||
if (!order.memberId) {
|
||||
return
|
||||
|
|
@ -305,7 +359,7 @@
|
|||
go.to('PAGES_ORDER_QUAN', {
|
||||
orderId: order.id,
|
||||
memberId: order.memberId,
|
||||
orderPrice: payPrice.value*1+coupAllPrice.value*1
|
||||
orderPrice: payPrice.value * 1 + coupAllPrice.value * 1
|
||||
})
|
||||
}
|
||||
async function discountShow() {
|
||||
|
|
@ -392,30 +446,35 @@
|
|||
uni.$off('choose-quan')
|
||||
uni.$on('choose-quan', (arr) => {
|
||||
console.log(arr);
|
||||
const manjianCoup = arr.filter(v => v.type == 1)
|
||||
const manjianCoup = arr.filter(v => v.type == 1 && v.num >= 1)
|
||||
let productCoup = arr.filter(v => v.type == 2)
|
||||
console.log(productCoup);
|
||||
//商品券分组
|
||||
let coupMap={}
|
||||
for(let i in productCoup){
|
||||
const coup=productCoup[i]
|
||||
if(coupMap.hasOwnProperty(coup.proId)){
|
||||
let coupMap = {}
|
||||
for (let i in productCoup) {
|
||||
const coup = productCoup[i]
|
||||
if (coupMap.hasOwnProperty(coup.proId)) {
|
||||
coupMap[coup.proId].push(coup)
|
||||
}else{
|
||||
coupMap[coup.proId]=[coup]
|
||||
} else {
|
||||
coupMap[coup.proId] = [coup]
|
||||
}
|
||||
}
|
||||
for(let key in coupMap){
|
||||
const arr=coupMap[key]
|
||||
for(let i in arr){
|
||||
const coup=arr[i]
|
||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||
console.log(coupMap);
|
||||
for (let key in coupMap) {
|
||||
const arr = coupMap[key]
|
||||
for (let i in arr) {
|
||||
const coup = arr[i]
|
||||
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
|
||||
console.log(proCoupStartIndex);
|
||||
console.log($goodsPayPriceMap[coup.proId]);
|
||||
coup.discountAmount=returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],proCoupStartIndex,coup.num)
|
||||
console.log(coup.discountAmount);
|
||||
const coupUseNum = returnProductCanUseNum($goodsPayPriceMap[coup.proId], proCoupStartIndex,
|
||||
coup.num)
|
||||
const num = Math.min($goodsPayPriceMap[coup.proId].length, coupUseNum)
|
||||
coup.num = num
|
||||
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
|
||||
proCoupStartIndex, num).toFixed(2)
|
||||
}
|
||||
}
|
||||
productCoup = productCoup.filter(v => v.num >= 1)
|
||||
console.log(productCoup);
|
||||
pays.quan = [...manjianCoup, ...productCoup]
|
||||
})
|
||||
|
|
@ -457,7 +516,7 @@
|
|||
|
||||
//打折相关数据
|
||||
const discount = reactive({
|
||||
|
||||
discount: 100
|
||||
})
|
||||
|
||||
function editDiscountConfirm(form) {
|
||||
|
|
@ -468,10 +527,18 @@
|
|||
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changePayType(i, item) {
|
||||
if (item.disabled) {
|
||||
return infoBox.showToast(item.payName + '不可用')
|
||||
}
|
||||
pays.payTypes.selIndex = i
|
||||
if (item.payType == 'vipPay') {
|
||||
chooseUser()
|
||||
|
|
@ -499,6 +566,9 @@
|
|||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay()
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
payOrder()
|
||||
}
|
||||
const tipsMap = {
|
||||
|
|
@ -511,33 +581,39 @@
|
|||
infoBox.showToast('余额不足')
|
||||
return
|
||||
}
|
||||
|
||||
if (payStatus) {
|
||||
return infoBox.showToast(tipsMap[payStatus])
|
||||
}
|
||||
try {
|
||||
payStatus = 'paying'
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.memberId,
|
||||
discount: 1,
|
||||
code: '',
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
userCouponInfos: pays.quan.map(v => {
|
||||
return {
|
||||
userCouponId: v.id,
|
||||
num: v.num
|
||||
}
|
||||
})
|
||||
})
|
||||
paySuccess()
|
||||
pay()
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
payStatus = ''
|
||||
}
|
||||
}
|
||||
async function pay(par) {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
payStatus = 'paying'
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.memberId,
|
||||
discount: discount.discount / 100,
|
||||
code: '',
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
userCouponInfos: pays.quan.map(v => {
|
||||
return {
|
||||
userCouponId: v.id,
|
||||
num: v.num
|
||||
}
|
||||
}),
|
||||
...par
|
||||
})
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
|
|
@ -552,15 +628,7 @@
|
|||
success: function(res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
Api.$payOrder({
|
||||
"orderId": order.orderId, // 订单id
|
||||
"payType": item.payType, //
|
||||
"discount": order.discount,
|
||||
"code": res.result
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
paySuccess()
|
||||
})
|
||||
pay({code: res.result})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -582,7 +650,7 @@
|
|||
async function init() {
|
||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap=returnGoodsPayPriceMap(order.detailList)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
console.log($goodsPayPriceMap);
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
|
|
@ -614,8 +682,24 @@
|
|||
const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
|
||||
})
|
||||
watch(() => payPrice.value, () => {
|
||||
watch(() => payPrice.value, (newval) => {
|
||||
getPayUrl()
|
||||
if (newval <= 0) {
|
||||
const arr = ['cash', 'vipPay']
|
||||
pays.payTypes.list.map(v => {
|
||||
if (arr.includes(v.payType)) {
|
||||
v.disabled = false
|
||||
} else {
|
||||
v.disabled = true
|
||||
}
|
||||
})
|
||||
const index = pays.payTypes.list.findIndex(v => !v.disabled)
|
||||
pays.payTypes.selIndex = index
|
||||
} else {
|
||||
pays.payTypes.list.map(v => {
|
||||
v.disabled = false
|
||||
})
|
||||
}
|
||||
})
|
||||
const pointCanDicountPrice = computed(() => {
|
||||
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
|
||||
|
|
@ -643,6 +727,10 @@
|
|||
<style lang="scss" scoped>
|
||||
$quan-color: #318AFE;
|
||||
|
||||
.op3 {
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
.hui {
|
||||
// background-color: $quan-color;
|
||||
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||
|
|
@ -674,6 +762,12 @@
|
|||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
&.disabled {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
.border-bottom {
|
||||
border-bottom: none;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
</view>
|
||||
<view class=" u-m-t-20 u-flex">
|
||||
<view>有效期:</view>
|
||||
<view class="u-font-24 u-m-l-6"> {{item.endTime}}</view>
|
||||
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">
|
||||
{{ formatStr(item.useRestrictions)}}
|
||||
|
|
@ -65,7 +66,8 @@
|
|||
</view>
|
||||
<view class=" u-m-t-14 u-flex">
|
||||
<view>有效期:</view>
|
||||
<view class="u-font-24 u-m-l-6"> {{item.endTime}}</view>
|
||||
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">
|
||||
{{ formatStr(item.useRestrictions)}}
|
||||
|
|
@ -92,7 +94,7 @@
|
|||
|
||||
<view :style="{height:safebottomHeight+'px'}"></view>
|
||||
<view class="fixed-b bottom safe-bottom border-top">
|
||||
|
||||
|
||||
<view class="u-m-b-32 u-flex u-row-between u-p-t-10">
|
||||
<view class="u-flex">
|
||||
<text>抵扣金额:</text>
|
||||
|
|
@ -103,7 +105,8 @@
|
|||
<text>支付金额:</text>
|
||||
<text class="color-red">¥</text>
|
||||
<text class="color-red">{{payPrice }}</text>
|
||||
<view class="u-absolute u-flex u-row-between" style="bottom: 100%;right: 0;" v-if="payPrice*1!=option.orderPrice*1">
|
||||
<view class="u-absolute u-flex u-row-between" style="bottom: 100%;right: 0;"
|
||||
v-if="payPrice*1!=option.orderPrice*1">
|
||||
<view class="u-flex line-th color-999">
|
||||
<text class="">¥</text>
|
||||
<text class="">{{option.orderPrice}}</text>
|
||||
|
|
@ -138,6 +141,7 @@
|
|||
onMounted
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
getSafeBottomHeight
|
||||
} from '@/commons/utils/safe-bottom.js'
|
||||
|
|
@ -228,13 +232,18 @@
|
|||
if (!item.use) {
|
||||
return
|
||||
}
|
||||
console.log();
|
||||
if (myQuan.fullReductionCouponSel.id && !item.checked) {
|
||||
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
||||
let coupArr = [...goodsQuan, item]
|
||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||
console.log(payPrice);
|
||||
if (payPrice<=0) {
|
||||
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
modal.confirmText = '继续选择'
|
||||
setModalShow('clear', true, item)
|
||||
return
|
||||
}
|
||||
if (myQuan.fullReductionCouponSel.fullAmount > payPrice) {
|
||||
modal.content = '选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
|
|
@ -246,11 +255,18 @@
|
|||
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
if (CheckedArr.length <= 0) {
|
||||
return myQuan.res.productCoupon.map(v => {
|
||||
v.use = true
|
||||
})
|
||||
}
|
||||
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||
noCheckedArr.map(v => {
|
||||
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
function changeFullReductionCouponSel(item) {
|
||||
|
|
@ -262,10 +278,11 @@
|
|||
myQuan.fullReductionCouponSel = {
|
||||
id: ''
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
myQuan.fullReductionCouponSel = item
|
||||
}
|
||||
myQuan.res.fullReductionCoupon=returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan.fullReductionCouponSel)
|
||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan
|
||||
.fullReductionCouponSel)
|
||||
}
|
||||
|
||||
function formatStr(str) {
|
||||
|
|
@ -298,13 +315,21 @@
|
|||
memberId: option.memberId
|
||||
})
|
||||
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
||||
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => v.use && option.orderPrice * 1 >= v
|
||||
.fullAmount * 1)
|
||||
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => {
|
||||
if(option.orderPrice<=0){
|
||||
return false
|
||||
}else{
|
||||
return v.use && option.orderPrice * 1 >= v
|
||||
.fullAmount * 1
|
||||
}
|
||||
|
||||
})
|
||||
res.productCoupon = res.productCoupon.map(v => {
|
||||
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
||||
return {
|
||||
...calcCoup,
|
||||
checked: false
|
||||
checked: false,
|
||||
use:option.orderPrice<=0?false:v.use
|
||||
}
|
||||
}).filter((v) => v.use);
|
||||
$fullReductionCoupon = res.fullReductionCoupon
|
||||
|
|
@ -315,7 +340,7 @@
|
|||
const option = reactive({
|
||||
orderId: '',
|
||||
memberId: '',
|
||||
orderPrice:0
|
||||
orderPrice: 0
|
||||
})
|
||||
|
||||
function toEmitChooseQuan(item) {
|
||||
|
|
@ -338,13 +363,14 @@
|
|||
let coupArr = [...fullReductionCoupon, ...goodsQuan]
|
||||
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||
})
|
||||
const payPrice=computed(()=>{
|
||||
const pay= option.orderPrice-discountAmount.value
|
||||
return (pay<0?0:pay).toFixed(2)
|
||||
const payPrice = computed(() => {
|
||||
const pay = option.orderPrice - discountAmount.value
|
||||
return (pay < 0 ? 0 : pay).toFixed(2)
|
||||
})
|
||||
watch(() => myQuan.types.sel, (newval) => {
|
||||
if (newval == 0) {
|
||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan.fullReductionCouponSel)
|
||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value,
|
||||
myQuan.fullReductionCouponSel)
|
||||
}
|
||||
if (newval == 1) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
export function isTui(item) {
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
//是否使用会员价
|
||||
export function isUseVipPrice(vipUser,goods){
|
||||
return vipUser.id&&vipUser.isVip&&goods.isMember
|
||||
}
|
||||
|
||||
//计算商品券优惠价格
|
||||
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||
|
|
@ -9,7 +13,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
|||
return 0
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
return price * coup.num
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +40,8 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
|||
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||
return false
|
||||
}
|
||||
return findGoodsTotalNumber < (coup.num + selCoupNumber) ? false : true
|
||||
console.log(selCoupNumber,findGoodsTotalNumber);
|
||||
return findGoodsTotalNumber < selCoupNumber ? false : true
|
||||
}
|
||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
||||
|
|
@ -50,12 +55,13 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
|||
}
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
const discountAmount = (price * coup.num).toFixed(2)
|
||||
console.log(discountAmount);
|
||||
|
||||
const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
||||
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
||||
// const canUse=discountAmount>0
|
||||
const canUse=coup.use
|
||||
return {
|
||||
...coup,
|
||||
discountAmount: discountAmount,
|
||||
|
|
@ -81,7 +87,7 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
|||
//返回商品实际支付价格
|
||||
export function returnProductPayPrice(goods,vipUser){
|
||||
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||
const price = vipUser.isVip ? memberPrice : item.price;
|
||||
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
||||
return price
|
||||
}
|
||||
//返回商品券抵扣的商品价格
|
||||
|
|
@ -96,6 +102,23 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
|
|||
return prve+curPrice
|
||||
},0)
|
||||
}
|
||||
|
||||
//返回商品券可抵扣的商品数量
|
||||
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
||||
console.log(productPriceArr);
|
||||
console.log(num);
|
||||
let n=0;
|
||||
for(let i=0;i<num;i++){
|
||||
if(productPriceArr[startIndex*1+i]){
|
||||
n+=1
|
||||
console.log(n);
|
||||
}else{
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
//返回同类商品券在同类商品价格数组里的开始位置
|
||||
export function returnProCoupStartIndex(coupArr,index){
|
||||
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
||||
|
|
@ -162,7 +185,9 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
|||
}
|
||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||
console.log(proCoupStartIndex);
|
||||
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coup.num)
|
||||
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
|
||||
console.log(coupNum);
|
||||
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,9 +219,31 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
|||
return v
|
||||
}
|
||||
const isfullAmount = payPrice >= v.fullAmount * 1
|
||||
if(payPrice<=0){
|
||||
return {
|
||||
...v,
|
||||
use: false
|
||||
}
|
||||
}
|
||||
return {
|
||||
...v,
|
||||
use: v.use && isfullAmount
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
||||
export function returnCanUseNumProductCoup(coupArr,){
|
||||
let productCoup = coupArr.filter(v => v.type == 2)
|
||||
//商品券分组
|
||||
let coupMap={}
|
||||
for(let i in productCoup){
|
||||
const coup=productCoup[i]
|
||||
if(coupMap.hasOwnProperty(coup.proId)){
|
||||
coupMap[coup.proId].push(coup)
|
||||
}else{
|
||||
coupMap[coup.proId]=[coup]
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
Loading…
Reference in New Issue