index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <div class="sellReturn pagePadding">
  3. <div v-if="powers.some((i) => i == '001')">
  4. <ex-table
  5. v-loading="loading"
  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. @selection="handleSelection"
  14. @screen-reset="
  15. pageInfo.curr = 1;
  16. parmValue.page = 1;
  17. searchList();
  18. "
  19. @screen-submit="
  20. pageInfo.curr = 1;
  21. parmValue.page = 1;
  22. searchList();
  23. "
  24. >
  25. <template #table-header="{}">
  26. <div style="width: 100%">
  27. <el-row style="padding: 0 0 0 80px">
  28. <!-- <el-col :span="4" style="width: 120px">
  29. <el-switch
  30. v-model="parmValue.use_type"
  31. :active-value="usetypeOtions[1].value"
  32. :inactive-value="usetypeOtions[0].value"
  33. :active-text="usetypeOtions[1].label"
  34. :inactive-text="usetypeOtions[0].label"
  35. @change="
  36. pageInfo.curr = 1;
  37. parmValue.page = 1;
  38. searchList();
  39. "
  40. />
  41. </el-col>-->
  42. <!-- 时间区间 -->
  43. <el-col :span="6" style="width: 303px; padding: 0 0 0 10px">
  44. <period-date-picker
  45. :type="1"
  46. :width="'135px'"
  47. :size="searchSize"
  48. :start="parmValue.start"
  49. :end="parmValue.end"
  50. @timeReturned="handleTime"
  51. />
  52. </el-col>
  53. <el-col :span="3" style="width: 200px; padding: 0 0 0 10px;margin-right:10px">
  54. <search-customer
  55. :value="parmValue.customer_code"
  56. :size="'mini'"
  57. style="width: 100%"
  58. :names="parmValue.customerName"
  59. :placeholder="'企业客户'"
  60. :disabled="false"
  61. :is-detail="true"
  62. @searchChange="customer_code_change"
  63. />
  64. </el-col>
  65. <el-col :span="4">
  66. <el-input
  67. style="width:100%"
  68. clearable
  69. size="mini"
  70. placeholder="商品名称"
  71. v-model="parmValue.good_name"
  72. @change="
  73. pageInfo.curr = 1;
  74. parmValue.page = 1;
  75. searchList();
  76. "
  77. />
  78. </el-col>
  79. <el-col :span="3" style="width: 66px; float: right">
  80. <el-button
  81. :size="searchSize"
  82. type="primary"
  83. style="float: right; margin-left: 5px"
  84. @click="searchList"
  85. >刷新</el-button>
  86. </el-col>
  87. </el-row>
  88. <el-row style="margin-top: 10px">
  89. <el-col :span="3" style="width: 200px">
  90. <el-select
  91. :size="searchSize"
  92. v-model="parmValue.status"
  93. filterable
  94. clearable
  95. placeholder="状态"
  96. style="width: 100%"
  97. @change="
  98. pageInfo.curr = 1;
  99. parmValue.page = 1;
  100. searchList();
  101. "
  102. >
  103. <el-option
  104. v-for="item in statusOptions"
  105. :key="'orderstatus' + item.id"
  106. :label="item.label"
  107. :value="item.value"
  108. />
  109. </el-select>
  110. </el-col>
  111. <el-col :span="4" style="width: 151px; padding: 0 0 0 10px">
  112. <el-select
  113. :size="searchSize"
  114. v-model="parmValue.order_source"
  115. filterable
  116. clearable
  117. placeholder="订单来源"
  118. style="width: 100%"
  119. @change="
  120. pageInfo.curr = 1;
  121. parmValue.page = 1;
  122. searchList();
  123. "
  124. >
  125. <el-option
  126. v-for="item in xs_order_source_options"
  127. :key="'orderstatus' + item.id"
  128. :label="item.label"
  129. :value="item.id"
  130. />
  131. </el-select>
  132. </el-col>
  133. <el-col :span="4" style="width: 151px; padding: 0 0 0 10px">
  134. <el-select
  135. :size="searchSize"
  136. v-model="parmValue.order_type"
  137. filterable
  138. clearable
  139. placeholder="商品类型"
  140. style="width: 100%"
  141. @change="
  142. pageInfo.curr = 1;
  143. parmValue.page = 1;
  144. searchList();
  145. "
  146. >
  147. <el-option
  148. v-for="item in xs_order_type_options"
  149. :key="'orderstatus' + item.id"
  150. :label="item.label"
  151. :value="item.id"
  152. />
  153. </el-select>
  154. </el-col>
  155. <el-col :span="5" style="padding: 0 0 0 10px">
  156. <search-supplier
  157. :size="'mini'"
  158. style="width: 104%"
  159. :value="parmValue.supplierNo"
  160. :names="parmValue.supplierName"
  161. :disabled="false"
  162. :placeholder="'供应商名称'"
  163. :isDetail="true"
  164. :noDisabled="true"
  165. @searchChange="supplierChange"
  166. />
  167. </el-col>
  168. <el-col :span="4" class="fr" style="width: 66px; padding: 0 0 0 10px">
  169. <el-button type="warning" class="fr" :size="searchSize" @click="restSearch">重置</el-button>
  170. </el-col>
  171. </el-row>
  172. <el-row style="padding: 10px 0 0 0">
  173. <el-col :span="6" style="width: 502px;margin-left: 0px;">
  174. <el-input
  175. clearable
  176. placeholder="关键字"
  177. v-model="s_input"
  178. maxlength="40"
  179. :size="searchSize"
  180. class="input-with-select"
  181. >
  182. <el-select
  183. v-model="select"
  184. style="width: 150px"
  185. slot="prepend"
  186. placeholder="关键字类型"
  187. >
  188. <el-option label="销售订单编号" value="orderCode" />
  189. <el-option label="采购单编号" value="cgdNo" />
  190. <el-option label="发货工单编号" value="outChildCode" />
  191. <el-option label="商品成本编号" value="spuCode" />
  192. <el-option label="发货单编号" value="outCode" />
  193. <el-option label="商品上线编号" value="skuCode" />
  194. <el-option label="申请人" value="apply_name" />
  195. </el-select>
  196. <el-button
  197. slot="append"
  198. icon="el-icon-search"
  199. @click="
  200. pageInfo.curr = 1;
  201. parmValue.page = 1;
  202. searchList();
  203. "
  204. ></el-button>
  205. </el-input>
  206. </el-col>
  207. <el-col :span="5">
  208. <el-select
  209. size="mini"
  210. style="width:104%;margin-left: 10px;"
  211. placeholder
  212. v-model="parmValue.IsByMe"
  213. @change="
  214. pageInfo.curr = 1;
  215. parmValue.page = 1;
  216. searchList();
  217. "
  218. >
  219. <el-option label="与我相关" value="0" />
  220. <el-option label="由我执行" value="1" />
  221. </el-select>
  222. </el-col>
  223. <div style="margin-left: 10px; float: right">
  224. <el-button
  225. v-if="powers.includes('090') && !isSupertube"
  226. type="primary"
  227. size="mini"
  228. @click="routeGoto('deliveryWorkOrderSend')"
  229. >批量发货</el-button>
  230. </div>
  231. <!-- v-if="powers.includes('087') && !isSupertube" -->
  232. <div style="float: right">
  233. <el-button type="primary" size="mini" @click="handleExport">发货工单导出</el-button>
  234. </div>
  235. <!-- <el-col :span="4" style="margin-left: 10px;margin-top:10px">
  236. <el-select placeholder="供应商端" clearable size="mini" v-model="parmValue.has_account"
  237. @change="
  238. pageInfo.curr = 1;
  239. parmValue.page = 1;
  240. searchList();
  241. "
  242. >
  243. <el-option value="0" label="未开通" />
  244. <el-option value="1" label="已开通"/>
  245. </el-select>
  246. </el-col>-->
  247. </el-row>
  248. </div>
  249. </template>
  250. <template #status="{ scope }">
  251. <el-tag
  252. :size="tablebtnSize"
  253. :type="scope.row.status == '0' ? 'warning' : ''"
  254. v-text="
  255. (statusOptions.find((item) => item.value == scope.row.status) || {})
  256. .label || '--'
  257. "
  258. ></el-tag>
  259. </template>
  260. <template #use_type="{ scope }">
  261. <el-tag size="mini">
  262. {{
  263. (usetypeOtions.find(({ value }) => value === scope.row.use_type) || {})
  264. .label || "---"
  265. }}
  266. </el-tag>
  267. </template>
  268. <template #has_account="{ scope }">
  269. <el-tag
  270. :size="tablebtnSize"
  271. :type="
  272. (
  273. has_account_list.find(
  274. (item) => item.code == scope.row.has_account + ''
  275. ) || {}
  276. ).type || '--'
  277. "
  278. v-text="
  279. (
  280. has_account_list.find(
  281. (item) => item.code == scope.row.has_account + ''
  282. ) || {}
  283. ).name || '--'
  284. "
  285. ></el-tag>
  286. </template>
  287. <template #order_type="{ scope }">
  288. <el-tag
  289. :size="tablebtnSize"
  290. v-text="
  291. (
  292. xs_order_type_options.find((item) => item.id == scope.row.order_type) ||
  293. {}
  294. ).label || '--'
  295. "
  296. ></el-tag>
  297. </template>
  298. <template #order_source="{ scope }">
  299. <el-tag
  300. :size="tablebtnSize"
  301. v-text="
  302. (
  303. xs_order_source_options.find(
  304. (item) => item.id == scope.row.order_source
  305. ) || {}
  306. ).label || '--'
  307. "
  308. ></el-tag>
  309. </template>
  310. <template #operation="{ scope }">
  311. <el-tooltip
  312. v-if="powers.some((i) => i == '007')"
  313. effect="dark"
  314. content="详情"
  315. placement="top"
  316. >
  317. <i
  318. class="el-icon-view tb-icon"
  319. @click="getRouter('deliveryWorkOrderDetail', scope.row.outChildCode)"
  320. ></i>
  321. </el-tooltip>
  322. </template>
  323. </ex-table>
  324. </div>
  325. <div v-else>
  326. <no-auth></no-auth>
  327. </div>
  328. </div>
  329. </template>
  330. <script>
  331. import mixinPage from "@/mixins/elPaginationHandle";
  332. import resToken from "@/mixins/resToken";
  333. import columns from "./columns";
  334. import asyncRequest from "@/apis/service/sellOut/deliveryWorkOrder";
  335. import { mapGetters } from "vuex";
  336. import urlConfig from "@/apis/url-config";
  337. import {
  338. xs_order_type_options,
  339. xs_order_source_options,
  340. has_account_list,
  341. usetypeOtions
  342. } from "@/assets/js/statusList";
  343. import companyHelper from "@/mixins/companyHelper";
  344. export default {
  345. name: "sellReturn",
  346. mixins: [mixinPage, resToken, companyHelper],
  347. computed: {
  348. ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
  349. powers() {
  350. const tran =
  351. this.$store.getters.btnList.find(
  352. item => item.menu_route == "deliveryWorkOrder"
  353. ) || {};
  354. const { action } = tran ?? {};
  355. return action ?? [];
  356. },
  357. dpowers() {
  358. const tran =
  359. this.$store.getters.btnList.find(
  360. item => item.menu_route == "deliveryWorkOrderDetail"
  361. ) || {};
  362. const { action } = tran ?? {};
  363. return action ?? [];
  364. }
  365. },
  366. data() {
  367. return {
  368. xs_order_type_options,
  369. xs_order_source_options,
  370. has_account_list,
  371. usetypeOtions,
  372. supplierName: "",
  373. fileUrl: urlConfig.baseURL,
  374. select: "outChildCode", //默认选择下拉框
  375. s_input: "", //搜索框内容
  376. select_list: [],
  377. sitem: null,
  378. // 状态
  379. statusOptions: [
  380. { value: "1", label: "待发货" },
  381. { value: "2", label: "发货完成" },
  382. // { value: "3", label: "已收货" },
  383. // { value: "4", label: "已全部收货" },
  384. { value: "5", label: "已取消" }
  385. ],
  386. loading: false,
  387. showModel: false,
  388. isDetail: false,
  389. modelId: 0,
  390. parmValue: {
  391. good_name: "",
  392. IsByMe: "1",
  393. supplierName: "",
  394. supplierNo: "",
  395. customerName: "",
  396. status: "",
  397. has_account: "",
  398. customer_code: [],
  399. returnCode: "", //销售退货code
  400. orderCode: "", //销售订单code
  401. company_name: "",
  402. good_code: "",
  403. skuCode: "",
  404. apply_name: "", //申请人
  405. start: "",
  406. end: "",
  407. status: "", //节点状态
  408. page: 1, // 页码
  409. size: 15, // 每页显示条数
  410. order_type: "",
  411. use_type: "1"
  412. },
  413. tableData: [],
  414. passwordModel: false,
  415. passwordModelId: 0,
  416. isPasswordDetail: false,
  417. // 表格 - 数据
  418. tableData: [],
  419. // 表格 - 参数
  420. table: {
  421. stripe: true,
  422. border: true,
  423. _defaultHeader_: ["setcol"]
  424. },
  425. // 表格 - 分页
  426. pageInfo: {
  427. size: 15,
  428. curr: 1,
  429. total: 0
  430. },
  431. // 表格 - 列参数
  432. columns: columns
  433. };
  434. },
  435. mounted() {
  436. const { back } = this.$route.query;
  437. if (back) {
  438. this.parmValue = JSON.parse(back);
  439. const { page, size } = this.parmValue;
  440. // this.parmValue.start = start || last_start;
  441. // this.parmValue.end = end || last_end;
  442. // if(this.parmValue.companyNo.length>0){
  443. // this.customerCode = [this.parmValue.companyNo] ;
  444. // }
  445. this.pageInfo = {
  446. size: size,
  447. curr: page,
  448. total: 0
  449. };
  450. //多选条件
  451. this.select = this.parmValue.select;
  452. // this.sselect = this.parmValue.sselect;
  453. this.s_input = this.parmValue.s_input;
  454. } else {
  455. this.select = "outChildCode";
  456. // this.sselect = "创建时间"
  457. }
  458. this.searchList();
  459. },
  460. methods: {
  461. async supplierChange(e) {
  462. const { code, label } = e;
  463. this.parmValue.supplierNo = code ? [code] : [];
  464. this.parmValue.supplierName = label;
  465. this.searchList();
  466. },
  467. customer_code_change(e) {
  468. if (e && e.code) {
  469. this.parmValue.customer_code = [e.code];
  470. this.parmValue.customerName = e.label;
  471. } else {
  472. this.parmValue.customer_code = [];
  473. this.parmValue.customerName = "";
  474. }
  475. this.searchList();
  476. },
  477. handleExport() {
  478. if (!this.loading) {
  479. this.loading = true;
  480. let httpType = `application/zip`;
  481. let model = JSON.parse(JSON.stringify(this.parmValue));
  482. delete model["s_input"];
  483. delete model["use_type"];
  484. axios({
  485. method: "post",
  486. url: this.fileUrl + "/admin/child_export",
  487. responseType: "blob",
  488. data: {
  489. ...model,
  490. [this.select]: this.s_input,
  491. customer_code: Array.isArray(this.parmValue.customer_code)
  492. ? this.parmValue.customer_code[0]
  493. : this.parmValue.customer_code,
  494. supplierNo: Array.isArray(this.parmValue.supplierNo)
  495. ? this.parmValue.supplierNo[0]
  496. : this.parmValue.supplierNo,
  497. needRela: true
  498. },
  499. headers: {
  500. Accept: httpType
  501. }
  502. })
  503. .then(res => {
  504. if (res && res.status == 200 && res.data) {
  505. let url = window.URL.createObjectURL(
  506. new Blob([res.data], { type: httpType })
  507. );
  508. let link = document.createElement("a");
  509. link.style.display = "none";
  510. link.href = url;
  511. let excelName = "发货工单.zip";
  512. link.setAttribute("download", excelName);
  513. document.body.appendChild(link);
  514. link.click();
  515. link.remove();
  516. window.URL.revokeObjectURL(url); //释放掉blob对象
  517. this.$message.success(`导出成功!`);
  518. setTimeout(() => {
  519. this.loading = false;
  520. }, 500);
  521. } else {
  522. this.$message.error(res.data.message);
  523. setTimeout(() => {
  524. this.loading = false;
  525. }, 500);
  526. }
  527. })
  528. .catch(error => {
  529. console.log(error);
  530. this.loading = false;
  531. });
  532. }
  533. },
  534. handleSelection(order) {
  535. const { list } = order;
  536. this.select_list = list;
  537. },
  538. getRouter(toRouter, queryId) {
  539. if (toRouter && queryId) {
  540. let model = {
  541. id: queryId
  542. };
  543. //有多选框的条件
  544. this.parmValue.select = this.select;
  545. // this.parmValue.sselect = this.sselect ;
  546. this.parmValue.s_input = this.s_input;
  547. let routerModel = {
  548. options: JSON.parse(JSON.stringify(this.parmValue)),
  549. router: this.$route.path
  550. };
  551. model.preModel = JSON.stringify(routerModel);
  552. this.routeGoto(toRouter, model);
  553. }
  554. },
  555. restSearch() {
  556. this.s_input = ""; //清除输入框内容
  557. this.select = "outChildCode"; //清除下拉框选中项
  558. this.parmValue = {
  559. good_name: "",
  560. IsByMe: "1",
  561. order_type: "",
  562. company_name: "", //申请人部门
  563. good_code: "",
  564. returnCode: "", //销售退货code
  565. orderCode: "", //销售订单code
  566. apply_name: "", //申请人
  567. start: "",
  568. end: "",
  569. status: "", //节点状态
  570. page: 1, // 页码
  571. size: 15, // 每页显示条数
  572. use_type: "1"
  573. };
  574. // 表格 - 分页
  575. this.pageInfo = {
  576. size: 15,
  577. total: 0,
  578. curr: 1
  579. };
  580. this.searchList();
  581. },
  582. openModal(id, isDetail, sitem) {
  583. this.showModel = true;
  584. this.modelId = id;
  585. this.isDetail = isDetail;
  586. this.sitem = sitem;
  587. },
  588. async deleteById(id, status) {
  589. await this.$confirm("确定要删除?", {
  590. confirmButtonText: "确定",
  591. cancelButtonText: "取消",
  592. type: "warning"
  593. })
  594. .then(async () => {
  595. const model = {
  596. id: id,
  597. status: status + "" === "1" ? "0" : "1"
  598. };
  599. const res = await asyncRequest.status(model);
  600. if (res && res.code === 0) {
  601. this.$notify.success({
  602. title: "删除成功",
  603. message: ""
  604. });
  605. this.searchList();
  606. } else if (res && res.code >= 100 && res.code <= 104) {
  607. await this.logout();
  608. } else {
  609. this.$message.warning(res.message);
  610. }
  611. })
  612. .catch(() => {
  613. console.log("取消");
  614. });
  615. },
  616. async searchList() {
  617. if (
  618. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  619. (this.parmValue.start === "" && this.parmValue.end !== "")
  620. ) {
  621. this.$message.warning("时间区间不完整!");
  622. return;
  623. }
  624. this.loading = true;
  625. let { supplierName, customerName, ...model } = JSON.parse(
  626. JSON.stringify(this.parmValue)
  627. );
  628. delete model["s_input"];
  629. delete model["use_type"];
  630. const res = await asyncRequest.list({
  631. ...model,
  632. [this.select]: this.s_input,
  633. customer_code: Array.isArray(this.parmValue.customer_code)
  634. ? this.parmValue.customer_code[0]
  635. : this.parmValue.customer_code,
  636. supplierNo: Array.isArray(this.parmValue.supplierNo)
  637. ? this.parmValue.supplierNo[0]
  638. : this.parmValue.supplierNo,
  639. needRela: true
  640. });
  641. if (res && res.code === 0 && res.data) {
  642. this.tableData = res.data.list;
  643. this.pageInfo.total = Number(res.data.count);
  644. } else if (res && res.code >= 100 && res.code <= 104) {
  645. await this.logout();
  646. } else {
  647. this.tableData = [];
  648. this.pageInfo.total = 0;
  649. }
  650. this.loading = false;
  651. },
  652. //物流公司查询
  653. async handleCompany(e) {
  654. console.log(e, "要求传快递简称,不传id"); //
  655. if (e && e.code) {
  656. this.parmValue.postCompany = [e.shortName];
  657. this.parmValue.page = 1;
  658. }
  659. await this.searchList();
  660. },
  661. company_idsearchChange(e) {
  662. const { code } = e;
  663. this.parmValue.companyNo = code || "";
  664. this.searchList();
  665. },
  666. // 时间
  667. async handleTime(e) {
  668. if (e.startTime !== "") {
  669. this.parmValue.start = e.startTime;
  670. } else {
  671. this.parmValue.start = "";
  672. }
  673. if (e.endTime !== "") {
  674. this.parmValue.end = e.endTime;
  675. } else {
  676. this.parmValue.end = "";
  677. }
  678. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  679. this.parmValue.page = 1;
  680. await this.searchList();
  681. }
  682. }
  683. }
  684. };
  685. </script>
  686. <style lang="scss" scoped>
  687. .sellReturn {
  688. }
  689. </style>