dmHexiaoScreenPicker.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <dm-pop-view ref="popView" title="更多筛选" :isShowConfirm="false" :maskTapHide='true'>
  3. <scroll-view class="screen_container" scroll-y="true">
  4. <view class="screen-items" v-for="(item, idx) in dataList" :key="idx">
  5. <block v-if="!(idx == 1 && screenValue == 1)">
  6. <view class="screen_item_title">{{item.title}}</view>
  7. <view class="level_tag_view">
  8. <text class="level_tag" :style="{ color: item1.isSelect ? '#fff' : '#666', 'background-color': item1.isSelect ? themeColor : '#F1F5F9' }"
  9. v-for="(item1, idx1) in item.subList" :key="idx1" @click="selectAction(item1, idx)">
  10. {{item1.title}}
  11. </text>
  12. </view>
  13. </block>
  14. </view>
  15. </scroll-view>
  16. <view class="bottom_btn">
  17. <text class="reset_btn" :style="`background-color: ${themeColor25};`" @click="resetAction">重置</text>
  18. <text class="pop_btn" :style="`background-color: ${themeColor};`" @click="sureAction">确定</text>
  19. </view>
  20. </dm-pop-view>
  21. </template>
  22. <script>
  23. import dmPopView from './dmPopView.vue';
  24. let app = getApp()
  25. export default {
  26. props: {
  27. screenValue: {
  28. type: [String, Number],
  29. default: 0
  30. },
  31. houseId: {
  32. type: [String, Number],
  33. default: ''
  34. },
  35. isSingleProject: {
  36. type: Boolean,
  37. default: false
  38. },
  39. isBrand: Boolean,
  40. defaultParameter: Object
  41. },
  42. data() {
  43. return {
  44. themeColor: null,
  45. fuzhuColor: null,
  46. themeColor50: null,
  47. themeColor25: null,
  48. fuzhuColor50: null,
  49. dataList: [],
  50. brandId: ''
  51. }
  52. },
  53. mounted() {
  54. this.themeColor = app.globalData.themeColor
  55. this.themeColor50 = app.globalData.themeColor50
  56. this.themeColor25 = app.globalData.themeColor25
  57. this.fuzhuColor = app.globalData.fuzhuColor
  58. this.fuzhuColor50 = app.globalData.fuzhuColor50
  59. let that = this;
  60. uni.getStorage({
  61. //获得保存在本地的用户信息
  62. key: 'userInfo',
  63. success: res => {
  64. if (res.data) {
  65. //有数据,已登录
  66. that.brandId = res.data.brandId;
  67. that.reloadDatahandle()
  68. }
  69. }
  70. });
  71. },
  72. methods: {
  73. async dataHandle() {
  74. if (!this.isSingleProject) {
  75. return
  76. }
  77. var houseIds = []
  78. if (this.houseId != '' && this.houseId != null) {
  79. houseIds = [this.houseId]
  80. }
  81. var self = this
  82. let res = await this.$myRequest({
  83. url: '/elab-marketing-user/activity_ticket_record/get_ticket_activity',
  84. data: {
  85. brandId: self.brandId,
  86. isBrand: self.isBrand,
  87. dateType: self.defaultParameter.dateType,
  88. maxDate: self.defaultParameter.endDate,
  89. minDate: self.defaultParameter.startDate,
  90. houseIds: houseIds,
  91. type: self.screenValue + 1
  92. }
  93. })
  94. if (res.data.success) {
  95. var tempList = [{
  96. title: '全部',
  97. isSelect: true,
  98. id: 0
  99. }]
  100. res.data.list.forEach((item, idx) => {
  101. var data = {
  102. title: item.activityName,
  103. isSelect: false,
  104. id: item.activityId
  105. }
  106. tempList.push(data)
  107. })
  108. this.dataList[3].subList = tempList
  109. this.dataList.forEach((item, idx) => {
  110. item.subList.forEach((item1, idx1) => {
  111. if (item1.hasOwnProperty('idx')) {
  112. item1.idx = idx1
  113. } else {
  114. item1['idx'] = idx1
  115. }
  116. })
  117. })
  118. }
  119. },
  120. async getActiveTypeDatahandle() {
  121. if (!this.isSingleProject) {
  122. return
  123. }
  124. var houseIds = []
  125. if (this.houseId != '' && this.houseId != null) {
  126. houseIds = [this.houseId]
  127. }
  128. var self = this
  129. let res = await this.$myRequest({
  130. url: '/elab-marketing-user/activity_ticket_record/get_ticket_activity_type',
  131. data: {
  132. brandId: self.brandId,
  133. isBrand: self.isBrand,
  134. dateType: self.defaultParameter.dateType,
  135. maxDate: self.defaultParameter.endDate,
  136. minDate: self.defaultParameter.startDate,
  137. houseIds: houseIds,
  138. type: self.screenValue + 1
  139. }
  140. })
  141. if (res.data.success) {
  142. var tempList = [{
  143. title: '全部',
  144. isSelect: true,
  145. id: 0
  146. }]
  147. res.data.list.forEach((item, idx) => {
  148. var data = {
  149. title: item.activityTypeName,
  150. isSelect: false,
  151. id: item.activityType
  152. }
  153. tempList.push(data)
  154. })
  155. this.dataList[2].subList = tempList
  156. this.dataList.forEach((item, idx) => {
  157. item.subList.forEach((item1, idx1) => {
  158. if (item1.hasOwnProperty('idx')) {
  159. item1.idx = idx1
  160. } else {
  161. item1['idx'] = idx1
  162. }
  163. })
  164. })
  165. }
  166. },
  167. show() {
  168. this.$refs.popView.show()
  169. },
  170. reloadDataList() {
  171. this.dataList = [{
  172. title: '排序',
  173. subList: [{
  174. title: '获券时间倒序',
  175. isSelect: true,
  176. id: 0
  177. },
  178. {
  179. title: '获券时间正序',
  180. isSelect: false,
  181. id: 1
  182. }
  183. ]
  184. },
  185. {
  186. title: '奖券状态',
  187. subList: [{
  188. title: '全部',
  189. isSelect: true,
  190. id: 0
  191. },
  192. {
  193. title: '可使用',
  194. isSelect: false,
  195. id: 1
  196. },
  197. {
  198. title: '已使用',
  199. isSelect: false,
  200. id: 2
  201. },
  202. {
  203. title: '已过期',
  204. isSelect: false,
  205. id: 3
  206. }
  207. ]
  208. },
  209. {
  210. title: '活动类型',
  211. subList: []
  212. },
  213. {
  214. title: '活动名称',
  215. subList: []
  216. }
  217. ]
  218. this.dataList.forEach((item, idx) => {
  219. item.subList.forEach((item1, idx1) => {
  220. if (item1.hasOwnProperty('idx')) {
  221. item1.idx = idx1
  222. } else {
  223. item1['idx'] = idx1
  224. }
  225. })
  226. })
  227. },
  228. selectAction(e, index) {
  229. this.dataList.forEach((item, idx) => {
  230. if (index == idx) {
  231. if (index > 1) {
  232. var isHave = false
  233. if (e.id != 0) {
  234. item.subList.forEach((item1, idx1) => {
  235. if (item1.idx == 0) {
  236. item1.isSelect = false
  237. }
  238. if (item1.idx == e.idx) {
  239. item1.isSelect = !item1.isSelect
  240. }
  241. if (item1.isSelect) {
  242. isHave = true
  243. }
  244. })
  245. if (!isHave) {
  246. item.subList[0].isSelect = true
  247. }
  248. } else {
  249. item.subList.forEach((item1, idx1) => {
  250. item1.isSelect = false
  251. if (item1.idx == 0) {
  252. item1.isSelect = true
  253. }
  254. })
  255. }
  256. } else {
  257. item.subList.forEach((item1, idx1) => {
  258. item1.isSelect = item1.idx == e.idx ? true : false
  259. })
  260. }
  261. }
  262. })
  263. },
  264. sureAction() {
  265. this.$emit('selectScreenAction', this.dataList)
  266. this.$refs.popView.hide()
  267. },
  268. resetAction() {
  269. this.dataList.forEach((item, idx) => {
  270. item.subList.forEach((item1, idx1) => {
  271. item1.isSelect = idx1 == 0 ? true: false
  272. })
  273. })
  274. this.$emit('selectScreenAction', this.dataList)
  275. this.$refs.popView.hide()
  276. },
  277. reloadDatahandle() {
  278. this.reloadDataList()
  279. this.dataHandle()
  280. this.getActiveTypeDatahandle()
  281. // var self = this
  282. // Promise.all([
  283. // self.dataHandle(),
  284. // self.getActiveTypeDatahandle(),
  285. // ]).then(res => {
  286. // if (res && res.length == 2) {
  287. // self.reloadDataList()
  288. // }
  289. // })
  290. }
  291. },
  292. components: {
  293. dmPopView
  294. },
  295. watch: {
  296. screenValue: {
  297. handler(e) {
  298. this.reloadDatahandle()
  299. },
  300. immediate: true
  301. },
  302. houseId: {
  303. handler(e) {
  304. this.reloadDatahandle()
  305. },
  306. immediate: true
  307. },
  308. isSingleProject: {
  309. handler(e) {
  310. if (e) {
  311. this.reloadDatahandle()
  312. }
  313. },
  314. immediate: true
  315. },
  316. defaultParameter: {
  317. handler(e) {
  318. this.reloadDatahandle()
  319. },
  320. deep: true,
  321. immediate: true
  322. }
  323. }
  324. }
  325. </script>
  326. <style scoped lang="scss">
  327. .screen_container {
  328. position: relative;
  329. margin-bottom: 190rpx;
  330. width: 750rpx;
  331. max-height: 1000rpx;
  332. .screen_item_title {
  333. margin-left: 30rpx;
  334. margin-top: 54rpx;
  335. line-height: 44rpx;
  336. font-size: 32rpx;
  337. font-family: Verdana, Verdana-Bold;
  338. font-weight: 700;
  339. text-align: left;
  340. color: #454545;
  341. }
  342. .level_tag_view {
  343. margin-left: 30rpx;
  344. margin-top: 0rpx;
  345. display: flex;
  346. flex-wrap: wrap;
  347. align-content: center;
  348. align-items: center;
  349. .level_tag {
  350. padding: 0 26rpx;
  351. box-sizing: border-box;
  352. margin-right: 16rpx;
  353. min-width: 220rpx;
  354. height: 72rpx;
  355. border-radius: 12rpx;
  356. margin-top: 20rpx;
  357. display: flex;
  358. flex-direction: column;
  359. justify-content: center;
  360. align-items: center;
  361. .level_tag_title {
  362. font-size: 28rpx;
  363. font-family: Verdana, Verdana-Regular;
  364. font-weight: 400;
  365. text-align: center;
  366. }
  367. .level_tag_subTitle {
  368. margin-top: -5rpx;
  369. font-size: 20rpx;
  370. font-family: Verdana, Verdana-Regular;
  371. font-weight: 400;
  372. text-align: center;
  373. }
  374. }
  375. }
  376. }
  377. // .bottom_btn {
  378. // display: flex;
  379. // justify-content: center;
  380. // position: fixed;
  381. // width: 100%;
  382. // left: 0;
  383. // bottom: 60rpx;
  384. // .text {
  385. // width: 260rpx;
  386. // height: 84rpx;
  387. // border-radius: 42rpx;
  388. // line-height: 84rpx;
  389. // font-size: 32rpx;
  390. // font-family: Verdana, Verdana-Regular;
  391. // font-weight: 400;
  392. // text-align: center;
  393. // color: #ffffff;
  394. // }
  395. // }
  396. .bottom_btn {
  397. display: flex;
  398. justify-content: center;
  399. position: fixed;
  400. width: 100%;
  401. left: 0;
  402. bottom: 60rpx;
  403. .reset_btn {
  404. width: 156rpx;
  405. height: 80rpx;
  406. border-radius: 40rpx;
  407. font-size: 28rpx;
  408. font-family: Verdana, Verdana-Bold;
  409. font-weight: 700;
  410. text-align: center;
  411. line-height: 80rpx;
  412. color: #666666;
  413. }
  414. .pop_btn {
  415. margin-left: 30rpx;
  416. width: 444rpx;
  417. height: 80rpx;
  418. border-radius: 40rpx;
  419. font-size: 28rpx;
  420. font-family: Verdana, Verdana-Bold;
  421. font-weight: 700;
  422. text-align: center;
  423. line-height: 80rpx;
  424. color: #ffffff;
  425. }
  426. }
  427. </style>