team.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <template>
  2. <view>
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <service-widget @btnClick="btn_click"></service-widget>
  5. <public-module></public-module>
  6. <view class="headers " :style="headerStyle">
  7. <view class="dis a-c j-start ">
  8. <u-icon name="arrow-left" color="#fff" size="40" @tap="back"></u-icon>
  9. <text style="margin: auto;">{{pageTtile}}</text>
  10. </view>
  11. </view>
  12. <view class="" style="padding-top: 98px;">
  13. <view class="querystyle body">
  14. <view class="statisticsDate dis a-c j-s " style="padding: 0 10px;">
  15. <view class="dis a-c j-c">
  16. <picker style="padding: 0;margin-right: 5px;" @change="bindPickerChange"
  17. :value="queryTimeTypeIndex" :range="queryTimeTypeArray">
  18. <view>{{queryTimeTypeArray[queryTimeTypeIndex]}}</view>
  19. </picker>
  20. <u-icon name="arrow-down-fill" color="#fff" size="16"></u-icon>
  21. </view>
  22. <view class="d-flex a-center j-center flex-1" @click="onShowDatePicker">
  23. <text @click="startshow=true">{{startdate}}</text>
  24. <text style="margin: 0 10px;">-</text>
  25. <text @click="endshow=true">{{enddate}}</text>
  26. </view>
  27. <view class="d-flex a-center j-center" @click="queryData()">
  28. <text>刷新</text>
  29. </view>
  30. </view>
  31. <view class="teamStatistics">
  32. <view class="statisticsTitle">
  33. <view class="d-flex a-center j-start">会员级别</view>
  34. <view class="d-flex a-center j-center">会员人数</view>
  35. <view class="d-flex a-center j-center">签单保费(元)</view>
  36. <view class="d-flex a-center j-end">出单人力</view>
  37. </view>
  38. <block v-for="(item,index) in SummaryList" :key="index">
  39. <view class="" style="padding: 0 10px;">
  40. <view class="statisticsContent " :class="index==teamTabIndex?'active':''">
  41. <view class="dis a-c j-start">{{item.teamlevel}}</view>
  42. <view class="dis a-c j-c">{{item.teamnum}}</view>
  43. <view class="dis a-c j-c">{{item.sumpremium.toFixed(2)}}</view>
  44. <view class="dis a-c j-end">{{item.usernum}}</view>
  45. </view>
  46. </view>
  47. </block>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="userdata">
  52. <u-tabs class="tabclass" :list="arrdata" :is-scroll="false" :current="teamTabIndex"
  53. @change="arrchange"></u-tabs>
  54. <view class="team_members">
  55. <view class="team_member d-flex j-s a-c">
  56. <view class="d-flex a-center j-center ">
  57. <view>会员</view>
  58. </view>
  59. <view class="d-flex a-center j-center " style="width: 10%;">
  60. <view v-if="teamTabIndex==0">级别</view>
  61. </view>
  62. <view class="d-flex a-center j-center ">
  63. <view v-if="teamTabIndex!=5">报价笔数</view>
  64. </view>
  65. <view class="d-flex a-center j-center ">
  66. <view v-if="teamTabIndex!=5">核保笔数</view>
  67. </view>
  68. <view class="d-flex a-center j-center ">
  69. <view v-if="teamTabIndex!=5">出单笔数</view>
  70. </view>
  71. <view class="d-flex a-center j-center ">
  72. <view v-if="teamTabIndex!=5">签单保费</view>
  73. </view>
  74. </view>
  75. <view class="dataOver">
  76. <view v-if="teamTabIndex==0" class="dis j-s a-c team_members-data"
  77. v-for="(item,index) in userPolicyList1" :key="index"
  78. @click="toTeamMember('userPolicyList1',index)">
  79. <view class="dis j-start a-c">{{item.username}}</view>
  80. <view class="dis j-c a-c" style="width: 10%;">{{item.teamlevel}}</view>
  81. <view class="dis j-c a-c">{{item.bjpolicynum}}</view>
  82. <view class="dis j-c a-c">{{item.policynum}}</view>
  83. <view class="dis j-c a-c">{{item.ordernum}}</view>
  84. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  85. </view>
  86. <view v-if="teamTabIndex==1" class="dis j-s a-c team_members-data"
  87. v-for="(item,index) in userPolicyList2" :key="index"
  88. @click="toTeamMember('userPolicyList2',index)">
  89. <view class="dis j-start a-c">{{item.username}}</view>
  90. <view class="dis j-c a-c" style="width: 10%;">{{item.teamlevel}}</view>
  91. <view class="dis j-c a-c">{{item.bjpolicynum}}</view>
  92. <view class="dis j-c a-c">{{item.policynum}}</view>
  93. <view class="dis j-c a-c">{{item.ordernum}}</view>
  94. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  95. </view>
  96. <view v-if="teamTabIndex==2" class="dis j-s a-c team_members-data"
  97. v-for="(item,index) in userPolicyList3" :key="index"
  98. @click="toTeamMember('userPolicyList3',index)">
  99. <view class="dis j-start a-c">{{item.username}}</view>
  100. <view class="dis j-c a-c" style="width: 10%;">{{item.teamlevel}}</view>
  101. <view class="dis j-c a-c">{{item.bjpolicynum}}</view>
  102. <view class="dis j-c a-c">{{item.policynum}}</view>
  103. <view class="dis j-c a-c">{{item.ordernum}}</view>
  104. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  105. </view>
  106. <view v-if="teamTabIndex==3" class="dis j-s a-c team_members-data"
  107. v-for="(item,index) in userPolicyList4" :key="index"
  108. @click="toTeamMember('userPolicyList4',index)">
  109. <view class="dis j-start a-c">{{item.username}}</view>
  110. <view class="dis j-c a-c" style="width: 10%;">{{item.teamlevel}}</view>
  111. <view class="dis j-c a-c">{{item.bjpolicynum}}</view>
  112. <view class="dis j-c a-c">{{item.policynum}}</view>
  113. <view class="dis j-c a-c">{{item.ordernum}}</view>
  114. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  115. </view>
  116. <view v-if="teamTabIndex==4" class="dis j-s a-c team_members-data"
  117. v-for="(item,index) in userPolicyList5" :key="index"
  118. @click="toTeamMember('userPolicyList5',index)">
  119. <view class="dis j-start a-c">{{item.username}}</view>
  120. <view class="dis j-c a-c" style="width: 10%;">{{item.teamlevel}}</view>
  121. <view class="dis j-c a-c">{{item.bjpolicynum}}</view>
  122. <view class="dis j-c a-c">{{item.policynum}}</view>
  123. <view class="dis j-c a-c">{{item.ordernum}}</view>
  124. <view class="dis j-c a-c">{{item.sumpremium}}</view>
  125. </view>
  126. <view v-if="teamTabIndex==5" class="dis j-s a-c team_members-data"
  127. v-for="(item,index) in userPolicyList6" :key="index"
  128. @click="toTeamMember('userPolicyList6',index)">
  129. <view class="dis j-start a-c">{{item.username}}</view>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <u-picker v-model="startshow" mode="time" :params="params" @confirm="startconfirm"></u-picker>
  135. <u-picker v-model="endshow" mode="time" :params="params" @confirm="endconfirm"></u-picker>
  136. </view>
  137. </template>
  138. <script>
  139. import {
  140. mapState
  141. } from "vuex";
  142. import MxDatePicker from "@/components/modules/tools/team/mx-datepicker/mx-datepicker.vue";
  143. import SwiperTab from "@/components/modules/tools/team/swiper-tab.vue";
  144. export default {
  145. components: {
  146. SwiperTab,
  147. MxDatePicker
  148. },
  149. data() {
  150. return {
  151. params: {
  152. year: true,
  153. month: true,
  154. day: true,
  155. hour: false,
  156. minute: false,
  157. second: false
  158. },
  159. startshow: false,
  160. endshow: false,
  161. headerStyle: {
  162. backgroundColor: '',
  163. backgroundImage: '',
  164. backgroundSize: '',
  165. backgroundPosition: '',
  166. boxShadow: ''
  167. // 其他样式属性...
  168. },
  169. queryPeopleId: "",
  170. queryTimeTypeArray: ['今天', '一周', '当月'],
  171. queryTimeTypeIndex: 0,
  172. startdate: new Date()
  173. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
  174. enddate: new Date()
  175. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
  176. showDatePicker: false,
  177. teamTabIndex: 0,
  178. SummaryList: [],
  179. userPolicyList1: [],
  180. userPolicyList2: [],
  181. userPolicyList3: [],
  182. userPolicyList4: [],
  183. userPolicyList5: [],
  184. userPolicyList6: [],
  185. arrdata: [{
  186. teamlevel: 0,
  187. name: '汇总',
  188. teamnum: 0, //人数
  189. sumpremium: 0, //签单保费
  190. usernum: 0 //出单人力
  191. },
  192. {
  193. teamlevel: 1,
  194. name: '本人',
  195. teamnum: 0, //人数
  196. sumpremium: 0, //签单保费
  197. usernum: 0 //出单人力
  198. },
  199. {
  200. teamlevel: 2,
  201. name: '一级',
  202. teamnum: 0, //人数
  203. sumpremium: 0, //签单保费
  204. usernum: 0 //出单人力
  205. },
  206. {
  207. teamlevel: 3,
  208. name: '二级',
  209. teamnum: 0, //人数
  210. sumpremium: 0, //签单保费
  211. usernum: 0 //出单人力
  212. },
  213. {
  214. teamlevel: 4,
  215. name: '三级',
  216. teamnum: 0, //人数
  217. sumpremium: 0, //签单保费
  218. usernum: 0 //出单人力
  219. },
  220. {
  221. teamlevel: 9,
  222. name: '临时',
  223. teamnum: 0, //人数
  224. sumpremium: 0, //签单保费
  225. usernum: 0 //出单人力
  226. }
  227. ],
  228. teamStaff: {},
  229. teamStaffList: [],
  230. pageTtile: "",
  231. }
  232. },
  233. onPullDownRefresh() {
  234. this.queryData()
  235. setTimeout(function() {
  236. uni.stopPullDownRefresh();
  237. }, 1000);
  238. },
  239. async onLoad(params) {
  240. this.$http.get('/sysMenuRecord/add?type=1&menuType=5')
  241. this.pageTtile = this.userInfo.sysUser.name + "会员管理"
  242. // this.queryPeopleId = params.id
  243. if ((!!params.id) && (!!params.name)) {
  244. this.queryPeopleId = params.id;
  245. await this.queryData()
  246. } else if (!!this.userInfo) {
  247. this.queryPeopleId = this.userInfo.sysUser.id
  248. await this.queryData()
  249. uni.setNavigationBarTitle({
  250. title: this.userInfo.sysUser.name + "会员管理"
  251. });
  252. } else {
  253. this.queryPeopleId = this.userInfo.sysUser.id
  254. await this.queryData()
  255. }
  256. },
  257. onShow() {},
  258. computed: {
  259. ...mapState(['userInfo']),
  260. getHeight() {
  261. let height = uni.getSystemInfoSync().windowHeight - uni.upx2px(770);
  262. return `height: ${height}px;`;
  263. }
  264. },
  265. methods: {
  266. btn_click() {
  267. uni.navigateTo({
  268. url: '/pages/chat/chat'
  269. })
  270. },
  271. startconfirm(e) {
  272. this.startdate = e.year + '-' + e.month + '-' + e.day;
  273. },
  274. endconfirm(e) {
  275. this.enddate = e.year + '-' + e.month + '-' + e.day;
  276. },
  277. //页面返回按钮
  278. back() {
  279. uni.navigateBack({
  280. delta: 1, // 返回的页面数,如果是1表示返回上一页
  281. success: function() {}
  282. });
  283. },
  284. bindPickerChange: function(e) {
  285. this.queryTimeTypeIndex = e.target.value
  286. if (e.target.value == 0) {
  287. this.startdate = new Date()
  288. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate();
  289. this.enddate = new Date()
  290. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate();
  291. this.queryData();
  292. this.queryData();
  293. }
  294. if (e.target.value == 1) {
  295. let strDay = new Date().getDate() - 7;
  296. if (strDay < 10) {
  297. strDay = "0" + strDay;
  298. }
  299. this.startdate = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + strDay;
  300. this.enddate = new Date()
  301. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
  302. this.queryData();
  303. }
  304. if (e.target.value == 2) {
  305. this.startdate = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + '01';
  306. this.enddate = new Date()
  307. .getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
  308. this.queryData();
  309. }
  310. },
  311. arrchange(e) {
  312. this.teamTabIndex = e;
  313. },
  314. async queryData() {
  315. let params = {
  316. "enddate": this.enddate,
  317. "startdate": this.startdate
  318. }
  319. let res = await this.$http.post('/esm/user/queryUserCount', params);
  320. if (res.code == '200') {
  321. this.SummaryList = res.data.hzList;
  322. this.userPolicyList1 = res.data.userPolicyList;
  323. this.userPolicyList2 = res.data.userPolicyList0;
  324. this.userPolicyList3 = res.data.userPolicyList1;
  325. this.userPolicyList4 = res.data.userPolicyList2;
  326. this.userPolicyList5 = res.data.userPolicyList3;
  327. this.userPolicyList6 = res.data.userPolicyList9;
  328. this.SummaryList.map(ele => {
  329. this.arrdata.map(val => {
  330. if (ele.teamlevel.includes(val.name)) {
  331. val.teamnum = ele.teamnum;
  332. }
  333. })
  334. })
  335. }
  336. },
  337. onShowDatePicker() { //显示
  338. this.showDatePicker = true;
  339. },
  340. onSelected(e) { //选择
  341. this.showDatePicker = false;
  342. if (e) {
  343. this.dateRange = e.value;
  344. this.queryData();
  345. }
  346. },
  347. // 选择团队tap
  348. teamTabtap(index) {
  349. this.teamTabIndex = index;
  350. },
  351. toTeamMember(name, index) {
  352. this.navigate({
  353. url: "/pages/tools/team/teamMember",
  354. success: (res) => {
  355. res.eventChannel.emit("acceptData", {
  356. item: this[name][index],
  357. date: [this.startdate, this.enddate]
  358. })
  359. }
  360. }, "navigateTo", true)
  361. }
  362. }
  363. }
  364. </script>
  365. <style lang="scss" scoped>
  366. .active {
  367. color: #FF5600 !important;
  368. }
  369. page {
  370. background-color: #F8FAFE;
  371. height: 100%;
  372. }
  373. .userdata {
  374. padding: 16px;
  375. margin-top: 75px;
  376. }
  377. .dataOver {
  378. max-height: calc(100vh - 480px);
  379. overflow-y: auto;
  380. }
  381. .tabclass {
  382. background-color: transparent !important;
  383. }
  384. .querystyle {
  385. width: 100%;
  386. height: 200px;
  387. background: #F8FAFE;
  388. background-image: url("/static/image/team/bg1.png");
  389. background-size: 100% 100%;
  390. padding: 0 16px;
  391. }
  392. .headers {
  393. position: fixed;
  394. top: 0;
  395. left: 0;
  396. height: auto;
  397. width: 100%;
  398. z-index: 999999;
  399. padding: 16px;
  400. padding-top: 50px;
  401. height: auto;
  402. background: #3D74FE;
  403. text {
  404. font-size: 18px;
  405. font-weight: bold;
  406. color: #fff;
  407. }
  408. }
  409. .body .statisticsDate {
  410. color: #fff;
  411. height: 34px;
  412. background: rgba(51, 94, 203, 0.5);
  413. border-radius: 6px;
  414. }
  415. .statisticsContent {
  416. border-bottom: 1upx solid #ddd;
  417. }
  418. .statisticsContent:last-child() {
  419. border: none,
  420. }
  421. .body .teamStatistics {
  422. width: 100%;
  423. height: auto;
  424. background: #FFFFFF;
  425. box-shadow: 0px 4px 10px 0px #DAE3F4;
  426. border-radius: 6px;
  427. }
  428. .body .teamStatistics .statisticsTitle {
  429. height: 70upx;
  430. padding: 0px 30upx;
  431. margin-top: 10px;
  432. box-sizing: border-box;
  433. line-height: 70upx;
  434. font-size: 24rpx;
  435. background: #FFEFE6;
  436. border-radius: 6px 6px 0 0;
  437. color: #232832;
  438. }
  439. .body .teamStatistics .statisticsContent {
  440. box-sizing: border-box;
  441. height: 70upx;
  442. line-height: 70upx;
  443. font-size: 26rpx;
  444. color: #232832;
  445. }
  446. .body .teamStatistics .statisticsTitle,
  447. .body .teamStatistics .statisticsContent {
  448. display: flex;
  449. flex-wrap: nowrap;
  450. justify-content: space-between;
  451. }
  452. .body .teamStatistics .statisticsTitle>view,
  453. .body .teamStatistics .statisticsContent>view {
  454. width: 200upx;
  455. text-align: center;
  456. font-size: 12px;
  457. }
  458. /* 横向滚动选项Start */
  459. .teamScrollView {
  460. border-bottom: 15upx solid #ccc;
  461. }
  462. /* 横向滚动选项Start */
  463. /* 团队成员列表Start */
  464. .team_members {
  465. width: 100%;
  466. height: auto;
  467. background: #FFFFFF;
  468. box-shadow: 0px 4px 10px 0px #DAE3F4;
  469. border-radius: 6px;
  470. }
  471. .team_members .team_member {
  472. min-height: 70upx;
  473. box-sizing: border-box;
  474. line-height: 70upx;
  475. width: 100%;
  476. height: 34px;
  477. background: #E7ECFD;
  478. border-radius: 6px 6px 0px 0px;
  479. }
  480. /* .team_members .team_member:nth-of-type(1){
  481. background: #CCCCCC;
  482. } */
  483. .team_members .team_member>view {
  484. width: 18%;
  485. flex-wrap: nowrap;
  486. }
  487. .team_members-data {
  488. padding: 0 8px;
  489. border-bottom: 1px solid #ddd;
  490. }
  491. .team_members-data>view {
  492. width: 18%;
  493. padding: 4px;
  494. }
  495. /* 团队成员列表End */
  496. </style>