|
@@ -82,14 +82,10 @@
|
|
|
</el-select>
|
|
|
</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-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-button type="warning" :size="searchSize" @click="restSearch">重置</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row style="padding: 0 0 0 0">
|
|
@@ -105,25 +101,22 @@
|
|
|
parmValue.page = 1;
|
|
|
searchList();
|
|
|
"
|
|
|
- ><el-select
|
|
|
- slot="prepend"
|
|
|
- v-model="select"
|
|
|
- style="width: 135px"
|
|
|
- placeholder="关键字类型"
|
|
|
>
|
|
|
- <el-option label="商品编号" value="1" />
|
|
|
- <el-option label="商品名称" value="2" />
|
|
|
- <el-option label="业务公司名称" value="3" />
|
|
|
- <el-option label="供应商名称" value="4" /> </el-select></el-input>
|
|
|
+ <el-select
|
|
|
+ slot="prepend"
|
|
|
+ v-model="select"
|
|
|
+ style="width: 135px"
|
|
|
+ placeholder="关键字类型"
|
|
|
+ >
|
|
|
+ <el-option label="商品编号" value="1" />
|
|
|
+ <el-option label="商品名称" value="2" />
|
|
|
+ <el-option label="业务公司名称" value="3" />
|
|
|
+ <el-option label="供应商名称" value="4" />
|
|
|
+ </el-select>
|
|
|
+ </el-input>
|
|
|
</el-col>
|
|
|
<el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- :size="searchSize"
|
|
|
- @click="resultList(selection)"
|
|
|
- >
|
|
|
- 保存
|
|
|
- </el-button>
|
|
|
+ <el-button type="success" :size="searchSize" @click="resultList(selection)">保存</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -138,8 +131,8 @@
|
|
|
<img
|
|
|
:src="scope.row.good_thumb_img"
|
|
|
style="display: inline-block; width: 100%; height: 100%"
|
|
|
- alt=""
|
|
|
- >
|
|
|
+ alt
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #good_type="{ scope }">
|
|
@@ -157,18 +150,26 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import asyncRequest from '@/apis/components/search-good-modal'
|
|
|
-import resToken from '@/mixins/resToken'
|
|
|
-import mixinPage from '@/mixins/elPaginationHandle'
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import columns from './columns'
|
|
|
+import asyncRequest from "@/apis/components/search-good-modal";
|
|
|
+import resToken from "@/mixins/resToken";
|
|
|
+import mixinPage from "@/mixins/elPaginationHandle";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import columns from "./columns";
|
|
|
export default {
|
|
|
- name: 'SearchGoodModal',
|
|
|
+ name: "SearchGoodModal",
|
|
|
mixins: [resToken, mixinPage],
|
|
|
computed: {
|
|
|
- ...mapGetters(['tablebtnSize', 'searchSize', 'size'])
|
|
|
+ ...mapGetters(["tablebtnSize", "searchSize", "size"])
|
|
|
},
|
|
|
- props: ['showModel', 'once', 'isonline', 'is_stock', 'isNoble', 'checkType'],
|
|
|
+ props: [
|
|
|
+ "showModel",
|
|
|
+ "once",
|
|
|
+ "isonline",
|
|
|
+ "is_stock",
|
|
|
+ "isNoble",
|
|
|
+ "checkType",
|
|
|
+ "is_combind"
|
|
|
+ ],
|
|
|
|
|
|
/**
|
|
|
* 属性集合
|
|
@@ -182,29 +183,29 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
options1: [
|
|
|
- { id: '0', name: '否' },
|
|
|
- { id: '1', name: '是' }
|
|
|
+ { id: "0", name: "否" },
|
|
|
+ { id: "1", name: "是" }
|
|
|
],
|
|
|
- sinput: '',
|
|
|
- select: '1',
|
|
|
+ sinput: "",
|
|
|
+ select: "1",
|
|
|
options: [],
|
|
|
selectLoading: false,
|
|
|
- searchName: '',
|
|
|
+ searchName: "",
|
|
|
supplierCode: [],
|
|
|
loading: true,
|
|
|
showModelThis: false,
|
|
|
parmValue: {
|
|
|
- type_code: '', // 是否定制
|
|
|
- supplierNo: '', // 供应商code
|
|
|
+ type_code: "", // 是否定制
|
|
|
+ supplierNo: "", // 供应商code
|
|
|
cat_id: [],
|
|
|
brandid: [],
|
|
|
- spucode: '', // 商品编码
|
|
|
- good_name: '', // 商品名称
|
|
|
- status: '1', //
|
|
|
- company: '',
|
|
|
- supplier: '',
|
|
|
- isonline: '',
|
|
|
- is_stock: '',
|
|
|
+ spucode: "", // 商品编码
|
|
|
+ good_name: "", // 商品名称
|
|
|
+ status: "1", //
|
|
|
+ company: "",
|
|
|
+ supplier: "",
|
|
|
+ isonline: "",
|
|
|
+ is_stock: "",
|
|
|
page: 1, // 页码
|
|
|
size: 15 // 每页显示条数
|
|
|
},
|
|
@@ -228,19 +229,19 @@ export default {
|
|
|
},
|
|
|
// 表格 - 列参数
|
|
|
columns: columns
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
watch: {
|
|
|
showModel: function(val) {
|
|
|
- this.showModelThis = val
|
|
|
+ this.showModelThis = val;
|
|
|
if (val) {
|
|
|
// this.supplierCode = [];
|
|
|
- this.restSearch()
|
|
|
+ this.restSearch();
|
|
|
}
|
|
|
},
|
|
|
showModelThis(val) {
|
|
|
if (!val) {
|
|
|
- this.$emit('cancel')
|
|
|
+ this.$emit("cancel");
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -256,174 +257,200 @@ export default {
|
|
|
// this.searchList();
|
|
|
// },
|
|
|
restSearch() {
|
|
|
- this.sinput = ''
|
|
|
- this.select = '1'
|
|
|
+ this.sinput = "";
|
|
|
+ this.select = "1";
|
|
|
// this.supplierCode = [];
|
|
|
this.parmValue = {
|
|
|
- type_code: '', // 是否定制
|
|
|
- supplierNo: '', // 供应商code
|
|
|
- spucode: '', // 商品编码
|
|
|
+ type_code: "", // 是否定制
|
|
|
+ supplierNo: "", // 供应商code
|
|
|
+ spucode: "", // 商品编码
|
|
|
cat_id: [],
|
|
|
brandid: [],
|
|
|
- good_name: '', // 商品名称
|
|
|
- status: '1', //
|
|
|
- is_stock: '',
|
|
|
- company: '',
|
|
|
- supplier: '',
|
|
|
- isonline: '',
|
|
|
+ good_name: "", // 商品名称
|
|
|
+ status: "1", //
|
|
|
+ is_stock: "",
|
|
|
+ company: "",
|
|
|
+ supplier: "",
|
|
|
+ isonline: "",
|
|
|
page: 1, // 页码
|
|
|
size: 15 // 每页显示条数
|
|
|
- }
|
|
|
+ };
|
|
|
// 表格 - 分页
|
|
|
this.pageInfo = {
|
|
|
size: 15,
|
|
|
curr: 1,
|
|
|
total: 0
|
|
|
- }
|
|
|
- this.searchList()
|
|
|
+ };
|
|
|
+ this.searchList();
|
|
|
},
|
|
|
async goods_class_change(e) {
|
|
|
- this.parmValue.cat_id = e
|
|
|
- this.pageInfo.curr = 1
|
|
|
- this.parmValue.page = 1
|
|
|
- await this.searchList()
|
|
|
+ this.parmValue.cat_id = e;
|
|
|
+ this.pageInfo.curr = 1;
|
|
|
+ this.parmValue.page = 1;
|
|
|
+ await this.searchList();
|
|
|
},
|
|
|
async brandidsearchChange(e) {
|
|
|
- const { id } = e
|
|
|
- this.parmValue.brandid = id ? [id] : []
|
|
|
- this.pageInfo.curr = 1
|
|
|
- this.parmValue.page = 1
|
|
|
- await this.searchList()
|
|
|
+ const { id } = e;
|
|
|
+ this.parmValue.brandid = id ? [id] : [];
|
|
|
+ this.pageInfo.curr = 1;
|
|
|
+ this.parmValue.page = 1;
|
|
|
+ await this.searchList();
|
|
|
},
|
|
|
async searchList() {
|
|
|
- this.loading = true
|
|
|
- this.parmValue.spucode = this.select === '1' ? this.sinput : ''
|
|
|
- this.parmValue.good_name = this.select === '2' ? this.sinput : ''
|
|
|
- this.parmValue.company = this.select === '3' ? this.sinput : ''
|
|
|
- this.parmValue.supplier = this.select === '4' ? this.sinput : ''
|
|
|
- this.parmValue.isonline = this.isonline || ''
|
|
|
- this.parmValue.is_stock = this.is_stock || ''
|
|
|
- const model = JSON.parse(JSON.stringify(this.parmValue))
|
|
|
- model.cat_id = model.cat_id.length > 0 ? model.cat_id[model.cat_id.length - 1] : ''
|
|
|
+ this.loading = true;
|
|
|
+ this.parmValue.spucode = this.select === "1" ? this.sinput : "";
|
|
|
+ this.parmValue.good_name = this.select === "2" ? this.sinput : "";
|
|
|
+ this.parmValue.company = this.select === "3" ? this.sinput : "";
|
|
|
+ this.parmValue.supplier = this.select === "4" ? this.sinput : "";
|
|
|
+ this.parmValue.isonline = this.isonline || "";
|
|
|
+ this.parmValue.is_stock = this.is_stock || "";
|
|
|
+
|
|
|
+ console.log(this.is_combind, "---");
|
|
|
+
|
|
|
+ if (this.is_combind) {
|
|
|
+ this.parmValue.is_combind = this.is_combind;
|
|
|
+ }
|
|
|
+
|
|
|
+ const model = JSON.parse(JSON.stringify(this.parmValue));
|
|
|
+ model.cat_id =
|
|
|
+ model.cat_id.length > 0 ? model.cat_id[model.cat_id.length - 1] : "";
|
|
|
model.brandid =
|
|
|
- model.brandid.length > 0 ? model.brandid[model.brandid.length - 1] : ''
|
|
|
+ model.brandid.length > 0 ? model.brandid[model.brandid.length - 1] : "";
|
|
|
|
|
|
- const res = await asyncRequest.list(model)
|
|
|
+ const res = await asyncRequest.list(model);
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
- this.tableData = res.data.list
|
|
|
- this.tableData.forEach((a) => {
|
|
|
- a.cat_name = ''
|
|
|
- const list = a.cat_info || []
|
|
|
+ this.tableData = res.data.list;
|
|
|
+ this.tableData.forEach(a => {
|
|
|
+ a.cat_name = "";
|
|
|
+ const list = a.cat_info || [];
|
|
|
list.forEach((b, i) => {
|
|
|
- a.cat_name += i == 0 ? b.name : '/' + b.name
|
|
|
- })
|
|
|
- })
|
|
|
- this.pageInfo.total = Number(res.data.count)
|
|
|
+ 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()
|
|
|
+ await this.logout();
|
|
|
} else {
|
|
|
- this.tableData = []
|
|
|
- this.pageInfo.total = 0
|
|
|
+ this.tableData = [];
|
|
|
+ this.pageInfo.total = 0;
|
|
|
}
|
|
|
- this.loading = false
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
async remoteMethod(query) {
|
|
|
- this.selectLoading = true
|
|
|
- if (query !== '') {
|
|
|
- this.options = []
|
|
|
+ this.selectLoading = true;
|
|
|
+ if (query !== "") {
|
|
|
+ this.options = [];
|
|
|
const formValue = {
|
|
|
page: 1,
|
|
|
size: 100,
|
|
|
name: query,
|
|
|
- code: ''
|
|
|
- }
|
|
|
+ code: ""
|
|
|
+ };
|
|
|
|
|
|
- const res = await asyncRequest.supplierList(formValue)
|
|
|
+ const res = await asyncRequest.supplierList(formValue);
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
- const { list } = res.data
|
|
|
- this.options = list
|
|
|
+ const { list } = res.data;
|
|
|
+ this.options = list;
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout()
|
|
|
+ await this.logout();
|
|
|
} else {
|
|
|
- this.$message.warning(res.message)
|
|
|
+ this.$message.warning(res.message);
|
|
|
}
|
|
|
} else {
|
|
|
- this.options = []
|
|
|
+ this.options = [];
|
|
|
}
|
|
|
- this.selectLoading = false
|
|
|
+ this.selectLoading = false;
|
|
|
},
|
|
|
async resultList(selection) {
|
|
|
if (selection && selection.length > 1 && this.once) {
|
|
|
- this.$message.warning('只能选择一条商品信息!')
|
|
|
- return
|
|
|
+ this.$message.warning("只能选择一条商品信息!");
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (this.checkType) {
|
|
|
- const h = this.$createElement
|
|
|
+ const h = this.$createElement;
|
|
|
const categoryIds = selection.map(({ cat_info, is_gold_price }) => ({
|
|
|
id: String(cat_info[0].id),
|
|
|
isGoldPrice: String(is_gold_price)
|
|
|
- }))
|
|
|
+ }));
|
|
|
|
|
|
- console.log(categoryIds)
|
|
|
- const nobleMetalIds = categoryIds.filter(({ id, isGoldPrice }
|
|
|
- ) => id === '6' && isGoldPrice === '1')
|
|
|
+ console.log(categoryIds);
|
|
|
+ const nobleMetalIds = categoryIds.filter(
|
|
|
+ ({ id, isGoldPrice }) => id === "6" && isGoldPrice === "1"
|
|
|
+ );
|
|
|
|
|
|
- if (nobleMetalIds.length > 0 && categoryIds.length !== nobleMetalIds.length) {
|
|
|
+ if (
|
|
|
+ nobleMetalIds.length > 0 &&
|
|
|
+ categoryIds.length !== nobleMetalIds.length
|
|
|
+ ) {
|
|
|
// this.$message.warning('勾选商品的分类必须全部为"贵金属"或全部为"非贵金属"')
|
|
|
|
|
|
this.$message({
|
|
|
- message: h('p', null, [
|
|
|
- h('span', null, '勾选商品必须全部为'),
|
|
|
- h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
|
|
|
- h('span', null, '或者全部为'),
|
|
|
- h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品')
|
|
|
+ message: h("p", null, [
|
|
|
+ h("span", null, "勾选商品必须全部为"),
|
|
|
+ h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
|
|
|
+ h("span", null, "或者全部为"),
|
|
|
+ h(
|
|
|
+ "i",
|
|
|
+ { style: "color: red" },
|
|
|
+ "未开启实时金价的贵金属商品和非贵金属商品"
|
|
|
+ )
|
|
|
]),
|
|
|
- type: 'warning',
|
|
|
+ type: "warning",
|
|
|
dangerouslyUseHTMLString: true
|
|
|
- })
|
|
|
- return
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- const isNoble = nobleMetalIds.length > 0 && categoryIds.length === nobleMetalIds.length
|
|
|
- if ((isNoble && !this.isNoble) && this.isNoble !== null) {
|
|
|
+ const isNoble =
|
|
|
+ nobleMetalIds.length > 0 &&
|
|
|
+ categoryIds.length === nobleMetalIds.length;
|
|
|
+ if (isNoble && !this.isNoble && this.isNoble !== null) {
|
|
|
// this.$message.warning('如需添加 "贵金属商品",请将已添加的所有 "非贵金属商品" 删除!')
|
|
|
|
|
|
this.$message({
|
|
|
- message: h('p', null, [
|
|
|
- h('span', null, '如需添加'),
|
|
|
- h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
|
|
|
- h('span', null, '请将已添加的所有'),
|
|
|
- h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品'),
|
|
|
- h('span', null, '删除!')
|
|
|
+ message: h("p", null, [
|
|
|
+ h("span", null, "如需添加"),
|
|
|
+ h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
|
|
|
+ h("span", null, "请将已添加的所有"),
|
|
|
+ h(
|
|
|
+ "i",
|
|
|
+ { style: "color: red" },
|
|
|
+ "未开启实时金价的贵金属商品和非贵金属商品"
|
|
|
+ ),
|
|
|
+ h("span", null, "删除!")
|
|
|
]),
|
|
|
- type: 'warning',
|
|
|
+ type: "warning",
|
|
|
dangerouslyUseHTMLString: true
|
|
|
- })
|
|
|
- return
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- if ((!isNoble && this.isNoble) && this.isNoble !== null) {
|
|
|
+ if (!isNoble && this.isNoble && this.isNoble !== null) {
|
|
|
this.$message({
|
|
|
- message: h('p', null, [
|
|
|
- h('span', null, '如需添加'),
|
|
|
- h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品'),
|
|
|
- h('span', null, '请将已添加的所有'),
|
|
|
- h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
|
|
|
- h('span', null, '删除!')
|
|
|
+ message: h("p", null, [
|
|
|
+ h("span", null, "如需添加"),
|
|
|
+ h(
|
|
|
+ "i",
|
|
|
+ { style: "color: red" },
|
|
|
+ "未开启实时金价的贵金属商品和非贵金属商品"
|
|
|
+ ),
|
|
|
+ h("span", null, "请将已添加的所有"),
|
|
|
+ h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
|
|
|
+ h("span", null, "删除!")
|
|
|
]),
|
|
|
- type: 'warning',
|
|
|
+ type: "warning",
|
|
|
dangerouslyUseHTMLString: true
|
|
|
- })
|
|
|
- return
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.showModelThis = false
|
|
|
- this.$emit('resultList', selection)
|
|
|
+ this.showModelThis = false;
|
|
|
+ this.$emit("resultList", selection);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style></style>
|