Browse Source

小程序:商家端-商品添加

panyong 2 years ago
parent
commit
c41459aceb

+ 34 - 10
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.js

@@ -16,17 +16,41 @@ Page({
     // * 发售时间:不能低于当前创建时间
     form: {
       'product_img_url': [], // 商品主图
-      'product_rotation_img_list': [{"url":"https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe57fa.jpg","formkey":"product_rotation_img_list"},{"url":"https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe51c4.jpg","formkey":"product_rotation_img_list"},{"url":"https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffefa54.jpg","formkey":"product_rotation_img_list"},{"url":"https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi6323230067e26.png","formkey":"product_rotation_img_list"}], // 商品轮播图
+      'product_rotation_img_list': [
+        {
+          'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe57fa.jpg',
+          'formkey': 'product_rotation_img_list'
+        },
+        {
+          'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe51c4.jpg',
+          'formkey': 'product_rotation_img_list'
+        },
+        {
+          'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffefa54.jpg',
+          'formkey': 'product_rotation_img_list'
+        },
+        {
+          'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi6323230067e26.png',
+          'formkey': 'product_rotation_img_list'
+        }
+      ], // 商品轮播图
       'product_detail_img_list': [], // 详情图
-      'product_title': '测试商品', // 商品标题
-      'product_category_id': 1, // 分类ID
-      'product_brand_id': 1, // 品牌ID
-      'product_spec': 'xl', // 规格
-      'product_unit': '个', // 单位
-      'product_all_price': 10000, // 批发价
-      'product_price': 9000, // 零售价
-      'product_count': 1000, // 库存
-      'product_sale_at': 0 // 预售时间(0代表预售)
+      'product_title': '', // 商品标题
+      'product_desc': '', // 商品简介
+      'product_category_id': {
+        'category_name': '',
+        'id': ''
+      }, // 分类ID
+      'product_brand_id': {
+        'brand_name': '',
+        'id': ''
+      }, // 品牌ID
+      'product_spec': '', // 规格
+      'product_unit': '', // 单位
+      'product_all_price': '', // 批发价
+      'product_price': '', // 零售价
+      'product_count': '', // 库存
+      'product_sale_at': '' // 预售时间(0代表预售)
     },
     product_img_url_max: 1,
     product_rotation_img_list_max: 5,

+ 1 - 1
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.scss

@@ -145,7 +145,7 @@ button.btn-submit {
     background-color: rgba(46, 129, 255, 1);
   }
 
-  &.send {
+  &[type= "primary"] {
     background-color: rgba(145, 179, 121, 1);
   }
 }

+ 15 - 22
htmldev/wxMini/pages/businessGoodsEdit/businessGoodsEdit.wxml

@@ -76,20 +76,23 @@
       <view class="describe">
         <view class="value">
           <textarea
-            value=""
+            value="{{form.product_desc}}"
             placeholder="请输入商品简介"
             placeholder-class="placeholder"
             maxlength="{{200}}"
             auto-height="{{true}}"></textarea>
         </view>
-        <view class="words-limit">0/200</view>
+        <view class="words-limit">{{form.product_desc.length}}/200</view>
       </view>
       <view class="box border-bottom-2">
         <label>
           <text>商品分类</text>
         </label>
         <view class="value">
-          <view class="placeholder">请选择商品分类</view>
+          <view
+            class="{{!!form.product_category_id.id ? '' : 'placeholder'}}">
+            {{form.product_category_id.category_name || '请选择商品分类'}}
+          </view>
           <image class="arrow" src="../../image/businessGoodsEdit/arrow.png"></image>
         </view>
       </view>
@@ -98,7 +101,9 @@
           <text>商品品牌</text>
         </label>
         <view class="value">
-          <view class="placeholder">请选择商品品牌</view>
+          <view class="{{!!form.product_brand_id.id ? '' : 'placeholder'}}">
+            {{form.product_brand_id.brand_name || '请选择商品品牌'}}
+          </view>
           <image class="arrow" src="../../image/businessGoodsEdit/arrow.png"></image>
         </view>
       </view>
@@ -118,22 +123,10 @@
           <text>单 位</text>
         </label>
         <view class="value">
-          <view class="placeholder">请选择商品单位</view>
+          <view class="{{!!form.product_unit ? '' : 'placeholder'}}">{{form.product_unit || '请选择商品单位'}}</view>
           <image class="arrow" src="../../image/businessGoodsEdit/arrow.png"></image>
         </view>
       </view>
-      <!-- todo -->
-      <view class="box border-bottom-2">
-        <label>
-          <text>商品货号</text>
-        </label>
-        <view class="value">
-          <input
-            value=""
-            placeholder="输入商品货号"
-            placeholder-class="placeholder"></input>
-        </view>
-      </view>
       <view class="box">
         <label>
           <text>批发价(元)</text>
@@ -167,20 +160,20 @@
             placeholder-class="placeholder"></input>
         </view>
       </view>
-      <view class="box">
+      <view class="box border-bottom-2">
         <label>
           <text>发售时间</text>
         </label>
         <view class="value">
-          <view class="placeholder">请选择发售时间</view>
+          <view class="{{!!form.product_sale_at ? '' : 'placeholder'}}">{{form.product_sale_at || '请选择发售时间'}}
+          </view>
           <image class="arrow" src="../../image/businessGoodsEdit/arrow.png"></image>
         </view>
       </view>
-      <!-- 编 辑: edit 发 布: send-->
       <button
-        class="btn-submit edit"
+        class="btn-submit"
         type="primary"
-        form-type="submit">编 
+        form-type="submit">编辑/发布
       </button>
     </form>
   </view>