cm-club-drawer.vue 11 KB

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