standbook_list.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. <template>
  2. <div class="app-container">
  3. <span>台账</span>
  4. <el-divider></el-divider>
  5. <!-- <el-radio-group v-model="mainId" size="">
  6. <el-radio-button
  7. v-for="(v, i) in dictList"
  8. :key="i"
  9. :label="v.dictCode"
  10. >{{ v.dictValue }}</el-radio-button
  11. >
  12. </el-radio-group>
  13. <br /><br /> -->
  14. <el-radio-group v-model="bill" @change="checkFn" size="">
  15. <el-radio-button label="COMMONLY">货款台账</el-radio-button>
  16. <el-radio-button label="REBATE">返利台账</el-radio-button>
  17. </el-radio-group>
  18. <h1></h1>
  19. <!-- 筛选条件 -->
  20. <div>
  21. <el-form
  22. ref="searchForm"
  23. :model="searchForm"
  24. label-width="100px"
  25. size="small"
  26. label-position="left"
  27. >
  28. <el-row :gutter="20">
  29. <el-col :xs="24" :sm="12" :lg="6">
  30. <el-form-item label="经销商名称" prop="customerId">
  31. <el-select
  32. :disabled="isDisabled"
  33. class="selectStyle"
  34. v-model="searchForm.customerId"
  35. placeholder="请选择"
  36. filterable
  37. @change="changeFn"
  38. >
  39. <el-option
  40. v-for="(v, i) in customerList"
  41. :key="i"
  42. :label="v.name"
  43. :value="v.id"
  44. >
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="钱包" prop="customerWalletId">
  51. <el-select
  52. class="selectStyle"
  53. v-model="searchForm.customerWalletId"
  54. placeholder="请选择"
  55. filterable
  56. >
  57. <el-option
  58. v-for="(v, i) in walletList"
  59. :key="i"
  60. :label="v.customerWalletName"
  61. :value="v.customerWalletId"
  62. >
  63. </el-option>
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="6">
  68. <el-form-item label="单据号" prop="billNo">
  69. <el-input
  70. v-model="searchForm.billNo"
  71. placeholder="请输入"
  72. ></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :xs="24" :sm="12" :lg="6">
  76. <el-form-item label="开始时间" prop="startTime">
  77. <el-date-picker
  78. class="selectStyle"
  79. v-model="searchForm.startTime"
  80. type="date"
  81. placeholder="选择日期时间"
  82. value-format="yyyy-MM-dd"
  83. >
  84. </el-date-picker>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :xs="24" :sm="12" :lg="6">
  88. <el-form-item label="结束时间" prop="endTime">
  89. <el-date-picker
  90. class="selectStyle"
  91. v-model="searchForm.endTime"
  92. type="date"
  93. placeholder="选择日期时间"
  94. value-format="yyyy-MM-dd"
  95. >
  96. </el-date-picker>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :xs="24" :sm="12" :lg="18">
  100. <el-form-item label="" class="fr">
  101. <el-button size="small" @click="resetFn">清空</el-button>
  102. <el-button size="small" type="primary" @click="searchFn"
  103. >搜索</el-button
  104. >
  105. </el-form-item>
  106. </el-col>
  107. </el-row>
  108. </el-form>
  109. </div>
  110. <!-- 按钮 -->
  111. <div class="btn-group clearfix">
  112. <div class="fr">
  113. <ExportButton
  114. :exUrl="'/finance/standing/book/export'"
  115. :exParams="exParams"
  116. />
  117. </div>
  118. </div>
  119. <div v-show="bill == 'COMMONLY'">
  120. <ul class="ulStyle">
  121. <li>
  122. 预付货款:<span>{{ amountList.preCount }}</span>
  123. </li>
  124. <li>
  125. 订单占款:<span>{{ amountList.orderCOunt }}</span>
  126. </li>
  127. <li>
  128. 支付货款:<span>{{ amountList.payCount }}</span>
  129. </li>
  130. <li>
  131. 押金:<span>{{ amountList.orderDate }}</span>
  132. </li>
  133. <li>
  134. 工程保证金:<span>{{ amountList.projectCount }}</span>
  135. </li>
  136. <li>
  137. 其他暂扣款:<span>{{ amountList.otherCount }}</span>
  138. </li>
  139. </ul>
  140. <!-- 列表 -->
  141. <div class="mymain-container">
  142. <div class="table">
  143. <el-table
  144. v-loading="listLoading"
  145. :data="dataList"
  146. element-loading-text="Loading"
  147. border
  148. fit
  149. highlight-current-row
  150. stripe
  151. show-summary
  152. :summary-method="getSummaries"
  153. >
  154. <el-table-column
  155. label="序号"
  156. align="center"
  157. width="100"
  158. type="index"
  159. show-overflow-tooltip
  160. ></el-table-column>
  161. <el-table-column
  162. align="center"
  163. label="单据日期"
  164. prop="theTime"
  165. min-width="160"
  166. show-overflow-tooltip
  167. ></el-table-column>
  168. <el-table-column
  169. align="center"
  170. label="单据类型"
  171. prop="billType"
  172. min-width="160"
  173. show-overflow-tooltip
  174. ></el-table-column>
  175. <el-table-column
  176. align="center"
  177. label="单据号"
  178. prop="billNo"
  179. min-width="160"
  180. show-overflow-tooltip
  181. ></el-table-column>
  182. <el-table-column
  183. align="center"
  184. label="钱包"
  185. prop="walletName"
  186. min-width="160"
  187. show-overflow-tooltip
  188. ></el-table-column>
  189. <el-table-column
  190. align="center"
  191. label="摘要"
  192. prop="remark"
  193. min-width="160"
  194. show-overflow-tooltip
  195. ></el-table-column>
  196. <el-table-column
  197. align="right"
  198. label="预付货款"
  199. prop="flag"
  200. min-width="160"
  201. show-overflow-tooltip
  202. >
  203. <template slot-scope="scope">
  204. {{
  205. scope.row.flag == 1
  206. ? scope.row.amountType == "IN"
  207. ? scope.row.amount
  208. : scope.row.amountType == "OUT"
  209. ? -scope.row.amount
  210. : ""
  211. : "-" | numToFixed
  212. }}
  213. </template>
  214. </el-table-column>
  215. <el-table-column
  216. align="right"
  217. label="订单占款"
  218. prop="flag"
  219. min-width="160"
  220. show-overflow-tooltip
  221. >
  222. <template slot-scope="scope">
  223. {{
  224. scope.row.flag == 2
  225. ? scope.row.amountType == "IN"
  226. ? scope.row.amount
  227. : scope.row.amountType == "OUT"
  228. ? -scope.row.amount
  229. : ""
  230. : "-" | numToFixed
  231. }}
  232. </template>
  233. </el-table-column>
  234. <el-table-column
  235. align="right"
  236. label="支付货款"
  237. prop="flag"
  238. min-width="160"
  239. show-overflow-tooltip
  240. >
  241. <template slot-scope="scope">
  242. {{
  243. scope.row.flag == 3
  244. ? scope.row.amountType == "IN"
  245. ? scope.row.amount
  246. : scope.row.amountType == "OUT"
  247. ? -scope.row.amount
  248. : ""
  249. : "-" | numToFixed
  250. }}
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. align="right"
  255. label="押金"
  256. prop="flag"
  257. min-width="160"
  258. show-overflow-tooltip
  259. >
  260. <template slot-scope="scope">
  261. {{
  262. scope.row.flag == 4
  263. ? scope.row.amountType == "IN"
  264. ? scope.row.amount
  265. : scope.row.amountType == "OUT"
  266. ? -scope.row.amount
  267. : ""
  268. : "-" | numToFixed
  269. }}
  270. </template>
  271. </el-table-column>
  272. <el-table-column
  273. align="right"
  274. label="工程保证金"
  275. prop="flag"
  276. min-width="160"
  277. show-overflow-tooltip
  278. >
  279. <template slot-scope="scope">
  280. {{
  281. scope.row.flag == 5
  282. ? scope.row.amountType == "IN"
  283. ? scope.row.amount
  284. : scope.row.amountType == "OUT"
  285. ? -scope.row.amount
  286. : ""
  287. : "-" | numToFixed
  288. }}
  289. </template>
  290. </el-table-column>
  291. <el-table-column
  292. align="right"
  293. label="其他暂扣款"
  294. prop="flag"
  295. min-width="160"
  296. show-overflow-tooltip
  297. >
  298. <template slot-scope="scope">
  299. {{
  300. scope.row.flag == 6
  301. ? scope.row.amountType == "IN"
  302. ? scope.row.amount
  303. : scope.row.amountType == "OUT"
  304. ? -scope.row.amount
  305. : ""
  306. : "-" | numToFixed
  307. }}
  308. </template>
  309. </el-table-column>
  310. <el-table-column
  311. align="right"
  312. label="账户余额"
  313. prop="balanceAmount"
  314. min-width="160"
  315. show-overflow-tooltip
  316. >
  317. <template slot-scope="scope">
  318. {{ scope.row.balanceAmount | numToFixed }}
  319. </template>
  320. </el-table-column>
  321. </el-table>
  322. </div>
  323. <!-- 分页
  324. <div class="fr">
  325. <el-pagination
  326. @size-change="handleSizeChange"
  327. @current-change="handleCurrentChange"
  328. :current-page="currentPage"
  329. :page-sizes="[10, 20, 30, 50, 500]"
  330. :page-size="10"
  331. layout="total, sizes, prev, pager, next, jumper"
  332. :total="listTotal"
  333. >
  334. </el-pagination>
  335. </div> -->
  336. </div>
  337. </div>
  338. <div v-show="bill == 'REBATE'">
  339. <ul class="ulStyle">
  340. <li>
  341. 返利支出:<span>{{ amountList.outCount }}</span>
  342. </li>
  343. <li>
  344. 返利收入:<span>{{ amountList.inCount }}</span>
  345. </li>
  346. </ul>
  347. <!-- 列表 -->
  348. <div class="mymain-container">
  349. <div class="table">
  350. <el-table
  351. v-loading="listLoading"
  352. :data="dataList"
  353. element-loading-text="Loading"
  354. border
  355. fit
  356. highlight-current-row
  357. stripe
  358. show-summary
  359. :summary-method="getSummaries2"
  360. >
  361. <el-table-column
  362. label="序号"
  363. align="center"
  364. width="100"
  365. type="index"
  366. show-overflow-tooltip
  367. ></el-table-column>
  368. <el-table-column
  369. align="center"
  370. label="客户编码"
  371. prop="customerCode"
  372. min-width="160"
  373. show-overflow-tooltip
  374. ></el-table-column>
  375. <el-table-column
  376. align="center"
  377. label="客户名称"
  378. prop="customerName"
  379. min-width="160"
  380. show-overflow-tooltip
  381. ></el-table-column>
  382. <el-table-column
  383. align="center"
  384. label="单据日期"
  385. prop="theTime"
  386. min-width="160"
  387. show-overflow-tooltip
  388. ></el-table-column>
  389. <el-table-column
  390. align="center"
  391. label="审核日期"
  392. prop="examineTime"
  393. min-width="160"
  394. show-overflow-tooltip
  395. ></el-table-column>
  396. <el-table-column
  397. align="center"
  398. label="单据类型"
  399. prop="billType"
  400. min-width="160"
  401. show-overflow-tooltip
  402. >
  403. <template slot-scope="scope">
  404. {{ scope.row.billType == 3 ? "付款单" : scope.row.billType }}
  405. </template>
  406. </el-table-column>
  407. <el-table-column
  408. align="center"
  409. label="单据号"
  410. prop="billNo"
  411. min-width="160"
  412. show-overflow-tooltip
  413. ></el-table-column>
  414. <el-table-column
  415. align="center"
  416. label="返利类型"
  417. prop="walletName"
  418. min-width="160"
  419. show-overflow-tooltip
  420. ></el-table-column>
  421. <el-table-column
  422. align="center"
  423. label="摘要"
  424. prop="remark"
  425. min-width="160"
  426. show-overflow-tooltip
  427. ></el-table-column>
  428. <el-table-column
  429. align="right"
  430. label="收入"
  431. prop="amountType"
  432. min-width="160"
  433. show-overflow-tooltip
  434. >
  435. <template slot-scope="scope">
  436. {{
  437. scope.row.amountType == "IN"
  438. ? scope.row.amount
  439. : "-" | numToFixed
  440. }}
  441. </template>
  442. </el-table-column>
  443. <el-table-column
  444. align="right"
  445. label="支出"
  446. prop="amountType"
  447. min-width="160"
  448. show-overflow-tooltip
  449. >
  450. <template slot-scope="scope">
  451. {{
  452. scope.row.amountType == "OUT"
  453. ? scope.row.amount
  454. : "-" | numToFixed
  455. }}
  456. </template>
  457. </el-table-column>
  458. <el-table-column
  459. align="right"
  460. label="折让金额"
  461. prop="allowanceAmount"
  462. min-width="160"
  463. show-overflow-tooltip
  464. >
  465. <template slot-scope="scope">
  466. {{ scope.row.allowanceAmount | numToFixed }}
  467. </template>
  468. </el-table-column>
  469. <el-table-column
  470. align="right"
  471. label="暂扣返利"
  472. prop="withholdAmount"
  473. min-width="160"
  474. show-overflow-tooltip
  475. >
  476. <template slot-scope="scope">
  477. {{ scope.row.withholdAmount | numToFixed }}
  478. </template>
  479. </el-table-column>
  480. <el-table-column
  481. align="right"
  482. label="结存"
  483. prop="balanceAmount"
  484. min-width="160"
  485. show-overflow-tooltip
  486. >
  487. <template slot-scope="scope">
  488. {{ scope.row.balanceAmount | numToFixed }}
  489. </template>
  490. </el-table-column>
  491. </el-table>
  492. </div>
  493. <!-- 分页 -->
  494. <!-- <div class="fr">
  495. <el-pagination
  496. @size-change="handleSizeChange"
  497. @current-change="handleCurrentChange"
  498. :current-page="currentPage"
  499. :page-sizes="[10, 20, 30, 50, 500]"
  500. :page-size="10"
  501. layout="total, sizes, prev, pager, next, jumper"
  502. :total="listTotal"
  503. >
  504. </el-pagination>
  505. </div> -->
  506. </div>
  507. </div>
  508. <!-- 分页 -->
  509. <div class="fr">
  510. <el-pagination
  511. @size-change="handleSizeChange"
  512. @current-change="handleCurrentChange"
  513. :current-page="currentPage"
  514. :page-sizes="[10, 20, 30, 50, 500]"
  515. :page-size="pageSize"
  516. layout="total, sizes, prev, pager, next, jumper"
  517. :total="listTotal"
  518. >
  519. </el-pagination>
  520. </div>
  521. </div>
  522. </template>
  523. <script>
  524. // import { mapGetters } from "vuex";
  525. import { getWalletCustomerList } from "@/api/finance/change_apply";
  526. import {
  527. getStandbookList,
  528. getDictList,
  529. getCustomerList,
  530. getAmountCount,
  531. } from "@/api/finance/standbook_list";
  532. export default {
  533. data() {
  534. return {
  535. amountList: {},
  536. customerList: [],
  537. currentPage: 1, // 当前页码
  538. pageSize: 10, // 每页数量
  539. listTotal: 0, // 列表总数
  540. // dataListRebate: [], // 列表数据
  541. // dataListLoan: [], // 列表数据
  542. dataList: [],
  543. walletList: [],
  544. // dictList: [],
  545. customerName: "",
  546. customerNumber: "",
  547. searchForm: {
  548. customerId: "",
  549. customerWalletId: "",
  550. billNo: "",
  551. startTime: "",
  552. endTime: "",
  553. }, //搜索表单
  554. listLoading: false, // 列表加载loading
  555. bill: "COMMONLY",
  556. isCustomer: JSON.parse(localStorage.getItem("supply_user")).isCustomer,
  557. isDisabled: false,
  558. isCustomerList: {
  559. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
  560. customerName: JSON.parse(localStorage.getItem("supply_user"))
  561. .customerName,
  562. customerNumber: JSON.parse(localStorage.getItem("supply_user"))
  563. .customerNumber,
  564. },
  565. };
  566. },
  567. computed: {
  568. exParams() {
  569. // return {
  570. // type: this.bill,
  571. // };
  572. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  573. return {
  574. ...this.searchForm,
  575. pageSize: this.pageSize,
  576. pageNum: this.currentPage,
  577. type: this.bill,
  578. customerName: this.$route.query.customerName,
  579. customerNumber: this.$route.query.customerNumber,
  580. };
  581. } else if (this.isCustomer) {
  582. return {
  583. ...this.searchForm,
  584. pageSize: this.pageSize,
  585. pageNum: this.currentPage,
  586. type: this.bill,
  587. customerName: this.$store.state.user.customerName,
  588. customerNumber: this.$store.state.user.customerNumber,
  589. };
  590. } else {
  591. return {
  592. ...this.searchForm,
  593. pageSize: this.pageSize,
  594. pageNum: this.currentPage,
  595. type: this.bill,
  596. customerName: this.customerName,
  597. customerNumber: this.customerNumber,
  598. };
  599. }
  600. },
  601. },
  602. beforeRouteEnter(to, from, next) {
  603. // console.log(to, from, next, 898);
  604. next((vm) => {
  605. // 这个时候组件还没有创建,所以要通过vm来访问
  606. console.log(vm);
  607. vm.getCustomerDataList();
  608. if (
  609. from.path == "/finance/details/balance_sum" &&
  610. to.path == "/finance/details/standbook_list" &&
  611. vm.$route.query.customerId
  612. ) {
  613. //只有是从A进到B页面才执行
  614. // 将要执行的逻辑
  615. vm.isDisabled = true;
  616. vm.searchForm.customerId = vm.$route.query.customerId;
  617. vm.changeFn(vm.$route.query.customerId);
  618. vm.getDataList({
  619. pageSize: vm.pageSize,
  620. pageNum: vm.currentPage,
  621. type: vm.bill,
  622. customerName: vm.$route.query.customerName,
  623. customerNumber: vm.$route.query.customerNumber,
  624. });
  625. vm.getAmountList({
  626. type: vm.bill,
  627. customerName: vm.$route.query.customerName,
  628. customerNumber: vm.$route.query.customerNumber,
  629. });
  630. } else if (vm.isCustomer) {
  631. vm.isDisabled = true;
  632. vm.searchForm.customerId = vm.$store.state.user.customerId;
  633. vm.changeFn(vm.$store.state.user.customerId);
  634. vm.getDataList({
  635. pageSize: vm.pageSize,
  636. pageNum: vm.currentPage,
  637. type: vm.bill,
  638. ...vm.isCustomerList,
  639. });
  640. vm.getAmountList({
  641. type: vm.bill,
  642. ...vm.isCustomerList,
  643. });
  644. } else {
  645. vm.searchForm.customerId = "";
  646. vm.isDisabled = false;
  647. vm.getDataList({
  648. pageSize: vm.pageSize,
  649. pageNum: vm.currentPage,
  650. type: vm.bill,
  651. });
  652. vm.getCustomerDataList();
  653. vm.getAmountList({
  654. type: vm.bill,
  655. });
  656. }
  657. });
  658. },
  659. created() {
  660. // console.log(
  661. // this.customerId,
  662. // this.$store.state.user.customerName,
  663. // this.$store.state.user.customerNumber,
  664. // 777777
  665. // );
  666. // if (this.$route.query.customerName && this.$route.query.customerNumber) {
  667. // this.isDisabled = true;
  668. // this.searchForm.customerId = this.$route.query.customerName;
  669. // this.changeFn(this.$route.query.customerId);
  670. // this.getDataList({
  671. // pageSize: this.pageSize,
  672. // pageNum: this.currentPage,
  673. // type: this.bill,
  674. // customerName: this.$route.query.customerName,
  675. // customerNumber: this.$route.query.customerNumber,
  676. // });
  677. // } else
  678. // if (this.isCustomer) {
  679. // this.isDisabled = true;
  680. // this.searchForm.customerId = this.$store.state.user.customerName;
  681. // this.changeFn(this.$store.state.user.customerId);
  682. // this.getDataList({
  683. // pageSize: this.pageSize,
  684. // pageNum: this.currentPage,
  685. // type: this.bill,
  686. // customerName: this.$store.state.user.customerName,
  687. // customerNumber: this.$store.state.user.customerNumber,
  688. // });
  689. // } else {
  690. // this.getDataList({
  691. // pageSize: this.pageSize,
  692. // pageNum: this.currentPage,
  693. // type: this.bill,
  694. // });
  695. // this.getCustomerDataList();
  696. // }
  697. // this.getCustomerDataList();
  698. // this.getWalletList();
  699. // this.getDataDict();
  700. },
  701. methods: {
  702. //
  703. computedFn(data, i, sums, index) {
  704. let map1 = data.map((v) => {
  705. if (v.flag == i && v.amountType == "IN") {
  706. return v.amount;
  707. }
  708. if (v.flag == i && v.amountType == "OUT") {
  709. return -v.amount;
  710. }
  711. });
  712. let sum = map1
  713. .reduce((prev, curr) => {
  714. const value = Number(curr);
  715. if (!isNaN(value)) {
  716. return prev + curr;
  717. } else {
  718. return prev;
  719. }
  720. }, 0)
  721. .toFixed(2);
  722. return sum;
  723. },
  724. //合计
  725. //返利台账列表合计
  726. getSummaries2(param) {
  727. const { columns, data } = param;
  728. const sums = [];
  729. columns.forEach((column, index) => {
  730. if (index === 0) {
  731. sums[index] = "合计";
  732. }
  733. if (index === 9) {
  734. let map1 = data.map((v) => {
  735. if (v.amountType == "IN") {
  736. return v.amount;
  737. }
  738. });
  739. sums[index] = map1
  740. .reduce((prev, curr) => {
  741. const value = Number(curr);
  742. if (!isNaN(value)) {
  743. return prev + curr;
  744. } else {
  745. return prev;
  746. }
  747. }, 0)
  748. .toFixed(2);
  749. }
  750. if (index === 10) {
  751. let map1 = data.map((v) => {
  752. if (v.amountType == "OUT") {
  753. return v.amount;
  754. }
  755. });
  756. sums[index] = map1
  757. .reduce((prev, curr) => {
  758. const value = Number(curr);
  759. if (!isNaN(value)) {
  760. return prev + curr;
  761. } else {
  762. return prev;
  763. }
  764. }, 0)
  765. .toFixed(2);
  766. }
  767. if (index === 11) {
  768. let map1 = data.map((v) => {
  769. return v.allowanceAmount;
  770. });
  771. sums[index] = map1
  772. .reduce((prev, curr) => {
  773. const value = Number(curr);
  774. if (!isNaN(value)) {
  775. return prev + curr;
  776. } else {
  777. return prev;
  778. }
  779. }, 0)
  780. .toFixed(2);
  781. }
  782. if (index === 12) {
  783. let map1 = data.map((v) => {
  784. return v.withholdAmount;
  785. });
  786. sums[index] = map1
  787. .reduce((prev, curr) => {
  788. const value = Number(curr);
  789. if (!isNaN(value)) {
  790. return prev + curr;
  791. } else {
  792. return prev;
  793. }
  794. }, 0)
  795. .toFixed(2);
  796. }
  797. if (index === 13) {
  798. let map1 = data.map((v) => {
  799. return v.balanceAmount;
  800. });
  801. sums[index] = map1
  802. .reduce((prev, curr) => {
  803. const value = Number(curr);
  804. if (!isNaN(value)) {
  805. return prev + curr;
  806. } else {
  807. return prev;
  808. }
  809. }, 0)
  810. .toFixed(2);
  811. }
  812. });
  813. return sums;
  814. },
  815. //货款台账列表合计
  816. getSummaries(param) {
  817. const { columns, data } = param;
  818. const sums = [];
  819. columns.forEach((column, index) => {
  820. if (index === 0) {
  821. sums[index] = "合计";
  822. }
  823. if (index === 6) {
  824. sums[index] = this.computedFn(data, 1);
  825. }
  826. if (index === 7) {
  827. sums[index] = this.computedFn(data, 2);
  828. }
  829. if (index === 8) {
  830. sums[index] = this.computedFn(data, 3);
  831. }
  832. if (index === 9) {
  833. sums[index] = this.computedFn(data, 4);
  834. }
  835. if (index === 10) {
  836. sums[index] = this.computedFn(data, 5);
  837. }
  838. if (index === 11) {
  839. sums[index] = this.computedFn(data, 6);
  840. }
  841. if (index === 12) {
  842. let map2 = data.map((v) => {
  843. return v.balanceAmount;
  844. });
  845. sums[index] = map2
  846. .reduce((prev, curr) => {
  847. const value = Number(curr);
  848. if (!isNaN(value)) {
  849. return prev + curr;
  850. } else {
  851. return prev;
  852. }
  853. }, 0)
  854. .toFixed(2);
  855. }
  856. });
  857. return sums;
  858. },
  859. //获取汇总总数
  860. async getAmountList(data) {
  861. let res = await getAmountCount(data);
  862. this.amountList = res.data;
  863. },
  864. //改变经销商
  865. async changeFn(v) {
  866. this.searchForm.customerWalletId = "";
  867. let res = await getWalletCustomerList({
  868. customerId: v,
  869. type: this.bill,
  870. hasRecord: true,
  871. });
  872. this.walletList = res.data;
  873. },
  874. //获取经销商列表
  875. async getCustomerDataList() {
  876. let res = await getCustomerList({
  877. pageNum: 1,
  878. pageSize: -1,
  879. });
  880. this.customerList = res.data.records;
  881. },
  882. // 更改每页数量
  883. handleSizeChange(val) {
  884. this.pageSize = val;
  885. this.currentPage = 1;
  886. // this.getDataList({
  887. // type: this.bill,
  888. // pageNum: this.currentPage,
  889. // pageSize: this.pageSize,
  890. // });
  891. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  892. this.getDataList({
  893. ...this.searchForm,
  894. pageSize: this.pageSize,
  895. pageNum: this.currentPage,
  896. type: this.bill,
  897. customerName: this.$route.query.customerName,
  898. customerNumber: this.$route.query.customerNumber,
  899. });
  900. } else if (this.isCustomer) {
  901. this.getDataList({
  902. ...this.searchForm,
  903. pageSize: this.pageSize,
  904. pageNum: this.currentPage,
  905. type: this.bill,
  906. ...this.isCustomerList,
  907. });
  908. } else {
  909. this.getDataList({
  910. ...this.searchForm,
  911. pageSize: this.pageSize,
  912. pageNum: this.currentPage,
  913. type: this.bill,
  914. customerName: this.customerName,
  915. customerNumber: this.customerNumber,
  916. });
  917. }
  918. },
  919. // 更改当前页
  920. handleCurrentChange(val) {
  921. this.currentPage = val;
  922. // this.getDataList({
  923. // type: this.bill,
  924. // pageNum: this.currentPage,
  925. // pageSize: this.pageSize,
  926. // });
  927. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  928. this.getDataList({
  929. ...this.searchForm,
  930. pageSize: this.pageSize,
  931. pageNum: this.currentPage,
  932. type: this.bill,
  933. customerName: this.$route.query.customerName,
  934. customerNumber: this.$route.query.customerNumber,
  935. });
  936. } else if (this.isCustomer) {
  937. this.getDataList({
  938. ...this.searchForm,
  939. pageSize: this.pageSize,
  940. pageNum: this.currentPage,
  941. type: this.bill,
  942. ...this.isCustomerList,
  943. });
  944. } else {
  945. this.getDataList({
  946. ...this.searchForm,
  947. pageSize: this.pageSize,
  948. pageNum: this.currentPage,
  949. type: this.bill,
  950. customerName: this.customerName,
  951. customerNumber: this.customerNumber,
  952. });
  953. }
  954. },
  955. // //获取品类
  956. // async getDataDict() {
  957. // const res = await getDictList({ sysDictEnum: "PRODUCT_TYPE" });
  958. // console.log(res);
  959. // this.dictList = res.data;
  960. // },
  961. //重置
  962. async resetFn() {
  963. // this.searchForm.customerId = "";
  964. // this.walletList = [];
  965. // this.customerName = "";
  966. // this.customerNumber = "";
  967. if (this.isCustomer) {
  968. await this.$refs.searchForm.resetFields();
  969. this.searchForm.customerId = this.$store.state.user.customerId;
  970. } else if (this.$route.query.customerId) {
  971. this.searchForm.customerId = this.$route.query.customerId;
  972. } else {
  973. this.walletList = [];
  974. this.customerName = "";
  975. this.customerNumber = "";
  976. await this.$refs.searchForm.resetFields();
  977. }
  978. },
  979. //查询
  980. searchFn() {
  981. this.currentPage = 1;
  982. this.pageSize = 10;
  983. // this.customerName = null;
  984. // this.customerNumber = null;
  985. let res = this.customerList.filter((v) => {
  986. return v.id == this.searchForm.customerId;
  987. });
  988. console.log(res);
  989. // return;
  990. if (res.length > 0) {
  991. this.customerName = res[0].name;
  992. this.customerNumber = res[0].number;
  993. }
  994. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  995. this.getDataList({
  996. ...this.searchForm,
  997. pageSize: this.pageSize,
  998. pageNum: this.currentPage,
  999. type: this.bill,
  1000. customerName: this.$route.query.customerName,
  1001. customerNumber: this.$route.query.customerNumber,
  1002. });
  1003. this.getAmountList({
  1004. ...this.searchForm,
  1005. type: this.bill,
  1006. customerName: this.$route.query.customerName,
  1007. customerNumber: this.$route.query.customerNumber,
  1008. });
  1009. } else if (this.isCustomer) {
  1010. this.getDataList({
  1011. ...this.searchForm,
  1012. pageSize: this.pageSize,
  1013. pageNum: this.currentPage,
  1014. type: this.bill,
  1015. ...this.isCustomerList,
  1016. });
  1017. this.getAmountList({
  1018. ...this.searchForm,
  1019. type: this.bill,
  1020. ...this.isCustomerList,
  1021. });
  1022. } else {
  1023. this.getDataList({
  1024. ...this.searchForm,
  1025. customerName: this.customerName,
  1026. customerNumber: this.customerNumber,
  1027. pageSize: this.pageSize,
  1028. pageNum: this.currentPage,
  1029. type: this.bill,
  1030. });
  1031. this.getAmountList({
  1032. ...this.searchForm,
  1033. type: this.bill,
  1034. customerName: this.customerName,
  1035. customerNumber: this.customerNumber,
  1036. });
  1037. }
  1038. },
  1039. // //钱包数据
  1040. // async getWalletList() {
  1041. // let res = await getWalletCustomerList({
  1042. // customerId: this.customerId,
  1043. // type: this.bill,
  1044. // });
  1045. // this.selectList = res.data;
  1046. // },
  1047. //切换列表
  1048. checkFn(v) {
  1049. // this.getDataList({
  1050. // pageSize: 10,
  1051. // pageNum: 1,
  1052. // type: v,
  1053. // });
  1054. this.resetFn();
  1055. this.pageSize = 10;
  1056. this.currentPage = 1;
  1057. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  1058. this.changeFn(this.$route.query.customerId);
  1059. this.getDataList({
  1060. ...this.searchForm,
  1061. pageSize: this.pageSize,
  1062. pageNum: this.currentPage,
  1063. type: v,
  1064. customerId: this.$route.query.customerId,
  1065. customerName: this.$route.query.customerName,
  1066. customerNumber: this.$route.query.customerNumber,
  1067. });
  1068. this.getAmountList({
  1069. ...this.searchForm,
  1070. type: v,
  1071. customerId: this.$route.query.customerId,
  1072. customerName: this.$route.query.customerName,
  1073. customerNumber: this.$route.query.customerNumber,
  1074. });
  1075. } else if (this.isCustomer) {
  1076. this.changeFn(this.$store.state.user.customerId);
  1077. this.getDataList({
  1078. ...this.searchForm,
  1079. pageSize: this.pageSize,
  1080. pageNum: this.currentPage,
  1081. type: v,
  1082. ...this.isCustomerList,
  1083. });
  1084. this.getAmountList({
  1085. ...this.searchForm,
  1086. type: v,
  1087. ...this.isCustomerList,
  1088. });
  1089. } else {
  1090. this.getDataList({
  1091. // ...this.searchForm,
  1092. // customerName: this.customerName,
  1093. // customerNumber: this.customerNumber,
  1094. pageSize: this.pageSize,
  1095. pageNum: this.currentPage,
  1096. type: v,
  1097. });
  1098. this.getAmountList({
  1099. type: v,
  1100. });
  1101. }
  1102. // this.getWalletList();
  1103. },
  1104. //
  1105. async getDataList(data) {
  1106. let res;
  1107. if (this.bill == "COMMONLY") {
  1108. res = await getStandbookList(data);
  1109. } else {
  1110. res = await getStandbookList(data);
  1111. }
  1112. this.dataList = res.data.records;
  1113. this.listTotal = res.data.total;
  1114. },
  1115. },
  1116. };
  1117. </script>
  1118. <style lang="scss" scoped>
  1119. .ulStyle {
  1120. list-style: none;
  1121. padding: 0;
  1122. li {
  1123. display: inline-block;
  1124. font-weight: 700;
  1125. span {
  1126. padding-left: 6px;
  1127. font-weight: 400;
  1128. }
  1129. // float: right;
  1130. margin-right: 20px;
  1131. }
  1132. }
  1133. .moneyStyle {
  1134. height: 130px;
  1135. border-radius: 20px;
  1136. padding: 20px 0 0 20px;
  1137. color: #fff;
  1138. span {
  1139. display: block;
  1140. font-size: 20px;
  1141. }
  1142. strong {
  1143. margin-top: 16px;
  1144. display: block;
  1145. font-size: 36px;
  1146. }
  1147. }
  1148. .selectStyle {
  1149. width: 100%;
  1150. }
  1151. .color1 {
  1152. background-color: #6c83d0;
  1153. }
  1154. .color2 {
  1155. background-color: #dfc062;
  1156. }
  1157. .color3 {
  1158. background-color: #dfc062;
  1159. }
  1160. .color4 {
  1161. background-color: #6bcfd7;
  1162. }
  1163. </style>