Jelajahi Sumber

活动添加库存

xiaodai2022 2 tahun lalu
induk
melakukan
ee2a06aba6

File diff ditekan karena terlalu besar
+ 8 - 0
dist/static/js/0.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/static/js/app.js


+ 2 - 3
src/apis/service/goodStore/active/index.js

@@ -20,7 +20,6 @@ export default {
     update: (data, params) => http(api + "customaredit", data, "post", params),
     // 删除
     delete: (data, params) => http(api + "customardelete", data, "post", params),
-
-
-
+    // 添加库存
+    actstock: (data, params) => http(api + "actstock", data, "post", params),
 };

+ 5 - 18
src/components/globalComponents/digital-input/main.vue

@@ -31,6 +31,7 @@
 </template>
 
 <script>
+import { accMul } from "@/utils/validate";
 export default {
   name: "digitalInput",
   props: [
@@ -61,8 +62,8 @@ export default {
       }
     },
     min: function (val) {
-      let a = this.accMul(val, "1");
-      let b = this.accMul(this.num, "1");
+      let a = accMul(val, "1");
+      let b = accMul(this.num, "1");
       console.log(a, b);
       if (a >= b) {
         this.num = a + "";
@@ -70,8 +71,8 @@ export default {
       }
     },
     max: function (val) {
-      let a = this.accMul(val, "1");
-      let b = this.accMul(this.num, "1");
+      let a = accMul(val, "1");
+      let b = accMul(this.num, "1");
       console.log(a, b);
       if (a <= b) {
         this.num = a + "";
@@ -90,20 +91,6 @@ export default {
       this.$emit("reschange", this.num);
       // console.log(value);
     },
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
-      return (
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) / Math.pow(10, m)
-      );
-    },
   },
 };
 </script>

+ 40 - 17
src/utils/validate.js

@@ -1,7 +1,24 @@
 /**
  * Created by PanJiaChen on 16/11/18.
  */
+ function accMulIn(arg1, arg2) {
+  let m = 0,
+    s1 = arg1.toString(),
+    s2 = arg2.toString();
+
+  try {
+    m += s1.split(".")[1].length;
+  } catch (e) {}
+
+  try {
+    m += s2.split(".")[1].length;
+  } catch (e) {}
 
+  return (
+    (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
+    Math.pow(10, m)
+  );
+}
 /** https
  * @param {string} path
  * @returns {Boolean}
@@ -362,9 +379,9 @@ export function isCreditCode(s) {
   const reg = /[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g;
   return reg.test(s);
 }
-
+//加法精算
 export function add_sum(arg1, arg2) {
-  var r1, r2, m;
+  let r1, r2, m;
   try {
     r1 = arg1.toString().split(".")[1].length;
   } catch (e) {
@@ -379,27 +396,31 @@ export function add_sum(arg1, arg2) {
 
   m = Math.pow(10, Math.max(r1, r2));
 
-  return (accMul(arg1, m) + accMul(arg2, m)) / m;
+  return (accMulIn(arg1, m) + accMulIn(arg2, m)) / m;
 }
-export function accMul(arg1, arg2) {
-  var m = 0,
-    s1 = arg1.toString(),
-    s2 = arg2.toString();
 
+//乘法精算
+export function accMul(arg1, arg2) {
+  return accMulIn(arg1, arg2)
+}
+ //除法精度问题
+ export function accDiv(arg1, arg2) {
+  let t1 = 0,
+    t2 = 0,
+    c1,
+    c2;
   try {
-    m += s1.split(".")[1].length;
+    t1 = arg1.toString().split(".")[1].length;
   } catch (e) {}
-
   try {
-    m += s2.split(".")[1].length;
+    t2 = arg2.toString().split(".")[1].length;
   } catch (e) {}
-
-  return (
-    (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
-    Math.pow(10, m)
-  );
-}
-
+  // with (Math) {
+  c1 = Number(arg1.toString().replace(".", ""));
+  c2 = Number(arg2.toString().replace(".", ""));
+  return (c1 / c2) * Math.pow(10, t2 - t1);
+  // }
+};
 export function isSpecialSymbol(s) {
   // console.log(s);
   const str = (s ?? "").replace(
@@ -478,3 +499,5 @@ export function hasSpace(s) {
   const str2 = s.replace(/[\r\n]/g, "");
   return !(str2 === s);
 }
+
+

+ 40 - 9
src/views/goodStore/active/columns.js

@@ -1,35 +1,34 @@
-
 //是否定制
 const options1 = [
   { id: "0", name: "是" },
   { id: "1", name: "否" },
-]
+];
 //专属类型
 const options2 = [
   { id: "0", name: "非泰康" },
   { id: "1", name: "泰康" },
-]
+];
 //销售权限
 const options3 = [
   { id: "0", name: "有销售权限" },
   { id: "1", name: "无销售权限" },
-]
+];
 
 //是否库存品
 const options4 = [
   { id: "0", name: "库存品" },
   { id: "1", name: "非库存品" },
-]
+];
 //是否启用实时金价
 const options5 = [
   { id: "0", name: "是" },
   { id: "1", name: "否" },
-]
+];
 //供货区域
 const options6 = [
   { id: "0", name: "全国" },
   { id: "1", name: "全国除偏远" },
-]
+];
 const listCol = [
   {
     prop: "activity_code",
@@ -85,6 +84,38 @@ const listCol = [
     _slot_: "operation",
     width: "50",
   },
-]
+];
+const showColumns = [
+  {
+    prop: "skuCode",
+    label: "商品编码",
+  },
+  {
+    prop: "sale_price",
+    label: "非活动价",
+    append: "元",
+    span: 6,
+  },
+  {
+    prop: "activity_price",
+    label: "活动价",
+    append: "元",
+    span: 6,
+  },
+  {
+    prop: "good_name",
+    label: "商品名称",
+    span: 24,
+  },
+];
 
-export { options1, options2, options3, options4, options5, options6, listCol }
+export {
+  options1,
+  options2,
+  options3,
+  options4,
+  options5,
+  options6,
+  listCol,
+  showColumns,
+};

+ 218 - 0
src/views/goodStore/active/components/addStock.vue

@@ -0,0 +1,218 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="10vh"
+    width="1040px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin-top: -20px">
+      <el-form
+        ref="ruleForm"
+        :model="ruleForm"
+        status-icon
+        :rules="rulesThis"
+        label-width="90px"
+        class="demo-ruleForm"
+      >
+        <el-row>
+          <el-col :span="24">
+            <show-data-table
+              style="margin: 0 0 10px 0; padding: 0"
+              :sitem="sitem"
+              border
+              :columns="showColumns"
+            />
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="当前库存" prop="activity_stock">
+              <el-input
+                v-model="ruleForm.activity_stock"
+                maxlength="100"
+                :disabled="true"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="新增库存" prop="act_stock">
+              <digital-input
+                :values="ruleForm.act_stock"
+                :placeholder="'新增库存'"
+                :min="0"
+                :max="100000000000"
+                :position="'right'"
+                :precision="0"
+                :controls="false"
+                :append="''"
+                @reschange="num_change"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="提交后库存" prop="total_stock">
+              <el-input
+                v-model="ruleForm.total_stock"
+                :placeholder="'提交后库存'"
+                maxlength="11"
+                :disabled="true"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" class="tr">
+            <el-button v-if="!isDetail" type="primary" @click="submitForm" :size="'mini'"
+              >保 存
+            </el-button>
+            <el-button @click="showModelThis = false" :size="'mini'">{{
+              isDetail ? "关 闭" : "取 消"
+            }}</el-button>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from "@/apis/service/goodStore/active";
+import resToken from "@/mixins/resToken";
+import { isnumber } from "@/utils/validate";
+import { add_sum } from "@/utils/validate";
+import { showColumns } from "../columns";
+export default {
+  name: "Account",
+  props: ["showModel", "id", "sitem"],
+  mixins: [resToken],
+  data() {
+    const validateNum = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("新增库存不能为空!"));
+      } else {
+        const num = parseInt(value + "");
+        if (!isnumber(value)) {
+          callback(new Error("新增库存必须是整数!"));
+        } else if (num === NaN) {
+          callback(new Error("新增库存必须是整数!"));
+        } else if (num === 0) {
+          callback(new Error("新增库存不能为零!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    return {
+      loading: false,
+      title: "添加商品活动库存",
+      showModelThis: this.showModel,
+      ruleForm: {
+        activity_stock: "",
+        skuCode: "", // 账号
+        actCode: "", // 真实姓名
+        act_stock: "",
+        total_stock: "",
+      },
+      showColumns,
+      rulesThis: this.rules,
+      rules: {
+        act_stock: [
+          {
+            required: true,
+            validator: validateNum,
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  mounted() {},
+  methods: {
+    async initForm() {
+      this.loading = true;
+      await this.resetForm();
+      this.rulesThis = this.rules;
+      this.loading = false;
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          for (let key in this.ruleForm) {
+            this.ruleForm[key] = key === "act_stock" ? "0" : this.sitem[key] ?? "";
+          }
+          this.get_total_stock();
+        }
+      });
+    },
+    get_total_stock() {
+      const { activity_stock, act_stock } = this.ruleForm;
+      this.ruleForm.total_stock = add_sum(activity_stock, act_stock);
+    },
+    num_change(e) {
+      this.ruleForm.act_stock = e + "";
+      this.$refs.ruleForm.validateField("act_stock");
+      this.get_total_stock();
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          if (!this.loading) {
+            this.loading = true;
+            const model = JSON.parse(JSON.stringify(this.ruleForm));
+            const { code, data, message } = await asyncRequest.actstock(model);
+            this.loading = false;
+            if (code === 0) {
+              this.$notify.success({
+                title: "库存添加成功!",
+                message: "",
+              });
+              this.showModelThis = false;
+              // 刷新
+              this.$emit("refresh");
+            } else if (code >= 100 && code <= 104) {
+              await this.logout();
+            } else {
+              this.$message.warning(message);
+            }
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.account {
+  .bottom-btn {
+    position: absolute;
+    bottom: 0px;
+    right: 0;
+    text-align: right;
+    z-index: 2;
+  }
+}
+</style>

+ 30 - 2
src/views/goodStore/active/components/baseForm.vue

@@ -234,6 +234,19 @@
                       @click="showGoodModelFun(scope.row.skuCode)"
                     ></i>
                   </el-tooltip>
+                  <el-tooltip
+                    v-if="
+                      status + '' === '4' || status + '' === '5' || status + '' === '6'
+                    "
+                    effect="dark"
+                    content="添加库存"
+                    placement="top"
+                  >
+                    <i
+                      class="el-icon-circle-plus-outline tb-icon"
+                      @click="addStock(scope.$index)"
+                    ></i>
+                  </el-tooltip>
                   <el-tooltip
                     v-if="status === ''"
                     effect="dark"
@@ -266,6 +279,12 @@
       :spuCode="''"
       @cancel="showGoodModel = false"
     />
+    <add-stock
+      :show-model="addStockModel"
+      :sitem="addStockSitem"
+      @refresh="$emit('refresh', true)"
+      @cancel="addStockModel = false"
+    />
     <el-col
       :span="24"
       v-if="status === ''"
@@ -281,6 +300,7 @@ import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 import searchGoodOnlineModal from "@/components/search-good-online-modal";
 import showGoodDataModal from "@/components/show-good-data-modal";
+import addStock from "./addStock";
 
 export default {
   name: "activeAdd",
@@ -289,6 +309,7 @@ export default {
   components: {
     searchGoodOnlineModal,
     showGoodDataModal,
+    addStock,
   },
   watch: {
     newTime: function (val) {
@@ -301,8 +322,7 @@ export default {
     ...mapGetters(["tablebtnSize", "searchSize", "size", "business_companyNo"]),
     powers() {
       const tran =
-        this.$store.getters.btnList.find((i) => i.menu_route == "activeDetail") ||
-        {};
+        this.$store.getters.btnList.find((i) => i.menu_route == "activeDetail") || {};
       const { action } = tran ?? {};
       return action ?? [];
     },
@@ -358,6 +378,8 @@ export default {
       rulesThis: this.rules,
       showGoodModel: false,
       showGoodId: "",
+      addStockModel: false,
+      addStockSitem: null,
       ruleForm: {},
       // 表格 - 数据
       tableData: [],
@@ -445,6 +467,12 @@ export default {
         }
       });
     },
+    //添加活动库存弹窗
+    addStock(index) {
+      this.addStockSitem = this.ruleForm.good_list[index];
+      this.addStockSitem.actCode = this.sitem.activity_code;
+      this.addStockModel = true;
+    },
     showGoodModelFun(skuCode) {
       this.showGoodModel = true;
       this.showGoodId = skuCode;

+ 7 - 43
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -1061,6 +1061,7 @@ import {
   options9,
   rules,
 } from "../columns";
+import { add_sum, accMul } from "@/utils/validate";
 export default {
   name: "goodsCostAdd",
   mixins: [resToken],
@@ -1568,56 +1569,19 @@ export default {
         package_fee, //包装费
         other_fee, //其他费用
       } = e;
-      let XA = this.add_sum(nake_fee, delivery_fee),
-        XB = this.add_sum(package_fee, cert_fee),
-        XC = this.add_sum(mark_fee, other_fee),
+      let XA = add_sum(nake_fee, delivery_fee),
+        XB = add_sum(package_fee, cert_fee),
+        XC = add_sum(mark_fee, other_fee),
         XD = 0;
-      let total = this.add_sum(this.add_sum(XA, XB), XC);
+      let total = add_sum(add_sum(XA, XB), XC);
       // console.log(total);
       if (this.is_noble && is_gold_price === "1") {
-        XD = this.add_sum(
-          this.accMul(noble_price, noble_weight),
-          this.accMul(noble_weight, cost_fee)
-        );
-        total = this.add_sum(total, XD);
+        XD = add_sum(accMul(noble_price, noble_weight), accMul(noble_weight, cost_fee));
+        total = add_sum(total, XD);
       }
       return total;
     },
-    add_sum(arg1, arg2) {
-      var r1, r2, m;
-      try {
-        r1 = arg1.toString().split(".")[1].length;
-      } catch (e) {
-        r1 = 0;
-      }
-
-      try {
-        r2 = arg2.toString().split(".")[1].length;
-      } catch (e) {
-        r2 = 0;
-      }
-
-      m = Math.pow(10, Math.max(r1, r2));
-
-      return (this.accMul(arg1, m) + this.accMul(arg2, m)) / m;
-    },
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
-
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
 
-      return (
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) / Math.pow(10, m)
-      );
-    },
     dataSort(key) {
       return function (a, b) {
         let value1 = a[key];

+ 3 - 18
src/views/orderEntry/orderConfirm/index.vue

@@ -687,6 +687,7 @@ import {
   onlineColumns,
 } from "./columns";
 import searchGoodOnlineModal from "@/components/search-good-online-modal";
+import { accMul } from "@/utils/validate";
 export default {
   name: "orderConfirm",
   mixins: [mixinPage, resToken],
@@ -894,7 +895,7 @@ export default {
         addr: addr || "", //联系地址
         addr_code: addr_code && addr_code.length > 0 ? addr_code.split(",") : [], //省市区
       };
-      this.ruleForm.before_discount_all_price = this.accMul(
+      this.ruleForm.before_discount_all_price = accMul(
         this.ruleForm.num,
         this.ruleForm.price
       );
@@ -1051,7 +1052,7 @@ export default {
       if (key === "num") {
         await this.get_new_price();
       }
-      this.ruleForm.before_discount_all_price = this.accMul(
+      this.ruleForm.before_discount_all_price = accMul(
         this.ruleForm.num,
         this.ruleForm.price
       );
@@ -1149,23 +1150,7 @@ export default {
         }
       });
     },
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
 
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
-
-      return (
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) / Math.pow(10, m)
-      );
-    },
     async set_salegetprice(model) {
       this.priceLoding = true;
       let resModel = {

+ 12 - 61
src/views/purchaseIn/workbench/components/baseForm.vue

@@ -646,6 +646,7 @@ import asyncRequest from "@/apis/service/purchaseIn/workbench";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 import baseFormAddEdit from "./baseFormAddEdit";
+import { add_sum, accMul, accDiv } from "@/utils/validate";
 import {
   options1,
   options2,
@@ -738,56 +739,6 @@ export default {
       this.ruleForm[key].splice(index, 1);
       this.$refs.ruleForm.validateField(key);
     },
-    //加法精度问题
-    accAdd(arg1, arg2) {
-      var r1, r2, m;
-      try {
-        r1 = arg1.toString().split(".")[1].length;
-      } catch (e) {
-        r1 = 0;
-      }
-      try {
-        r2 = arg2.toString().split(".")[1].length;
-      } catch (e) {
-        r2 = 0;
-      }
-      m = Math.pow(10, Math.max(r1, r2));
-      return (arg1 * m + arg2 * m) / m;
-    },
-
-    //乘法精度问题
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
-      let numStr =
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) / Math.pow(10, m);
-      return numStr.toString();
-    },
-    //除法精度问题
-    accDiv(arg1, arg2) {
-      var t1 = 0,
-        t2 = 0,
-        c1,
-        c2;
-      try {
-        t1 = arg1.toString().split(".")[1].length;
-      } catch (e) {}
-      try {
-        t2 = arg2.toString().split(".")[1].length;
-      } catch (e) {}
-      // with (Math) {
-      c1 = Number(arg1.toString().replace(".", ""));
-      c2 = Number(arg2.toString().replace(".", ""));
-      return (c1 / c2) * Math.pow(10, t2 - t1);
-      // }
-    },
     async initForm() {
       this.supplierNo = [];
       this.loading = true;
@@ -827,20 +778,20 @@ export default {
         nake_fee,
         delivery_fee,
       } = this.ruleForm;
-      let a = this.accDiv(demo_fee, num); // 打样费/购买数量
-      let b = this.accDiv(open_fee, num); //开模费/购买数量
-      let c = this.accMul(noble_weight, this.newGoldPrice); //金属重量* 最新金价
-      let d = this.accMul(cost_fee, noble_weight); //工艺费* 金属重量
-      let e = this.accAdd(pakge_fee, mark_fee); //包装费+加标费
-      let f = this.accAdd(cert_fee, nake_fee); //证书费+产品裸价
+      let a = accDiv(demo_fee, num); // 打样费/购买数量
+      let b = accDiv(open_fee, num); //开模费/购买数量
+      let c = accMul(noble_weight, this.newGoldPrice); //金属重量* 最新金价
+      let d = accMul(cost_fee, noble_weight); //工艺费* 金属重量
+      let e = add_sum(pakge_fee, mark_fee); //包装费+加标费
+      let f = add_sum(cert_fee, nake_fee); //证书费+产品裸价
       if (this.is_noble) {
-        this.newPrice = this.accAdd(
-          this.accAdd(this.accAdd(a, b), this.accAdd(c, d)),
-          this.accAdd(this.accAdd(e, f), delivery_fee)
+        this.newPrice = add_sum(
+          add_sum(add_sum(a, b), add_sum(c, d)),
+          add_sum(add_sum(e, f), delivery_fee)
         ).toFixed(2);
       } else {
-        this.newPrice = this.accAdd(
-          this.accAdd(this.accAdd(a, b), this.accAdd(e, f)),
+        this.newPrice = add_sum(
+          add_sum(add_sum(a, b), add_sum(e, f)),
           delivery_fee
         ).toFixed(2);
       }

+ 15 - 48
src/views/sellOut/zixunOrder/components/addEditBargain.vue

@@ -86,9 +86,7 @@
                 :min="0"
                 :disabled="sitem.is_gold_price == 1 && sitem.can[0].id == 6"
                 :max="
-                  show_sitem && show_sitem.origin_price
-                    ? show_sitem.origin_price
-                    : '0'
+                  show_sitem && show_sitem.origin_price ? show_sitem.origin_price : '0'
                 "
                 :position="'right'"
                 :precision="2"
@@ -127,9 +125,7 @@
                 :placeholder="'期望工艺费'"
                 :min="0"
                 :disabled="!(sitem.is_gold_price == 1 && sitem.can[0].id == 6)"
-                :max="
-                  show_sitem && show_sitem.cost_fee ? show_sitem.cost_fee : '0'
-                "
+                :max="show_sitem && show_sitem.cost_fee ? show_sitem.cost_fee : '0'"
                 :position="'right'"
                 :precision="2"
                 :size="'mini'"
@@ -152,11 +148,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="16">
-            <el-form-item
-              label="议价备注:"
-              prop="bargain_remark"
-              label-width="88px"
-            >
+            <el-form-item label="议价备注:" prop="bargain_remark" label-width="88px">
               <el-input
                 type="textarea"
                 :rows="2"
@@ -172,11 +164,7 @@
             <el-button @click="showModelThis = false" :size="'mini'">{{
               isDetail ? "关 闭" : "取 消"
             }}</el-button>
-            <el-button
-              v-if="!isDetail"
-              type="primary"
-              :size="'mini'"
-              @click="submitForm"
+            <el-button v-if="!isDetail" type="primary" :size="'mini'" @click="submitForm"
               >保 存
             </el-button>
           </el-col>
@@ -188,27 +176,12 @@
 <script>
 import asyncRequest from "@/apis/service/sellOut/bargainList";
 import resToken from "@/mixins/resToken";
-import { add_sum, accMul } from "@/utils/validate";
+import { add_sum } from "@/utils/validate";
 export default {
   name: "Account",
   props: ["showModel", "sitem"],
   mixins: [resToken],
   data() {
-    const validate_num = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("不能为空!"));
-      } else if (
-        value === "0" ||
-        value === "0." ||
-        value === "0.0" ||
-        value === "0.00"
-      ) {
-        callback(new Error("期望售价不能为零!"));
-      } else {
-        callback();
-      }
-    };
-
     return {
       roleList: [],
       loading: false,
@@ -289,9 +262,9 @@ export default {
         const { origin_price, specinfo, cost_fee, bidNo } = this.sitem;
         if (specinfo && specinfo.length > 0) {
           specinfo.forEach((a, ai) => {
-            this.show_sitem.good_name += `${ai === 0 ? "_" : "-"}${
-              a.spec_name
-            }[${a.spec_value_name}]`;
+            this.show_sitem.good_name += `${ai === 0 ? "_" : "-"}${a.spec_name}[${
+              a.spec_value_name
+            }]`;
           });
         }
         if (this.$refs.ruleForm) {
@@ -321,14 +294,13 @@ export default {
             return;
           }
           this.loading = true;
-          const { bidNo, origin_price, is_gold_price, can, cost_fee } =
-            this.sitem;
+          const { bidNo, origin_price, is_gold_price, can, cost_fee } = this.sitem;
           const { bargain_price, cost_price } = this.ruleForm;
           let a = add_sum(origin_price + "", "0");
           let b = add_sum(bargain_price + "", "0");
           if (b > a) {
             this.$message.warning("期望售价不能高于当前售价");
-            this.loading=false
+            this.loading = false;
             return;
           }
 
@@ -336,7 +308,7 @@ export default {
           let d = add_sum(cost_price + "", "0");
           if (d > c) {
             this.$message.warning("期望工艺费不能高于当前工艺费");
-            this.loading=false
+            this.loading = false;
             return;
           }
 
@@ -345,22 +317,17 @@ export default {
           delete model["result_info_id_name"];
 
           //根据实时金价对接口进行不同传参
-          if (
-            is_gold_price == "1" &&
-            can &&
-            can.length > 0 &&
-            can[0].id + "" == "6"
-          ) {
+          if (is_gold_price == "1" && can && can.length > 0 && can[0].id + "" == "6") {
             if (c === d) {
               this.$message.warning("期望工艺费不能等于当前工艺费!");
-              this.loading=false
+              this.loading = false;
               return;
             }
             model.bargain_price = "0";
           } else {
             if (a === b) {
               this.$message.warning("期望售价不能等于当前售价!");
-              this.loading=false
+              this.loading = false;
               return;
             }
             model.cost_price = "0";
@@ -391,7 +358,7 @@ export default {
 };
 </script>
 
-   <style lang="scss" scoped>
+<style lang="scss" scoped>
 .account {
 }
 </style>

+ 8 - 34
src/views/sellOut/zixunOrder/components/addEditGoodModal.vue

@@ -340,14 +340,8 @@
                       prop="enclosure_file"
                       class="activity-upload"
                     >
-                      <div
-                        v-if="ruleForm && ruleForm.enclosure_file"
-                        class="clearfix tl"
-                      >
-                        <a
-                          :href="ruleForm.enclosure_file"
-                          download="附件"
-                          class="fl"
+                      <div v-if="ruleForm && ruleForm.enclosure_file" class="clearfix tl">
+                        <a :href="ruleForm.enclosure_file" download="附件" class="fl"
                           >点击下载</a
                         >
 
@@ -371,9 +365,7 @@
                             :multiple="false"
                             :uploadcondition="beforeOtherUpload"
                             @UploadErrorEvent="UploadErrorOtherenclosure_file"
-                            @UploadSuccessEvent="
-                              UploadSuccessOtherenclosure_file
-                            "
+                            @UploadSuccessEvent="UploadSuccessOtherenclosure_file"
                           />
                         </div>
                         <div class="txt-tips fl">
@@ -458,6 +450,7 @@ import asyncRequest from "@/apis/service/sellOut/zixunOrder";
 import resToken from "@/mixins/resToken";
 import { rules } from "../columns";
 import baseFormAddEdit from "./baseFormAddEdit";
+import { accMul } from "@/utils/validate";
 export default {
   name: "brand",
   props: ["showModel", "id", "sitem"],
@@ -544,22 +537,6 @@ export default {
     },
   },
   methods: {
-    //乘法精度问题
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
-      return (
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
-        Math.pow(10, m)
-      );
-    },
     async initForm() {
       this.loading = true;
       const { index } = this.sitem;
@@ -584,8 +561,7 @@ export default {
     //规格编辑修改结果
     refreshEdit(e) {
       let item = JSON.parse(JSON.stringify(e));
-      const { index, id, specid, spec_name, spec_value_id, spec_value_name } =
-        item;
+      const { index, id, specid, spec_name, spec_value_id, spec_value_name } = item;
       if (index + "" === "-1") {
         this.spec_tableData.push(item);
       } else {
@@ -675,10 +651,8 @@ export default {
             p_arrtime: p_arrtime,
 
             pgNo: fi === "-1" && p_pgNo ? p_pgNo : pgNo || "",
-            arrival_time:
-              fi === "-1" && p_pgNo ? p_arrtime : arrival_time || "",
-            budget_price:
-              fi === "-1" && p_pgNo ? p_budget_price : budget_price || "0.00",
+            arrival_time: fi === "-1" && p_pgNo ? p_arrtime : arrival_time || "",
+            budget_price: fi === "-1" && p_pgNo ? p_budget_price : budget_price || "0.00",
             num: fi === "-1" && p_pgNo ? p_num : num || "0",
             brand_id: brand_id ? brand_id : [],
             brand_name: brand_name ? brand_name : "",
@@ -929,7 +903,7 @@ export default {
 };
 </script>
 
-   <style lang="scss" scoped>
+<style lang="scss" scoped>
 .brand {
 }
 .lsac {

+ 16 - 58
src/views/sellOut/zixunOrder/components/editForm.vue

@@ -93,8 +93,7 @@
             remote
             clearable
             :disabled="
-              type === 'view' ||
-              (type === 'edit' && ruleForm.is_project === '1')
+              type === 'view' || (type === 'edit' && ruleForm.is_project === '1')
             "
             :multiple-limit="1"
             reserve-keyword
@@ -182,9 +181,8 @@
                   :size="'mini'"
                   v-text="
                     (
-                      statusOptions.find(
-                        (item) => item.value == scope.row.good_type
-                      ) || {}
+                      statusOptions.find((item) => item.value == scope.row.good_type) ||
+                      {}
                     ).label || '--'
                   "
                 ></el-tag
@@ -222,8 +220,7 @@
                 type="date"
                 style="width: 100%"
                 :disabled="
-                  type === 'view' ||
-                  (type === 'edit' && ruleForm.is_project === '1')
+                  type === 'view' || (type === 'edit' && ruleForm.is_project === '1')
                 "
                 value-format="yyyy-MM-dd"
                 :picker-options="pickerOptions1"
@@ -261,8 +258,7 @@
                 :precision="2"
                 :size="'mini'"
                 :disabled="
-                  type === 'view' ||
-                  (type === 'edit' && ruleForm.is_project === '1')
+                  type === 'view' || (type === 'edit' && ruleForm.is_project === '1')
                 "
                 :controls="false"
                 :append="'元'"
@@ -281,8 +277,7 @@
                 :precision="0"
                 :size="'mini'"
                 :disabled="
-                  type === 'view' ||
-                  (type === 'edit' && ruleForm.is_project === '1')
+                  type === 'view' || (type === 'edit' && ruleForm.is_project === '1')
                 "
                 :controls="false"
                 :append="''"
@@ -412,11 +407,7 @@
             >
               <el-table-column prop="spec_name" label="规格类型" />
               <el-table-column prop="spec_value_name" label="规格值" />
-              <el-table-column
-                fixed="right"
-                width="88px"
-                v-if="type !== 'view'"
-              >
+              <el-table-column fixed="right" width="88px" v-if="type !== 'view'">
                 <template slot="header" slot-scope="scope">
                   <span>操作</span>
                   <el-tooltip
@@ -528,15 +519,11 @@
                             :src="ruleForm.good_img"
                             class="avatar"
                           />
-                          <i
-                            v-else
-                            class="el-icon-plus avatar-uploader-icon"
-                          ></i>
+                          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                           <file-upload
                             class="Upload"
                             :disabled="
-                              type === 'view' ||
-                              (type !== 'view' && ruleForm.p_good_img)
+                              type === 'view' || (type !== 'view' && ruleForm.p_good_img)
                             "
                             :accept="'.jpg,.png,.jpeg'"
                             :multiple="true"
@@ -558,14 +545,8 @@
                       prop="enclosure_file"
                       class="activity-upload"
                     >
-                      <div
-                        v-if="ruleForm && ruleForm.enclosure_file"
-                        class="clearfix tl"
-                      >
-                        <a
-                          :href="ruleForm.enclosure_file"
-                          download="附件"
-                          class="fl"
+                      <div v-if="ruleForm && ruleForm.enclosure_file" class="clearfix tl">
+                        <a :href="ruleForm.enclosure_file" download="附件" class="fl"
                           >点击下载</a
                         >
 
@@ -589,9 +570,7 @@
                             :multiple="false"
                             :uploadcondition="beforeOtherUpload"
                             @UploadErrorEvent="UploadErrorOtherenclosure_file"
-                            @UploadSuccessEvent="
-                              UploadSuccessOtherenclosure_file
-                            "
+                            @UploadSuccessEvent="UploadSuccessOtherenclosure_file"
                           />
                         </div>
                         <div class="txt-tips fl">
@@ -679,7 +658,7 @@ import resToken from "@/mixins/resToken";
 import { edutRules } from "../columns";
 import baseFormAddEdit from "./baseFormAddEdit";
 import { mapGetters } from "vuex";
-
+import { accMul } from "@/utils/validate";
 export default {
   name: "handover",
   props: ["id", "sitem", "newTime", "type"],
@@ -815,23 +794,6 @@ export default {
     },
   },
   methods: {
-    //乘法精度问题
-    accMul(arg1, arg2) {
-      var m = 0,
-        s1 = arg1.toString(),
-        s2 = arg2.toString();
-      try {
-        m += s1.split(".")[1].length;
-      } catch (e) {}
-      try {
-        m += s2.split(".")[1].length;
-      } catch (e) {}
-      return (
-        (Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
-        Math.pow(10, m)
-      );
-    },
-
     async initForm() {
       this.loading = true;
       this.status = "";
@@ -852,8 +814,7 @@ export default {
       this.$refs.ruleForm.validateField(key);
     },
     sch_is_noble() {
-      this.rulesThis["projectNo"][0].required =
-        this.ruleForm.is_project === "1";
+      this.rulesThis["projectNo"][0].required = this.ruleForm.is_project === "1";
       this.$refs.ruleForm.validateField("projectNo");
       let list = [
         "config",
@@ -931,9 +892,7 @@ export default {
           this.unit_name = unit_name;
           this.brand_name = brand;
           this.spec_tableData =
-            specinfo && specinfo.length > 0
-              ? JSON.parse(JSON.stringify(specinfo))
-              : [];
+            specinfo && specinfo.length > 0 ? JSON.parse(JSON.stringify(specinfo)) : [];
           this.cat_id_name = "";
           if (can && can.length > 0) {
             can.forEach((s, i) => {
@@ -972,8 +931,7 @@ export default {
             budget_price: budget_price || "0.00",
             num: num || "0",
             brand_id: brand_id ? [brand_id] : [],
-            cat_id:
-              cat_id && cat_id.length > 0 ? [cat_id[cat_id.length - 1]] : [],
+            cat_id: cat_id && cat_id.length > 0 ? [cat_id[cat_id.length - 1]] : [],
             good_img: good_img || "",
             good_name: good_name || "",
             total_weight: total_weight || "0",

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini