123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <template>
- <view>
- <view class="head-bar">
- <view class="page-title">鲸致生活</view>
- <view class="bar-right">
- <view class="order-block" @tap="goOrder">
- <image src="/static/images/icon-order.png" mode="aspectFit"></image>
- <view>订单</view>
- </view>
- <view class="kf-block" @tap="goIM">
- <!-- <button class="contact-btn" open-type="contact">客服</button> -->
- <view class="contact-wrapper">
- <image src="/static/images/online-new.png"></image>
- <view>客服</view>
- </view>
- </view>
- </view>
- </view>
- <view class="container">
- <view class="goods-list">
- <view :class="'goods-item ' + (item.isTop ? 'current-live' : '')" v-for="(item, index) in goodsList" :key="index">
- <view class="item-left">
- <image class="goods-img" :src="item.imgUrl + '?w=200'" mode="aspectFit"></image>
- <view class="goods-sort">{{ item.sort }}</view>
- <view class="goods-interpret" :tt-if="item.isTop">
- <image src="https://mall.zhaijieshi.cc/file/jzmall/storage/8ms4gt7xmd0z5ys0q83z.gif"></image>
- <text>讲解中</text>
- </view>
- <view class="soldout-mask" :tt-if="item.isSoldout">- 已抢光 -</view>
- </view>
- <view class="item-right">
- <view class="top-wrapper">
- <view class="goods-name">{{ item.name }}</view>
- <view class="shop-info">
- <view class="shop-distance">
- <!-- {{distance}}m -->
- <image src="/static/images/address.png" style="height: 12px; width: 12px"></image>
- </view>
- <view class="shop-tips">鲸致生活{{ item.shops }}家门店可用</view>
- </view>
- <view class="refund-info" :tt-if="item.isSoldout">
- <view class="refund-text">随时退·过期退</view>
- <view class="sale-num-out">已售{{ item.saleNum }}</view>
- </view>
- <view class="soldout-tag" :tt-if="item.isSoldout">商品已抢光</view>
- </view>
- <view class="bottom-wrapper">
- <view class="sale-num" :tt-if="!item.isSoldout">已售{{ item.saleNum }}</view>
- <view class="item-bottom">
- <view class="price-block">
- <block v-if="item.times > 1" class="">
- <view class="whole-price">
- ¥
- <text>{{ item.retailPrice }}</text>
- /{{ item.times }}次
- </view>
- <view class="single-price">单次¥160</view>
- </block>
- <block v-if="item.times == 1">
- <view v-if="item.isHot" class="hot-text">秒杀</view>
- <view class="counter-price">
- ¥
- <text>{{ item.retailPrice }}</text>
- </view>
- <view class="retail-price">¥{{ item.counterPrice }}</view>
- <view class="goods-discount">{{ item.discount }}折</view>
- </block>
- </view>
- <view class="buy-btn soldout-btn" :tt-if="item.isSoldout">已抢光</view>
- <view class="buy-btn" :data-id="item.id" @tap="goGoods" :tt-if="!item.isSoldout">去抢购</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- const app = getApp();
- export default {
- data() {
- return {
- talentId: '',
- //达人id
- updateTime: '',
- //数据最后更新时间
- goodsList: [],
- distance: parseInt(Math.random() * 500)
- };
- }
- /**
- * 生命周期函数--监听页面加载
- */,
- onLoad: function (options) {
- console.info(options);
- let talentId = options.talentId;
- if (talentId) {
- this.setData({
- talentId: talentId
- });
- this.getGoodsSnow();
- setInterval(() => {
- this.getGoodsSnow();
- }, 2000);
- } else {
- uni.showToast({
- title: '异常加载'
- });
- }
- },
- methods: {
- getGoodsSnow() {
- let that = this;
- util.request(
- api.GoodsSnow,
- {
- talentId: that.talentId,
- updateTime: that.updateTime
- },
- 'GET'
- ).then(function (res) {
- if (res.data.isModify) {
- that.setData({
- updateTime: res.data.updateTime,
- goodsList: res.data.list
- });
- }
- });
- },
- goGoods(e) {
- let goodsId = e.currentTarget.dataset.id;
- //console.info('/pages/goods/goods?id=' + goodsId + '&talentId=' + this.data.talentId)
- uni.navigateTo({
- url: '/pages/goods/goods?id=' + goodsId + '&talentId=' + this.talentId
- });
- },
- goOrder() {
- uni.navigateTo({
- url: '/pages/ucenter/order/order'
- });
- },
- goIM() {
- console.info('goIm');
- uni.navigateTo({
- url: '/pages/chat/im/im'
- });
- }
- }
- };
- </script>
- <style>
- .head-bar {
- height: 80rpx;
- position: fixed;
- left: 0;
- right: 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 36rpx 0 32rpx;
- background: #fff;
- z-index: 9;
- }
- .page-title {
- color: #000;
- font-size: 28rpx;
- }
- .bar-right {
- height: 80rpx;
- display: flex;
- align-items: center;
- }
- .bar-right image {
- width: 30rpx;
- height: 30rpx;
- margin-right: 8rpx;
- }
- .bar-right view {
- font-size: 24rpx;
- color: #666;
- }
- .order-block {
- display: flex;
- align-items: center;
- height: 80rpx;
- }
- .kf-block {
- margin-left: 40rpx;
- position: relative;
- height: 80rpx;
- }
- .contact-btn {
- height: 80rpx;
- width: 88rpx;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- z-index: 99;
- opacity: 0;
- }
- .contact-wrapper {
- display: flex;
- align-items: center;
- height: 80rpx;
- }
- .container {
- padding: 100rpx 20rpx 80rpx;
- }
- .goods-item {
- display: flex;
- margin-bottom: 40rpx;
- }
- .goods-item.current-live {
- background: rgb(254, 245, 247);
- }
- .item-left {
- width: 220rpx;
- height: 220rpx;
- overflow: hidden;
- position: relative;
- border-radius: 12rpx;
- margin-right: 16rpx;
- }
- .goods-img {
- width: 220rpx;
- height: 220rpx;
- border-radius: 12rpx;
- }
- .goods-sort {
- width: 48rpx;
- height: 36rpx;
- border-radius: 12rpx 0 8rpx 0;
- background: rgba(0, 0, 0, 0.6);
- color: #fff;
- font-size: 26rpx;
- line-height: 36rpx;
- text-align: center;
- position: absolute;
- top: 0;
- left: 0;
- }
- .goods-interpret {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- height: 48rpx;
- background: linear-gradient(135deg, rgba(252, 78, 150, 0.7) 0%, rgba(250, 52, 96, 0.7) 100%);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .goods-interpret image {
- width: 36rpx;
- height: 30rpx;
- margin-right: 8rpx;
- }
- .goods-interpret text {
- color: #fff;
- font-size: 26rpx;
- }
- .soldout-mask {
- position: absolute;
- top: 0;
- left: 0;
- width: 220rpx;
- height: 220rpx;
- background: rgba(0, 0, 0, 0.48);
- color: #fff;
- font-size: 24rpx;
- text-align: center;
- border-radius: 12rpx;
- line-height: 220rpx;
- }
- .item-right {
- flex: 1;
- height: 220rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .goods-name {
- color: #000;
- font-size: 28rpx;
- line-height: 40rpx;
- /* font-weight: bold; */
- }
- .shop-info {
- display: flex;
- height: 40rpx;
- align-items: center;
- }
- .shop-distance {
- padding-right: 10rpx;
- margin-right: 10rpx;
- border-right: 2rpx solid #ddd;
- font-size: 24rpx;
- color: #777;
- height: 24rpx;
- line-height: 24rpx;
- }
- .shop-tips {
- font-size: 24rpx;
- color: #777;
- line-height: 24rpx;
- }
- .refund-info {
- display: flex;
- align-items: center;
- height: 40rpx;
- justify-content: space-between;
- margin: 4rpx 0 8rpx;
- }
- .refund-text {
- background: #eee;
- border-radius: 4rpx;
- height: 40rpx;
- line-height: 40rpx;
- padding: 0 10rpx;
- font-size: 20rpx;
- color: #888;
- }
- .sale-num-out {
- font-size: 20rpx;
- color: #888;
- }
- .soldout-tag {
- height: 34rpx;
- width: 300rpx;
- padding-left: 12rpx;
- line-height: 34rpx;
- color: #fff;
- font-size: 18rpx;
- border-radius: 40rpx;
- background: linear-gradient(90deg, rgb(221, 165, 140) 0%, rgb(220, 100, 107) 50%, rgb(219, 33, 95) 100%);
- }
- .sale-num {
- text-align: right;
- font-size: 20rpx;
- color: #888;
- margin-bottom: 4rpx;
- }
- .item-bottom {
- display: flex;
- justify-content: space-between;
- height: 48rpx;
- align-items: flex-end;
- }
- .buy-btn {
- width: 140rpx;
- height: 48rpx;
- border-radius: 8rpx;
- text-align: center;
- line-height: 48rpx;
- color: #fff;
- font-size: 24rpx;
- background: linear-gradient(135deg, rgb(252, 78, 150) 0%, rgb(250, 52, 96) 100%);
- }
- .soldout-btn.buy-btn {
- opacity: 0.6;
- }
- .price-block {
- display: flex;
- align-items: center;
- height: 30rpx;
- }
- .whole-price {
- color: rgb(250, 49, 88);
- font-size: 26rpx;
- padding-bottom: 4rpx;
- }
- .whole-price text {
- font-weight: bold;
- font-size: 32rpx;
- }
- .single-price {
- color: #666;
- font-size: 26rpx;
- margin-left: 8rpx;
- }
- .hot-text {
- color: rgb(250, 49, 88);
- font-size: 20rpx;
- }
- .counter-price {
- color: rgb(250, 49, 88);
- font-size: 24rpx;
- margin: 0 4rpx;
- padding-bottom: 8rpx;
- }
- .counter-price text {
- font-size: 32rpx;
- font-weight: bold;
- }
- .retail-price {
- font-size: 24rpx;
- text-decoration: line-through;
- color: #999;
- }
- .goods-discount {
- margin-left: 8rpx;
- color: rgb(250, 49, 88);
- font-size: 18rpx;
- padding: 4rpx 8rpx;
- border-radius: 4rpx;
- background: rgb(254, 234, 238);
- }
- </style>
|