index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view>
  3. <view class="w-full bg-top h-518 relative" :style="{backgroundImage:headerBg}">
  4. <view class="fixed-lt w-full z-20" :style="{'padding-top': sysHeight + 'px','background': pageScrollStatus ? '#e93323' : 'transparent'}">
  5. <view class="w-full px-20 pl-20 h-80 flex-between-center">
  6. <text class="iconfont icon-ic_leftarrow fs-40 text--w111-fff" @click="goBack"></text>
  7. <text class="fs-34 fw-500 text--w111-fff">预售</text>
  8. <text></text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="px-20">
  13. <view class="bg--w111-fff rd-16rpx relative " style="top: -24rpx;">
  14. <view class="w-full h-112 bg-primary-light nav-bg" :style="{backgroundImage:navBg}">
  15. <view class="w-full flex-between-center pl-16 pr-16">
  16. <text class="fs-26 text--w111-666 lh-36rpx pt-22 pb-22 pl-56 pr-56"
  17. v-for="(item, index) in timeList" :key="index"
  18. :class="active == index? 'active':''"
  19. @tap="settimeList(item.key)">{{item.name}}</text>
  20. </view>
  21. </view>
  22. <view class="w-full pl-20 pr-20 pb-40" v-if="presellList.length">
  23. <view class="w-full flex justify-between pro-item"
  24. v-for="(item,index) in presellList" :key="index"
  25. @tap="goDetails(item)">
  26. <easy-loadimage
  27. :image-src="item.image"
  28. width="240rpx"
  29. height="240rpx"
  30. borderRadius="16rpx"></easy-loadimage>
  31. <view class="flex-1 flex-col justify-between pl-20">
  32. <view class="w-full">
  33. <view class="w-full fs-28 h-80 lh-40rpx line2">{{item.store_name}}</view>
  34. <view class="w-full flex items-end flex-wrap mt-16" v-if="item.store_label.length">
  35. <BaseTag
  36. :text="label.label_name"
  37. :color="label.color"
  38. :background="label.bg_color"
  39. :borderColor="label.border_color"
  40. :circle="label.border_color ? true : false"
  41. :imgSrc="label.icon"
  42. v-for="(label, idx) in item.store_label" :key="idx"></BaseTag>
  43. </view>
  44. </view>
  45. <view class="flex w-full h-68 rd-8rpx btn-bg relative" :class="active == 2 ? 'opacity' : ''">
  46. <view class="flex-y-center pl-20 fs-22 btn-left ">
  47. <baseMoney
  48. :money="item.price"
  49. symbolSize="26"
  50. integerSize="40"
  51. decimalSize="26"
  52. weight
  53. preFix="预售:"
  54. preFixSize="22"
  55. textColor="#e93323"
  56. color="#e93323"></baseMoney>
  57. </view>
  58. <image src="../static/yushou1.png" class="btn-right" v-if="active == 0"></image>
  59. <image src="../static/yushou2.png" class="btn-right" v-else-if="active == 1"></image>
  60. <image src="../static/yushou3.png" class="btn-right" v-else="active == 2"></image>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class='px-20' v-else>
  66. <emptyPage title="暂无预售商品,去看看其他商品吧~" src="/statics/images/noActivity.gif"></emptyPage>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  74. import { getAdvancellList } from '@/api/activity';
  75. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  76. import {HTTP_REQUEST_URL} from '@/config/app';
  77. import emptyPage from '@/components/emptyPage.vue';
  78. export default {
  79. name: "presell",
  80. filters: {
  81. dateFormat: function(value) {
  82. return dayjs(value * 1000).format('MM/DD HH:mm');
  83. },
  84. },
  85. components:{ emptyPage },
  86. data() {
  87. return {
  88. sysHeight:sysHeight,
  89. presellList: [],
  90. timeList: [
  91. {name: '未开始',key: 0},
  92. {name: '正在进行',key: 1},
  93. {name: '已结束',key: 2},
  94. ],
  95. active: 1,
  96. page: 1,
  97. limit: 8,
  98. loading: false,
  99. loadend: false,
  100. loadTitle: '加载更多',
  101. picUrl: '', //头部图片
  102. imgHost:HTTP_REQUEST_URL,
  103. pageScrollStatus:false,
  104. }
  105. },
  106. computed:{
  107. headerBg(){
  108. return 'url('+this.imgHost+'/statics/images/product/product_presale_header.png'+')'
  109. },
  110. navBg(){
  111. return 'url('+this.imgHost+'/statics/images/product/presell-bg-' + this.active +'.png'+')'
  112. }
  113. },
  114. onPageScroll(object) {
  115. if (object.scrollTop > 130) {
  116. this.pageScrollStatus = true;
  117. } else if (object.scrollTop < 130) {
  118. this.pageScrollStatus = false;
  119. }
  120. uni.$emit('scroll');
  121. },
  122. onLoad() {
  123. this.getPresellProductList();
  124. },
  125. onShow(){
  126. uni.removeStorageSync('form_type_cart');
  127. },
  128. methods: {
  129. getPresellProductList: function() {
  130. let that = this;
  131. let data = {
  132. page: that.page,
  133. limit: that.limit,
  134. time_type: that.active + 1
  135. };
  136. if (that.loading) return;
  137. if (that.loadend) return;
  138. that.loading = true;
  139. that.loadTitle = '';
  140. getAdvancellList(data).then(res => {
  141. let list = res.data.list;
  142. let loadend = list.length < that.limit;
  143. that.presellList = that.$util.SplitArray(list, that.presellList);
  144. that.$set(that, 'presellList', that.presellList);
  145. that.loadend = loadend;
  146. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  147. that.page = that.page + 1;
  148. that.loading = false;
  149. }).catch(err => {
  150. that.loading = false;
  151. that.loadTitle = '加载更多';
  152. });
  153. },
  154. settimeList(key) {
  155. let that = this;
  156. that.active = key;
  157. that.loadend = false;
  158. that.page = 1;
  159. that.presellList = [];
  160. that.getPresellProductList();
  161. },
  162. goDetails(item) {
  163. uni.navigateTo({
  164. url: `/pages/activity/goods_details/index?id=${item.id}&type=6`
  165. })
  166. },
  167. goBack(){
  168. uni.navigateBack()
  169. }
  170. },
  171. /**
  172. * 页面上拉触底事件的处理函数
  173. */
  174. onReachBottom: function() {
  175. this.getPresellProductList();
  176. }
  177. }
  178. </script>
  179. <style>
  180. page{
  181. background: linear-gradient(270deg, #6D4ADC 0%, #7033D7 98%);
  182. }
  183. </style>
  184. <style lang="scss">
  185. .bg-top{
  186. background-size: 100% 100%;
  187. background-repeat: no-repeat;
  188. }
  189. .bg-primary-light{
  190. background-color: rgba(109, 74, 220, 0.1);
  191. }
  192. .nav-bg{
  193. background-size: 100% 100%;
  194. background-repeat: no-repeat;
  195. }
  196. .active{
  197. font-size: 32rpx;
  198. font-weight: 500;
  199. line-height: 44rpx;
  200. color: #7033D7;
  201. }
  202. .btn-bg{
  203. background: rgba(233, 51, 35, 0.1);
  204. }
  205. .btn-left{
  206. flex: 1;
  207. border-radius: 8rpx 0 0 8rpx;
  208. }
  209. .btn-right{
  210. width: 180rpx;
  211. height: 68rpx;
  212. }
  213. .shandian{
  214. width: 42rpx;
  215. height: 68rpx;
  216. position: absolute;
  217. transform: scale(1.1);
  218. left: 56%;
  219. top: 1px;
  220. }
  221. .pro-item ~ .pro-item{
  222. margin-top: 32rpx;
  223. }
  224. .border-label {
  225. display: inline-flex;
  226. display: flex;
  227. align-items: center;
  228. flex-wrap: nowrap;
  229. height: 26rpx;
  230. padding: 0 6rpx;
  231. border: 1rpx solid #e93323;
  232. border-radius: 6rpx;
  233. font-size: 18rpx;
  234. color: #e93323;
  235. }
  236. /deep/ .empty-box{
  237. width: 100%;
  238. height: 280px;
  239. }
  240. .opacity{
  241. opacity: 0.5;
  242. }
  243. </style>