From 11ceead11523bf49056f039aed0c1f5b272a41ab Mon Sep 17 00:00:00 2001
From: wwz <1144797966@qq.com>
Date: Mon, 21 Apr 2025 16:39:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=B8=8D=E8=B6=B3=E8=90=A5?=
=?UTF-8?q?=E4=B8=9A=E6=97=B6=E9=97=B4=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/api/request.js | 3 +-
framework/0-conf.js | 2 +-
pages.json | 4 +-
pages/order/components/orderInfoAfter.vue | 10 +-
pages/order/detail.vue | 6 +-
pages/order/index.vue | 25 ++-
pages/product/components/shoppingCartes.vue | 6 +-
pages/product/index.vue | 234 ++++++++++++++++----
static/ztt/icon_goods_kcbz.svg | 14 ++
static/ztt/icon_goods_sq.svg | 14 ++
static/ztt/icon_goods_wks.svg | 14 ++
static/ztt/icon_goods_yxj.svg | 14 ++
12 files changed, 290 insertions(+), 56 deletions(-)
create mode 100644 static/ztt/icon_goods_kcbz.svg
create mode 100644 static/ztt/icon_goods_sq.svg
create mode 100644 static/ztt/icon_goods_wks.svg
create mode 100644 static/ztt/icon_goods_yxj.svg
diff --git a/common/api/request.js b/common/api/request.js
index 1627c6b..003fdeb 100644
--- a/common/api/request.js
+++ b/common/api/request.js
@@ -109,5 +109,6 @@ export default (params) => {
}
});
- }).catch((e) => {});
+ }).catch((e) => {
+ });
};
\ No newline at end of file
diff --git a/framework/0-conf.js b/framework/0-conf.js
index 04a11fe..2c4a371 100644
--- a/framework/0-conf.js
+++ b/framework/0-conf.js
@@ -1,5 +1,5 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false;
-const debug = true
+const debug = false
// #ifdef H5
const proxyApi = "/api"
// #endif
diff --git a/pages.json b/pages.json
index c7e6165..bf4d013 100644
--- a/pages.json
+++ b/pages.json
@@ -75,7 +75,7 @@
{
"path": "pages/order/coupon",
"style": {
- "navigationBarTitleText": "优惠卷"
+ "navigationBarTitleText": "优惠劵"
}
},
{
@@ -153,7 +153,7 @@
{
"path": "pages/user/coupon",
"style": {
- "navigationBarTitleText": "优惠卷"
+ "navigationBarTitleText": "优惠劵"
}
},
{
diff --git a/pages/order/components/orderInfoAfter.vue b/pages/order/components/orderInfoAfter.vue
index 765b46e..a4192e0 100644
--- a/pages/order/components/orderInfoAfter.vue
+++ b/pages/order/components/orderInfoAfter.vue
@@ -197,10 +197,14 @@
下单时间:
{{$u.timeFormat(listinfo.updateTime, 'yyyy-mm-dd hh:MM:ss')}}
-
+ {{orderVIP.shopName}}
+
用餐模式:
堂食
diff --git a/pages/order/detail.vue b/pages/order/detail.vue
index 577028f..83230d7 100644
--- a/pages/order/detail.vue
+++ b/pages/order/detail.vue
@@ -225,9 +225,9 @@
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
listinfo.totalCost = Math.round(sums * 100) / 100;
// 总价格
- console.log(listinfo.combinedArray, listinfo.packFeess, listinfo.totalPrices, listinfo
- .Seatcharge, listinfo.Productroll, listinfo.coupondiscountAmount, sums) // 霸王餐
- console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
+ // console.log(listinfo.combinedArray, listinfo.packFeess, listinfo.totalPrices, listinfo
+ // .Seatcharge, listinfo.Productroll, listinfo.coupondiscountAmount, sums) // 霸王餐
+ // 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)
diff --git a/pages/order/index.vue b/pages/order/index.vue
index 0ecd0f5..7045a26 100644
--- a/pages/order/index.vue
+++ b/pages/order/index.vue
@@ -71,11 +71,11 @@
- ¥{{item.status == 'unpaid'?item.originAmount:item.orderAmount}}
+ ¥{{item.status == 'unpaid'?item.originAmount:item.orderAmount}}
共{{item.goods.length}}件
-
-
+
+
+ 去点餐
+
+
+
+
-
@@ -136,6 +143,10 @@
},
]
+ import {
+ productStore
+ } from '@/stores/user.js';
+
// 初始化是单店还是团购店
const navtabindex = ref('2')
// 总数据列表
@@ -152,6 +163,12 @@
}
})
+ // 点击扫码
+ const scanCodehandle = async (i) => {
+ const store = productStore();
+ await store.scanCodeactions()
+ }
+
// 单店团购
const userorderList = async () => {
let res = await APIuserorder({
diff --git a/pages/product/components/shoppingCartes.vue b/pages/product/components/shoppingCartes.vue
index 18aabdf..e91ec0e 100644
--- a/pages/product/components/shoppingCartes.vue
+++ b/pages/product/components/shoppingCartes.vue
@@ -69,7 +69,7 @@
{{ ifcartNumber(item) }}
-
+
@@ -116,8 +116,7 @@
{{item.productName}}
- {{item.skuName}}
+ {{item.skuName}}
@@ -222,6 +221,7 @@
sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i, suitNum),
is_print: 1,
+ suitNum: item.suitNum,
})
}
diff --git a/pages/product/index.vue b/pages/product/index.vue
index 589c9e1..bca1ef0 100644
--- a/pages/product/index.vue
+++ b/pages/product/index.vue
@@ -7,8 +7,11 @@
:src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
mode="aspectFill">
-
- {{ shopInfo.shopName }}
+
+
+ {{ shopInfo.shopName }}
+
+
距离您{{ distance }}
@@ -34,26 +37,41 @@
+
+
+
+
+
+
+
+
{{ item.name }}
本店回头客第{{index+1}}名
-
+
招牌
+
+ 「{{item.suitNum}}{{item.unitName}}起点」
+
-
- 「{{item.suitNum}}{{item.unitName}}起点」
-
+
-
+
- 非可售时间
+ 未开售
已售罄
@@ -115,12 +133,7 @@
-
-
-
-
@@ -156,6 +169,19 @@
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/1.gif" mode="" v-else
:lazy-load="true">
+
+
+
+
+
+
TOP{{index1+1}}
{{ item1.name }}
@@ -167,8 +193,9 @@
style="font-size: 20rpx;">
「{{item1.suitNum}}{{item1.unitName}}起点」
-
-
+
¥
@@ -178,7 +205,8 @@
- 非可售时间
+ 未开售
已售罄
@@ -223,10 +251,6 @@
-
-
-
@@ -294,7 +318,7 @@
:class="{ shop_sku_box_item_selected: selectedSpecs[specType] === option }">
{{option}}
+ v-if="specifications.item.result&& specifications.item.result.isSoldStock== 1 && selectedSpecs[specType] === option">
售罄
{{option.proName}}
/{{option.unitName}}
-
+
售罄
@@ -353,7 +377,7 @@
-
+
@@ -412,6 +436,9 @@
import shoppingCartes from './components/shoppingCartes.vue'
import confirmorder from './components/confirmorder.vue'
import Loading from '@/components/Loading.vue';
+ import dayjs from 'dayjs';
+ import isBetween from 'dayjs/plugin/isBetween'
+ dayjs.extend(isBetween)
// 获取全局属性
const {
@@ -628,7 +655,7 @@
item: {
groupSnap: [],
result: {
- isPauseSale: 0
+ isSoldStock: 0
}
},
@@ -676,12 +703,13 @@
specInfo: selectedSpecsStr.value,
id: specifications.item.id
});
+ // skuList
if (result != true) {
specifications.sku_id = result.id
specifications.product_id = result.productId
// 添加多规格分组
specifications.item.result = result
- if (result.isPauseSale == 0) {
+ if (result.isSoldStock == 0) {
canSubmit.value = true;
} else {
canSubmit.value = false;
@@ -792,7 +820,12 @@
}
} else {
if (!res && shopCartNumber.value < 1) {
- shopCartNumber.value = parseFloat(specifications.item.suitNum);
+ console.log(res, specifications)
+ if (specifications.type == 'sku') {
+ shopCartNumber.value = parseFloat(specifications.item.result.suitNum);
+ } else {
+ shopCartNumber.value = parseFloat(specifications.item.suitNum);
+ }
} else {
shopCartNumber.value++;
}
@@ -897,6 +930,14 @@
// 提交选择并执行下一步操作的方法
const submitSelection = async () => {
+ if (!isProductAvailable(specifications.productListitem.days, specifications.productListitem.startTime,
+ specifications.productListitem.endTime)) {
+ uni.showToast({
+ title: '不在可售时间内'
+ })
+ return false;
+ }
+ // 判断购物车是否有该选中商品
// 数量不能少于0
if (shopCartNumber.value <= 0) {
return;
@@ -906,13 +947,17 @@
let res = await shoppingcart()
// 是否是套餐 有就传
- if (specifications.item.type != "package") {
+ if (specifications.item.type == "package") {
+ // 需求更改:所所有商品套餐都是add,没有修改
+ res = null
+ } else {
selectedGroupSnap.value = []
}
websocketsendMessage({
id: res ? res.cartListId : '',
type: 'shopping',
+ suitNum: specifications.productListitem.suitNum,
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: res ? 'edit' : 'add',
@@ -932,15 +977,16 @@
} else {
return;
}
-
-
}
-
//获取多规格数据
const clickspecifications = async (item, index, indexs, type) => {
+ console.log(item)
// 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
- if (item.isSoldStock == 1 || item.isSaleTime == 0 || item.type == 'single' || item.type == 'weight' || (item.type == 'package' && item.groupType == '0')) {
+ if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow) || item.type == 'single' ||
+ item
+ .type == 'weight' || (
+ item.type == 'package' && item.groupType == '0')) {
return false;
}
// 数量清零
@@ -948,6 +994,7 @@
// 初始化
let data = {
item: item,
+ productListitem: item,
type: '',
product_id: '',
sku_id: ''
@@ -964,6 +1011,7 @@
selectedOptions.value = []
specifications.product_id = res.id
specifications.sku_id = item.skuId
+ shopCartNumber.value = 1
}
// 购物车是否有商品
specifications.type = res.type
@@ -974,10 +1022,49 @@
specifications.item.amountcartNumber = 0
showShopsku.value = true
}
+ // 判断商品是否在可售时间内
+ const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
+ // 将后端返回的字符串转换为数组
+ const sellDays = sellDaysStr.split(',');
+ const now = dayjs();
+ const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
+ const currentDay = days[now.day()];
+
+ // console.log('当前日期:', currentDay);
+ // console.log('可售日期列表:', sellDays);
+
+ // 检查当前周几是否在可售周几列表中
+ if (!sellDays.includes(currentDay)) {
+ // console.log('当前日期不在可售日期列表中');
+ return false;
+ }
+
+ const startTime = dayjs(`${now.format('YYYY-MM-DD')} ${startTimeStr}`);
+ let endTime = dayjs(`${now.format('YYYY-MM-DD')} ${endTimeStr}`);
+
+ // 处理跨天情况
+ if (endTime.isBefore(startTime)) {
+ endTime = endTime.add(1, 'day');
+ }
+
+ // console.log('当前时间:', now.format('YYYY-MM-DD HH:mm:ss'));
+ // console.log('开始时间:', startTime.format('YYYY-MM-DD HH:mm:ss'));
+ // console.log('结束时间:', endTime.format('YYYY-MM-DD HH:mm:ss'));
+
+ const isInRange = now.isBetween(startTime, endTime, null, '[)');
+ // console.log('当前时间是否在可售时间范围内:', isInRange);
+
+ return isInRange;
+ }
// 单规格
const singleclick = async (item, i) => {
- console.log(item)
+ if (!isProductAvailable(item.days, item.startTime, item.endTime)) {
+ uni.showToast({
+ title: '不在可售时间内'
+ })
+ return false;
+ }
// 判断购物车是否有该选中商品
let res = null
try {
@@ -987,6 +1074,10 @@
} catch (error) {
//TODO handle the exception
}
+
+ // 保存这次点击的
+ specifications.productListitem = item
+
// 是否起售 如果小于或者大于都是1
let suitNum = 1;
const cartNumberFloat = parseFloat(item.cartNumber);
@@ -998,6 +1089,7 @@
websocketsendMessage({
id: res ? item.cartListId : '',
type: 'shopping',
+ suitNum: item.suitNum,
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: await calculateValue(item.cartNumber, i, suitNum) == 'del' ? 'del' : res ?
@@ -1105,6 +1197,7 @@
if (Message) {
// 心跳返回 过滤
if (Message.type == "ping_interval" || Message.msg_id == "ping_interval") {
+ isLoading.value = false;
return false
}
// 检查消息是否已经处理过
@@ -1115,7 +1208,6 @@
// 初始化
if (Message.operate_type == "init") {
- console.log(Message)
cartList.value = Message.data
uni.hideLoading();
isLoading.value = false;
@@ -1161,6 +1253,33 @@
productqueryProduct()
}
+ // 提示
+ if (Message.status == 0 && Message.type != 'no_suit_num') {
+ uni.showToast({
+ title: Message.msg,
+ icon: "none"
+ })
+ }
+
+ if (Message.type == 'no_suit_num') {
+ // console.log(specifications)
+ uni.showModal({
+ title: '提示',
+ showCancel: false,
+ content: '此商品库存不足起售数量!',
+ success: async (data) => {
+ await websocketsendMessage({
+ id: Message.id,
+ type: 'shopping',
+ table_code: uni.cache.get('tableCode'),
+ shop_id: uni.cache.get('shopId'),
+ operate_type: 'del',
+ is_print: 1,
+ })
+ }
+ });
+ }
+
//除去p 每次返回都回执消息
await websocketsendMessage({
type: 'receipt',
@@ -1306,7 +1425,6 @@
}
}, 0);
}
- console.log(cartone, 'orderinfo.value')
// 购物车总数价格
let cart = 0
if (matchedProducts.value.length > 0) {
@@ -1332,7 +1450,6 @@
}, 0);
}
cart = parseFloat(cartone) + parseFloat(cart)
- console.log(cart, 'orderinfo.value')
// 向上取整并保留两位小数
return parseFloat(cart.toFixed(2));
});
@@ -1453,12 +1570,15 @@
//TODO handle the exception
//第一步:将所有商品的 cartNumber 初始化为 0
shopProductList.productInfo.forEach((group) => {
- group.productList.forEach((product) => {
+ group.productList.forEach(async (product) => {
product.cartNumber = 0;
+ product.isSaleTimeshow = await isProductAvailable(product.days, product
+ .startTime, product.endTime)
});
});
- shopProductList.hots.forEach((i) => {
+ shopProductList.hots.forEach(async (i) => {
i.cartNumber = 0
+ i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime)
})
scrollTopSize.value = 0
topArr.value = []
@@ -1599,12 +1719,32 @@
height: 204rpx;
}
+ .vifgoodsImg {
+ width: 100%;
+ height: 204rpx;
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 9;
+ background-color: rgb(0, 0, 0, 0.5);
+
+ image {
+ padding: 30rpx;
+ width: 100%;
+ height: 100%;
+ }
+ }
+
+
.panelfiveitemone {
margin-top: 32rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
+ overflow: hidden; //超出的文本隐藏
+ text-overflow: ellipsis; //溢出用省略号显示
+ white-space: nowrap; //溢出不换行
}
.panelfiveitemtow {
@@ -1893,16 +2033,32 @@
width: 120rpx;
height: 120rpx;
margin-right: 18rpx;
- margin-left: 2px;
}
.goodsImg {
+ position: relative;
width: 200rpx;
height: 200rpx;
border-radius: 18rpx;
flex-shrink: 0;
}
+ .vifgoodsImg {
+ width: 200rpx;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 9;
+ background-color: rgb(0, 0, 0, 0.5);
+
+ image {
+ padding: 30rpx;
+ width: 100%;
+ height: 100%;
+ }
+ }
+
.topSort {
width: 92rpx;
height: 38rpx;
diff --git a/static/ztt/icon_goods_kcbz.svg b/static/ztt/icon_goods_kcbz.svg
new file mode 100644
index 0000000..c73177e
--- /dev/null
+++ b/static/ztt/icon_goods_kcbz.svg
@@ -0,0 +1,14 @@
+
diff --git a/static/ztt/icon_goods_sq.svg b/static/ztt/icon_goods_sq.svg
new file mode 100644
index 0000000..b029fd4
--- /dev/null
+++ b/static/ztt/icon_goods_sq.svg
@@ -0,0 +1,14 @@
+
diff --git a/static/ztt/icon_goods_wks.svg b/static/ztt/icon_goods_wks.svg
new file mode 100644
index 0000000..5d89f12
--- /dev/null
+++ b/static/ztt/icon_goods_wks.svg
@@ -0,0 +1,14 @@
+
diff --git a/static/ztt/icon_goods_yxj.svg b/static/ztt/icon_goods_yxj.svg
new file mode 100644
index 0000000..710c2b3
--- /dev/null
+++ b/static/ztt/icon_goods_yxj.svg
@@ -0,0 +1,14 @@
+