seckill.vue 8.8 KB

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