snowGoodsList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view>
  3. <view class="head-bar">
  4. <view class="page-title">鲸致生活</view>
  5. <view class="bar-right">
  6. <view class="order-block" @tap="goOrder">
  7. <image src="/static/images/icon-order.png" mode="aspectFit"></image>
  8. <view>订单</view>
  9. </view>
  10. <view class="kf-block" @tap="goIM">
  11. <!-- <button class="contact-btn" open-type="contact">客服</button> -->
  12. <view class="contact-wrapper">
  13. <image src="/static/images/online-new.png"></image>
  14. <view>客服</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="container">
  20. <view class="goods-list">
  21. <view :class="'goods-item ' + (item.isTop ? 'current-live' : '')" v-for="(item, index) in goodsList" :key="index">
  22. <view class="item-left">
  23. <image class="goods-img" :src="item.imgUrl + '?w=200'" mode="aspectFit"></image>
  24. <view class="goods-sort">{{ item.sort }}</view>
  25. <view class="goods-interpret" :tt-if="item.isTop">
  26. <image src="https://mall.zhaijieshi.cc/file/jzmall/storage/8ms4gt7xmd0z5ys0q83z.gif"></image>
  27. <text>讲解中</text>
  28. </view>
  29. <view class="soldout-mask" :tt-if="item.isSoldout">- 已抢光 -</view>
  30. </view>
  31. <view class="item-right">
  32. <view class="top-wrapper">
  33. <view class="goods-name">{{ item.name }}</view>
  34. <view class="shop-info">
  35. <view class="shop-distance">
  36. <!-- {{distance}}m -->
  37. <image src="/static/images/address.png" style="height: 12px; width: 12px"></image>
  38. </view>
  39. <view class="shop-tips">鲸致生活{{ item.shops }}家门店可用</view>
  40. </view>
  41. <view class="refund-info" :tt-if="item.isSoldout">
  42. <view class="refund-text">随时退·过期退</view>
  43. <view class="sale-num-out">已售{{ item.saleNum }}</view>
  44. </view>
  45. <view class="soldout-tag" :tt-if="item.isSoldout">商品已抢光</view>
  46. </view>
  47. <view class="bottom-wrapper">
  48. <view class="sale-num" :tt-if="!item.isSoldout">已售{{ item.saleNum }}</view>
  49. <view class="item-bottom">
  50. <view class="price-block">
  51. <block v-if="item.times > 1" class="">
  52. <view class="whole-price">
  53. ¥
  54. <text>{{ item.retailPrice }}</text>
  55. /{{ item.times }}次
  56. </view>
  57. <view class="single-price">单次¥160</view>
  58. </block>
  59. <block v-if="item.times == 1">
  60. <view v-if="item.isHot" class="hot-text">秒杀</view>
  61. <view class="counter-price">
  62. ¥
  63. <text>{{ item.retailPrice }}</text>
  64. </view>
  65. <view class="retail-price">¥{{ item.counterPrice }}</view>
  66. <view class="goods-discount">{{ item.discount }}折</view>
  67. </block>
  68. </view>
  69. <view class="buy-btn soldout-btn" :tt-if="item.isSoldout">已抢光</view>
  70. <view class="buy-btn" :data-id="item.id" @tap="goGoods" :tt-if="!item.isSoldout">去抢购</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. var util = require('../../../utils/util.js');
  81. var api = require('../../../config/api.js');
  82. const app = getApp();
  83. export default {
  84. data() {
  85. return {
  86. talentId: '',
  87. //达人id
  88. updateTime: '',
  89. //数据最后更新时间
  90. goodsList: [],
  91. distance: parseInt(Math.random() * 500)
  92. };
  93. }
  94. /**
  95. * 生命周期函数--监听页面加载
  96. */,
  97. onLoad: function (options) {
  98. console.info(options);
  99. let talentId = options.talentId;
  100. if (talentId) {
  101. this.setData({
  102. talentId: talentId
  103. });
  104. this.getGoodsSnow();
  105. setInterval(() => {
  106. this.getGoodsSnow();
  107. }, 2000);
  108. } else {
  109. uni.showToast({
  110. title: '异常加载'
  111. });
  112. }
  113. },
  114. methods: {
  115. getGoodsSnow() {
  116. let that = this;
  117. util.request(
  118. api.GoodsSnow,
  119. {
  120. talentId: that.talentId,
  121. updateTime: that.updateTime
  122. },
  123. 'GET'
  124. ).then(function (res) {
  125. if (res.data.isModify) {
  126. that.setData({
  127. updateTime: res.data.updateTime,
  128. goodsList: res.data.list
  129. });
  130. }
  131. });
  132. },
  133. goGoods(e) {
  134. let goodsId = e.currentTarget.dataset.id;
  135. //console.info('/pages/goods/goods?id=' + goodsId + '&talentId=' + this.data.talentId)
  136. uni.navigateTo({
  137. url: '/pages/goods/goods?id=' + goodsId + '&talentId=' + this.talentId
  138. });
  139. },
  140. goOrder() {
  141. uni.navigateTo({
  142. url: '/pages/ucenter/order/order'
  143. });
  144. },
  145. goIM() {
  146. console.info('goIm');
  147. uni.navigateTo({
  148. url: '/pages/chat/im/im'
  149. });
  150. }
  151. }
  152. };
  153. </script>
  154. <style>
  155. .head-bar {
  156. height: 80rpx;
  157. position: fixed;
  158. left: 0;
  159. right: 0;
  160. display: flex;
  161. align-items: center;
  162. justify-content: space-between;
  163. padding: 0 36rpx 0 32rpx;
  164. background: #fff;
  165. z-index: 9;
  166. }
  167. .page-title {
  168. color: #000;
  169. font-size: 28rpx;
  170. }
  171. .bar-right {
  172. height: 80rpx;
  173. display: flex;
  174. align-items: center;
  175. }
  176. .bar-right image {
  177. width: 30rpx;
  178. height: 30rpx;
  179. margin-right: 8rpx;
  180. }
  181. .bar-right view {
  182. font-size: 24rpx;
  183. color: #666;
  184. }
  185. .order-block {
  186. display: flex;
  187. align-items: center;
  188. height: 80rpx;
  189. }
  190. .kf-block {
  191. margin-left: 40rpx;
  192. position: relative;
  193. height: 80rpx;
  194. }
  195. .contact-btn {
  196. height: 80rpx;
  197. width: 88rpx;
  198. position: absolute;
  199. top: 0;
  200. bottom: 0;
  201. left: 0;
  202. z-index: 99;
  203. opacity: 0;
  204. }
  205. .contact-wrapper {
  206. display: flex;
  207. align-items: center;
  208. height: 80rpx;
  209. }
  210. .container {
  211. padding: 100rpx 20rpx 80rpx;
  212. }
  213. .goods-item {
  214. display: flex;
  215. margin-bottom: 40rpx;
  216. }
  217. .goods-item.current-live {
  218. background: rgb(254, 245, 247);
  219. }
  220. .item-left {
  221. width: 220rpx;
  222. height: 220rpx;
  223. overflow: hidden;
  224. position: relative;
  225. border-radius: 12rpx;
  226. margin-right: 16rpx;
  227. }
  228. .goods-img {
  229. width: 220rpx;
  230. height: 220rpx;
  231. border-radius: 12rpx;
  232. }
  233. .goods-sort {
  234. width: 48rpx;
  235. height: 36rpx;
  236. border-radius: 12rpx 0 8rpx 0;
  237. background: rgba(0, 0, 0, 0.6);
  238. color: #fff;
  239. font-size: 26rpx;
  240. line-height: 36rpx;
  241. text-align: center;
  242. position: absolute;
  243. top: 0;
  244. left: 0;
  245. }
  246. .goods-interpret {
  247. position: absolute;
  248. bottom: 0;
  249. left: 0;
  250. right: 0;
  251. height: 48rpx;
  252. background: linear-gradient(135deg, rgba(252, 78, 150, 0.7) 0%, rgba(250, 52, 96, 0.7) 100%);
  253. display: flex;
  254. align-items: center;
  255. justify-content: center;
  256. }
  257. .goods-interpret image {
  258. width: 36rpx;
  259. height: 30rpx;
  260. margin-right: 8rpx;
  261. }
  262. .goods-interpret text {
  263. color: #fff;
  264. font-size: 26rpx;
  265. }
  266. .soldout-mask {
  267. position: absolute;
  268. top: 0;
  269. left: 0;
  270. width: 220rpx;
  271. height: 220rpx;
  272. background: rgba(0, 0, 0, 0.48);
  273. color: #fff;
  274. font-size: 24rpx;
  275. text-align: center;
  276. border-radius: 12rpx;
  277. line-height: 220rpx;
  278. }
  279. .item-right {
  280. flex: 1;
  281. height: 220rpx;
  282. display: flex;
  283. flex-direction: column;
  284. justify-content: space-between;
  285. }
  286. .goods-name {
  287. color: #000;
  288. font-size: 28rpx;
  289. line-height: 40rpx;
  290. /* font-weight: bold; */
  291. }
  292. .shop-info {
  293. display: flex;
  294. height: 40rpx;
  295. align-items: center;
  296. }
  297. .shop-distance {
  298. padding-right: 10rpx;
  299. margin-right: 10rpx;
  300. border-right: 2rpx solid #ddd;
  301. font-size: 24rpx;
  302. color: #777;
  303. height: 24rpx;
  304. line-height: 24rpx;
  305. }
  306. .shop-tips {
  307. font-size: 24rpx;
  308. color: #777;
  309. line-height: 24rpx;
  310. }
  311. .refund-info {
  312. display: flex;
  313. align-items: center;
  314. height: 40rpx;
  315. justify-content: space-between;
  316. margin: 4rpx 0 8rpx;
  317. }
  318. .refund-text {
  319. background: #eee;
  320. border-radius: 4rpx;
  321. height: 40rpx;
  322. line-height: 40rpx;
  323. padding: 0 10rpx;
  324. font-size: 20rpx;
  325. color: #888;
  326. }
  327. .sale-num-out {
  328. font-size: 20rpx;
  329. color: #888;
  330. }
  331. .soldout-tag {
  332. height: 34rpx;
  333. width: 300rpx;
  334. padding-left: 12rpx;
  335. line-height: 34rpx;
  336. color: #fff;
  337. font-size: 18rpx;
  338. border-radius: 40rpx;
  339. background: linear-gradient(90deg, rgb(221, 165, 140) 0%, rgb(220, 100, 107) 50%, rgb(219, 33, 95) 100%);
  340. }
  341. .sale-num {
  342. text-align: right;
  343. font-size: 20rpx;
  344. color: #888;
  345. margin-bottom: 4rpx;
  346. }
  347. .item-bottom {
  348. display: flex;
  349. justify-content: space-between;
  350. height: 48rpx;
  351. align-items: flex-end;
  352. }
  353. .buy-btn {
  354. width: 140rpx;
  355. height: 48rpx;
  356. border-radius: 8rpx;
  357. text-align: center;
  358. line-height: 48rpx;
  359. color: #fff;
  360. font-size: 24rpx;
  361. background: linear-gradient(135deg, rgb(252, 78, 150) 0%, rgb(250, 52, 96) 100%);
  362. }
  363. .soldout-btn.buy-btn {
  364. opacity: 0.6;
  365. }
  366. .price-block {
  367. display: flex;
  368. align-items: center;
  369. height: 30rpx;
  370. }
  371. .whole-price {
  372. color: rgb(250, 49, 88);
  373. font-size: 26rpx;
  374. padding-bottom: 4rpx;
  375. }
  376. .whole-price text {
  377. font-weight: bold;
  378. font-size: 32rpx;
  379. }
  380. .single-price {
  381. color: #666;
  382. font-size: 26rpx;
  383. margin-left: 8rpx;
  384. }
  385. .hot-text {
  386. color: rgb(250, 49, 88);
  387. font-size: 20rpx;
  388. }
  389. .counter-price {
  390. color: rgb(250, 49, 88);
  391. font-size: 24rpx;
  392. margin: 0 4rpx;
  393. padding-bottom: 8rpx;
  394. }
  395. .counter-price text {
  396. font-size: 32rpx;
  397. font-weight: bold;
  398. }
  399. .retail-price {
  400. font-size: 24rpx;
  401. text-decoration: line-through;
  402. color: #999;
  403. }
  404. .goods-discount {
  405. margin-left: 8rpx;
  406. color: rgb(250, 49, 88);
  407. font-size: 18rpx;
  408. padding: 4rpx 8rpx;
  409. border-radius: 4rpx;
  410. background: rgb(254, 234, 238);
  411. }
  412. </style>