cm-screen-drawer.vue 14 KB

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