店铺列表和店铺详情分页功能添加
This commit is contained in:
@@ -22,11 +22,12 @@ const goods = id => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 店铺列表
|
// 店铺列表
|
||||||
const shops = (categoryId) => {
|
const shops = (categoryId,page) => {
|
||||||
return request({
|
return request({
|
||||||
url: 'mall/shops',
|
url: 'mall/shops',
|
||||||
data: {
|
data: {
|
||||||
category_id: categoryId
|
category_id: categoryId,
|
||||||
|
page:page
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -39,12 +40,13 @@ const shopsDetail = (shopId) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 店铺商品
|
// 店铺商品
|
||||||
const shopsGoods = (shop_id, category_id) => {
|
const shopsGoods = (shop_id, category_id,page) => {
|
||||||
return request({
|
return request({
|
||||||
url: 'mall/goods',
|
url: 'mall/goods',
|
||||||
data: {
|
data: {
|
||||||
shop_id,
|
shop_id,
|
||||||
category_id
|
category_id,
|
||||||
|
page,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<scroll-view scroll-y="true" class="scroll-view-right">
|
<scroll-view scroll-y="true" class="scroll-view-right" @scrolltolower='lower'>
|
||||||
<block v-if="goods.length > 0">
|
<block v-if="goods.length > 0">
|
||||||
<view class="goods-item" v-for="(item,index) in goods" :key="index"
|
<view class="goods-item" v-for="(item,index) in goods" :key="index"
|
||||||
@click="onGoods(item.goods_id)">
|
@click="onGoods(item.goods_id)">
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<view class="price">{{item.price.price_min || '0'}}
|
<view class="price">{{item.price.price_min || '0'}}
|
||||||
<view class="price-type">
|
<view class="price-type">
|
||||||
<text> DT积分</text>
|
<text> DT积分</text>
|
||||||
<text class="kucun"> 库存量:1222</text>
|
<text class="kucun"> 库存量:{{item.stock}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -70,12 +70,14 @@
|
|||||||
category_id : '',
|
category_id : '',
|
||||||
classify : [],
|
classify : [],
|
||||||
goods : [],
|
goods : [],
|
||||||
pages : {}
|
has_more:true,
|
||||||
|
page:1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.ShopId = this.$Route.query.ShopId
|
this.ShopId = this.$Route.query.ShopId
|
||||||
shopsDetail(this.ShopId).then(res => {
|
shopsDetail(this.ShopId).then(res => {
|
||||||
|
console.log(res);
|
||||||
this.classify = [{
|
this.classify = [{
|
||||||
category_id: '',
|
category_id: '',
|
||||||
name: '全部商品',
|
name: '全部商品',
|
||||||
@@ -90,14 +92,19 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.has_more = true;
|
||||||
|
this.page = 1;
|
||||||
|
this.getGoods()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getGoods() {
|
getGoods() {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
})
|
})
|
||||||
shopsGoods(this.ShopId, this.category_id).then(res => {
|
shopsGoods(this.ShopId, this.category_id,this.page).then(res => {
|
||||||
this.goods = res.data
|
this.goods = this.goods.concat(res.data);
|
||||||
this.pages = res.page
|
this.has_more = res.page.has_more;
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -106,9 +113,19 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
lower(){
|
||||||
|
if(this.has_more){
|
||||||
|
this.page = this.page + 1;
|
||||||
|
this.has_more = true;
|
||||||
|
this.getGoods()
|
||||||
|
}
|
||||||
|
},
|
||||||
selectClassify(id) {
|
selectClassify(id) {
|
||||||
if (id === this.category_id) return;
|
if (id === this.category_id) return;
|
||||||
this.category_id = id;
|
this.category_id = id;
|
||||||
|
this.page = 1;
|
||||||
|
this.goods =[];
|
||||||
|
this.has_more = true;
|
||||||
this.getGoods()
|
this.getGoods()
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
|
|||||||
@@ -5,30 +5,28 @@
|
|||||||
<u-tabs :list="classify" lineColor="#34CE98" @click="onTabs" />
|
<u-tabs :list="classify" lineColor="#34CE98" @click="onTabs" />
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<!-- 店铺列表 -->
|
<!-- 店铺列表 -->
|
||||||
<block v-if="shopsArr.length > 0">
|
<block v-if="shopsArr.length > 0">
|
||||||
<view class="shop-List">
|
<view class="shop-List">
|
||||||
<view class="shopInfo" v-for="(item,index) in shopsArr" :key="index" @click="toShop(item.shop_id)">
|
<view class="shopInfo" v-for="(item,index) in shopsArr" :key="index" @click="toShop(item.shop_id)">
|
||||||
<view class="shopInfo-title-left">
|
<view class="shopInfo-title-left">
|
||||||
<image class="shop-logo" :src="item.cover" mode="aspectFill" />
|
<image class="shop-logo" :src="item.cover" mode="aspectFill" />
|
||||||
<view class="shop-title">
|
<view class="shop-title">
|
||||||
<view class="shop-titl nowrap">{{item.name}}</view>
|
<view class="shop-titl nowrap">{{item.name}}</view>
|
||||||
<view>店铺评分:<span>5.0</span></view>
|
<view>店铺评分:<span>5.0</span></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="shopInfo-title-right" >在售{{item.goods_count}}件<uni-icons class="icons" type="right" size="14" color="grey" /></view>
|
<view class="shopInfo-title-right">在售{{item.goods_count}}件
|
||||||
</view>
|
<uni-icons class="icons" type="right" size="14" color="grey" />
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</view>
|
||||||
<block v-else>
|
</view>
|
||||||
<view class="vertical pages-empty">
|
</block>
|
||||||
<u-empty
|
<block v-else>
|
||||||
icon="http://cdn.uviewui.com/uview/empty/list.png"
|
<view class="vertical pages-empty">
|
||||||
textColor="#999"
|
<u-empty icon="http://cdn.uviewui.com/uview/empty/list.png" textColor="#999" text="暂无相关店铺">
|
||||||
text="暂无相关店铺"
|
</u-empty>
|
||||||
>
|
</view>
|
||||||
</u-empty>
|
</block>
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -39,29 +37,42 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
shopsArr : [],
|
shopsArr: [],
|
||||||
classify : [],
|
classify: [],
|
||||||
shopsPage: {},
|
// shopsPage: {},
|
||||||
|
page: 1,
|
||||||
|
has_more: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getShops()
|
this.getShops()
|
||||||
},
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.has_more) {
|
||||||
|
this.page = this.page + 1;
|
||||||
|
this.getShops();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getShops() {
|
getShops() {
|
||||||
shops(this.categoryId).then(res => {
|
shops(this.categoryId, this.page).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
this.shopsArr = res.shops.data
|
if (this.page == 1) {
|
||||||
this.shopsPage= res.shops.page
|
this.shopsArr = [];
|
||||||
this.classify = [{
|
this.classify = [{
|
||||||
name: "全部",
|
name: "全部",
|
||||||
category_id: ""
|
category_id: ""
|
||||||
}].concat(res.categories)
|
}].concat(res.categories)
|
||||||
|
}
|
||||||
|
this.shopsArr = this.shopsArr.concat(res.shops.data);
|
||||||
|
this.has_more = res.shops.page.has_more;
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onTabs(e) {
|
onTabs(e) {
|
||||||
this.categoryId = e.category_id
|
this.categoryId = e.category_id
|
||||||
|
this.page = 1;
|
||||||
|
this.has_more = true;
|
||||||
this.getShops()
|
this.getShops()
|
||||||
},
|
},
|
||||||
toShop(id) {
|
toShop(id) {
|
||||||
@@ -74,95 +85,110 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.getShops()
|
this.category_id = '';
|
||||||
|
this.page = 1;
|
||||||
|
this.has_more = true;
|
||||||
|
this.getShops();
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pages-empty{
|
.pages-empty {
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
background: $window-color;
|
background: $window-color;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 筛选
|
// 筛选
|
||||||
.classify-tabs {
|
.classify-tabs {
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
.shop-List{
|
|
||||||
padding: $padding;
|
.shop-List {
|
||||||
.shopInfo {
|
padding: $padding;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
.shopInfo {
|
||||||
align-items: center;
|
display: flex;
|
||||||
box-sizing: border-box;
|
flex-direction: row;
|
||||||
width: 100%;
|
align-items: center;
|
||||||
padding: $padding - 10;
|
box-sizing: border-box;
|
||||||
background-color: #fff;
|
width: 100%;
|
||||||
border-radius: $radius;
|
padding: $padding - 10;
|
||||||
margin-top: 20rpx;
|
background-color: #fff;
|
||||||
&:first-child{
|
border-radius: $radius;
|
||||||
margin-top: 0;
|
margin-top: 20rpx;
|
||||||
}
|
|
||||||
.shopInfo-title-left {
|
&:first-child {
|
||||||
width: 60%;
|
margin-top: 0;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
.shopInfo-title-left {
|
||||||
justify-content: flex-start;
|
width: 60%;
|
||||||
box-sizing: border-box;
|
display: flex;
|
||||||
position: relative;
|
flex-direction: row;
|
||||||
padding-left: 90rpx;
|
align-items: center;
|
||||||
min-height: 90rpx;
|
justify-content: flex-start;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
.shop-logo {
|
position: relative;
|
||||||
position: absolute;
|
padding-left: 90rpx;
|
||||||
left: 0;
|
min-height: 90rpx;
|
||||||
top: 0;
|
box-sizing: border-box;
|
||||||
width: 90rpx;
|
|
||||||
height: 90rpx;
|
.shop-logo {
|
||||||
border-radius: 10rpx;
|
position: absolute;
|
||||||
border: solid 1rpx #f9f9f9;
|
left: 0;
|
||||||
}
|
top: 0;
|
||||||
.shop-title {
|
width: 90rpx;
|
||||||
display: flex;
|
height: 90rpx;
|
||||||
flex-direction: column;
|
border-radius: 10rpx;
|
||||||
align-items: flex-start;
|
border: solid 1rpx #f9f9f9;
|
||||||
justify-content: flex-start;
|
}
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: 26rpx;
|
.shop-title {
|
||||||
margin-left: $margin;
|
display: flex;
|
||||||
color: #999;
|
flex-direction: column;
|
||||||
width: 100%;
|
align-items: flex-start;
|
||||||
span {
|
justify-content: flex-start;
|
||||||
color: $text-price;
|
box-sizing: border-box;
|
||||||
padding-left: 4rpx;
|
font-size: 26rpx;
|
||||||
}
|
margin-left: $margin;
|
||||||
.shop-titl {
|
color: #999;
|
||||||
font-size: 32rpx;
|
width: 100%;
|
||||||
color: #333;
|
|
||||||
font-weight: bold;
|
span {
|
||||||
margin-bottom: 6rpx;
|
color: $text-price;
|
||||||
overflow: hidden;
|
padding-left: 4rpx;
|
||||||
white-space: nowrap;
|
}
|
||||||
text-overflow: ellipsis;
|
|
||||||
width: 100%;
|
.shop-titl {
|
||||||
}
|
font-size: 32rpx;
|
||||||
}
|
color: #333;
|
||||||
}
|
font-weight: bold;
|
||||||
.shopInfo-title-right {
|
margin-bottom: 6rpx;
|
||||||
width: 40%;
|
overflow: hidden;
|
||||||
text-align: right;
|
white-space: nowrap;
|
||||||
font-size: 26rpx;
|
text-overflow: ellipsis;
|
||||||
color: gray;
|
width: 100%;
|
||||||
.icons{
|
}
|
||||||
vertical-align: bottom;
|
}
|
||||||
margin-top: 2rpx;
|
}
|
||||||
}
|
|
||||||
}
|
.shopInfo-title-right {
|
||||||
}
|
width: 40%;
|
||||||
}
|
text-align: right;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: gray;
|
||||||
|
|
||||||
|
.icons {
|
||||||
|
vertical-align: bottom;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
BIN
static/.DS_Store
vendored
BIN
static/.DS_Store
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/__uniappscan.js
vendored
2
unpackage/dist/dev/app-plus/__uniappscan.js
vendored
File diff suppressed because one or more lines are too long
1339
unpackage/dist/dev/app-plus/app-service.js
vendored
1339
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
14
unpackage/dist/dev/app-plus/app-view.js
vendored
14
unpackage/dist/dev/app-plus/app-view.js
vendored
@@ -20376,7 +20376,12 @@ var render = function() {
|
|||||||
"v-uni-scroll-view",
|
"v-uni-scroll-view",
|
||||||
{
|
{
|
||||||
staticClass: _vm._$g(19, "sc"),
|
staticClass: _vm._$g(19, "sc"),
|
||||||
attrs: { "scroll-y": "true", _i: 19 }
|
attrs: { "scroll-y": "true", _i: 19 },
|
||||||
|
on: {
|
||||||
|
scrolltolower: function($event) {
|
||||||
|
return _vm.$handleViewEvent($event)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
_vm._$g(20, "i")
|
_vm._$g(20, "i")
|
||||||
@@ -20454,7 +20459,12 @@ var render = function() {
|
|||||||
),
|
),
|
||||||
attrs: { _i: "29-" + $31 }
|
attrs: { _i: "29-" + $31 }
|
||||||
},
|
},
|
||||||
[_vm._v("库存量:1222")]
|
[
|
||||||
|
_vm._v(
|
||||||
|
"库存量:" +
|
||||||
|
_vm._$g("29-" + $31, "t0-0")
|
||||||
|
)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
1
|
1
|
||||||
|
|||||||
BIN
unpackage/dist/dev/app-plus/static/.DS_Store
vendored
BIN
unpackage/dist/dev/app-plus/static/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB |
2
unpackage/dist/dev/app-plus/view.css
vendored
2
unpackage/dist/dev/app-plus/view.css
vendored
File diff suppressed because one or more lines are too long
6
unpackage/dist/dev/app-plus/view.umd.min.js
vendored
6
unpackage/dist/dev/app-plus/view.umd.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user