Compare commits
7 Commits
75ed724fbb
...
ac7af51a92
| Author | SHA1 | Date | |
|---|---|---|---|
| ac7af51a92 | |||
| 9b78ee0f48 | |||
| 113193b142 | |||
| edd10edf9f | |||
| e645aa5516 | |||
| 158a025ba1 | |||
| 4d7c388f74 |
@@ -55,7 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<!-- 优惠券名称与领取按钮 -->
|
<!-- 优惠券名称与领取按钮 -->
|
||||||
<view class="u-flex u-row-between u-m-t-16">
|
<view class="u-flex u-row-between u-m-t-16 u-col-center">
|
||||||
<view>
|
<view>
|
||||||
<text class="title">{{ item.couponInfo.title }}</text>
|
<text class="title">{{ item.couponInfo.title }}</text>
|
||||||
<text class="num">x{{ item.num }}</text>
|
<text class="num">x{{ item.num }}</text>
|
||||||
@@ -507,6 +507,7 @@ function close() {
|
|||||||
outline: none;
|
outline: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
&:active {
|
&:active {
|
||||||
background: #f07080; // 点击深色反馈
|
background: #f07080; // 点击深色反馈
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,260 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- 支付方式 -->
|
|
||||||
<view class="paymentMethod">
|
|
||||||
<view class="paymentMethod_content">
|
|
||||||
<view class="paymentMethod_title">支付方式</view>
|
|
||||||
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChanges" :size="28"
|
|
||||||
placement="column">
|
|
||||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
|
||||||
<view class="method_list" @click="groupChanges(item.type)" :class="{disabled:returnDisabled(item)}"
|
|
||||||
v-if="(index+1) == radiovalue?!changeFreeenable:true">
|
|
||||||
<view class="method_list_top">
|
|
||||||
<view class="method_list_top_left">
|
|
||||||
<image class="icon" :src="item.url" mode="aspectFill" />
|
|
||||||
<view class="method_list_top_cen">
|
|
||||||
<view class="name"> {{ item.name }} </view>
|
|
||||||
<view class="method_list_bom" v-if="item.type == 1">
|
|
||||||
<text class="balance">
|
|
||||||
当前余额¥{{orderVIP?(orderVIP.amount||0):0}}</text>
|
|
||||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<up-radio :disabled="returnDisabled(item)" activeColor="#E8AD7B" icon-size="18" size="18" :name="item.type">
|
|
||||||
</up-radio>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</up-radio-group>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
ref,
|
|
||||||
reactive,
|
|
||||||
defineProps,
|
|
||||||
computed,
|
|
||||||
defineEmits,
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
defineExpose
|
|
||||||
} from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
rechargeFreeChecked: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
payAmount: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
freeCheck: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
changeFreeenable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
disablePayType: {
|
|
||||||
type: Array,
|
|
||||||
default: () => {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function returnDisabled(item) {
|
|
||||||
if (props.disablePayType.includes(item.name)) {
|
|
||||||
return true
|
|
||||||
}else{
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const orderVIP = ref(null)
|
|
||||||
const emits = defineEmits(['customevent', 'groupChange']);
|
|
||||||
watchEffect(() => {
|
|
||||||
orderVIP.value = uni.cache.get('orderVIP')
|
|
||||||
})
|
|
||||||
|
|
||||||
const orderVIPfun = (data) => {
|
|
||||||
orderVIP.value = data
|
|
||||||
}
|
|
||||||
|
|
||||||
const paymentMethodList = ref([
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
{
|
|
||||||
name: "微信支付",
|
|
||||||
type: 2,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
|
||||||
payType: 'wechatPay'
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
// #ifdef MP-ALIPAY
|
|
||||||
{
|
|
||||||
name: "支付宝支付",
|
|
||||||
type: 3,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
|
||||||
payType: 'aliPay'
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
{
|
|
||||||
name: "余额支付",
|
|
||||||
type: 1,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
|
||||||
payType: 'accountPay'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
const paymentMethodName = ref([{
|
|
||||||
name: "余额支付",
|
|
||||||
type: 1,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
|
||||||
payType: 'accountPay'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "微信支付",
|
|
||||||
type: 2,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
|
||||||
payType: 'wechatPay'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "支付宝支付",
|
|
||||||
type: 3,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
|
||||||
payType: 'aliPay'
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
const radiovalue = ref(2) // 支付方式
|
|
||||||
|
|
||||||
const ispws = ref(false) // 输入支付密码
|
|
||||||
|
|
||||||
const storeInfo = ref({})
|
|
||||||
|
|
||||||
// * 监听支付方式切换
|
|
||||||
const groupChanges = (type) => {
|
|
||||||
if (props.freeCheck && type == 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const item=paymentMethodList.value.find(v=>v.type==type)
|
|
||||||
if(item&&returnDisabled(item)){
|
|
||||||
uni.showToast({
|
|
||||||
title:"当前支付方式不可用",
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// if (props.payAmount <= 0 && type != 1) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
radiovalue.value = type;
|
|
||||||
let name = paymentMethodName.value[type - 1].name;
|
|
||||||
|
|
||||||
emits("groupChange", paymentMethodName.value[type - 1])
|
|
||||||
}
|
|
||||||
|
|
||||||
// 去充值
|
|
||||||
const goRecharge = () => {
|
|
||||||
if (orderVIP.value.isVip) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/user/member/czzx?shopId=' + orderVIP.value.shopId
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/user/vip/buy-vip?shopId=' + orderVIP.value.shopId
|
|
||||||
})
|
|
||||||
|
|
||||||
// uni.pro.navigateTo('user/member/index', {
|
|
||||||
// shopId: orderVIP.value.shopId
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
// 将方法暴露给父组件
|
|
||||||
defineExpose({
|
|
||||||
groupChanges,
|
|
||||||
orderVIPfun
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.paymentMethod {
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-top: 30rpx;
|
|
||||||
border-radius: 18rpx;
|
|
||||||
|
|
||||||
.paymentMethod_content {
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 22rpx;
|
|
||||||
padding: 30rpx 30rpx 0 30rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
.paymentMethod_title {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.method_list {
|
|
||||||
padding: 40rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
&.disabled{
|
|
||||||
opacity: .6;
|
|
||||||
}
|
|
||||||
.method_list_top {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.method_list_top_left {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 54.67rpx !important;
|
|
||||||
height: 48rpx !important;
|
|
||||||
margin-right: 22rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.method_list_top_cen {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.method_list_bom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.balance {
|
|
||||||
margin-right: 20rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topUpNow {
|
|
||||||
color: #FF803D;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.method_list:nth-child(odd) {
|
|
||||||
border-bottom: 2rpx solid #e5e5e5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<view class="name"> {{ item.name }} </view>
|
<view class="name"> {{ item.name }} </view>
|
||||||
<view class="method_list_bom" v-if="item.name == '余额支付'">
|
<view class="method_list_bom" v-if="item.name == '余额支付'">
|
||||||
<text class="balance">
|
<text class="balance">
|
||||||
当前余额¥{{ orderVIP ? orderVIP.amount || 0 : 0 }}</text>
|
当前余额¥{{ shopUserInfo ? shopUserInfo.amount || 0 : 0 }}</text>
|
||||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -66,6 +66,14 @@ const props = defineProps({
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
shopUserInfo:{
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return{
|
||||||
|
amount:0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 工具函数 - 深拷贝对象(切断引用)
|
// 工具函数 - 深拷贝对象(切断引用)
|
||||||
@@ -77,15 +85,10 @@ function returnDisabled(item) {
|
|||||||
return props.disablePayType.includes(item.name);
|
return props.disablePayType.includes(item.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderVIP = ref(null);
|
|
||||||
const emits = defineEmits(["customevent", "groupChange"]);
|
const emits = defineEmits(["customevent", "groupChange"]);
|
||||||
watchEffect(() => {
|
|
||||||
orderVIP.value = uni.cache.get("orderVIP");
|
|
||||||
});
|
|
||||||
|
|
||||||
const orderVIPfun = (data) => {
|
|
||||||
orderVIP.value = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 支付方式列表(保持不变)
|
// 支付方式列表(保持不变)
|
||||||
const paymentMethodList = ref([
|
const paymentMethodList = ref([
|
||||||
@@ -207,13 +210,12 @@ const goRecharge = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/user/member/czzx?shopId=${orderVIP.value?.shopId || ''}`,
|
url: `/pages/user/member/czzx?shopId=${props.shopUserInfo?.shopId || ''}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
groupChanges,
|
groupChanges,
|
||||||
orderVIPfun,
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@
|
|||||||
style="align-items: baseline; justify-content: flex-end"
|
style="align-items: baseline; justify-content: flex-end"
|
||||||
>
|
>
|
||||||
<text class="color-666 font-12"> 总计:</text>
|
<text class="color-666 font-12"> 总计:</text>
|
||||||
<text class="font-16 color-333 font-700" v-if="centerUserInfo">
|
<text class="font-16 color-333 font-700" >
|
||||||
{{ centerUserInfo.totalIncome }}</text
|
{{ totalIncome }}</text
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -113,6 +113,7 @@
|
|||||||
<scroll-view
|
<scroll-view
|
||||||
class="popup-list"
|
class="popup-list"
|
||||||
direction="vertical"
|
direction="vertical"
|
||||||
|
:scroll-y="true"
|
||||||
@scrollend="scrollBottom"
|
@scrollend="scrollBottom"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
@@ -301,6 +302,7 @@ async function centerUser() {
|
|||||||
}
|
}
|
||||||
onShow(() => {});
|
onShow(() => {});
|
||||||
|
|
||||||
|
|
||||||
onLoad(async (opt) => {
|
onLoad(async (opt) => {
|
||||||
await getCouponShopsAjax();
|
await getCouponShopsAjax();
|
||||||
|
|
||||||
@@ -314,13 +316,24 @@ onLoad(async (opt) => {
|
|||||||
}
|
}
|
||||||
if (opt.shopId) {
|
if (opt.shopId) {
|
||||||
querForm.value.shopId = opt.shopId;
|
querForm.value.shopId = opt.shopId;
|
||||||
const findItem = couponShops.value.find((item) => item.id == opt.shopId);
|
const findItem = shopList.value.find((item) => item.shopId == opt.shopId);
|
||||||
querForm.value.shopName = findItem.shopName || "";
|
querForm.value.shopName = findItem.shopName || "";
|
||||||
}
|
}
|
||||||
centerUser();
|
centerUser();
|
||||||
getIncomeDetailsAjax();
|
getIncomeDetailsAjax();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const totalIncome=computed(()=>{
|
||||||
|
if(!querForm.value.shopId){
|
||||||
|
return centerUserInfo.value?(centerUserInfo.value.totalIncome||0):0;
|
||||||
|
}
|
||||||
|
const findItem = shopList.value.find((item) => item.shopId == querForm.value.shopId );
|
||||||
|
if(findItem){
|
||||||
|
return findItem.income||0
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => querForm.value.status,
|
() => querForm.value.status,
|
||||||
(newVal, oldVal) => {
|
(newVal, oldVal) => {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@
|
|||||||
</rechargeFree>
|
</rechargeFree>
|
||||||
|
|
||||||
<!-- 支付方式 -->
|
<!-- 支付方式 -->
|
||||||
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
|
<paymentMethodes ref="paymentMethodref" :shopUserInfo="orderVIP" @groupChange="groupChange"
|
||||||
:disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod"
|
:disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod"
|
||||||
v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
@@ -203,6 +203,7 @@
|
|||||||
useWebSocket
|
useWebSocket
|
||||||
} from "@/stores/carts-websocket.js";
|
} from "@/stores/carts-websocket.js";
|
||||||
import * as chatApi from "@/http/php/chat";
|
import * as chatApi from "@/http/php/chat";
|
||||||
|
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||||
|
|
||||||
import MsgListItem from '@/components/msg-list-item/msg-list-item.vue'
|
import MsgListItem from '@/components/msg-list-item/msg-list-item.vue'
|
||||||
|
|
||||||
@@ -858,8 +859,6 @@
|
|||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
const shopUserInfo = uni.cache.get("shopUserInfo");
|
const shopUserInfo = uni.cache.get("shopUserInfo");
|
||||||
console.log("shopUserInfo", shopUserInfo);
|
|
||||||
console.log("listinfo", listinfo);
|
|
||||||
if (shopUserInfo) {
|
if (shopUserInfo) {
|
||||||
if (shopUserInfo.userId == listinfo.userId) {
|
if (shopUserInfo.userId == listinfo.userId) {
|
||||||
pay_unlock();
|
pay_unlock();
|
||||||
@@ -1011,7 +1010,6 @@
|
|||||||
// 更新数据
|
// 更新数据
|
||||||
if (orderVIP.value) {
|
if (orderVIP.value) {
|
||||||
orderVIP.value = uni.cache.get("orderVIP");
|
orderVIP.value = uni.cache.get("orderVIP");
|
||||||
paymentMethodref.value.orderVIPfun(uni.cache.get("orderVIP"));
|
|
||||||
if (listinfo.id && ordershopUserInfo.value.registerType != "before") {
|
if (listinfo.id && ordershopUserInfo.value.registerType != "before") {
|
||||||
orderorderInfo();
|
orderorderInfo();
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1032,7 @@
|
|||||||
console.log("跳转到加菜页面");
|
console.log("跳转到加菜页面");
|
||||||
const arr= getCurrentPages()
|
const arr= getCurrentPages()
|
||||||
console.log(arr);
|
console.log(arr);
|
||||||
if(arr[arr.length-1]&&arr[arr.length-1].route=='pages/product/index'){
|
if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
|
||||||
back();
|
back();
|
||||||
}else{
|
}else{
|
||||||
uni.cache.set('tableCode',listinfo.tableCode)
|
uni.cache.set('tableCode',listinfo.tableCode)
|
||||||
@@ -1113,10 +1111,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const limitTimeDiscountRes = ref(null)
|
const limitTimeDiscountRes = ref(null)
|
||||||
|
const rechargeConfig=ref(null)
|
||||||
async function init(opt) {
|
async function init(opt) {
|
||||||
await storeuser.actionsproductqueryProduct();
|
const res1= await storeuser.actionsproductqueryProduct();
|
||||||
|
orderVIP.value=res1
|
||||||
console.log("init");
|
console.log('orderVIP',orderVIP.value)
|
||||||
cartStore.clearOrderConfig();
|
cartStore.clearOrderConfig();
|
||||||
Object.assign(options, opt);
|
Object.assign(options, opt);
|
||||||
listinfo.id = options.orderId;
|
listinfo.id = options.orderId;
|
||||||
@@ -1146,10 +1145,23 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取台桌信息
|
||||||
|
let tableRes = await getTableInfo({
|
||||||
|
tableCode: options.tableCode || "",
|
||||||
|
});
|
||||||
|
console.log("tableRes", tableRes);
|
||||||
|
listinfo.tableName = tableRes?tableRes.name:'';
|
||||||
|
|
||||||
//获取店铺信息
|
//获取店铺信息
|
||||||
const shopInfoRes = await APIusershopInfodetail({
|
const shopInfoRes = await APIusershopInfodetail({
|
||||||
shopId: options.shopId,
|
shopId: options.shopId,
|
||||||
});
|
});
|
||||||
|
//智慧充值
|
||||||
|
const rechargeConfigRes=await rechargeApi.config({shopId: options.shopId})
|
||||||
|
if(rechargeConfigRes&&typeof rechargeConfigRes ==='object'){
|
||||||
|
rechargeConfig.value=rechargeConfigRes
|
||||||
|
}
|
||||||
//获取积分配置
|
//获取积分配置
|
||||||
pointsApi.pointsConfig().then(res => {
|
pointsApi.pointsConfig().then(res => {
|
||||||
cartStore.setPointDeductionRule(res);
|
cartStore.setPointDeductionRule(res);
|
||||||
@@ -1274,6 +1286,9 @@
|
|||||||
if (!isCanUseCharge.value) {
|
if (!isCanUseCharge.value) {
|
||||||
arr.add("余额支付");
|
arr.add("余额支付");
|
||||||
}
|
}
|
||||||
|
if(rechargeConfig.value&&!rechargeConfig.value.isEnable){
|
||||||
|
arr.add("余额支付");
|
||||||
|
}
|
||||||
|
|
||||||
return Array.from(arr);
|
return Array.from(arr);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -583,7 +583,6 @@
|
|||||||
console.log(uni.cache.get('orderVIP'))
|
console.log(uni.cache.get('orderVIP'))
|
||||||
orderVIP.value = uni.cache.get('orderVIP')
|
orderVIP.value = uni.cache.get('orderVIP')
|
||||||
ordershopUserInfo.value = orderVIP.value.shopInfo
|
ordershopUserInfo.value = orderVIP.value.shopInfo
|
||||||
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
|
|
||||||
if (orderId.value) {
|
if (orderId.value) {
|
||||||
orderorderInfo()
|
orderorderInfo()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1685,11 +1685,10 @@
|
|||||||
// 返回商品对应sku数据
|
// 返回商品对应sku数据
|
||||||
|
|
||||||
function cartInit(arr) {
|
function cartInit(arr) {
|
||||||
|
|
||||||
const result = []
|
const result = []
|
||||||
console.log('cartInitArr', arr);
|
|
||||||
console.log('allGoodsArr', allGoodsArr);
|
|
||||||
cartStore.carts = arr.map(v => {
|
cartStore.carts = arr.map(v => {
|
||||||
const goods = allGoodsArr.find(g => g.id == v.product_id)
|
const goods = cartStore.allGoodsArr.find(g => g.id == v.product_id)
|
||||||
const goodsSkuList = goods ? goods.skuList : []
|
const goodsSkuList = goods ? goods.skuList : []
|
||||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||||
@@ -1699,6 +1698,13 @@
|
|||||||
}, cartStore.limitTimeDiscount, shopInfo,
|
}, cartStore.limitTimeDiscount, shopInfo,
|
||||||
shopUserInfo.value, 'product_id');
|
shopUserInfo.value, 'product_id');
|
||||||
if (!goods) {
|
if (!goods) {
|
||||||
|
console.log('删除未匹配到的商品', {
|
||||||
|
id: v.id,
|
||||||
|
operate_type: "del",
|
||||||
|
table_code: uni.cache.get('tableCode'),
|
||||||
|
shop_id: uni.cache.get('shopId'),
|
||||||
|
type: "shopping",
|
||||||
|
})
|
||||||
useSocket.sendMessage({
|
useSocket.sendMessage({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
operate_type: "del",
|
operate_type: "del",
|
||||||
@@ -1747,7 +1753,7 @@
|
|||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log('product index 收到消息', Message);
|
|
||||||
// 检查消息是否已经处理过
|
// 检查消息是否已经处理过
|
||||||
if (processedMessageIds.has(Message.msg_id)) {
|
if (processedMessageIds.has(Message.msg_id)) {
|
||||||
return;
|
return;
|
||||||
@@ -2184,11 +2190,11 @@
|
|||||||
}
|
}
|
||||||
return currentTime >= startTime && currentTime <= endTime;
|
return currentTime >= startTime && currentTime <= endTime;
|
||||||
});
|
});
|
||||||
let allGoodsArr = []
|
const allGoodsArr = ref([])
|
||||||
// 列表请求
|
// 列表请求
|
||||||
const productqueryProduct = async () => {
|
const productqueryProduct = async () => {
|
||||||
cartStore.goodsIsloading = false;
|
cartStore.goodsIsloading = false;
|
||||||
allGoodsArr = []
|
allGoodsArr.value=[]
|
||||||
try {
|
try {
|
||||||
shopProductList.hots = await productminiApphotsquery();
|
shopProductList.hots = await productminiApphotsquery();
|
||||||
shopProductList.productInfo = await APIgroupquery();
|
shopProductList.productInfo = await APIgroupquery();
|
||||||
@@ -2200,38 +2206,46 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.pro.switchTab('index/index');
|
uni.pro.switchTab('index/index');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
return; // 出错直接返回,避免后续逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||||
//TODO handle the exception
|
// 第一步:处理productInfo(替换forEach为for...of,支持await)
|
||||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
for (const group of shopProductList.productInfo) {
|
||||||
shopProductList.productInfo.forEach((group) => {
|
for (const product of group.productList) {
|
||||||
group.productList.forEach(async (product) => {
|
product.cartNumber = 0;
|
||||||
product.isSaleTimeshow = await isProductAvailable(product.days, product
|
// 等待异步函数执行完成后,再push
|
||||||
.startTime, product.endTime);
|
product.isSaleTimeshow = await isProductAvailable(
|
||||||
|
product.days,
|
||||||
allGoodsArr.push(product)
|
product.startTime,
|
||||||
|
product.endTime
|
||||||
|
);
|
||||||
|
allGoodsArr.value.push(product);
|
||||||
cartStore.setGoodsMap(product.id, product);
|
cartStore.setGoodsMap(product.id, product);
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
shopProductList.hots.forEach(async (i) => {
|
|
||||||
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
|
||||||
allGoodsArr.push(i)
|
|
||||||
cartStore.setGoodsMap(i.id, i);
|
|
||||||
});
|
|
||||||
console.log('shopProductList', shopProductList);
|
|
||||||
|
|
||||||
|
// 第二步:处理hots(同理替换forEach为for...of)
|
||||||
|
for (const i of shopProductList.hots) {
|
||||||
|
i.cartNumber = 0;
|
||||||
|
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
||||||
|
allGoodsArr.value.push(i);
|
||||||
|
cartStore.setGoodsMap(i.id, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 此时所有异步操作完成,allGoodsArr已有数据
|
||||||
|
// console.log('allGoodsArr', allGoodsArr);
|
||||||
|
// console.log('shopProductList', shopProductList);
|
||||||
|
console.log('cartStore.carts', cartStore.carts)
|
||||||
|
cartStore.allGoodsArr=allGoodsArr.value
|
||||||
if (cartStore.carts.length > 0) {
|
if (cartStore.carts.length > 0) {
|
||||||
cartInit(cartStore.carts)
|
cartInit(cartStore.carts);
|
||||||
}
|
}
|
||||||
|
|
||||||
cartStore.goodsIsloading = true;
|
cartStore.goodsIsloading = true;
|
||||||
scrollTopSize.value = 0;
|
scrollTopSize.value = 0;
|
||||||
topArr.value = [];
|
topArr.value = [];
|
||||||
// userStore.actionsAPIuser()
|
|
||||||
// 数据可以更新
|
|
||||||
isDataLoaded.value = true;
|
isDataLoaded.value = true;
|
||||||
// 历史订单
|
|
||||||
Historicalorders();
|
Historicalorders();
|
||||||
updateProductQuantities();
|
updateProductQuantities();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
<text v-if="item.bizCode == 'cashback'">
|
<text v-if="item.bizCode == 'cashback'">
|
||||||
消费返现
|
消费返现
|
||||||
</text>
|
</text>
|
||||||
|
<text v-if="item.bizCode == 'cashback_refund'">
|
||||||
|
消费返现扣减
|
||||||
|
</text>
|
||||||
<text v-if="item.bizCode == 'freeIn'">
|
<text v-if="item.bizCode == 'freeIn'">
|
||||||
霸王餐充值
|
霸王餐充值
|
||||||
</text>
|
</text>
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ export const useCartsStore = defineStore("cart", () => {
|
|||||||
);
|
);
|
||||||
//用户信息
|
//用户信息
|
||||||
const shopUserInfo = ref(uni.cache.get("shopUserInfo") || {});
|
const shopUserInfo = ref(uni.cache.get("shopUserInfo") || {});
|
||||||
|
|
||||||
|
//全部的商品列表
|
||||||
|
const allGoodsArr=ref([])
|
||||||
|
|
||||||
const consumeDiscount = ref({});
|
const consumeDiscount = ref({});
|
||||||
|
|
||||||
@@ -754,6 +757,6 @@ export const useCartsStore = defineStore("cart", () => {
|
|||||||
//限时折扣
|
//限时折扣
|
||||||
limitTimeDiscount,
|
limitTimeDiscount,
|
||||||
shopUserInfo,
|
shopUserInfo,
|
||||||
socketSendMsg,
|
socketSendMsg,allGoodsArr
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -716,9 +716,10 @@
|
|||||||
const index = item.packageInfo.tieredDiscount.findIndex(v => v.peopleNum==nowStep.value.peopleNum)
|
const index = item.packageInfo.tieredDiscount.findIndex(v => v.peopleNum==nowStep.value.peopleNum)
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
const percent= (index + 1) / item.packageInfo.tieredDiscount.length * 100
|
const percent= (index + 1) / item.packageInfo.tieredDiscount.length * 100
|
||||||
return percent>=100?100:0;
|
return percent>=100?100:percent;
|
||||||
|
}else{
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
})
|
})
|
||||||
const nowPrice = computed(() => {
|
const nowPrice = computed(() => {
|
||||||
if (!item.packageInfo) {
|
if (!item.packageInfo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user