cm-club-drawer.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. <view class="drawer-main-name">机构类型:</view>
  57. <view class="drawer-main-radiov">
  58. <view class="drawer-main-radio">
  59. <picker @change="bindPickerChange(2,$event)" :value="index" :range="clubTypeActions" range-key="name">
  60. <input class="input" type="text" disabled="false" v-model="clubTypeText" value="" placeholder="请选择"/>
  61. <text class="iconfont icon-xiangyou"></text>
  62. </picker>
  63. </view>
  64. </view>
  65. <template v-if="queryData.userIdentity === 4">
  66. <view class="drawer-main-name">升级状态<text class="small">(个人机构升级为资质机构)</text>:</view>
  67. <view class="drawer-main-radiov">
  68. <view class="drawer-main-radio">
  69. <picker @change="bindPickerChange(3,$event)" :value="index" :range="clubStatusActions" range-key="name">
  70. <input class="input" type="text" disabled="false" v-model="clubStatusText" value="" placeholder="请选择"/>
  71. <text class="iconfont icon-xiangyou"></text>
  72. </picker>
  73. </view>
  74. </view>
  75. </template>
  76. <view class="drawer-main-name">活跃状态:</view>
  77. <view class="drawer-main-radiov">
  78. <view class="drawer-main-radio">
  79. <picker @change="bindPickerChange(4,$event)" :value="index" :range="clubActiveActions" range-key="name">
  80. <input class="input" type="text" disabled="false" v-model="clubActiveText" value="" placeholder="请选择"/>
  81. <text class="iconfont icon-xiangyou"></text>
  82. </picker>
  83. </view>
  84. </view>
  85. <view class="drawer-main-name">客户价值:</view>
  86. <view class="drawer-main-radiov">
  87. <view class="drawer-main-radio">
  88. <picker @change="bindPickerChange(5,$event)" :value="index" :range="customerValueActions" range-key="name">
  89. <input class="input" type="text" disabled="false" v-model="customerValueText" value="" placeholder="请选择"/>
  90. <text class="iconfont icon-xiangyou"></text>
  91. </picker>
  92. </view>
  93. </view>
  94. </template>
  95. </view>
  96. </scroll-view>
  97. <view class="drawer-input btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  98. <view class="drawer-btn clear" @click="closeDrawer">取消</view>
  99. <view class="drawer-btn comfrim" @click="handSearchConfirm">确定</view>
  100. </view>
  101. </view>
  102. </tui-drawer>
  103. </view>
  104. </template>
  105. <script>
  106. import { mapState, mapMutations } from 'vuex'
  107. export default {
  108. name: 'rightDrawer',
  109. props: {
  110. rightDrawer: {
  111. type: Boolean,
  112. default: false
  113. }
  114. },
  115. data() {
  116. const currentDate = this.getDate({
  117. format: true
  118. })
  119. return {
  120. date: currentDate,
  121. CustomBar: this.CustomBar, // 顶部导航栏高度
  122. StatusBar: this.StatusBar,
  123. isIphoneX: this.$store.state.isIphoneX,
  124. height: 0,
  125. drawerH: 0, // 抽屉内部scrollview高度
  126. categorys: [],
  127. checkedCategorysList: [],
  128. actionsText: '',
  129. queryData: {
  130. startTime:'',
  131. endTime:'',
  132. userIdentity:'',
  133. serviceProviderId: 0,
  134. activeState: '',
  135. customerValue:''
  136. },
  137. clubTypeActions:[
  138. {name:'个人机构',value:4},
  139. {name:'资质机构',value:2}
  140. ],
  141. clubStatusActions:[
  142. {name:'待升级',value:90},
  143. {name:'升级中',value:1},
  144. {name:'升级失败',value:92}
  145. ],
  146. clubActiveActions:[
  147. {name:'活跃用户',value:1},
  148. {name:'不活跃用户',value:1}
  149. ],
  150. customerValueActions:[
  151. {name:'高价值客户',value:1},
  152. {name:'一般价值客户',value:1},
  153. {name:'潜在价值客户',value:1},
  154. {name:'低价值客户',value:1}
  155. ],
  156. clubTypeText:'',
  157. clubStatusText:'',
  158. clubActiveText:'',
  159. customerValueText:'',
  160. sellerActions: []
  161. }
  162. },
  163. created() {
  164. this.setScrollHeight()
  165. if(this.isManage){
  166. this.userSellerServiceTeam()
  167. }
  168. },
  169. computed: {
  170. ...mapState(['isManage']),
  171. startDate() {
  172. return this.getDate('start')
  173. },
  174. endDate() {
  175. return this.getDate('end')
  176. }
  177. },
  178. methods: {
  179. async userSellerServiceTeam() {
  180. //获取组员协销列表
  181. try{
  182. const userInfo = await this.$api.getStorage()
  183. const res = await this.SellerService.userSellerServiceTeam({ spId: userInfo.serviceProviderId })
  184. this.sellerActions = res.data
  185. }catch(e){
  186. console.log('=========>获取组员协销列表异常')
  187. }
  188. },
  189. bindPickerChange(type, e) {
  190. //选择筛选条件
  191. switch (type) {
  192. case 1:
  193. this.actionsText = this.sellerActions[e.target.value].name
  194. this.queryData.serviceProviderId = this.sellerActions[e.target.value].serviceProviderId
  195. break
  196. case 2:
  197. this.clubTypeText = this.clubTypeActions[e.target.value].name
  198. this.queryData.userIdentity = this.clubTypeActions[e.target.value].value
  199. break
  200. case 3:
  201. this.clubStatusText = this.clubStatusActions[e.target.value].name
  202. this.queryData.status = this.clubStatusActions[e.target.value].value
  203. break
  204. case 4:
  205. this.clubActiveText = this.clubActiveActions[e.target.value].name
  206. this.queryData.activeState = this.clubActiveActions[e.target.value].name
  207. break
  208. case 5:
  209. this.customerValueText = this.customerValueActions[e.target.value].name
  210. this.queryData.customerValue = this.customerValueActions[e.target.value].name
  211. break
  212. }
  213. },
  214. bindStartDateChange(event){
  215. //开始时间
  216. console.log('开始时间==>',event.detail.value)
  217. this.queryData.startTime = event.detail.value
  218. console.log('开始时间==>',this.queryData.startTime)
  219. },
  220. bindEndDateChange(event){
  221. //结束时间
  222. console.log('结束时间==>',event.detail.value)
  223. this.queryData.endTime = event.detail.value
  224. console.log('结束时间==>',this.queryData.endTime)
  225. },
  226. closeDrawer() {
  227. this.$parent.rightDrawer = false
  228. },
  229. handSearchConfirm() {
  230. //确定筛选
  231. this.$emit('handSearchConfirm', this.queryData)
  232. this.$parent.rightDrawer = false
  233. },
  234. setScrollHeight() {
  235. let obj = {}
  236. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  237. uni.getSystemInfo({
  238. success: res => {
  239. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  240. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  241. }
  242. })
  243. this.windowHeight = windowHeight - 1
  244. this.scrollHeight = windowHeight - 1
  245. },
  246. getDate(type) {
  247. const date = new Date()
  248. let year = date.getFullYear()
  249. let month = date.getMonth() + 1
  250. let day = date.getDate()
  251. if (type === 'start') {
  252. year = year - 1
  253. } else if (type === 'end') {
  254. year = year + 1
  255. }
  256. month = month > 9 ? month : '0' + month
  257. day = day > 9 ? day : '0' + day
  258. return `${year}-${month}-${day}`
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss">
  264. /*screen*/
  265. .drawer-container {
  266. width: 580rpx;
  267. height: 100%;
  268. padding: 80rpx 0;
  269. overflow: hidden;
  270. box-sizing: border-box;
  271. background-color: #ffffff;
  272. .drawer-title {
  273. width: 100%;
  274. height: 72rpx;
  275. line-height: 72rpx;
  276. box-sizing: border-box;
  277. padding: 0 30rpx;
  278. float: left;
  279. background-color: #f7f7f7;
  280. font-size: $font-size-26;
  281. color: #333333;
  282. font-weight: bold;
  283. text-align: left;
  284. }
  285. .drawer-main {
  286. width: 100%;
  287. height: auto;
  288. box-sizing: border-box;
  289. float: left;
  290. .drawer-main-name {
  291. width: 100%;
  292. height: 80rpx;
  293. line-height: 80rpx;
  294. text-align: left;
  295. font-size: $font-size-26;
  296. color: #333333;
  297. box-sizing: border-box;
  298. padding: 0 20rpx;
  299. font-weight: bold;
  300. .small{
  301. font-weight: normal;
  302. color: #999999;
  303. }
  304. }
  305. .drawer-main-time{
  306. width: 100%;
  307. height: 56rpx;
  308. box-sizing: border-box;
  309. .line{
  310. color: #999999;
  311. float: left;
  312. line-height: 56rpx;
  313. }
  314. .drawer-main-time-input{
  315. width: 228rpx;
  316. height: 56rpx;
  317. background: #F7F7F7;
  318. border-radius: 28rpx;
  319. box-sizing: border-box;
  320. padding: 0 20rpx;
  321. line-height: 56rpx;
  322. float: left;
  323. margin: 0 20rpx;
  324. position: relative;
  325. .input-text{
  326. display: block;
  327. height: 56rpx;
  328. font-size: 26rpx;
  329. color: #666666;
  330. }
  331. .icon-riqi{
  332. color: #FF5B00;
  333. display: block;
  334. width: 40rpx;
  335. height: 56rpx;
  336. position: absolute;
  337. right: 10rpx;
  338. top: 0;
  339. line-height: 56rpx;
  340. }
  341. }
  342. }
  343. .drawer-main-radiov {
  344. width: 100%;
  345. height: auto;
  346. box-sizing: border-box;
  347. padding: 0 20rpx;
  348. .drawer-main-radio {
  349. width: 100%;
  350. height: 80rpx;
  351. box-sizing: border-box;
  352. padding: 0 10rpx;
  353. border: 1px solid rgba(0, 0, 0, 0.2);
  354. border-radius: 6rpx;
  355. margin-bottom: 30rpx;
  356. position: relative;
  357. &.btn {
  358. border: none;
  359. margin-top: 40rpx;
  360. }
  361. .input {
  362. width: 100%;
  363. height: 80rpx;
  364. line-height: 80rpx;
  365. float: left;
  366. box-sizing: border-box;
  367. font-size: $font-size-24;
  368. color: #333333;
  369. padding: 0 10rpx;
  370. padding-right: 68rpx;
  371. }
  372. .iconfont {
  373. width: 50rpx;
  374. height: 80rpx;
  375. display: block;
  376. line-height: 80rpx;
  377. text-align: center;
  378. font-size: 30rpx;
  379. color: #999999;
  380. position: absolute;
  381. right: 0;
  382. top: 0;
  383. }
  384. }
  385. }
  386. }
  387. .drawer-input {
  388. width: 100%;
  389. float: left;
  390. box-sizing: border-box;
  391. padding: 24rpx 10rpx 0 10rpx;
  392. border: 1px solid rgba(0, 0, 0, 0.2);
  393. border-radius: 4rpx;
  394. position: relative;
  395. background-color: #ffffff;
  396. &.btn {
  397. border: none;
  398. display: flex;
  399. position: fixed;
  400. left: 0;
  401. bottom: 0;
  402. }
  403. .drawer-btn {
  404. width: 210rpx;
  405. height: 84rpx;
  406. border-radius: 42rpx;
  407. background: $btn-confirm;
  408. line-height: 84rpx;
  409. text-align: center;
  410. font-size: $font-size-26;
  411. color: #ffffff;
  412. flex: 1;
  413. margin: 0 10rpx;
  414. &.comfrim {
  415. background: $btn-confirm;
  416. }
  417. &.clear {
  418. background: #ffe6dc;
  419. color: $color-system;
  420. }
  421. }
  422. }
  423. }
  424. </style>