Task:多店铺选择

This commit is contained in:
linxi
2025-03-24 18:13:19 +08:00
parent a1182276a9
commit 85b1a8f0f1
4 changed files with 133 additions and 5 deletions
+6
View File
@@ -266,5 +266,11 @@ export function shareTown(id) {
return request.get("/ancientTown/poster/" + id, {login: true})
}
/**
* 获取用户店铺列表
*/
export function getMerchantApply() {
return request.get("/merchantApply/userHotels", {}, {login: true})
}
+2 -2
View File
@@ -1363,7 +1363,7 @@ export default {
},
// 点击加入购物车按钮
joinCart() {
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0 || storeInfo.isNegotiable === 1) {
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0 || this.storeInfo.isNegotiable === 1) {
return
}
// 0=加入购物车
@@ -1372,7 +1372,7 @@ export default {
},
// 立即购买
tapBuy() {
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0 || storeInfo.isNegotiable === 1) {
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0 || this.storeInfo.isNegotiable === 1) {
return
}
// 1=直接购买
+102
View File
@@ -0,0 +1,102 @@
<template>
<u-popup
:show="show"
@close="close"
@open="open"
mode="center"
closeable
round="10"
>
<view class="v12-pa-3 pop-content">
<view class="v12-dark-text v12-font-bold pop-title">请选择登录的店铺</view>
<view v-for="(item, index) in list" :key="index" class="home-wrap">
<view>
<u-avatar :src="item.logo"></u-avatar>
</view>
<view class="name-wrap one-t">{{ item.name }}</view>
<view class="enter-btn" @click="queryHome(index)">
点击进入{{ item.id }}
</view>
</view>
</view>
</u-popup>
</template>
<script>
export default {
data() {
return {
list: [],
show: false,
}
},
methods: {
queryHome(e) {
this.$nextTick(() => {
this.$emit('enter', this.list[e])
this.show = false
})
},
open(records) {
console.log(records);
if(!records) return;
this.show = true;
this.list = records && [...records] || []
},
close() {
this.show = false;
}
}
}
</script>
<style lang="less" scoped>
.home-wrap{
display: flex;
align-items: center;
justify-content: space-between;
background: #F6F6F6;
padding: 10rpx 20rpx;
border-radius: 20rpx;
margin-bottom: 10rpx;
}
.name-wrap{
width: 280rpx;
font-size: 30rpx;
font-weight: bold;
}
.enter-btn{
width: 118rpx;
height: 42rpx;
background: #0DC5C5;
border-radius: 22rpx;
padding: 2rpx 10rpx;
text-align: center;
line-height: 42rpx;
color: #fff;
font-size: 24rpx;
}
.pop-content{
width: 568rpx;
max-height: 860rpx;
background: rgba(255,255,255,0.39);
border-radius: 12rpx;
}
.pop-title{
position: relative;
width: fit-content;
margin-bottom: 20rpx;
}
.pop-title::after{
content: '';
position: absolute;
bottom: 0rpx;
left: 0;
width: 100%;
height: 5px;
background-color: #0DC5C5;
border-radius: 20rpx;
opacity: 0.5;
}
</style>
+23 -3
View File
@@ -401,6 +401,10 @@
<image :src="webUrl + '/page/hotel/edit.png'" class="img" />
修改资料
</view>
<view class="bottom-btn" @click="changeHome">
<image :src="webUrl + '/icon/qiehuan.png'" class="img" />
切换店铺
</view>
</view>
</view>
<goo-skeleton v-else />
@@ -431,6 +435,7 @@
/>
</view>
</u-popup>
<homeList ref="homeList" @enter="goHome"></homeList>
</view>
</template>
@@ -446,7 +451,8 @@ import {
setTopHotelNew,
getHotelNewsZan,
getHotelShareBackgroundImage,
hotelNewsView
hotelNewsView,
getMerchantApply
} from "@/api/inn.js"
import {formatDateTime} from "@/utils"
import {getUrlParam} from "@/utils/common.js"
@@ -454,14 +460,16 @@ import imgBox from '@/components/imageTypeSet/imagebox.vue'
import cookie from "@/utils/store/cookie"
import {addStore, removeStore} from "@/api/favorite"
import { pageListenMixins } from '@/mixins/pageListenMixins'
import homeList from "../components/jin-edit/homeList.vue"
export default {
components: {
imgBox
imgBox,
homeList
},
mixins: [pageListenMixins],
data() {
return {
homeList: [],
webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false,
activeIndex: 0,
@@ -588,6 +596,18 @@ export default {
this.fetchInnDetail()
},
methods: {
goHome(e) {
this.id = e.id
this.fetchInnDetail()
},
changeHome() {
uni.showLoading()
getMerchantApply().then(res => {
this.$refs.homeList.open(res.data || [])
}).finally(() => {
uni.hideLoading()
})
},
changeShare() {
this.showShare = !this.showShare
},