OrderDataReport.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view>
  3. <view class="home">
  4. <view class="search-icon" @click="openSearch"><text class="custom-icon custom-icon-shaixuan"></text></view>
  5. <view class="charts-box">
  6. <qiun-data-charts type="mix" :chartData="chartData" :echartsH5="true" :echartsApp="true"
  7. background="none" :animation="false" />
  8. </view>
  9. </view>
  10. <view class="top-view">
  11. <view class="thead">
  12. <view class="flex1 sort-li">时间</view>
  13. <view class="flex1 staff-li">订单数量</view>
  14. <view class="flex1 cutomer-li">订单金额</view>
  15. </view>
  16. <scroll-view class="cont-ul" scroll-y="true">
  17. <view class="flex" v-for="(item, index) in goods_list" :key="index">
  18. <view class="flex1 sort-li">{{ item.day }}</view>
  19. <view class="flex1 staff-li">{{ item.num }}</view>
  20. <view class="flex1 cutomer-li">{{ item.amount }}</view>
  21. </view>
  22. <u-loadmore :status="load_status" :load-text="loadText" @loadmore="loadmoreData" />
  23. </scroll-view>
  24. </view>
  25. <u-popup v-model="search_show" mode="right">
  26. <view class="search-pop">
  27. <view class="form-view">
  28. <u-form label-width="160rpx" label-position="left">
  29. <u-form-item label-position="top" label="下单日期">
  30. <view class="date-li">
  31. <picker mode="date" @change="bindDateStartChange">
  32. <text
  33. class="date-li">{{ search_data.start ? $u.timeFormat(search_data.start, 'yyyy-mm-dd') : '开始日期' }}</text>
  34. </picker>
  35. </view>
  36. <view class="date-line">-</view>
  37. <view class="date-li">
  38. <picker mode="date" @change="bindDateEndChange">
  39. <text
  40. class="date-li">{{ search_data.end ? $u.timeFormat(search_data.end, 'yyyy-mm-dd') : '结束日期' }}</text>
  41. </picker>
  42. </view>
  43. </u-form-item>
  44. <u-form-item label="订单状态">
  45. <view class="clearfix form-val" @click="month_show = true">
  46. <text
  47. class="float_left ellipsis">{{ search_data.orderStatus_name ? search_data.orderStatus_name : '请选择' }}</text>
  48. <view class="float_right">
  49. <u-icon :name="!search_data.orderStatus ? 'arrow-right' : 'close-circle-fill'"
  50. size="28" color="#999999"></u-icon>
  51. </view>
  52. </view>
  53. </u-form-item>
  54. </u-form>
  55. </view>
  56. <view class="search-btn">
  57. <view class="btn-li" @click="clearValue()">重置</view>
  58. <view class="btn-li" @click="searchConfirm">确定</view>
  59. </view>
  60. </view>
  61. </u-popup>
  62. <u-select v-model="month_show" :list="tabs_list" @confirm="confirm"></u-select>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. loadText: {
  70. loadmore: '点击加载更多',
  71. loading: '努力加载中',
  72. nomore: '没有更多了'
  73. },
  74. page: 1,
  75. pageSize: 10,
  76. total: 0,
  77. type: 1,
  78. chartData: {
  79. categories: [],
  80. series: []
  81. },
  82. goods_list: {},
  83. search_show: false,
  84. search_data: {
  85. start: '',
  86. end: '',
  87. orderStatus: '',
  88. orderStatus_name: ''
  89. },
  90. tabs_list: [{
  91. label: '待审核',
  92. value: 2
  93. },
  94. {
  95. label: '待发货',
  96. value: 3
  97. },
  98. {
  99. label: '待收货',
  100. value: 4
  101. },
  102. {
  103. label: '已完成',
  104. value: 5
  105. },
  106. {
  107. label: '已关闭',
  108. value: 6
  109. }
  110. ],
  111. month_show: false,
  112. load_status: 'nomore'
  113. };
  114. },
  115. onLoad() {
  116. this.order();
  117. },
  118. onPullDownRefresh() {
  119. this.page = 1;
  120. this.order();
  121. },
  122. methods: {
  123. loadmoreData() {
  124. if (this.total / this.pageSize > this.page) {
  125. this.page += 1;
  126. this.order();
  127. }
  128. },
  129. openSearch() {
  130. this.search_show = true;
  131. },
  132. order() {
  133. this.load_status = 'loading';
  134. this.$u.api
  135. .order({
  136. page: this.page,
  137. pageSize: this.pageSize,
  138. startTime: this.search_data.start,
  139. endTime: this.search_data.end,
  140. type: this.type,
  141. orderStatus: this.search_data.orderStatus
  142. })
  143. .then(res => {
  144. uni.stopPullDownRefresh();
  145. if (this.page === 1) {
  146. this.goods_list = res.data;
  147. } else {
  148. this.goods_list = this.goods_list.concat(res.data);
  149. }
  150. this.total = res.pageTotal;
  151. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  152. const timeData = [];
  153. const goodsNum = [];
  154. const goodsMoney = [];
  155. this.$nextTick(() => {
  156. res.data.forEach(value => {
  157. const arr = value.day.split('-');
  158. timeData.push(arr[1] + '-' + arr[2]);
  159. goodsNum.push(Number(value.num));
  160. goodsMoney.push(Number(value.amount));
  161. });
  162. this.setChartData(timeData, goodsNum, goodsMoney);
  163. })
  164. });
  165. },
  166. setChartData(timeData, goodsNum, goodsMoney) {
  167. this.chartData = {
  168. categories: timeData,
  169. series: [{
  170. name: '订单数',
  171. data: goodsNum,
  172. // #ifdef APP-PLUS
  173. type: 'bar',
  174. // #endif
  175. // #ifdef MP-WEIXIN
  176. type: 'column',
  177. // #endif
  178. index: 1
  179. },
  180. {
  181. name: '订单金额',
  182. data: goodsMoney,
  183. type: 'line',
  184. style: 'curve',
  185. // #ifdef APP-PLUS
  186. yAxisIndex: 1,
  187. smooth: true,
  188. // #endif
  189. disableLegend: true
  190. }
  191. ]
  192. };
  193. },
  194. bindDateStartChange(e) {
  195. this.search_data.start = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  196. },
  197. bindDateEndChange(e) {
  198. this.search_data.end = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  199. },
  200. confirm(val) {
  201. this.search_data.orderStatus = val[0].value;
  202. this.search_data.orderStatus_name = val[0].label;
  203. },
  204. clearValue() {
  205. this.search_data = {
  206. start: '',
  207. end: '',
  208. orderStatus: '',
  209. orderStatus_name: ''
  210. };
  211. this.searchConfirm();
  212. },
  213. searchConfirm() {
  214. this.search_show = false;
  215. this.page = 1;
  216. this.order();
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. .charts-box {
  223. width: 730rpx;
  224. /* #ifdef MP-WEIXIN */
  225. height: 480rpx;
  226. /* #endif */
  227. /* #ifdef APP-PLUS */
  228. height: 550rpx;
  229. /* #endif */
  230. margin: 0 auto;
  231. }
  232. .home {
  233. position: relative;
  234. /* #ifdef MP-WEIXIN */
  235. padding-top: 70rpx;
  236. /* #endif */
  237. .search-icon {
  238. position: absolute;
  239. width: 80rpx;
  240. text-align: center;
  241. z-index: 1;
  242. right: 0;
  243. top: 20rpx;
  244. }
  245. }
  246. .top-view {
  247. width: 100%;
  248. z-index: 9;
  249. .thead {
  250. line-height: 60rpx;
  251. height: 60rpx;
  252. font-size: 24rpx;
  253. background-color: #f5f5f5;
  254. display: flex;
  255. width: 100%;
  256. }
  257. .search-view {
  258. width: 100%;
  259. }
  260. }
  261. .flex1 {
  262. display: table-cell;
  263. text-align: center;
  264. position: relative;
  265. height: 100%;
  266. vertical-align: middle;
  267. &.staff-li {
  268. width: 33%;
  269. }
  270. &.sort-li {
  271. width: 33%;
  272. }
  273. &.cutomer-li {
  274. width: 33%;
  275. }
  276. }
  277. .cont-ul {
  278. height: calc(100vh - 620rpx);
  279. background-color: #ffffff;
  280. .flex {
  281. height: 70rpx;
  282. }
  283. }
  284. .flex {
  285. display: table;
  286. width: 750rpx;
  287. font-size: 24rpx;
  288. }
  289. </style>