index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div class="refund pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  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. @screen-reset="
  14. pageInfo.curr = 1;
  15. searchList();
  16. "
  17. @screen-submit="
  18. pageInfo.curr = 1;
  19. searchList();
  20. "
  21. >
  22. <template #table-header="{}">
  23. <div style="width: 100%">
  24. <el-row>
  25. <el-col :span="24" style="padding: 0 0 10px 80px">
  26. <el-col :span="12" style="width: 470px">
  27. <el-select
  28. v-model="code"
  29. multiple
  30. filterable
  31. remote
  32. :multiple-limit="1"
  33. reserve-keyword
  34. :size="searchSize"
  35. style="width: 100%"
  36. placeholder="公司名称"
  37. :remote-method="remoteMethod"
  38. :loading="selectLoading"
  39. @change="selectChange"
  40. >
  41. <el-option
  42. v-for="item in activeOptions"
  43. :key="item.companyNo"
  44. :label="item.companyName"
  45. :value="item.companyNo"
  46. />
  47. </el-select>
  48. </el-col>
  49. <el-col
  50. :span="4"
  51. style="width: 66px; float: right"
  52. v-if="powers.some((item) => item == '002')"
  53. >
  54. <el-button
  55. :size="searchSize"
  56. type="primary"
  57. style="float: right"
  58. @click="searchList"
  59. >
  60. 刷新
  61. </el-button>
  62. </el-col>
  63. <el-col
  64. :span="4"
  65. style="width: 66px; float: right"
  66. v-if="powers.some((item) => item == '024')"
  67. >
  68. <el-button
  69. type="warning"
  70. style="float: right"
  71. :size="searchSize"
  72. @click="restSearch"
  73. >
  74. 重置
  75. </el-button>
  76. </el-col>
  77. </el-col>
  78. <el-col :span="24">
  79. <el-col :span="4" style="width: 190px">
  80. <el-select
  81. :size="searchSize"
  82. v-model="parmValue.refund_status"
  83. placeholder="退款状态"
  84. style="width: 100%"
  85. @change="
  86. pageInfo.curr = 1;
  87. parmValue.page = 1;
  88. searchList();
  89. "
  90. >
  91. <el-option
  92. v-for="item in billType"
  93. :key="item.code"
  94. :label="item.name"
  95. :value="item.code"
  96. >
  97. </el-option>
  98. </el-select>
  99. </el-col>
  100. <el-col :span="4" style="width: 290px; padding-left: 10px">
  101. <el-input
  102. :size="searchSize"
  103. placeholder="请输入资金编号"
  104. v-model="parmValue.relaNo"
  105. class="input-with-select"
  106. >
  107. <el-button
  108. slot="append"
  109. @click="searchList"
  110. icon="el-icon-search"
  111. ></el-button>
  112. </el-input>
  113. </el-col>
  114. <el-col
  115. :span="4"
  116. style="width: 80px; float: right"
  117. v-if="powers.some((item) => item == '003')"
  118. >
  119. <el-button
  120. type="success"
  121. :size="searchSize"
  122. style="float: right"
  123. @click="openModal('add', '003')"
  124. >
  125. 添加
  126. </el-button>
  127. </el-col>
  128. </el-col>
  129. </el-row>
  130. </div>
  131. </template>
  132. <template #refund_status="{ scope }">
  133. <el-tag
  134. :type="
  135. scope.row.refund_status == '4'
  136. ? 'success'
  137. : scope.row.refund_status == '5' || scope.row.refund_status == '6'
  138. ? 'danger'
  139. : 'warning'
  140. "
  141. size="mini"
  142. v-text="
  143. (
  144. billType.find((item) => item.code == scope.row.refund_status) ||
  145. {}
  146. ).name || '--'
  147. "
  148. ></el-tag>
  149. </template>
  150. <template #operation="{ scope }">
  151. <el-tooltip
  152. v-if="
  153. powers.some((item) => item == '028') &&
  154. scope.row.refund_status === '1'
  155. "
  156. class="item"
  157. effect="dark"
  158. content="业务审核"
  159. placement="top"
  160. >
  161. <i
  162. class="el-icon-finished tb-icon"
  163. @click="
  164. openModal(scope.row.refundNo, '028', scope.row.refund_status)
  165. "
  166. ></i>
  167. </el-tooltip>
  168. <el-tooltip
  169. v-if="
  170. powers.some((item) => item == '029') &&
  171. scope.row.refund_status === '2'
  172. "
  173. class="item"
  174. effect="dark"
  175. content="财务审核"
  176. placement="top"
  177. >
  178. <i
  179. class="el-icon-finished tb-icon"
  180. @click="
  181. openModal(scope.row.refundNo, '029', scope.row.refund_status)
  182. "
  183. ></i>
  184. </el-tooltip>
  185. <el-tooltip
  186. v-if="
  187. (powers.some((item) => item == '027') &&
  188. scope.row.refund_status !== '3') &&
  189. (scope.row.refund_status !== '4')
  190. "
  191. class="item"
  192. effect="dark"
  193. content="取消申请"
  194. placement="top"
  195. >
  196. <i
  197. class="el-icon-error tb-icon"
  198. @click="changeStatus(scope.row.refundNo)"
  199. ></i>
  200. </el-tooltip>
  201. </template>
  202. </ex-table>
  203. <no-auth v-else></no-auth>
  204. <!-- 新建 /详情 /审核-->
  205. <add-edit
  206. :id="modelId"
  207. :show-model="showModel"
  208. :is-detail="isDetail"
  209. :dstatus="dstatus"
  210. @refresh="searchList"
  211. @cancel="showModel = false"
  212. />
  213. </div>
  214. </template>
  215. <script>
  216. import ExTable from "@/components/ExTableNew.vue";
  217. import addEdit from "./addEdit";
  218. import asyncRequest from "@/apis/service/InvoiceSales/refund";
  219. import mixinPage from "@/mixins/elPaginationHandle";
  220. import { mapGetters } from "vuex";
  221. import resToken from "@/mixins/resToken";
  222. import urlConfig from "@/apis/url-config";
  223. export default {
  224. name: "refund",
  225. mixins: [mixinPage, resToken],
  226. components: {
  227. ExTable,
  228. addEdit,
  229. },
  230. computed: {
  231. //组件SIZE设置
  232. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  233. powers() {
  234. let tran =
  235. this.$store.getters.btnList.find(
  236. (item) => item.menu_route == "refund"
  237. ) || {};
  238. if (tran && tran.action && tran.action.length > 0) {
  239. return tran.action;
  240. } else {
  241. return [];
  242. }
  243. },
  244. },
  245. data() {
  246. return {
  247. showModel: false,
  248. isDetail: false,
  249. selection: [],
  250. invNo: "0",
  251. dstatus: "0",
  252. modelId: 0,
  253. selectLoading: false,
  254. billType: [
  255. {
  256. code: "1",
  257. name: "待业务审核",
  258. },
  259. {
  260. code: "2",
  261. name: "待财务审核",
  262. },
  263. {
  264. code: "3",
  265. name: "待资金认领完成",
  266. },
  267. {
  268. code: "4",
  269. name: "退款已完成",
  270. },
  271. {
  272. code: "5",
  273. name: "业务已驳回",
  274. },
  275. {
  276. code: "6",
  277. name: "财务已驳回",
  278. },
  279. ],
  280. activeOptions: [],
  281. name: "",
  282. downLoading: false,
  283. code: [],
  284. loading: true,
  285. formValue: {
  286. company: "", // 账户
  287. page: 1, // 页码
  288. size: 100, // 每页显示条数
  289. },
  290. fileUrl:
  291. urlConfig.baseURL +
  292. "%E5%8F%91%E7%A5%A8%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xls",
  293. parmValue: {
  294. companyNo: "",
  295. type: "1",
  296. page: 1, // 页码
  297. size: 15, // 每页显示条数
  298. relaNo: "",
  299. inv_type: "",
  300. back_type: "",
  301. refund_status: "",
  302. },
  303. // 表格 - 数据
  304. tableData: [],
  305. // 表格 - 参数
  306. table: {
  307. stripe: true,
  308. border: true,
  309. _defaultHeader_: ["setcol"],
  310. },
  311. // 表格 - 分页
  312. pageInfo: {
  313. size: 15,
  314. curr: 1,
  315. total: 0,
  316. },
  317. // 表格 - 列参数
  318. columns: [
  319. {
  320. prop: "refundNo",
  321. label: "退款编号",
  322. width: "180px",
  323. fixed: "left",
  324. },
  325. {
  326. prop: "traNo",
  327. label: "原资金编号",
  328. width: "180px",
  329. },
  330. {
  331. prop: "customerNo",
  332. label: "客户企业编码",
  333. width: "130px",
  334. },
  335. {
  336. prop: "customer",
  337. label: "客户企业名称",
  338. "min-width": "180px",
  339. },
  340. {
  341. prop: "refund_fee",
  342. label: "退款总额度",
  343. width: "120px",
  344. },
  345. {
  346. prop: "back_fee",
  347. label: "退款认领额度",
  348. width: "120px",
  349. },
  350. {
  351. prop: "apply_name",
  352. label: "申请人",
  353. width: "85px",
  354. },
  355. {
  356. prop: "refund_status",
  357. label: "退款状态",
  358. _slot_: "refund_status",
  359. width: "120px",
  360. },
  361. {
  362. prop: "addtime",
  363. label: "申请时间",
  364. sortable: true,
  365. width: "150px",
  366. },
  367. {
  368. prop: "",
  369. label: "操作",
  370. fixed: "right",
  371. _noset_: true,
  372. _slot_: "operation",
  373. },
  374. ],
  375. };
  376. },
  377. mounted() {
  378. this.searchList();
  379. },
  380. methods: {
  381. async selectChange() {
  382. let arr = JSON.parse(JSON.stringify(this.code));
  383. this.parmValue.companyNo = arr.join(",");
  384. this.parmValue.page = 1;
  385. await this.searchList();
  386. },
  387. restSearch() {
  388. // 表格 - 分页
  389. this.pageInfo = {
  390. size: 15,
  391. curr: 1,
  392. total: 0,
  393. };
  394. this.parmValue = {
  395. companyNo: "",
  396. type: "1",
  397. page: 1, // 页码
  398. size: 15, // 每页显示条数
  399. relaNo: "",
  400. inv_type: "",
  401. back_type: "",
  402. refund_status: "",
  403. };
  404. this.searchList();
  405. },
  406. // 新建/编辑/详情
  407. openModal(id, isDetail, status) {
  408. this.modelId = id;
  409. this.dstatus = status;
  410. console.log(this.dstatus);
  411. this.isDetail = isDetail;
  412. this.showModel = true;
  413. },
  414. /**
  415. * 取消申请
  416. * @param {String} refundNo refundNo
  417. */
  418. async changeStatus(refundNo) {
  419. await this.$confirm(`确定要取消申请?`, {
  420. confirmButtonText: "确定",
  421. cancelButtonText: "取消",
  422. type: "warning",
  423. })
  424. .then(async () => {
  425. const model = {
  426. refundNo: refundNo,
  427. };
  428. const res = await asyncRequest.delete(model);
  429. if (res && res.code === 0) {
  430. this.$notify.success({
  431. title: "申请取消成功",
  432. message: "",
  433. });
  434. this.searchList();
  435. } else if (res && res.code >= 100 && res.code <= 104) {
  436. await this.logout();
  437. } else {
  438. this.$message.warning(res.message);
  439. }
  440. })
  441. .catch(() => {
  442. console.log("取消");
  443. });
  444. },
  445. // 刷新表格
  446. async searchList() {
  447. this.loading = true;
  448. const res = await asyncRequest.list(this.parmValue);
  449. if (res && res.code === 0 && res.data) {
  450. this.tableData = res.data.list;
  451. this.pageInfo.total = Number(res.data.count);
  452. } else if (res && res.code >= 100 && res.code <= 104) {
  453. await this.logout();
  454. } else {
  455. this.tableData = [];
  456. this.pageInfo.total = 0;
  457. }
  458. this.loading = false;
  459. },
  460. async remoteMethod(query) {
  461. this.selectLoading = true;
  462. if (query !== "") {
  463. this.activeOptions = [];
  464. this.formValue.company = query;
  465. const res = await asyncRequest.clist(this.formValue);
  466. if (res && res.code === 0 && res.data && res.data.list) {
  467. this.activeOptions = res.data.list;
  468. } else if (res && res.code >= 100 && res.code <= 104) {
  469. await this.logout();
  470. } else {
  471. this.$message.warning(res.message);
  472. }
  473. } else {
  474. this.activeOptions = [];
  475. }
  476. this.selectLoading = false;
  477. },
  478. },
  479. };
  480. </script>
  481. <style lang="scss" scoped>
  482. </style>