cm-screen-drawer.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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. <view class="drawer-main-name">小组</view>
  42. <view class="drawer-main-brand clearfix">
  43. <view
  44. class="drawer-brand-list"
  45. :class="isCheckedGroups ? 'checked' : ''"
  46. @click="choiceGroupsAll"
  47. >全部</view
  48. >
  49. <view
  50. class="drawer-brand-list"
  51. :class="group.isChecked ? 'checked' : ''"
  52. v-for="(group, index) in groups"
  53. :key="index"
  54. @click="choiceGroups(group, index)"
  55. >
  56. {{ group.leaderName }}
  57. </view>
  58. </view>
  59. <view class="drawer-main-name" v-if="members.length>0">组员</view>
  60. <view class="drawer-main-brand clearfix" v-if="members.length>0">
  61. <view
  62. class="drawer-brand-list"
  63. :class="member.isChecked ? 'checked' : ''"
  64. v-for="(member, index) in members"
  65. :key="index"
  66. @click="choiceMembers(member, index)"
  67. >
  68. {{ member.groupName }}
  69. </view>
  70. </view>
  71. </view>
  72. </scroll-view>
  73. <view class="drawer-input btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  74. <view class="drawer-btn clear" @click="closeDrawer">取消</view>
  75. <view class="drawer-btn comfrim" @click="handSearchConfirm">确定</view>
  76. </view>
  77. </view>
  78. </tui-drawer>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. name: 'rightDrawer',
  84. props: {
  85. rightDrawer: {
  86. type: Boolean,
  87. default: false
  88. }
  89. },
  90. data() {
  91. const currentDate = this.getDate({
  92. format: true
  93. })
  94. return {
  95. CustomBar: this.CustomBar, // 顶部导航栏高度
  96. isIphoneX: this.$store.state.isIphoneX,
  97. isCheckedGroups:false,
  98. checkedIndex: 0,
  99. checkedGroupsIndex: 0,
  100. checkedMemberIndex: 0,
  101. isShowClose: false,
  102. dataList: [],
  103. date: currentDate,
  104. height: 0,
  105. drawerH: 0 ,// 抽屉内部scrollview高度
  106. categorys:[],
  107. checkedCategorysList:[],
  108. groups:[],
  109. members:[],
  110. queryData:{
  111. startAddTime:'开始日期',
  112. endAddTime:'结束日期',
  113. consult:'',
  114. leaderId:0,
  115. groupId:0,
  116. }
  117. }
  118. },
  119. created() {
  120. this.SetScrollHeight()
  121. this.getUserClubConsults()
  122. },
  123. computed: {
  124. startDate() {
  125. return this.getDate('start')
  126. },
  127. endDate() {
  128. return this.getDate('end')
  129. }
  130. },
  131. methods: {
  132. getUserClubConsults() {
  133. //查询咨询类别
  134. this.UserService.getUserClubConsults()
  135. .then(response => {
  136. this.categorys = response.data.map((el, index) => {
  137. el.isChecked = false
  138. return el
  139. })
  140. this.getUserClubTeams()
  141. })
  142. .catch(error => {
  143. console.log('=========>获取咨询类别列表失败')
  144. })
  145. },
  146. getUserClubTeams() {
  147. this.UserService.getUserClubTeams()
  148. .then(response => {
  149. this.groups = response.data.map((el, index) => {
  150. el.isChecked = false
  151. return el
  152. })
  153. })
  154. .catch(error => {
  155. console.log('=========>获取咨询类别列表失败')
  156. })
  157. },
  158. getUserClubTeamsRroups(leaderId) {
  159. this.UserService.getUserClubTeamsRroups({leaderId:leaderId})
  160. .then(response => {
  161. this.members = response.data.map((el, index) => {
  162. el.isChecked = false
  163. return el
  164. })
  165. })
  166. .catch(error => {
  167. console.log('=========>获取咨询类别列表失败')
  168. })
  169. },
  170. choiceCategorys(category,idx){
  171. //选择分类
  172. category.isChecked = !category.isChecked
  173. if (category.isChecked) {
  174. this.checkedCategorysList.push(category.id)
  175. } else {
  176. this.checkedCategorysList.splice(index, 1)
  177. }
  178. this.queryData.consult = this.checkedCategorysList.join(',')
  179. console.log('checkedBrandList', this.queryData.consult)
  180. },
  181. choiceGroupsAll() {
  182. // 点击选择全部小组
  183. this.isCheckedGroups = true
  184. this.queryData.leaderId = ''
  185. this.groups.forEach(el => {
  186. el.isChecked = false
  187. })
  188. },
  189. choiceGroups(group,idx){
  190. //选择小组
  191. this.isCheckedGroups = false
  192. this.checkedGroupsIndex = idx
  193. this.groups.forEach((el, index) => {
  194. if (this.checkedGroupsIndex == index) {
  195. el.isChecked = true
  196. this.queryData.leaderId = group.leaderId
  197. this.getUserClubTeamsRroups(group.leaderId)
  198. } else {
  199. el.isChecked = false
  200. }
  201. })
  202. },
  203. choiceMembers(member, idx) {
  204. //选择组员
  205. this.checkedMemberIndex = idx
  206. this.members.forEach((el, index) => {
  207. if (this.checkedMemberIndex == index) {
  208. el.isChecked = true
  209. this.queryData.groupId = member.groupId
  210. } else {
  211. el.isChecked = false
  212. }
  213. })
  214. },
  215. closeDrawer(){
  216. this.$parent.isScreenDrawer = false
  217. },
  218. handSearchConfirm(){
  219. //确定筛选
  220. this.$emit('handSearchConfirm', this.queryData)
  221. this.$parent.isScreenDrawer = false
  222. },
  223. bindStartDateChange(event){
  224. //开始时间
  225. console.log('开始时间==>',event.detail.value)
  226. this.queryData.startAddTime = event.detail.value
  227. },
  228. bindEndDateChange(event){
  229. //结束时间
  230. console.log('结束时间==>',event.detail.value)
  231. this.queryData.endAddTime = event.detail.value
  232. },
  233. SetScrollHeight() {
  234. let obj = {}
  235. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  236. uni.getSystemInfo({
  237. success: res => {
  238. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  239. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  240. }
  241. })
  242. this.windowHeight = windowHeight - 1
  243. this.scrollHeight = windowHeight - 1
  244. },
  245. getDate(type) {
  246. const date = new Date()
  247. let year = date.getFullYear()
  248. let month = date.getMonth() + 1
  249. let day = date.getDate()
  250. if (type === 'start') {
  251. year = year - 60
  252. } else if (type === 'end') {
  253. year = year + 2
  254. }
  255. month = month > 9 ? month : '0' + month
  256. day = day > 9 ? day : '0' + day
  257. return `${year}-${month}-${day}`
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss">
  263. /*screen*/
  264. .drawer-container {
  265. width: 580rpx;
  266. height: 100%;
  267. padding: 80rpx 0;
  268. overflow: hidden;
  269. box-sizing: border-box;
  270. background-color: #FFFFFF;
  271. .drawer-title {
  272. width: 100%;
  273. height: 72rpx;
  274. line-height: 72rpx;
  275. box-sizing: border-box;
  276. padding: 0 30rpx;
  277. float: left;
  278. background-color: #f7f7f7;
  279. font-size: $font-size-26;
  280. color: #333333;
  281. font-weight: bold;
  282. text-align: left;
  283. }
  284. .drawer-main {
  285. width: 100%;
  286. height: auto;
  287. box-sizing: border-box;
  288. float: left;
  289. .drawer-main-name{
  290. width: 100%;
  291. height: 80rpx;
  292. line-height: 80rpx;
  293. text-align: left;
  294. font-size: $font-size-26;
  295. color: #333333;
  296. box-sizing: border-box;
  297. padding: 0 20rpx;
  298. }
  299. .drawer-main-time{
  300. width: 100%;
  301. height: 56rpx;
  302. box-sizing: border-box;
  303. .line{
  304. color: #999999;
  305. float: left;
  306. line-height: 56rpx;
  307. }
  308. .drawer-main-time-input{
  309. width: 228rpx;
  310. height: 56rpx;
  311. background: #F7F7F7;
  312. border-radius: 28rpx;
  313. box-sizing: border-box;
  314. padding: 0 20rpx;
  315. line-height: 56rpx;
  316. float: left;
  317. margin: 0 20rpx;
  318. position: relative;
  319. .input-text{
  320. font-size: 26rpx;
  321. color: #666666;
  322. }
  323. .icon-riqi{
  324. color: #E15616;
  325. display: block;
  326. width: 40rpx;
  327. height: 56rpx;
  328. position: absolute;
  329. right: 10rpx;
  330. top: 0;
  331. line-height: 56rpx;
  332. }
  333. }
  334. }
  335. .drawer-main-brand {
  336. width: 100%;
  337. height: auto;
  338. box-sizing: border-box;
  339. padding: 0 20rpx;
  340. background-color: #ffffff;
  341. .drawer-brand-list {
  342. width: 160rpx;
  343. height: 56rpx;
  344. line-height: 56rpx;
  345. text-align: center;
  346. font-size: 26rpx;
  347. background-color: #f7f7f7;
  348. color: #999999;
  349. border-radius: 30rpx;
  350. box-sizing: border-box;
  351. padding: 0 15rpx;
  352. float: left;
  353. margin: 12rpx 24rpx 12rpx 0;
  354. text-overflow: ellipsis;
  355. overflow: hidden;
  356. display: -webkit-box;
  357. -webkit-line-clamp: 1;
  358. line-clamp: 1;
  359. -webkit-box-orient: vertical;
  360. &.checked {
  361. background-color: #fef6f3;
  362. color: #e15616;
  363. }
  364. &:nth-child(3n) {
  365. margin-right: 0;
  366. }
  367. }
  368. }
  369. }
  370. .drawer-input {
  371. width: 100%;
  372. float: left;
  373. box-sizing: border-box;
  374. padding: 24rpx 10rpx 0 10rpx;
  375. border: 1px solid rgba(0, 0, 0, 0.2);
  376. border-radius: 4rpx;
  377. position: relative;
  378. background-color: #ffffff;
  379. &.btn {
  380. border: none;
  381. display: flex;
  382. position: fixed;
  383. left: 0;
  384. bottom: 0;
  385. }
  386. .drawer-btn {
  387. width: 210rpx;
  388. height: 84rpx;
  389. border-radius: 42rpx;
  390. background: $btn-confirm;
  391. line-height: 84rpx;
  392. text-align: center;
  393. font-size: $font-size-26;
  394. color: #ffffff;
  395. flex: 1;
  396. margin: 0 10rpx;
  397. &.comfrim {
  398. background: $btn-confirm;
  399. }
  400. &.clear {
  401. background: #FFE6DC;
  402. color: $color-system;
  403. }
  404. }
  405. }
  406. }
  407. </style>