戴艳蓉 3 years ago
parent
commit
02745fa35f

+ 2 - 0
src/apis/service/goodStore/goodsOnline/index.js

@@ -19,6 +19,8 @@ export default {
   delete: (data, params) => http(api + "gooddel", data, "post", params),
   // 重新发起审核流程
   againonline: (data, params) => http(api + "againonline", data, "post", params),
+  // 获取系统售价
+  goodupprice: (data, params) => http(api + "goodupprice", data, "post", params),
 
   // 复制
   copy: (data, params) => http(api + "goodcopy", data, "post", params),

+ 76 - 22
src/views/goodStore/goodsOnline/components/costFormAddEdit.vue

@@ -22,7 +22,7 @@
             status-icon
             :size="'small'"
             :rules="rulesThis"
-            label-width="110px"
+            label-width="85px"
             class="demo-ruleForm"
           >
             <el-form-item label="起订量" prop="min_num">
@@ -34,11 +34,22 @@
                 :position="'right'"
                 :precision="0"
                 :controls="false"
+                :size="'small'"
                 :disabled="id === '007'"
                 :append="''"
                 @reschange="min_num_change"
               />
             </el-form-item>
+            <el-form-item label="系统售价" prop="new_sale_price">
+              <el-input
+                placeholder="系统售价"
+                v-loading="search_loading"
+                :disabled="true"
+                v-model="ruleForm.new_sale_price"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
             <el-form-item label="售价" prop="sale_price">
               <digital-input
                 :values="ruleForm.sale_price"
@@ -48,6 +59,7 @@
                 :position="'right'"
                 :precision="2"
                 :controls="false"
+                :size="'small'"
                 :disabled="id === '007'"
                 :append="'元'"
                 @reschange="sale_price_change"
@@ -62,6 +74,7 @@
                 :position="'right'"
                 :precision="2"
                 :controls="false"
+                :size="'small'"
                 :disabled="id === '007'"
                 :append="'元'"
                 @reschange="market_price_change"
@@ -75,31 +88,36 @@
                 maxlength="20"
               />
             </el-form-item>
-            <el-form-item label="阶梯使用状态" prop="status">
-              <el-radio-group v-model="ruleForm.status">
-                <el-radio :label="'1'">启用</el-radio>
-                <el-radio :label="'0'">禁用</el-radio>
-              </el-radio-group>
-            </el-form-item>
+            <el-row :gutter="10">
+              <el-col :span="16">
+                <el-form-item label="状态" prop="status">
+                  <el-radio-group v-model="ruleForm.status">
+                    <el-radio :label="'1'">启用</el-radio>
+                    <el-radio :label="'0'">禁用</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+              </el-col>
+              <el-col :span="8" style="text-align: right">
+                <el-button :size="'small'" type="primary" @click="submitForm"
+                  >保 存
+                </el-button>
+                <el-button @click="showModelThis = false" :size="'small'">{{
+                  "取 消"
+                }}</el-button>
+              </el-col>
+            </el-row>
           </el-form>
         </el-col>
-        <el-col :span="24" style="text-align: right">
-          <el-button :size="'small'" type="primary" @click="submitForm"
-            >保 存
-          </el-button>
-          <el-button @click="showModelThis = false" :size="'small'">{{
-            "取 消"
-          }}</el-button>
-        </el-col>
       </el-row>
     </el-card>
   </el-dialog>
 </template>
 <script>
 import resToken from "@/mixins/resToken";
+import asyncRequest from "@/apis/service/goodStore/goodsOnline";
 export default {
   name: "brand",
-  props: ["showModel", "index", "sitem"],
+  props: ["showModel", "index", "sitem", "spuCode"],
   mixins: [resToken],
   data() {
     const validate_min_num = (rule, value, callback) => {
@@ -129,8 +147,19 @@ export default {
       loading: false,
       title: "",
       showModelThis: this.showModel,
-      ruleForm: {},
+      ruleForm: {
+        id: "",
+        index: "-1",
+        min_num: "0",
+        sale_price: "0",
+        market_price: "0",
+        market_platform: "",
+        new_sale_price: "",
+        status: "1",
+        is_del: "0",
+      },
       rulesThis: this.rules,
+      search_loading: false,
       rules: {
         min_num: [
           {
@@ -179,8 +208,7 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
-      await this.resetFormData();
-      console.log(this.index);
+      await this.resetForm();
       this.rulesThis = this.rules;
       if (this.index + "" === "-1") {
         this.title = "添加销售成本阶梯";
@@ -188,7 +216,6 @@ export default {
         this.title = "修改销售成本阶梯";
       }
 
-      await this.resetForm();
       this.loading = false;
     },
     async resetForm() {
@@ -218,9 +245,11 @@ export default {
         sale_price: sale_price || "0",
         market_price: market_price || "0",
         market_platform: market_platform || "",
+        new_sale_price: "",
         status: status || "1",
         is_del: is_del || "0",
       };
+      await this.get_new(this.ruleForm.min_num);
     },
 
     async submitForm() {
@@ -236,9 +265,34 @@ export default {
         }
       });
     },
-    min_num_change(e) {
-      this.ruleForm.min_num = e;
+    async min_num_change(e) {
+      this.ruleForm.min_num = e + "";
       this.$refs.ruleForm.validateField("min_num");
+      await this.get_new(this.ruleForm.min_num);
+    },
+    async get_new(min_num) {
+      if (!this.search_loading) {
+        if (min_num === "" || min_num === "0") {
+          this.ruleForm.new_sale_price = "0";
+        } else {
+          this.search_loading = true;
+          let { code, data, message } = await asyncRequest.goodupprice({
+            min_num: min_num,
+            spuCode: this.spuCode,
+          });
+          this.search_loading = false;
+          if (code === 0) {
+            const { sale_price } = data;
+            this.ruleForm.new_sale_price = sale_price;
+          } else if (code >= 100 && code <= 104) {
+            await this.logout();
+          } else if (code == 1010) {
+            this.ruleForm.new_sale_price = "0";
+          } else {
+            this.$message.warning(message);
+          }
+        }
+      }
     },
     sale_price_change(e) {
       this.ruleForm.sale_price = e;

+ 32 - 14
src/views/goodStore/goodsOnline/components/fixed-price-form.vue

@@ -182,12 +182,7 @@
                 ></i>
               </el-tooltip>
 
-              <el-tooltip
-                effect="dark"
-                content="删除"
-                placement="top"
-                v-if="scope.row.id === ''"
-              >
+              <el-tooltip effect="dark" content="删除" placement="top">
                 <i
                   class="el-icon-delete tb-icon"
                   @click="openCostEditDelete(scope.$index)"
@@ -201,6 +196,7 @@
           :index="costmodelIndex"
           :show-model="costshowModel"
           :sitem="costsitem"
+          :spuCode="spuCode"
           @refresh="costrefreshEdit"
           @cancel="costshowModel = false"
         />
@@ -232,6 +228,7 @@ export default {
     "labelWidth",
     "id",
     "spuCode",
+    "sitem",
   ],
   components: {
     costFormAddEdit,
@@ -299,7 +296,7 @@ export default {
           {
             required: true,
             message: "请上传凭证文件",
-            trigger: "change",
+            trigger: "blur,change",
           },
         ],
         rebut: [
@@ -341,8 +338,9 @@ export default {
     async initForm() {
       console.log(this.spuCode);
       this.loading = true;
-      this.rulesThis = this.rules;
       await this.resetForm();
+      this.rulesThis = this.rules;
+
       this.loading = false;
     },
 
@@ -394,13 +392,32 @@ export default {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
+          const { proof, ladderlist } = this.sitem;
 
           this.ruleForm = {
             skuCode: this.id,
-            proof_type: "1", // 通过or驳回
-            proof_url: "", //驳回至
-            good_ladder: [],
+            proof_type: proof && proof.proof_type ? proof.proof_type : "1", // 通过or驳回
+            proof_url: proof && proof.proof_url ? proof.proof_url : "", //驳回至
+            good_ladder:
+              ladderlist && ladderlist.length > 0
+                ? JSON.parse(JSON.stringify(ladderlist))
+                : [],
           };
+          console.log(this.ruleForm.proof_url);
+          switch (this.ruleForm.proof_type) {
+            case "1":
+              this.video_url = this.ruleForm.proof_url;
+              break;
+            case "2":
+              this.img_url = this.ruleForm.proof_url;
+              break;
+            case "3":
+              this.other_url = this.ruleForm.proof_url;
+              break;
+            default:
+              this.video_url = this.ruleForm.proof_url;
+          }
+          this.$refs.ruleForm.validateField("proof_url");
         }
       });
     },
@@ -427,10 +444,11 @@ export default {
               title: "信息提交成功",
               message: "",
             });
-            // this.showModelThis = false;
-            // 刷新
             this.$emit("resSuccess", true);
-            // this.routeReGoto("goodsOnline", {});
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
           }
         } else {
           console.log("error submit!!");

+ 15 - 46
src/views/goodStore/goodsOnline/components/handle-online-form.vue

@@ -33,7 +33,15 @@ import costFormAddEdit from "./costFormAddEdit";
 import asyncRequest from "@/apis/service/goodStore/goodsOnline";
 export default {
   name: "exam-form",
-  props: ["size", "statusList", "disabled", "isMust", "labelWidth", "id"],
+  props: [
+    "size",
+    "statusList",
+    "disabled",
+    "isMust",
+    "labelWidth",
+    "id",
+    "code",
+  ],
   components: {
     costFormAddEdit,
   },
@@ -76,11 +84,11 @@ export default {
       },
     };
   },
-   newTime: function (val) {
-      if (val) {
-        this.initForm();
-      }
-    },
+  newTime: function (val) {
+    if (val) {
+      this.initForm();
+    }
+  },
   mounted() {
     this.initForm();
   },
@@ -100,7 +108,7 @@ export default {
           this.$refs.ruleForm.clearValidate();
 
           this.ruleForm = {
-            plat_code: "",
+            plat_code: this.code || "",
           };
         }
       });
@@ -118,45 +126,6 @@ export default {
         }
       });
     },
-    //图片上传成功
-    async UploadSuccessEventproof_url(data) {
-      const { url } = data;
-      if (url === "noToken") {
-        await this.logout();
-      } else {
-        this.ruleForm.proof_url = url;
-        this.$refs.ruleForm.validateField("proof_url");
-        this.$message.success("图片上传成功!");
-      }
-    },
-
-    //图片上传失败
-    UploadErrorEventproof_url(res) {
-      if (res !== "break") {
-        this.$message.error("图片上传失败!");
-        this.$refs.ruleForm.validateField("proof_url");
-      }
-    },
-
-    //判断图片规格
-    beforeAvatarUpload(file) {
-      let isJPG = false;
-      if (
-        file.type === "image/jpg" ||
-        file.type === "image/png" ||
-        file.type === "image/jpeg"
-      ) {
-        isJPG = true;
-      }
-      const isLt2M = file.size / 1024 / 1024 < 1;
-      if (!isJPG) {
-        this.$message.error("图片格式不正确!");
-      }
-      if (!isLt2M) {
-        this.$message.error("图片大小不能超过 1MB!");
-      }
-      return isJPG && isLt2M;
-    },
   },
 };
 </script>

+ 2 - 2
src/views/goodStore/goodsOnline/components/online-exam-form.vue

@@ -72,7 +72,7 @@
 <script>
 export default {
   name: "exam-form",
-  props: ["size", "statusList", "disabled", "isMust", "labelWidth"],
+  props: ["size", "statusList", "disabled", "isMust", "labelWidth",'time'],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小             非必填
@@ -188,7 +188,7 @@ export default {
           this.ruleForm = {
             state: "1", // 通过or驳回
             rebut: "", //驳回至
-            online_time: "",
+            online_time: this.time||"",
             remark: "",
           };
         }

+ 4 - 1
src/views/goodStore/goodsOnline/detail.vue

@@ -170,9 +170,10 @@
               <online-exam-form
                 :newTime="newTime"
                 v-if="newTime !== ''"
-                :options8="options8"
+                :time="sitem.online_time"
                 :disabled="false"
                 :isMust="false"
+                :statusList="[]"
                 @searchChange="examForm"
               />
             </el-collapse-item>
@@ -190,6 +191,7 @@
                 :id="queryId"
                 :spuCode="spuCode"
                 v-if="newTime !== ''"
+                :sitem="sitem"
                 :disabled="false"
                 :isMust="false"
                 @resSuccess="initForm"
@@ -226,6 +228,7 @@
                 :newTime="newTime"
                 v-if="newTime !== ''"
                 :options="[]"
+                :code="sitem.plat_code"
                 :disabled="false"
                 :isMust="false"
                 @resSuccess="examForm3"