standbook_list.vue 39 KB

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