pageStyle.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view :data-theme="theme">
  3. <view class="seckill_header w-full">
  4. <view :style="{ height: `${navH}rpx` }"></view>
  5. <view class="scroll_box" :style='{width: mainWidth+"px"}'>
  6. <scroll-view scroll-x="true" scroll-with-animation style="white-space: nowrap; vertical-align: middle;"
  7. show-scrollbar="false" :scroll-left="tabLeft">
  8. <!-- #ifdef APP-PLUS -->
  9. <!-- <view class="" :style="'width:100%;' + 'height:'+sysHeight"></view> -->
  10. <!-- #endif -->
  11. <view class="scroll_box_item">
  12. <view class="scroll_item" v-for="(item,index) in timeLine" :key="index"
  13. @click="checkSeckill(index,item)">
  14. <view class="acea-row row-column row-center row-middle" :style='"width:"+isWidth+"px;"'
  15. :id='"sort"+index'>
  16. <text class="header_time f-w-700"
  17. :class="active == index ? 'active' : ''">{{item.startTime}}</text>
  18. <text class="header_day f-w-700"
  19. :class="active == index ? 'active_day' : ''">{{item.status | timeStatusFilter}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </scroll-view>
  24. </view>
  25. </view>
  26. <view class="seckill_box" :style='{ marginTop: listMarTop + "rpx"}'>
  27. <view class="seckill_desc acea-row row-between row-middle">
  28. <view class="acea-row row-column">
  29. <text class="seckill_name"></text>
  30. </view>
  31. <view v-if="status>0" class="acea-row datatimeBox">
  32. <text class="f-s-24 text-right mr10">{{desc}}</text>
  33. <view class="count_down">
  34. <countDown :is-day="true" :tip-text="' '" :day-text="' '" :hour-text="' : '"
  35. :minute-text="' : '" :second-text="' '" :datatime="datatime" :isCol="false"
  36. :bgColor="bgColor"></countDown>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 秒杀商品列表 -->
  41. <seckill-list :seckillList="seckillList" :loading="loading" :loadTitle="loadTitle" :status="status"
  42. :datatime="datatime"></seckill-list>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapGetters
  49. } from "vuex";
  50. import SeckillList from "../components/SeckillList";
  51. import countDown from "@/components/countDown";
  52. import emptyPage from '@/components/emptyPage.vue'
  53. import {
  54. setThemeColor
  55. } from '@/utils/setTheme.js'
  56. let app = getApp();
  57. export default {
  58. name: 'PageStyle',
  59. components: {
  60. countDown,
  61. emptyPage,
  62. SeckillList,
  63. },
  64. props: {
  65. //秒杀商品列表
  66. seckillList: {
  67. type: Array,
  68. default: function() {
  69. return [];
  70. }
  71. },
  72. loading: {
  73. type: Boolean,
  74. default: false
  75. },
  76. loadTitle: {
  77. type: String,
  78. default: ''
  79. },
  80. status: {
  81. type: Number,
  82. default: 1
  83. },
  84. // 倒计时时间
  85. datatime: {
  86. type: Number,
  87. default: 0
  88. },
  89. active: {
  90. type: Number,
  91. default: 0
  92. },
  93. mainWidth: {
  94. type: Number,
  95. default: 0
  96. },
  97. tabLeft: {
  98. type: Number,
  99. default: 0
  100. },
  101. timeLine: {
  102. type: Array,
  103. default: function() {
  104. return [];
  105. }
  106. },
  107. marTop: {
  108. type: Number,
  109. default: 0
  110. },
  111. // 倒计时文字
  112. desc: {
  113. type: String,
  114. default: ''
  115. },
  116. isWidth: {
  117. type: Number,
  118. default: 0
  119. },
  120. },
  121. computed: mapGetters(['globalData']),
  122. data() {
  123. return {
  124. theme: this.$Cache.get("theme"),
  125. bgColor: {
  126. 'bgColor': '',
  127. 'Color': '#fff',
  128. 'width': '36rpx',
  129. 'timeTxtwidth': '16rpx',
  130. 'isDay': true
  131. },
  132. listMarTop: 0,
  133. navH: '',
  134. }
  135. },
  136. mounted() {
  137. this.bgColor.bgColor = setThemeColor();
  138. // #ifdef MP || APP-PLUS
  139. // 获取导航高度;
  140. //this.navH = this.globalData.navHeight;
  141. // 获取页面高度
  142. uni.getSystemInfo({
  143. success:(res) => {
  144. // 获取导航高度;
  145. this.navH = res.statusBarHeight * (750 / res.windowWidth) + 91;
  146. }
  147. });
  148. // #endif
  149. this.$nextTick(function() {
  150. const query = uni.createSelectorQuery().in(this);
  151. query.select('.scroll_box_item').boundingClientRect(data => {
  152. // #ifdef MP
  153. this.listMarTop = this.navH + data.height * 2 + 30 + 20
  154. // #endif
  155. // #ifdef APP-PLUS
  156. this.listMarTop = this.marTop + data.height * 2 + 30 + 20
  157. // #endif
  158. }).exec();
  159. });
  160. },
  161. methods: {
  162. checkSeckill(index, item) {
  163. this.$emit('getCheckSeckill', index, item)
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. /deep/.dialog_nav {
  170. z-index: 9999;
  171. }
  172. .mts {
  173. margin-top: -56rpx;
  174. }
  175. .datatimeBox {
  176. height: 36rpx;
  177. line-height: 36rpx;
  178. }
  179. .friceIcon {
  180. font-size: 28rpx;
  181. }
  182. .futura {
  183. margin-top: -6rpx;
  184. }
  185. .seckill_header {
  186. background-image: url('../static/images/seckill_bg.jpg');
  187. background-size: cover;
  188. top: 0;
  189. left: 0;
  190. /* #ifdef H5 */
  191. height: 210rpx;
  192. padding-top: 32rpx;
  193. /* #endif */
  194. /* #ifndef H5*/
  195. height: 380rpx;
  196. /* #endif */
  197. position: fixed;
  198. z-index: 2;
  199. }
  200. .head-menu {
  201. display: flex;
  202. align-items: center;
  203. height: 54rpx;
  204. width: 140rpx;
  205. background: transparent;
  206. border: 1px solid rgba(151, 151, 151, 0.2);
  207. border-radius: 27rpx;
  208. position: relative;
  209. &:after {
  210. content: '';
  211. position: absolute;
  212. width: 1px;
  213. height: 26rpx;
  214. background-color: #EAEAEA;
  215. left: 50%;
  216. top: 50%;
  217. transform: translate(-50%, -50%);
  218. }
  219. .iconfont {
  220. flex: 1;
  221. text-align: center;
  222. color: #fff;
  223. box-sizing: border-box;
  224. }
  225. }
  226. .scroll_box_item {
  227. width: 100%;
  228. height: 92rpx;
  229. }
  230. .scroll_box {
  231. height: 104rpx;
  232. }
  233. .scroll_item {
  234. display: inline-block;
  235. height: 92rpx;
  236. }
  237. .header_time {
  238. font-size: 36rpx;
  239. color: rgba(255, 255, 255, .4);
  240. display: inline-block;
  241. margin-bottom: 10rpx;
  242. transition: all .3s ease;
  243. font-family: PingFang SC-中黑体, PingFang SC;
  244. }
  245. .active {
  246. color: #fff;
  247. }
  248. .active_day {
  249. width: 108rpx;
  250. height: 30rpx;
  251. line-height: 30rpx;
  252. text-align: center;
  253. font-size: 22rpx;
  254. color: #fff !important;
  255. @include linear-gradient(theme);
  256. background-size: contain;
  257. background-repeat: no-repeat;
  258. }
  259. .header_day {
  260. font-size: 24rpx;
  261. color: rgba(255, 255, 255, .4);
  262. font-family: PingFang SC-中黑体, PingFang SC;
  263. }
  264. .seckill_box {
  265. width: 100%;
  266. background-color: #fff;
  267. left: 0;
  268. position: relative;
  269. /* #ifdef H5 */
  270. margin-top: 172rpx !important;
  271. /* #endif */
  272. /* #ifndef H5 */
  273. //margin-top: -120rpx;
  274. /* #endif */
  275. }
  276. .seckill_desc {
  277. background: linear-gradient(360deg, #FFFFFF 0%, #F4F4F4 100%);
  278. border-radius: 24rpx 24rpx 0px 0px;
  279. padding: 0 24rpx;
  280. width: 100%;
  281. height: 117rpx;
  282. position: fixed;
  283. z-index: 2;
  284. }
  285. .seckill_name {
  286. width: 222rpx;
  287. height: 57rpx;
  288. background-image: url('../static/images/miaos.png');
  289. background-size: contain;
  290. background-repeat: no-repeat;
  291. padding-bottom: 10rpx;
  292. }
  293. .seckill_discount {
  294. font-size: 32rpx;
  295. font-family: PingFangSC-Regular, PingFang SC;
  296. font-weight: 400;
  297. color: #AC6926;
  298. }
  299. .text-right {
  300. text-align: right;
  301. }
  302. .count_down {}
  303. /deep/ .is_day {
  304. font-size: 24rpx;
  305. font-weight: 500;
  306. color: #1B1B1B;
  307. }
  308. </style>