From 529a43903c73fe9083a0fd3f6fdba0e97d58220d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com>
Date: Sat, 3 Aug 2024 14:12:59 +0800
Subject: [PATCH] 11
---
pages/order_food/order_food copy.vue | 1899 ++++++++++++++++++++++++++
pages/order_food/order_food.vue | 47 +-
2 files changed, 1932 insertions(+), 14 deletions(-)
create mode 100644 pages/order_food/order_food copy.vue
diff --git a/pages/order_food/order_food copy.vue b/pages/order_food/order_food copy.vue
new file mode 100644
index 0000000..9d2b37c
--- /dev/null
+++ b/pages/order_food/order_food copy.vue
@@ -0,0 +1,1899 @@
+
+
+
+
+
+ 加载中
+
+
+
+
+
+
+
+
+ {{ shopInfo.storeInfo.shopName }}
+
+
+ 距离您{{ shopInfo.distance }}
+
+
+
+ 营业时间:{{ shopInfo.storeInfo.businessStartDay +'至'+ shopInfo.storeInfo.businessEndDay +' '+ shopInfo.storeInfo.businessTime }}
+
+
+ 查看
+
+
+
+
+ 本店招牌菜
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+ 本店回头客第{{index+1}}名
+
+
+ 招牌
+
+
+ {{item.shortTitle?item.shortTitle:''}}
+
+
+ 月售{{item.stockNumber}}
+
+
+
+ ¥
+ {{item.lowPrice}}
+ /份
+ 「{{item.suit}}份起点」
+
+
+
+
+
+
+ 选规格
+ {{item.cartNumber<99?item.cartNumber:'99+'}}
+
+
+
+
+
+ {{ item.cartNumber }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+ TOP{{index1+1}}
+
+
+ {{ item1.name }}
+ 本店回头客第{{index1+1}}名
+ {{item1.shortTitle?item1.shortTitle:''}}
+ 月售{{item1.stockNumber}}
+ ¥{{ item1.lowPrice }}/份「{{item1.suit}}份起点」
+
+
+
+ 选规格
+ {{item1.cartNumber<99?item1.cartNumber:'99+'}}
+
+
+
+
+
+
+
+ {{ item1.cartNumber }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{cartLists_count<99?cartLists_count:'99+'}}
+
+
+ ¥
+ {{cartLists.amount||'0.00'}}
+
+
+ 去结算
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+ {{ item.skuName }}
+
+
+
+ ¥
+ {{ item.salePrice }}
+
+
+
+
+
+ {{ item.number }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ shopInfo.storeInfo.shopName }}
+
+
+
+
+ 商家信息
+
+
+ 营业时间:
+ {{ shopInfo.storeInfo.businessStartDay +'至'+ shopInfo.storeInfo.businessEndDay +' '+ shopInfo.storeInfo.businessTime }}
+
+
+ 商家地址:
+ {{ shopInfo.storeInfo.address }}
+
+
+ 商家电话:
+ {{ shopInfo.storeInfo.phone }}
+
+
+ 商家公告
+
+
+ 公告:
+ {{ shopInfo.storeInfo.detail }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{specifications.name}}
+
+ 本店回头客第{{specifications.indexb+1}}名
+ {{specifications.shortTitle?specifications.shortTitle:''}}
+
+
+
+ {{item.name}}
+
+
+
+ {{item1}}
+
+
+
+
+
+
+
+
+ ¥
+ {{salePrice}}
+ /杯
+
+
+
+
+
+
+ {{amountcartNumber}}
+
+
+
+
+
+
+ {{skuidname.toString()}}
+
+
+ 添加到购物车
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue
index ebce2cf..9d2b37c 100644
--- a/pages/order_food/order_food.vue
+++ b/pages/order_food/order_food.vue
@@ -93,7 +93,7 @@
:scroll-into-view="leftIntoView" :scroll-with-animation="false">
{{item.name}}
+ @click="leftTap(index)">{{item.name}}
@@ -517,18 +517,18 @@
* @param {Object} b
*/
shopAdd(item, index, index1, a, b) {
- if ( a == "+" ){
- if ( this.skuNumber < this.skuSuit) {
- this.amountcartNumber = this.amountcartNumber + (item.suit==0?1:item.suit);
- }else {
+ if (a == "+") {
+ if (this.skuNumber < this.skuSuit) {
+ this.amountcartNumber = this.amountcartNumber + (item.suit == 0 ? 1 : item.suit);
+ } else {
this.amountcartNumber++;
}
} else {
if (this.amountcartNumber > 0) {
console.log(item)
- if ( this.skuNumber < this.skuSuit) {
- this.amountcartNumber = this.amountcartNumber - (item.suit==0?1:item.suit);
+ if (this.skuNumber < this.skuSuit) {
+ this.amountcartNumber = this.amountcartNumber - (item.suit == 0 ? 1 : item.suit);
} else {
this.amountcartNumber = this.amountcartNumber - 1;
}
@@ -851,7 +851,7 @@
/* 获取最后一项的高度,设置填充高度。判断和填充时做了 +-20 的操作,是为了滚动时更好的定位 */
let last = res[res.length - 1].height;
if (last - 20 < this.scrollHeight) {
- this.fillHeight = this.scrollHeight - last + 20; //这是吸到顶部的距离
+ // this.fillHeight = this.scrollHeight - last + 20; //这是吸到顶部的距离
// this.fillHeight = 200;
}
});
@@ -876,18 +876,37 @@
break;
}
}
+ const calculateDeltas = (arr) => {
+ return arr.map((item, index, array) => {
+ if (index === 0) {
+ // 第一个元素前无下标,返回当前元素后下标与第一个元素的差
+ return array[index + 1] - item;
+ } else if (index === array.length - 1) {
+ // 最后一个元素后无下标,返回当前元素前下标与最后一个元素的差
+ return item - array[index - 1];
+ } else {
+ // 计算当前元素前后下标的差
+ return array[index + 1] - item || item - array[index - 1];
+ }
+ });
+ };
+ // 计算前后下标差
+ const deltas = calculateDeltas(this.topArr);
+ console.log(deltas);
this.leftIndex = (index < 0 ? 0 : index);
}
},
+
+
+
/* 左侧导航点击 */
- leftTap(e) {
+ leftTap(index) {
let HeighTdata = null
if (this.opacity) {
- HeighTdata = this.HeighT
+ HeighTdata = this.HeighT //一个导航栏高度
} else {
- HeighTdata = this.HeighT * 2
+ HeighTdata = this.HeighT * 2 //顶部的时候两个导航栏高度
}
- console.log(this.scrollTopSize + HeighTdata, 11)
try {
uni.pageScrollTo({
scrollTop: this.scrollTopSize + HeighTdata, //滑动需要的距离 nav+列表距离的高度
@@ -897,9 +916,9 @@
//TODO handle the exception
}
setTimeout(() => {
- let index = e.currentTarget.dataset.index;
this.scrollInto = `item-${index}`;
- }, 300)
+ this.leftIndex = (index < 0 ? 0 : index);
+ }, 100)
}
}
}