team.vue 9.1 KB

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