team.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view>
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="body">
  6. <view class="statisticsDate d-flex">
  7. <view style="width: 180upx;flex-shrink: 0;">
  8. <picker style="padding: 0;" @change="bindPickerChange" :value="queryTimeTypeIndex"
  9. :range="queryTimeTypeArray">
  10. <view>{{queryTimeTypeArray[queryTimeTypeIndex]}}</view>
  11. </picker>
  12. </view>
  13. <view class="d-flex a-center j-center flex-1" @click="onShowDatePicker">
  14. {{dateRange[0].replace('/','-')}} -
  15. {{dateRange[1]}}
  16. </view>
  17. <view class="d-flex a-center j-center" style="width: 60upx;flex-shrink: 0;">
  18. <view class="icon iconfont icon-search-1-copy"></view>
  19. </view>
  20. </view>
  21. <view class="teamStatistics">
  22. <view class="statisticsTitle">
  23. <view class="d-flex a-center j-center">团队级别</view>
  24. <view class="d-flex a-center j-center">团队人数</view>
  25. <view class="d-flex a-center j-center">签单保费(元)</view>
  26. <view class="d-flex a-center j-center">出单人力</view>
  27. </view>
  28. <block v-for="(item,index) in SummaryList" :key="index">
  29. <view class="statisticsContent">
  30. <view class="d-flex a-center j-center">{{item.teamlevel}}</view>
  31. <view class="d-flex a-center j-center">{{item.teamnum}}</view>
  32. <view class="d-flex a-center j-center">{{item.sumpremium.toFixed(2)}}</view>
  33. <view class="d-flex a-center j-center">{{item.usernum}}</view>
  34. </view>
  35. </block>
  36. </view>
  37. <swiper-tab :tabBars="arrdata" :tabIndex="teamTabIndex" @tabtap="teamTabtap"></swiper-tab>
  38. <view class="team_members">
  39. <view class="team_member d-flex" style="background-color: #CCCCCC;">
  40. <view class="d-flex a-center j-center flex-1">
  41. <view>团队成员</view>
  42. </view>
  43. <view class="d-flex a-center j-center flex-1">
  44. <view>核保笔数</view>
  45. </view>
  46. <view class="d-flex a-center j-center flex-1">
  47. <view>出单笔数</view>
  48. </view>
  49. <view class="d-flex a-center j-center flex-1">
  50. <view>签单保费</view>
  51. </view>
  52. </view>
  53. <view v-if="teamTabIndex==0" class="dis j-s a-c team_members-data"
  54. v-for="(item,index) in userPolicyList1" :key="index" @click="toTeamMember('userPolicyList1',index)">
  55. <view class="dis j-c a-c">{{item.username}}</view>
  56. <view class="dis j-c a-c">{{item.ordernum}}</view>
  57. <view class="dis j-c a-c">{{item.policynum}}</view>
  58. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  59. </view>
  60. <view v-if="teamTabIndex==1" class="dis j-s a-c team_members-data"
  61. v-for="(item,index) in userPolicyList2" :key="index">
  62. <view class="dis j-c a-c">{{item.username}}</view>
  63. <view class="dis j-c a-c">{{item.ordernum}}</view>
  64. <view class="dis j-c a-c">{{item.policynum}}</view>
  65. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  66. </view>
  67. <view v-if="teamTabIndex==2" class="dis j-s a-c team_members-data"
  68. v-for="(item,index) in userPolicyList3" :key="index">
  69. <view class="dis j-c a-c">{{item.username}}</view>
  70. <view class="dis j-c a-c">{{item.ordernum}}</view>
  71. <view class="dis j-c a-c">{{item.policynum}}</view>
  72. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  73. </view>
  74. <view v-if="teamTabIndex==3" class="dis j-s a-c team_members-data"
  75. v-for="(item,index) in userPolicyList4" :key="index">
  76. <view class="dis j-c a-c">{{item.username}}</view>
  77. <view class="dis j-c a-c">{{item.ordernum}}</view>
  78. <view class="dis j-c a-c">{{item.policynum}}</view>
  79. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  80. </view>
  81. <view v-if="teamTabIndex==4" class="dis j-s a-c team_members-data"
  82. v-for="(item,index) in userPolicyList5" :key="index">
  83. <view class="dis j-c a-c">{{item.username}}</view>
  84. <view class="dis j-c a-c">{{item.ordernum}}</view>
  85. <view class="dis j-c a-c">{{item.policynum}}</view>
  86. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  87. </view>
  88. </view>
  89. </view>
  90. <mx-date-picker :show="showDatePicker" type="range" :value="dateRange" :show-tips="true" @confirm="onSelected"
  91. @cancel="onSelected" />
  92. </view>
  93. </template>
  94. <script>
  95. import {
  96. mapState
  97. } from "vuex";
  98. import MxDatePicker from "@/components/modules/tools/team/mx-datepicker/mx-datepicker.vue";
  99. import SwiperTab from "@/components/modules/tools/team/swiper-tab.vue";
  100. export default {
  101. components: {
  102. SwiperTab,
  103. MxDatePicker
  104. },
  105. data() {
  106. return {
  107. queryPeopleId: "",
  108. queryTimeTypeArray: ['本月查询', '本年查询', '自定义查询'],
  109. queryTimeTypeIndex: 0,
  110. dateRange: [new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-01', new Date()
  111. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
  112. ],
  113. showDatePicker: false,
  114. teamTabIndex: 0,
  115. SummaryList: [],
  116. userPolicyList1: [],
  117. userPolicyList2: [],
  118. userPolicyList3: [],
  119. userPolicyList4: [],
  120. userPolicyList5: [],
  121. arrdata: [{
  122. teamlevel: 99,
  123. name: '汇总',
  124. teamnum: 0, //人数
  125. sumpremium: 0, //签单保费
  126. usernum: 0 //出单人力
  127. },
  128. {
  129. teamlevel: 1,
  130. name: '本人',
  131. teamnum: 0, //人数
  132. sumpremium: 0, //签单保费
  133. usernum: 0 //出单人力
  134. },
  135. {
  136. teamlevel: 2,
  137. name: '一级团队',
  138. teamnum: 0, //人数
  139. sumpremium: 0, //签单保费
  140. usernum: 0 //出单人力
  141. },
  142. {
  143. teamlevel: 3,
  144. name: '二级团队',
  145. teamnum: 0, //人数
  146. sumpremium: 0, //签单保费
  147. usernum: 0 //出单人力
  148. },
  149. {
  150. teamlevel: 9,
  151. name: '临时团队',
  152. teamnum: 0, //人数
  153. sumpremium: 0, //签单保费
  154. usernum: 0 //出单人力
  155. }
  156. ],
  157. teamStaff: {},
  158. teamStaffList: [],
  159. }
  160. },
  161. async onLoad(params) {
  162. // this.queryPeopleId = params.id
  163. if ((!!params.id) && (!!params.name)) {
  164. this.queryPeopleId = params.id
  165. await this.queryData()
  166. uni.setNavigationBarTitle({
  167. title: params.name + "团队管理"
  168. });
  169. } else if (!!this.userInfo) {
  170. this.queryPeopleId = this.userInfo.sysUser.id
  171. await this.queryData()
  172. uni.setNavigationBarTitle({
  173. title: this.userInfo.sysUser.name + "团队管理"
  174. });
  175. } else {
  176. this.queryPeopleId = this.userInfo.sysUser.id
  177. await this.queryData()
  178. }
  179. },
  180. onShow() {},
  181. computed: {
  182. ...mapState(['userInfo']),
  183. getHeight() {
  184. let height = uni.getSystemInfoSync().windowHeight - uni.upx2px(770);
  185. return `height: ${height}px;`;
  186. }
  187. },
  188. methods: {
  189. bindPickerChange: function(e) {
  190. this.queryTimeTypeIndex = e.target.value
  191. if (e.target.value == 0) {
  192. this.dateRange = [new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + '01',
  193. new Date()
  194. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
  195. ];
  196. this.queryData();
  197. }
  198. if (e.target.value == 1) {
  199. this.dateRange = [new Date().getFullYear() + '-01-01', new Date().getFullYear() + '-12-31'];
  200. this.queryData();
  201. }
  202. if (e.target.value == 2) {
  203. this.showDatePicker = true;
  204. }
  205. },
  206. async queryData() {
  207. let params = {
  208. "enddate": this.dateRange[1],
  209. "startdate": this.dateRange[0]
  210. }
  211. let res = await this.$http.post('/esm/user/queryUserCount', params);
  212. if (res.code == '200') {
  213. this.SummaryList = res.data.hzList;
  214. this.userPolicyList1 = res.data.userPolicyList;
  215. this.userPolicyList2 = res.data.userPolicyList0;
  216. this.userPolicyList3 = res.data.userPolicyList1;
  217. this.userPolicyList4 = res.data.userPolicyList2;
  218. this.userPolicyList5 = res.data.userPolicyList9;
  219. }
  220. },
  221. onShowDatePicker() { //显示
  222. this.showDatePicker = true;
  223. },
  224. onSelected(e) { //选择
  225. this.showDatePicker = false;
  226. if (e) {
  227. this.dateRange = e.value;
  228. this.queryData();
  229. }
  230. },
  231. // 选择团队tap
  232. teamTabtap(index) {
  233. this.teamTabIndex = index;
  234. },
  235. toTeamMember(index) {
  236. this.navigate({
  237. url: "/pages/tools/team/teamMember",
  238. success: (res) => {
  239. res.eventChannel.emit("acceptData", {
  240. item: this.teamStaffList[index]
  241. })
  242. }
  243. }, "navigateTo", true)
  244. }
  245. }
  246. }
  247. </script>
  248. <style>
  249. .body .statisticsDate {
  250. padding: 15upx 30upx;
  251. border-radius: 35upx;
  252. border: 1px solid #ddd;
  253. margin: 15upx 30upx;
  254. font-size: 28upx;
  255. }
  256. .body .teamStatistics {
  257. border-bottom: 15upx solid #ddd;
  258. }
  259. .body .teamStatistics .statisticsTitle {
  260. height: 70upx;
  261. padding: 0px 30upx;
  262. box-sizing: border-box;
  263. line-height: 70upx;
  264. font-size: 30upx;
  265. background: #ccc;
  266. }
  267. .body .teamStatistics .statisticsContent {
  268. padding: 0px 30upx;
  269. box-sizing: border-box;
  270. height: 70upx;
  271. line-height: 70upx;
  272. border-bottom: 1upx solid #ddd;
  273. font-size: 28upx;
  274. }
  275. .body .teamStatistics .statisticsTitle,
  276. .body .teamStatistics .statisticsContent {
  277. display: flex;
  278. flex-wrap: nowrap;
  279. justify-content: space-between;
  280. }
  281. .body .teamStatistics .statisticsTitle>view,
  282. .body .teamStatistics .statisticsContent>view {
  283. width: 200upx;
  284. text-align: center;
  285. }
  286. /* 横向滚动选项Start */
  287. .teamScrollView {
  288. border-bottom: 15upx solid #ccc;
  289. }
  290. /* 横向滚动选项Start */
  291. /* 团队成员列表Start */
  292. .team_members {}
  293. .team_members .team_member {
  294. min-height: 70upx;
  295. padding: 0px 30upx;
  296. box-sizing: border-box;
  297. line-height: 70upx;
  298. border-bottom: 1px solid #ddd;
  299. }
  300. /* .team_members .team_member:nth-of-type(1){
  301. background: #CCCCCC;
  302. } */
  303. .team_members .team_member>view {
  304. flex-wrap: nowrap;
  305. }
  306. .team_members-data {
  307. padding: 0 15px;
  308. border-bottom: 1px solid #ddd;
  309. }
  310. .team_members-data>view {
  311. width: 25%;
  312. padding: 4px;
  313. }
  314. /* 团队成员列表End */
  315. </style>