RegionalOrderReport.vue 6.5 KB

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