standbook_list.vue 32 KB

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