From e9655643d62bd9df4eeedb8bef45bdb5ad7c9559 Mon Sep 17 00:00:00 2001
From: ISFP_T <68358856@qq.com>
Date: Fri, 27 Feb 2026 15:26:17 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages-user/pages/add-card/index.vue | 37 ++++++++++++-------------
src/pages/home/index.vue | 18 ++++++------
2 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/src/pages-user/pages/add-card/index.vue b/src/pages-user/pages/add-card/index.vue
index db83e7e..daed2c8 100644
--- a/src/pages-user/pages/add-card/index.vue
+++ b/src/pages-user/pages/add-card/index.vue
@@ -2,7 +2,7 @@
import * as R from "ramda";
const { t } = useI18n();
// @ts-ignore
-import {debounce} from "throttle-debounce";
+import { debounce } from "throttle-debounce";
// @ts-ignore
import Config from "@/config";
@@ -24,10 +24,10 @@ const handleSubmit = debounce(Config.debounceLongTime, submit, {
From 9f2d2f876483aa693b31adbbd04de08c6675cc00 Mon Sep 17 00:00:00 2001
From: ISFP_T <68358856@qq.com>
Date: Tue, 3 Mar 2026 09:42:22 +0800
Subject: [PATCH 2/2] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
env/.env.development | 4 +-
src/locale/en.json | 7 +
src/locale/zh-Hans.json | 7 +
src/manifest.json | 4 +-
src/pages-store/pages/list/index.vue | 2 +-
src/pages-store/pages/order/checkout.vue | 446 ++++++++++++++---
src/pages-store/pages/store/index.vue | 121 ++++-
src/pages-user/pages/add-card/index.vue | 56 ++-
src/pages-user/pages/cart/index.vue | 456 ++++++++++++++----
src/pages-user/pages/member/index.vue | 5 +-
.../tabbar-home/components/class-bullet.vue | 18 +-
.../tabbar-home/components/tabs-type.vue | 2 +-
.../components/tabbar-home/tabbar-home.vue | 40 +-
src/service/merchant.ts | 27 +-
src/service/merchantCart.ts | 47 ++
src/service/merchantOrder.ts | 184 +++++++
src/service/types.ts | 16 +-
17 files changed, 1232 insertions(+), 210 deletions(-)
diff --git a/env/.env.development b/env/.env.development
index 52da8f1..8285797 100644
--- a/env/.env.development
+++ b/env/.env.development
@@ -4,7 +4,7 @@ NODE_ENV=development
VITE_DELETE_CONSOLE=false
#本地环境
-#VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
-VITE_SERVER_BASEURL=http://192.168.5.33:8889
+VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
+#VITE_SERVER_BASEURL=http://192.168.5.64:8080
#VITE_SERVER_BASEURL=http://192.168.0.148:8888
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
\ No newline at end of file
diff --git a/src/locale/en.json b/src/locale/en.json
index 1f6680e..b3d9679 100644
--- a/src/locale/en.json
+++ b/src/locale/en.json
@@ -261,6 +261,9 @@
"onTheWay": "OTW",
"title": "History"
},
+ "store": {
+ "all": "All"
+ },
"search": {
"hot-title": "Popular Categories",
"recently": "Recently",
@@ -516,6 +519,10 @@
}
},
"pages-user": {
+ "add-card": {
+ "loading": "Loading...",
+ "loadFailed": "Loading failed, please try again"
+ },
"balance": {
"all": "All",
"detail-list": "Detail list",
diff --git a/src/locale/zh-Hans.json b/src/locale/zh-Hans.json
index b6095cf..ce58485 100644
--- a/src/locale/zh-Hans.json
+++ b/src/locale/zh-Hans.json
@@ -261,6 +261,9 @@
"onTheWay": "在路上",
"title": "订单"
},
+ "store": {
+ "all": "全部"
+ },
"search": {
"hot-title": "热搜",
"recently": "历史记录",
@@ -516,6 +519,10 @@
}
},
"pages-user": {
+ "add-card": {
+ "loading": "加载中...",
+ "loadFailed": "加载失败,请重试"
+ },
"balance": {
"all": "全部",
"detail-list": "明细列表",
diff --git a/src/manifest.json b/src/manifest.json
index 88c895d..bf3b0fd 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,8 +2,8 @@
"name" : "CHEFLINK delivery",
"appid" : "__UNI__06509BE",
"description" : "",
- "versionName" : "1.0.11",
- "versionCode" : 111,
+ "versionName" : "1.0.13",
+ "versionCode" : 113,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
diff --git a/src/pages-store/pages/list/index.vue b/src/pages-store/pages/list/index.vue
index 04e6abf..d640b66 100644
--- a/src/pages-store/pages/list/index.vue
+++ b/src/pages-store/pages/list/index.vue
@@ -29,7 +29,7 @@ function getList(pageNum: number, pageSize: number) {
recipeCategoryId:props.id
},
}).then(res => {
- resolve(res)
+ resolve(res.data)
})
})
}
diff --git a/src/pages-store/pages/order/checkout.vue b/src/pages-store/pages/order/checkout.vue
index fa97f33..5b1bc74 100644
--- a/src/pages-store/pages/order/checkout.vue
+++ b/src/pages-store/pages/order/checkout.vue
@@ -16,6 +16,10 @@ import {
type MerchantVo,
appMerchantOrderCalculatePriceCartPost,
appUserCardSelectDefaultPost, appMerchantOrderCreateOrderCartPost, appMerchantOrderPayOrderPost,
+ appMerchantOrderCreateOrderCartBatchPost,
+ appMerchantOrderCalculatePriceCartBatchPost,
+ appMerchantCartListMerchantPost,
+ appMerchantOrderPayOrderBatchPost
} from "@/service";
import useEventEmit from "@/hooks/useEventEmit";
import {EventEnum} from "@/constant/enums";
@@ -27,8 +31,8 @@ const userStore = useUserStore();
// 送达偏好
const visitMethodRef = ref();
const visitMethod = ref({
- value: 0,
- label: t("components.visit.leaveItToMePersonally"),
+ value: 2,
+ label: t("components.visit.putItAtTheDoor"),
});
function chooseVisitMethod() {
visitMethodRef.value?.onOpen(visitMethod.value.value);
@@ -236,6 +240,8 @@ useEventEmit(EventEnum.CHOOSE_PAYMENT_METHOD, (data) => {
const storeId = ref('')
+const orderType = ref('') // 订单类型:batch-批量下单,normal-普通下单
+const batchCartIds = ref([]) // 批量下单的购物车ID列表
const formData = ref({
orderRemark: '',
phone: '',
@@ -249,7 +255,26 @@ const formData = ref({
const needTableware = ref(false)
onLoad((options: any)=> {
loading.value = true
- if(options.storeId) {
+
+ // 判断是批量下单还是普通下单
+ if(options.type == 'batch' && options.cartIds) {
+ // 批量下单模式
+ orderType.value = 'batch'
+ batchCartIds.value = options.cartIds.split(',')
+ console.log("下单类型",options.type);
+
+ // 默认取用户信息中的手机号作为收货手机号
+ formData.value.phone = userStore.userInfo.phone || ''
+ contact.value.areaCode = userStore.userInfo.areaCode || ''
+ // 获取用户地址列表
+ getAddressList()
+ // 查询批量购物车详情
+ getBatchCartInfo()
+ // 查询用户默认信用卡
+ appUserCardSelectDefault()
+ } else if(options.storeId) {
+ // 普通下单模式
+ orderType.value = 'normal'
storeId.value = options.storeId as string
formData.value.orderRemark = options.orderRemark as string
@@ -310,11 +335,77 @@ function getCartInfo() {
loading.value = false
})
}
+
+// 批量下单:查询购物车详情
+async function getBatchCartInfo() {
+ try {
+ // 根据购物车ID列表,按店铺分组查询
+ const cartIds = batchCartIds.value
+ console.log('批量购物车ID列表', cartIds)
+
+ // 1. 先获取所有店铺列表
+ const merchantRes = await appMerchantCartListMerchantPost({});
+ console.log('批量模式-购物车店铺列表', merchantRes);
+
+ if (!merchantRes.data || merchantRes.data.length === 0) {
+ cartDataList.value = [];
+ return;
+ }
+
+ // 2. 对每个店铺查询完整的商品信息
+ const merchantPromises = merchantRes.data.map(async (merchant: any) => {
+ try {
+ const cartRes = await appMerchantCartListByMerchantIdPost({
+ params: {
+ merchantId: merchant.id
+ }
+ });
+ console.log(`批量模式-店铺 ${merchant.merchantName} 的商品列表`, cartRes);
+
+ // 只保留选中的商品(根据 cartIds 过滤)
+ const filteredItems = (cartRes.data || []).filter((item: any) =>
+ cartIds.includes(String(item.id))
+ );
+
+ // 如果该店铺有选中的商品,才返回
+ if (filteredItems.length > 0) {
+ return {
+ ...merchant,
+ merchantCartVoList: filteredItems
+ };
+ }
+ return null;
+ } catch (error) {
+ console.error(`获取店铺 ${merchant.id} 商品失败`, error);
+ return null;
+ }
+ });
+
+ // 3. 等待所有店铺的商品信息加载完成,并过滤掉 null
+ const results = await Promise.all(merchantPromises);
+ cartDataList.value = results.filter(item => item !== null);
+ console.log('批量模式-最终购物车数据', cartDataList.value);
+
+ // 查询菜品会员折扣价
+ if(cartIds.length > 0) {
+ appMerchantCartCalculateSavings()
+ // 注意:价格计算会在地址加载完成后自动调用
+ // 这里不需要立即调用 appMerchantOrderCalculatePriceCart()
+ }
+ } catch (error) {
+ console.error('获取批量购物车详情失败', error)
+ cartDataList.value = [];
+ } finally {
+ loading.value = false
+ }
+}
+
// 查询菜品会员折扣价
const cartSavingsData = ref({})
function appMerchantCartCalculateSavings() {
+ const cartIds = orderType.value == 'batch' ? batchCartIds.value : cartDataList.value.map(item => item.id)
appMerchantCartCalculateSavingsPost({
- body: cartDataList.value.map(item => item.id)
+ body: cartIds
}).then(res=> {
console.log('菜品会员折扣价', res)
cartSavingsData.value = res.data
@@ -390,21 +481,43 @@ function appMerchantOrderCalculatePriceCart() {
// 优先使用新选择的地址id
const targetAddressId = selectedAddressId.value || currentAddressId.value
// if(!targetAddressId) return
- appMerchantOrderCalculatePriceCartPost({
- body: {
- addressId: targetAddressId,
- cartIds: cartDataList.value.map(item => item.id),
- receiveMethod: deliveryMethod.value === 0 ? 1 : 2,
- couponId: couponInfo.value ? couponInfo.value.id : '',
- tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
- // weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
- phone: formData.value.phone,
- areaCode: contact.value.areaCode,
- }
- }).then(res=> {
- console.log('购物车下单价格', res)
- priceData.value = res.data
- })
+
+ const cartIds = orderType.value == 'batch' ? batchCartIds.value : cartDataList.value.map(item => item.id)
+
+ // 批量模式使用批量计算价格接口
+ if(orderType.value == 'batch') {
+ appMerchantOrderCalculatePriceCartBatchPost({
+ body: {
+ addressId: targetAddressId,
+ cartIds: cartIds,
+ receiveMethod: deliveryMethod.value === 0 ? 1 : 2,
+ couponId: couponInfo.value ? couponInfo.value.id : '',
+ tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
+ phone: formData.value.phone,
+ areaCode: contact.value.areaCode,
+ }
+ }).then(res=> {
+ console.log('批量购物车下单价格', res)
+ priceData.value = res.data
+ })
+ } else {
+ // 普通模式使用单店铺计算价格接口
+ appMerchantOrderCalculatePriceCartPost({
+ body: {
+ addressId: targetAddressId,
+ cartIds: cartIds,
+ receiveMethod: deliveryMethod.value === 0 ? 1 : 2,
+ couponId: couponInfo.value ? couponInfo.value.id : '',
+ tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
+ // weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
+ phone: formData.value.phone,
+ areaCode: contact.value.areaCode,
+ }
+ }).then(res=> {
+ console.log('购物车下单价格', res)
+ priceData.value = res.data
+ })
+ }
}
// 获取用户地址列表
@@ -439,9 +552,16 @@ function getAddressList() {
// 回显送达偏好
if(+data.deliveryRemark === 1) {
visitMethod.value.label = t('components.visit.leaveItToMePersonally')
+ visitMethod.value.value = 1
}
if(+data.deliveryRemark === 2) {
visitMethod.value.label = t('components.visit.putItAtTheDoor')
+ visitMethod.value.value = 2
+ }
+
+ // 如果是批量模式,地址加载完成后重新计算价格
+ if(orderType.value === 'batch') {
+ appMerchantOrderCalculatePriceCart()
}
}
})
@@ -495,6 +615,7 @@ const isShowWeeklyDelivery = computed(()=> {
const passwordInputRef = ref(null)
const resOrderId = ref('')
+const resOrderIds = ref([]) // 批量下单返回的订单ID列表
function handleGoSettle() {
// 优先使用新选择的地址id
const targetAddressId = selectedAddressId.value || currentAddressId.value
@@ -512,59 +633,116 @@ function handleGoSettle() {
})
return
}
- if(!resOrderId.value) {
- let data = {
- addressId: targetAddressId,
- phone: formData.value.phone,
- areaCode: contact.value.areaCode,
- cartIds: cartDataList.value.map(item => item.id),
- couponId: couponInfo.value ? couponInfo.value.id : '',
- deliveryMethod: visitMethod.value.label, // 派送方式(如放门口或者交到顾客手中)
- deliveryType: deliveryTimeType.value, // 1-立即交付 2-预约交付
- orderRemark: formData.value.orderRemark,
- receiveMethod: deliveryMethod.value === 0 ? 1 : 2, // 收货方式(1-派送 2-自取)
- startScheduledTime: '', //
- endScheduledTime: '', //
- tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
- // weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
- needTableware: needTableware.value ? 1 : 2, // 餐具 1是 2否
- }
+
+ // 批量下单
+ if(orderType.value == 'batch') {
+ if(resOrderIds.value.length === 0) {
+ let data = {
+ addressId: targetAddressId,
+ phone: formData.value.phone,
+ areaCode: contact.value.areaCode,
+ cartIds: batchCartIds.value,
+ couponId: couponInfo.value ? couponInfo.value.id : '',
+ deliveryMethod: visitMethod.value.label, // 派送方式(如放门口或者交到顾客手中)
+ deliveryType: deliveryTimeType.value, // 1-立即交付 2-预约交付
+ orderRemark: formData.value.orderRemark,
+ receiveMethod: deliveryMethod.value === 0 ? 1 : 2, // 收货方式(1-派送 2-自取)
+ startScheduledTime: '', //
+ endScheduledTime: '', //
+ tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
+ needTableware: needTableware.value ? 1 : 2, // 餐具 1是 2否
+ }
- // 如果是预约派送
- if(deliveryTimeType.value === 1) {
- const result = getTimeStamps(showDeliveryTime.value);
- data.startScheduledTime = result.startTimestamp
- data.endScheduledTime = result.endTimestamp
+ // 如果是预约派送
+ if(deliveryTimeType.value === 1) {
+ const result = getTimeStamps(showDeliveryTime.value);
+ data.startScheduledTime = result.startTimestamp
+ data.endScheduledTime = result.endTimestamp
+ } else {
+ data.startScheduledTime = diyTime.value.startTime
+ data.endScheduledTime = diyTime.value.endTime
+ }
+ console.log('批量下单参数', data)
+ appMerchantOrderCreateOrderCartBatchPost({
+ body: data
+ }).then(res=> {
+ console.log('批量下单成功', res)
+ resOrderIds.value = res.data.orderIds || []
+ // 如果是余额支付,弹出支付密码弹窗
+ if(payMethodOptions.value.payMethod === 2) {
+ passwordInputRef.value?.showPasswordInput()
+ } else {
+ appMerchantOrderPayOrderBatch()
+ }
+ })
} else {
- data.startScheduledTime = diyTime.value.startTime
- data.endScheduledTime = diyTime.value.endTime
+ // 如果是余额支付,弹出支付密码弹窗
+ if(payMethodOptions.value.payMethod === 2) {
+ passwordInputRef.value?.showPasswordInput()
+ } else {
+ appMerchantOrderPayOrderBatch()
+ }
}
- console.log('下单参数', data)
- appMerchantOrderCreateOrderCartPost({
- body: data
- }).then(res=> {
- console.log('下单成功', res)
- resOrderId.value = res.data || ''
+ } else {
+ // 普通下单
+ if(!resOrderId.value) {
+ let data = {
+ addressId: targetAddressId,
+ phone: formData.value.phone,
+ areaCode: contact.value.areaCode,
+ cartIds: cartDataList.value.map(item => item.id),
+ couponId: couponInfo.value ? couponInfo.value.id : '',
+ deliveryMethod: visitMethod.value.label, // 派送方式(如放门口或者交到顾客手中)
+ deliveryType: deliveryTimeType.value, // 1-立即交付 2-预约交付
+ orderRemark: formData.value.orderRemark,
+ receiveMethod: deliveryMethod.value === 0 ? 1 : 2, // 收货方式(1-派送 2-自取)
+ startScheduledTime: '', //
+ endScheduledTime: '', //
+ tipDiscount: deliveryMethod.value === 1 ? 0 : (diyTipValue.value ? Number(diyTipValue.value) / 100 : (selectedTipIndex.value || 0) / 100), // 小费比例,自取订单不需要小费
+ // weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
+ needTableware: needTableware.value ? 1 : 2, // 餐具 1是 2否
+ }
+
+ // 如果是预约派送
+ if(deliveryTimeType.value === 1) {
+ const result = getTimeStamps(showDeliveryTime.value);
+ data.startScheduledTime = result.startTimestamp
+ data.endScheduledTime = result.endTimestamp
+ } else {
+ data.startScheduledTime = diyTime.value.startTime
+ data.endScheduledTime = diyTime.value.endTime
+ }
+ console.log('下单参数', data)
+ appMerchantOrderCreateOrderCartPost({
+ body: data
+ }).then(res=> {
+ console.log('下单成功', res)
+ resOrderId.value = res.data || ''
+ // 如果是余额支付,弹出支付密码弹窗
+ if(payMethodOptions.value.payMethod === 2) {
+ passwordInputRef.value?.showPasswordInput()
+ } else {
+ appMerchantOrderPayOrder()
+ }
+ })
+ } else {
// 如果是余额支付,弹出支付密码弹窗
if(payMethodOptions.value.payMethod === 2) {
passwordInputRef.value?.showPasswordInput()
} else {
appMerchantOrderPayOrder()
}
- })
- } else {
- // 如果是余额支付,弹出支付密码弹窗
- if(payMethodOptions.value.payMethod === 2) {
- passwordInputRef.value?.showPasswordInput()
- } else {
- appMerchantOrderPayOrder()
}
}
}
function payPawSuccess(password: string) {
payMethodOptions.value.payPassword = password
- appMerchantOrderPayOrder()
+ if(orderType.value === 'batch') {
+ appMerchantOrderPayOrderBatch()
+ } else {
+ appMerchantOrderPayOrder()
+ }
}
function appMerchantOrderPayOrder() {
@@ -588,6 +766,37 @@ function appMerchantOrderPayOrder() {
})
}
+// 批量订单支付
+function appMerchantOrderPayOrderBatch() {
+ // 使用批量支付接口
+ appMerchantOrderPayOrderBatchPost({
+ body: {
+ orderIds: resOrderIds.value,
+ cardId: payMethodOptions.value.cardId,
+ payMethod: payMethodOptions.value.payMethod,
+ payPassword: payMethodOptions.value.payPassword
+ }
+ }).then(res=> {
+ console.log('批量支付结果', res)
+ uni.showToast({
+ title: t('pages-store.checkout.paymentSuccess'),
+ icon: 'none'
+ })
+
+ setTimeout(()=> {
+ uni.navigateBack({
+ delta: 2,
+ })
+ }, 500)
+ }).catch(err => {
+ console.error('批量支付失败', err)
+ uni.showToast({
+ title: '支付失败',
+ icon: 'none'
+ })
+ })
+}
+
function getTimeStamps(timeStr: string) {
// 验证输入是否为空
if (!timeStr || typeof timeStr !== 'string') {
@@ -980,7 +1189,7 @@ function handleClose() {
-
+
{{ t("pages-store.checkout.orderInfoSummary") }}
+
+
+
+
+ {{ t("pages-store.checkout.orderInfoSummary") }}
+
+
+
+
+
+
+ {{ merchant.merchantName }}
+ {{ merchant.merchantCartVoList.length }} {{ t('pages-user.cart.items') }}
+
+
+
+
+
+
+
+
+
+
+ {{
+ item.merchantDishVo?.dishName
+ }}
+
+
+
+
+
+ {{ dish?.merchantSideDishItemVo?.name || '' }}
+
+ +${{ dish?.merchantSideDishItemVo?.price }}
+
+
+
+
+
+
+ ${{ item.merchantDishVo?.discountPrice }}
+ ${{ item.merchantDishVo?.originalPrice }}
+
+
+ x{{ item.count }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ t("pages-store.checkout.orderInfoSummary") }}
+
+ 已选择 {{ batchCartIds.length }} 件商品
+
+
+
+
@@ -1173,7 +1477,8 @@ function handleClose() {
{{ t('pages-store.order.subtotal') }}
- ${{ priceData?.actualAmount }}
+ ${{ priceData?.totalActualAmount || '0.00' }}
+ ${{ priceData?.actualAmount || '0.00' }}
@@ -1184,13 +1489,17 @@ function handleClose() {
mode="aspectFit"
/>
-
- ${{ (Number(priceData?.tax) + Number(priceData?.tip) + Number(priceData?.deliveryFee)).toFixed(2) }}
+
+ ${{ (Number(priceData?.totalTax || 0) + Number(priceData?.totalTip || 0) + Number(priceData?.totalDeliveryFee || 0)).toFixed(2) }}
+
+
+ ${{ (Number(priceData?.tax || 0) + Number(priceData?.tip || 0) + Number(priceData?.deliveryFee || 0)).toFixed(2) }}
{{ t('pages-store.order.total') }}
- ${{ priceData?.paidAmount }}
+ ${{ priceData?.totalPaidAmount || '0.00' }}
+ ${{ priceData?.paidAmount || '0.00' }}
@@ -1245,19 +1554,24 @@ function handleClose() {
{{ t('common.goSettle') }}
-
- {{ t('common.goSettle') }}
+ -->
+
diff --git a/src/pages-store/pages/store/index.vue b/src/pages-store/pages/store/index.vue
index 18efd3d..0225b5f 100644
--- a/src/pages-store/pages/store/index.vue
+++ b/src/pages-store/pages/store/index.vue
@@ -8,6 +8,7 @@ import { useScrollThreshold } from '@/hooks/useScrollThreshold'
import {
appCollectCollectPost, appMerchantCartCalculateSavingsPost, appMerchantCartListByMerchantIdPost,
appMerchantDetailMerchantIdGet,
+ appMerchantDishDishIdGet,
appMerchantMenuMenuListByUserPost, type MerchantCartVo,
type MerchantVo
} from "@/service";
@@ -138,7 +139,7 @@ function getStoreDetail() {
console.log('商家详情', res)
storeDetail.value = res.data as MerchantVo
- getMerchantCouponReceiveList()
+ // getMerchantCouponReceiveList()
// 解析营业时间并判断闭店提示
if (res.data.businessHours) {
@@ -149,13 +150,19 @@ function getStoreDetail() {
}
}
- if(res.data.merchantMenuVoList && res.data.merchantMenuVoList.length > 0) {
- tabs.value = res.data.merchantMenuVoList.map((item) => {
- return {
- title: item.menuName,
- key: item.id
- }
- })
+ if(res.data.merchantCategoryIds && res.data.merchantCategoryIds.length > 0) {
+ tabs.value = [
+ {
+ title: t('pages.store.all'),
+ key: ''
+ },
+ ...res.data.merchantCategoryIds.map((item) => {
+ return {
+ title: item.menuName,
+ key: item.id
+ }
+ })
+ ]
}
// 商户的经纬度存在,并且用户的经纬度也存在
@@ -283,7 +290,90 @@ function handleClickSegmented(index: number) {
}
const activeTab = ref(0);
-const tabs = ref([]);
+const tabs = ref([]);
+
+// 分页相关状态
+const pageNum = ref(1);
+const pageSize = ref(10);
+const hasMore = ref(true);
+const isLoadingMore = ref(false);
+const dishListByQuery = ref([]);
+
+// 计算当前显示的商品列表
+const currentDishList = computed(() => {
+ if(tabs.value[activeTab.value].key==''&&pageNum.value===1){
+ return storeDetail.value?.dishPage?.records
+ }
+ console.log(tabs.value[activeTab.value].key=='');
+ // 使用 dishListByQuery 作为数据源
+ return dishListByQuery.value || []
+})
+
+// 加载菜品列表
+async function loadDishList(isLoadMore = false) {
+ if (isLoadingMore.value) return;
+
+ const currentTab = tabs.value[activeTab.value];
+ if (!currentTab) return;
+
+ try {
+ isLoadingMore.value = true;
+
+ // 构建请求参数
+ const body: any = {
+ merchantId: storeID.value,
+ pageNum: isLoadMore ? pageNum.value : 1,
+ pageSize: pageSize.value
+ };
+
+ // 如果选中的tab的key不为空,则传递menuId
+ if (currentTab.key !== '') {
+ body.menuId = currentTab.key;
+ }
+
+ console.log('加载菜品列表参数', body);
+
+ const res = await appMerchantDishDishIdGet({ body });
+
+ if (res.data && res.data.rows) {
+ if (isLoadMore) {
+ // 加载更多,追加数据
+ dishListByQuery.value = [
+ ...dishListByQuery.value,
+ ...res.data.rows
+ ];
+ } else {
+ // 首次加载或刷新
+ dishListByQuery.value = res.data.rows;
+ }
+
+ // 更新分页信息
+ hasMore.value = res.data.rows.length >= pageSize.value;
+
+ if (isLoadMore) {
+ pageNum.value++;
+ }
+ }
+ } catch (error) {
+ console.error('加载菜品列表失败:', error);
+ } finally {
+ isLoadingMore.value = false;
+ }
+}
+
+// 监听tab切换,重置分页并加载数据
+watch(activeTab, () => {
+ pageNum.value = 1;
+ hasMore.value = true;
+ loadDishList(false);
+});
+
+// 触底加载更多
+onReachBottom(() => {
+ if (hasMore.value && !isLoadingMore.value) {
+ loadDishList(true);
+ }
+});
const showStatusBar = useScrollThreshold()
onPageScroll((e) => {
@@ -540,9 +630,9 @@ function handleShare() {
- {{ t('pages-store.store.recommend') }}
-
-
+ {{ t('pages-store.store.recommend') }}
+
+
@@ -563,6 +653,13 @@ function handleShare() {
:src="item?.dishImage?.split(',')[0]"
mode="aspectFill"
class="w-full h-full rounded-24rpx bg-common"
+ v-if="item.dishImage.split(',').length > 0"
+ />
+
diff --git a/src/pages-user/pages/add-card/index.vue b/src/pages-user/pages/add-card/index.vue
index daed2c8..4592bdc 100644
--- a/src/pages-user/pages/add-card/index.vue
+++ b/src/pages-user/pages/add-card/index.vue
@@ -97,29 +97,47 @@ export default {
mounted() {
console.log('mounted')
+ const locale = uni.getStorageSync('UNI_LOCALE') || 'en'
+ const loadingText = locale === 'zh-Hans' ? '加载中...' : 'Loading...'
+ uni.showLoading({
+ title: loadingText,
+ mask: true
+ })
this.init()
},
methods: {
async init(){
- console.log('本次初始化使用的key', Config.stripeKey)
- loadStripe.setLoadParameters({advancedFraudSignals: false});
- const stripe = await loadStripe(Config.stripeKey);
- this.stripe=stripe
- console.log(stripe)
- const options = {
- appearance: {/*...*/},
- };
- this.elements = stripe.elements(options);
- const paymentElement = this.elements.create('card',{disableLink:true});
- paymentElement.mount('#payment-form');
- this.elements.get
- paymentElement.on('change', (event)=> {
- console.log(event)
- if (event.complete) {
- this.isCompleted = true
- // enable payment button
- }
- });
+ try {
+ console.log('本次初始化使用的key', Config.stripeKey)
+ loadStripe.setLoadParameters({advancedFraudSignals: false});
+ const stripe = await loadStripe(Config.stripeKey);
+ this.stripe=stripe
+ console.log(stripe)
+ const options = {
+ appearance: {/*...*/},
+ };
+ this.elements = stripe.elements(options);
+ const paymentElement = this.elements.create('card',{disableLink:true});
+ paymentElement.mount('#payment-form');
+ this.elements.get
+ paymentElement.on('change', (event)=> {
+ console.log(event)
+ if (event.complete) {
+ this.isCompleted = true
+ // enable payment button
+ }
+ });
+ uni.hideLoading()
+ } catch (error) {
+ console.error('初始化失败', error)
+ uni.hideLoading()
+ const locale = uni.getStorageSync('UNI_LOCALE') || 'en'
+ const errorText = locale === 'zh-Hans' ? '加载失败,请重试' : 'Loading failed, please try again'
+ uni.showToast({
+ icon: 'none',
+ title: errorText
+ })
+ }
},
async handleSubmit(isSubmit){
console.log('handleSubmit',isSubmit,this.isCompleted)
diff --git a/src/pages-user/pages/cart/index.vue b/src/pages-user/pages/cart/index.vue
index bd5d4ce..5b3511a 100644
--- a/src/pages-user/pages/cart/index.vue
+++ b/src/pages-user/pages/cart/index.vue
@@ -1,5 +1,5 @@
@@ -133,69 +288,123 @@ function getCartList() {
v-show="!loading"
>
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
- {{
- item.merchantName
- }}
- {{ item.merchantCartVoList.length }} {{ t('pages-user.cart.items') }} · ${{ item.cartTotalPrice || 0 }}
- {{ t('pages-store.order.deliveryAddress') }}: {{ item.merchantAddress }}
+
-
+
+
-
-
-
-
-
+
+
+ {{
+ merchant.merchantName
+ }}
+
-
-
-
- {{ t('pages-user.cart.viewCart') }}
+
+
+
-
-
-
-
- {{ t('pages-user.cart.viewStore') }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{
+ item.merchantDishVo?.dishName
+ }}
+
+
+
+
+
+ {{ dish?.merchantSideDishItemVo?.name || '' }}
+
+ +${{ dish?.merchantSideDishItemVo?.price }}
+
+
+
+
+
+
+ ${{ item.merchantDishVo?.discountPrice }}
+ ${{ item.merchantDishVo?.originalPrice }}
+
+
+ x{{ item.count }}
+
+
+
+
+
+
+
@@ -216,10 +425,73 @@ function getCartList() {
+
+
+
+
-
diff --git a/src/pages-user/pages/member/index.vue b/src/pages-user/pages/member/index.vue
index eeb59bd..a46597e 100644
--- a/src/pages-user/pages/member/index.vue
+++ b/src/pages-user/pages/member/index.vue
@@ -70,6 +70,7 @@ function appMembershipRechargeItem() {
Free for 7 days
+
@@ -97,7 +98,7 @@ function appMembershipRechargeItem() {
-
+
diff --git a/src/pages/home/components/tabbar-home/components/class-bullet.vue b/src/pages/home/components/tabbar-home/components/class-bullet.vue
index e956b89..750e717 100644
--- a/src/pages/home/components/tabbar-home/components/class-bullet.vue
+++ b/src/pages/home/components/tabbar-home/components/class-bullet.vue
@@ -22,8 +22,8 @@
class="category-item"
@click="handleItemClick(item)"
>
-
- {{ item.categoryName }}
+
+ {{ item.categoryName || item.name }}
-
- {{ item.categoryName }}
+
+ {{ item.categoryName || item.name }}
@@ -85,9 +85,10 @@ import { computed, ref, onMounted, nextTick, getCurrentInstance } from 'vue'
// 定义分类项接口(与模板字段一致)
interface CategoryItem {
id: number
- categoryImage: string
- name: string,
- categoryName:any
+ categoryImage?: string
+ logoUrl?: string
+ name?: string
+ categoryName: string
}
// 定义组件属性
@@ -289,7 +290,7 @@ onMounted(() => {
justify-content: center;
min-width: 120rpx;
height: 60rpx;
- padding: 0 16rpx;
+ padding: 0 20rpx;
border: 1px solid #C8C8C8;
border-radius: 30rpx;
cursor: pointer;
@@ -304,6 +305,7 @@ onMounted(() => {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
+ flex-shrink: 0;
}
.category-text {
diff --git a/src/pages/home/components/tabbar-home/components/tabs-type.vue b/src/pages/home/components/tabbar-home/components/tabs-type.vue
index 0d76707..cce1efd 100644
--- a/src/pages/home/components/tabbar-home/components/tabs-type.vue
+++ b/src/pages/home/components/tabbar-home/components/tabs-type.vue
@@ -18,7 +18,7 @@ const props = defineProps({
},
imgKey: {
type: String,
- default: 'categoryImage',
+ default: 'logoUrl',
},
})
const emit = defineEmits(['changeType']);
diff --git a/src/pages/home/components/tabbar-home/tabbar-home.vue b/src/pages/home/components/tabbar-home/tabbar-home.vue
index 639945d..59ac88a 100644
--- a/src/pages/home/components/tabbar-home/tabbar-home.vue
+++ b/src/pages/home/components/tabbar-home/tabbar-home.vue
@@ -93,7 +93,7 @@ function appMarketActivityList() {
}
// 滚动信息获取 APP-商家标签分类控制器(用户端首页上面左右滚动的)
-const appMerchantLabelList = ref([])
+const appMerchantLabelList = ref([])
function getAppMerchantLabelList() {
appRecipeCategoryListGet({}).then(res => {
console.log('滚动信息获取 APP-商家标签分类控制器(用户端首页上面左右滚动的)', res)
@@ -167,6 +167,20 @@ function getList(pageNum: number, pageSize: number) {
})
}
+// 回到顶部
+const showBackToTop = ref(false)
+function scrollToTop() {
+ if (paging.value) {
+ paging.value.scrollToTop()
+ }
+}
+
+// 监听页面滚动
+function onPageScroll(e: any) {
+ // 滚动距离大于60时显示,小于等于60时隐藏
+ showBackToTop.value = e.detail.scrollTop > 120
+}
+
// 点击头部分类
const merchantLabelId = ref('')
function handleItemClick(e) {
@@ -186,7 +200,7 @@ const isShowMerchant = computed(()=> {
if(!selfPickup.value && !discount.value && !props.scoreRange && !props.price && !currentCategory.value) {
return true // 没有筛选条件时显示
} else {
- return false // 有筛选条件时隐藏
+ return true // 有筛选条件时隐藏
}
})
@@ -249,7 +263,7 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
},
]"
>
-
+
@@ -402,6 +416,11 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
{{ userStore.userCartAllData[0]?.merchantCartVoList?.length || 0 }}
+
+
+
+
+
@@ -426,4 +445,19 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
background-size: 100% 100%;
background-repeat: no-repeat;
}
+
+.back-to-top-btn {
+ position: fixed;
+ bottom: 148rpx;
+ left: 30rpx;
+ width: 88rpx;
+ height: 88rpx;
+ background-color: #14181B;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
+ z-index: 998;
+}
diff --git a/src/service/merchant.ts b/src/service/merchant.ts
index e67b79c..8b23b3a 100644
--- a/src/service/merchant.ts
+++ b/src/service/merchant.ts
@@ -16,13 +16,38 @@ export async function appMerchantDetailMerchantIdGet({
}) {
const { merchantId: param0, ...queryParams } = params;
- return request(`/app/merchant/detail/${param0}`, {
+ // return request(`/app/merchant/detail/${param0}`, {
+ // method: 'GET',
+ // params: { ...queryParams },
+ // ...(options || {}),
+ // });
+ return request(`/app/merchant/shopInfo/${param0}`, {
method: 'GET',
params: { ...queryParams },
...(options || {}),
});
}
+/** 根据菜品ID和店铺ID查询对应菜品 */
+export async function appMerchantDishDishIdGet({
+ body,
+ options,
+}: {
+ // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
+ body: API.AppMerchantDishdishIdGetParams;
+ options?: CustomRequestOptions;
+}) {
+ return request(`/app/merchant/dishPageByMenuId`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ })
+}
+
+
/** 商户编辑个人信息 POST /app/merchant/edit */
export async function appMerchantEditPost({
body,
diff --git a/src/service/merchantCart.ts b/src/service/merchantCart.ts
index cee5cee..7cce855 100644
--- a/src/service/merchantCart.ts
+++ b/src/service/merchantCart.ts
@@ -130,3 +130,50 @@ export async function appMerchantCartListMerchantPost({
...(options || {}),
});
}
+
+interface AppMerchantCartOrderBatchPostBody {
+ /** 购物车ID列表 */
+ cartIds: any[];
+}
+
+/** 批量购物车下单 */
+export async function appMerchantCartOrderBatchPost({
+ body,
+ options,
+}: {
+ body: AppMerchantCartOrderBatchPostBody;
+ options?: CustomRequestOptions;
+}) {
+ return request('/app/merchantOrder/createOrderCartBatch', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ })
+}
+
+
+interface AppMerchantOrderPayBatchPostBody {
+ /** 订单ID列表 */
+ orderIds: any[];
+}
+
+/** 订单批量支付 */
+export async function appMerchantOrderPayBatchPost({
+ body,
+ options,
+}: {
+ body: AppMerchantOrderPayBatchPostBody;
+ options?: CustomRequestOptions;
+}) {
+ return request('/app/merchantOrder/payOrderBatch', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ })
+}
\ No newline at end of file
diff --git a/src/service/merchantOrder.ts b/src/service/merchantOrder.ts
index bc77080..e38bccb 100644
--- a/src/service/merchantOrder.ts
+++ b/src/service/merchantOrder.ts
@@ -62,6 +62,62 @@ export async function appMerchantOrderCalculatePriceCartPost({
);
}
+/** 批量购物车下单 - 计算价格 POST /app/merchantOrder/calculatePriceCartBatch */
+export async function appMerchantOrderCalculatePriceCartBatchPost({
+ body,
+ options,
+}: {
+ body: API.CalculatePriceCartBatchBo;
+ options?: CustomRequestOptions;
+}) {
+ return request(
+ '/app/merchantOrder/calculatePriceCartBatch',
+ {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ }
+ );
+}
+
+/**
+ * CalculatePriceCartBatchBo - 批量计算价格参数
+ */
+export interface CalculatePriceCartBatchBo {
+ /**
+ * 配送地址id
+ */
+ addressId?: number;
+ /**
+ * 区号
+ */
+ areaCode?: string;
+ /**
+ * 购物车id列表
+ */
+ cartIds?: string[] | number[];
+ /**
+ * 优惠券id
+ */
+ couponId?: number;
+ /**
+ * 手机号
+ */
+ phone?: string;
+ /**
+ * 收货方式(1-派送 2-自取)
+ */
+ receiveMethod?: number;
+ /**
+ * 小费比例
+ */
+ tipDiscount?: number;
+ [property: string]: any;
+}
+
/** 商品下单 - 计算价格 POST /app/merchantOrder/calculatePriceDish */
export async function appMerchantOrderCalculatePriceDishPost({
body,
@@ -140,6 +196,93 @@ export async function appMerchantOrderCreateOrderCartPost({
});
}
+/** 购物车批量下单 POST /app/merchantOrder/createOrderCartBatch */
+export async function appMerchantOrderCreateOrderCartBatchPost({
+ body,
+ options,
+}: {
+ body: API.CreateOrderCartBatchBo;
+ options?: CustomRequestOptions;
+}) {
+ return request('/app/merchantOrder/createOrderCartBatch', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/**
+ * CreateOrderCartBatchBo - 批量下单参数
+ */
+export interface CreateOrderCartBatchBo {
+ /**
+ * 配送地址id
+ */
+ addressId?: number;
+ /**
+ * 区号
+ */
+ areaCode?: string;
+ /**
+ * 购物车id列表
+ */
+ cartIds?: string[] | number[];
+ /**
+ * 优惠券id
+ */
+ couponId?: number;
+ /**
+ * 派送方式(如放门口或者交到顾客手中)
+ */
+ deliveryMethod?: string;
+ /**
+ * 交付时间类型(1-立即交付 2-预约交付)
+ */
+ deliveryType?: number;
+ /**
+ * 订单备注
+ */
+ orderRemark?: string;
+ /**
+ * 手机号
+ */
+ phone: string;
+ /**
+ * 收货方式(1-派送 2-自取)
+ */
+ receiveMethod: number;
+ /**
+ * 预约时间- 开始
+ */
+ startScheduledTime?: number | string;
+ /**
+ * 预约时间- 结束
+ */
+ endScheduledTime?: number | string;
+ /**
+ * 小费比例
+ */
+ tipDiscount?: number;
+ /**
+ * 是否需要餐具(1-是 2-否)
+ */
+ needTableware?: number;
+ [property: string]: any;
+}
+
+/**
+ * RListLong - 返回订单ID列表
+ */
+export interface RListLong {
+ code?: number;
+ data?: number[];
+ msg?: string;
+ [property: string]: any;
+}
+
/** 菜品下单 POST /app/merchantOrder/createOrderDish */
export async function appMerchantOrderCreateOrderDishPost({
body,
@@ -290,6 +433,47 @@ export async function appMerchantOrderPayOrderPost({
});
}
+/** 批量订单付款 POST /app/merchantOrder/payOrderBatch */
+export async function appMerchantOrderPayOrderBatchPost({
+ body,
+ options,
+}: {
+ body: API.PayOrderBatchBo;
+ options?: CustomRequestOptions;
+}) {
+ return request('/app/merchantOrder/payOrderBatch', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/**
+ * PayOrderBatchBo - 批量订单支付参数
+ */
+export interface PayOrderBatchBo {
+ /**
+ * 订单ID列表
+ */
+ orderIds: number[] | string[];
+ /**
+ * 信用卡ID
+ */
+ cardId?: string;
+ /**
+ * 支付方式 1信用卡 2余额
+ */
+ payMethod: number;
+ /**
+ * 支付密码(余额支付时需要)
+ */
+ payPassword?: string;
+ [property: string]: any;
+}
+
/** 商家接单 POST /app/merchantOrder/receiveOrder */
export async function appMerchantOrderReceiveOrderPost({
params,
diff --git a/src/service/types.ts b/src/service/types.ts
index d6dfedb..6c65868 100644
--- a/src/service/types.ts
+++ b/src/service/types.ts
@@ -197,6 +197,13 @@
'merchantId': number;
}
+
+ export type AppMerchantDishdishIdGetParams = {
+ 'merchantId':any;
+ 'menuId':any;
+ 'pageNum':number;
+ 'pageSize':number;
+ }
export type AppMerchantDishAddViewCountPostParams =
{
@@ -4531,7 +4538,14 @@
'data'?: MerchantVo;
'systemTime'?: null;
}
-
+
+
+ export type RDishVo = {
+ 'code'?: number;
+ 'msg'?: string;
+ 'data'?: any;
+ 'systemTime'?: number;
+ }
export type RNumberStatisticsVo =
{