修复bug
This commit is contained in:
+2
-1
@@ -629,7 +629,8 @@
|
||||
"enter-verification-code": "Please enter the verification code"
|
||||
},
|
||||
"set-payment-password-successfully": "Setting the payment password successfully",
|
||||
"two-passwords-inconsistent": "The password is inconsistent when entered twice"
|
||||
"two-passwords-inconsistent": "The password is inconsistent when entered twice",
|
||||
"password-length-limit": "Password must be 8-16 characters long"
|
||||
},
|
||||
"recharge": {
|
||||
"amount": "Recharge amount",
|
||||
|
||||
@@ -629,7 +629,8 @@
|
||||
"enter-verification-code": "请输入验证码"
|
||||
},
|
||||
"set-payment-password-successfully": "设置支付密码成功",
|
||||
"two-passwords-inconsistent": "两次输入的密码不一致"
|
||||
"two-passwords-inconsistent": "两次输入的密码不一致",
|
||||
"password-length-limit": "密码长度必须为8-16位"
|
||||
},
|
||||
"recharge": {
|
||||
"amount": "充值金额",
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "CHEFLINK delivery",
|
||||
"appid" : "__UNI__06509BE",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.13",
|
||||
"versionCode" : 113,
|
||||
"versionName" : "1.0.21",
|
||||
"versionCode" : 121,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
@@ -29,7 +29,7 @@ onLoad(()=> {
|
||||
})
|
||||
|
||||
function handleClickDish(item: any) {
|
||||
navigateTo(`/pages-store/pages/store/dishes?id=${item.id}&storeId=${item.merchantId}`)
|
||||
navigateTo(`/pages-store/pages/store/index?id=${item.merchantId}`)
|
||||
}
|
||||
|
||||
function navigateTo(url: string) {
|
||||
|
||||
@@ -58,7 +58,8 @@ function confirmPhone(data: { phone: string; areaCode: string }) {
|
||||
}
|
||||
|
||||
// 配送时间 1 即刻配送 2 预约配送
|
||||
const deliveryTimeType = ref(1);
|
||||
// 当前业务仅支持预约配送,默认值设置为 2
|
||||
const deliveryTimeType = ref(2);
|
||||
// 配送时间配置
|
||||
const deliveryMinutes = ref(0); // 预计送达时间(分钟)
|
||||
// 自取时间配置
|
||||
@@ -92,21 +93,22 @@ const showDeliveryTime = computed(() => {
|
||||
}
|
||||
return "";
|
||||
});
|
||||
// 切换配送时间点击事件
|
||||
// 切换配送时间点击事件(目前仅支持预约配送)
|
||||
function toggleDeliveryTimeType(type: number) {
|
||||
if (type === 2) {
|
||||
if (userSelectedDeliveryTimeDate.value) {
|
||||
deliveryTimeType.value = type;
|
||||
}
|
||||
// 统一设置为预约配送
|
||||
deliveryTimeType.value = 2;
|
||||
|
||||
// 跳转到时间选择页面
|
||||
console.log(storeDetail.value.merch);
|
||||
const businessHours = (storeDetail.value as any)?.businessHours;
|
||||
const url = businessHours
|
||||
? `/pages/address/reservation-time?storeBusinessHours=${encodeURIComponent(
|
||||
businessHours
|
||||
)}`
|
||||
: "/pages/address/reservation-time";
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/address/reservation-time?storeBusinessHours=" + storeDetail.value.businessHours,
|
||||
url,
|
||||
});
|
||||
} else {
|
||||
deliveryTimeType.value = type;
|
||||
}
|
||||
}
|
||||
|
||||
const diyTime = ref({})
|
||||
@@ -118,9 +120,13 @@ useEventEmit(EventEnum.CHOOSE_APPOINTMENT_TIME, (data) => {
|
||||
|
||||
// 配送还是自取
|
||||
if(deliveryMethod.value === 0) {
|
||||
userSelectedDeliveryTimeDate.value = dayjs(data.date).format('MM-DD') + ' ' + data.timeSlot;
|
||||
userSelectedDeliveryTimeDate.value =
|
||||
dayjs(data.date).format('MM-DD') +
|
||||
(data.timeSlot ? ' ' + data.timeSlot : '');
|
||||
} else {
|
||||
userSelectedSelfPickupTimeDate.value = dayjs(data.date).format('MM-DD') + ' ' + data.timeSlot;
|
||||
userSelectedSelfPickupTimeDate.value =
|
||||
dayjs(data.date).format('MM-DD') +
|
||||
(data.timeSlot ? ' ' + data.timeSlot : '');
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -161,8 +167,8 @@ function handleClickSegmented(index: number) {
|
||||
|
||||
if(index !== deliveryMethod.value) {
|
||||
deliveryMethod.value = index
|
||||
// 重置配送类型
|
||||
deliveryTimeType.value = 1
|
||||
// 重置配送类型为预约配送
|
||||
deliveryTimeType.value = 2
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
}
|
||||
@@ -170,33 +176,70 @@ function handleClickSegmented(index: number) {
|
||||
// 折叠面板
|
||||
const collapseValue = ref([""]);
|
||||
|
||||
// 当前选中的小费
|
||||
const selectedTipIndex = ref(5);
|
||||
// 单个订单的小费
|
||||
const selectedTipIndex = ref(0);
|
||||
const diyTipValue = ref('')
|
||||
// 批量订单:每个店铺的小费索引映射 merchantId -> tipIndex
|
||||
const merchantTipIndexMap = ref<Record<string, number>>({})
|
||||
// 批量订单:每个店铺的自定义小费值映射 merchantId -> diyTipValue
|
||||
const merchantDiyTipValueMap = ref<Record<string, string>>({})
|
||||
|
||||
const tipOptions = ref([
|
||||
{
|
||||
label: "5%",
|
||||
label: "$3",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: "$5",
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: "10%",
|
||||
label: "$10",
|
||||
value: 10,
|
||||
},
|
||||
{
|
||||
label: "15%",
|
||||
value: 15,
|
||||
},
|
||||
]);
|
||||
|
||||
// 单个订单的小费选择
|
||||
function selectedTipChange(item: any) {
|
||||
if(item.value === selectedTipIndex.value) return
|
||||
diyTipValue.value = ''
|
||||
selectedTipIndex.value = item.value
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
function handleConfirmTip() {
|
||||
if(diyTipValue.value) {
|
||||
|
||||
// 批量订单:选择某个店铺的小费
|
||||
function selectedTipChangeForMerchant(merchantId: string, item: any) {
|
||||
if(item.value === merchantTipIndexMap.value[merchantId]) return
|
||||
merchantDiyTipValueMap.value[merchantId] = ''
|
||||
merchantTipIndexMap.value[merchantId] = item.value
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
|
||||
// 单个订单的自定义小费确认(金额,单位:美元)
|
||||
function handleConfirmTip() {
|
||||
// 如果未填写其他小费金额,失去焦点时默认填充为 0
|
||||
const val = String(diyTipValue.value || '').trim()
|
||||
if (!val) {
|
||||
diyTipValue.value = '0'
|
||||
}
|
||||
// 使用自定义小费时,选中"其他"这一项
|
||||
if (selectedTipIndex.value !== 0) {
|
||||
selectedTipIndex.value = 0
|
||||
}
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
|
||||
// 批量订单:确认某个店铺的自定义小费(金额,单位:美元)
|
||||
function handleConfirmTipForMerchant(merchantId: string) {
|
||||
const val = String(merchantDiyTipValueMap.value[merchantId] || '').trim()
|
||||
if (!val) {
|
||||
merchantDiyTipValueMap.value[merchantId] = '0'
|
||||
}
|
||||
// 使用自定义小费时,选中"其他"这一项
|
||||
if (merchantTipIndexMap.value[merchantId] !== 0) {
|
||||
merchantTipIndexMap.value[merchantId] = 0
|
||||
}
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
|
||||
// 是否选择了配送周卡
|
||||
@@ -486,13 +529,44 @@ function appMerchantOrderCalculatePriceCart() {
|
||||
|
||||
// 批量模式使用批量计算价格接口
|
||||
if(orderType.value == 'batch') {
|
||||
// 构建 merchantCouponMap: { merchantId: couponId }
|
||||
const couponMap: Record<string, number> = {}
|
||||
Object.keys(merchantCouponMap.value).forEach(merchantId => {
|
||||
if(merchantCouponMap.value[merchantId]?.id) {
|
||||
couponMap[merchantId] = merchantCouponMap.value[merchantId].id
|
||||
}
|
||||
})
|
||||
|
||||
// 构建 merchantTipMap: { merchantId: tipAmount } (小费金额,单位:美元)
|
||||
const tipMap: Record<string, number> = {}
|
||||
cartDataList.value.forEach((merchant: any) => {
|
||||
const merchantId = String(merchant.id)
|
||||
if(deliveryMethod.value === 1) {
|
||||
// 自取订单不需要小费
|
||||
tipMap[merchantId] = 0
|
||||
} else {
|
||||
// 配送订单需要小费
|
||||
const diyTip = merchantDiyTipValueMap.value[merchantId]
|
||||
const tipIndex = merchantTipIndexMap.value[merchantId] || 0
|
||||
if(diyTip) {
|
||||
// 自定义小费金额(美元)
|
||||
tipMap[merchantId] = Number(diyTip) || 0
|
||||
} else if(tipIndex > 0) {
|
||||
// 选择固定金额选项
|
||||
tipMap[merchantId] = tipIndex
|
||||
} else {
|
||||
tipMap[merchantId] = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
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), // 小费比例,自取订单不需要小费
|
||||
merchantCouponMap: couponMap,
|
||||
merchantTipMap: tipMap, // 小费金额(美元)
|
||||
phone: formData.value.phone,
|
||||
areaCode: contact.value.areaCode,
|
||||
}
|
||||
@@ -502,13 +576,24 @@ function appMerchantOrderCalculatePriceCart() {
|
||||
})
|
||||
} else {
|
||||
// 普通模式使用单店铺计算价格接口
|
||||
// 计算小费金额(美元)
|
||||
let tipAmount = 0
|
||||
if(deliveryMethod.value === 0) {
|
||||
// 配送订单需要小费
|
||||
if(diyTipValue.value) {
|
||||
tipAmount = Number(diyTipValue.value) || 0
|
||||
} else if(selectedTipIndex.value > 0) {
|
||||
tipAmount = selectedTipIndex.value
|
||||
}
|
||||
}
|
||||
|
||||
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), // 小费比例,自取订单不需要小费
|
||||
tipDiscount: tipAmount, // 小费金额(美元),自取订单不需要小费
|
||||
// weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
|
||||
phone: formData.value.phone,
|
||||
areaCode: contact.value.areaCode,
|
||||
@@ -634,22 +719,62 @@ function handleGoSettle() {
|
||||
return
|
||||
}
|
||||
|
||||
// 仅支持预约配送:必须先选择预约时间
|
||||
if (deliveryTimeType.value === 2 && (!diyTime.value.startTime || !diyTime.value.endTime)) {
|
||||
uni.showToast({
|
||||
title: t('pages-store.checkout.chooseTime'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 批量下单
|
||||
if(orderType.value == 'batch') {
|
||||
if(resOrderIds.value.length === 0) {
|
||||
// 构建 merchantCouponMap: { merchantId: couponId }
|
||||
const couponMap: Record<string, number> = {}
|
||||
Object.keys(merchantCouponMap.value).forEach(merchantId => {
|
||||
if(merchantCouponMap.value[merchantId]?.id) {
|
||||
couponMap[merchantId] = merchantCouponMap.value[merchantId].id
|
||||
}
|
||||
})
|
||||
|
||||
// 构建 merchantTipMap: { merchantId: tipAmount } (小费金额,单位:美元)
|
||||
const tipMap: Record<string, number> = {}
|
||||
cartDataList.value.forEach((merchant: any) => {
|
||||
const merchantId = String(merchant.id)
|
||||
if(deliveryMethod.value === 1) {
|
||||
// 自取订单不需要小费
|
||||
tipMap[merchantId] = 0
|
||||
} else {
|
||||
// 配送订单需要小费
|
||||
const diyTip = merchantDiyTipValueMap.value[merchantId]
|
||||
const tipIndex = merchantTipIndexMap.value[merchantId] || 0
|
||||
if(diyTip) {
|
||||
// 自定义小费金额(美元)
|
||||
tipMap[merchantId] = Number(diyTip) || 0
|
||||
} else if(tipIndex > 0) {
|
||||
// 选择固定金额选项
|
||||
tipMap[merchantId] = tipIndex
|
||||
} else {
|
||||
tipMap[merchantId] = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let data = {
|
||||
addressId: targetAddressId,
|
||||
phone: formData.value.phone,
|
||||
areaCode: contact.value.areaCode,
|
||||
cartIds: batchCartIds.value,
|
||||
couponId: couponInfo.value ? couponInfo.value.id : '',
|
||||
merchantCouponMap: couponMap,
|
||||
merchantTipMap: tipMap,
|
||||
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否
|
||||
}
|
||||
|
||||
@@ -686,6 +811,17 @@ function handleGoSettle() {
|
||||
} else {
|
||||
// 普通下单
|
||||
if(!resOrderId.value) {
|
||||
// 计算小费金额(美元)
|
||||
let tipAmount = 0
|
||||
if(deliveryMethod.value === 0) {
|
||||
// 配送订单需要小费
|
||||
if(diyTipValue.value) {
|
||||
tipAmount = Number(diyTipValue.value) || 0
|
||||
} else if(selectedTipIndex.value > 0) {
|
||||
tipAmount = selectedTipIndex.value
|
||||
}
|
||||
}
|
||||
|
||||
let data = {
|
||||
addressId: targetAddressId,
|
||||
phone: formData.value.phone,
|
||||
@@ -698,7 +834,7 @@ function handleGoSettle() {
|
||||
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), // 小费比例,自取订单不需要小费
|
||||
tipDiscount: tipAmount, // 小费金额(美元),自取订单不需要小费
|
||||
// weeklyDeliveryFee: isWeeklyDelivery.value ? 1 : 2, // 是否支付周配送费(1-是 2-否)
|
||||
needTableware: needTableware.value ? 1 : 2, // 餐具 1是 2否
|
||||
}
|
||||
@@ -899,16 +1035,31 @@ export interface CreateOrderCartBo {
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
// 单个订单的优惠券信息
|
||||
const couponInfo = ref(null)
|
||||
function navigateToCoupon() {
|
||||
// 批量订单:每个店铺的优惠券映射 merchantId -> couponInfo
|
||||
const merchantCouponMap = ref<Record<string, any>>({})
|
||||
// 批量订单:每个店铺的小费映射 merchantId -> tipAmount (小费金额,单位:美元)
|
||||
const merchantTipMap = ref<Record<string, number>>({})
|
||||
// 批量订单:每个店铺的小费比例映射 merchantId -> tipPercent (小费比例,0-100)
|
||||
const merchantTipPercentMap = ref<Record<string, number>>({})
|
||||
|
||||
function navigateToCoupon(merchantId?: string) {
|
||||
const targetMerchantId = merchantId || storeId.value
|
||||
uni.navigateTo({
|
||||
url: '/pages-user/pages/coupon/list?id=' + storeId.value,
|
||||
url: '/pages-user/pages/coupon/list?id=' + targetMerchantId,
|
||||
events: {
|
||||
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
|
||||
selectedCoupon: function(data) {
|
||||
console.log(data)
|
||||
if(data) {
|
||||
if(orderType.value === 'batch' && merchantId) {
|
||||
// 批量模式:存储到对应店铺的优惠券映射
|
||||
merchantCouponMap.value[merchantId] = data
|
||||
} else {
|
||||
// 单个订单模式
|
||||
couponInfo.value = data
|
||||
}
|
||||
// 重新计算价格
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
@@ -916,8 +1067,14 @@ function navigateToCoupon() {
|
||||
},
|
||||
})
|
||||
}
|
||||
function handleClose() {
|
||||
function handleClose(merchantId?: string) {
|
||||
if(orderType.value === 'batch' && merchantId) {
|
||||
// 批量模式:清除对应店铺的优惠券
|
||||
delete merchantCouponMap.value[merchantId]
|
||||
} else {
|
||||
// 单个订单模式
|
||||
couponInfo.value = null
|
||||
}
|
||||
// 重新计算价格
|
||||
appMerchantOrderCalculatePriceCart()
|
||||
}
|
||||
@@ -1111,21 +1268,9 @@ function handleClose() {
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<!--配送-->
|
||||
<template v-if="storeIsDeliveryService && deliveryMethod === 0">
|
||||
<view class="flex-center-sb pb-36rpx px-30rpx gap-22rpx">
|
||||
<view
|
||||
@click="toggleDeliveryTimeType(1)"
|
||||
:class="[deliveryTimeType === 1 ? 'border-#333' : 'border-#D8D8D8']"
|
||||
class="w-full h-152rpx text-28rpx lh-28rpx border-solid border-1px rounded-20rpx center"
|
||||
>
|
||||
<view class="text-center">
|
||||
<view class="text-#333 mb-12rpx">
|
||||
{{ t("pages-store.checkout.immediateDelivery") }}
|
||||
</view>
|
||||
<view class="text-#7D7D7D">{{ storeDetail?.deliveryTime }}{{ t('common.minutes') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--配送:当前业务仅支持预约配送;batch 模式也要展示预约入口-->
|
||||
<template v-if="(storeIsDeliveryService || orderType === 'batch') && deliveryMethod === 0">
|
||||
<view class="pb-36rpx px-30rpx">
|
||||
<view
|
||||
@click="toggleDeliveryTimeType(2)"
|
||||
:class="[deliveryTimeType === 2 ? 'border-#333' : 'border-#D8D8D8']"
|
||||
@@ -1147,21 +1292,9 @@ function handleClose() {
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!--自取-->
|
||||
<template v-if="storeIsSelfPickup && deliveryMethod === 1">
|
||||
<view class="flex-center-sb pb-36rpx px-30rpx gap-22rpx">
|
||||
<view
|
||||
@click="toggleDeliveryTimeType(1)"
|
||||
:class="[deliveryTimeType === 1 ? 'border-#333' : 'border-#D8D8D8']"
|
||||
class="w-full h-152rpx text-28rpx lh-28rpx border-solid border-1px rounded-20rpx center"
|
||||
>
|
||||
<view class="text-center">
|
||||
<view class="text-#333 mb-12rpx">
|
||||
{{ t('pages-store.checkout.immediatePickup') }}
|
||||
</view>
|
||||
<view class="text-#7D7D7D">{{ storeDetail?.pickupTime }}{{ t('common.minutes') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--自取:当前业务仅支持预约自取;batch 模式同样展示预约入口 -->
|
||||
<template v-if="(storeIsSelfPickup || orderType === 'batch') && deliveryMethod === 1">
|
||||
<view class="pb-36rpx px-30rpx">
|
||||
<view
|
||||
@click="toggleDeliveryTimeType(2)"
|
||||
:class="[deliveryTimeType === 2 ? 'border-#333' : 'border-#D8D8D8']"
|
||||
@@ -1331,6 +1464,87 @@ function handleClose() {
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 批量模式:每个店铺的优惠券和小费选择 -->
|
||||
<view v-if="merchant.id" class="px-20rpx pb-20rpx border-top border-[#F2F2F2] mt-20rpx">
|
||||
<!-- 优惠券 -->
|
||||
<view @click="navigateToCoupon(String(merchant.id))" class="flex-center-sb py-24rpx gap-20rpx">
|
||||
<view class="flex-center-sb flex-1">
|
||||
<view class="flex items-center">
|
||||
<image
|
||||
src="@img/chef/105.png"
|
||||
mode="aspectFill"
|
||||
class="w-36rpx h-36rpx relative z-1"
|
||||
/>
|
||||
<view class="ml-20rpx text-26rpx lh-26rpx font-500 text-#333">
|
||||
{{ merchantCouponMap[String(merchant.id)] ? merchantCouponMap[String(merchant.id)].snapshotNameZh : t('pages-store.checkout.addCoupon') }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="merchantCouponMap[String(merchant.id)]" @click.stop="handleClose(String(merchant.id))" class="i-carbon:close-filled text-32rpx text-#7D7D7D"></view>
|
||||
</view>
|
||||
<image
|
||||
src="@img/chef/142.png"
|
||||
mode="aspectFill"
|
||||
class="w-24rpx h-24rpx shrink-0"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 小费(仅配送时显示) -->
|
||||
<view v-if="deliveryMethod === 0" class="border-top border-[#F2F2F2] pt-24rpx">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<image
|
||||
src="@img/chef/1335.png"
|
||||
mode="aspectFill"
|
||||
class="w-36rpx h-36rpx relative z-1"
|
||||
/>
|
||||
<view class="ml-20rpx text-26rpx lh-26rpx font-500 text-#333">
|
||||
{{ t('pages-store.checkout.chooseTips') }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-center-sb gap-16rpx">
|
||||
<view
|
||||
v-for="(item, index) in tipOptions"
|
||||
:key="index"
|
||||
@click="selectedTipChangeForMerchant(String(merchant.id), item)"
|
||||
:class="[
|
||||
merchantTipIndexMap[String(merchant.id)] === item.value
|
||||
? 'border-#333'
|
||||
: 'border-#D8D8D8',
|
||||
]"
|
||||
class="flex-1 h-64rpx text-24rpx lh-64rpx text-#333 rounded-16rpx border-solid border-1px center"
|
||||
>
|
||||
{{ item.label }}
|
||||
</view>
|
||||
<view
|
||||
@click="selectedTipChangeForMerchant(String(merchant.id), { value: 0 })"
|
||||
:class="[
|
||||
merchantTipIndexMap[String(merchant.id)] === 0
|
||||
? 'border-#333'
|
||||
: 'border-#D8D8D8',
|
||||
]"
|
||||
class="flex-1 h-64rpx text-24rpx lh-64rpx text-#333 rounded-16rpx border-solid border-1px center"
|
||||
>
|
||||
<view class="px-10rpx center">
|
||||
<wd-input
|
||||
no-border
|
||||
use-prefix-slot
|
||||
@blur="handleConfirmTipForMerchant(String(merchant.id))"
|
||||
custom-class="!center !text-24rpx !bg-transparent flex-1 !text-center"
|
||||
placeholderStyle="font-size: 24rpx;color: #333; text-align: center;"
|
||||
:placeholder="t('pages-store.checkout.other')"
|
||||
v-model="merchantDiyTipValueMap[String(merchant.id)]"
|
||||
@confirm="handleConfirmTipForMerchant(String(merchant.id))"
|
||||
>
|
||||
<template #suffix>
|
||||
<text v-if="merchantDiyTipValueMap[String(merchant.id)] && merchantDiyTipValueMap[String(merchant.id)].length > 0">$</text>
|
||||
</template>
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -1347,8 +1561,9 @@ function handleClose() {
|
||||
</view>
|
||||
|
||||
<view class="pt-36rpx pb-36rpx" >
|
||||
<!-- 优惠券 -->
|
||||
<view @click="navigateToCoupon" class="flex-center-sb border-bottom py-36rpx px-30rpx gap-20rpx">
|
||||
<!-- 单个订单模式:优惠券 -->
|
||||
<template v-if="orderType === 'normal'">
|
||||
<view @click="navigateToCoupon()" class="flex-center-sb border-bottom py-36rpx px-30rpx gap-20rpx">
|
||||
<view class="flex-center-sb flex-1">
|
||||
<view class="flex items-center">
|
||||
<image
|
||||
@@ -1360,8 +1575,7 @@ function handleClose() {
|
||||
{{ couponInfo ? couponInfo.snapshotNameZh : t('pages-store.checkout.addCoupon') }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="couponInfo" @click.stop="handleClose" class="i-carbon:close-filled"></view>
|
||||
<view v-if="couponInfo" @click.stop="handleClose()" class="i-carbon:close-filled text-36rpx text-#7D7D7D"></view>
|
||||
</view>
|
||||
<image
|
||||
src="@img/chef/142.png"
|
||||
@@ -1369,9 +1583,10 @@ function handleClose() {
|
||||
class="w-32rpx h-32rpx shrink-0"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="deliveryMethod === 0">
|
||||
<!-- 小费 -->
|
||||
<!-- 单个订单模式:小费(仅配送时显示) -->
|
||||
<template v-if="orderType === 'normal' && deliveryMethod === 0">
|
||||
<view class="border-bottom py-36rpx px-30rpx">
|
||||
<view class="flex items-center mb-28rpx">
|
||||
<image
|
||||
@@ -1385,8 +1600,9 @@ function handleClose() {
|
||||
</view>
|
||||
|
||||
<view class="flex-center-sb gap-22rpx">
|
||||
<template v-for="(item, index) in tipOptions">
|
||||
<view
|
||||
v-for="(item, index) in tipOptions"
|
||||
:key="index"
|
||||
@click="selectedTipChange(item)"
|
||||
:class="[
|
||||
selectedTipIndex === item.value
|
||||
@@ -1397,7 +1613,6 @@ function handleClose() {
|
||||
>
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</template>
|
||||
<view
|
||||
@click="selectedTipChange({ value: 0 })"
|
||||
:class="[
|
||||
@@ -1419,13 +1634,14 @@ function handleClose() {
|
||||
@confirm="handleConfirmTip"
|
||||
>
|
||||
<template #suffix>
|
||||
<text v-if="diyTipValue.length > 0">%</text>
|
||||
<text v-if="diyTipValue.length > 0">$</text>
|
||||
</template>
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 配送费周卡 -->
|
||||
<!-- <view v-if="isShowWeeklyDelivery" class="border-bottom px-30rpx py-36rpx">-->
|
||||
@@ -1471,7 +1687,7 @@ function handleClose() {
|
||||
<!-- {{ t('pages-store.checkout.tipsDesc') }}-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
</template>
|
||||
<!-- </template> -->
|
||||
|
||||
<!-- 费用明细 -->
|
||||
<view class="border-bottom px-30rpx py-32rpx">
|
||||
|
||||
@@ -112,10 +112,10 @@ function navigateBack() {
|
||||
const storeId = ref('')
|
||||
onLoad((options: any) => {
|
||||
loading.value = true;
|
||||
if(options.id) {
|
||||
if(options.id&&options.id!='undefined') {
|
||||
getDishDetail(options.id)
|
||||
}
|
||||
if(options.storeId) {
|
||||
if(options.storeId&&options.storeId!='undefined') {
|
||||
storeId.value = options.storeId
|
||||
getCartInfo()
|
||||
getStoreDetail()
|
||||
|
||||
@@ -139,7 +139,7 @@ function getStoreDetail() {
|
||||
console.log('商家详情', res)
|
||||
storeDetail.value = res.data as MerchantVo
|
||||
|
||||
// getMerchantCouponReceiveList()
|
||||
getMerchantCouponReceiveList()
|
||||
|
||||
// 解析营业时间并判断闭店提示
|
||||
if (res.data.businessHours) {
|
||||
@@ -270,6 +270,21 @@ function getMenuList() {
|
||||
const deliveryMethod = ref(0);
|
||||
const deliveryMethodOptions = [t('pages-store.store.delivery'), t('pages-store.store.pickup')];
|
||||
const showDeliverySwitch = ref(true); // 是否显示配送方式切换组件
|
||||
|
||||
// 配送时间显示:后端返回分钟;>= 1 天时换算成“天”,否则保持“分钟”
|
||||
function formatMinutesToDaysText(minutes?: number | string) {
|
||||
const m = Number(minutes)
|
||||
if (!Number.isFinite(m) || m <= 0) return '--'
|
||||
const MINUTES_PER_DAY = 60 * 24
|
||||
if (m < MINUTES_PER_DAY) return `${m} ${t('common.minutes')}`
|
||||
const days = m / MINUTES_PER_DAY
|
||||
// 保留 1 位小数并去掉末尾 0(例如 2.0 -> 2)
|
||||
let daysText = days.toFixed(1).replace(/\.0$/, '')
|
||||
daysText = '3';
|
||||
return `${daysText}${t('pages-store.store.days')}`
|
||||
}
|
||||
|
||||
const deliveryTimeText = computed(() => formatMinutesToDaysText(storeDetail.value?.deliveryTime as any))
|
||||
function handleClickSegmented(index: number) {
|
||||
console.log("切换配送方式:", index);
|
||||
if(+storeDetail.value.deliveryService !== 1 && index === 0) {
|
||||
@@ -319,6 +334,11 @@ async function loadDishList(isLoadMore = false) {
|
||||
try {
|
||||
isLoadingMore.value = true;
|
||||
|
||||
// 非加载更多场景下,固定先请求第 1 页,并将内部 pageNum 重置为 1
|
||||
if (!isLoadMore) {
|
||||
pageNum.value = 1;
|
||||
}
|
||||
|
||||
// 构建请求参数
|
||||
const body: any = {
|
||||
merchantId: storeID.value,
|
||||
@@ -347,12 +367,21 @@ async function loadDishList(isLoadMore = false) {
|
||||
dishListByQuery.value = res.data.rows;
|
||||
}
|
||||
|
||||
const gotFullPage = res.data.rows.length >= pageSize.value;
|
||||
// 更新分页信息
|
||||
hasMore.value = res.data.rows.length >= pageSize.value;
|
||||
hasMore.value = gotFullPage;
|
||||
|
||||
if (isLoadMore) {
|
||||
// 下一次请求再使用下一页页码
|
||||
if (gotFullPage) {
|
||||
pageNum.value++;
|
||||
}
|
||||
} else {
|
||||
// 首次/刷新后,下一次「加载更多」应该从第 2 页开始
|
||||
pageNum.value = gotFullPage ? 2 : 1;
|
||||
}
|
||||
} else {
|
||||
hasMore.value = false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载菜品列表失败:', error);
|
||||
@@ -361,10 +390,10 @@ async function loadDishList(isLoadMore = false) {
|
||||
}
|
||||
}
|
||||
|
||||
// 监听tab切换,重置分页并加载数据
|
||||
// 监听 tab 切换,重置数据并加载当前 tab 的第一页
|
||||
watch(activeTab, () => {
|
||||
pageNum.value = 1;
|
||||
hasMore.value = true;
|
||||
dishListByQuery.value = [];
|
||||
loadDishList(false);
|
||||
});
|
||||
|
||||
@@ -534,7 +563,7 @@ function handleShare() {
|
||||
></image>
|
||||
CHEFLINK
|
||||
</view>
|
||||
<text v-if="+storeDetail?.deliveryService === 1" class="text-#7D7D7D"> • {{ storeDetail?.deliveryTime }} {{ t('common.minutes') }}</text>
|
||||
<text v-if="+storeDetail?.deliveryService === 1" class="text-#7D7D7D"> • {{ deliveryTimeText }}</text>
|
||||
</view>
|
||||
<view class="text-24rpx lh-24rpx text-#7D7D7D text-center mt-16rpx">
|
||||
{{ t('pages-store.store.title') }} US${{ storeDetail?.minOrderPrice }}
|
||||
@@ -602,7 +631,7 @@ function handleShare() {
|
||||
</view>
|
||||
<view class="h-128rpx w-1rpx rotate-0 bg-#D8D8D8"></view>
|
||||
<view class="w-full flex-1 center flex-col pl-44rpx">
|
||||
<view class="text-#333 mb-8rpx">{{ storeDetail?.deliveryTime }} {{ t('common.minutes') }}</view>
|
||||
<view class="text-#333 mb-8rpx">{{ deliveryTimeText }}</view>
|
||||
<view class="text-#7D7D7D">{{ t('pages-store.store.earTime') }}</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -675,7 +704,7 @@ function handleShare() {
|
||||
<view class="flex-center-sb mt-12rpx">
|
||||
<view class="text-28rpx text-#999">
|
||||
<view class="line-through">US${{ item.originalPrice }}</view>
|
||||
<view>{{ t('pages-store.store.sales') }}:{{ item.salesCount }}</view>
|
||||
<!-- <view>{{ t('pages-store.store.sales') }}:{{ item.salesCount }}</view> -->
|
||||
</view>
|
||||
|
||||
<view class="center w-64rpx h-64rpx rounded-50% bg-white shadow-lg">
|
||||
|
||||
@@ -24,8 +24,8 @@ const FormSchema = z.object({
|
||||
oldLoginPwd: z.string()
|
||||
.min(1, {message: t('pages-user.pay-password.input-placeholder.enter-old-password')}),
|
||||
newLoginPwd: z.string()
|
||||
.min(1, {message: t('pages-user.pay-password.input-placeholder.enter-new-password')})
|
||||
.regex(/^\d{6}$/, {message: t('pages-user.pay-password.enter-6-digit-password')}),
|
||||
.min(8, {message: t('pages-user.pay-password.password-length-limit')})
|
||||
.max(16, {message: t('pages-user.pay-password.password-length-limit')}),
|
||||
confirmPwd: z.string()
|
||||
.min(1, {message: t('pages-user.pay-password.input-placeholder.enter-new-password-again')})
|
||||
|
||||
@@ -116,7 +116,7 @@ function navigateTo(url: string) {
|
||||
clearable
|
||||
:focus-when-clear="false"
|
||||
:cursorSpacing="20"
|
||||
:maxlength="20"
|
||||
:maxlength="16"
|
||||
v-model.trim="form.newLoginPwd"
|
||||
:placeholder="t('pages-user.pay-password.input-placeholder.enter-new-password')"
|
||||
placeholderStyle="font-size: 28rpx;line-height: 42rpx;color: #999999;"
|
||||
@@ -130,7 +130,7 @@ function navigateTo(url: string) {
|
||||
clearable
|
||||
:focus-when-clear="false"
|
||||
:cursorSpacing="20"
|
||||
:maxlength="20"
|
||||
:maxlength="16"
|
||||
v-model.trim="form.confirmPwd"
|
||||
:placeholder="t('pages-user.pay-password.input-placeholder.enter-new-password-again')"
|
||||
placeholderStyle="font-size: 28rpx;line-height: 42rpx;color: #999999;"
|
||||
|
||||
@@ -14,6 +14,14 @@ const storeBusinessHours = ref('');
|
||||
// 是否仅选择日期(当进入页面传递了 storeBusinessHours 时开启)
|
||||
const onlySelectDay = ref(false);
|
||||
|
||||
// 业务规则:只能预约周一 / 周四 / 周五
|
||||
// JS 中:0-周日 1-周一 ... 4-周四 5-周五
|
||||
const allowedWeekdays = [1, 4, 5];
|
||||
const isAllowedDay = (date: Date): boolean => {
|
||||
const dayIndex = date.getDay();
|
||||
return allowedWeekdays.includes(dayIndex);
|
||||
};
|
||||
|
||||
// 解析商家营业时间的接口
|
||||
interface BusinessHours {
|
||||
days: string[]; // 营业的星期几
|
||||
@@ -112,6 +120,11 @@ const isDateOpen = (date: Date): boolean => {
|
||||
* @returns 是否可选择
|
||||
*/
|
||||
const isDateSelectable = (date: Date): boolean => {
|
||||
// 新增:限制只能预约周一 / 周四 / 周五
|
||||
if (!isAllowedDay(date)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果只选日期模式,营业即可选择
|
||||
if (onlySelectDay.value) {
|
||||
if (!storeBusinessHours.value) return true;
|
||||
@@ -227,9 +240,12 @@ const hasAvailableTimeSlots = (date: Date): boolean => {
|
||||
// 初始化选中日期为第一个有可用时间段的营业日期
|
||||
const initializeSelectedDate = () => {
|
||||
if (onlySelectDay.value) {
|
||||
// 仅选日期模式:选择第一个营业日期(或第一个日期)
|
||||
const firstOpen = dateOptions.value.find((d) => isDateOpen(d));
|
||||
selectedDate.value = firstOpen || dateOptions.value[0];
|
||||
// 仅选日期模式:选择第一个“允许预约且营业”的日期(或第一个允许的日期)
|
||||
const firstOpen = dateOptions.value.find(
|
||||
(d) => isAllowedDay(d) && isDateOpen(d)
|
||||
);
|
||||
const firstAllowed = firstOpen || dateOptions.value.find((d) => isAllowedDay(d));
|
||||
selectedDate.value = firstAllowed || dateOptions.value[0];
|
||||
nextTick(() => updateScrollPosition());
|
||||
return;
|
||||
}
|
||||
@@ -487,7 +503,12 @@ const findNextBusinessDate = (currentDate: Date): Date | null => {
|
||||
dayjs(date).isSame(dayjs(nextDate), "day")
|
||||
);
|
||||
|
||||
if (isInRange && isDateOpen(nextDate) && hasAvailableTimeSlots(nextDate)) {
|
||||
if (
|
||||
isInRange &&
|
||||
isAllowedDay(nextDate) &&
|
||||
isDateOpen(nextDate) &&
|
||||
hasAvailableTimeSlots(nextDate)
|
||||
) {
|
||||
return nextDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
class="category-item"
|
||||
@click="handleItemClick(item)"
|
||||
>
|
||||
<image :src="item.logoUrl" class="category-icon" mode="aspectFit" />
|
||||
<text class="category-text">{{ item.categoryName }}</text>
|
||||
<image v-if="item.categoryImage || item.logoUrl" :src="item.categoryImage || item.logoUrl" class="category-icon" mode="aspectFit" />
|
||||
<text class="category-text">{{ item.categoryName || item.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(item, idx) in categoriesReversed"
|
||||
@@ -69,8 +69,8 @@
|
||||
class="category-item"
|
||||
@click="handleItemClick(item)"
|
||||
>
|
||||
<image :src="item.categoryImage" class="category-icon" mode="aspectFit" />
|
||||
<text class="category-text">{{ item.categoryName }}</text>
|
||||
<image v-if="item.categoryImage || item.logoUrl" :src="item.categoryImage || item.logoUrl" class="category-icon" mode="aspectFit" />
|
||||
<text class="category-text">{{ item.categoryName || item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
<!--
|
||||
* @Author: ISFP_T 68358856@qq.com
|
||||
* @Date: 2026-02-25 10:02:44
|
||||
* @LastEditors: ISFP_T 68358856@qq.com
|
||||
* @LastEditTime: 2026-03-04 10:22:25
|
||||
* @FilePath: \chef-link-uniapp\src\pages\home\components\tabbar-home\components\food-box\index.vue
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import Collection from "@/components/collection/index.vue";
|
||||
import {appCollectCollectPost} from "@/service";
|
||||
@@ -11,10 +19,18 @@ function handleClickFood() {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages-store/pages/store/index?id=' + props.item.id
|
||||
// })
|
||||
|
||||
let merchantId = ''
|
||||
if(props.item.merchantId){
|
||||
merchantId = props.item.merchantId
|
||||
uni.navigateTo({
|
||||
url: '/pages-store/pages/store/dishes?id=' +props.item.id + '&storeId=' + props.item.merchantId,
|
||||
})
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: '/pages-store/pages/store/index?id=' + props.item.id
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function handleCollectionChange(value: boolean) {
|
||||
@@ -33,23 +49,23 @@ function handleCollectionChange(value: boolean) {
|
||||
<template>
|
||||
<view @click="handleClickFood" class="mb-52rpx">
|
||||
<image
|
||||
:src="item?.dishImage?.split(',')[0]"
|
||||
:src="item?.dishImage?.split(',')[0]||item?.logo"
|
||||
mode="aspectFill"
|
||||
class="w-100% h-400rpx rounded-24rpx bg-common"
|
||||
></image>
|
||||
<view class="flex justify-between items-start mt-14rpx">
|
||||
<view>
|
||||
<text class="text-30rpx lh-30rpx text-#333 font-500 line-clamp-1"
|
||||
>{{ item.dishName }}</text
|
||||
>{{ item?.dishName||item?.merchantName }}</text
|
||||
>
|
||||
<!-- <view v-if="+item.deliveryService === 1" class="text-#CE7138 text-24rpx lh-24rpx mt-12rpx">${{ item.deliveryFee }} {{ t('pages.home.deliveryFee') }}</view> -->
|
||||
<view class="text-24rpx lh-24rpx flex items-center mt-12rpx">
|
||||
<view class="text-24rpx lh-24rpx flex items-center mt-12rpx" v-if="item?.originalPrice">
|
||||
|
||||
<image
|
||||
src="@img/chef/124.png"
|
||||
class="w-24rpx h-24rpx mx-4rpx mt-2rpx"
|
||||
></image>
|
||||
<text class="text-#333 font-500">$US{{ item.originalPrice }}</text>
|
||||
<text class="text-#333 font-500">$US{{ item?.originalPrice }}</text>
|
||||
<!-- <text class="text-#7D7D7D">({{ item.commentCount }}) • {{ item.deliveryTime }}{{ t('common.minutes') }}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -392,7 +392,7 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
|
||||
<view class="flex-center-sb mt-12rpx">
|
||||
<view class="text-28rpx text-#999">
|
||||
<view class="line-through">US${{ item?.originalPrice }}</view>
|
||||
<view>{{ t('pages-store.store.sales') }}:{{ item?.salesCount }}</view>
|
||||
<!-- <view>{{ t('pages-store.store.sales') }}:{{ item?.salesCount }}</view> -->
|
||||
</view>
|
||||
|
||||
<view class="center w-64rpx h-64rpx rounded-50% bg-white shadow-lg">
|
||||
@@ -418,7 +418,7 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
|
||||
</view>
|
||||
|
||||
<!-- 回到顶部按钮 -->
|
||||
<view v-if="showBackToTop" @click="scrollToTop" class="back-to-top-btn">
|
||||
<view v-if="showBackToTop" @click="scrollToTop" class="fixed bottom-148rpx left-30rpx w-88rpx h-88rpx bg-#14181B rounded-50% center shadow-lg">
|
||||
<image src="@img/chef/119.png" class="w-40rpx h-40rpx shrink-0 rotate-180"></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -445,19 +445,4 @@ 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;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,7 +6,7 @@ import AnimatedButton from "../animated-button/animated-button.vue";
|
||||
import Collection from "@/components/collection/index.vue";
|
||||
import FoodSkeleton from "@/pages/search/components/food-skeleton.vue";
|
||||
import RecipeSkeleton from "@/pages/search/components/recipe-skeleton.vue";
|
||||
import {appRecipeCategoryListGet, appSearchMerchantByDishPost, appSearchSearchRecipePost, appCollectCollectPost} from "@/service";
|
||||
import {getDishListByCategoryId,appRecipeCategoryListGet, appSearchMerchantByDishPost, appSearchSearchRecipePost, appCollectCollectPost} from "@/service";
|
||||
import {formatTimestamp} from "@/utils/utils";
|
||||
import {useUserStore} from "@/store";
|
||||
import { debounce } from 'throttle-debounce'
|
||||
@@ -43,22 +43,22 @@ const { paging, dataList, loading, queryList, firstLoaded } = usePage((pageNum,
|
||||
if(props.activeTab === 0) {
|
||||
// 搜索美食
|
||||
return new Promise(resolve => {
|
||||
appSearchMerchantByDishPost({
|
||||
getDishListByCategoryId({
|
||||
body: {
|
||||
keyword: props.keyword || '', // 搜索关键词
|
||||
pageNum: pageNum,
|
||||
pageSize: pageSize,
|
||||
selfPickup: selfPickup.value, // 是否自提
|
||||
discount: discount.value, // 是否有折扣 1是 2 否
|
||||
scoreRange: props.scoreRange || null, // 评分范围 比如 3-4
|
||||
priceRange: props.price || null, // 价格范围 比如 10-30
|
||||
selfPickup: selfPickup.value || undefined, // 是否自提
|
||||
discount: discount.value || undefined, // 是否有折扣 1是 2 否
|
||||
scoreRange: props.scoreRange || undefined, // 评分范围 比如 3-4
|
||||
priceRange: props.price || undefined, // 价格范围 比如 10-30
|
||||
sortType: 1, // 1系统推荐(按照喜好) 2 距离排序 3 评分排序
|
||||
lat: userStore.userLocation.latitude,
|
||||
lng: userStore.userLocation.longitude,
|
||||
}
|
||||
lat: userStore.userLocation.latitude || undefined,
|
||||
lng: userStore.userLocation.longitude || undefined,
|
||||
},
|
||||
}).then(res => {
|
||||
foodTotal.value = res.total; // 更新美食数据总条数
|
||||
resolve({rows: res.rows})
|
||||
foodTotal.value = res.total||res.data?.total||0; // 更新美食数据总条数
|
||||
resolve({rows: res.rows||res.data.rows})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
@@ -177,18 +177,18 @@ defineExpose({
|
||||
bg-color="#ffffff"
|
||||
>
|
||||
<template v-if="activeTab === 0">
|
||||
<view
|
||||
<!-- <view
|
||||
class="animate-in fade-in animate-ease-out animate-duration-300"
|
||||
v-show="loadingFoodState"
|
||||
>
|
||||
<food-skeleton />
|
||||
</view>
|
||||
</view> -->
|
||||
<view
|
||||
class="animate-in fade-in animate-ease-in animate-duration-300"
|
||||
v-show="!loadingFoodState"
|
||||
>
|
||||
<!-- 筛选工具 -->
|
||||
<filtrate-tool class="my-36rpx" @togglePickup="togglePickup" @toggleDiscount="toggleDiscount" @toggleScore="emit('toggleScore')" @togglePrice="emit('togglePrice')" />
|
||||
<!-- <filtrate-tool class="my-36rpx" @togglePickup="togglePickup" @toggleDiscount="toggleDiscount" @toggleScore="emit('toggleScore')" @togglePrice="emit('togglePrice')" /> -->
|
||||
<view
|
||||
class="pl-30rpx pb-36rpx text-36rpx lh-36rpx text-#333 font-500 tracking-[.04em]"
|
||||
>{{ foodTotal }} {{ t('pages.search.result.result') }}</view
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import SearchHistory from './components/search-history/index.vue'
|
||||
import SearchSkeleton from './components/search-skeleton.vue'
|
||||
import {useSearchStore} from '@/store'
|
||||
import {appSearchListPost} from '@/service'
|
||||
import {appSearchListPost,appRecipeCategoryListGet} from '@/service'
|
||||
|
||||
const {t} = useI18n()
|
||||
const searchStore = useSearchStore()
|
||||
@@ -23,9 +23,9 @@ function handleSearch() {
|
||||
|
||||
function handleHotSearch(item: any) {
|
||||
nextTick(() => {
|
||||
searchStore.setHistoryList(item.name)
|
||||
searchStore.setHistoryList(item.categoryName)
|
||||
uni.navigateTo({
|
||||
url: `/pages/search/result?keyword=${item.name}`,
|
||||
url: `/pages/search/result?keyword=${item.categoryName}`,
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -39,7 +39,7 @@ onMounted(() => {
|
||||
|
||||
const hotSearchList = ref([])
|
||||
function getHotSearchList() {
|
||||
appSearchListPost({}).then(res=> {
|
||||
appRecipeCategoryListGet({}).then(res=> {
|
||||
console.log('热门搜索词列表', res)
|
||||
hotSearchList.value = res.data
|
||||
}).finally(() => {
|
||||
@@ -68,9 +68,9 @@ function getHotSearchList() {
|
||||
</view>
|
||||
<template v-for="item in hotSearchList">
|
||||
<view @click="handleHotSearch(item)" class="w-full h-144rpx flex items-center">
|
||||
<image :src="item.logoUrl" class="w-64rpx h-64rpx mr-28rpx rounded-50%" mode="aspectFill"></image>
|
||||
<image :src="item?.categoryImage" class="w-64rpx h-64rpx mr-28rpx rounded-50%" mode="aspectFill"></image>
|
||||
<view class="flex-1 border-b-solid border-b-1rpx border-b-#DFDFDF h-full flex items-center text-30rpx text-primary font-500 tracking-[.06em]">
|
||||
{{ item.name }}
|
||||
{{ item?.categoryName }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -107,11 +107,11 @@ onMounted(()=> {
|
||||
v-model="keyword"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
<tab-switcher
|
||||
<!-- <tab-switcher
|
||||
v-model="activeTab"
|
||||
:tabs="tabs"
|
||||
@change="handleTabChange"
|
||||
/>
|
||||
/> -->
|
||||
</template>
|
||||
<swiper
|
||||
class="h-full"
|
||||
|
||||
@@ -67,7 +67,7 @@ export async function appMerchantOrderCalculatePriceCartBatchPost({
|
||||
body,
|
||||
options,
|
||||
}: {
|
||||
body: API.CalculatePriceCartBatchBo;
|
||||
body: CalculatePriceCartBatchBo;
|
||||
options?: CustomRequestOptions;
|
||||
}) {
|
||||
return request<API.RCalculatePriceCartVo>(
|
||||
@@ -115,6 +115,14 @@ export interface CalculatePriceCartBatchBo {
|
||||
* 小费比例
|
||||
*/
|
||||
tipDiscount?: number;
|
||||
/**
|
||||
* 商户优惠券映射 { merchantId: couponId }
|
||||
*/
|
||||
merchantCouponMap?: Record<string, number>;
|
||||
/**
|
||||
* 商户小费映射 { merchantId: tipAmount } (小费金额,单位:美元)
|
||||
*/
|
||||
merchantTipMap?: Record<string, number>;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
@@ -270,6 +278,14 @@ export interface CreateOrderCartBatchBo {
|
||||
* 是否需要餐具(1-是 2-否)
|
||||
*/
|
||||
needTableware?: number;
|
||||
/**
|
||||
* 商户优惠券映射 { merchantId: couponId }
|
||||
*/
|
||||
merchantCouponMap?: Record<string, number>;
|
||||
/**
|
||||
* 商户小费映射 { merchantId: tipAmount } (小费金额,单位:美元)
|
||||
*/
|
||||
merchantTipMap?: Record<string, number>;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,6 +376,7 @@
|
||||
/** 排序的方向desc或者asc */
|
||||
'isAsc'?: string;
|
||||
'recipeCategoryId'?:any;
|
||||
'keyword'?:any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user