index.vue 22 KB

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