Просмотр исходного кода

商城购买商品 选择多款式 图片

jiangfeng 5 лет назад
Родитель
Сommit
5bae5bfc2f
2 измененных файлов с 12 добавлено и 3 удалено
  1. 11 2
      mallApp/src/components/module/app-order-list.vue
  2. 1 1
      mallApp/src/pages/order/buy.vue

+ 11 - 2
mallApp/src/components/module/app-order-list.vue

@@ -27,14 +27,23 @@ export default {
 		info: {
 		info: {
 			type: Object,
 			type: Object,
 			default: () => {}
 			default: () => {}
-		}
+		},
+        goodsStyleId:'',
 	},
 	},
 	data() {
 	data() {
 		return {}
 		return {}
 	},
 	},
 	computed: {
 	computed: {
 		imgUrl() {
 		imgUrl() {
-			if (this.$util.isEmpty(this.info)) return ''
+			if (this.$util.isEmpty(this.info)) return '';
+			let img = '';
+			this.info.goodsStyleList.forEach((ele)=>{
+			    if(ele.id==this.goodsStyleId){
+			        console.log(ele.img)
+                    img = ele.img
+				}
+			})
+			if(!this.$util.isEmpty(img)) return img;
 			return this.info.smallCoverUrl ? this.info.smallCoverUrl : this.info.smallImgList[0]
 			return this.info.smallCoverUrl ? this.info.smallCoverUrl : this.info.smallImgList[0]
 		}
 		}
 	},
 	},

+ 1 - 1
mallApp/src/pages/order/buy.vue

@@ -36,7 +36,7 @@
       <div class="module-com shop-price-wrap">
       <div class="module-com shop-price-wrap">
         <div class="module-tit">商品信息</div>
         <div class="module-tit">商品信息</div>
         <div class="module-det">
         <div class="module-det">
-          <app-list-module v-if="!$util.isEmpty(goodsInfo)" :info="goodsInfo" />
+          <app-list-module v-if="!$util.isEmpty(goodsInfo)" :goodsStyleId="option.goodsStyleId" :info="goodsInfo" />
           <div class="shop-prompt" v-if="!$util.isEmpty(orderShop)" @click="showAlert = true">
           <div class="shop-prompt" v-if="!$util.isEmpty(orderShop)" @click="showAlert = true">
             <div>
             <div>
               <span>{{ `运费(${showDistance}公里)` }}</span>
               <span>{{ `运费(${showDistance}公里)` }}</span>