index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div>
  3. <view class='flash-sale'>
  4. <view class='header'>
  5. <img mode="widthFix" class="presellBg" src="../static/images/presell_bg.png" alt="">
  6. </view>
  7. <view class="main_count">
  8. <view class="presellList acea-row row-between-wrapper">
  9. <view class='timeList'>
  10. <block v-for="(item,index) in timeList" :key='index'>
  11. <view @tap='settimeList(item,index)' class='item' :class="active == index?'on':''">
  12. <view class='time'><span>{{item}}</span></view>
  13. </view>
  14. </block>
  15. </view>
  16. </view>
  17. <view class='list'>
  18. <block v-for="(item,index) in presellList" :key='index'>
  19. <view class='item acea-row row-between-wrapper' @tap='goDetails(item)'>
  20. <view class='pictrue'>
  21. <image :src='item.product.image'></image>
  22. </view>
  23. <view class='text acea-row row-column-around'>
  24. <view class='name line1'>{{item.store_name}}</view>
  25. <view class='booking'>
  26. <text v-if="item.presell_type != 0 && active != 0" class="count" style="color: #999;">已预定{{item.seles ? item.seles : 0}}{{item.product.unit_name}}</text>
  27. <text v-else style="color: #999; font-size: 24rpx;">暂未开始</text>
  28. </view>
  29. <view v-if="item.coupon" class='coupon acea-row row-between-wrapper' style="margin-top: 14rpx;">
  30. <view class='hide line1 acea-row'>
  31. <view class='activity'>满{{item.coupon.use_min_price}}减{{item.coupon.coupon_price}}</view>
  32. </view>
  33. </view>
  34. <view class="progress">
  35. <view class='presell_price'>
  36. <text class="presell_text">预售价</text>
  37. <text class="price">¥ <text>{{ item.price }}</text></text>
  38. </view>
  39. <view v-if="active != 0" class='order_btn'>{{ active === 1 ? '立即预定' : '已结束' }}</view>
  40. <view v-else class="unStartBtn">
  41. <text>开售时间</text>
  42. <view>{{ new Date(item.start_time.replace(/-/g,"/")).getMonth()+1 }}月
  43. {{ new Date(item.start_time.replace(/-/g,"/")).getDate() }}日
  44. {{ new Date(item.start_time.replace(/-/g,"/")).getHours()<10?'0'+
  45. new Date(item.start_time.replace(/-/g,"/")).getHours():new Date(item.start_time.replace(/-/g,"/")).getHours() || '00'}}:
  46. {{ new Date(item.start_time.replace(/-/g,"/")).getMinutes()<10?"0" + new Date(item.start_time.replace(/-/g,"/")).getMinutes():
  47. new Date(item.start_time.replace(/-/g,"/")).getMinutes() || '00'}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </block>
  53. </view>
  54. </view>
  55. </view>
  56. <home></home>
  57. </div>
  58. </template>
  59. <script>
  60. import {
  61. getSeckillIndexTime,
  62. getPresellList
  63. } from '../../../api/activity.js';
  64. import home from '@/components/home/index.vue'
  65. export default {
  66. components: {
  67. home
  68. },
  69. data() {
  70. return {
  71. topImage: '',
  72. presellList: [],
  73. timeList: [
  74. '未开始',
  75. '正在进行',
  76. '已结束'
  77. ],
  78. active: 1,
  79. type: 0,
  80. scrollLeft: 0,
  81. interval: 0,
  82. status: 1,
  83. page: 1,
  84. limit: 8,
  85. loading: false,
  86. loadend: false,
  87. pageloading: false,
  88. }
  89. },
  90. /**
  91. * 用户点击右上角分享
  92. */
  93. // #ifdef MP
  94. onShareAppMessage: function() {
  95. wx.showShareMenu({
  96. withShareTicket: true,
  97. menus: ['shareAppMessage', 'shareTimeline']
  98. })
  99. return {
  100. title: '预售活动',
  101. path: 'pages/activity/presell/index',
  102. }
  103. },
  104. onShareTimeline: function() {
  105. return {
  106. title: '预售活动',
  107. query: {
  108. key: ''
  109. },
  110. imageUrl: ''
  111. }
  112. },
  113. // #endif
  114. onLoad() {
  115. this.getPresellProductList();
  116. },
  117. methods: {
  118. getPresellProductList: function() {
  119. var that = this;
  120. var data = {
  121. page: that.page,
  122. limit: that.limit,
  123. type: that.active
  124. };
  125. if (that.loadend) return;
  126. if (that.pageloading) return;
  127. this.pageloading = true
  128. getPresellList(data).then(res => {
  129. console.log(res);
  130. var presellList = res.data.list;
  131. var loadend = presellList.length < that.limit;
  132. that.page++;
  133. that.presellList = that.presellList.concat(presellList),
  134. that.page = that.page;
  135. that.pageloading = false;
  136. that.loadend = loadend;
  137. }).catch(err => {
  138. that.pageloading = false
  139. });
  140. },
  141. settimeList: function(item, index) {
  142. var that = this;
  143. that.active = index
  144. that.type = that.active;
  145. that.loadend = false;
  146. that.page = 1;
  147. that.presellList = [];
  148. // wxh.time(e.currentTarget.dataset.stop, that);
  149. that.getPresellProductList();
  150. },
  151. goDetails(item) {
  152. uni.navigateTo({
  153. url: '/pages/activity/presell_details/index?id=' + item.product_presell_id
  154. })
  155. }
  156. },
  157. /**
  158. * 页面上拉触底事件的处理函数
  159. */
  160. onReachBottom: function() {
  161. this.getPresellProductList();
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page {
  167. background-color: #FF7F21;
  168. }
  169. .noCommodity{
  170. border-top: none;
  171. }
  172. .flash-sale .header {
  173. width: 100%;
  174. position: relative;
  175. }
  176. .flash-sale .main_count{
  177. position: relative;
  178. top: -150rpx;
  179. }
  180. .flash-sale .header .presellBg {
  181. width: 750rpx;
  182. }
  183. .flash-sale .presellList {
  184. padding: 0 20rpx;
  185. bottom: 0;
  186. margin: 0 30rpx;
  187. width: 690rpx;
  188. background: #fff;
  189. border-radius: 16rpx;
  190. line-height: 80rpx;
  191. height: 80rpx;
  192. }
  193. .flash-sale .presellList .priceTag {
  194. width: 75rpx;
  195. height: 70rpx;
  196. }
  197. .flash-sale .presellList .priceTag image {
  198. opacity: 1;
  199. }
  200. .flash-sale .presellList .priceTag image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. .flash-sale .timeList {
  205. display: flex;
  206. justify-content: center;
  207. align-items: center;
  208. margin: 0 auto;
  209. }
  210. .flash-sale .timeList .item {
  211. font-size: 20rpx;
  212. color: #666;
  213. text-align: center;
  214. box-sizing: border-box;
  215. width: 224rpx;
  216. }
  217. .flash-sale .timeList .item .time {
  218. font-size: 26rpx;
  219. color: #AAAAAA;
  220. }
  221. .flash-sale .timeList .item.on .time {
  222. color: #FD6523;
  223. font-weight: 600;
  224. span{
  225. position: relative;
  226. &::after{
  227. content: '';
  228. display: inline-block;
  229. width: 100%;
  230. height: 4rpx;
  231. background: #FD6523;
  232. position: absolute;
  233. left: 0;
  234. bottom: -4rpx;
  235. border-radius: 2rpx;
  236. }
  237. }
  238. }
  239. .activity {
  240. height: 56rpx;
  241. padding: 0 11px;
  242. color: #e93323;
  243. font-size: 22rpx;
  244. line-height: 50rpx;
  245. position: relative;
  246. background-image: url(~pages/activity/static/images/couponBg.png);
  247. background-size: 100%;
  248. background-repeat: no-repeat;
  249. }
  250. .flash-sale .list{
  251. margin-top: 24rpx;
  252. }
  253. .flash-sale .list .item {
  254. height: 278rpx;
  255. position: relative;
  256. width: 690rpx;
  257. margin: 0 auto 20rpx auto;
  258. background-color: #fff;
  259. border-radius: 20rpx;
  260. padding: 0 25rpx;
  261. }
  262. .flash-sale .list .item .pictrue {
  263. width: 240rpx;
  264. height: 240rpx;
  265. border-radius: 10rpx;
  266. }
  267. .flash-sale .list .item .pictrue image {
  268. width: 100%;
  269. height: 100%;
  270. border-radius: 10rpx;
  271. }
  272. .flash-sale .list .item .text {
  273. width: 380rpx;
  274. font-size: 30rpx;
  275. color: #333;
  276. }
  277. .flash-sale .list .item .text .name {
  278. width: 100%;
  279. color: #282828;
  280. font-weight: bold;
  281. font-size: 28rpx;
  282. }
  283. .flash-sale .list .item .text .booking {
  284. font-size: 30rpx;
  285. color: #E93323;
  286. }
  287. .flash-sale .list .item .text .booking .count {
  288. font-size: 24rpx;
  289. color: #E93323;
  290. }
  291. .flash-sale .list .item .text .limit {
  292. font-size: 22rpx;
  293. color: #999;
  294. margin-bottom: 5rpx;
  295. }
  296. .flash-sale .list .item .text .limit .limitPrice {
  297. margin-left: 10rpx;
  298. }
  299. .flash-sale .list .item .text .progress {
  300. width: 392rpx;
  301. height: 74rpx;
  302. background-image: url(~pages/activity/static/images/priceBg.png);
  303. background-size: 100%;
  304. margin-top: 16rpx;
  305. .presell_price{
  306. float: left;
  307. width: 50%;
  308. text-align: center;
  309. line-height: 15px;
  310. padding: 8rpx 0;
  311. .presell_text{
  312. display: block;
  313. color: #E93323;
  314. font-size: 20rpx;
  315. }
  316. .price{
  317. font-size: 26rpx;
  318. color: #E93323;
  319. text{
  320. font-weight: bold;
  321. }
  322. }
  323. }
  324. .order_btn{
  325. float: left;
  326. width: 50%;
  327. text-align: center;
  328. color: #FFFFFF;
  329. font-size: 26rpx;
  330. line-height: 76rpx;
  331. }
  332. .unStartBtn{
  333. float: left;
  334. width: 50%;
  335. text-align: center;
  336. color: #FFFFFF;
  337. font-size: 20rpx;
  338. padding: 8rpx 0;
  339. text{
  340. font-size: 22rpx;
  341. }
  342. }
  343. }
  344. </style>