修改确认订单逻辑
This commit is contained in:
11
common/api/market/coupon.js
Normal file
11
common/api/market/coupon.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// 引入 request 文件
|
||||
import request from '@/common/api/request.js'
|
||||
import {prveUrl} from './config.js'
|
||||
|
||||
export const findCoupon = (data) => {
|
||||
return request({
|
||||
url: prveUrl + '/user/coupon/findCoupon',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
11
common/api/market/index.js
Normal file
11
common/api/market/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// 引入 request 文件
|
||||
import request from '@/common/api/request.js'
|
||||
import {prveUrl} from './config.js'
|
||||
|
||||
export const consumeDiscount = (data) => {
|
||||
return request({
|
||||
url: prveUrl + '/user/consumeDiscount',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -85,26 +85,53 @@ export const joinMember = (data) => {
|
||||
}
|
||||
//会员购买支付
|
||||
export const ltPayMember = (data) => {
|
||||
// #ifdef MP-WEIXIN
|
||||
const openId=uni.cache.get('userInfo').wechatOpenId;
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
const openId=uni.cache.get('userInfo').alipayOpenId;
|
||||
// #endif
|
||||
return request({
|
||||
url: url + '/pay/ltPayMember',
|
||||
method: 'post',
|
||||
data: {
|
||||
platformType,
|
||||
payType,
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
openId,
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
//智慧充值
|
||||
export const recharge = (data) => {
|
||||
// #ifdef MP-WEIXIN
|
||||
const openId=uni.cache.get('userInfo').wechatOpenId;
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
const openId=uni.cache.get('userInfo').alipayOpenId;
|
||||
// #endif
|
||||
return request({
|
||||
url: url + '/pay/recharge',
|
||||
method: 'post',
|
||||
data: {
|
||||
platformType,
|
||||
payType,
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
openId,
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const rechargePayOrder = (data) => {
|
||||
return request({
|
||||
url: url + '/pay/rechargePayOrder',
|
||||
method: 'post',
|
||||
data: {
|
||||
platformType,
|
||||
payType,
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
...data
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "^2.0.2-4040520250103001",
|
||||
"bignumber.js": "^9.3.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"lodash": "^4.17.21",
|
||||
"pinia": "^2.3.1",
|
||||
"pinia-plugin-unistorage": "^0.1.2"
|
||||
"pinia-plugin-unistorage": "^0.1.2",
|
||||
"ysk-utils": "^1.0.28"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,16 @@
|
||||
:placeholder="instructions" />
|
||||
</view>
|
||||
<!-- <view class="instructions">{{ instructions }}</view> -->
|
||||
<up-button type="primary" @click="confirmIntegral" text="确定"></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,26 +120,21 @@
|
||||
<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'">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;"
|
||||
@@ -251,6 +216,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
|
||||
:maxValue="calcUsablePointsData.maxIntegral" :instructions="calcUsablePointsData.instructionText"
|
||||
@confirm="handleConfirm" @close="calcUsablePointsData.showModal = false"
|
||||
@@ -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 {
|
||||
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: '', //用户备注
|
||||
}
|
||||
@@ -853,7 +898,15 @@
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
|
||||
@@ -16,14 +16,18 @@
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="status-wrap">
|
||||
<view class="item" :class="{ active: querForm.statusActiveIndex == index }" v-for="(item, index) in statusList" :key="item.value" @click="tabChange(index)">
|
||||
<text class="t">{{ item.label }}(0)</text>
|
||||
<view class="item" :class="{ active: querForm.statusActiveIndex == 0 }" @click="tabChange(0)">
|
||||
<text class="t">商品兑换券 {{returnSelNumber(0)}}</text>
|
||||
</view>
|
||||
<view class="icon-wrap" :style="{ width: `${100 / statusList.length}%`, left: `${(100 / statusList.length) * querForm.statusActiveIndex}%` }">
|
||||
<image
|
||||
class="active-icon"
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAMCAYAAAB4MH11AAACKUlEQVR4AaRTS2sTURT+MpkxUzNtRpuYpBsrqbgQH6BYRHGllloQN+5cuNeV6MKfoj9BwYUgIsXHRqE+SluliFLbBqmENJNMMpMm87qecw1NglJse+HMPeee833nce8oIgpFq7wsGt/fCb9eFrtdfmNd1L+9Jc4Vog6E4jcqqM0/R+3zNOwv09jtshdfSx7mDJwKqAMfIvAAEaFVWkLgWjvOEbVdtNa+Epf4wxmFUNTkfqiDGUkqogDu8icKiKS9nQ9jnR8fqM5AwuJJE/G9JhRF05E8dAqIKeDlrsyiWVxg9f+Fum+uzsFZmtnEGIVxKHsGIFn1bAF6ZlQ6I28D9uIrmYSrkodbfETgw6GubZo9Yzk0kR4Fc7IuE8QUFebJKSTSB/kM4UYd1scnKL18QInm4Vk/6W6qiNoOwpZDuoX2elFWXHrzELW5Z+RzJVbPHca+09doIKq0ZQLW+C44iWbm2ZQSNMqozj5F5f1jWCSVGd4fwerstYUXCOplGcsfxponJqHS7Nlm2UyAWAza0AFkzt1A6uhFqEYaoHsR9BLCpg2vukZVr5IU4dV+yU7oRikkTrHDMI9PIHPhJrhQ9Kxugs6hkkhi8Mh5DI9flyCep6ImOt7uxnF6dgypYxMy1hg7S0/yH3FdSL+mpbIw6CVwVSNX7yM/eQfZS7eQu3wb+St3MTJ1D2nq1iicgZbK9YN7rL866PH1qfGBIWj0v/Do4rrR59vK+A0AAP//GfTndQAAAAZJREFUAwCu+SjIaSGpLwAAAABJRU5ErkJggg=="
|
||||
></image>
|
||||
<view class="item" :class="{ active: querForm.statusActiveIndex == 1 }" @click="tabChange(1)">
|
||||
<text class="t">折扣优惠券{{returnSelNumber(1)}}</text>
|
||||
</view>
|
||||
|
||||
<view class="icon-wrap"
|
||||
:style="{ width: `${100 / statusList.length}%`, left: `${(100 / statusList.length) * querForm.statusActiveIndex}%` }">
|
||||
<image class="active-icon"
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAMCAYAAAB4MH11AAACKUlEQVR4AaRTS2sTURT+MpkxUzNtRpuYpBsrqbgQH6BYRHGllloQN+5cuNeV6MKfoj9BwYUgIsXHRqE+SluliFLbBqmENJNMMpMm87qecw1NglJse+HMPeee833nce8oIgpFq7wsGt/fCb9eFrtdfmNd1L+9Jc4Vog6E4jcqqM0/R+3zNOwv09jtshdfSx7mDJwKqAMfIvAAEaFVWkLgWjvOEbVdtNa+Epf4wxmFUNTkfqiDGUkqogDu8icKiKS9nQ9jnR8fqM5AwuJJE/G9JhRF05E8dAqIKeDlrsyiWVxg9f+Fum+uzsFZmtnEGIVxKHsGIFn1bAF6ZlQ6I28D9uIrmYSrkodbfETgw6GubZo9Yzk0kR4Fc7IuE8QUFebJKSTSB/kM4UYd1scnKL18QInm4Vk/6W6qiNoOwpZDuoX2elFWXHrzELW5Z+RzJVbPHca+09doIKq0ZQLW+C44iWbm2ZQSNMqozj5F5f1jWCSVGd4fwerstYUXCOplGcsfxponJqHS7Nlm2UyAWAza0AFkzt1A6uhFqEYaoHsR9BLCpg2vukZVr5IU4dV+yU7oRikkTrHDMI9PIHPhJrhQ9Kxugs6hkkhi8Mh5DI9flyCep6ImOt7uxnF6dgypYxMy1hg7S0/yH3FdSL+mpbIw6CVwVSNX7yM/eQfZS7eQu3wb+St3MTJ1D2nq1iicgZbK9YN7rL866PH1qfGBIWj0v/Do4rrR59vK+A0AAP//GfTndQAAAAZJREFUAwCu+SjIaSGpLwAAAABJRU5ErkJggg==">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -33,9 +37,9 @@
|
||||
</view>
|
||||
<view class="title-wrap">
|
||||
<text class="t">可用红包</text>
|
||||
<text class="n">3张</text>
|
||||
<text class="n">{{list.canUseCoupons.length}}张</text>
|
||||
</view>
|
||||
<view class="item" v-for="item in list.data" :key="item.id" @click="toUseHandle(item)">
|
||||
<view class="item" v-for="item in list.canUseCoupons" :key="item.id" @click="changeSelCoupon(item)">
|
||||
<view class="top">
|
||||
<view class="icon">
|
||||
<couponIcon :item="item" />
|
||||
@@ -45,18 +49,21 @@
|
||||
<text class="t">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="view time">
|
||||
<text class="t">{{ dayjs(item.effectStartTime).format('YYYY.M.D') }} - {{ dayjs(item.effectEndTime).format('YYYY.M.D') }}</text>
|
||||
<text class="t">{{ dayjs(item.effectStartTime).format('YYYY.M.D') }} -
|
||||
{{ dayjs(item.effectEndTime).format('YYYY.M.D') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<view class="round" v-if="!item.active"></view>
|
||||
<view class="active" v-else>
|
||||
<view class="active" v-if="isActive(item)">
|
||||
<up-icon name="checkmark-circle-fill" size="24" color="#FF3232"></up-icon>
|
||||
</view>
|
||||
<view class="round" v-else></view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="btm">
|
||||
<view class="left">1、可适用门店:{{ item.useShops }} 2、可适用商品:{{ item.foods }}3、可使用类型:{{ convertValuesToLabels(item.useType) }}</view>
|
||||
<view class="left">1、可适用门店:{{ item.useShops }}
|
||||
2、可适用商品:{{ item.foods }}3、可使用类型:{{ convertValuesToLabels(item.useType) }}</view>
|
||||
<view class="right" @click.stop="showDetailHandle(item)">
|
||||
<text class="t">查看详情</text>
|
||||
</view>
|
||||
@@ -64,9 +71,9 @@
|
||||
</view>
|
||||
<view class="title-wrap">
|
||||
<text class="t">不可用红包</text>
|
||||
<text class="n">3张</text>
|
||||
<text class="n">{{list.noCanUseCoupons.length}}张</text>
|
||||
</view>
|
||||
<view class="item disabled" v-for="item in list.data" :key="item.id">
|
||||
<view class="item disabled" v-for="item in list.noCanUseCoupons" :key="item.id">
|
||||
<view class="top">
|
||||
<view class="icon">
|
||||
<couponIcon :item="item" />
|
||||
@@ -76,7 +83,8 @@
|
||||
<text class="t">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="view time">
|
||||
<text class="t">{{ dayjs(item.effectStartTime).format('YYYY.M.D') }} - {{ dayjs(item.effectEndTime).format('YYYY.M.D') }}</text>
|
||||
<text class="t">{{ dayjs(item.effectStartTime).format('YYYY.M.D') }} -
|
||||
{{ dayjs(item.effectEndTime).format('YYYY.M.D') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn">
|
||||
@@ -90,7 +98,7 @@
|
||||
</view> -->
|
||||
<view class="error">
|
||||
<text class="t t1">不可用原因:</text>
|
||||
<text class="t t2">不在使用时间内</text>
|
||||
<text class="t t2">{{returnNoUseRestrictions(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -117,7 +125,9 @@
|
||||
</view>
|
||||
<scroll-view class="popup-list" direction="vertical">
|
||||
<view class="ul">
|
||||
<view class="li" v-for="(item, index) in selectListItemDetails" :key="index">{{ index + 1 }}、{{ item }}</view>
|
||||
<view class="li" v-for="(item, index) in selectListItemDetails" :key="index">
|
||||
{{ index + 1 }}、{{ item }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -126,44 +136,59 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { APIcouponfindByUserId, APIfindCoupon, getCouponShops } from '@/common/api/member.js';
|
||||
import couponIcon from '@/pages/user/components/coupon-icon.vue';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
APIcouponfindByUserId,
|
||||
APIfindCoupon,
|
||||
getCouponShops
|
||||
} from '@/common/api/member.js';
|
||||
import {
|
||||
findCoupon
|
||||
} from '@/common/api/market/coupon.js';
|
||||
import couponIcon from '@/pages/user/components/coupon-icon.vue';
|
||||
import * as UTILS from '@/utils/goods-utils.js'
|
||||
import {
|
||||
useCartsStore
|
||||
} from '@/stores/carts.js';
|
||||
const cartStore = useCartsStore()
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
const querForm = ref({
|
||||
//返回不可用原因
|
||||
function returnNoUseRestrictions(item) {
|
||||
if (item.noUseRestrictions) {
|
||||
return item.noUseRestrictions
|
||||
}
|
||||
if (item.canuseResult) {
|
||||
return item.canuseResult.reason
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
const querForm = ref({
|
||||
searchValue: '',
|
||||
shopId: '',
|
||||
shopName: '',
|
||||
statusActiveIndex: 0
|
||||
});
|
||||
});
|
||||
|
||||
// 状态
|
||||
// const statusList = ref([
|
||||
// {
|
||||
// value: 0,
|
||||
// label: '未使用',
|
||||
// bg: '#333333',
|
||||
// color: '#ffffff'
|
||||
// },
|
||||
// {
|
||||
// value: 1,
|
||||
// label: '已使用',
|
||||
// bg: '#F8F8F8',
|
||||
// color: '#999999'
|
||||
// },
|
||||
// {
|
||||
// value: 2,
|
||||
// label: '已失效',
|
||||
// bg: '#F8F8F8',
|
||||
// color: '#999999'
|
||||
// }
|
||||
// ]);
|
||||
const statusList = ref([
|
||||
{
|
||||
const statusList = ref([{
|
||||
value: 0,
|
||||
label: '商品兑换券',
|
||||
bg: '#333333',
|
||||
@@ -175,25 +200,23 @@ const statusList = ref([
|
||||
bg: '#F8F8F8',
|
||||
color: '#999999'
|
||||
}
|
||||
]);
|
||||
const list = reactive({
|
||||
]);
|
||||
const list = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
status: 'loading',
|
||||
data: []
|
||||
});
|
||||
status: 'nomore',
|
||||
data: [],
|
||||
noCanUseCoupons: [],
|
||||
canUseCoupons: []
|
||||
});
|
||||
|
||||
// onReachBottom(() => {
|
||||
// if (list.status != 'nomore') {
|
||||
// list.page++;
|
||||
// getCouponList();
|
||||
// }
|
||||
// });
|
||||
|
||||
const showDetail = ref(false);
|
||||
const selectListItem = ref('');
|
||||
const selectListItemDetails = ref([]);
|
||||
function showDetailHandle(item) {
|
||||
|
||||
const showDetail = ref(false);
|
||||
const selectListItem = ref('');
|
||||
const selectListItemDetails = ref([]);
|
||||
|
||||
function showDetailHandle(item) {
|
||||
showDetail.value = true;
|
||||
selectListItemDetails.value = [
|
||||
`可适用门店:${item.useShops}`,
|
||||
@@ -212,85 +235,204 @@ function showDetailHandle(item) {
|
||||
if (item.type == 3) {
|
||||
selectListItemDetails.value.unshift(`最高抵扣${item.maxDiscountAmount}元`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function searchHandle() {
|
||||
function returnSelNumber(index) {
|
||||
if (index) {
|
||||
if (couponSel.value.id) {
|
||||
return '(1)'
|
||||
} else {
|
||||
return '(0)'
|
||||
}
|
||||
} else {
|
||||
if (goodsCouponSel.value.id) {
|
||||
return '(1)'
|
||||
} else {
|
||||
return '(0)'
|
||||
}
|
||||
}
|
||||
}
|
||||
// 搜索
|
||||
function searchHandle() {
|
||||
list.page = 1;
|
||||
list.status = 'loading';
|
||||
list.status = 'nomore';
|
||||
getCouponList();
|
||||
}
|
||||
}
|
||||
|
||||
// 切换类型
|
||||
function tabChange(index) {
|
||||
// 切换类型
|
||||
function tabChange(index) {
|
||||
querForm.value.statusActiveIndex = index;
|
||||
list.page = 1;
|
||||
list.status = 'loading';
|
||||
list.status = 'nomore';
|
||||
getCouponList();
|
||||
}
|
||||
}
|
||||
|
||||
// 去使用
|
||||
function toUseHandle(item) {
|
||||
console.log(item);
|
||||
item.active = !item.active;
|
||||
// uni.cache.set('shopId', item.shopId);
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// });
|
||||
}
|
||||
function changeSelCoupon(item) {
|
||||
if (querForm.value.statusActiveIndex) {
|
||||
if (couponSel.value.id == item.id) {
|
||||
couponSel.value = {
|
||||
id: ''
|
||||
}
|
||||
} else {
|
||||
couponSel.value = item
|
||||
}
|
||||
} else {
|
||||
if (goodsCouponSel.value.id == item.id) {
|
||||
goodsCouponSel.value = {
|
||||
id: ''
|
||||
}
|
||||
} else {
|
||||
goodsCouponSel.value = item
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取优惠券列表
|
||||
async function getCouponList() {
|
||||
const couponSel = ref({
|
||||
id: ''
|
||||
})
|
||||
const goodsCouponSel = ref({
|
||||
id: ''
|
||||
})
|
||||
const quansSelArr = computed(() => {
|
||||
return [couponSel.value, goodsCouponSel.value].filter((v) => v.id);
|
||||
})
|
||||
|
||||
function isActive(item) {
|
||||
if (querForm.value.statusActiveIndex) {
|
||||
return couponSel.value.id == item.id
|
||||
} else {
|
||||
return goodsCouponSel.value.id == item.id
|
||||
}
|
||||
}
|
||||
|
||||
// 获取优惠券列表
|
||||
async function getCouponList() {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
});
|
||||
const res = await APIcouponfindByUserId({
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
name: querForm.value.searchValue,
|
||||
status: '',
|
||||
shopId: querForm.value.shopId ? querForm.value.shopId : uni.cache.get('shopId'),
|
||||
// page: list.page,
|
||||
// size: list.size,
|
||||
page: 1,
|
||||
size: 500
|
||||
});
|
||||
res.records.map((item) => {
|
||||
item.active = false;
|
||||
const res = await findCoupon({
|
||||
shopUserId: uni.cache.get('shopUserInfo').id,
|
||||
});
|
||||
|
||||
if (list.page == 1) {
|
||||
list.data = res.records;
|
||||
|
||||
let canUseGoodsCoupon = []
|
||||
let canUseDiscountCoupon = []
|
||||
|
||||
let noUseGoodsCoupon = []
|
||||
let noUseDiscountCoupon = []
|
||||
const user = uni.cache.get('shopUserInfo')
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
const goodsOrderPrice = uni.getStorageSync('goodsOrderPrice') || 0
|
||||
const goodsList = uni.getStorageSync('canDikouGoodsArr') || []
|
||||
const dinnerType = uni.getStorageSync('dinnerType')
|
||||
const canDikouGoodsArr = UTILS.returnCanDikouGoods(cartStore.allGoods, [], user);
|
||||
const shopId = uni.cache.get('shopId')
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const coupon = res[i]
|
||||
const canuseResult = UTILS.returnCouponCanUse({
|
||||
canDikouGoodsArr,
|
||||
coupon,
|
||||
goodsOrderPrice,
|
||||
user,
|
||||
selCoupon: [],
|
||||
shopInfo
|
||||
})
|
||||
const {
|
||||
canUse,
|
||||
reason
|
||||
} = canuseResult
|
||||
if (coupon.type == 2) {
|
||||
if (canUse) {
|
||||
canUseGoodsCoupon.push(coupon)
|
||||
} else {
|
||||
list.data.push(...res.records);
|
||||
noUseGoodsCoupon.push({
|
||||
...coupon,
|
||||
canuseResult
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (canUse) {
|
||||
canUseDiscountCoupon.push(coupon)
|
||||
} else {
|
||||
noUseDiscountCoupon.push({
|
||||
...coupon,
|
||||
canuseResult
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
//商品券
|
||||
canUseGoodsCoupon = canUseGoodsCoupon.map(v => {
|
||||
const discount = UTILS.returnCouponDiscount(
|
||||
canDikouGoodsArr,
|
||||
v,
|
||||
user,
|
||||
goodsOrderPrice,
|
||||
[],
|
||||
shopInfo
|
||||
);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
discountAmount: discount ? discount.discountPrice : v.discountAmount,
|
||||
};
|
||||
})
|
||||
//非商品券
|
||||
canUseDiscountCoupon = canUseDiscountCoupon.map(v => {
|
||||
const discount = UTILS.returnCouponDiscount(
|
||||
canDikouGoodsArr,
|
||||
v,
|
||||
user,
|
||||
goodsOrderPrice,
|
||||
quansSelArr.value,
|
||||
shopInfo
|
||||
|
||||
);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
discountAmount: discount ? discount.discountPrice : v.discountAmount,
|
||||
}
|
||||
})
|
||||
|
||||
if (querForm.value.statusActiveIndex == 0) {
|
||||
list.noCanUseCoupons = noUseGoodsCoupon
|
||||
list.canUseCoupons = canUseGoodsCoupon
|
||||
} else {
|
||||
list.noCanUseCoupons = noUseDiscountCoupon
|
||||
list.canUseCoupons = canUseDiscountCoupon
|
||||
}
|
||||
|
||||
if (res.pageNumber == res.totalPage || res.records.length == 0) {
|
||||
list.status = 'nomore';
|
||||
}
|
||||
console.log('canUseGoodsCoupon', canUseGoodsCoupon);
|
||||
console.log('noUseGoodsCoupon', noUseGoodsCoupon);
|
||||
console.log('canUseDiscountCoupon', canUseDiscountCoupon);
|
||||
console.log('noUseDiscountCoupon', noUseDiscountCoupon);
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
// 店铺列表滚动到底部了
|
||||
function scrollBottom() {
|
||||
// 店铺列表滚动到底部了
|
||||
function scrollBottom() {
|
||||
console.log('店铺列表滚动到底部了');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 将value数组字符串转换为对应的label拼接字符串
|
||||
* @param {Array} options - 包含value和label的选项数组,格式如[{value: 'xxx', label: 'xxx'}, ...]
|
||||
* @param {string} valueStr - 包含value的数组字符串,格式如'["dine","pickup"]'
|
||||
* @param {string} separator - 标签拼接分隔符,默认值为'、'
|
||||
* @returns {string} 拼接后的label字符串,如"堂食、自取"
|
||||
*/
|
||||
function convertValuesToLabels(valueStr, options, separator = '、') {
|
||||
function convertValuesToLabels(valueStr, options, separator = '、') {
|
||||
try {
|
||||
options = [
|
||||
{
|
||||
options = [{
|
||||
value: 'dine',
|
||||
label: '堂食'
|
||||
},
|
||||
@@ -338,46 +480,53 @@ function convertValuesToLabels(valueStr, options, separator = '、') {
|
||||
console.error('转换失败:', error.message);
|
||||
return ''; // 出错时返回空字符串
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 选择店铺
|
||||
function selectShopHandle(item) {
|
||||
// 选择店铺
|
||||
function selectShopHandle(item) {
|
||||
querForm.value.shopId = item.shopId;
|
||||
querForm.value.shopName = item.shopName;
|
||||
list.page = 1;
|
||||
show.value = false;
|
||||
getCouponList();
|
||||
}
|
||||
// 获取当前店铺会员信息
|
||||
const shopList = ref([]);
|
||||
async function getCouponShopsAjax() {
|
||||
}
|
||||
// 获取当前店铺会员信息
|
||||
const shopList = ref([]);
|
||||
async function getCouponShopsAjax() {
|
||||
try {
|
||||
const res = await getCouponShops();
|
||||
shopList.value = res;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
onShow(() => {
|
||||
getCouponList();
|
||||
});
|
||||
});
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
getCouponShopsAjax();
|
||||
});
|
||||
});
|
||||
|
||||
watch(() => quansSelArr.value, (newval) => {
|
||||
uni.$emit('selCoupon', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
page {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
.container {
|
||||
padding: 136upx 28upx 28upx;
|
||||
}
|
||||
.header-wrap {
|
||||
}
|
||||
|
||||
.header-wrap {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
@@ -385,45 +534,56 @@ page {
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
padding: 28upx;
|
||||
|
||||
.search-wrap {
|
||||
display: flex;
|
||||
gap: 28upx;
|
||||
|
||||
.input-wrap {
|
||||
flex: 1;
|
||||
height: 70upx;
|
||||
border: 1px solid #ececec;
|
||||
border-radius: 8upx;
|
||||
position: relative;
|
||||
|
||||
&:first-child {
|
||||
flex: 1.5;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
|
||||
&.left {
|
||||
left: 14upx;
|
||||
}
|
||||
|
||||
&.right {
|
||||
right: 14upx;
|
||||
}
|
||||
}
|
||||
|
||||
.ipt {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
&.left {
|
||||
padding-left: 68upx;
|
||||
}
|
||||
|
||||
&.right {
|
||||
padding: 0 56upx 0 28upx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status-wrap {
|
||||
display: flex;
|
||||
// padding-top: 28upx;
|
||||
position: relative;
|
||||
|
||||
.icon-wrap {
|
||||
height: 12upx;
|
||||
position: absolute;
|
||||
@@ -434,23 +594,27 @@ page {
|
||||
justify-content: center;
|
||||
transition: all 0.3s ease-in-out;
|
||||
padding-right: 28upx;
|
||||
|
||||
.active-icon {
|
||||
width: 24upx;
|
||||
height: 12upx;
|
||||
z-index: 9;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
height: 80upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.t {
|
||||
font-size: 32upx;
|
||||
color: #666666;
|
||||
transition: all 0.3s ease-in-out 0.1s;
|
||||
}
|
||||
|
||||
&.active {
|
||||
.t {
|
||||
color: #e3ad7f;
|
||||
@@ -458,39 +622,48 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-wrap {
|
||||
}
|
||||
|
||||
.list-wrap {
|
||||
padding-top: 28upx;
|
||||
|
||||
.tips {
|
||||
.t {
|
||||
color: #666;
|
||||
font-size: 24upx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10upx;
|
||||
padding-top: 28upx;
|
||||
|
||||
.t {
|
||||
font-size: 32upx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.n {
|
||||
color: #666;
|
||||
font-size: 24upx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
border-radius: 18upx;
|
||||
background-color: #fff;
|
||||
padding: 28upx;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 28upx;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
.top {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 100%;
|
||||
@@ -501,6 +674,7 @@ page {
|
||||
z-index: 10;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.btn {
|
||||
.round {
|
||||
background-color: #f0f0f0;
|
||||
@@ -508,16 +682,19 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 28upx;
|
||||
|
||||
.icon {
|
||||
$size: 140upx;
|
||||
width: $size;
|
||||
height: $size;
|
||||
margin-right: 28upx;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -526,6 +703,7 @@ page {
|
||||
gap: 8upx;
|
||||
padding: 0 28upx;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
$height: 100upx;
|
||||
content: '';
|
||||
@@ -536,12 +714,15 @@ page {
|
||||
margin-top: $height * 0.5 * -1;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.view {
|
||||
flex: 1;
|
||||
|
||||
&.name {
|
||||
font-size: 32upx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
&.time {
|
||||
.t {
|
||||
font-size: 24upx;
|
||||
@@ -550,12 +731,14 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 40upx;
|
||||
height: 40upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.round {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -565,11 +748,13 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btm {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 28upx 0 14upx;
|
||||
border-top: 1upx solid #f7f7f7;
|
||||
|
||||
.left {
|
||||
flex: 1;
|
||||
height: 40upx;
|
||||
@@ -579,25 +764,30 @@ page {
|
||||
font-size: 24upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 28upx;
|
||||
justify-content: flex-end;
|
||||
|
||||
.t {
|
||||
font-size: 24upx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.error {
|
||||
flex: 1;
|
||||
|
||||
.t {
|
||||
font-size: 24upx;
|
||||
|
||||
&.t1 {
|
||||
color: #ff1c1c;
|
||||
}
|
||||
|
||||
&.t2 {
|
||||
color: #333;
|
||||
}
|
||||
@@ -605,22 +795,27 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.shoplist-popup {
|
||||
}
|
||||
|
||||
.shoplist-popup {
|
||||
padding: 0 28upx 28upx;
|
||||
|
||||
.title {
|
||||
padding: 28upx 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.t {
|
||||
font-size: 32upx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-list {
|
||||
max-height: 50vh;
|
||||
|
||||
.item {
|
||||
padding: 28upx;
|
||||
border-radius: 12upx;
|
||||
@@ -629,17 +824,20 @@ page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 28upx;
|
||||
|
||||
.t {
|
||||
font-size: 28upx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
/* 必须设置宽度 */
|
||||
width: 600upx; /* 或具体像素值 */
|
||||
width: 600upx;
|
||||
/* 或具体像素值 */
|
||||
|
||||
/* 关键属性 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1; /* 显示2行 */
|
||||
-webkit-line-clamp: 1;
|
||||
/* 显示2行 */
|
||||
overflow: hidden;
|
||||
|
||||
/* 文本溢出省略号 */
|
||||
@@ -647,19 +845,24 @@ page {
|
||||
|
||||
/* 可选:防止行高度,确保计算准确 */
|
||||
line-height: 1.5;
|
||||
word-break: break-all; /* 允许在单词内换行 */
|
||||
word-wrap: break-word; /* 允许长单词或URL换行 */
|
||||
word-break: break-all;
|
||||
/* 允许在单词内换行 */
|
||||
word-wrap: break-word;
|
||||
/* 允许长单词或URL换行 */
|
||||
}
|
||||
|
||||
.intro {
|
||||
font-size: 28upx;
|
||||
color: #999;
|
||||
/* 必须设置宽度 */
|
||||
width: 600upx; /* 或具体像素值 */
|
||||
width: 600upx;
|
||||
/* 或具体像素值 */
|
||||
|
||||
/* 关键属性 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2; /* 显示2行 */
|
||||
-webkit-line-clamp: 2;
|
||||
/* 显示2行 */
|
||||
overflow: hidden;
|
||||
|
||||
/* 文本溢出省略号 */
|
||||
@@ -667,15 +870,19 @@ page {
|
||||
|
||||
/* 可选:防止行高度,确保计算准确 */
|
||||
line-height: 1.5;
|
||||
word-break: break-all; /* 允许在单词内换行 */
|
||||
word-wrap: break-word; /* 允许长单词或URL换行 */
|
||||
word-break: break-all;
|
||||
/* 允许在单词内换行 */
|
||||
word-wrap: break-word;
|
||||
/* 允许长单词或URL换行 */
|
||||
}
|
||||
}
|
||||
|
||||
.ul {
|
||||
.li {
|
||||
color: #999;
|
||||
font-size: 28upx;
|
||||
padding: 8upx 0;
|
||||
|
||||
.t {
|
||||
color: #999;
|
||||
font-size: 28upx;
|
||||
@@ -683,5 +890,5 @@ page {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -36,7 +36,7 @@
|
||||
<text class="color-333 font-14 u-m-l-20">储值</text>
|
||||
</view>
|
||||
<view class="u-flex color-666" @click="toChargeList">
|
||||
<text class="font-12 u-m-r-4">{{rechargeList.length}}家店</text>
|
||||
<text class="font-12 u-m-r-4">{{rechargeTotal}}家店</text>
|
||||
<up-icon name="arrow-down" color="#666" size="12px"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -68,7 +68,7 @@
|
||||
<text class="color-333 font-14 u-m-l-20">会员</text>
|
||||
</view>
|
||||
<view class="u-flex color-666" @click="tomemberList">
|
||||
<text class="font-12 u-m-r-4">{{memberList.length}}家店</text>
|
||||
<text class="font-12 u-m-r-4">{{memberTotal}}家店</text>
|
||||
<up-icon name="arrow-down" color="#666" size="12px"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -300,10 +300,14 @@
|
||||
|
||||
const memberList = ref([])
|
||||
const rechargeList = ref([])
|
||||
const memberTotal=ref(0)
|
||||
const rechargeTotal=ref(0)
|
||||
async function getData() {
|
||||
const res = await vipApi.list()
|
||||
memberTotal.value=res.length
|
||||
memberList.value = res.slice(0, 3);
|
||||
const res1 = await rechargeApi.list()
|
||||
rechargeTotal.value=res1.length
|
||||
rechargeList.value = res1.slice(0, 3);
|
||||
}
|
||||
onShow(() => {
|
||||
|
||||
830
pnpm-lock.yaml
generated
830
pnpm-lock.yaml
generated
@@ -4,10 +4,16 @@ settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@dcloudio/uni-app':
|
||||
specifier: ^2.0.2-4040520250103001
|
||||
version: 2.0.2-4070620250821001(@dcloudio/types@3.4.21)(@vue/composition-api@1.7.2)
|
||||
version: 2.0.2-4070620250821001(@dcloudio/types@3.4.21)(@vue/composition-api@1.7.2(vue@3.5.22))
|
||||
bignumber.js:
|
||||
specifier: ^9.3.1
|
||||
version: 9.3.1
|
||||
dayjs:
|
||||
specifier: ^1.11.13
|
||||
version: 1.11.18
|
||||
@@ -19,10 +25,13 @@ dependencies:
|
||||
version: 4.17.21
|
||||
pinia:
|
||||
specifier: ^2.3.1
|
||||
version: 2.3.1(@vue/composition-api@1.7.2)(vue@3.5.21)
|
||||
version: 2.3.1(@vue/composition-api@1.7.2(vue@3.5.22))(vue@3.5.22)
|
||||
pinia-plugin-unistorage:
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2
|
||||
ysk-utils:
|
||||
specifier: ^1.0.28
|
||||
version: 1.0.28
|
||||
|
||||
packages:
|
||||
|
||||
@@ -52,53 +61,9 @@ packages:
|
||||
'@dcloudio/types': ^3.0.15
|
||||
'@vue/composition-api': ^1.7.0
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2':
|
||||
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
'@jridgewell/source-map@0.3.11':
|
||||
resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5':
|
||||
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
'@nodelib/fs.stat@2.0.5':
|
||||
resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
'@nodelib/fs.walk@1.2.8':
|
||||
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
'@sindresorhus/merge-streams@2.3.0':
|
||||
resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@types/eslint-scope@3.7.7':
|
||||
resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==}
|
||||
|
||||
'@types/eslint@9.6.1':
|
||||
resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==}
|
||||
|
||||
'@types/estree@1.0.8':
|
||||
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
|
||||
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/node@24.5.2':
|
||||
resolution: {integrity: sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==}
|
||||
|
||||
'@vue/compiler-core@3.5.22':
|
||||
resolution: {integrity: sha512-jQ0pFPmZwTEiRNSb+i9Ow/I/cHv2tXYqsnHKKyCQ08irI2kdF5qmYedmF8si8mA7zepUFmJ2hqzS8CQmNOWOkQ==}
|
||||
|
||||
@@ -136,115 +101,8 @@ packages:
|
||||
'@vue/shared@3.5.22':
|
||||
resolution: {integrity: sha512-F4yc6palwq3TT0u+FYf0Ns4Tfl9GRFURDN2gWG7L1ecIaS/4fCIuFOjMTnCyjsu/OK6vaDKLCrGAa+KvvH+h4w==}
|
||||
|
||||
'@webassemblyjs/ast@1.14.1':
|
||||
resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==}
|
||||
|
||||
'@webassemblyjs/floating-point-hex-parser@1.13.2':
|
||||
resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==}
|
||||
|
||||
'@webassemblyjs/helper-api-error@1.13.2':
|
||||
resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==}
|
||||
|
||||
'@webassemblyjs/helper-buffer@1.14.1':
|
||||
resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==}
|
||||
|
||||
'@webassemblyjs/helper-numbers@1.13.2':
|
||||
resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==}
|
||||
|
||||
'@webassemblyjs/helper-wasm-bytecode@1.13.2':
|
||||
resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==}
|
||||
|
||||
'@webassemblyjs/helper-wasm-section@1.14.1':
|
||||
resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==}
|
||||
|
||||
'@webassemblyjs/ieee754@1.13.2':
|
||||
resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==}
|
||||
|
||||
'@webassemblyjs/leb128@1.13.2':
|
||||
resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==}
|
||||
|
||||
'@webassemblyjs/utf8@1.13.2':
|
||||
resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==}
|
||||
|
||||
'@webassemblyjs/wasm-edit@1.14.1':
|
||||
resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==}
|
||||
|
||||
'@webassemblyjs/wasm-gen@1.14.1':
|
||||
resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==}
|
||||
|
||||
'@webassemblyjs/wasm-opt@1.14.1':
|
||||
resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==}
|
||||
|
||||
'@webassemblyjs/wasm-parser@1.14.1':
|
||||
resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==}
|
||||
|
||||
'@webassemblyjs/wast-printer@1.14.1':
|
||||
resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==}
|
||||
|
||||
'@xtuc/ieee754@1.2.0':
|
||||
resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==}
|
||||
|
||||
'@xtuc/long@4.2.2':
|
||||
resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==}
|
||||
|
||||
acorn-import-phases@1.0.4:
|
||||
resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
peerDependencies:
|
||||
acorn: ^8.14.0
|
||||
|
||||
acorn@8.15.0:
|
||||
resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
ajv-formats@2.1.1:
|
||||
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
|
||||
peerDependencies:
|
||||
ajv: ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
ajv:
|
||||
optional: true
|
||||
|
||||
ajv-keywords@5.1.0:
|
||||
resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==}
|
||||
peerDependencies:
|
||||
ajv: ^8.8.2
|
||||
|
||||
ajv@8.17.1:
|
||||
resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
|
||||
|
||||
baseline-browser-mapping@2.8.6:
|
||||
resolution: {integrity: sha512-wrH5NNqren/QMtKUEEJf7z86YjfqW/2uw3IL3/xpqZUC95SSVIFXYQeeGjL6FT/X68IROu6RMehZQS5foy2BXw==}
|
||||
hasBin: true
|
||||
|
||||
braces@3.0.3:
|
||||
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
browserslist@4.26.2:
|
||||
resolution: {integrity: sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
|
||||
buffer-from@1.1.2:
|
||||
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
||||
|
||||
caniuse-lite@1.0.30001745:
|
||||
resolution: {integrity: sha512-ywt6i8FzvdgrrrGbr1jZVObnVv6adj+0if2/omv9cmR2oiZs30zL4DIyaptKcbOrBdOIc74QTMoJvSE2QHh5UQ==}
|
||||
|
||||
chrome-trace-event@1.0.4:
|
||||
resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
||||
commander@2.20.3:
|
||||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
||||
|
||||
copy-webpack-plugin@12.0.2:
|
||||
resolution: {integrity: sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==}
|
||||
engines: {node: '>= 18.12.0'}
|
||||
peerDependencies:
|
||||
webpack: ^5.1.0
|
||||
bignumber.js@9.3.1:
|
||||
resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==}
|
||||
|
||||
csstype@3.1.3:
|
||||
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
|
||||
@@ -252,175 +110,30 @@ packages:
|
||||
dayjs@1.11.18:
|
||||
resolution: {integrity: sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==}
|
||||
|
||||
electron-to-chromium@1.5.223:
|
||||
resolution: {integrity: sha512-qKm55ic6nbEmagFlTFczML33rF90aU+WtrJ9MdTCThrcvDNdUHN4p6QfVN78U06ZmguqXIyMPyYhw2TrbDUwPQ==}
|
||||
|
||||
enhanced-resolve@5.18.3:
|
||||
resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
entities@4.5.0:
|
||||
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
||||
engines: {node: '>=0.12'}
|
||||
|
||||
es-module-lexer@1.7.0:
|
||||
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
|
||||
|
||||
escalade@3.2.0:
|
||||
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
eslint-scope@5.1.1:
|
||||
resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
|
||||
esrecurse@4.3.0:
|
||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
estraverse@4.3.0:
|
||||
resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
estraverse@5.3.0:
|
||||
resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
estree-walker@2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
events@3.3.0:
|
||||
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
||||
engines: {node: '>=0.8.x'}
|
||||
|
||||
fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
|
||||
fast-glob@3.3.3:
|
||||
resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==}
|
||||
engines: {node: '>=8.6.0'}
|
||||
|
||||
fast-uri@3.1.0:
|
||||
resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==}
|
||||
|
||||
fastq@1.19.1:
|
||||
resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==}
|
||||
|
||||
fill-range@7.1.1:
|
||||
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
glob-parent@6.0.2:
|
||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
glob-to-regexp@0.4.1:
|
||||
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
|
||||
|
||||
globby@14.1.0:
|
||||
resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
graceful-fs@4.2.11:
|
||||
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
||||
|
||||
has-flag@4.0.0:
|
||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
ignore@7.0.5:
|
||||
resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==}
|
||||
engines: {node: '>= 4'}
|
||||
|
||||
is-extglob@2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-glob@4.0.3:
|
||||
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-number@7.0.0:
|
||||
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
|
||||
jest-worker@27.5.1:
|
||||
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
|
||||
jsbarcode@3.12.1:
|
||||
resolution: {integrity: sha512-QZQSqIknC2Rr/YOUyOkCBqsoiBAOTYK+7yNN3JsqfoUtJtkazxNw1dmPpxuv7VVvqW13kA3/mKiLq+s/e3o9hQ==}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/lodash@4.17.21:
|
||||
lodash@4.17.21:
|
||||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
||||
dev: false
|
||||
|
||||
/magic-string@0.30.19:
|
||||
=======
|
||||
json-parse-even-better-errors@2.3.1:
|
||||
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
|
||||
|
||||
json-schema-traverse@1.0.0:
|
||||
resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
|
||||
|
||||
loader-runner@4.3.0:
|
||||
resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==}
|
||||
engines: {node: '>=6.11.5'}
|
||||
|
||||
magic-string@0.30.19:
|
||||
>>>>>>> a39c9f4d7228eb5bd0bda613fd326824fc7777ee
|
||||
resolution: {integrity: sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==}
|
||||
|
||||
merge-stream@2.0.0:
|
||||
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
|
||||
|
||||
merge2@1.4.1:
|
||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
micromatch@4.0.8:
|
||||
resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
||||
mime-db@1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
nanoid@3.3.11:
|
||||
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
neo-async@2.6.2:
|
||||
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
|
||||
|
||||
node-releases@2.0.21:
|
||||
resolution: {integrity: sha512-5b0pgg78U3hwXkCM8Z9b2FJdPZlr9Psr9V2gQPESdGHqbntyFJKFW4r5TeWGFzafGY3hzs1JC62VEQMbl1JFkw==}
|
||||
|
||||
normalize-path@3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
path-type@6.0.0:
|
||||
resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
picocolors@1.1.1:
|
||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||
|
||||
picomatch@2.3.1:
|
||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
||||
pinia-plugin-unistorage@0.1.2:
|
||||
resolution: {integrity: sha512-WXit2cGnm5rG6CDTcLSLehNWhyJS/Yq7WEeeXAapZbCnqoPJxlszqg7rT8S+OP47az0h5nlajGo+LuyMxUQ2uw==}
|
||||
|
||||
@@ -437,94 +150,10 @@ packages:
|
||||
resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
|
||||
queue-microtask@1.2.3:
|
||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
||||
|
||||
randombytes@2.1.0:
|
||||
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
|
||||
|
||||
require-from-string@2.0.2:
|
||||
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
reusify@1.1.0:
|
||||
resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}
|
||||
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
||||
|
||||
run-parallel@1.2.0:
|
||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||
|
||||
safe-buffer@5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
|
||||
schema-utils@4.3.2:
|
||||
resolution: {integrity: sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
|
||||
serialize-javascript@6.0.2:
|
||||
resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
|
||||
|
||||
slash@5.1.0:
|
||||
resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==}
|
||||
engines: {node: '>=14.16'}
|
||||
|
||||
source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
source-map-support@0.5.21:
|
||||
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
|
||||
|
||||
source-map@0.6.1:
|
||||
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
supports-color@8.1.1:
|
||||
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
tapable@2.2.3:
|
||||
resolution: {integrity: sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
terser-webpack-plugin@5.3.14:
|
||||
resolution: {integrity: sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
'@swc/core': '*'
|
||||
esbuild: '*'
|
||||
uglify-js: '*'
|
||||
webpack: ^5.1.0
|
||||
peerDependenciesMeta:
|
||||
'@swc/core':
|
||||
optional: true
|
||||
esbuild:
|
||||
optional: true
|
||||
uglify-js:
|
||||
optional: true
|
||||
|
||||
terser@5.44.0:
|
||||
resolution: {integrity: sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
to-regex-range@5.0.1:
|
||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||
engines: {node: '>=8.0'}
|
||||
|
||||
undici-types@7.12.0:
|
||||
resolution: {integrity: sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==}
|
||||
|
||||
unicorn-magic@0.3.0:
|
||||
resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
update-browserslist-db@1.1.3:
|
||||
resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
browserslist: '>= 4.21.0'
|
||||
|
||||
vue-demi@0.14.10:
|
||||
resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -544,23 +173,8 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
watchpack@2.4.4:
|
||||
resolution: {integrity: sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
webpack-sources@3.3.3:
|
||||
resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
webpack@5.101.3:
|
||||
resolution: {integrity: sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
webpack-cli: '*'
|
||||
peerDependenciesMeta:
|
||||
webpack-cli:
|
||||
optional: true
|
||||
ysk-utils@1.0.28:
|
||||
resolution: {integrity: sha512-VpEYjK5ldWgZXY+rxcwef8DB9/K9K13BPZEL3l3NXybofLsh1089sMJF4B4rVpqYszcTF13ZLL6WJWCkhCPOkg==}
|
||||
|
||||
snapshots:
|
||||
|
||||
@@ -584,57 +198,8 @@ snapshots:
|
||||
'@dcloudio/types': 3.4.21
|
||||
'@vue/composition-api': 1.7.2(vue@3.5.22)
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2': {}
|
||||
|
||||
'@jridgewell/source-map@0.3.11':
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.13
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5': {}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
run-parallel: 1.2.0
|
||||
|
||||
'@nodelib/fs.stat@2.0.5': {}
|
||||
|
||||
'@nodelib/fs.walk@1.2.8':
|
||||
dependencies:
|
||||
'@nodelib/fs.scandir': 2.1.5
|
||||
fastq: 1.19.1
|
||||
|
||||
'@sindresorhus/merge-streams@2.3.0': {}
|
||||
|
||||
'@types/eslint-scope@3.7.7':
|
||||
dependencies:
|
||||
'@types/eslint': 9.6.1
|
||||
'@types/estree': 1.0.8
|
||||
|
||||
'@types/eslint@9.6.1':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.8
|
||||
'@types/json-schema': 7.0.15
|
||||
|
||||
'@types/estree@1.0.8': {}
|
||||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/node@24.5.2':
|
||||
dependencies:
|
||||
undici-types: 7.12.0
|
||||
|
||||
'@vue/compiler-core@3.5.22':
|
||||
dependencies:
|
||||
'@babel/parser': 7.28.4
|
||||
@@ -695,274 +260,28 @@ snapshots:
|
||||
|
||||
'@vue/shared@3.5.22': {}
|
||||
|
||||
'@webassemblyjs/ast@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/helper-numbers': 1.13.2
|
||||
'@webassemblyjs/helper-wasm-bytecode': 1.13.2
|
||||
|
||||
'@webassemblyjs/floating-point-hex-parser@1.13.2': {}
|
||||
|
||||
'@webassemblyjs/helper-api-error@1.13.2': {}
|
||||
|
||||
'@webassemblyjs/helper-buffer@1.14.1': {}
|
||||
|
||||
'@webassemblyjs/helper-numbers@1.13.2':
|
||||
dependencies:
|
||||
'@webassemblyjs/floating-point-hex-parser': 1.13.2
|
||||
'@webassemblyjs/helper-api-error': 1.13.2
|
||||
'@xtuc/long': 4.2.2
|
||||
|
||||
'@webassemblyjs/helper-wasm-bytecode@1.13.2': {}
|
||||
|
||||
'@webassemblyjs/helper-wasm-section@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/helper-buffer': 1.14.1
|
||||
'@webassemblyjs/helper-wasm-bytecode': 1.13.2
|
||||
'@webassemblyjs/wasm-gen': 1.14.1
|
||||
|
||||
'@webassemblyjs/ieee754@1.13.2':
|
||||
dependencies:
|
||||
'@xtuc/ieee754': 1.2.0
|
||||
|
||||
'@webassemblyjs/leb128@1.13.2':
|
||||
dependencies:
|
||||
'@xtuc/long': 4.2.2
|
||||
|
||||
'@webassemblyjs/utf8@1.13.2': {}
|
||||
|
||||
'@webassemblyjs/wasm-edit@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/helper-buffer': 1.14.1
|
||||
'@webassemblyjs/helper-wasm-bytecode': 1.13.2
|
||||
'@webassemblyjs/helper-wasm-section': 1.14.1
|
||||
'@webassemblyjs/wasm-gen': 1.14.1
|
||||
'@webassemblyjs/wasm-opt': 1.14.1
|
||||
'@webassemblyjs/wasm-parser': 1.14.1
|
||||
'@webassemblyjs/wast-printer': 1.14.1
|
||||
|
||||
'@webassemblyjs/wasm-gen@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/helper-wasm-bytecode': 1.13.2
|
||||
'@webassemblyjs/ieee754': 1.13.2
|
||||
'@webassemblyjs/leb128': 1.13.2
|
||||
'@webassemblyjs/utf8': 1.13.2
|
||||
|
||||
'@webassemblyjs/wasm-opt@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/helper-buffer': 1.14.1
|
||||
'@webassemblyjs/wasm-gen': 1.14.1
|
||||
'@webassemblyjs/wasm-parser': 1.14.1
|
||||
|
||||
'@webassemblyjs/wasm-parser@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/helper-api-error': 1.13.2
|
||||
'@webassemblyjs/helper-wasm-bytecode': 1.13.2
|
||||
'@webassemblyjs/ieee754': 1.13.2
|
||||
'@webassemblyjs/leb128': 1.13.2
|
||||
'@webassemblyjs/utf8': 1.13.2
|
||||
|
||||
'@webassemblyjs/wast-printer@1.14.1':
|
||||
dependencies:
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@xtuc/long': 4.2.2
|
||||
|
||||
'@xtuc/ieee754@1.2.0': {}
|
||||
|
||||
'@xtuc/long@4.2.2': {}
|
||||
|
||||
acorn-import-phases@1.0.4(acorn@8.15.0):
|
||||
dependencies:
|
||||
acorn: 8.15.0
|
||||
|
||||
acorn@8.15.0: {}
|
||||
|
||||
ajv-formats@2.1.1(ajv@8.17.1):
|
||||
optionalDependencies:
|
||||
ajv: 8.17.1
|
||||
|
||||
ajv-keywords@5.1.0(ajv@8.17.1):
|
||||
dependencies:
|
||||
ajv: 8.17.1
|
||||
fast-deep-equal: 3.1.3
|
||||
|
||||
ajv@8.17.1:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
fast-uri: 3.1.0
|
||||
json-schema-traverse: 1.0.0
|
||||
require-from-string: 2.0.2
|
||||
|
||||
baseline-browser-mapping@2.8.6: {}
|
||||
|
||||
braces@3.0.3:
|
||||
dependencies:
|
||||
fill-range: 7.1.1
|
||||
|
||||
browserslist@4.26.2:
|
||||
dependencies:
|
||||
baseline-browser-mapping: 2.8.6
|
||||
caniuse-lite: 1.0.30001745
|
||||
electron-to-chromium: 1.5.223
|
||||
node-releases: 2.0.21
|
||||
update-browserslist-db: 1.1.3(browserslist@4.26.2)
|
||||
|
||||
buffer-from@1.1.2: {}
|
||||
|
||||
caniuse-lite@1.0.30001745: {}
|
||||
|
||||
chrome-trace-event@1.0.4: {}
|
||||
|
||||
commander@2.20.3: {}
|
||||
|
||||
copy-webpack-plugin@12.0.2(webpack@5.101.3):
|
||||
dependencies:
|
||||
fast-glob: 3.3.3
|
||||
glob-parent: 6.0.2
|
||||
globby: 14.1.0
|
||||
normalize-path: 3.0.0
|
||||
schema-utils: 4.3.2
|
||||
serialize-javascript: 6.0.2
|
||||
webpack: 5.101.3
|
||||
bignumber.js@9.3.1: {}
|
||||
|
||||
csstype@3.1.3: {}
|
||||
|
||||
dayjs@1.11.18: {}
|
||||
|
||||
electron-to-chromium@1.5.223: {}
|
||||
|
||||
enhanced-resolve@5.18.3:
|
||||
dependencies:
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.2.3
|
||||
|
||||
entities@4.5.0: {}
|
||||
|
||||
es-module-lexer@1.7.0: {}
|
||||
|
||||
escalade@3.2.0: {}
|
||||
|
||||
eslint-scope@5.1.1:
|
||||
dependencies:
|
||||
esrecurse: 4.3.0
|
||||
estraverse: 4.3.0
|
||||
|
||||
esrecurse@4.3.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
|
||||
estraverse@4.3.0: {}
|
||||
|
||||
estraverse@5.3.0: {}
|
||||
|
||||
estree-walker@2.0.2: {}
|
||||
|
||||
events@3.3.0: {}
|
||||
|
||||
fast-deep-equal@3.1.3: {}
|
||||
|
||||
fast-glob@3.3.3:
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
'@nodelib/fs.walk': 1.2.8
|
||||
glob-parent: 5.1.2
|
||||
merge2: 1.4.1
|
||||
micromatch: 4.0.8
|
||||
|
||||
fast-uri@3.1.0: {}
|
||||
|
||||
fastq@1.19.1:
|
||||
dependencies:
|
||||
reusify: 1.1.0
|
||||
|
||||
fill-range@7.1.1:
|
||||
dependencies:
|
||||
to-regex-range: 5.0.1
|
||||
|
||||
glob-parent@5.1.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
||||
glob-parent@6.0.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
||||
glob-to-regexp@0.4.1: {}
|
||||
|
||||
globby@14.1.0:
|
||||
dependencies:
|
||||
'@sindresorhus/merge-streams': 2.3.0
|
||||
fast-glob: 3.3.3
|
||||
ignore: 7.0.5
|
||||
path-type: 6.0.0
|
||||
slash: 5.1.0
|
||||
unicorn-magic: 0.3.0
|
||||
|
||||
graceful-fs@4.2.11: {}
|
||||
|
||||
has-flag@4.0.0: {}
|
||||
|
||||
ignore@7.0.5: {}
|
||||
|
||||
is-extglob@2.1.1: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
dependencies:
|
||||
is-extglob: 2.1.1
|
||||
|
||||
is-number@7.0.0: {}
|
||||
|
||||
jest-worker@27.5.1:
|
||||
dependencies:
|
||||
'@types/node': 24.5.2
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
|
||||
jsbarcode@3.12.1: {}
|
||||
|
||||
json-parse-even-better-errors@2.3.1: {}
|
||||
|
||||
json-schema-traverse@1.0.0: {}
|
||||
|
||||
loader-runner@4.3.0: {}
|
||||
lodash@4.17.21: {}
|
||||
|
||||
magic-string@0.30.19:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
merge-stream@2.0.0: {}
|
||||
|
||||
merge2@1.4.1: {}
|
||||
|
||||
micromatch@4.0.8:
|
||||
dependencies:
|
||||
braces: 3.0.3
|
||||
picomatch: 2.3.1
|
||||
|
||||
mime-db@1.52.0: {}
|
||||
|
||||
mime-types@2.1.35:
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
|
||||
nanoid@3.3.11: {}
|
||||
|
||||
neo-async@2.6.2: {}
|
||||
|
||||
node-releases@2.0.21: {}
|
||||
|
||||
normalize-path@3.0.0: {}
|
||||
|
||||
path-type@6.0.0: {}
|
||||
|
||||
picocolors@1.1.1: {}
|
||||
|
||||
picomatch@2.3.1: {}
|
||||
|
||||
pinia-plugin-unistorage@0.1.2: {}
|
||||
|
||||
pinia@2.3.1(@vue/composition-api@1.7.2(vue@3.5.22))(vue@3.5.22):
|
||||
@@ -979,80 +298,8 @@ snapshots:
|
||||
picocolors: 1.1.1
|
||||
source-map-js: 1.2.1
|
||||
|
||||
queue-microtask@1.2.3: {}
|
||||
|
||||
randombytes@2.1.0:
|
||||
dependencies:
|
||||
safe-buffer: 5.2.1
|
||||
|
||||
require-from-string@2.0.2: {}
|
||||
|
||||
reusify@1.1.0: {}
|
||||
|
||||
run-parallel@1.2.0:
|
||||
dependencies:
|
||||
queue-microtask: 1.2.3
|
||||
|
||||
safe-buffer@5.2.1: {}
|
||||
|
||||
schema-utils@4.3.2:
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
ajv: 8.17.1
|
||||
ajv-formats: 2.1.1(ajv@8.17.1)
|
||||
ajv-keywords: 5.1.0(ajv@8.17.1)
|
||||
|
||||
serialize-javascript@6.0.2:
|
||||
dependencies:
|
||||
randombytes: 2.1.0
|
||||
|
||||
slash@5.1.0: {}
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
source-map-support@0.5.21:
|
||||
dependencies:
|
||||
buffer-from: 1.1.2
|
||||
source-map: 0.6.1
|
||||
|
||||
source-map@0.6.1: {}
|
||||
|
||||
supports-color@8.1.1:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
|
||||
tapable@2.2.3: {}
|
||||
|
||||
terser-webpack-plugin@5.3.14(webpack@5.101.3):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 4.3.2
|
||||
serialize-javascript: 6.0.2
|
||||
terser: 5.44.0
|
||||
webpack: 5.101.3
|
||||
|
||||
terser@5.44.0:
|
||||
dependencies:
|
||||
'@jridgewell/source-map': 0.3.11
|
||||
acorn: 8.15.0
|
||||
commander: 2.20.3
|
||||
source-map-support: 0.5.21
|
||||
|
||||
to-regex-range@5.0.1:
|
||||
dependencies:
|
||||
is-number: 7.0.0
|
||||
|
||||
undici-types@7.12.0: {}
|
||||
|
||||
unicorn-magic@0.3.0: {}
|
||||
|
||||
update-browserslist-db@1.1.3(browserslist@4.26.2):
|
||||
dependencies:
|
||||
browserslist: 4.26.2
|
||||
escalade: 3.2.0
|
||||
picocolors: 1.1.1
|
||||
|
||||
vue-demi@0.14.10(@vue/composition-api@1.7.2(vue@3.5.22))(vue@3.5.22):
|
||||
dependencies:
|
||||
vue: 3.5.22
|
||||
@@ -1067,41 +314,6 @@ snapshots:
|
||||
'@vue/server-renderer': 3.5.22(vue@3.5.22)
|
||||
'@vue/shared': 3.5.22
|
||||
|
||||
watchpack@2.4.4:
|
||||
ysk-utils@1.0.28:
|
||||
dependencies:
|
||||
glob-to-regexp: 0.4.1
|
||||
graceful-fs: 4.2.11
|
||||
|
||||
webpack-sources@3.3.3: {}
|
||||
|
||||
webpack@5.101.3:
|
||||
dependencies:
|
||||
'@types/eslint-scope': 3.7.7
|
||||
'@types/estree': 1.0.8
|
||||
'@types/json-schema': 7.0.15
|
||||
'@webassemblyjs/ast': 1.14.1
|
||||
'@webassemblyjs/wasm-edit': 1.14.1
|
||||
'@webassemblyjs/wasm-parser': 1.14.1
|
||||
acorn: 8.15.0
|
||||
acorn-import-phases: 1.0.4(acorn@8.15.0)
|
||||
browserslist: 4.26.2
|
||||
chrome-trace-event: 1.0.4
|
||||
enhanced-resolve: 5.18.3
|
||||
es-module-lexer: 1.7.0
|
||||
eslint-scope: 5.1.1
|
||||
events: 3.3.0
|
||||
glob-to-regexp: 0.4.1
|
||||
graceful-fs: 4.2.11
|
||||
json-parse-even-better-errors: 2.3.1
|
||||
loader-runner: 4.3.0
|
||||
mime-types: 2.1.35
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 4.3.2
|
||||
tapable: 2.2.3
|
||||
terser-webpack-plugin: 5.3.14(webpack@5.101.3)
|
||||
watchpack: 2.4.4
|
||||
webpack-sources: 3.3.3
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
- uglify-js
|
||||
bignumber.js: 9.3.1
|
||||
|
||||
BIN
static/icon/charge.png
Normal file
BIN
static/icon/charge.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
@@ -144,7 +144,7 @@ export const useWebSocket = defineStore('socketTask', () => {
|
||||
});
|
||||
socketTask.value.onMessage((res) => {
|
||||
receivedMessages.value = JSON.parse(res.data)
|
||||
console.log('收到消息',receivedMessages.value)
|
||||
// console.log('收到消息',receivedMessages.value)
|
||||
sendMessage({
|
||||
type: 'receipt',
|
||||
msg_id: receivedMessages.value.msg_id
|
||||
|
||||
232
stores/carts.js
232
stores/carts.js
@@ -1,11 +1,24 @@
|
||||
import {
|
||||
defineStore
|
||||
} from 'pinia';
|
||||
import yskUtils from 'ysk-utils'
|
||||
const {
|
||||
OrderPriceCalculator,
|
||||
BaseCartItem,
|
||||
BackendCoupon,
|
||||
ActivityConfig,
|
||||
OrderExtraConfig,
|
||||
MerchantReductionConfig,
|
||||
MerchantReductionType,
|
||||
GoodsType
|
||||
} = yskUtils
|
||||
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive,
|
||||
watchEffect
|
||||
watchEffect,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
productminiApphotsquery,
|
||||
@@ -13,16 +26,156 @@ import {
|
||||
} from "@/common/api/product/product.js";
|
||||
export const useCartsStore = defineStore('cart',
|
||||
() => {
|
||||
// const dinersNum = uni.cache.get('dinersNum')
|
||||
// const isVip = uni.cache.get('orderVIP').isVip //此用户是否是会员
|
||||
// const isMemberPrice = uni.cache.get('ordershopUserInfo').isMemberPrice //此店是否可以用会员
|
||||
// const isTableFee = uni.cache.get('ordershopUserInfo').isTableFee //此店是否免桌位费
|
||||
// const tableFee = uni.cache.get('ordershopUserInfo').tableFee //一个餐位费多钱
|
||||
|
||||
// 商品订单会员
|
||||
const shopInfo = ref(uni.cache.get('shopInfo') || {
|
||||
isMemberPrice: 0,
|
||||
isTableFee: 1
|
||||
})
|
||||
|
||||
// 适配工具库 BaseCartItem 接口的商品数据转换函数
|
||||
const convertToBaseCartItem = (item) => {
|
||||
const skuData = item.skuData ? {
|
||||
id: item.skuData.id || item.sku_id,
|
||||
salePrice: item.skuData.salePrice || 0,
|
||||
memberPrice: item.skuData.memberPrice || 0
|
||||
} :
|
||||
undefined;
|
||||
|
||||
|
||||
|
||||
return {
|
||||
...item,
|
||||
id: item.id,
|
||||
product_id: item.product_id || item.productId,
|
||||
salePrice: item.salePrice || item.price,
|
||||
number: item.number || item.num || 0,
|
||||
product_type: item.productType,
|
||||
is_temporary: !!(item.is_temporary || item.isTemporary),
|
||||
is_gift: !!(item.is_gift || item.isGift),
|
||||
returnNum: item.returnNum || 0,
|
||||
memberPrice: item.memberPrice || 0,
|
||||
discountSaleAmount: item.discount_sale_amount || item.discountSaleAmount || 0,
|
||||
packFee: item.packFee || 0,
|
||||
packNumber: item.pack_number || item.packNumber || 0,
|
||||
activityInfo: item.activityInfo ? {
|
||||
type: item.activityInfo.type,
|
||||
discountRate: OrderPriceCalculator.formatDiscountRate(item.activityInfo.discountRate),
|
||||
vipPriceShare: !!item.activityInfo.vipPriceShare
|
||||
} : undefined,
|
||||
skuData
|
||||
};
|
||||
};
|
||||
|
||||
// 合并所有商品列表
|
||||
const allGoods = computed(() => {
|
||||
const currentGoods = (carts.value).map(convertToBaseCartItem);
|
||||
const giftGoods = [].map(convertToBaseCartItem);
|
||||
// 扁平化历史订单商品
|
||||
const oldOrderGoods = Object.values(oldOrder.value.detailMap || {})
|
||||
.flat()
|
||||
.map(convertToBaseCartItem);
|
||||
return [...currentGoods, ...giftGoods, ...oldOrderGoods];
|
||||
})
|
||||
|
||||
|
||||
// 就餐类型 'dine-in' | 'take-out'
|
||||
|
||||
let dinnerType = ref('dine-in');
|
||||
|
||||
function setDinnerType(str) {
|
||||
dinnerType.value = str
|
||||
}
|
||||
//餐位费配置
|
||||
|
||||
const dinersNum = uni.cache.set('dinersNum') || 1
|
||||
const seatFeeConfig = ref({
|
||||
pricePerPerson: shopInfo.value.tableFee || 1,
|
||||
personCount: dinersNum,
|
||||
isEnabled: !shopInfo.value.isTableFee
|
||||
})
|
||||
watch(() => shopInfo.value.isTableFee, (newval) => {
|
||||
seatFeeConfig.value.isEnabled = !shopInfo.value.isTableFee
|
||||
})
|
||||
|
||||
function setSeatFeeConfig(key, val) {
|
||||
seatFeeConfig.value[key] = val;
|
||||
}
|
||||
watch(() => seatFeeConfig.value, (newval) => {
|
||||
console.log('seatFeeConfig', seatFeeConfig.value);
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
//积分规则
|
||||
const pointDeductionRule = ref({
|
||||
pointsPerYuan: 100,
|
||||
maxDeductionAmount: Infinity
|
||||
})
|
||||
|
||||
function setPointDeductionRule(pointsPerYuan, maxDeductionAmount) {
|
||||
pointDeductionRule.value.pointsPerYuan = pointsPerYuan
|
||||
pointDeductionRule.value.maxDeductionAmount = maxDeductionAmount
|
||||
}
|
||||
|
||||
// 初始配置:默认无减免(固定金额 0 元)
|
||||
const merchantReductionConfig = ref({
|
||||
type: 'fixed_amount',
|
||||
fixedAmount: 0
|
||||
});
|
||||
//使用积分数量
|
||||
const userPoints = ref(0);
|
||||
|
||||
function setUserPoints(newval) {
|
||||
userPoints.value = newval
|
||||
}
|
||||
|
||||
|
||||
//新客立减
|
||||
const newUserDiscount = ref(0);
|
||||
// 订单额外配置
|
||||
const orderExtraConfig = computed(() => ({
|
||||
// 引用扩展后的商家减免配置
|
||||
merchantReduction: merchantReductionConfig.value,
|
||||
additionalFee: 0,
|
||||
pointDeductionRule: pointDeductionRule.value,
|
||||
seatFeeConfig: seatFeeConfig.value,
|
||||
currentStoreId: '',
|
||||
userPoints: userPoints.value,
|
||||
isMember: useVipPrice.value,
|
||||
memberDiscountRate: 1,
|
||||
newUserDiscount: newUserDiscount.value
|
||||
}));
|
||||
|
||||
// 营销活动列表
|
||||
const activityList = computed(() => {
|
||||
return [];
|
||||
});
|
||||
// 优惠券列表
|
||||
const backendCoupons = ref([])
|
||||
|
||||
function setCoupons(cps) {
|
||||
console.log('setCoupons', cps);
|
||||
backendCoupons.value = cps;
|
||||
}
|
||||
// 商品加入购物车顺序
|
||||
const cartOrder = ref({});
|
||||
// 订单费用汇总
|
||||
const orderCostSummary = computed(() => {
|
||||
const costSummary = OrderPriceCalculator.calculateOrderCostSummary(
|
||||
allGoods.value,
|
||||
dinnerType.value,
|
||||
backendCoupons.value,
|
||||
activityList.value,
|
||||
orderExtraConfig.value,
|
||||
cartOrder.value,
|
||||
new Date()
|
||||
);
|
||||
return costSummary;
|
||||
});
|
||||
|
||||
const goodsIsloading = ref(true);
|
||||
|
||||
|
||||
|
||||
//商品数据Map
|
||||
const goodsMap = reactive({})
|
||||
//获取商品数据
|
||||
@@ -62,13 +215,6 @@ export const useCartsStore = defineStore('cart',
|
||||
let skuData = undefined;
|
||||
skuData = goods?.skuList.find((sku) => sku.id == v.sku_id);
|
||||
|
||||
// if (goods.type == 'package') {
|
||||
// //套餐商品
|
||||
// const SnapSku = findInGroupSnapSku(goods.groupSnap, v.sku_id)
|
||||
// skuData = { ...SnapSku, salePrice: SnapSku ? SnapSku.price : 0 }
|
||||
// } else {
|
||||
// skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id);
|
||||
// }
|
||||
skuData = goods?.skuList.find((sku) => sku.id == v.sku_id);
|
||||
|
||||
if (skuData) {
|
||||
@@ -135,7 +281,6 @@ export const useCartsStore = defineStore('cart',
|
||||
if (Message.operate_type == 'del' && Message.status == 1) {
|
||||
// 优化:使用可选链操作符避免报错
|
||||
carts.value = carts.value.filter(item => item.id !== msgData?.id);
|
||||
// carts.value = carts.value.filter(item => item.id != Message.data.id);
|
||||
}
|
||||
|
||||
// 添加或者减少购物后返回
|
||||
@@ -167,7 +312,6 @@ export const useCartsStore = defineStore('cart',
|
||||
}
|
||||
|
||||
if (Message.type == 'no_suit_num') {
|
||||
// console.log(specifications)
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
@@ -177,9 +321,6 @@ export const useCartsStore = defineStore('cart',
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +334,10 @@ export const useCartsStore = defineStore('cart',
|
||||
originAmount: 0
|
||||
})
|
||||
|
||||
function setOldOrder(data) {
|
||||
oldOrder.value = data
|
||||
}
|
||||
|
||||
|
||||
// 会员信息
|
||||
const orderVIP = ref(uni.cache.get('orderVIP') || {
|
||||
@@ -210,10 +355,7 @@ export const useCartsStore = defineStore('cart',
|
||||
}
|
||||
}
|
||||
|
||||
// 商品订单会员
|
||||
const shopInfo = ref(uni.cache.get('shopInfo') || {
|
||||
isMemberPrice: 0
|
||||
})
|
||||
|
||||
|
||||
//是否使用会员价
|
||||
const useVipPrice = computed(() => {
|
||||
@@ -264,16 +406,6 @@ export const useCartsStore = defineStore('cart',
|
||||
return money
|
||||
})
|
||||
|
||||
//商品券抵扣金额
|
||||
// const productCouponDiscountAmount = computed(() => {
|
||||
// let index = -1;
|
||||
// return quansSelArr.value.reduce((pre, cur) => {
|
||||
// index++;
|
||||
// return pre + returnProDiscount(cur, index) * 1;
|
||||
// }, 0);
|
||||
// });
|
||||
|
||||
|
||||
//返回打包数量(称重商品打包数量最大为1)
|
||||
function returnCartPackNumber(cur) {
|
||||
const maxReturnNum = cur.number - (cur.returnNum || 0);
|
||||
@@ -343,8 +475,6 @@ export const useCartsStore = defineStore('cart',
|
||||
if (!matchedProducts || !Array.isArray(matchedProducts)) {
|
||||
return 0;
|
||||
}
|
||||
// console.log(uni.cache.get('orderVIP').isVip, uni.cache.get('ordershopUserInfo').isMemberPrice,
|
||||
// 111)
|
||||
// 购物车总数价格
|
||||
console.log('isBwc');
|
||||
console.log(isBwc);
|
||||
@@ -366,8 +496,6 @@ export const useCartsStore = defineStore('cart',
|
||||
|
||||
cart = cart.toFixed(2)
|
||||
console.log(parseFloat(cart))
|
||||
// 向上取整并保留两位小数
|
||||
// let result = roundUpToTwoDecimals(cart, 'upward')
|
||||
return parseFloat(cart);
|
||||
};
|
||||
|
||||
@@ -399,9 +527,6 @@ export const useCartsStore = defineStore('cart',
|
||||
|
||||
if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && seatNum) {
|
||||
cart = parseFloat(seatNum) * parseFloat(uni.cache.get('ordershopUserInfo').tableFee)
|
||||
|
||||
// Math.ceil(parseFloat(seatNum) * parseFloat(
|
||||
// uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
|
||||
}
|
||||
// 向下取整并保留两位小数
|
||||
let result = roundUpToTwoDecimals(cart, 'downward')
|
||||
@@ -417,18 +542,9 @@ export const useCartsStore = defineStore('cart',
|
||||
// 向下取整并保留两位小数
|
||||
let result = roundUpToTwoDecimals(total, 'downward')
|
||||
return result;
|
||||
// return Math.floor(total * 100) / 100;
|
||||
});
|
||||
|
||||
//获取热门商品
|
||||
async function getHotProduct() {
|
||||
|
||||
}
|
||||
|
||||
//获取分组商品
|
||||
async function getGroupProduct() {
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
getTotalPackFee,
|
||||
@@ -446,7 +562,21 @@ export const useCartsStore = defineStore('cart',
|
||||
totalPackFee,
|
||||
updateData,
|
||||
useVipPrice,
|
||||
totalOriginPrice
|
||||
totalOriginPrice,
|
||||
orderCostSummary,
|
||||
setCoupons,
|
||||
setUserPoints,
|
||||
setPointDeductionRule,
|
||||
setOldOrder,
|
||||
//优惠券列表
|
||||
backendCoupons,
|
||||
allGoods,
|
||||
setDinnerType,
|
||||
setSeatFeeConfig,
|
||||
seatFeeConfig,
|
||||
shopInfo,
|
||||
//新客立减金额
|
||||
newUserDiscount
|
||||
};
|
||||
}
|
||||
);
|
||||
444
utils/goods-utils - 副本.js
Normal file
444
utils/goods-utils - 副本.js
Normal file
@@ -0,0 +1,444 @@
|
||||
import {
|
||||
BigNumber
|
||||
} from "bignumber.js";
|
||||
import _ from "lodash";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回商品单价
|
||||
* @param goods 商品
|
||||
* @param user 用户信息
|
||||
* @param {Object} shopInfo
|
||||
*/
|
||||
export function returnGoodsPrice(goods, user, shopInfo) {
|
||||
if (goods.discount_sale_amount * 1 > 0) {
|
||||
return goods.discount_sale_amount;
|
||||
}
|
||||
if(shopInfo&&!shopInfo.isMemberPrice){
|
||||
return goods.salePrice;
|
||||
}
|
||||
if (user.isVip && goods.memberPrice * 1 <= goods.salePrice * 1 && goods.memberPrice * 1 > 0) {
|
||||
return goods.memberPrice;
|
||||
}
|
||||
return goods.salePrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回商品分组
|
||||
* @param arr 商品列表
|
||||
*/
|
||||
export function returnGoodsGroupMap(arr) {
|
||||
let map = {};
|
||||
arr.forEach((v) => {
|
||||
const key = v.productId + "_" + v.skuId;
|
||||
if (!map[key]) {
|
||||
map[key] = [];
|
||||
}
|
||||
map[key].push(v);
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
||||
* @param coupon
|
||||
*/
|
||||
export function returnCoupType(coupon) {
|
||||
const couponTypes = {
|
||||
1: "满减券",
|
||||
2: "商品券",
|
||||
3: "折扣券",
|
||||
4: "第二件半价券",
|
||||
5: "消费送券",
|
||||
6: "买一送一券",
|
||||
7: "固定价格券",
|
||||
8: "免配送费券",
|
||||
};
|
||||
return couponTypes[coupon.type] || "未知类型";
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回商品券抵扣后的商品列表
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param selCoupon 已选择的优惠券列表
|
||||
* @param user 用户信息
|
||||
*/
|
||||
export function returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user) {
|
||||
const goodsCouponGoods = selCoupon
|
||||
.filter((v) => v.type == 2)
|
||||
.reduce((prve, cur) => {
|
||||
prve.push(...cur.discount.hasDiscountGoodsArr);
|
||||
return prve;
|
||||
}, []);
|
||||
const arr = _.cloneDeep(canDikouGoodsArr)
|
||||
.map((v) => {
|
||||
const findCart = goodsCouponGoods.find((carts) => carts.id == v.id);
|
||||
if (findCart) {
|
||||
v.num -= findCart.num;
|
||||
}
|
||||
return v;
|
||||
})
|
||||
.filter((v) => v.num > 0);
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断优惠券是否可使用,并返回不可用原因
|
||||
*
|
||||
* @param {Object} args - 函数参数集合
|
||||
* @param {Array} args.canDikouGoodsArr - 可参与抵扣的商品列表
|
||||
* @param {Object} args.coupon - 优惠券信息对象
|
||||
* @param {boolean} args.coupon.use - 优惠券是否启用
|
||||
* @param {Array} args.coupon.useFoods - 优惠券适用的商品ID列表
|
||||
* @param {number} args.coupon.fullAmount - 优惠券使用门槛金额
|
||||
* @param {number} args.coupon.type - 优惠券类型
|
||||
* @param {number} args.goodsOrderPrice - 订单中所有商品的总金额
|
||||
* @param {Object} args.user - 用户信息对象
|
||||
* @param {Object} args.selCoupon - 已经选择的优惠券信息对象
|
||||
* @param {Object} args.shopInfo
|
||||
* @returns {Object} - { canUse: boolean, reason: string } 可用状态及不可用原因
|
||||
*/
|
||||
export function returnCouponCanUse(args) {
|
||||
let {
|
||||
canDikouGoodsArr,
|
||||
coupon,
|
||||
goodsOrderPrice,
|
||||
user,
|
||||
selCoupon,
|
||||
shopInfo
|
||||
} = args;
|
||||
|
||||
// 优惠券未启用
|
||||
if (!coupon.use) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "优惠券未启用"
|
||||
};
|
||||
}
|
||||
|
||||
canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user,shopInfo);
|
||||
// 计算门槛金额
|
||||
let fullAmount = goodsOrderPrice;
|
||||
// 是否抵扣全部商品
|
||||
const isDikouAll = coupon.useFoods.length === 0;
|
||||
let canCalcGoodsArr = [];
|
||||
// 订单里参与门槛计算的商品
|
||||
if (!isDikouAll) {
|
||||
canCalcGoodsArr = canDikouGoodsArr.filter((v) => {
|
||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
||||
});
|
||||
fullAmount = canCalcGoodsArr.reduce((pre, cur) => {
|
||||
return pre + returnGoodsPrice(cur, user,shopInfo) * cur.num;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// 没有符合条件的商品
|
||||
if (!isDikouAll && canCalcGoodsArr.length === 0) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "没有符合条件的商品"
|
||||
};
|
||||
}
|
||||
|
||||
// 不满足门槛金额
|
||||
if (fullAmount < coupon.fullAmount) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`
|
||||
};
|
||||
}
|
||||
|
||||
// 商品券特殊验证
|
||||
if (coupon.type === 2) {
|
||||
if (!(isDikouAll || canCalcGoodsArr.length > 0)) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "没有符合条件的商品可抵扣"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 买一送一券特殊验证
|
||||
if (coupon.type === 6) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
} else if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canCalcGoodsArr.some((v) => v.num >= 2);
|
||||
}
|
||||
|
||||
if (!canUse) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "需要购买至少2件相同的商品才能使用"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 第二件半价券特殊验证
|
||||
if (coupon.type === 4) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
} else if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canCalcGoodsArr.some((v) => v.num >= 2);
|
||||
}
|
||||
|
||||
if (!canUse) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "需要购买至少2件相同的商品才能使用"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 所有条件都满足
|
||||
return {
|
||||
canUse: true,
|
||||
reason: ""
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算抵扣商品金额
|
||||
* @param discountGoodsArr 可抵扣商品列表
|
||||
* @param discountNum 抵扣数量
|
||||
* @param user 用户信息
|
||||
* @param {Object} shopInfo 店铺信息
|
||||
*/
|
||||
export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user,shopInfo) {
|
||||
let hasCountNum = 0;
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr = [];
|
||||
for (let i = 0; i < discountGoodsArr.length; i++) {
|
||||
if (hasCountNum >= discountNum) {
|
||||
break;
|
||||
}
|
||||
const goods = discountGoodsArr[i];
|
||||
const shengyuNum = discountNum - hasCountNum;
|
||||
const num = Math.min(goods.num, shengyuNum);
|
||||
discountPrice += returnGoodsPrice(goods, user,shopInfo) * num;
|
||||
hasCountNum += num;
|
||||
hasDiscountGoodsArr.push({
|
||||
...goods,
|
||||
num
|
||||
});
|
||||
}
|
||||
return {
|
||||
discountPrice,
|
||||
hasDiscountGoodsArr
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算优惠券抵扣金额
|
||||
* @param arr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param goodsOrderPrice 商品订单金额
|
||||
* @param selCoupon 已选择的优惠券列表
|
||||
*/
|
||||
export function returnCouponDiscount(arr, coupon, user, goodsOrderPrice, selCoupon) {
|
||||
console.log('arr', arr);
|
||||
const canDikouGoodsArr = returnCanDikouGoodsArr(arr, selCoupon, user);
|
||||
console.log('canDikouGoodsArr', canDikouGoodsArr);
|
||||
if (coupon.type == 2) {
|
||||
return returnCouponProductDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice);
|
||||
}
|
||||
if (coupon.type == 6) {
|
||||
return returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice);
|
||||
}
|
||||
if (coupon.type == 4) {
|
||||
return returnSecoendDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice);
|
||||
}
|
||||
if (coupon.type == 3) {
|
||||
return returnCouponZhekouDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice, selCoupon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 折扣券抵扣金额
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param goodsOrderPrice 商品订单金额
|
||||
* @param selCoupon 已选择的优惠券列表
|
||||
*
|
||||
*/
|
||||
export function returnCouponZhekouDiscount(
|
||||
canDikouGoodsArr,
|
||||
coupon,
|
||||
user,
|
||||
goodsOrderPrice,
|
||||
selCoupon
|
||||
) {
|
||||
const {
|
||||
discountRate,
|
||||
maxDiscountAmount
|
||||
} = coupon;
|
||||
|
||||
const goodsCouponDiscount = selCoupon
|
||||
.filter((v) => v.type == 2)
|
||||
.reduce((prve, cur) => {
|
||||
return prve + cur.discount.discountPrice;
|
||||
}, 0);
|
||||
goodsOrderPrice -= goodsCouponDiscount;
|
||||
// 使用bignumber处理高精度计算
|
||||
// 1. 计算折扣率(百分比转小数):discountRate / 100
|
||||
const discountRatio = new BigNumber(discountRate).dividedBy(100);
|
||||
// 2. 计算优惠比例:1 - 折扣率(例如:8折的优惠比例是 1 - 0.8 = 0.2)
|
||||
const discountAmountRatio = new BigNumber(1).minus(discountRatio);
|
||||
// 3. 计算折扣金额:商品订单金额 × 优惠比例
|
||||
let discountPrice = new BigNumber(goodsOrderPrice).times(discountAmountRatio).toNumber();
|
||||
if (maxDiscountAmount != 0) {
|
||||
discountPrice = discountPrice >= maxDiscountAmount ? maxDiscountAmount : discountPrice;
|
||||
}
|
||||
|
||||
return {
|
||||
discountPrice, // 折扣抵扣金额(即优惠的金额)
|
||||
hasDiscountGoodsArr: [],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品券抵扣金额
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
*/
|
||||
export function returnCouponProductDiscount(canDikouGoodsArr, coupon, user) {
|
||||
const {
|
||||
useFoods,
|
||||
discountNum,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品数组
|
||||
let discountGoodsArr = [];
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
discountGoodsArr = canDikouGoodsArr
|
||||
.slice(canDikouGoodsArr.length - discountNum, canDikouGoodsArr.length)
|
||||
.reverse();
|
||||
} else {
|
||||
discountGoodsArr = canDikouGoodsArr.slice(0, discountNum);
|
||||
}
|
||||
} else {
|
||||
//抵扣选中商品
|
||||
const discountSelGoodsArr = canDikouGoodsArr.filter((v) =>
|
||||
useFoods.find((food) => food.id == v.productId)
|
||||
);
|
||||
if (useRule == "price_asc") {
|
||||
discountGoodsArr = discountSelGoodsArr
|
||||
.slice(discountSelGoodsArr.length - discountNum, discountSelGoodsArr.length)
|
||||
.reverse();
|
||||
} else {
|
||||
discountGoodsArr = discountSelGoodsArr.slice(0, discountNum);
|
||||
}
|
||||
}
|
||||
const result = calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 返回买一送一券抵扣详情
|
||||
/**
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user,shopInfo) {
|
||||
const {
|
||||
useFoods,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合买一送一条件的商品
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2);
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods[canUseGoods.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods.slice(0, 1);
|
||||
}
|
||||
} else {
|
||||
//符合抵扣条件的商品
|
||||
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods1.slice(0, 1);
|
||||
}
|
||||
}
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user,shopInfo);
|
||||
const hasDiscountGoodsArr = [discountGoods];
|
||||
return {
|
||||
discountPrice,
|
||||
hasDiscountGoodsArr
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回第二件半价券抵扣详情
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnSecoendDiscount(canDikouGoodsArr, coupon, user,shopInfo) {
|
||||
const {
|
||||
useFoods,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合买一送一条件的商品
|
||||
const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2);
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods[canUseGoods.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods.slice(0, 1);
|
||||
}
|
||||
} else {
|
||||
//符合抵扣条件的商品
|
||||
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods1.slice(0, 1);
|
||||
}
|
||||
}
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user,shopInfo);
|
||||
const hasDiscountGoodsArr = [discountGoods];
|
||||
//返回半价价格
|
||||
return {
|
||||
discountPrice: new BigNumber(discountPrice).dividedBy(2).toNumber(),
|
||||
hasDiscountGoodsArr,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回可以抵扣优惠券的商品列表,过滤掉赠品、临时商品,价格从高到低排序
|
||||
* @param arr 商品列表
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
export function returnCanDikouGoods(arr, user, shopInfo) {
|
||||
const result = arr
|
||||
.filter((v) => {
|
||||
return v.is_temporary != 1 && v.is_gift != 1;
|
||||
})
|
||||
.filter((v) => {
|
||||
return v.num > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return returnGoodsPrice(b, use, shopInfo) - returnGoodsPrice(a, user, shopInfo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -1,33 +1,23 @@
|
||||
import { BigNumber } from "bignumber.js";
|
||||
import {
|
||||
BigNumber
|
||||
} from "bignumber.js";
|
||||
import _ from "lodash";
|
||||
|
||||
/**
|
||||
* 返回可以抵扣优惠券的商品列表,过滤掉赠品、临时商品,价格从高到低排序
|
||||
* @param arr 商品列表
|
||||
* @param user 用户信息
|
||||
*/
|
||||
export function returnCanDikouGoods(arr, user) {
|
||||
return arr
|
||||
.filter((v) => {
|
||||
return v.is_temporary != 1 && v.is_gift != 1;
|
||||
})
|
||||
.filter((v) => {
|
||||
return v.num > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return returnGoodsPrice(b, user) - returnGoodsPrice(a, user);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回商品单价
|
||||
* @param goods 商品
|
||||
* @param user 用户信息
|
||||
* @param {Object} shopInfo
|
||||
*/
|
||||
export function returnGoodsPrice(goods, user) {
|
||||
export function returnGoodsPrice(goods, user, shopInfo) {
|
||||
if (goods.discount_sale_amount * 1 > 0) {
|
||||
return goods.discount_sale_amount;
|
||||
}
|
||||
if(shopInfo&&!shopInfo.isMemberPrice){
|
||||
return goods.salePrice;
|
||||
}
|
||||
if (user.isVip && goods.memberPrice * 1 <= goods.salePrice * 1 && goods.memberPrice * 1 > 0) {
|
||||
return goods.memberPrice;
|
||||
}
|
||||
@@ -94,31 +84,43 @@ export function returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断优惠券是否可使用
|
||||
* 判断优惠券是否可使用,并返回不可用原因
|
||||
*
|
||||
* @param {Object} args - 函数参数集合
|
||||
* @param {Array} args.canDikouGoodsArr - 可参与抵扣的商品列表,每个元素包含商品信息(productId、num等)
|
||||
* @param {Array} args.canDikouGoodsArr - 可参与抵扣的商品列表
|
||||
* @param {Object} args.coupon - 优惠券信息对象
|
||||
* @param {boolean} args.coupon.use - 优惠券是否启用(true为启用,false为禁用)
|
||||
* @param {Array} args.coupon.useFoods - 优惠券适用的商品ID列表(空数组表示适用全部商品)
|
||||
* @param {boolean} args.coupon.use - 优惠券是否启用
|
||||
* @param {Array} args.coupon.useFoods - 优惠券适用的商品ID列表
|
||||
* @param {number} args.coupon.fullAmount - 优惠券使用门槛金额
|
||||
* @param {number} args.coupon.type - 优惠券类型(1:满减券, 2:商品券, 3:折扣券, 4:第二件半价券, 6:买一送一券)
|
||||
* @param {number} args.goodsOrderPrice - 订单中所有商品的总金额(未筛选时的初始金额)
|
||||
* @param {Object} args.user - 用户信息对象(用于计算商品价格,如会员价等)
|
||||
* @param {Object} args.user - 用户信息对象(用于计算商品价格,如会员价等)
|
||||
* @param {number} args.coupon.type - 优惠券类型
|
||||
* @param {number} args.goodsOrderPrice - 订单中所有商品的总金额
|
||||
* @param {Object} args.user - 用户信息对象
|
||||
* @param {Object} args.selCoupon - 已经选择的优惠券信息对象
|
||||
* @returns {boolean} - 优惠券是否可用(true可用,false不可用)
|
||||
* @param {Object} args.shopInfo
|
||||
* @returns {Object} - { canUse: boolean, reason: string } 可用状态及不可用原因
|
||||
*/
|
||||
export function returnCouponCanUse(args) {
|
||||
let { canDikouGoodsArr, coupon, goodsOrderPrice, user, selCoupon } = args;
|
||||
let {
|
||||
canDikouGoodsArr,
|
||||
coupon,
|
||||
goodsOrderPrice,
|
||||
user,
|
||||
selCoupon,
|
||||
shopInfo
|
||||
} = args;
|
||||
|
||||
// 优惠券未启用
|
||||
if (!coupon.use) {
|
||||
return false;
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "优惠券未启用"
|
||||
};
|
||||
}
|
||||
|
||||
canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user);
|
||||
canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user,shopInfo);
|
||||
// 计算门槛金额
|
||||
let fullAmount = goodsOrderPrice;
|
||||
//是否抵扣全部商品
|
||||
// 是否抵扣全部商品
|
||||
const isDikouAll = coupon.useFoods.length === 0;
|
||||
let canCalcGoodsArr = [];
|
||||
// 订单里参与门槛计算的商品
|
||||
@@ -127,73 +129,86 @@ export function returnCouponCanUse(args) {
|
||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
||||
});
|
||||
fullAmount = canCalcGoodsArr.reduce((pre, cur) => {
|
||||
return pre + returnGoodsPrice(cur, user) * cur.num;
|
||||
return pre + returnGoodsPrice(cur, user,shopInfo) * cur.num;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
//没有符合商品
|
||||
if (!isDikouAll && canCalcGoodsArr.length == 0) {
|
||||
return false;
|
||||
// 没有符合条件的商品
|
||||
if (!isDikouAll && canCalcGoodsArr.length === 0) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "没有符合条件的商品"
|
||||
};
|
||||
}
|
||||
|
||||
//不满足门槛金额
|
||||
// 不满足门槛金额
|
||||
if (fullAmount < coupon.fullAmount) {
|
||||
console.log("不满足门槛金额");
|
||||
return false;
|
||||
return {
|
||||
canUse: false,
|
||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`
|
||||
};
|
||||
}
|
||||
|
||||
if (coupon.type == 2) {
|
||||
//商品券
|
||||
return isDikouAll || canCalcGoodsArr.length > 0;
|
||||
// 商品券特殊验证
|
||||
if (coupon.type === 2) {
|
||||
if (!(isDikouAll || canCalcGoodsArr.length > 0)) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "没有符合条件的商品可抵扣"
|
||||
};
|
||||
}
|
||||
if (coupon.type == 1) {
|
||||
//满减券
|
||||
return fullAmount >= coupon.fullAmount;
|
||||
}
|
||||
if (coupon.type == 6) {
|
||||
//买一送一券
|
||||
|
||||
// 买一送一券特殊验证
|
||||
if (coupon.type === 6) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
} else if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canCalcGoodsArr.some((v) => v.num >= 2);
|
||||
}
|
||||
if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canDikouGoodsArr
|
||||
.filter((v) => {
|
||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
||||
})
|
||||
.some((v) => v.num >= 2);
|
||||
|
||||
if (!canUse) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "需要购买至少2件相同的商品才能使用"
|
||||
};
|
||||
}
|
||||
return canUse;
|
||||
}
|
||||
if (coupon.type == 4) {
|
||||
//第二件半价券
|
||||
|
||||
// 第二件半价券特殊验证
|
||||
if (coupon.type === 4) {
|
||||
let canUse = false;
|
||||
if (isDikouAll) {
|
||||
canUse = canDikouGoodsArr.some((v) => v.num >= 2);
|
||||
} else if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canCalcGoodsArr.some((v) => v.num >= 2);
|
||||
}
|
||||
if (canCalcGoodsArr.length > 0) {
|
||||
canUse = canDikouGoodsArr
|
||||
.filter((v) => {
|
||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
||||
})
|
||||
.some((v) => v.num >= 2);
|
||||
|
||||
if (!canUse) {
|
||||
return {
|
||||
canUse: false,
|
||||
reason: "需要购买至少2件相同的商品才能使用"
|
||||
};
|
||||
}
|
||||
return canUse;
|
||||
}
|
||||
if (coupon.type == 3) {
|
||||
//折扣券
|
||||
return true;
|
||||
}
|
||||
|
||||
// 所有条件都满足
|
||||
return {
|
||||
canUse: true,
|
||||
reason: ""
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算抵扣商品金额
|
||||
* @param discountGoodsArr 可抵扣商品列表
|
||||
* @param discountNum 抵扣数量
|
||||
* @param user 用户信息
|
||||
* @param {Object} shopInfo 店铺信息
|
||||
*/
|
||||
export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user) {
|
||||
export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user,shopInfo) {
|
||||
let hasCountNum = 0;
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr = [];
|
||||
@@ -204,23 +219,31 @@ export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user) {
|
||||
const goods = discountGoodsArr[i];
|
||||
const shengyuNum = discountNum - hasCountNum;
|
||||
const num = Math.min(goods.num, shengyuNum);
|
||||
discountPrice += returnGoodsPrice(goods, user) * num;
|
||||
discountPrice += returnGoodsPrice(goods, user,shopInfo) * num;
|
||||
hasCountNum += num;
|
||||
hasDiscountGoodsArr.push({ ...goods, num });
|
||||
hasDiscountGoodsArr.push({
|
||||
...goods,
|
||||
num
|
||||
});
|
||||
}
|
||||
return { discountPrice, hasDiscountGoodsArr };
|
||||
return {
|
||||
discountPrice,
|
||||
hasDiscountGoodsArr
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算优惠券抵扣金额
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param arr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param goodsOrderPrice 商品订单金额
|
||||
* @param selCoupon 已选择的优惠券列表
|
||||
*/
|
||||
export function returnCouponDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice, selCoupon) {
|
||||
canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user);
|
||||
export function returnCouponDiscount(arr, coupon, user, goodsOrderPrice, selCoupon) {
|
||||
console.log('arr', arr);
|
||||
const canDikouGoodsArr = returnCanDikouGoodsArr(arr, selCoupon, user);
|
||||
console.log('canDikouGoodsArr', canDikouGoodsArr);
|
||||
if (coupon.type == 2) {
|
||||
return returnCouponProductDiscount(canDikouGoodsArr, coupon, user, goodsOrderPrice);
|
||||
}
|
||||
@@ -251,7 +274,10 @@ export function returnCouponZhekouDiscount(
|
||||
goodsOrderPrice,
|
||||
selCoupon
|
||||
) {
|
||||
const { discountRate, maxDiscountAmount } = coupon;
|
||||
const {
|
||||
discountRate,
|
||||
maxDiscountAmount
|
||||
} = coupon;
|
||||
|
||||
const goodsCouponDiscount = selCoupon
|
||||
.filter((v) => v.type == 2)
|
||||
@@ -259,7 +285,6 @@ export function returnCouponZhekouDiscount(
|
||||
return prve + cur.discount.discountPrice;
|
||||
}, 0);
|
||||
goodsOrderPrice -= goodsCouponDiscount;
|
||||
|
||||
// 使用bignumber处理高精度计算
|
||||
// 1. 计算折扣率(百分比转小数):discountRate / 100
|
||||
const discountRatio = new BigNumber(discountRate).dividedBy(100);
|
||||
@@ -284,11 +309,13 @@ export function returnCouponZhekouDiscount(
|
||||
* @param user 用户信息
|
||||
*/
|
||||
export function returnCouponProductDiscount(canDikouGoodsArr, coupon, user) {
|
||||
const { useFoods, discountNum, useRule } = coupon;
|
||||
|
||||
const {
|
||||
useFoods,
|
||||
discountNum,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品数组
|
||||
let discountGoodsArr = [];
|
||||
|
||||
//抵扣全部商品
|
||||
if (useFoods.length === 0) {
|
||||
if (useRule == "price_asc") {
|
||||
@@ -312,7 +339,6 @@ export function returnCouponProductDiscount(canDikouGoodsArr, coupon, user) {
|
||||
}
|
||||
}
|
||||
const result = calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user);
|
||||
console.log(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -321,9 +347,13 @@ export function returnCouponProductDiscount(canDikouGoodsArr, coupon, user) {
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user) {
|
||||
const { useFoods, useRule } = coupon;
|
||||
function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user,shopInfo) {
|
||||
const {
|
||||
useFoods,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合买一送一条件的商品
|
||||
@@ -338,18 +368,18 @@ function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user) {
|
||||
} else {
|
||||
//符合抵扣条件的商品
|
||||
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
|
||||
console.log(canUseGoods1);
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods1.slice(0, 1);
|
||||
}
|
||||
}
|
||||
console.log("discountGoods");
|
||||
console.log(discountGoods);
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user);
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user,shopInfo);
|
||||
const hasDiscountGoodsArr = [discountGoods];
|
||||
return { discountPrice, hasDiscountGoodsArr };
|
||||
return {
|
||||
discountPrice,
|
||||
hasDiscountGoodsArr
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,9 +387,13 @@ function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user) {
|
||||
* @param canDikouGoodsArr 可抵扣商品列表
|
||||
* @param coupon 优惠券
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
function returnSecoendDiscount(canDikouGoodsArr, coupon, user) {
|
||||
const { useFoods, useRule } = coupon;
|
||||
function returnSecoendDiscount(canDikouGoodsArr, coupon, user,shopInfo) {
|
||||
const {
|
||||
useFoods,
|
||||
useRule
|
||||
} = coupon;
|
||||
//抵扣商品
|
||||
let discountGoods = undefined;
|
||||
//符合买一送一条件的商品
|
||||
@@ -374,14 +408,13 @@ function returnSecoendDiscount(canDikouGoodsArr, coupon, user) {
|
||||
} else {
|
||||
//符合抵扣条件的商品
|
||||
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
|
||||
console.log(canUseGoods1);
|
||||
if (useRule == "price_asc") {
|
||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
||||
} else {
|
||||
discountGoods = canUseGoods1.slice(0, 1);
|
||||
}
|
||||
}
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user);
|
||||
const discountPrice = returnGoodsPrice(discountGoods, user,shopInfo);
|
||||
const hasDiscountGoodsArr = [discountGoods];
|
||||
//返回半价价格
|
||||
return {
|
||||
@@ -389,3 +422,23 @@ function returnSecoendDiscount(canDikouGoodsArr, coupon, user) {
|
||||
hasDiscountGoodsArr,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回可以抵扣优惠券的商品列表,过滤掉赠品、临时商品,价格从高到低排序
|
||||
* @param arr 商品列表
|
||||
* @param user 用户信息
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
export function returnCanDikouGoods(arr, user, shopInfo) {
|
||||
const result = arr
|
||||
.filter((v) => {
|
||||
return v.is_temporary != 1 && v.is_gift != 1;
|
||||
})
|
||||
.filter((v) => {
|
||||
return v.num > 0;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return returnGoodsPrice(b, use, shopInfo) - returnGoodsPrice(a, user, shopInfo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user