listStyle.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view :data-theme="theme">
  3. <!-- #ifdef H5 -->
  4. <view class="w-full bg-top h-604 relative" :style="{backgroundImage:headerBg}">
  5. <!-- #endif -->
  6. <!-- #ifndef H5 -->
  7. <view class="w-full bg-top relative"
  8. :style="{backgroundImage:headerBg,height: (sysHeight + 262) * 2 + 'rpx'}">
  9. <!-- #endif -->
  10. </view>
  11. <view class="relative w-full content">
  12. <view class="_box h-106 flex-y-center" :class="pageScrollStatus ? '' : 'rd-t-24rpx'"
  13. :style="{'top': 50 + sysHeight + 'px'}">
  14. <scroll-view scroll-x="true" style="white-space: nowrap;" scroll-with-animation
  15. class="white-nowrap vertical-middle w-full relative z-10"
  16. :class="{'sel1':active == 0,'sel-last': timeLine.length > 4 && active == timeLine.length - 1}"
  17. show-scrollbar="false" :scroll-left="tabLeft">
  18. <view class="scroll-item" v-for="(item,index) in timeLine" :key='index'
  19. :class="active == index ? 'active-card' : ''"
  20. :style="{'background-image': active == index ? navActiveBg : ''}"
  21. @tap='checkSeckill(index,item)'>
  22. <view class="flex-col flex-center z-10 relative t-22">
  23. <text class="SemiBold fs-40 lh-40rpx semiBold"
  24. :class="active == index ? 'text--w111-333':'text--w111-fff'">{{item.startTime}}</text>
  25. <text class="inline-block h-36 lh-34rpx fs-24"
  26. :class="active == index ? 'red-tag':'text--w111-fff'">{{item.status | timeStatusFilter}}</text>
  27. </view>
  28. </view>
  29. </scroll-view>
  30. <view class="abs-lb w-full"
  31. :style="{'background': pageScrollStatus ? '#e93323' : 'rgba(245,245,245,0.2)','height': pageScrollStatus ? '130rpx' : '96rpx'}">
  32. </view>
  33. </view>
  34. <view class="bg--w111-f5f5f5 pt-32 pl-20 pr-20 relative">
  35. <view class="card w-full bg--w111-fff rd-24rpx p-20 flex" v-for="(item,index) in seckillList"
  36. :key="index" @tap='goDetail(item.id)'>
  37. <view class="w-240 h-240">
  38. <easy-loadimage mode="aspectFit" :image-src="item.image" :border-src="item.image"
  39. width="240rpx" height="240rpx" :radius="10"></easy-loadimage>
  40. </view>
  41. <view class="flex-1 pl-20 flex-col justify-between">
  42. <view class="w-full">
  43. <view class="w-410 fs-28 lh-40rpx line2">
  44. <text v-if="item.isSelf" class="font-bg-red bt-color mr10 self_min merType bg-red">自营</text>
  45. {{item.name}}
  46. </view>
  47. </view>
  48. <view class="flex items-baseline">
  49. <text class="fs-22 lh-30rpx text-primary pr-8">秒杀价:</text>
  50. <baseMoney :money="item.seckillPrice" symbolSize="24" integerSize="40" decimalSize="24"
  51. incolor="E93323" weight></baseMoney>
  52. <text class="fs-22 lh-30rpx text--w111-999 pl-16 text-line regular">¥{{item.price}}</text>
  53. </view>
  54. <view class="w-full progress-box flex-between-center" v-if="status == 1">
  55. <view class="flex-y-center">
  56. <view class="progress ml-16">
  57. <view class="active" :style="'width:'+item.payRange"></view>
  58. </view>
  59. <text class="fs-22 text-primary pl-8">已抢{{item.payRange}}</text>
  60. </view>
  61. <view class="qiang"></view>
  62. </view>
  63. <view class="w-full yuyue-box flex-between-center" v-if="status == 2 || status ==3">
  64. <view class="flex-y-center fs-22 pl-16">活动即将开始</view>
  65. <view class="yuyue"></view>
  66. </view>
  67. <view class="w-full over-box flex-between-center" v-if="status == 0">
  68. <view class="flex-y-center fs-22 pl-16">活动已结束</view>
  69. <view class="over"></view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="abs-lt cir" v-show="active > 0"></view>
  74. </view>
  75. <view class="bg--w111-f5f5f5 p-20" v-if="!seckillList.length && !loading">
  76. <emptyPage title="暂无秒杀商品,去看看其他商品吧~" :imgSrc="urlDomain+'crmebimage/presets/noShopper.png'">
  77. </emptyPage>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import emptyPage from '@/components/emptyPage.vue';
  84. import easyLoadimage from '@/components/base/easy-loadimage.vue'
  85. import {
  86. goProductDetail
  87. } from "@/libs/order";
  88. let sysHeight = uni.getWindowInfo() ? uni.getWindowInfo().statusBarHeight : '';
  89. let app = getApp();
  90. export default {
  91. name: 'ListStyle',
  92. components: {
  93. emptyPage,
  94. easyLoadimage
  95. },
  96. props: {
  97. //秒杀商品列表
  98. seckillList: {
  99. type: Array,
  100. default: function() {
  101. return [];
  102. }
  103. },
  104. timeLine: {
  105. type: Array,
  106. default: function() {
  107. return [];
  108. }
  109. },
  110. loading: {
  111. type: Boolean,
  112. default: false
  113. },
  114. active: {
  115. type: Number,
  116. default: 0
  117. },
  118. //控制页面滑动
  119. pageScrollStatus: {
  120. type: Boolean,
  121. default: false
  122. },
  123. tabLeft: {
  124. type: Number,
  125. default: 0
  126. },
  127. },
  128. data() {
  129. return {
  130. theme: app.globalData.theme,
  131. urlDomain: this.$Cache.get("imgHost"),
  132. sysHeight: sysHeight,
  133. scrollLeft: 0,
  134. status: 1,
  135. }
  136. },
  137. computed: {
  138. headerBg() {
  139. return 'url(' + this.urlDomain + 'crmebimage/presets/seckill_header.png' + ')'
  140. },
  141. navActiveLeft() {
  142. if (this.active == 0) {
  143. return 0
  144. } else if (this.active == 1) {
  145. return '134rpx'
  146. } else {
  147. return 154 * this.active + 'rpx'
  148. }
  149. },
  150. navActiveBg() {
  151. if (this.active == 0) {
  152. return 'url(' + this.urlDomain + 'crmebimage/presets/seckill_header_icon1.png' + ')'
  153. } else {
  154. return 'url(' + this.urlDomain + 'crmebimage/presets/seckill_header_icon2.png' + ')'
  155. }
  156. }
  157. },
  158. methods: {
  159. checkSeckill(index, item) {
  160. this.$emit('getCheckSeckill', index, item);
  161. },
  162. /*
  163. *去商品详情页
  164. */
  165. goDetail(id) {
  166. goProductDetail(id, 1, `&status=${this.status}&datatime=${this.datatime}`)
  167. },
  168. },
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .bg-top{
  173. background-size: 100% 100%;
  174. background-repeat: no-repeat;
  175. }
  176. .sticky{
  177. &:after{
  178. content:'';
  179. width:100%;
  180. height: 20px;
  181. background-color: #E93323;
  182. position: absolute;
  183. left: 0;
  184. bottom: -20rpx;
  185. }
  186. }
  187. .content{
  188. top: -114rpx;
  189. }
  190. ._box{
  191. position: sticky;
  192. z-index: 99;
  193. }
  194. .card ~ .card{
  195. margin-top: 20rpx;
  196. }
  197. .w-21-p111-{
  198. width: 21%;
  199. }
  200. .max-w-96{
  201. max-width: 96rpx;
  202. }
  203. .fq{
  204. background-color: #E93323;
  205. color: #fff;
  206. }
  207. .text-primary{
  208. color: #E93323;;
  209. }
  210. .text-line{
  211. text-decoration: line-through;
  212. }
  213. .progress-box{
  214. height: 64rpx;
  215. background-color: rgba(233, 51, 35, 0.05);
  216. border-radius: 16rpx;
  217. }
  218. .progress{
  219. width:160rpx;
  220. height: 18rpx;
  221. border-radius: 10rpx;
  222. background-color: rgba(233, 51, 35, 0.2);
  223. .active{
  224. height: 18rpx;
  225. border-radius: 10rpx;
  226. background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
  227. }
  228. }
  229. .qiang{
  230. width:112rpx;
  231. height: 64rpx;
  232. background-image: url('../static/images/qiang.png');
  233. background-size: cover;
  234. }
  235. .yuyue-box{
  236. height: 64rpx;
  237. background-color: #FFF1E5;
  238. border-radius: 16rpx;
  239. color: #FF7D00;
  240. }
  241. .yuyue{
  242. width:140rpx;
  243. height: 64rpx;
  244. background-image: url('../static/images/yuyue.png');
  245. background-size: cover;
  246. }
  247. .over-box{
  248. height: 64rpx;
  249. background-color: rgba(233, 51, 35, 0.05);
  250. border-radius: 16rpx;
  251. color: rgba(233, 51, 35, 0.60);
  252. }
  253. .over{
  254. width:140rpx;
  255. height: 64rpx;
  256. background-image: url('../static/images/over.png');
  257. background-size: cover;
  258. }
  259. .sel1 .scroll-item{
  260. right: 30rpx;
  261. }
  262. .sel-last {
  263. /deep/.uni-scroll-view {
  264. margin-right: -10rpx;
  265. }
  266. .scroll-item {
  267. // left: 40rpx;
  268. // left: 32rpx;
  269. }
  270. .active-card {
  271. width: 180rpx;
  272. padding-left: 10px;
  273. .relative {
  274. width: 160rpx;
  275. }
  276. }
  277. }
  278. .scroll-item{
  279. display: inline-block;
  280. height: 96rpx;
  281. width: 21%;
  282. position: relative;
  283. bottom: 0;
  284. }
  285. .active-card{
  286. width:234rpx;
  287. height: 106rpx;
  288. background-size: cover;
  289. z-index: 99;
  290. }
  291. .t-22{
  292. top: 22rpx;
  293. }
  294. .red-tag{
  295. display: inline-block;
  296. padding: 0 12rpx;
  297. height: 36rpx;
  298. border-radius: 18rpx;
  299. text-align: center;
  300. line-height: 36rpx;
  301. background-color: #E93323;
  302. font-size: 22rpx;
  303. color: #fff;
  304. }
  305. .cir{
  306. width: 24rpx;
  307. height: 24rpx;
  308. background-color: #ED593E;
  309. &:after{
  310. content: '';
  311. width: 24rpx;
  312. height: 24rpx;
  313. position: absolute;
  314. left: 0;
  315. top: 0;
  316. border-top-left-radius: 100%; /* 左上角为半径大小的弧形 */
  317. background-color: #f5f5f5;
  318. }
  319. }
  320. .brand-tag{
  321. background-color: #e93323 !important;
  322. }
  323. </style>