移除不要的文件
This commit is contained in:
6
env/.env.development
vendored
6
env/.env.development
vendored
@ -8,10 +8,10 @@ VITE_DELETE_CONSOLE = false
|
||||
VITE_SHOW_SOURCEMAP = true
|
||||
|
||||
# 请求地址
|
||||
VITE_SERVER_BASEURL = 'https://76458.com'
|
||||
VITE_SERVER_BASEURL = 'https://test1.stnav.com'
|
||||
# 图片上传路径
|
||||
VITE_UPLOAD_BASEURL = 'https://76458.com/upload'
|
||||
VITE_UPLOAD_BASEURL = 'https://test1.stnav.com/upload'
|
||||
|
||||
# 上传图片请求地址
|
||||
VITE_UPLOAD_BASEURL = 'https://76458.com/storeapi/upload/image'
|
||||
VITE_UPLOAD_BASEURL = 'https://test1.stnav.com/storeapi/upload/image'
|
||||
VITE_UPLOAD_IMAGE_URL = 'https://chaz.oss-cn-shanghai.aliyuncs.com/'
|
||||
@ -2,7 +2,6 @@
|
||||
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
|
||||
import { navigateToInterceptor } from '@/router/interceptor'
|
||||
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
|
||||
import { LOCATION_DEFAULT_CITY, LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG, LOCATION_LAT_KEY, LOCATION_LNG_KEY, LOCATION_CITY_KEY } from '@/hooks/useLocation'
|
||||
|
||||
onLaunch((options) => {
|
||||
// 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
|
||||
|
||||
@ -10,81 +10,6 @@ import type {
|
||||
} from '@/api/types/tea-room'
|
||||
import type { ITeaSpecialistFuture7DaysResult, ITeaSpecialistOrderDetailsResult } from '@/api/types/tea'
|
||||
|
||||
/**
|
||||
* 经纬度转换为城市
|
||||
*/
|
||||
export interface ILocationToCityParams {
|
||||
latitude: number
|
||||
longitude: number
|
||||
}
|
||||
|
||||
export function getLocationToCity(data: ILocationToCityParams) {
|
||||
return http.Post<{
|
||||
message: string
|
||||
result: {
|
||||
ad_info: {
|
||||
province: string
|
||||
city: string
|
||||
district: string
|
||||
adcode: string
|
||||
},
|
||||
location: {
|
||||
lat: number
|
||||
lng: number
|
||||
}
|
||||
}
|
||||
}>('/api/common/cityAddress',
|
||||
data,
|
||||
{
|
||||
meta: { ignoreAuth: true }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门店列表
|
||||
*/
|
||||
export interface IHomeTeaStoreListParams {
|
||||
page: number
|
||||
size: number
|
||||
search: string
|
||||
latitude: number
|
||||
longitude: number
|
||||
}
|
||||
|
||||
export function getHomeTeaStoreList(data: IHomeTeaStoreListParams) {
|
||||
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreLists',
|
||||
data,
|
||||
{
|
||||
meta: { ignoreAuth: true }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取茶室开通城市列表
|
||||
*/
|
||||
export function getOpenCityList() {
|
||||
return http.Post<IOpenCityListResult>('/api/teaStore/teaStoreCity',
|
||||
{
|
||||
meta: { ignoreAuth: true }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶室搜索历史
|
||||
*/
|
||||
export function getTeaRoomSearchHistory() {
|
||||
return http.Post<{ list: Array<string> }>('/api/teaStore/teaStoreSearchHistory')
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除茶室搜索历史
|
||||
*/
|
||||
export function clearTeaRoomSearchHistory() {
|
||||
return http.Post('/api/teaStore/delTeaStoreSearchHistory', null)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶室详情
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
import { http } from '@/http/alova'
|
||||
import type { IOrderListResult, IOrderDetailsResult } from '@/api/types/teaSpecialist-order'
|
||||
|
||||
/**
|
||||
* 茶艺师-获取订单列表
|
||||
*/
|
||||
export interface ITeaSpecialistOrderListParams {
|
||||
page: number
|
||||
size: number
|
||||
order_status: string
|
||||
search: string
|
||||
}
|
||||
|
||||
export function getTeaSpecialistOrderList(data: ITeaSpecialistOrderListParams) {
|
||||
return http.Post<IOrderListResult>('/api/order/orderList',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师-获取订单详情
|
||||
*/
|
||||
export interface ITeaSpecialistOrderDetailsParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function getTeaSpecialistOrderDetails(data: ITeaSpecialistOrderDetailsParams) {
|
||||
return http.Post<IOrderDetailsResult>('/api/order/orderDetails',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师-取消订单
|
||||
*/
|
||||
export interface ICancelTeaSpecialistOrderParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function cancelTeaSpecialistOrder(data: ICancelTeaSpecialistOrderParams) {
|
||||
return http.Post('/api/order/cancelOrder',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师-删除订单
|
||||
*/
|
||||
export interface IDeleteTeaSpecialistOrderParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function deleteTeaSpecialistOrder(data: IDeleteTeaSpecialistOrderParams) {
|
||||
return http.Post('/api/order/delOrder',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师-确认(完成)订单
|
||||
*/
|
||||
export interface IConfirmTeaSpecialistOrderParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function confirmTeaSpecialistOrder(data: IConfirmTeaSpecialistOrderParams) {
|
||||
return http.Post('/api/order/userConfirmOrder',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 茶艺师-订单退款
|
||||
*/
|
||||
export interface IRefundTeaSpecialistOrderParams {
|
||||
id: number
|
||||
order_type: string
|
||||
}
|
||||
|
||||
export function refundTeaSpecialistOrder(data: IRefundTeaSpecialistOrderParams) {
|
||||
return http.Post('/api/pay/refund',
|
||||
data
|
||||
)
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
import { http } from '@/http/alova'
|
||||
import type { IUserAddressListResult, IUserAddressDetailsResult, IUserCouponListResult } from '@/api/types/user'
|
||||
import type { IOrderListResult } from '@/api/types/teaSpecialist-order'
|
||||
import type { IUserResult } from '@/api/types/user'
|
||||
|
||||
|
||||
@ -1,604 +0,0 @@
|
||||
<route lang="jsonc" type="page">
|
||||
{
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<view class="pb-254rpx">
|
||||
|
||||
<!-- 一键续订 -->
|
||||
<wd-popup v-model="showRenewPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pb-26rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showRenewPopup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">续订包间</view>
|
||||
<view>
|
||||
<scroll-view scroll-y class="h-[660rpx] pb-20rpx">
|
||||
<view class="mx-60rpx">
|
||||
<view class="text-[#01000D] text-32rpx leading-44rpx">续订时间</view>
|
||||
<view class="grid grid-cols-4 gap-x-20rpx gap-y-20rpx mt-28rpx">
|
||||
<view v-for="item in timeList" :key="item.id"
|
||||
class="h-72rpx rounded-16rpx flex items-center justify-center text-28rpx leading-40rpx"
|
||||
:class="[item.id == selectedRenewTime ? 'bg-[#4C9F44] text-[#fff]' : 'bg-[#F7F7F7] text-[#606266]']"
|
||||
@click="selectedRenewTime = item.id">
|
||||
{{ item.time }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mx-60rpx mt-50rpx">
|
||||
<view class="text-[#01000D] text-32rpx leading-44rpx">续订茶叶
|
||||
<text class="text-26rpx leading-36rpx text-[#909399] ml-20rpx">支持多选</text>
|
||||
</view>
|
||||
<view class="grid grid-cols-3 gap-x-20rpx gap-y-20rpx mt-28rpx">
|
||||
<view v-for="item in teaList" :key="item.id"
|
||||
class="h-110rpx rounded-16rpx flex flex-col items-center justify-center text-28rpx leading-40rpx"
|
||||
:class="selectedRenewTea.includes(item.id) ? 'bg-[#4C9F44] text-[#fff]' : 'bg-[#F7F7F7] text-[#606266]'"
|
||||
@click="OrderDetail.handleToggleRenewTea(item.id)">
|
||||
<view>{{item.title}}</view>
|
||||
<view>{{item.price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mx-60rpx mt-60rpx">
|
||||
<view class="text-[#01000D] text-32rpx leading-44rpx">支付方式</view>
|
||||
<view class="mt-28rpx">
|
||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44">
|
||||
<view class="flex justify-between items-center mb-40rpx" v-for="(item, index) in payList" :key="index" @click="pay = item.id">
|
||||
<view class="flex items-center">
|
||||
<wd-img width="50rpx" height="50rpx" :src="item.icon"></wd-img>
|
||||
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="flex items-center">
|
||||
<wd-radio :value="item.value">
|
||||
<view class="text-[#303133] text-26rpx leading-36rpx mr-20rpx" v-if="item.id == 1">可用202.22</view>
|
||||
</wd-radio>
|
||||
</view>
|
||||
</view>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view>
|
||||
<wd-gap height="2rpx" bg-color="#EFF0F2"></wd-gap>
|
||||
</view>
|
||||
|
||||
<view class="flex justify-between items-center mt-50rpx mx-60rpx">
|
||||
<view class="flex items-center">
|
||||
<view class="text-24rpx text-[#303133] leading-34rpx">合计:</view>
|
||||
<view class="flex items-center h-56rpx mr-16rpx">
|
||||
<price-format color="#FF5951" :first-size="40" :second-size="40" :subscript-size="28" :price="23.02"></price-format>
|
||||
<view class="ml-20rpx">
|
||||
<price-format color="#909399" :first-size="26" :second-size="26" :subscript-size="26" :price="23.02" lineThrough></price-format>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx'>立即预定</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 续订成功 -->
|
||||
<wd-popup v-model="showRenewSuccessPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pt-64rpx pb-74rpx">
|
||||
<view class="flex justify-center items-center">
|
||||
<view class="bg-[#4C9F44] w-280rpx rounded-280rpx">
|
||||
<wd-img width="280rpx" height="280rpx" :src="`${OSS}images/reserve_room/reserve_room_image7.png`"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-[#303133] text-36rpx leading-46rpx text-center mt-48rpx">茶艺师续订成功</view>
|
||||
<view class="text-[#9CA3AF] text-28rpx leading-44rpx mt-16rpx text-center">可以刷新页面查看预约时间</view>
|
||||
<view class="w-630rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] rounded-8rpx text-[#fff] mt-174rpx mx-auto">好的</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 退款规则 -->
|
||||
<wd-popup v-model="showRefundRule" custom-class="rounded-16rpx" lock-scroll>
|
||||
<view class="w-592rpx py-52rpx">
|
||||
<view class="text-36rpx text-[#303133] leading-50rpx text-center">确定申请退款吗?</view>
|
||||
<view class="font-400 text-32rpx text-[#303133] leading-44rpx text-center mt-40rpx">退款按照如下规则,请谨慎操作。</view>
|
||||
<view class="font-400 text-32rpx text-[#303133] leading-44rpx px-54rpx mt-18rpx">
|
||||
<view>1)茶艺师未出发,100%退款;</view>
|
||||
<view>2)茶艺师已出发未到达目的地,不退车马费;</view>
|
||||
<view>3)茶艺师出发并到达目的地,不退车马费,并且支付茶艺师50%服务费。</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-54rpx text-32rpx leading-44rpx flex items-center justify-center leading-80rpx text-center">
|
||||
<view class="w-240rpx h-80rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="showRefundRule = false">取消</view>
|
||||
<view class="w-240rpx h-80rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleConfirmRefund">确定退款</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 取消订单 -->
|
||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||
|
||||
<!-- 费用详情 -->
|
||||
<wd-popup v-model="showCostPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pb-30rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showCostPopup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">费用明细</view>
|
||||
<view>
|
||||
<view class="px-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">服务费</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] flex items-center">
|
||||
¥640.00
|
||||
</view>
|
||||
</view>
|
||||
<view class="rounded-16rpx py-20rpx">
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>服务费(¥160元/小时)</view>
|
||||
<view>x4</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="px-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">车马费</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] flex items-center">
|
||||
¥640.00
|
||||
</view>
|
||||
</view>
|
||||
<view class="rounded-16rpx py-20rpx">
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>车马费(¥3.00元/公里)</view>
|
||||
<view>x4</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="px-30rpx mb-20rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">茶艺服务</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] flex items-center">
|
||||
¥640.00
|
||||
</view>
|
||||
</view>
|
||||
<view class="rounded-16rpx py-20rpx">
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>红茶/绿茶/福鼎白茶/铁观音</view>
|
||||
<view>¥158</view>
|
||||
</view>
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>茶具使用</view>
|
||||
<view>¥158</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="px-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">优惠</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] flex items-center text-[#4C9F44]">
|
||||
-¥148.00
|
||||
</view>
|
||||
</view>
|
||||
<view class="rounded-16rpx pt-20rpx">
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>优惠券</view>
|
||||
<view>-¥20</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mx-60rpx mt-30rpx">
|
||||
<wd-gap height="2rpx" bg-color="#F6F7F9"></wd-gap>
|
||||
</view>
|
||||
<view class="mx-60rpx text-30rpx text-[#303133] leading-42rpx flex items-center justify-between mt-30rpx">
|
||||
<view>实付金额</view>
|
||||
<view>¥698.90</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<view>
|
||||
<navbar :title="title" custom-class='!bg-[#F6F7F8]' :leftArrow="false"></navbar>
|
||||
</view>
|
||||
|
||||
<view class="text-[#909399] text-26rpx leading-36rpx mb-40rpx">
|
||||
<view class="text-center" v-if="orderStatus == TeaSpecialistOrderStatus.Serving || orderStatus == TeaSpecialistOrderStatus.Pay">使用过程中有任何问题,请联系客服</view>
|
||||
<view class="flex items-center justify-center" v-if="orderStatus == TeaSpecialistOrderStatus.Pending">
|
||||
<view class="flex items-center mr-6rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
||||
</view>
|
||||
<view class="flex items-center text-26rpx leading-36rpx text-[#909399]">
|
||||
<view>还剩</view>
|
||||
<view class="mx-6rpx">
|
||||
<wd-count-down :time="order.time1" custom-class="!text-[#FF5951]" />
|
||||
</view>
|
||||
<view>订单自动取消</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ml-80rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Finished">感谢您的选择,期待再续茶香!</view>
|
||||
<view class="ml-80rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Confirm">您的服务已经结束,请及时确认订单</view>
|
||||
</view>
|
||||
|
||||
<!-- 信息模块 -->
|
||||
<view class="mx-30rpx coupon-bg" >
|
||||
<view class="flex items-center px-30rpx pt-30rpx">
|
||||
<view class="mr-30rpx">
|
||||
<wd-img width="190rpx" height="190rpx" :src="order.teamaster.image" mode="scaleToFill"></wd-img>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx line-1 w-280rpx">
|
||||
{{ order.teamaster.name }}
|
||||
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
|
||||
</view>
|
||||
<view class="text-26rpx leading-36rpx text-[#909399]">¥{{ order.order_amount }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
||||
<view>¥{{ order.teamaster.price }}/小时</view>
|
||||
<view>x{{ order.hours }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
||||
<view class="w-300rpx line-1">车马费(¥{{ order.fare_price }}元/公里)</view>
|
||||
<view>¥{{ order.fare_distance_price }}/小时</view>
|
||||
</view>
|
||||
<view class="text-[#606266] text-right mt-26rpx" v-if="orderStatus !== TeaSpecialistOrderStatus.Pending">
|
||||
<text class="text-24rpx leading-34rpx mr-12rpx">实付</text>
|
||||
<text class="tetx-32rpx leading-36rpx">¥{{ order.order_amount }}</text>
|
||||
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-70rpx">
|
||||
<view class="text-30rpx leading-42rpx text-[#303133] px-30rpx">预约信息</view>
|
||||
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx pb-28rpx"
|
||||
v-if="orderStatus == TeaSpecialistOrderStatus.Pending || orderStatus == TeaSpecialistOrderStatus.Pay || orderStatus == TeaSpecialistOrderStatus.Serving || orderStatus == TeaSpecialistOrderStatus.Confirm">
|
||||
<view class="mb-20rpx px-30rpx">预约时间:{{ order.start_time }} - {{ order.end_time }}</view>
|
||||
<view class="flex justify-between items-center pl-30rpx">
|
||||
<view>预约时长:{{ order.hours }}小时</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx pb-28rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Cancelled || orderStatus == TeaSpecialistOrderStatus.Finished">
|
||||
<view class="mb-20rpx px-30rpx">服务时间:{{ order.start_time }} - {{ order.end_time }}</view>
|
||||
<view class="flex justify-between items-center pl-30rpx">
|
||||
<view>服务时长:{{ order.hours }}小时</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 服务方式 -->
|
||||
<view class="bg-white rounded-16rpx px-30rpx pb-32rpx mx-30rpx mt-20rpx">
|
||||
<view class="pt-32rpx text-[#303133] text-32rpx leading-44rpx">服务方式</view>
|
||||
<view>
|
||||
<view class="flex justify-between items-center relative">
|
||||
<view>
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx">服务方式</view>
|
||||
<view class="text-[#303133]">{{ Number(order.service_type) == 1 ? '到店服务' : '上门服务'}}</view>
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx">{{ Number(order.service_type) == 1 ? '服务门店' : '服务地址'}}</view>
|
||||
<view class="text-[#303133] line-1 w-300rpx" v-if="Number(order.service_type) == 1">{{ order.store_address.name }}</view>
|
||||
<view class="text-[#303133] line-1 w-300rpx" v-if="Number(order.service_type) != 1">
|
||||
{{ order.address.province }} {{ order.address.city }} {{ order.address.district }} {{ order.address.address }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx">到达时长</view>
|
||||
<view class="text-[#303133]">{{ order.reach_time }}分钟左右到达</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex absolute top-1/2 right-0 -translate-y-1/2">
|
||||
<view class="text-center mr-20rpx" @click="OrderDetail.handleOpenMap">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
||||
</view>
|
||||
<view class="text-center" v-if="orderStatus != TeaSpecialistOrderStatus.Pending" @click="OrderDetail.handleCallService">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="bg-white rounded-16rpx px-30rpx py-34rpx mx-30rpx mt-20rpx">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx">订单信息</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||
<view>订单编号</view>
|
||||
<view>
|
||||
<text>{{ order.order_sn }}</text>
|
||||
<wd-divider vertical />
|
||||
<text class="text-[#4C9F44]" @click="OrderDetail.handleCopy(order.order_sn)">复制</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx" v-if="orderStatus != TeaSpecialistOrderStatus.Pending && order.pay_way">
|
||||
<view>交易方式</view>
|
||||
<view>{{ order.pay_way_title }}</view>
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||
<view>创建时间</view>
|
||||
<view>{{ order.dtime }}</view>
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx" v-if="orderStatus != TeaSpecialistOrderStatus.Pending && orderStatus != TeaSpecialistOrderStatus.Cancelled">
|
||||
<view>付款时间</view>
|
||||
<view>{{ order.update_dtime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx" v-if="orderStatus != TeaSpecialistOrderStatus.Cancelled && orderStatus != TeaSpecialistOrderStatus.Finished">
|
||||
<view class="mt-34rpx">
|
||||
<!-- 预约单、服务中 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center mt-34rpx" v-if="orderStatus === TeaSpecialistOrderStatus.Serving || orderStatus == TeaSpecialistOrderStatus.Confirm">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleConfirmOrder">确认订单</view>
|
||||
</view>
|
||||
|
||||
<!-- 待付款 -->
|
||||
<view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Pending">
|
||||
<view class="flex items-center">
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] mr-16rpx" @click="OrderDetail.handleCancelOrder">取消订单</view>
|
||||
</view>
|
||||
<view class="w-360rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleToPay">立即支付¥{{ order.order_amount }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 已预约 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus == TeaSpecialistOrderStatus.Pay">
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="showRefundRule = true">申请退款</view>
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="OrderDetail.handleCallService">联系客服</view>
|
||||
</view>
|
||||
|
||||
<!-- 交易完成 -->
|
||||
<!-- <view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center mt-34rpx"
|
||||
v-if="orderStatus == TeaSpecialistOrderStatus.Finished || orderStatus == TeaSpecialistOrderStatus.Cancelled">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">再次预定</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { TeaSpecialistOrderStatusTextValue, TeaSpecialistOrderStatus } from '@/utils/order'
|
||||
import { getTeaSpecialistOrderDetails } from '@/api/teaSpecialist-order'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
|
||||
const title = ref<string>('')
|
||||
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||
const showRefundRule = ref<boolean>(false) // 退款规则弹窗
|
||||
|
||||
// 订单倒计时取消
|
||||
const time = ref<number>(30 * 60 * 60 * 1000)
|
||||
|
||||
// 取消订单弹窗
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
// 费用明细
|
||||
const showCostPopup = ref<boolean>(false) // 是否显示退款详情弹出框
|
||||
|
||||
/** 续订 **/
|
||||
const showRenewPopup = ref<boolean>(false)
|
||||
const timeList = [
|
||||
{id: 1, time: '1小时'},
|
||||
{id: 2, time: '2小时'},
|
||||
{id: 3, time: '3小时'},
|
||||
{id: 4, time: '4小时'},
|
||||
{id: 5, time: '5小时'},
|
||||
{id: 6, time: '6小时'},
|
||||
]
|
||||
const selectedRenewTime = ref<number>(0) // 选择的续订时间
|
||||
const pay = ref<number>(1) // 支付方式
|
||||
const payList = ref<Array<any>>([
|
||||
{
|
||||
id: 1,
|
||||
name: '平台余额',
|
||||
icon: `${OSS}icon/icon_platform_balance.png`,
|
||||
balance: 0,
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '微信支付',
|
||||
icon: `${OSS}icon/icon_weichat.png`,
|
||||
balance: 0,
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
|
||||
const teaList = [
|
||||
{id: 1, title: '红茶(3泡)', price: '¥128.00'},
|
||||
{id: 2, title: '铁观音(3泡)', price: '¥128.00'},
|
||||
{id: 3, title: '红茶(3泡)', price: '¥128.00'},
|
||||
{id: 4, title: '红茶(3泡)', price: '¥128.00'},
|
||||
{id: 5, title: '红茶(3泡)', price: '¥128.00'},
|
||||
]
|
||||
const selectedRenewTea = ref<Array<any>>([]) // 选择的续订时间
|
||||
const showRenewSuccessPopup = ref<boolean>(false)
|
||||
|
||||
// 订单
|
||||
const orderId = ref<number>(0)
|
||||
const order = ref<any>({})
|
||||
|
||||
onLoad(async (args) => {
|
||||
orderId.value = args.orderId
|
||||
// 获取订单详情
|
||||
OrderDetail.handleInit()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
const OrderDetail = {
|
||||
// 获取订单详情
|
||||
handleInit: async () => {
|
||||
const res = await getTeaSpecialistOrderDetails({id: orderId.value})
|
||||
const data = res.details
|
||||
order.value = data
|
||||
title.value = TeaSpecialistOrderStatusTextValue[data.order_status].title || '订单详情'
|
||||
console.log("🚀 ~ title.value:", title.value)
|
||||
orderStatus.value = data.order_status
|
||||
},
|
||||
|
||||
// 确认订单
|
||||
handleConfirmOrder: () => {
|
||||
message.confirm({
|
||||
title: '确认订单',
|
||||
msg: '为保障您的权益,请茶艺师服务完成后在确认订单',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
// 点击确认按钮回调事件
|
||||
if (res.action == 'confirm') {
|
||||
uni.$on('refreshOrderDetail', () => {
|
||||
OrderDetail.handleInit()
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
handleConfirmOrderHooks(orderId.value)
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
// 续订茶艺师
|
||||
handleToggleRenewTea: (id: number) => {
|
||||
const idx = selectedRenewTea.value.indexOf(id)
|
||||
if (idx > -1) {
|
||||
selectedRenewTea.value.splice(idx, 1) // 已选中则移除
|
||||
} else {
|
||||
selectedRenewTea.value.push(id) // 未选中则添加
|
||||
}
|
||||
},
|
||||
|
||||
// 再次预定
|
||||
handleAgainReeserve: () => {
|
||||
showRenewSuccessPopup.value = true
|
||||
showRenewPopup.value = false
|
||||
},
|
||||
|
||||
// 申请退款
|
||||
handleConfirmRefund: () => {
|
||||
uni.$on('refreshOrderDetail', () => {
|
||||
showRefundRule.value = false
|
||||
|
||||
OrderDetail.handleInit()
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
handleRefundOrderHooks(orderId.value, 'order')
|
||||
|
||||
},
|
||||
|
||||
// 取消订单
|
||||
handleCancelOrder: () => {
|
||||
message.confirm({
|
||||
title: '确定取消订单?',
|
||||
msg: '取消订单后无法恢复,优惠券可退回',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
// 点击确认按钮回调事件
|
||||
uni.$on('refreshOrderDetail', () => {
|
||||
OrderDetail.handleInit()
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
handleCancelOrderHooks(orderId.value)
|
||||
}
|
||||
toast.info('订单取消成功')
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
// 支付
|
||||
handleToPay: () => {
|
||||
uni.$on('refreshOrderDetail', () => {
|
||||
OrderDetail.handleInit()
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
handleToPayHooks(orderId.value, order.value.teamaster.id)
|
||||
},
|
||||
|
||||
// 打开地图
|
||||
handleOpenMap: () => {
|
||||
if (Number(order.value.service_type) == 1) {
|
||||
uni.openLocation({
|
||||
latitude: Number(order.value.store_address.latitude),
|
||||
longitude: Number(order.value.store_address.longitude),
|
||||
name: order.value.store_address.name,
|
||||
address: order.value.store_address.address,
|
||||
})
|
||||
|
||||
} else {
|
||||
uni.openLocation({
|
||||
latitude: Number(order.value.address.latitude),
|
||||
longitude: Number(order.value.address.longitude),
|
||||
name: order.value.address.address,
|
||||
address: order.value.address.province + ' ' + order.value.address.city + ' ' + order.value.address.district + ' ' + order.value.address.address,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 联系客服
|
||||
handleCallService: () => {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: order.value.customer_service_phone, // 替换为需要拨打的电话号码
|
||||
});
|
||||
},
|
||||
|
||||
// 复制订单号
|
||||
handleCopy: (text: string) => {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
toast.info('复制成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $cz-page-background;
|
||||
}
|
||||
|
||||
.coupon-bg {
|
||||
background-image: url(#{$OSS}images/order/order_image2.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
</style>
|
||||
@ -1,196 +0,0 @@
|
||||
<route lang="jsonc" type="page">{
|
||||
"needLogin": true,
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}</route>
|
||||
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="order-list sticky top-0 left-0 z-50 bg-[#F6F7F8] pb-10rpx">
|
||||
<wd-navbar safeAreaInsetTop custom-class='!bg-[#F6F7F8]' :bordered="false" placeholder>
|
||||
<template #left>
|
||||
<view class="h-48rpx flex items-center">
|
||||
<view class="mt-4rpx" @click="router.navigateBack()">
|
||||
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
||||
</view>
|
||||
<view class="search-box">
|
||||
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索茶室订单"></wd-search>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view class="tabs">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
|
||||
<wd-tab title="全部" :name="TeaSpecialistOrderStatusText.All"></wd-tab>
|
||||
<wd-tab title="待付款" :name="TeaSpecialistOrderStatusText.Pending"></wd-tab>
|
||||
<wd-tab title="预约单" :name="TeaSpecialistOrderStatusText.Pay"></wd-tab>
|
||||
<wd-tab title="待确认" :name="TeaSpecialistOrderStatusText.Confirm"></wd-tab>
|
||||
<wd-tab title="已完结" :name="TeaSpecialistOrderStatusText.Finished"></wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tabs mt-18rpx mx-30rpx">
|
||||
<!-- 这里可以尝试下不重新刷新获取列表 -->
|
||||
<!-- 全部 -->
|
||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.TeaRoom" :order="item"></combo-card>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
|
||||
<!-- 待付款 -->
|
||||
<!-- <mescroll-body ref="mescrollItem1" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Pending">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||
</view>
|
||||
</mescroll-body> -->
|
||||
|
||||
<!-- 预约单 -->
|
||||
<!-- <mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Reserved">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||
</view>
|
||||
</mescroll-body> -->
|
||||
|
||||
<!-- 待确认 -->
|
||||
<!-- <mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Confirm">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||
</view>
|
||||
</mescroll-body> -->
|
||||
|
||||
<!-- 已完结 -->
|
||||
<!-- <mescroll-body ref="mescrollItem3" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" v-if="tab === OrderStatus.Finished">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||
</view>
|
||||
</mescroll-body> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getTeaSpecialistOrderList } from '@/api/teaSpecialist-order'
|
||||
import ComboCard from '@/components/order/ComboCard.vue'
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { OrderSource, OrderStatus, TeaSpecialistOrderStatusText, TeaSpecialistOrderStatusValue } from '@/utils/order'
|
||||
import { router } from '@/utils/tools'
|
||||
|
||||
/* mescroll */
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||
const downOption = {
|
||||
auto: true
|
||||
}
|
||||
const upOption = {
|
||||
auto: true,
|
||||
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||
}
|
||||
const list = ref<Array<any>>([]) // 茶艺师列表
|
||||
const keywords = ref<string>('')
|
||||
const orderStatus = ref<string>('')
|
||||
|
||||
|
||||
// tab
|
||||
const tab = ref<string>('all')
|
||||
|
||||
onLoad((args) => {
|
||||
uni.$on('refreshOrderList', () => {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll()
|
||||
})
|
||||
|
||||
// 根据传过来的参数决定显示哪个tab
|
||||
if (args.orderStatus) {
|
||||
tab.value = args.orderStatus
|
||||
}
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.$off('refreshOrderList')
|
||||
})
|
||||
|
||||
const OrderList = {
|
||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||
upCallback: (mescroll) => {
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
order_status: orderStatus.value,
|
||||
search: keywords.value
|
||||
}
|
||||
|
||||
getTeaSpecialistOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
})
|
||||
},
|
||||
|
||||
// 切换tab
|
||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||
tab.value = e.name
|
||||
if (e.name === TeaSpecialistOrderStatusText.Pending) {
|
||||
orderStatus.value = '0'
|
||||
} else {
|
||||
orderStatus.value = TeaSpecialistOrderStatusValue[e.name] || ''
|
||||
}
|
||||
|
||||
// 切换tab时,重置当前的mescroll
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
},
|
||||
|
||||
// 返回上一页
|
||||
handleBack: () => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $cz-page-background;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
:deep() {
|
||||
.wd-navbar__left {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tabs {
|
||||
:deep() {
|
||||
.wd-tabs,
|
||||
.wd-tabs__nav {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.wd-tabs__nav-item {
|
||||
font-weight: 400 !important;
|
||||
font-size: 28rpx !important;
|
||||
color: #606266 !important;
|
||||
line-height: 40rpx !important;
|
||||
padding: 0 30rpx !important;
|
||||
}
|
||||
|
||||
.wd-tabs__nav-item.is-active {
|
||||
font-weight: 500 !important;
|
||||
color: #303133 !important;
|
||||
font-size: 32rpx !important;
|
||||
line-height: 44rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,188 +0,0 @@
|
||||
import { getLocationToCity } from '@/api/tea-room'
|
||||
|
||||
const LOCATION_EXPIRE_MS = 30 * 24 * 60 * 60 * 1000 // 定位缓存30天
|
||||
const LOCATION_DENY_INTERVAL = 60 * 60 * 1000 // 未授权定位,弹窗间隔1小时
|
||||
|
||||
export const LOCATION_EXPIRE_KEY = 'location_expire_time' // 定位缓存KEY
|
||||
export const LOCATION_DEFAULT_CITY = '上海市' // 默认城市
|
||||
export const LOCATION_DEFAULT_LAT = 31.230393 // 上海经度
|
||||
export const LOCATION_DEFAULT_LNG = 121.473629 // 上海纬度
|
||||
export const LOCATION_DENY_TIME_KEY = 'location_deny_time' // 未授权定位,重新授权时间KEY
|
||||
export const LOCATION_CITY_KEY = 'city' // 城市缓存KEY
|
||||
export const LOCATION_LAT_KEY = 'latitude' // 城市缓存KEY
|
||||
export const LOCATION_LNG_KEY = 'longitude' // 城市缓存KEY
|
||||
|
||||
// 检查过期时间
|
||||
export function handleCheckLocationCacheHooks() {
|
||||
const expire = uni.getStorageSync(LOCATION_EXPIRE_KEY)
|
||||
if (expire && Date.now() > expire) {
|
||||
uni.removeStorageSync(LOCATION_LAT_KEY)
|
||||
uni.removeStorageSync(LOCATION_LNG_KEY)
|
||||
uni.removeStorageSync(LOCATION_EXPIRE_KEY)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 设置经纬度缓存
|
||||
export function handleSetLocationCacheHooks(lat: number, lng: number) {
|
||||
uni.setStorageSync(LOCATION_LAT_KEY, lat)
|
||||
uni.setStorageSync(LOCATION_LNG_KEY, lng)
|
||||
uni.setStorageSync(LOCATION_EXPIRE_KEY, Date.now() + LOCATION_EXPIRE_MS)
|
||||
}
|
||||
|
||||
// 初始化经纬度
|
||||
export async function handleEnsureLocationAuthHooks() {
|
||||
// 1. 检查缓存
|
||||
if (handleCheckLocationCacheHooks()) {
|
||||
const lat = uni.getStorageSync(LOCATION_LAT_KEY)
|
||||
const lng = uni.getStorageSync(LOCATION_LNG_KEY)
|
||||
if (lat && lng) return { lat, lng }
|
||||
}
|
||||
|
||||
// 2. 获取定位
|
||||
return new Promise<{ lat: number, lng: number, }>((resolve) => {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success() {
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
||||
resolve({ lat: res.latitude, lng: res.longitude})
|
||||
},
|
||||
fail() {
|
||||
// 定位失败,返回默认上海
|
||||
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
// 用户拒绝授权
|
||||
if (shouldShowAuthModal()) {
|
||||
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要获取您的地理位置,请授权定位服务',
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
// 可引导用户去设置页面
|
||||
uni.openSetting({})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 返回默认上海
|
||||
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并弹窗授权地理位置(每小时弹一次,授权后自动获取定位)
|
||||
* 返回 Promise<boolean>,true 表示已授权,false 表示未授权
|
||||
*/
|
||||
export function checkLocationAuthWithModal(): Promise<{ lat: number, lng: number } | false> {
|
||||
return new Promise((resolve) => {
|
||||
uni.getSetting({
|
||||
success(settingRes) {
|
||||
const hasAuth = settingRes.authSetting && settingRes.authSetting['scope.userLocation']
|
||||
if (hasAuth) {
|
||||
// 已授权,自动获取并返回经纬度
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
||||
resolve({ lat: res.latitude, lng: res.longitude })
|
||||
},
|
||||
fail() {
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 未授权,判断是否需要弹窗
|
||||
const lastDeny = uni.getStorageSync(LOCATION_DENY_TIME_KEY)
|
||||
|
||||
if (!lastDeny || (Date.now() - lastDeny > LOCATION_DENY_INTERVAL)) {
|
||||
|
||||
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要获取您的地理位置,请授权定位服务',
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
uni.openSetting({
|
||||
success(openRes) {
|
||||
const nowAuth = openRes.authSetting && openRes.authSetting['scope.userLocation']
|
||||
if (nowAuth) {
|
||||
// 用户授权后,自动获取并返回经纬度
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
||||
resolve({ lat: res.latitude, lng: res.longitude })
|
||||
},
|
||||
fail() {
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve(false)
|
||||
}
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置城市
|
||||
*/
|
||||
export function setLocationCity(city: string) {
|
||||
uni.setStorageSync(LOCATION_CITY_KEY, city)
|
||||
}
|
||||
|
||||
/**
|
||||
* 经纬度转换为城市
|
||||
* @returns
|
||||
*/
|
||||
export async function handleGetLocationCity(lat: number, lng: number) {
|
||||
try {
|
||||
console.log("🚀 ~ handleGetLocationCity ~ res:", lat, lng)
|
||||
|
||||
const res = await getLocationToCity({ latitude: lat, longitude: lng })
|
||||
if (res.message == "Success") {
|
||||
const params = {
|
||||
latitude: res.result.location.lat,
|
||||
longitude: res.result.location.lng,
|
||||
city: res.result.ad_info.city
|
||||
}
|
||||
setLocationCity(params.city)
|
||||
// uni.$emit('locationUpdate', params) // 通知页面
|
||||
return params
|
||||
} else {
|
||||
setLocationCity(LOCATION_DEFAULT_CITY)
|
||||
}
|
||||
} catch (error) {
|
||||
setLocationCity(LOCATION_DEFAULT_CITY)
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否需要弹授权框
|
||||
function shouldShowAuthModal() {
|
||||
const lastDeny = uni.getStorageSync(LOCATION_DENY_TIME_KEY)
|
||||
return !lastDeny || (Date.now() - lastDeny > LOCATION_DENY_INTERVAL)
|
||||
}
|
||||
@ -41,7 +41,7 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`" />
|
||||
</view>
|
||||
</view>
|
||||
<wd-input v-model="form.title" no-border placeholder="请输入包间名称" :maxlength="10" show-word-limit
|
||||
<wd-input v-model="form.title" no-border placeholder="请输入包间名称" :maxlength="15" show-word-limit
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx" />
|
||||
</view>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user