standbook_list.vue 41 KB

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