添加收藏茶室接口和完善茶室详情
This commit is contained in:
13
env/.env
vendored
13
env/.env
vendored
@ -2,7 +2,7 @@ VITE_APP_TITLE = '茶址'
|
|||||||
VITE_APP_PORT = 9000
|
VITE_APP_PORT = 9000
|
||||||
|
|
||||||
VITE_UNI_APPID = '__UNI__D1E5001'
|
VITE_UNI_APPID = '__UNI__D1E5001'
|
||||||
VITE_WX_APPID = 'wxa2abb91f64032a2b'
|
VITE_WX_APPID = 'wx63e106209b842919'
|
||||||
|
|
||||||
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
||||||
VITE_APP_PUBLIC_BASE=/
|
VITE_APP_PUBLIC_BASE=/
|
||||||
@ -19,13 +19,4 @@ VITE_APP_PROXY=false
|
|||||||
VITE_APP_PROXY_PREFIX = '/api'
|
VITE_APP_PROXY_PREFIX = '/api'
|
||||||
|
|
||||||
# 第二个请求地址 (目前alova中可以使用)
|
# 第二个请求地址 (目前alova中可以使用)
|
||||||
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
||||||
|
|
||||||
# 默认地址
|
|
||||||
VITE_DEFAULT_LONGITUDE = 113.665412
|
|
||||||
VITE_DEFAULT_LATITUDE = 34.757975
|
|
||||||
VITE_DEFAULT_ADDRESS = '上海市'
|
|
||||||
VITE_DEFAULT_LOCATION_EXPIRE_MS = 30 * 24 * 60 * 60 * 1000 # 30天
|
|
||||||
VITE_DEFAULT_LOCATION_EXPIRE_KEY = 'location_expire_time'
|
|
||||||
VITE_DEFAULT_LOCATION_DENY_TIME_KEY = 'location_deny_time'
|
|
||||||
VITE_DEFAULT_LOCATION_DENY_INTERVAL = 60 * 60 * 1000 # 1小时
|
|
||||||
12
src/api/home.ts
Normal file
12
src/api/home.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { http } from '@/http/alova'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页轮播图
|
||||||
|
*/
|
||||||
|
export function getHomeBannerList() {
|
||||||
|
return http.Post<{ list: Array<{ address: string;}> }>('/api/index/carouselLists', null,
|
||||||
|
{
|
||||||
|
meta: { ignoreAuth: true }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import type { ICaptcha, IUpdateInfo, IUpdatePassword, IUserInfoVo, IUserLogin } from './types/login'
|
import type { ICaptcha, IUpdateInfo, IUpdatePassword, IUserInfoVo, IUserLogin } from './types/login'
|
||||||
import { http } from '@/http/http'
|
import { http } from '@/http/alova'
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录表单
|
* 登录表单
|
||||||
@ -11,12 +12,21 @@ export interface ILoginForm {
|
|||||||
uuid: string
|
uuid: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机密码登录
|
||||||
|
*/
|
||||||
|
export interface IMobileLoginForm {
|
||||||
|
account: string
|
||||||
|
terminal: number
|
||||||
|
scene: number
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证码
|
* 获取验证码
|
||||||
* @returns ICaptcha 验证码
|
* @returns ICaptcha 验证码
|
||||||
*/
|
*/
|
||||||
export function getCode() {
|
export function getCode() {
|
||||||
return http.get<ICaptcha>('/user/getCode')
|
return http.Get<ICaptcha>('/user/getCode')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,35 +34,48 @@ export function getCode() {
|
|||||||
* @param loginForm 登录表单
|
* @param loginForm 登录表单
|
||||||
*/
|
*/
|
||||||
export function login(loginForm: ILoginForm) {
|
export function login(loginForm: ILoginForm) {
|
||||||
return http.post<IUserLogin>('/user/login', loginForm)
|
return http.Post<IUserLogin>('/api/user/login', loginForm)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录
|
||||||
|
* @param loginForm 登录表单
|
||||||
|
*/
|
||||||
|
export function mobileLogin(loginForm: IMobileLoginForm) {
|
||||||
|
return http.Post<IUserLogin>('/api/login/account',
|
||||||
|
loginForm,
|
||||||
|
{
|
||||||
|
meta: { ignoreAuth: true } // 忽略认证
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
export function getUserInfo() {
|
export function getUserInfo() {
|
||||||
return http.get<IUserInfoVo>('/user/info')
|
return http.Get<IUserInfoVo>('/api/user/info')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return http.get<void>('/user/logout')
|
return http.Get<void>('/user/logout')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户信息
|
* 修改用户信息
|
||||||
*/
|
*/
|
||||||
export function updateInfo(data: IUpdateInfo) {
|
export function updateInfo(data: IUpdateInfo) {
|
||||||
return http.post('/user/updateInfo', data)
|
return http.Get('/user/updateInfo', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户密码
|
* 修改用户密码
|
||||||
*/
|
*/
|
||||||
export function updateUserPassword(data: IUpdatePassword) {
|
export function updateUserPassword(data: IUpdatePassword) {
|
||||||
return http.post('/user/updatePassword', data)
|
return http.Get('/user/updatePassword', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,5 +102,10 @@ export function getWxCode() {
|
|||||||
* @returns Promise 包含登录结果
|
* @returns Promise 包含登录结果
|
||||||
*/
|
*/
|
||||||
export function wxLogin(data: { code: string }) {
|
export function wxLogin(data: { code: string }) {
|
||||||
return http.post<IUserLogin>('/user/wxLogin', data)
|
return http.Post<IUserLogin>('/api/login/mnpLogin',
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
meta: { ignoreAuth: true } // 忽略认证
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
91
src/api/tea-room.ts
Normal file
91
src/api/tea-room.ts
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { http } from '@/http/alova'
|
||||||
|
import type { IHomeTeaRoomListResult, IOpenCityListResult, ITeaRoomDetailResult } from '@/api/types/tea-room'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取茶室列表
|
||||||
|
*/
|
||||||
|
export interface IHomeTeaRoomListParams {
|
||||||
|
page: number
|
||||||
|
size: number
|
||||||
|
search: string
|
||||||
|
latitude: number
|
||||||
|
longitude: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHomeTeaRoomList(data: any) {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 茶室详情
|
||||||
|
*/
|
||||||
|
export interface IRoomDetailParams {
|
||||||
|
id: number
|
||||||
|
latitude: number
|
||||||
|
longitude: number
|
||||||
|
user_id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTeaRoomDetail(data: IRoomDetailParams) {
|
||||||
|
return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails',
|
||||||
|
data
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏茶室
|
||||||
|
*/
|
||||||
|
export interface ICollectTeaRoomParams {
|
||||||
|
id: number
|
||||||
|
status: number // 1:收藏 0:取消收藏
|
||||||
|
}
|
||||||
|
|
||||||
|
export function collectTeaRoom(data: ICollectTeaRoomParams) {
|
||||||
|
return http.Post('/api/teaStore/teaStoreCollect',
|
||||||
|
data
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏的茶室列表
|
||||||
|
*/
|
||||||
|
export interface ICollectTeaRoomListParams {
|
||||||
|
page: number
|
||||||
|
size: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCollectTeaRoomList(data: ICollectTeaRoomListParams) {
|
||||||
|
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreCollectList',
|
||||||
|
data
|
||||||
|
)
|
||||||
|
}
|
||||||
84
src/api/teaSpecialist-order.ts
Normal file
84
src/api/teaSpecialist-order.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
0
src/api/types/home.ts
Normal file
0
src/api/types/home.ts
Normal file
@ -11,6 +11,7 @@ export interface IUserInfoVo {
|
|||||||
channel: number
|
channel: number
|
||||||
is_new_user: number
|
is_new_user: number
|
||||||
mobile: string
|
mobile: string
|
||||||
|
username: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
56
src/api/types/tea-room.ts
Normal file
56
src/api/types/tea-room.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* 茶室列表接口返回数据
|
||||||
|
*/
|
||||||
|
export interface IHomeTeaRoomListResult {
|
||||||
|
count: number
|
||||||
|
list: Array<any>
|
||||||
|
more: number
|
||||||
|
page: string
|
||||||
|
size: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 茶室开通城市列表接口返回数据
|
||||||
|
*/
|
||||||
|
export interface IOpenCityListResult {
|
||||||
|
list: Array<{
|
||||||
|
city_id: number
|
||||||
|
del: number
|
||||||
|
dtime: string
|
||||||
|
name: string
|
||||||
|
status: number
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 茶室详情接口返回数据
|
||||||
|
*/
|
||||||
|
export interface ITeaRoomDetailResult {
|
||||||
|
details: {
|
||||||
|
address: string
|
||||||
|
city: string
|
||||||
|
city_id: number
|
||||||
|
collect: number
|
||||||
|
contact_phone: string
|
||||||
|
customer_service: string
|
||||||
|
day_time: string
|
||||||
|
del: number
|
||||||
|
district: string
|
||||||
|
district_id: number
|
||||||
|
dtime: string
|
||||||
|
end_time: string
|
||||||
|
id: number
|
||||||
|
image: string
|
||||||
|
latitude: string
|
||||||
|
longitude: string
|
||||||
|
name: string
|
||||||
|
operation_type: number,
|
||||||
|
province: string
|
||||||
|
province_id: number
|
||||||
|
shop_status: number
|
||||||
|
star: number
|
||||||
|
start_time: string
|
||||||
|
status: number
|
||||||
|
update_dtime: string
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/api/types/teaSpecialist-order.ts
Normal file
17
src/api/types/teaSpecialist-order.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 订单列表返回数据
|
||||||
|
*/
|
||||||
|
export interface IOrderListResult {
|
||||||
|
count: number
|
||||||
|
list: Array<any>
|
||||||
|
more: number
|
||||||
|
page: string
|
||||||
|
size: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单详情返回数据
|
||||||
|
*/
|
||||||
|
export interface IOrderDetailsResult {
|
||||||
|
details: any
|
||||||
|
}
|
||||||
50
src/api/types/user.ts
Normal file
50
src/api/types/user.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* 用户信息结果类型
|
||||||
|
*/
|
||||||
|
export interface IUserInfoResult {
|
||||||
|
account: string
|
||||||
|
avatar: string
|
||||||
|
create_time: string
|
||||||
|
has_auth: boolean
|
||||||
|
has_password: boolean
|
||||||
|
id: number
|
||||||
|
mobile: string
|
||||||
|
nickname: string
|
||||||
|
real_name: string
|
||||||
|
sex: string
|
||||||
|
sn: number
|
||||||
|
user_money: string
|
||||||
|
version: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址列表
|
||||||
|
*/
|
||||||
|
export interface IUserAddressListResult {
|
||||||
|
id: number
|
||||||
|
contact: string
|
||||||
|
telephone: string
|
||||||
|
province: string
|
||||||
|
province_id: number
|
||||||
|
city: string
|
||||||
|
city_id: number
|
||||||
|
district: string
|
||||||
|
district_id: number
|
||||||
|
address: string
|
||||||
|
is_default: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址详情
|
||||||
|
*/
|
||||||
|
export interface IUserAddressDetailsResult extends IUserAddressListResult {
|
||||||
|
address_details: IUserAddressListResult
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券列表
|
||||||
|
*/
|
||||||
|
export interface IUserCouponListResult {
|
||||||
|
no_use: Array<any>
|
||||||
|
use: Array<any>
|
||||||
|
}
|
||||||
131
src/api/user.ts
Normal file
131
src/api/user.ts
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
import { http } from '@/http/alova'
|
||||||
|
import type { IUserAddressListResult, IUserAddressDetailsResult, IUserCouponListResult } from '@/api/types/user'
|
||||||
|
import type { IOrderListResult } from '@/api/types/teaSpecialist-order'
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户个人信息
|
||||||
|
*/
|
||||||
|
export function getUserInfo() {
|
||||||
|
return http.Post('/api/user/info')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优惠券列表
|
||||||
|
*/
|
||||||
|
export function getUserCoupons() {
|
||||||
|
return http.Post('/api/UserCoupon/UserCoupinList')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户地址
|
||||||
|
*/
|
||||||
|
export function getUserAddress() {
|
||||||
|
return http.Post('/api/user/addressList')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户添加地址
|
||||||
|
*/
|
||||||
|
export interface IAddUserAddressParams {
|
||||||
|
id: number
|
||||||
|
contact: string
|
||||||
|
telephone: string
|
||||||
|
province: string
|
||||||
|
province_id?: number
|
||||||
|
city: string
|
||||||
|
city_id?: number
|
||||||
|
district: string
|
||||||
|
district_id?: number
|
||||||
|
address: string
|
||||||
|
is_default: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addUserAddress(data: IAddUserAddressParams) {
|
||||||
|
return http.Post<IUserAddressListResult>('/api/user/addAddress', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑用户地址
|
||||||
|
*/
|
||||||
|
export interface IEditUserAddressParams extends IAddUserAddressParams {
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editUserAddress(data: IAddUserAddressParams) {
|
||||||
|
return http.Post('/api/user/editAddress', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户地址
|
||||||
|
*/
|
||||||
|
export interface IDeleteUserAddressParams {
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteUserAddress(data: IDeleteUserAddressParams) {
|
||||||
|
return http.Post('/api/user/delAddress', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取地址详情
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface IUserAddressDetailsParams extends IDeleteUserAddressParams {}
|
||||||
|
export function userAddressDetails(data: IUserAddressDetailsParams) {
|
||||||
|
return http.Post<IUserAddressDetailsResult>('/api/user/addressDetails', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券列表(从订单页获取)
|
||||||
|
*/
|
||||||
|
export interface IGetCouponsParams {
|
||||||
|
id: number
|
||||||
|
numbers: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCoupons(data: IGetCouponsParams) {
|
||||||
|
return http.Post<IUserCouponListResult>('/api/UserCoupon/UserCoupinList', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券列表(从个人中心点击进去)
|
||||||
|
*/
|
||||||
|
export interface IGetMyCouponsParams {
|
||||||
|
status: number
|
||||||
|
}
|
||||||
|
export function getMyCoupons(data: IGetMyCouponsParams) {
|
||||||
|
return http.Post('/api/UserCoupon/orderCoupinList', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人中心优惠券
|
||||||
|
*/
|
||||||
|
export function getMyCoupon() {
|
||||||
|
return http.Post<IUserCouponListResult>('/api/UserCoupon/coupinList')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取个人中心优惠券
|
||||||
|
*/
|
||||||
|
export interface IClaimMyCouponParams {
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function claimMyCoupon(data: IClaimMyCouponParams) {
|
||||||
|
return http.Post('/api/UserCoupon/receiveCoupon', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额使用记录
|
||||||
|
*/
|
||||||
|
export interface IGetUserMoneyLogParams {
|
||||||
|
page: number
|
||||||
|
size: number
|
||||||
|
month: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserMoneyLog(data: IGetUserMoneyLogParams) {
|
||||||
|
return http.Post<IOrderListResult>('/api/user/moneyLogList', data)
|
||||||
|
}
|
||||||
@ -16,99 +16,109 @@
|
|||||||
|
|
||||||
<view>
|
<view>
|
||||||
<view class="coupon-tab">
|
<view class="coupon-tab">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @click="collect.handleChangeTab" :lazy="false">
|
<wd-tabs v-model="tab" swipeable slidable="always" @click="Collect.handleChangeTab" :lazy="false">
|
||||||
<wd-tab title="茶室">
|
<wd-tab title="茶室"></wd-tab>
|
||||||
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in 100" :key="index" @click="collect.handleToTeaRoom(item)">
|
<wd-tab title="茶艺师"></wd-tab>
|
||||||
<view class="absolute top--28rpx left-0 z-1">
|
|
||||||
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image4.png`"/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="mx-30rpx p-30rpx flex bg-white rounded-10rpx">
|
|
||||||
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`" radius="10rpx" />
|
|
||||||
<view class="flex-1 ml-28rpx flex justify-between line-1 items-start relative">
|
|
||||||
<view class="line-1">
|
|
||||||
<view class="font-bold text-30rpx leading-42rpx flex justify-between items-center w-400rpx">
|
|
||||||
<view class="w-300rpx line-1">
|
|
||||||
凝香茶业
|
|
||||||
</view>
|
|
||||||
<view @click.stop="collect.handleCancelTeaRoom(item)">
|
|
||||||
<wd-icon name="heart-filled" size="22px" color="#F65353"></wd-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="font-400 text-[#F29747] text-24rpx leading-34rpx mt-10rpx">
|
|
||||||
100+收藏
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
|
||||||
<view class="font-400 text-[#606266] text-24rpx mr-10rpx">
|
|
||||||
营业时间:00:00-23:59
|
|
||||||
</view>
|
|
||||||
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-4rpx border-[#F2E2E1]">
|
|
||||||
打烊了
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center mt-20rpx">
|
|
||||||
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
|
|
||||||
mode="aspectFit" />
|
|
||||||
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx">
|
|
||||||
青浦区仓路478号
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</wd-tab>
|
|
||||||
<wd-tab title="茶艺师">
|
|
||||||
<view class="flex items-center bg-white p-20rpx rounded-10rpx mx-30rpx mb-20rpx">
|
|
||||||
<view class="mr-28rpx relative">
|
|
||||||
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`"></wd-img>
|
|
||||||
<view class="tea-specialist-time absolute top-6rpx left-0 text-[#fff] font-400 text-18rpx leading-26rpx flex items-center justify-center">
|
|
||||||
可约9:00
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex-1">
|
|
||||||
<view class="flex items-center justify-between">
|
|
||||||
<view class="font-bold text-[#303133] text-30rpx leading-42rpx mr-14rpx">
|
|
||||||
凝香茶业
|
|
||||||
</view>
|
|
||||||
<view class="w-168rpx h-40rpx relative mr-44rpx">
|
|
||||||
<view class="absolute left-0 top-0 h-36rpx flex items-start">
|
|
||||||
<wd-img :src="`${OSS}icon/icon_gold_medal.png`" width="36rpx" height="36rpx"></wd-img>
|
|
||||||
</view>
|
|
||||||
<view class="bg-[#F0F6EF] text-[#006C2D] font-400 text-22rpx leading-32rpx rounded-4rpx text-center w-150rpx ml-18rpx pb-4rpx">金牌茶艺师</view>
|
|
||||||
</view>
|
|
||||||
<view @click.stop="collect.handleCancelTeaRoom(1)">
|
|
||||||
<wd-icon name="heart-filled" size="22px" color="#F65353"></wd-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="flex items-center">
|
|
||||||
<view class="mr-12rpx">
|
|
||||||
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">上门服务</wd-tag>
|
|
||||||
</view>
|
|
||||||
<view class="mr-12rpx">
|
|
||||||
<wd-tag color="#F55726" bg-color="#F55726" plain>到点服务</wd-tag>
|
|
||||||
</view>
|
|
||||||
<view class="mr-12rpx">
|
|
||||||
<wd-tag color="#818CA9" bg-color="#F3F3F3">28岁</wd-tag>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center mt-8rpx">
|
|
||||||
<wd-img :src="`${OSS}icon/icon_woman.png`" width="28rpx" height="28rpx"></wd-img>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="font-400 text-[#F29747] text-24rpx leading-34rpx mt-20rpx">
|
|
||||||
100+收藏
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="font-400 text-[#FF5951] text-26rpx leading-40rpx">
|
|
||||||
<text class="text-32rpx">¥180</text>
|
|
||||||
<text class="text-24rpx">/小时</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</wd-tab>
|
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
|
|
||||||
|
<view class="">
|
||||||
|
<mescroll-body @init="mescrollInit" :down="downOption" @down="downCallback" :up="upOption" @up="Collect.upCallback" top="28rpx">
|
||||||
|
<!-- 茶室列表 -->
|
||||||
|
<template v-if="tab === 0">
|
||||||
|
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in list" :key="index" @click="Collect.handleToTeaRoom(item.tea_store_id)">
|
||||||
|
<view class="absolute top--28rpx left-0 z-1">
|
||||||
|
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image4.png`"/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mx-30rpx p-30rpx flex bg-white rounded-10rpx">
|
||||||
|
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`" radius="10rpx" />
|
||||||
|
<view class="flex-1 ml-28rpx flex justify-between line-1 items-start relative">
|
||||||
|
<view class="line-1">
|
||||||
|
<view class="font-bold text-30rpx leading-42rpx flex justify-between items-center w-400rpx">
|
||||||
|
<view class="w-300rpx line-1">
|
||||||
|
{{ item.teaStore[0].name }}
|
||||||
|
</view>
|
||||||
|
<view @click.stop="Collect.handleCancelTeaRoom(item.tea_store_id)">
|
||||||
|
<wd-icon name="heart-filled" size="22px" color="#F65353"></wd-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="font-400 text-[#F29747] text-24rpx leading-34rpx mt-10rpx">
|
||||||
|
{{ item.count > 100 ? `${item.count}+` : item.count }}收藏
|
||||||
|
</view>
|
||||||
|
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||||
|
<view class="font-400 text-[#606266] text-24rpx mr-10rpx">
|
||||||
|
营业时间: {{ item.teaStore[0].start_time }}-{{ item.teaStore[0].end_time }}
|
||||||
|
</view>
|
||||||
|
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-4rpx border-[#F2E2E1]" v-if="item.shop_status == 0">
|
||||||
|
打烊了
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex items-center mt-20rpx">
|
||||||
|
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
|
||||||
|
mode="aspectFit" />
|
||||||
|
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx">
|
||||||
|
{{ item.teaStore[0].address }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 茶艺师列表 -->
|
||||||
|
<template v-if="tab === 1">
|
||||||
|
<view class="flex items-center bg-white p-20rpx rounded-10rpx mx-30rpx mb-20rpx">
|
||||||
|
<view class="mr-28rpx relative">
|
||||||
|
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`"></wd-img>
|
||||||
|
<view class="tea-specialist-time absolute top-6rpx left-0 text-[#fff] font-400 text-18rpx leading-26rpx flex items-center justify-center">
|
||||||
|
可约9:00
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<view class="flex items-center justify-between">
|
||||||
|
<view class="font-bold text-[#303133] text-30rpx leading-42rpx mr-14rpx">
|
||||||
|
凝香茶业
|
||||||
|
</view>
|
||||||
|
<view class="w-168rpx h-40rpx relative mr-44rpx">
|
||||||
|
<view class="absolute left-0 top-0 h-36rpx flex items-start">
|
||||||
|
<wd-img :src="`${OSS}icon/icon_gold_medal.png`" width="36rpx" height="36rpx"></wd-img>
|
||||||
|
</view>
|
||||||
|
<view class="bg-[#F0F6EF] text-[#006C2D] font-400 text-22rpx leading-32rpx rounded-4rpx text-center w-150rpx ml-18rpx pb-4rpx">金牌茶艺师</view>
|
||||||
|
</view>
|
||||||
|
<view @click.stop="Collect.handleCancelTeaRoom(1)">
|
||||||
|
<wd-icon name="heart-filled" size="22px" color="#F65353"></wd-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex items-center">
|
||||||
|
<view class="mr-12rpx">
|
||||||
|
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">上门服务</wd-tag>
|
||||||
|
</view>
|
||||||
|
<view class="mr-12rpx">
|
||||||
|
<wd-tag color="#F55726" bg-color="#F55726" plain>到点服务</wd-tag>
|
||||||
|
</view>
|
||||||
|
<view class="mr-12rpx">
|
||||||
|
<wd-tag color="#818CA9" bg-color="#F3F3F3">28岁</wd-tag>
|
||||||
|
</view>
|
||||||
|
<view class="flex items-center mt-8rpx">
|
||||||
|
<wd-img :src="`${OSS}icon/icon_woman.png`" width="28rpx" height="28rpx"></wd-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="font-400 text-[#F29747] text-24rpx leading-34rpx mt-20rpx">
|
||||||
|
100+收藏
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="font-400 text-[#FF5951] text-26rpx leading-40rpx">
|
||||||
|
<text class="text-32rpx">¥180</text>
|
||||||
|
<text class="text-24rpx">/小时</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</mescroll-body>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -117,31 +127,69 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {ref} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {toast} from '@/utils/toast'
|
import {toast} from '@/utils/toast'
|
||||||
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||||
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
|
import { getCollectTeaRoomList, collectTeaRoom } from '@/api/tea-room'
|
||||||
|
|
||||||
const tab = ref<number>(0)
|
const tab = ref<number>(0)
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
|
const downOption = {
|
||||||
|
auto: true
|
||||||
|
}
|
||||||
|
const upOption = {
|
||||||
|
auto: true,
|
||||||
|
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||||
|
}
|
||||||
|
const list = ref<Array<any>>([])
|
||||||
|
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const collect = {
|
const Collect = {
|
||||||
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
|
upCallback: (mescroll) => {
|
||||||
|
const filter = {
|
||||||
|
page: mescroll.num,
|
||||||
|
size: mescroll.size,
|
||||||
|
}
|
||||||
|
|
||||||
|
getCollectTeaRoomList(filter).then( res => {
|
||||||
|
console.log("🚀 ~ res:", 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
|
// 切换tab
|
||||||
handleChangeTab: (item: any) => {
|
handleChangeTab: (item: any) => {
|
||||||
tab.value = item.index
|
tab.value = Number(item.index)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 去茶室的详情
|
// 去茶室的详情
|
||||||
handleToTeaRoom: (item: any) => {
|
handleToTeaRoom: (id: number) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/bundle/tea-room/room?id=1'
|
url: `/bundle/tea-room/room?id=${id}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消收藏
|
// 取消收藏
|
||||||
handleCancelTeaRoom: (item: any) => {
|
handleCancelTeaRoom: async (id: number) => {
|
||||||
|
await collectTeaRoom({
|
||||||
|
id,
|
||||||
|
status: 0
|
||||||
|
})
|
||||||
toast.info('取消收藏成功')
|
toast.info('取消收藏成功')
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消收藏茶艺师
|
// 取消收藏茶艺师
|
||||||
@ -161,7 +209,11 @@
|
|||||||
.wd-tabs,
|
.wd-tabs,
|
||||||
.wd-tabs__nav,
|
.wd-tabs__nav,
|
||||||
.wd-tabs__line {
|
.wd-tabs__line {
|
||||||
background-color: transparent;
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wd-tabs__line {
|
||||||
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<route lang="jsonc" type="page">{
|
<route lang="jsonc" type="page">{
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<route lang="jsonc" type="page">{
|
<route lang="jsonc" type="page">{
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
<view v-for="item in teaList" :key="item.id"
|
<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="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]'"
|
:class="selectedRenewTea.includes(item.id) ? 'bg-[#4C9F44] text-[#fff]' : 'bg-[#F7F7F7] text-[#606266]'"
|
||||||
@click="orderDetail.handleToggleRenewTea(item.id)">
|
@click="OrderDetail.handleToggleRenewTea(item.id)">
|
||||||
<view>{{item.title}}</view>
|
<view>{{item.title}}</view>
|
||||||
<view>{{item.price}}</view>
|
<view>{{item.price}}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
|
|
||||||
<view class="mt-54rpx text-32rpx leading-44rpx flex items-center justify-center leading-80rpx text-center">
|
<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-[#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 class="w-240rpx h-80rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleConfirmRefund">确定退款</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
@ -206,85 +206,72 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|
||||||
<!-- 平台团购直营店 -->
|
|
||||||
<view>
|
<view>
|
||||||
<navbar :title="title" custom-class='!bg-[#F6F7F8]'></navbar>
|
<navbar :title="title" custom-class='!bg-[#F6F7F8]' :leftArrow="false"></navbar>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="text-[#909399] text-26rpx leading-36rpx mb-40rpx">
|
<view class="text-[#909399] text-26rpx leading-36rpx mb-40rpx">
|
||||||
<view class="ml-80rpx" v-if="orderStatus === OrderStatus.Consuming || orderStatus === OrderStatus.Reserved || orderStatus === OrderStatus.Serving">使用过程中有任何问题,请联系客服</view>
|
<view class="text-center" v-if="orderStatus == TeaSpecialistOrderStatus.Serving || orderStatus == TeaSpecialistOrderStatus.Pay">使用过程中有任何问题,请联系客服</view>
|
||||||
<view class="flex items-center justify-center" v-if="orderStatus === OrderStatus.Pending">
|
<view class="flex items-center justify-center" v-if="orderStatus == TeaSpecialistOrderStatus.Pending">
|
||||||
<view class="flex items-center mr-6rpx">
|
<view class="flex items-center mr-6rpx">
|
||||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_time.png`"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center text-26rpx leading-36rpx text-[#909399]">
|
<view class="flex items-center text-26rpx leading-36rpx text-[#909399]">
|
||||||
<view>还剩</view>
|
<view>还剩</view>
|
||||||
<view class="mx-6rpx">
|
<view class="mx-6rpx">
|
||||||
<wd-count-down :time="time" custom-class="!text-[#FF5951]" />
|
<wd-count-down :time="order.time1" custom-class="!text-[#FF5951]" />
|
||||||
</view>
|
</view>
|
||||||
<view>订单自动取消</view>
|
<view>订单自动取消</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-80rpx" v-if="orderStatus === OrderStatus.Finished">品一口香茗,让生活慢下来,从一杯好茶开始</view>
|
<view class="ml-80rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Finished">感谢您的选择,期待再续茶香!</view>
|
||||||
<view class="ml-80rpx" v-if="orderStatus === OrderStatus.Confirm">您的服务已经结束,请及时确认订单</view>
|
<view class="ml-80rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Confirm">您的服务已经结束,请及时确认订单</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 信息模块 -->
|
<!-- 信息模块 -->
|
||||||
<view class="mx-30rpx coupon-bg" >
|
<view class="mx-30rpx coupon-bg" >
|
||||||
<view class="flex items-center px-30rpx pt-30rpx pb-40rpx">
|
<view class="flex items-center px-30rpx pt-30rpx">
|
||||||
<view class="mr-30rpx">
|
<view class="mr-30rpx">
|
||||||
<wd-img width="190rpx" height="190rpx" :src="`${OSS}images/home/home_image5.png`" mode="scaleToFill"></wd-img>
|
<wd-img width="190rpx" height="190rpx" :src="order.teamaster.image" mode="scaleToFill"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1">
|
<view class="flex-1">
|
||||||
<view class="flex justify-between items-center">
|
<view class="flex justify-between items-center">
|
||||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx line-1 w-300rpx">
|
<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>
|
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-26rpx leading-36rpx text-[#909399]">¥324</view>
|
<view class="text-26rpx leading-36rpx text-[#909399]">¥{{ order.order_amount }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
||||||
<view>¥108/小时</view>
|
<view>¥{{ order.teamaster.price }}/小时</view>
|
||||||
<view>x3</view>
|
<view>x{{ order.hours }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
||||||
<view>车马费(¥3.00元/公里)</view>
|
<view class="w-300rpx line-1">车马费(¥{{ order.fare_price }}元/公里)</view>
|
||||||
<view>x3</view>
|
<view>¥{{ order.fare_distance_price }}/小时</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#606266] text-right mt-26rpx" v-if="orderStatus !== OrderStatus.Pending">
|
<view class="text-[#606266] text-right mt-26rpx" v-if="orderStatus !== TeaSpecialistOrderStatus.Pending">
|
||||||
<text class="text-24rpx leading-34rpx mr-12rpx">实付</text>
|
<text class="text-24rpx leading-34rpx mr-12rpx">实付</text>
|
||||||
<text class="tetx-32rpx leading-36rpx">¥29.32</text>
|
<text class="tetx-32rpx leading-36rpx">¥{{ order.order_amount }}</text>
|
||||||
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
|
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-28rpx pb-28rpx">
|
<view class="mt-70rpx">
|
||||||
<view class="text-30rpx leading-42rpx text-[#303133] px-30rpx">预约信息</view>
|
<view class="text-30rpx leading-42rpx text-[#303133] px-30rpx">预约信息</view>
|
||||||
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx">
|
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx pb-28rpx"
|
||||||
<view class="mb-20rpx px-30rpx">预约时间:2025-03-18 09:00-12:00</view>
|
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 class="flex justify-between items-center pl-30rpx">
|
||||||
<view>预约时长:3小时</view>
|
<view>预约时长:{{ order.hours }}小时</view>
|
||||||
<view
|
|
||||||
v-if="orderStatus === OrderStatus.Reserved || orderStatus === OrderStatus.Consuming"
|
|
||||||
class="bg-[#4C9F44] rounded-[100rpx_0rpx_0rpx_100rpx] font-bold text-28rpx leading-40rpx text-[#fff] w-170rpx h-56rpx flex justify-center items-center"
|
|
||||||
@click="showRenewPopup = true">一键续订</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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="mx-30rpx mt-20rpx bg-white rounded-16rpx" v-if="orderStatus === OrderStatus.Serving || orderStatus === OrderStatus.Reserved">
|
<view class="mb-20rpx px-30rpx">服务时间:{{ order.start_time }} - {{ order.end_time }}</view>
|
||||||
<view class="px-30rpx"> 地图显示</view>
|
<view class="flex justify-between items-center pl-30rpx">
|
||||||
<view class="px-30rpx flex justify-between items-center">
|
<view>服务时长:{{ order.hours }}小时</view>
|
||||||
<view class="font-500 text-24rpx text-[#909399] leading-42rpx">信息没有更新,想问问茶艺师到哪里了?</view>
|
|
||||||
<view class="flex items-center">
|
|
||||||
<view class="flex items-center mr-6rpx">
|
|
||||||
<wd-img width="34rpx" height="34rpx" :src="`${OSS}icon/icon_phone2.png`" mode="scaleToFill"></wd-img>
|
|
||||||
</view>
|
|
||||||
<view class="text-26rpx leading-36rpx text-[#4C9F44]">
|
|
||||||
联系茶艺师
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -298,22 +285,26 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||||
<view class="text-[#606266] mr-54rpx">服务方式</view>
|
<view class="text-[#606266] mr-54rpx">服务方式</view>
|
||||||
<view class="text-[#303133]">到店服务</view>
|
<view class="text-[#303133]">{{ Number(order.service_type) == 1 ? '到店服务' : '上门服务'}}</view>
|
||||||
</view>
|
|
||||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx" v-if="orderStatus !== OrderStatus.Pending">
|
|
||||||
<view class="text-[#606266] mr-54rpx">服务门店</view>
|
|
||||||
<view class="text-[#303133] line-1 w-300rpx">茶馆名称茶馆名称茶馆名称茶馆名称茶馆名称茶馆名称茶馆名称</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||||
<view class="text-[#606266] mr-54rpx"> {{ orderStatus === OrderStatus.Serving ? '门店地址' : '服务地址' }}</view>
|
<view class="text-[#606266] mr-54rpx">{{ Number(order.service_type) == 1 ? '服务门店' : '服务地址'}}</view>
|
||||||
<view class="text-[#303133]">青浦区仓桥路478号</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>
|
</view>
|
||||||
<view class="flex absolute top-1/2 right-0 -translate-y-1/2">
|
<view class="flex absolute top-1/2 right-0 -translate-y-1/2">
|
||||||
<view class="text-center mr-20rpx" >
|
<view class="text-center mr-20rpx" @click="OrderDetail.handleOpenMap">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center" v-if="orderStatus === OrderStatus.Serving">
|
<view class="text-center" v-if="orderStatus != TeaSpecialistOrderStatus.Pending" @click="OrderDetail.handleCallService">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -321,91 +312,58 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 支付方式 -->
|
|
||||||
<view class="bg-white rounded-16rpx px-30rpx py-34rpx mx-30rpx mt-20rpx" v-if="orderStatus === OrderStatus.Pending">
|
|
||||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44">
|
|
||||||
<block v-for="(item, index) in PayList" :key="index">
|
|
||||||
<view
|
|
||||||
class="flex justify-between items-center"
|
|
||||||
:class="index !== PayList.length - 1 ? 'mb-40rpx' : ''"
|
|
||||||
v-if="item.id != 2"
|
|
||||||
>
|
|
||||||
<view class="flex items-center">
|
|
||||||
<wd-img width="50rpx" height="50rpx" :src="`${OSS}${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.type !== PayCategory.WeChatPay">可用202.22</view>
|
|
||||||
</wd-radio>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</wd-radio-group>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 订单信息 -->
|
<!-- 订单信息 -->
|
||||||
<view class="bg-white rounded-16rpx px-30rpx py-34rpx mx-30rpx mt-20rpx">
|
<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-[#303133] text-32rpx leading-44rpx">订单信息</view>
|
||||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||||
<view>订单编号</view>
|
<view>订单编号</view>
|
||||||
<view>
|
<view>
|
||||||
<text>7327328627526903</text>
|
<text>{{ order.order_sn }}</text>
|
||||||
<wd-divider vertical />
|
<wd-divider vertical />
|
||||||
<text class="text-[#4C9F44]">复制</text>
|
<text class="text-[#4C9F44]" @click="OrderDetail.handleCopy(order.order_sn)">复制</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx" v-if="orderStatus !== OrderStatus.Pending">
|
<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>交易方式</view>
|
||||||
<view>微信支付</view>
|
<view>{{ order.pay_way_title }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||||
<view>创建时间</view>
|
<view>创建时间</view>
|
||||||
<view>2019-05-16 12:20:26</view>
|
<view>{{ order.dtime }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx" v-if="orderStatus !== OrderStatus.Pending">
|
<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>付款时间</view>
|
||||||
<view>2019-05-16 13:20:26</view>
|
<view>{{ order.update_dtime }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx">
|
<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="mt-34rpx">
|
||||||
<!-- 预约单、服务中 -->
|
<!-- 预约单、服务中 -->
|
||||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === OrderStatus.Serving || orderStatus === OrderStatus.Confirm">
|
<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-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="orderDetail.handleAgainReeserve">再次预定</view>
|
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleConfirmOrder">确认订单</view>
|
||||||
<view class="w-330rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="orderDetail.handleConfirmOrder">确认订单</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 待付款 -->
|
<!-- 待付款 -->
|
||||||
<view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus === OrderStatus.Pending">
|
<view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus == TeaSpecialistOrderStatus.Pending">
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="text-28rpx leading-40rpx text-[#606266] mr-16rpx" @click="orderDetail.handleCancelOrder">取消</view>
|
<view class="text-28rpx leading-40rpx text-[#606266] mr-16rpx" @click="OrderDetail.handleCancelOrder">取消订单</view>
|
||||||
<view class="flex items-center">
|
|
||||||
<view class="mr-16rpx mt-[-8rpx]">
|
|
||||||
<price-format color="#FF5951" :first-size="40" :second-size="40" :subscript-size="28" :price="23.02"></price-format>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center text-[#4C9F44]" >
|
|
||||||
<view class="text-24rpx mr-10rpx" @click="showCostPopup = true">费用明细</view>
|
|
||||||
<wd-icon name="arrow-down" size="24rpx" color="#4C9F44"></wd-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="w-178rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] rounded-8rpx text-[#fff]">立即预定</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>
|
||||||
|
|
||||||
<!-- 已预约 -->
|
<!-- 已预约 -->
|
||||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === OrderStatus.Reserved">
|
<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] mr-30rpx" @click="showRefundRule = true">申请退款</view>
|
||||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="orderDetail.handleService">联系客服</view>
|
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="OrderDetail.handleCallService">联系客服</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 交易完成 -->
|
<!-- 交易完成 -->
|
||||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center mt-34rpx"
|
<!-- <view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center mt-34rpx"
|
||||||
v-if="orderStatus === OrderStatus.Finished || orderStatus === OrderStatus.Cancelled">
|
v-if="orderStatus == TeaSpecialistOrderStatus.Finished || orderStatus == TeaSpecialistOrderStatus.Cancelled">
|
||||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">再次预定</view>
|
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">再次预定</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -413,15 +371,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { OrderStatusTitle, OrderStatus, OrderSource } from '@/utils/order'
|
import { TeaSpecialistOrderStatusTextValue, TeaSpecialistOrderStatus } from '@/utils/order'
|
||||||
import {toast} from '@/utils/toast'
|
import { getTeaSpecialistOrderDetails } from '@/api/teaSpecialist-order'
|
||||||
|
import { toast } from '@/utils/toast'
|
||||||
import { useMessage } from 'wot-design-uni'
|
import { useMessage } from 'wot-design-uni'
|
||||||
import { PayList, PayCategory, PayValue } from '@/utils/pay'
|
import { handleCancelOrderHooks, handleToPayHooks, handleDeleteOrderHooks, handleConfirmOrderHooks, handleRefundOrderHooks } from '@/hooks/useTeaSpecialistOrder'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
const title = ref<string>('')
|
const title = ref<string>('')
|
||||||
const orderStatus = ref<string>('') // 订单状态:待使用、退款等
|
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||||
const showRefundRule = ref<boolean>(false) // 退款规则弹窗
|
const showRefundRule = ref<boolean>(false) // 退款规则弹窗
|
||||||
|
|
||||||
// 订单倒计时取消
|
// 订单倒计时取消
|
||||||
@ -470,17 +429,29 @@
|
|||||||
{id: 5, title: '红茶(3泡)', price: '¥128.00'},
|
{id: 5, title: '红茶(3泡)', price: '¥128.00'},
|
||||||
]
|
]
|
||||||
const selectedRenewTea = ref<Array<any>>([]) // 选择的续订时间
|
const selectedRenewTea = ref<Array<any>>([]) // 选择的续订时间
|
||||||
|
|
||||||
|
|
||||||
const showRenewSuccessPopup = ref<boolean>(false)
|
const showRenewSuccessPopup = ref<boolean>(false)
|
||||||
/** 结束 **/
|
|
||||||
|
|
||||||
onLoad((args) => {
|
// 订单ID
|
||||||
title.value = OrderStatusTitle[OrderSource.TeaSpecialist][args.orderStatus] || '订单详情'
|
const orderId = ref<number>(0)
|
||||||
orderStatus.value = args.orderStatus
|
const order = ref<any>({})
|
||||||
|
|
||||||
|
onLoad(async (args) => {
|
||||||
|
orderId.value = args.orderId
|
||||||
|
// 获取订单详情
|
||||||
|
OrderDetail.handleInit()
|
||||||
})
|
})
|
||||||
|
|
||||||
const orderDetail = {
|
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: () => {
|
handleConfirmOrder: () => {
|
||||||
message.confirm({
|
message.confirm({
|
||||||
@ -496,7 +467,14 @@
|
|||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
// 点击确认按钮回调事件
|
// 点击确认按钮回调事件
|
||||||
toast.info('订单取消成功')
|
if (res.action == 'confirm') {
|
||||||
|
uni.$on('refreshOrderDetail', () => {
|
||||||
|
OrderDetail.handleInit()
|
||||||
|
uni.$off('refreshOrderDetail')
|
||||||
|
})
|
||||||
|
|
||||||
|
handleConfirmOrderHooks(orderId.value)
|
||||||
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 点击取消按钮回调事件
|
// 点击取消按钮回调事件
|
||||||
})
|
})
|
||||||
@ -520,6 +498,15 @@
|
|||||||
|
|
||||||
// 申请退款
|
// 申请退款
|
||||||
handleConfirmRefund: () => {
|
handleConfirmRefund: () => {
|
||||||
|
uni.$on('refreshOrderDetail', () => {
|
||||||
|
showRefundRule.value = false
|
||||||
|
|
||||||
|
OrderDetail.handleInit()
|
||||||
|
uni.$off('refreshOrderDetail')
|
||||||
|
})
|
||||||
|
|
||||||
|
handleRefundOrderHooks(orderId.value, 'order')
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消订单
|
// 取消订单
|
||||||
@ -536,17 +523,67 @@
|
|||||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
// 点击确认按钮回调事件
|
if (res.action == 'confirm') {
|
||||||
|
// 点击确认按钮回调事件
|
||||||
|
uni.$on('refreshOrderDetail', () => {
|
||||||
|
OrderDetail.handleInit()
|
||||||
|
uni.$off('refreshOrderDetail')
|
||||||
|
})
|
||||||
|
|
||||||
|
handleCancelOrderHooks(orderId.value)
|
||||||
|
}
|
||||||
toast.info('订单取消成功')
|
toast.info('订单取消成功')
|
||||||
}).catch(() => {
|
}).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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 联系客服
|
// 联系客服
|
||||||
handleService: () => {
|
handleCallService: () => {
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: order.value.customer_service_phone, // 替换为需要拨打的电话号码
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 复制订单号
|
||||||
|
handleCopy: (text: string) => {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: text,
|
||||||
|
success: () => {
|
||||||
|
toast.info('复制成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<route lang="jsonc" type="page">{
|
<route lang="jsonc" type="page">{
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
@ -8,25 +9,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="order-list sticky top-0 left-0 z-50 bg-[#F6F7F8] pb-10rpx">
|
<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 @click-left="orderList.handleBack">
|
<wd-navbar safeAreaInsetTop custom-class='!bg-[#F6F7F8]' :bordered="false" placeholder>
|
||||||
<template #left>
|
<template #left>
|
||||||
<view class="h-48rpx flex items-center">
|
<view class="h-48rpx flex items-center">
|
||||||
<view class="mt-4rpx">
|
<view class="mt-4rpx" @click="router.navigateBack()">
|
||||||
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="search-box">
|
<view class="search-box">
|
||||||
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索茶室订单"></wd-search>
|
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索茶室订单"></wd-search>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</wd-navbar>
|
</wd-navbar>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="orderList.handleChangeTabs">
|
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
|
||||||
<wd-tab title="全部" name="all"></wd-tab>
|
<wd-tab title="全部" :name="TeaSpecialistOrderStatusText.All"></wd-tab>
|
||||||
<wd-tab title="待付款" :name="OrderStatus.Pending"></wd-tab>
|
<wd-tab title="待付款" :name="TeaSpecialistOrderStatusText.Pending"></wd-tab>
|
||||||
<wd-tab title="预约单" :name="OrderStatus.Reserved"></wd-tab>
|
<wd-tab title="预约单" :name="TeaSpecialistOrderStatusText.Pay"></wd-tab>
|
||||||
<wd-tab title="待确认" :name="OrderStatus.Confirm"></wd-tab>
|
<wd-tab title="待确认" :name="TeaSpecialistOrderStatusText.Confirm"></wd-tab>
|
||||||
<wd-tab title="已完结" :name="OrderStatus.Finished"></wd-tab>
|
<wd-tab title="已完结" :name="TeaSpecialistOrderStatusText.Finished"></wd-tab>
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -34,115 +35,117 @@
|
|||||||
<view class="tabs mt-18rpx mx-30rpx">
|
<view class="tabs mt-18rpx mx-30rpx">
|
||||||
<!-- 这里可以尝试下不重新刷新获取列表 -->
|
<!-- 这里可以尝试下不重新刷新获取列表 -->
|
||||||
<!-- 全部 -->
|
<!-- 全部 -->
|
||||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === 'all'">
|
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in 10" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order-status="OrderStatus.Pending"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
|
|
||||||
<!-- 待付款 -->
|
<!-- 待付款 -->
|
||||||
<mescroll-body ref="mescrollItem1" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === OrderStatus.Pending">
|
<!-- <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 10" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order-status="OrderStatus.Pending"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body> -->
|
||||||
|
|
||||||
<!-- 预约单 -->
|
<!-- 预约单 -->
|
||||||
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === OrderStatus.Reserved">
|
<!-- <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 10" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order-status="OrderStatus.Pending"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body> -->
|
||||||
|
|
||||||
<!-- 待确认 -->
|
<!-- 待确认 -->
|
||||||
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === OrderStatus.Confirm">
|
<!-- <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 10" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order-status="OrderStatus.Pending"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body> -->
|
||||||
|
|
||||||
<!-- 已完结 -->
|
<!-- 已完结 -->
|
||||||
<mescroll-body ref="mescrollItem3" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === OrderStatus.Finished">
|
<!-- <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 10" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order-status="OrderStatus.Pending"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { OrderSource, OrderStatus } from '@/utils/order'
|
import { getTeaSpecialistOrderList } from '@/api/teaSpecialist-order'
|
||||||
import ComboCard from '@/components/order/ComboCard.vue'
|
import ComboCard from '@/components/order/ComboCard.vue'
|
||||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
|
import { OrderSource, OrderStatus, TeaSpecialistOrderStatusText, TeaSpecialistOrderStatusValue } from '@/utils/order'
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
|
||||||
/* mescroll */
|
/* mescroll */
|
||||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
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 keywords = ref<string>('')
|
||||||
|
const orderStatus = ref<string>('')
|
||||||
|
|
||||||
|
|
||||||
// tab
|
// tab
|
||||||
const tab = ref<string>('all')
|
const tab = ref<string>('all')
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
|
uni.$on('refreshOrderList', () => {
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll()
|
||||||
|
})
|
||||||
|
|
||||||
// 根据传过来的参数决定显示哪个tab
|
// 根据传过来的参数决定显示哪个tab
|
||||||
if (args.orderStatus) {
|
if (args.orderStatus) {
|
||||||
tab.value = args.orderStatus
|
tab.value = args.orderStatus
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const orderList = {
|
onUnload(() => {
|
||||||
|
uni.$off('refreshOrderList')
|
||||||
|
})
|
||||||
|
|
||||||
|
const OrderList = {
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
const filter = {
|
||||||
// list({
|
page: mescroll.num,
|
||||||
// page: mescroll.num,
|
size: mescroll.size,
|
||||||
// size: mescroll.size
|
order_status: orderStatus.value,
|
||||||
// }).then((res: { list: Array<any>, totalPages: Number }) => {
|
search: keywords.value
|
||||||
// const curPageData = res.list || [] // 当前页数据
|
}
|
||||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
|
||||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
|
||||||
|
|
||||||
// console.log("🚀 ~ goods:", goods)
|
getTeaSpecialistOrderList(filter).then((res) => {
|
||||||
|
const curPageData = res.list || [] // 当前页数据
|
||||||
// mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数)
|
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||||
|
list.value = list.value.concat(curPageData) //追加新数据
|
||||||
// }).catch(() => {
|
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||||
// mescroll.endErr(); // 请求失败, 结束加载
|
}).catch(() => {
|
||||||
// })
|
mescroll.endErr() // 请求失败, 结束加载
|
||||||
// apiGoods(mescroll.num, mescroll.size).then(res=>{
|
})
|
||||||
// const curPageData = res.list || [] // 当前页数据
|
|
||||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
|
||||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
|
||||||
// //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
||||||
// //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
|
|
||||||
|
|
||||||
// //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
|
||||||
// //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数)
|
|
||||||
|
|
||||||
// //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
|
|
||||||
// //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
|
|
||||||
|
|
||||||
// //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
|
|
||||||
// //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
|
|
||||||
|
|
||||||
// //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据.
|
|
||||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
|
||||||
// }).catch(()=>{
|
|
||||||
mescroll.endErr(); // 请求失败, 结束加载
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 切换tab
|
// 切换tab
|
||||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||||
tab.value = e.name
|
tab.value = e.name
|
||||||
|
if (e.name === TeaSpecialistOrderStatusText.Pending) {
|
||||||
|
orderStatus.value = '0'
|
||||||
|
} else {
|
||||||
|
orderStatus.value = TeaSpecialistOrderStatusValue[e.name] || ''
|
||||||
|
}
|
||||||
|
|
||||||
// 切换tab时,重置当前的mescroll
|
// 切换tab时,重置当前的mescroll
|
||||||
// getMescroll().resetUpScroll();
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
@ -159,6 +162,14 @@
|
|||||||
background-color: $cz-page-background;
|
background-color: $cz-page-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-list {
|
||||||
|
:deep() {
|
||||||
|
.wd-navbar__left {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
:deep() {
|
:deep() {
|
||||||
.wd-tabs,
|
.wd-tabs,
|
||||||
|
|||||||
@ -11,11 +11,16 @@
|
|||||||
<navbar title="预约茶室" fixed>
|
<navbar title="预约茶室" fixed>
|
||||||
<template #right>
|
<template #right>
|
||||||
<view class="flex items-center ml-114rpx right-slot">
|
<view class="flex items-center ml-114rpx right-slot">
|
||||||
<view class="mr-16rpx flex items-center" @click="room.handleCollect">
|
<view class="mr-16rpx flex items-center" @click="Room.handleCollect">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc.png`"></wd-img>
|
|
||||||
<!-- <wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc_s.png`"></wd-img> -->
|
<!-- <wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc_s.png`"></wd-img> -->
|
||||||
|
<template v-if="teaRoom.collect > 0">
|
||||||
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc_s.png`"></wd-img>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc.png`"></wd-img>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view @click="room.handleService" class="flex items-center">
|
<view @click="Room.handleService" class="flex items-center">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_kefu.png`"></wd-img>
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_kefu.png`"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -27,22 +32,22 @@
|
|||||||
<view>
|
<view>
|
||||||
<wd-swiper value-key="image" height="320rpx"
|
<wd-swiper value-key="image" height="320rpx"
|
||||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current"
|
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current"
|
||||||
@click="room.handleClick" mode="aspectFit">
|
@click="Room.handleClick" mode="aspectFit">
|
||||||
</wd-swiper>
|
</wd-swiper>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-38rpx flex justify-between">
|
<view class="mt-38rpx flex justify-between">
|
||||||
<view class="line-1">
|
<view class="line-1">
|
||||||
<view class="text-34rpx text-[#303133] leading-48rpx font-bold line-1">凝香茶业</view>
|
<view class="text-34rpx text-[#303133] leading-48rpx font-bold line-1">{{ teaRoom.name }}</view>
|
||||||
<view class="relative mt-18rpx h-34rpx">
|
<view class="relative mt-18rpx h-34rpx">
|
||||||
<view class="absolute top-0 flex items-center">
|
<view class="absolute top-0 flex items-center">
|
||||||
<wd-rate v-model="rate" readonly active-color="#FF5951" allow-half active-icon="star-filled" icon="star" space="4rpx"/>
|
<wd-rate v-model="teaRoom.star" readonly active-color="#FF5951" allow-half active-icon="star-filled" icon="star" space="4rpx"/>
|
||||||
<view class="text-26rpx text-[#606266] leading-34rpx ml-8rpx">4.0 推荐</view>
|
<view class="text-26rpx text-[#606266] leading-34rpx ml-8rpx">{{ teaRoom.star }} 推荐</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-26rpx mt-18rpx leading-48rpx text-[#606266]">营业时间:周一至周日 08:00-20:00</view>
|
<view class="text-26rpx mt-18rpx leading-48rpx text-[#606266]">营业时间:{{ teaRoom.day_time }} {{ teaRoom.start_time }}-{{ teaRoom.end_time }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-col items-end">
|
<view class="flex flex-col items-end">
|
||||||
<view @click="room.handleToRecharge">
|
<view @click="Room.handleToRecharge">
|
||||||
<recharge-btn name="充值"></recharge-btn>
|
<recharge-btn name="充值"></recharge-btn>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-24rpx text-[#818CA9] mt-18rpx">1分钟前有人充值</view>
|
<view class="text-24rpx text-[#818CA9] mt-18rpx">1分钟前有人充值</view>
|
||||||
@ -57,16 +62,16 @@
|
|||||||
<view class="w-36rpx h-36rpx">
|
<view class="w-36rpx h-36rpx">
|
||||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_location2.png`"/>
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_location2.png`"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-2rpx text-26rpx text-[#606266] line-2">青浦区仓路478号</view>
|
<view class="ml-2rpx text-26rpx text-[#606266] line-2">{{ teaRoom.address }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#92928C] text-24rpx ml-38rpx mt-14rpx">距您14km</view>
|
<view class="text-[#92928C] text-24rpx ml-38rpx mt-14rpx">距您14km</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center mr-32rpx">
|
<view class="flex items-center mr-32rpx">
|
||||||
<view class="text-center mr-20rpx" @click="room.handleLocation">
|
<view class="text-center mr-20rpx" @click="Room.handleLocation">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
||||||
<view class="text-[#606266] text-24rpx leading-32rpx mt-8rpx">导航</view>
|
<view class="text-[#606266] text-24rpx leading-32rpx mt-8rpx">导航</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center" @click="room.handleCallPhone">
|
<view class="text-center" @click="Room.handleCallPhone">
|
||||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
||||||
<view class="text-[#606266] text-24rpx leading-32rpx mt-8rpx">电话</view>
|
<view class="text-[#606266] text-24rpx leading-32rpx mt-8rpx">电话</view>
|
||||||
</view>
|
</view>
|
||||||
@ -77,17 +82,17 @@
|
|||||||
<wd-gap bg-color="#F6F7F9" height="20rpx"></wd-gap>
|
<wd-gap bg-color="#F6F7F9" height="20rpx"></wd-gap>
|
||||||
</view>
|
</view>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="room.handleChangeTab" :lazy="false">
|
<wd-tabs v-model="tab" swipeable slidable="always" @change="Room.handleChangeTab" :lazy="false">
|
||||||
<wd-tab title="茶室预定" v-if="storeType != 2">
|
<wd-tab title="茶室预定" v-if="storeType != 2">
|
||||||
<view class="content mx-30rpx mt-34rpx">
|
<view class="content mx-30rpx mt-34rpx">
|
||||||
<mescroll-body @init="mescrollInit" @down="downCallback" @up="room.upCallback">
|
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Room.upCallback">
|
||||||
<room-list :is-reserve="true" :store-type="storeType"></room-list>
|
<room-list :is-reserve="true" :store-type="storeType"></room-list>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
</view>
|
</view>
|
||||||
</wd-tab>
|
</wd-tab>
|
||||||
<wd-tab title="团购套餐">
|
<wd-tab title="团购套餐">
|
||||||
<view class="content mx-30rpx mt-34rpx">
|
<view class="content mx-30rpx mt-34rpx">
|
||||||
<mescroll-body @init="mescrollInit" @down="downCallback" @up="room.upCallback">
|
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Room.upCallback">
|
||||||
<room-list :is-group-buying="true" :store-type="storeType"></room-list>
|
<room-list :is-group-buying="true" :store-type="storeType"></room-list>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
</view>
|
</view>
|
||||||
@ -98,7 +103,7 @@
|
|||||||
<!-- 客服弹窗 -->
|
<!-- 客服弹窗 -->
|
||||||
<wd-popup v-model="showServicePopup" lock-scroll custom-style="border-radius:30rpx;" @close="showServicePopup = false">
|
<wd-popup v-model="showServicePopup" lock-scroll custom-style="border-radius:30rpx;" @close="showServicePopup = false">
|
||||||
<view class="text-center w-440rpx h-560rpx flex flex-col justify-center items-center">
|
<view class="text-center w-440rpx h-560rpx flex flex-col justify-center items-center">
|
||||||
<view class="w-240rpx h-240rpx" @click="room.handleOpenServiceSheet">
|
<view class="w-240rpx h-240rpx" @click="Room.handleOpenServiceSheet">
|
||||||
<wd-img width='100%' height='100%' :src="`${OSS}images/reserve_room/reserve_room_image3.png`"></wd-img>
|
<wd-img width='100%' height='100%' :src="`${OSS}images/reserve_room/reserve_room_image3.png`"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-36rpx text-[#303133] leading-50rpx mt-54rpx">门店客服</view>
|
<view class="text-36rpx text-[#303133] leading-50rpx mt-54rpx">门店客服</view>
|
||||||
@ -106,7 +111,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|
||||||
<wd-action-sheet v-model="showAction" :actions="sheetMenu" cancel-text="取消" @close="showAction = false" @select="room.handleSelectMenu" />
|
<wd-action-sheet v-model="showAction" :actions="sheetMenu" cancel-text="取消" @close="showAction = false" @select="Room.handleSelectMenu" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -116,6 +121,10 @@
|
|||||||
import RechargeBtn from '@/components/RechargeBtn.vue'
|
import RechargeBtn from '@/components/RechargeBtn.vue'
|
||||||
import RoomList from '@/components/reserve/RoomList.vue'
|
import RoomList from '@/components/reserve/RoomList.vue'
|
||||||
import {toast} from '@/utils/toast'
|
import {toast} from '@/utils/toast'
|
||||||
|
import { getTeaRoomDetail, collectTeaRoom } from '@/api/tea-room'
|
||||||
|
import type { ITeaRoomDetailResult } from '@/api/types/tea-room'
|
||||||
|
import type {IUserInfoVo } from '@/api/types/login'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
const rightPadding = inject('capsuleOffset')
|
const rightPadding = inject('capsuleOffset')
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
@ -127,8 +136,15 @@
|
|||||||
])
|
])
|
||||||
const current = ref<number>(0)
|
const current = ref<number>(0)
|
||||||
|
|
||||||
|
// 茶室ID
|
||||||
|
const teaRoomId = ref<number>(0)
|
||||||
|
const teaRoom = ref<any>({})
|
||||||
|
|
||||||
// 评分
|
// 评分
|
||||||
const rate = ref<number>(4)
|
const rate = ref<number>(4)
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const userInfo = ref<IUserInfoVo>(null)
|
||||||
|
|
||||||
// tab
|
// tab
|
||||||
const tab = ref<number>(0)
|
const tab = ref<number>(0)
|
||||||
@ -143,12 +159,32 @@
|
|||||||
/* mescroll */
|
/* mescroll */
|
||||||
const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad((args) => {
|
||||||
|
console.log("🚀 ~ args:", uni.getStorageSync('latitude'), uni.getStorageSync('longitude'))
|
||||||
|
if (args.id) {
|
||||||
|
teaRoomId.value = Number(args.id)
|
||||||
|
Room.handleInit()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const room = {
|
const Room = {
|
||||||
sheetMenuType: '', // 记录菜单类型
|
sheetMenuType: '', // 记录菜单类型
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
handleInit: async () => {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
userInfo.value = userStore.userInfo
|
||||||
|
|
||||||
|
const res = await getTeaRoomDetail({
|
||||||
|
id: teaRoomId.value,
|
||||||
|
latitude: uni.getStorageSync('latitude'),
|
||||||
|
longitude: uni.getStorageSync('longitude'),
|
||||||
|
user_id: userInfo.value.id || 0
|
||||||
|
})
|
||||||
|
teaRoom.value = res.details
|
||||||
|
console.log("🚀 ~ teaRoom.value:", teaRoom.value)
|
||||||
|
},
|
||||||
|
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||||
@ -190,10 +226,15 @@
|
|||||||
// })
|
// })
|
||||||
},
|
},
|
||||||
|
|
||||||
// 收藏和取消收藏
|
// 处理收藏
|
||||||
handleCollect: () => {
|
handleCollect: async () => {
|
||||||
// 处理收藏逻辑
|
let status = teaRoom.value.collect == 0 ? 1 : 0
|
||||||
toast.info('收藏成功')
|
await collectTeaRoom({
|
||||||
|
id: teaRoom.value.id,
|
||||||
|
status
|
||||||
|
})
|
||||||
|
|
||||||
|
teaRoom.value.collect = teaRoom.value.collect == 0 ? 1 : 0
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开客服弹窗
|
// 打开客服弹窗
|
||||||
@ -203,7 +244,7 @@
|
|||||||
|
|
||||||
// 打开客服二维码弹窗
|
// 打开客服二维码弹窗
|
||||||
handleOpenServiceSheet: () => {
|
handleOpenServiceSheet: () => {
|
||||||
room.sheetMenuType = 'service'
|
Room.sheetMenuType = 'service'
|
||||||
showAction.value = true
|
showAction.value = true
|
||||||
sheetMenu.value = [
|
sheetMenu.value = [
|
||||||
{
|
{
|
||||||
@ -219,8 +260,7 @@
|
|||||||
|
|
||||||
// 处理菜单选择
|
// 处理菜单选择
|
||||||
handleSelectMenu: (item: any) => {
|
handleSelectMenu: (item: any) => {
|
||||||
console.log("🚀 ~ item:", item)
|
if (Room.sheetMenuType == 'service') {
|
||||||
if (room.sheetMenuType == 'service') {
|
|
||||||
// 处理客服相关的菜单项
|
// 处理客服相关的菜单项
|
||||||
if (item.value === 'saveImage') {
|
if (item.value === 'saveImage') {
|
||||||
// 处理保存图片逻辑
|
// 处理保存图片逻辑
|
||||||
@ -229,9 +269,9 @@
|
|||||||
// 处理添加微信逻辑
|
// 处理添加微信逻辑
|
||||||
toast.success('已添加门店微信')
|
toast.success('已添加门店微信')
|
||||||
}
|
}
|
||||||
} else if (room.sheetMenuType == 'call' && item.index == 1) {
|
} else if (Room.sheetMenuType == 'call') {
|
||||||
uni.makePhoneCall({
|
uni.makePhoneCall({
|
||||||
phoneNumber: item.value // 替换为实际电话号码
|
phoneNumber: teaRoom.value.contact_phone
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,25 +280,26 @@
|
|||||||
|
|
||||||
// 处理导航逻辑
|
// 处理导航逻辑
|
||||||
handleLocation: () => {
|
handleLocation: () => {
|
||||||
toast.info('正在导航...')
|
uni.openLocation({
|
||||||
// 可以使用uni.navigateTo或其他方式打开地图应用
|
latitude: Number(teaRoom.value.latitude),
|
||||||
uni.navigateTo({
|
longitude: Number(teaRoom.value.longitude),
|
||||||
url: '/pages/map/map' // 假设有一个地图页面
|
name: teaRoom.value.name,
|
||||||
|
address: teaRoom.value.address
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理拨打电话逻辑
|
// 处理拨打电话逻辑
|
||||||
handleCallPhone: () => {
|
handleCallPhone: () => {
|
||||||
room.sheetMenuType = 'call'
|
Room.sheetMenuType = 'call'
|
||||||
showAction.value = true
|
showAction.value = true
|
||||||
sheetMenu.value = [
|
sheetMenu.value = [
|
||||||
{
|
{
|
||||||
name: 15005837859,
|
name: teaRoom.value.contact_phone || '暂无联系人',
|
||||||
value: ''
|
value: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '呼叫',
|
name: '呼叫',
|
||||||
value: 15005837859
|
value: teaRoom.value.contact_phone || ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="RechargeBtn">
|
<script lang="ts" setup name="Pay">
|
||||||
/**
|
/**
|
||||||
* Pay 支付组件
|
* Pay 支付组件
|
||||||
* @description 用于展示支付
|
* @description 用于展示支付
|
||||||
@ -52,7 +52,6 @@
|
|||||||
// 获取个人用户信息
|
// 获取个人用户信息
|
||||||
const userRes = await getUserInfo()
|
const userRes = await getUserInfo()
|
||||||
Object.assign(userInfo, userRes || {})
|
Object.assign(userInfo, userRes || {})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
import { router } from '@/utils/tools'
|
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
|
||||||
const LOCATION_EXPIRE_KEY = import.meta.env.VITE_DEFAULT_LOCATION_EXPIRE_KEY // 定位缓存KEY
|
export const LOCATION_DEFAULT_CITY = '上海市' // 默认城市
|
||||||
const LOCATION_EXPIRE_MS = import.meta.env.VITE_DEFAULT_LOCATION_EXPIRE_MS // 30天
|
export const LOCATION_DEFAULT_LAT = 34.757975 // 上海经度
|
||||||
const LOCATION_DEFAULT_CITY = import.meta.env.VITE_DEFAULT_ADDRESS // 默认城市
|
export const LOCATION_DEFAULT_LNG = 113.665412 // 上海纬度
|
||||||
const LOCATION_DEFAULT_LAT = import.meta.env.VITE_DEFAULT_LATITUDE // 上海经度
|
export const LOCATION_DENY_TIME_KEY = 'location_deny_time' // 未授权定位,重新授权时间KEY
|
||||||
const LOCATION_DEFAULT_LNG = import.meta.env.VITE_DEFAULT_LONGITUDE // 上海纬度
|
export const LOCATION_CITY_KEY = 'city' // 城市缓存KEY
|
||||||
const LOCATION_DENY_TIME_KEY = import.meta.env.VITE_DEFAULT_LOCATION_DENY_TIME_KEY
|
|
||||||
const LOCATION_DENY_INTERVAL = import.meta.env.VITE_DEFAULT_LOCATION_DENY_INTERVAL
|
|
||||||
|
|
||||||
// 检查过期时间
|
// 检查过期时间
|
||||||
export function handleCheckLocationCacheHooks() {
|
export function handleCheckLocationCacheHooks() {
|
||||||
@ -50,6 +49,7 @@ export async function handleEnsureLocationAuthHooks() {
|
|||||||
},
|
},
|
||||||
fail() {
|
fail() {
|
||||||
// 定位失败,返回默认上海
|
// 定位失败,返回默认上海
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -69,12 +69,88 @@ export async function handleEnsureLocationAuthHooks() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 返回默认上海
|
// 返回默认上海
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: 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)
|
||||||
|
}
|
||||||
|
|
||||||
// 检查是否需要弹授权框
|
// 检查是否需要弹授权框
|
||||||
function shouldShowAuthModal() {
|
function shouldShowAuthModal() {
|
||||||
const lastDeny = uni.getStorageSync(LOCATION_DENY_TIME_KEY)
|
const lastDeny = uni.getStorageSync(LOCATION_DENY_TIME_KEY)
|
||||||
|
|||||||
97
src/hooks/useTeaSpecialistOrder.ts
Normal file
97
src/hooks/useTeaSpecialistOrder.ts
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
import { router } from '@/utils/tools'
|
||||||
|
import { toast } from '@/utils/toast'
|
||||||
|
import { cancelTeaSpecialistOrder, deleteTeaSpecialistOrder, confirmTeaSpecialistOrder, refundTeaSpecialistOrder } from '@/api/teaSpecialist-order'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消订单
|
||||||
|
* @param orderId 订单ID
|
||||||
|
*/
|
||||||
|
export async function handleCancelOrderHooks(orderId: number) {
|
||||||
|
try {
|
||||||
|
const response = await cancelTeaSpecialistOrder({ id: orderId })
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
|
uni.$emit('refreshOrderDetail')
|
||||||
|
} catch (error) {
|
||||||
|
router.navigateBack()
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新支付
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @param teaSpecialistId 茶艺师ID
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function handleToPayHooks(orderId: number, teaSpecialistId: number) {
|
||||||
|
try {
|
||||||
|
uni.$on('payment', params => {
|
||||||
|
console.log("🚀 ~ params:", params)
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$off("payment")
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
|
uni.$emit('refreshOrderDetail')
|
||||||
|
if (params.result) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/notice/reserve?type=teaSpecialist&orderId=${params.orderId}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/bundle/order/tea-specialist/order-list'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
router.navigateTo(`/pages/cashier/cashier?from=order&orderId=${orderId}&teaSpecialistId=${teaSpecialistId}`)
|
||||||
|
}, 800)
|
||||||
|
} catch (error) {
|
||||||
|
toast.info('订单提交失败,请稍后重试')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单
|
||||||
|
*/
|
||||||
|
export async function handleDeleteOrderHooks(orderId: number) {
|
||||||
|
try {
|
||||||
|
const response = await deleteTeaSpecialistOrder({ id: orderId })
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
|
uni.$emit('refreshOrderDetail')
|
||||||
|
} catch (error) {
|
||||||
|
router.navigateBack()
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认(完成)订单
|
||||||
|
*/
|
||||||
|
export async function handleConfirmOrderHooks(orderId: number) {
|
||||||
|
try {
|
||||||
|
const response = await confirmTeaSpecialistOrder({ id: orderId })
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
|
uni.$emit('refreshOrderDetail')
|
||||||
|
} catch (error) {
|
||||||
|
router.navigateBack()
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @param orderType 订单类型
|
||||||
|
*/
|
||||||
|
export async function handleRefundOrderHooks(orderId: number, orderType: string) {
|
||||||
|
try {
|
||||||
|
const response = await refundTeaSpecialistOrder({ id: orderId, order_type: orderType })
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
|
uni.$emit('refreshOrderDetail')
|
||||||
|
} catch (error) {
|
||||||
|
router.navigateBack()
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,7 +32,7 @@ const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthenticati
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// 切换到登录页
|
// 切换到登录页
|
||||||
await uni.reLaunch({ url: '/pages/common/login/index' })
|
await uni.reLaunch({ url: '/pages/login/login' })
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -67,9 +67,7 @@ const alovaInstance = createAlova({
|
|||||||
// }
|
// }
|
||||||
// method.config.headers.token = token;
|
// method.config.headers.token = token;
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const token = uni.getStorageSync('token')
|
||||||
const { token } = userStore.userInfo as unknown as IUserInfo
|
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
toast.info('请先登录')
|
toast.info('请先登录')
|
||||||
router.switchTab('/pages/my/my', 500)
|
router.switchTab('/pages/my/my', 500)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
export enum ResultEnum {
|
export enum ResultEnum {
|
||||||
Success = 0, // 成功
|
Success = 1, // 成功
|
||||||
Error = 400, // 错误
|
Error = 0, // 错误
|
||||||
Unauthorized = 401, // 未授权
|
Unauthorized = -1, // 未授权
|
||||||
Forbidden = 403, // 禁止访问(原为forbidden)
|
Forbidden = 403, // 禁止访问(原为forbidden)
|
||||||
NotFound = 404, // 未找到(原为notFound)
|
NotFound = 404, // 未找到(原为notFound)
|
||||||
MethodNotAllowed = 405, // 方法不允许(原为methodNotAllowed)
|
MethodNotAllowed = 405, // 方法不允许(原为methodNotAllowed)
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
},
|
},
|
||||||
"quickapp": {},
|
"quickapp": {},
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wxa2abb91f64032a2b",
|
"appid": "wx63e106209b842919",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
@ -98,7 +98,7 @@
|
|||||||
},
|
},
|
||||||
"permission": {
|
"permission": {
|
||||||
"scope.userLocation": {
|
"scope.userLocation": {
|
||||||
"desc": "我们需要获取您的位置,以方便推荐附近工厂给您"
|
"desc": "我们需要获取您的位置,以方便推荐附近茶室给您"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -153,6 +153,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/search/search",
|
"path": "pages/search/search",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
"needLogin": true,
|
||||||
"layout": "tabbar",
|
"layout": "tabbar",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
@ -335,6 +336,7 @@
|
|||||||
{
|
{
|
||||||
"path": "order/douyin/order-list",
|
"path": "order/douyin/order-list",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
@ -375,6 +377,7 @@
|
|||||||
{
|
{
|
||||||
"path": "order/tea-room/order-list",
|
"path": "order/tea-room/order-list",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
@ -391,6 +394,7 @@
|
|||||||
{
|
{
|
||||||
"path": "order/tea-specialist/order-list",
|
"path": "order/tea-specialist/order-list",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
"needLogin": true,
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
|
|||||||
@ -29,9 +29,9 @@
|
|||||||
<view class="mt-50rpx mx-30rpx">
|
<view class="mt-50rpx mx-30rpx">
|
||||||
<view class="text-[#333] leading-42rpx text-30rpx font-bold">已开通城市</view>
|
<view class="text-[#333] leading-42rpx text-30rpx font-bold">已开通城市</view>
|
||||||
<view class="mt-40rpx grid grid-cols-4 gap-20rpx w-full">
|
<view class="mt-40rpx grid grid-cols-4 gap-20rpx w-full">
|
||||||
<view class="bg-[#F8F9FA] rounded-28rpx h-56rpx text-[#606266] flex items-center justify-center" v-for="(item, index) in 9" :key="index">
|
<view class="bg-[#F8F9FA] rounded-28rpx h-56rpx text-[#606266] flex items-center justify-center" v-for="(item, index) in openCityList" :key="index">
|
||||||
<wd-img width="28rpx" height="28rpx" :src="`${OSS}icon/icon_location2.png`"></wd-img>
|
<wd-img width="28rpx" height="28rpx" :src="`${OSS}icon/icon_location2.png`"></wd-img>
|
||||||
<view class="text-26rpx text-[#606266] leading-36rpx">上海市</view>
|
<view class="text-26rpx text-[#606266] leading-36rpx">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -39,18 +39,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, inject } from 'vue'
|
import { router } from '@/utils/tools'
|
||||||
|
import { getOpenCityList } from '@/api/tea-room'
|
||||||
|
|
||||||
let OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
onLoad(() => {
|
// 经纬度
|
||||||
|
const latitude = ref<number>(0)
|
||||||
|
const longitude = ref<number>(0)
|
||||||
|
|
||||||
|
// 已开通城市列表
|
||||||
|
const openCityList = ref<Array<any>>([])
|
||||||
|
|
||||||
|
onLoad((args) => {
|
||||||
|
if (args.lat && args.lng) {
|
||||||
|
latitude.value = Number(args.lat)
|
||||||
|
longitude.value = Number(args.lng)
|
||||||
|
}
|
||||||
|
|
||||||
|
City.handleInit()
|
||||||
})
|
})
|
||||||
|
|
||||||
const city = {
|
const City = {
|
||||||
back: () => {
|
handleInit: async () => {
|
||||||
uni.navigateBack({
|
const res = await getOpenCityList()
|
||||||
delta: 1,
|
openCityList.value = res.list
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,13 +13,13 @@
|
|||||||
<view class="home-bg w-[100%] fixed top-0 left-0 z-100">
|
<view class="home-bg w-[100%] fixed top-0 left-0 z-100">
|
||||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
|
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
|
||||||
<template #left>
|
<template #left>
|
||||||
<view class="flex items-center line-1 w-130rpx" @click="Index.toCity">
|
<view class="flex items-center line-1 w-130rpx" @click="Index.handleToCity">
|
||||||
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">上海市</view>
|
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">上海市</view>
|
||||||
<wd-img width="14rpx" height="9rpx" :src="`${OSS}icon/icon_arrow_down.png`" />
|
<wd-img width="14rpx" height="9rpx" :src="`${OSS}icon/icon_arrow_down.png`" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="search-box flex items-center ml-26rpx" @click="Index.toSearch">
|
<view class="search-box flex items-center ml-26rpx" @click="Index.handleToSearch">
|
||||||
<wd-search placeholder="搜索茶址名称" hide-cancel disabled :placeholder-left="true"
|
<wd-search placeholder="搜索茶址名称" hide-cancel disabled :placeholder-left="true"
|
||||||
placeholderStyle="text-align:left;padding-left: 24rpx;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;">
|
placeholderStyle="text-align:left;padding-left: 24rpx;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;">
|
||||||
</wd-search>
|
</wd-search>
|
||||||
@ -30,9 +30,9 @@
|
|||||||
|
|
||||||
<view :style="{ paddingTop: navbarHeight + 'px' }">
|
<view :style="{ paddingTop: navbarHeight + 'px' }">
|
||||||
<view class="mt-32rpx mx-30rpx">
|
<view class="mt-32rpx mx-30rpx">
|
||||||
<wd-swiper value-key="image" height="240rpx" indicatorPosition="bottom-left"
|
<wd-swiper height="240rpx" indicatorPosition="bottom-left"
|
||||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current"
|
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current"
|
||||||
@click="Index.handleClick" @change="Index.onChange" mode="aspectFit"></wd-swiper>
|
@click="Index.handleClick" mode="aspectFit"></wd-swiper>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-40rpx flex items-center h-36rpx mx-30rpx">
|
<view class="mt-40rpx flex items-center h-36rpx mx-30rpx">
|
||||||
@ -56,28 +56,29 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Index.upCallback" top="28rpx"
|
<mescroll-body @init="mescrollInit" :down="downOption" @down="downCallback" :up="upOption" @up="Index.upCallback" top="28rpx"
|
||||||
:fixed="true">
|
:fixed="true">
|
||||||
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in 100" :key="index" @click="Index.handleToReserveRoom(item)">
|
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in list" :key="index" @click="Index.handleToReserveRoom(item.id)">
|
||||||
<view class="absolute top--28rpx left-0 z-1">
|
<view class="absolute top--28rpx left-0 z-1">
|
||||||
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image4.png`"/>
|
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image4.png`"/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mx-30rpx p-30rpx flex bg-white rounded-10rpx">
|
<view class="mx-30rpx p-30rpx flex bg-white rounded-10rpx">
|
||||||
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`" radius="10rpx" />
|
<wd-img width="200rpx" height="200rpx" :src="item.image" radius="10rpx" />
|
||||||
<view class="flex-1 ml-28rpx flex justify-between line-1 items-start relative">
|
<view class="flex-1 ml-28rpx flex justify-between line-1 items-start relative">
|
||||||
<view class="line-1">
|
<view class="line-1">
|
||||||
<view class="font-bold text-30rpx leading-42rpx line-1">
|
<view class="font-bold text-30rpx leading-42rpx line-1">
|
||||||
凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业凝香茶业</view>
|
{{ item.name }}
|
||||||
|
</view>
|
||||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||||
<view class="font-400 text-[#F29747] text-24rpx mr-18rpx">半年预约300+</view>
|
<view class="font-400 text-[#F29747] text-24rpx mr-18rpx">半年预约{{ item.half_year_nums > 10 ? item.half_year_nums + '+' : item.half_year_nums }}</view>
|
||||||
<view class="font-400 bg-[#F3F3F3] text-[#818CA9] text-22rpx px-8rpx rounded-4rpx">刚有人预约了</view>
|
<view class="font-400 bg-[#F3F3F3] text-[#818CA9] text-22rpx px-8rpx rounded-4rpx">刚有人预约了</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||||
<view class="font-400 text-[#606266] text-24rpx mr-10rpx">
|
<view class="font-400 text-[#606266] text-24rpx mr-10rpx">
|
||||||
营业时间:00:00-23:59
|
营业时间:{{ item.start_time }}-{{ item.end_time }}
|
||||||
</view>
|
</view>
|
||||||
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-4rpx border-[#F2E2E1]">
|
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-4rpx border-[#F2E2E1]" v-if="item.shop_status == 0">
|
||||||
打烊了
|
打烊了
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -85,7 +86,7 @@
|
|||||||
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
|
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
|
||||||
mode="aspectFit" />
|
mode="aspectFit" />
|
||||||
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx">
|
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx">
|
||||||
青浦区仓路478号
|
{{ item.address }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -95,7 +96,7 @@
|
|||||||
<wd-icon name="add" color="#fff" size="20rpx" custom-style="font-weight: bold;" />
|
<wd-icon name="add" color="#fff" size="20rpx" custom-style="font-weight: bold;" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-24rpx text-[#92928C] font-400 mt-12rpx">距您14km</view>
|
<view class="text-24rpx text-[#92928C] font-400 mt-12rpx">距您{{ item.distance }}km</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -107,69 +108,105 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
import { handleEnsureLocationAuthHooks } from '@/hooks/useLocation'
|
import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks } from '@/hooks/useLocation'
|
||||||
|
import { getHomeBannerList } from '@/api/home'
|
||||||
|
import { getHomeTeaRoomList } from '@/api/tea-room'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
const navbarHeight = inject('navbarHeight')
|
const navbarHeight = inject('navbarHeight')
|
||||||
|
|
||||||
/** 轮播图 **/
|
/** 轮播图 **/
|
||||||
const swiperList = ref<string[]>([
|
const swiperList = ref<string[]>([])
|
||||||
`${OSS}images/banner1.png`,
|
|
||||||
`${OSS}images/banner1.png`,
|
|
||||||
`${OSS}images/banner1.png`
|
|
||||||
])
|
|
||||||
const current = ref<number>(0)
|
const current = ref<number>(0)
|
||||||
|
|
||||||
// 分页
|
// 分页
|
||||||
const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
|
const downOption = {
|
||||||
|
auto: true
|
||||||
|
}
|
||||||
|
const upOption = {
|
||||||
|
auto: true,
|
||||||
|
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||||
|
}
|
||||||
|
const latitude = ref<number>(0)
|
||||||
|
const longitude = ref<number>(0)
|
||||||
|
const keywords = ref<string>('')
|
||||||
|
const list = ref<Array<any>>([])
|
||||||
|
|
||||||
|
onShow(async() => {
|
||||||
|
// 等到onLoad执行完毕且获取到授权KEY后,才执行定位授权检查
|
||||||
|
if (uni.getStorageSync(LOCATION_DENY_TIME_KEY)) {
|
||||||
|
const location = await checkLocationAuthWithModal()
|
||||||
|
if (location) {
|
||||||
|
latitude.value = location.lat
|
||||||
|
longitude.value = location.lng
|
||||||
|
Index.handleResetSearch()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onLoad(async() => {
|
onLoad(async() => {
|
||||||
|
// 初始化页面数据
|
||||||
|
Index.handleInit()
|
||||||
|
|
||||||
// 获取用户经纬度(带缓存和授权逻辑)
|
// 获取用户经纬度(带缓存和授权逻辑)
|
||||||
const { lat, lng } = await handleEnsureLocationAuthHooks()
|
const { lat, lng } = await handleEnsureLocationAuthHooks()
|
||||||
// 你可以在这里根据经纬度做后续处理,比如请求附近门店等
|
latitude.value = lat
|
||||||
console.log('当前定位:', lat, lng)
|
longitude.value = lng
|
||||||
|
Index.handleResetSearch()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const Index = {
|
const Index = {
|
||||||
toCity: () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/city/city'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
toSearch: () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/search/search'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
const userStore = useUserStore()
|
||||||
|
const userId = userStore.userInfo?.id || 0
|
||||||
|
|
||||||
// apiGoods(mescroll.num, mescroll.size).then(res=>{
|
const filter = {
|
||||||
// const curPageData = res.list || [] // 当前页数据
|
page: mescroll.num,
|
||||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
size: mescroll.size,
|
||||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
latitude: latitude.value,
|
||||||
// //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
longitude: longitude.value,
|
||||||
// //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
|
search: keywords.value,
|
||||||
|
user_id: userId
|
||||||
|
}
|
||||||
|
|
||||||
// //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
getHomeTeaRoomList(filter).then( res => {
|
||||||
// //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数)
|
console.log("🚀 ~ res:", 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() // 请求失败, 结束加载
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
|
handleInit: () => {
|
||||||
// //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
|
// 初始化操作
|
||||||
|
getHomeBannerList().then(res => {
|
||||||
|
swiperList.value = res.list.map(item => item.address)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
|
handleToCity: () => {
|
||||||
// //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
|
router.navigateTo(`/pages/city/city?lat=${latitude.value}&lng=${longitude.value}`)
|
||||||
|
},
|
||||||
|
|
||||||
// //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据.
|
// 跳转茶室搜索
|
||||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
handleToSearch: () => {
|
||||||
// }).catch(()=>{
|
uni.$on('refreshTeaRoomList', params => {
|
||||||
mescroll.endErr(); // 请求失败, 结束加载
|
keywords.value = params.keywords
|
||||||
// })
|
Index.handleResetSearch()
|
||||||
|
|
||||||
|
uni.$off('refreshTeaRoomList')
|
||||||
|
})
|
||||||
|
router.navigateTo(`/pages/search/search?keywords=${keywords.value}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClick: (item: any) => {
|
handleClick: (item: any) => {
|
||||||
@ -177,16 +214,16 @@
|
|||||||
console.log('Clicked item:', item)
|
console.log('Clicked item:', item)
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange: (e: any) => {
|
handleToReserveRoom: (id: number = 0) => {
|
||||||
// 设置 current.value 为当前轮播索引
|
|
||||||
current.value = e.current
|
|
||||||
},
|
|
||||||
|
|
||||||
handleToReserveRoom: (id: number = 1) => {
|
|
||||||
// 跳转到预约茶室页面
|
// 跳转到预约茶室页面
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/bundle/tea-room/room?id=${id}`
|
url: `/bundle/tea-room/room?id=${id}`
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleResetSearch: () => {
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -19,16 +19,18 @@
|
|||||||
<wd-img :src="`${OSS}images/logo.png`" width="100%" height="100%" mode="aspectFill"></wd-img>
|
<wd-img :src="`${OSS}images/logo.png`" width="100%" height="100%" mode="aspectFill"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-124rpx mx-60rpx box-border">
|
<view class="mt-124rpx mx-60rpx box-border">
|
||||||
<wd-button open-type="getPhoneNumber" @getphonenumber="login.handleGetPhoneNumber" custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border">手机号一键登录</wd-button>
|
<wd-button custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border" @click="Login.handleLogin">立即登录</wd-button>
|
||||||
<view class="text-30rpx font-400 text-[#303133] leading-42rpx text-center mt-32rpx">其它手机号登录</view>
|
<wd-button custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border" @click="Login.handleMobileLogin">测试-账号登录</wd-button>
|
||||||
|
<!-- <wd-button open-type="getUserInfo" @getuserinfo="Login.handleWxLogin" custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border">立即登录</wd-button> -->
|
||||||
|
<!-- <view class="text-30rpx font-400 text-[#303133] leading-42rpx text-center mt-32rpx">其它手机号登录</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex items-center mx-32rpx mt-64rpx">
|
<view class="flex items-center mx-32rpx mt-64rpx">
|
||||||
<view class="w-32rpx h-32rpx">
|
<view class="w-32rpx h-32rpx">
|
||||||
<wd-checkbox v-model="agree" @change="login.handleAgree" checked-color="#4C9F44" size="large"> </wd-checkbox>
|
<wd-checkbox v-model="agree" @change="Login.handleAgree" checked-color="#4C9F44" size="large"> </wd-checkbox>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-400 text-26rpx leading-40rpx text-[#8F959E] ml-14rpx flex-1" @click="agree = !agree">
|
<view class="font-400 text-26rpx leading-40rpx text-[#8F959E] ml-14rpx flex-1" @click="agree = !agree">
|
||||||
我已阅读并同意 <text class="text-[#4C9F44]" @click.stop="login.handleToService">《服务协议》</text> 和<text class="text-[#4C9F44]" @click.stop="login.handleToPrivacy">《隐私政策》</text>,未注册手机号登录后将自动你为您创建账号
|
我已阅读并同意 <text class="text-[#4C9F44]" @click.stop="Login.handleToService">《服务协议》</text> 和<text class="text-[#4C9F44]" @click.stop="Login.handleToPrivacy">《隐私政策》</text>,未注册手机号登录后将自动你为您创建账号
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -36,19 +38,46 @@
|
|||||||
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { toast } from '@/utils/toast'
|
||||||
|
import { getWxCode } from '@/api/login'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
|
// 服务协议条款
|
||||||
const agree = ref<boolean>(false)
|
const agree = ref<boolean>(false)
|
||||||
|
|
||||||
const login = {
|
const Login = {
|
||||||
// 获取手机号
|
// 获取手机号
|
||||||
handleGetPhoneNumber: (e: object) => {
|
handleLogin: async (e: object) => {
|
||||||
console.log("🚀 ~ e:", e)
|
if (!agree.value) {
|
||||||
|
toast.info('请同意服务协议和隐私政策')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const res = await userStore.wxLogin()
|
||||||
|
if (res) {
|
||||||
|
toast.info('登录成功')
|
||||||
|
router.navigateBack(1, 500)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAgree: (e: any) => {
|
// 手机登录
|
||||||
console.log('e', e)
|
handleMobileLogin: async () => {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
console.log("🚀 ~ userStore:", userStore)
|
||||||
|
const res = await userStore.mobileLogin('18868040087', 1, 2)
|
||||||
|
if (res) {
|
||||||
|
uni.setStorageSync('latitude', '30.74744')
|
||||||
|
uni.setStorageSync('longitude', '120.78483')
|
||||||
|
toast.info('登录成功')
|
||||||
|
router.navigateBack(1, 500)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleAgree: async (e: any) => {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到服务协议页面
|
// 跳转到服务协议页面
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_vip.png`" mode="aspectFill"></wd-img>
|
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_vip.png`" mode="aspectFill"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center leading-34rpx" @click="My.handleToVipBenefits">
|
<view class="flex items-center leading-34rpx" @click="My.handleToVipBenefits">
|
||||||
<view class="font-400 text-24rpx ml-12rpx mr-20rpx text-[#EECC99]">2026.03.06到期</view>
|
<view class="font-400 text-24rpx ml-12rpx mr-20rpx text-[#EECC99]">{{ isLogin ? '会员到期时间' : '- -' }}</view>
|
||||||
<view class="flex items-center mt-4rpx">
|
<view class="flex items-center mt-4rpx">
|
||||||
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
|
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
<view class="flex items-center justify-between mx-40rpx">
|
<view class="flex items-center justify-between mx-40rpx">
|
||||||
<view class="flex item-center leading-34rpx text-[#EECC99]">
|
<view class="flex item-center leading-34rpx text-[#EECC99]">
|
||||||
<view class="font-400 text-24rpx mr-18rpx">上月消费</view>
|
<view class="font-400 text-24rpx mr-18rpx">上月消费</view>
|
||||||
<view class="font-400 text-28rpx mr-18rpx">¥23014.02</view>
|
<view class="font-400 text-28rpx mr-18rpx">¥{{ isLogin ? '上月消费金额显示' : '- -' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view>
|
<view class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view>
|
||||||
</view>
|
</view>
|
||||||
@ -240,8 +240,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {OrderStatus} from '@/utils/order'
|
import { OrderStatus } from '@/utils/order'
|
||||||
import {toast} from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
const navbarHeight = inject('navbarHeight')
|
const navbarHeight = inject('navbarHeight')
|
||||||
@ -249,10 +251,9 @@
|
|||||||
|
|
||||||
// 登录信息相关
|
// 登录信息相关
|
||||||
const userInfo = ref<any>(null)
|
const userInfo = ref<any>(null)
|
||||||
const isLogin = ref<boolean>(true)
|
const isLogin = ref<boolean>(false)
|
||||||
const isVip = ref<boolean>(true)
|
const isVip = ref<boolean>(true)
|
||||||
|
|
||||||
|
|
||||||
// 茶室订单
|
// 茶室订单
|
||||||
const roomMenuList = reactive([
|
const roomMenuList = reactive([
|
||||||
{ id: 1, title: '全部订单', icon: `${OSS}icon/icon_room_all_order.png`, badge: '', status: 'all' },
|
{ id: 1, title: '全部订单', icon: `${OSS}icon/icon_room_all_order.png`, badge: '', status: 'all' },
|
||||||
@ -287,6 +288,12 @@
|
|||||||
// 领取优惠券
|
// 领取优惠券
|
||||||
const isClaimCoupon = ref<boolean>(false)
|
const isClaimCoupon = ref<boolean>(false)
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
isLogin.value = userStore.isLoggedIn
|
||||||
|
console.log("🚀 ~ isLogin.value:", isLogin.value)
|
||||||
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -294,24 +301,21 @@
|
|||||||
const My = {
|
const My = {
|
||||||
// 跳转抖音团购
|
// 跳转抖音团购
|
||||||
handleToDouYinGroupBuying: () => {
|
handleToDouYinGroupBuying: () => {
|
||||||
uni.navigateTo({
|
router.navigateTo('/bundle/order/douyin/order-list')
|
||||||
url: '/bundle/order/douyin/order-list'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到个人信息
|
// 跳转到个人信息
|
||||||
handleToProfile: () => {
|
handleToProfile: () => {
|
||||||
|
if (isLogin.value) {
|
||||||
uni.navigateTo({
|
router.navigateTo('/bundle/profile/profile')
|
||||||
url: '/bundle/profile/profile'
|
} else {
|
||||||
})
|
router.navigateTo('/pages/login/login')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转平台团购
|
// 跳转平台团购
|
||||||
handleToPlatformGroupBuying: () => {
|
handleToPlatformGroupBuying: () => {
|
||||||
uni.navigateTo({
|
router.navigateTo('/bundle/order/platform/order-list')
|
||||||
url: '/bundle/order/platform/order-list'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击显示客服电话
|
// 点击显示客服电话
|
||||||
@ -335,40 +339,48 @@
|
|||||||
showPompoCodePopup.value = true
|
showPompoCodePopup.value = true
|
||||||
} else {
|
} else {
|
||||||
toast.info('请先登录')
|
toast.info('请先登录')
|
||||||
setTimeout(() => {
|
router.navigateTo('/pages/login/login', 800)
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login'
|
|
||||||
})
|
|
||||||
}, 800)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到会员权益
|
// 跳转到会员权益
|
||||||
handleToVipBenefits: () => {
|
handleToVipBenefits: () => {
|
||||||
uni.navigateTo({
|
if (isLogin.value) {
|
||||||
url: '/bundle/vip/benefits'
|
router.navigateTo('/bundle/vip/my-benefits')
|
||||||
})
|
} else {
|
||||||
|
toast.info('请先登录')
|
||||||
|
router.navigateTo('/pages/login/login', 800)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到优惠券
|
// 跳转到优惠券
|
||||||
handleToCoupon: () => {
|
handleToCoupon: () => {
|
||||||
uni.navigateTo({
|
if (isLogin.value) {
|
||||||
url: '/bundle/coupon/my-coupon'
|
router.navigateTo('/bundle/coupon/my-coupon')
|
||||||
})
|
} else {
|
||||||
|
toast.info('请先登录')
|
||||||
|
router.navigateTo('/pages/login/login', 800)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到收藏
|
// 跳转到收藏
|
||||||
handleToCollect: () => {
|
handleToCollect: () => {
|
||||||
uni.navigateTo({
|
if (isLogin.value) {
|
||||||
url: '/bundle/collect/collect'
|
router.navigateTo('/bundle/collect/collect')
|
||||||
})
|
} else {
|
||||||
|
toast.info('请先登录')
|
||||||
|
router.navigateTo('/pages/login/login', 800)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到我的钱包
|
// 跳转到我的钱包
|
||||||
handleToWallet: () => {
|
handleToWallet: () => {
|
||||||
uni.navigateTo({
|
if (isLogin.value) {
|
||||||
url: '/bundle/wallet/wallet'
|
router.navigateTo('/bundle/wallet/wallet')
|
||||||
})
|
} else {
|
||||||
|
toast.info('请先登录')
|
||||||
|
router.navigateTo('/pages/login/login', 800)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
||||||
<route lang="jsonc" type="page">{
|
<route lang="jsonc" type="page">{
|
||||||
|
"needLogin": true,
|
||||||
"layout": "tabbar",
|
"layout": "tabbar",
|
||||||
"style": {
|
"style": {
|
||||||
// 'custom' 表示开启自定义导航栏,默认 'default'
|
// 'custom' 表示开启自定义导航栏,默认 'default'
|
||||||
@ -11,57 +12,125 @@
|
|||||||
<view class="">
|
<view class="">
|
||||||
<view class="home-bg">
|
<view class="home-bg">
|
||||||
<view class="home-bg w-[100vw] fixed top-0 left-0 z-100">
|
<view class="home-bg w-[100vw] fixed top-0 left-0 z-100">
|
||||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
|
<wd-navbar safeAreaInsetTop custom-class='!bg-[#F6F7F8]' :bordered="false" placeholder>
|
||||||
<template #left>
|
<template #left>
|
||||||
<view class="flex items-center" @click="search.back">
|
<view class="h-48rpx flex items-center">
|
||||||
<wd-img width="48rpx" height="48rpx" :src="`${OSS}icon/icon_arrow_left.png`" />
|
<view class="mt-4rpx" @click="router.navigateBack()">
|
||||||
|
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
<view class="search-box ml-20rpx">
|
||||||
<template #title>
|
<wd-search
|
||||||
<view class="search-box flex items-center ml-26rpx">
|
v-model="keywords"
|
||||||
<wd-search v-model="keywords" placeholder="搜索茶址名称" hide-cancel placeholder-left
|
hide-cancel
|
||||||
placeholderStyle="text-align:left;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;"></wd-search>
|
placeholder-left
|
||||||
|
light
|
||||||
|
placeholder="搜索茶址名称"
|
||||||
|
placeholderStyle="text-align:left;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;"
|
||||||
|
@search="Search.handleSearch">
|
||||||
|
</wd-search>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</view>
|
||||||
</wd-navbar>
|
</template>
|
||||||
|
</wd-navbar>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mx-30rpx mt-30rpx" :style="{ paddingTop: navbarHeight + 'px' }">
|
<view class="mx-30rpx mt-30rpx" :style="{ paddingTop: navbarHeight + 'px' }">
|
||||||
<view class="flex justify-between items-center">
|
<view class="flex justify-between items-center" @click="Search.handleClearHistory">
|
||||||
<view class="text-30rpx leading-42rpx text-[#303133] font-bold">历史搜索</view>
|
<view class="text-30rpx leading-42rpx text-[#303133] font-bold">历史搜索</view>
|
||||||
<wd-icon name="delete-thin" size="22px" color="9D9D9D"></wd-icon>
|
<wd-icon name="delete-thin" size="22px" color="9D9D9D"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-40rpx flex flex-wrap items-center">
|
<view class="mt-40rpx flex flex-wrap items-center">
|
||||||
<view class="bg-[#F8F9FA] rounded-28rpx w-112rpx h-56rpx text-center text-[#606266] text-26rpx leading-56rpx mr-20rpx mb-24rpx" v-for="(item, index) in 10" :key="index">
|
<view class="bg-[#F8F9FA] rounded-28rpx w-112rpx h-56rpx text-center text-[#606266] text-26rpx leading-56rpx mr-20rpx mb-24rpx" v-for="(item, index) in searchHistory" :key="index">
|
||||||
茶叶
|
{{ item.content }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
|
|
||||||
|
<!-- 删除历史 -->
|
||||||
|
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, inject } from 'vue'
|
|
||||||
import { getNavBarHeight } from '@/utils/index'
|
import { getNavBarHeight } from '@/utils/index'
|
||||||
|
import { getTeaRoomSearchHistory, clearTeaRoomSearchHistory } from '@/api/tea-room'
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
import { useMessage } from 'wot-design-uni'
|
||||||
|
|
||||||
let navbarHeight = ref(0)
|
const navbarHeight = ref(0)
|
||||||
let OSS = inject('OSS')
|
|
||||||
|
// 提示框
|
||||||
|
const message = useMessage('wd-message-box-slot')
|
||||||
|
|
||||||
|
// 搜索关键词
|
||||||
const keywords = ref<string>('')
|
const keywords = ref<string>('')
|
||||||
|
|
||||||
onLoad(() => {
|
// 搜索历史
|
||||||
navbarHeight.value = getNavBarHeight()
|
const searchHistory = ref<Array<any>>([])
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
Search.handleInit()
|
||||||
})
|
})
|
||||||
|
|
||||||
const search = {
|
onLoad((args) => {
|
||||||
back: () => {
|
navbarHeight.value = getNavBarHeight()
|
||||||
uni.navigateBack({
|
keywords.value = args.keywords || ''
|
||||||
delta: 1,
|
})
|
||||||
|
|
||||||
|
const Search = {
|
||||||
|
// 初始化
|
||||||
|
handleInit: () => {
|
||||||
|
console.log("🚀 ~ Search.handleInit:")
|
||||||
|
getTeaRoomSearchHistory().then( res => {
|
||||||
|
searchHistory.value = res.list
|
||||||
|
console.log('搜索历史123', res.list)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
handleSearch: () => {
|
||||||
|
const params = {
|
||||||
|
keywords: keywords.value
|
||||||
|
}
|
||||||
|
uni.$emit('refreshTeaRoomList', params)
|
||||||
|
router.navigateBack()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 清除搜索历史
|
||||||
|
handleClearHistory: () => {
|
||||||
|
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') {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
clearTeaRoomSearchHistory().then(() => {
|
||||||
|
searchHistory.value = []
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 点击取消按钮回调事件
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -13,7 +13,8 @@ const loginRoute = import.meta.env.VITE_LOGIN_URL
|
|||||||
|
|
||||||
function isLogined() {
|
function isLogined() {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
return !!userStore.userInfo.username
|
console.log("🚀 ~ isLogined ~ userStore.isLoggedIn:", userStore.isLoggedIn)
|
||||||
|
return !!userStore.isLoggedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDev = import.meta.env.DEV
|
const isDev = import.meta.env.DEV
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import {
|
|||||||
logout as _logout,
|
logout as _logout,
|
||||||
wxLogin as _wxLogin,
|
wxLogin as _wxLogin,
|
||||||
getWxCode,
|
getWxCode,
|
||||||
|
mobileLogin as _mobileLogin
|
||||||
} from '@/api/login'
|
} from '@/api/login'
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
|
|
||||||
@ -22,9 +23,13 @@ const userInfoState: IUserInfoVo = {
|
|||||||
account: '',
|
account: '',
|
||||||
channel: 0,
|
channel: 0,
|
||||||
is_new_user: 1,
|
is_new_user: 1,
|
||||||
mobile: ''
|
mobile: '',
|
||||||
|
username: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认未登录
|
||||||
|
const isLoggedIn = ref<boolean>(false)
|
||||||
|
|
||||||
export const useUserStore = defineStore(
|
export const useUserStore = defineStore(
|
||||||
'user',
|
'user',
|
||||||
() => {
|
() => {
|
||||||
@ -52,16 +57,16 @@ export const useUserStore = defineStore(
|
|||||||
userInfo.value = { ...userInfoState }
|
userInfo.value = { ...userInfoState }
|
||||||
uni.removeStorageSync('userInfo')
|
uni.removeStorageSync('userInfo')
|
||||||
uni.removeStorageSync('token')
|
uni.removeStorageSync('token')
|
||||||
|
isLoggedIn.value = false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
const getUserInfo = async () => {
|
const getUserInfo = async () => {
|
||||||
const res = await _getUserInfo()
|
const res = await _getUserInfo()
|
||||||
const userInfo = res.data
|
const userInfo = res
|
||||||
setUserInfo(userInfo)
|
setUserInfo(userInfo)
|
||||||
uni.setStorageSync('userInfo', userInfo)
|
uni.setStorageSync('userInfo', userInfo)
|
||||||
uni.setStorageSync('token', userInfo.token)
|
|
||||||
// TODO 这里可以增加获取用户路由的方法 根据用户的角色动态生成路由
|
// TODO 这里可以增加获取用户路由的方法 根据用户的角色动态生成路由
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@ -83,6 +88,19 @@ export const useUserStore = defineStore(
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号密码登录
|
||||||
|
*/
|
||||||
|
const mobileLogin = async (account: string, terminal: number, scene: number) => {
|
||||||
|
const res = await _mobileLogin({ account, terminal, scene})
|
||||||
|
console.log("🚀 ~ mobileLogin ~ res:", res)
|
||||||
|
uni.setStorageSync('token', res.token)
|
||||||
|
|
||||||
|
await getUserInfo()
|
||||||
|
isLoggedIn.value = true
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录 并 删除用户信息
|
* 退出登录 并 删除用户信息
|
||||||
*/
|
*/
|
||||||
@ -99,8 +117,12 @@ export const useUserStore = defineStore(
|
|||||||
console.log('微信登录code', data)
|
console.log('微信登录code', data)
|
||||||
|
|
||||||
const res = await _wxLogin(data)
|
const res = await _wxLogin(data)
|
||||||
await getUserInfo()
|
uni.setStorageSync('token', res.token)
|
||||||
return res
|
|
||||||
|
const user = await getUserInfo()
|
||||||
|
|
||||||
|
isLoggedIn.value = true
|
||||||
|
return res && user
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -111,7 +133,9 @@ export const useUserStore = defineStore(
|
|||||||
setUserAvatar,
|
setUserAvatar,
|
||||||
logout,
|
logout,
|
||||||
setUserInfo,
|
setUserInfo,
|
||||||
removeUserInfo
|
removeUserInfo,
|
||||||
|
isLoggedIn,
|
||||||
|
mobileLogin
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -165,4 +165,58 @@ export const OrderStatusTitle: Record<OrderSource, Record<OrderStatus, string>>
|
|||||||
[OrderStatus.AfterSaleApply]: '申请售后',
|
[OrderStatus.AfterSaleApply]: '申请售后',
|
||||||
[OrderStatus.AfterSaleProcessing]: '申请售后中'
|
[OrderStatus.AfterSaleProcessing]: '申请售后中'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 茶艺师订单状态数字(根据UI图还缺已退款、待接单、售后中、售后完成)
|
||||||
|
export enum TeaSpecialistOrderStatus {
|
||||||
|
Pending = 0, // 待付款(未支付)
|
||||||
|
Pay = 1, // 预约单、已预约(已支付)
|
||||||
|
Cancelled = 2, // 已取消(订单取消)
|
||||||
|
Confirm = 3, // 待确认(已接单)
|
||||||
|
Serving = 4, // 服务中
|
||||||
|
Finished = 5, // 已完成
|
||||||
|
}
|
||||||
|
|
||||||
|
// 茶艺师订单状态文本
|
||||||
|
export enum TeaSpecialistOrderStatusText {
|
||||||
|
All = 'all', // 待付款
|
||||||
|
Pending = 'pending', // 待付款
|
||||||
|
Pay = 'pay', // 已支付(预约单、已预约)
|
||||||
|
Cancelled = 'cancelled', // 已取消
|
||||||
|
Confirm = 'confirm', // 待确认
|
||||||
|
Serving = 'serving', // 服务中
|
||||||
|
Finished = 'finished', // 已完成
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态内容映射
|
||||||
|
export const TeaSpecialistOrderStatusTextValue: Record<TeaSpecialistOrderStatus, any> = {
|
||||||
|
[TeaSpecialistOrderStatus.Pending]: {
|
||||||
|
title: '等待付款'
|
||||||
|
},
|
||||||
|
[TeaSpecialistOrderStatus.Pay]: {
|
||||||
|
title: '已预约'
|
||||||
|
},
|
||||||
|
[TeaSpecialistOrderStatus.Cancelled]: {
|
||||||
|
title: '订单取消'
|
||||||
|
},
|
||||||
|
[TeaSpecialistOrderStatus.Confirm]: {
|
||||||
|
title: '订单待确认'
|
||||||
|
},
|
||||||
|
[TeaSpecialistOrderStatus.Serving]: {
|
||||||
|
title: '服务中'
|
||||||
|
},
|
||||||
|
[TeaSpecialistOrderStatus.Finished]: {
|
||||||
|
title: '交易完成'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TeaSpecialistOrderStatusValue: Record<TeaSpecialistOrderStatusText, string | number> = {
|
||||||
|
[TeaSpecialistOrderStatusText.All]: '',
|
||||||
|
[TeaSpecialistOrderStatusText.Pending]: 0,
|
||||||
|
[TeaSpecialistOrderStatusText.Pay]: 1,
|
||||||
|
[TeaSpecialistOrderStatusText.Cancelled]: 2,
|
||||||
|
[TeaSpecialistOrderStatusText.Confirm]: 3,
|
||||||
|
[TeaSpecialistOrderStatusText.Serving]: 4,
|
||||||
|
[TeaSpecialistOrderStatusText.Finished]: 5,
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user