新增点餐首页和商品列表的轮播图
This commit is contained in:
@@ -3,11 +3,22 @@
|
||||
<Nav />
|
||||
<!-- 顶部面板 -->
|
||||
<view class="top--panel" :class="{ grayscale: !isBusinessTime }">
|
||||
<image
|
||||
class="panelimgbackground"
|
||||
:src="shopExtend ? shopExtend.value : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<template v-if="shopExtend">
|
||||
<image
|
||||
class="panelimgbackground"
|
||||
:src="shopExtend ? shopExtend.value : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
|
||||
mode="aspectFill"
|
||||
v-if="!isJsonArrayString(shopExtend.value)"
|
||||
></image>
|
||||
<swiper class="panelimgbackground" autoplay indicator-dots circular v-else>
|
||||
<swiper-item v-for="(item, index) in JSON.parse(shopExtend.value)" :key="index">
|
||||
<image :src="item" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image class="panelimgbackground" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png" mode="aspectFill"></image>
|
||||
</template>
|
||||
<view class="panelone flex-start">
|
||||
<view class="u-flex u-flex-y-center">
|
||||
<text>
|
||||
@@ -556,7 +567,7 @@
|
||||
import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue';
|
||||
//价格计算辅助函数
|
||||
// import * as limitUtils from '@/utils/order-utils.js';
|
||||
import {limitUtils } from 'ysk-utils'
|
||||
import { limitUtils } from 'ysk-utils';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import GoodsPrice from '@/components/goods-price.vue';
|
||||
@@ -578,7 +589,7 @@ import Loading from '@/components/Loading.vue';
|
||||
import dayjs from 'dayjs';
|
||||
import isBetween from 'dayjs/plugin/isBetween';
|
||||
dayjs.extend(isBetween);
|
||||
import { filterNumberInput } from '@/utils/util.js';
|
||||
import { filterNumberInput, isJsonArrayString } from '@/utils/util.js';
|
||||
import { APIproductqueryShop } from '@/common/api/member.js';
|
||||
import { getDistance } from '@/utils/address.js';
|
||||
|
||||
@@ -680,9 +691,18 @@ const callChildMethod = () => {
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg;
|
||||
} catch (error) {}
|
||||
// const shopExtend = ref(uni.cache.get('shopTable').shopExtendMap.shopinfo_bg);
|
||||
// console.log('shopExtend', shopExtend);
|
||||
|
||||
// 分步取值 + 每层兜底,避免某一环不存在导致 undefined
|
||||
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
|
||||
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
|
||||
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
|
||||
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
|
||||
|
||||
// try {
|
||||
// const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg;
|
||||
// } catch (error) {}
|
||||
|
||||
// 计算高度
|
||||
const navScroll = ref(null);
|
||||
@@ -1342,7 +1362,7 @@ const singleclick = async (item, i) => {
|
||||
} else if (item.suitNum >= cartNumberFloat && i === '-') {
|
||||
suitNum = item.cartNumber;
|
||||
}
|
||||
const sendMsg={
|
||||
const sendMsg = {
|
||||
type: 'shopping',
|
||||
suitNum: item.suitNum,
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
@@ -1355,9 +1375,9 @@ const singleclick = async (item, i) => {
|
||||
is_print: 1,
|
||||
product_type: item.type,
|
||||
is_time_discount: item.is_time_discount
|
||||
}
|
||||
if(item.cartListId){
|
||||
sendMsg.id=item.cartListId;
|
||||
};
|
||||
if (item.cartListId) {
|
||||
sendMsg.id = item.cartListId;
|
||||
}
|
||||
websocketsendMessage(sendMsg);
|
||||
};
|
||||
@@ -1681,7 +1701,7 @@ const confirmorderref = ref(null);
|
||||
|
||||
// 结账
|
||||
const orderdetail = async () => {
|
||||
isAutoClose = false;
|
||||
isAutoClose = false;
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/confirm-order?tableCode=' + uni.cache.get('tableCode') + '&shopId=' + uni.cache.get('shopId')
|
||||
});
|
||||
@@ -2102,7 +2122,7 @@ function returnLimitPrice(item) {
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
isAutoClose=true
|
||||
isAutoClose = true;
|
||||
// 监听页面显示和隐藏
|
||||
useSocket.setOnMessage(onMessage);
|
||||
useSocket.onShowconnect();
|
||||
@@ -2124,21 +2144,20 @@ onShow(async () => {
|
||||
|
||||
//是否自动关闭socket
|
||||
let isAutoClose = true;
|
||||
function closeSocket(){
|
||||
if(isAutoClose){
|
||||
useSocket.closeSocket();
|
||||
function closeSocket() {
|
||||
if (isAutoClose) {
|
||||
useSocket.closeSocket();
|
||||
}
|
||||
useSocket.setOnMessage(() => {});
|
||||
|
||||
}
|
||||
onHide(() => {
|
||||
closeSocket()
|
||||
closeSocket();
|
||||
});
|
||||
onUnload(() => {
|
||||
closeSocket()
|
||||
closeSocket();
|
||||
});
|
||||
|
||||
const oldOrder=ref(null)
|
||||
const oldOrder = ref(null);
|
||||
onMounted(async () => {
|
||||
await proxy.$onLaunched;
|
||||
// 获取当前页面栈
|
||||
@@ -2192,12 +2211,12 @@ onMounted(async () => {
|
||||
|
||||
//跳转历史订单
|
||||
function toHistory() {
|
||||
isAutoClose = false;
|
||||
isAutoClose = false;
|
||||
const tableCode = uni.cache.get('tableCode');
|
||||
const shopId = uni.cache.get('shopId');
|
||||
let url= `/pages/order/confirm-order?tableCode=${tableCode}&shopId=${shopId}`
|
||||
const res=oldOrder.value;
|
||||
console.log('toHistory',res);
|
||||
let url = `/pages/order/confirm-order?tableCode=${tableCode}&shopId=${shopId}`;
|
||||
const res = oldOrder.value;
|
||||
console.log('toHistory', res);
|
||||
// if (res && res.id && shopInfo.registerType == 'after') {
|
||||
// url+='&orderId='+res.id
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user