123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <view class="container">
- <JHeader title="商品列表" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
- <view v-if="goodsList.length > 0" class="listBox">
- <view
- v-for="(item, index) in goodsList" :key="index" class="goodsDetails-box flex-display flex-column"
- @click="goodsDateils(item.shopId, item.productId, item.skuId)"
- >
- <view v-if="item.activityType === 0" class="goodsDetails flex-items-plus flex-row">
- <image class="goodsImg default-img" :src="item.image"></image>
- <view class="mar-left-30">
- <view class="goodsName-box overflowNoDot">
- <label class="goodsName fs26">{{ item.productName }}</label>
- </view>
- <view class="usersBox">
- <label v-if="item.users != null" class="fs24 font-color-C5AA7B">{{ item.users }}人付款</label>
- <label v-else class="fs24 font-color-C5AA7B">0人付款</label>
- </view>
- <view class="priceBuyNum-box flex-items mar-top-20">
- <view>
- <label class="fs30 font-color-C83732">¥</label>
- <label class="fs36 font-color-C83732 mar-left-10">{{ item.price }}</label>
- </view>
- <view style="margin-left: 20upx; color: #CCCCCC;text-decoration:line-through">
- <label class="fs24">¥{{ item.originalPrice }}</label>
- </view>
- </view>
- <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
- <label class="fs22 font-color-FFEBC4">{{ item.shopName }}</label>
- </view>
- </view>
- </view>
- <view v-else class="spikeList goodsDetails">
- <view class="listItem">
- <view class="itemBox">
- <img :src="item.image" class="pic-img default-img">
- </view>
- <view class="itemInfo mar-top-30">
- <p>{{ item.productName }}</p>
- <view v-if="item.users != null" class="number">
- <view class="numText">{{ item.users }}人付款</view>
- </view>
- <view class="flex-row-plus flex-item mar-top-30">
- <ATFActivityImage :type="item.activityType"></ATFActivityImage>
- <view class="font-color-C83732 flex-row-plus">
- <b>¥</b>
- <label class="fs28">{{ item.price }}</label>
- </view>
- <view class="mar-left-30 discountsPriceLine font-color-999">¥{{ item.originalPrice }}</view>
- </view>
- <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
- <label class="fs22 font-color-FFEBC4">{{ item.shopName }}</label>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 搜索为空 -->
- <view style="padding-bottom: 45upx;">
- <LoadingMore
- :status="!isEmpty && !goodsList.length
- ? 'loading' : !isEmpty && goodsList.length && (goodsList.length >= goodsTotal) ? 'no-more' : ''"
- >
- </LoadingMore>
- <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
- </view>
- </view>
- </template>
- <script>
- import { getProducts2CanvasApi } from '../../../api/anotherTFInterface'
- export default {
- name: 'CanvasGoods',
- data() {
- return {
- isEmpty: false,
- goodsList: [],
- goodsTotal: 0,
- queryInfo: {
- page: 1,
- pageSize: 20,
- ids: [],
- classifyId: 0
- },
- source: 2,
- sourceType: ''
- }
- },
- onLoad(option) {
- if (option.sourceType) {
- this.sourceType = option.sourceType
- if (option.sourceType === '1') {
- this.queryInfo.ids = option.ids
- } else if (option.sourceType === '2') {
- this.queryInfo.classifyId = option.classifyId
- }
- }
- this.searchList()
- },
- methods: {
- searchList(isLoadmore) {
- var params = {
- page: this.queryInfo.page,
- pageSize: this.queryInfo.pageSize
- }
- if (this.sourceType === '1') {
- if (this.queryInfo.ids && this.queryInfo.ids.length > 0) {
- params.ids = this.queryInfo.ids
- }
- } else if (this.sourceType === '2') {
- if (this.queryInfo.classifyId) {
- params.classifyId = this.queryInfo.classifyId
- }
- }
- if (params.ids || params.classifyId) {
- uni.showLoading()
- getProducts2CanvasApi(params).then((res) => {
- this.goodsTotal = res.data.total
- if (isLoadmore) {
- this.goodsList.push(...res.data.list)
- } else {
- this.goodsList = res.data.list
- }
- this.isEmpty = this.goodsList.length === 0
- uni.hideLoading()
- })
- .catch((e) => {
- uni.hideLoading()
- })
- }
- },
- // 商品详情
- goodsDateils(shopId, productId, skuId) {
- uni.navigateTo({
- url: '/another-tf/another-serve/goodsDetails/index?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
- })
- }
- },
- onReachBottom() {
- if (this.goodsList.length < this.goodsTotal) {
- ++this.queryInfo.page
- this.searchList(true)
- }
- }
- }
- </script>
- <style lang="less" scoped>
- input {
- padding-left: 80upx;
- }
- .container {
- background-color: #f8f8f8;
- min-height: 100vh;
- box-sizing: border-box;
- .goodsDetails-box {
- background: #FFFFFF;
- margin-top: 20rpx;
- box-sizing: border-box;
- .goodsDetails {
- border-bottom: 1upx solid #EDEDED;
- padding-top: 30rpx;
- padding-bottom: 30upx;
- position: relative;
- .goodsName-box {
- width: 389upx;
- height: 85upx;
- }
- .shopName {
- position: absolute;
- left: 0;
- top: 0;
- height: 50rpx;
- background: #333333;
- opacity: 1;
- border-radius: 0 20rpx 20rpx 0;
- padding: 10rpx 15rpx;
- }
- .goodsImg {
- width: 260upx;
- height: 260upx;
- }
- }
- }
- .spikeList {
- padding-top: 30rpx;
- border-bottom: 1upx solid #EDEDED;
- .listItem {
- display: flex;
- // padding-bottom: 10upx;
- border-bottom: 1upx solid #EEEEEE;
- margin-bottom: 30upx;
- &:last-child {
- border-bottom: none;
- }
- .itemBox {
- width: 260upx;
- height: 260upx;
- margin-right: 30upx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .itemInfo {
- flex: 1;
- p {
- font-size: 26upx;
- color: #333333;
- line-height: 40upx;
- margin-bottom: 20upx;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .number {
- color: #999999;
- font-size: 26upx;
- display: flex;
- align-items: center;
- .numText {
- padding: 0 10rpx;
- height: 40rpx;
- line-height: 40rpx;
- border: 2rpx solid #E4E5E6;
- color: #C5AA7B;
- font-size: 20rpx;
- margin-right: 10rpx;
- }
- }
- }
- }
- }
- .listBox {
- padding: 0 24rpx;
- box-sizing: border-box;
- .usersBox {
- margin-top: 20rpx;
- label {
- padding: 10rpx;
- border: 2rpx solid #E4E5E6;
- }
- }
- }
- }
- </style>
|