index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  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">
  8. <template slot="menuLeft">
  9. <el-button type="info" size="small" @click="outExport">导出</el-button>
  10. </template>
  11. <template slot="corpNameSearch">
  12. <crop-select v-model="search.corpName" corpType="KH" :zhKey="true"></crop-select>
  13. </template>
  14. <template slot="careteTimeSearch">
  15. <el-date-picker v-model="search.careteTime" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  16. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  17. </el-date-picker>
  18. </template>
  19. <template slot="brandSearch">
  20. <el-select v-model="search.brand" filterable clearable>
  21. <el-option v-for="(item, index) in brandOption" :key="index" :label="item.dictValue"
  22. :value="item.dictValue" />
  23. </el-select>
  24. </template>
  25. <template slot-scope="scope" slot="corpName">
  26. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.corpName}}</span>
  27. </template>
  28. <template slot-scope="{row}"
  29. slot="source">
  30. <div style="text-align:center">
  31. <i :class="row.source"/>
  32. </div>
  33. </template>
  34. </avue-crud>
  35. </basic-container>
  36. </div>
  37. </template>
  38. <script>
  39. import { getToken } from "@/util/auth";
  40. import { getList } from "@/api/statisticAnalysis/salesProfitN"
  41. import _ from "lodash";
  42. import iconList from "@/config/iconList";
  43. export default {
  44. name: "index",
  45. data() {
  46. return {
  47. form: {},
  48. search: {},
  49. dataList: [],
  50. loading: false,
  51. detailData: {},
  52. page: {
  53. pageSize: 20,
  54. currentPage: 1,
  55. total: 0,
  56. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  57. },
  58. option:{},
  59. optionBack: {
  60. searchShow: true,
  61. searchMenuSpan: 8,
  62. align: "center",
  63. searchSpan: 8,
  64. border: true,
  65. index: true,
  66. addBtn: true,
  67. viewBtn: false,
  68. editBtn: false,
  69. delBtn: false,
  70. showSummary: true,
  71. searchIcon: true,
  72. searchIndex: 2,
  73. menu: false,
  74. summaryText: "合计",
  75. sumColumnList: [{
  76. name: "quantity",
  77. type: "sum",
  78. decimals: 0
  79. },{
  80. name: "amount",
  81. type: "sum",
  82. decimals: 2
  83. },{
  84. name: "specialOfferAmount",
  85. type: "sum",
  86. decimals: 2
  87. },{
  88. name: "nonSpecialOfferQuantity",
  89. type: "sum",
  90. decimals: 2
  91. },{
  92. name: "nonSpecialOfferAmount",
  93. type: "sum",
  94. decimals: 2
  95. },{
  96. name: "seventeenQuantity",
  97. type: "sum",
  98. decimals: 2
  99. },{
  100. name: "seventeenAmount",
  101. type: "sum",
  102. decimals: 2
  103. },{
  104. name: "purchaseAmount",
  105. type: "sum",
  106. decimals: 2
  107. },{
  108. name: "thisUsedProfit",
  109. type: "sum",
  110. decimals: 2
  111. },{
  112. name: "totalAmount",
  113. type: "sum",
  114. decimals: 2
  115. },{
  116. name: "grossProfit",
  117. type: "sum",
  118. decimals: 2
  119. }],
  120. column: [
  121. {
  122. label: "客户名称",
  123. prop: "corpName",
  124. overHidden: true,
  125. width: 100,
  126. search: true
  127. },
  128. {
  129. label: "品牌",
  130. prop: "brand",
  131. type: "select",
  132. showColumn: false,
  133. search: true
  134. },
  135. {
  136. label: "省份",
  137. prop: "province",
  138. overHidden: true,
  139. width: 100,
  140. search: true
  141. },
  142. {
  143. label: "日期",
  144. prop: "careteTime",
  145. type: "date",
  146. format: "yyyy-MM-dd",
  147. overHidden: true,
  148. search: true,
  149. width: 100
  150. },
  151. {
  152. label: "业务员",
  153. prop: "salesName",
  154. overHidden: true,
  155. search: true,
  156. width: 100
  157. },
  158. {
  159. label: "发货数量",
  160. prop: "quantity",
  161. overHidden: true,
  162. width: 100
  163. },
  164. {
  165. label: "销售金额",
  166. prop: "amount",
  167. overHidden: true,
  168. width: 100
  169. },
  170. {
  171. label: "特价条数",
  172. prop: "specialOfferQuantity",
  173. overHidden: true,
  174. width: 100
  175. },
  176. {
  177. label: "特价总金额",
  178. prop: "specialOfferAmount",
  179. overHidden: true,
  180. width: 100
  181. },
  182. {
  183. label: "非特价条数",
  184. prop: "nonSpecialOfferQuantity",
  185. overHidden: true,
  186. width: 100
  187. },
  188. {
  189. label: "非特价总金额",
  190. prop: "nonSpecialOfferAmount",
  191. overHidden: true,
  192. width: 100
  193. },
  194. {
  195. label: "17寸以上数量",
  196. prop: "seventeenQuantity",
  197. overHidden: true,
  198. width: 100
  199. },
  200. {
  201. label: "17寸以上金额",
  202. prop: "seventeenAmount",
  203. overHidden: true,
  204. width: 100
  205. },
  206. {
  207. label: "采购金额",
  208. prop: "purchaseAmount",
  209. overHidden: true,
  210. width: 100
  211. },
  212. {
  213. label: "返利使用额",
  214. prop: "thisUsedProfit",
  215. overHidden: true,
  216. width: 100
  217. },
  218. {
  219. label: "费用总金额",
  220. prop: "totalAmount",
  221. overHidden: true,
  222. width: 100
  223. },
  224. {
  225. label: "销售毛利",
  226. prop: "grossProfit",
  227. overHidden: true,
  228. width: 100
  229. },
  230. {
  231. label: "销售毛利率",
  232. prop: "grossProfitRate",
  233. overHidden: true,
  234. width: 100
  235. }
  236. ]
  237. },
  238. brandOption: []
  239. };
  240. },
  241. async created() {
  242. this.option = await this.getColumnData(this.getColumnName(185), this.optionBack);
  243. this.getWorkDicts('brand').then(res => {
  244. this.brandOption = res.data.data;
  245. })
  246. },
  247. methods: {
  248. //查看跳转页面
  249. beforeOpenPage(row, index) {
  250. this.$router.$avueRouter.closeTag("/businessManagement/salesOrder/index");
  251. this.$router.push({
  252. path: "/businessManagement/salesOrder/index",
  253. query: { id: row.orderId }
  254. });
  255. },
  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. //点击搜索按钮触发
  268. searchChange(params, done) {
  269. this.page.currentPage = 1;
  270. this.onLoad(this.page, params);
  271. done();
  272. },
  273. refreshChange() {
  274. this.onLoad(this.page, this.search);
  275. },
  276. currentChange(val) {
  277. this.page.currentPage = val;
  278. },
  279. sizeChange(val) {
  280. this.page.currentPage = 1;
  281. this.page.pageSize = val;
  282. },
  283. onLoad(page, params = {}) {
  284. let data = this.deepClone(Object.assign({}, params, this.search));
  285. if (data.careteTime) {
  286. data.beginCreateTime = data.careteTime[0]
  287. data.endCreateTime = data.careteTime[1]
  288. delete data.careteTime
  289. }
  290. this.loading = true;
  291. getList(
  292. page.currentPage,
  293. page.pageSize,
  294. data
  295. )
  296. .then(res => {
  297. if (res.data.data.records) {
  298. res.data.data.records.forEach(e => {
  299. e.itemLoading = true;
  300. });
  301. }
  302. this.dataList = res.data.data.records ? res.data.data.records : [];
  303. this.page.total = res.data.data.total;
  304. if (this.page.total) {
  305. this.option.height = window.innerHeight - 210;
  306. }
  307. })
  308. .finally(() => {
  309. this.loading = false;
  310. });
  311. },
  312. //列保存触发
  313. async saveColumn() {
  314. const inSave = await this.saveColumnData(this.getColumnName(185), this.option);
  315. if (inSave) {
  316. this.$message.success("保存成功");
  317. //关闭窗口
  318. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  319. }
  320. },
  321. async resetColumn() {
  322. this.option = this.optionBack;
  323. const inSave = await this.delColumnData(this.getColumnName(185), this.optionBack);
  324. if (inSave) {
  325. this.$message.success("重置成功");
  326. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  327. }
  328. },
  329. outExport() {
  330. let params = { ...this.search }
  331. if (params.careteTime && params.careteTime.length > 0) {
  332. params = {
  333. ...params,
  334. beginCreateTime: params.careteTime[0] + ' 00:00:00',
  335. endCreateTime: params.careteTime[1] + ' 23:59:59',
  336. }
  337. } else {
  338. params = {
  339. ...params,
  340. beginCreateTime: '',
  341. endCreateTime: '',
  342. }
  343. }
  344. window.open(
  345. `/api/blade-purchase-sales/exportOrder/selSalesProfitExport?${this.website.tokenHeader
  346. }=${getToken()}&corpName=${this.search.corpName}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}&salesName=${params.salesName}&province=${params.province}`
  347. );
  348. },
  349. }
  350. };
  351. </script>
  352. <style scoped>
  353. .page-crad ::v-deep .basic-container__card {
  354. height: 94.2vh;
  355. }
  356. ::v-deep .el-table__expanded-cell[class*="cell"] {
  357. padding: 0px;
  358. }
  359. .itemTable ::v-deep .el-table {
  360. width: 100%;
  361. }
  362. </style>