购物车,订单,霸王餐
This commit is contained in:
parent
9da31e2faa
commit
5b8100aa64
|
|
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
||||||
|
// 定义接收的属性
|
||||||
|
const props = defineProps({
|
||||||
|
freeDineConfig: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
},
|
},
|
||||||
props:{
|
payAmount: {
|
||||||
shopUserInfo:{
|
type: Number,
|
||||||
type: Object
|
default: 0
|
||||||
},
|
|
||||||
freeDingConfig:{
|
|
||||||
type: Object
|
|
||||||
},
|
|
||||||
payAmount: {
|
|
||||||
type: Number
|
|
||||||
},
|
|
||||||
rechargeFreeChecked: {
|
|
||||||
type: Boolean
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
});
|
||||||
payAmount (newVal) {
|
|
||||||
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
const emits = defineEmits(['changeFree']);
|
||||||
this.freeDisabled = true
|
|
||||||
} else {
|
const changeFreeenable = ref(false)
|
||||||
this.freeDisabled = false
|
|
||||||
}
|
/**
|
||||||
}
|
* 监听是否免单
|
||||||
},
|
*/
|
||||||
mounted() {
|
const change = (e) => {
|
||||||
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
|
emits('changeFree', e);
|
||||||
this.freeDisabled = true
|
|
||||||
} else {
|
|
||||||
this.freeDisabled = false
|
|
||||||
}
|
|
||||||
console.log(this.freeDisabled )
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监听是否免单
|
|
||||||
*/
|
|
||||||
changeFree ( e ) {
|
|
||||||
if ( this.freeDisabled ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.$emit("changeFree",this.rechargeFreeChecked)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</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>
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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, //是否使用会员价0否1是
|
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, //是否使用会员价0否1是
|
||||||
|
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
|
|
@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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({
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -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'
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -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({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue