Handy_Cao 2 år sedan
förälder
incheckning
7fcb8fed92

+ 55 - 49
GuangZuan/miniprogram/pages/trade/index.ts

@@ -184,62 +184,68 @@ Page({
       /// 钻石分类
       zscategory: this.data.category,
       /// 形状
-      zsshapetype: [this.data.shape.toString()],
+      zsshapetype: this.data.shape === 0 ? [] : [this.data.shape.toString()],
       /// 净度
-      zsclaritytype: [this.data.clarity],
+      zsclaritytype: this.data.clarity === 0 ? [] : [this.data.clarity],
       /// 切工
-      zscuttype: [this.data.cut],
+      zscuttype: this.data.cut === 0 ? [] : [this.data.cut],
       /// 荧光
-      zsfluorescencetype: [this.data.fluorescence],
+      zsfluorescencetype: this.data.fluorescence === 0 ? [] : [this.data.fluorescence],
     }
-    // /// 获取参数
+    /// 获取参数
     // const info = JSON.parse(wx.getStorageSync('TradeParams')) 
-    /// 钻石查询
-    queryDiamond({
-      data: {
-        ...data,
-        // /// 颜色
-        // zscolortype: info ? info.zscolortype : [null],
-        // /// 货币类型
-        // zscurrencytype: info ? [info.zscurrencytype.toString()] : [''],
-        // /// 证书类型
-        // zscerttype: info ? [info.zscerttype.toString()] : [''],
-        // /// 抛光
-        // zspolishtype: info ? [info.zspolishtype] : [],
-        // /// 对称
-        // zssymmetrytype: info ? [info.zssymmetrytype] : [],
-        // /// 总重量(克拉重量)-从
-        // weight1: info ? info.weight1 : 0.0,
-        // /// 总重量(克拉重量)-至
-        // weight2: info ? info.weight2 : 0
-      },
-      /// 加载成功
-      success: (res) => {
-        if (res.code != 200) {
+    showLoading(() => {
+      /// 钻石查询
+      queryDiamond({
+        data: {
+          ...data,
+          // /// 颜色
+          // zscolortype: info ? info.zscolortype : [],
+          // /// 货币类型
+          // zscurrencytype: info ? [info.zscurrencytype.toString()] : [],
+          // /// 证书类型
+          // zscerttype: info ? [info.zscerttype.toString()] : [],
+          // /// 抛光
+          // zspolishtype: info ? [info.zspolishtype] : [],
+          // /// 对称
+          // zssymmetrytype: info ? [info.zssymmetrytype] : [],
+          // /// 总重量(克拉重量)-从
+          // weight1: info ? info.weight1 : 0.0,
+          // /// 总重量(克拉重量)-至
+          // weight2: info ? info.weight2 : 0
+        },
+        /// 加载成功
+        success: (res) => {
+          if (res.code != 200) {
+            /// 加载失败
+            hideLoading(()=>{}, '请求失败,原因:'+res.msg)
+            return
+          }
           /// 加载失败
-          showToast('请求失败,原因:'+res.msg)
-          return
+          hideLoading(()=>{
+            /// 数据赋值
+            this.setData({ 
+              isEmpty: res.data.length === 0,
+              sellOrders: res.data.map(itm => {
+                var obj = itm
+                obj.zscuttype1display = isnullstr(itm.zscuttype1display)
+                obj.zspolishtype1display = isnullstr(itm.zspolishtype1display)
+                obj.zsfluorescencetype1display = isnullstr(itm.zsfluorescencetype1display)
+                obj.zssymmetrytype1display = isnullstr(itm.zssymmetrytype1display)
+                return obj
+              }) 
+            })
+          })
+        },
+        fail: (emsg) => {
+          /// 加载失败
+          hideLoading(()=>{}, emsg)
+        },
+        complete: () => {
+          /// 停止下拉刷新
+          wx.stopPullDownRefresh()
         }
-        /// 数据赋值
-        this.setData({ sellOrders: res.data.map(itm => {
-          var obj = itm
-          obj.zscuttype1display = isnullstr(itm.zscuttype1display)
-          obj.zspolishtype1display = isnullstr(itm.zspolishtype1display)
-          obj.zsfluorescencetype1display = isnullstr(itm.zsfluorescencetype1display)
-          obj.zssymmetrytype1display = isnullstr(itm.zssymmetrytype1display)
-          return obj
-        }) })
-      },
-      fail: (emsg) => {
-        /// 加载失败
-        showToast(emsg)
-      },
-      complete: () => {
-        /// 数据赋值
-        this.setData({ isEmpty: this.data.sellOrders.length === 0 })
-        /// 停止下拉刷新
-        wx.stopPullDownRefresh()
-      }
+      })
     })
   },
 

+ 1 - 1
GuangZuan/miniprogram/pages/trade/index.wxml

@@ -48,7 +48,7 @@
           <text wx:if="{{ active === 1 }}">颜色:{{ itm.zscolortypedisplay }}</text>
           <text>切工:{{ active === 0 ? itm.zscuttype1display : itm.zscuttypedisplay }}</text>
           <text>抛光:{{ active === 0 ? itm.zspolishtype1display : itm.zspolishtypedisplay }}</text>
-          <text>尺寸:{{ itm.zssize }}</text>
+          <text>尺寸:{{ active === 0 ? itm.sizedisplay : itm.zssize }}</text>
         </view>
         <view class="vanSwipeCell-item__mid__mid">
           <text wx:if="{{ active === 1 }}">净度:{{ itm.zsclaritytypedisplay }}</text>