|
|
@ -37,11 +37,17 @@ |
|
|
<view class="hot-line"></view> |
|
|
<view class="hot-line"></view> |
|
|
<view class="search-box"> |
|
|
<view class="search-box"> |
|
|
<uni-icons type="search" size="16" color="#ff6735"></uni-icons> |
|
|
<uni-icons type="search" size="16" color="#ff6735"></uni-icons> |
|
|
<input type="text" placeholder="酸辣无骨凤爪" v-model="searchName" confirm-type="search" @confirm="goSearch" /> |
|
|
<input type="text" placeholder="想吃什么" v-model="searchName" confirm-type="search" @confirm="goSearch" /> |
|
|
<view class="search-btn" @tap="goSearch">搜索</view> |
|
|
<view class="search-btn" @tap="goSearch">搜索</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="sort-strip"> |
|
|
|
|
|
<view class="sort-item" :class="{'active': sortType === ''}" @tap="setSort('')">随机推荐</view> |
|
|
|
|
|
<view class="sort-item" :class="{'active': sortType === 'asc'}" @tap="setSort('asc')">价格升序</view> |
|
|
|
|
|
<view class="sort-item" :class="{'active': sortType === 'desc'}" @tap="setSort('desc')">价格降序</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="goods-list"> |
|
|
<view class="goods-list"> |
|
|
<view class="goods-card" v-for="(item,index) in currentList" :key="item.id" @tap="grabItem(item)"> |
|
|
<view class="goods-card" v-for="(item,index) in currentList" :key="item.id" @tap="grabItem(item)"> |
|
|
<view class="goods-img-wrap"> |
|
|
<view class="goods-img-wrap"> |
|
|
@ -54,7 +60,7 @@ |
|
|
<view class="sold-bar"> |
|
|
<view class="sold-bar"> |
|
|
<view class="sold-progress" :style="{width: item.progress + '%'}"></view> |
|
|
<view class="sold-progress" :style="{width: item.progress + '%'}"></view> |
|
|
</view> |
|
|
</view> |
|
|
<text>已售{{item.sold}}</text> |
|
|
<text>已售999+</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="coupon-row"> |
|
|
<view class="coupon-row"> |
|
|
<view class="coupon-tag" v-for="coupon in item.coupons" :key="coupon">{{coupon}}</view> |
|
|
<view class="coupon-tag" v-for="coupon in item.coupons" :key="coupon">{{coupon}}</view> |
|
|
@ -79,8 +85,8 @@ |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="coupon-float"> |
|
|
<view class="coupon-float"> |
|
|
<view class="coupon-icon">秒</view> |
|
|
<view class="coupon-icon">券</view> |
|
|
<view class="coupon-text">秒杀没有下次一定,只有现在立刻!</view> |
|
|
<view class="coupon-text">你有2元优惠券待使用 · 剩02:32:17</view> |
|
|
<image class="coupon-use" src="/static/images/img/loading.gif" mode="aspectFit"></image> |
|
|
<image class="coupon-use" src="/static/images/img/loading.gif" mode="aspectFit"></image> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
@ -136,7 +142,8 @@ |
|
|
pages: 1, |
|
|
pages: 1, |
|
|
loadStatus: 'more', |
|
|
loadStatus: 'more', |
|
|
currentItem: null, |
|
|
currentItem: null, |
|
|
parsedSpecs: [] |
|
|
parsedSpecs: [], |
|
|
|
|
|
sortType: '' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -206,6 +213,10 @@ |
|
|
pageNum: this.pageNum, |
|
|
pageNum: this.pageNum, |
|
|
pageSize: this.pageSize |
|
|
pageSize: this.pageSize |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.sortType) { |
|
|
|
|
|
data.sort = 'seckillPrice' |
|
|
|
|
|
data.order = this.sortType |
|
|
|
|
|
} |
|
|
this.tui.request("/app/seckillGroup/product/page", "POST", data, false, false).then((res) => { |
|
|
this.tui.request("/app/seckillGroup/product/page", "POST", data, false, false).then((res) => { |
|
|
this.loadStatus = 'nomore' |
|
|
this.loadStatus = 'nomore' |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
@ -241,10 +252,10 @@ |
|
|
sold: soldStock > 10000 ? (soldStock / 10000).toFixed(1).replace('.0', '') + '万+' : soldStock + '+', |
|
|
sold: soldStock > 10000 ? (soldStock / 10000).toFixed(1).replace('.0', '') + '万+' : soldStock + '+', |
|
|
progress: totalStock > 0 ? Math.min(100, Math.round(soldStock * 100 / totalStock)) : 0, |
|
|
progress: totalStock > 0 ? Math.min(100, Math.round(soldStock * 100 / totalStock)) : 0, |
|
|
coupons: ['秒杀价', '限时开抢', '库存' + (item.availableStock || 0)], |
|
|
coupons: ['秒杀价', '限时开抢', '库存' + (item.availableStock || 0)], |
|
|
price: seckillPrice.toFixed(1).replace('.0', ''), |
|
|
price: seckillPrice.toFixed(2), |
|
|
save: save.toFixed(1).replace('.0', ''), |
|
|
save: save.toFixed(2), |
|
|
seckillPrice: seckillPrice, |
|
|
seckillPrice: seckillPrice, |
|
|
originalPrice: originalPrice, |
|
|
originalPrice: originalPrice.toFixed(2), |
|
|
availableStock: item.availableStock || 0, |
|
|
availableStock: item.availableStock || 0, |
|
|
shopId: item.shopId, |
|
|
shopId: item.shopId, |
|
|
shopName: item.shopName, |
|
|
shopName: item.shopName, |
|
|
@ -285,6 +296,12 @@ |
|
|
this.resetProductList() |
|
|
this.resetProductList() |
|
|
this.getSeckillList() |
|
|
this.getSeckillList() |
|
|
}, |
|
|
}, |
|
|
|
|
|
setSort(type) { |
|
|
|
|
|
if (this.sortType === type) return |
|
|
|
|
|
this.sortType = type |
|
|
|
|
|
this.resetProductList() |
|
|
|
|
|
this.getSeckillList() |
|
|
|
|
|
}, |
|
|
grabItem(item) { |
|
|
grabItem(item) { |
|
|
if (!item || !item.productId) { |
|
|
if (!item || !item.productId) { |
|
|
this.tui.toast('商品信息异常') |
|
|
this.tui.toast('商品信息异常') |
|
|
@ -364,7 +381,7 @@ |
|
|
originalPrice: originalPrice.toFixed(2) |
|
|
originalPrice: originalPrice.toFixed(2) |
|
|
} |
|
|
} |
|
|
}), |
|
|
}), |
|
|
price: seckillPrice, |
|
|
price: originalPrice, |
|
|
seckillPrice: seckillPrice, |
|
|
seckillPrice: seckillPrice, |
|
|
originalPrice: originalPrice, |
|
|
originalPrice: originalPrice, |
|
|
lunchBox: 0, |
|
|
lunchBox: 0, |
|
|
@ -634,6 +651,32 @@ |
|
|
width: 22rpx; |
|
|
width: 22rpx; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.sort-strip { |
|
|
|
|
|
width: 95%; |
|
|
|
|
|
margin: 0 auto 12rpx; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.sort-item { |
|
|
|
|
|
height: 46rpx; |
|
|
|
|
|
padding: 0 20rpx; |
|
|
|
|
|
margin-right: 12rpx; |
|
|
|
|
|
border-radius: 999rpx; |
|
|
|
|
|
background: rgba(255, 255, 255, 0.72); |
|
|
|
|
|
color: #8a6b55; |
|
|
|
|
|
font-size: 22rpx; |
|
|
|
|
|
font-weight: 800; |
|
|
|
|
|
line-height: 46rpx; |
|
|
|
|
|
box-shadow: 0 8rpx 18rpx rgba(203, 99, 37, 0.08); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.sort-item.active { |
|
|
|
|
|
background: #fff0e9; |
|
|
|
|
|
color: #ff4b25; |
|
|
|
|
|
box-shadow: 0 10rpx 20rpx rgba(255, 92, 38, 0.15); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.goods-list { |
|
|
.goods-list { |
|
|
width: 95%; |
|
|
width: 95%; |
|
|
margin: 0 auto; |
|
|
margin: 0 auto; |
|
|
|