list.vue 16 KB

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