12312
This commit is contained in:
+30
-81
@@ -1,42 +1,32 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 自定义导航栏 -->
|
||||
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||
<view class="nav-header">
|
||||
<view class="nav-back" @click="goBack">
|
||||
<text class="back-icon"></text>
|
||||
</view>
|
||||
<text class="nav-title">门店详情</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="page" v-if="store">
|
||||
<!-- 门店信息卡片 -->
|
||||
<view class="store-card">
|
||||
<image class="store-img" :src="store.image" mode="aspectFill" />
|
||||
<view class="store-info">
|
||||
<text class="store-name">{{ store.name }}</text>
|
||||
<text class="store-category">{{ store.category }}</text>
|
||||
<text class="store-hours">营业时间:{{ store.hours }}</text>
|
||||
<text class="store-hours">营业时间:{{ store.businessTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 地址行 -->
|
||||
<view class="address-row">
|
||||
<text class="address-text">{{ store.address }}</text>
|
||||
<view class="distance-row">
|
||||
<text class="distance-icon"></text>
|
||||
<text class="distance-text">{{ store.distance }}km</text>
|
||||
<view class="distance-row" v-if="store.distance !== null">
|
||||
<u-icon name="map" color="#999999" size="24"></u-icon>
|
||||
<text class="distance-text">{{ store.distance < 1 ? Math.round(store.distance * 1000) + 'm' : Math.round(store.distance) + 'km' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商户优惠 -->
|
||||
<view class="discount-section">
|
||||
<view class="section-title">
|
||||
<text class="discount-tag-icon"></text>
|
||||
<image src="https://aliyunoss.hn12301.net/hhrs/hhrs_qysm.png" style="width: 30rpx;height: 30rpx;"></image>
|
||||
<text class="discount-title">商户优惠</text>
|
||||
</view>
|
||||
<view class="discount-list">
|
||||
<text class="discount-item" v-for="(item, index) in store.discounts" :key="index">{{ item }}</text>
|
||||
<text class="discount-item" v-for="(item, index) in discountList" :key="index">{{ item }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -46,36 +36,35 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 44,
|
||||
store: {
|
||||
id: 1,
|
||||
name: '怀化黄岩白马风景区',
|
||||
category: '景区',
|
||||
hours: '08:00~12:00',
|
||||
address: '怀化市鹤城区万达广场 C 区501',
|
||||
distance: '1.4',
|
||||
image: 'https://aliyunoss.hn12301.net/hhrs/hhrs_venue1.png',
|
||||
discounts: [
|
||||
'用本人 62 开头社保卡凭电子社保码,可享景区免费入园权益',
|
||||
'仅限社保卡持卡人本人使用,非持卡人核销后会扣除使用次数且无法入园',
|
||||
'电子社保码截图无效,需在核销时打开电子社保卡页面。电子社保卡可在云闪付-湖南社保卡,或者微信-湖南智慧人社公众号'
|
||||
]
|
||||
}
|
||||
store: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
discountList() {
|
||||
if (!this.store || !this.store.merchantDiscount) return []
|
||||
return this.store.merchantDiscount.split('\n')
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = sysInfo.statusBarHeight || 44
|
||||
if (options.id) {
|
||||
this.loadDetail(options.id)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
loadDetail(id) {
|
||||
// TODO: 调用接口 this.$u.api.getVenueDetail({ id })
|
||||
loadDetail(shopId) {
|
||||
const loc = uni.getStorageSync('lng') && uni.getStorageSync('lat')
|
||||
? { lng: uni.getStorageSync('lng'), lat: uni.getStorageSync('lat') }
|
||||
: null
|
||||
const params = { shopId: shopId }
|
||||
if (loc) {
|
||||
params.lng = loc.lng
|
||||
params.lat = loc.lat
|
||||
}
|
||||
this.$u.api.getStoreDetail(params).then(res => {
|
||||
if (res.errcode === 0 && res.data) {
|
||||
this.store = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,44 +72,9 @@ export default {
|
||||
|
||||
<style>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
background-color: #f2f2f7;
|
||||
}
|
||||
|
||||
.nav-bar {
|
||||
background-color: #ffffff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.nav-header {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
font-size: 20px;
|
||||
color: #1a1818;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #1a1818;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 门店卡片 */
|
||||
@@ -190,11 +144,6 @@ export default {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.distance-icon {
|
||||
font-size: 12px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.distance-text {
|
||||
font-size: 12px;
|
||||
color: #999999;
|
||||
|
||||
+73
-92
@@ -1,39 +1,30 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 自定义导航栏 -->
|
||||
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||
<view class="nav-header">
|
||||
<view class="nav-back" @click="goBack">
|
||||
<text class="back-icon"></text>
|
||||
</view>
|
||||
<text class="nav-title">文旅场馆</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-area">
|
||||
<view class="search-bar">
|
||||
<text class="search-icon"></text>
|
||||
<u-icon name="search" color="#8e8e93" size="36"></u-icon>
|
||||
<input class="search-input" v-model="keyword" placeholder="请搜索场馆名" confirm-type="search" @confirm="onSearch" />
|
||||
<view class="search-btn" @click="onSearch">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 场馆列表 -->
|
||||
<view class="list-area">
|
||||
<view class="venue-card" v-for="item in list" :key="item.id" @click="goDetail(item)">
|
||||
<scroll-view class="list-area" scroll-y @scrolltolower="loadMore" :lower-threshold="100">
|
||||
<view class="venue-card" v-for="item in list" :key="item.shopId" @click="goDetail(item)">
|
||||
<image class="card-img" :src="item.image" mode="aspectFill" />
|
||||
<view class="card-info">
|
||||
<text class="card-name">{{ item.name }}</text>
|
||||
<text class="card-category">{{ item.category }}</text>
|
||||
<text class="card-address">{{ item.address }}</text>
|
||||
</view>
|
||||
<view class="card-distance">
|
||||
<text class="distance-icon"></text>
|
||||
<text class="distance-text">{{ item.distance }}km</text>
|
||||
<view class="card-distance" v-if="item.distance !== null">
|
||||
<u-icon name="map" color="#999999" size="24"></u-icon>
|
||||
<text class="distance-text">{{ item.distance < 1 ? Math.round(item.distance * 1000) + 'm' : Math.round(item.distance) + 'km' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus" :loading-text="'加载中...'" :loadmore-text="'上拉加载更多'" :nomore-text="'没有更多了'" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -41,87 +32,85 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 44,
|
||||
keyword: '',
|
||||
list: [
|
||||
{
|
||||
id: 1,
|
||||
name: '怀化黄岩白马风景区',
|
||||
category: '景区',
|
||||
address: '怀化市鹤城区万达广场 C 区501',
|
||||
image: 'https://aliyunoss.hn12301.net/hhrs/hhrs_venue1.png',
|
||||
distance: '1.4'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '穿岩山国家森林公园景区',
|
||||
category: '景区',
|
||||
address: '怀化市鹤城区万达广场 C 区501',
|
||||
image: 'https://aliyunoss.hn12301.net/hhrs/hhrs_venue2.png',
|
||||
distance: '1.4'
|
||||
}
|
||||
]
|
||||
list: [],
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
lng: '',
|
||||
lat: '',
|
||||
loadStatus: 'loadmore'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = sysInfo.statusBarHeight || 44
|
||||
const loc = uni.getStorageSync('lng') && uni.getStorageSync('lat')
|
||||
? { lng: uni.getStorageSync('lng'), lat: uni.getStorageSync('lat') }
|
||||
: null
|
||||
if (loc) {
|
||||
this.lng = loc.lng
|
||||
this.lat = loc.lat
|
||||
}
|
||||
this.loadList()
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
loadList() {
|
||||
if (this.loading) return
|
||||
this.loading = true
|
||||
this.loadStatus = 'loading'
|
||||
const params = {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
keyword: this.keyword,
|
||||
typeId: 1
|
||||
}
|
||||
if (this.lng) params.lng = this.lng
|
||||
if (this.lat) params.lat = this.lat
|
||||
this.$u.api.getStoreList(params).then(res => {
|
||||
if (res.errcode === 0 && res.data) {
|
||||
const list = res.data.list || []
|
||||
if (this.pageNo === 1) {
|
||||
this.list = list
|
||||
} else {
|
||||
this.list = this.list.concat(list)
|
||||
}
|
||||
this.total = res.data.total || 0
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
if (this.list.length === 0) {
|
||||
this.loadStatus = 'nomore'
|
||||
} else if (this.list.length >= this.total) {
|
||||
this.loadStatus = 'nomore'
|
||||
} else {
|
||||
this.loadStatus = 'loadmore'
|
||||
}
|
||||
})
|
||||
},
|
||||
loadMore() {
|
||||
if (this.list.length < this.total && !this.loading) {
|
||||
this.pageNo++
|
||||
this.loadList()
|
||||
}
|
||||
},
|
||||
goDetail(item) {
|
||||
uni.navigateTo({ url: '/pages/venue/detail?id=' + item.id })
|
||||
uni.navigateTo({ url: '/pages/venue/detail?id=' + item.shopId })
|
||||
},
|
||||
onSearch() {
|
||||
// TODO: 调用搜索接口
|
||||
this.pageNo = 1
|
||||
this.list = []
|
||||
this.loadList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background-color: #f2f2f7;
|
||||
}
|
||||
page {
|
||||
background-color: #f2f2f7;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
|
||||
.nav-bar {
|
||||
background-color: #ffffff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.nav-header {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
font-size: 20px;
|
||||
color: #1a1818;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #1a1818;
|
||||
}
|
||||
|
||||
.search-area {
|
||||
background-color: #ffffff;
|
||||
@@ -139,11 +128,6 @@ export default {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
font-size: 18px;
|
||||
color: #8e8e93;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
@@ -172,6 +156,8 @@ export default {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #f2f2f7;
|
||||
border-radius: 6px;
|
||||
width: 702rpx;
|
||||
|
||||
padding: 24px 12px;
|
||||
gap: 12px;
|
||||
box-shadow: 0 2px 3px #f2f2f7;
|
||||
@@ -220,11 +206,6 @@ export default {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.distance-icon {
|
||||
font-size: 12px;
|
||||
color: #727272;
|
||||
}
|
||||
|
||||
.distance-text {
|
||||
font-size: 12px;
|
||||
color: #727272;
|
||||
|
||||
Reference in New Issue
Block a user