index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <div class="dealGoodsPool pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. @selection="selection_change"
  24. >
  25. <template #table-header="{}">
  26. <div style="width: 100%">
  27. <el-row style="padding: 0 0 0 80px">
  28. <el-col :span="6" style="width: 293px">
  29. <period-date-picker
  30. :type="1"
  31. :width="'135px'"
  32. :size="searchSize"
  33. :start="parmValue.start"
  34. :end="parmValue.end"
  35. @timeReturned="handleTime"
  36. />
  37. </el-col>
  38. <el-col :span="6" style="width: 250px; padding: 0 0 0 10px">
  39. <el-input
  40. :size="searchSize"
  41. style="100%"
  42. v-model="parmValue.good_code"
  43. :maxlength="40"
  44. placeholder="商品编码"
  45. ></el-input>
  46. </el-col>
  47. <el-col :span="6" style="width: 280px; padding: 0 0 0 10px">
  48. <el-input
  49. :size="searchSize"
  50. style="100%"
  51. v-model="parmValue.supplier_name"
  52. :maxlength="40"
  53. placeholder="商品名称"
  54. ></el-input>
  55. </el-col>
  56. <el-col
  57. :span="3"
  58. class="fr"
  59. style="width: 110px; padding: 0 0 0 10px"
  60. >
  61. <!-- v-if="powers.some((item) => item == '055')" -->
  62. <el-button
  63. :size="searchSize"
  64. type="warning"
  65. style="float: right"
  66. @click="add_online"
  67. >
  68. <i class="el-icon-circle-plus-outline"></i>
  69. <span>商品上线</span>
  70. </el-button>
  71. </el-col>
  72. <el-col
  73. :span="3"
  74. class="fr"
  75. style="width: 66px; padding: 0 0 0 10px"
  76. >
  77. <el-button type="primary" :size="searchSize" @click="searchList">
  78. 刷新
  79. </el-button>
  80. </el-col>
  81. <el-col
  82. :span="3"
  83. class="fr"
  84. style="width: 66px; padding: 0 0 0 10px"
  85. >
  86. <el-button type="warning" :size="searchSize" @click="restSearch">
  87. 重置
  88. </el-button>
  89. </el-col>
  90. </el-row>
  91. <!-- <el-row> -->
  92. <!-- <el-col :span="4" style="width: 518px">
  93. <el-input
  94. :size="searchSize"
  95. v-model="sinput"
  96. :maxlength="40"
  97. placeholder="关键字"
  98. >
  99. <el-select
  100. v-model="select"
  101. slot="prepend"
  102. @change="
  103. pageInfo.curr = 1;
  104. parmValue.page = 1;
  105. searchList();
  106. "
  107. style="width: 130px"
  108. placeholder="关键词类型"
  109. >
  110. <el-option label="业务公司编码" value="1" />
  111. <el-option label="业务公司名称" value="2" />
  112. <el-option label="供应商编码" value="3" />
  113. <el-option label="供应商名称" value="4" />
  114. </el-select>
  115. </el-input>
  116. </el-col> -->
  117. <!-- </el-row> -->
  118. </div></template
  119. >
  120. <template #good_img="{ scope }">
  121. <div
  122. v-if="scope.row.good_img"
  123. style="width: 20px; height: 20px"
  124. class="hover"
  125. v-viewer
  126. >
  127. <img
  128. :src="scope.row.good_img"
  129. style="display: inline-block; width: 100%; height: 100%"
  130. alt=""
  131. />
  132. </div>
  133. </template>
  134. <!-- <template #status="{ scope }">
  135. <el-tag
  136. :size="tablebtnSize"
  137. :type="scope.row.status == '0' ? '' : 'warning'"
  138. v-text="
  139. (statusList.find((item) => item.code == scope.row.status) || {})
  140. .name || '--'
  141. "
  142. ></el-tag>
  143. </template> -->
  144. <template #good_type="{ scope }">
  145. <el-tag
  146. :size="tablebtnSize"
  147. :type="scope.row.good_type == '0' ? 'warning' : ''"
  148. v-text="
  149. (options1.find((item) => item.id == scope.row.good_type) || {})
  150. .name || '--'
  151. "
  152. ></el-tag>
  153. </template>
  154. <template #operation="{ scope }">
  155. <el-tooltip
  156. v-if="powers.some((item) => item == '007')"
  157. effect="dark"
  158. content="详情"
  159. placement="top"
  160. >
  161. <i class="el-icon-view tb-icon" @click="show_view(scope.row)"></i>
  162. </el-tooltip>
  163. </template>
  164. </ex-table>
  165. <no-auth v-else></no-auth>
  166. <show-goods-data-table-modal
  167. :showModel="visible"
  168. :type="'3'"
  169. :title="row.dtitle"
  170. :skuCode="row.skuCode"
  171. :spuCode="row.spuCode"
  172. :iscgd="false"
  173. @cancel="visible = false"
  174. />
  175. <el-dialog
  176. title="弹窗"
  177. :visible.sync="centerDialogVisible"
  178. width="30%"
  179. center
  180. >
  181. <span>暂无</span>
  182. </el-dialog>
  183. </div>
  184. </template>
  185. <script>
  186. import asyncRequest from "@/apis/service/goodStore/dealGoodsPool";
  187. import mixinPage from "@/mixins/elPaginationHandle";
  188. import { mapGetters } from "vuex";
  189. import resToken from "@/mixins/resToken";
  190. import { listCol, options1 } from "./columns";
  191. import showGoodsDataTableModal from "@/components/show-goods-data-table-modal";
  192. export default {
  193. name: "dealGoodsPool",
  194. mixins: [mixinPage, resToken],
  195. components: {
  196. showGoodsDataTableModal,
  197. },
  198. computed: {
  199. //组件SIZE设置
  200. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  201. powers() {
  202. let tran =
  203. this.$store.getters.btnList.find(
  204. (item) => item.menu_route == "dealGoodsPool"
  205. ) || {};
  206. if (tran && tran.action && tran.action.length > 0) {
  207. return tran.action;
  208. } else {
  209. return [];
  210. }
  211. },
  212. },
  213. data() {
  214. return {
  215. row: {},
  216. visible: false,
  217. select: "1",
  218. sinput: "",
  219. //弹窗
  220. centerDialogVisible:false,
  221. //选中数组
  222. changeList:[],
  223. statusList: [
  224. {
  225. code: "0",
  226. name: "新建待审核",
  227. },
  228. {
  229. code: "1",
  230. name: "审核通过",
  231. },
  232. {
  233. code: "2",
  234. name: "基础修改待审核",
  235. },
  236. {
  237. code: "3",
  238. name: "成本修改待审核",
  239. },
  240. ],
  241. options1: options1,
  242. loading: false,
  243. parmValue: {
  244. page: 1, // 页码
  245. size: 15, // 每页显示条数
  246. start: "",
  247. end: "",
  248. status: "",
  249. creater: "",
  250. },
  251. // 表格 - 数据
  252. tableData: [],
  253. // 表格 - 参数
  254. table: {
  255. stripe: true,
  256. border: true,
  257. _defaultHeader_: ["setcol"],
  258. },
  259. // 表格 - 分页
  260. pageInfo: {
  261. size: 15,
  262. curr: 1,
  263. total: 0,
  264. },
  265. // 表格 - 列参数
  266. columns: listCol,
  267. supplierNo: [],
  268. cat_id: [],
  269. brandid: [],
  270. };
  271. },
  272. mounted() {
  273. this.supplierNo = [];
  274. this.cat_id = [];
  275. this.brandid = [];
  276. this.searchList();
  277. },
  278. methods: {
  279. //点击商品上线
  280. add_online(){
  281. this.centerDialogVisible = true;
  282. },
  283. //选中触发函数
  284. selection_change(e) {
  285. console.log(e);
  286. const { list } = e;
  287. //选中的数组集合
  288. this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
  289. },
  290. show_view(keyRow) {
  291. this.row = keyRow;
  292. this.row.dtitle = "咨询成交商品详情";
  293. this.visible = true;
  294. },
  295. restSearch() {
  296. this.supplierNo = [];
  297. this.cat_id = [];
  298. this.brandid = [];
  299. // 表格 - 分页
  300. this.pageInfo = {
  301. size: 15,
  302. curr: 1,
  303. total: 0,
  304. };
  305. this.parmValue = {
  306. page: 1, // 页码
  307. size: 15, // 每页显示条数
  308. start: "",
  309. end: "",
  310. status: "",
  311. creater: "",
  312. };
  313. this.searchList();
  314. },
  315. //供应商选择
  316. async supplierNosearchChange(e) {
  317. console.log(e);
  318. const { code } = e;
  319. this.supplierNo = code ? [code] : [];
  320. this.parmValue.supplierNo = this.supplierNo.toString();
  321. this.pageInfo.curr = 1;
  322. this.parmValue.page = 1;
  323. await this.searchList();
  324. },
  325. //业务企业选择
  326. async company_idsearchChange(e) {
  327. const { code } = e;
  328. this.parmValue.company_id = code ? code : "";
  329. this.pageInfo.curr = 1;
  330. this.parmValue.page = 1;
  331. await this.searchList();
  332. },
  333. //商品品牌选择
  334. async brandidsearchChange(e) {
  335. const { id, code, label } = e;
  336. if (id) {
  337. this.brandid = [id];
  338. } else {
  339. this.brandid = [];
  340. }
  341. this.ruleForm.brandid = this.this.brandid.toString();
  342. this.pageInfo.curr = 1;
  343. this.parmValue.page = 1;
  344. await this.searchList();
  345. },
  346. // 时间
  347. async handleTime(e) {
  348. this.parmValue.start = e.startTime || "";
  349. this.parmValue.end = e.endTime || "";
  350. if (
  351. (this.parmValue.start !== "" && this.parmValue.end !== "") ||
  352. (this.parmValue.start === "" && this.parmValue.end === "")
  353. ) {
  354. this.pageInfo.curr = 1;
  355. this.parmValue.page = 1;
  356. await this.searchList();
  357. }
  358. },
  359. /**
  360. * 启用/禁用
  361. * @param {String} id id
  362. * @param {String} status 0-禁用 1-启用
  363. */
  364. async changeStatus(id, status) {
  365. await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
  366. confirmButtonText: "确定",
  367. cancelButtonText: "取消",
  368. type: "warning",
  369. })
  370. .then(async () => {
  371. this.loading = true;
  372. const model = {
  373. id: id,
  374. status: status === "1" ? "0" : "1",
  375. };
  376. const res = await asyncRequest.status(model);
  377. if (res && res.code === 0) {
  378. this.loading = false;
  379. this.$notify.success({
  380. title: "状态修改成功!",
  381. message: "",
  382. });
  383. await this.searchList();
  384. } else if (res && res.code >= 100 && res.code <= 104) {
  385. await this.logout();
  386. } else {
  387. this.loading = false;
  388. this.$message.warning(res.message);
  389. }
  390. })
  391. .catch(() => {
  392. console.log("取消");
  393. });
  394. },
  395. async deleteItem(code) {
  396. await this.$confirm("确定要删除?", {
  397. confirmButtonText: "确定",
  398. cancelButtonText: "取消",
  399. type: "warning",
  400. })
  401. .then(async () => {
  402. const model = {
  403. codes: [code],
  404. };
  405. const res = await asyncRequest.delete(model);
  406. if (res && res.code === 0) {
  407. this.$notify.success({
  408. title: "删除成功",
  409. message: "",
  410. });
  411. this.searchList();
  412. } else if (res && res.code >= 100 && res.code <= 104) {
  413. await this.logout();
  414. } else {
  415. this.$message.warning(res.message);
  416. }
  417. })
  418. .catch(() => {
  419. console.log("取消");
  420. });
  421. },
  422. // 刷新表格
  423. async searchList() {
  424. if (
  425. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  426. (this.parmValue.start === "" && this.parmValue.end !== "")
  427. ) {
  428. this.$message.warning("时间区间不完整!");
  429. return;
  430. }
  431. this.loading = true;
  432. const res = await asyncRequest.list(this.parmValue);
  433. if (res && res.code === 0 && res.data) {
  434. this.tableData = res.data.list;
  435. console.log("11111111",this.tableData)
  436. this.tableData.forEach((a) => {
  437. a.cat_name = "";
  438. let list = a.cat_info || [];
  439. list.forEach((b, i) => {
  440. a.cat_name += i == 0 ? b.name : "/" + b.name;
  441. });
  442. });
  443. this.pageInfo.total = Number(res.data.count);
  444. } else if (res && res.code >= 100 && res.code <= 104) {
  445. await this.logout();
  446. } else {
  447. this.tableData = [];
  448. this.pageInfo.total = 0;
  449. }
  450. this.loading = false;
  451. },
  452. //商品分类选择
  453. async goods_class_change(e) {
  454. const { value } = e;
  455. this.cat_id = value || [];
  456. this.pageInfo.cat_id = this.cat_id.toString();
  457. this.pageInfo.curr = 1;
  458. this.parmValue.page = 1;
  459. await this.searchList();
  460. },
  461. },
  462. };
  463. </script>
  464. <style lang="scss" scoped>
  465. </style>