list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div 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" @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" @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" 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">
  102. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  103. <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  104. <a @click="advanced=!advanced" style="margin-left: 8px">
  105. {{ advanced ? '收起' : '展开' }}
  106. <a-icon :type="advanced ? 'up' : 'down'"/>
  107. </a>
  108. </a-col>
  109. </a-row>
  110. </a-form>
  111. </div>
  112. <!-- 总计 -->
  113. <a-alert type="info" showIcon style="margin-bottom:15px">
  114. <div slot="message">合计:<strong>{{ total }}</strong>条</div>
  115. </a-alert>
  116. <!-- 列表 -->
  117. <s-table
  118. class="sTable"
  119. ref="table"
  120. size="default"
  121. :rowKey="(record) => record.id"
  122. :columns="columns"
  123. :data="loadData"
  124. :scroll="{ x: 1820, y: tableHeight }"
  125. bordered>
  126. <!-- 单号 -->
  127. <template slot="salesBillNo" slot-scope="text, record">
  128. <span :class="$hasPermissions('B_salesDetail')?'active':'common'" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  129. </template>
  130. <!-- 操作 -->
  131. <template slot="action" slot-scope="text, record">
  132. <a-button
  133. size="small"
  134. type="link"
  135. v-if="record.financialStatus=='WAIT' && $hasPermissions('B_financialCollection_receipt')"
  136. class="button-warning"
  137. @click="handleAudit(record)"
  138. id="financialCollectionList-audit-btn">收款</a-button>
  139. <span v-else>--</span>
  140. </template>
  141. </s-table>
  142. </a-spin>
  143. </a-card>
  144. </template>
  145. <script>
  146. import moment from 'moment'
  147. import getDate from '@/libs/getDate.js'
  148. import { STable, VSelect } from '@/components'
  149. import rangeDate from '@/views/common/rangeDate.vue'
  150. import subarea from '@/views/common/subarea.js'
  151. import { getArea } from '@/api/data'
  152. import { salesReceiptList, salesReceipt } from '@/api/sales'
  153. export default {
  154. components: { STable, VSelect, subarea, rangeDate },
  155. data () {
  156. return {
  157. spinning: false,
  158. queryParam: { // 查询条件
  159. beginAuditDate: getDate.getThreeMonthDays().starttime,
  160. endAuditDate: getDate.getCurrMonthDays().endtime,
  161. beginSettleDate: '',
  162. endSettleDate: '',
  163. buyerName: '',
  164. dealerLevel: undefined,
  165. settleStyleSn: undefined,
  166. subareaSn: undefined,
  167. billStatus: undefined,
  168. financialStatus: undefined,
  169. dealerProvinceSn: undefined,
  170. dealerCitySn: undefined,
  171. dealerCountySn: undefined
  172. },
  173. tableHeight: 0,
  174. disabled: false, // 查询、重置按钮是否可操作
  175. auditDate: [
  176. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  177. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  178. ], // 审核时间
  179. advanced: false,
  180. columns: [
  181. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  182. { title: '审核时间', dataIndex: 'auditDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  183. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 220, align: 'center' },
  184. { title: '经销商名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  185. { title: '商户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  186. { title: '销售数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  187. { title: '订单金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  188. { title: '收款时间', dataIndex: 'settleDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  189. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '备注', dataIndex: 'remarks', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  191. { title: '业务状态', dataIndex: 'billStatusDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  192. { title: '财务状态', dataIndex: 'financialStatusDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  193. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  194. ],
  195. // 加载数据方法 必须为 Promise 对象
  196. loadData: parameter => {
  197. this.disabled = true
  198. if (this.tableHeight == 0) {
  199. this.tableHeight = window.innerHeight - 380
  200. }
  201. return salesReceiptList(Object.assign(parameter, this.queryParam)).then(res => {
  202. const data = res.data
  203. const no = (data.pageNo - 1) * data.pageSize
  204. for (var i = 0; i < data.list.length; i++) {
  205. data.list[i].no = no + i + 1
  206. }
  207. this.total = data.count
  208. this.disabled = false
  209. return data
  210. })
  211. },
  212. total: 0, // 合计
  213. addrProvinceList: [], // 省下拉
  214. addrCityList: [], // 市下拉
  215. addrDistrictList: [] // 区下拉
  216. }
  217. },
  218. methods: {
  219. // 审核时间 change
  220. dateAuditChange (date) {
  221. this.queryParam.beginAuditDate = date[0]
  222. this.queryParam.endAuditDate = date[1]
  223. },
  224. // 收款时间 change
  225. dateSettleChange (date) {
  226. this.queryParam.beginSettleDate = date[0]
  227. this.queryParam.endSettleDate = date[1]
  228. },
  229. // 重置
  230. resetSearchForm () {
  231. this.$refs.rangeAuditDate.resetDate(this.auditDate)
  232. if (this.advanced) { // 查询条件未展开时,该组件未渲染
  233. this.$refs.rangeSettleDate.resetDate()
  234. }
  235. this.queryParam.beginAuditDate = getDate.getThreeMonthDays().starttime
  236. this.queryParam.endAuditDate = getDate.getCurrMonthDays().endtime
  237. this.queryParam.beginSettleDate = ''
  238. this.queryParam.endSettleDate = ''
  239. this.queryParam.buyerName = ''
  240. this.queryParam.dealerLevel = undefined
  241. this.queryParam.settleStyleSn = undefined
  242. this.queryParam.subareaSn = undefined
  243. this.queryParam.billStatus = undefined
  244. this.queryParam.financialStatus = undefined
  245. this.queryParam.dealerProvinceSn = undefined
  246. this.queryParam.dealerCitySn = undefined
  247. this.queryParam.dealerCountySn = undefined
  248. this.$refs.table.refresh(true)
  249. },
  250. // 详情
  251. handleDetail (row) {
  252. if (this.$hasPermissions('B_salesDetail')) {
  253. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
  254. }
  255. },
  256. // 收款
  257. handleAudit (row) {
  258. const _this = this
  259. this.$confirm({
  260. title: '提示',
  261. content: '确认要收款吗?',
  262. centered: true,
  263. onOk () {
  264. _this.spinning = true
  265. salesReceipt({ sn: row.salesBillSn }).then(res => {
  266. if (res.status == 200) {
  267. _this.$message.success(res.message)
  268. _this.$refs.table.refresh()
  269. _this.spinning = false
  270. } else {
  271. _this.spinning = false
  272. }
  273. })
  274. }
  275. })
  276. },
  277. // 获取城市列表
  278. getCityList (val) {
  279. this.addrCityList = []
  280. this.addrDistrictList = []
  281. this.queryParam.dealerCitySn = undefined
  282. this.queryParam.dealerCountySn = undefined
  283. this.getArea('city', val)
  284. },
  285. // 获取区县列表
  286. getAreaList (val) {
  287. this.addrDistrictList = []
  288. this.queryParam.dealerCountySn = undefined
  289. this.getArea('district', val)
  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. },
  320. beforeRouteEnter (to, from, next) {
  321. next(vm => {
  322. vm.getArea('province')
  323. })
  324. }
  325. }
  326. </script>
  327. <style lang="less">
  328. .financialCollectionList-wrap{
  329. .sTable{
  330. margin-top: 20px;
  331. }
  332. .active{
  333. color: #ed1c24;
  334. cursor: pointer;
  335. }
  336. .common{
  337. color: #000;
  338. }
  339. }
  340. </style>