修改首页功能

This commit is contained in:
wangxiaowei
2026-04-23 10:41:27 +08:00
parent 7f8f15b809
commit a3edea96af
10 changed files with 45 additions and 37 deletions

View File

@ -61,7 +61,7 @@
<script>
import { mapGetters, mapActions } from 'vuex'
import { getShopGoodsCategory } from '@/api/shop'
import { getShopGoodsCategory, getCityGoodsCategory } from '@/api/shop'
import { getGoodsList } from '@/api/store'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js'
@ -99,14 +99,15 @@
...mapActions(['getCartNum']),
onCityChange() {
console.log("🚀 ~ methods.onCityChange:", 'onCityChange')
this.active = -1
this.goodsList = []
this.getShopGoodsCategoryFun()
this.mescroll.resetUpScroll()
},
async getShopGoodsCategoryFun() {
const { data, code } = await getShopGoodsCategory({
shop_id: this.shopId
const { data, code } = await getCityGoodsCategory({
city_id: (this.cityInfo && this.cityInfo.id) || 0,
})
if (code == 1) {
this.category = data
@ -126,7 +127,8 @@
page_size: pageSize,
page_no: pageNum,
shop_id: this.shopId,
shop_cate_id: cateId
shop_cate_id: cateId,
city_id: (this.cityInfo && this.cityInfo.id) || 0,
}).then(({ data }) => {
let curPageData = data.lists
let curPageLen = curPageData.length

View File

@ -32,14 +32,14 @@
>
<view class="flex-1 flex">
<!-- 城市 -->
<router-link
<!-- <router-link
v-if="appConfig.is_open_nearby"
class="m-l-16 flex white row-center flex-none"
to="/bundle_b/pages/city/city"
>
<text class="m-r-6">{{ cityInfo.name || '选择' }}</text>
<u-icon name="arrow-down" size="24" color="#FFFFFF"></u-icon>
</router-link>
</router-link> -->
<view class="store-search flex-1" @click="handleSerach">
<u-search
v-model="keyword"
@ -87,16 +87,16 @@
</view>
</view>
</view>
<view
<!-- <view
class="flex row-center white br60 sm flex-none subscribe-btn"
:class="{ gray: shopInfo.shop_follow_status === 1 }"
@tap="changeShopFollowFun"
>
{{ shopInfo.shop_follow_status === 1 ? '已关注' : '+ 关注' }}
</view>
</view> -->
</view>
<view class="p-t-20 p-b-20">
<u-tabs
<!-- <u-tabs
:current="tabcurrent"
:list="[{ name: '精选' }, { name: '商品' }, { name: '领券' }]"
:is-scroll="false"
@ -104,6 +104,15 @@
bg-color="transparent"
active-color="white"
inactive-color="white"
></u-tabs> -->
<u-tabs
:current="tabcurrent"
:list="[{ name: '精选' }, { name: '商品' }]"
:is-scroll="false"
@change="tabChange"
bg-color="transparent"
active-color="white"
inactive-color="white"
></u-tabs>
</view>
</view>
@ -214,7 +223,7 @@
<script>
import { mapActions, mapGetters } from 'vuex'
import { getShopInfo, getShopGoodsCategory, changeShopFollow, getCityShops } from '@/api/shop'
import { getShopInfo, getShopGoodsCategory, changeShopFollow, getCityShops, getCityGoodsCategory } from '@/api/shop'
import { getShopLive } from '@/api/live'
import { getGoodsList } from '@/api/store'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js'
@ -263,6 +272,7 @@ export default {
this.sys = uni.getSystemInfoSync()
await this.getShopInfoFun()
await this.getShopGoodsCategoryFun()
this.getCurrentCity()
// #ifdef MP-WEIXIN
this.getShopLiveFun()
// #endif
@ -275,7 +285,6 @@ export default {
// #endif
},
onShow() {
this.getCurrentCity()
// #ifdef H5
this.enableFix = true
// #endif
@ -351,8 +360,7 @@ export default {
}
},
async getShopGoodsCategoryFun() {
const { data, code } = await getShopGoodsCategory({
shop_id: this.id,
const { data, code } = await getCityGoodsCategory({
city_id: (this.cityInfo && this.cityInfo.id) || 0
})
if (code == 1) {

View File

@ -36,7 +36,7 @@
{{ shopInfo.name }}
</view>
</view>
<view
<!-- <view
class="column white br60 sm flex-none subscribe-btn m-t-20"
:class="{ gray: shopInfo.shop_follow_status === 1 }"
@tap="changeShopFollowFun"
@ -45,7 +45,7 @@
{{ shopInfo.shop_follow_status === 1 ? '已关注' : '关注' }}
</view>
<view class="xxs m-t-5"> {{ shopInfo.follow_num }}人关注 </view>
</view>
</view> -->
</view>
</view>
<view class="store-header bg-white">
@ -63,18 +63,18 @@
src="../../static/images/Certificate.png"
></image>
</view>
<router-link
<!-- <router-link
:to="{ path: '/bundle/pages/chat/chat', query: { shop_id: shopInfo.id } }"
>
<view class="store-row flex row-between">
<view class="">联系客服</view>
<view class="">联系客服</view> -->
<!-- <u-icon name="arrow-right" /> -->
<image
<!-- <image
style="height: 40rpx; width: 40rpx"
src="../../static/images/service.png"
></image>
</view>
</router-link>
</router-link> -->
</view>
<view class="store-header m-t-20 bg-white">
<view class="store-row flex row-between" @click="showPopup = true">