index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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="{row}"
  26. slot="source">
  27. <div style="text-align:center">
  28. <i :class="row.source"/>
  29. </div>
  30. </template>
  31. </avue-crud>
  32. </basic-container>
  33. </div>
  34. </template>
  35. <script>
  36. import { getToken } from "@/util/auth";
  37. import { getList } from "@/api/statisticAnalysis/salesProfitN"
  38. import _ from "lodash";
  39. import iconList from "@/config/iconList";
  40. export default {
  41. name: "index",
  42. data() {
  43. return {
  44. form: {},
  45. search: {},
  46. dataList: [],
  47. loading: false,
  48. detailData: {},
  49. page: {
  50. pageSize: 20,
  51. currentPage: 1,
  52. total: 0,
  53. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  54. },
  55. option:{},
  56. optionBack: {
  57. searchShow: true,
  58. searchMenuSpan: 8,
  59. align: "center",
  60. searchSpan: 8,
  61. border: true,
  62. index: true,
  63. addBtn: true,
  64. viewBtn: false,
  65. editBtn: false,
  66. delBtn: false,
  67. showSummary: true,
  68. searchIcon: true,
  69. searchIndex: 2,
  70. menu: false,
  71. summaryText: "合计",
  72. sumColumnList: [{
  73. name: "quantity",
  74. type: "sum",
  75. decimals: 2
  76. }],
  77. column: [
  78. {
  79. label: "菜单图标",
  80. prop: "source",
  81. type: "icon",
  82. slot: true,
  83. iconList: iconList,
  84. rules: [
  85. {
  86. required: true,
  87. message: "请输入菜单图标",
  88. trigger: "click"
  89. }
  90. ]
  91. },
  92. {
  93. label: "客户名称",
  94. prop: "corpName",
  95. overHidden: true,
  96. width: 100,
  97. search: true
  98. },
  99. {
  100. label: "品牌",
  101. prop: "brand",
  102. type: "select",
  103. showColumn: false,
  104. search: true
  105. },
  106. {
  107. label: "省份",
  108. prop: "province",
  109. overHidden: true,
  110. width: 100,
  111. search: true
  112. },
  113. {
  114. label: "日期",
  115. prop: "careteTime",
  116. type: "date",
  117. format: "yyyy-MM-dd",
  118. overHidden: true,
  119. search: true,
  120. width: 100
  121. },
  122. {
  123. label: "业务员",
  124. prop: "salesName",
  125. overHidden: true,
  126. search: true,
  127. width: 100
  128. },
  129. {
  130. label: "发货数量",
  131. prop: "quantity",
  132. overHidden: true,
  133. width: 100
  134. },
  135. {
  136. label: "销售金额",
  137. prop: "amount",
  138. overHidden: true,
  139. width: 100
  140. },
  141. {
  142. label: "特价条数",
  143. prop: "specialOfferQuantity",
  144. overHidden: true,
  145. width: 100
  146. },
  147. {
  148. label: "特价总金额",
  149. prop: "specialOfferAmount",
  150. overHidden: true,
  151. width: 100
  152. },
  153. {
  154. label: "非特价条数",
  155. prop: "nonSpecialOfferQuantity",
  156. overHidden: true,
  157. width: 100
  158. },
  159. {
  160. label: "非特价总金额",
  161. prop: "nonSpecialOfferAmount",
  162. overHidden: true,
  163. width: 100
  164. },
  165. {
  166. label: "17寸以上数量",
  167. prop: "seventeenQuantity",
  168. overHidden: true,
  169. width: 100
  170. },
  171. {
  172. label: "17寸以上金额",
  173. prop: "seventeenAmount",
  174. overHidden: true,
  175. width: 100
  176. },
  177. {
  178. label: "采购金额",
  179. prop: "purchaseAmount",
  180. overHidden: true,
  181. width: 100
  182. },
  183. {
  184. label: "返利使用额",
  185. prop: "thisUsedProfit",
  186. overHidden: true,
  187. width: 100
  188. },
  189. {
  190. label: "费用总金额",
  191. prop: "totalAmount",
  192. overHidden: true,
  193. width: 100
  194. },
  195. {
  196. label: "销售毛利",
  197. prop: "grossProfit",
  198. overHidden: true,
  199. width: 100
  200. },
  201. {
  202. label: "销售毛利率",
  203. prop: "grossProfitRate",
  204. overHidden: true,
  205. width: 100
  206. }
  207. ]
  208. },
  209. brandOption: []
  210. };
  211. },
  212. async created() {
  213. this.option = await this.getColumnData(this.getColumnName(185), this.optionBack);
  214. this.getWorkDicts('brand').then(res => {
  215. this.brandOption = res.data.data;
  216. })
  217. },
  218. methods: {
  219. cellStyle() {
  220. return "padding:0;height:40px;";
  221. },
  222. searchCriteriaSwitch(type) {
  223. if (type) {
  224. this.option.height = this.option.height - 46;
  225. } else {
  226. this.option.height = this.option.height + 46;
  227. }
  228. this.$refs.crud.getTableHeight();
  229. },
  230. //点击搜索按钮触发
  231. searchChange(params, done) {
  232. this.page.currentPage = 1;
  233. this.onLoad(this.page, params);
  234. done();
  235. },
  236. refreshChange() {
  237. this.onLoad(this.page, this.search);
  238. },
  239. currentChange(val) {
  240. this.page.currentPage = val;
  241. },
  242. sizeChange(val) {
  243. this.page.currentPage = 1;
  244. this.page.pageSize = val;
  245. },
  246. onLoad(page, params = {}) {
  247. let data = this.deepClone(Object.assign({}, params, this.search));
  248. if (data.careteTime) {
  249. data.beginCreateTime = data.careteTime[0]
  250. data.endCreateTime = data.careteTime[1]
  251. delete data.careteTime
  252. }
  253. this.loading = true;
  254. getList(
  255. page.currentPage,
  256. page.pageSize,
  257. data
  258. )
  259. .then(res => {
  260. if (res.data.data.records) {
  261. res.data.data.records.forEach(e => {
  262. e.itemLoading = true;
  263. });
  264. }
  265. this.dataList = res.data.data.records ? res.data.data.records : [];
  266. this.page.total = res.data.data.total;
  267. if (this.page.total) {
  268. this.option.height = window.innerHeight - 210;
  269. }
  270. })
  271. .finally(() => {
  272. this.loading = false;
  273. });
  274. },
  275. //列保存触发
  276. async saveColumn() {
  277. const inSave = await this.saveColumnData(this.getColumnName(185), this.option);
  278. if (inSave) {
  279. this.$message.success("保存成功");
  280. //关闭窗口
  281. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  282. }
  283. },
  284. async resetColumn() {
  285. this.option = this.optionBack;
  286. const inSave = await this.delColumnData(this.getColumnName(185), this.optionBack);
  287. if (inSave) {
  288. this.$message.success("重置成功");
  289. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  290. }
  291. },
  292. outExport() {
  293. let params = { ...this.search }
  294. if (params.careteTime && params.careteTime.length > 0) {
  295. params = {
  296. ...params,
  297. beginCreateTime: params.careteTime[0] + ' 00:00:00',
  298. endCreateTime: params.careteTime[1] + ' 23:59:59',
  299. }
  300. } else {
  301. params = {
  302. ...params,
  303. beginCreateTime: '',
  304. endCreateTime: '',
  305. }
  306. }
  307. window.open(
  308. `/api/blade-purchase-sales/exportOrder/selSalesProfitExport?${this.website.tokenHeader
  309. }=${getToken()}&corpName=${this.search.corpName}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}&salesName=${params.salesName}&province=${params.province}`
  310. );
  311. },
  312. }
  313. };
  314. </script>
  315. <style scoped>
  316. .page-crad ::v-deep .basic-container__card {
  317. height: 94.2vh;
  318. }
  319. ::v-deep .el-table__expanded-cell[class*="cell"] {
  320. padding: 0px;
  321. }
  322. .itemTable ::v-deep .el-table {
  323. width: 100%;
  324. }
  325. </style>