index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <div class="capitalClaim pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <el-row :gutter="10" style="padding-bottom: 10px">
  7. <el-col :span="8" style="width: 440px">
  8. <el-select
  9. v-model="code"
  10. multiple
  11. filterable
  12. :size="searchSize"
  13. remote
  14. style="width: 100%"
  15. :multiple-limit="1"
  16. reserve-keyword
  17. placeholder="认领公司名称"
  18. :remote-method="remoteMethod"
  19. :loading="selectLoading"
  20. class="setWidth"
  21. >
  22. <el-option
  23. v-for="item in activeOptions"
  24. :key="item.companyNo"
  25. :label="item.companyName"
  26. :value="item.companyNo"
  27. />
  28. </el-select>
  29. </el-col>
  30. <el-col :span="8" style="width: 312px">
  31. <el-input :size="searchSize" v-model="input" placeholder="关键字">
  32. <el-select
  33. style="width: 103px"
  34. v-model="select"
  35. slot="prepend"
  36. placeholder="请选择"
  37. >
  38. <el-option label="资金编码" value="1"></el-option>
  39. <el-option label="付款方" value="2"></el-option>
  40. </el-select>
  41. <!-- <el-button
  42. slot="append"
  43. icon="el-icon-search"
  44. @click="searchList"
  45. ></el-button> -->
  46. </el-input>
  47. </el-col>
  48. <el-col :span="3" style="width: 216px" class="fr tr">
  49. <el-button
  50. v-if="powers.some((item) => item == '023')"
  51. :size="searchSize"
  52. type="primary"
  53. :disabled="downLoading"
  54. @click="dlTemplate"
  55. >
  56. 下载模板
  57. </el-button>
  58. <el-button
  59. v-if="powers.some((item) => item == '038')"
  60. :size="searchSize"
  61. type="primary"
  62. @click="importshowModel = true"
  63. >
  64. 导入数据
  65. </el-button>
  66. </el-col>
  67. </el-row>
  68. <el-row :gutter="10" style="padding-bottom: 10px">
  69. <el-col :span="7" style="width: 138px">
  70. <el-select
  71. style="width: 100%"
  72. :size="searchSize"
  73. v-model="parmValue.status"
  74. clearable
  75. placeholder="认领状态"
  76. @change="
  77. pageInfo.curr = 1;
  78. parmValue.page = 1;
  79. searchList();
  80. "
  81. >
  82. <el-option
  83. v-for="item in capitalFlowType"
  84. :key="item.code"
  85. :label="item.name"
  86. :value="item.code"
  87. >
  88. </el-option>
  89. </el-select>
  90. </el-col>
  91. <el-col :span="6" style="width: 302px">
  92. <period-date-picker
  93. :start="parmValue.start"
  94. :end="parmValue.end"
  95. :type="1"
  96. :width="'135px'"
  97. :size="searchSize"
  98. @timeReturned="timeReturned($event)"
  99. />
  100. </el-col>
  101. <el-col :span="6" style="width: 302px">
  102. <number-range
  103. :start="parmValue.total_low"
  104. :end="parmValue.total_up"
  105. :type="1"
  106. :width="'135px'"
  107. :title="'资金总额'"
  108. :size="searchSize"
  109. @numReturned="numReturned($event, 0)"
  110. />
  111. </el-col>
  112. <el-col :span="4" style="width: 226px" class="fr tr">
  113. <el-button
  114. type="primary"
  115. :size="searchSize"
  116. icon="el-icon-search"
  117. @click="searchList"
  118. />
  119. <el-button
  120. type="warning"
  121. v-if="powers.some((item) => item == '024')"
  122. :size="searchSize"
  123. @click="restSearch"
  124. >
  125. 重置
  126. </el-button>
  127. <el-button
  128. v-if="powers.some((item) => item == '002')"
  129. :size="searchSize"
  130. type="primary"
  131. @click="searchList"
  132. >
  133. 刷新
  134. </el-button>
  135. </el-col>
  136. </el-row>
  137. <el-table
  138. :data="tableData"
  139. v-loading="loading"
  140. border
  141. :size="size"
  142. row-key="traNo"
  143. stripe
  144. style="width: 100%"
  145. :default-expand-all="false"
  146. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  147. >
  148. <el-table-column
  149. label="资金编号"
  150. prop="traNo"
  151. width="220px"
  152. fixed="left"
  153. />
  154. <el-table-column label="收入/支出" prop="trade_type" width="80px">
  155. <template slot-scope="scope">
  156. <el-tag
  157. :type="scope.row.trade_type === '0' ? 'success' : 'warning'"
  158. size="mini"
  159. v-text="scope.row.trade_type === '0' ? '收入' : '支出'"
  160. ></el-tag>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="认领状态" prop="status" width="90px">
  164. <template slot-scope="scope">
  165. <el-tag
  166. :type="scope.row.status_type"
  167. size="mini"
  168. v-text="scope.row.statusName"
  169. ></el-tag>
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="认领企业编码" prop="companyNo" width="130px" />
  173. <el-table-column
  174. label="认领企业"
  175. show-overflow-tooltip
  176. prop="companyName"
  177. min-width="170px"
  178. />
  179. <el-table-column label="记录总金额" prop="total_fee" width="120px" />
  180. <el-table-column label="已认领金额" prop="amount" width="120px" />
  181. <el-table-column
  182. label="对方公司"
  183. prop="trade_out"
  184. show-overflow-tooltip
  185. min-width="170px"
  186. />
  187. <el-table-column
  188. label="对方账号"
  189. prop="trade_account"
  190. show-overflow-tooltip
  191. width="170px"
  192. />
  193. <el-table-column
  194. label="付款备注"
  195. show-overflow-tooltip
  196. prop="trade_used"
  197. width="180px"
  198. />
  199. <el-table-column
  200. label="驳回原因"
  201. show-overflow-tooltip
  202. prop="exam_remark"
  203. width="180px"
  204. />
  205. <el-table-column label="交易时间" prop="trade_time" width="145px" />
  206. <el-table-column fixed="right" label="操作" width="85px">
  207. <template slot-scope="scope">
  208. <el-tooltip
  209. v-if="
  210. (powers.some((item) => item == '039') &&
  211. scope.row.logNo === scope.row.traNo &&
  212. scope.row.status === '1' &&
  213. parseInt(scope.row.balance) !== 0) ||
  214. (powers.some((item) => item == '039') &&
  215. scope.row.logNo === scope.row.traNo &&
  216. scope.row.status === '6' &&
  217. parseInt(scope.row.balance) !== 0)
  218. "
  219. effect="dark"
  220. content="资金认领"
  221. placement="top"
  222. >
  223. <i
  224. class="el-icon-s-flag tb-icon"
  225. @click="
  226. openModal(
  227. scope.row.id,
  228. scope.row.traNo,
  229. '039',
  230. scope.row.exam_remark,
  231. scope.row.status,
  232. scope.row.trade_type
  233. )
  234. "
  235. ></i>
  236. </el-tooltip>
  237. <el-tooltip
  238. v-if="
  239. powers.some((item) => item == '040') &&
  240. scope.row.logNo !== scope.row.traNo &&
  241. scope.row.status === '2'
  242. "
  243. effect="dark"
  244. content="认领审核"
  245. placement="top"
  246. >
  247. <i
  248. class="el-icon-s-check tb-icon"
  249. @click="
  250. openModal(
  251. scope.row.id,
  252. scope.row.traNo,
  253. '040',
  254. scope.row.exam_remark,
  255. scope.row.status
  256. )
  257. "
  258. ></i>
  259. </el-tooltip>
  260. <el-tooltip
  261. v-if="
  262. (powers.some((item) => item == '040') &&
  263. scope.row.logNo !== scope.row.traNo &&
  264. scope.row.status === '2') ||
  265. (powers.some((item) => item == '040') &&
  266. scope.row.logNo !== scope.row.traNo &&
  267. scope.row.status === '4')
  268. "
  269. effect="dark"
  270. content="取消认领申请"
  271. placement="top"
  272. >
  273. <i
  274. class="el-icon-error tb-icon"
  275. @click="changeStatus(scope.row.traNo)"
  276. ></i>
  277. </el-tooltip>
  278. </template>
  279. </el-table-column>
  280. </el-table>
  281. <div
  282. class="Pagination"
  283. style="text-align: right; margin-top: 10px"
  284. v-show="count > 0"
  285. >
  286. <el-pagination
  287. :size="searchSize"
  288. @size-change="handleSizeChange"
  289. @current-change="handlePageChange"
  290. :current-page="parmValue.page"
  291. :page-sizes="[15, 50, 100]"
  292. :page-size="parmValue.size"
  293. layout="total, sizes, prev, pager, next, jumper"
  294. :total="count"
  295. ></el-pagination>
  296. </div>
  297. </div>
  298. <no-auth v-else></no-auth>
  299. <add-edit
  300. :show-model="importshowModel"
  301. @refresh="searchList"
  302. @cancel="importshowModel = false"
  303. />
  304. <add-edit1
  305. :id="modelId"
  306. :show-model="showModel"
  307. :is-detail="isDetail"
  308. :logNo="logNo"
  309. :exam_remark="exam_remark"
  310. :status="status"
  311. :trade_type="trade_type"
  312. @refresh="searchList"
  313. @cancel="showModel = false"
  314. />
  315. </div>
  316. </template>
  317. <script>
  318. import addEdit from "./addEdit";
  319. import addEdit1 from "./addEdit1";
  320. import asyncRequest from "@/apis/service/InvoiceSales/capitalClaim";
  321. import urlConfig from "@/apis/url-config";
  322. import mixinPage from "@/mixins/elPaginationHandle";
  323. import { mapGetters } from "vuex";
  324. import PeriodDatePicker from "@/components/PeriodDatePicker";
  325. import numberRange from "@/components/numberRange";
  326. import { invoiceType, orderType, capitalFlowType } from "@/assets/js/linkType";
  327. import { timestampToTime } from "@/utils/validate";
  328. import resToken from "@/mixins/resToken";
  329. export default {
  330. name: "capitalClaim",
  331. mixins: [mixinPage, resToken],
  332. components: {
  333. addEdit,
  334. PeriodDatePicker,
  335. numberRange,
  336. addEdit1,
  337. },
  338. computed: {
  339. //组件SIZE设置
  340. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  341. powers() {
  342. let tran =
  343. this.$store.getters.btnList.find(
  344. (item) => item.menu_route == "capitalClaim"
  345. ) || {};
  346. if (tran && tran.action && tran.action.length > 0) {
  347. return tran.action;
  348. } else {
  349. return [];
  350. }
  351. },
  352. },
  353. data() {
  354. return {
  355. select: "1",
  356. sname: "",
  357. stype: "",
  358. input: "",
  359. timer: false,
  360. logNo: "",
  361. status: "",
  362. trade_type: "",
  363. exam_remark: "",
  364. importshowModel: false,
  365. fileUrl: urlConfig.baseURL + "%E8%B5%84%E9%87%91%E6%A8%A1%E6%9D%BF.xls",
  366. invoiceType: invoiceType,
  367. orderType: orderType,
  368. capitalFlowType: capitalFlowType,
  369. downLoading: false,
  370. code: [],
  371. selectLoading: false,
  372. activeOptions: [],
  373. name: "",
  374. contector: "",
  375. loading: false,
  376. showModel: false,
  377. isDetail: false,
  378. modelId: 0,
  379. parmValue: {
  380. companyNo: "",
  381. name: "",
  382. logNo: "", //
  383. total_low: "", //
  384. total_up: "", //
  385. start: "",
  386. end: "",
  387. status: "", //
  388. page: 1, // 页码
  389. size: 15, // 每页显示条数
  390. },
  391. // 表格 - 数据
  392. tableData: [],
  393. count: 0, // 总条数
  394. };
  395. },
  396. mounted() {
  397. this.searchList();
  398. },
  399. methods: {
  400. restSearch() {
  401. this.code = [];
  402. // 表格 - 分页
  403. this.pageInfo = {
  404. size: 15,
  405. curr: 1,
  406. total: 0,
  407. };
  408. this.parmValue = {
  409. companyNo: "",
  410. total_low: "", //
  411. total_up: "", //
  412. name: "",
  413. start: "",
  414. end: "",
  415. logNo: "", //
  416. status: "", //
  417. page: 1, // 页码
  418. size: 15, // 每页显示条数
  419. };
  420. this.searchList();
  421. },
  422. // 新建/编辑/详情
  423. openModal(id, logNo, isDetail, exam_remark, status, trade_type) {
  424. console.log(trade_type);
  425. this.logNo = logNo;
  426. this.modelId = id;
  427. this.exam_remark = exam_remark;
  428. this.isDetail = isDetail;
  429. this.status = status;
  430. this.trade_type = trade_type ? trade_type : "";
  431. console.log(this.trade_type);
  432. this.showModel = true;
  433. },
  434. async timeReturned(e) {
  435. if (e.startTime !== "") {
  436. this.parmValue.start = e.startTime;
  437. } else {
  438. this.parmValue.start = "";
  439. }
  440. if (e.endTime !== "") {
  441. this.parmValue.end = e.endTime;
  442. } else {
  443. this.parmValue.end = "";
  444. }
  445. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  446. this.parmValue.page = 1;
  447. await this.searchList();
  448. }
  449. },
  450. numReturned(e, type) {
  451. if (type === 0) {
  452. this.parmValue.total_low = e.lower; //最小金额
  453. this.parmValue.total_up = e.online; //最大金额
  454. } else if (type === 1) {
  455. this.parmValue.pay_low = e.lower; //最小金额
  456. this.parmValue.pay_up = e.online; //最大金额
  457. } else {
  458. this.parmValue.inv_low = e.lower; //最小金额
  459. this.parmValue.inv_up = e.online; //最大金额
  460. }
  461. },
  462. /**
  463. * 取消资金认领
  464. * @param {String} id id
  465. */
  466. async changeStatus(id) {
  467. await this.$confirm(`确定要取消认领申请?`, {
  468. confirmButtonText: "确定",
  469. cancelButtonText: "取消",
  470. type: "warning",
  471. })
  472. .then(async () => {
  473. const model = {
  474. traNo: id,
  475. };
  476. const res = await asyncRequest.delete(model);
  477. if (res && res.code === 0) {
  478. this.$notify.success({
  479. title: "取消认领申请成功!",
  480. message: "",
  481. });
  482. this.searchList();
  483. } else if (res && res.code >= 100 && res.code <= 104) {
  484. await this.logout();
  485. } else {
  486. this.$message.warning(res.message);
  487. }
  488. })
  489. .catch(() => {
  490. console.log("取消");
  491. });
  492. },
  493. // 刷新表格
  494. async searchList() {
  495. if (
  496. (this.parmValue.total_low !== "" && this.parmValue.total_up === "") ||
  497. (this.parmValue.total_low === "" && this.parmValue.total_up !== "")
  498. ) {
  499. this.$message.warning("资金总额区间有误!");
  500. return;
  501. }
  502. if (this.select === "1") {
  503. this.parmValue.logNo = this.input;
  504. this.parmValue.name = "";
  505. } else {
  506. this.parmValue.logNo = "";
  507. this.parmValue.name = this.input;
  508. }
  509. this.parmValue.companyNo = this.code.join(",");
  510. this.loading = true;
  511. const res = await asyncRequest.list(this.parmValue);
  512. if (res && res.code === 0 && res.data) {
  513. this.tableData = [];
  514. let list = res.data.list;
  515. list.forEach((v1) => {
  516. let item = {
  517. children: [],
  518. };
  519. if (v1.trade && v1.trade.length === 1 && v1.is_all === "1") {
  520. item = Object.assign(item, v1.trade[0]);
  521. this.setType(item.status);
  522. item.statusName = this.sname;
  523. item.status_type = this.stype;
  524. item.amount = item.total_fee;
  525. item.trade_account = v1.trade_account;
  526. item.trade_out = v1.trade_out;
  527. item.trade_used = v1.trade_used;
  528. item.trade_type = v1.trade_type;
  529. } else if (
  530. (v1.trade && v1.trade.length > 1) ||
  531. (v1.trade && v1.trade.length === 1 && v1.is_all !== "1")
  532. ) {
  533. item = Object.assign(item, v1);
  534. item.status = item.is_all === "1" ? "5" : "6";
  535. this.setType(item.status);
  536. item.statusName = this.sname;
  537. item.traNo = item.logNo;
  538. item.status_type = this.stype;
  539. v1.trade.forEach((v2) => {
  540. this.setType(v2.status);
  541. v2.statusName = this.sname;
  542. v2.status_type = this.stype;
  543. v2.amount = v2.total_fee;
  544. v2.trade_account = v1.trade_account;
  545. v2.trade_out = v1.trade_out;
  546. v2.trade_used = v1.trade_used;
  547. v2.trade_type = v1.trade_type;
  548. let child = Object.assign({}, v2);
  549. item.children.push(child);
  550. });
  551. } else {
  552. item = v1;
  553. item.traNo = item.logNo;
  554. this.setType(item.status);
  555. item.statusName = this.sname;
  556. item.status_type = this.stype;
  557. }
  558. // console.log(item);
  559. this.tableData.push(item);
  560. });
  561. console.log(this.tableData);
  562. this.count = Number(res.data.count);
  563. // this.pageInfo.total = Number(res.data.count);
  564. } else if (res && res.code >= 100 && res.code <= 104) {
  565. await this.logout();
  566. } else {
  567. this.tableData = [];
  568. this.count = 0;
  569. }
  570. this.loading = false;
  571. },
  572. setType(status) {
  573. this.sname, (this.stype = "");
  574. switch (status) {
  575. case "1":
  576. this.sname = "未认领";
  577. this.stype = "warning";
  578. break;
  579. case "2":
  580. this.sname = "待审核";
  581. this.stype = "";
  582. break;
  583. case "3":
  584. this.sname = "认领成功";
  585. this.stype = "success";
  586. break;
  587. case "4":
  588. this.sname = "审核驳回";
  589. this.stype = "danger";
  590. break;
  591. case "5":
  592. this.sname = "全部认领";
  593. this.stype = "success";
  594. break;
  595. case "6":
  596. this.sname = "部分认领";
  597. this.stype = "warning";
  598. break;
  599. default:
  600. this.sname = "";
  601. this.stype = "";
  602. break;
  603. }
  604. },
  605. async remoteMethod(query) {
  606. this.selectLoading = true;
  607. if (query !== "") {
  608. this.activeOptions = [];
  609. const res = await asyncRequest.clist({
  610. page: 1,
  611. size: 100,
  612. company: query,
  613. });
  614. if (res && res.code === 0 && res.data && res.data.list) {
  615. this.activeOptions = res.data.list;
  616. } else if (res && res.code >= 100 && res.code <= 104) {
  617. await this.logout();
  618. } else {
  619. this.$message.warning(res.message);
  620. }
  621. } else {
  622. this.activeOptions = [];
  623. }
  624. this.selectLoading = false;
  625. },
  626. async dlTemplate() {
  627. if (!this.downLoading) {
  628. this.downLoading = true;
  629. let elemIF = document.createElement("iframe");
  630. elemIF.src =
  631. this.fileUrl + "?time=" + timestampToTime(new Date().valueOf());
  632. elemIF.style.display = "none";
  633. document.body.appendChild(elemIF);
  634. this.$message.success(`资金模板下载成功!`);
  635. setTimeout(() => {
  636. this.downLoading = false;
  637. }, 500);
  638. }
  639. },
  640. },
  641. };
  642. </script>
  643. <style lang="scss" scoped>
  644. </style>