index.vue 8.4 KB

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