diff --git a/env/.env.development b/env/.env.development index aa7e2d2..764ee04 100644 --- a/env/.env.development +++ b/env/.env.development @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DELETE_CONSOLE=false #本地环境 -#VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api -VITE_SERVER_BASEURL=http://192.168.5.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 \ No newline at end of file diff --git a/src/locale/en.json b/src/locale/en.json index 2b09231..9829614 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -405,7 +405,7 @@ "subtotalBar": "Subtotal", "subtotalOneLine": "Subtotal: $ {amount}", "subtotalWithPieces": "Items total ({count})", - "itemsGoodsTotalWithPrice": "{count} items total $ {amount}", + "itemsGoodsTotalWithPrice": "{count} items total ${amount}", "useDiscount": "Discounts", "appointmentDelivery": "Appointment delivery", "appointmentPickup": "Appointment pickup", @@ -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", @@ -622,14 +625,20 @@ "viewStore": "View Store", "localDelivery": "Local delivery", "deliveryUnified": "Orders are delivered by {name}.", - "itemsTotalWithPrice": "{count} items total $ {amount}", + "itemsTotalWithPrice": "{count} items total ${amount}", "deliveryFeeLine": "Delivery", "serviceFeeLine": "Service fee", "subtotalLine": "Subtotal", "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", diff --git a/src/locale/zh-Hans.json b/src/locale/zh-Hans.json index cdb5264..279eadc 100644 --- a/src/locale/zh-Hans.json +++ b/src/locale/zh-Hans.json @@ -405,7 +405,7 @@ "subtotalBar": "小计", "subtotalOneLine": "小计: $ {amount}", "subtotalWithPieces": "总计({count}件)", - "itemsGoodsTotalWithPrice": "{count}件商品总共 $ {amount}", + "itemsGoodsTotalWithPrice": "{count}件商品总共${amount}", "useDiscount": "使用优惠", "appointmentDelivery": "预约配送", "appointmentPickup": "预约自取", @@ -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": "看不清?换一张", @@ -622,14 +625,20 @@ "viewStore": "查看店铺", "localDelivery": "本地配送", "deliveryUnified": "商品将由 {name} 统一配送!", - "itemsTotalWithPrice": "{count}件商品总共 $ {amount}", + "itemsTotalWithPrice": "{count}件商品总共${amount}", "deliveryFeeLine": "运费", "serviceFeeLine": "服务费", "subtotalLine": "小计", "selectAll": "全选", "forYou": "为您推荐", "calculating": "计算中...", - "selectItemsHint": "请选择要结算的商品" + "selectItemsHint": "请选择要结算的商品", + "removeCartTitle": "删除购物车?", + "removeCartDesc": "确定要删除该店铺购物车吗?", + "removeProductTitle": "移除商品?", + "removeProductDesc": "确定要将 {name} 从购物车中移除吗?", + "emptyTitle": "购物车为空", + "emptyAction": "去逛逛餐厅" }, "choosePaymethod": { "creditCard": "信用卡支付", diff --git a/src/manifest.json b/src/manifest.json index 0db648e..72e82e8 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -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/" + } + } } diff --git a/src/pages-store/pages/home-store/index.vue b/src/pages-store/pages/home-store/index.vue index ec7640f..cd424ef 100644 --- a/src/pages-store/pages/home-store/index.vue +++ b/src/pages-store/pages/home-store/index.vue @@ -1,25 +1,24 @@ \ No newline at end of file +.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; +} + + + diff --git a/src/pages-store/pages/order/checkout.vue b/src/pages-store/pages/order/checkout.vue index a4fdc20..bf6cd30 100644 --- a/src/pages-store/pages/order/checkout.vue +++ b/src/pages-store/pages/order/checkout.vue @@ -28,6 +28,21 @@ const { t } = useI18n(); const configStore = useConfigStore(); const userStore = useUserStore(); +function fillI18nParams(template: string, params: Record) { + 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) { }} {{ deliveryMethod === 0 - ? t('pages-store.checkout.localDeliverySubtitle', { name: Config.appName }) + ? localDeliverySubtitleText : t('pages-store.checkout.pickupSubtitle') }} @@ -1346,7 +1402,7 @@ function handleClose(merchantId?: string) { - {{ t('pages-store.checkout.itemsGoodsTotalWithPrice', { count: cartTotalPieceCount, amount: displayGoodsAmountStr }) }} + {{ itemsGoodsTotalWithPriceText }} {{ t('pages-store.checkout.shippingFee') }} @@ -1370,7 +1426,7 @@ function handleClose(merchantId?: string) { {{ t('pages-store.checkout.scheduledDeliveryTitle') }} {{ - t('pages-store.checkout.scheduledDeliveryWindow', { time: scheduledServiceEndLabel }) + scheduledDeliveryWindowText }} {{ 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 }} @@ -1735,13 +1787,11 @@ function handleClose(merchantId?: string) { {{ t('pages-store.checkout.orderBreakdown') }} - {{ - t('pages-store.checkout.memberThanks', { name: Config.appName }) - }} + {{ memberThanksText }} - {{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }} + {{ subtotalWithPiecesText }} ${{ displayGoodsAmountStr }} @@ -1792,7 +1842,7 @@ function handleClose(merchantId?: string) { - {{ t('pages-store.checkout.subtotalWithPieces', { count: cartTotalPieceCount }) }} + {{ subtotalWithPiecesText }} ${{ displayPaidStr }} @@ -1822,9 +1872,7 @@ function handleClose(merchantId?: string) { - {{ - t('pages-store.checkout.subtotalOneLine', { amount: displayPaidStr }) - }} + {{ subtotalOneLineText }} { + 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>() 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) { -