From 212ed891eba94c59d663c7bbbb156acdbc3a0f12 Mon Sep 17 00:00:00 2001
From: Jacob <hlnie@tohours.com>
Date: 星期二, 20 十月 2026 15:12:13 +0800
Subject: [PATCH] fix: 订单列表及商品组件处理空值展示并统一数字转换避免显示 null/NaN

---
 pages/users/order_list/index.vue |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/pages/users/order_list/index.vue b/pages/users/order_list/index.vue
index 111602b..03bc685 100644
--- a/pages/users/order_list/index.vue
+++ b/pages/users/order_list/index.vue
@@ -37,14 +37,14 @@
 						<view class='title acea-row row-between-wrapper'>
 							<view class="acea-row row-middle">
 								<text class="sign cart-color acea-row row-center-wrapper"
-									v-if="item.activityType !== '鏅��' && item.activityType !== '鏍搁攢'">{{ item.activityType
-									}}</text>
+									v-if="item.activityType && item.activityType !== '鏅��' && item.activityType !== '鏍搁攢'">{{
+										item.activityType }}</text>
 								<!-- <text class="sign cart-color acea-row row-center-wrapper" v-if="item.bargainId != 0">鐮嶄环</text>
 								<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.storeOrder.combinationId != 0">鎷煎洟</text>
 								<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.storeOrder.seckillId != 0">绉掓潃</text> -->
 								<view>{{ item.createTime }}</view>
 							</view>
-							<view class='font-color'>{{ item.orderStatus }}</view>
+							<view class='font-color'>{{ item.orderStatus || '' }}</view>
 							<!-- <view v-if="item.status?item.status.type == 0:0" class='font-color'>寰呬粯娆�</view>
 							<view v-else-if="item.status?item.status.type == 1:0 && item.storeOrder.shippingType==1" class='font-color'>寰呭彂璐�</view>
 							<view v-else-if="item.status?item.status.type == 2:0 && item.storeOrder.shippingType==1" class='font-color'>寰呮敹璐�</view>
@@ -54,8 +54,7 @@
 						</view>
 						<orderListGoods :orderInfoList="item.orderInfoList"
 							:zonePromotionList="item.zonePromotionList || []"></orderListGoods>
-						<view class='totalPrice'>鍏眥{ item.totalNum + getGiftCount(item.zonePromotionList || [])
-							}}浠跺晢鍝侊紝鎬婚噾棰�
+						<view class='totalPrice'>鍏眥{ getTotalNum(item) }}浠跺晢鍝侊紝鎬婚噾棰�
 							<text class='money font-color' v-if="getPayWay(item.payPrice, item.payCareBean) == 1">
 								<text class="color-blue">锟{ toNumber(item.payPrice) }}</text>
 								<text class="color-blue">+{{ toThousands(toNumber(item.payCareBean)) }}鎮﹀吇璞�</text>
@@ -254,6 +253,9 @@
 			});
 			return count;
 		},
+		getTotalNum(item) {
+			return (Number(item.totalNum) || 0) + this.getGiftCount(item.zonePromotionList || []);
+		},
 		getPayWay(price, payCareBean) {
 			console.log('闃挎柉椤垮彂閫佸埌鍙戦�佸湴鏂�', Number(price) > 0 && Number(payCareBean) > 0);
 			if (Number(price) > 0 && Number(payCareBean) > 0) {
@@ -312,7 +314,9 @@
 		getOrderData: function () {
 			let that = this;
 			orderData().then(res => {
-				that.$set(that, 'orderData', res.data);
+				that.$set(that, 'orderData', (res && res.data) || {});
+			}).catch(() => {
+				that.$set(that, 'orderData', {});
 			})
 		},
 		/**
@@ -447,7 +451,7 @@
 				page: that.page,
 				limit: that.limit,
 			}).then(res => {
-				let list = res.data.list || [];
+				let list = (res && res.data && res.data.list) || [];
 				let loadend = list.length < that.limit;
 				that.orderList = that.$util.SplitArray(list, that.orderList);
 				that.$set(that, 'orderList', that.orderList);

--
Gitblit v1.4.0