list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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="{ x: 1440, y: tableHeight }"
  122. bordered>
  123. <!-- 单号 -->
  124. <template slot="salesBillNo" slot-scope="text, record">
  125. <span :class="$hasPermissions('B_salesDetail')?'active':'common'" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  126. </template>
  127. <!-- 操作 -->
  128. <template slot="action" slot-scope="text, record">
  129. <a-button
  130. size="small"
  131. type="link"
  132. v-if="record.financialStatus=='WAIT' && $hasPermissions('B_financialCollection_receipt')"
  133. class="button-warning"
  134. @click="handleAudit(record)"
  135. id="financialCollectionList-audit-btn">收款</a-button>
  136. <span v-else>--</span>
  137. </template>
  138. </s-table>
  139. </a-spin>
  140. </a-card>
  141. </template>
  142. <script>
  143. import moment from 'moment'
  144. import getDate from '@/libs/getDate.js'
  145. import { STable, VSelect } from '@/components'
  146. import rangeDate from '@/views/common/rangeDate.vue'
  147. import subarea from '@/views/common/subarea.js'
  148. import { getArea } from '@/api/data'
  149. import { salesReceiptList, salesReceipt } from '@/api/sales'
  150. export default {
  151. components: { STable, VSelect, subarea, rangeDate },
  152. data () {
  153. return {
  154. spinning: false,
  155. tableHeight: 0,
  156. queryParam: { // 查询条件
  157. beginAuditDate: getDate.getThreeMonthDays().starttime,
  158. endAuditDate: getDate.getCurrMonthDays().endtime,
  159. beginSettleDate: '',
  160. endSettleDate: '',
  161. buyerName: '',
  162. dealerLevel: undefined,
  163. settleStyleSn: undefined,
  164. subareaSn: undefined,
  165. billStatus: undefined,
  166. financialStatus: undefined,
  167. dealerProvinceSn: undefined,
  168. dealerCitySn: undefined,
  169. dealerCountySn: undefined
  170. },
  171. disabled: false, // 查询、重置按钮是否可操作
  172. auditDate: [
  173. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  174. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  175. ], // 审核时间
  176. advanced: false,
  177. columns: [
  178. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  179. { title: '审核时间', dataIndex: 'auditDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 180, align: 'center' },
  181. { title: '经销商名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  182. { title: '商户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  183. { title: '销售数量', dataIndex: 'totalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  184. { title: '订单金额', dataIndex: 'totalAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  185. { title: '收款时间', dataIndex: 'settleDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  186. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  187. { title: '备注', dataIndex: 'remarks', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  188. { title: '业务状态', dataIndex: 'billStatusDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  189. { title: '财务状态', dataIndex: 'financialStatusDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
  191. ],
  192. // 加载数据方法 必须为 Promise 对象
  193. loadData: parameter => {
  194. this.disabled = true
  195. this.spinning = true
  196. return salesReceiptList(Object.assign(parameter, this.queryParam)).then(res => {
  197. const data = res.data
  198. const no = (data.pageNo - 1) * data.pageSize
  199. for (var i = 0; i < data.list.length; i++) {
  200. data.list[i].no = no + i + 1
  201. }
  202. this.total = data.count || 0
  203. this.disabled = false
  204. this.spinning = false
  205. return data
  206. })
  207. },
  208. total: 0, // 合计
  209. addrProvinceList: [], // 省下拉
  210. addrCityList: [], // 市下拉
  211. addrDistrictList: [] // 区下拉
  212. }
  213. },
  214. methods: {
  215. // 审核时间 change
  216. dateAuditChange (date) {
  217. this.queryParam.beginAuditDate = date[0]
  218. this.queryParam.endAuditDate = date[1]
  219. },
  220. // 收款时间 change
  221. dateSettleChange (date) {
  222. this.queryParam.beginSettleDate = date[0]
  223. this.queryParam.endSettleDate = date[1]
  224. },
  225. // 重置
  226. resetSearchForm () {
  227. this.$refs.rangeAuditDate.resetDate(this.auditDate)
  228. if (this.advanced) { // 查询条件未展开时,该组件未渲染
  229. this.$refs.rangeSettleDate.resetDate()
  230. }
  231. this.queryParam.beginAuditDate = getDate.getThreeMonthDays().starttime
  232. this.queryParam.endAuditDate = getDate.getCurrMonthDays().endtime
  233. this.queryParam.beginSettleDate = ''
  234. this.queryParam.endSettleDate = ''
  235. this.queryParam.buyerName = ''
  236. this.queryParam.dealerLevel = undefined
  237. this.queryParam.settleStyleSn = undefined
  238. this.queryParam.subareaSn = undefined
  239. this.queryParam.billStatus = undefined
  240. this.queryParam.financialStatus = undefined
  241. this.queryParam.dealerProvinceSn = undefined
  242. this.queryParam.dealerCitySn = undefined
  243. this.queryParam.dealerCountySn = undefined
  244. this.$refs.table.refresh(true)
  245. },
  246. // 详情
  247. handleDetail (row) {
  248. if (this.$hasPermissions('B_salesDetail')) {
  249. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
  250. }
  251. },
  252. // 收款
  253. handleAudit (row) {
  254. const _this = this
  255. this.$confirm({
  256. title: '提示',
  257. content: '确认要收款吗?',
  258. centered: true,
  259. onOk () {
  260. _this.spinning = true
  261. salesReceipt({ sn: row.salesBillSn }).then(res => {
  262. if (res.status == 200) {
  263. _this.$message.success(res.message)
  264. _this.$refs.table.refresh()
  265. _this.spinning = false
  266. } else {
  267. _this.spinning = false
  268. }
  269. })
  270. }
  271. })
  272. },
  273. // 获取城市列表
  274. getCityList (val) {
  275. this.addrCityList = []
  276. this.addrDistrictList = []
  277. this.queryParam.dealerCitySn = undefined
  278. this.queryParam.dealerCountySn = undefined
  279. if (val) {
  280. this.getArea('city', val)
  281. }
  282. },
  283. // 获取区县列表
  284. getAreaList (val) {
  285. this.addrDistrictList = []
  286. this.queryParam.dealerCountySn = undefined
  287. if (val) {
  288. this.getArea('district', val)
  289. }
  290. },
  291. // 省/市/区
  292. getArea (leve, sn) {
  293. let params
  294. if (leve == 'province') {
  295. params = { type: '2' }
  296. } else {
  297. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  298. }
  299. getArea(params).then(res => {
  300. if (res.status == 200) {
  301. if (leve == 'province') {
  302. this.addrProvinceList = res.data || []
  303. } else if (leve == 'city') {
  304. this.addrCityList = res.data || []
  305. } else if (leve == 'district') {
  306. this.addrDistrictList = res.data || []
  307. }
  308. } else {
  309. if (leve == 'province') {
  310. this.addrProvinceList = []
  311. } else if (leve == 'city') {
  312. this.addrCityList = []
  313. } else if (leve == 'district') {
  314. this.addrDistrictList = []
  315. }
  316. }
  317. })
  318. },
  319. setTableH () {
  320. const tableSearchH = this.$refs.tableSearch.offsetHeight
  321. this.tableHeight = window.innerHeight - tableSearchH - 195
  322. }
  323. },
  324. mounted () {
  325. const _this = this
  326. this.$nextTick(() => { // 页面渲染完成后的回调
  327. _this.setTableH()
  328. })
  329. },
  330. watch: {
  331. advanced (newValue, oldValue) {
  332. const _this = this
  333. setTimeout(() => {
  334. _this.setTableH()
  335. }, 400)
  336. }
  337. },
  338. beforeRouteEnter (to, from, next) {
  339. next(vm => {
  340. vm.getArea('province')
  341. })
  342. }
  343. }
  344. </script>
  345. <style lang="less">
  346. .financialCollectionList-wrap{
  347. .active{
  348. color: #ed1c24;
  349. cursor: pointer;
  350. }
  351. .common{
  352. color: rgba(0, 0, 0, 0.65);
  353. }
  354. }
  355. </style>