123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <view class="main">
- <view class="list-box-h">
- <view v-for="(item, index) in list" :key="index" class="guess-item" @click="navToDetailPage(item)">
- <image :src="item.image"></image>
- <view class="guess-box">
- <view class="title clamp2">{{ item.store_name }}</view>
- <view class="flex itemContent">
- <view>
- <view v-if='vip!=1' class="price-box flex">
- <view class="yuanprice">{{ item.ot_price }}</view>
- <image src="../../static/img/jiantou.png" mode=""></image>
- <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view>
- </view>
- <view class="price" >¥{{ item.price }}</view>
- </view>
- <view class="btn">立即购买</view>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </view>
- </template>
- <script>
- import {
- getProducts
- } from '@/api/product.js';
- export default {
- data() {
- return {
- list: [],
- page: 1,
- limit: 10,
- loadingType: 'more',
- cid: 0,
- vip: 0
- }
- },
- onLoad(opt) {
- this.cid = opt.cid || ''
- this.tit = decodeURI(opt.tit)
- console.log(opt.tit, this.tit);
- uni.setNavigationBarTitle({
- title: this.tit
- })
- this.vip = +opt.vip || 0
- this.getArticleList()
- },
- methods: {
- navToDetailPage(item) {
- uni.navigateTo({
- url: '/pages/product/product?id=' + item.id
- });
- },
- getArticleList() {
- let obj = this
- if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
- return
- }
- obj.loadingType = 'loading'
- getProducts({
- page: obj.page,
- limit: obj.limit,
- can_up_level: this.vip //设置是否vip商品
- }, obj.cid).then(({
- data
- }) => {
- obj.list = obj.list.concat(data)
- obj.page++
- if (data.length == obj.limit) {
- obj.loadingType = 'more'
- } else {
- obj.loadingType = 'noMore'
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #fff;
- min-height: 100%;
- }
- .list-box-h {
- padding: 20rpx;
- }
- .guess-item {
- padding: 10rpx;
- display: flex;
- min-width: 100%;
- width: 0;
- margin-bottom: 20rpx;
- background: #ffffff;
- border-radius: 10rpx;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- image {
- width: 200rpx;
- height: 200rpx;
- border-radius: 10rpx;
- flex-shrink: 0;
- }
- .guess-box {
- width: 100%;
- padding: 5px;
- position: relative;
- .itemContent {
- position: absolute ;
- width: 100%;
- padding: 20rpx 10rpx;
- bottom: 0;
- right: 0;
- }
- .title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- height: 2.5em;
- line-height: 1.25em;
- }
- .price-box {
- justify-content: flex-start;
- .yuanprice {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- padding-right: 6rpx;
- }
- image {
- width: 14rpx;
- height: 16rpx;
- }
- .jiang {
- padding-left: 2rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #b59467;
- }
- }
- .price {
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF6F0F;
- }
- .btn {
- background: #16cc9f;
- border-radius: 28rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #ffffff;
- float: right;
- padding: 10rpx 20rpx;
- }
- }
- }
- </style>
|