index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <view class="container" :style="viewColor">
  3. <view class='flash-sale'>
  4. <!-- #ifdef H5 -->
  5. <view v-if='!$wechat.isWeixin()' class="fixed-head">
  6. <view class="sys-head" :style="{height:statusBarHeight}"></view>
  7. <view class="tool-bar">
  8. <view class='iconfont icon-xiangzuo' @tap='goBack'></view>
  9. </view>
  10. </view>
  11. <!-- #endif -->
  12. <view class='header'>
  13. <image mode="widthFix" class="presellBg" :src="domain+'/static/diy/presell_title'+keyColor+'.png'" alt="">
  14. </view>
  15. <view class="main_count">
  16. <view class="presellList acea-row row-between-wrapper">
  17. <view class='timeList'>
  18. <block v-for="(item,index) in timeList" :key='index'>
  19. <view @tap='settimeList(item,index)' class='item' :class="active == index?'on':''">
  20. <view class='time'><text>{{item}}</text></view>
  21. </view>
  22. </block>
  23. </view>
  24. </view>
  25. <view class='list'>
  26. <block v-for="(item,index) in presellList" :key='index'>
  27. <view class='item acea-row row-between-wrapper' @tap='goDetails(item)'>
  28. <view class='pictrue'>
  29. <image :src='item.product.image'></image>
  30. </view>
  31. <view class='text acea-row row-column-around'>
  32. <view class='name line1'>{{item.store_name}}</view>
  33. <view class='booking'>
  34. <text v-if="item.presell_type != 0 && active != 0" class="count" style="color: #BFBFBF;">已预定{{item.seles ? item.seles : 0}}{{item.product.unit_name}}</text>
  35. <text v-else style="color: #999; font-size: 24rpx;">暂未开始</text>
  36. </view>
  37. <view v-if="item.coupon" class='coupon acea-row row-between-wrapper' style="margin-top: 14rpx;">
  38. <view class='hide line1 acea-row'>
  39. <view class='activity'>满{{item.coupon.use_min_price}}减{{item.coupon.coupon_price}}</view>
  40. </view>
  41. </view>
  42. <view class="progress" :style="'background-image:url('+domain+'/static/diy/priceBg'+keyColor+'.png'">
  43. <view class='presell_price'>
  44. <text class="presell_text">预售价</text>
  45. <text class="price">¥ <text>{{ item.price }}</text></text>
  46. </view>
  47. <view v-if="active != 0" class='order_btn'>{{ active === 1 ? '立即预定' : '已结束' }}</view>
  48. <view v-else class="unStartBtn">
  49. <text>开售时间</text>
  50. <view>{{ new Date(item.start_time.replace(/-/g,"/")).getMonth()+1 }}月
  51. {{ new Date(item.start_time.replace(/-/g,"/")).getDate() }}日
  52. {{ new Date(item.start_time.replace(/-/g,"/")).getHours()<10?'0'+
  53. new Date(item.start_time.replace(/-/g,"/")).getHours():new Date(item.start_time.replace(/-/g,"/")).getHours() || '00'}}:
  54. {{ new Date(item.start_time.replace(/-/g,"/")).getMinutes()<10?"0" + new Date(item.start_time.replace(/-/g,"/")).getMinutes():
  55. new Date(item.start_time.replace(/-/g,"/")).getMinutes() || '00'}}</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </block>
  61. </view>
  62. </view>
  63. </view>
  64. <home></home>
  65. <!-- #ifndef H5 -->
  66. <passwordPopup></passwordPopup>
  67. <!-- #endif -->
  68. </view>
  69. </template>
  70. <script>
  71. // +----------------------------------------------------------------------
  72. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  73. // +----------------------------------------------------------------------
  74. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  75. // +----------------------------------------------------------------------
  76. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  77. // +----------------------------------------------------------------------
  78. // | Author: CRMEB Team <admin@crmeb.com>
  79. // +----------------------------------------------------------------------
  80. import {
  81. getSeckillIndexTime,
  82. getPresellList
  83. } from '../../../api/activity.js';
  84. import home from '@/components/home/index.vue'
  85. // #ifndef H5
  86. import passwordPopup from '@/components/passwordPopup';
  87. // #endif
  88. import { configMap } from "@/utils";
  89. import { mapGetters } from "vuex";
  90. import { HTTP_REQUEST_URL } from '@/config/app';
  91. export default {
  92. computed: configMap({statusBarHeight:0},mapGetters(['viewColor','keyColor'])),
  93. components: {
  94. // #ifndef H5
  95. passwordPopup,
  96. // #endif
  97. home
  98. },
  99. data() {
  100. return {
  101. domain: HTTP_REQUEST_URL,
  102. topImage: '',
  103. presellList: [],
  104. timeList: [
  105. '未开始',
  106. '正在进行',
  107. '已结束'
  108. ],
  109. active: 1,
  110. type: 0,
  111. scrollLeft: 0,
  112. interval: 0,
  113. status: 1,
  114. page: 1,
  115. limit: 10,
  116. loading: false,
  117. loadend: false,
  118. pageloading: false,
  119. }
  120. },
  121. /**
  122. * 用户点击右上角分享
  123. */
  124. // #ifdef MP
  125. onShareAppMessage: function() {
  126. wx.showShareMenu({
  127. withShareTicket: true,
  128. menus: ['shareAppMessage', 'shareTimeline']
  129. })
  130. return {
  131. title: '预售活动',
  132. path: 'pages/activity/presell/index',
  133. }
  134. },
  135. onShareTimeline: function() {
  136. return {
  137. title: '预售活动',
  138. query: {
  139. key: ''
  140. },
  141. imageUrl: ''
  142. }
  143. },
  144. // #endif
  145. onLoad() {
  146. this.getPresellProductList();
  147. },
  148. methods: {
  149. goBack: function() {
  150. uni.navigateBack();
  151. },
  152. getPresellProductList: function() {
  153. var that = this;
  154. var data = {
  155. page: that.page,
  156. limit: that.limit,
  157. type: that.active
  158. };
  159. if (that.loadend) return;
  160. if (that.pageloading) return;
  161. this.pageloading = true
  162. getPresellList(data).then(res => {
  163. console.log(res);
  164. var presellList = res.data.list;
  165. var loadend = presellList.length < that.limit;
  166. that.page++;
  167. that.presellList = that.presellList.concat(presellList),
  168. uni.stopPullDownRefresh(); //结束下拉刷新
  169. that.pageloading = false;
  170. that.loadend = loadend;
  171. }).catch(err => {
  172. that.pageloading = false
  173. });
  174. },
  175. settimeList: function(item, index) {
  176. var that = this;
  177. that.active = index
  178. that.type = that.active;
  179. that.loadend = false;
  180. that.page = 1;
  181. that.presellList = [];
  182. // wxh.time(e.currentTarget.dataset.stop, that);
  183. that.getPresellProductList();
  184. },
  185. goDetails(item) {
  186. uni.navigateTo({
  187. url: '/pages/activity/presell_details/index?id=' + item.product_presell_id
  188. })
  189. }
  190. },
  191. onPullDownRefresh: function(){
  192. this.page = 1;
  193. this.pageloading = false;
  194. this.loadend = false;
  195. this.presellList = []
  196. this.getPresellProductList();
  197. },
  198. /**
  199. * 页面上拉触底事件的处理函数
  200. */
  201. onReachBottom: function() {
  202. this.getPresellProductList();
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .container {
  208. min-height: 100vh;
  209. background-color: var(--view-theme);
  210. }
  211. .noCommodity{
  212. border-top: none;
  213. }
  214. .flash-sale .header {
  215. width: 100%;
  216. position: relative;
  217. }
  218. .flash-sale .main_count{
  219. position: relative;
  220. top: -150rpx;
  221. }
  222. .flash-sale .header .presellBg {
  223. width: 750rpx;
  224. box-sizing: border-box;
  225. }
  226. .flash-sale .presellList {
  227. padding: 0 20rpx;
  228. bottom: 0;
  229. margin: 0 30rpx;
  230. width: 690rpx;
  231. background: #fff;
  232. border-radius: 16rpx;
  233. line-height: 80rpx;
  234. height: 80rpx;
  235. }
  236. .flash-sale .presellList .priceTag {
  237. width: 75rpx;
  238. height: 70rpx;
  239. }
  240. .flash-sale .presellList .priceTag image {
  241. opacity: 1;
  242. }
  243. .flash-sale .presellList .priceTag image {
  244. width: 100%;
  245. height: 100%;
  246. }
  247. .flash-sale .timeList {
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. margin: 0 auto;
  252. }
  253. .flash-sale .timeList .item {
  254. font-size: 20rpx;
  255. color: #666;
  256. text-align: center;
  257. box-sizing: border-box;
  258. width: 224rpx;
  259. }
  260. .flash-sale .timeList .item .time {
  261. font-size: 26rpx;
  262. color: #AAAAAA;
  263. }
  264. .flash-sale .timeList .item.on .time {
  265. color: var(--view-theme);
  266. font-weight: 700;
  267. span{
  268. position: relative;
  269. &::after{
  270. content: '';
  271. display: inline-block;
  272. width: 100%;
  273. height: 5rpx;
  274. background: var(--view-theme);
  275. position: absolute;
  276. left: 0;
  277. bottom: -8rpx;
  278. border-radius: 2rpx;
  279. }
  280. }
  281. }
  282. .activity {
  283. padding: 0 20rpx;
  284. border: 1px solid var(--view-theme);
  285. color: var(--view-theme);
  286. font-size: 24rpx;
  287. line-height: 40rpx;
  288. position: relative;
  289. }
  290. .activity:before {
  291. content: ' ';
  292. position: absolute;
  293. width: 7rpx;
  294. height: 10rpx;
  295. border-radius: 0 7rpx 7rpx 0;
  296. border: 1px solid var(--view-theme);
  297. background-color: #fff;
  298. bottom: 50%;
  299. left: -3rpx;
  300. margin-bottom: -6rpx;
  301. border-left-color: #fff;
  302. }
  303. .activity:after {
  304. content: ' ';
  305. position: absolute;
  306. width: 7rpx;
  307. height: 10rpx;
  308. border-radius: 7rpx 0 0 7rpx;
  309. border: 1px solid var(--view-theme);
  310. background-color: #fff;
  311. right: -3rpx;
  312. bottom: 50%;
  313. margin-bottom: -6rpx;
  314. border-right-color: #fff;
  315. }
  316. .flash-sale .list{
  317. margin-top: 24rpx;
  318. }
  319. .flash-sale .list .item {
  320. height: 278rpx;
  321. position: relative;
  322. width: 690rpx;
  323. margin: 0 auto 20rpx auto;
  324. background-color: #fff;
  325. border-radius: 20rpx;
  326. padding: 0 25rpx;
  327. }
  328. .flash-sale .list .item .pictrue {
  329. width: 240rpx;
  330. height: 240rpx;
  331. border-radius: 10rpx;
  332. }
  333. .flash-sale .list .item .pictrue image {
  334. width: 100%;
  335. height: 100%;
  336. border-radius: 10rpx;
  337. }
  338. .flash-sale .list .item .text {
  339. width: 380rpx;
  340. font-size: 30rpx;
  341. color: #333;
  342. }
  343. .flash-sale .list .item .text .name {
  344. width: 100%;
  345. color: #282828;
  346. font-weight: bold;
  347. font-size: 28rpx;
  348. }
  349. .flash-sale .list .item .text .booking {
  350. font-size: 30rpx;
  351. color: #E93323;
  352. }
  353. .flash-sale .list .item .text .booking .count {
  354. font-size: 24rpx;
  355. color: #E93323;
  356. }
  357. .flash-sale .list .item .text .limit {
  358. font-size: 22rpx;
  359. color: #999;
  360. margin-bottom: 5rpx;
  361. }
  362. .flash-sale .list .item .text .limit .limitPrice {
  363. margin-left: 10rpx;
  364. }
  365. .flash-sale .list .item .text .progress {
  366. width: 392rpx;
  367. height: 74rpx;
  368. background-size: 100%;
  369. margin-top: 16rpx;
  370. .presell_price{
  371. float: left;
  372. width: 50%;
  373. text-align: center;
  374. line-height: 15px;
  375. padding: 8rpx 0;
  376. .presell_text{
  377. display: block;
  378. color: #FF4F00;
  379. font-size: 20rpx;
  380. }
  381. .price{
  382. font-size: 26rpx;
  383. color: #FF4F00;
  384. text{
  385. font-weight: bold;
  386. }
  387. }
  388. }
  389. .order_btn{
  390. float: left;
  391. width: 50%;
  392. text-align: center;
  393. color: #FFFFFF;
  394. font-size: 26rpx;
  395. line-height: 76rpx;
  396. }
  397. .unStartBtn{
  398. float: left;
  399. width: 50%;
  400. text-align: center;
  401. color: #FFFFFF;
  402. font-size: 20rpx;
  403. padding: 8rpx 0;
  404. text{
  405. font-size: 22rpx;
  406. }
  407. }
  408. }
  409. .tool-bar{
  410. display: flex;
  411. align-items: center;
  412. height: 40px;
  413. }
  414. .fixed-head{
  415. position: absolute;
  416. left: 0;
  417. top: 20px;
  418. width: 100%;
  419. z-index: 10;
  420. .icon-xiangzuo {
  421. margin-right: 40rpx;
  422. margin-left: 20rpx;
  423. font-size: 40rpx;
  424. color: #fff;
  425. }
  426. }
  427. </style>