shish 3 mesi fa
parent
commit
10988f6614

+ 11 - 1
hdPad/src/pages/home/components/leftArea.vue

@@ -2,7 +2,7 @@
     <view class="itemList-box">
         <view class="title">
             列表
-            <text style="float:right;">{{ getMyShopInfo.shop.shopName=='首店'? getMyShopInfo.shop.merchantName: getMyShopInfo.shop.merchantName+' '+getMyShopInfo.shop.shopName}}</text>
+            <text style="float:right;">{{ shopTitle }}</text>
         </view>
         <scroll-view
             class="itemList-item_box"
@@ -141,6 +141,16 @@ export default {
     },
 	computed:{
 		...mapGetters(["getMyShopInfo"]),
+        shopTitle() {
+            const shop = (this.getMyShopInfo && this.getMyShopInfo.shop) || {}
+            const merchantName = shop.merchantName || ''
+            const shopName = shop.shopName || ''
+
+            if (!merchantName && !shopName) return ''
+            return shopName == '首店'
+                ? merchantName
+                : `${merchantName}${merchantName && shopName ? ' ' : ''}${shopName}`
+        },
 	},
     methods:{
         getTouchPoint(event) {

+ 11 - 5
hdPad/src/pages/home/components/leftGroup.vue

@@ -2,11 +2,7 @@
 	<view class="itemList-box">
 		<view class="title">
 			列表
-			<text style="float: right">{{
-				getMyShopInfo.shop.shopName == "首店"
-					? getMyShopInfo.shop.merchantName
-					: getMyShopInfo.shop.merchantName + " " + getMyShopInfo.shop.shopName
-			}}</text>
+			<text style="float: right">{{ shopTitle }}</text>
 		</view>
 		<scroll-view
 			class="itemList-item_box"
@@ -111,6 +107,16 @@ export default {
 	},
 	computed: {
 		...mapGetters(["getMyShopInfo"]),
+		shopTitle() {
+			const shop = (this.getMyShopInfo && this.getMyShopInfo.shop) || {};
+			const merchantName = shop.merchantName || "";
+			const shopName = shop.shopName || "";
+
+			if (!merchantName && !shopName) return "";
+			return shopName == "首店"
+				? merchantName
+				: `${merchantName}${merchantName && shopName ? " " : ""}${shopName}`;
+		},
 	},
 	created() {
 		this.getGroupList();