account_list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div class="app-container">
  3. <div v-if="showReconciliation">
  4. <!-- 筛选条件 -->
  5. <div>
  6. <Collapse :screen-form="searchForm">
  7. <template #right_btn>
  8. <el-button size="mini" @click="clearFn">清空</el-button>
  9. <el-button size="mini" type="primary" @click="searchFn">搜索</el-button>
  10. </template>
  11. <template #search>
  12. <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
  13. <el-row :gutter="20">
  14. <el-col :xs="24" :sm="12" :lg="6">
  15. <el-form-item label="经销商名称" prop="customerId">
  16. <el-select
  17. v-model="searchForm.customerId"
  18. class="selectStyle"
  19. placeholder="请选择"
  20. filterable
  21. @change="changeFn"
  22. >
  23. <el-option v-for="(v, i) in customerList" :key="i" :label="v.name" :value="v.id"> </el-option>
  24. </el-select>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :xs="24" :sm="12" :lg="6">
  28. <el-form-item label="钱包" prop="customerWalletId">
  29. <el-select
  30. v-model="searchForm.customerWalletId"
  31. class="selectStyle"
  32. placeholder="请选择"
  33. filterable
  34. >
  35. <el-option
  36. v-for="(v, i) in walletList"
  37. :key="i"
  38. :label="v.customerWalletName"
  39. :value="v.customerWalletId"
  40. >
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :xs="24" :sm="12" :lg="6">
  46. <el-form-item label="单据号" prop="billNo">
  47. <el-input v-model="searchForm.billNo" placeholder="请输入"></el-input>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :xs="24" :sm="12" :lg="6">
  51. <el-form-item label="开始时间" prop="startTime">
  52. <el-date-picker
  53. class="selectStyle"
  54. v-model="searchForm.startTime"
  55. placeholder="选择日期"
  56. type="datetime"
  57. default-time="00:00:00"
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. >
  60. </el-date-picker>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :lg="6">
  64. <el-form-item label="结束时间" prop="endTime">
  65. <el-date-picker
  66. class="selectStyle"
  67. v-model="searchForm.endTime"
  68. placeholder="选择日期"
  69. type="datetime"
  70. default-time="23:59:59"
  71. value-format="yyyy-MM-dd HH:mm:ss"
  72. >
  73. </el-date-picker>
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. </el-form>
  78. </template>
  79. </Collapse>
  80. </div>
  81. <!-- 按钮 -->
  82. <div class="btn-group clearfix">
  83. <div class="fl">
  84. <el-button :disabled="dataList.length == 0" type="primary" size="mini" @click="reconciliationFn"
  85. >一键对账</el-button
  86. >
  87. <el-button type="primary" size="mini" @click="recordFn">记录</el-button>
  88. </div>
  89. <div class="fr">
  90. <ExportButton :exUrl="'finance/standing/book/export'" :exParams="exParams" />
  91. </div>
  92. </div>
  93. <!-- 列表 -->
  94. <div class="mymain-container">
  95. <div class="table">
  96. <el-table
  97. v-loading="listLoading"
  98. :data="dataList"
  99. element-loading-text="Loading"
  100. border
  101. fit
  102. highlight-current-row
  103. stripe
  104. show-summary
  105. :summary-method="getSummaries"
  106. >
  107. <el-table-column align="left" label="序号" type="index" width="80" show-overflow-tooltip></el-table-column>
  108. <el-table-column
  109. align="left"
  110. label="月份"
  111. prop="month"
  112. min-width="100"
  113. show-overflow-tooltip
  114. ></el-table-column>
  115. <el-table-column
  116. align="left"
  117. label="对账状态"
  118. prop="isReconciliation"
  119. min-width="100"
  120. show-overflow-tooltip
  121. >
  122. <template slot-scope="scope">
  123. <el-tag size="mini" type="danger" v-if="scope.row.isReconciliation == false">未对账</el-tag>
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="left" label="客户编码" prop="customerCode" min-width="100" show-overflow-tooltip>
  127. <template slot-scope="scope">
  128. <CopyButton :copyText="scope.row.customerCode" />
  129. <span>{{ scope.row.customerCode }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column align="left" label="客户名称" prop="customerName" min-width="260" show-overflow-tooltip>
  133. <template slot-scope="scope">
  134. <CopyButton :copyText="scope.row.customerName" />
  135. <span>{{ scope.row.customerName }}</span>
  136. </template>
  137. </el-table-column>
  138. <!-- <el-table-column
  139. align="left"
  140. label="部门"
  141. prop=""
  142. min-width="160"
  143. show-overflow-tooltip
  144. ></el-table-column> -->
  145. <el-table-column
  146. align="left"
  147. label="现金钱包类型"
  148. prop="walletName"
  149. min-width="160"
  150. show-overflow-tooltip
  151. ></el-table-column>
  152. <el-table-column
  153. align="left"
  154. label="单据类型"
  155. prop="billType"
  156. min-width="160"
  157. show-overflow-tooltip
  158. ></el-table-column>
  159. <el-table-column align="left" label="单据号" prop="billNo" min-width="160" show-overflow-tooltip>
  160. <template slot-scope="scope">
  161. <CopyButton :copyText="scope.row.billNo" />
  162. <span>{{ scope.row.billNo }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column
  166. align="left"
  167. label="单据日期"
  168. prop="theTime"
  169. min-width="160"
  170. show-overflow-tooltip
  171. ></el-table-column>
  172. <el-table-column
  173. align="left"
  174. label="备注"
  175. prop="remark"
  176. min-width="160"
  177. show-overflow-tooltip
  178. ></el-table-column>
  179. <el-table-column align="right" label="收付款金额" prop="amount" min-width="130" show-overflow-tooltip>
  180. <template slot-scope="scope">
  181. {{ (scope.row.amountType == 'OUT' ? -scope.row.amount : scope.row.amount) | numToFixed }}
  182. </template>
  183. </el-table-column>
  184. <!-- <el-table-column
  185. align="center"
  186. label="发货金额"
  187. prop=""
  188. min-width="160"
  189. show-overflow-tooltip
  190. ></el-table-column> -->
  191. </el-table>
  192. </div>
  193. <!-- 分页 -->
  194. <div class="fr">
  195. <el-pagination
  196. @size-change="handleSizeChange"
  197. @current-change="handleCurrentChange"
  198. :current-page="currentPage"
  199. :page-sizes="[10, 20, 30, 50]"
  200. :page-size="10"
  201. layout="total, sizes, prev, pager, next, jumper"
  202. :total="listTotal"
  203. >
  204. </el-pagination>
  205. </div>
  206. </div>
  207. </div>
  208. <AccountListDetail v-else />
  209. </div>
  210. </template>
  211. <script>
  212. import {
  213. getFinanceStandingBookList,
  214. getFinanceStandingBookCheck,
  215. getCustomerList,
  216. getWalletCustomerList
  217. } from '@/api/finance/account_list'
  218. import AccountListDetail from './components/account_list-detail'
  219. import { numToFixed } from '@/filters'
  220. export default {
  221. components: {
  222. AccountListDetail
  223. },
  224. data() {
  225. return {
  226. currentPage: 1, // 当前页码
  227. pageSize: 10, // 每页数量
  228. listTotal: 0, // 列表总数
  229. dataList: [], // 列表数据
  230. searchForm: {
  231. customerId: '',
  232. customerWalletId: '',
  233. billNo: '',
  234. startTime: '',
  235. endTime: ''
  236. }, //搜索表单
  237. listLoading: false, // 列表加载loading
  238. showReconciliation: true,
  239. customerList: [],
  240. walletList: [],
  241. isCollapse: true
  242. }
  243. },
  244. computed: {
  245. exParams() {
  246. return {
  247. ...this.searchForm,
  248. pageSize: this.pageSize,
  249. pageNum: this.currentPage,
  250. isReconciliation: false
  251. }
  252. }
  253. },
  254. created() {
  255. this.getDataList()
  256. this.getCustomerDataList({
  257. pageSize: -1,
  258. pageNum: 1
  259. })
  260. },
  261. methods: {
  262. //合计
  263. getSummaries(param) {
  264. const { columns, data } = param
  265. const sums = []
  266. columns.forEach((column, index) => {
  267. if (index === 0) {
  268. sums[index] = '合计'
  269. }
  270. if (index === 10) {
  271. let arr = []
  272. data.forEach(v => {
  273. if (v.amountType == 'OUT') {
  274. arr.push(-v.amount)
  275. } else {
  276. arr.push(v.amount)
  277. }
  278. })
  279. let a = arr.reduce((prev, curr) => {
  280. const value = Number(curr)
  281. if (!isNaN(value)) {
  282. return prev + curr
  283. } else {
  284. return prev
  285. }
  286. }, 0)
  287. sums[index] = numToFixed(a)
  288. }
  289. })
  290. return sums
  291. },
  292. //清空
  293. clearFn() {
  294. this.$refs.searchForm.resetFields()
  295. },
  296. //搜索
  297. searchFn() {
  298. this.currentPage = 1
  299. this.getDataList()
  300. },
  301. //改变经销商
  302. async changeFn(v) {
  303. this.searchForm.customerWalletId = ''
  304. let res = await getWalletCustomerList({ customerId: v })
  305. this.walletList = res.data
  306. },
  307. //获取经销商数据
  308. async getCustomerDataList(data) {
  309. const res = await getCustomerList(data)
  310. this.customerList = res.data.records
  311. },
  312. //记录
  313. recordFn() {
  314. this.showReconciliation = false
  315. },
  316. // 更改每页数量
  317. handleSizeChange(val) {
  318. this.pageSize = val
  319. this.currentPage = 1
  320. this.getDataList()
  321. },
  322. // 更改当前页
  323. handleCurrentChange(val) {
  324. this.currentPage = val
  325. this.getDataList()
  326. },
  327. //获取列表
  328. async getDataList() {
  329. let params = {
  330. pageNum: this.currentPage,
  331. pageSize: this.pageSize,
  332. customerId: this.searchForm.customerId,
  333. customerWalletId: this.searchForm.customerWalletId,
  334. billNo: this.searchForm.billNo,
  335. startTime: this.searchForm.startTime,
  336. endTime: this.searchForm.endTime,
  337. isReconciliation: false
  338. }
  339. let res = await getFinanceStandingBookList(params)
  340. // res.data.records.forEach((item) => {
  341. // item.sums1 = [];
  342. // item.sums2 = ["amount"];
  343. // });
  344. this.dataList = res.data.records
  345. this.listTotal = res.data.total
  346. },
  347. //一键对账
  348. async reconciliationFn() {
  349. const res = await getFinanceStandingBookList({
  350. pageSize: -1,
  351. pageNum: 1
  352. })
  353. let arr = res.data.records
  354. let ids = arr.map(v => v.id)
  355. console.log(ids)
  356. await getFinanceStandingBookCheck({ ids: ids.toString() })
  357. this.$message.success('对账成功')
  358. },
  359. seeFN() {
  360. this.showDetail = false
  361. }
  362. }
  363. }
  364. </script>
  365. <style lang="scss" scoped>
  366. .selectStyle {
  367. width: 100%;
  368. }
  369. </style>