Quellcode durchsuchen

团餐bug修复

lishanshan vor 2 Monaten
Ursprung
Commit
5403f482c9
2 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen
  1. 9 1
      pages/groupMeal/orders/order-details.vue
  2. 8 1
      pages/groupMeal/orders/refund.vue

+ 9 - 1
pages/groupMeal/orders/order-details.vue

@@ -37,7 +37,7 @@
 				<view class="title">商品信息</view>
 				<view class="center">
 					<view class="img">
-						<image :src="product.productImage || `${$config.apiUrl}/${product.productImage.split(',')[0]}`" mode="">
+						<image :src="productImageUrl" mode="">
 						</image>
 					</view>
 					<view class="box">
@@ -170,6 +170,14 @@
 		components: {
 			ListExpand
 		},
+    // 在 export default 中增加 computed
+    computed: {
+        productImageUrl() {
+            if (!this.product.productImage) return '';
+            if (this.product.productImage.indexOf('http') === 0) return this.product.productImage;
+            return `${this.$config.apiUrl}/${this.product.productImage.split(',')[0]}`;
+        }
+    },
 		data() {
 			return {
 				query: {},

+ 8 - 1
pages/groupMeal/orders/refund.vue

@@ -4,7 +4,7 @@
 		<u-navbar title="协商记录" :autoBack="true" :placeholder="true" :border-bottom="true"></u-navbar>
 		<view class="product">
 			<view class="left">
-				<image :src="data.productImage || `${$config.apiUrl}/${data.productImage.split(',')[0]}`" mode=""></image>
+				<image :src="productImageUrl" mode=""></image>
 			</view>
 			<view class="right">
 				<view>
@@ -131,6 +131,13 @@ export default {
 			}
 		}
 	},
+  computed: {
+      productImageUrl() {
+          if (!this.data.productImage) return '';
+          if (this.data.productImage.indexOf('http') === 0) return this.data.productImage;
+          return `${this.$config.apiUrl}/${this.data.productImage.split(',')[0]}`;
+      }
+  },
 	mounted() {
 		// 订单状态 0 待支付 1 待成团 2 已成团 3 已出餐 4 已送达 5 已取消 6 售后
 	},