Activitylist.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="活动列表" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div flex-wrapper" @scrolltolower="loadMore" scroll-y="true">
  15. <view v-if="activityList" class="div bg_content">
  16. <view @click="goActivityDetail(item)" class="div brand_item" v-for="item in activityList" :key="item.activity_id">
  17. <view class="div bg_banner">
  18. <view class="div brand_other_mark">
  19. <view class="div other_mark_title">
  20. {{item.activity_title}}
  21. </view>
  22. <view class="div other_mark_info">
  23. <text class="span mark_info">查看更多</text>
  24. <view class="div wqvue-image mark_icon">
  25. <image mode="aspectFit" class="img" src="../../../static/image/home/activity-arrow.png" />
  26. </view>
  27. </view>
  28. </view>
  29. <view class="div timer">
  30. <count-down :styletype="1" :timetype="2" :timelimithour="0" :timesurplus="item.activity_enddate"></count-down>
  31. </view>
  32. <view class="div bg_banner_img">
  33. <view class="div wqvue-image banner_img_info">
  34. <image mode="aspectFit" class="img" :src="item.activity_banner_mobile_url" />
  35. </view>
  36. </view>
  37. </view>
  38. <view class="div sku_list_3" v-if="item.goods_list && item.goods_list.length">
  39. <view class="div li" v-for="goods in item.goods_list" :key="item.goods_id">
  40. <view class="div cover">
  41. <view class="div wqvue-image img" alt="">
  42. <image mode="aspectFit" class="img" :src="goods.goods_image_url" />
  43. </view>
  44. </view>
  45. <view class="div sg_goodslist_3_info">
  46. <view class="div main_line">
  47. <text class="span span">¥<text class="span em">{{parseFloat(goods.goods_price)}}</text></text>
  48. <text class="span span del" v-if="goods.goods_marketprice">¥{{parseFloat(goods.goods_marketprice)}}</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view v-else class="div empty-data">暂时没有商品</view>
  54. </view>
  55. </view>
  56. <empty-record v-if='activityList && !activityList.length'></empty-record>
  57. </scroll-view>
  58. </view>
  59. </view></home-base>
  60. </template>
  61. <script>
  62. import {getFontSize} from '@/util/common'
  63. import TitleHeader from '../../TitleHeader'
  64. import { urlencode } from '@/util/common'
  65. import HomeBase from '../HomeBase'
  66. import CountDown from '../../CountDown'
  67. import EmptyRecord from '../../EmptyRecord'
  68. import { getActivityList } from '../../../api/homeActivity'
  69. export default {
  70. name: 'ActivityList',
  71. components:{
  72. TitleHeader,
  73. HomeBase,
  74. CountDown,
  75. EmptyRecord
  76. },
  77. mounted(){
  78. // #ifdef MP-WEIXIN
  79. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  80. // #endif
  81. },
  82. computed:{
  83. fontSize(){
  84. return getFontSize()
  85. },
  86. },
  87. data(){
  88. return {
  89. navHeight: 0,
  90. activityList: false,
  91. params: { 'page': 0, 'per_page': 10 },
  92. loading: false, // 是否加载更多
  93. isMore: true // 是否有更多
  94. }
  95. },
  96. created () {
  97. this.loadMore()
  98. },
  99. methods:{
  100. goBack(){uni.navigateBack({delta:1})},
  101. loadMore () {
  102. if (this.loading) {
  103. return
  104. }
  105. this.loading = true
  106. this.params.page = ++this.params.page
  107. if (this.isMore) {
  108. this.getActivityList(true)
  109. }
  110. },
  111. getActivityList () {
  112. uni.showLoading({ title: '加载中' })
  113. getActivityList(this.params).then(res => {
  114. uni.hideLoading()
  115. if (res.result.hasmore) {
  116. this.isMore = true
  117. } else {
  118. this.isMore = false
  119. }
  120. if (this.activityList) {
  121. this.activityList = this.activityList.concat(res.result.activity_list)
  122. } else {
  123. this.activityList = res.result.activity_list
  124. }
  125. this.loading = false
  126. }).catch(error => {
  127. uni.hideLoading()
  128. uni.showToast({icon:'none',title: error.message})
  129. this.loading = false
  130. })
  131. },
  132. goActivityDetail (item) {
  133. uni.navigateTo({ url: '/pages/home/activity/Activitydetail'+'?'+urlencode( { 'activity_id': item.activity_id } )})
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped lang="scss">
  139. .scroll-view-wrapper{display: flex;flex-direction: column;}
  140. .scroll-view{flex:1}
  141. .bg_content .bg_banner_img {
  142. width: 100%;
  143. height: 5.25rem;
  144. box-sizing: border-box;
  145. overflow: hidden;
  146. display: block
  147. }
  148. .bg_content .bg_banner_img .banner_img_info,.bg_content .bg_banner_img .banner_img_info .img {
  149. width: 100%;
  150. height: 5.25rem;
  151. border-radius: .4rem .4rem 0 0;
  152. box-sizing: border-box;
  153. display: block
  154. }
  155. .brand_item {
  156. position: relative;
  157. margin: .75rem;
  158. background: #fff;
  159. border-radius: .4rem;
  160. box-shadow: 0 0 1rem 0 rgba(0,0,0,.09)
  161. }
  162. .brand_item .brand_other_mark,.brand_item .desc {
  163. border-radius: .2rem;
  164. position: absolute;
  165. text-align: center
  166. }
  167. .brand_item .brand_other_mark {
  168. top: .5rem;
  169. left: .75rem;
  170. width: 8.2rem;
  171. height: 4.3rem;
  172. padding: .5rem;
  173. padding-top:1rem;
  174. box-sizing: border-box;
  175. background: hsla(0,0%,100%,.8);
  176. overflow: hidden;
  177. z-index: 1
  178. }
  179. .brand_item .brand_other_mark .other_mark_img {
  180. width: 2rem;
  181. height: 1rem;
  182. display: block;
  183. margin: 0 auto;
  184. border-radius: .1rem
  185. }
  186. .brand_item .brand_other_mark .other_mark_title {
  187. height: 1.4rem;
  188. line-height: 1.4rem;
  189. font-size:$h1;
  190. color: #000;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. white-space: nowrap;
  194. text-align: center
  195. }
  196. .brand_item .brand_other_mark .other_mark_info {
  197. display: inline-block;
  198. background: #333;
  199. border-radius: .2rem;
  200. height: .9rem;
  201. line-height: .9rem;
  202. box-sizing: border-box;
  203. padding: 0 .25rem;
  204. font-size: 0;
  205. }
  206. .brand_item .brand_other_mark .other_mark_info .mark_info {
  207. max-width: 6rem;
  208. font-size:$fontSize;
  209. color: #fff;
  210. display: inline-block;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. white-space: nowrap
  214. }
  215. .brand_item .brand_other_mark .other_mark_info .mark_icon {
  216. float: right;
  217. width: .5rem;
  218. height: .5rem;
  219. margin-left: .15rem;
  220. margin-top: .2rem
  221. }
  222. .brand_item .timer {
  223. position: absolute;
  224. width: 3.5rem;
  225. height: 1rem;
  226. padding: .1rem 0;
  227. line-height: 1.05rem;
  228. background: #333;
  229. box-shadow: 0 .15rem .45rem 0 rgba(51,51,51,.15);
  230. font-size:$fontSize;
  231. z-index: 2;
  232. right: 0;
  233. top: 0;
  234. color: #fff;
  235. display: -webkit-box;
  236. display: -webkit-flex;
  237. display: flex;
  238. -webkit-box-align: center;
  239. -webkit-align-items: center;
  240. align-items: center;
  241. -webkit-box-pack: center;
  242. -webkit-justify-content: center;
  243. justify-content: center;
  244. border-radius: 0 .4rem
  245. }
  246. .brand_item .timer_info {
  247. height: .95rem;
  248. line-height: .95rem;
  249. display: block;
  250. box-sizing: border-box;
  251. border-radius: .125rem;
  252. font-size:$fontSize;
  253. color: #fff;
  254. text-align: center
  255. }
  256. .brand_item .timer_info:first-child {
  257. text-align: center
  258. }
  259. .brand_item .timer_mark {
  260. font-size:$fontSize;
  261. display: block;
  262. padding: 0 .1rem;
  263. height: .95rem;
  264. line-height: .95rem
  265. }
  266. .sku_list_3 {
  267. display: -webkit-box;
  268. display: -webkit-flex;
  269. display: flex;
  270. -webkit-box-pack: justify;
  271. -webkit-justify-content: space-between;
  272. justify-content: space-between;
  273. padding: .5rem .75rem;
  274. font-size: 0
  275. }
  276. .sku_list_3 .li {
  277. display: inline-block;
  278. width: 4.95rem;
  279. font-size: 0
  280. }
  281. .sku_list_3 .li .cover,.sku_list_3 .li .img {
  282. width: 4.95rem;
  283. height: 4.95rem;
  284. border-radius: .2rem
  285. }
  286. .sku_list_3 .li .cover {
  287. background-repeat: no-repeat;
  288. background-position: 50%;
  289. background-size: cover
  290. }
  291. .sku_list_3 .li .hot {
  292. background: $primaryGradualColor;
  293. box-shadow: 0 .15rem .3rem $subColor;
  294. position: absolute;
  295. margin-left: .25rem;
  296. padding: 0 .3rem;
  297. width: 1.5rem;
  298. height: .8rem;
  299. line-height: .8rem;
  300. color: #fff;
  301. font-size:$fontSize;
  302. border-radius: .7rem .7rem 0
  303. }
  304. .sku_list_3 .main_line {
  305. padding: .5rem 0 0;
  306. color: #ec1d1d;
  307. text-align: center;
  308. overflow: hidden;
  309. font-size:$h6;
  310. display: -webkit-box;
  311. display: -webkit-flex;
  312. display: flex;
  313. -webkit-box-pack: center;
  314. -webkit-justify-content: center;
  315. justify-content: center;
  316. -webkit-box-align: baseline;
  317. -webkit-align-items: baseline;
  318. align-items: baseline;
  319. -webkit-flex-wrap: wrap;
  320. flex-wrap: wrap;
  321. }
  322. .sku_list_3 .main_line .fxprice_unit {
  323. letter-spacing: 0
  324. }
  325. .sku_list_3 .main_line .em {
  326. font-size:$h1
  327. }
  328. .sku_list_3 .main_line .normal {
  329. font-size:$fontSize;
  330. margin-right: .25rem
  331. }
  332. .sku_list_3 .main_line .del {
  333. color: #999;
  334. text-decoration: line-through
  335. }
  336. .sku_list_3 .width-fxprice {
  337. -webkit-box-align: center;
  338. -webkit-align-items: center;
  339. align-items: center
  340. }
  341. .sku_list_3 .sub_line {
  342. text-align: center;
  343. overflow: hidden;
  344. color: #999;
  345. text-decoration: line-through;
  346. font-size:$fontSize;
  347. line-height: .9rem
  348. }
  349. .wqvue-image {
  350. display: inline-block;
  351. overflow: hidden;
  352. position: relative;
  353. }
  354. .wqvue-image .img {
  355. width: 100%;
  356. height: 100%;
  357. position: absolute;
  358. left: 50%;
  359. top: 50%;
  360. transform: translate3d(-50%,-50%,0);
  361. }
  362. .empty-data{font-size:$subFontSize;text-align: center;padding:1.6rem 0;color:#999;height: 4.2055rem;}
  363. </style>