cm-screen-drawer.vue 16 KB

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