修改确认订单逻辑
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>
|
||||
1407
pages/order/confirm-order - 副本.vue
Normal file
1407
pages/order/confirm-order - 副本.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,8 @@
|
||||
</view>
|
||||
|
||||
|
||||
{{cartStore.orderCostSummary}}
|
||||
|
||||
<!-- 详情 -->
|
||||
<orderInfo :useVipPrice="cartStore.useVipPrice" :packfee="packfee" :shifu="shifu" :nowCarts="cartStore.carts"
|
||||
ref="orderInfoAfterRef" :freeCheck="freeCheck" :listinfo="listinfo" :orderVIP="orderVIP"
|
||||
@@ -47,6 +49,8 @@
|
||||
v-if="(listinfo.status == 'unpaid'||!listinfo.id) && orderVIP.freeDineConfig.enable"
|
||||
@changeFree="changeFree">
|
||||
</rechargeFree>
|
||||
<!-- 充值享优惠 -->
|
||||
<ChargeVue @updateChargeSel="updateChargeSel" @updateRechargeId="updateRechargeId" v-else></ChargeVue>
|
||||
<!-- 支付方式 -->
|
||||
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
|
||||
:changeFreeenable="isBwc" v-if="listinfo.status == 'unpaid'||!listinfo.id">
|
||||
@@ -56,7 +60,7 @@
|
||||
<view class="fixedview_one flex-start">
|
||||
<view class="fixedview_oneone"> 实付金额: </view>
|
||||
<view class="fixedview_onetow">
|
||||
<text>¥</text>{{listinfo.totalCost}}
|
||||
<text>¥</text>{{cartStore.orderCostSummary.finalPayAmount}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-colum-end u-flex u-flex-y-center">
|
||||
@@ -110,7 +114,11 @@
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
|
||||
import {
|
||||
BigNumber
|
||||
} from 'bignumber.js';
|
||||
import ChargeVue from './components/charge.vue';
|
||||
import {pay} from '@/utils/pay.js'
|
||||
function onback() {
|
||||
closeSocket()
|
||||
back()
|
||||
@@ -122,6 +130,7 @@
|
||||
'border-radius': '106rpx',
|
||||
'border': '2rpx solid #E8AD7B'
|
||||
}
|
||||
import _ from "lodash";
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
@@ -140,9 +149,10 @@
|
||||
import {
|
||||
APIgetOrderById,
|
||||
APIputuserorder,
|
||||
APIhistoryOrder
|
||||
APIhistoryOrder,rechargePayOrder
|
||||
} from '@/common/api/order/index.js'
|
||||
import {
|
||||
APIusershopInfodetail,
|
||||
APIshopUserInfo
|
||||
} from '@/common/api/member.js'
|
||||
import {
|
||||
@@ -156,6 +166,19 @@
|
||||
useWebSocket
|
||||
} from '@/stores/carts-websocket.js';
|
||||
const cartStore = useCartsStore()
|
||||
|
||||
|
||||
//充值相关
|
||||
const rechargeItem=ref(null)
|
||||
const rechargeId=ref(null)
|
||||
|
||||
function updateRechargeId(e){
|
||||
rechargeId.value=e
|
||||
}
|
||||
function updateChargeSel(e){
|
||||
rechargeItem.value=e
|
||||
}
|
||||
|
||||
async function onMessage(Message) {
|
||||
cartStore.onMessage(Message, cartsSocket)
|
||||
listinfo.totalPrices = historyTotalPrices * 1 + cartStore.totalPrice * 1
|
||||
@@ -324,8 +347,10 @@
|
||||
listinfo.tableName = tableRes.name;
|
||||
}
|
||||
}
|
||||
cartStore.setOldOrder(res);
|
||||
socketInit()
|
||||
console.log(res);
|
||||
|
||||
getOrderInfoAfterCalcInit(res)
|
||||
}
|
||||
|
||||
@@ -609,12 +634,12 @@
|
||||
//先付
|
||||
if (isPayBefor()) {
|
||||
console.log('isPayBefor');
|
||||
console.log(cartStore.isEmpty);
|
||||
// 购物车有数据
|
||||
if (!cartStore.isEmpty) {
|
||||
const res = await createOrder()
|
||||
goToPay()
|
||||
}
|
||||
|
||||
goToPay()
|
||||
|
||||
} else {
|
||||
//后付
|
||||
@@ -725,7 +750,7 @@
|
||||
shopUserId: orderVIP.value.id,
|
||||
orderId: listinfo.id,
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
amount: listinfo.totalCost, // 最终订单金额
|
||||
amount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
|
||||
returnUrl: '', //跳转地址
|
||||
buyerRemark: '',
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
@@ -739,27 +764,44 @@
|
||||
orderId: listinfo.id,
|
||||
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
originAmount: listinfo.originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: listinfo.Productroll, //商品优惠券抵扣金额
|
||||
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //满减优惠券抵扣金额
|
||||
couponList: uniqueIds.value, //用户使用的卡券
|
||||
orderAmount: listinfo.totalCost, // 最终订单金额
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
|
||||
couponList: cartStore.backendCoupons.map(v => v.id), //用户使用的卡券
|
||||
orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: listinfo.pointsDiscountAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
console.log('topay checkOrderPay', checkOrderPay);
|
||||
try {
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
if(rechargeItem.value.id&&rechargeId.value){
|
||||
//充值支付
|
||||
const payRes= await rechargePayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: '',
|
||||
rechargeId:rechargeId.value,
|
||||
rechargeDetailId:rechargeItem.value.id,
|
||||
shopUserId:orderVIP.value.id,
|
||||
shopId: orderVIP.value.shopId,
|
||||
})
|
||||
pay(payRes)
|
||||
}else{
|
||||
await storeMemberpay.actionsltPayOrder({
|
||||
checkOrderPay,
|
||||
payType: paymentmethod.payType,
|
||||
buyerRemark: '',
|
||||
returnUrl: ''
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
pay_unlock()
|
||||
//TODO handle the exception
|
||||
@@ -787,21 +829,24 @@
|
||||
// 余额支付
|
||||
const accountPayevent = async (pwd) => {
|
||||
ispws.value = false;
|
||||
|
||||
|
||||
let checkOrderPay = {
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
orderId: listinfo.id,
|
||||
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
originAmount: listinfo.originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount: listinfo.Productroll, //商品优惠券抵扣金额
|
||||
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //满减优惠券抵扣金额
|
||||
couponList: uniqueIds.value, //用户使用的卡券
|
||||
orderAmount: listinfo.totalCost, // 最中订单金额
|
||||
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
|
||||
otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
|
||||
couponList: cartStore.backendCoupons.map(v => v.id), //用户使用的卡券
|
||||
orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
|
||||
roundAmount: 0, //抹零金额 减免多少钱
|
||||
pointsDiscountAmount: listinfo.pointsDiscountAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsDiscountAmount: cartStore.orderCostSummary
|
||||
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
|
||||
pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
|
||||
remark: '', //用户备注
|
||||
}
|
||||
@@ -852,8 +897,16 @@
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
orderorderInfo()
|
||||
|
||||
|
||||
orderorderInfo()
|
||||
uni.$off('selCoupon')
|
||||
uni.$on('selCoupon', function(data) {
|
||||
console.log('selCoupon', data)
|
||||
orderInfoAfterRef.value.dataprocessing(_.cloneDeep(data))
|
||||
cartStore.setCoupons(_.cloneDeep(data))
|
||||
})
|
||||
|
||||
});
|
||||
let options = {}
|
||||
|
||||
@@ -904,12 +957,19 @@
|
||||
async function init(opt) {
|
||||
Object.assign(options, opt)
|
||||
listinfo.id = options.orderId;
|
||||
console.log('init', listinfo);
|
||||
console.log('options', options);
|
||||
if (options.shopId) {
|
||||
// 每次进来全局更新shopId
|
||||
uni.cache.set('shopId', options.shopId, 30)
|
||||
uni.$on('returnData', handleReturnData);
|
||||
}
|
||||
//获取店铺信息
|
||||
const shopInfoRes = await APIusershopInfodetail({
|
||||
shopId: options.shopId
|
||||
})
|
||||
if (shopInfoRes) {
|
||||
cartStore.shopInfo = shopInfoRes.shopInfo;
|
||||
}
|
||||
// * 获取会员信息
|
||||
await storeuser.actionsproductqueryProduct()
|
||||
await nextTick()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user