cm-club-drawer.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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="{
  9. paddingTop: CustomBar - StatusBar + 8 + 'px',
  10. paddingBottom: isIphoneX ? '180rpx' : '146rpx'
  11. }"
  12. >
  13. <scroll-view class="tui-drawer-scroll" scroll-y :style="{ height: drawerH + 'px' }">
  14. <view class="drawer-title">更多筛选</view>
  15. <view class="drawer-main">
  16. <template v-if="isManage">
  17. <view class="drawer-main-name">组员:</view>
  18. <view class="drawer-main-radiov">
  19. <view class="drawer-main-radio">
  20. <picker
  21. @change="bindPickerChange(1, $event)"
  22. :value="index"
  23. :range="sellerActions"
  24. range-key="name"
  25. >
  26. <input
  27. class="input"
  28. type="text"
  29. disabled="false"
  30. v-model="actionsText"
  31. value=""
  32. placeholder="请选择"
  33. />
  34. <text class="iconfont icon-xiangyou"></text>
  35. </picker>
  36. </view>
  37. </view>
  38. </template>
  39. <template v-else>
  40. <view class="drawer-main-name">客户分配日期</view>
  41. <view class="drawer-main-time">
  42. <view class="drawer-main-time-input">
  43. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindStartDateChange">
  44. <text class="input-text">{{ queryData.startTime }}</text>
  45. </picker>
  46. <text class="iconfont icon-riqi"></text>
  47. </view>
  48. <view class="line">-</view>
  49. <view class="drawer-main-time-input">
  50. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindEndDateChange">
  51. <text class="input-text">{{ queryData.endTime }}</text>
  52. </picker>
  53. <text class="iconfont icon-riqi"></text>
  54. </view>
  55. </view>
  56. </template>
  57. </view>
  58. </scroll-view>
  59. <view class="drawer-input btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  60. <view class="drawer-btn clear" @click="closeDrawer">取消</view>
  61. <view class="drawer-btn comfrim" @click="handSearchConfirm">确定</view>
  62. </view>
  63. </view>
  64. </tui-drawer>
  65. </view>
  66. </template>
  67. <script>
  68. import { mapState, mapMutations } from 'vuex'
  69. export default {
  70. name: 'rightDrawer',
  71. props: {
  72. rightDrawer: {
  73. type: Boolean,
  74. default: false
  75. }
  76. },
  77. data() {
  78. const currentDate = this.getDate({
  79. format: true
  80. })
  81. return {
  82. date: currentDate,
  83. CustomBar: this.CustomBar, // 顶部导航栏高度
  84. StatusBar: this.StatusBar,
  85. isIphoneX: this.$store.state.isIphoneX,
  86. height: 0,
  87. drawerH: 0, // 抽屉内部scrollview高度
  88. categorys: [],
  89. checkedCategorysList: [],
  90. actionsText: '',
  91. queryData: {
  92. startTime:'',
  93. endTime:'',
  94. serviceProviderId: 0
  95. },
  96. sellerActions: []
  97. }
  98. },
  99. created() {
  100. this.setScrollHeight()
  101. if(this.isManage){
  102. this.userSellerServiceTeam()
  103. }
  104. },
  105. computed: {
  106. ...mapState(['isManage']),
  107. startDate() {
  108. return this.getDate('start')
  109. },
  110. endDate() {
  111. return this.getDate('end')
  112. }
  113. },
  114. methods: {
  115. async userSellerServiceTeam() {
  116. //获取组员协销列表
  117. try{
  118. const userInfo = await this.$api.getStorage()
  119. const res = await this.SellerService.userSellerServiceTeam({ spId: userInfo.serviceProviderId })
  120. this.sellerActions = res.data
  121. }catch(e){
  122. console.log('=========>获取组员协销列表异常')
  123. }
  124. },
  125. bindPickerChange(type, e) {
  126. //选择筛选条件
  127. switch (type) {
  128. case 1:
  129. this.actionsText = this.sellerActions[e.target.value].name
  130. this.queryData.serviceProviderId = this.sellerActions[e.target.value].serviceProviderId
  131. break
  132. }
  133. },
  134. bindStartDateChange(event){
  135. //开始时间
  136. console.log('开始时间==>',event.detail.value)
  137. this.queryData.startTime = event.detail.value
  138. console.log('开始时间==>',this.queryData.startTime)
  139. },
  140. bindEndDateChange(event){
  141. //结束时间
  142. console.log('结束时间==>',event.detail.value)
  143. this.queryData.endTime = event.detail.value
  144. console.log('结束时间==>',this.queryData.endTime)
  145. },
  146. closeDrawer() {
  147. this.$parent.rightDrawer = false
  148. },
  149. handSearchConfirm() {
  150. //确定筛选
  151. this.$emit('handSearchConfirm', this.queryData)
  152. this.$parent.rightDrawer = false
  153. },
  154. setScrollHeight() {
  155. let obj = {}
  156. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  157. uni.getSystemInfo({
  158. success: res => {
  159. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  160. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  161. }
  162. })
  163. this.windowHeight = windowHeight - 1
  164. this.scrollHeight = windowHeight - 1
  165. },
  166. getDate(type) {
  167. const date = new Date()
  168. let year = date.getFullYear()
  169. let month = date.getMonth() + 1
  170. let day = date.getDate()
  171. if (type === 'start') {
  172. year = year - 1
  173. } else if (type === 'end') {
  174. year = year + 1
  175. }
  176. month = month > 9 ? month : '0' + month
  177. day = day > 9 ? day : '0' + day
  178. return `${year}-${month}-${day}`
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. /*screen*/
  185. .drawer-container {
  186. width: 580rpx;
  187. height: 100%;
  188. padding: 80rpx 0;
  189. overflow: hidden;
  190. box-sizing: border-box;
  191. background-color: #ffffff;
  192. .drawer-title {
  193. width: 100%;
  194. height: 72rpx;
  195. line-height: 72rpx;
  196. box-sizing: border-box;
  197. padding: 0 30rpx;
  198. float: left;
  199. background-color: #f7f7f7;
  200. font-size: $font-size-26;
  201. color: #333333;
  202. font-weight: bold;
  203. text-align: left;
  204. }
  205. .drawer-main {
  206. width: 100%;
  207. height: auto;
  208. box-sizing: border-box;
  209. float: left;
  210. .drawer-main-name {
  211. width: 100%;
  212. height: 80rpx;
  213. line-height: 80rpx;
  214. text-align: left;
  215. font-size: $font-size-26;
  216. color: #333333;
  217. box-sizing: border-box;
  218. padding: 0 20rpx;
  219. font-weight: bold;
  220. }
  221. .drawer-main-time{
  222. width: 100%;
  223. height: 56rpx;
  224. box-sizing: border-box;
  225. .line{
  226. color: #999999;
  227. float: left;
  228. line-height: 56rpx;
  229. }
  230. .drawer-main-time-input{
  231. width: 228rpx;
  232. height: 56rpx;
  233. background: #F7F7F7;
  234. border-radius: 28rpx;
  235. box-sizing: border-box;
  236. padding: 0 20rpx;
  237. line-height: 56rpx;
  238. float: left;
  239. margin: 0 20rpx;
  240. position: relative;
  241. .input-text{
  242. display: block;
  243. height: 56rpx;
  244. font-size: 26rpx;
  245. color: #666666;
  246. }
  247. .icon-riqi{
  248. color: #FF5B00;
  249. display: block;
  250. width: 40rpx;
  251. height: 56rpx;
  252. position: absolute;
  253. right: 10rpx;
  254. top: 0;
  255. line-height: 56rpx;
  256. }
  257. }
  258. }
  259. .drawer-main-radiov {
  260. width: 100%;
  261. height: auto;
  262. box-sizing: border-box;
  263. padding: 0 20rpx;
  264. .drawer-main-radio {
  265. width: 100%;
  266. height: 80rpx;
  267. box-sizing: border-box;
  268. padding: 0 10rpx;
  269. border: 1px solid rgba(0, 0, 0, 0.2);
  270. border-radius: 6rpx;
  271. margin-bottom: 30rpx;
  272. position: relative;
  273. &.btn {
  274. border: none;
  275. margin-top: 40rpx;
  276. }
  277. .input {
  278. width: 100%;
  279. height: 80rpx;
  280. line-height: 80rpx;
  281. float: left;
  282. box-sizing: border-box;
  283. font-size: $font-size-24;
  284. color: #333333;
  285. padding: 0 10rpx;
  286. padding-right: 68rpx;
  287. }
  288. .iconfont {
  289. width: 50rpx;
  290. height: 80rpx;
  291. display: block;
  292. line-height: 80rpx;
  293. text-align: center;
  294. font-size: 30rpx;
  295. color: #999999;
  296. position: absolute;
  297. right: 0;
  298. top: 0;
  299. }
  300. }
  301. }
  302. }
  303. .drawer-input {
  304. width: 100%;
  305. float: left;
  306. box-sizing: border-box;
  307. padding: 24rpx 10rpx 0 10rpx;
  308. border: 1px solid rgba(0, 0, 0, 0.2);
  309. border-radius: 4rpx;
  310. position: relative;
  311. background-color: #ffffff;
  312. &.btn {
  313. border: none;
  314. display: flex;
  315. position: fixed;
  316. left: 0;
  317. bottom: 0;
  318. }
  319. .drawer-btn {
  320. width: 210rpx;
  321. height: 84rpx;
  322. border-radius: 42rpx;
  323. background: $btn-confirm;
  324. line-height: 84rpx;
  325. text-align: center;
  326. font-size: $font-size-26;
  327. color: #ffffff;
  328. flex: 1;
  329. margin: 0 10rpx;
  330. &.comfrim {
  331. background: $btn-confirm;
  332. }
  333. &.clear {
  334. background: #ffe6dc;
  335. color: $color-system;
  336. }
  337. }
  338. }
  339. }
  340. </style>