index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <basic-container>
  3. <avue-crud :key="key" ref="crud" :option="option" :data="data" :search.sync="query" @on-load="onLoad"
  4. @search-reset="resetChange" :page.sync="page" :cell-style="cellStyle" @search-change="searchChange"
  5. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 337.2)"
  6. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 337.2)">
  7. <template slot="menuLeft">
  8. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  9. </template>
  10. <template slot="header">
  11. <el-table :data="commodityData" border size="small" @header-click="cellClick" style="width: 100%">
  12. <el-table-column v-for="(item, index) in commodityLabel" :key="index" :prop="item.prop"
  13. show-overflow-tooltip :label="item.label" />
  14. </el-table>
  15. </template>
  16. <!-- <template slot="customerNameSearch">
  17. <search-query :datalist="customerData" :selectValue="query.customerName" :filterable="true"
  18. :clearable="true" :remote="true" :buttonIf="false"
  19. :forParameter="{ key: 'id', label: 'cname', value: 'cname' }" placeholder="请选择客户名称"
  20. @remoteMethod="KHgetListfun" @corpFocus="KHgetListfun" @corpChange="corpChange($event, 'customerName')">
  21. </search-query>
  22. </template> -->
  23. <template slot="brandNameSearch">
  24. <search-query :datalist="brandData" :selectValue="query.brandName" :clearable="true" :buttonIf="false"
  25. :forParameter="{ key: 'id', label: 'cname', value: 'cname' }" placeholder="请选择品牌"
  26. @corpFocus="listAllfun" @corpChange="corpChange($event, 'brandName')">
  27. </search-query>
  28. </template>
  29. <template slot="storageIdSearch">
  30. <search-query :datalist="storageData" :selectValue="query.storageId" :clearable="true" :buttonIf="false"
  31. :forParameter="{ key: 'id', label: 'cname', value: 'id' }" placeholder="请选择品牌"
  32. @corpFocus="storageIdfun" @corpChange="corpChange($event, 'storageId')">
  33. </search-query>
  34. </template>
  35. <!--<template slot="goodsNameSearch">-->
  36. <!-- <search-query :datalist="goodsData"-->
  37. <!-- :selectValue="query.goodsName"-->
  38. <!-- :filterable="true"-->
  39. <!-- :clearable="true"-->
  40. <!-- :remote="true"-->
  41. <!-- :buttonIf="false"-->
  42. <!-- :forParameter="{key:'id',label:'cname',value:'cname'}"-->
  43. <!-- placeholder="请选择商品名称"-->
  44. <!-- @remoteMethod="SPgetListfun"-->
  45. <!-- @corpFocus="SPgetListfun"-->
  46. <!-- @corpChange="corpChange($event,'goodsName')">-->
  47. <!-- </search-query>-->
  48. <!--</template>-->
  49. <template slot="salerNameSearch">
  50. <search-query :datalist="salerData" :selectValue="query.salerName" :clearable="true" :buttonIf="false"
  51. :forParameter="{ key: 'id', label: 'name', value: 'name' }" placeholder="请选择业务员"
  52. @corpFocus="YWYgetListfun" @corpChange="corpChange($event, 'salerName')">
  53. </search-query>
  54. </template>
  55. <template slot="actualPaymentStatusSearch">
  56. <search-query :datalist="actualPaymentStatusData" :selectValue="query.actualPaymentStatus"
  57. :clearable="true" :buttonIf="false"
  58. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }" placeholder="请选择结算方式"
  59. @corpFocus="actualPaymentWorkDictsfun" @corpChange="corpChange($event, 'actualPaymentStatus')">
  60. </search-query>
  61. </template>
  62. <template slot="bsTypeSearch">
  63. <search-query :datalist="bsTypeData" :selectValue="query.bsType" :clearable="false" :buttonIf="false"
  64. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }" placeholder="请选择单据状态"
  65. @corpChange="corpChange($event, 'bsType')">
  66. </search-query>
  67. </template>
  68. <template slot="isContainSearch">
  69. <el-checkbox v-model="query.isContain" :true-label="1" :false-label="0"></el-checkbox>
  70. </template>
  71. <template slot="status" slot-scope="{ row }">
  72. <span>{{ row.status }}</span>
  73. </template>
  74. </avue-crud>
  75. </basic-container>
  76. </template>
  77. <script>
  78. import { statisticsSaleDetail, statisticsSaleDetailSum } from "@/api/saleDetail";
  79. import { defaultDate3 } from "@/util/date";
  80. import { getList as KHgetList } from '@/api/tirePartsMall/basicData/customerInformation/index'
  81. import { getList as SPgetList } from '@/api/tirePartsMall/basicData/commodityInformation/index'
  82. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  83. import { getWorkDicts } from "@/api/system/dictbiz";
  84. import { getToken } from "@/util/auth";
  85. import { getSalesman } from "@/api/landTransportation";
  86. import { listAll, storageDesc } from "@/api/tirePartsMall/basicData/listingManagement";
  87. import { getParamservice } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  88. export default {
  89. components: { SearchQuery },
  90. data() {
  91. return {
  92. key: 0,
  93. data: [],
  94. total: [],
  95. storageData: [],
  96. query: {
  97. businesDateStart: defaultDate3()[0],
  98. businesDateEnd: defaultDate3()[1],
  99. isContain: 1,
  100. bsType: 'CG,TKCG,RZCG',
  101. },
  102. page: {
  103. pageSize: 10,
  104. currentPage: 1,
  105. total: 0,
  106. pageSizes: [10, 50, 100, 200, 300]
  107. },
  108. option: {},
  109. optionList: {
  110. align: 'center',
  111. stripe: true,
  112. index: true,
  113. menu: false,
  114. height: "auto",
  115. searchSpan: 6,
  116. // searchIcon: true,
  117. // searchIndex: 2,
  118. // highlightCurrentRow: true,
  119. border: true,
  120. searchMenuSpan: 18,
  121. addBtn: false,
  122. showSummary: true,
  123. summaryText: "合计",
  124. sumColumnList: [
  125. {
  126. name: 'goodsNum',
  127. type: 'sum',
  128. decimals: 0
  129. },
  130. {
  131. name: 'subTotalMoney',
  132. type: 'sum',
  133. decimals: 2
  134. },
  135. {
  136. name: 'costprie',
  137. type: 'sum',
  138. decimals: 2
  139. },
  140. {
  141. name: 'profit',
  142. type: 'sum',
  143. decimals: 2
  144. },
  145. {
  146. name: 'primaryGoodsTotalNum',
  147. type: 'sum',
  148. decimals: 0
  149. },
  150. {
  151. name: 'primaryGoodsTotalMoney',
  152. type: 'sum',
  153. decimals: 2
  154. },
  155. {
  156. name: 'price',
  157. type: 'sum',
  158. decimals: 2
  159. },
  160. {
  161. name: 'outGoodsTotalShipNum',
  162. type: 'sum',
  163. decimals: 0
  164. },
  165. {
  166. name: 'outGoodsTotalShipAmount',
  167. type: 'sum',
  168. decimals: 2
  169. },
  170. {
  171. name: 'surplusNum',
  172. type: 'sum',
  173. decimals: 0
  174. },
  175. {
  176. name: 'surplusAmount',
  177. type: 'sum',
  178. decimals: 2
  179. }
  180. ],
  181. column: [{
  182. label: '供应商名称',
  183. prop: 'customerName',
  184. overHidden: true,
  185. width: 100,
  186. search: true,
  187. searchslot: true,
  188. searchOrder: 3
  189. },
  190. // {
  191. // label: '业务员',
  192. // prop: 'salerName',
  193. // overHidden: true,
  194. // search: true,
  195. // searchslot: true,
  196. // searchOrder: 4
  197. // },
  198. {
  199. label: '仓库',
  200. prop: "storageName",
  201. searchProp: "storageId",
  202. search: true,
  203. overHidden: true,
  204. searchOrder: 9
  205. }, {
  206. label: '业务编号',
  207. prop: 'ordNo',
  208. overHidden: true,
  209. search: true,
  210. searchOrder: 5
  211. }, {
  212. label: '业务日期',
  213. prop: 'businesDate',
  214. overHidden: true,
  215. }, {
  216. label: '入库时间',
  217. prop: 'deliveryBusinesDate',
  218. overHidden: true,
  219. }, {
  220. label: '结算状态',
  221. prop: 'actualPaymentStatus',
  222. overHidden: true,
  223. search: true,
  224. searchslot: true,
  225. searchOrder: 7
  226. }, {
  227. label: '品牌',
  228. prop: 'brandName',
  229. overHidden: true,
  230. search: true,
  231. searchslot: true,
  232. searchOrder: 6.1,
  233. }, {
  234. label: '商品编码',
  235. prop: 'code',
  236. overHidden: true,
  237. search: true,
  238. searchslot: true,
  239. searchOrder: 6
  240. }, {
  241. label: '商品名称',
  242. prop: 'goodsName',
  243. overHidden: true,
  244. search: true,
  245. searchslot: true,
  246. searchOrder: 6
  247. }, {
  248. label: '规格型号',
  249. prop: 'propertyName',
  250. overHidden: true,
  251. }, {
  252. label: '花纹',
  253. prop: 'pattern',
  254. overHidden: true,
  255. },
  256. // {
  257. // label: '数量',
  258. // prop: 'goodsNum',
  259. // overHidden: true,
  260. // },
  261. {
  262. label: '价格',
  263. prop: 'price',
  264. overHidden: true,
  265. },
  266. // {
  267. // label: '金额',
  268. // prop: 'subTotalMoney',
  269. // overHidden: true,
  270. // },
  271. {
  272. label: '订单数量',
  273. prop: 'primaryGoodsTotalNum',
  274. overHidden: true,
  275. },
  276. {
  277. label: '订单金额',
  278. prop: 'primaryGoodsTotalMoney',
  279. overHidden: true,
  280. },
  281. {
  282. label: '入库数量',
  283. prop: 'goodsNum',
  284. overHidden: true,
  285. },
  286. {
  287. label: '入库金额',
  288. prop: 'subTotalMoney',
  289. overHidden: true,
  290. },
  291. {
  292. label: '卖出数量',
  293. prop: 'outGoodsTotalShipNum',
  294. overHidden: true,
  295. },
  296. {
  297. label: '卖出金额',
  298. prop: 'outGoodsTotalShipAmount',
  299. overHidden: true,
  300. },
  301. {
  302. label: '剩余数量',
  303. prop: 'surplusNum',
  304. overHidden: true,
  305. },
  306. {
  307. label: '剩余金额',
  308. prop: 'surplusAmount',
  309. overHidden: true,
  310. },
  311. // {
  312. // label: '成本',
  313. // prop: 'costprie',
  314. // overHidden: true,
  315. // },
  316. // {
  317. // label: '毛利',
  318. // prop: 'profit',
  319. // overHidden: true,
  320. // },
  321. {
  322. label: '业务开始',
  323. prop: 'businesDateStart',
  324. overHidden: true,
  325. search: true,
  326. hide: true,
  327. searchOrder: 1,
  328. type: "date",
  329. format: "yyyy-MM-dd",
  330. valueFormat: "yyyy-MM-dd",
  331. },
  332. {
  333. label: '业务结束',
  334. prop: 'businesDateEnd',
  335. overHidden: true,
  336. search: true,
  337. hide: true,
  338. searchOrder: 2,
  339. type: "date",
  340. format: "yyyy-MM-dd",
  341. valueFormat: "yyyy-MM-dd",
  342. },
  343. {
  344. label: '入库开始',
  345. prop: 'dateStart',
  346. overHidden: true,
  347. search: true,
  348. hide: true,
  349. searchOrder: 2.1,
  350. type: "date",
  351. format: "yyyy-MM-dd",
  352. valueFormat: "yyyy-MM-dd",
  353. },
  354. {
  355. label: '入库结束',
  356. prop: 'dateEnd',
  357. overHidden: true,
  358. search: true,
  359. hide: true,
  360. searchOrder: 2.2,
  361. type: "date",
  362. format: "yyyy-MM-dd",
  363. valueFormat: "yyyy-MM-dd",
  364. },
  365. {
  366. label: '单据状态',
  367. prop: 'status',
  368. overHidden: true,
  369. // search: true,
  370. // searchslot: true,
  371. // searchOrder: 8
  372. },
  373. {
  374. label: '业务类型',
  375. prop: 'bsType',
  376. overHidden: true,
  377. search: true,
  378. searchslot: true,
  379. searchOrder: 8
  380. },
  381. {
  382. label: '包含未收货',
  383. prop: 'isContain',
  384. overHidden: true,
  385. hide: true,
  386. search: true,
  387. searchslot: true,
  388. searchOrder: 10
  389. }]
  390. },
  391. bsTypeData: [],
  392. customerData: [], // 客户数据
  393. brandData: [], // 品牌数据
  394. goodsData: [], // 商品名称
  395. salerData: [], // 业务员
  396. actualPaymentStatusData: [], // 结算状态
  397. statusData: [], // 单据状态
  398. commodityData: [], // 合计数据
  399. // 合计的配置项
  400. commodityLabel: [{
  401. id: 1,
  402. label: '订单数量',
  403. prop: 'primaryGoodsTotalNum'
  404. },
  405. {
  406. id: 2,
  407. label: '订单金额',
  408. prop: 'primaryGoodsTotalMoney'
  409. },
  410. // {
  411. // id: 3,
  412. // label: '采购成本',
  413. // prop: 'costprie'
  414. // },
  415. // {
  416. // id: 4,
  417. // label: '采购毛利',
  418. // prop: 'profit'
  419. // },
  420. {
  421. id: 5,
  422. label: '已取消数量',
  423. prop: 'goodsSumCancellation'
  424. },
  425. {
  426. id: 6,
  427. label: '已取消金额',
  428. prop: 'amountCancellation'
  429. },
  430. {
  431. label: '入库数量',
  432. prop: 'goodsSum',
  433. },
  434. {
  435. label: '入库金额',
  436. prop: 'amount',
  437. },
  438. {
  439. label: '卖出数量',
  440. prop: 'outGoodsTotalShipNum',
  441. },
  442. {
  443. label: '卖出金额',
  444. prop: 'outGoodsTotalShipAmount',
  445. },
  446. {
  447. label: '剩余数量',
  448. prop: 'surplusNum',
  449. },
  450. {
  451. label: '剩余金额',
  452. prop: 'surplusAmount',
  453. },
  454. // {
  455. // id: 7,
  456. // label: '已取消成本',
  457. // prop: 'costprieCancellation'
  458. // },
  459. // {
  460. // id: 8,
  461. // label: '已取消毛利',
  462. // prop: 'profitCancellation'
  463. // }
  464. ],
  465. }
  466. },
  467. async created() {
  468. this.option = await this.getColumnData(this.getColumnName(337.2), this.optionList);
  469. getWorkDicts('cg_business_Type').then(res2 => {
  470. getParamservice(1, 10, { paramKey: 'whether.financing' }).then(res => {
  471. if (res.data.data.records.length) {
  472. res.data.data.records.forEach(e => {
  473. if (e.paramValue == 1) {
  474. this.bsTypeData = res2.data.data
  475. } else {
  476. this.bsTypeData = res2.data.data.filter(e => e.dictKey != "RZCG")
  477. }
  478. })
  479. } else {
  480. this.bsTypeData = res2.data.data.filter(e => e.dictKey != "RZCG")
  481. }
  482. })
  483. })
  484. this.query = this.deepClone(this.query)
  485. },
  486. methods: {
  487. resetChange() {
  488. this.query = {
  489. businesDateStart: defaultDate3()[0],
  490. businesDateEnd: defaultDate3()[1],
  491. isContain: 1,
  492. bsType: 'CG,TKCG,RZCG',
  493. }
  494. },
  495. cellStyle({ row, rowIndex }) {
  496. if (row.status == '已取消') {
  497. return 'color: red';
  498. }
  499. return
  500. },
  501. //导出
  502. outExport() {
  503. let config = { params: { ...this.query } }
  504. if (config.params) {
  505. for (const propName of Object.keys(config.params)) {
  506. const value = config.params[propName];
  507. if (value !== null && typeof (value) !== "undefined") {
  508. if (value instanceof Array) {
  509. for (const key of Object.keys(value)) {
  510. let params = propName + '[' + key + ']';
  511. config.params[params] = value[key]
  512. }
  513. delete config.params[propName]
  514. }
  515. }
  516. }
  517. }
  518. const routeData = this.$router.resolve({
  519. path: '/api/blade-sales-part/statistics/saleDetailExport', //跳转目标窗口的地址
  520. query: {
  521. ...config.params, //括号内是要传递给新窗口的参数
  522. }
  523. })
  524. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  525. },
  526. // 获取品牌数据
  527. listAllfun() {
  528. listAll().then(res => {
  529. this.brandData = res.data.data
  530. })
  531. },
  532. //获取仓库
  533. storageIdfun() {
  534. storageDesc().then(res => {
  535. this.storageData = res.data.data
  536. })
  537. },
  538. // 获取客户数据
  539. KHgetListfun(cname) {
  540. KHgetList({ current: 1, size: 20, corpType: 'GYS', cname: cname ? cname : null }).then(res => {
  541. this.customerData = res.data.data.records
  542. })
  543. },
  544. // 获取业务员数据
  545. YWYgetListfun(realName) {
  546. // YWYgetList(1,10,{realName:realName?realName:null}).then(res=>{
  547. // this.salerData = res.data.data.records
  548. // })
  549. getSalesman().then(res => {
  550. this.salerData = res.data.data
  551. })
  552. },
  553. // 获取商品数据
  554. SPgetListfun(cname) {
  555. SPgetList({ current: 1, size: 20, cname: cname ? cname : null }).then(res => {
  556. this.goodsData = res.data.data.records
  557. })
  558. },
  559. // 结算状态
  560. actualPaymentWorkDictsfun() {
  561. getWorkDicts('settlement_Status').then(res => {
  562. this.actualPaymentStatusData = res.data.data
  563. })
  564. },
  565. // 单据状态
  566. statusWorkDictsfun() {
  567. getWorkDicts('sales_Status').then(res => {
  568. this.statusData = res.data.data
  569. })
  570. },
  571. // 下拉回调
  572. corpChange(value, name) {
  573. this.$set(this.query, name, value)
  574. },
  575. //搜索
  576. searchChange(params, done) {
  577. this.query = params;
  578. this.onLoad(this.page, params)
  579. done();
  580. },
  581. // 获取列表数据
  582. onLoad(page, params = {}) {
  583. let queryParams = {
  584. size: page.pageSize,
  585. current: page.currentPage,
  586. bsType: 'CG,TKCG',
  587. ...Object.assign(params, this.query)
  588. }
  589. statisticsSaleDetail(queryParams).then(res => {
  590. this.data = res.data.data.records
  591. this.page.total = res.data.data.total
  592. // this.option.height = window.innerHeight - 230;
  593. // generalLedgerTotal(queryParams).then(res=>{
  594. // this.total = res.data.data
  595. // })
  596. statisticsSaleDetailSum({ ...Object.assign(params, this.query) }).then(re => {
  597. this.commodityData = [re.data.data]
  598. })
  599. }).finally(() => {
  600. this.$refs.crud.doLayout();
  601. })
  602. },
  603. //自定义列保存
  604. async saveColumnTwo(ref, option, optionBack, code) {
  605. /**
  606. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  607. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  608. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  609. */
  610. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  611. if (inSave) {
  612. this.$message.success("保存成功");
  613. //关闭窗口
  614. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  615. }
  616. },
  617. //自定义列重置
  618. async resetColumnTwo(ref, option, optionBack, code) {
  619. this[option] = this[optionBack];
  620. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  621. if (inSave) {
  622. this.$message.success("重置成功");
  623. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  624. }
  625. },
  626. }
  627. }
  628. </script>
  629. <style scoped></style>