123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <view class="community">
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
- <view class="left">
- <view class="store-item" v-for="(item, index) in list" :key="index" @click="goGoodsDetail(item.goodsId)">
- <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
- <view class="info">
- <view class="title">
- {{ item.goodsName }}
- </view>
- <view class="user-info">
- <!-- <image class="head" :src="item.goodsPath"></image> -->
- <view class="user-name">
- {{ item.shopName }}
- </view>
- </view>
- <view class="price-box">
- <view class="left">
- <view class="unit">
- ¥
- </view>
- <view class="price">
- {{ item.realPrice }}
- </view>
- <view class="old-price">
- ¥{{ item.marketPrice }}
- </view>
- </view>
- <view class="right">
- {{ item.saleNum }}人已购
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="right">
- <view class="store-item" v-for="(item, index) in list1" :key="index" @click="goGoodsDetail(item.goodsId)">
- <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
- <view class="info">
- <view class="title">
- {{ item.goodsName }}
- </view>
- <view class="user-info">
- <!-- <image class="head" :src="item.goodsPath" mode=""></image> -->
- <view class="user-name">
- {{ item.shopName }}
- </view>
- </view>
- <view class="price-box">
- <view class="left">
- <view class="unit">
- ¥
- </view>
- <view class="price">
- {{ item.realPrice }}
- </view>
- <view class="old-price">
- ¥{{ item.marketPrice }}
- </view>
- </view>
- <view class="right">
- {{ item.saleNum }}人已购
- </view>
- </view>
- </view>
- </view>
- </view>
- </zs-list>
- </view>
- </template>
- <script>
- import { studyGoodsByUser } from '@/api/study.js';
- export default {
- data() {
- return {
- status: 'more',
- id: 0,
- list: [
- ],
- list1: [
- ],
- query: {
- columnId: 0,
- }
- }
- },
- methods: {
- loadMore() {
- this.studyGoodsByUser()
- },
- // 去商品详情
- goGoodsDetail(id) {
- uni.navigateTo({
- url: '/study/studyGoodsDetail?id=' + id
- })
- },
- studyGoodsByUser() {
- this.status = 'loading'
- studyGoodsByUser(this.query).then(res => {
- if (res.state == 'Success') {
- let list = []
- let list1 = []
- res.content.records.map((item, index) => {
- if (index % 2) {
- list1.push(item)
- } else {
- list.push(item)
- }
- })
- this.list = this.list.concat(list)
- this.list1 = this.list1.concat(list1)
- let total = this.list.length + this.list1.length
- if (total >= res.content.total) {
- this.status = 'noMore'
- } else {
- this.status = 'more'
- this.query.currentPage++
- }
- }
- })
- },
- },
- onLoad(options) {
- this.query.columnId = options.columnId
- // console.log(options.id);
- // this.id = options.id
- // this.getItem()
- }
- }
- </script>
- <style lang="scss">
- .community {
- background: #FFFFFF;
- padding: 20rpx;
- .zs-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .left {}
- .right {}
- .store-item {
- box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
- border-radius: 16rpx;
- width: 344rpx;
- height: 566rpx;
- margin-top: 20rpx;
- display: flex;
- flex-direction: column;
- .info {
- padding: 20rpx;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .title {
- color: #222222;
- font-size: 28rpx;
- height: 76rpx;
- width: 100%;
- font-weight: bold;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- /* 显示的最大行数 */
- overflow: hidden;
- }
- .user-info {
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- .head {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- }
- .user-name {
- color: #AAAAAA;
- font-size: 24rpx;
- overflow: hidden;
- // margin-left: 12rpx;
- }
- }
- .price-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 12rpx;
- .left {
- display: flex;
- align-items: flex-end;
- .unit {
- font-size: 24rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- .price {
- font-size: 32rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- .old-price {
- font-size: 20rpx;
- color: #AAAAAA;
- text-decoration: line-through;
- margin-left: 10rpx;
- }
- }
- .right {
- font-size: 20rpx;
- color: #AAAAAA;
- }
- }
- }
- }
- }
- }
- </style>
|