Style(店铺):商品列表接口对接
This commit is contained in:
@@ -461,6 +461,12 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "inn/innGoodList",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "店铺商品列表"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "inn/innApply",
|
"path": "inn/innApply",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view v-if="isLoad">
|
||||||
|
<view class="goods-section flex flex-wrap">
|
||||||
|
<view
|
||||||
|
v-for="(item,index) in goodsList"
|
||||||
|
:key="index"
|
||||||
|
class="item"
|
||||||
|
@click="goGoodsConByID(item)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="item.image"
|
||||||
|
class="cover"
|
||||||
|
/>
|
||||||
|
<view class="">
|
||||||
|
<view class="name more-t">{{ item.storeName }}</view>
|
||||||
|
<view class="price-line flex ai-center">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/20221118104357701129.png'"
|
||||||
|
class="label"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text>¥{{ item.price }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sales-line flex ai-center">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/20221118092713277343.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text>{{ item.sales }}人已购买</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<goo-skeleton v-else />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getHotelGoodList
|
||||||
|
} from "@/api/inn.js";
|
||||||
|
import {formatDateTime} from "@/utils";
|
||||||
|
import {getUrlParam} from "@/utils/common.js";
|
||||||
|
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
||||||
|
import cookie from "@/utils/store/cookie";
|
||||||
|
import {addStore, removeStore} from "@/api/favorite";
|
||||||
|
import GooSkeleton from '@/components/GooSkeleton/index.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
imgBox,
|
||||||
|
GooSkeleton
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
|
isLoad: false,
|
||||||
|
page: 1,
|
||||||
|
goodsList: [],
|
||||||
|
id: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
if (options.id) {
|
||||||
|
this.id = options.id || null;
|
||||||
|
this.fetchGoods()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goGoodsConByID(item) {
|
||||||
|
this.$yrouter.push({
|
||||||
|
path: '/pages/shop/GoodsCon/index',
|
||||||
|
query: {
|
||||||
|
id: item.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fetchGoods() {
|
||||||
|
getHotelGoodList({
|
||||||
|
id: this.id,
|
||||||
|
page: this.page,
|
||||||
|
limit: 10
|
||||||
|
}).then(res => {
|
||||||
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
this.isLoad = true
|
||||||
|
const len = data.records.length
|
||||||
|
if (len > 0) {
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
this.goodsList.push(data.records[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="less">
|
||||||
|
@import "@/assets/css/store.less";
|
||||||
|
.goods-section {
|
||||||
|
padding: 40rpx 32rpx 0;
|
||||||
|
background: #F5F5FA;
|
||||||
|
.item {
|
||||||
|
position: relative;
|
||||||
|
width: 332rpx;
|
||||||
|
height: 528rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-right: 22rpx;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
background: #fff;
|
||||||
|
.name {
|
||||||
|
padding: 8rpx 6rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.price-line {
|
||||||
|
padding: 0 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 38rpx;
|
||||||
|
color: #ED0F0F;
|
||||||
|
}
|
||||||
|
.sales-line {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
padding: 8rpx 10rpx 18rpx;
|
||||||
|
border-top: 1rpx solid #EFEFEF;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
color: #8D8D8D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item:nth-child(2n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.cover {
|
||||||
|
width: 332rpx;
|
||||||
|
height: 332rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.39);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.label {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-right: 4rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
background: #FFFFFF;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -182,6 +182,9 @@
|
|||||||
<text>{{ item.sales }}人已购买</text>
|
<text>{{ item.sales }}人已购买</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="btn" @click="viewAllGoodHandle">
|
||||||
|
查看所有商品
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 最新资讯 -->
|
<!-- 最新资讯 -->
|
||||||
<view
|
<view
|
||||||
@@ -760,11 +763,14 @@ export default {
|
|||||||
id: this.inn.id,
|
id: this.inn.id,
|
||||||
page: this.goodsPage,
|
page: this.goodsPage,
|
||||||
limit: 12
|
limit: 12
|
||||||
}).then(data => {
|
}).then(res => {
|
||||||
const len = data.records.length;
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
const len = data.records.length
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
this.goodsList.push(data.records[i]);
|
this.goodsList.push(data.records[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -804,6 +810,11 @@ export default {
|
|||||||
},
|
},
|
||||||
toggleMoreHandle(index) {
|
toggleMoreHandle(index) {
|
||||||
this.$set(this.infoArray[index], 'showMore', !this.infoArray[index].showMore)
|
this.$set(this.infoArray[index], 'showMore', !this.infoArray[index].showMore)
|
||||||
|
},
|
||||||
|
viewAllGoodHandle() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesInn/inn/innGoodList?id=' + this.inn.id,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user