list.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesSlipReportList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form-model
  7. id="salesSlipReportList-form"
  8. layout="inline"
  9. ref="ruleForm"
  10. :model="queryParam"
  11. :rules="rules"
  12. @keyup.enter.native="handleSearch">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-model-item label="销售日期" prop="time">
  16. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-model-item label="客户名称">
  21. <custList id="salesSlipReportList-allocateTypeSn" ref="custList" @change="custChange"></custList>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-model-item label="客户类型">
  26. <v-select
  27. v-model="queryParam.dealer.dealerLevel"
  28. ref="dealerLevel"
  29. id="salesSlipReportList-allocateTypeSn"
  30. code="DEALER_LEVEL"
  31. placeholder="请选择客户类型"
  32. allowClear></v-select>
  33. </a-form-model-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="销售单号">
  38. <a-input id="salesSlipReportList-allocateTypeSn" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-model-item label="所在区域">
  43. <subarea id="salesSlipReportList-allocateTypeSn" v-model="queryParam.dealer.subareaSn"></subarea>
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="12" :sm="24">
  47. <a-row>
  48. <a-form-model-item label="地区">
  49. <a-col span="7">
  50. <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
  51. <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
  52. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  53. </a-select>
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col span="7" offset="1">
  57. <a-form-model-item prop="dealerCitySn" style="margin: 0;">
  58. <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
  59. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  60. </a-select>
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col span="7" offset="1">
  64. <a-form-model-item prop="dealerCountySn" style="margin: 0;">
  65. <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
  66. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  67. </a-select>
  68. </a-form-model-item>
  69. </a-col>
  70. </a-form-model-item>
  71. </a-row>
  72. </a-col>
  73. </template>
  74. <a-col :md="6" :sm="24">
  75. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesSlipReportList-refresh">查询</a-button>
  76. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesSlipReportList-reset">重置</a-button>
  77. <a @click="advanced=!advanced" style="margin-left: 8px">
  78. {{ advanced ? '收起' : '展开' }}
  79. <a-icon :type="advanced ? 'up' : 'down'"/>
  80. </a>
  81. </a-col>
  82. </a-row>
  83. </a-form-model>
  84. </div>
  85. <!-- 列表 -->
  86. <s-table
  87. class="sTable"
  88. ref="table"
  89. size="small"
  90. :defaultLoadData="false"
  91. :rowKey="(record) => record.id"
  92. :columns="columns"
  93. :data="loadData"
  94. :scroll="{ x: 3220 }"
  95. bordered>
  96. <template slot="footer">
  97. <a-row>
  98. <a-col span="2">合计:</a-col>
  99. <a-col span="22">
  100. <a-row>
  101. <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? totalData.jpLqqAmount : '--' }}</a-col>
  102. <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? totalData.jpYgpAmount : '--' }}</a-col>
  103. <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? totalData.jpLbAmount : '--' }}</a-col>
  104. <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? totalData.jpScpAmount : '--' }}</a-col>
  105. <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? totalData.jpGyxAmount : '--' }}</a-col>
  106. <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? totalData.gpLqqAmount : '--' }}</a-col>
  107. <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? totalData.gpYgpAmount : '--' }}</a-col>
  108. <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? totalData.gpScpAmount : '--' }}</a-col>
  109. <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? totalData.hjAmount : '--' }}</a-col>
  110. <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? totalData.dlsAmount : '--' }}</a-col>
  111. <a-col span="4">稳升:{{ (totalData && (totalData.wsAmount || totalData.wsAmount==0)) ? totalData.wsAmount : '--' }}</a-col>
  112. <a-col span="4">TBU:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? totalData.tbuAmount : '--' }}</a-col>
  113. <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? totalData.ngkAmount : '--' }}</a-col>
  114. <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? totalData.flpAmount : '--' }}</a-col>
  115. <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? totalData.cpAmount : '--' }}</a-col>
  116. <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? totalData.wetAmount : '--' }}</a-col>
  117. <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? totalData.lbstAmount : '--' }}</a-col>
  118. <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? totalData.defAmount : '--' }}</a-col>
  119. <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? totalData.bndAmount : '--' }}</a-col>
  120. <a-col span="4">开单销售单合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? totalData.totalAmount : '--' }}</a-col>
  121. </a-row>
  122. </a-col>
  123. </a-row>
  124. </template>
  125. </s-table>
  126. </a-spin>
  127. </a-card>
  128. </template>
  129. <script>
  130. import getDate from '@/libs/getDate.js'
  131. import { STable, VSelect } from '@/components'
  132. import rangeDate from '@/views/common/rangeDate.vue'
  133. import custList from '@/views/common/custList.vue'
  134. import subarea from '@/views/common/subarea.js'
  135. import { getArea } from '@/api/data'
  136. import { salesBillReportList, salesBillReportCount } from '@/api/salesBillReport'
  137. export default {
  138. components: { STable, VSelect, rangeDate, subarea, custList },
  139. data () {
  140. return {
  141. spinning: false,
  142. advanced: false, // 高级搜索 展开/关闭
  143. tableHeight: 0,
  144. queryParam: { // 查询条件
  145. time: [
  146. getDate.getCurrMonthDays().starttime,
  147. getDate.getCurrMonthDays().endtime
  148. ],
  149. beginDate: getDate.getCurrMonthDays().starttime,
  150. endDate: getDate.getCurrMonthDays().endtime,
  151. salesBillNo: '', // 销售单号
  152. dealer: {
  153. 'dealerSn': undefined,
  154. 'provinceSn': undefined,
  155. 'citySn': undefined,
  156. 'districtSn': undefined,
  157. 'subareaSn': undefined,
  158. 'dealerLevel': undefined
  159. }
  160. },
  161. rules: {
  162. 'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
  163. },
  164. disabled: false, // 查询、重置按钮是否可操作
  165. exportLoading: false,
  166. columns: [
  167. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  168. { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return text ? text.join('/') : '--' } },
  169. { title: '销售单号', dataIndex: 'salesBillNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  171. { title: '客户名称', dataIndex: 'dealer.dealerName', align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '客户类型', dataIndex: 'dealer.dealerLevelDictValue', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  173. { title: '品牌',
  174. align: 'center',
  175. children: [
  176. {
  177. title: '箭牌',
  178. align: 'center',
  179. children: [
  180. {
  181. title: '滤清器',
  182. dataIndex: 'jpLqqAmount',
  183. align: 'center',
  184. width: 100,
  185. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  186. },
  187. {
  188. title: '雨刮片',
  189. dataIndex: 'jpYgpAmount',
  190. align: 'center',
  191. width: 100,
  192. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  193. },
  194. {
  195. title: '喇叭',
  196. dataIndex: 'jpLbAmount',
  197. align: 'center',
  198. width: 100,
  199. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  200. },
  201. {
  202. title: '刹车片',
  203. dataIndex: 'pp4',
  204. align: 'jpScpAmount',
  205. width: 100,
  206. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  207. },
  208. {
  209. title: '感应线',
  210. dataIndex: 'jpGyxAmount',
  211. align: 'center',
  212. width: 100,
  213. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  214. }
  215. ]
  216. },
  217. {
  218. title: '冠牌',
  219. align: 'center',
  220. children: [
  221. {
  222. title: '滤清器',
  223. dataIndex: 'gpLqqAmount',
  224. align: 'center',
  225. width: 100,
  226. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  227. },
  228. {
  229. title: '雨刮片',
  230. dataIndex: 'gpYgpAmount',
  231. align: 'center',
  232. width: 100,
  233. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  234. },
  235. {
  236. title: '刹车片',
  237. dataIndex: 'gpScpAmount',
  238. align: 'center',
  239. width: 100,
  240. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  241. }
  242. ]
  243. },
  244. {
  245. title: '汇箭',
  246. dataIndex: 'hjAmount',
  247. align: 'center',
  248. width: 100,
  249. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  250. },
  251. {
  252. title: '德路斯',
  253. dataIndex: 'dlsAmount',
  254. align: 'center',
  255. width: 100,
  256. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  257. },
  258. {
  259. title: '稳升',
  260. dataIndex: 'wsAmount',
  261. align: 'center',
  262. width: 100,
  263. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  264. },
  265. {
  266. title: 'TBU',
  267. dataIndex: 'tbuAmount',
  268. align: 'center',
  269. width: 100,
  270. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  271. }
  272. ] },
  273. { title: '代理品牌',
  274. align: 'center',
  275. children: [
  276. {
  277. title: 'NGK',
  278. dataIndex: 'ngkAmount',
  279. align: 'center',
  280. width: 100,
  281. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  282. },
  283. {
  284. title: '飞利浦',
  285. dataIndex: 'flpAmount',
  286. align: 'center',
  287. width: 100,
  288. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  289. },
  290. {
  291. title: '车仆',
  292. dataIndex: 'cpAmount',
  293. align: 'center',
  294. width: 100,
  295. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  296. },
  297. {
  298. title: '瓦尔塔',
  299. dataIndex: 'wetAmount',
  300. align: 'center',
  301. width: 100,
  302. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  303. },
  304. {
  305. title: '雷贝斯托',
  306. dataIndex: 'lbstAmount',
  307. align: 'center',
  308. width: 100,
  309. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  310. },
  311. {
  312. title: '德尔福',
  313. dataIndex: 'defAmount',
  314. align: 'center',
  315. width: 100,
  316. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  317. },
  318. {
  319. title: '巴诺德',
  320. dataIndex: 'bndAmount',
  321. align: 'center',
  322. width: 100,
  323. customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
  324. }
  325. ] },
  326. { title: '实际销售单合计金额', width: 200, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
  327. ],
  328. // 加载数据方法 必须为 Promise 对象
  329. loadData: parameter => {
  330. this.disabled = true
  331. this.spinning = true
  332. if (this.tableHeight == 0) {
  333. this.tableHeight = window.innerHeight - 380
  334. }
  335. const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) // 有分页
  336. delete paramsPage.time
  337. return salesBillReportList(paramsPage).then(res => {
  338. this.getCount(paramsPage)
  339. const data = res.data
  340. const no = (data.pageNo - 1) * data.pageSize
  341. for (var i = 0; i < data.list.length; i++) {
  342. data.list[i].no = no + i + 1
  343. }
  344. this.disabled = false
  345. this.spinning = false
  346. return data
  347. })
  348. },
  349. totalData: null,
  350. addrProvinceList: [], // 省下拉
  351. addrCityList: [], // 市下拉
  352. addrDistrictList: [] // 区下拉
  353. }
  354. },
  355. methods: {
  356. // 总计
  357. getCount (params) {
  358. salesBillReportCount(params).then(res => {
  359. if (res.status == 200 && res.data) {
  360. this.totalData = res.data
  361. } else {
  362. this.totalData = null
  363. }
  364. })
  365. },
  366. handleSearch () {
  367. const _this = this
  368. this.$refs.ruleForm.validate(valid => {
  369. if (valid) {
  370. _this.$refs.table.refresh(true)
  371. } else {
  372. return false
  373. }
  374. })
  375. },
  376. // 创建时间 change
  377. dateChange (date) {
  378. if (date.length) {
  379. if (date[0] == '' && date[1] == '') {
  380. this.resetSearchForm()
  381. } else {
  382. this.queryParam.time = date
  383. }
  384. }
  385. this.queryParam.beginDate = date[0]
  386. this.queryParam.endDate = date[1]
  387. },
  388. custChange (val) {
  389. this.queryParam.dealer.dealerSn = val.key
  390. },
  391. // 重置
  392. resetSearchForm () {
  393. this.queryParam.time = [
  394. getDate.getCurrMonthDays().starttime,
  395. getDate.getCurrMonthDays().endtime
  396. ]
  397. this.$refs.rangeDate.resetDate(this.queryParam.time)
  398. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  399. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  400. this.queryParam.salesBillNo = ''
  401. this.queryParam.dealer = {
  402. 'dealerSn': undefined,
  403. 'provinceSn': undefined,
  404. 'citySn': undefined,
  405. 'districtSn': undefined,
  406. 'subareaSn': undefined,
  407. 'dealerLevel': undefined
  408. }
  409. this.$refs.custList.resetForm()
  410. this.$refs.ruleForm.resetFields()
  411. this.$refs.table.clearTable()
  412. },
  413. // 获取城市列表
  414. getCityList (val) {
  415. this.addrCityList = []
  416. this.addrDistrictList = []
  417. this.queryParam.dealer.citySn = undefined
  418. this.queryParam.dealer.districtSn = undefined
  419. this.getArea('city', val)
  420. },
  421. // 获取区县列表
  422. getAreaList (val) {
  423. this.addrDistrictList = []
  424. this.queryParam.dealer.districtSn = undefined
  425. this.getArea('district', val)
  426. },
  427. // 省/市/区
  428. getArea (leve, sn) {
  429. let params
  430. if (leve == 'province') {
  431. params = { type: '2' }
  432. } else {
  433. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  434. }
  435. getArea(params).then(res => {
  436. if (res.status == 200) {
  437. if (leve == 'province') {
  438. this.addrProvinceList = res.data || []
  439. } else if (leve == 'city') {
  440. this.addrCityList = res.data || []
  441. } else if (leve == 'district') {
  442. this.addrDistrictList = res.data || []
  443. }
  444. } else {
  445. if (leve == 'province') {
  446. this.addrProvinceList = []
  447. } else if (leve == 'city') {
  448. this.addrCityList = []
  449. } else if (leve == 'district') {
  450. this.addrDistrictList = []
  451. }
  452. }
  453. })
  454. }
  455. },
  456. beforeRouteEnter (to, from, next) {
  457. next(vm => {
  458. vm.getArea('province')
  459. })
  460. }
  461. }
  462. </script>