Commit bd003f2b authored by xhx's avatar xhx

网点时间及电话提取

parent 605f7a21
......@@ -77,34 +77,12 @@
<p class="w-1/2 border-r border-gray-300 mb-0" @click="handleClickChatWithClientManager">联系客服</p>
<p class="w-1/2 mb-0" :class="isOpen ? 'text-app-blue' : 'text-gray-800'" @click="toCall">电话咨询</p>
</div>
<van-popup v-model:show="show" round teleport="body" :style="{ width: '90%', top: '80%' }">
<div class="text-center py-4" @click="handleClickCall">
<icon
name="icon-a-dianhua"
color="#3E4FAF"
size="17"
class="inline-block pr-3 align-text-bottom"
/>
<span class="text-app-blue text-sm align-middle font-semibold">呼叫95533</span>
</div>
</van-popup>
<van-popup
v-model:show="show"
round
:style="{ width: '90%', margin: '60px auto 0px auto', top: '80%' }"
teleport="body"
:overlay="false"
>
<div
class="text-app-blue text-sm font-semibold border-t border-gray-200 text-center py-4"
@click="show = false"
>取消</div>
</van-popup>
<show-call :show="show" :phone="phone" @hidden="hidden" />
</div>
</template>
<script lang="ts" setup>
import { computed, PropType, ref } from 'vue'
import { computed, defineComponent, PropType, ref } from 'vue'
import Icon from "@/components/common/Icon.vue"
import { transfterStrToDate } from '@/utils/transfer'
import AddressService from '@/service/AddressService'
......@@ -114,9 +92,14 @@ import jsBridge from "@/utils/jsBridge2"
import UserService from '@/service/UserService'
import { authCheck } from '@/utils/authCheck'
import router from '@/router'
import ShowCall from '@/components/showCall/index.vue'
const addressService = new AddressService()
const components = defineComponent({
ShowCall
})
const props = defineProps({
changeable: {
type: Boolean,
......@@ -207,23 +190,24 @@ const getErrorNote = () => {
getErrorNote()
let show = ref(false)
const phone = ref('')
const toCall = () => {
if (isOpen) {
show.value = true
}
authCheck(async () => {
const ret = await UserService.getInstance().contact_custom_service({
outLetID: props.outlet_id as number
})
if (ret.code === 200) {
phone.value = ret.data.phone
show.value = true
}
})
}
const handleClickCall = async () => {
const ret = await UserService.getInstance().contact_custom_service({
outLetID: props.outlet_id as number
})
if (ret.code === 200) {
new jsBridge().bridge_call(ret.data.phone, () => {
show.value = false;
})
}
const hidden = (v: boolean) => {
show.value = v
}
const handleClickNagigate = () => {
new jsBridge().bridge_navigate(`${props.longitude},${props.latitude}`, () => {
show.value = false;
......
<template>
<div>
<van-popup v-model:show="show" round teleport="body" :style="{ width: '90%', top: '80%' }" @click-overlay="hide">
<div class="text-center py-4" @click="handleClickCall">
<icon
name="icon-a-dianhua"
color="#3E4FAF"
size="17"
class="inline-block pr-3 align-text-bottom"
/>
<span class="text-app-blue text-sm align-middle font-semibold">呼叫{{ phone }}</span>
</div>
</van-popup>
<van-popup
v-model:show="show"
round
:style="{ width: '90%', margin: '60px auto 0px auto', top: '80%' }"
teleport="body"
:overlay="false"
@click-overlay="hide"
>
<div
class="text-app-blue text-sm font-semibold border-t border-gray-200 text-center py-4"
@click="hide"
>取消</div>
</van-popup>
</div>
</template>
<script lang="ts" setup>
import Vue, { ComponentInternalInstance, getCurrentInstance } from 'vue'
import jsBridge from "@/utils/jsBridge2"
const { ctx } = getCurrentInstance() as any
console.log(ctx)
const props = defineProps({
show: {
type: Boolean,
default: false,
},
phone: {
type: String,
}
})
const hide = () => {
console.log(ctx, 'ctx')
ctx.$emit('hidden', false)
}
const handleClickCall = async () => {
console.log(props.phone)
new jsBridge().bridge_call(props.phone, () => {
ctx.$emit('hidden', false)
})
}
</script>
\ No newline at end of file
......@@ -7,7 +7,7 @@ export default {
filterDistance(distance: string){
if(!distance) return ''
const m = Number(distance)
const k = (m / 1000).toFixed(2)
const k = (m).toFixed(2)
return `${k}km`
}
} as { [key: string]: (...args: any) => any }
......@@ -12,6 +12,15 @@ class AddressService {
}
getNearby(data: { bank_code: number; number: number }) {
return baseAxios<iNearbyOutLet[]>({
method: 'post',
url: '/address/nearby',
data: {
...data,
longitude: '120.194393',
latitude: '30.244417',
},
})
return new Promise<iRet<iNearbyOutLet[]>>((resolve) => {
function getGps() {
new Bridge().bridge_getGps(null, (params: any) => {
......@@ -38,7 +47,9 @@ class AddressService {
(position) => {
const la = position.coords.latitude.toString()
const lo = position.coords.longitude.toString()
console.log(position, 'position')
resolve(
baseAxios<iNearbyOutLet[]>({
method: 'post',
url: '/address/nearby',
......@@ -51,6 +62,7 @@ class AddressService {
)
},
(error) => {
console.log(error)
getGps()
},
)
......
......@@ -6,8 +6,8 @@ export function transfterStrToDate(str: string) {
start = start.replace(':', ':').replace('早上', '').replace('下午', '')
end = end.replace(':', ':').replace('早上', '').replace('下午', '')
const d = new Date()
start = `${d.getFullYear()} ${d.getMonth() + 1} ${d.getDate()} ${start}`
end = `${d.getFullYear()} ${d.getMonth() + 1} ${d.getDate()} ${end}`
start = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()} ${start}`
end = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()} ${end}`
const startDate = new Date(start)
const endDate = new Date(end)
return [startDate, endDate]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment