霸王餐更改
This commit is contained in:
27
App.vue
27
App.vue
@@ -6,7 +6,8 @@
|
|||||||
APIgeocodelocation
|
APIgeocodelocation
|
||||||
} from "@/common/api/api.js"
|
} from "@/common/api/api.js"
|
||||||
import {
|
import {
|
||||||
onLaunch
|
onLaunch,
|
||||||
|
onShow
|
||||||
} from '@dcloudio/uni-app';
|
} from '@dcloudio/uni-app';
|
||||||
import {
|
import {
|
||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
@@ -22,23 +23,25 @@
|
|||||||
// 标记应用启动完成
|
// 标记应用启动完成
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
await store.initNavbarHeight();
|
await store.initNavbarHeight();
|
||||||
// #ifndef H5
|
|
||||||
// try {
|
|
||||||
const storelogin = Storelogin();
|
|
||||||
await storelogin.actionslogin()
|
|
||||||
proxy.$isResolve()
|
|
||||||
// } catch (error) {
|
|
||||||
// proxy.$isResolve()
|
|
||||||
// console.log(error)
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
});
|
});
|
||||||
// export default {
|
// export default {
|
||||||
// onLaunch: async function() {
|
// onLaunch: async function() {
|
||||||
|
|
||||||
|
|
||||||
// },
|
// },
|
||||||
// onShow: function() {},
|
onShow(async () => {
|
||||||
|
// #ifndef H5
|
||||||
|
// try {
|
||||||
|
const storelogin = Storelogin();
|
||||||
|
await storelogin.actionslogin()
|
||||||
|
proxy.$isResolve()
|
||||||
|
// } catch (error) {
|
||||||
|
// proxy.$isResolve()
|
||||||
|
// console.log(error)
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
// onHide: function() {}
|
// onHide: function() {}
|
||||||
// }
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ const useWebSocket = (options = {}) => {
|
|||||||
socketTask.value.onOpen(() => {
|
socketTask.value.onOpen(() => {
|
||||||
// 初始化 初始购物车
|
// 初始化 初始购物车
|
||||||
sendMessage(initMessage)
|
sendMessage(initMessage)
|
||||||
uni.hideLoading();
|
|
||||||
});
|
});
|
||||||
socketTask.value.onMessage((res) => {
|
socketTask.value.onMessage((res) => {
|
||||||
receivedMessages.value = JSON.parse(res.data)
|
receivedMessages.value = JSON.parse(res.data)
|
||||||
@@ -113,11 +112,10 @@ const useWebSocket = (options = {}) => {
|
|||||||
title: '操作异常,请重新扫码',
|
title: '操作异常,请重新扫码',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
console.log('服务器正常关闭,停止重连');
|
|
||||||
autoReconnect.value = false;
|
autoReconnect.value = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.pro.switchTab('index/index');
|
uni.pro.switchTab('index/index');
|
||||||
}, 1000)
|
}, 1500)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (autoReconnect.value && !isManuallyClosed.value) {
|
if (autoReconnect.value && !isManuallyClosed.value) {
|
||||||
@@ -157,7 +155,8 @@ const useWebSocket = (options = {}) => {
|
|||||||
isPongReceived.value = false; // 每次发送心跳消息前重置标记
|
isPongReceived.value = false; // 每次发送心跳消息前重置标记
|
||||||
socketTask.value.send({
|
socketTask.value.send({
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
type: 'ping_interval'
|
type: 'ping_interval',
|
||||||
|
set: 'shopping'
|
||||||
}),
|
}),
|
||||||
success: () => {
|
success: () => {
|
||||||
console.log('心跳消息发送成功');
|
console.log('心跳消息发送成功');
|
||||||
@@ -180,8 +179,7 @@ const useWebSocket = (options = {}) => {
|
|||||||
const handlePong = (res) => {
|
const handlePong = (res) => {
|
||||||
try {
|
try {
|
||||||
let data = JSON.parse(res.data);
|
let data = JSON.parse(res.data);
|
||||||
if (data.msg === 'ok' && data.msg_id ==
|
if (data.msg === 'ok' && data.msg_id == 'ping_interval') {
|
||||||
'ping_interval') {
|
|
||||||
isPongReceived.value = true;
|
isPongReceived.value = true;
|
||||||
console.log('收到心跳响应,清除超时定时器');
|
console.log('收到心跳响应,清除超时定时器');
|
||||||
clearTimeout(pongTimer);
|
clearTimeout(pongTimer);
|
||||||
@@ -250,10 +248,13 @@ const useWebSocket = (options = {}) => {
|
|||||||
const reconnectInterval = initialReconnectInterval * Math.pow(2, reconnectAttempts.value - 1);
|
const reconnectInterval = initialReconnectInterval * Math.pow(2, reconnectAttempts.value - 1);
|
||||||
const randomizedInterval = reconnectInterval + Math.floor(Math.random() * 1000);
|
const randomizedInterval = reconnectInterval + Math.floor(Math.random() * 1000);
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: `尝试第 ${reconnectAttempts.value} 次重连`,
|
title: `正在努力连接..`,
|
||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
console.log(`尝试第 ${reconnectAttempts.value} 次重连,重连间隔: ${randomizedInterval}ms...`);
|
console.log(`尝试第 ${reconnectAttempts.value} 次重连,重连间隔: ${randomizedInterval}ms...`);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 1000)
|
||||||
reconnectTimer.value = setTimeout(() => {
|
reconnectTimer.value = setTimeout(() => {
|
||||||
connect();
|
connect();
|
||||||
}, randomizedInterval);
|
}, randomizedInterval);
|
||||||
|
|||||||
@@ -73,12 +73,7 @@
|
|||||||
orderVIP.value = data
|
orderVIP.value = data
|
||||||
}
|
}
|
||||||
|
|
||||||
const paymentMethodList = ref([{
|
const paymentMethodList = ref([
|
||||||
name: "余额支付",
|
|
||||||
type: 1,
|
|
||||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
|
||||||
payType: 'accountPay'
|
|
||||||
},
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
{
|
{
|
||||||
name: "微信支付",
|
name: "微信支付",
|
||||||
@@ -95,6 +90,12 @@
|
|||||||
payType: 'aliPay'
|
payType: 'aliPay'
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
|
{
|
||||||
|
name: "余额支付",
|
||||||
|
type: 1,
|
||||||
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||||
|
payType: 'accountPay'
|
||||||
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<view class="therecontent_box_item">
|
<view class="therecontent_box_item">
|
||||||
<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
|
<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
|
||||||
<view class="therecontent_box_imge_text">
|
<view class="therecontent_box_imge_text">
|
||||||
{{todayList.name}}
|
{{todayList.name|| ''}}
|
||||||
</view>
|
</view>
|
||||||
<view class="therecontent_box_imge_right flex-start">
|
<view class="therecontent_box_imge_right flex-start">
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 首页抢购区域 -->
|
<!-- 首页抢购区域 -->
|
||||||
<view class="fivecontent">
|
<view class="fivecontent">
|
||||||
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
|
<view class="fivecontent_item" v-for="(item,index) in formhomelist.list" :key="index"
|
||||||
@click="fivecontentclick(item)">
|
@click="fivecontentclick(item)">
|
||||||
<view class="fivecontent_item_nav flex-start">
|
<view class="fivecontent_item_nav flex-start">
|
||||||
<image :src="item.shopImage" mode="aspectFill"></image>
|
<image :src="item.shopImage" mode="aspectFill"></image>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<up-loadmore height='40' :status="formhomelist.status" iconSize='16' fontSize='16' />
|
<up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<indexs v-if="showindex == 'shopIndex'"></indexs>
|
<indexs v-if="showindex == 'shopIndex'"></indexs>
|
||||||
@@ -234,7 +234,8 @@
|
|||||||
page: 1, //页数
|
page: 1, //页数
|
||||||
size: 10, //页容量
|
size: 10, //页容量
|
||||||
status: 'loadmore',
|
status: 'loadmore',
|
||||||
name: '1'
|
name: '1',
|
||||||
|
list:[]
|
||||||
})
|
})
|
||||||
// 使用 reactive 创建响应式对象
|
// 使用 reactive 创建响应式对象
|
||||||
const timeData = ref({});
|
const timeData = ref({});
|
||||||
@@ -243,7 +244,6 @@
|
|||||||
const onChange = (e) => {
|
const onChange = (e) => {
|
||||||
timeData.value = e;
|
timeData.value = e;
|
||||||
};
|
};
|
||||||
const homelist = ref([]) //接收数据
|
|
||||||
const onLoadhome = async () => {
|
const onLoadhome = async () => {
|
||||||
try {
|
try {
|
||||||
let res = await APIhome(formhomelist)
|
let res = await APIhome(formhomelist)
|
||||||
@@ -265,30 +265,34 @@
|
|||||||
item.end_times = 0
|
item.end_times = 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (res.pages < formhomelist.page) {
|
if ((res.totalPage == 0 || res.totalPage == 1) && res.totalRow <= 10) {
|
||||||
|
console.log(res)
|
||||||
formhomelist.status = 'nomore'
|
formhomelist.status = 'nomore'
|
||||||
if (form.page == 1 && res.list.length == 0) {
|
formhomelist.list = res.records
|
||||||
|
if (formhomelist.page == 1 && res.records.length == 0) {
|
||||||
|
formhomelist.list = []
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
formhomelist.status = 'loading';
|
formhomelist.status = 'loading';
|
||||||
|
if (formhomelist.page == 1) {
|
||||||
|
formhomelist.list = res.records
|
||||||
|
} else {
|
||||||
|
formhomelist.list = [...formhomelist.list, ...res.records];
|
||||||
|
}
|
||||||
formhomelist.page = ++formhomelist.page;
|
formhomelist.page = ++formhomelist.page;
|
||||||
setTimeout(() => {
|
if (formhomelist.page > res.totalPage) {
|
||||||
homelist.value = [...homelist.value, ...res.list];
|
formhomelist.status = 'nomore';
|
||||||
|
} else {
|
||||||
formhomelist.status = 'loading';
|
formhomelist.status = 'loading';
|
||||||
if (res.pageNum == res.pages) {
|
}
|
||||||
formhomelist.status = 'nomore';
|
|
||||||
} else {
|
|
||||||
formhomelist.status = 'loading';
|
|
||||||
}
|
|
||||||
}, 500)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
// /筛选数据处理
|
// /筛选数据处理
|
||||||
const init_fn = async () => {
|
const init_fn = async () => {
|
||||||
homelist.value = []
|
formhomelist.list = []
|
||||||
Object.assign(formhomelist, {
|
Object.assign(formhomelist, {
|
||||||
address: uni.cache.get('getLocationstorage').address, //地址
|
address: uni.cache.get('getLocationstorage').address, //地址
|
||||||
lng: uni.cache.get('getLocationstorage').lng,
|
lng: uni.cache.get('getLocationstorage').lng,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="contentbox"
|
<view class="contentbox"
|
||||||
:style="'background:url('+(shopExtend?shopExtend.shopExtendList[0].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
|
:style="'background:url('+(shopExtend[0]?shopExtend[0].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
|
||||||
<view class="contentboxitem flex-between">
|
<view class="contentboxitem flex-between">
|
||||||
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
|
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
|
||||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
import {
|
import {
|
||||||
productStore
|
productStore
|
||||||
} from '@/stores/user.js';
|
} from '@/stores/user.js';
|
||||||
const shopExtend = uni.cache.get('shopId') ? uni.cache.get('shopUserInfo') : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png'
|
const shopExtend = uni.cache.get('shopUserInfo').shopExtendList ? uni.cache.get('shopUserInfo').shopExtendList : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png'
|
||||||
const scanCodehandle = async (i) => {
|
const scanCodehandle = async (i) => {
|
||||||
const store = productStore();
|
const store = productStore();
|
||||||
await store.scanCodeactions()
|
await store.scanCodeactions()
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
<view class="price">
|
<view class="price">
|
||||||
<view class="priceAmount">
|
<view class="priceAmount">
|
||||||
¥{{orderVIP.isVip ==1 && ordershopUserInfo.isMemberPrice==1?item.memberPrice:item.price}}
|
¥{{orderVIP.isVip ==1 && ordershopUserInfo.isMemberPrice==1?(item.memberPrice|| item.price):item.price}}
|
||||||
</view>
|
</view>
|
||||||
<view class="num">x{{item.num}}</view>
|
<view class="num">x{{item.num}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -122,8 +122,7 @@
|
|||||||
<!-- 支付之前 -->
|
<!-- 支付之前 -->
|
||||||
<block v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
<block v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||||||
<view v-for="(item,indexe) in favorablelist" :key="indexe">
|
<view v-for="(item,indexe) in favorablelist" :key="indexe">
|
||||||
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}"
|
<view class="favorable" :class="{column:item.type=='product'}" @click="goUrl(item)">
|
||||||
@click="goUrl(item)">
|
|
||||||
<view class="favorable_left">
|
<view class="favorable_left">
|
||||||
<text class="name"> {{ item.name }} </text>
|
<text class="name"> {{ item.name }} </text>
|
||||||
</view>
|
</view>
|
||||||
@@ -161,7 +160,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="cell-item column" v-if="listinfo.discountInfo.length > 0">
|
<view class="cell-item column" v-if="listinfo.discountInfo">
|
||||||
<view class="label">优惠折扣</view>
|
<view class="label">优惠折扣</view>
|
||||||
<view class="val column">
|
<view class="val column">
|
||||||
<view class="productCoupon" v-for="(item,index) in listinfo.discountInfo" :key="index">
|
<view class="productCoupon" v-for="(item,index) in listinfo.discountInfo" :key="index">
|
||||||
@@ -343,6 +342,7 @@
|
|||||||
|
|
||||||
// 跳转
|
// 跳转
|
||||||
const goUrl = (item) => {
|
const goUrl = (item) => {
|
||||||
|
console.log(props.listinfo.totalPrices, props.listinfo.Productroll)
|
||||||
if (props.changeFreeenable) {
|
if (props.changeFreeenable) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '不可与其他优惠共享!',
|
title: '不可与其他优惠共享!',
|
||||||
@@ -360,7 +360,8 @@
|
|||||||
type: "confirm_order_coupon",
|
type: "confirm_order_coupon",
|
||||||
shopId: uni.cache.get('orderVIP').shopId,
|
shopId: uni.cache.get('orderVIP').shopId,
|
||||||
shopUserId: props.orderVIP.id,
|
shopUserId: props.orderVIP.id,
|
||||||
payAmount: props.listinfo.totalCost,
|
payAmount: (parseFloat(props.listinfo.totalPrices) - parseFloat(props.listinfo
|
||||||
|
.Productroll)).toFixed(2),
|
||||||
shoppingCart: JSON.stringify(props.listinfo.combinedArray)
|
shoppingCart: JSON.stringify(props.listinfo.combinedArray)
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -336,6 +336,7 @@
|
|||||||
|
|
||||||
Orderinfo.shopUserId = options.shopUserId
|
Orderinfo.shopUserId = options.shopUserId
|
||||||
Orderinfo.payAmount = options.payAmount
|
Orderinfo.payAmount = options.payAmount
|
||||||
|
console.log(Orderinfo.payAmount)
|
||||||
Orderinfo.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart))
|
Orderinfo.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart))
|
||||||
}
|
}
|
||||||
getCouponList()
|
getCouponList()
|
||||||
|
|||||||
@@ -173,13 +173,6 @@
|
|||||||
})
|
})
|
||||||
if (res) {
|
if (res) {
|
||||||
Object.assign(listinfo, res);
|
Object.assign(listinfo, res);
|
||||||
// if (listinfo.status == 'unpaid') {
|
|
||||||
// try {
|
|
||||||
// let res = await APIhistoryOrder({
|
|
||||||
// orderId: orderId.value
|
|
||||||
// })
|
|
||||||
// } catch (error) {}
|
|
||||||
// }
|
|
||||||
// 历史订单
|
// 历史订单
|
||||||
if (listinfo.detailMap) {
|
if (listinfo.detailMap) {
|
||||||
let combinedArray = [];
|
let combinedArray = [];
|
||||||
@@ -190,12 +183,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
listinfo.combinedArray = combinedArray
|
listinfo.combinedArray = combinedArray
|
||||||
listinfo.packFeess = await cartStore.getTotalPackFee(listinfo.combinedArray)
|
listinfo.packFeess = cartStore.getTotalPackFee(listinfo.combinedArray)
|
||||||
// 计算购物车商品费用
|
// 计算购物车商品费用
|
||||||
listinfo.totalPrices = await cartStore.getTotalTotalPrices(listinfo
|
listinfo.totalPrices = cartStore.getTotalTotalPrices(listinfo
|
||||||
.combinedArray)
|
.combinedArray, changeFreeenable)
|
||||||
// 餐位费listinfo.seatNum
|
// 餐位费listinfo.seatNum
|
||||||
listinfo.Seatcharge = await cartStore.getTotalSeatcharge(listinfo.seatNum)
|
listinfo.Seatcharge = cartStore.getTotalSeatcharge(listinfo.seatNum)
|
||||||
}
|
}
|
||||||
if (listinfo.discountInfo) {
|
if (listinfo.discountInfo) {
|
||||||
const discountObj = JSON.parse(listinfo.discountInfo);
|
const discountObj = JSON.parse(listinfo.discountInfo);
|
||||||
@@ -207,8 +200,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
listinfo.discountInfo = tempArray;
|
listinfo.discountInfo = tempArray;
|
||||||
console.log(tempArray)
|
|
||||||
}
|
}
|
||||||
|
// 回填先质控
|
||||||
|
listinfo.pointsDiscountAmount = 0
|
||||||
|
// console.log(listinfo)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,6 +226,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
// 霸王餐
|
// 霸王餐
|
||||||
try {
|
try {
|
||||||
console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
|
console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
|
||||||
@@ -257,12 +253,13 @@
|
|||||||
const changeFreeenable = ref(false)
|
const changeFreeenable = ref(false)
|
||||||
|
|
||||||
const changeFree = (e) => {
|
const changeFree = (e) => {
|
||||||
console.log(e)
|
|
||||||
if (e) {
|
if (e) {
|
||||||
orderInfoAfterRef.value.bwcclear()
|
orderInfoAfterRef.value.bwcclear()
|
||||||
uniqueIds.value = [] // 筛选出商品卷的id
|
uniqueIds.value = [] // 筛选出商品卷的id
|
||||||
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
|
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
|
||||||
listinfo.pointsNum = 0 // 商品卷总价价格
|
listinfo.pointsNum = 0 // 商品卷总价价格
|
||||||
|
let res = cartStore.getTotalTotalPrices(listinfo.combinedArray, 1)
|
||||||
|
console.log(res)
|
||||||
// 支付方式切换
|
// 支付方式切换
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
paymentMethodref.value.groupChanges(2)
|
paymentMethodref.value.groupChanges(2)
|
||||||
@@ -453,7 +450,7 @@
|
|||||||
amount: listinfo.totalCost, // 最终订单金额
|
amount: listinfo.totalCost, // 最终订单金额
|
||||||
returnUrl: '', //跳转地址
|
returnUrl: '', //跳转地址
|
||||||
buyerRemark: '',
|
buyerRemark: '',
|
||||||
seatNum: listinfo.seatNum
|
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -549,9 +546,13 @@
|
|||||||
|
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
console.log(uni.cache.get('orderVIP'))
|
|
||||||
try {
|
try {
|
||||||
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
|
// 更新数据
|
||||||
|
if (orderVIP.value) {
|
||||||
|
orderVIP.value = uni.cache.get('orderVIP')
|
||||||
|
ordershopUserInfo.value = orderVIP.value.shopInfo
|
||||||
|
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//TODO handle the exception
|
//TODO handle the exception
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<view class="price">
|
<view class="price">
|
||||||
<view class="priceAmount">
|
<view class="priceAmount">
|
||||||
¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.price}}
|
¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.price):item.price}}
|
||||||
</view>
|
</view>
|
||||||
<view class="num">x{{item.num}}</view>
|
<view class="num">x{{item.num}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text
|
<text
|
||||||
class="price">¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
class="price">¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 餐位费 -->
|
<!-- 餐位费 -->
|
||||||
@@ -218,10 +218,11 @@
|
|||||||
// 是否启用会员价 0否1是
|
// 是否启用会员价 0否1是
|
||||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||||
// memberPrice会员价
|
// memberPrice会员价
|
||||||
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
|
return total + (parseFloat(item.memberPrice || item.price) * parseFloat(item.num - item
|
||||||
|
.returnNum));
|
||||||
} else {
|
} else {
|
||||||
// salePrice销售价
|
// salePrice销售价
|
||||||
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
|
return total + (parseFloat(item.price || 0) * parseFloat(item.num - item.returnNum));
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
// 购物车总数价格
|
// 购物车总数价格
|
||||||
@@ -229,10 +230,11 @@
|
|||||||
// 是否启用会员价 0否1是
|
// 是否启用会员价 0否1是
|
||||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||||
// memberPrice会员价
|
// memberPrice会员价
|
||||||
return total + parseFloat(item.memberPrice) * parseFloat(item.cartNumber);
|
return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item
|
||||||
|
.cartNumber);
|
||||||
} else {
|
} else {
|
||||||
// salePrice销售价
|
// salePrice销售价
|
||||||
return total + parseFloat(item.salePrice) * parseFloat(item.cartNumber);
|
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
cart = cartone + cart
|
cart = cartone + cart
|
||||||
@@ -416,6 +418,7 @@
|
|||||||
border-radius: 30rpx 30rpx 0 0;
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
.scroll-view {
|
.scroll-view {
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
margin-bottom: 190rpx;
|
margin-bottom: 190rpx;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
<!-- 会员价与价格 -->
|
<!-- 会员价与价格 -->
|
||||||
<text
|
<text
|
||||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice || item.salePrice):item.salePrice}}</text>
|
||||||
<!-- <text class="originalprice"
|
<!-- <text class="originalprice"
|
||||||
v-if="item.originPrice">¥{{item.originPrice}}</text>
|
v-if="item.originPrice">¥{{item.originPrice}}</text>
|
||||||
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
|
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||||
<!-- 会员价与价格 -->
|
<!-- 会员价与价格 -->
|
||||||
<text
|
<text
|
||||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text>
|
||||||
<!-- 原价 -->
|
<!-- 原价 -->
|
||||||
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
||||||
<!-- 单位 -->
|
<!-- 单位 -->
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
:class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
:class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||||
<!-- 会员价与价格 -->
|
<!-- 会员价与价格 -->
|
||||||
<text
|
<text
|
||||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice|| item.salePrice):item.salePrice}}</text>
|
||||||
<!-- 原价 -->
|
<!-- 原价 -->
|
||||||
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
||||||
<!-- 单位 -->
|
<!-- 单位 -->
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<view class="money">
|
<view class="money">
|
||||||
<view>¥</view>
|
<view>¥</view>
|
||||||
<text class="money_num" style="margin-right: 10rpx;">
|
<text class="money_num" style="margin-right: 10rpx;">
|
||||||
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item1.memberPrice:item1.salePrice}}
|
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1 ?(item1.memberPrice||item1.salePrice):item1.salePrice}}
|
||||||
</text>
|
</text>
|
||||||
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
<view class="money">
|
<view class="money">
|
||||||
<view>¥</view>
|
<view>¥</view>
|
||||||
<text class="money_num" style="margin-right: 10rpx;">
|
<text class="money_num" style="margin-right: 10rpx;">
|
||||||
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item1.memberPrice:item1.salePrice}}
|
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item1.memberPrice||item1.salePrice):item1.salePrice}}
|
||||||
</text>
|
</text>
|
||||||
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -284,6 +284,10 @@
|
|||||||
v-if="specifications.item.result&& specifications.item.result.isPauseSale== 1 && selectedSpecs[specType] === option">
|
v-if="specifications.item.result&& specifications.item.result.isPauseSale== 1 && selectedSpecs[specType] === option">
|
||||||
<view>售罄</view>
|
<view>售罄</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="shop_sku_box_item_tip"
|
||||||
|
v-if="specifications.item.result == 'kong' && canSubmit == false && selectedSpecs[specType] === option">
|
||||||
|
<view>已下架</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -315,7 +319,7 @@
|
|||||||
<view class="price">
|
<view class="price">
|
||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
<text
|
<text
|
||||||
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?specifications.item.memberPrice:specifications.item.salePrice}}</text>
|
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.memberPrice||specifications.item.salePrice):specifications.item.salePrice}}</text>
|
||||||
<text class="i">/{{specifications.item.unitName}}</text>
|
<text class="i">/{{specifications.item.unitName}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="operation-wrap">
|
<view class="operation-wrap">
|
||||||
@@ -635,16 +639,23 @@
|
|||||||
specInfo: selectedSpecsStr.value,
|
specInfo: selectedSpecsStr.value,
|
||||||
id: specifications.item.id
|
id: specifications.item.id
|
||||||
});
|
});
|
||||||
specifications.sku_id = result.id
|
console.log(result)
|
||||||
specifications.product_id = result.productId
|
if (result != true) {
|
||||||
// 添加多规格分组
|
specifications.sku_id = result.id
|
||||||
specifications.item.result = result
|
specifications.product_id = result.productId
|
||||||
console.log(specifications.item)
|
// 添加多规格分组
|
||||||
if (result.isPauseSale == 0) {
|
specifications.item.result = result
|
||||||
canSubmit.value = true;
|
console.log(specifications.item)
|
||||||
|
if (result.isPauseSale == 0) {
|
||||||
|
canSubmit.value = true;
|
||||||
|
} else {
|
||||||
|
canSubmit.value = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
specifications.item.result = 'kong'
|
||||||
canSubmit.value = false;
|
canSubmit.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
canSubmit.value = false;
|
canSubmit.value = false;
|
||||||
}
|
}
|
||||||
@@ -1152,10 +1163,11 @@
|
|||||||
// 是否启用会员价 0否1是
|
// 是否启用会员价 0否1是
|
||||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||||
// memberPrice会员价
|
// memberPrice会员价
|
||||||
return total + parseFloat(item.memberPrice) * parseFloat(item.cartNumber);
|
return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item
|
||||||
|
.cartNumber);
|
||||||
} else {
|
} else {
|
||||||
// salePrice销售价
|
// salePrice销售价
|
||||||
return total + parseFloat(item.salePrice) * parseFloat(item.cartNumber);
|
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
// 向上取整并保留两位小数
|
// 向上取整并保留两位小数
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<image class="topBack"
|
<image class="topBack"
|
||||||
:src="ShopId?shopExtend.shopExtendList[1].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'"
|
:src="userInfo.shopExtendList?(userInfo.shopExtendList[1].value?userInfo.shopExtendList[1].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'):'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'"
|
||||||
mode="aspectFill"></image>
|
mode="aspectFill"></image>
|
||||||
<view class="myContent">
|
<view class="myContent">
|
||||||
<view class="my_info flex-between">
|
<view class="my_info flex-between">
|
||||||
<view class="my_info_left">
|
<view class="my_info_left">
|
||||||
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
|
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
|
||||||
<view class="name">{{userInfo.nickName || '无'}}</view>
|
<view class="name">{{userInfo.nickName}}</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId"
|
<image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId"
|
||||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
|
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
|
||||||
@@ -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 ||userInfo.points}}</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"
|
||||||
@@ -104,12 +104,12 @@
|
|||||||
},
|
},
|
||||||
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
|
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
|
||||||
])
|
])
|
||||||
const teblist = ref([])
|
|
||||||
const shopExtend = uni.cache.get('shopId') ? uni.cache.get('shopUserInfo') : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png'
|
|
||||||
const userInfo = reactive({})
|
const userInfo = reactive({})
|
||||||
|
|
||||||
const ShopId = ref(uni.cache.get('shopId'))
|
const ShopId = ref(uni.cache.get('shopId'))
|
||||||
|
|
||||||
|
|
||||||
const clickEvent = () => {
|
const clickEvent = () => {
|
||||||
if (ShopId.value) {
|
if (ShopId.value) {
|
||||||
if (userInfo.isVip == 0) {
|
if (userInfo.isVip == 0) {
|
||||||
@@ -195,9 +195,9 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onShow(() => {
|
||||||
onShow(async () => {
|
console.log(111)
|
||||||
await store.actionsAPIuser()
|
store.actionsAPIuser()
|
||||||
if (uni.cache.get('shopId')) {
|
if (uni.cache.get('shopId')) {
|
||||||
Object.assign(userInfo, uni.cache.get('orderVIP'))
|
Object.assign(userInfo, uni.cache.get('orderVIP'))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 计算购物车商品总价格
|
// 计算购物车商品总价格
|
||||||
const getTotalTotalPrices = (matchedProducts) => computed(() => {
|
const getTotalTotalPrices = (matchedProducts, bwc = 2) => computed(() => {
|
||||||
if (!matchedProducts || !Array.isArray(matchedProducts)) {
|
if (!matchedProducts || !Array.isArray(matchedProducts)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,10 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
let cart = matchedProducts.reduce((total, item) => {
|
let cart = matchedProducts.reduce((total, item) => {
|
||||||
// 是否启用会员价 0否1是
|
// 是否启用会员价 0否1是
|
||||||
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
||||||
.isMemberPrice == 1) {
|
.isMemberPrice == 1 && bwc == 2) {
|
||||||
// memberPrice会员价
|
// memberPrice会员价
|
||||||
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item
|
return total + (parseFloat(item.memberPrice || item.price) * parseFloat(item
|
||||||
|
.num - item
|
||||||
.returnNum));
|
.returnNum));
|
||||||
} else {
|
} else {
|
||||||
// salePrice销售价
|
// salePrice销售价
|
||||||
@@ -67,7 +68,7 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
||||||
.isMemberPrice == 1) {
|
.isMemberPrice == 1) {
|
||||||
// memberPrice会员价
|
// memberPrice会员价
|
||||||
return total + parseFloat(item.memberPrice)
|
return total + parseFloat(item.memberPrice || item.price)
|
||||||
} else {
|
} else {
|
||||||
// salePrice销售价
|
// salePrice销售价
|
||||||
return total + parseFloat(item.price)
|
return total + parseFloat(item.price)
|
||||||
@@ -84,8 +85,10 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
let cart = 0
|
let cart = 0
|
||||||
|
|
||||||
if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && seatNum) {
|
if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && seatNum) {
|
||||||
cart = Math.ceil(parseFloat(seatNum) * parseFloat(
|
cart = parseFloat(seatNum) * parseFloat(uni.cache.get('ordershopUserInfo').tableFee)
|
||||||
uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
|
|
||||||
|
// Math.ceil(parseFloat(seatNum) * parseFloat(
|
||||||
|
// uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
|
||||||
}
|
}
|
||||||
// 向下取整并保留两位小数
|
// 向下取整并保留两位小数
|
||||||
let result = roundUpToTwoDecimals(cart, 'downward')
|
let result = roundUpToTwoDecimals(cart, 'downward')
|
||||||
|
|||||||
Reference in New Issue
Block a user