standbook_list.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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 {
  326. getAmountCount,
  327. getCustomerList,
  328. getStandbookList,
  329. } from "@/api/finance/standbook_list";
  330. import { numToFixed } from "@/filters";
  331. export default {
  332. data() {
  333. return {
  334. isShow: false,
  335. amountList: {},
  336. customerList: [],
  337. currentPage: 1, // 当前页码
  338. pageSize: 10, // 每页数量
  339. listTotal: 0, // 列表总数
  340. // dataListRebate: [], // 列表数据
  341. // dataListLoan: [], // 列表数据
  342. dataList: [],
  343. walletList: [],
  344. // dictList: [],
  345. customerName: "",
  346. customerNumber: "",
  347. searchForm: {
  348. customerId: "",
  349. customerWalletId: "",
  350. billNo: "",
  351. startTime: "",
  352. endTime: "",
  353. customerNumber: "",
  354. billType: "",
  355. }, //搜索表单
  356. listLoading: false, // 列表加载loading
  357. bill: "COMMONLY",
  358. isCustomer: JSON.parse(localStorage.getItem("supply_user")).isCustomer,
  359. isDisabled: false,
  360. isCustomerList: {
  361. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
  362. customerName: JSON.parse(localStorage.getItem("supply_user"))
  363. .customerName,
  364. customerNumber: JSON.parse(localStorage.getItem("supply_user"))
  365. .customerNumber,
  366. },
  367. typeList: [
  368. "收款单",
  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. computed: {
  396. exParams() {
  397. // return {
  398. // type: this.bill,
  399. // };
  400. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  401. return {
  402. ...this.searchForm,
  403. pageSize: this.pageSize,
  404. pageNum: this.currentPage,
  405. type: this.bill,
  406. customerName: this.$route.query.customerName,
  407. customerNumber: this.$route.query.customerNumber,
  408. };
  409. } else if (this.isCustomer) {
  410. return {
  411. ...this.searchForm,
  412. pageSize: this.pageSize,
  413. pageNum: this.currentPage,
  414. type: this.bill,
  415. customerName: this.$store.state.user.customerName,
  416. customerNumber: this.$store.state.user.customerNumber,
  417. };
  418. } else {
  419. return {
  420. ...this.searchForm,
  421. pageSize: this.pageSize,
  422. pageNum: this.currentPage,
  423. type: this.bill,
  424. customerName: this.customerName,
  425. customerNumber: this.customerNumber,
  426. };
  427. }
  428. },
  429. },
  430. beforeRouteEnter(to, from, next) {
  431. // console.log(to, from, next, 898);
  432. next((vm) => {
  433. // 这个时候组件还没有创建,所以要通过vm来访问
  434. console.log(vm);
  435. vm.getCustomerDataList();
  436. if (
  437. from.path == "/finance/details/balance_sum" &&
  438. to.path == "/finance/details/standbook_list" &&
  439. vm.$route.query.customerId
  440. ) {
  441. //只有是从A进到B页面才执行
  442. // 将要执行的逻辑
  443. vm.isShow = true;
  444. vm.isDisabled = true;
  445. vm.searchForm.customerId = vm.$route.query.customerId;
  446. vm.changeFn(vm.$route.query.customerId);
  447. vm.getDataList({
  448. pageSize: vm.pageSize,
  449. pageNum: vm.currentPage,
  450. type: vm.bill,
  451. customerName: vm.$route.query.customerName,
  452. customerNumber: vm.$route.query.customerNumber,
  453. });
  454. vm.getAmountList({
  455. type: vm.bill,
  456. customerName: vm.$route.query.customerName,
  457. customerNumber: vm.$route.query.customerNumber,
  458. });
  459. } else if (vm.isCustomer) {
  460. vm.isShow = false;
  461. vm.isDisabled = true;
  462. vm.searchForm.customerId = vm.$store.state.user.customerId;
  463. vm.changeFn(vm.$store.state.user.customerId);
  464. vm.getDataList({
  465. pageSize: vm.pageSize,
  466. pageNum: vm.currentPage,
  467. type: vm.bill,
  468. ...vm.isCustomerList,
  469. });
  470. vm.getAmountList({
  471. type: vm.bill,
  472. ...vm.isCustomerList,
  473. });
  474. } else {
  475. vm.isShow = false;
  476. vm.searchForm.customerId = "";
  477. vm.isDisabled = false;
  478. vm.getDataList({
  479. pageSize: vm.pageSize,
  480. pageNum: vm.currentPage,
  481. type: vm.bill,
  482. });
  483. vm.getCustomerDataList();
  484. vm.getAmountList({
  485. type: vm.bill,
  486. });
  487. }
  488. });
  489. },
  490. // activated() {
  491. // // 钱包余额页跳转过来
  492. // if (this.$route.query && this.$route.query.status){
  493. // this.bill = this.$route.query.status
  494. // this.changeFn(this.bill)
  495. // //只有是从A进到B页面才执行
  496. // // 将要执行的逻辑
  497. // this.isShow = true;
  498. // this.isDisabled = true;
  499. // this.searchForm.customerId = this.$route.query.customerId;
  500. // this.changeFn(this.$route.query.customerId);
  501. // this.getDataList({
  502. // pageSize: this.pageSize,
  503. // pageNum: this.currentPage,
  504. // type: this.bill,
  505. // customerName: this.$route.query.customerName,
  506. // customerNumber: this.$route.query.customerNumber,
  507. // });
  508. // this.getAmountList({
  509. // type: this.bill,
  510. // customerName: this.$route.query.customerName,
  511. // customerNumber: this.$route.query.customerNumber,
  512. // });
  513. // }
  514. // },
  515. created() {
  516. if (this.$route.query && this.$route.query.status) {
  517. this.bill = this.$route.query.status;
  518. this.changeFn(this.bill);
  519. //只有是从A进到B页面才执行
  520. // 将要执行的逻辑
  521. this.isShow = true;
  522. this.isDisabled = true;
  523. this.searchForm.customerId = this.$route.query.customerId;
  524. this.changeFn(this.$route.query.customerId);
  525. this.getDataList({
  526. pageSize: this.pageSize,
  527. pageNum: this.currentPage,
  528. type: this.bill,
  529. customerName: this.$route.query.customerName,
  530. customerNumber: this.$route.query.customerNumber,
  531. });
  532. this.getAmountList({
  533. type: this.bill,
  534. customerName: this.$route.query.customerName,
  535. customerNumber: this.$route.query.customerNumber,
  536. });
  537. }
  538. // console.log(
  539. // this.customerId,
  540. // this.$store.state.user.customerName,
  541. // this.$store.state.user.customerNumber,
  542. // 777777
  543. // );
  544. // if (this.$route.query.customerName && this.$route.query.customerNumber) {
  545. // this.isDisabled = true;
  546. // this.searchForm.customerId = this.$route.query.customerName;
  547. // this.changeFn(this.$route.query.customerId);
  548. // this.getDataList({
  549. // pageSize: this.pageSize,
  550. // pageNum: this.currentPage,
  551. // type: this.bill,
  552. // customerName: this.$route.query.customerName,
  553. // customerNumber: this.$route.query.customerNumber,
  554. // });
  555. // } else
  556. // if (this.isCustomer) {
  557. // this.isDisabled = true;
  558. // this.searchForm.customerId = this.$store.state.user.customerName;
  559. // this.changeFn(this.$store.state.user.customerId);
  560. // this.getDataList({
  561. // pageSize: this.pageSize,
  562. // pageNum: this.currentPage,
  563. // type: this.bill,
  564. // customerName: this.$store.state.user.customerName,
  565. // customerNumber: this.$store.state.user.customerNumber,
  566. // });
  567. // } else {
  568. // this.getDataList({
  569. // pageSize: this.pageSize,
  570. // pageNum: this.currentPage,
  571. // type: this.bill,
  572. // });
  573. // this.getCustomerDataList();
  574. // }
  575. // this.getCustomerDataList();
  576. // this.getWalletList();
  577. // this.getDataDict();
  578. },
  579. methods: {
  580. goBack() {
  581. this.$router.go(-1);
  582. this.$store.dispatch("tagsView/delView", this.$route);
  583. },
  584. //
  585. computedFn(data, i, sums, index) {
  586. let map1 = data.map((v) => {
  587. if (v.flag == i && v.amountType == "IN") {
  588. return v.amount;
  589. }
  590. if (v.flag == i && v.amountType == "OUT") {
  591. return -v.amount;
  592. }
  593. });
  594. let sum1 = map1.reduce((prev, curr) => {
  595. const value = Number(curr);
  596. if (!isNaN(value)) {
  597. return prev + curr;
  598. } else {
  599. return prev;
  600. }
  601. }, 0);
  602. let sum = numToFixed(sum1);
  603. return sum;
  604. },
  605. //合计
  606. //返利台账列表合计
  607. getSummaries2(param) {
  608. const { columns, data } = param;
  609. const sums = [];
  610. columns.forEach((column, index) => {
  611. if (index === 0) {
  612. sums[index] = "合计";
  613. }
  614. if (index === 10) {
  615. let map1 = data.map((v) => {
  616. if (v.amountType == "IN") {
  617. return v.amount;
  618. }
  619. });
  620. let a = map1.reduce((prev, curr) => {
  621. const value = Number(curr);
  622. if (!isNaN(value)) {
  623. return prev + curr;
  624. } else {
  625. return prev;
  626. }
  627. }, 0);
  628. sums[index] = numToFixed(a);
  629. }
  630. if (index === 11) {
  631. let map1 = data.map((v) => {
  632. if (v.amountType == "OUT") {
  633. return v.amount;
  634. }
  635. });
  636. let a = map1.reduce((prev, curr) => {
  637. const value = Number(curr);
  638. if (!isNaN(value)) {
  639. return prev + curr;
  640. } else {
  641. return prev;
  642. }
  643. }, 0);
  644. sums[index] = numToFixed(a);
  645. }
  646. if (index === 12) {
  647. let map1 = data.map((v) => {
  648. return v.allowanceAmount;
  649. });
  650. let a = map1.reduce((prev, curr) => {
  651. const value = Number(curr);
  652. if (!isNaN(value)) {
  653. return prev + curr;
  654. } else {
  655. return prev;
  656. }
  657. }, 0);
  658. sums[index] = numToFixed(a);
  659. }
  660. if (index === 13) {
  661. let map1 = data.map((v) => {
  662. return v.withholdAmount;
  663. });
  664. let a = map1.reduce((prev, curr) => {
  665. const value = Number(curr);
  666. if (!isNaN(value)) {
  667. return prev + curr;
  668. } else {
  669. return prev;
  670. }
  671. }, 0);
  672. sums[index] = numToFixed(a);
  673. }
  674. if (index === 14) {
  675. let map1 = data.map((v) => {
  676. return v.balanceAmount;
  677. });
  678. let a = map1.reduce((prev, curr) => {
  679. const value = Number(curr);
  680. if (!isNaN(value)) {
  681. return prev + curr;
  682. } else {
  683. return prev;
  684. }
  685. }, 0);
  686. sums[index] = numToFixed(a);
  687. }
  688. });
  689. return sums;
  690. },
  691. //货款台账列表合计
  692. getSummaries(param) {
  693. const { columns, data } = param;
  694. const sums = [];
  695. columns.forEach((column, index) => {
  696. if (index === 0) {
  697. sums[index] = "合计";
  698. }
  699. if (index === 7) {
  700. sums[index] = this.computedFn(data, 1);
  701. }
  702. if (index === 8) {
  703. sums[index] = this.computedFn(data, 2);
  704. }
  705. if (index === 9) {
  706. sums[index] = this.computedFn(data, 3);
  707. }
  708. if (index === 10) {
  709. sums[index] = this.computedFn(data, 4);
  710. }
  711. if (index === 11) {
  712. sums[index] = this.computedFn(data, 5);
  713. }
  714. if (index === 12) {
  715. sums[index] = this.computedFn(data, 6);
  716. }
  717. if (index === 13) {
  718. let map2 = data.map((v) => {
  719. return v.balanceAmount;
  720. });
  721. let aa = map2.reduce((prev, curr) => {
  722. const value = Number(curr);
  723. if (!isNaN(value)) {
  724. return prev + curr;
  725. } else {
  726. return prev;
  727. }
  728. }, 0);
  729. sums[index] = numToFixed(aa);
  730. }
  731. });
  732. return sums;
  733. },
  734. //获取汇总总数
  735. async getAmountList(data) {
  736. let res = await getAmountCount(data);
  737. if (res.data) {
  738. this.amountList = res.data;
  739. } else {
  740. this.amountList = {
  741. inCount: 0,
  742. orderCOunt: 0,
  743. orderDate: 0,
  744. otherCount: 0,
  745. outCount: 0,
  746. payCount: 0,
  747. preCount: 0,
  748. projectCount: 0,
  749. };
  750. }
  751. },
  752. //改变经销商
  753. async changeFn(v) {
  754. this.searchForm.customerWalletId = "";
  755. let res = await getWalletCustomerList({
  756. customerId: v,
  757. type: this.bill,
  758. hasRecord: true,
  759. });
  760. this.walletList = res.data;
  761. },
  762. //获取经销商列表
  763. async getCustomerDataList() {
  764. let res = await getCustomerList({
  765. pageNum: 1,
  766. pageSize: -1,
  767. });
  768. this.customerList = res.data.records;
  769. },
  770. // 更改每页数量
  771. handleSizeChange(val) {
  772. this.pageSize = val;
  773. this.currentPage = 1;
  774. // this.getDataList({
  775. // type: this.bill,
  776. // pageNum: this.currentPage,
  777. // pageSize: this.pageSize,
  778. // });
  779. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  780. this.getDataList({
  781. ...this.searchForm,
  782. pageSize: this.pageSize,
  783. pageNum: this.currentPage,
  784. type: this.bill,
  785. customerName: this.$route.query.customerName,
  786. customerNumber: this.$route.query.customerNumber,
  787. });
  788. } else if (this.isCustomer) {
  789. this.getDataList({
  790. ...this.searchForm,
  791. pageSize: this.pageSize,
  792. pageNum: this.currentPage,
  793. type: this.bill,
  794. ...this.isCustomerList,
  795. });
  796. } else {
  797. this.getDataList({
  798. ...this.searchForm,
  799. pageSize: this.pageSize,
  800. pageNum: this.currentPage,
  801. type: this.bill,
  802. customerName: this.customerName,
  803. customerNumber: this.customerNumber,
  804. });
  805. }
  806. },
  807. // 更改当前页
  808. handleCurrentChange(val) {
  809. this.currentPage = val;
  810. // this.getDataList({
  811. // type: this.bill,
  812. // pageNum: this.currentPage,
  813. // pageSize: this.pageSize,
  814. // });
  815. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  816. this.getDataList({
  817. ...this.searchForm,
  818. pageSize: this.pageSize,
  819. pageNum: this.currentPage,
  820. type: this.bill,
  821. customerName: this.$route.query.customerName,
  822. customerNumber: this.$route.query.customerNumber,
  823. });
  824. } else if (this.isCustomer) {
  825. this.getDataList({
  826. ...this.searchForm,
  827. pageSize: this.pageSize,
  828. pageNum: this.currentPage,
  829. type: this.bill,
  830. ...this.isCustomerList,
  831. });
  832. } else {
  833. this.getDataList({
  834. ...this.searchForm,
  835. pageSize: this.pageSize,
  836. pageNum: this.currentPage,
  837. type: this.bill,
  838. customerName: this.customerName,
  839. customerNumber: this.customerNumber,
  840. });
  841. }
  842. },
  843. // //获取品类
  844. // async getDataDict() {
  845. // const res = await getDictList({ sysDictEnum: "PRODUCT_TYPE" });
  846. // console.log(res);
  847. // this.dictList = res.data;
  848. // },
  849. //重置
  850. async resetFn() {
  851. // this.searchForm.customerId = "";
  852. // this.walletList = [];
  853. // this.customerName = "";
  854. // this.customerNumber = "";
  855. if (this.isCustomer) {
  856. await this.$refs.searchForm.resetFields();
  857. this.searchForm.customerId = this.$store.state.user.customerId;
  858. } else if (this.$route.query.customerId) {
  859. this.searchForm.customerId = this.$route.query.customerId;
  860. } else {
  861. this.walletList = [];
  862. this.customerName = "";
  863. this.customerNumber = "";
  864. await this.$refs.searchForm.resetFields();
  865. }
  866. },
  867. //查询
  868. searchFn() {
  869. this.currentPage = 1;
  870. this.pageSize = 10;
  871. // this.customerName = null;
  872. // this.customerNumber = null;
  873. let res = this.customerList.filter((v) => {
  874. return v.id == this.searchForm.customerId;
  875. });
  876. console.log(res);
  877. // return;
  878. if (res.length > 0) {
  879. this.customerName = res[0].name;
  880. this.customerNumber = res[0].number;
  881. }
  882. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  883. this.getDataList({
  884. ...this.searchForm,
  885. pageSize: this.pageSize,
  886. pageNum: this.currentPage,
  887. type: this.bill,
  888. customerName: this.$route.query.customerName,
  889. customerNumber:
  890. this.$route.query.customerNumber || this.searchForm.customerNumber,
  891. });
  892. this.getAmountList({
  893. ...this.searchForm,
  894. type: this.bill,
  895. customerName: this.$route.query.customerName,
  896. customerNumber: this.$route.query.customerNumber,
  897. });
  898. } else if (this.isCustomer) {
  899. this.getDataList({
  900. ...this.searchForm,
  901. pageSize: this.pageSize,
  902. pageNum: this.currentPage,
  903. type: this.bill,
  904. ...this.isCustomerList,
  905. });
  906. this.getAmountList({
  907. ...this.searchForm,
  908. type: this.bill,
  909. ...this.isCustomerList,
  910. });
  911. } else {
  912. this.getDataList({
  913. ...this.searchForm,
  914. customerName: this.customerName,
  915. customerNumber: this.customerNumber || this.searchForm.customerNumber,
  916. pageSize: this.pageSize,
  917. pageNum: this.currentPage,
  918. type: this.bill,
  919. });
  920. this.getAmountList({
  921. ...this.searchForm,
  922. type: this.bill,
  923. customerName: this.customerName,
  924. customerNumber: this.customerNumber,
  925. });
  926. }
  927. },
  928. // //钱包数据
  929. // async getWalletList() {
  930. // let res = await getWalletCustomerList({
  931. // customerId: this.customerId,
  932. // type: this.bill,
  933. // });
  934. // this.selectList = res.data;
  935. // },
  936. //切换列表
  937. checkFn(v) {
  938. // this.getDataList({
  939. // pageSize: 10,
  940. // pageNum: 1,
  941. // type: v,
  942. // });
  943. this.resetFn();
  944. this.pageSize = 10;
  945. this.currentPage = 1;
  946. if (this.$route.query.customerName && this.$route.query.customerNumber) {
  947. this.changeFn(this.$route.query.customerId);
  948. this.getDataList({
  949. ...this.searchForm,
  950. pageSize: this.pageSize,
  951. pageNum: this.currentPage,
  952. type: v,
  953. customerId: this.$route.query.customerId,
  954. customerName: this.$route.query.customerName,
  955. customerNumber: this.$route.query.customerNumber,
  956. });
  957. this.getAmountList({
  958. ...this.searchForm,
  959. type: v,
  960. customerId: this.$route.query.customerId,
  961. customerName: this.$route.query.customerName,
  962. customerNumber: this.$route.query.customerNumber,
  963. });
  964. } else if (this.isCustomer) {
  965. this.changeFn(this.$store.state.user.customerId);
  966. this.getDataList({
  967. ...this.searchForm,
  968. pageSize: this.pageSize,
  969. pageNum: this.currentPage,
  970. type: v,
  971. ...this.isCustomerList,
  972. });
  973. this.getAmountList({
  974. ...this.searchForm,
  975. type: v,
  976. ...this.isCustomerList,
  977. });
  978. } else {
  979. this.getDataList({
  980. // ...this.searchForm,
  981. // customerName: this.customerName,
  982. // customerNumber: this.customerNumber,
  983. pageSize: this.pageSize,
  984. pageNum: this.currentPage,
  985. type: v,
  986. });
  987. this.getAmountList({
  988. type: v,
  989. });
  990. }
  991. // this.getWalletList();
  992. },
  993. //
  994. async getDataList(data) {
  995. let res;
  996. if (this.bill == "COMMONLY") {
  997. res = await getStandbookList(data);
  998. } else {
  999. res = await getStandbookList(data);
  1000. }
  1001. this.dataList = res.data.records;
  1002. this.listTotal = res.data.total;
  1003. },
  1004. },
  1005. };
  1006. </script>
  1007. <style lang="scss" scoped>
  1008. .ulStyle {
  1009. list-style: none;
  1010. padding: 0;
  1011. li {
  1012. display: inline-block;
  1013. font-weight: 700;
  1014. span {
  1015. padding-left: 6px;
  1016. font-weight: 400;
  1017. }
  1018. // float: right;
  1019. margin-right: 20px;
  1020. }
  1021. }
  1022. .moneyStyle {
  1023. height: 130px;
  1024. border-radius: 20px;
  1025. padding: 20px 0 0 20px;
  1026. color: #fff;
  1027. span {
  1028. display: block;
  1029. font-size: 20px;
  1030. }
  1031. strong {
  1032. margin-top: 16px;
  1033. display: block;
  1034. font-size: 36px;
  1035. }
  1036. }
  1037. .selectStyle {
  1038. width: 100%;
  1039. }
  1040. .color1 {
  1041. background-color: #6c83d0;
  1042. }
  1043. .color2 {
  1044. background-color: #dfc062;
  1045. }
  1046. .color3 {
  1047. background-color: #dfc062;
  1048. }
  1049. .color4 {
  1050. background-color: #6bcfd7;
  1051. }
  1052. </style>