修改首页功能

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

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

View File

@ -262,12 +262,9 @@
isScanEntry: false
};
},
onLoad() {
onLoad(options) {
this.isScanEntry = false
console.log("🚀 ~ this.$Route.query:", this.$Route.query)
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)
console.log("🚀 ~ query:", query)
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.veryfiyDistributeFun()
},
methods: {
parseScanQuery(scene) {
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{
this.setCityInfo(city);
// 返回上一页
this.$Router.back(1, {
success: () => {
const {
onLoad,
options
} = currentPage()
// 刷新上一个页面
onLoad && onLoad({ ...options, refresh: true })
}
})
this.$Router.back(1)
console.log(city)
const historyList = this.historyList;
const result = historyList.filter(item => item.name == city.name);

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">

View File

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