index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div class="content">
  3. <div class="bck">
  4. <el-form :inline="true" :model="queryForm">
  5. <el-form-item label="">
  6. <el-date-picker
  7. v-model="queryForm.aa"
  8. type="month"
  9. placeholder="月份"
  10. @change="onQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="">
  14. <el-radio-group v-model="queryForm.bb" size="large" @change="onQuery">
  15. <el-radio-button label="本日" />
  16. <el-radio-button label="本周" />
  17. <el-radio-button label="本月" />
  18. <el-radio-button label="今年" />
  19. <el-radio-button label="其他" />
  20. </el-radio-group>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-date-picker
  24. v-model="queryForm.timeArr"
  25. type="daterange"
  26. unlink-panels
  27. range-separator="-"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期"
  30. value-format="YYYY-MM-DD"
  31. @change="onQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" @click="onQuery">搜索</el-button>
  36. <el-button type="defualt" @click="onReset">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. <div class="bck statistics" style="margin-top: 10px">
  41. <div class="item first">
  42. <div class="left_">
  43. <div class="money">
  44. {{ moneyFormat(0, 2) }}
  45. </div>
  46. <div>销售额({{ 0 }})</div>
  47. </div>
  48. <div class="right_">
  49. <div class="icon">
  50. <img src="@/assets/images/portrait/icon_sales.png" alt="" />
  51. </div>
  52. </div>
  53. </div>
  54. <div class="item two">
  55. <div class="left_">
  56. <div class="money">
  57. {{ moneyFormat(0, 2) }}
  58. </div>
  59. <div>订单(单)</div>
  60. </div>
  61. <div class="right_">
  62. <div class="icon">
  63. <img src="@/assets/images/portrait/icon_profits.png" alt="" />
  64. </div>
  65. </div>
  66. </div>
  67. <div class="item three">
  68. <div class="left_">
  69. <div class="money">
  70. {{ 0 }}
  71. </div>
  72. <div>下单客户数(人)</div>
  73. </div>
  74. <div class="right_">
  75. <div class="icon">
  76. <img src="@/assets/images/portrait/icon_email.png" alt="" />
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="bck scatter" style="margin-top: 10px">
  82. <el-row>
  83. <el-col :span="8">
  84. <TitleInfo :content="titleList[0]"></TitleInfo>
  85. <div ref="echartDom" style="height: 40vh"></div>
  86. </el-col>
  87. <el-col :span="16">
  88. <byTable
  89. :source="sourceList.scatterData"
  90. :pagination="sourceList.scatterPagination"
  91. :config="scatterConfig"
  92. :loading="scatterLoading"
  93. highlight-current-row
  94. :selectConfig="[]"
  95. @get-list="getList"
  96. >
  97. </byTable>
  98. </el-col>
  99. </el-row>
  100. </div>
  101. </div>
  102. </template>
  103. <script setup>
  104. import * as echarts from "echarts";
  105. import TitleInfo from "@/components/TitleInfo/index.vue";
  106. const titleList = [
  107. "销售分布",
  108. "客户分类",
  109. "业务员销售趋势",
  110. "商品销售额",
  111. "商品销量",
  112. ];
  113. const { proxy } = getCurrentInstance();
  114. const scatterLoading = ref(false);
  115. const loadingOne = ref(false);
  116. const loadingTwo = ref(false);
  117. const queryForm = reactive({
  118. beginTime: "",
  119. endTime: "",
  120. timeArr: "",
  121. });
  122. const sourceList = ref({
  123. scatterData: [],
  124. scatterPagination: {
  125. total: 3,
  126. pageNum: 1,
  127. pageSize: 10,
  128. },
  129. });
  130. //图表
  131. const echartDom = ref(null);
  132. let myChart = null;
  133. const option = reactive({
  134. data: {
  135. tooltip: {
  136. trigger: "item",
  137. },
  138. legend: {
  139. top: "0%",
  140. left: "center",
  141. },
  142. series: [
  143. {
  144. name: "销售分布",
  145. type: "pie",
  146. radius: ["20%", "50%"],
  147. avoidLabelOverlap: false,
  148. itemStyle: {
  149. borderRadius: 10,
  150. borderColor: "#fff",
  151. borderWidth: 2,
  152. },
  153. label: {
  154. show: false,
  155. position: "center",
  156. },
  157. emphasis: {
  158. label: {
  159. show: true,
  160. fontSize: 40,
  161. fontWeight: "bold",
  162. },
  163. },
  164. labelLine: {
  165. show: false,
  166. },
  167. data: [2000, 1000],
  168. },
  169. ],
  170. },
  171. });
  172. const scatterConfig = computed(() => {
  173. return [
  174. {
  175. attrs: {
  176. label: "序列",
  177. prop: "receiptWarehouseName",
  178. },
  179. },
  180. {
  181. attrs: {
  182. label: "国家",
  183. prop: "receiptWarehouseName",
  184. },
  185. },
  186. {
  187. attrs: {
  188. label: "订单量(单)",
  189. prop: "receiptWarehouseName",
  190. },
  191. },
  192. {
  193. attrs: {
  194. label: "交易金额(¥)",
  195. prop: "amount",
  196. },
  197. render(amount) {
  198. return proxy.moneyFormat(amount, 2);
  199. },
  200. },
  201. ];
  202. });
  203. const getData = () => {
  204. // loading.value = true;
  205. loadingOne.value = true;
  206. loadingTwo.value = true;
  207. // proxy.post("/saleQuotation/sourceStatistics", queryForm).then((res) => {
  208. // allData.sourceData = res;
  209. // setTimeout(() => {
  210. // loading.value = false;
  211. // }, 200);
  212. // });
  213. // proxy.post("/saleQuotation/typeStatistics", queryForm).then((res) => {
  214. // allData.typeData = res;
  215. // setTimeout(() => {
  216. // loadingOne.value = false;
  217. // }, 200);
  218. // });
  219. proxy.post("/contract/salesStatistics", queryForm).then((res) => {
  220. console.log(res, "aa");
  221. });
  222. };
  223. const onQuery = () => {
  224. queryForm.beginTime = queryForm.timeArr[0];
  225. queryForm.endTime = queryForm.timeArr[1];
  226. getData();
  227. };
  228. const onReset = () => {};
  229. onMounted(() => {
  230. myChart = echarts.init(echartDom.value);
  231. window.addEventListener("resize", () => {
  232. myChart.resize();
  233. });
  234. myChart.setOption(option.data);
  235. getData();
  236. });
  237. </script>
  238. <style lang="scss" scoped>
  239. .content {
  240. margin: 20px;
  241. }
  242. :deep(.el-form-item) {
  243. margin-bottom: 0px;
  244. }
  245. .bck {
  246. background-color: #fff;
  247. padding: 15px;
  248. }
  249. .statistics {
  250. display: flex;
  251. // justify-content: space-around;
  252. .item {
  253. border-radius: 10px;
  254. margin-right: 20px;
  255. width: 13vw;
  256. height: 70px;
  257. padding: 10px;
  258. box-sizing: border-box;
  259. display: flex;
  260. justify-content: space-between;
  261. .left_ {
  262. display: flex;
  263. flex-direction: column;
  264. justify-content: space-around;
  265. .money {
  266. font-weight: 700;
  267. color: #333333;
  268. font-size: 15px;
  269. }
  270. }
  271. .right_ {
  272. .icon {
  273. img {
  274. width: 20px;
  275. height: 20px;
  276. margin-top: 6px;
  277. }
  278. width: 34px;
  279. height: 34px;
  280. margin-top: 10px;
  281. border-radius: 8px;
  282. background-color: #ffffff;
  283. text-align: center;
  284. line-height: 34px;
  285. }
  286. }
  287. }
  288. .first {
  289. background: linear-gradient(#c7e3fe, #dfecff);
  290. }
  291. .two {
  292. background: linear-gradient(#eae8fb, #ded9ff);
  293. }
  294. .three {
  295. background: linear-gradient(#fcf1e4, #fce5ca);
  296. }
  297. .four {
  298. background: linear-gradient(#e2fbe8, #e2fbe8);
  299. }
  300. .five {
  301. background: linear-gradient(#ffebe9, #ffebe9);
  302. }
  303. }
  304. .scatter {
  305. // display: flex;
  306. }
  307. </style>