Преглед изворни кода

如果有多个订单且多个备注,把所有备注都展示

shizhongqi пре 3 месеци
родитељ
комит
8b9e9e0493
1 измењених фајлова са 21 додато и 5 уклоњено
  1. 21 5
      ghsApp/src/admin/order/orderListByDist.vue

+ 21 - 5
ghsApp/src/admin/order/orderListByDist.vue

@@ -32,9 +32,11 @@
                 <text class="col-address" style="color: #07c160;">{{ customItems[0].address }}</text>
               </block>
             </view>
-            <view class="row-remark" v-if="customItems[0].remark">
-              <text style="color: #666;font-size: 28upx;">备注:</text>{{ customItems[0].remark }}
-            </view>
+            <block v-if="getRemarks(customItems).length > 0">
+              <view class="row-remark" v-for="(remarkItem, rIndex) in getRemarks(customItems)" :key="'remark-' + rIndex">
+                <text style="font-size: 28upx;">{{ remarkItem.label }}:</text>{{ remarkItem.text }}
+              </view>
+            </block>
           </view>
         </view>
       </block>
@@ -60,7 +62,7 @@
               <text class="col-address-popup">{{ item.address }}</text>
             </view>
             <view class="row-remark" v-if="item.remark">
-              <text style="color: #666;font-size: 28upx;">备注:</text>{{ item.remark }}
+              <text style="font-size: 28upx;">备注:</text>{{ item.remark }}
             </view>
           </view>
         </scroll-view>
@@ -176,6 +178,20 @@ export default {
         remark: item.remark || ''
       };
     },
+    getRemarks(customItems) {
+      if (!customItems || !customItems.length) return [];
+      const remarks = customItems.map(item => item.remark).filter(remark => !!remark);
+      if (remarks.length === 0) {
+        return [];
+      }
+      if (remarks.length === 1) {
+        return [{ label: '备注', text: remarks[0] }];
+      }
+      return remarks.map((remark, index) => ({
+        label: `备注${index + 1}`,
+        text: remark
+      }));
+    },
     handleRowClick(customItems) {
       if (customItems.length === 1) {
         this.goToDetail(customItems[0].id);
@@ -269,7 +285,7 @@ export default {
 
 .row-remark {
   font-size: 26upx;
-  color: #999;
+  color: hsl(0, 95%, 44%);
   margin-top: 10upx;
   width: 100%;
 }