修改确认订单逻辑
This commit is contained in:
@@ -25,24 +25,7 @@
|
||||
</view>
|
||||
<view class="value" v-if="listinfo.tableName"> {{ listinfo.tableName || '' }} </view>
|
||||
</view>
|
||||
<!-- <view class="pack" v-else>
|
||||
<view class="top">
|
||||
<text class="title">{{ shopInfo.shopName }}</text>
|
||||
<text class="address">{{ shopInfo.address }}</text>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="item">
|
||||
<view class="lable">取餐时间</view>
|
||||
<view class="text">立即取餐</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">预留电话</view>
|
||||
<view class="getPhone text"><u-input class="inputVal" v-model="order.phone"
|
||||
input-align="right" placeholder="请输入预留电话以便联系您"></u-input><text
|
||||
class="getBtn">获取手机号</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
@@ -79,33 +62,20 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<!--<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
|
||||
<view class="totalAmount">
|
||||
<view class="label">小计¥</view>
|
||||
<view class="price"> {{item.totalAmount}} </view>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="semicircle_icon" v-if="index > 0">
|
||||
<view class="semicircle_left_icon"></view>
|
||||
<view class="semicircle_right_icon"></view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
<view class="total-wrap u-m-t-30" v-if="listinfo.status == 'unpaid'||!listinfo.id">
|
||||
<view>总计¥</view>
|
||||
<view class="price"> {{listinfo.totalCost||''}} </view>
|
||||
<view class="price"> {{cartStore.orderCostSummary.goodsRealAmount}} </view>
|
||||
</view>
|
||||
|
||||
<view class="total-wrap" v-else>
|
||||
<!-- <view class="total-wrap" v-else>
|
||||
<view>实付¥</view>
|
||||
<view class="price"> {{listinfo.payAmount||''}} </view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
@@ -119,12 +89,12 @@
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="ordershopUserInfo.isTableFee == 0 && is_type == 0 && listinfo.Seatcharge != 0">
|
||||
v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.Seatcharge}}</view>
|
||||
<view>X{{cartStore.seatFeeConfig.personCount}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.Seatcharge}}</view>
|
||||
<view>{{cartStore.orderCostSummary.seatFee}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -150,25 +120,20 @@
|
||||
<text class="name u-m-l-16"> {{ item.name }} </text>
|
||||
</view>
|
||||
|
||||
<!-- 商品卷 -->
|
||||
<view class="favorable_right" :class="{column:item.value}" v-if="item.type=='product'">
|
||||
<view :class="{column:item.value}">
|
||||
<view class="favorable_right_text" v-if="item.value.uniqueIds">
|
||||
<text>{{item.value.uniqueIds}}张</text>
|
||||
<text>¥-{{item.value.Productroll}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
style="margin-top: 5rpx;"></up-icon>
|
||||
</view>
|
||||
|
||||
<!-- 优惠卷 -->
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text">{{item.value.name}}</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>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 积分 -->
|
||||
<view class="favorable_right" v-if="item.type=='points'">
|
||||
@@ -250,6 +215,8 @@
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
|
||||
:maxValue="calcUsablePointsData.maxIntegral" :instructions="calcUsablePointsData.instructionText"
|
||||
@@ -264,6 +231,9 @@
|
||||
useCartsStore
|
||||
} from '@/stores/carts.js';
|
||||
const cartStore = useCartsStore()
|
||||
import {
|
||||
consumeDiscount
|
||||
} from '@/common/api/market/index.js'
|
||||
import orderItemVue from './order-item.vue';
|
||||
import {
|
||||
ref,
|
||||
@@ -308,13 +278,17 @@
|
||||
},
|
||||
])
|
||||
|
||||
const favorablelist = reactive([{
|
||||
name: "商品券",
|
||||
type: "product",
|
||||
value: [],
|
||||
icon: goodsIcon,
|
||||
const favorablelist = reactive([
|
||||
{
|
||||
name: "新客立减",
|
||||
type: "newUser",
|
||||
width: '40rpx',
|
||||
height: '34rpx',
|
||||
value: "",
|
||||
icon: coupIcon,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "优惠券",
|
||||
type: "coupon",
|
||||
width: '40rpx',
|
||||
@@ -323,7 +297,6 @@
|
||||
icon: coupIcon,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
},
|
||||
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
|
||||
{
|
||||
icon: pointsIcon,
|
||||
name: "积分抵扣",
|
||||
@@ -384,7 +357,8 @@
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
const is_type = ref(0)
|
||||
@@ -392,30 +366,45 @@
|
||||
const tabClick = (item, index) => {
|
||||
is_type.value = index
|
||||
emits("istype", is_type.value)
|
||||
cartStore.setDinnerType(item.val)
|
||||
// this.getchoseEatModel('tabClick', index, item);
|
||||
}
|
||||
|
||||
// 操作优惠卷
|
||||
const dataprocessing = (data) => {
|
||||
if (data.typeOrder == 1) {
|
||||
favorablelist[1].value = data.item
|
||||
} else {
|
||||
favorablelist[0].value = data
|
||||
}
|
||||
favorablelist[1].value = data
|
||||
|
||||
}
|
||||
|
||||
const returnCouponDiscount = computed(() => {
|
||||
if(!favorablelist[1].value){
|
||||
return 0
|
||||
}
|
||||
return favorablelist[1].value.reduce((prve,cur)=>{
|
||||
return prve+(cur.discountAmount||0)
|
||||
},0)
|
||||
})
|
||||
|
||||
// 清空
|
||||
const bwcclear = () => {
|
||||
IntegralInputclose()
|
||||
// 清空优惠卷
|
||||
favorablelist[1].value = ''
|
||||
favorablelist[0].value = ''
|
||||
favorablelist[1].value = ''
|
||||
}
|
||||
|
||||
const dinnerType = computed(() => {
|
||||
return is_type.value ? 'take-out' : 'dine-ine'
|
||||
})
|
||||
// 跳转
|
||||
const goUrl = (item) => {
|
||||
console.log(props.listinfo.totalPrices, props.listinfo.Productroll)
|
||||
const canDikouGoodsArr = props.nowCarts
|
||||
const goodsOrderPrice = props.listinfo.totalPrices
|
||||
// const user=uni.cache.get('shopUserInfo')
|
||||
uni.setStorageSync('canDikouGoodsArr', canDikouGoodsArr)
|
||||
uni.setStorageSync('goodsOrderPrice', goodsOrderPrice)
|
||||
uni.setStorageSync('dinnerType', dinnerType.value)
|
||||
|
||||
|
||||
if (props.isBwc) {
|
||||
uni.showToast({
|
||||
title: '不可与其他优惠共享!',
|
||||
@@ -440,22 +429,7 @@
|
||||
shoppingCart: JSON.stringify([...props.nowCarts, ...props.listinfo.combinedArray]),
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
// 清空积分
|
||||
IntegralInputclose()
|
||||
console.log('props.listinfo.combinedArray', props.listinfo.combinedArray);
|
||||
// 清空优惠卷
|
||||
favorablelist[1].value = ''
|
||||
favorablelist[0].value = ''
|
||||
emits('learcoupons', 'product')
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_product",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
shopUserId: props.orderVIP.id,
|
||||
payAmount: props.listinfo.totalPrices,
|
||||
shoppingCart: JSON.stringify([...props.nowCarts, ...props.listinfo.combinedArray]),
|
||||
})
|
||||
break;
|
||||
|
||||
case 'points':
|
||||
IntegralInputclose()
|
||||
if (calcUsablePointsData.usable == 0) {
|
||||
@@ -483,12 +457,15 @@
|
||||
|
||||
|
||||
const handleConfirm = async (integral) => {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney= cartStore.orderCostSummary.goodsRealAmount-cartStore.orderCostSummary.couponDeductionAmount
|
||||
calcUsablePointsData.integral = integral
|
||||
props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
points: integral,
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount: props.listinfo.totalCost
|
||||
orderAmount:maxMoney
|
||||
})
|
||||
cartStore.setUserPoints(integral)
|
||||
emits('clickPointsamount', {
|
||||
pointsDiscountAmount: props.listinfo.pointsDiscountAmount,
|
||||
pointsNum: calcUsablePointsData.integral
|
||||
@@ -499,6 +476,7 @@
|
||||
const getCalcUsablePoints = async (data) => {
|
||||
Object.assign(calcUsablePointsData, data);
|
||||
try {
|
||||
cartStore.setPointDeductionRule(data.equivalentPoints,data.maxDeductionAmount)
|
||||
calcUsablePointsData.minIntegral = data.minDeductionPoints
|
||||
calcUsablePointsData.maxIntegral = data.maxUsablePoints
|
||||
calcUsablePointsData.instructionText =
|
||||
@@ -514,6 +492,7 @@
|
||||
calcUsablePointsData.integral = null
|
||||
props.listinfo.pointsDiscountAmount = 0
|
||||
calcUsablePointsData.showModal = false
|
||||
cartStore.setUserPoints(0);
|
||||
}
|
||||
|
||||
// * 复制订单号
|
||||
@@ -537,23 +516,42 @@
|
||||
bwcclear,
|
||||
IntegralInputclose
|
||||
});
|
||||
|
||||
watch(()=>props.listinfo.seatNum,(newval)=>{
|
||||
cartStore.setSeatFeeConfig('personCount',newval||1)
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
getConsumeDiscount()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .orderInfo .u-textarea{
|
||||
::v-deep .orderInfo .u-textarea {
|
||||
background: #FAFAFA;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
}
|
||||
::v-deep .u-textarea__field{
|
||||
|
||||
::v-deep .u-textarea__field {
|
||||
background: #FAFAFA;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
}
|
||||
.t{
|
||||
|
||||
.t {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.card_box {
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
@@ -1048,6 +1046,9 @@
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-weight: 400rpx;
|
||||
&.red{
|
||||
color: #FF3232;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1060,7 +1061,9 @@
|
||||
|
||||
.favorable_right_text {
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
&.red{
|
||||
color: #FF3232;
|
||||
}
|
||||
text:nth-child(1) {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
@@ -1205,4 +1208,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.red{
|
||||
color:#FF3232;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user