index.vue 21 KB

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