index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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">导出
  10. </el-button>
  11. </template>
  12. <template slot="corpIdSearch">
  13. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  14. </template>
  15. <template slot="businesDateSearch">
  16. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  17. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  18. </el-date-picker>
  19. </template>
  20. <template slot="corpId" slot-scope="{ row, index }">
  21. <span>{{ row.corpName }}</span>
  22. </template>
  23. </avue-crud>
  24. </basic-container>
  25. </div>
  26. </template>
  27. <script>
  28. import { getToken } from "@/util/auth";
  29. import { getList } from "@/api/statisticAnalysis/salesDetails"
  30. export default {
  31. name: "index",
  32. data() {
  33. return {
  34. form: {},
  35. search: {},
  36. dataList: [],
  37. loading: false,
  38. detailData: {},
  39. page: {
  40. pageSize: 20,
  41. currentPage: 1,
  42. total: 0,
  43. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  44. },
  45. option: {},
  46. optionBack: {
  47. searchShow: true,
  48. searchMenuPosition: "right",
  49. searchSpan: 8,
  50. border: true,
  51. index: true,
  52. addBtn: false,
  53. viewBtn: false,
  54. editBtn: false,
  55. delBtn: false,
  56. searchIcon: true,
  57. menu: false,
  58. summaryText: "合计",
  59. showSummary: true,
  60. sumColumnList: [{
  61. name: "quantity",
  62. type: "sum",
  63. decimals: 2
  64. }, {
  65. name: "amount",
  66. type: "sum",
  67. decimals: 2
  68. }, {
  69. name: "price",
  70. type: "sum",
  71. decimals: 2
  72. }, {
  73. name: "settlmentAmount",
  74. type: "sum",
  75. decimals: 2
  76. }, {
  77. name: "feesAmount",
  78. type: "sum",
  79. decimals: 2
  80. }],
  81. column: [
  82. {
  83. label: "订单号",
  84. prop: "orderNo",
  85. overHidden: true
  86. },
  87. {
  88. label: "客户名称",
  89. prop: "corpId",
  90. overHidden: true,
  91. search: true,
  92. },
  93. // {
  94. // label: "品牌",
  95. // prop: "billType",
  96. // type: "select",
  97. // hide: true,
  98. // showColumn: false,
  99. // search: true
  100. // },
  101. {
  102. label: "日期",
  103. prop: "careteTime",
  104. type: "datetime",
  105. format: 'yyyy-MM-dd',
  106. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  107. searchRange: true,
  108. searchDefaultTime: ['00:00:00', '23:59:59'],
  109. overHidden: true,
  110. search: true,
  111. },
  112. {
  113. label: "业务员",
  114. prop: "salesName",
  115. overHidden: true,
  116. search: true,
  117. },
  118. {
  119. label: "产品编码",
  120. prop: "commodityCode",
  121. overHidden: true,
  122. },
  123. {
  124. label: "规格",
  125. prop: "typeno",
  126. overHidden: true
  127. },
  128. {
  129. label: "花纹",
  130. prop: "brandItem",
  131. overHidden: true
  132. },
  133. {
  134. label: "数量",
  135. prop: "quantity",
  136. overHidden: true
  137. },
  138. {
  139. label: "金额",
  140. prop: "amount",
  141. overHidden: true
  142. },
  143. {
  144. label: "单价",
  145. prop: "price",
  146. overHidden: true
  147. },
  148. {
  149. label: "回款额",
  150. prop: "settlmentAmount",
  151. overHidden: true
  152. },
  153. {
  154. label: "包装费",
  155. prop: "feesAmount",
  156. overHidden: true
  157. },
  158. {
  159. label: "特价金额",
  160. prop: "specialPrice",
  161. overHidden: true
  162. }
  163. ]
  164. }
  165. };
  166. },
  167. async created() {
  168. this.option = await this.getColumnData(this.getColumnName(130.1), this.optionBack);
  169. // this.option = this.optionBack
  170. console.log(this.option);
  171. let i = 0;
  172. this.option.column.forEach(item => {
  173. if (item.search) i++
  174. })
  175. if (i % 3 !== 0) {
  176. const num = 3 - Number(i % 3)
  177. this.option.searchMenuSpan = num * 8;
  178. this.option.searchMenuPosition = "right";
  179. }
  180. },
  181. methods: {
  182. cellStyle() {
  183. return "padding:0;height:40px;";
  184. },
  185. searchCriteriaSwitch(type) {
  186. if (type) {
  187. this.option.height = this.option.height - 46;
  188. } else {
  189. this.option.height = this.option.height + 46;
  190. }
  191. this.$refs.crud.getTableHeight();
  192. },
  193. //点击搜索按钮触发
  194. searchChange(params, done) {
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. refreshChange() {
  200. this.onLoad(this.page, this.search);
  201. },
  202. currentChange(val) {
  203. this.page.currentPage = val;
  204. },
  205. sizeChange(val) {
  206. this.page.currentPage = 1;
  207. this.page.pageSize = val;
  208. },
  209. onLoad(page, params) {
  210. this.loading = true;
  211. let data = this.deepClone(Object.assign({}, params, this.search));
  212. if (data.careteTime) {
  213. data.beginCreateTime = data.careteTime[0]
  214. data.endCreateTime = data.careteTime[1]
  215. delete data.careteTime
  216. }
  217. getList(
  218. page.currentPage,
  219. page.pageSize,
  220. data
  221. ).then(res => {
  222. if (res.data.data.records) {
  223. res.data.data.records.forEach(e => {
  224. e.itemLoading = true;
  225. });
  226. }
  227. this.dataList = res.data.data.records ? res.data.data.records : [];
  228. this.page.total = res.data.data.total;
  229. if (this.page.total) {
  230. this.option.height = window.innerHeight - 210;
  231. }
  232. }).finally(() => {
  233. this.loading = false;
  234. });
  235. },
  236. //列保存触发
  237. async saveColumn() {
  238. const inSave = await this.saveColumnData(this.getColumnName(130.1), this.option);
  239. if (inSave) {
  240. this.$message.success("保存成功");
  241. //关闭窗口
  242. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  243. }
  244. },
  245. async resetColumn() {
  246. this.option = this.optionBack;
  247. const inSave = await this.delColumnData(this.getColumnName(130.1), this.optionBack);
  248. if (inSave) {
  249. this.$message.success("重置成功");
  250. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  251. }
  252. },
  253. editOpen(row) {
  254. },
  255. outExport() {
  256. let queryParams = this.search
  257. if (queryParams.arrivalTime) {
  258. queryParams.beginCreateTime = queryParams.careteTime[0]
  259. queryParams.endCreateTime = queryParams.careteTime[1]
  260. delete queryParams.careteTime
  261. }
  262. // const routeData = this.$router.resolve({
  263. // path: '/api/blade-land/order/acct-export', //跳转目标窗口的地址
  264. // query: {
  265. // ...queryParams //括号内是要传递给新窗口的参数
  266. // }
  267. // })
  268. // window.open(routeData.href.slice(1, routeData.href.length - 1) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  269. }
  270. }
  271. };
  272. </script>
  273. <style scoped>
  274. .page-crad ::v-deep .basic-container__card {
  275. height: 94.2vh;
  276. }
  277. ::v-deep .el-table__expanded-cell[class*="cell"] {
  278. padding: 0px;
  279. }
  280. .itemTable ::v-deep .el-table {
  281. width: 100%;
  282. }
  283. </style>