戴艳蓉 3 năm trước cách đây
mục cha
commit
e7238a844e

+ 9 - 0
src/apis/components/search-good-online-modal.js

@@ -0,0 +1,9 @@
+import http from "@/apis/axios";
+const api = "admin/";
+export default {
+  // 列表
+  list: (data, params) => http(api + "gooduplist", data, "post", params),
+  // 供应商列表
+  supplierList: (data, params) => http(api + "supplierlist", data, "post", params),
+
+};

+ 0 - 0
src/components/search-good-modal/商品选择 → src/components/search-good-modal/上线前商品选择


+ 84 - 0
src/components/search-good-online-modal/columns.js

@@ -0,0 +1,84 @@
+export default [
+  { type: "selection", fixed: "left", _noset_: true },
+  {
+    prop: "good_code",
+    label: "商品编码",
+    width: "150",
+  },
+  {
+    prop: "good_name",
+    label: "商品名称",
+    "min-width": "120",
+  },
+
+  {
+    prop: "gys_code",
+    label: "供应商编码",
+    width: "142",
+  },
+  {
+    prop: "supplier_name",
+    label: "供货商",
+    "min-width": "160",
+  },
+  // {
+  //   prop: "cg_saler",
+  //   label: "采购员",
+  //   width: "60",
+  // },
+  // {
+  //   prop: "usable_stock",
+  //   label: "商品库存",
+  //   width: "70",
+  // },
+  {
+    prop: "unit",
+    label: "单位",
+    width: "45",
+  },
+  // {
+  //   prop: "bstatus",
+  //   label: "当前状态",
+  //   _slot_: "status",
+  //   width: "80px",
+  // },
+
+
+  // {
+  //   prop: "classArr",
+  //   label: "商品类别",
+  // },
+  {
+    prop: "color",
+    label: "商品颜色",
+    width: "70",
+  },
+  {
+    prop: "material",
+    label: "商品材质",
+    width: "70",
+  },
+  {
+    prop: "brand",
+    label: "品牌",
+    "width": "70",
+  },
+  // {
+  //   prop: "good_type",
+  //   label: "商品类型",
+  // },
+  // {后端有接口但是没有值。
+  //   prop: "specs",
+  //   label: "商品规格",
+  // },
+
+  // {
+  //   prop: "",
+  //   label: "操作",
+  //   width: "80px",
+  //   fixed: "right",
+  //   _noset_: true,
+  //   _slot_: "operation",
+  // },
+
+]

+ 2 - 0
src/components/search-good-online-modal/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 300 - 0
src/components/search-good-online-modal/main.vue

@@ -0,0 +1,300 @@
+<template>
+  <el-dialog
+    :title="'选择商品'"
+    :center="true"
+    align="left"
+    top="8vh"
+    width="1040px"
+    @close="showModelThis = false"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    v-loading="loading"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    append-to-body
+  >
+    <el-card style="margin-top: -20px" class="modal-form-style">
+      <ex-table
+        v-loading="loading"
+        :table="table"
+        :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
+        :size="size"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+      >
+        <template #table-header="{ selection }">
+          <div style="width: 100%">
+            <el-row style="margin-top: -15px">
+              <el-col :span="24">
+                <el-col :span="4" style="width: 280px; padding: 0">
+                  <el-select
+                    v-model="supplierCode"
+                    multiple
+                    filterable
+                    remote
+                    :multiple-limit="1"
+                    reserve-keyword
+                    :size="searchSize"
+                    clearable
+                    style="width: 100%"
+                    :placeholder="'供应商名称'"
+                    :remote-method="remoteMethod"
+                    :loading="selectLoading"
+                    @change="supplierChange"
+                  >
+                    <el-option
+                      v-for="(item, index) in options"
+                      :key="item.id + index"
+                      :label="item.name"
+                      :value="item.code + ''"
+                      :disabled="item.status !== '1'"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-col>
+                <el-col :span="4" style="width: 190px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.good_code"
+                    :maxlength="40"
+                    clearable
+                    placeholder="商品编号"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 180px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.good_name"
+                    :maxlength="40"
+                    clearable
+                    placeholder="商品名称"
+                  />
+                </el-col>
+
+                <el-col :span="4" style="width: 54px">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    class="fr"
+                    icon="el-icon-search"
+                    @click="searchList"
+                /></el-col>
+                <el-col :span="4" style="width: 66px">
+                  <el-button
+                    type="warning"
+                    class="fr"
+                    :size="searchSize"
+                    @click="restSearch"
+                  >
+                    重置
+                  </el-button>
+                </el-col>
+                <el-col :span="3" style="width: 66px">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    style="float: right; margin-left: 5px"
+                    @click="searchList"
+                  >
+                    刷新
+                  </el-button>
+                </el-col>
+                <el-col :span="3" style="width: 66px; float: right">
+                  <el-button
+                    :size="searchSize"
+                    type="success"
+                    style="float: right; margin-left: 5px"
+                    @click="resultList(selection)"
+                  >
+                    保存
+                  </el-button>
+                </el-col>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+      </ex-table>
+    </el-card>
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from "@/apis/components/search-good-online-modal";
+import resToken from "@/mixins/resToken";
+import mixinPage from "@/mixins/elPaginationHandle";
+import { mapGetters } from "vuex";
+import columns from "./columns";
+export default {
+  name: "searchGoodOnlineModal",
+  mixins: [resToken, mixinPage],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+  },
+  props: ["showModel", "once"],
+
+  /**
+   * 属性集合
+   * @param {Boolean}       showModel             : 是否弹出弹窗        必填
+   * @param {Boolean}       once                  : 是否只选一条        非必填
+   */
+  /**
+   * 事件集合
+   * @searchChange             : 选中值变化调用   抛出选中数据
+   */
+  data() {
+    return {
+      options: [],
+      selectLoading: false,
+      searchName: "",
+      supplierCode: [],
+      loading: true,
+      showModelThis: false,
+      parmValue: {
+        type_code: "", // 商品属性code
+        supplierNo: "", // 供应商code
+        good_code: "", // 商品编码
+        good_name: "", // 商品名称
+        wsmcode: "", //仓库code
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        // _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: columns,
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.supplierCode = [];
+        this.searchList();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+
+  methods: {
+    supplierChange(e) {
+      if (e && e.length === 1) {
+        this.parmValue.supplierNo = e[0];
+      } else {
+        this.parmValue.supplierNo = "";
+      }
+      this.parmValue.page = 1;
+      this.searchList();
+    },
+    restSearch() {
+      this.supplierCode = [];
+      this.parmValue = {
+        type_code: "", // 商品属性code
+        supplierNo: "", // 供应商code
+        good_code: "", // 商品编码
+        good_name: "", // 商品名称
+        wsmcode: "", //仓库code
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.searchList();
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        // this.tableData.map((v) => {
+        //   // v.sale_price = this.setNum(v.sale_price);
+        //   // v.sale_fee = this.setNum(v.sale_fee);
+        //   // // v.num =
+        //   // //pa (v.sale_price);
+        //   return v;
+        // });
+        //
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+    async remoteMethod(query) {
+      this.selectLoading = true;
+      if (query !== "") {
+        this.options = [];
+        let formValue = {
+          page: 1,
+          size: 100,
+          name: query,
+          code: "",
+        };
+
+        let res = await asyncRequest.supplierList(formValue);
+        if (res && res.code === 0 && res.data) {
+          const { list } = res.data;
+          this.options = list;
+        } else if (res && res.code >= 100 && res.code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(res.message);
+        }
+      } else {
+        this.options = [];
+      }
+      this.selectLoading = false;
+    },
+    async resultList(selection) {
+      if (selection && selection.length > 1 && this.once) {
+        this.$message.warning("只能选择一条商品信息!");
+        return;
+      }
+      this.showModelThis = false;
+      this.$emit("resultList", selection);
+    },
+  },
+};
+</script>
+
+<style>
+</style>

+ 0 - 0
src/components/search-good-online-modal/上线后商品选择


+ 69 - 25
src/views/goodStore/active/add.vue

@@ -14,7 +14,7 @@
         class="demo-ruleForm"
       >
         <el-row>
-          <el-col :span="8">
+          <el-col :span="16">
             <el-form-item label="活动标题" prop="activity_name">
               <el-input
                 placeholder="活动标题"
@@ -35,17 +35,8 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="8">
-            <el-form-item label="商品库存类型" prop="is_stock">
-              <el-input
-                placeholder="商品库存类型"
-                v-model="ruleForm.is_stock"
-                maxlength="100"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="活动时间" required>
+          <el-col :span="16">
+            <el-form-item label="活动时间" required style="margin: 0">
               <el-row>
                 <el-col :span="11">
                   <el-form-item prop="datactivity_name">
@@ -71,26 +62,79 @@
               </el-row>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="8">
+            <el-form-item label="商品库存类型" prop="is_stock">
+              <el-input
+                placeholder="商品库存类型"
+                v-model="ruleForm.is_stock"
+                maxlength="100"
+              />
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="24">
             <el-form-item label="活动描述" prop="activity_desc">
               <el-input
                 placeholder="活动描述"
+                type="textarea"
+                :rows="2"
+                show-word-limit
                 v-model="ruleForm.activity_desc"
-                maxlength="100"
+                maxlength="500"
               />
             </el-form-item>
           </el-col>
 
           <el-col :span="24">
-            <el-form-item label="活动商品" prop="good_list">
-
-
-
-              
+            <el-form-item
+              label="活动商品"
+              :label-position="'top'"
+              prop="good_list"
+            >
+              <el-table
+                :data="ruleForm.spuCode"
+                stripe
+                border
+                :size="'mini'"
+                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-column fixed="right" width="100">
+                  <template slot="header" slot-scope="scope">
+                    <span>操作</span>
+                    <el-tooltip
+                      class="item"
+                      effect="dark"
+                      content="添加活动商品"
+                      placement="top"
+                    >
+                      <i
+                        class="el-icon-circle-plus-outline fr"
+                        style="font-size: 18px; margin-top: 2px"
+                        @click="openEdit('add', '0')"
+                      />
+                    </el-tooltip>
+                  </template>
+                  <template slot-scope="scope">
+                    <el-button
+                      @click="handleClick(scope.row)"
+                      type="text"
+                      size="small"
+                      >查看</el-button
+                    >
+                    <el-button type="text" size="small">编辑</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
+      <search-good-online-modal />
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -101,16 +145,12 @@
 import asyncRequest from "@/apis/service/goodStore/active";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
-// import baseForm from "./components/baseForm";
-// import costForm from "./components/costForm";
-// import packForm from "./components/packForm";
+import searchGoodOnlineModal from "@/components/search-good-online-modal";
 export default {
   name: "activeAdd",
   mixins: [resToken],
   components: {
-    // baseForm,
-    // costForm,
-    // packForm,
+    searchGoodOnlineModal,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -152,6 +192,10 @@ export default {
     handleClick(row) {
       console.log(row);
     },
+    openEdit(type, id) {
+      console.log(type);
+       console.log(id);
+    },
     async initData() {
       this.loading = true;
       let res = await asyncRequest.detail({ id: this.id });