index.vue 23 KB

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