ui调整
This commit is contained in:
Vendored
+2
-2
@@ -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.3:8080
|
||||
VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
||||
#VITE_SERVER_BASEURL=http://192.168.5.4:8080
|
||||
#VITE_SERVER_BASEURL=http://192.168.0.148:8888
|
||||
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
||||
+11
-2
@@ -449,6 +449,7 @@
|
||||
"deliveryAddress": "Delivery address",
|
||||
"deliveryPhotos": "Delivery of photos",
|
||||
"deliveryTime": "Delivery time",
|
||||
"beforeDeadline": " before",
|
||||
"estimatedDeliveryTime": "Estimated delivery time",
|
||||
"orderInfo": "Ordering Information",
|
||||
"orderNumber": "Order number",
|
||||
@@ -542,6 +543,7 @@
|
||||
"productIntro": "Introduction",
|
||||
"origin": "Origin",
|
||||
"unitQty": "Unit qty.",
|
||||
"category": "Category",
|
||||
"brand": "Brand",
|
||||
"allergen": "Allergen",
|
||||
"weeklySales": "Weekly sales",
|
||||
@@ -550,7 +552,8 @@
|
||||
"dash": "—",
|
||||
"lbUnit": "lb",
|
||||
"hotSalesBadge": "Fresh picks",
|
||||
"stockLabel": "Stock"
|
||||
"stockLabel": "Stock",
|
||||
"loadMoreRecommend": "Load more"
|
||||
},
|
||||
"securityCode": {
|
||||
"cantSee": "Can't see clearly? Change one",
|
||||
@@ -629,7 +632,13 @@
|
||||
"selectAll": "Select all",
|
||||
"forYou": "Recommended for you",
|
||||
"calculating": "Calculating...",
|
||||
"selectItemsHint": "Select items to checkout"
|
||||
"selectItemsHint": "Select items to checkout",
|
||||
"removeCartTitle": "Delete shopping cart?",
|
||||
"removeCartDesc": "Are you sure you want to delete this cart?",
|
||||
"removeProductTitle": "Remove the product?",
|
||||
"removeProductDesc": "Are you sure you want to remove {name} from your shopping cart?",
|
||||
"emptyTitle": "Your cart is empty",
|
||||
"emptyAction": "Explore Restaurants"
|
||||
},
|
||||
"choosePaymethod": {
|
||||
"creditCard": "Credit card payment",
|
||||
|
||||
+11
-2
@@ -449,6 +449,7 @@
|
||||
"deliveryAddress": "配送地址",
|
||||
"deliveryPhotos": "送达照片",
|
||||
"deliveryTime": "送达时间",
|
||||
"beforeDeadline": "前",
|
||||
"estimatedDeliveryTime": "预计送达时间",
|
||||
"orderInfo": "订单信息",
|
||||
"orderNumber": "订单号",
|
||||
@@ -542,6 +543,7 @@
|
||||
"productIntro": "产品简介",
|
||||
"origin": "产地",
|
||||
"unitQty": "单位数量",
|
||||
"category": "分类",
|
||||
"brand": "品牌",
|
||||
"allergen": "过敏源",
|
||||
"weeklySales": "周销量",
|
||||
@@ -550,7 +552,8 @@
|
||||
"dash": "—",
|
||||
"lbUnit": "磅",
|
||||
"hotSalesBadge": "生鲜热销榜",
|
||||
"stockLabel": "库存"
|
||||
"stockLabel": "库存",
|
||||
"loadMoreRecommend": "加载更多"
|
||||
},
|
||||
"securityCode": {
|
||||
"cantSee": "看不清?换一张",
|
||||
@@ -629,7 +632,13 @@
|
||||
"selectAll": "全选",
|
||||
"forYou": "为您推荐",
|
||||
"calculating": "计算中...",
|
||||
"selectItemsHint": "请选择要结算的商品"
|
||||
"selectItemsHint": "请选择要结算的商品",
|
||||
"removeCartTitle": "删除购物车?",
|
||||
"removeCartDesc": "确定要删除该店铺购物车吗?",
|
||||
"removeProductTitle": "移除商品?",
|
||||
"removeProductDesc": "确定要将 {name} 从购物车中移除吗?",
|
||||
"emptyTitle": "购物车为空",
|
||||
"emptyAction": "去逛逛餐厅"
|
||||
},
|
||||
"choosePaymethod": {
|
||||
"creditCard": "信用卡支付",
|
||||
|
||||
+9
-3
@@ -2,8 +2,8 @@
|
||||
"name" : "CHEFLINK delivery",
|
||||
"appid" : "__UNI__06509BE",
|
||||
"description" : "",
|
||||
"versionName" : "2.0.1",
|
||||
"versionCode" : 201,
|
||||
"versionName" : "3.0.6",
|
||||
"versionCode" : 306,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@@ -203,5 +203,11 @@
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"locale" : "en"
|
||||
"locale" : "en",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : "/h5/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import usePage from "@/hooks/usePage";
|
||||
import {appMerchantRecommendListPost} from "@/service";
|
||||
import { appMerchantRecommendListPost, type MerchantVo } from "@/service";
|
||||
import { useUserStore } from "@/store";
|
||||
import FiltrateTool from "@/components/filtrate-tool/index.vue";
|
||||
import PriceChoose from "@/components/filtrate-tool/components/price-choose.vue";
|
||||
import Score from "@/components/filtrate-tool/components/score.vue";
|
||||
import FoodBox from "@/pages/home/components/tabbar-home/components/food-box/index.vue";
|
||||
const userStore = useUserStore();
|
||||
|
||||
const {t} = useI18n()
|
||||
const userStore = useUserStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps({
|
||||
merchantCategoryIds: {
|
||||
type: [Number, String],
|
||||
default: null
|
||||
}
|
||||
})
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const {paging, dataList, queryList} = usePage(getList)
|
||||
const { paging, dataList, queryList } = usePage<MerchantVo>(getList);
|
||||
function getList(pageNum: number, pageSize: number) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
appMerchantRecommendListPost({
|
||||
params: {
|
||||
pageNum: pageNum,
|
||||
@@ -28,75 +27,344 @@ function getList(pageNum: number, pageSize: number) {
|
||||
body: {
|
||||
lat: userStore.userLocation.latitude,
|
||||
lng: userStore.userLocation.longitude,
|
||||
selfPickup: selfPickup.value, // 是否自提
|
||||
discount: discount.value, // 是否有折扣 1是 2 否
|
||||
scoreRange: scoreRange.value || null, // 评分范围 比如 3-4
|
||||
priceRange: price.value || null, // 价格范围 比如 10-30
|
||||
merchantCategoryIds: props.merchantCategoryIds ? [props.merchantCategoryIds] : [], // 商家分类id集合(首页中间)
|
||||
}
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
resolve({rows: res.rows})
|
||||
})
|
||||
})
|
||||
selfPickup: selfPickup.value,
|
||||
discount: discount.value,
|
||||
scoreRange: scoreRange.value || null,
|
||||
priceRange: price.value || null,
|
||||
merchantCategoryIds: props.merchantCategoryIds
|
||||
? [props.merchantCategoryIds]
|
||||
: [],
|
||||
},
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
resolve({ rows: res.rows });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 是否自提
|
||||
const selfPickup = ref<number | null>(null)
|
||||
const selfPickup = ref<number | null>(null);
|
||||
function togglePickup(value: number) {
|
||||
selfPickup.value = value;
|
||||
paging.value.refresh()
|
||||
}
|
||||
// 是否有折扣
|
||||
const discount = ref<number | null>(null)
|
||||
function toggleDiscount(value: number) {
|
||||
discount.value = value;
|
||||
paging.value.refresh()
|
||||
paging.value?.refresh();
|
||||
}
|
||||
|
||||
const scoreRef = ref<any>()
|
||||
const scoreRange = ref<string | null>(null)
|
||||
const priceChooseRef = ref<any>()
|
||||
const price = ref<string | null>(null)
|
||||
function toggleScore() {
|
||||
if (scoreRef.value) {
|
||||
scoreRef.value.onOpen();
|
||||
const discount = ref<number | null>(null);
|
||||
function toggleDiscount(value: number) {
|
||||
discount.value = value;
|
||||
paging.value?.refresh();
|
||||
}
|
||||
|
||||
const scoreRef = ref<any>();
|
||||
const scoreRange = ref<string | null>(null);
|
||||
const priceChooseRef = ref<any>();
|
||||
const price = ref<string | null>(null);
|
||||
function toggleScore() {
|
||||
scoreRef.value?.onOpen();
|
||||
}
|
||||
function togglePrice() {
|
||||
if (priceChooseRef.value) {
|
||||
priceChooseRef.value.onOpen();
|
||||
}
|
||||
priceChooseRef.value?.onOpen();
|
||||
}
|
||||
|
||||
function applyScore(value: string) {
|
||||
scoreRange.value = value;
|
||||
nextTick(() => paging.value?.refresh());
|
||||
}
|
||||
function applyPrice(value: string) {
|
||||
price.value = value;
|
||||
nextTick(() => paging.value?.refresh());
|
||||
}
|
||||
|
||||
/** 左侧双图:优先店铺图,不足则用 logo 补齐 */
|
||||
function merchantImagePair(item: MerchantVo): [string, string] {
|
||||
const shop = (item.shopImages || "")
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
const logo = (item.logo || "").trim();
|
||||
let a = shop[0] || logo || "";
|
||||
let b = shop[1] || shop[0] || logo || "";
|
||||
if (!a && !b) return ["", ""];
|
||||
if (!b) b = a;
|
||||
if (!a) a = b;
|
||||
return [a, b];
|
||||
}
|
||||
|
||||
function merchantCategoryLine(item: MerchantVo): string {
|
||||
const zh = item.merchantCategoryNamesZh;
|
||||
const en = item.merchantCategoryNamesEn;
|
||||
if (uni.getLocale() === "zh-Hans" && zh?.length) return zh[0] || "";
|
||||
if (en?.length) return en[0] || "";
|
||||
if (zh?.length) return zh[0] || "";
|
||||
return "";
|
||||
}
|
||||
|
||||
function ratingStars(rating?: number) {
|
||||
const n = Math.min(5, Math.max(0, Math.round(Number(rating) || 0)));
|
||||
return n;
|
||||
}
|
||||
|
||||
function ratingText(rating?: number) {
|
||||
const n = Number(rating);
|
||||
if (Number.isFinite(n)) return n.toFixed(1);
|
||||
return "0.0";
|
||||
}
|
||||
|
||||
function openMerchant(item: MerchantVo) {
|
||||
if (item?.id == null) return;
|
||||
uni.navigateTo({
|
||||
url: `/pages-store/pages/store/index?id=${item.id}`,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<z-paging ref="paging" v-model="dataList" @query="queryList">
|
||||
<view class="home-store-page">
|
||||
<z-paging
|
||||
ref="paging"
|
||||
v-model="dataList"
|
||||
bg-color="#F2F3F5"
|
||||
@query="queryList"
|
||||
>
|
||||
<template #top>
|
||||
<view class="bg-white pb-24rpx">
|
||||
<navbar :title="t('pages.home.featured-on')"/>
|
||||
<!-- 筛选工具 -->
|
||||
<filtrate-tool class="mt-32rpx" @togglePickup="togglePickup" @toggleDiscount="toggleDiscount" @toggleScore="toggleScore" @togglePrice="togglePrice" />
|
||||
<view class="home-store-header">
|
||||
<navbar
|
||||
:title="t('pages.home.featured-on')"
|
||||
circle-back
|
||||
custom-class="!bg-white"
|
||||
/>
|
||||
</view>
|
||||
<view class="home-store-filter-strip">
|
||||
<filtrate-tool
|
||||
class="home-store-filters"
|
||||
@togglePickup="togglePickup"
|
||||
@toggleDiscount="toggleDiscount"
|
||||
@toggleScore="toggleScore"
|
||||
@togglePrice="togglePrice"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
<view class="p-30rpx">
|
||||
<template v-for="(item, index) in dataList" :key="index">
|
||||
<food-box :item="item" />
|
||||
</template>
|
||||
|
||||
<view class="home-store-list">
|
||||
<view
|
||||
v-for="(item, index) in dataList"
|
||||
:key="item.id ?? index"
|
||||
class="merchant-card"
|
||||
@click="openMerchant(item)"
|
||||
>
|
||||
<view class="merchant-card__imgs">
|
||||
<view
|
||||
v-for="(src, ii) in merchantImagePair(item)"
|
||||
:key="ii"
|
||||
class="merchant-card__img-slot"
|
||||
:class="
|
||||
ii === 0
|
||||
? 'merchant-card__img-slot--first'
|
||||
: 'merchant-card__img-slot--last'
|
||||
"
|
||||
>
|
||||
<image
|
||||
v-if="src"
|
||||
class="merchant-card__img"
|
||||
:src="src"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view v-else class="merchant-card__img merchant-card__img--empty" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="merchant-card__body">
|
||||
<text class="merchant-card__name">{{ item.merchantName }}</text>
|
||||
<text
|
||||
v-if="merchantCategoryLine(item)"
|
||||
class="merchant-card__cate"
|
||||
>{{ merchantCategoryLine(item) }}</text
|
||||
>
|
||||
<view class="merchant-card__rating">
|
||||
<text
|
||||
v-for="si in [1, 2, 3, 4, 5]"
|
||||
:key="si"
|
||||
class="merchant-card__star"
|
||||
:class="{
|
||||
'merchant-card__star--on': si <= ratingStars(item.rating),
|
||||
}"
|
||||
>★</text
|
||||
>
|
||||
<text class="merchant-card__score">{{
|
||||
ratingText(item.rating)
|
||||
}}</text>
|
||||
</view>
|
||||
<text class="merchant-card__tag">{{ t("pages.home.brandTag") }}</text>
|
||||
</view>
|
||||
<view class="merchant-card__go" @click.stop="openMerchant(item)">
|
||||
<view class="i-carbon:chevron-right merchant-card__go-icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging>
|
||||
|
||||
<score @applyScore="applyScore" ref="scoreRef" />
|
||||
<price-choose @applyPrice="applyPrice" ref="priceChooseRef" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.home-store-page {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.home-store-header {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.home-store-filter-strip {
|
||||
background: #f2f3f5;
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.home-store-filters {
|
||||
display: block;
|
||||
padding: 16rpx 0 20rpx;
|
||||
}
|
||||
|
||||
.home-store-list {
|
||||
padding: 16rpx 24rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.merchant-card {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.merchant-card__imgs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
width: 152rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.merchant-card__img-slot {
|
||||
width: 152rpx;
|
||||
height: 96rpx;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
background: #e8eaed;
|
||||
}
|
||||
|
||||
/* 仅外侧圆角;靠两张图之间的分割一侧为直角 */
|
||||
.merchant-card__img-slot--first {
|
||||
border-radius: 12rpx 12rpx 0 0;
|
||||
}
|
||||
|
||||
.merchant-card__img-slot--last {
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
}
|
||||
|
||||
.merchant-card__img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background: #e8eaed;
|
||||
}
|
||||
|
||||
.merchant-card__img--empty {
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.merchant-card__body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 20rpx 0 8rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.merchant-card__name {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #14181b;
|
||||
line-height: 1.35;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.merchant-card__cate {
|
||||
margin-top: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
line-height: 1.3;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.merchant-card__rating {
|
||||
margin-top: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.merchant-card__star {
|
||||
font-size: 22rpx;
|
||||
line-height: 1;
|
||||
color: #e0e0e0;
|
||||
letter-spacing: -2rpx;
|
||||
}
|
||||
|
||||
.merchant-card__star--on {
|
||||
color: #14181b;
|
||||
}
|
||||
|
||||
.merchant-card__score {
|
||||
margin-left: 10rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #14181b;
|
||||
}
|
||||
|
||||
.merchant-card__tag {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #b8860b;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.merchant-card__go {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 50%;
|
||||
background: #14181b;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.merchant-card__go-icon {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
margin-left: 2rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #f2f3f5;
|
||||
}
|
||||
</style>
|
||||
@@ -28,6 +28,21 @@ const { t } = useI18n();
|
||||
const configStore = useConfigStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
function fillI18nParams(template: string, params: Record<string, string | number>) {
|
||||
let text = template;
|
||||
Object.keys(params).forEach((key) => {
|
||||
const value = String(params[key] ?? "");
|
||||
text = text.replace(new RegExp(`\\{${key}\\}`, "g"), value);
|
||||
text = text.replace(new RegExp(`\\$\\{${key}\\}`, "g"), value);
|
||||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
const appDisplayName = computed(() => {
|
||||
const name = String((Config as any)?.appName ?? "").trim();
|
||||
return name || "CHEFLINK";
|
||||
});
|
||||
|
||||
// 送达偏好
|
||||
const visitMethodRef = ref();
|
||||
// value 与 visit-method 组件保持一致:0-亲自送达 1-放门口
|
||||
@@ -1176,6 +1191,47 @@ const scheduledServiceEndLabel = computed(() => {
|
||||
return '';
|
||||
});
|
||||
|
||||
const localDeliverySubtitleText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.localDeliverySubtitle'), { name: appDisplayName.value })
|
||||
);
|
||||
|
||||
const itemsGoodsTotalWithPriceText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.itemsGoodsTotalWithPrice'), {
|
||||
count: cartTotalPieceCount.value,
|
||||
amount: displayGoodsAmountStr.value,
|
||||
})
|
||||
);
|
||||
|
||||
const scheduledDeliveryWindowText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.scheduledDeliveryWindow'), {
|
||||
time: scheduledServiceEndLabel.value,
|
||||
})
|
||||
);
|
||||
|
||||
const deliverBeforeText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.deliverBefore'), {
|
||||
time: deliveryMethod.value === 0
|
||||
? String(userSelectedDeliveryTimeDate.value ?? '')
|
||||
: String(userSelectedSelfPickupTimeDate.value ?? ''),
|
||||
})
|
||||
);
|
||||
|
||||
const memberThanksText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.memberThanks'), { name: appDisplayName.value })
|
||||
);
|
||||
|
||||
const subtotalWithPiecesText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.subtotalWithPieces'), {
|
||||
count: cartTotalPieceCount.value,
|
||||
})
|
||||
);
|
||||
|
||||
const subtotalOneLineText = computed(() =>
|
||||
fillI18nParams(t('pages-store.checkout.subtotalOneLine'), {
|
||||
amount: displayPaidStr.value,
|
||||
})
|
||||
);
|
||||
|
||||
const showAppointmentEntry = computed(() => {
|
||||
if (deliveryMethod.value === 0) {
|
||||
return storeIsDeliveryService.value || orderType.value === 'batch';
|
||||
@@ -1332,7 +1388,7 @@ function handleClose(merchantId?: string) {
|
||||
}}</text>
|
||||
<text class="checkout-card-subtitle block">{{
|
||||
deliveryMethod === 0
|
||||
? t('pages-store.checkout.localDeliverySubtitle', { name: Config.appName })
|
||||
? localDeliverySubtitleText
|
||||
: t('pages-store.checkout.pickupSubtitle')
|
||||
}}</text>
|
||||
</view>
|
||||
@@ -1346,7 +1402,7 @@ function handleClose(merchantId?: string) {
|
||||
</view>
|
||||
<view class="checkout-confirm-band-right">
|
||||
<text class="checkout-confirm-band-line1">
|
||||
{{ t('pages-store.checkout.itemsGoodsTotalWithPrice', { count: cartTotalPieceCount, amount: displayGoodsAmountStr }) }}
|
||||
{{ itemsGoodsTotalWithPriceText }}
|
||||
</text>
|
||||
<view v-if="deliveryMethod === 0" class="checkout-confirm-band-line2">
|
||||
<text>{{ t('pages-store.checkout.shippingFee') }}</text>
|
||||
@@ -1370,7 +1426,7 @@ function handleClose(merchantId?: string) {
|
||||
<view class="flex-1 min-w-0">
|
||||
<text class="checkout-schedule-title">{{ t('pages-store.checkout.scheduledDeliveryTitle') }}</text>
|
||||
<text v-if="scheduledServiceEndLabel" class="checkout-schedule-mid">{{
|
||||
t('pages-store.checkout.scheduledDeliveryWindow', { time: scheduledServiceEndLabel })
|
||||
scheduledDeliveryWindowText
|
||||
}}</text>
|
||||
<text class="checkout-schedule-hint">{{
|
||||
t('pages-store.checkout.scheduledDeliveryHint')
|
||||
@@ -1456,11 +1512,7 @@ function handleClose(merchantId?: string) {
|
||||
v-if="showAppointmentEntry && (userSelectedDeliveryTimeDate || userSelectedSelfPickupTimeDate)"
|
||||
class="checkout-deliver-hint"
|
||||
>
|
||||
{{
|
||||
t('pages-store.checkout.deliverBefore', {
|
||||
time: deliveryMethod === 0 ? userSelectedDeliveryTimeDate : userSelectedSelfPickupTimeDate,
|
||||
})
|
||||
}}
|
||||
{{ deliverBeforeText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -1735,13 +1787,11 @@ function handleClose(merchantId?: string) {
|
||||
<view class="checkout-section-label">{{ t('pages-store.checkout.orderBreakdown') }}</view>
|
||||
<view class="checkout-card checkout-breakdown checkout-gutter">
|
||||
<view v-if="isUserMemberCheckout" class="checkout-member-line">
|
||||
<text class="checkout-member-text">{{
|
||||
t('pages-store.checkout.memberThanks', { name: Config.appName })
|
||||
}}</text>
|
||||
<text class="checkout-member-text">{{ memberThanksText }}</text>
|
||||
<text class="checkout-member-icon">◆</text>
|
||||
</view>
|
||||
<view class="checkout-breakdown-row">
|
||||
<text class="checkout-breakdown-label">{{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }}</text>
|
||||
<text class="checkout-breakdown-label">{{ subtotalWithPiecesText }}</text>
|
||||
<text class="checkout-breakdown-value">${{ displayGoodsAmountStr }}</text>
|
||||
</view>
|
||||
<view class="checkout-breakdown-row">
|
||||
@@ -1792,7 +1842,7 @@ function handleClose(merchantId?: string) {
|
||||
</view>
|
||||
<view class="checkout-breakdown-divider"></view>
|
||||
<view class="checkout-breakdown-row checkout-breakdown-row--total">
|
||||
<text class="checkout-breakdown-total-label">{{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }}</text>
|
||||
<text class="checkout-breakdown-total-label">{{ subtotalWithPiecesText }}</text>
|
||||
<text class="checkout-breakdown-total-value">${{ displayPaidStr }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -1822,9 +1872,7 @@ function handleClose(merchantId?: string) {
|
||||
<view class="checkout-bottom-bar-glass"></view>
|
||||
<view class="checkout-bottom-bar-inner">
|
||||
<view class="checkout-bottom-bar-price">
|
||||
<text class="checkout-bottom-bar-one-line">{{
|
||||
t('pages-store.checkout.subtotalOneLine', { amount: displayPaidStr })
|
||||
}}</text>
|
||||
<text class="checkout-bottom-bar-one-line">{{ subtotalOneLineText }}</text>
|
||||
</view>
|
||||
<wd-button
|
||||
@click="handleGoSettle"
|
||||
|
||||
@@ -16,6 +16,7 @@ import CancelOrder from "@/pages-store/pages/order/components/cancel-order.vue";
|
||||
import {useConfigStore} from "@/store";
|
||||
import {OrderStatus, EventEnum, OrderCancelStatus} from "@/constant/enums";
|
||||
import {formatTimestampWithMonthName, formatTimestampShort, navGoogleMap, callPhone} from "@/utils/utils";
|
||||
import dayjs from 'dayjs'
|
||||
import useEventEmit from "@/hooks/useEventEmit";
|
||||
const configStore = useConfigStore();
|
||||
|
||||
@@ -239,28 +240,107 @@ function navigateTo(url: string) {
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
|
||||
/** 订单详情顶栏:与设计稿一致的 MM/DD HH:mm */
|
||||
function formatOrderNavScheduleTime(timestamp?: number | string | null) {
|
||||
if (timestamp == null || timestamp === '') return ''
|
||||
const n = Number(timestamp)
|
||||
if (!Number.isFinite(n)) return ''
|
||||
return dayjs(n).format('MM/DD HH:mm')
|
||||
}
|
||||
|
||||
function handleOrderDetailBack() {
|
||||
const pages = getCurrentPages?.() || []
|
||||
if (pages.length <= 1) {
|
||||
uni.switchTab({ url: '/pages/home/index' })
|
||||
return
|
||||
}
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
/** 顶栏居中展示「预计送达 / 下单时间」:非取消、非退款申请中、非商家拒绝 */
|
||||
const showOrderNavTimeBlock = computed(() => {
|
||||
if (!orderDetail.value) return false
|
||||
if (orderStatus.value === OrderStatus.CANCELLED) return false
|
||||
if (orderDetail.value.refundStatus === OrderCancelStatus.APPLIED) return false
|
||||
if (orderStatus.value === OrderStatus.MERCHANT_REJECTED) return false
|
||||
return true
|
||||
})
|
||||
|
||||
const orderNavPrimaryLine = computed(() => {
|
||||
const d = orderDetail.value
|
||||
if (!d) return ''
|
||||
const isDelivery = +(d.receiveMethod ?? 0) === 1
|
||||
const label = isDelivery
|
||||
? t('pages-store.order.estimatedDeliveryTime')
|
||||
: t('pages-store.order.upTime')
|
||||
const timePart = formatOrderNavScheduleTime(d.endScheduledTime) || '--'
|
||||
const suffix = isDelivery ? t('pages-store.order.beforeDeadline') : ''
|
||||
return `${label} : ${timePart}${suffix}`
|
||||
})
|
||||
|
||||
const orderNavSecondaryLine = computed(() => {
|
||||
const d = orderDetail.value
|
||||
if (!d) return ''
|
||||
const ct = d.createTime
|
||||
const timeStr =
|
||||
formatOrderNavScheduleTime(ct) ||
|
||||
(ct != null && ct !== '' ? formatTimestampShort(Number(ct)) : '')
|
||||
return `${t('pages-store.order.orderTime')}: ${timeStr || '--'}`
|
||||
})
|
||||
|
||||
// 已支付上传凭证(Zip 等线下支付)
|
||||
const voucherChooseRef = ref<InstanceType<typeof ChooseImage>>()
|
||||
const voucherSubmitting = ref(false)
|
||||
|
||||
function openUploadVoucher() {
|
||||
voucherChooseRef.value?.init()
|
||||
}
|
||||
// function openUploadVoucher() {
|
||||
// voucherChooseRef.value?.init()
|
||||
// }
|
||||
|
||||
function normalizeVoucherUrl(payload: unknown): string {
|
||||
if (Array.isArray(payload)) {
|
||||
const first = payload[0]
|
||||
return typeof first === 'string' ? first : ''
|
||||
}
|
||||
return typeof payload === 'string' ? payload : ''
|
||||
}
|
||||
// function normalizeVoucherUrl(payload: unknown): string {
|
||||
// if (Array.isArray(payload)) {
|
||||
// const first = payload[0]
|
||||
// return typeof first === 'string' ? first : ''
|
||||
// }
|
||||
// return typeof payload === 'string' ? payload : ''
|
||||
// }
|
||||
|
||||
async function onVoucherImageUploaded(urls: unknown) {
|
||||
const zipPayVoucher = normalizeVoucherUrl(urls)
|
||||
if (!zipPayVoucher) {
|
||||
uni.showToast({ title: t('pages-store.order.voucherUploadFailed'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
// async function onVoucherImageUploaded(urls: unknown) {
|
||||
// const zipPayVoucher = normalizeVoucherUrl(urls)
|
||||
// if (!zipPayVoucher) {
|
||||
// uni.showToast({ title: t('pages-store.order.voucherUploadFailed'), icon: 'none' })
|
||||
// return
|
||||
// }
|
||||
// const id = orderDetail.value?.id
|
||||
// if (id == null || String(id).trim() === '') {
|
||||
// uni.showToast({ title: t('pages-store.order.voucherUploadFailed'), icon: 'none' })
|
||||
// return
|
||||
// }
|
||||
// if (voucherSubmitting.value) return
|
||||
// voucherSubmitting.value = true
|
||||
// try {
|
||||
// await appMerchantOrderZipPayVoucherPost({
|
||||
// body: {
|
||||
// orderId: Number(id),
|
||||
// zipPayVoucher,
|
||||
// },
|
||||
// options: { hideErrorToast: true },
|
||||
// })
|
||||
// uni.showToast({ title: t('pages-store.order.voucherSubmitSuccess'), icon: 'none' })
|
||||
// setTimeout(() => {
|
||||
// appMerchantOrderDetail()
|
||||
// }, 500)
|
||||
// }
|
||||
// catch {
|
||||
// uni.showToast({ title: t('pages-store.order.voucherSubmitFailed'), icon: 'none' })
|
||||
// }
|
||||
// finally {
|
||||
// voucherSubmitting.value = false
|
||||
// }
|
||||
// }
|
||||
|
||||
const FIXED_VOUCHER_URL = 'https://www.howhowfresh.com/prod-api/resource/oss/download/2037827804362121218'
|
||||
|
||||
async function openUploadVoucher() {
|
||||
const id = orderDetail.value?.id
|
||||
if (id == null || String(id).trim() === '') {
|
||||
uni.showToast({ title: t('pages-store.order.voucherUploadFailed'), icon: 'none' })
|
||||
@@ -271,8 +351,8 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
try {
|
||||
await appMerchantOrderZipPayVoucherPost({
|
||||
body: {
|
||||
orderId: Number(id),
|
||||
zipPayVoucher,
|
||||
orderId: id,
|
||||
zipPayVoucher: FIXED_VOUCHER_URL,
|
||||
},
|
||||
options: { hideErrorToast: true },
|
||||
})
|
||||
@@ -292,7 +372,28 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
|
||||
<template>
|
||||
<view class="order-detail-page">
|
||||
<navbar />
|
||||
<wd-navbar
|
||||
safeAreaInsetTop
|
||||
fixed
|
||||
placeholder
|
||||
:bordered="false"
|
||||
custom-class="order-detail-navbar !bg-white"
|
||||
@click-left="handleOrderDetailBack"
|
||||
>
|
||||
<template #left>
|
||||
<view class="shrink-0">
|
||||
<view class="order-detail-navbar-circle center">
|
||||
<view class="i-carbon:chevron-left text-44rpx text-#111"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #title>
|
||||
<view v-if="!loading && orderDetail && showOrderNavTimeBlock" class="order-detail-nav-times">
|
||||
<text class="order-detail-nav-primary">{{ orderNavPrimaryLine }}</text>
|
||||
<text class="order-detail-nav-secondary">{{ orderNavSecondaryLine }}</text>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view
|
||||
class="animate-in fade-in animate-ease-out animate-duration-300"
|
||||
v-show="loading"
|
||||
@@ -324,36 +425,26 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
</view>
|
||||
</template>
|
||||
<!-- 商家拒绝订单 -->
|
||||
<template v-if="orderStatus === OrderStatus.MERCHANT_REJECTED">
|
||||
<view class="px-30rpx pt-20rpx pb-50rpx">
|
||||
<template v-else-if="orderStatus === OrderStatus.MERCHANT_REJECTED">
|
||||
<view class="px-30rpx pt-8rpx pb-40rpx">
|
||||
<view class="text-40rpx lh-36rpx text-#333 font-500">{{ t('pages-store.order.orderStatus.merchantRejected') }}</view>
|
||||
<view class="text-28rpx lh-28rpx text-#7D7D7D mt-26rpx">{{ t('pages-store.order.orderStatus.merchantRejectedDesc') }}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="px-30rpx pt-20rpx pb-50rpx">
|
||||
<view class="text-40rpx lh-36rpx text-#333 font-500">
|
||||
<template v-if="orderDetail?.receiveMethod === 1">
|
||||
{{ t('pages-store.order.estimatedDeliveryTime') }}
|
||||
</template>
|
||||
<template v-else>{{ t('pages-store.order.upTime') }}</template>
|
||||
:
|
||||
<!-- 订单预计送达时间-->
|
||||
{{ formatTimestampShort(orderDetail?.endScheduledTime) }}
|
||||
<!-- 顶栏已展示预计送达/下单时间;此处仅保留提示类副文案 -->
|
||||
<view class="px-30rpx pt-8rpx pb-24rpx" v-if="orderStatus === OrderStatus.PENDING_PAYMENT || orderDetail?.refundStatus === OrderCancelStatus.REJECTED">
|
||||
<view class="text-28rpx lh-36rpx text-#7D7D7D" v-if="orderStatus === OrderStatus.PENDING_PAYMENT">
|
||||
{{ t('pages-store.order.autoCancellation') }}
|
||||
</view>
|
||||
<view class="text-28rpx lh-28rpx text-#7D7D7D mt-26rpx">
|
||||
<view>{{ t('pages-store.order.orderTime') }}: {{ formatTimestampShort(orderDetail?.createTime) }}</view>
|
||||
<!-- 订单30分钟自动取消--待支付 -->
|
||||
<view v-if="orderStatus === OrderStatus.PENDING_PAYMENT">{{ t('pages-store.order.autoCancellation') }}</view>
|
||||
</view>
|
||||
<view class="text-28rpx lh-28rpx text-#7D7D7D mt-26rpx" v-if="orderDetail?.refundStatus === OrderCancelStatus.REJECTED">
|
||||
<view class="text-28rpx lh-36rpx text-#7D7D7D mt-16rpx" v-if="orderDetail?.refundStatus === OrderCancelStatus.REJECTED">
|
||||
{{ t('pages-store.order.rejectReason') }}:{{ orderDetail?.rejectReason }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单进度 -->
|
||||
<!-- 订单进度(紧接顶栏时间信息) -->
|
||||
<view
|
||||
v-if="orderDetail?.refundStatus !== OrderCancelStatus.APPLIED && orderDetail?.refundStatus !== OrderCancelStatus.APPROVED"
|
||||
class="mb-52rpx px-30rpx"
|
||||
class="order-detail-progress-wrap mb-52rpx px-30rpx"
|
||||
>
|
||||
<OrderProgress
|
||||
:steps="orderSteps"
|
||||
@@ -475,7 +566,7 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
x{{ item?.count }}
|
||||
</view>
|
||||
</view>
|
||||
<text class="goods-caption line-clamp-1">{{ dishTitle(item) }}</text>
|
||||
<text class="goods-caption line-clamp-2">{{ dishTitle(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -683,7 +774,8 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 待支付 -->
|
||||
<template v-if="orderStatus === OrderStatus.PENDING_PAYMENT">
|
||||
<!-- 上传支付凭证 -->
|
||||
<wd-button
|
||||
:loading="voucherSubmitting"
|
||||
:disabled="voucherSubmitting"
|
||||
@@ -693,7 +785,6 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
>
|
||||
{{ t('pages-store.order.uploadPaidVoucher') }}
|
||||
</wd-button>
|
||||
<template v-if="orderStatus === OrderStatus.PENDING_PAYMENT">
|
||||
<wd-button @click="goPay" custom-class="!h-108rpx !bg-14181B !text-32rpx !lh-108rpx !text-#fff !rounded-46rpx !mt-22rpx" block>
|
||||
{{ t('common.goPay') }}
|
||||
</wd-button>
|
||||
@@ -765,8 +856,8 @@ async function onVoucherImageUploaded(urls: unknown) {
|
||||
<password-container @success="payPawSuccess" ref="passwordInputRef" />
|
||||
<!-- 核销订单 -->
|
||||
<use-code ref="useCodeRef" />
|
||||
<!-- 支付凭证:相册/拍照 -->
|
||||
<choose-image ref="voucherChooseRef" :count="1" @change="onVoucherImageUploaded" />
|
||||
<!-- 支付凭证:相册/拍照(暂时不使用文件上传,改用固定URL) -->
|
||||
<choose-image ref="voucherChooseRef" :count="1" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -871,4 +962,47 @@ page {
|
||||
line-height: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.order-detail-navbar-circle {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.order-detail-nav-times {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 8rpx;
|
||||
max-width: 480rpx;
|
||||
}
|
||||
|
||||
.order-detail-nav-primary {
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #14181b;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.order-detail-nav-secondary {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
color: #7d7d7d;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.order-detail-progress-wrap {
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
|
||||
:deep(.order-detail-navbar.wd-navbar .wd-navbar__title) {
|
||||
max-width: 520rpx;
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import {useConfigStore} from "@/store";
|
||||
import {receiveCouponApi} from "@/pages-user/service";
|
||||
import couponBg from '@img-store/coupon.png'
|
||||
import couponBg2 from '@img-store/coupon-2.png'
|
||||
import couponRightBg from '@img-store/coupon-right.png'
|
||||
import couponRightBg2 from '@img-store/coupon-right-2.png'
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
@@ -102,12 +106,16 @@ function couponBenefitText(item: any) {
|
||||
:key="item.id"
|
||||
class="coupon-card"
|
||||
>
|
||||
<image
|
||||
class="coupon-card-bg"
|
||||
:src="item.userCouponVo ? couponBg2 : couponBg"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<view class="coupon-card-body">
|
||||
<!-- 左侧信息 -->
|
||||
<view class="coupon-card-info">
|
||||
<view class="coupon-card-amount">
|
||||
<text class="coupon-amount-value">{{ couponAmountText(item) }}</text>
|
||||
<text class="coupon-amount-label">{{ t('pages-store.store.couponOff') }}</text>
|
||||
<text class="coupon-amount-value" :class="{ 'coupon-amount-value--disabled': item.userCouponVo }">{{ couponAmountText(item) }}</text>
|
||||
<text class="coupon-amount-label" :class="{ 'coupon-amount-label--disabled': item.userCouponVo }">{{ t('pages-store.store.couponOff') }}</text>
|
||||
</view>
|
||||
<view class="coupon-card-desc">
|
||||
{{ item.nameZh }}
|
||||
@@ -121,21 +129,21 @@ function couponBenefitText(item: any) {
|
||||
<text>{{ t('pages-store.store.get') }} {{ couponBenefitText(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 右侧按钮 -->
|
||||
</view>
|
||||
<view
|
||||
v-if="item.userCouponVo"
|
||||
class="coupon-claim-btn coupon-claim-btn--disabled"
|
||||
class="coupon-claim-wrap"
|
||||
>
|
||||
{{ t('pages-store.store.claimed') }}
|
||||
<image class="coupon-claim-bg" :src="couponRightBg2" mode="scaleToFill" />
|
||||
<text class="coupon-claim-text coupon-claim-text--disabled">{{ t('pages-store.store.claimed') }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="coupon-claim-btn"
|
||||
class="coupon-claim-wrap"
|
||||
@click="confirmCoupon(item)"
|
||||
>
|
||||
{{ t('pages-store.store.claimNow') }}
|
||||
</view>
|
||||
<image class="coupon-claim-bg" :src="couponRightBg" mode="scaleToFill" />
|
||||
<text class="coupon-claim-text">{{ t('pages-store.store.claimNow') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -157,27 +165,31 @@ function couponBenefitText(item: any) {
|
||||
}
|
||||
|
||||
.coupon-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
border: 2rpx solid #F5D0B8;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
overflow: hidden;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-card-bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.coupon-card-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 32rpx 180rpx 32rpx 32rpx;
|
||||
}
|
||||
|
||||
.coupon-card-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.coupon-card-amount {
|
||||
@@ -191,6 +203,10 @@ function couponBenefitText(item: any) {
|
||||
line-height: 56rpx;
|
||||
font-weight: bold;
|
||||
color: #CE7138;
|
||||
|
||||
&--disabled {
|
||||
color: #BFBFBF;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-amount-label {
|
||||
@@ -199,6 +215,10 @@ function couponBenefitText(item: any) {
|
||||
color: #CE7138;
|
||||
font-weight: 500;
|
||||
margin-left: 10rpx;
|
||||
|
||||
&--disabled {
|
||||
color: #BFBFBF;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-card-desc {
|
||||
@@ -223,22 +243,37 @@ function couponBenefitText(item: any) {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.coupon-claim-btn {
|
||||
flex-shrink: 0;
|
||||
min-width: 140rpx;
|
||||
height: 68rpx;
|
||||
line-height: 68rpx;
|
||||
text-align: center;
|
||||
background: #CE7138;
|
||||
.coupon-claim-wrap {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 168rpx;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.coupon-claim-bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.coupon-claim-text {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 24rpx;
|
||||
// font-weight: 600;
|
||||
text-align: center;
|
||||
|
||||
&--disabled {
|
||||
background: #E6E6E6;
|
||||
color: #999;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -423,10 +423,7 @@ function navigateBack() {
|
||||
|
||||
function navigateToCart() {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages-user/pages/cart/store-cart'
|
||||
+ '?storeId=' + storeID.value
|
||||
+ '&storeName=' + encodeURIComponent(storeDetail.value.merchantName),
|
||||
url: '/pages-user/pages/cart/index',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -25,9 +25,9 @@ defineExpose({
|
||||
@close="handleClose"
|
||||
>
|
||||
<view class="px-30rpx text-#333 text-center pt-48rpx pb-60rpx">
|
||||
<view class="text-40rpx lh-40rpx font-500">Delete shopping cart?</view>
|
||||
<view class="text-40rpx lh-40rpx font-500">{{ t("pages-user.cart.removeCartTitle") }}</view>
|
||||
<view class="text-28rpx lh-28rpx mt-36rpx">
|
||||
Are you sure you want to delete the shopping cart?
|
||||
{{ t("pages-user.cart.removeCartDesc") }}
|
||||
</view>
|
||||
<view class="mt-70rpx">
|
||||
<wd-button @click="handleDelete" custom-class="!h-108rpx !bg-14181B !text-36rpx !lh-108rpx !text-#fff !rounded-16rpx" block>
|
||||
|
||||
@@ -4,6 +4,20 @@ const emit = defineEmits(['confirm','close'])
|
||||
|
||||
const show = ref(false);
|
||||
const goodsName = ref('');
|
||||
|
||||
function fillI18nParams(template: string, params: Record<string, string | number>) {
|
||||
let text = template;
|
||||
Object.keys(params).forEach((key) => {
|
||||
const value = String(params[key] ?? "");
|
||||
text = text.replace(new RegExp(`\\{${key}\\}`, "g"), value);
|
||||
text = text.replace(new RegExp(`\\$\\{${key}\\}`, "g"), value);
|
||||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
const removeProductDescText = computed(() =>
|
||||
fillI18nParams(t("pages-user.cart.removeProductDesc"), { name: goodsName.value })
|
||||
);
|
||||
function onOpen(title: string) {
|
||||
if (title) {
|
||||
goodsName.value = title;
|
||||
@@ -31,9 +45,9 @@ defineExpose({
|
||||
@close="handleClose"
|
||||
>
|
||||
<view class="px-30rpx text-#333 text-center pt-48rpx pb-60rpx">
|
||||
<view class="text-40rpx lh-40rpx font-500">Remove the product?</view>
|
||||
<view class="text-40rpx lh-40rpx font-500">{{ t("pages-user.cart.removeProductTitle") }}</view>
|
||||
<view class="text-28rpx lh-28rpx mt-36rpx">
|
||||
Are you sure you want to remove {{ goodsName }} from your shopping cart?
|
||||
{{ removeProductDescText }}
|
||||
</view>
|
||||
<view class="mt-70rpx">
|
||||
<wd-button @click="confirmRemove" custom-class="!h-108rpx !bg-14181B !text-36rpx !lh-108rpx !text-#fff !rounded-16rpx" block>
|
||||
|
||||
@@ -38,6 +38,9 @@ interface CartItem {
|
||||
merchantDishVo: any;
|
||||
sideDishList: any[];
|
||||
checked: boolean;
|
||||
discountPrice: number;
|
||||
originalPrice: number;
|
||||
memberPrice: number;
|
||||
}
|
||||
|
||||
interface CartMerchant {
|
||||
@@ -66,6 +69,59 @@ const selectedCartItems = computed(() => {
|
||||
});
|
||||
|
||||
const selectedCount = computed(() => selectedCartItems.value.length);
|
||||
const appDisplayName = computed(() => {
|
||||
const name = String((Config as any)?.appName ?? "").trim();
|
||||
return name || "CHEFLINK";
|
||||
});
|
||||
|
||||
function fillI18nParams(template: string, params: Record<string, string | number>) {
|
||||
let text = template;
|
||||
Object.keys(params).forEach((key) => {
|
||||
const value = String(params[key] ?? "");
|
||||
text = text.replace(new RegExp(`\\{${key}\\}`, "g"), value);
|
||||
text = text.replace(new RegExp(`\\$\\{${key}\\}`, "g"), value);
|
||||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
function normalizePriceString(val: unknown) {
|
||||
const s = String(val ?? "").trim();
|
||||
if (!/^\d+(\.\d+)?$/.test(s)) return "0";
|
||||
const [intRaw, decRaw = ""] = s.split(".");
|
||||
const intPart = intRaw.replace(/^0+(?=\d)/, "") || "0";
|
||||
const decPart = decRaw.slice(0, 2).padEnd(2, "0");
|
||||
return `${intPart}.${decPart}`;
|
||||
}
|
||||
|
||||
function priceToCentString(val: unknown) {
|
||||
const normalized = normalizePriceString(val);
|
||||
const [intPart, decPart = "00"] = normalized.split(".");
|
||||
return `${intPart}${decPart}`.replace(/^0+(?=\d)/, "") || "0";
|
||||
}
|
||||
|
||||
function formatPriceForView(val: unknown) {
|
||||
const normalized = normalizePriceString(val);
|
||||
return normalized.replace(/\.00$/, "").replace(/(\.\d)0$/, "$1");
|
||||
}
|
||||
|
||||
function getCartLineDisplayPrice(item: CartItem) {
|
||||
// const memberCent = priceToCentString(item?.memberPrice);
|
||||
// console.log('memberCent', memberCent);
|
||||
console.log('item?.memberPrice', item?.memberPrice);
|
||||
console.log(userStore.userInfo.userMembershipVo, 'userStore.isMember');
|
||||
if (userStore.userInfo.userMembershipVo!==null) {
|
||||
return item?.memberPrice;
|
||||
}
|
||||
return item?.discountPrice;
|
||||
}
|
||||
|
||||
function showCartLineOriginalPrice(item: CartItem) {
|
||||
const originalCent = priceToCentString(item?.originalPrice);
|
||||
const currentCent = userStore.userInfo.userMembershipVo!==null && priceToCentString(item?.memberPrice) !== "0"
|
||||
? priceToCentString(item?.memberPrice)
|
||||
: priceToCentString(item?.discountPrice);
|
||||
return originalCent !== "0" && originalCent !== currentCent;
|
||||
}
|
||||
|
||||
const priceData = ref<
|
||||
Record<string, any> & {
|
||||
@@ -100,6 +156,17 @@ const selectedGoodsSubtotal = computed(() => {
|
||||
return total.toFixed(2);
|
||||
});
|
||||
|
||||
const deliveryUnifiedText = computed(() =>
|
||||
fillI18nParams(t("pages-user.cart.deliveryUnified"), { name: appDisplayName.value })
|
||||
);
|
||||
|
||||
const itemsTotalWithPriceText = computed(() =>
|
||||
fillI18nParams(t("pages-user.cart.itemsTotalWithPrice"), {
|
||||
count: priceData.value.totalQuantity ?? selectedItemQty.value,
|
||||
amount: selectedGoodsSubtotal.value,
|
||||
})
|
||||
);
|
||||
|
||||
/** 与地址页、结算页一致:展示用户已保存预约日,无则展示今天(选时间会跳转 reservation-time 并写回接口) */
|
||||
const deliveryScheduleLabel = computed(() => {
|
||||
const ap = userStore.appointmentTime as any;
|
||||
@@ -210,7 +277,7 @@ function confirmRemove() {
|
||||
getCartList();
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "删除成功",
|
||||
title: t("toast.deleteSuccess"),
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -324,23 +391,18 @@ function scheduleCartUpdate(item: CartItem, targetValue: number) {
|
||||
pendingUpdateTimers.set(key, timer);
|
||||
}
|
||||
|
||||
function normalizeInputNumberValue(payload: any): number {
|
||||
if (typeof payload === "number") return payload;
|
||||
if (payload && typeof payload === "object") {
|
||||
if (typeof payload.detail?.value === "number")
|
||||
return payload.detail.value;
|
||||
if (typeof payload.value === "number") return payload.value;
|
||||
}
|
||||
const numeric = Number(payload);
|
||||
return Number.isNaN(numeric) ? 0 : numeric;
|
||||
/** wd-input-number change 为 { value },兼容 detail.value */
|
||||
function normalizeInputNumberValue(payload: unknown): number {
|
||||
const raw =
|
||||
typeof payload === "number"
|
||||
? payload
|
||||
: (payload as any)?.value ?? (payload as any)?.detail?.value ?? payload;
|
||||
const n = Number(raw);
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
|
||||
const delItemData = ref<CartItem | null>(null);
|
||||
|
||||
function onItemQtyChange(item: CartItem) {
|
||||
return (payload: unknown) => handleQuantityChange(payload, item);
|
||||
}
|
||||
|
||||
function handleQuantityChange(payload: any, item: CartItem) {
|
||||
if (!item) return;
|
||||
const nextValue = normalizeInputNumberValue(payload);
|
||||
@@ -593,9 +655,7 @@ async function getCartList() {
|
||||
t("pages-user.cart.localDelivery")
|
||||
}}</text>
|
||||
<text class="cart-delivery-sub">{{
|
||||
t("pages-user.cart.deliveryUnified", {
|
||||
name: Config.appName,
|
||||
})
|
||||
deliveryUnifiedText
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -607,11 +667,7 @@ async function getCartList() {
|
||||
</view>
|
||||
<view class="cart-price-summary">
|
||||
<text class="cart-summary-line1">{{
|
||||
t("pages-user.cart.itemsTotalWithPrice", {
|
||||
count:
|
||||
priceData.totalQuantity ?? selectedItemQty,
|
||||
amount: selectedGoodsSubtotal,
|
||||
})
|
||||
itemsTotalWithPriceText
|
||||
}}</text>
|
||||
<view
|
||||
v-if="
|
||||
@@ -731,26 +787,22 @@ async function getCartList() {
|
||||
<text class="mr-6rpx">{{
|
||||
dish?.merchantSideDishItemVo?.name || ""
|
||||
}}</text>
|
||||
<text
|
||||
<!-- <text
|
||||
v-if="dish?.merchantSideDishItemVo?.price"
|
||||
class="text-[#00A76D] mr-10rpx"
|
||||
>+${{ dish?.merchantSideDishItemVo?.price }}</text
|
||||
>
|
||||
>${{ dish?.merchantSideDishItemVo?.price }}</text
|
||||
> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="cart-line-price-row">
|
||||
<view class="flex items-baseline flex-wrap">
|
||||
<text class="cart-line-price"
|
||||
>${{ item.merchantDishVo?.discountPrice }}</text
|
||||
>${{ getCartLineDisplayPrice(item) }}</text
|
||||
>
|
||||
<text
|
||||
v-if="
|
||||
item.merchantDishVo?.originalPrice &&
|
||||
item.merchantDishVo?.originalPrice !==
|
||||
item.merchantDishVo?.discountPrice
|
||||
"
|
||||
v-if="showCartLineOriginalPrice(item)"
|
||||
class="cart-line-price-old"
|
||||
>${{ item.merchantDishVo?.originalPrice }}</text
|
||||
>${{ item?.originalPrice }}</text
|
||||
>
|
||||
</view>
|
||||
<wd-input-number
|
||||
@@ -761,7 +813,7 @@ async function getCartList() {
|
||||
:input-width="72"
|
||||
button-size="52"
|
||||
custom-class="cart-qty-input"
|
||||
@change="onItemQtyChange(item)"
|
||||
@change="(e) => handleQuantityChange(e, item)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -809,12 +861,12 @@ async function getCartList() {
|
||||
<template v-else>
|
||||
<view class="flex flex-col items-center justify-center py-100rpx">
|
||||
<image src="@img/chef/100.png" class="w-318rpx h-318rpx" />
|
||||
<text class="text-32rpx text-[#7D7D7D]">Your cart is empty</text>
|
||||
<text class="text-32rpx text-[#7D7D7D]">{{ t("pages-user.cart.emptyTitle") }}</text>
|
||||
<view
|
||||
class="mt-60rpx w-400rpx h-88rpx rounded-16rpx bg-[#14181B] flex items-center justify-center"
|
||||
@click="goToHome"
|
||||
>
|
||||
<text class="text-30rpx text-white">Explore Restaurants</text>
|
||||
<text class="text-30rpx text-white">{{ t("pages-user.cart.emptyAction") }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -115,20 +115,14 @@ function scheduleCartUpdate(item: MerchantCartVo, targetValue: number) {
|
||||
pendingUpdateTimers.set(key, timer)
|
||||
}
|
||||
|
||||
function normalizeInputNumberValue(payload: any): number {
|
||||
if (typeof payload === 'number') {
|
||||
return payload
|
||||
}
|
||||
if (payload && typeof payload === 'object') {
|
||||
if (typeof payload.detail?.value === 'number') {
|
||||
return payload.detail.value
|
||||
}
|
||||
if (typeof payload.value === 'number') {
|
||||
return payload.value
|
||||
}
|
||||
}
|
||||
const numeric = Number(payload)
|
||||
return Number.isNaN(numeric) ? 0 : numeric
|
||||
/** wd-input-number change 为 { value },兼容 detail.value */
|
||||
function normalizeInputNumberValue(payload: unknown): number {
|
||||
const raw =
|
||||
typeof payload === "number"
|
||||
? payload
|
||||
: (payload as any)?.value ?? (payload as any)?.detail?.value ?? payload;
|
||||
const n = Number(raw);
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
|
||||
const delItemData = ref<MerchantCartVo | null>(null)
|
||||
@@ -247,6 +241,18 @@ function appMerchantCartCalculateSavings() {
|
||||
})
|
||||
}
|
||||
|
||||
function getCartItemDiscountPrice(item: MerchantCartVo) {
|
||||
return item.discountPrice ?? item.merchantDishVo?.discountPrice
|
||||
}
|
||||
|
||||
function getCartItemOriginalPrice(item: MerchantCartVo) {
|
||||
return item.originalPrice ?? item.merchantDishVo?.originalPrice
|
||||
}
|
||||
|
||||
function getCartItemMemberPrice(item: MerchantCartVo) {
|
||||
return item.memberPrice ?? item.merchantDishVo?.memberPrice
|
||||
}
|
||||
|
||||
function navigateTo(url: string) {
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
@@ -301,21 +307,21 @@ function navigateTo(url: string) {
|
||||
|
||||
<view class="price-row flex items-center mt-18rpx">
|
||||
<text class="current-price text-[#333333] text-30rpx font-normal"
|
||||
>${{ item.merchantDishVo.discountPrice }}</text
|
||||
>${{ getCartItemDiscountPrice(item) }}</text
|
||||
>
|
||||
<text
|
||||
v-if="item.merchantDishVo.originalPrice"
|
||||
v-if="getCartItemOriginalPrice(item)"
|
||||
class="original-price text-[#7D7D7D] text-24rpx font-normal line-through ml-10rpx"
|
||||
>${{ item.merchantDishVo.originalPrice }}</text
|
||||
>${{ getCartItemOriginalPrice(item) }}</text
|
||||
>
|
||||
|
||||
<!-- 会员价标签 -->
|
||||
<view
|
||||
v-if="Number(item.merchantDishVo.memberPrice) > 0"
|
||||
v-if="Number(getCartItemMemberPrice(item)) > 0"
|
||||
class="member-price-tag ml-10rpx center pl-16rpx pr-6rpx pb-2rpx"
|
||||
>
|
||||
<text class="text-[#FBE3C3] text-20rpx"
|
||||
>{{ t('pages-store.store.members') }}: ${{ item.merchantDishVo.memberPrice }}</text
|
||||
>{{ t('pages-store.store.members') }}: ${{ getCartItemMemberPrice(item) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
+4
-1
@@ -229,7 +229,10 @@
|
||||
"path": "pages/store/search/result"
|
||||
},
|
||||
{
|
||||
"path": "pages/store/dishes"
|
||||
"path": "pages/store/dishes",
|
||||
"style": {
|
||||
"onReachBottomDistance": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order/checkout"
|
||||
|
||||
@@ -81,11 +81,6 @@ function subtitleLine(item: any): string {
|
||||
class="featured-card__media-half featured-card__media-half--top"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<image
|
||||
:src="getCardImages(item)[1]"
|
||||
class="featured-card__media-half featured-card__media-half--bottom"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</template>
|
||||
<image
|
||||
v-else-if="getCardImages(item).length >= 1"
|
||||
@@ -154,6 +149,7 @@ function subtitleLine(item: any): string {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 620rpx;
|
||||
height: 256rpx;
|
||||
min-height: 256rpx;
|
||||
margin-left: 16rpx;
|
||||
background: #fff;
|
||||
@@ -171,18 +167,22 @@ function subtitleLine(item: any): string {
|
||||
background: #f0f0f0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.featured-card__media-single {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 256rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.featured-card__media-half {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: block;
|
||||
}
|
||||
.featured-card__media-half--top {
|
||||
border-bottom: 3rpx solid #fff;
|
||||
|
||||
@@ -446,10 +446,10 @@ const debouncedEmit = debounce(1300, (isCollected: boolean, id: string, type: Co
|
||||
<view class="featured-dish-meta flex items-start justify-between gap-12rpx mb-14rpx">
|
||||
<view class="min-w-0 flex-1">
|
||||
<text class="featured-dish-price">US${{ item?.discountPrice }}</text>
|
||||
<text
|
||||
<!-- <text
|
||||
v-if="Number(item?.originalPrice) > Number(item?.discountPrice)"
|
||||
class="featured-dish-original"
|
||||
>US${{ item?.originalPrice }}</text>
|
||||
>US${{ item?.originalPrice }}</text> -->
|
||||
</view>
|
||||
<text class="featured-dish-sales shrink-0">{{ t('pages-store.store.sales') }}: {{ formatSalesCount(item?.salesCount) }}</text>
|
||||
</view>
|
||||
|
||||
@@ -194,7 +194,7 @@ const poster = computed(() => ({
|
||||
type: 'view',
|
||||
},
|
||||
{
|
||||
text: 'http://192.168.5.118:8091/#/'+ `pages-login/pages/sign-up/index?invitationCode=${userStore.userInfo.invitationCode}`,
|
||||
text: 'http://www.howhowfresh.com/h5/'+ `pages-login/pages/sign-up/index?invitationCode=${userStore.userInfo.invitationCode}`,
|
||||
type: 'qrcode',
|
||||
css: {
|
||||
width: '124rpx',
|
||||
|
||||
@@ -83,7 +83,7 @@ defineExpose({
|
||||
</view>
|
||||
<view class="shrink-0 ml-20rpx" v-if="userStore.userInfo.invitationCode">
|
||||
<uqrcode ref="uqrcode" canvas-id="qrcode"
|
||||
:value="'http://192.168.5.118:8091/#/' + `pages-login/pages/sign-up/index?invitationCode=${userStore.userInfo.invitationCode}`"
|
||||
:value="'http://www.howhowfresh.com/h5/' + `pages-login/pages/sign-up/index?invitationCode=${userStore.userInfo.invitationCode}`"
|
||||
:size="124"
|
||||
sizeUnit="rpx"
|
||||
:options="{}"></uqrcode>
|
||||
|
||||
Reference in New Issue
Block a user