index.vue 20 KB

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