shish 6 лет назад
Родитель
Сommit
d788cb5bcb
2 измененных файлов с 41 добавлено и 19 удалено
  1. 36 13
      store/src/admin/goodsManage/add.vue
  2. 5 6
      store/src/components/app-uploader.vue

+ 36 - 13
store/src/admin/goodsManage/add.vue

@@ -22,7 +22,7 @@
             placeholder-class="phcolor"
             class="tui-input"
             name="sold"
-            placeholder="请输入"
+            placeholder="请输入已售数量"
             maxlength="50"
             type="number"
           />
@@ -34,7 +34,7 @@
             placeholder-class="phcolor"
             class="tui-input"
             name="stock"
-            placeholder="请输入"
+            placeholder="请输入库存,留空表示库存充足"
             maxlength="50"
             type="number"
           />
@@ -72,31 +72,47 @@
         <tui-list-cell class="line-cell" :hover="false">
           <div class="tui-title">自动涨价</div>
           <label for="autoPrice" class="tui-input" @click="autoRiseChange(form.autoRise)">
-            <checkbox id="autoPrice" class="ljd-checkbox" :checked="form.autoRise == 1"></checkbox>
+            <checkbox
+              id="autoPrice"
+              class="ljd-checkbox"
+              :checked="form.autoRise == 1"
+              style="transform: scale(0.7,0.7);"
+            ></checkbox>
             <span>需要</span>
           </label>
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
           <div class="tui-title">配送方式</div>
-          <label for="autoPrice" class="tui-input" @click="needSendChange(form.needSend)">
+          <label for="sendType" class="tui-input" @click="needSendChange(form.needSend)">
             <checkbox
-              id="autoPrice"
+              id="sendType"
               class="ljd-checkbox"
               :checked="form.needSend == 1"
               @change="giftChange"
+              style="transform: scale(0.7,0.7);"
             ></checkbox>
-            <span>到店自</span>
+            <span>到店自</span>
           </label>
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
           <div class="tui-title">运费</div>
           <radio-group class="tui-input flex-center-between" @change="freightChange">
             <label class="list" for="customLink">
-              <radio id="customLink" value="0" :checked="form.freightType == 0" />
+              <radio
+                id="customLink"
+                value="0"
+                :checked="form.freightType == 0"
+                style="transform: scale(0.8,0.8);"
+              />
               <span class="checkbox-text">按距离收费</span>
             </label>
             <label class="list" for="goodsLink">
-              <radio id="goodsLink" value="1" :checked="form.freightType == 1" />
+              <radio
+                id="goodsLink"
+                value="1"
+                :checked="form.freightType == 1"
+                style="transform: scale(0.8,0.8);"
+              />
               <span class="checkbox-text">免运费</span>
             </label>
           </radio-group>
@@ -161,8 +177,8 @@ export default {
         autoRise: "1",
         needSend: "0",
         freightType: "0",
-		shopImg: [],
-		briefContent:""
+        shopImg: [],
+        briefContent: ""
         // goodsStyleList: [],
       }
     };
@@ -183,10 +199,16 @@ export default {
     },
     _getDet() {
       return getDetailB({ id: this.option.id }).then(res => {
-        if (this.$util.isEmpty(res.data)) return;
+        if (this.$util.isEmpty(res.data)) {
+          return;
+        }
         Object.keys(this.form).forEach((i, index) => {
           this.form[i] = res.data[i];
         });
+        if (this.form.stock == -1) {
+          this.$set(this.form, "stock", "");
+        }
+        this.$set(this.form, "shopImg", res.data.smallImgList)
       });
     },
     // 确认
@@ -204,6 +226,9 @@ export default {
       let host = this.option.id ? updateB : addB;
       let form = JSON.parse(JSON.stringify(this.form));
       form.shopImg = this.$util.imgSubstr(form.shopImg);
+      if (form.stock == "") {
+        form.stock = -1;
+      }
       host({
         status: this.status,
         ...form
@@ -274,8 +299,6 @@ export default {
   .module-tit {
     padding: 20px 30px;
     font-size: 28px;
-    // font-weight: 600;
-    // border-bottom: 1px solid $borderColor;
   }
   .module-det {
     padding: 0 30px;

+ 5 - 6
store/src/components/app-uploader.vue

@@ -137,7 +137,7 @@ export default {
       ]
     };
   },
-  onLoad() {
+  mounted() {
     if (this.isSave) {
       let str = uni.getStorageSync(this.saveStr);
       if (str !== "") {
@@ -157,7 +157,6 @@ export default {
       if (this.disabled) {
         return;
       }
-      console.log("执行到这里.....");
       let that = this;
       let tempFilePaths = await that.getImage();
       await that.blobToBase64(tempFilePaths);
@@ -316,7 +315,6 @@ export default {
           success: async function(res) {
             await that.fileValid(res);
             var tempFilePaths = res.tempFilePaths;
-            console.log(tempFilePaths);
             if (that.isSave) {
               uni.setStorageSync(that.saveStr, showImgList.join(","));
             }
@@ -361,11 +359,13 @@ export default {
       }
       res.tempFiles = newtempFiles;
       res.tempFilePaths = newtempFilePaths;
-      // console.log('过滤完了')
     },
     // 设为主图
     mainImg(index) {
-      if (index == 0) return false;
+      return false;
+      if (index == 0){
+         return false;
+      }
       this.$msg("操作成功!");
       // let imgArr = JSON.parse(JSON.stringify(this.showImgList))
       let imgUrl = this.showImgList[index];
@@ -417,7 +417,6 @@ export default {
   },
   watch: {
     imgList(val) {
-      console.log("监听图片数据变化");
       this.showImgList = [...val];
     }
   }