cm-screen-drawer.vue 10 KB

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