standbook_list.vue 36 KB

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