cm-screen-drawer.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <template>
  2. <view class="drawer-content">
  3. <!--右抽屉-->
  4. <tui-drawer mode="right" :visible="rightDrawer" @close="closeDrawer">
  5. <view
  6. class="drawer-container clearfix"
  7. scroll-y
  8. :style="{ paddingTop: '0px', paddingBottom: isIphoneX ? '180rpx' : '146rpx' }"
  9. >
  10. <scroll-view class="tui-drawer-scroll" scroll-y :style="{ height: drawerH + 'px' }">
  11. <view class="drawer-title">更多筛选</view>
  12. <view class="drawer-main">
  13. <view class="drawer-main-name">日期</view>
  14. <view class="drawer-main-time">
  15. <view class="drawer-main-time-input">
  16. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindStartDateChange">
  17. <text class="input-text">{{ queryData.startAddTime }}</text>
  18. </picker>
  19. <text class="iconfont icon-riqi"></text>
  20. </view>
  21. <view class="line">-</view>
  22. <view class="drawer-main-time-input">
  23. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindEndDateChange">
  24. <text class="input-text">{{ queryData.endAddTime }}</text>
  25. </picker>
  26. <text class="iconfont icon-riqi"></text>
  27. </view>
  28. </view>
  29. <view class="drawer-main-name">咨询类别</view>
  30. <view class="drawer-main-brand clearfix">
  31. <view
  32. class="drawer-brand-list"
  33. :class="category.isChecked ? 'checked' : ''"
  34. v-for="(category, index) in categorys"
  35. :key="index"
  36. @click="choiceCategorys(category, index)"
  37. >
  38. {{ category.className }}
  39. </view>
  40. </view>
  41. <template v-if="manager > 0">
  42. <view class="drawer-main-name">小组</view>
  43. <view class="drawer-main-brand clearfix">
  44. <view
  45. class="drawer-brand-list"
  46. :class="isCheckedGroups ? 'checked' : ''"
  47. @click="choiceGroupsAll"
  48. >全部</view
  49. >
  50. <view
  51. class="drawer-brand-list"
  52. :class="group.isChecked ? 'checked' : ''"
  53. v-for="(group, index) in groups"
  54. :key="index"
  55. @click="choiceGroups(group, index)"
  56. >
  57. {{ group.leaderName }}
  58. </view>
  59. </view>
  60. </template>
  61. <template v-if="manager>0 || leaderId>0">
  62. <view class="drawer-main-name" v-if="members.length>0">组员</view>
  63. <view class="drawer-main-brand clearfix" v-if="members.length>0">
  64. <view
  65. class="drawer-brand-list"
  66. :class="member.isChecked ? 'checked' : ''"
  67. v-for="(member, index) in members"
  68. :key="index"
  69. @click="choiceMembers(member, index)"
  70. >
  71. {{ member.groupName }}
  72. </view>
  73. </view>
  74. </template>
  75. <view class="drawer-main-name">价格敏感度:</view>
  76. <view class="drawer-main-radiov">
  77. <view class="drawer-main-radio">
  78. <picker @change="bindPickerChange(1,$event)" :value="index" :range="priceActions" range-key="name">
  79. <input class="input" type="text" disabled="false" v-model="priceFlagText" value="" placeholder="请选择"/>
  80. <text class="iconfont icon-xiangyou"></text>
  81. </picker>
  82. </view>
  83. </view>
  84. <view class="drawer-main-name">意向程度:</view>
  85. <view class="drawer-main-radiov">
  86. <view class="drawer-main-radio">
  87. <picker @change="bindPickerChange(2,$event)" :value="index" :range="intenActions" range-key="name">
  88. <input class="input" type="text" disabled="false" v-model="intenFlagText" value="" placeholder="请选择"/>
  89. <text class="iconfont icon-xiangyou"></text>
  90. </picker>
  91. </view>
  92. </view>
  93. <view class="drawer-main-name">跟进状态:</view>
  94. <view class="drawer-main-radiov">
  95. <view class="drawer-main-radio">
  96. <picker @change="bindPickerChange(3,$event)" :value="index" :range="stateActions" range-key="name">
  97. <input class="input" type="text" disabled="false" v-model="followStateText" value="" placeholder="请选择"/>
  98. <text class="iconfont icon-xiangyou"></text>
  99. </picker>
  100. </view>
  101. </view>
  102. <view class="drawer-main-name">报备状态:</view>
  103. <view class="drawer-main-radiov">
  104. <view class="drawer-main-radio">
  105. <picker @change="bindPickerChange(4,$event)" :value="index" :range="reportActions" range-key="name">
  106. <input class="input" type="text" disabled="false" v-model="reportText" value="" placeholder="请选择"/>
  107. <text class="iconfont icon-xiangyou"></text>
  108. </picker>
  109. </view>
  110. </view>
  111. <view class="drawer-main-name">新增分配机构:</view>
  112. <view class="drawer-main-radiov">
  113. <view class="drawer-main-radio">
  114. <picker @change="bindPickerChange(5,$event)" :value="index" :range="clubActions" range-key="name">
  115. <input class="input" type="text" disabled="false" v-model="clubStateText" value="" placeholder="请选择"/>
  116. <text class="iconfont icon-xiangyou"></text>
  117. </picker>
  118. </view>
  119. </view>
  120. </view>
  121. </scroll-view>
  122. <view class="drawer-input btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  123. <view class="drawer-btn clear" @click="closeDrawer">取消</view>
  124. <view class="drawer-btn comfrim" @click="handSearchConfirm">确定</view>
  125. </view>
  126. </view>
  127. </tui-drawer>
  128. </view>
  129. </template>
  130. <script>
  131. export default {
  132. name: 'rightDrawer',
  133. props: {
  134. rightDrawer: {
  135. type: Boolean,
  136. default: false
  137. }
  138. },
  139. data() {
  140. const currentDate = this.getDate({
  141. format: true
  142. })
  143. return {
  144. CustomBar: this.CustomBar, // 顶部导航栏高度
  145. isIphoneX: this.$store.state.isIphoneX,
  146. isCheckedGroups:false,
  147. checkedIndex: 0,
  148. checkedGroupsIndex: 0,
  149. checkedMemberIndex: 0,
  150. isShowClose: false,
  151. dataList: [],
  152. date: currentDate,
  153. manager:0,
  154. leaderId:0,
  155. height: 0,
  156. drawerH: 0 ,// 抽屉内部scrollview高度
  157. categorys:[],
  158. checkedCategorysList:[],
  159. groups:[],
  160. members:[],
  161. reportText:'',
  162. priceFlagText:'',
  163. intenFlagText:'',
  164. followStateText:'',
  165. clubStateText:'',
  166. queryData:{
  167. startAddTime:'',
  168. endAddTime:'',
  169. consult:'',
  170. leaderId:0,
  171. groupId:0,
  172. pinceSensitve:0,//价格敏感度
  173. satisfied:0,// 意向程度
  174. followup:0,// 跟进状态
  175. },
  176. priceActions:[
  177. {name:'全部',value:0},
  178. {name:'敏感',value:1},
  179. {name: '适中',value:2},
  180. {name: '不敏感',value:3},
  181. {name: '不明确',value:4}
  182. ],
  183. intenActions:[
  184. {name:'全部',value:0},
  185. {name:'意向强烈',value:1},
  186. {name: '意向一般',value:2},
  187. {name: '意向平淡',value:3},
  188. {name: '随便看看',value:4}
  189. ],
  190. stateActions:[
  191. {name:'全部',value:0},
  192. {name:'跟进中',value:1},
  193. {name: '跟进完成',value:2},
  194. {name: '已放弃',value:3},
  195. ],
  196. reportActions:[
  197. {name:'全部',value:0},
  198. {name:'待审核',value:1},
  199. {name: '审核通过',value:2},
  200. {name: '审核未通过',value:3},
  201. ],
  202. clubActions:[
  203. {name:'全部',value:0},
  204. {name:'是',value:1},
  205. {name: '否',value:2},
  206. ],
  207. }
  208. },
  209. created() {
  210. this.SetScrollHeight()
  211. this.getUserClubConsults()
  212. },
  213. computed: {
  214. startDate() {
  215. return this.getDate('start')
  216. },
  217. endDate() {
  218. return this.getDate('end')
  219. }
  220. },
  221. methods: {
  222. async getUserClubConsults() {
  223. const userInfo = await this.$api.getStorage()
  224. this.manager = userInfo.manager ? userInfo.manager : 0
  225. this.leaderId = userInfo.leaderId ? userInfo.leaderId : 0
  226. //查询咨询类别
  227. this.UserService.getUserClubConsults()
  228. .then(response => {
  229. this.categorys = response.data.map((el, index) => {
  230. el.isChecked = false
  231. return el
  232. })
  233. if(this.manager > 0){
  234. this.getUserClubTeams()
  235. }
  236. if(this.leaderId > 0){
  237. this.getUserClubTeamsRroups(this.leaderId)
  238. }
  239. })
  240. .catch(error => {
  241. console.log('=========>获取咨询类别列表失败')
  242. })
  243. },
  244. getUserClubTeams() {
  245. this.UserService.getUserClubTeams()
  246. .then(response => {
  247. this.groups = response.data.map((el, index) => {
  248. el.isChecked = false
  249. return el
  250. })
  251. })
  252. .catch(error => {
  253. console.log('=========>获取小组列表失败')
  254. })
  255. },
  256. getUserClubTeamsRroups(leaderId) {
  257. this.UserService.getUserClubTeamsRroups({leaderId:leaderId})
  258. .then(response => {
  259. this.members = response.data.map((el, index) => {
  260. el.isChecked = false
  261. return el
  262. })
  263. })
  264. .catch(error => {
  265. console.log('=========>获取咨询类别列表失败')
  266. })
  267. },
  268. choiceCategorys(category,idx){
  269. //选择分类
  270. category.isChecked = !category.isChecked
  271. if (category.isChecked) {
  272. if(!this.contains(this.checkedCategorysList,category.id)){
  273. this.checkedCategorysList.push(category.id)
  274. }
  275. } else {
  276. this.checkedCategorysList.splice(this.checkedCategorysList.indexOf(category.id),1)
  277. }
  278. this.queryData.consult = this.checkedCategorysList.join(',')
  279. },
  280. contains(arr, val) {// 校验
  281. return arr.some(item => item === val)
  282. },
  283. choiceGroupsAll() {
  284. // 点击选择全部小组
  285. this.isCheckedGroups = true
  286. this.queryData.leaderId = ''
  287. this.groups.forEach(el => {
  288. el.isChecked = false
  289. })
  290. },
  291. choiceGroups(group,idx){
  292. //选择小组
  293. this.isCheckedGroups = false
  294. this.checkedGroupsIndex = idx
  295. this.groups.forEach((el, index) => {
  296. if (this.checkedGroupsIndex == index) {
  297. el.isChecked = true
  298. this.queryData.leaderId = group.leaderId
  299. this.getUserClubTeamsRroups(group.leaderId)
  300. } else {
  301. el.isChecked = false
  302. }
  303. })
  304. },
  305. choiceMembers(member, idx) {
  306. //选择组员
  307. this.checkedMemberIndex = idx
  308. this.members.forEach((el, index) => {
  309. if (this.checkedMemberIndex == index) {
  310. el.isChecked = true
  311. this.queryData.groupId = member.groupId
  312. } else {
  313. el.isChecked = false
  314. }
  315. })
  316. },
  317. bindPickerChange(type,e) {//选择筛选条件
  318. switch(type){
  319. case 1:
  320. this.priceFlagText = this.priceActions[e.target.value].name
  321. this.queryData.pinceSensitve = this.priceActions[e.target.value].value
  322. break
  323. case 2:
  324. this.intenFlagText = this.intenActions[e.target.value].name
  325. this.queryData.satisfied = this.intenActions[e.target.value].value
  326. break
  327. case 3:
  328. this.followStateText = this.stateActions[e.target.value].name
  329. this.queryData.followup = this.stateActions[e.target.value].value
  330. break
  331. case 4:
  332. this.reportText = this.reportActions[e.target.value].name
  333. this.queryData.followup = this.reportActions[e.target.value].value
  334. break
  335. case 5:
  336. this.clubStateText = this.clubActions[e.target.value].name
  337. this.queryData.followup = this.clubActions[e.target.value].value
  338. break
  339. }
  340. },
  341. closeDrawer(){
  342. this.$parent.isScreenDrawer = false
  343. },
  344. handSearchConfirm(){
  345. //确定筛选
  346. this.$emit('handSearchConfirm', this.queryData)
  347. this.$parent.isScreenDrawer = false
  348. },
  349. bindStartDateChange(event){
  350. //开始时间
  351. console.log('开始时间==>',event.detail.value)
  352. this.queryData.startAddTime = event.detail.value
  353. },
  354. bindEndDateChange(event){
  355. //结束时间
  356. console.log('结束时间==>',event.detail.value)
  357. this.queryData.endAddTime = event.detail.value
  358. },
  359. SetScrollHeight() {
  360. let obj = {}
  361. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  362. uni.getSystemInfo({
  363. success: res => {
  364. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  365. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  366. }
  367. })
  368. this.windowHeight = windowHeight - 1
  369. this.scrollHeight = windowHeight - 1
  370. },
  371. getDate(type) {
  372. const date = new Date()
  373. let year = date.getFullYear()
  374. let month = date.getMonth() + 1
  375. let day = date.getDate()
  376. if (type === 'start') {
  377. year = year - 1
  378. } else if (type === 'end') {
  379. year = year + 1
  380. }
  381. month = month > 9 ? month : '0' + month
  382. day = day > 9 ? day : '0' + day
  383. return `${year}-${month}-${day}`
  384. }
  385. }
  386. }
  387. </script>
  388. <style lang="scss">
  389. /*screen*/
  390. .drawer-container {
  391. width: 580rpx;
  392. height: 100%;
  393. padding: 80rpx 0;
  394. overflow: hidden;
  395. box-sizing: border-box;
  396. background-color: #FFFFFF;
  397. .drawer-title {
  398. width: 100%;
  399. height: 72rpx;
  400. line-height: 72rpx;
  401. box-sizing: border-box;
  402. padding: 0 30rpx;
  403. float: left;
  404. background-color: #f7f7f7;
  405. font-size: $font-size-26;
  406. color: #333333;
  407. font-weight: bold;
  408. text-align: left;
  409. }
  410. .drawer-main {
  411. width: 100%;
  412. height: auto;
  413. box-sizing: border-box;
  414. float: left;
  415. .drawer-main-name{
  416. width: 100%;
  417. height: 80rpx;
  418. line-height: 80rpx;
  419. text-align: left;
  420. font-size: $font-size-26;
  421. color: #333333;
  422. box-sizing: border-box;
  423. padding: 0 20rpx;
  424. font-weight: bold;
  425. }
  426. .drawer-main-time{
  427. width: 100%;
  428. height: 56rpx;
  429. box-sizing: border-box;
  430. .line{
  431. color: #999999;
  432. float: left;
  433. line-height: 56rpx;
  434. }
  435. .drawer-main-time-input{
  436. width: 228rpx;
  437. height: 56rpx;
  438. background: #F7F7F7;
  439. border-radius: 28rpx;
  440. box-sizing: border-box;
  441. padding: 0 20rpx;
  442. line-height: 56rpx;
  443. float: left;
  444. margin: 0 20rpx;
  445. position: relative;
  446. .input-text{
  447. display: block;
  448. height: 56rpx;
  449. font-size: 26rpx;
  450. color: #666666;
  451. }
  452. .icon-riqi{
  453. color: #E15616;
  454. display: block;
  455. width: 40rpx;
  456. height: 56rpx;
  457. position: absolute;
  458. right: 10rpx;
  459. top: 0;
  460. line-height: 56rpx;
  461. }
  462. }
  463. }
  464. .drawer-main-brand {
  465. width: 100%;
  466. height: auto;
  467. box-sizing: border-box;
  468. padding: 0 20rpx;
  469. background-color: #ffffff;
  470. .drawer-brand-list {
  471. width: 160rpx;
  472. height: 56rpx;
  473. line-height: 56rpx;
  474. text-align: center;
  475. font-size: 26rpx;
  476. background-color: #f7f7f7;
  477. color: #999999;
  478. border-radius: 30rpx;
  479. box-sizing: border-box;
  480. padding: 0 15rpx;
  481. float: left;
  482. margin: 12rpx 24rpx 12rpx 0;
  483. text-overflow: ellipsis;
  484. overflow: hidden;
  485. display: -webkit-box;
  486. -webkit-line-clamp: 1;
  487. line-clamp: 1;
  488. -webkit-box-orient: vertical;
  489. &.checked {
  490. background-color: #fef6f3;
  491. color: #e15616;
  492. }
  493. &:nth-child(3n) {
  494. margin-right: 0;
  495. }
  496. }
  497. }
  498. .drawer-main-radiov{
  499. width: 100%;
  500. height: auto;
  501. box-sizing: border-box;
  502. padding: 0 20rpx;
  503. .drawer-main-radio{
  504. width: 100%;
  505. height: 80rpx;
  506. box-sizing: border-box;
  507. padding: 0 10rpx;
  508. border: 1px solid rgba(0,0,0,0.2);
  509. border-radius: 6rpx;
  510. margin-bottom: 30rpx;
  511. position: relative;
  512. &.btn{
  513. border: none;
  514. margin-top: 40rpx;
  515. }
  516. .input{
  517. width: 100%;
  518. height: 80rpx;
  519. line-height: 80rpx;
  520. float: left;
  521. box-sizing: border-box;
  522. font-size: $font-size-24;
  523. color: #333333;
  524. padding: 0 10rpx;
  525. padding-right: 68rpx;
  526. }
  527. .iconfont{
  528. width: 50rpx;
  529. height: 80rpx;
  530. display: block;
  531. line-height: 80rpx;
  532. text-align: center;
  533. font-size: 30rpx;
  534. color: #999999;
  535. position: absolute;
  536. right: 0;
  537. top: 0;
  538. }
  539. }
  540. }
  541. }
  542. .drawer-input {
  543. width: 100%;
  544. float: left;
  545. box-sizing: border-box;
  546. padding: 24rpx 10rpx 0 10rpx;
  547. border: 1px solid rgba(0, 0, 0, 0.2);
  548. border-radius: 4rpx;
  549. position: relative;
  550. background-color: #ffffff;
  551. &.btn {
  552. border: none;
  553. display: flex;
  554. position: fixed;
  555. left: 0;
  556. bottom: 0;
  557. }
  558. .drawer-btn {
  559. width: 210rpx;
  560. height: 84rpx;
  561. border-radius: 42rpx;
  562. background: $btn-confirm;
  563. line-height: 84rpx;
  564. text-align: center;
  565. font-size: $font-size-26;
  566. color: #ffffff;
  567. flex: 1;
  568. margin: 0 10rpx;
  569. &.comfrim {
  570. background: $btn-confirm;
  571. }
  572. &.clear {
  573. background: #FFE6DC;
  574. color: $color-system;
  575. }
  576. }
  577. }
  578. }
  579. </style>