cm-screen-drawer.vue 16 KB

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