会员,充值,明细,下单问题修复
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
</view>
|
||||
<scroll-view scroll-x="true" class="u-m-t-20">
|
||||
<view class="list">
|
||||
<view class="item color1" @click="itemClick" v-for="(item,index) in list" :key="index"
|
||||
<view class="item color1" @click="itemClick(index)" v-for="(item,index) in list" :key="index"
|
||||
:class="{active:sel==index}">
|
||||
<view class="">
|
||||
<text>¥</text>
|
||||
@@ -26,9 +26,9 @@
|
||||
</view>
|
||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||
<text>送</text>
|
||||
<text>{{item.couponInfoList.length}}</text>
|
||||
<text>{{couponNum(item.couponInfoList)}}</text>
|
||||
<text>张券</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index">查看</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index" @click="lookCoupon(item)">查看</text>
|
||||
</view>
|
||||
|
||||
<view class="sel u-flex" v-if="sel==index">
|
||||
@@ -40,21 +40,39 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="" v-else></view>
|
||||
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import CouponList from '@/components/coupon/list.vue'
|
||||
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||
import {
|
||||
useCartsStore
|
||||
} from '@/stores/carts.js';
|
||||
const cartStore = useCartsStore()
|
||||
import {
|
||||
onMounted,
|
||||
onMounted,reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const couponModel = reactive({
|
||||
show: false,
|
||||
couponInfoList: []
|
||||
})
|
||||
|
||||
function lookCoupon(item) {
|
||||
couponModel.couponInfoList = item.couponInfoList
|
||||
couponModel.show = true
|
||||
}
|
||||
|
||||
function couponNum(list) {
|
||||
return list.reduce((prve, cur) => {
|
||||
return prve + cur.num
|
||||
}, 0)
|
||||
}
|
||||
const cartStore = useCartsStore()
|
||||
|
||||
const list = ref([])
|
||||
const sel = ref(-1)
|
||||
const isShow = ref(false)
|
||||
@@ -82,19 +100,25 @@
|
||||
updateSel()
|
||||
}
|
||||
})
|
||||
|
||||
const emits=defineEmits(['updateChargeSel','updateRechargeId'])
|
||||
function updateSel(){
|
||||
const selItem=list.value[sel.value]
|
||||
emits('updateChargeSel',selItem?selItem:{})
|
||||
emits('updateRechargeId',data.id)
|
||||
}
|
||||
function itemClick(index){
|
||||
|
||||
console.log('itemClick',sel.value,index);
|
||||
if(sel.value==-1){
|
||||
sel.value=index
|
||||
return
|
||||
}
|
||||
if(sel.value==index){
|
||||
sel.value=-1
|
||||
return
|
||||
}
|
||||
sel.value=index
|
||||
}
|
||||
const emits=defineEmits(['updateChargeSel'])
|
||||
watch(()=>sel.value,(newval)=>{
|
||||
updateSel()
|
||||
})
|
||||
@@ -104,8 +128,14 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.color1{
|
||||
color: #5F2E0F;
|
||||
}
|
||||
.color2{
|
||||
color: #FF6300;
|
||||
}
|
||||
.box {
|
||||
background: linear-gradient(179.4deg, #f8eadc 0%, #fdf9f6 82%, #ffffff 100%);
|
||||
background-color: #fdf9f6;
|
||||
padding: 30rpx;
|
||||
margin-top: 32rpx;
|
||||
border-radius: 22rpx;
|
||||
@@ -125,7 +155,7 @@
|
||||
.item {
|
||||
padding: 36rpx 22rpx;
|
||||
border-radius: 42rpx;
|
||||
background: linear-gradient(180deg, #F5F5F5 58.54%, #FFF 140.47%);
|
||||
background: linear-gradient(180deg, #F5F5F5 58.54%, #FFF 104.47%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
@@ -88,8 +88,7 @@
|
||||
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="cell-item" v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{cartStore.seatFeeConfig.personCount}}</view>
|
||||
@@ -117,33 +116,50 @@
|
||||
<u-image bgColor="#fff" :width="item.width||'44rpx'" :height="item.height||'44rpx'"
|
||||
v-if="item.icon" :src="item.icon" mode=""></u-image>
|
||||
</view>
|
||||
<text class="name u-m-l-16"> {{ item.name }} </text>
|
||||
<text class="name u-m-l-16 no-wrap"> {{ item.name }} </text>
|
||||
<text class="font-12" style="color: #666;margin-right: 16rpx;" v-if="item.type=='points'">
|
||||
「可用积分{{pointsRes.accountPoints}},最大可抵扣{{maxPointDiscount}}元」
|
||||
|
||||
</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 优惠卷 -->
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text red" v-if="returnCouponDiscount>0">-¥{{returnCouponDiscount}}</text>
|
||||
<text class="favorable_right_text red"
|
||||
v-if="returnCouponDiscount>0">-¥{{returnCouponDiscount}}</text>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||!listinfo.id"></up-icon>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 新客立减 -->
|
||||
<view class="favorable_right" v-if="item.type=='newUser'">
|
||||
<text class="favorable_right_text red" v-if="newUserDiscount>0">-¥{{newUserDiscount}}</text>
|
||||
|
||||
<text class="favorable_right_text red"
|
||||
v-if="newUserDiscount>0">-¥{{newUserDiscount}}</text>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 积分 -->
|
||||
<view class="favorable_right" v-if="item.type=='points'">
|
||||
<view class="favorable_right u-flex u-col-center" v-if="item.type=='points'">
|
||||
<up-icon name="checkmark-circle-fill" size="24rpx" v-if="usePoints"
|
||||
color="#FE7E00"></up-icon>
|
||||
<text v-if="usePoints" class="red">
|
||||
-¥{{cartStore.orderCostSummary.pointDeductionAmount}}
|
||||
</text>
|
||||
<view v-else class="u-flex u-col-center">
|
||||
<view class="round"></view>
|
||||
<text class="color-333 font-12 no-wrap">使用抵扣</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="favorable_right" v-if="item.type=='points'">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
|
||||
v-if="calcUsablePointsData.integral">
|
||||
使用 {{ calcUsablePointsData.integral}}
|
||||
积分抵扣¥{{props.listinfo.pointsDiscountAmount}}
|
||||
</text>
|
||||
<up-icon v-else name="arrow-right" color="#575B66" size="16"></up-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -215,7 +231,7 @@
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
|
||||
@@ -247,6 +263,12 @@
|
||||
|
||||
} from 'vue'
|
||||
|
||||
const usePoints = ref(false)
|
||||
|
||||
function chnageIsUsePoints() {
|
||||
usePoints.value = !usePoints.value
|
||||
}
|
||||
|
||||
import IntegralInput from './IntegralInput.vue';
|
||||
import {
|
||||
APImemberPointsmyPoints,
|
||||
@@ -278,8 +300,7 @@
|
||||
},
|
||||
])
|
||||
|
||||
const favorablelist = reactive([
|
||||
{
|
||||
const favorablelist = reactive([{
|
||||
name: "新客立减",
|
||||
type: "newUser",
|
||||
width: '40rpx',
|
||||
@@ -374,12 +395,12 @@
|
||||
}
|
||||
|
||||
const returnCouponDiscount = computed(() => {
|
||||
if(!favorablelist[1].value){
|
||||
if (!favorablelist[1].value) {
|
||||
return 0
|
||||
}
|
||||
return favorablelist[1].value.reduce((prve,cur)=>{
|
||||
return prve+(cur.discountAmount||0)
|
||||
},0)
|
||||
return favorablelist[1].value.reduce((prve, cur) => {
|
||||
return prve + (cur.discountAmount || 0)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
// 清空
|
||||
@@ -426,8 +447,10 @@
|
||||
shoppingCart: JSON.stringify([...props.nowCarts, ...props.listinfo.combinedArray]),
|
||||
})
|
||||
break;
|
||||
|
||||
|
||||
case 'points':
|
||||
chnageIsUsePoints()
|
||||
return
|
||||
IntegralInputclose()
|
||||
if (calcUsablePointsData.usable == 0) {
|
||||
uni.showToast({
|
||||
@@ -453,14 +476,47 @@
|
||||
})
|
||||
|
||||
|
||||
const pointsRes = reactive({
|
||||
accountPoints: 0
|
||||
})
|
||||
getMaxPointsDiscount()
|
||||
const maxPointDiscount=ref(0)
|
||||
async function getMaxPointsDiscount() {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
.couponDeductionAmount
|
||||
let res = await APImemberPointscalcUsablePoints({
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount: maxMoney
|
||||
})
|
||||
console.log(res);
|
||||
Object.assign(pointsRes, res)
|
||||
const maxUsablePoints = res.maxUsablePoints
|
||||
maxPointDiscount.value=res.maxDeductionAmount
|
||||
// props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
// points: maxUsablePoints,
|
||||
// shopUserId: props.orderVIP.id,
|
||||
// orderAmount: maxMoney
|
||||
// })
|
||||
cartStore.setUserPoints(maxUsablePoints)
|
||||
}
|
||||
watch(() => usePoints.value, (newval) => {
|
||||
if (newval) {
|
||||
getMaxPointsDiscount()
|
||||
} else {
|
||||
cartStore.setUserPoints(0)
|
||||
}
|
||||
})
|
||||
|
||||
const handleConfirm = async (integral) => {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney= cartStore.orderCostSummary.goodsRealAmount-cartStore.orderCostSummary.couponDeductionAmount
|
||||
const maxMoney = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
.couponDeductionAmount
|
||||
calcUsablePointsData.integral = integral
|
||||
props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
points: integral,
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount:maxMoney
|
||||
orderAmount: maxMoney
|
||||
})
|
||||
cartStore.setUserPoints(integral)
|
||||
emits('clickPointsamount', {
|
||||
@@ -473,7 +529,7 @@
|
||||
const getCalcUsablePoints = async (data) => {
|
||||
Object.assign(calcUsablePointsData, data);
|
||||
try {
|
||||
cartStore.setPointDeductionRule(data.equivalentPoints,data.maxDeductionAmount)
|
||||
cartStore.setPointDeductionRule(data.equivalentPoints, data.maxDeductionAmount)
|
||||
calcUsablePointsData.minIntegral = data.minDeductionPoints
|
||||
calcUsablePointsData.maxIntegral = data.maxUsablePoints
|
||||
calcUsablePointsData.instructionText =
|
||||
@@ -513,19 +569,20 @@
|
||||
bwcclear,
|
||||
IntegralInputclose
|
||||
});
|
||||
|
||||
watch(()=>props.listinfo.seatNum,(newval)=>{
|
||||
cartStore.setSeatFeeConfig('personCount',newval||1)
|
||||
|
||||
watch(() => props.listinfo.seatNum, (newval) => {
|
||||
cartStore.setSeatFeeConfig('personCount', newval || 1)
|
||||
})
|
||||
|
||||
const newUserDiscount=ref(0)
|
||||
async function getConsumeDiscount(){
|
||||
|
||||
const newUserDiscount = ref(0)
|
||||
async function getConsumeDiscount() {
|
||||
const consumeDiscountRes = await consumeDiscount({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
})
|
||||
if(consumeDiscountRes){
|
||||
newUserDiscount.value=consumeDiscountRes.amount
|
||||
cartStore.newUserDiscount=consumeDiscountRes.amount||0
|
||||
if (consumeDiscountRes&&consumeDiscountRes.isUse) {
|
||||
newUserDiscount.value = consumeDiscountRes.amount
|
||||
cartStore.newUserDiscount = consumeDiscountRes.amount || 0
|
||||
cartStore.consumeDiscount=consumeDiscountRes
|
||||
}
|
||||
}
|
||||
getConsumeDiscount()
|
||||
@@ -537,6 +594,14 @@
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
}
|
||||
|
||||
.round {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
border: 1px solid #D9D9D9;
|
||||
}
|
||||
|
||||
::v-deep .u-textarea__field {
|
||||
background: #FAFAFA;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
@@ -1043,7 +1108,8 @@
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-weight: 400rpx;
|
||||
&.red{
|
||||
|
||||
&.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
}
|
||||
@@ -1058,9 +1124,11 @@
|
||||
|
||||
.favorable_right_text {
|
||||
margin-bottom: 10rpx;
|
||||
&.red{
|
||||
|
||||
&.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
|
||||
text:nth-child(1) {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
@@ -1205,7 +1273,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.red{
|
||||
color:#FF3232;
|
||||
|
||||
.red {
|
||||
color: #FF3232;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user