standbook_list.vue 41 KB

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