activitylist.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <view :class="[AppTheme]" class="all_box">
  3. <!-- #ifdef APP-PLUS -->
  4. <u-sticky offset-top="0" style="z-index: 10;">
  5. <!-- #endif -->
  6. <!-- #ifdef H5 -->
  7. <u-sticky offset-top="-44" style="z-index: 10;">
  8. <!-- #endif -->
  9. <view class="navbar">
  10. <u-tabs :current='tabscurrent' :list="titlelist" @click="tabsChange" :activeStyle="{
  11. color: primary,
  12. transform: 'scale(1.05)'
  13. }" :inactiveStyle="{
  14. color: '#606266',
  15. transform: 'scale(1)'
  16. }" lineWidth="40" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;" :lineColor="primary">
  17. </u-tabs>
  18. </view>
  19. </u-sticky>
  20. <swiper :current='swipercurrent' @change='swiperchange' class="swiper-box">
  21. <swiper-item class="swiper_item" v-for="(item, index) in titlelist" :key="index">
  22. <view class="list-scroll-content" @scrolltolower='scrolltolower' scroll-y>
  23. <view @click="godetile(item2.id,item2.status)" class="activity_item"
  24. v-for="(item2, index2) in couponlist" :key="index2">
  25. <view class="coupon_item_title">
  26. <u-icon name="chrome-circle-fill" :color="primary" size="42"></u-icon>
  27. <text>{{ item2.activity_title }}</text>
  28. </view>
  29. <view class="activity_item_top"
  30. :style="{ backgroundImage: 'url(' + item2.activity_img + ')' }">
  31. <view v-if="item2.isend==0" style=" opacity:0.6;width: 100%;height: 420rpx;display: flex;justify-content: center;align-items: center; background-color: black;">
  32. <image style="width: 220rpx;height: 220rpx;" :src="settingFile.root_img+'/static/app/end.png?t=152425'"></image>
  33. </view>
  34. <view class="activity_time">{{ retushorttime(item2.end_time) }}</view>
  35. <view class="registration_deadline" v-if="item2.status === 0">
  36. <u-empty text="报名截止" icon-color="#fff" color="#fff" mode="favor" icon-size="85">
  37. </u-empty>
  38. </view>
  39. </view>
  40. <view class="activity_item_bottom">
  41. <view class="expiration_reminder">{{ item2.activity_title }}</view>
  42. <view class="activity_price">门票:
  43. <view class="activity_price_p1 text-primary">
  44. {{ item2.child_fares }}~{{ item2.adult_fares }}
  45. </view>
  46. </view>
  47. <view class="activity_id">{{ retushorttime(item2.start_time) }} ~
  48. {{ retushorttime(item2.end_time) }}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </swiper-item>
  54. </swiper>
  55. <admyself :opshow="true"></admyself>
  56. <view style="height: 20rpx;"></view>
  57. <!-- 分享 -->
  58. <sharebox ref="sbox" v-if="sharedata" :data="sharedata"></sharebox>
  59. </view>
  60. </template>
  61. <script>
  62. import mallApi from '@/api/mall/index.js';
  63. import untiljs from '@/common/until.js';
  64. export default {
  65. data() {
  66. return {
  67. status: 'loadmore',
  68. tabscurrent: 0,
  69. swipercurrent: 0,
  70. p: 1,
  71. primary: this.$theme.primary,
  72. settingFile: getApp().globalData.siteinfo,
  73. titlelist: [{
  74. id: 0,
  75. name: '全部'
  76. }, ],
  77. ubseclist: [{
  78. name: '综合排序'
  79. },
  80. {
  81. name: '销量优先'
  82. },
  83. {
  84. name: '距离优先'
  85. },
  86. {
  87. name: '人气优先'
  88. },
  89. {
  90. name: '收藏最多'
  91. }
  92. ],
  93. couponlist: [],
  94. sharedata: null,
  95. };
  96. },
  97. onLoad(options) {
  98. let that = this
  99. that.$bindid.getbindid(options, that.$store);
  100. that.vueinit();
  101. that.$init_config(2, function(res) {
  102. if (that.$config) {
  103. that.sharedata = that.$config.sharedata
  104. }
  105. })
  106. },
  107. onShareAppMessage(res) {
  108. let that = this
  109. let data = {
  110. title: that.sharedata.title,
  111. imageUrl: that.sharedata.imageUrl,
  112. path: that.sharedata.path
  113. };
  114. return data;
  115. },
  116. onShareTimeline(res) {
  117. let that = this
  118. return {
  119. title: that.sharedata.title,
  120. imageUrl: that.sharedata.imageUrl,
  121. path: that.sharedata.path
  122. }
  123. },
  124. onPullDownRefresh() {
  125. this.vueinit();
  126. setTimeout(() => {
  127. uni.stopPullDownRefresh()
  128. }, 1500)
  129. },
  130. onReachBottom() {
  131. console.log("上拉加载")
  132. this.p++
  133. let that = this
  134. let data = {
  135. cid: that.tabscurrent,
  136. p: that.p
  137. }
  138. that.status = 'loading'
  139. mallApi.getofinlist(data).then(res => {
  140. if (res.status == 1) {
  141. res.data.forEach(ele => {
  142. that.couponlist.push(ele)
  143. })
  144. if (that.couponlist.length == 10) {
  145. that.status = 'loadmore'
  146. } else {
  147. that.status = 'nomore'
  148. }
  149. } else {
  150. that.status = 'nomore'
  151. that.p--
  152. }
  153. });
  154. },
  155. methods: {
  156. scrolltolower() { //上拉加载
  157. // console.log("上拉加载")
  158. // this.p++
  159. // let that = this
  160. // let data = {
  161. // cid: that.tabscurrent,
  162. // p: that.p
  163. // }
  164. // that.status = 'loading'
  165. // mallApi.getofinlist(data).then(res => {
  166. // if (res.status == 1) {
  167. // console.log(res, "resres");
  168. // res.data.forEach(ele => {
  169. // that.couponlist.push(ele)
  170. // })
  171. // if (that.couponlist.length == 10) {
  172. // that.status = 'loadmore'
  173. // } else {
  174. // that.status = 'nomore'
  175. // }
  176. // } else {
  177. // that.status = 'nomore'
  178. // that.p--
  179. // }
  180. // });
  181. },
  182. //跳转
  183. godetile(id, status) {
  184. if (status === 0) {
  185. uni.showToast({
  186. title: "活动已结束",
  187. icon: 'none'
  188. })
  189. } else {
  190. uni.navigateTo({
  191. url: "/pagesB/pages/activitydetails/activitydetails?id=" + id
  192. })
  193. }
  194. },
  195. //返回指定格式时间
  196. retushorttime(time) {
  197. let date = new Date(time);
  198. return untiljs.formatDate(date, 'yyyy.MM.dd');
  199. },
  200. vueinit() {
  201. let that = this;
  202. mallApi.getofflineindex().then(res => {
  203. if (res.status == 1) {
  204. that.titlelist = res.data
  205. } else {
  206. uni.showToast({
  207. title: res.msg,
  208. icon: "none"
  209. })
  210. }
  211. });
  212. mallApi.getofinlist().then(res => {
  213. if (res.status == 1) {
  214. this.couponlist = []
  215. res.data.forEach(ele => {
  216. that.couponlist.push(ele)
  217. })
  218. if (that.couponlist.length == 10) {
  219. that.status = 'loadmore'
  220. } else {
  221. that.status = 'nomore'
  222. }
  223. } else {
  224. that.couponlist = res.data;
  225. that.status = 'nomore'
  226. }
  227. });
  228. },
  229. getcouponlist(id, p) {
  230. mallApi.getofinlist({
  231. cid: id,
  232. p: p
  233. }).then(res => {
  234. if (res.status == 1) {
  235. this.couponlist = res.data;
  236. } else {
  237. this.couponlist = res.data;
  238. }
  239. });
  240. },
  241. // tabs通知swiper切换并更改数据
  242. tabsChange(item) {
  243. console.log(item, 'item')
  244. this.tabscurrent = item.index
  245. this.swipercurrent = item.index
  246. this.couponlist = []
  247. this.getcouponlist(item.id, 1)
  248. },
  249. swiperchange(e) {
  250. this.swipercurrent = e.detail.current
  251. this.tabscurrent = e.detail.current
  252. this.couponlist = []
  253. this.getcouponlist(e.detail.current, 1)
  254. }
  255. }
  256. };
  257. </script>
  258. <style lang="scss" scoped>
  259. .all_box {
  260. .navbar {
  261. background-color: #ffffff;
  262. z-index: 10;
  263. }
  264. .swiper-box {
  265. min-height: calc(100vh - 88rpx);
  266. .swiper_item {
  267. .list-scroll-content {
  268. height: 101%;
  269. overflow-y: auto;
  270. .activity_item {
  271. margin: 20rpx;
  272. z-index: 10;
  273. box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.08);
  274. border-radius: 10rpx;
  275. padding: 15rpx;
  276. background-color: #ffffff;
  277. .coupon_item_title {
  278. display: flex;
  279. justify-content: flex-start;
  280. align-items: center;
  281. font-size: 30rpx;
  282. color: #000;
  283. padding: 15rpx 0;
  284. u-icon {
  285. margin-right: 15rpx;
  286. }
  287. }
  288. .activity_item_top {
  289. position: relative;
  290. background-size: cover;
  291. width: 100%;
  292. height: 420rpx;
  293. border-radius: 7.5rpx;
  294. .registration_deadline {
  295. position: absolute;
  296. left: 0;
  297. top: 0;
  298. width: 100%;
  299. height: 100%;
  300. background-color: rgba(0, 0, 0, 0.55);
  301. border-radius: 7.5rpx;
  302. z-index: 8;
  303. }
  304. .activity_time {
  305. position: absolute;
  306. right: 0;
  307. top: 25rpx;
  308. background-color: rgba(0, 0, 0, 0.4);
  309. z-index: 7;
  310. padding: 10rpx 25rpx;
  311. color: #ffffff;
  312. border-radius: 15rpx 0 0 15rpx;
  313. font-size: 26rpx;
  314. letter-spacing: 2.5rpx;
  315. }
  316. }
  317. .activity_item_bottom {
  318. width: 100%;
  319. background-color: #ffffff;
  320. border-radius: 0 0 15rpx 15rpx;
  321. padding: 20rpx 0;
  322. .expiration_reminder {
  323. color: #333;
  324. font-size: 30rpx;
  325. }
  326. .activity_price {
  327. font-size: 24rpx;
  328. color: #999;
  329. display: flex;
  330. justify-content: flex-start;
  331. align-items: center;
  332. margin: 20rpx 0;
  333. .activity_price_p1 {
  334. font-size: 26rpx;
  335. font-weight: 700;
  336. }
  337. }
  338. .activity_id {
  339. font-size: 24rpx;
  340. color: #999;
  341. }
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }
  348. </style>