cm-screen-drawer.vue 14 KB

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