戴艳蓉 пре 3 година
родитељ
комит
0e351a0e16

+ 1 - 0
src/views/good-share/components/changeBackGood.vue

@@ -124,6 +124,7 @@
                     searchList(index);
                   "
                   @selection="selection_change"
+                  
                 >
                   <template #good_img="{ scope }">
                     <div

+ 1 - 0
src/views/goodStore/goodsCost/columns.js

@@ -44,6 +44,7 @@ const options8 = [
 //配置要求
 const options9 = ["证书", "包装盒", "绒布袋", "标签", "其他"]
 const listCol = [
+  { type: "selection", fixed: "left", _noset_: true },
   {
     prop: "spuCode",
     label: "编号",

+ 216 - 0
src/views/goodStore/goodsCost/components/addEdit.vue

@@ -0,0 +1,216 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="'添加商品上线'"
+    :center="true"
+    align="left"
+    top="18vh"
+    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: -20px 0 0 0;  padding-bottom: 0;">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-table
+            :data="sitem"
+            stripe
+            :size="'mini'"
+            border
+            style="width: 100%"
+          >
+            <el-table-column prop="date" label="日期" width="180">
+            </el-table-column>
+            <el-table-column prop="name" label="姓名" width="180">
+            </el-table-column>
+            <el-table-column prop="address" label="地址"> </el-table-column>
+          </el-table>
+        </el-col>
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            
+            :rules="rulesThis"
+            label-width="80px"
+            class="demo-ruleForm"
+          >
+            <el-row style="padding-bottom">
+              <el-col :span="8">
+                <el-form-item label="所属平台" prop="platform">
+                  <search-terrace
+                    :value="ruleForm.platform"
+                    :disabled="false"
+                    :isDetail="false"
+                    :placeholder="'所属平台'"
+                    @searchChange="platform_codesearchChange"
+                  />
+                </el-form-item>
+                <el-form-item label="上线原因" prop="online_reason">
+                  <el-input
+                    :disabled="false"
+                    placeholder="上线原因"
+                    v-model="ruleForm.online_reason"
+                    maxlength="200"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="16" style="text-align: right">
+                <el-form-item label="上线备注" prop="online_remark">
+                  <el-input
+                    type="textarea"
+                    :rows="3"
+                    :disabled="false"
+                    placeholder="商品备注"
+                    maxlength="2000"
+                    v-model="ruleForm.online_remark"
+                  />
+                </el-form-item>
+                <el-button
+                  v-if="id !== '007'"
+                  type="primary"
+                  :size="'mini'"
+                  @click="submitForm"
+                  >保 存
+                </el-button>
+                <el-button :size="'mini'" @click="showModelThis = false">{{
+                  id == "007" ? "关 闭" : "取 消"
+                }}</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from "@/apis/service/goodStore/brand";
+import resToken from "@/mixins/resToken";
+export default {
+  name: "brand",
+  props: ["showModel", "id", "sitem"],
+  mixins: [resToken],
+  data() {
+    return {
+      loading: false,
+      showModelThis: this.showModel,
+      ruleForm: {
+        platform: [], //string	平台id
+        online_reason: "", //string	上线原因
+        online_remark: "", //string	上线备注
+      },
+      rulesThis: this.rules,
+      rules: {
+        platform: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择所属平台",
+            trigger: "change",
+          },
+        ],
+        online_reason: [
+          {
+            required: true,
+            message: "上线原因不能为空",
+            trigger: "blur",
+          },
+        ],
+        online_remark: [
+          {
+            required: true,
+            message: "上线备注不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    async initForm() {
+      this.loading = true;
+      this.rulesThis = this.rules;
+      await this.resetForm();
+      this.loading = false;
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          const { id, brand_name } = this.sitem;
+          this.ruleForm = {
+            platform: [], //string	平台id
+            online_reason: "", //string	上线原因
+            online_remark: "", //string	上线备注
+          };
+        }
+      });
+    },
+    platform_codesearchChange(e) {
+      const { id, code, label } = e;
+      this.ruleForm.platform = id ? [id] : [];
+      this.$refs.ruleForm.validateField("platform");
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          let model = JSON.parse(JSON.stringify(this.ruleForm));
+          let res = {};
+          if (this.id === "003") {
+            delete model["id"];
+            res = await asyncRequest.add(model);
+          } else {
+            res = await asyncRequest.update(model);
+          }
+          this.loading = false;
+          if (res && res.code === 0) {
+            const title = this.id === "add" ? "添加成功!" : "修改成功!";
+            this.$notify.success({
+              title,
+              message: "",
+            });
+            this.showModelThis = false;
+            // 刷新
+            this.$emit("refresh");
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.brand {
+
+}
+</style>

+ 25 - 25
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -1361,18 +1361,19 @@ export default {
         spec_value_id,
         spec_value_value,
       } = item;
-      if (index + "" === "-1") {
+      let ffindex = -1;
+      this.spec_tableData.forEach((i, findex) => {
+        if (i.spec_id === spec_id) {
+          ffindex === findex;
+          this.spec_tableData[findex].id = id;
+          this.spec_tableData[findex].spec_id = spec_id;
+          this.spec_tableData[findex].spec_value = spec_value;
+          this.spec_tableData[findex].spec_value_id = spec_value_id;
+          this.spec_tableData[findex].spec_value_value = spec_value_value;
+        }
+      });
+      if (ffindex === -1) {
         this.spec_tableData.push(item);
-      } else {
-        this.spec_tableData.forEach((i, findex) => {
-          if (i.spec_id === spec_id) {
-            this.spec_tableData[findex].id = id;
-            this.spec_tableData[findex].spec_id = spec_id;
-            this.spec_tableData[findex].spec_value = spec_value;
-            this.spec_tableData[findex].spec_value_id = spec_value_id;
-            this.spec_tableData[findex].spec_value_value = spec_value_value;
-          }
-        });
       }
       this.showModel = false;
     },
@@ -1380,20 +1381,20 @@ export default {
     costrefreshEdit(e) {
       let item = JSON.parse(JSON.stringify(e));
       console.log(item);
-      const { index, id, cost_fee, delivery_fee, min_num, nake_fee } =
-        item;
-      if (index + "" === "-1") {
+      const { index, id, cost_fee, delivery_fee, min_num, nake_fee } = item;
+      let ffindex = -1;
+      this.ladder_tableData.forEach((i, findex) => {
+        if (findex === parseInt(index + "")) {
+          ffindex = findex;
+          this.ladder_tableData[findex].id = id;
+          this.ladder_tableData[findex].cost_fee = cost_fee;
+          this.ladder_tableData[findex].delivery_fee = delivery_fee;
+          this.ladder_tableData[findex].min_num = min_num;
+          this.ladder_tableData[findex].nake_fee = nake_fee;
+        }
+      });
+      if (ffindex === -1) {
         this.ladder_tableData.push(item);
-      } else {
-        this.ladder_tableData.forEach((i, findex) => {
-          if (findex === parseInt(index + "")) {
-            this.ladder_tableData[findex].id = id;
-            this.ladder_tableData[findex].cost_fee = cost_fee;
-            this.ladder_tableData[findex].delivery_fee = delivery_fee;
-            this.ladder_tableData[findex].min_num = min_num;
-            this.ladder_tableData[findex].nake_fee = nake_fee;
-          }
-        });
       }
       this.showModel = false;
     },
@@ -1568,7 +1569,6 @@ export default {
             });
           }
           this.is_noble = isok;
-          
 
           let spec_list1 =
             speclist && speclist.length > 0

+ 9 - 15
src/views/goodStore/goodsCost/components/costFormAddEdit.vue

@@ -50,7 +50,7 @@
                 :disabled="false"
                 :max="100000000000"
                 :position="'right'"
-                :precision="0"
+                :precision="2"
                 :size="'mini'"
                 :controls="false"
                 :append="'元'"
@@ -66,7 +66,7 @@
                 :disabled="false"
                 :max="100000000000"
                 :position="'right'"
-                :precision="0"
+                :precision="2"
                 :size="'mini'"
                 :controls="false"
                 :append="'元'"
@@ -83,7 +83,7 @@
                 :disabled="false"
                 :max="100000000000"
                 :position="'right'"
-                :precision="0"
+                :precision="2"
                 :size="'mini'"
                 :controls="false"
                 :append="'元'"
@@ -113,15 +113,9 @@ export default {
   data() {
     const validate_num_0 = (rule, value, callback) => {
       if (value === "") {
-        callback(new Error("不能为空!"));
-      } else if (
-        value === "0" ||
-        value === "0." ||
-        value === "0.0" ||
-        value === "0.00" ||
-        value === "0.000"
-      ) {
-        callback(new Error("不能为零!"));
+        callback(new Error("起订量不能为空!"));
+      } else if (value === "0") {
+        callback(new Error("起订量不能为零!"));
       } else {
         callback();
       }
@@ -137,13 +131,13 @@ export default {
           { required: true, validator: validate_num_0, trigger: "blur" },
         ],
         cost_fee: [
-          { required: true, validator: validate_num_0, trigger: "blur" },
+          { required: true, message: "工艺费不能为空!", trigger: "blur" },
         ],
         nake_fee: [
-          { required: true, validator: validate_num_0, trigger: "blur" },
+          { required: true, message: "成本合计不能为空!", trigger: "blur" },
         ],
         delivery_fee: [
-          { required: true, validator: validate_num_0, trigger: "blur" },
+          { required: true, message: "其中运费不能为空!", trigger: "blur" },
         ],
       },
     };

+ 44 - 3
src/views/goodStore/goodsCost/index.vue

@@ -20,6 +20,7 @@
         parmValue.page = 1;
         searchList();
       "
+      @selection="selection_change"
     >
       <template #table-header="{}">
         <div style="width: 100%">
@@ -120,7 +121,7 @@
                 />
               </el-select>
             </el-col>
-            <el-col :span="4" style="width: 450px; padding: 0 0 0 10px">
+            <el-col :span="4" style="width: 420px; padding: 0 0 0 10px">
               <el-input
                 :size="searchSize"
                 v-model="sinput"
@@ -161,6 +162,22 @@
                 添加
               </el-button>
             </el-col>
+            <el-col
+              :span="3"
+              class="fr"
+              style="width: 110px; padding: 0 0 0 10px"
+              v-if="powers.some((item) => item == '055')"
+            >
+              <el-button
+                :size="searchSize"
+                type="warning"
+                style="float: right"
+                @click="add_online"
+              >
+                <i class="el-icon-circle-plus-outline"></i>
+                <span>商品上线</span>
+              </el-button>
+            </el-col>
           </el-row>
         </div></template
       >
@@ -253,6 +270,14 @@
       </template>
     </ex-table>
     <no-auth v-else></no-auth>
+    <add-edit
+      :id="''"
+      :sitem="changeList"
+      :show-model="showModel"
+      :is-detail="false"
+      @refresh="showModel = false"
+      @cancel="showModel = false"
+    />
   </div>
 </template>
 <script>
@@ -261,9 +286,13 @@ import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
 import { listCol, options1 } from "./columns";
+import addEdit from "./components/addEdit";
 export default {
   name: "goodsCost",
   mixins: [mixinPage, resToken],
+  components: {
+    addEdit,
+  },
   computed: {
     //组件SIZE设置
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -299,9 +328,10 @@ export default {
           name: "成本修改待审核",
         },
       ],
-
+      showModel: false,
       options1: options1,
       loading: false,
+      changeList: [],
       parmValue: {
         page: 1, // 页码
         size: 15, // 每页显示条数
@@ -402,9 +432,13 @@ export default {
       console.log(ntype + "----" + wtype);
       this.routeGoto("goodsCostDetail", {
         id: code,
-        type: wtype === '2' ? "editBase" : wtype === '3' ? "editCoin" : "",
+        type: wtype === "2" ? "editBase" : wtype === "3" ? "editCoin" : "",
       });
     },
+    selection_change(e) {
+      const { list } = e;
+      this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
+    },
     //商品品牌选择
     async brandidsearchChange(e) {
       const { id, code, label } = e;
@@ -530,6 +564,13 @@ export default {
       this.parmValue.page = 1;
       await this.searchList();
     },
+    add_online() {
+      if (this.changeList.length === 0) {
+        this.$message.warning("至少选择一个商品!");
+        return;
+      }
+      this.showModel = true;
+    },
   },
 };
 </script>

+ 1 - 1
src/views/goodStore/goodsOnline/ShowDataTableColumns.js

@@ -45,7 +45,7 @@ export default [
     span: 6,
   },
   {
-    prop: "platform_code_en",
+    prop: "plat_code",
     label: "平台商品编码",
     span: 6,
   },

+ 0 - 1
src/views/goodStore/goodsOnline/add.vue

@@ -318,7 +318,6 @@ export default {
     },
 
     platform_codesearchChange(e) {
-      console.log(e);
       const { id, code, label } = e;
       this.ruleForm.platform = id ? [id] : [];
       this.$refs.ruleForm.validateField("platform");

+ 1 - 0
src/views/goodStore/goodsOnline/columns.js

@@ -44,6 +44,7 @@ const options8 = [
   { id: "5", name: "待上线" },
   { id: "6", name: "上线成功" },
   { id: "7", name: "审核失败" },
+  { id: "8", name: "已下线" },
 ]
 const listCol = [
   {

+ 29 - 17
src/views/goodStore/goodsOnline/components/fixed-price-form.vue

@@ -155,7 +155,13 @@
           <el-table-column prop="sale_price" label="售价" />
           <el-table-column prop="market_price" label="市场价" />
           <el-table-column prop="market_platform" label="对比平台" />
-          <el-table-column prop="status" label="状态" />
+          <el-table-column prop="status" label="状态">
+            <el-tag
+              :size="'mini'"
+              :type="scope.row.status == '1' ? '' : 'warning'"
+              >{{ scope.row.status == "1" ? "启用" : "禁用" }}</el-tag
+            >
+          </el-table-column>
           <el-table-column fixed="right">
             <template slot="header" slot-scope="scope">
               <span>操作</span>
@@ -174,7 +180,12 @@
                 ></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="删除" placement="top">
+              <el-tooltip
+                effect="dark"
+                content="删除"
+                placement="top"
+                v-if="scope.row.id === ''"
+              >
                 <i
                   class="el-icon-delete tb-icon"
                   @click="openCostEditDelete(scope.$index)"
@@ -315,7 +326,7 @@ export default {
         this.selectLoading = false;
       }
     },
-     newTime: function (val) {
+    newTime: function (val) {
       if (val) {
         this.initForm();
       }
@@ -340,7 +351,7 @@ export default {
     },
 
     openCostEditDelete(index) {
-     this.ruleForm.good_ladder.splice(index, 1);
+      this.ruleForm.good_ladder.splice(index, 1);
     },
     //阶梯成本修改
     costrefreshEdit(e) {
@@ -356,20 +367,21 @@ export default {
         status,
         is_del,
       } = item;
-      if (index + "" === "-1") {
+      let ffindex = -1;
+      this.ruleForm.good_ladder.forEach((i, findex) => {
+        if (findex === parseInt(index + "")) {
+          ffindex = findex;
+          this.ruleForm.good_ladder[findex].id = id;
+          this.ruleForm.good_ladder[findex].sale_price = sale_price;
+          this.ruleForm.good_ladder[findex].market_price = market_price;
+          this.ruleForm.good_ladder[findex].min_num = min_num;
+          this.ruleForm.good_ladder[findex].market_platform = market_platform;
+          this.ruleForm.good_ladder[findex].status = status;
+          this.ruleForm.good_ladder[findex].id_del = is_del;
+        }
+      });
+      if (ffindex === -1) {
         this.ruleForm.good_ladder.push(item);
-      } else {
-        this.ruleForm.good_ladder.forEach((i, findex) => {
-          if (findex === parseInt(index+"")) {
-            this.ruleForm.good_ladder[findex].id = id;
-            this.ruleForm.good_ladder[findex].sale_price = sale_price;
-            this.ruleForm.good_ladder[findex].market_price = market_price;
-            this.ruleForm.good_ladder[findex].min_num = min_num;
-            this.ruleForm.good_ladder[findex].market_platform = market_platform;
-            this.ruleForm.good_ladder[findex].status = status;
-            this.ruleForm.good_ladder[findex].id_del = is_del;
-          }
-        });
       }
       this.showModel = false;
     },