list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesCollectionList-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="salesCollectionList-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="salesCollectionList-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="salesCollectionList-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="salesCollectionList-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.settleType"
  44. ref="settleType"
  45. id="salesCollectionList-settleType"
  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. <rangeDate ref="rangeSettleDate" @change="dateSettleChange" />
  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.settleStyle"
  60. ref="settleStyle"
  61. id="salesCollectionList-settleStyle"
  62. code="SETTLE_STYLE"
  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.billStatus"
  71. ref="billStatus"
  72. id="salesCollectionList-billStatus"
  73. code="DISPATCH_BILL_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.settleState"
  82. ref="settleState"
  83. id="salesCollectionList-settleState"
  84. code="FINANCIAL_RECEIVE_STATUS"
  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. <v-select
  92. v-model="queryParam.voidFlag"
  93. ref="voidFlag"
  94. id="salesCollectionList-voidFlag"
  95. code="VOID_FLAG"
  96. placeholder="请选择单据状态"
  97. allowClear></v-select>
  98. </a-form-item>
  99. </a-col>
  100. <a-col :md="6" :sm="24">
  101. <a-form-item label="所在区域">
  102. <subarea id="salesCollectionList-subarea" v-model="queryParam.subareaSn"></subarea>
  103. </a-form-item>
  104. </a-col>
  105. <a-col :md="6" :sm="24">
  106. <a-row>
  107. <a-form-item label="地区">
  108. <a-col span="24">
  109. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  110. <a-select v-model="queryParam.dealerProvinceSn" allowClear @change="getCityList" placeholder="请选择省">
  111. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  112. </a-select>
  113. </a-form-item>
  114. </a-col>
  115. <!-- <a-col span="7" offset="1">
  116. <a-form-item prop="dealerCitySn" style="margin: 0;">
  117. <a-select v-model="queryParam.dealerCitySn" allowClear @change="getAreaList" placeholder="请选择市">
  118. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  119. </a-select>
  120. </a-form-item>
  121. </a-col>
  122. <a-col span="7" offset="1">
  123. <a-form-item prop="dealerCountySn" style="margin: 0;">
  124. <a-select v-model="queryParam.dealerCountySn" allowClear placeholder="请选择区/县">
  125. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  126. </a-select>
  127. </a-form-item>
  128. </a-col> -->
  129. </a-form-item>
  130. </a-row>
  131. </a-col>
  132. </template>
  133. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  134. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesCollectionList-refresh">查询</a-button>
  135. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesCollectionList-reset">重置</a-button>
  136. <a @click="advanced=!advanced" style="margin-left: 5px">
  137. {{ advanced ? '收起' : '展开' }}
  138. <a-icon :type="advanced ? 'up' : 'down'"/>
  139. </a>
  140. </a-col>
  141. </a-row>
  142. </a-form>
  143. </div>
  144. <!-- 操作按钮 -->
  145. <div class="table-operator">
  146. <a-button type="primary" @click="handlePlColle()" class="button-error">批量收款</a-button>
  147. <span style="margin-left: 8px">
  148. <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  149. </span>
  150. </div>
  151. <!-- 列表 -->
  152. <s-table
  153. class="sTable fixPagination"
  154. ref="table"
  155. :style="{ height: tableHeight+84.5+'px' }"
  156. size="small"
  157. :row-selection=" showSelect?{ columnWidth: 40 }:null"
  158. @rowSelection="rowSelectionFun"
  159. :rowKey="(record) => record.id"
  160. :columns="columns"
  161. :data="loadData"
  162. :scroll="{ y: tableHeight }"
  163. :defaultLoadData="false"
  164. bordered>
  165. <!-- 单号 -->
  166. <template slot="bizNo" slot-scope="text, record">
  167. <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">{{ record.bizNo }}</span>
  168. <span v-else>{{ record.bizNo }}</span>
  169. </template>
  170. <!-- 下推单号 -->
  171. <template slot="dispatchBillNo" slot-scope="text, record">
  172. <span v-if="$hasPermissions('B_dispatchDetail')" class="link-bule" @click="handleBhDetail(record)">{{ record.dispatchBillNo }}</span>
  173. <span v-else>{{ record.dispatchBillNo || '--' }}</span>
  174. </template>
  175. <!-- 操作 -->
  176. <template slot="action" slot-scope="text, record">
  177. <a-button
  178. size="small"
  179. type="link"
  180. v-if="record.settleState=='WAIT' && record.voidFlag!=1 && $hasPermissions('B_financialCollection_receipt')"
  181. class="button-warning"
  182. @click="handleColle(row)"
  183. id="salesCollectionList-audit-btn">收款</a-button>
  184. <span v-else>--</span>
  185. </template>
  186. </s-table>
  187. <!-- 销售收款弹框 -->
  188. <commonModal
  189. :openModal="showSkModal"
  190. modalTit="销售收款"
  191. @cancel="showSkModal=false"
  192. @ok="handleSaveColle"
  193. >
  194. <div style="text-align: center;line-height: 24px;">
  195. <div v-if="handlePlData.length">箭冠汽配西安大兴店,共 {{ handlePlData && handlePlData.length }} 个备货单,合计 1266.45 元</div>
  196. <div style="padding: 15px 0;font-weight: bold;">请选择收款类型</div>
  197. <div>
  198. <v-select
  199. v-model="queryParam.settleType"
  200. showType="radio"
  201. code="SALES_SOURCE"
  202. ></v-select>
  203. </div>
  204. </div>
  205. </commonModal>
  206. </a-spin>
  207. </a-card>
  208. </template>
  209. <script>
  210. import { commonMixin } from '@/utils/mixin'
  211. import moment from 'moment'
  212. import getDate from '@/libs/getDate.js'
  213. import { STable, VSelect } from '@/components'
  214. import rangeDate from '@/views/common/rangeDate.vue'
  215. import subarea from '@/views/common/subarea.js'
  216. import { getArea } from '@/api/data'
  217. import commonModal from '@/views/common/commonModal.vue'
  218. import { settleReceiptList, settleReceipt } from '@/api/settleReceipt'
  219. export default {
  220. name: 'SalesCollectionList',
  221. mixins: [commonMixin],
  222. components: { STable, VSelect, subarea, rangeDate, commonModal },
  223. data () {
  224. return {
  225. spinning: false,
  226. showTipModal: false,
  227. showSkModal: false,
  228. tableHeight: 0,
  229. queryParam: { // 查询条件
  230. beginDate: getDate.getThreeMonthDays().starttime + ' 00:00:00',
  231. endDate: getDate.getCurrMonthDays().endtime + ' 23:59:59',
  232. bizNo: '',
  233. dispatchBillNo: '',
  234. beginDateSettle: '',
  235. endDateSettle: '',
  236. settleClientName: '',
  237. dealerLevel: undefined,
  238. settleStyle: undefined,
  239. subareaSn: undefined,
  240. billStatus: undefined,
  241. settleState: undefined,
  242. voidFlag: undefined,
  243. dealerProvinceSn: undefined,
  244. dealerCitySn: undefined,
  245. dealerCountySn: undefined
  246. },
  247. disabled: false, // 查询、重置按钮是否可操作
  248. auditDate: [
  249. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  250. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  251. ], // 审核时间
  252. advanced: false,
  253. // 加载数据方法 必须为 Promise 对象
  254. loadData: parameter => {
  255. this.disabled = true
  256. this.spinning = true
  257. return settleReceiptList(Object.assign(parameter, this.queryParam)).then(res => {
  258. let data
  259. if (res.status == 200) {
  260. data = res.data
  261. const no = (data.pageNo - 1) * data.pageSize
  262. for (var i = 0; i < data.list.length; i++) {
  263. data.list[i].no = no + i + 1
  264. }
  265. this.total = data.count || 0
  266. this.disabled = false
  267. }
  268. this.spinning = false
  269. return data
  270. })
  271. },
  272. total: 0, // 合计
  273. addrProvinceList: [], // 省下拉
  274. addrCityList: [], // 市下拉
  275. addrDistrictList: [], // 区下拉
  276. rowSelectionInfo: null,
  277. handlePlData: []
  278. }
  279. },
  280. // 根据权限显示列表字段
  281. computed: {
  282. // 是否显示table选择框
  283. showSelect () {
  284. return this.$hasPermissions('B_productInfo_batchAudit')
  285. },
  286. columns () {
  287. const arr = [
  288. { title: '创建时间', dataIndex: 'createDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  289. { title: '销售单号', scopedSlots: { customRender: 'bizNo' }, width: '10%', align: 'center' },
  290. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
  291. { title: '发货编号', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  292. { title: '客户名称', dataIndex: 'settleClientName', align: 'left', width: '9%', customRender: function (text) { return text || '--' }, ellipsis: true },
  293. { title: '收货客户名称', dataIndex: 'settleClientName', align: 'left', width: '9%', customRender: function (text) { return text || '--' }, ellipsis: true },
  294. { title: '产品款数', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  295. { title: '产品数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  296. // { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  297. { title: '收款类型', dataIndex: 'settleStyleDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  298. { title: '收款时间', dataIndex: 'settleTime', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  299. { title: '收款方式', dataIndex: 'settleStyleDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  300. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  301. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  302. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  303. { title: '操作', scopedSlots: { customRender: 'action' }, width: '4%', align: 'center' }
  304. ]
  305. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  306. arr.splice(8, 0, { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  307. }
  308. return arr
  309. }
  310. },
  311. methods: {
  312. // 表格选中项
  313. rowSelectionFun (obj) {
  314. this.rowSelectionInfo = obj || null
  315. },
  316. // 审核时间 change
  317. dateAuditChange (date) {
  318. this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : ''
  319. this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : ''
  320. },
  321. // 收款时间 change
  322. dateSettleChange (date) {
  323. this.queryParam.beginDateSettle = date[0] ? date[0] + ' 00:00:00' : ''
  324. this.queryParam.endDateSettle = date[1] ? date[1] + ' 23:59:59' : ''
  325. },
  326. // 重置
  327. resetSearchForm () {
  328. this.$refs.rangeAuditDate.resetDate(this.auditDate)
  329. if (this.advanced) { // 查询条件未展开时,该组件未渲染
  330. this.$refs.rangeSettleDate.resetDate()
  331. }
  332. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime + ' 00:00:00'
  333. this.queryParam.endDate = getDate.getCurrMonthDays().endtime + ' 23:59:59'
  334. this.queryParam.bizNo = ''
  335. this.queryParam.dispatchBillNo = ''
  336. this.queryParam.beginDateSettle = ''
  337. this.queryParam.endDateSettle = ''
  338. this.queryParam.settleClientName = ''
  339. this.queryParam.dealerLevel = undefined
  340. this.queryParam.settleStyle = undefined
  341. this.queryParam.subareaSn = undefined
  342. this.queryParam.billStatus = undefined
  343. this.queryParam.settleState = undefined
  344. this.queryParam.voidFlag = undefined
  345. this.queryParam.dealerProvinceSn = undefined
  346. this.queryParam.dealerCitySn = undefined
  347. this.queryParam.dealerCountySn = undefined
  348. this.$refs.table.refresh(true)
  349. },
  350. // 销售单详情
  351. handleDetail (row) {
  352. this.$router.push({ name: 'salesDetail', params: { sn: row.bizSn, type: 'salesCollection' } })
  353. },
  354. // 备货单号
  355. handleBhDetail (row) {
  356. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'salesCollection' } })
  357. },
  358. // 收款
  359. handlePlColle () {
  360. const _this = this
  361. const slen = _this.rowSelectionInfo.selectedRowKeys.length
  362. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
  363. _this.$message.warning('请在列表勾选后再进行批量操作!')
  364. return
  365. }
  366. // 判断是否选择相同的客户
  367. const settleClientName = _this.rowSelectionInfo.selectedRows[0].settleClientName
  368. const haseq = _this.rowSelectionInfo.selectedRows.filter(item => item.settleClientName == settleClientName)
  369. if (haseq.length == slen) {
  370. this.handlePlData = _this.rowSelectionInfo.selectedRows
  371. this.showSkModal = true
  372. } else {
  373. this.$info({
  374. title: '操作提示',
  375. centered: true,
  376. content: '您所选择的备货单,不属于同一个客户,无法收款,请重新选择。只能针对一个客户的备货单进行批量收款。',
  377. onOk () {}
  378. })
  379. }
  380. },
  381. handleColle (row) {
  382. this.handlePlData = [row]
  383. this.showSkModal = true
  384. },
  385. handleSaveColle (row) {
  386. const _this = this
  387. _this.spinning = true
  388. settleReceipt({ sn: row.accountReceiptSn }).then(res => {
  389. if (res.status == 200) {
  390. _this.$message.success(res.message)
  391. _this.$refs.table.refresh()
  392. _this.spinning = false
  393. } else {
  394. _this.spinning = false
  395. }
  396. })
  397. },
  398. // 获取城市列表
  399. getCityList (val) {
  400. this.addrCityList = []
  401. this.addrDistrictList = []
  402. this.queryParam.dealerCitySn = undefined
  403. this.queryParam.dealerCountySn = undefined
  404. if (val) {
  405. this.getArea('city', val)
  406. }
  407. },
  408. // 获取区县列表
  409. getAreaList (val) {
  410. this.addrDistrictList = []
  411. this.queryParam.dealerCountySn = undefined
  412. if (val) {
  413. this.getArea('district', val)
  414. }
  415. },
  416. // 省/市/区
  417. getArea (leve, sn) {
  418. let params
  419. if (leve == 'province') {
  420. params = { type: '2' }
  421. } else {
  422. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  423. }
  424. getArea(params).then(res => {
  425. if (res.status == 200) {
  426. if (leve == 'province') {
  427. this.addrProvinceList = res.data || []
  428. } else if (leve == 'city') {
  429. this.addrCityList = res.data || []
  430. } else if (leve == 'district') {
  431. this.addrDistrictList = res.data || []
  432. }
  433. } else {
  434. if (leve == 'province') {
  435. this.addrProvinceList = []
  436. } else if (leve == 'city') {
  437. this.addrCityList = []
  438. } else if (leve == 'district') {
  439. this.addrDistrictList = []
  440. }
  441. }
  442. })
  443. },
  444. pageInit () {
  445. const _this = this
  446. this.$nextTick(() => { // 页面渲染完成后的回调
  447. _this.setTableH()
  448. })
  449. this.getArea('province')
  450. },
  451. setTableH () {
  452. const tableSearchH = this.$refs.tableSearch.offsetHeight
  453. this.tableHeight = window.innerHeight - tableSearchH - 235
  454. }
  455. },
  456. watch: {
  457. advanced (newValue, oldValue) {
  458. const _this = this
  459. this.$nextTick(() => { // 页面渲染完成后的回调
  460. _this.setTableH()
  461. })
  462. },
  463. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  464. this.setTableH()
  465. }
  466. },
  467. mounted () {
  468. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  469. this.pageInit()
  470. this.resetSearchForm()
  471. }
  472. },
  473. activated () {
  474. // 如果是新页签打开,则重置当前页面
  475. if (this.$store.state.app.isNewTab) {
  476. this.pageInit()
  477. this.resetSearchForm()
  478. }
  479. // 仅刷新列表,不重置页面
  480. if (this.$store.state.app.updateList) {
  481. this.pageInit()
  482. this.$refs.table.refresh()
  483. }
  484. },
  485. beforeRouteEnter (to, from, next) {
  486. next(vm => {})
  487. }
  488. }
  489. </script>
  490. <style lang="less">
  491. .salesCollectionList-wrap{
  492. .active{
  493. color: #ed1c24;
  494. cursor: pointer;
  495. }
  496. .common{
  497. color: rgba(0, 0, 0);
  498. }
  499. }
  500. </style>