list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="审核时间">
  10. <rangeDate ref="rangeAuditDate" :value="auditDate" @change="dateAuditChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="销售单号">
  15. <a-input id="financialCollectionList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入销售单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="备货单号">
  20. <a-input id="financialCollectionList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="经销商名称">
  26. <a-input id="financialCollectionList-settleClientName" v-model.trim="queryParam.settleClientName" allowClear placeholder="请输入经销商名称"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="商户级别">
  31. <v-select
  32. v-model="queryParam.dealerLevel"
  33. ref="dealerLevel"
  34. id="financialCollectionList-dealerLevel"
  35. code="DEALER_LEVEL"
  36. placeholder="请选择商户级别"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="收款方式">
  42. <v-select
  43. v-model="queryParam.settleStyle"
  44. ref="settleStyle"
  45. id="financialCollectionList-settleStyle"
  46. code="SETTLE_STYLE"
  47. placeholder="请选择收款方式"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="区域">
  53. <subarea id="financialCollectionList-subarea" v-model="queryParam.subareaSn"></subarea>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-item label="业务状态">
  58. <v-select
  59. v-model="queryParam.billStatus"
  60. ref="billStatus"
  61. id="financialCollectionList-billStatus"
  62. code="DISPATCH_BILL_STATUS"
  63. placeholder="请选择业务状态"
  64. allowClear></v-select>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-item label="财务状态">
  69. <v-select
  70. v-model="queryParam.settleState"
  71. ref="settleState"
  72. id="financialCollectionList-settleState"
  73. code="FINANCIAL_RECEIVE_STATUS"
  74. placeholder="请选择财务状态"
  75. allowClear></v-select>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-item label="单据状态">
  80. <v-select
  81. v-model="queryParam.voidFlag"
  82. ref="voidFlag"
  83. id="financialCollectionList-voidFlag"
  84. code="VOID_FLAG"
  85. placeholder="请选择单据状态"
  86. allowClear></v-select>
  87. </a-form-item>
  88. </a-col>
  89. <a-col :md="6" :sm="24">
  90. <a-form-item label="收款时间">
  91. <rangeDate ref="rangeSettleDate" @change="dateSettleChange" />
  92. </a-form-item>
  93. </a-col>
  94. <a-col :md="12" :sm="24">
  95. <a-row>
  96. <a-form-item label="经销商地区">
  97. <a-col span="7">
  98. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  99. <a-select v-model="queryParam.dealerProvinceSn" allowClear @change="getCityList" placeholder="请选择省">
  100. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  101. </a-select>
  102. </a-form-item>
  103. </a-col>
  104. <a-col span="7" offset="1">
  105. <a-form-item prop="dealerCitySn" style="margin: 0;">
  106. <a-select v-model="queryParam.dealerCitySn" allowClear @change="getAreaList" placeholder="请选择市">
  107. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  108. </a-select>
  109. </a-form-item>
  110. </a-col>
  111. <a-col span="7" offset="1">
  112. <a-form-item prop="dealerCountySn" style="margin: 0;">
  113. <a-select v-model="queryParam.dealerCountySn" allowClear placeholder="请选择区/县">
  114. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  115. </a-select>
  116. </a-form-item>
  117. </a-col>
  118. </a-form-item>
  119. </a-row>
  120. </a-col>
  121. </template>
  122. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  123. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  124. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  125. <a @click="advanced=!advanced" style="margin-left: 5px">
  126. {{ advanced ? '收起' : '展开' }}
  127. <a-icon :type="advanced ? 'up' : 'down'"/>
  128. </a>
  129. </a-col>
  130. </a-row>
  131. </a-form>
  132. </div>
  133. <!-- 列表 -->
  134. <s-table
  135. class="sTable fixPagination"
  136. ref="table"
  137. :style="{ height: tableHeight+84.5+'px' }"
  138. size="small"
  139. :rowKey="(record) => record.id"
  140. :columns="columns"
  141. :data="loadData"
  142. :scroll="{ y: tableHeight }"
  143. :defaultLoadData="false"
  144. bordered>
  145. <!-- 单号 -->
  146. <template slot="bizNo" slot-scope="text, record">
  147. <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">{{ record.bizNo }}</span>
  148. <span v-else>{{ record.bizNo }}</span>
  149. </template>
  150. <!-- 下推单号 -->
  151. <template slot="dispatchBillNo" slot-scope="text, record">
  152. <span v-if="$hasPermissions('B_dispatchDetail')" class="link-bule" @click="handleBhDetail(record)">{{ record.dispatchBillNo }}</span>
  153. <span v-else>{{ record.dispatchBillNo || '--' }}</span>
  154. </template>
  155. <!-- 操作 -->
  156. <template slot="action" slot-scope="text, record">
  157. <a-button
  158. size="small"
  159. type="link"
  160. v-if="record.settleState=='WAIT' && record.voidFlag!=1 && $hasPermissions('B_financialCollection_receipt')"
  161. class="button-warning"
  162. @click="handleAudit(record)"
  163. id="financialCollectionList-audit-btn">收款</a-button>
  164. <span v-else>--</span>
  165. </template>
  166. </s-table>
  167. </a-spin>
  168. </a-card>
  169. </template>
  170. <script>
  171. import { commonMixin } from '@/utils/mixin'
  172. import moment from 'moment'
  173. import getDate from '@/libs/getDate.js'
  174. import { STable, VSelect } from '@/components'
  175. import rangeDate from '@/views/common/rangeDate.vue'
  176. import subarea from '@/views/common/subarea.js'
  177. import { getArea } from '@/api/data'
  178. import { settleReceiptList, settleReceipt } from '@/api/settleReceipt'
  179. export default {
  180. name: 'FinancialCollectionList',
  181. mixins: [commonMixin],
  182. components: { STable, VSelect, subarea, rangeDate },
  183. data () {
  184. return {
  185. spinning: false,
  186. tableHeight: 0,
  187. queryParam: { // 查询条件
  188. beginDate: getDate.getThreeMonthDays().starttime + ' 00:00:00',
  189. endDate: getDate.getCurrMonthDays().endtime + ' 23:59:59',
  190. bizNo: '',
  191. dispatchBillNo: '',
  192. beginDateSettle: '',
  193. endDateSettle: '',
  194. settleClientName: '',
  195. dealerLevel: undefined,
  196. settleStyle: undefined,
  197. subareaSn: undefined,
  198. billStatus: undefined,
  199. settleState: undefined,
  200. voidFlag: undefined,
  201. dealerProvinceSn: undefined,
  202. dealerCitySn: undefined,
  203. dealerCountySn: undefined
  204. },
  205. disabled: false, // 查询、重置按钮是否可操作
  206. auditDate: [
  207. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  208. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  209. ], // 审核时间
  210. advanced: false,
  211. // 加载数据方法 必须为 Promise 对象
  212. loadData: parameter => {
  213. this.disabled = true
  214. this.spinning = true
  215. return settleReceiptList(Object.assign(parameter, this.queryParam)).then(res => {
  216. let data
  217. if (res.status == 200) {
  218. data = res.data
  219. const no = (data.pageNo - 1) * data.pageSize
  220. for (var i = 0; i < data.list.length; i++) {
  221. data.list[i].no = no + i + 1
  222. }
  223. this.total = data.count || 0
  224. this.disabled = false
  225. }
  226. this.spinning = false
  227. return data
  228. })
  229. },
  230. total: 0, // 合计
  231. addrProvinceList: [], // 省下拉
  232. addrCityList: [], // 市下拉
  233. addrDistrictList: [] // 区下拉
  234. }
  235. },
  236. // 根据权限显示列表字段
  237. computed: {
  238. columns () {
  239. const arr = [
  240. { title: '审核时间', dataIndex: 'createDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  241. { title: '销售单号', scopedSlots: { customRender: 'bizNo' }, width: '10%', align: 'center' },
  242. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
  243. { title: '经销商名称', dataIndex: 'settleClientName', align: 'left', width: '9%', customRender: function (text) { return text || '--' }, ellipsis: true },
  244. { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  245. { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  246. // { title: '销售金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  247. { title: '收款时间', dataIndex: 'settleTime', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '收款方式', dataIndex: 'settleStyleDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  249. { title: '备注', dataIndex: 'remark', width: '7%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  250. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  251. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  252. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  253. { title: '操作', scopedSlots: { customRender: 'action' }, width: '4%', align: 'center' }
  254. ]
  255. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  256. arr.splice(6, 0, { title: '销售金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  257. }
  258. return arr
  259. }
  260. },
  261. methods: {
  262. // 审核时间 change
  263. dateAuditChange (date) {
  264. this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : ''
  265. this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : ''
  266. },
  267. // 收款时间 change
  268. dateSettleChange (date) {
  269. this.queryParam.beginDateSettle = date[0] ? date[0] + ' 00:00:00' : ''
  270. this.queryParam.endDateSettle = date[1] ? date[1] + ' 23:59:59' : ''
  271. },
  272. // 重置
  273. resetSearchForm () {
  274. this.$refs.rangeAuditDate.resetDate(this.auditDate)
  275. if (this.advanced) { // 查询条件未展开时,该组件未渲染
  276. this.$refs.rangeSettleDate.resetDate()
  277. }
  278. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime + ' 00:00:00'
  279. this.queryParam.endDate = getDate.getCurrMonthDays().endtime + ' 23:59:59'
  280. this.queryParam.bizNo = ''
  281. this.queryParam.dispatchBillNo = ''
  282. this.queryParam.beginDateSettle = ''
  283. this.queryParam.endDateSettle = ''
  284. this.queryParam.settleClientName = ''
  285. this.queryParam.dealerLevel = undefined
  286. this.queryParam.settleStyle = undefined
  287. this.queryParam.subareaSn = undefined
  288. this.queryParam.billStatus = undefined
  289. this.queryParam.settleState = undefined
  290. this.queryParam.voidFlag = undefined
  291. this.queryParam.dealerProvinceSn = undefined
  292. this.queryParam.dealerCitySn = undefined
  293. this.queryParam.dealerCountySn = undefined
  294. this.$refs.table.refresh(true)
  295. },
  296. // 详情
  297. handleDetail (row) {
  298. this.$router.push({ name: 'salesDetail', params: { sn: row.bizSn, type: 'financialCollection' } })
  299. },
  300. handleBhDetail (row) {
  301. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'financialCollection' } })
  302. },
  303. // 收款
  304. handleAudit (row) {
  305. const _this = this
  306. this.$confirm({
  307. title: '提示',
  308. content: '确认要收款吗?',
  309. centered: true,
  310. onOk () {
  311. _this.spinning = true
  312. settleReceipt({ sn: row.accountReceiptSn }).then(res => {
  313. if (res.status == 200) {
  314. _this.$message.success(res.message)
  315. _this.$refs.table.refresh()
  316. _this.spinning = false
  317. } else {
  318. _this.spinning = false
  319. }
  320. })
  321. }
  322. })
  323. },
  324. // 获取城市列表
  325. getCityList (val) {
  326. this.addrCityList = []
  327. this.addrDistrictList = []
  328. this.queryParam.dealerCitySn = undefined
  329. this.queryParam.dealerCountySn = undefined
  330. if (val) {
  331. this.getArea('city', val)
  332. }
  333. },
  334. // 获取区县列表
  335. getAreaList (val) {
  336. this.addrDistrictList = []
  337. this.queryParam.dealerCountySn = undefined
  338. if (val) {
  339. this.getArea('district', val)
  340. }
  341. },
  342. // 省/市/区
  343. getArea (leve, sn) {
  344. let params
  345. if (leve == 'province') {
  346. params = { type: '2' }
  347. } else {
  348. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  349. }
  350. getArea(params).then(res => {
  351. if (res.status == 200) {
  352. if (leve == 'province') {
  353. this.addrProvinceList = res.data || []
  354. } else if (leve == 'city') {
  355. this.addrCityList = res.data || []
  356. } else if (leve == 'district') {
  357. this.addrDistrictList = res.data || []
  358. }
  359. } else {
  360. if (leve == 'province') {
  361. this.addrProvinceList = []
  362. } else if (leve == 'city') {
  363. this.addrCityList = []
  364. } else if (leve == 'district') {
  365. this.addrDistrictList = []
  366. }
  367. }
  368. })
  369. },
  370. pageInit () {
  371. const _this = this
  372. this.$nextTick(() => { // 页面渲染完成后的回调
  373. _this.setTableH()
  374. })
  375. this.getArea('province')
  376. },
  377. setTableH () {
  378. const tableSearchH = this.$refs.tableSearch.offsetHeight
  379. this.tableHeight = window.innerHeight - tableSearchH - 195
  380. }
  381. },
  382. watch: {
  383. advanced (newValue, oldValue) {
  384. const _this = this
  385. this.$nextTick(() => { // 页面渲染完成后的回调
  386. _this.setTableH()
  387. })
  388. },
  389. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  390. this.setTableH()
  391. }
  392. },
  393. mounted () {
  394. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  395. this.pageInit()
  396. this.resetSearchForm()
  397. }
  398. },
  399. activated () {
  400. // 如果是新页签打开,则重置当前页面
  401. if (this.$store.state.app.isNewTab) {
  402. this.pageInit()
  403. this.resetSearchForm()
  404. }
  405. // 仅刷新列表,不重置页面
  406. if (this.$store.state.app.updateList) {
  407. this.pageInit()
  408. this.$refs.table.refresh()
  409. }
  410. },
  411. beforeRouteEnter (to, from, next) {
  412. next(vm => {})
  413. }
  414. }
  415. </script>
  416. <style lang="less">
  417. .financialCollectionList-wrap{
  418. .active{
  419. color: #ed1c24;
  420. cursor: pointer;
  421. }
  422. .common{
  423. color: rgba(0, 0, 0);
  424. }
  425. }
  426. </style>