You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

371 lines
8.3 KiB

3 months ago
  1. <template>
  2. <!-- 秒杀 -->
  3. <view v-if="spikeList.length">
  4. <view class="seckill" :style="[boxStyle]" >
  5. <view class="bg_box" :style="[boxBgStyle]"></view>
  6. <view class="title acea-row row-between-wrapper">
  7. <view class="acea-row row-middle">
  8. <view class="pictrue skeleton-rect">
  9. <image :src="logoUrl"></image>
  10. </view>
  11. <view class="lines"></view>
  12. <view class="point skeleton-rect" :style="[titleColor]">{{titleText}}</view>
  13. </view>
  14. <view class="more acea-row row-center-wrapper skeleton-rect" @click="toSeckillList()">
  15. GO<text class="iconfont icon-you"></text>
  16. </view>
  17. </view>
  18. <view class="conter" v-if="listStyle == 0">
  19. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;"
  20. show-scrollbar="false">
  21. <view class="itemCon" :style="[{'margin-right':itemStyle}]" v-for="(item, index) in spikeList"
  22. :key="index" @click="toSeckillDetail(item.id)">
  23. <view class="item">
  24. <view class="pictrue skeleton-rect">
  25. <easy-loadimage :image-src="item.image" :radius="dataConfig.contentStyle.val">
  26. </easy-loadimage>
  27. </view>
  28. <view v-show="nameShow" :style="[nameColor]" class="name line1 skeleton-rect">{{item.title}}</view>
  29. <view v-show="priceShow" :style="[priceColor]" class="x_money semiBold line1 skeleton-rect">¥<text
  30. class="num semiBold">{{item.price}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </scroll-view>
  35. </view>
  36. <view class="conter_y" :style="[{'grid-gap':itemStyle}]" v-if="listStyle == 1">
  37. <view class="item" v-for="(item, index) in spikeList" :key="index" @click="toSeckillDetail(item.id)">
  38. <view class="pictrue">
  39. <easy-loadimage :image-src="item.image" :radius="dataConfig.contentStyle.val">
  40. </easy-loadimage>
  41. </view>
  42. <view class="text-info acea-row row-column row-between">
  43. <view v-show="nameShow">
  44. <view :style="[nameColor]" class="title line2">{{ item.title }}</view>
  45. </view>
  46. <view v-show="priceShow" :style="[priceColor]" class="price semiBold">
  47. <view>
  48. <text class="semiBold"></text>
  49. <text class="semiBold">{{ item.price }}</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. // +----------------------------------------------------------------------
  60. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  61. // +----------------------------------------------------------------------
  62. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  63. // +----------------------------------------------------------------------
  64. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  65. // +----------------------------------------------------------------------
  66. // | Author: CRMEB Team <admin@crmeb.com>
  67. // +----------------------------------------------------------------------
  68. let app = getApp();
  69. import {
  70. getSeckillIndexApi
  71. } from '@/api/activity.js';
  72. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  73. export default {
  74. name: 'homeSeckill',
  75. props: {
  76. dataConfig: {
  77. type: Object,
  78. default: () => {}
  79. },
  80. },
  81. components: {
  82. easyLoadimage
  83. },
  84. data() {
  85. return {
  86. urlDomain: this.$Cache.get("imgHost"),
  87. spikeList: [], // 秒杀
  88. datatime: 0,
  89. status: 0,
  90. themeColor:this.$options.filters.filterTheme(app.globalData.theme)
  91. }
  92. },
  93. computed: {
  94. //秒杀样式
  95. listStyle() {
  96. return this.dataConfig.tabConfig.tabVal
  97. },
  98. //最外层盒子的背景图片
  99. boxBgStyle() {
  100. return {
  101. borderRadius: this.dataConfig.bgStyle.val * 2 + 'rpx' + ' ' + this.dataConfig.bgStyle.val * 2 + 'rpx' +
  102. ' ' + 0 + ' ' + 0,
  103. backgroundImage: `url(${this.urlDomain}crmebimage/presets/seckill_bg_pic.png),linear-gradient(${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`
  104. }
  105. },
  106. //最外层盒子的样式
  107. boxStyle() {
  108. return {
  109. borderRadius: this.dataConfig.bgStyle.val * 2 + 'rpx',
  110. margin: this.dataConfig.mbConfig.val * 2 + 'rpx' + ' ' + this.dataConfig.lrConfig.val * 2 + 'rpx' +
  111. ' ' + 0,
  112. padding: this.dataConfig.upConfig.val * 2 + 'rpx' + ' ' + '24rpx' + ' ' + this.dataConfig.downConfig
  113. .val * 2 + 'rpx'
  114. }
  115. },
  116. //图片圆角
  117. itemStyle() {
  118. return this.dataConfig.contentConfig.val * 2 + 'rpx'
  119. },
  120. //标题图片
  121. logoUrl() {
  122. return this.dataConfig.logoConfig.url
  123. },
  124. //标题
  125. titleText() {
  126. return this.dataConfig.titleConfig.val
  127. },
  128. //标题颜色
  129. titleColor() {
  130. return {
  131. color: this.dataConfig.titleColor.color[0].item
  132. }
  133. },
  134. //名称颜色
  135. nameColor() {
  136. return {
  137. color: this.dataConfig.nameColor.color[0].item
  138. };
  139. },
  140. //价格颜色
  141. priceColor() {
  142. return {
  143. color: this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.priceColor.color[0].item:this.themeColor
  144. };
  145. },
  146. //商品名称
  147. nameShow() {
  148. if (this.dataConfig.typeConfig.activeValue.indexOf(0) !== -1) {
  149. return true;
  150. } else {
  151. return false;
  152. }
  153. },
  154. //商品价格
  155. priceShow() {
  156. if (this.dataConfig.typeConfig.activeValue.indexOf(1) !== -1) {
  157. return true;
  158. } else {
  159. return false;
  160. }
  161. },
  162. },
  163. created() {
  164. this.getSeckillIndex();
  165. },
  166. methods: {
  167. getSeckillIndex() {
  168. getSeckillIndexApi().then(({
  169. data
  170. }) => {
  171. this.spikeList = [];
  172. this.spikeList = data ? data.productList : [];
  173. })
  174. },
  175. toSeckillList() {
  176. this.$util.navigateTo(this.dataConfig.linkConfig.val)
  177. },
  178. toSeckillDetail(id){
  179. uni.navigateTo({
  180. url:`/pages/activity/goods_seckill_details/index?id=${id}`
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. .seckill {
  188. width: auto;
  189. background: #fff;
  190. border-radius: 14rpx;
  191. box-sizing: border-box;
  192. position: relative;
  193. .bg_box {
  194. position: absolute;
  195. top: 0;
  196. left: 0;
  197. width: 100%;
  198. height: 256rpx;
  199. background-repeat: no-repeat;
  200. background-size: cover;
  201. border-radius: 14rpx 14rpx 0 0;
  202. }
  203. .title {
  204. .pictrue {
  205. width: 124rpx;
  206. height: 32rpx;
  207. z-index: 9;
  208. image {
  209. width: 100%;
  210. height: 100%;
  211. }
  212. }
  213. .lines {
  214. width: 1rpx;
  215. height: 24rpx;
  216. background-color: #fff;
  217. opacity: 0.6;
  218. margin-left: 16rpx;
  219. }
  220. .point {
  221. font-size: 26rpx;
  222. color: #fff;
  223. margin-left: 21rpx;
  224. margin-right: 4rpx;
  225. z-index: 9;
  226. }
  227. .styleAll {
  228. width: 35rpx;
  229. height: 35rpx;
  230. background-color: #2F2F2F;
  231. border-radius: 6rpx;
  232. color: #fff;
  233. text-align: center;
  234. }
  235. .more {
  236. width: 86rpx;
  237. height: 40rpx;
  238. background: linear-gradient(142deg, #FFE9CE 0%, #FFD6A7 100%);
  239. opacity: 1;
  240. border-radius: 18px;
  241. font-size: 22rpx;
  242. color: #FE960F;
  243. padding-left: 8rpx;
  244. font-weight: 800;
  245. z-index: 9;
  246. .iconfont {
  247. font-size: 21rpx;
  248. }
  249. }
  250. }
  251. .conter {
  252. border-radius: 12px;
  253. margin-top: 30rpx;
  254. .itemCon {
  255. display: inline-block;
  256. width: 186rpx;
  257. .item {
  258. width: 100%;
  259. .pictrue {
  260. width: 100%;
  261. height: 186rpx;
  262. overflow: hidden;
  263. image {
  264. width: 100%;
  265. height: 100%;
  266. border-radius: 6rpx;
  267. }
  268. }
  269. .name {
  270. font-size: 26rpx;
  271. color: #333;
  272. margin-top: 8rpx;
  273. }
  274. .y_money {
  275. font-size: 24rpx;
  276. color: #999999;
  277. text-decoration: line-through;
  278. }
  279. .x_money {
  280. font-size: 28rpx;
  281. height: 100%;
  282. font-weight: bold;
  283. margin-top: 4rpx;
  284. .num {
  285. font-size: 28rpx;
  286. }
  287. }
  288. .money {
  289. margin-top: 14rpx;
  290. }
  291. }
  292. }
  293. }
  294. }
  295. .conter_y {
  296. display: grid;
  297. grid-template-columns: repeat(1, 1fr);
  298. grid-template-rows: auto;
  299. width: 100%;
  300. margin-top: 30rpx;
  301. .item {
  302. display: flex;
  303. width: 100%;
  304. z-index: 9;
  305. .pictrue {
  306. width: 108px;
  307. height: 108px;
  308. image {
  309. width: 100%;
  310. height: 100%;
  311. }
  312. }
  313. .text-info {
  314. z-index: 9;
  315. margin-left: 20rpx;
  316. flex: 1;
  317. .title {
  318. width: 100%;
  319. height: 80rpx;
  320. line-height: 40rpx;
  321. color: #333;
  322. }
  323. .old-price {
  324. font-weight: normal;
  325. font-size: 24rpx;
  326. color: #999;
  327. }
  328. .price {
  329. font-size: 36rpx;
  330. font-weight: 550;
  331. text {
  332. padding-bottom: 4rpx;
  333. font-size: 26rpx;
  334. font-weight: normal;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. .semiBold{
  341. font-size: 36rpx !important;
  342. }
  343. </style>