修改确认订单逻辑
This commit is contained in:
@@ -7,8 +7,15 @@
|
||||
:placeholder="instructions" />
|
||||
</view>
|
||||
<!-- <view class="instructions">{{ instructions }}</view> -->
|
||||
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
|
||||
<up-button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</up-button>
|
||||
<view class="u-flex gap-20" style="width: 100%; padding-bottom: 40px;">
|
||||
<view class="u-flex-1">
|
||||
<up-button style="margin-top: 20rpx;" @click="IntegralInputclose">取消</up-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<up-button type="primary" @click="confirmIntegral" text="确定"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -117,7 +124,9 @@
|
||||
height: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.gap-20{
|
||||
gap: 20rpx;
|
||||
}
|
||||
.modal-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -146,6 +155,7 @@
|
||||
|
||||
.input-wrapper {
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.instructions {
|
||||
|
||||
161
pages/order/components/charge.vue
Normal file
161
pages/order/components/charge.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="box" v-if="isShow">
|
||||
<view class="u-flex u-col-center" style="align-items: center;">
|
||||
<image src="/static/icon/charge.png" class="charge" mode=""></image>
|
||||
<view class="u-m-l-28 color-333 font-700"> 充值享优惠</view>
|
||||
</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"
|
||||
:class="{active:sel==index}">
|
||||
<view class="">
|
||||
<text>¥</text>
|
||||
<text class="font-700" style="font-size: 48rpx;"
|
||||
:class="{color2:sel==index}">{{item.amount}}</text>
|
||||
</view>
|
||||
<view class="font-12" v-if="item.rewardAmount" :class="{color2:sel==index}">
|
||||
<text>赠</text>
|
||||
<text>¥</text>
|
||||
<text class="font-14">{{item.rewardAmount}}</text>
|
||||
</view>
|
||||
<view class="font-12" v-if="item.rewardPoints">
|
||||
<text>送</text>
|
||||
<text>¥</text>
|
||||
<text class="font-14">{{item.rewardPoints}}</text>
|
||||
</view>
|
||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||
<text>送</text>
|
||||
<text>{{item.couponInfoList.length}}</text>
|
||||
<text>张券</text>
|
||||
<text class="color2 u-m-l-8" v-if="sel==index">查看</text>
|
||||
</view>
|
||||
|
||||
<view class="sel u-flex" v-if="sel==index">
|
||||
<image class="image" src="/static/vip/sel.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="" v-else></view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||
import {
|
||||
useCartsStore
|
||||
} from '@/stores/carts.js';
|
||||
const cartStore = useCartsStore()
|
||||
import {
|
||||
onMounted,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const list = ref([])
|
||||
const sel = ref(-1)
|
||||
const isShow = ref(false)
|
||||
let data={}
|
||||
let $riginList=[]
|
||||
async function init() {
|
||||
console.log('recharge', )
|
||||
const shopId = uni.cache.get('shopId')
|
||||
const res = await rechargeApi.config({
|
||||
shopId
|
||||
})
|
||||
if (res) {
|
||||
data=res;
|
||||
$riginList=res.rechargeDetailList
|
||||
isShow.value = res.isOrder
|
||||
list.value = res.rechargeDetailList.filter(v=>v.amount>cartStore.orderCostSummary.finalPayAmount)
|
||||
if(list.value.length){
|
||||
sel.value=0
|
||||
updateSel()
|
||||
}
|
||||
}
|
||||
}
|
||||
watch(()=>cartStore.orderCostSummary.finalPayAmount,(newval)=>{
|
||||
list.value=$riginList.filter(v=>v.amount>newval)
|
||||
if(list.value.length){
|
||||
sel.value=0
|
||||
updateSel()
|
||||
}
|
||||
})
|
||||
|
||||
function updateSel(){
|
||||
const selItem=list.value[sel.value]
|
||||
emits('updateChargeSel',selItem?selItem:{})
|
||||
emits('updateRechargeId',data.id)
|
||||
}
|
||||
function itemClick(index){
|
||||
if(sel.value==index){
|
||||
sel.value=-1
|
||||
}
|
||||
sel.value=index
|
||||
}
|
||||
const emits=defineEmits(['updateChargeSel'])
|
||||
watch(()=>sel.value,(newval)=>{
|
||||
updateSel()
|
||||
})
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
background: linear-gradient(179.4deg, #f8eadc 0%, #fdf9f6 82%, #ffffff 100%);
|
||||
padding: 30rpx;
|
||||
margin-top: 32rpx;
|
||||
border-radius: 22rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.charge {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
padding: 20rpx 0;
|
||||
|
||||
.item {
|
||||
padding: 36rpx 22rpx;
|
||||
border-radius: 42rpx;
|
||||
background: linear-gradient(180deg, #F5F5F5 58.54%, #FFF 140.47%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border: 6rpx solid transparent;
|
||||
transition: all .3s ease-in-out;
|
||||
min-width: 202rpx;
|
||||
|
||||
&.active {
|
||||
background: linear-gradient(180deg, #FFC29A -26.17%, #FFF 64.06%);
|
||||
border: 6rpx solid #FE6C0E;
|
||||
box-shadow: 0 0 31rpx 2rpx #fe8b435e;
|
||||
}
|
||||
|
||||
.sel {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
|
||||
transform: translateX(-50%) translateY(21rpx);
|
||||
|
||||
.image {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1224
pages/order/components/orderInfo - 副本 (2).vue
Normal file
1224
pages/order/components/orderInfo - 副本 (2).vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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