修改首页功能

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

@ -94,4 +94,9 @@ export function apiOrderInvoiceDetail(params) {
// 获取城市下对应的店铺 // 获取城市下对应的店铺
export function getCityShops(params) { export function getCityShops(params) {
return request.get("shop/getShopCityInfo", { params }) return request.get("shop/getShopCityInfo", { params })
}
// 获取城市下对应的店铺分类
export function getCityGoodsCategory(params) {
return request.get("shop_goods_category/getCityGoodsCategory", { params })
} }

View File

@ -40,7 +40,7 @@
</view> </view>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapActions, mapGetters } from 'vuex'
import { getGoodsList } from '@/api/store' import { getGoodsList } from '@/api/store'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js' import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js'
@ -107,7 +107,8 @@ export default {
is_recommend: this.is_recommend == 1 ? 1 : '', is_recommend: this.is_recommend == 1 ? 1 : '',
sort_by_price: priceSort, sort_by_price: priceSort,
sort_by_sales: saleSort, sort_by_sales: saleSort,
keyword keyword,
city_id: (this.cityInfo && this.cityInfo.id) || 0,
}).then(({ data }) => { }).then(({ data }) => {
let curPageData = data.lists let curPageData = data.lists
let curPageLen = curPageData.length let curPageLen = curPageData.length
@ -119,7 +120,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['sysInfo']), ...mapGetters(['sysInfo', 'cityInfo']),
navHeight() { navHeight() {
return this.sysInfo.navHeight + 'px' return this.sysInfo.navHeight + 'px'
} }

View File

@ -262,12 +262,9 @@
isScanEntry: false isScanEntry: false
}; };
}, },
onLoad() { onLoad(options) {
this.isScanEntry = false this.isScanEntry = false
console.log("🚀 ~ this.$Route.query:", this.$Route.query)
if (this.$Route.query && this.$Route.query.scene) { if (this.$Route.query && this.$Route.query.scene) {
console.log("🚀 ~ this.$Route.query:", this.$Route.query.scene)
const query = this.parseScanQuery(this.$Route.query.scene) const query = this.parseScanQuery(this.$Route.query.scene)
console.log("🚀 ~ query:", query) console.log("🚀 ~ query:", query)
if (query.type == 1 || query.type == '1') { if (query.type == 1 || query.type == '1') {
@ -276,13 +273,16 @@
} }
} }
if (options && (options.type == 1 || options.type == '1')) {
this.isScanEntry = true
}
// 获取上级及个人信息 // 获取上级及个人信息
this.getSuperiorInfoFun() this.getSuperiorInfoFun()
// 判断是否是分销会员 // 判断是否是分销会员
this.veryfiyDistributeFun() this.veryfiyDistributeFun()
}, },
methods: { methods: {
parseScanQuery(scene) { parseScanQuery(scene) {
if (!scene || typeof scene !== 'string') return {} if (!scene || typeof scene !== 'string') return {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -130,16 +130,7 @@
try{ try{
this.setCityInfo(city); this.setCityInfo(city);
// 返回上一页 // 返回上一页
this.$Router.back(1, { this.$Router.back(1)
success: () => {
const {
onLoad,
options
} = currentPage()
// 刷新上一个页面
onLoad && onLoad({ ...options, refresh: true })
}
})
console.log(city) console.log(city)
const historyList = this.historyList; const historyList = this.historyList;
const result = historyList.filter(item => item.name == city.name); const result = historyList.filter(item => item.name == city.name);

View File

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

View File

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

View File

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

View File

@ -69,3 +69,4 @@ $u-bg-color: #f3f4f6;
$u-form-item-border-color: #dcdfe6; $u-form-item-border-color: #dcdfe6;
$u-form-item-height: 70rpx; $u-form-item-height: 70rpx;
$OSS: 'https://chaz.oss-cn-shanghai.aliyuncs.com/chazhi_shop/';