Jelajahi Sumber

赠送页面添加类型选中样式
商品属性修改

2662043119@qq.com 1 tahun lalu
induk
melakukan
3bdcfe0e6a

+ 2 - 2
src/pages/consumerGold/index.vue

@@ -90,7 +90,7 @@
             </view>
             <view class="content-view">
               <view :class="['product-title', 'ellipsis']">{{
-                i.goods_name
+                i.goods.goods_name
               }}</view>
               <view class="product-price">
                 <text class="product-price-original">{{ i.cost_price }}</text>
@@ -191,7 +191,7 @@ export default {
           } else {
             // console.log("这里");
             that.page = -1;
-            this.$toast("暂无更多");
+            // this.$toast("暂无更多");
           }
         } else {
           this.page = -1;

+ 15 - 6
src/pages/product/p_details.vue

@@ -103,19 +103,20 @@
                             </view>
                         </view>
                     </view>
-                    <view v-if="detail.goods_attr_list.length > 0">
+                    <view v-if="detail.goods_spec_list.length > 0">
                         <view class="goods_spec">
                             <text>{{detail.goods_attr}}</text>
                         </view>
                         <view class="goods_spec_list">
                             <view class="goods_spec_list_item"  
-                                v-for="(item,index) in detail.goods_attr_list" :key="index"
+                                v-for="(item,index) in detail.goods_spec_list[goodsSpecIndex].attr_list" :key="index"
                                 :class="goodsAttrIndex == index ? 'goods_spec_list_item_active' : ''"
                                 @click="goodsAttrChange(item,index)">
                                 <span>{{item.attr_name}}</span>
                             </view>
                         </view>
                     </view>
+                    
                 </view>
                 <checkbox-group class="flex_r flex_ac flex_jc" @change="checkboxChange">
                     <label class="option_box">
@@ -200,7 +201,7 @@ export default {
             detail: {
                 goods: {},
                 goods_spec_list: [],
-                goods_attr_list: [],
+                
             }, // 商品详情
             checked: false, //是否选中协议
             buyNum: 1, //购买数量
@@ -242,10 +243,12 @@ export default {
                     this.detail.goods_img = imgs;
                     if (this.detail.goods_spec_list.length > 0) {
                         this.specId = this.detail.goods_spec_list[0].id
+
+                        if (this.detail.goods_spec_list[0].attr_list.length > 0) {
+                            this.attrId = this.detail.goods_spec_list[0].attr_list[0].id
+                        }
                     }
-                    if (this.detail.goods_attr_list.length > 0) {
-                        this.attrId = this.detail.goods_attr_list[0].id
-                    }
+                    
                     this.getPrice()
                 } else {
                     uni.showModal({
@@ -376,6 +379,12 @@ export default {
         goodsSpecChange(item,index){
             this.goodsSpecIndex = index;
             this.specId = item.id
+            this.goodsAttrIndex = 0
+            if(this.detail.goods_spec_list[this.goodsSpecIndex].attr_list.length > 0){
+                this.attrId = this.detail.goods_spec_list[this.goodsSpecIndex].attr_list[0].id
+            }else{
+                this.attrId = "0"
+            }
             this.getPrice()
         },
         goodsAttrChange(item,index){

+ 1 - 1
src/pages/szw-order-list/index.vue

@@ -17,7 +17,7 @@
                         <view class="goods-info flex_r flex_jb" :data-type="li.type" @tap="toDetails(li)">
                             <image :src="li.original_img" mode="cover" class="goods-img" />
                             <view class="goodsDetail_info">
-                                <view class="good_name ellipsis2">{{ li.goods_name || "" }}</view>
+                                <view class="good_name ellipsis">{{ li.goods_name || "" }}</view>
                                 <view class="goods_spec">
                                     <text class="goods_spec_text" v-if="li.spec_name">{{ li.spec_name }}</text>
                                     <text v-if="li.attr_name">{{ li.attr_name }}</text>

+ 7 - 4
src/pages/to-pay-list/index.vue

@@ -229,13 +229,16 @@ export default {
             post("v1/goods/goodsDetail", da).then((res) => {
                 if (res.code === 0) {
                     this.goodsInfo = res.data.data;
+                    let attr_list=[]
                     if (this.goodsInfo.goods_spec_list.length > 0) {
-                        this.specName = this.goodsInfo.goods_spec_list.filter((item)=>{
+                        let list= this.goodsInfo.goods_spec_list.filter((item)=>{
                             return item.id == this.Data.spec_id
-                        })[0].spec_name
+                        })[0]
+                        this.specName = list.spec_name;
+                        attr_list = list.attr_list
                     }
-                    if (this.goodsInfo.goods_attr_list.length > 0) {
-                        this.attrName = this.goodsInfo.goods_attr_list.filter((item)=>{
+                    if (attr_list.length > 0) {
+                        this.attrName = attr_list.filter((item)=>{
                             return item.id == this.Data.attr_id
                         })[0].attr_name
                     }