xiaohaizhao il y a 2 ans
Parent
commit
8cbde668c3

+ 10 - 7
packageA/market/detail.js

@@ -35,6 +35,7 @@ Page({
       "id": "20221223165503",
       content
     }).then(res => {
+      wx.hideLoading();
       console.log("商品详情", res)
       if (res.msg != '成功') return wx.showToast({
         title: res.msg,
@@ -53,16 +54,14 @@ Page({
       res.data.item[0].gradeprice = CNY(res.data.item[0].gradeprice);
       res.data.item[0].marketprice = CNY(res.data.item[0].marketprice);
       this.setData({
+        content,
         detail: res.data.item[0],
-        content: Object.assign(this.data.content, res.data.rows[0]),
-        loading: false
-      });
-      if (init) this.setData({
         specRows: res.data.specRows,
         cheekRows: res.data.cheekRows,
         materialRows: res.data.materialRows,
         colorRows: res.data.colorRows,
-      })
+        loading: false
+      });
     })
   },
   /* 预览媒体 */
@@ -120,8 +119,12 @@ Page({
       valuename
     } = e.currentTarget.dataset,
       content = this.data.content;
-    if (content[valuename] == value) return;
-    content[valuename] = value;
+    if (!value.flag) return;
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    })
+    content[valuename] = (content[valuename] == value.parm) ? "" : value.parm;
     this.getDetail()
   },
   clickBut() {

+ 4 - 0
packageA/market/detail.scss

@@ -126,6 +126,10 @@ swiper {
     padding-bottom: 20rpx;
   }
 
+  .disabled {
+    opacity: .4;
+  }
+
 }
 
 .tabs {

+ 4 - 4
packageA/market/detail.wxml

@@ -38,7 +38,7 @@
       规格
     </view>
     <view class="product-box">
-      <navigator url="#" class="product {{content.spec===item?'active':''}}" wx:for="{{specRows}}" wx:key="index" bindtap="changeItemno" data-valuename="spec" data-value="{{item}}">{{item}}</navigator>
+      <navigator url="#" class="product {{content.spec===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{specRows}}" wx:key="index" bindtap="changeItemno" data-valuename="spec" data-value="{{item}}">{{item.parm}}</navigator>
     </view>
   </block>
 
@@ -47,7 +47,7 @@
       颜色
     </view>
     <view class="product-box">
-      <navigator url="#" class="product {{content.color===item?'active':''}}" wx:for="{{colorRows}}" wx:key="index" bindtap="changeItemno" data-valuename="color" data-value="{{item}}">{{item}}</navigator>
+      <navigator url="#" class="product {{content.color===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{colorRows}}" wx:key="index" bindtap="changeItemno" data-valuename="color" data-value="{{item}}">{{item.parm}}</navigator>
     </view>
   </block>
 
@@ -56,7 +56,7 @@
       材质
     </view>
     <view class="product-box">
-      <navigator url="#" class="product {{content.material===item?'active':''}}" wx:for="{{materialRows}}" wx:key="index" bindtap="changeItemno" data-valuename="material" data-value="{{item}}">{{item}}</navigator>
+      <navigator url="#" class="product {{content.material===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{materialRows}}" wx:key="index" bindtap="changeItemno" data-valuename="material" data-value="{{item}}">{{item.parm}}</navigator>
     </view>
   </block>
 
@@ -65,7 +65,7 @@
       边框
     </view>
     <view class="product-box">
-      <navigator url="#" class="product {{content.cheek===item?'active':''}}" wx:for="{{cheekRows}}" wx:key="index" bindtap="changeItemno" data-valuename="cheek" data-value="{{item}}">{{item}}</navigator>
+      <navigator url="#" class="product {{content.cheek===item.parm?'active':''}}  {{item.flag?'':'disabled'}}" wx:for="{{cheekRows}}" wx:key="index" bindtap="changeItemno" data-valuename="cheek" data-value="{{item}}">{{item.parm}}</navigator>
     </view>
   </block>
 

+ 1 - 1
packageA/market/index.wxml

@@ -14,7 +14,7 @@
 <!-- 品牌列表 -->
 <!-- <Tabs list="{{brandList}}" wx:if="{{brandList.length>1}}" box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' bind:onChange="brandChange" /> -->
 <!-- 产品列表 -->
-<Tabs wx:for="{{typeList}}" wx:if="{{typeList.length>1}}" active="{{item.active}}" wx:key="{{index}}" rowIndex="{{index}}" list="{{item.list}}" bind:onChange="typeChange" name='itemclassname' box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' />
+<Tabs wx:for="{{typeList}}" active="{{item.active}}" wx:key="{{index}}" rowIndex="{{index}}" list="{{item.list}}" bind:onChange="typeChange" name='itemclassname' box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' />
 <view class="division" />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
 	<List list="{{list}}" sys_enterpriseid='{{sys_enterpriseid}}' />