|
@@ -0,0 +1,501 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ center
|
|
|
+ title="选择子商品"
|
|
|
+ :visible="_visible"
|
|
|
+ @close="handleClose"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :append-to-body="true"
|
|
|
+ width="1024px"
|
|
|
+ top="5vh"
|
|
|
+ class="child-product"
|
|
|
+ >
|
|
|
+ <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();
|
|
|
+ "
|
|
|
+ @selection="selectionChange"
|
|
|
+ >
|
|
|
+ <template #table-header="{}">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-row style="padding: 0 0 10px 0px">
|
|
|
+ <el-col :span="6" style="width: 303px">
|
|
|
+ <period-date-picker
|
|
|
+ :type="1"
|
|
|
+ :width="'135px'"
|
|
|
+ :size="searchSize"
|
|
|
+ :start="parmValue.start"
|
|
|
+ :end="parmValue.end"
|
|
|
+ @timeReturned="handleTime"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" style="width: 135px">
|
|
|
+ <search-brand
|
|
|
+ :value="brandid"
|
|
|
+ :disabled="false"
|
|
|
+ :size="'mini'"
|
|
|
+ :isDetail="true"
|
|
|
+ :names="parmValue.supplierName"
|
|
|
+ :placeholder="'商品品牌'"
|
|
|
+ @searchChange="brandidsearchChange"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" style="width: 310px; padding: 0 0 0 10px">
|
|
|
+ <good-class
|
|
|
+ :value="parmValue.cat_id"
|
|
|
+ @handleChange="goods_class_change"
|
|
|
+ :disabled="false"
|
|
|
+ :size="searchSize"
|
|
|
+ :isDetail="false"
|
|
|
+ :placeholder="'分类'"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
|
|
|
+ <el-button type="primary" :size="searchSize" @click="searchList">刷新</el-button>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
|
|
|
+ <el-button type="warning" :size="searchSize" @click="restSearch">重置</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <!-- <el-col :span="4" style="width: 226px">
|
|
|
+ <el-select
|
|
|
+ v-model="parmValue.status"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ :size="searchSize"
|
|
|
+ placeholder="状态"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in statusList"
|
|
|
+ :key="'status' + item.code"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.code"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-col>-->
|
|
|
+ <el-col :span="4" style="width: 145px; padding: 0 0 0 0px">
|
|
|
+ <el-select
|
|
|
+ v-model="parmValue.isonline"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ :size="searchSize"
|
|
|
+ placeholder="是否上线"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in isonlineoptions"
|
|
|
+ :key="'isonline' + item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <!-- <el-col :span="4" style="width: 135px;margin-left:10px">
|
|
|
+ <el-select
|
|
|
+ v-model="parmValue.is_stock"
|
|
|
+ size="mini"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="商品类型"
|
|
|
+ clearable
|
|
|
+ @change="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="opt in isStockOptions"
|
|
|
+ :key="opt.value"
|
|
|
+ :value="opt.value"
|
|
|
+ :label="opt.label"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-col>-->
|
|
|
+ <el-col :span="3" style="margin: 0 10px">
|
|
|
+ <search-supplier
|
|
|
+ :size="'mini'"
|
|
|
+ style="width: 250px"
|
|
|
+ :value="supplierNo"
|
|
|
+ :disabled="false"
|
|
|
+ :placeholder="'供应商名称'"
|
|
|
+ :names="''"
|
|
|
+ :isDetail="false"
|
|
|
+ :noDisabled="true"
|
|
|
+ @searchChange="supplierChange"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="4" style="width: 320px">
|
|
|
+ <el-input
|
|
|
+ :size="searchSize"
|
|
|
+ v-model="sinput"
|
|
|
+ :maxlength="40"
|
|
|
+ @blur="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ placeholder="关键字"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="select"
|
|
|
+ slot="prepend"
|
|
|
+ style="width: 135px"
|
|
|
+ @change="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ placeholder="关键字类型"
|
|
|
+ >
|
|
|
+ <el-option label="商品编号" value="1" />
|
|
|
+ <el-option label="商品名称" value="2" />
|
|
|
+ </el-select>
|
|
|
+ </el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- <el-row style="margin-top: 10px">
|
|
|
+
|
|
|
+ </el-row>-->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #spuCode="{ scope }">
|
|
|
+ <div style="display:flex;align-items:center">
|
|
|
+ <p>{{scope.row.spuCode}}</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #good_thumb_img="{ scope }">
|
|
|
+ <div
|
|
|
+ v-if="scope.row.good_thumb_img"
|
|
|
+ style="width: 20px; height: 20px"
|
|
|
+ class="hover"
|
|
|
+ v-viewer
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="scope.row.good_thumb_img"
|
|
|
+ style="display: inline-block; width: 100%; height: 100%"
|
|
|
+ alt
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #status="{ scope }">
|
|
|
+ <el-tag
|
|
|
+ :size="tablebtnSize"
|
|
|
+ :type="
|
|
|
+ (statusList.find((item) => item.code == scope.row.status) || {}).type || '--'
|
|
|
+ "
|
|
|
+ v-text="
|
|
|
+ (statusList.find((item) => item.code == scope.row.status) || {}).name || '--'
|
|
|
+ "
|
|
|
+ ></el-tag>
|
|
|
+ </template>
|
|
|
+ <template #has_account="{ scope }">
|
|
|
+ <el-tag
|
|
|
+ :size="tablebtnSize"
|
|
|
+ :type="
|
|
|
+ (
|
|
|
+ has_account_list.find((item) => item.code == scope.row.has_account + '') ||
|
|
|
+ {}
|
|
|
+ ).type || '--'
|
|
|
+ "
|
|
|
+ v-text="
|
|
|
+ (
|
|
|
+ has_account_list.find((item) => item.code == scope.row.has_account + '') ||
|
|
|
+ {}
|
|
|
+ ).name || '--'
|
|
|
+ "
|
|
|
+ ></el-tag>
|
|
|
+ </template>
|
|
|
+ <template #isonline="{ scope }">
|
|
|
+ <el-tag
|
|
|
+ :size="tablebtnSize"
|
|
|
+ :type="scope.row.is_online == '0' ? 'warning' : ''"
|
|
|
+ v-text="
|
|
|
+ (isonlineoptions.find((item) => item.id == scope.row.is_online) || {}).name ||
|
|
|
+ '--'
|
|
|
+ "
|
|
|
+ ></el-tag>
|
|
|
+ </template>
|
|
|
+ <template #is_stock="{ scope }">
|
|
|
+ <el-tag
|
|
|
+ :size="tablebtnSize"
|
|
|
+ :type="scope.row.is_stock == '0' ? 'warning' : ''"
|
|
|
+ v-text="
|
|
|
+ (options4.find((item) => item.id == scope.row.is_stock) || {}).name || '--'
|
|
|
+ "
|
|
|
+ ></el-tag>
|
|
|
+ </template>
|
|
|
+ </ex-table>
|
|
|
+
|
|
|
+ <div style="display:flex;justify-content:flex-end">
|
|
|
+ <el-button size="mini" type="primary" @click="onSave">保 存</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listCol, options1, options4 } from "./../columns";
|
|
|
+import { has_account_list, isStockOptions } from "@/assets/js/statusList";
|
|
|
+import asyncRequest from "@/apis/service/goodStore/goodsCost";
|
|
|
+import mixinPage from "@/mixins/elPaginationHandle";
|
|
|
+import resToken from "@/mixins/resToken";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "ProductListModal",
|
|
|
+ props: ["visible"],
|
|
|
+ mixins: [mixinPage, resToken],
|
|
|
+ computed: {
|
|
|
+ _visible: {
|
|
|
+ get() {
|
|
|
+ return this.visible;
|
|
|
+ },
|
|
|
+ set(nV) {
|
|
|
+ this.$emit("update:visible", nV);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ visible(v) {
|
|
|
+ if (!v) return;
|
|
|
+ this.searchList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ table: {
|
|
|
+ stripe: true,
|
|
|
+ border: true,
|
|
|
+ _defaultHeader_: []
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ columns: listCol.filter(({ label }) => {
|
|
|
+ return !["操作"].includes(label);
|
|
|
+ }),
|
|
|
+ selected: [],
|
|
|
+ options1,
|
|
|
+ options4,
|
|
|
+ size: "mini",
|
|
|
+ searchSize: "mini",
|
|
|
+ tablebtnSize: "mini",
|
|
|
+ sinput: "",
|
|
|
+ select: "1",
|
|
|
+ parmValue: {
|
|
|
+ page: 1, // 页码
|
|
|
+ size: 10, // 每页显示条数
|
|
|
+ is_stock: "",
|
|
|
+ start: "",
|
|
|
+ end: "",
|
|
|
+ status: "",
|
|
|
+ good_name: "",
|
|
|
+ spucode: "",
|
|
|
+ cat_id: [],
|
|
|
+ brandid: "",
|
|
|
+ good_type: "",
|
|
|
+ companyNo: "",
|
|
|
+ supplierNo: "",
|
|
|
+ isonline: "",
|
|
|
+ company_name: "" //创建人部门
|
|
|
+ },
|
|
|
+ has_account_list,
|
|
|
+ isStockOptions,
|
|
|
+ pageInfo: {
|
|
|
+ size: 10,
|
|
|
+ curr: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ isonlineoptions: [
|
|
|
+ { id: "0", name: "未上线" },
|
|
|
+ { id: "1", name: "已上线" }
|
|
|
+ ],
|
|
|
+ statusList: [
|
|
|
+ {
|
|
|
+ code: "0",
|
|
|
+ name: "新建待审核",
|
|
|
+ type: ""
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "1",
|
|
|
+ name: "审核通过",
|
|
|
+ type: "success"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "2",
|
|
|
+ name: "基础修改待审核",
|
|
|
+ type: ""
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "3",
|
|
|
+ name: "成本修改待审核",
|
|
|
+ type: ""
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "4",
|
|
|
+ name: "基础修改驳回",
|
|
|
+ type: "danger"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "5",
|
|
|
+ name: "成本修改驳回",
|
|
|
+ type: "danger"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "6",
|
|
|
+ name: "新建审核驳回",
|
|
|
+ type: "danger"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "7",
|
|
|
+ name: "复制商品待编辑",
|
|
|
+ type: "info"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: "8",
|
|
|
+ name: "竞价商品待编辑",
|
|
|
+ type: "info"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ tableData: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ selectionChange(evt) {
|
|
|
+ const { list } = evt;
|
|
|
+ this.selected = list;
|
|
|
+ },
|
|
|
+ restSearch() {
|
|
|
+ this.select = "2";
|
|
|
+ this.sinput = "";
|
|
|
+ this.supplierNo = [];
|
|
|
+ this.brandid = [];
|
|
|
+ // 表格 - 分页
|
|
|
+ this.pageInfo = {
|
|
|
+ size: 15,
|
|
|
+ curr: 1,
|
|
|
+ total: 0
|
|
|
+ };
|
|
|
+ this.parmValue = {
|
|
|
+ page: 1, // 页码
|
|
|
+ size: 15, // 每页显示条数
|
|
|
+ start: "",
|
|
|
+ end: "",
|
|
|
+ status: "",
|
|
|
+ good_name: "",
|
|
|
+ company_name: "", //创建人部门
|
|
|
+ spucode: "",
|
|
|
+ cat_id: [],
|
|
|
+ brandid: "",
|
|
|
+ good_type: "",
|
|
|
+ isonline: "",
|
|
|
+ companyNo: "",
|
|
|
+ supplierNo: ""
|
|
|
+ };
|
|
|
+ this.searchList();
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.selected = [];
|
|
|
+ this._visible = false;
|
|
|
+ },
|
|
|
+ proportionChange(proportion) {
|
|
|
+ this.ruleForm.proportion = proportion;
|
|
|
+ },
|
|
|
+ onSave() {
|
|
|
+ if (this.selected.length === 0 || this.selected.length > 1) {
|
|
|
+ const message =
|
|
|
+ this.selected.length === 0 ? "请选择一条商品" : "只能选择一条商品";
|
|
|
+ this.$message.warning(message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const { spuCode } = this.selected[0];
|
|
|
+ this.$emit("selected", spuCode);
|
|
|
+ this._visible = false;
|
|
|
+ },
|
|
|
+ async searchList() {
|
|
|
+ if (
|
|
|
+ (this.parmValue.start !== "" && this.parmValue.end === "") ||
|
|
|
+ (this.parmValue.start === "" && this.parmValue.end !== "")
|
|
|
+ ) {
|
|
|
+ this.$message.warning("时间区间不完整!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ let item = JSON.parse(JSON.stringify(this.parmValue));
|
|
|
+ item.spucode = this.select === "1" ? this.sinput : "";
|
|
|
+ item.good_name = this.select === "2" ? this.sinput : "";
|
|
|
+ item.companyNo = this.select === "3" ? this.sinput : "";
|
|
|
+ item.supplierNo = this.select === "4" ? this.sinput : "";
|
|
|
+ item.company_name = this.select === "5" ? this.sinput : ""; // 部门
|
|
|
+ item.cat_id =
|
|
|
+ item.cat_id.length > 0 ? item.cat_id[item.cat_id.length - 1] : "";
|
|
|
+ const res = await asyncRequest.list({
|
|
|
+ ...item,
|
|
|
+ supplierNo: Array.isArray(this.supplierNo) ? this.supplierNo[0] : "",
|
|
|
+ needRela: true,
|
|
|
+ is_stock: "1",
|
|
|
+ status: "1"
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res && res.code === 0 && res.data) {
|
|
|
+ this.tableData = res.data.list;
|
|
|
+ this.tableData.forEach(a => {
|
|
|
+ a.cat_name = "";
|
|
|
+ let list = a.cat_info || [];
|
|
|
+ list.forEach((b, i) => {
|
|
|
+ a.cat_name += i == 0 ? b.name : "/" + b.name;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ 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.getresultlist();
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.child-product {
|
|
|
+ /deep/ .el-pagination {
|
|
|
+ float: left !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|