|
|
|
|
<template>
|
|
|
|
|
<view class="page">
|
|
|
|
|
<view class="top">
|
|
|
|
|
<!-- <view class="position" @click="$u.route({ url: '/pages/CitySelect/CitySelect' })"> -->
|
|
|
|
|
<view class="position" @click="isShowSite = true">
|
|
|
|
|
<u-icon name="map-fill"></u-icon>
|
|
|
|
|
<!-- <text>{{ vuex_location.city.replace(/(市|区|县)/,'') }}</text> -->
|
|
|
|
|
<text>{{ site_name || ' ' }}</text>
|
|
|
|
|
<u-icon name="arrow-down" size="22"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="container">
|
|
|
|
|
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
|
|
|
|
|
<image class="bkg" src="~@/package_sub/static/ServiceList/bkg.png" mode="aspectFill"></image>
|
|
|
|
|
|
|
|
|
|
<view v-if="list.length>0">
|
|
|
|
|
<view class="list">
|
|
|
|
|
<view class="list-item" v-for="(item,i) in list" :key="i" @click="toDetail(item)">
|
|
|
|
|
<view class="left">
|
|
|
|
|
<view class="list-item__icon">
|
|
|
|
|
<image style="width:152rpx;height:128rpx" :src="item.cover.url"></image>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="center">
|
|
|
|
|
<view class="list-item__title">
|
|
|
|
|
{{item.name}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="list-item__sub-title">{{item.introduce?item.introduce:''}}</view>
|
|
|
|
|
|
|
|
|
|
<view class="list-item__price">
|
|
|
|
|
<text class="list-item__price--unit">¥</text>
|
|
|
|
|
<text class="list-item__price--number">{{item.price}}</text>
|
|
|
|
|
<text class="list-item__price--text">元起</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="right">
|
|
|
|
|
<u-button shape="circle" ripple :custom-style="orderBtnStyle"
|
|
|
|
|
@click.stop="toDetail(item)">预约</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<u-loadmore :margin-top="20" :status="loadStatus" bgColor="#f2f2f2"></u-loadmore>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else style="height: 100%;" class="d-flex ai-center jc-center">
|
|
|
|
|
<u-empty mode="list"></u-empty>
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 选择站点 -->
|
|
|
|
|
<u-select v-model="isShowSite" value-name="id" @confirm="confirmSite" label-name="name"
|
|
|
|
|
:list="list_site"></u-select>
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
orderBtnStyle: {
|
|
|
|
|
'background-image': 'linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%)',
|
|
|
|
|
'font-weight': '500',
|
|
|
|
|
'font-size': '27rpx',
|
|
|
|
|
'color': '#fff',
|
|
|
|
|
'width': '130rpx',
|
|
|
|
|
'height': '60rpx',
|
|
|
|
|
'line-height': '60rpx'
|
|
|
|
|
},
|
|
|
|
|
last_page: 1,
|
|
|
|
|
select: {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 5,
|
|
|
|
|
type: '',
|
|
|
|
|
site_id:''
|
|
|
|
|
},
|
|
|
|
|
list: [],
|
|
|
|
|
loadStatus: 'loadmore',
|
|
|
|
|
isShowSite: false,
|
|
|
|
|
list_site: [{
|
|
|
|
|
id: '',
|
|
|
|
|
name: '全部'
|
|
|
|
|
}],
|
|
|
|
|
site_name:''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// if (this.$store.state.vuex_location !== 2) {
|
|
|
|
|
// this.$store.dispatch('getLocation')
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.select.type = options.type ? options.type : ''
|
|
|
|
|
// this.select.site_id = this.vuex_site?this.vuex_site.id:''
|
|
|
|
|
// this.site_name = this.vuex_site?this.vuex_site.name:'全部'
|
|
|
|
|
// this.getSiteList()
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
// this.getList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取人员绑定的列表
|
|
|
|
|
async getUserInfo(){
|
|
|
|
|
// 获取登录角色
|
|
|
|
|
const loginRole = uni.getStorageSync('login_role')
|
|
|
|
|
// 根据角色选择不同的获取用户信息接口
|
|
|
|
|
let userApi = null
|
|
|
|
|
switch(loginRole) {
|
|
|
|
|
case 'nurse':
|
|
|
|
|
userApi = this.$u.api.getUser // 护工信息
|
|
|
|
|
break
|
|
|
|
|
case 'staff':
|
|
|
|
|
userApi = this.$u.api.getStaffUser // 工作人员信息
|
|
|
|
|
break
|
|
|
|
|
case 'operator':
|
|
|
|
|
userApi = this.$u.api.getOperatorUser // 运营人员信息
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '无效的角色信息',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const user = await userApi()
|
|
|
|
|
this.$u.vuex('vuex_user', user)
|
|
|
|
|
this.list_site = user.site
|
|
|
|
|
if(user.site.length<1){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '您还未绑定授权区域,请联系管理员绑定',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.select.site_id = this.list_site[0].id
|
|
|
|
|
this.site_name = this.list_site[0].name
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error("获取用户信息失败", err)
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '获取用户信息失败',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getSiteList() {
|
|
|
|
|
const res = await this.$u.api.otherSite()
|
|
|
|
|
this.list_site.push(...res)
|
|
|
|
|
},
|
|
|
|
|
async getList() {
|
|
|
|
|
const res = await this.$u.api.accompanyProduct({
|
|
|
|
|
...this.select,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
this.last_page = res.last_page
|
|
|
|
|
this.loadStatus = this.select.page >= this.last_page ? 'nomore' : 'loadmore'
|
|
|
|
|
this.list.push(...res.data)
|
|
|
|
|
console.log(this.select.page, this.last_page)
|
|
|
|
|
},
|
|
|
|
|
reachBottom() {
|
|
|
|
|
if (this.select.page > this.last_page) {
|
|
|
|
|
this.loadStatus = 'nomore'
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.loadStatus = 'loading'
|
|
|
|
|
this.select.page++
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
confirmSite(e) {
|
|
|
|
|
// this.$u.vuex("vuex_site", e[0])
|
|
|
|
|
this.select.site_id = e[0].value?e[0].value:''
|
|
|
|
|
this.site_name = e[0].label?e[0].label:'全部'
|
|
|
|
|
this.list = []
|
|
|
|
|
this.select.page = 1
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
toOrder(item) {
|
|
|
|
|
if (!this.token) {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: "提示",
|
|
|
|
|
content: "请先登录再下单",
|
|
|
|
|
confirmText: "登录",
|
|
|
|
|
success: (status) => {
|
|
|
|
|
if (status.confirm) {
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url: '/pages/login/login',
|
|
|
|
|
type: 'redirect'
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: () => {},
|
|
|
|
|
});
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url: '/package_sub/pages/AddOrder/AddOrder',
|
|
|
|
|
params: {
|
|
|
|
|
id: item.id,
|
|
|
|
|
title: item.name,
|
|
|
|
|
site_id: item.site_id,
|
|
|
|
|
type: item.type
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
toDetail(item) {
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url: '/package_sub/pages/ServiceDetail/ServiceDetail?id=' + item.id+'&site_name='+this.site_name+'&choose_site='+this.select.site_id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
token() {
|
|
|
|
|
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.page {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.top {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
background: #fff;
|
|
|
|
|
padding: 26rpx 28rpx;
|
|
|
|
|
z-index: 4;
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
height: 94rpx;
|
|
|
|
|
|
|
|
|
|
.position {
|
|
|
|
|
color: #000;
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
letter-spacing: 3rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
|
|
|
|
&>text {
|
|
|
|
|
padding: 0 13rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.container {
|
|
|
|
|
padding-bottom: 40rpx;
|
|
|
|
|
// padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx);
|
|
|
|
|
// padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
height: calc(100vh - 94rpx);
|
|
|
|
|
|
|
|
|
|
.bkg {
|
|
|
|
|
height: 316rpx;
|
|
|
|
|
width: 100vw;
|
|
|
|
|
position: absolute;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.list {
|
|
|
|
|
padding: 252rpx 25rpx 20rpx;
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 3;
|
|
|
|
|
|
|
|
|
|
&-item {
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
filter: drop-shadow(2.192rpx 4.494rpx 5rpx rgba(33, 32, 32, 0.15));
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 34rpx 45rpx 34rpx 26rpx;
|
|
|
|
|
|
|
|
|
|
&__icon {
|
|
|
|
|
// background-color: #f9f5e9;
|
|
|
|
|
height: 128rpx;
|
|
|
|
|
width: 152rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.center {
|
|
|
|
|
flex: 1;
|
|
|
|
|
margin-left: 18rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.right {
|
|
|
|
|
margin-left: 12rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__title {
|
|
|
|
|
max-width: 300rpx;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #000;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__sub-title {
|
|
|
|
|
padding-top: 20rpx;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #929196;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
max-width: 304rpx;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__price {
|
|
|
|
|
padding-top: 16rpx;
|
|
|
|
|
color: #c20d12;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
|
|
|
|
&--unit {}
|
|
|
|
|
|
|
|
|
|
&--number {
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.list-item+.list-item {
|
|
|
|
|
margin-top: 28rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|