VisitRepor.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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"><qiun-data-charts type="column" :echartsH5="true" :echartsApp="true" :chartData="chartData" background="none" :animation="false" /></view>
  6. </view>
  7. <view class="top-view">
  8. <view class="thead">
  9. <view class="flex1 sort-li">#</view>
  10. <view class="flex1 staff-li">员工</view>
  11. <view class="flex1 cutomer-li">部门</view>
  12. <view class="flex1 phone-li">客户数</view>
  13. <view class="flex1 phone-li2">订单数</view>
  14. <view class="flex1 phone-li3">下单金额</view>
  15. <view class="flex1 phone-li4">跟进次数</view>
  16. </view>
  17. <scroll-view class="cont-ul" scroll-y="true">
  18. <view class="flex" v-for="(item, index) in goods_list" :key="index">
  19. <view class="flex1 sort-li">{{ item.staffId }}</view>
  20. <view class="flex1 staff-li">{{ item.staffName }}</view>
  21. <view class="flex1 cutomer-li">{{ item.departmentName }}</view>
  22. <view class="flex1 phone-li">{{ item.customerNum }}</view>
  23. <view class="flex1 phone-li2">{{ item.customerOrderNum }}</view>
  24. <view class="flex1 phone-li3">{{ item.customerOrderAmount }}</view>
  25. <view class="flex1 phone-li4" ><u-button @click="goPage(`/pagesT/statement/VisitReporDetails?id=${item.staffId}&name=${item.staffName}`)" type="primary" size="mini">{{ item.num }}</u-button></view>
  26. </view>
  27. <u-loadmore :status="load_status" :load-text="loadText" @loadmore="loadmoreData" />
  28. </scroll-view>
  29. </view>
  30. <u-popup v-model="search_show" mode="right">
  31. <view class="search-pop">
  32. <view class="form-view">
  33. <u-form label-width="160rpx" label-position="left">
  34. <u-form-item label-position="top" label="下单日期">
  35. <view class="date-li">
  36. <picker mode="date" @change="bindDateStartChange">
  37. <text class="date-li">{{ search_data.start ? $u.timeFormat(search_data.start, 'yyyy-mm-dd') : '开始日期' }}</text>
  38. </picker>
  39. </view>
  40. <view class="date-line">-</view>
  41. <view class="date-li">
  42. <picker mode="date" @change="bindDateEndChange">
  43. <text class="date-li">{{ search_data.end ? $u.timeFormat(search_data.end, 'yyyy-mm-dd') : '结束日期' }}</text>
  44. </picker>
  45. </view>
  46. </u-form-item>
  47. <u-form-item label="部门">
  48. <view class="clearfix form-val" @click="openSel('cate_show')">
  49. <text class="float_left ellipsis">{{ search_data.department_name ? search_data.department_name : '请选择' }}</text>
  50. <view class="float_right"><u-icon :name="!search_data.departmentId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon></view>
  51. </view>
  52. </u-form-item>
  53. </u-form>
  54. </view>
  55. <view class="search-btn">
  56. <view class="btn-li" @click="clearValue()">重置</view>
  57. <view class="btn-li" @click="searchConfirm">确定</view>
  58. </view>
  59. </view>
  60. </u-popup>
  61. <tki-tree style="z-index: 99;" ref="tkitree" :selectParent="true" :range="cate_list" rangeKey="title" @confirm="cateConfirm"></tki-tree>
  62. </view>
  63. </template>
  64. <script>
  65. import tkiTree from '@/components/tki-tree/tki-tree.vue';
  66. export default {
  67. components: {
  68. tkiTree
  69. },
  70. data() {
  71. return {
  72. loadText: {
  73. loadmore: '点击加载更多',
  74. loading: '努力加载中',
  75. nomore: '没有更多了'
  76. },
  77. chartData: {
  78. categories: [],
  79. series: []
  80. },
  81. page: 1,
  82. pageSize: 10,
  83. total: 0,
  84. goods_list: {},
  85. load_status: 'nomore',
  86. search_show: false,
  87. search_data: {
  88. start: '',
  89. end: '',
  90. department_name: '',
  91. departmentId: ''
  92. },
  93. cate_list: []
  94. };
  95. },
  96. onLoad() {
  97. this.getCustomerCallOnReportForm();
  98. this.getAllDepartment();
  99. },
  100. onPullDownRefresh() {
  101. this.page = 1;
  102. this.getCustomerCallOnReportForm();
  103. },
  104. methods: {
  105. loadmoreData() {
  106. if (this.total / this.pageSize > this.page) {
  107. this.page += 1;
  108. this.getCustomerCallOnReportForm();
  109. }
  110. },
  111. openSearch() {
  112. this.search_show = true;
  113. },
  114. getCustomerCallOnReportForm() {
  115. this.load_status = 'loading';
  116. this.$u.api
  117. .getCustomerCallOnReportForm({
  118. page: this.page,
  119. pageSize: this.pageSize,
  120. departmentId: this.search_data.departmentId,
  121. start: this.search_data.start,
  122. end: this.search_data.end
  123. })
  124. .then(res => {
  125. uni.stopPullDownRefresh();
  126. if (this.page === 1) {
  127. this.goods_list = res.data;
  128. } else {
  129. this.goods_list = this.goods_list.concat(res.data);
  130. }
  131. this.total = res.pageTotal;
  132. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  133. const staffName = [];
  134. const orderNum = [];
  135. this.$nextTick(() => {
  136. res.data.forEach(value => {
  137. staffName.push(value.staffName);
  138. orderNum.push(Number(value.num));
  139. });
  140. this.setChartData(staffName, orderNum);
  141. });
  142. })
  143. .catch(err => {
  144. console.log(err);
  145. });
  146. },
  147. setChartData(staffName, orderNum) {
  148. this.chartData = {
  149. categories: staffName,
  150. series: [
  151. {
  152. name: '客户数量',
  153. data: orderNum
  154. }
  155. ]
  156. };
  157. },
  158. bindDateStartChange(e) {
  159. this.search_data.start = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  160. },
  161. bindDateEndChange(e) {
  162. this.search_data.end = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  163. },
  164. getAllDepartment() {
  165. this.$u.api.getAllDepartment().then(res => {
  166. // this.list = this.reduceList(res.data);
  167. this.cate_list = res.data;
  168. });
  169. },
  170. openSel(key) {
  171. if (key === 'cate_show') {
  172. this.$refs.tkitree._show();
  173. return;
  174. }
  175. },
  176. cateConfirm(arr) {
  177. this.search_data.department_name = arr[0].title;
  178. this.search_data.departmentId = [arr[0].id];
  179. },
  180. clearValue() {
  181. this.search_data = {
  182. start: '',
  183. end: '',
  184. department_name: '',
  185. departmentId: ''
  186. };
  187. this.searchConfirm();
  188. },
  189. searchConfirm() {
  190. this.search_show = false;
  191. this.page = 1;
  192. this.getCustomerCallOnReportForm();
  193. }
  194. }
  195. };
  196. </script>
  197. <style lang="scss" scoped>
  198. .charts-box {
  199. width: 730rpx;
  200. height: 550rpx;
  201. margin: 0 auto;
  202. }
  203. .home {
  204. position: relative;
  205. padding-top: 50rpx;
  206. .search-icon {
  207. position: absolute;
  208. right: 30rpx;
  209. top: 20rpx;
  210. width: 80rpx;
  211. height: 80rpx;
  212. text-align: center;
  213. z-index: 1;
  214. }
  215. }
  216. .top-view {
  217. width: 100%;
  218. z-index: 9;
  219. .thead {
  220. line-height: 60rpx;
  221. height: 60rpx;
  222. font-size: 24rpx;
  223. background-color: #f5f5f5;
  224. display: flex;
  225. width: 100%;
  226. }
  227. .search-view {
  228. width: 100%;
  229. }
  230. }
  231. .flex1 {
  232. display: table-cell;
  233. text-align: center;
  234. position: relative;
  235. height: 100%;
  236. vertical-align: middle;
  237. &.staff-li {
  238. width: 14.2%;
  239. }
  240. &.sort-li {
  241. width: 14.2%;
  242. }
  243. &.cutomer-li {
  244. width: 14.2%;
  245. }
  246. &.phone-li {
  247. width: 14.2%;
  248. }
  249. &.phone-li2 {
  250. width: 14.2%;
  251. }
  252. &.phone-li3 {
  253. width: 14.2%;
  254. }
  255. &.phone-li4 {
  256. width: 14.2%;
  257. }
  258. }
  259. .cont-ul {
  260. height: calc(100vh - 666rpx);
  261. background-color: #FFFFFF;
  262. .flex {
  263. height: 70rpx;
  264. }
  265. }
  266. .flex {
  267. display: table;
  268. width: 750rpx;
  269. font-size: 24rpx;
  270. }
  271. </style>