Browse Source

小程序:商品详情接口对接

panyong 2 years ago
parent
commit
a9bb579ffa

+ 30 - 3
htmldev/wxMini/pages/businessGoodsManage/businessGoodsManage.js

@@ -166,9 +166,15 @@ Page({
       if (status) {
         const { list } = data
         if (Array.isArray(list)) {
-          const _list = temp.isRefresh
-            ? [].concat(list)
-            : that.data.originScrollViewData[_tab].list.concat(list)
+          // product_status 商品状态(0未上架1已上架2审核中3审核未通过)
+          // product_sale_at 预售(0非预售  时间戳代表预售时间)
+          const tempList = list.map(item => {
+            return {
+              ...item,
+              ...that.getStatusTextAndColor(item.product_status)
+            }
+          })
+          const _list = temp.isRefresh ? [].concat(tempList) : that.data.originScrollViewData[_tab].list.concat(tempList)
 
           that.setData({
             ['originScrollViewData[' + _tab + '].list']: _list,
@@ -261,5 +267,26 @@ Page({
     this.setData({
       booLock: false
     })
+  },
+  getStatusTextAndColor(val) {
+    const arr = ['未上架', '已上架', '审核中', '审核未通过']
+    let color = 'col-0'
+    switch (val) {
+      case 1:
+        color = 'col-2'
+        break
+      case 2:
+        color = 'col-1'
+        break
+      case 3:
+        color = 'col-3'
+        break
+      default:
+    }
+
+    return {
+      product_status_text: arr[val] || '',
+      product_status_color: color
+    }
   }
 })

+ 4 - 0
htmldev/wxMini/pages/businessGoodsManage/businessGoodsManage.scss

@@ -79,6 +79,10 @@
     color: rgba(51, 51, 51, 1);
   }
 
+  .col-0 {
+    color: rgba(51, 51, 51, 1);
+  }
+
   .col-1 {
     color: rgba(255, 141, 26, 1);
   }

+ 5 - 3
htmldev/wxMini/pages/businessGoodsManage/businessGoodsManage.wxml

@@ -45,11 +45,13 @@
               wx:for="{{item.list}}"
               wx:for-item="order"
               wx:key="id">
-          <!-- todo 货号 审核状态 -->
           <view class="top">
-            <view>产品货号:12345678900</view>
+            <view>产品货号:{{order.product_code}}</view>
             <!-- 已上架 审核未通过 -->
-            <view class="col-1">审核中</view>
+            <view
+              class="{{order.product_status_color}}"
+              wx:if="{{!!order.product_status_text}}">{{order.product_status_text}}
+            </view>
           </view>
           <view class="middle">
             <view class="photo-wrap">