index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div>
  3. <basic-container class="page-crad" v-show="show">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch" @search-reset="searchReset">
  8. <template slot="header">
  9. <el-table :data="commodityData" border size="small" @header-click="cellClick" style="width: 100%"
  10. v-loading="itemloading">
  11. <el-table-column v-for="(item, index) in commodityLabel" :key="index" :prop="item.prop" show-overflow-tooltip
  12. :label="item.label" />
  13. </el-table>
  14. </template>
  15. <template slot="menuLeft">
  16. <el-button type="info" icon="el-icon-printer" size="small" :loading="exportLoading" @click.stop="statement"
  17. v-if="false">报表打印</el-button>
  18. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  19. </template>
  20. <template slot="corpNameSearch">
  21. <crop-select v-model="search.corpId" corpType="KG"></crop-select>
  22. </template>
  23. <template slot="sizeSearch">
  24. <el-select v-model="search.size" placeholder="请选择">
  25. <el-option label="是" :value="1"></el-option>
  26. <el-option label="否" :value="0"></el-option>
  27. </el-select>
  28. </template>
  29. <template slot="customerName" slot-scope="scope">
  30. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{
  31. scope.row.customerName
  32. }}</span>
  33. </template>
  34. <template slot="whetherSettlementSearch">
  35. <el-checkbox v-model="search.whetherSettlement" :true-label="0" :false-label="1"></el-checkbox>
  36. </template>
  37. </avue-crud>
  38. </basic-container>
  39. <report-dialog :switchDialog="switchDialog" :searchValue="statementData" :reportName="'经销商-可用库存表'"
  40. @onClose="onClose()" />
  41. <detail v-if="!show" :detail-data="detailData" :trade-type="tradeType" @goBack="goBack"></detail>
  42. </div>
  43. </template>
  44. <script>
  45. import { getToken } from "@/util/auth";
  46. import { getList } from "@/api/statisticAnalysis/collectLedger";
  47. import { getStatisticsList, statisticsSum } from "@/api/tireMall/tirePartsMall/statisticAnalysis/index";
  48. import { micrometerFormat } from "@/util/validate";
  49. import _ from "lodash";
  50. import reportDialog from "@/components/report-dialog/main";
  51. import { gainUser } from "@/api/basicData/customerInquiry";
  52. import detail from "./detail";
  53. import { dateFormat } from "@/util/date";
  54. export default {
  55. name: "index",
  56. components: {
  57. reportDialog,
  58. detail
  59. },
  60. data() {
  61. return {
  62. itemloading: false,
  63. commodityLabel: [
  64. {
  65. id: 1,
  66. label: "金额",
  67. prop: "totalMoney",
  68. }, {
  69. id: 2,
  70. label: "实收金额",
  71. prop: "paymentAmountTl",
  72. }, {
  73. id: 3,
  74. label: "运费",
  75. prop: "freight",
  76. }, {
  77. id: 4,
  78. label: "未收金额",
  79. prop: "outstandingAmount",
  80. }
  81. ],
  82. commodityData: [], // 合计数据
  83. exportLoading: false,
  84. switchDialog: false,
  85. statementData: {},
  86. form: {},
  87. search: {
  88. whetherSettlement: 0,
  89. businesDateList:[dateFormat(new Date,'yyyy-MM'),dateFormat(new Date,'yyyy-MM')]
  90. },
  91. dataList: [],
  92. loading: false,
  93. detailData: {},
  94. page: {
  95. pageSize: 20,
  96. currentPage: 1,
  97. total: 0,
  98. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  99. },
  100. option: {},
  101. defaultOption: {
  102. // searchShow: true,
  103. align: "center",
  104. searchSpan: 6,
  105. searchMenuSpan: 24,
  106. border: true,
  107. index: true,
  108. addBtn: false,
  109. viewBtn: false,
  110. editBtn: false,
  111. delBtn: false,
  112. showSummary: true,
  113. summaryText: '合计',
  114. sumColumnList: [
  115. {
  116. name: 'totalMoney',
  117. type: 'sum'
  118. },
  119. {
  120. name: 'paymentAmountTl',
  121. type: 'sum'
  122. },
  123. {
  124. name: 'freight',
  125. type: 'sum'
  126. },
  127. {
  128. name: 'outstandingAmount',
  129. type: 'sum'
  130. },
  131. ],
  132. // searchIcon: true,
  133. // searchIndex: 3,
  134. menu: false,
  135. column: [
  136. {
  137. label: '客户',
  138. prop: "customerName",
  139. type: "select",
  140. search: true,
  141. overHidden: true,
  142. filterable: true,
  143. props: {
  144. label: 'cname',
  145. value: 'id'
  146. },
  147. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=1',
  148. },
  149. {
  150. label: '业务员',
  151. prop: "salerId",
  152. search: true,
  153. type: "select",
  154. props: {
  155. label: "name",
  156. value: "id"
  157. },
  158. dicUrl: "/api/blade-user/salerList",
  159. filterable: true,
  160. hide: true,
  161. },
  162. {
  163. label: '业务员',
  164. prop: "salerName",
  165. overHidden: true,
  166. },
  167. {
  168. label: "业务日期",
  169. prop: "businesDate",
  170. type: 'date',
  171. format: "yyyy-MM",
  172. valueFormat: "yyyy-MM",
  173. unlinkPanels: true,
  174. searchRange: true,
  175. overHidden: true,
  176. },
  177. {
  178. label: "业务日期",
  179. prop: "businesDateList",
  180. search: true,
  181. type: 'monthrange',
  182. format: "yyyy-MM",
  183. valueFormat: "yyyy-MM",
  184. unlinkPanels: true,
  185. searchRange: true,
  186. overHidden: true,
  187. hide: true
  188. },
  189. {
  190. label: "结清不显示",
  191. prop: "whetherSettlement",
  192. search: true,
  193. hide: true
  194. },
  195. // {
  196. // label: "是否显示金额为0",
  197. // prop: "size",
  198. // search: true,
  199. // overHidden: true,
  200. // hide: true,
  201. // showColumn: false
  202. // },
  203. {
  204. label: "金额",
  205. prop: "totalMoney",
  206. search: false,
  207. overHidden: true,
  208. },
  209. {
  210. label: "运费",
  211. prop: "freight",
  212. search: false,
  213. overHidden: true,
  214. },
  215. {
  216. label: "实收金额",
  217. prop: "paymentAmountTl",
  218. search: false,
  219. overHidden: true,
  220. },
  221. {
  222. label: "未收金额",
  223. prop: "outstandingAmount",
  224. search: false,
  225. overHidden: true,
  226. },
  227. ],
  228. },
  229. // 仓库配置
  230. configurationWarehouse: {
  231. multipleChoices: false,
  232. multiple: false,
  233. collapseTags: false,
  234. placeholder: "请点击右边按钮选择",
  235. dicData: [],
  236. },
  237. brandOption: [],
  238. userList: [],
  239. tradeType: '',
  240. sysitemType: null,
  241. show: true,
  242. };
  243. },
  244. async created() {
  245. this.option = this.defaultOption;
  246. this.option = await this.getColumnData(this.getColumnName(284), this.defaultOption);
  247. this.getWorkDicts('brand').then(res => {
  248. this.brandOption = res.data.data;
  249. })
  250. gainUser().then(res => {
  251. this.userList = res.data.data;
  252. });
  253. this.search=this.deepClone(this.search)
  254. },
  255. methods: {
  256. cellStyle() {
  257. return "padding:0;height:40px;";
  258. },
  259. searchCriteriaSwitch(type) {
  260. if (type) {
  261. this.option.height = this.option.height - 46;
  262. } else {
  263. this.option.height = this.option.height + 46;
  264. }
  265. this.$refs.crud.getTableHeight();
  266. },
  267. searchReset() {
  268. },
  269. //点击搜索按钮触发
  270. searchChange(params, done) {
  271. this.page.currentPage = 1;
  272. this.onLoad(this.page, params);
  273. done();
  274. },
  275. refreshChange() {
  276. this.onLoad(this.page, this.search);
  277. },
  278. currentChange(val) {
  279. this.page.currentPage = val;
  280. },
  281. sizeChange(val) {
  282. this.page.currentPage = 1;
  283. this.page.pageSize = val;
  284. },
  285. onLoad(page, params) {
  286. this.search = this.deepClone(this.search)
  287. this.search.customerId = this.search.customerName
  288. this.sysitemType = localStorage.getItem('sysitemType');
  289. if (this.sysitemType == 999) {
  290. this.tradeType = ''
  291. } else if (this.sysitemType == 1) {
  292. this.tradeType = 'XX'
  293. } else if (this.sysitemType == 2) {
  294. this.tradeType = 'GN'
  295. } else if (this.sysitemType == 3) {
  296. this.tradeType = 'JK'
  297. } else if (this.sysitemType == 4) {
  298. this.tradeType = 'CK'
  299. } else if (this.sysitemType == 5) {
  300. this.tradeType = 'SW'
  301. } else if (this.sysitemType == 6) {
  302. this.tradeType = 'JXS'
  303. } else if (this.sysitemType == 7) {
  304. this.tradeType = 'LY'
  305. }
  306. this.loading = true;
  307. this.dataList.forEach(item => {
  308. this.$refs.crud.toggleRowExpansion(item, false);
  309. });
  310. let queryParams = this.deepClone(Object.assign({ type: 0 }, params, this.search));
  311. if (queryParams.accDate && queryParams.accDate.length > 0) {
  312. queryParams = {
  313. ...queryParams,
  314. accDateStart: queryParams.accDate[0] + ' 00:00:00',
  315. accDateEnd: queryParams.accDate[1] + ' 23:59:59',
  316. }
  317. delete queryParams.accDate;
  318. }
  319. getStatisticsList(
  320. page.currentPage,
  321. page.pageSize,
  322. queryParams
  323. )
  324. .then(res => {
  325. if (res.data.data.records) {
  326. res.data.data.records.forEach(e => {
  327. e.itemLoading = true;
  328. });
  329. }
  330. this.dataList = res.data.data.records ? res.data.data.records : [];
  331. this.page.total = res.data.data.total;
  332. if (this.page.total) {
  333. this.option.height = window.innerHeight - 330;
  334. }
  335. this.itemloading = true,
  336. statisticsSum({ type: 0, ...queryParams }).then(res => {
  337. this.commodityData = [res.data.data]
  338. }).finally(() => {
  339. this.itemloading = false;
  340. });
  341. })
  342. .finally(() => {
  343. this.loading = false;
  344. });
  345. },
  346. editOpen(row) {
  347. if (row.billType == "BJ") {
  348. this.$router.push({
  349. path: "/exportTrade/customerInquiry/index",
  350. query: {
  351. id: row.id
  352. }
  353. });
  354. } else {
  355. this.$router.push({
  356. path: "/exportTrade/salesContract/index",
  357. query: {
  358. id: row.id
  359. }
  360. });
  361. }
  362. },
  363. statement() {
  364. this.statementData = { ...this.search };
  365. if (this.statementData.accDate && this.statementData.accDate.length > 0) {
  366. this.statementData.accDateStart = this.statementData.accDate[0] + " " + "00:00:00"
  367. this.statementData.accDateEnd = this.statementData.accDate[1] + " " + "23:59:59"
  368. delete this.statementData.accDate
  369. }
  370. this.switchDialog = !this.switchDialog;
  371. },
  372. onClose(val) {
  373. this.switchDialog = val;
  374. },
  375. // 跳转到详情
  376. beforeOpenPage(row, index) {
  377. this.detailData = {
  378. customerId: row.customerId,
  379. businesDate: row.businesDate,
  380. salerId: row.salerId,
  381. };
  382. this.show = false;
  383. },
  384. goBack() {
  385. this.detailData = this.$options.data().detailData
  386. if (JSON.stringify(this.$route.query) != "{}") {
  387. this.$router.$avueRouter.closeTag();
  388. this.$router.push({
  389. path: "/statisticAnalysis/collectLedger/index"
  390. });
  391. }
  392. this.dataList.forEach(item => {
  393. this.$refs.crud.toggleRowExpansion(item, false)
  394. })
  395. this.show = true;
  396. this.onLoad(this.page, this.search);
  397. },
  398. outExport() {
  399. if (!this.search.corpId) this.$set(this.search, 'corpId', '');
  400. if (this.search.accDate && this.search.accDate.length > 0) {
  401. this.search = {
  402. ...this.search,
  403. accDateStart: this.search.accDate[0] + ' 00:00:00',
  404. accDateEnd: this.search.accDate[1] + ' 23:59:59',
  405. }
  406. } else {
  407. this.search = {
  408. ...this.search,
  409. accDateStart: '',
  410. accDateEnd: '',
  411. }
  412. }
  413. this.$confirm('是否导出应收总账信息?', '提示', {
  414. confirmButtonText: '确定',
  415. cancelButtonText: '取消',
  416. type: 'warning'
  417. }).then(() => {
  418. window.open(
  419. `/api/blade-sales-part/order/statistics-export?${this.website.tokenHeader
  420. }=${getToken()}&type=0&businesDateList[0]=${this.search.businesDateList[0] == null || this.search.businesDateList[0] === undefined ? '' : this.search.businesDateList[0]
  421. }&businesDateList[1]=${this.search.businesDateList[1] == null || this.search.businesDateList[1] === undefined ? '' : this.search.businesDateList[1]
  422. }&customerId=${this.search.customerName == null || this.search.customerName === undefined ? '' : this.search.customerName}`
  423. );
  424. }).catch(() => {
  425. this.$message({
  426. type: 'info',
  427. message: '已取消' //
  428. });
  429. })
  430. },
  431. //列保存触发
  432. async saveColumn() {
  433. const inSave = this.saveColumnData(this.getColumnName(284), this.option);
  434. if (inSave) {
  435. this.$nextTick(() => {
  436. this.$refs.crud.doLayout();
  437. });
  438. this.$message.success("保存成功");
  439. //关闭窗口
  440. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  441. }
  442. },
  443. async resetColumn() {
  444. this.option = this.defaultOption;
  445. // this.option = await this.getColumnData(this.getColumnName(284), this.defaultOption);
  446. const inSave = await this.delColumnData(this.getColumnName(284), this.defaultOption);
  447. if (inSave) {
  448. this.$nextTick(() => {
  449. this.$refs.crud.doLayout()
  450. })
  451. this.$message.success("重置成功");
  452. //关闭窗口
  453. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  454. }
  455. },
  456. }
  457. };
  458. </script>
  459. <style scoped>
  460. .page-crad ::v-deep .basic-container__card {
  461. height: 94.2vh;
  462. }
  463. ::v-deep .el-table__expanded-cell[class*="cell"] {
  464. padding: 0px;
  465. }
  466. .itemTable ::v-deep .el-table {
  467. width: 100%;
  468. }
  469. /deep/ .el-col-md-8 {
  470. width: 24.33333%;
  471. }
  472. </style>