购物车,订单,霸王餐

This commit is contained in:
wwz 2025-03-20 18:33:21 +08:00
parent 9da31e2faa
commit 5b8100aa64
16 changed files with 1382 additions and 1224 deletions

View File

@ -32,7 +32,8 @@ export const APIhistoryOrder = (data) => {
return request({ return request({
url: url + '/user/order/historyOrder', url: url + '/user/order/historyOrder',
method: 'get', method: 'get',
data: data data: data,
toast: false
}) })
} }

View File

@ -312,6 +312,10 @@ const useWebSocket = (options = {}) => {
// 页面显示,尝试连接 WebSocket // 页面显示,尝试连接 WebSocket
const onShowconnect = () => { const onShowconnect = () => {
if (autoReconnect.value) { if (autoReconnect.value) {
uni.showLoading({
title: `尝试再次连接`,
mask: true
})
connect(); connect();
} }
} }

View File

@ -3,10 +3,10 @@
<view class="paymentMethod"> <view class="paymentMethod">
<view class="paymentMethod_content"> <view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view> <view class="paymentMethod_title">支付方式</view>
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28" <up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChanges" :size="28"
placement="column"> placement="column">
<block v-for="(item,index) in paymentMethodList" :key="index"> <block v-for="(item,index) in paymentMethodList" :key="index">
<view class="method_list" @click="groupChange(item.type)"> <view class="method_list" @click="groupChanges(item.type)" v-if="index == 0?!changeFreeenable:true">
<view class="method_list_top"> <view class="method_list_top">
<view class="method_list_top_left"> <view class="method_list_top_left">
<image class="icon" :src="item.url" mode="aspectFill" /> <image class="icon" :src="item.url" mode="aspectFill" />
@ -38,7 +38,8 @@
computed, computed,
defineEmits, defineEmits,
watch, watch,
watchEffect watchEffect,
defineExpose
} from 'vue' } from 'vue'
const props = defineProps({ const props = defineProps({
@ -53,10 +54,15 @@
freeCheck: { freeCheck: {
type: Boolean, type: Boolean,
default: false default: false
},
changeFreeenable: {
type: Boolean,
default: false
} }
}); });
const orderVIP = ref(uni.cache.get('orderVIP')) const orderVIP = ref(uni.cache.get('orderVIP'))
const emits = defineEmits(['customevent', 'groupChange']); const emits = defineEmits(['customevent', 'groupChange']);
@ -113,7 +119,7 @@
const storeInfo = ref({}) const storeInfo = ref({})
// * // *
const groupChange = (type) => { const groupChanges = (type) => {
if (props.freeCheck && type == 1) { if (props.freeCheck && type == 1) {
return; return;
} }
@ -132,6 +138,10 @@
shopId: orderVIP.value.shopId shopId: orderVIP.value.shopId
}) })
} }
//
defineExpose({
groupChanges
});
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -171,7 +171,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="cell-item" <!-- <view class="cell-item"
v-if="listinfo && listinfo.pointsDiscountAmount && listinfo.pointsDiscountAmount > 0"> v-if="listinfo && listinfo.pointsDiscountAmount && listinfo.pointsDiscountAmount > 0">
<view class="label">积分抵扣</view> <view class="label">积分抵扣</view>
<view class="val"> <view class="val">
@ -179,7 +179,7 @@
<view style="font-size: 28rpx;"></view> <view style="font-size: 28rpx;"></view>
<view>{{listinfo.pointsDiscountAmount.toFixed(2)}}</view> <view>{{listinfo.pointsDiscountAmount.toFixed(2)}}</view>
</view> </view>
</view> </view> -->
</block> </block>
<view class="total-wrap"> <view class="total-wrap">
@ -193,7 +193,7 @@
<view class="row" @click="copyHandle(listinfo.orderNo)"> <view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单编号</text> <text class="t">订单编号</text>
<text class="info" <text class="info"
style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{listinfo.orderNo}}点击复制</text> style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{listinfo.orderNo}}(点击复制)</text>
</view> </view>
<view class="row"> <view class="row">
<text class="t">下单时间</text> <text class="t">下单时间</text>
@ -316,7 +316,12 @@
default: { default: {
isTableFee: 0 isTableFee: 0
} }
},
changeFreeenable: {
type: Boolean,
default: false
} }
}) })
const is_type = ref(0) const is_type = ref(0)
@ -337,8 +342,23 @@
} }
//
const bwcclear = () => {
IntegralInputclose()
//
favorablelist[1].value = ''
favorablelist[0].value = ''
}
// //
const goUrl = (item) => { const goUrl = (item) => {
if (props.changeFreeenable) {
uni.showToast({
title: '不可与其他优惠共享!',
icon: 'none'
})
return false;
}
switch (item.type) { switch (item.type) {
case 'coupon': case 'coupon':
// //
@ -433,7 +453,8 @@
// //
defineExpose({ defineExpose({
dataprocessing, dataprocessing,
getCalcUsablePoints getCalcUsablePoints,
bwcclear
}); });
</script> </script>
@ -701,6 +722,7 @@
} }
.shop-info { .shop-info {
padding-top: 28rpx;
border-bottom: 2rpx dashed #e5e5e5; border-bottom: 2rpx dashed #e5e5e5;
.item:nth-child(1) { .item:nth-child(1) {

View File

@ -4,99 +4,84 @@
<view class="rechargeFree_bg" @click="changeFree"> <view class="rechargeFree_bg" @click="changeFree">
<view class="left"> <view class="left">
<view class="icon">优惠</view> <view class="icon">优惠</view>
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}订单满{{freeDingConfig.rechargeThreshold}}元可用本单立享免单</view> <view class="text">
充值消费{{freeDineConfig.rechargeTimes}}订单满{{freeDineConfig.rechargeThreshold}}元可用本单立享免单</view>
</view> </view>
<u-checkbox-group iconPlacement="right" > <up-checkbox :disabled="!freeDineConfig.enable" @change="change" shape="circle" usedAlone v-model:checked="changeFreeenable" icon-size="20" size="20">
<u-checkbox :disabled="freeDisabled" v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36"> </up-checkbox>
</u-checkbox> <!-- <up-checkbox-group iconPlacement="right">
</u-checkbox-group> <up-checkbox : v-model="changeFreeenable"
:checked="freeDineConfig.enable" @change="change" activeColor="#E8AD7B" shape="circle"
icon-size="16" size="16">
</up-checkbox>
</up-checkbox-group> -->
</view> </view>
</view> </view>
</template> </template>
<script> <script setup>
export default { import {
data() { ref,
return { defineProps,
freeDisabled: false, defineEmits
} } from 'vue';
},
props:{
shopUserInfo:{
type: Object
},
freeDingConfig:{
type: Object
},
payAmount: {
type: Number
},
rechargeFreeChecked: {
type: Boolean
},
//
const props = defineProps({
freeDineConfig: {
type: Object,
default: {}
}, },
watch: { payAmount: {
payAmount (newVal) { type: Number,
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) { default: 0
this.freeDisabled = true
} else {
this.freeDisabled = false
}
}
}, },
mounted() { });
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
} else {
this.freeDisabled = false
}
console.log(this.freeDisabled )
},
methods: {
/** const emits = defineEmits(['changeFree']);
* 监听是否免单
*/ const changeFreeenable = ref(false)
changeFree ( e ) {
if ( this.freeDisabled ) { /**
return; * 监听是否免单
} */
this.$emit("changeFree",this.rechargeFreeChecked) const change = (e) => {
} emits('changeFree', e);
}
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
// .rechargeFree {
.rechargeFree{
// padding: 0 20rpx; // padding: 0 20rpx;
margin-top: 32rpx; margin-top: 32rpx;
.rechargeFree_bg{
.rechargeFree_bg {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-radius: 24rpx; border-radius: 24rpx;
background-color: #fff; background-color: #fff;
.left{
.left {
display: flex; display: flex;
align-items: center; align-items: center;
.icon{
.icon {
width: 68rpx; width: 68rpx;
height: 36rpx; height: 36rpx;
text-align: center; text-align: center;
line-height: 36rpx; line-height: 36rpx;
background: linear-gradient( 180deg, #FEDE81 0%, #FEB263 100%); background: linear-gradient(180deg, #FEDE81 0%, #FEB263 100%);
border-radius: 12rpx 0rpx 12rpx 0rpx; border-radius: 12rpx 0rpx 12rpx 0rpx;
font-weight: 500; font-weight: 500;
font-size: 20rpx; font-size: 20rpx;
color: #FFFFFF; color: #FFFFFF;
margin-right: 12rpx; margin-right: 12rpx;
} }
.text{
width: 90%; .text {
width: 80%;
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
@ -104,5 +89,4 @@
} }
} }
} }
</style> </style>

View File

@ -80,6 +80,7 @@
ref, ref,
reactive, reactive,
onMounted, onMounted,
computed
} from 'vue'; } from 'vue';
import { import {
onLoad, onLoad,
@ -113,7 +114,7 @@
// 使 // 使
const navigatorGo = (item) => { const navigatorGo = (item) => {
console.log(Orderinfo.payAmount, item) // console.log(Orderinfo.payAmount, item)
if (Orderinfo.payAmount < item.fullAmount) { if (Orderinfo.payAmount < item.fullAmount) {
uni.showToast({ uni.showToast({
title: "当前订单金额不足使用金额", title: "当前订单金额不足使用金额",
@ -138,6 +139,23 @@
}); });
} }
// num
const mergedArray = computed(() => {
const map = new Map();
Orderinfo.shoppingCart.forEach(item => {
if (map.has(item.productId)) {
const existingItem = map.get(item.productId);
existingItem.num += item.num;
} else {
map.set(item.productId, {
...item
});
}
});
return Array.from(map.values());
});
const Selectedlist = ref([]) const Selectedlist = ref([])
// //
@ -146,12 +164,31 @@
if (!item.show) { if (!item.show) {
return false; return false;
} }
console.log(Orderinfo.shoppingCart) // id
if (Orderinfo.shoppingCart.length < Selectedlist.value.length) { const count = Selectedlist.value.filter(item => item.id === item.id).length;
// id
const foundObject = mergedArray.value.find(i => i.productId === item.proId)
if (foundObject.num <= count) {
uni.showToast({ uni.showToast({
title: '不可多余下单参数哦!' title: '不可多余商品!',
icon: 'none'
}) })
return false;
} }
// id
console.log(mergedArray.value)
console.log(item)
console.log(Selectedlist.value)
console.log(Orderinfo.shoppingCart)
// if (Orderinfo.shoppingCart.length <= Selectedlist.value.length) {
// uni.showToast({
// title: '!',
// icon:'none'
// })
// return false;
// }
if (item.Selected) { if (item.Selected) {
Selectedlist.value = Selectedlist.value.filter(i => i.id !== item.id) Selectedlist.value = Selectedlist.value.filter(i => i.id !== item.id)
@ -251,15 +288,12 @@
}; };
}); });
} }
console.log(res)
if (res.length > 0) { if (res.length > 0) {
fromInfo.list = res fromInfo.list = res
} else { } else {
fromInfo.list = [] fromInfo.list = []
return false return false
} }
console.log(res)
} }
// //
const cancelCoupon = () => { const cancelCoupon = () => {
@ -296,12 +330,8 @@
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: Orderinfo.typeOrder == 2 ? '商品卷' : '优惠卷', title: Orderinfo.typeOrder == 2 ? '商品卷' : '优惠卷',
success: () => { success: () => {},
console.log('导航栏标题修改成功'); fail: (err) => {}
},
fail: (err) => {
console.error('导航栏标题修改失败', err);
}
}); });
Orderinfo.shopUserId = options.shopUserId Orderinfo.shopUserId = options.shopUserId

View File

@ -36,39 +36,18 @@
<!-- x详情 --> <!-- x详情 -->
<orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck" <orderInfoAfter ref="orderInfoAfterRef" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck"
:listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype" :listinfo="listinfo" :orderVIP="orderVIP" :ordershopUserInfo='ordershopUserInfo' @istype="istype"
@clickPointsamount='clickPointsamount' @learcoupons="learcoupons"> @clickPointsamount='clickPointsamount' @learcoupons="learcoupons" :changeFreeenable='changeFreeenable'>
</orderInfoAfter> </orderInfoAfter>
<!-- 充值免单 --> <!-- 霸王餐 -->
<!-- <block v-if="listinfo.useType == 'dine-in-after'"> <rechargeFree :freeDineConfig="orderVIP.freeDineConfig" :payAmount="listinfo.totalPrices"
<rechargeFree v-if="listinfo.status == 'unpaid' && orderVIP.freeDineConfig.enable" @changeFree="changeFree">
:rechargeFreeChecked="rechargeFreeChecked" </rechargeFree>
v-if="listinfo.freeDingConfig&&listinfo.freeDingConfig.enable == 1&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')"
ref="rechargeFree"
:freeDisabled="freeDisabled"
:payAmount="listinfo.payAmount"
:freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="orderVIP" @changeFree="changeFree"></rechargeFree>
</block>
<block v-else>
<rechargeFree
:rechargeFreeChecked="rechargeFreeChecked"
v-if="listinfo.freeDingConfig&&listinfo.freeDingConfig.enable == 1&&(!listinfo.couponInfoList&&listinfo.pointsDiscountAmount<=0)&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')"
ref="rechargeFree"
:freeDisabled="freeDisabled"
:payAmount="listinfo.payAmount"
:freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="orderVIP" @changeFree="changeFree"></rechargeFree>
</block> -->
<!-- 支付方式 --> <!-- 支付方式 -->
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange" <paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
v-if="listinfo.status == 'unpaid'"> :changeFreeenable='changeFreeenable' v-if="listinfo.status == 'unpaid'">
</paymentMethodes> </paymentMethodes>
<!-- <paymentMethodes ref="paymentMethodes" :rechargeFreeChecked="rechargeFreeChecked"
v-if="orderVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck"
:payAmount="listinfo.payAmount" :orderVIP="orderVIP" @groupChange="groupChange"></paymentMethodes> -->
<view class="fixedview"> <view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid'"> <view class="flex-between" v-if="listinfo.status == 'unpaid'">
<view class="fixedview_one flex-start"> <view class="fixedview_one flex-start">
@ -77,8 +56,13 @@
<text>¥</text>{{listinfo.totalCost}} <text>¥</text>{{listinfo.totalCost}}
</view> </view>
</view> </view>
<view class="fixedview_tow" @tap="$u.debounce(goToPay,1000)"> <view class="flex-colum-end">
{{paymentmethod.paymentBtnText}} <view class="fixedview_tow" @tap="$u.debounce(istoricalorders,1000)">
{{paymentmethod.paymentBtnText}}
</view>
<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
取消订单
</view> -->
</view> </view>
</view> </view>
</view> </view>
@ -97,11 +81,12 @@
} from 'vue'; } from 'vue';
import { import {
APIgetOrderById APIgetOrderById,
APIputuserorder,
APIhistoryOrder
} from '@/common/api/order/index.js' } from '@/common/api/order/index.js'
import { import {
APIusershopInfodetail,
APIshopUserInfo APIshopUserInfo
} from '@/common/api/member.js' } from '@/common/api/member.js'
@ -131,7 +116,7 @@
import payPassword from '@/components/payPassword.vue' import payPassword from '@/components/payPassword.vue'
import orderInfoAfter from './components/orderInfoAfter.vue' import orderInfoAfter from './components/orderInfoAfter.vue'
// import orderInfoBefore from '../components/orderInfoBefore.vue' // import orderInfoBefore from '../components/orderInfoBefore.vue'
// import rechargeFree from '../components/rechargeFree.vue' import rechargeFree from './components/rechargeFree.vue'
import paymentMethodes from '@/components/paymentMethod.vue'; // import paymentMethodes from '@/components/paymentMethod.vue'; //
import { import {
onBackPress onBackPress
@ -186,13 +171,13 @@
}) })
if (res) { if (res) {
Object.assign(listinfo, res); Object.assign(listinfo, res);
if (listinfo.status == 'unpaid') { // if (listinfo.status == 'unpaid') {
try { // try {
let res = await APIhistoryOrder({ // let res = await APIhistoryOrder({
orderId: orderId.value // orderId: orderId.value
}) // })
} catch (error) {} // } catch (error) {}
} // }
// //
if (listinfo.detailMap) { if (listinfo.detailMap) {
let combinedArray = []; let combinedArray = [];
@ -245,6 +230,13 @@
0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo 0 ? listinfo.Seatcharge : 0) - (listinfo.Productroll || 0) - (listinfo
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0); .coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
listinfo.totalCost = Math.round(sums * 100) / 100; listinfo.totalCost = Math.round(sums * 100) / 100;
//
console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
if (orderVIP.value.freeDineConfig.enable && changeFreeenable.value) {
listinfo.totalCost = (parseFloat(listinfo.totalCost) * parseFloat(orderVIP.value
.freeDineConfig
.rechargeTimes)).toFixed(2)
}
// //
if (listinfo.totalCost && listinfo.status == 'unpaid') { if (listinfo.totalCost && listinfo.status == 'unpaid') {
uni.$u.debounce(memberPointscalcUsablePoints, 500) uni.$u.debounce(memberPointscalcUsablePoints, 500)
@ -256,6 +248,34 @@
} }
}); });
//
const changeFreeenable = ref(false)
const changeFree = (e) => {
console.log(e)
if (e) {
uniqueIds.value = [] // id
listinfo.coupondiscountAmount = 0 //
listinfo.Productroll = 0 //
uniqueIds.value = [] // id
listinfo.coupondiscountAmount = 0 //
//
// #ifdef MP-WEIXIN
paymentMethodref.value.groupChanges(2)
// paymentmethod.radiovalue = 2;
// paymentmethod.paymentBtnText = "";
// paymentmethod.payType = 'wechatPay';
// #endif
// #ifdef MP-ALIPAY
paymentMethodref.value.groupChanges(3)
// paymentmethod.radiovalue = 3;
// paymentmethod.paymentBtnText = "";
// paymentmethod.payType = 'wechatPay';
// #endif
}
changeFreeenable.value = e
}
const saveImage = (url) => { const saveImage = (url) => {
uni.saveImage({ uni.saveImage({
url: url, url: url,
@ -268,6 +288,9 @@
}); });
} }
//
const paymentMethodref = ref(null)
// //
const paymentmethod = reactive({ const paymentmethod = reactive({
radiovalue: 2, radiovalue: 2,
@ -330,8 +353,52 @@
} }
} }
//
const APIputuserorderclick = async () => {
await APIputuserorder(listinfo.id)
uni.navigateBack()
}
const istoricalorders = async () => {
console.log(paymentmethod.payType, '1212')
//
let APIhistoryOrderres = await APIhistoryOrder({
tableCode: listinfo.tableCode
})
//
if (APIhistoryOrderres.detailMap) {
let combinedArray = [];
for (const key in APIhistoryOrderres.detailMap) {
if (APIhistoryOrderres.detailMap.hasOwnProperty(key)) {
let subArray = APIhistoryOrderres.detailMap[key];
combinedArray = [...combinedArray, ...subArray]
}
}
//
if (listinfo.combinedArray.length === combinedArray.length) {
goToPay()
} else {
uni.showToast({
title: '你的订单已更新!',
icon: 'none'
})
orderorderInfo()
}
} else {
uni.showToast({
title: '你的小伙伴已提交订单~',
icon: 'none'
})
setTimeout(() => {
orderorderInfo()
}, 1000)
}
}
// * // *
const goToPay = async () => { const goToPay = async () => {
//
// //
if (paymentmethod.payType == 'accountPay') { if (paymentmethod.payType == 'accountPay') {
if (orderVIP.value.isVip == 0) { if (orderVIP.value.isVip == 0) {
@ -369,34 +436,48 @@
} }
return false return false
} }
let checkOrderPay = { if (orderVIP.value.freeDineConfig.enable && changeFreeenable.value) {
orderId: orderId.value, await storeMemberpay.actionspayltPayVip({
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 : shopId: orderVIP.value.shopId,
0, //使01 shopUserId: orderVIP.value.id,
userAllPack: is_type.value == 0 ? 0 : 1, // orderId: orderId.value,
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, // userAllPack: is_type.value == 0 ? 0 : 1, //
originAmount: listinfo.originAmount, //+ amount: listinfo.totalCost, //
discountRatio: 1, //( ) 1 returnUrl: '', //
discountAmount: 0, // 0 buyerRemark: ''
productCouponDiscountAmount: listinfo.Productroll, //
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //
couponList: uniqueIds.value, //使
orderAmount: listinfo.totalCost, //
roundAmount: 0, //
pointsDiscountAmount: listinfo.pointsDiscountAmount, //(tb_points_basic_setting)
pointsNum: 0, //( enable_deduction使)
remark: '', //
}
try {
await storeMemberpay.actionsltPayOrder({
checkOrderPay,
payType: paymentmethod.payType,
buyerRemark: '',
returnUrl: ''
}) })
} catch (error) { return false;
//TODO handle the exception } else {
let checkOrderPay = {
orderId: orderId.value,
vipPrice: orderVIP.value.isVip == 1 && ordershopUserInfo.value.isMemberPrice == 1 ? 1 :
0, //使01
userAllPack: is_type.value == 0 ? 0 : 1, //
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //
originAmount: listinfo.originAmount, //+
discountRatio: 1, //( ) 1
discountAmount: 0, // 0
productCouponDiscountAmount: listinfo.Productroll, //
fullCouponDiscountAmount: listinfo.coupondiscountAmount, //
couponList: uniqueIds.value, //使
orderAmount: listinfo.totalCost, //
roundAmount: 0, //
pointsDiscountAmount: listinfo.pointsDiscountAmount, //(tb_points_basic_setting)
pointsNum: 0, //( enable_deduction使)
remark: '', //
}
try {
await storeMemberpay.actionsltPayOrder({
checkOrderPay,
payType: paymentmethod.payType,
buyerRemark: '',
returnUrl: ''
})
} catch (error) {
//TODO handle the exception
}
} }
orderorderInfo() orderorderInfo()
} }
@ -906,6 +987,7 @@
left: 0; left: 0;
width: 100%; width: 100%;
// height: 80rpx;
.flex-between { .flex-between {
width: 100%; width: 100%;
padding: 36rpx 54rpx 102rpx 54rpx; padding: 36rpx 54rpx 102rpx 54rpx;
@ -932,14 +1014,26 @@
} }
} }
.fixedview_tow { .flex-colum-end {
background: #E3AD7F; .fixedview_tow {
border-radius: 36rpx; background: #E3AD7F;
font-weight: 400; border-radius: 36rpx;
font-size: 32rpx; font-weight: 400;
color: #FFFFFF; font-size: 32rpx;
padding: 14rpx 44rpx; color: #FFFFFF;
padding: 14rpx 44rpx;
}
.fixedview_tows {
background: #c3c3c3;
border-radius: 36rpx;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
padding: 14rpx 44rpx;
}
} }
} }
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -145,6 +145,7 @@
product_id: item.id, product_id: item.id,
sku_id: item.skuId, sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i), number: await calculateValue(item.cartNumber, i),
is_print: 1,
}) })
} }

View File

@ -2,7 +2,7 @@
<view> <view>
<Nav /> <Nav />
<!-- 顶部面板 --> <!-- 顶部面板 -->
<view class="top--panel"> <view class="top--panel" :class="{ 'grayscale':!isBusinessTime }">
<image class="panelimgbackground" <image class="panelimgbackground"
:src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'" :src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
mode="aspectFill"> mode="aspectFill">
@ -126,7 +126,7 @@
</view> </view>
<!-- 滚动区域 --> <!-- 滚动区域 -->
<view class="scroll-panel" id="scroll-panel"> <view class="scroll-panel" id="scroll-panel" :class="{ 'grayscale':!isBusinessTime }">
<view class="list-box"> <view class="list-box">
<view class="left" :style="{top: `${store.height}px`}"> <view class="left" :style="{top: `${store.height}px`}">
<scroll-view :scroll-into-view="leftIntoView" :scroll-with-animation="false" :scroll-y="true" <scroll-view :scroll-into-view="leftIntoView" :scroll-with-animation="false" :scroll-y="true"
@ -319,7 +319,8 @@
</view> </view>
<view class="operation-wrap"> <view class="operation-wrap">
<view class="btn"> <view class="btn">
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"></up-icon> <up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
v-if="shopCartNumber>0"></up-icon>
<view class="btnClick" @click="shopCart('-')"> <view class="btnClick" @click="shopCart('-')">
</view> </view>
</view> </view>
@ -611,28 +612,35 @@
const selectSpec = async (specType, option) => { const selectSpec = async (specType, option) => {
// //
shopCartNumber.value = 0 shopCartNumber.value = 0
// selectedSpecs // selectedSpecs
selectedSpecs.value = { const newSelectedSpecs = {};
...selectedSpecs.value, const specKeys = Object.keys(specifications.item.selectSpecInfo);
[specType]: option for (const key of specKeys) {
}; if (key === specType) {
if (allSpecsSelected.value) { newSelectedSpecs[key] = option;
try { } else {
let result = await APIminiAppskuinfo({ newSelectedSpecs[key] = selectedSpecs.value[key];
specInfo: selectedSpecsStr.value,
id: specifications.item.id
});
specifications.sku_id = result.id
specifications.product_id = result.productId
//
specifications.item.result = result
if (result.isPauseSale == 0) {
canSubmit.value = true;
// skuBtnText.value = ''
}
} catch (error) {
canSubmit.value = false;
} }
}
selectedSpecs.value = newSelectedSpecs;
if (allSpecsSelected.value) {
// try {
let result = await APIminiAppskuinfo({
specInfo: selectedSpecsStr.value,
id: specifications.item.id
});
specifications.sku_id = result.id
specifications.product_id = result.productId
//
specifications.item.result = result
if (result.isPauseSale == 0) {
canSubmit.value = true;
// skuBtnText.value = ''
}
// } catch (error) {
// canSubmit.value = false;
// }
} else { } else {
canSubmit.value = false; canSubmit.value = false;
} }
@ -691,12 +699,17 @@
return false; return false;
}; };
// //
const allConditionsSatisfied = computed(() => { const allConditionsSatisfied = computed(() => {
return specifications.item.groupSnap.every((setmenu, index) => { // specifications.item.groupSnap
if (!specifications.item?.groupSnap) {
return false;
}
return specifications.item.groupSnap.every((optionGroup, index) => {
//
const selected = selectedOptions.value[index] || []; const selected = selectedOptions.value[index] || [];
// //
const hasEnoughSelection = selected.length === setmenu.number; const hasEnoughSelection = selected.length === optionGroup.number;
return hasEnoughSelection; return hasEnoughSelection;
}); });
}); });
@ -836,7 +849,8 @@
shopCartNumber.value, shopCartNumber.value,
pro_group_info: selectedGroupSnap.value, pro_group_info: selectedGroupSnap.value,
goods_type: specifications.item.type == "package" ? 'package' : '', goods_type: specifications.item.type == "package" ? 'package' : '',
is_print: 1 is_print: 1,
product_type: specifications.item.type
}) })
// //
selectedGroupSnap.value = [] selectedGroupSnap.value = []
@ -884,6 +898,7 @@
// //
const singleclick = async (item, i) => { const singleclick = async (item, i) => {
console.log(item, i)
// //
let res = await matchingProduct(item) let res = await matchingProduct(item)
websocketsendMessage({ websocketsendMessage({
@ -895,7 +910,8 @@
product_id: item.id, product_id: item.id,
sku_id: item.skuId, sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i), number: await calculateValue(item.cartNumber, i),
is_print: 1 is_print: 1,
product_type: item.type
}) })
} }
@ -1017,7 +1033,9 @@
// //
if (Message.operate_type == 'del' && Message.status == 1) { if (Message.operate_type == 'del' && Message.status == 1) {
cartList.value = cartList.value.filter(item => item.id != Message.data.id); // 使
cartList.value = cartList.value.filter(item => item.id !== Message.data?.id);
// cartList.value = cartList.value.filter(item => item.id != Message.data.id);
} }
// //
@ -1084,49 +1102,6 @@
} }
if (cartItem.is_temporary === 1) { if (cartItem.is_temporary === 1) {
return [{ return [{
// cartListId: 5309
// cartListinfo: Proxy {id: 5309, shop_id: 203, table_code: "40309814459", sku_id: 2863, product_id: 1273, }
// cartNumber: "2.00"
// coverImg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/490de935cc9042bfa56d0c392f806484.jpg"
// groupType: null
// id: "1273"
// isHot: 1
// isSaleTime: 1
// isSoldStock: 0
// memberPrice: 0.88
// name: ""
// originPrice: 0.88
// packFee: 0
// salePrice: 2.88
// skuId: "2863"
// skuList: Proxy {0: {}}
// stockNumber: 0
// suitNum: 1
// type: "single"
// unitName: ""
// cartListId: 5324
// cartListinfo: Proxy {id: 5324, shop_id: 203, table_code: "40309814459", sku_id: 0, product_id: -74982031, }
// cartNumber: "25.00"
// create_time: "2025-03-18 15:05:37"
// discount_sale_amount: "357.00"
// discount_sale_note: ""
// id: 5324
// is_gift: 0
// is_print: 0
// is_temporary: 1
// is_wait_call: 0
// number: "25.00"
// pack_number: "0.00"
// pro_group_info: ""
// product_id: -74982031
// product_name: ""
// remark: ""
// shop_id: 203
// sku_id: 0
// sku_name: "VB"
// table_code: "40309814459"
// update_time: null
...cartItem, ...cartItem,
memberPrice: cartItem.discount_sale_amount, memberPrice: cartItem.discount_sale_amount,
salePrice: cartItem.discount_sale_amount, salePrice: cartItem.discount_sale_amount,
@ -1174,7 +1149,7 @@
} }
}, 0); }, 0);
// //
return cart = Math.ceil(cart * 100) / 100; return parseFloat(cart.toFixed(2));
} else { } else {
return 0 return 0
} }
@ -1250,6 +1225,54 @@
})); }));
}) })
// //
// const getCurrentDateTime = () => {
// const now = new Date();
// const dayOfWeek = ['', '', '', '', '', '', ''][now.getDay()];
// const hours = now.getHours().toString().padStart(2, '0');
// const minutes = now.getMinutes().toString().padStart(2, '0');
// const currentTime = `${hours}:${minutes}`;
// return {
// dayOfWeek,
// currentTime
// };
// };
// //
// const isBusinessTime = computed(() => {
// const {
// dayOfWeek,
// currentTime
// } = getCurrentDateTime();
// console.log(shopInfo)
// const [startDay, endDay] = [shopInfo.businessStartDay, shopInfo.businessEndDay];
// const [startTime, endTime] = shopInfo.businessTime.split('-');
// const dayIndex = ['', '', '', '', '', '', ''].indexOf(dayOfWeek);
// const startDayIndex = ['', '', '', '', '', '', ''].indexOf(startDay);
// const endDayIndex = ['', '', '', '', '', '', ''].indexOf(endDay);
// console.log(shopInfo.businessTime, 1111)
// const isInDayRange = dayIndex >= startDayIndex && dayIndex <= endDayIndex;
// const isInTimeRange = currentTime >= startTime && currentTime <= endTime;
// console.log(isInDayRange, isInTimeRange, 1111)
// return isInDayRange && isInTimeRange;
// });
//
const getCurrentTime = () => {
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
return `${hours}:${minutes}`;
};
//
const isBusinessTime = computed(() => {
const currentTime = getCurrentTime();
const [startTime, endTime] = shopInfo.businessTime.split('-');
return currentTime >= startTime && currentTime <= endTime;
});
// //
const productqueryProduct = async () => { const productqueryProduct = async () => {
try { try {
@ -1272,9 +1295,10 @@
// userStore.actionsAPIuser() // userStore.actionsAPIuser()
// //
isDataLoaded.value = true; isDataLoaded.value = true;
} else { } else {
uni.showToast({ uni.showToast({
title: '错误二维码' title: '暂无列表数据...'
}); });
isDataLoaded.value = false; isDataLoaded.value = false;
setTimeout(() => { setTimeout(() => {
@ -1307,20 +1331,6 @@
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];
// //
const options = currentPage.options; const options = currentPage.options;
// // #ifdef MP-WEIXIN
// if (options.q) {
// console.log(options.q)
// const store = productStore();
// await store.scanCodeactions(options.q)
// }
// // #endif
// // #ifdef MP-ALIPAY
// if (getApp().globalData.tableCode) {
// await store.scanCodeactions(getApp().globalData.tableCode)
// }
// // #endif
await productqueryProduct() await productqueryProduct()
setTimeout(() => { setTimeout(() => {
// //
@ -1331,6 +1341,11 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.grayscale {
filter: grayscale(100%);
pointer-events: none;
}
.top--panel { .top--panel {
// padding: 0 20rpx; // padding: 0 20rpx;
background-color: #fff; background-color: #fff;
@ -1920,9 +1935,12 @@
border-bottom: 2rpx solid #F0F0F0; border-bottom: 2rpx solid #F0F0F0;
} }
.shop_sku_box:last-child {
padding-bottom: 60rpx;
}
.shop_sku_box { .shop_sku_box {
padding: 20rpx 28rpx; padding: 20rpx;
.shop_sku_box_name { .shop_sku_box_name {
margin-top: 20rpx; margin-top: 20rpx;

View File

@ -146,7 +146,9 @@
} }
// 使 // 使
const navigatorGo = (item) => {} const navigatorGo = (item) => {
uni.pro.switchTab('index/index')
}
const getCouponList = async () => { const getCouponList = async () => {
let res = await APIcouponfindByUserId({ let res = await APIcouponfindByUserId({

View File

@ -93,7 +93,7 @@
res = await APIshopUserpointsRecord({ res = await APIshopUserpointsRecord({
page: formData.form.page, page: formData.form.page,
size: formData.form.size, size: formData.form.size,
status: formData.status status: formData.form.status
}) })
} }
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) { if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
@ -188,7 +188,7 @@
align-items: center; align-items: center;
color: #333; color: #333;
margin-top: -60rpx; margin-top: -60rpx;
padding: 0 120rpx; // padding: 0 120rpx;
font-size: 28rpx; font-size: 28rpx;
.fonts { .fonts {

View File

@ -110,7 +110,6 @@
import { import {
APIuseractivate, APIuseractivate,
APIusershopInfodetail,
APIshopUserInfo APIshopUserInfo
} from '@/common/api/member.js' } from '@/common/api/member.js'
@ -250,7 +249,7 @@
uni.pro.navigateTo(item.url, { uni.pro.navigateTo(item.url, {
shopId: infoForn.shopId, shopId: infoForn.shopId,
type: item.name == '明细' ? 1 : 2, type: item.name == '明细' ? 1 : 2,
shopInfo: JSON.stringify(infoForn.userInfo.shopInfo) shopInfo: JSON.stringify(infoForn.userInfo)
}) })
// uni.navigateTo({ // uni.navigateTo({
@ -320,7 +319,7 @@
}); });
return false; return false;
} }
console.log({ await store.actionspayltPayVip({
shopId: infoForn.shopId, shopId: infoForn.shopId,
activateId: infoForn.id, activateId: infoForn.id,
shopUserId: infoForn.userInfo.id, shopUserId: infoForn.userInfo.id,
@ -328,15 +327,6 @@
returnUrl: '', // returnUrl: '', //
buyerRemark: '' buyerRemark: ''
}) })
let res = await store.actionspayltPayVip({
shopId: infoForn.shopId,
activateId: infoForn.id,
shopUserId: infoForn.userInfo.id,
amount: infoForn.amount, //
returnUrl: '', //
buyerRemark: ''
})
console.log(res)
} }
@ -377,11 +367,6 @@
uni.cache.set('shopId', options.shopId, 30) uni.cache.set('shopId', options.shopId, 30)
infoForn.shopId = options.shopId ? options.shopId : uni.cache.get('shopId') infoForn.shopId = options.shopId ? options.shopId : uni.cache.get('shopId')
} }
// let resone = await APIusershopInfodetail({
// shopId: infoForn.shopId
// })
// infoForn.shopUserInfo = resone.shopInfo
asyncshopUserInfo() asyncshopUserInfo()
if (options.type == 'detail') { if (options.type == 'detail') {
detailtype.value = 'detail' detailtype.value = 'detail'

View File

@ -101,7 +101,6 @@
onMounted onMounted
} from 'vue' } from 'vue'
import { import {
APIusershopInfodetail,
APIshopUserInfo APIshopUserInfo
} from '@/common/api/member.js' } from '@/common/api/member.js'
@ -135,7 +134,7 @@
uni.pro.navigateTo('user/member/billDetails', { uni.pro.navigateTo('user/member/billDetails', {
shopId: shopUserInfo.shopId, shopId: shopUserInfo.shopId,
type: type, type: type,
shopInfo: JSON.stringify(shopUserInfo.shopInfo) shopInfo: JSON.stringify(shopUserInfo)
}) })
} else if (type == 3) { } else if (type == 3) {
uni.pro.navigateTo('user/coupon', { uni.pro.navigateTo('user/coupon', {
@ -183,11 +182,6 @@
if (pageParams.shopId) { if (pageParams.shopId) {
shopUserInfo.shopId = pageParams.shopId shopUserInfo.shopId = pageParams.shopId
uni.cache.set('shopId', pageParams.shopId, 30) uni.cache.set('shopId', pageParams.shopId, 30)
// let res = await APIusershopInfodetail({
// shopId: pageParams.shopId
// })
// shopInfo
// shopUserInfo.shopExtend = res.shopExtend.member_bg
asyncshopUserInfo() asyncshopUserInfo()
} }

View File

@ -32,7 +32,7 @@
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"> src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png">
</image> </image>
<view class="my_list_item_name">积分</view> <view class="my_list_item_name">积分</view>
<view class="my_list_item_num">{{userInfo.accountPoints ||'0'}}</view> <view class="my_list_item_num">{{userInfo.accountPoints ||userInfo.points}}</view>
</view> </view>
<view class="my_list_item"> <view class="my_list_item">
<image class="my_list_item_icon" <image class="my_list_item_icon"
@ -131,10 +131,17 @@
// //
const Myassets = () => { const Myassets = () => {
uni.pro.navigateTo('user/member/memberdetails', { if (uni.cache.get('shopId')) {
shopId: uni.cache.get('shopId'), uni.pro.navigateTo('user/member/memberdetails', {
type: 'index' shopId: uni.cache.get('shopId'),
}) type: 'index'
})
} else {
uni.pro.navigateTo('user/member/list', {
shopId: uni.cache.get('shopId'),
type: 'index'
})
}
} }
const clickTo = (item, index) => { const clickTo = (item, index) => {
@ -191,13 +198,12 @@
onShow(async () => { onShow(async () => {
await store.actionsAPIuser() await store.actionsAPIuser()
let res = uni.cache.get('orderVIP')
if (uni.cache.get('shopId')) { if (uni.cache.get('shopId')) {
Object.assign(userInfo, res) Object.assign(userInfo, uni.cache.get('orderVIP'))
} else { } else {
Object.assign(userInfo, { Object.assign(userInfo, {
...res, ...uni.cache.get('userInfo'),
...res.assetsSummary ...uni.cache.get('userInfo').assetsSummary
}) })
} }
}) })

View File

@ -36,7 +36,9 @@ export const Memberpay = defineStore('memberpay', {
openId: uni.cache.get('userInfo').wechatOpenId, openId: uni.cache.get('userInfo').wechatOpenId,
// #endif // #endif
returnUrl: data.returnUrl ? data.returnUrl : '', returnUrl: data.returnUrl ? data.returnUrl : '',
buyerRemark: data.buyerRemark ? data.buyerRemark : '' buyerRemark: data.buyerRemark ? data.buyerRemark : '',
orderId: data.orderId,
userAllPack: data.userAllPack
}) })
if (res) { if (res) {
uni.showLoading({ uni.showLoading({