cm-screen-drawer.vue 9.4 KB

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