页面
This commit is contained in:
parent
3f12b30147
commit
78c6170ef0
16
env/.env
vendored
16
env/.env
vendored
@ -11,8 +11,8 @@ VITE_APP_PUBLIC_BASE=/
|
|||||||
VITE_LOGIN_URL = '/pages/login/index'
|
VITE_LOGIN_URL = '/pages/login/index'
|
||||||
|
|
||||||
# 数字乡村
|
# 数字乡村
|
||||||
VITE_SERVER_BASEURL = 'http://127.0.0.1:8787'
|
VITE_SERVER_BASEURL = 'http://test.data-middle.lihaink.cn'
|
||||||
VITE_UPLOAD_BASEURL = 'http://127.0.0.1:8787/upload'
|
VITE_UPLOAD_BASEURL = 'http://test.data-middle.lihaink.cn/upload'
|
||||||
|
|
||||||
|
|
||||||
# 村集体
|
# 村集体
|
||||||
@ -23,13 +23,13 @@ VITE_CRMEB_SERVER_BASEURL_LOGIN = 'https://test.shop.lihaink.cn/pages/user/login
|
|||||||
|
|
||||||
# 有些同学可能需要在微信小程序里面根据 develop、trial、release 分别设置上传地址,参考代码如下。
|
# 有些同学可能需要在微信小程序里面根据 develop、trial、release 分别设置上传地址,参考代码如下。
|
||||||
# 下面的变量如果没有设置,会默认使用 VITE_SERVER_BASEURL or VITE_UPLOAD_BASEURL
|
# 下面的变量如果没有设置,会默认使用 VITE_SERVER_BASEURL or VITE_UPLOAD_BASEURL
|
||||||
VITE_SERVER_BASEURL__WEIXIN_DEVELOP = 'http://127.0.0.1:8787'
|
VITE_SERVER_BASEURL__WEIXIN_DEVELOP = 'http://test.data-middle.lihaink.cn'
|
||||||
VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'http://127.0.0.1:8787'
|
VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'http://test.data-middle.lihaink.cn'
|
||||||
VITE_SERVER_BASEURL__WEIXIN_RELEASE = 'http://127.0.0.1:8787'
|
VITE_SERVER_BASEURL__WEIXIN_RELEASE = 'http://test.data-middle.lihaink.cn'
|
||||||
|
|
||||||
VITE_UPLOAD_BASEURL__WEIXIN_DEVELOP = 'http://127.0.0.1:8787/upload'
|
VITE_UPLOAD_BASEURL__WEIXIN_DEVELOP = 'http://test.data-middle.lihaink.cn/upload'
|
||||||
VITE_UPLOAD_BASEURL__WEIXIN_TRIAL = 'http://127.0.0.1:8787/upload'
|
VITE_UPLOAD_BASEURL__WEIXIN_TRIAL = 'http://test.data-middle.lihaink.cn/upload'
|
||||||
VITE_UPLOAD_BASEURL__WEIXIN_RELEASE = 'http://127.0.0.1:8787/upload'
|
VITE_UPLOAD_BASEURL__WEIXIN_RELEASE = 'http://test.data-middle.lihaink.cn/upload'
|
||||||
|
|
||||||
# h5是否需要配置代理
|
# h5是否需要配置代理
|
||||||
VITE_APP_PROXY=true
|
VITE_APP_PROXY=true
|
||||||
|
@ -15,17 +15,24 @@ const {
|
|||||||
} = env
|
} = env
|
||||||
|
|
||||||
export default defineManifestConfig({
|
export default defineManifestConfig({
|
||||||
'name': VITE_APP_TITLE,
|
name: VITE_APP_TITLE,
|
||||||
'appid': VITE_UNI_APPID,
|
appid: VITE_UNI_APPID,
|
||||||
'description': '',
|
description: '',
|
||||||
'versionName': '1.0.0',
|
versionName: '1.0.0',
|
||||||
'versionCode': '100',
|
versionCode: '100',
|
||||||
'transformPx': false,
|
transformPx: false,
|
||||||
'locale': VITE_FALLBACK_LOCALE, // 'zh-Hans'
|
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
|
||||||
'h5': {
|
h5: {
|
||||||
router: {
|
router: {
|
||||||
base: VITE_APP_PUBLIC_BASE,
|
base: VITE_APP_PUBLIC_BASE,
|
||||||
},
|
},
|
||||||
|
sdkConfigs: {
|
||||||
|
maps: {
|
||||||
|
tencent: {
|
||||||
|
key: 'IOUBZ-HCDW3-KP53C-RFNVK-QAZ7O-EQFKM',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
'app-plus': {
|
'app-plus': {
|
||||||
@ -83,14 +90,14 @@ export default defineManifestConfig({
|
|||||||
ios: {
|
ios: {
|
||||||
appstore: 'static/app/icons/1024x1024.png',
|
appstore: 'static/app/icons/1024x1024.png',
|
||||||
ipad: {
|
ipad: {
|
||||||
'app': 'static/app/icons/76x76.png',
|
app: 'static/app/icons/76x76.png',
|
||||||
'app@2x': 'static/app/icons/152x152.png',
|
'app@2x': 'static/app/icons/152x152.png',
|
||||||
'notification': 'static/app/icons/20x20.png',
|
notification: 'static/app/icons/20x20.png',
|
||||||
'notification@2x': 'static/app/icons/40x40.png',
|
'notification@2x': 'static/app/icons/40x40.png',
|
||||||
'proapp@2x': 'static/app/icons/167x167.png',
|
'proapp@2x': 'static/app/icons/167x167.png',
|
||||||
'settings': 'static/app/icons/29x29.png',
|
settings: 'static/app/icons/29x29.png',
|
||||||
'settings@2x': 'static/app/icons/58x58.png',
|
'settings@2x': 'static/app/icons/58x58.png',
|
||||||
'spotlight': 'static/app/icons/40x40.png',
|
spotlight: 'static/app/icons/40x40.png',
|
||||||
'spotlight@2x': 'static/app/icons/80x80.png',
|
'spotlight@2x': 'static/app/icons/80x80.png',
|
||||||
},
|
},
|
||||||
iphone: {
|
iphone: {
|
||||||
@ -108,7 +115,7 @@ export default defineManifestConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
'quickapp': {},
|
quickapp: {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
'mp-weixin': {
|
'mp-weixin': {
|
||||||
appid: VITE_WX_APPID,
|
appid: VITE_WX_APPID,
|
||||||
@ -119,6 +126,11 @@ export default defineManifestConfig({
|
|||||||
minified: true,
|
minified: true,
|
||||||
},
|
},
|
||||||
usingComponents: true,
|
usingComponents: true,
|
||||||
|
permission: {
|
||||||
|
'scope.userLocation': {
|
||||||
|
desc: '需要获取位置以展示医院信息',
|
||||||
|
},
|
||||||
|
},
|
||||||
// __usePrivacyCheck__: true,
|
// __usePrivacyCheck__: true,
|
||||||
},
|
},
|
||||||
'mp-alipay': {
|
'mp-alipay': {
|
||||||
@ -131,8 +143,8 @@ export default defineManifestConfig({
|
|||||||
'mp-toutiao': {
|
'mp-toutiao': {
|
||||||
usingComponents: true,
|
usingComponents: true,
|
||||||
},
|
},
|
||||||
'uniStatistics': {
|
uniStatistics: {
|
||||||
enable: false,
|
enable: false,
|
||||||
},
|
},
|
||||||
'vueVersion': '3',
|
vueVersion: '3',
|
||||||
})
|
})
|
||||||
|
@ -89,7 +89,12 @@
|
|||||||
"es6": true,
|
"es6": true,
|
||||||
"minified": true
|
"minified": true
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
"usingComponents": true,
|
||||||
|
"permission": {
|
||||||
|
"scope.userLocation": {
|
||||||
|
"desc": "需要获取位置以展示医院信息"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"usingComponents": true,
|
"usingComponents": true,
|
||||||
@ -108,6 +113,13 @@
|
|||||||
"h5": {
|
"h5": {
|
||||||
"router": {
|
"router": {
|
||||||
"base": "/"
|
"base": "/"
|
||||||
|
},
|
||||||
|
"sdkConfigs": {
|
||||||
|
"maps": {
|
||||||
|
"tencent": {
|
||||||
|
"key": "IOUBZ-HCDW3-KP53C-RFNVK-QAZ7O-EQFKM"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -102,6 +102,17 @@
|
|||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/my/setting",
|
||||||
|
"type": "page",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设置"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/service/find",
|
||||||
|
"type": "page"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/service/index",
|
"path": "pages/service/index",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<wd-card>
|
<wd-card>
|
||||||
<wd-grid :gutter="2" :column="4">
|
<wd-grid :gutter="2" :column="4">
|
||||||
<view
|
<view
|
||||||
@click="more"
|
@click="more(item)"
|
||||||
v-for="item in [
|
v-for="item in [
|
||||||
{ name: '我的订单', icon: '/static/icons/village_service.png', color: 'green' },
|
{ name: '我的订单', icon: '/static/icons/village_service.png', color: 'green' },
|
||||||
{ name: '我的收藏', icon: '/static/icons/agriculture_service.png', color: 'blue' },
|
{ name: '我的收藏', icon: '/static/icons/agriculture_service.png', color: 'blue' },
|
||||||
@ -35,8 +35,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-grid>
|
</wd-grid>
|
||||||
</wd-card>
|
</wd-card>
|
||||||
|
<!-- <button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button> -->
|
||||||
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -61,6 +60,19 @@ const logout = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function more(item) {
|
||||||
|
if (item.name == '设置') {
|
||||||
|
setting()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setting() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/my/setting',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// userStore.wxLogin()
|
// userStore.wxLogin()
|
||||||
// // 用户登录,获取openId
|
// // 用户登录,获取openId
|
||||||
// uni.login({
|
// uni.login({
|
||||||
|
310
src/pages/my/setting.vue
Normal file
310
src/pages/my/setting.vue
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
<route lang="json5">
|
||||||
|
{
|
||||||
|
style: { navigationBarTitleText: '设置' },
|
||||||
|
}
|
||||||
|
</route>
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wx-login />
|
||||||
|
<!-- <view class="ml-4">wx的openid:</view> -->
|
||||||
|
<!-- <view class="ml-4">{{ openId }}</view> -->
|
||||||
|
|
||||||
|
<view class="p-2">
|
||||||
|
<wd-card>
|
||||||
|
<wd-cell-group>
|
||||||
|
<!-- <wd-cell title="标题文字" center>
|
||||||
|
<wd-button custom-class="custom-value" size="small" plain>按钮</wd-button>
|
||||||
|
</wd-cell>
|
||||||
|
<wd-cell title="标题文字" center>
|
||||||
|
<view class="custom-value" style="height: 32px">
|
||||||
|
<wd-switch v-model="switchValue" change="handleSwitchChange" />
|
||||||
|
</view>
|
||||||
|
</wd-cell> -->
|
||||||
|
<wd-cell title="我的钱包" is-link to="/pages/index/index">
|
||||||
|
<view class="custom-text"></view>
|
||||||
|
</wd-cell>
|
||||||
|
<wd-col-picker
|
||||||
|
label="做宴地址"
|
||||||
|
v-model="orderInfo.district_name"
|
||||||
|
prop="district_name"
|
||||||
|
:columns="area"
|
||||||
|
:column-change="columnChange"
|
||||||
|
placeholder="请填写做宴地址"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: false,
|
||||||
|
validator: (value: string) => {
|
||||||
|
if (value.length > 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
message: '做宴地址不能为空,请填写',
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
></wd-col-picker>
|
||||||
|
<!-- <wd-cell>
|
||||||
|
<template #title>
|
||||||
|
<view>
|
||||||
|
<view style="display: inline-block">标题文字</view>
|
||||||
|
<view class="end-time">25天后到期</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</wd-cell> -->
|
||||||
|
</wd-cell-group>
|
||||||
|
</wd-card>
|
||||||
|
|
||||||
|
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<style>
|
||||||
|
.cell-icon {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 4px 0;
|
||||||
|
width: 16px;
|
||||||
|
height: 24px;
|
||||||
|
margin-right: 4px;
|
||||||
|
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png')
|
||||||
|
no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
:deep(.custom-value) {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 0;
|
||||||
|
transform: translate(0, -50%);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.custom-text {
|
||||||
|
color: #f0883a;
|
||||||
|
}
|
||||||
|
.end-time {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 8px;
|
||||||
|
border: 1px solid #faa21e;
|
||||||
|
padding: 0 4px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #faa21e;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script lang="ts">
|
||||||
|
const switchValue = ref('')
|
||||||
|
function handleSwitchChange({ value }) {
|
||||||
|
console.log(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// import { useUserStore } from '@/store'
|
||||||
|
// import { http } from '@/utils/http'
|
||||||
|
// import WxLogin from './components/wx-login.vue'
|
||||||
|
|
||||||
|
const hasLogin = computed(() => userStore.userInfo?.nickname)
|
||||||
|
|
||||||
|
// const userStore = useUserStore()
|
||||||
|
// const openId = ref('')
|
||||||
|
|
||||||
|
// const logout = () => {
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '确认退出当前账号?',
|
||||||
|
// success: (res) => {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// userStore.logout()
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
totalPrice: 0,
|
||||||
|
pre_price: 0,
|
||||||
|
server_user: {
|
||||||
|
phone: '',
|
||||||
|
public_name: '',
|
||||||
|
},
|
||||||
|
server_user_id: 0,
|
||||||
|
order_id: 0, //订单id
|
||||||
|
address_string: '',
|
||||||
|
// banquetType: this.getBanquetType(),
|
||||||
|
propShowOrder: false,
|
||||||
|
area: [],
|
||||||
|
value: [],
|
||||||
|
order_type: 1, //厨师 2 酒店
|
||||||
|
orderInfo: {
|
||||||
|
district_name: [],
|
||||||
|
street_name: '',
|
||||||
|
cart_ids: 0, //酒店
|
||||||
|
customer_name: '',
|
||||||
|
phone: '',
|
||||||
|
address: '',
|
||||||
|
remark: '',
|
||||||
|
banquet_type: '1',
|
||||||
|
reservation_type: 1,
|
||||||
|
server_user_id: 0,
|
||||||
|
table_number: 1, //酒店
|
||||||
|
banquet_date: null, //酒店
|
||||||
|
},
|
||||||
|
matchedItems_sp: [],
|
||||||
|
showDatePicker: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
this.server_user_id = option.id
|
||||||
|
this.orderInfo.cart_ids = option.cart_ids || 0
|
||||||
|
if (this.orderInfo.cart_ids) {
|
||||||
|
this.order_type = 2 //酒店
|
||||||
|
}
|
||||||
|
this.orderInfo.server_user_id = option.id
|
||||||
|
this.getCartCheck()
|
||||||
|
this.getArea()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
pickDate(e) {
|
||||||
|
this.orderInfo.banquet_date = e[0]
|
||||||
|
this.showDatePicker = false
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.propShowOrder = false
|
||||||
|
},
|
||||||
|
//表单验证
|
||||||
|
handleSubmit(reservation_type) {
|
||||||
|
this.orderInfo.reservation_type = reservation_type //付款类型
|
||||||
|
this.$refs.form
|
||||||
|
.validate()
|
||||||
|
.then(({ valid, errors }) => {
|
||||||
|
if (valid) {
|
||||||
|
this.orderInfo.address = this.address_string + this.orderInfo.street_name
|
||||||
|
this.addOrder()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error, 'error')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// //提交订单
|
||||||
|
// addOrder() {
|
||||||
|
// CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
|
||||||
|
// if (res.code === 1) {
|
||||||
|
// this.order_id = res.data.order_id
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: `/pages/banquet/order/detail?order_id=${res.data.order_id}`,
|
||||||
|
// })
|
||||||
|
// } else if (res.code === 0) {
|
||||||
|
// uni.$u.toast('请求错误,请从新下单!')
|
||||||
|
// this.goBack()
|
||||||
|
// } else {
|
||||||
|
// uni.$u.toast(res.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
|
||||||
|
// // 微信支付
|
||||||
|
// payOrder() {
|
||||||
|
// CommonApi.commonPost('/api/banquet/order/pay', {
|
||||||
|
// order_id: this.order_id,
|
||||||
|
// }).catch((res) => {
|
||||||
|
// if (res.code === 1) {
|
||||||
|
// wx.requestPayment({
|
||||||
|
// timeStamp: res.data.timeStamp,
|
||||||
|
// nonceStr: res.data.nonceStr,
|
||||||
|
// package: res.data.package,
|
||||||
|
// signType: res.data.signType,
|
||||||
|
// paySign: res.data.paySign,
|
||||||
|
// success: function (res) {
|
||||||
|
// console.log('success:' + JSON.stringify(res))
|
||||||
|
// },
|
||||||
|
// fail: function (err) {
|
||||||
|
// console.log('fail:' + JSON.stringify(err))
|
||||||
|
// },
|
||||||
|
// complete: function (res) {
|
||||||
|
// console.log('complete:' + JSON.stringify(res))
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// uni.$u.toast(res.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
//获取地址
|
||||||
|
getArea() {
|
||||||
|
this.area = [
|
||||||
|
colPickerData.map((item) => ({
|
||||||
|
value: item.value,
|
||||||
|
label: item.text,
|
||||||
|
})),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
//选择地址后--记录地址字符串
|
||||||
|
handleConfirm(value) {
|
||||||
|
this.address_string = value.selectedItems.map((item) => item.label).join('')
|
||||||
|
},
|
||||||
|
//地址改版事件
|
||||||
|
columnChange({ selectedItem, resolve, finish }) {
|
||||||
|
try {
|
||||||
|
const areaData = findChildrenByCode(colPickerData, selectedItem.value)
|
||||||
|
if (areaData && areaData.length) {
|
||||||
|
resolve(
|
||||||
|
areaData.map((item) => ({
|
||||||
|
value: item.value,
|
||||||
|
label: item.text,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理列变更时出错:', error)
|
||||||
|
finish() // 确保在发生错误时也能完成操作以避免卡顿
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// //宴席类型
|
||||||
|
// getBanquetType() {
|
||||||
|
// CommonApi.commonGet('/api/banquet/dishes/banquetType').catch((res) => {
|
||||||
|
// if (res.code === 1) {
|
||||||
|
// res.data.forEach((item) => {
|
||||||
|
// item.label = item.name
|
||||||
|
// })
|
||||||
|
// this.banquetType = res.data
|
||||||
|
// } else {
|
||||||
|
// uni.$u.toast(res.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// //购物车验证
|
||||||
|
getCartCheck() {
|
||||||
|
let query = {
|
||||||
|
server_user_id: this.server_user_id,
|
||||||
|
cart_ids: 0,
|
||||||
|
}
|
||||||
|
if (this.order_type == 2 && this.orderInfo.cart_ids > 0) {
|
||||||
|
query.cart_ids = this.orderInfo.cart_ids
|
||||||
|
}
|
||||||
|
// CommonApi.commonPost('/api/banquet/order/check', query).catch((res) => {
|
||||||
|
// if (res.code === 1) {
|
||||||
|
// this.matchedItems_sp = res.data.cart_list
|
||||||
|
// this.totalPrice = res.data.total_price
|
||||||
|
// this.pre_price = this.totalPrice >= 1000 ? 1000 : this.totalPrice
|
||||||
|
// this.server_user.phone = res.data.server_user.certification.phone
|
||||||
|
// this.server_user.public_name = res.data.server_user.certification.public_name
|
||||||
|
// this.$refs.pagingRefSP?.complete(res.data)
|
||||||
|
// // console.log(res);
|
||||||
|
// } else {
|
||||||
|
// uni.$u.toast(res.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 返回上一级
|
||||||
|
goBack() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1, // delta 表示返回的页面数,1 表示返回上一级
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
102
src/pages/service/find.vue
Normal file
102
src/pages/service/find.vue
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<map
|
||||||
|
id="hospitalMap"
|
||||||
|
style="width: 100%; height: 80vh"
|
||||||
|
:latitude="center.lat"
|
||||||
|
:longitude="center.lng"
|
||||||
|
:markers="markers"
|
||||||
|
@markertap="handleMarkerTap"
|
||||||
|
></map>
|
||||||
|
<scroll-view class="poi-list">
|
||||||
|
<view v-for="(item, index) in hospitals" :key="index" @click="focusMarker(item)">
|
||||||
|
<text class="hospital-name">{{ item.name }}</text>
|
||||||
|
<text class="hospital-distance">{{ item.distance }}米</text>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
center: { lat: 39.90469, lng: 116.40717 }, // 默认北京坐标
|
||||||
|
markers: [],
|
||||||
|
hospitals: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.initMap()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initMap() {
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: (res) => {
|
||||||
|
this.center = { lat: res.latitude, lng: res.longitude }
|
||||||
|
this.searchHospitals()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
searchHospitals() {
|
||||||
|
// 需引入qqmapsdk(H5)或使用uni.requireNativePlugin(App)
|
||||||
|
const qqmapsdk = new qq.maps.SearchService({
|
||||||
|
complete: (result) => {
|
||||||
|
this.hospitals = result.detail.pois.map((poi) => ({
|
||||||
|
id: poi.id,
|
||||||
|
name: poi.title,
|
||||||
|
address: poi.address,
|
||||||
|
distance: poi._distance,
|
||||||
|
lat: poi.latLng.lat,
|
||||||
|
lng: poi.latLng.lng,
|
||||||
|
}))
|
||||||
|
this.updateMarkers()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
qqmapsdk.searchNearby('医院', new qq.maps.LatLng(this.center.lat, this.center.lng), 2000)
|
||||||
|
},
|
||||||
|
updateMarkers() {
|
||||||
|
this.markers = this.hospitals.map((h) => ({
|
||||||
|
id: h.id,
|
||||||
|
latitude: h.lat,
|
||||||
|
longitude: h.lng,
|
||||||
|
iconPath: '/static/hospital-marker.png',
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
callout: { content: h.name },
|
||||||
|
}))
|
||||||
|
},
|
||||||
|
handleMarkerTap(e) {
|
||||||
|
const hospital = this.hospitals.find((h) => h.id === e.markerId)
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: ['导航到' + hospital.name, '查看详情'],
|
||||||
|
success: (res) => {
|
||||||
|
if (res.tapIndex === 0) {
|
||||||
|
this.openNavigation(hospital)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
focusMarker(item) {
|
||||||
|
this.center = { lat: item.lat, lng: item.lng }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.poi-list {
|
||||||
|
height: 20vh;
|
||||||
|
padding: 10px;
|
||||||
|
background: #f8f8f8;
|
||||||
|
}
|
||||||
|
.hospital-name {
|
||||||
|
font-weight: bold;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.hospital-distance {
|
||||||
|
color: #888;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -8,26 +8,6 @@
|
|||||||
}
|
}
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
// import RequestComp from './components/request.vue'
|
|
||||||
// import UploadComp from './components/upload.vue'
|
|
||||||
|
|
||||||
// 获取屏幕边界到安全区域距离
|
|
||||||
const { safeAreaInsets } = uni.getSystemInfoSync()
|
|
||||||
|
|
||||||
// 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误
|
|
||||||
// const testOxlint = (name: string) => {
|
|
||||||
// console.log('oxlint')
|
|
||||||
// }
|
|
||||||
// testOxlint('oxlint')
|
|
||||||
// console.log('about')
|
|
||||||
function more(item) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="background_home">
|
<view class="background_home">
|
||||||
@ -69,7 +49,7 @@ function more(item) {
|
|||||||
@click="more(item)"
|
@click="more(item)"
|
||||||
v-for="item in [
|
v-for="item in [
|
||||||
{
|
{
|
||||||
name: '租赁服务',
|
name: '找停车',
|
||||||
url: '/pages/activity/lease/index',
|
url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/village_service.png',
|
icon: '/static/icons/village_service.png',
|
||||||
color: 'green',
|
color: 'green',
|
||||||
@ -281,3 +261,28 @@ function more(item) {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
// import RequestComp from './components/request.vue'
|
||||||
|
// import UploadComp from './components/upload.vue'
|
||||||
|
|
||||||
|
// 获取屏幕边界到安全区域距离
|
||||||
|
const { safeAreaInsets } = uni.getSystemInfoSync()
|
||||||
|
|
||||||
|
// 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误
|
||||||
|
// const testOxlint = (name: string) => {
|
||||||
|
// console.log('oxlint')
|
||||||
|
// }
|
||||||
|
// testOxlint('oxlint')
|
||||||
|
// console.log('about')
|
||||||
|
function more(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
// url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
|
||||||
|
url: `/pages/service/find`,
|
||||||
|
})
|
||||||
|
|
||||||
|
// uni.openLocation({
|
||||||
|
// latitude: Number(2),
|
||||||
|
// longitude: Number(2),
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
97
src/utils/map-service.ts
Normal file
97
src/utils/map-service.ts
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// import QQMapWX from '@/utils/qqmap-wx-jssdk.min.js'
|
||||||
|
|
||||||
|
interface Hospital {
|
||||||
|
name: string
|
||||||
|
address: string
|
||||||
|
latitude: number
|
||||||
|
longitude: number
|
||||||
|
telephone?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MapService {
|
||||||
|
private qqmapsdk: any
|
||||||
|
|
||||||
|
constructor(apiKey: string) {
|
||||||
|
// this.qqmapsdk = new QQMapWX({ key: apiKey })
|
||||||
|
|
||||||
|
this.qqmapsdk = new Promise(function (resolve, reject) {
|
||||||
|
window.init = function () {
|
||||||
|
resolve(window.qq) //关键
|
||||||
|
}
|
||||||
|
var script = document.createElement('script')
|
||||||
|
script.type = 'text/javascript'
|
||||||
|
script.src = `https://map.qq.com/api/js?v=2.exp&callback=init&key=IOUBZ-HCDW3-KP53C-RFNVK-QAZ7O-EQFKM`
|
||||||
|
script.onerror = reject
|
||||||
|
document.head.appendChild(script)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// export function TMap(key) {
|
||||||
|
// return new Promise(function (resolve, reject) {
|
||||||
|
// window.init = function () {
|
||||||
|
// resolve(window.qq) //关键
|
||||||
|
// }
|
||||||
|
// var script = document.createElement('script')
|
||||||
|
// script.type = 'text/javascript'
|
||||||
|
// script.src = `https://map.qq.com/api/js?v=2.exp&callback=init&key=${key}`
|
||||||
|
// script.onerror = reject
|
||||||
|
// document.head.appendChild(script)
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// 获取当前位置并搜索附近医院
|
||||||
|
async getNearbyHospitals(): Promise<Hospital[]> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: (res) => {
|
||||||
|
this.qqmapsdk.search({
|
||||||
|
keyword: '医院',
|
||||||
|
location: {
|
||||||
|
latitude: res.latitude,
|
||||||
|
longitude: res.longitude,
|
||||||
|
},
|
||||||
|
success: (result: any) => {
|
||||||
|
const hospitals = result.data.map((item: any) => ({
|
||||||
|
name: item.title,
|
||||||
|
address: item.address,
|
||||||
|
latitude: item.location.lat,
|
||||||
|
longitude: item.location.lng,
|
||||||
|
telephone: item.tel,
|
||||||
|
}))
|
||||||
|
resolve(hospitals)
|
||||||
|
},
|
||||||
|
fail: (err: any) => reject(err),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => reject(err),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示泸州市重点医院
|
||||||
|
async getLuzhouHospitals(): Promise<Hospital[]> {
|
||||||
|
const luzhouHospitals = [
|
||||||
|
{
|
||||||
|
name: '泸州市中医医院(城南院区)',
|
||||||
|
address: '四川省泸州市纳溪区杏林路',
|
||||||
|
latitude: 28.816722,
|
||||||
|
longitude: 105.403076,
|
||||||
|
telephone: '(0830)6684666',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '西南医科大学附属中医医院',
|
||||||
|
address: '四川省泸州市江阳区江阳中路517号',
|
||||||
|
latitude: 28.895212,
|
||||||
|
longitude: 105.457616,
|
||||||
|
telephone: '(0830)2392239',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '泸州市人民医院(沙茜院区)',
|
||||||
|
address: '四川省泸州市江阳区酒谷大道二段316号',
|
||||||
|
latitude: 28.874252,
|
||||||
|
longitude: 105.482441,
|
||||||
|
telephone: '(0830)2963162',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
return luzhouHospitals
|
||||||
|
}
|
||||||
|
}
|
1122
src/utils/qqmap-wx-jssdk.js
Normal file
1122
src/utils/qqmap-wx-jssdk.js
Normal file
File diff suppressed because it is too large
Load Diff
1
src/utils/qqmap-wx-jssdk.min.js
vendored
Normal file
1
src/utils/qqmap-wx-jssdk.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -23,6 +23,8 @@
|
|||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"vueCompilerOptions": {
|
"vueCompilerOptions": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user