fix:订单列表展示购买商品数量
This commit is contained in:
1 parent
80b04689de
commit
39f60bb2c7
6 files changed
+36
-16
No files matched your search
@@ -54,7 +54,7 @@ export default {
|
||||
pendingPay: "Unpaid",
|
||||
noProduct: "No product",
|
||||
goodsExpandHint: "{count} item(s), tap to expand",
|
||||
goodsOneHint: "1 item",
|
||||
goodsOneHint: "{count} item(s)",
|
||||
goodsTotal: "{count} item(s)",
|
||||
expand: "Expand",
|
||||
collapse: "Collapse",
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
pendingPay: "待支付",
|
||||
noProduct: "暂无商品",
|
||||
goodsExpandHint: "共 {count} 件,点击展开",
|
||||
goodsOneHint: "共 1 件商品",
|
||||
goodsOneHint: "共 {count} 件商品",
|
||||
goodsTotal: "共 {count} 件",
|
||||
expand: "展开",
|
||||
collapse: "收起",
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
pendingPay: "待支付",
|
||||
noProduct: "暫無商品",
|
||||
goodsExpandHint: "共 {count} 件,點擊展開",
|
||||
goodsOneHint: "共 1 件商品",
|
||||
goodsOneHint: "共 {count} 件商品",
|
||||
goodsTotal: "共 {count} 件",
|
||||
expand: "展開",
|
||||
collapse: "收起",
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "资安信",
|
||||
"appid" : "__UNI__1BFE88F",
|
||||
"description" : "资安信后勤管理系统",
|
||||
"versionName" : "1.5.40",
|
||||
"versionCode" : 1540,
|
||||
"versionName" : "1.5.41",
|
||||
"versionCode" : 1541,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
@@ -462,7 +462,7 @@ const doAppleLogin = async () => {
|
||||
<view class="flex justify-between items-center m-t-30rpx m-x-30rpx">
|
||||
<text class="color-blue font-size-sm" @click="router.jump('/pages/root/forgot-password')">{{
|
||||
t("mobile.login.forgotPassword") }}</text>
|
||||
<text class="color-blue font-size-sm" v-if="false" @click="router.jump('/pages/root/invite-register')">{{
|
||||
<text class="color-blue font-size-sm" @click="router.jump('/pages/root/invite-register')">{{
|
||||
t("mobile.login.register") }}</text>
|
||||
</view>
|
||||
|
||||
@@ -471,11 +471,11 @@ const doAppleLogin = async () => {
|
||||
<view class="flex items-center justify-center m-b-20rpx">
|
||||
<view class="login-divider-line" />
|
||||
<text class="login-divider-text second-text-24 color-#999 m-x-20rpx">{{ t("mobile.login.otherLogin")
|
||||
}}</text>
|
||||
}}</text>
|
||||
<view class="login-divider-line" />
|
||||
</view>
|
||||
<view class="flex justify-center items-center social-login-row">
|
||||
<view v-if="state.wxLoginEnabled && false" class="social-login-btn" role="button"
|
||||
<view v-if="state.wxLoginEnabled" class="social-login-btn" role="button"
|
||||
:aria-label="t('mobile.login.wechatLogin')" hover-class="social-login-btn--pressed"
|
||||
:hover-stay-time="120" @tap="onWechatLoginTap">
|
||||
<image class="social-login-icon" src="/static/icon/weixinlogo.png" mode="aspectFill" />
|
||||
|
||||
@@ -55,6 +55,19 @@ const getOrderKey = (order: any, index: number) => String(order?.id ?? index)
|
||||
|
||||
const hasMultipleGoods = (order: any) => (order?.carList?.length || 0) > 1
|
||||
|
||||
/** 商品行购买数量;缺失或非正数时返回 0,模板据此隐藏 ×N 角标。 */
|
||||
const goodsCount = (item: any) => {
|
||||
const count = Number(item?.productCount ?? 0)
|
||||
return Number.isFinite(count) && count > 0 ? count : 0
|
||||
}
|
||||
|
||||
/** 订单商品总件数,按各行 productCount 汇总;历史数据缺数量时回退商品种类数,展示与旧口径一致。 */
|
||||
const goodsTotalCount = (order: any) => {
|
||||
const list: any[] = order?.carList || []
|
||||
const total = list.reduce((sum, item) => sum + goodsCount(item), 0)
|
||||
return total > 0 ? total : list.length
|
||||
}
|
||||
|
||||
const isGoodsCollapsed = (order: any, index: number) => {
|
||||
if (!props.goodsCollapsed || !hasMultipleGoods(order)) return false
|
||||
return collapseState.value[getOrderKey(order, index)] ?? true
|
||||
@@ -296,13 +309,20 @@ const refundStatusLabel = computed(() => {
|
||||
:src="filePath(props.cardetail.carList?.[0]?.productPic) || '/static/logo/zax.png'"
|
||||
mode="aspectFill" />
|
||||
<view class="ml-16rpx min-w-0 flex-1">
|
||||
<view class="second-text-22 truncate">
|
||||
{{ props.cardetail.carList?.[0]?.productName || t('mobile.order.noProduct') }}
|
||||
<view class="flex items-center">
|
||||
<view class="min-w-0 flex-1 second-text-22 truncate">
|
||||
{{ props.cardetail.carList?.[0]?.productName || t('mobile.order.noProduct') }}
|
||||
</view>
|
||||
<text v-if="goodsCount(props.cardetail.carList?.[0])"
|
||||
class="ml-8rpx flex-shrink-0 text-20rpx font-600 text-[#98a2b3]">
|
||||
×{{ goodsCount(props.cardetail.carList?.[0]) }}
|
||||
</text>
|
||||
</view>
|
||||
<view v-if="hasMultipleGoods(props.cardetail)" class="mt-8rpx text-20rpx text-[#98a2b3]">
|
||||
{{ t('mobile.order.goodsExpandHint', { count: props.cardetail.carList?.length || 0 }) }}
|
||||
{{ t('mobile.order.goodsExpandHint', { count: goodsTotalCount(props.cardetail) }) }}
|
||||
</view>
|
||||
<view v-else class="mt-8rpx text-20rpx text-[#98a2b3]">{{ t('mobile.order.goodsOneHint') }}
|
||||
<view v-else class="mt-8rpx text-20rpx text-[#98a2b3]">
|
||||
{{ t('mobile.order.goodsOneHint', { count: goodsTotalCount(props.cardetail) }) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -316,6 +336,9 @@ const refundStatusLabel = computed(() => {
|
||||
<image class="h-90rpx w-120rpx rounded-8rpx bg-[#999] shadow-main overflow-hidden"
|
||||
:src="filePath(item.productPic) || '/static/logo/zax.png'" mode="aspectFill" />
|
||||
<view class="second-text-22 mt-8rpx truncate">{{ item.productName }}</view>
|
||||
<view v-if="goodsCount(item)" class="mt-2rpx text-20rpx text-[#98a2b3]">
|
||||
×{{ goodsCount(item) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -328,10 +351,7 @@ const refundStatusLabel = computed(() => {
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="mt-6rpx rounded-full bg-[#e8f2ff] px-10rpx py-3rpx text-18rpx font-600 text-[#1570ef]">
|
||||
{{ t('mobile.order.goodsTotal', {
|
||||
count:
|
||||
props.cardetail.carList?.length || 0
|
||||
}) }}
|
||||
{{ t('mobile.order.goodsTotal', { count: goodsTotalCount(props.cardetail) }) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in new issue
Block a user