seckill.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view>
  3. <view class="default" v-if="isIframe && !spikeList.length">
  4. <text>{{$t(`秒杀模块,暂无数据`)}}</text>
  5. </view>
  6. <view class="seckill" v-if="spikeList.length && isShow && !isIframe">
  7. <view class="title acea-row row-between-wrapper">
  8. <view class="acea-row row-middle">
  9. <view class="name">{{$t(`限时秒杀`)}}</view>
  10. <view class="point">{{point}} {{$t(`场`)}}</view>
  11. <countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
  12. :datatime="datatime"></countDown>
  13. </view>
  14. <navigator url="/pages/activity/goods_seckill/index" hover-class="none" class="more acea-row row-center-wrapper">{{$t(`更多`)}}<text class="iconfont icon-jiantou"></text></navigator>
  15. </view>
  16. <view class="conter">
  17. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  18. <view class="itemCon" v-for="(item, index) in spikeList" :key="index" @click="goDetail(item)">
  19. <view class="item">
  20. <view class="pictrue">
  21. <image :src="item.image"></image>
  22. </view>
  23. <view class="name line1">{{item.title}}</view>
  24. <view class="money">
  25. <view class="x_money">{{$t(`¥`)}}<text class="num">{{item.price}}</text></view>
  26. <view class="y_money">{{$t(`¥`)}}{{item.ot_price}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <view class="seckill" v-if="spikeList.length && isIframe">
  34. <view class="title acea-row row-between-wrapper">
  35. <view class="acea-row row-middle">
  36. <view class="name">{{$t(`限时秒杀`)}}</view>
  37. <view class="point">{{point}} {{$t(`场`)}}</view>
  38. <countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
  39. :datatime="datatime"></countDown>
  40. </view>
  41. <navigator class="more acea-row row-center-wrapper">{{$t(`更多`)}}<text class="iconfont icon-jiantou"></text></navigator>
  42. </view>
  43. <view class="conter">
  44. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  45. <view class="itemCon" v-for="(item, index) in spikeList" :key="index" @click="goDetail(item)">
  46. <view class="item">
  47. <view class="pictrue">
  48. <image :src="item.image"></image>
  49. </view>
  50. <view class="name line1">{{item.title}}</view>
  51. <view class="money">
  52. <view class="x_money">{{$t(`¥`)}}<text class="num">{{item.price}}</text></view>
  53. <view class="y_money">{{$t(`¥`)}}{{item.ot_price}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. let app = getApp();
  65. import {
  66. goPage
  67. } from '@/libs/order.js';
  68. import { getHomeProducts } from '@/api/store.js';
  69. import countDown from '@/components/countDown';
  70. export default {
  71. name: 'seckill',
  72. components: {
  73. countDown
  74. },
  75. props: {
  76. dataConfig: {
  77. type: Object,
  78. default: () => {}
  79. }
  80. },
  81. watch: {
  82. dataConfig: {
  83. immediate: true,
  84. handler(nVal, oVal) {
  85. if(nVal){
  86. this.isShow = nVal.isShow.val;
  87. this.selectType = nVal.tabConfig.tabVal;
  88. this.$set(this, 'selectId', nVal.selectConfig.activeValue || '');
  89. this.$set(this, 'type', nVal.titleInfo.type);
  90. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  91. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  92. this.ids = nVal.ids?nVal.ids.join(','):'';
  93. this.numConfig = nVal.numConfig.val;
  94. this.productslist();
  95. }
  96. }
  97. }
  98. },
  99. data() {
  100. return {
  101. datatime: 0,
  102. point: "",
  103. spikeList: [],
  104. name:this.$options.name,//component组件固定写法获取当前name;
  105. isIframe:app.globalData.isIframe,//判断是前台还是后台;
  106. isShow:true,
  107. selectType:0,
  108. selectId: '',
  109. salesOrder:'',
  110. newsOrder:'',
  111. ids:'',
  112. page: 1,
  113. limit: this.$config.LIMIT,
  114. type: '',
  115. numConfig:0
  116. };
  117. },
  118. created() {
  119. },
  120. mounted() {
  121. },
  122. methods: {
  123. // 产品列表
  124. productslist: function() {
  125. let that = this;
  126. let data = {};
  127. if (that.selectType) {
  128. data = {
  129. page: that.page,
  130. limit: that.limit,
  131. type: that.type,
  132. ids: that.ids,
  133. selectType: that.selectType
  134. }
  135. } else {
  136. data = {
  137. page: that.page,
  138. limit: that.numConfig<=that.limit?that.numConfig:that.limit,
  139. type: that.type,
  140. newsOrder: that.newsOrder,
  141. salesOrder: that.salesOrder,
  142. selectId: that.selectId,
  143. selectType: that.selectType
  144. }
  145. }
  146. getHomeProducts(data).then(res => {
  147. that.spikeList = res.data.list;
  148. that.point = res.data.time;
  149. that.datatime = res.data.stop;
  150. }).catch(err => {
  151. that.$util.Tips({ title: err });
  152. });
  153. },
  154. goDetail(item){
  155. goPage(item).then(res=>{
  156. uni.navigateTo({
  157. url: `/pages/activity/goods_seckill_details/index?id=${item.id}&time=${this.datatime}&status=1`
  158. })
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss">
  165. .default{
  166. width: 690rpx;
  167. height: 300rpx;
  168. border-radius: 14rpx;
  169. margin: 26rpx auto 0 auto;
  170. background-color: #ccc;
  171. text-align: center;
  172. line-height: 300rpx;
  173. .iconfont{
  174. font-size: 50rpx;
  175. }
  176. }
  177. .seckill {
  178. width: 690rpx;
  179. height: 410rpx;
  180. margin: 0 auto;
  181. padding-top: 35rpx;
  182. background-color: $uni-bg-color;
  183. // border-top:1rpx solid #eee;
  184. .title {
  185. .name{
  186. font-size: 32rpx;
  187. color: #282828;
  188. font-weight: bold;
  189. }
  190. // .lines {
  191. // width: 1rpx;
  192. // height: 24rpx;
  193. // background-color: #1DB0FC;
  194. // opacity: 0.6;
  195. // margin-left: 16rpx;
  196. // }
  197. .point {
  198. font-size: 30rpx;
  199. font-weight: bold;
  200. color: #fc4141;
  201. margin-left: 16rpx;
  202. }
  203. /deep/.time {
  204. font-size: 24rpx;
  205. .styleAll {
  206. width: 35rpx;
  207. height: 35rpx;
  208. background-color: rgba(252, 60, 62, 0.09);
  209. border-radius: 6rpx;
  210. color: rgb(233, 51, 35);
  211. text-align: center;
  212. }
  213. .red {
  214. &~.red {
  215. color: #333333;
  216. padding: 0 4rpx;
  217. }
  218. }
  219. }
  220. .more {
  221. font-size: 26rpx!important;
  222. color: #333;
  223. .iconfont {
  224. margin-left: 8rpx;
  225. font-size: 26rpx!important;
  226. vertical-align: 2rpx;
  227. }
  228. }
  229. }
  230. .conter {
  231. width: 100%;
  232. height: 320rpx;
  233. background-color: #FFFFFF;
  234. border-radius: 12px;
  235. margin-top: 26rpx;
  236. .itemCon {
  237. display: inline-block;
  238. width: 174rpx;
  239. margin-right: 24rpx;
  240. .item {
  241. width: 100%;
  242. .pictrue {
  243. width: 100%;
  244. height: 174rpx;
  245. border-radius: 6rpx;
  246. image {
  247. width: 100%;
  248. height: 100%;
  249. border-radius: 6rpx;
  250. }
  251. }
  252. .name {
  253. font-size: 24rpx;
  254. color: #333333;
  255. margin-top: 10rpx;
  256. }
  257. .money {
  258. .y_money {
  259. font-size: 20rpx;
  260. color: #999999;
  261. text-decoration: line-through;
  262. }
  263. .x_money {
  264. color: #FD502F;
  265. font-size: 24rpx;
  266. font-weight: bold;
  267. margin-top: 3rpx;
  268. .num {
  269. font-size: 28rpx;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. }
  276. }
  277. </style>