Browse Source

小程序:首页接口对接

panyong 2 years ago
parent
commit
828ff7b309

+ 20 - 1
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.js

@@ -58,7 +58,17 @@ Page({
     booSaleAt: false,
     minDate: minDate,
     maxDate: new Date(objMinDate.YYYY + 5, 11, 31).getTime(),
-    currentDate: new Date().getTime()
+    currentDate: new Date().getTime(),
+    productStatus: [
+      {
+        name: '下架',
+        value: 0
+      },
+      {
+        name: '上架',
+        value: 1
+      }
+    ]
   },
 
   /**
@@ -358,6 +368,13 @@ Page({
 
     this.setData(tempForm)
   },
+  handleRadio(event) {
+    const { formkey, item } = event.currentTarget.dataset
+
+    this.setData({
+      [`form.${formkey}`]: item.value
+    })
+  },
   saleAtTypeShow() {
     this.setData({ booSaleAtType: true })
   },
@@ -412,6 +429,7 @@ Page({
       product_all_price,
       product_price,
       product_count,
+      product_status,
       product_sale_at
     } = this.data.form
 
@@ -428,6 +446,7 @@ Page({
       product_all_price: yuan2Fen(product_all_price),
       product_price: yuan2Fen(product_price),
       product_count,
+      product_status,
       product_sale_at: product_sale_at === '预售' ? 0 : this.data.currentDate
     }
   },

+ 21 - 0
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.scss

@@ -135,6 +135,27 @@ label {
   color: rgba(153, 153, 153, 1);
 }
 
+.select-options {
+  display: flex;
+  align-items: center;
+
+  &:nth-of-type(2) {
+    margin-left: 16rpx;
+  }
+
+  image {
+    width: 42rpx;
+    height: 42rpx;
+  }
+
+  text {
+    margin-left: 6rpx;
+    line-height: 42rpx;
+    font-size: 28rpx;
+    color: rgba(51, 51, 51, 1);
+  }
+}
+
 button.btn-submit {
   width: 627rpx;
   height: 80rpx;

+ 24 - 0
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.wxml

@@ -176,6 +176,30 @@
             bind:input="setFormValue"></input>
         </view>
       </view>
+
+      <view class="form-item">
+        <label>
+          <text>状 态</text>
+        </label>
+        <view class="value">
+          <view
+            class="select-options"
+            wx:for="{{productStatus}}"
+            wx:key="value"
+            data-formkey="product_status"
+            data-item="{{item}}"
+            bind:tap="handleRadio">
+            <image
+              hidden="{{ index === 0 ? form.product_status === 0 : form.product_status === 1}}"
+              src="../../image/common/unselected.png"></image>
+            <image
+              hidden="{{index === 0 ? form.product_status !== 0 : form.product_status !== 1}}"
+              src="../../image/common/selected.png"></image>
+            <text>{{item.name}}</text>
+          </view>
+        </view>
+      </view>
+
       <view
         class="form-item border-bottom-2"
         bind:tap="saleAtTypeShow">