master
王文杰 7 months ago
parent abbddcc8e1
commit 22b6b75ab0

@ -12,8 +12,10 @@ const activeMenuKey = ref(0)
const activeWeightKey = ref(0) const activeWeightKey = ref(0)
// //
const longitude = ref(121.404032) let location = reactive({
const latitude = ref(31.163973) longitude: '',
latitude: '',
})
// //
const isShowTimePop = ref(false) const isShowTimePop = ref(false)
const isShowAddressPop = ref(false) const isShowAddressPop = ref(false)
@ -114,35 +116,15 @@ const getLocationInfo = () => {
// highAccuracyExpireTime: 5000, // highAccuracyExpireTime: 5000,
success(res) { success(res) {
console.log(res) console.log(res)
longitude.value = res.longitude location = Object.assign(location, {
latitude.value = res.latitude longitude: res.longitude,
}, latitude: res.latitude,
fail(err) {
console.log(err)
uni.showModal({
content: '检测到您没打开获取定位功能权限,是否去设置打开?',
confirmText: '确认',
cancelText: '取消',
success: function (res) {
if (res.confirm) {
uni.openSetting({
success() {
getLocationInfo()
},
}) })
} uni.setStorageSync('location', location)
},
})
},
})
}
const getAuthorizeInfo = () => {
uni.authorize({
scope: 'scope.userLocation',
success(res) {
getLocationInfo()
}, },
fail(err) { fail(err) {
console.log(err)
uni.showModal({ uni.showModal({
content: '检测到您没打开获取定位功能权限,是否去设置打开?', content: '检测到您没打开获取定位功能权限,是否去设置打开?',
confirmText: '确认', confirmText: '确认',
@ -160,20 +142,8 @@ const getAuthorizeInfo = () => {
}, },
}) })
} }
// -
const getSettingInfo = () => {
uni.getSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
getLocationInfo()
} else {
getAuthorizeInfo()
}
},
})
}
onReady(() => { onReady(() => {
getSettingInfo() getLocationInfo()
}) })
// //
@ -191,10 +161,8 @@ const handleBooking = async () => {
appointmentTimeStart, appointmentTimeStart,
appointmentTimeEnd, appointmentTimeEnd,
location: { location: {
// longitude: longitude.value, longitude: longitude.value,
// latitude: latitude.value, latitude: latitude.value,
latitude: '31.163973',
longitude: '121.444032',
}, },
orderDetails: orderDetailsFilter, orderDetails: orderDetailsFilter,
recycleAddress: recycleAddress.value, recycleAddress: recycleAddress.value,
@ -271,7 +239,13 @@ const bindPickerChange = (e, item) => {
<template> <template>
<view class="booking"> <view class="booking">
<view class="module section-map"> <view class="module section-map">
<map id="map" class="map" show-location :latitude="latitude" :longitude="longitude"></map> <map
id="map"
class="map"
show-location
:latitude="location.latitude"
:longitude="location.longitude"
></map>
</view> </view>
<view class="module info"> <view class="module info">
<view class="module-title">取件信息</view> <view class="module-title">取件信息</view>

@ -6,16 +6,14 @@ import SiteItem from './siteItem.vue'
const siteSelected = ref(null) const siteSelected = ref(null)
const activeIndex = ref(0) const activeIndex = ref(0)
//
const location = uni.getStorageSync('location')
const sitePopup = ref<UniHelper.UniPopupInstance>() const sitePopup = ref<UniHelper.UniPopupInstance>()
// //
const queryParams: Required<siteParams> = { const queryParams: Required<siteParams> = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
location: { location: location,
latitude: 31.163973,
longitude: 121.404032,
},
productCode: '', productCode: '',
} }

@ -2,7 +2,7 @@
* @Author: 王文杰 * @Author: 王文杰
* @Date: 2024-03-04 14:13:16 * @Date: 2024-03-04 14:13:16
* @LastEditors: 王文杰 * @LastEditors: 王文杰
* @LastEditTime: 2024-03-09 13:32:33 * @LastEditTime: 2024-03-11 21:29:35
* @FilePath: /app-nx-personal/src/pages/index/components/CategoryPanel.vue * @FilePath: /app-nx-personal/src/pages/index/components/CategoryPanel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@ -11,7 +11,7 @@ import type { CategoryItem } from '@/types/home'
// props // props
defineProps<{ defineProps<{
list: CategoryItem[] list: Object[]
}>() }>()
const handleToBooking = (productCode) => { const handleToBooking = (productCode) => {
@ -33,7 +33,7 @@ const handleToBooking = (productCode) => {
> >
<view class="left"> <view class="left">
<view class="title">{{ item.name }}</view> <view class="title">{{ item.name }}</view>
<view class="desc">{{ item.desc }}</view> <view class="desc">{{ item.description }}</view>
</view> </view>
<view class="right"> <view class="right">
<image class="icon" :src="item.icon"></image> <image class="icon" :src="item.icon"></image>

@ -31,8 +31,10 @@ const bannerList = reactive<BannerItem[]>([
const categoryList = ref<CategoryItem[]>([]) const categoryList = ref<CategoryItem[]>([])
let siteList = reactive([]) let siteList = reactive([])
// //
const longitude = ref(0) let location = reactive({
const latitude = ref(0) longitude: '',
latitude: '',
})
const isLogin = computed(() => { const isLogin = computed(() => {
const token = memberStore.profile?.token const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_token') const storage_token = uni.getStorageSync('storage_token')
@ -43,17 +45,25 @@ const isLogin = computed(() => {
const isLoading = ref(false) const isLoading = ref(false)
// //
onLoad(async () => { onLoad(async () => {
isLoading.value = true
await Promise.all([getHomeCategory(), getHomeSite()])
isLoading.value = false
if (isLogin.value) { if (isLogin.value) {
getSettingInfo() getSettingInfo()
} }
}) })
const init = async () => {
isLoading.value = true
await Promise.all([getHomeCategory(), getHomeSite()])
isLoading.value = false
}
const getHomeCategory = async () => { const getHomeCategory = async () => {
const params = {} const params = {}
const res = await getHomeCategoryAPI(params) const res = await getHomeCategoryAPI(params)
if (res.code == 200) { if (res.code == 200) {
res.data.forEach((e) => {
const arr = JSON.parse(e.photo)
const icon = 'http://222.71.165.188:8808' + arr[0].url
e.icon = 'http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-05-06/4b02f01f-a365-4b6c-9f7a-8b0f591dda02.png?quality=95&imageView'
})
categoryList.value = res.data categoryList.value = res.data
} }
} }
@ -62,10 +72,7 @@ const getHomeSite = async () => {
const params = { const params = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
location: { location: location,
latitude: 31.163973,
longitude: 121.404032,
},
} }
const res = await getHomeSiteAPI(params) const res = await getHomeSiteAPI(params)
if (res.code == 200) { if (res.code == 200) {
@ -79,10 +86,12 @@ const getLocationInfo = () => {
// isHighAccuracy: true, // isHighAccuracy: true,
// highAccuracyExpireTime: 5000, // highAccuracyExpireTime: 5000,
success(res) { success(res) {
console.log(res) location = {
longitude.value = res.longitude longitude: res.longitude,
latitude.value = res.latitude latitude: res.latitude,
}
uni.setStorageSync('location', location)
init()
}, },
fail(err) { fail(err) {
console.log(err) console.log(err)
@ -151,7 +160,7 @@ const getSettingInfo = () => {
<!-- 自定义轮播图 --> <!-- 自定义轮播图 -->
<XtxSwiper :list="bannerList" /> <XtxSwiper :list="bannerList" />
<!-- 分类面板 --> <!-- 分类面板 -->
<CategoryPanel :list="categoryListDefault" /> <CategoryPanel :list="categoryList" />
<!-- 电话联系> --> <!-- 电话联系> -->
<PhoneContact /> <PhoneContact />
<!-- 附近回收站> --> <!-- 附近回收站> -->
@ -214,4 +223,5 @@ page {
} }
} }
} }
</style> </style>import type { parse } from 'path'

@ -47,7 +47,9 @@ const handleMoney = () => {
} }
onLoad(() => { onLoad(() => {
if (isLogin.value) {
getMemberProfileData() getMemberProfileData()
}
}) })
const getMemberProfileData = async () => { const getMemberProfileData = async () => {

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { OrderState, orderStateList } from '@/services/constants' import { OrderState, orderStateList } from '@/services/constants'
import { getOrderByIdAPI } from '@/services/order' import { getOrderByIdAPI, cancleOrderAPI } from '@/services/order'
import type { LogisticItem, OrderResult } from '@/types/order' import type { LogisticItem, OrderResult } from '@/types/order'
import { onLoad, onReady } from '@dcloudio/uni-app' import { onLoad, onReady } from '@dcloudio/uni-app'
import { ref, getCurrentInstance, unref } from 'vue' import { ref, getCurrentInstance, unref } from 'vue'
@ -10,22 +10,23 @@ import QQMapWX from '@/libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.min.js'
// //
const { safeAreaInsets } = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
//
const location = uni.getStorageSync('location')
const orderStatus = ref('') const orderStatus = ref('')
//
// //
onLoad((options) => { onLoad((options) => {
getMemberOrderByIdData(options.orderId) getMemberOrderByIdData(options.orderId)
}) })
const isLoading = ref(false)
// //
const order = ref<OrderResult>() const order = ref<OrderResult>()
const getMemberOrderByIdData = async (orderId) => { const getMemberOrderByIdData = async (orderId) => {
const params = { const params = {
orderId: orderId, orderId: orderId,
latitude: 31.163973, latitude: location.latitude,
longitude: 121.404032, longitude: location.longitude,
} }
isLoading.value = true
const res = await getOrderByIdAPI(params) const res = await getOrderByIdAPI(params)
if (res.code == 200) { if (res.code == 200) {
const data = res.data const data = res.data
@ -34,6 +35,7 @@ const getMemberOrderByIdData = async (orderId) => {
const end = data.appointmentTimeEnd.slice(11, 16) const end = data.appointmentTimeEnd.slice(11, 16)
data.appointmentTime = str + ' ' + start + '-' + end data.appointmentTime = str + ' ' + start + '-' + end
order.value = data order.value = data
isLoading.value = false
} }
} }
// //
@ -44,27 +46,25 @@ const handleCancleOrder = () => {
confirmColor: '#3775F6', confirmColor: '#3775F6',
success: async (success) => { success: async (success) => {
if (success.confirm) { if (success.confirm) {
// const res = await putMemberOrderReceiptByIdAPI(query.id) const res = await cancleOrderAPI({ id: order.value.id })
// if (res.code == 200) {
// order.value = res.result uni.navigateBack()
}
} }
}, },
}) })
} }
const handleAcceptConfirm = () => {
uni.navigateTo({ url: '/payment/detail/detail' })
}
</script> </script>
<template> <template>
<view class="viewport"> <view class="viewport">
<template v-if="1"> <template v-if="!isLoading">
<view class="order-detail"> <view class="order-detail">
<view class="status"> <view class="status">
<template v-if="order.orderStatus.code == '520192817293693253'">
<view class="title">{{ order.orderStatus.desc }}</view> <view class="title">{{ order.orderStatus.desc }}</view>
<template v-if="order.orderStatus.code == '520192817293693253'">
<view class="desc">预约时间{{ order.appointmentTime }}</view> <view class="desc">预约时间{{ order.appointmentTime }}</view>
<view class="action"> <view class="action">
<view class="button" @click="handleCancleOrder"></view> <view class="button cancle" @click="handleCancleOrder"></view>
</view> </view>
</template> </template>
</view> </view>
@ -130,13 +130,17 @@ page {
display: flex; display: flex;
justify-content: center; justify-content: center;
.button { .button {
padding: 14rpx 40rpx; padding: 10rpx 30rpx;
text-align: center; text-align: center;
border: 2rpx solid #D5D6DB; border: 2rpx solid #D5D6DB;
font-size: 30rpx; font-size: 28rpx;
font-weight: normal; font-weight: normal;
color: #0D0D26; color: #0D0D26;
border-radius: 30rpx; border-radius: 30rpx;
&.cancle {
border: 2rpx solid #E30000;
color: #E30000;
}
} }
} }
} }

@ -2,8 +2,7 @@
import { OrderState } from '@/services/constants' import { OrderState } from '@/services/constants'
import { orderStateList } from '@/services/constants' import { orderStateList } from '@/services/constants'
import { putMemberOrderReceiptByIdAPI } from '@/services/order' import { putMemberOrderReceiptByIdAPI } from '@/services/order'
import { cancleOrderAPI } from '@/services/order' import { getMemberOrderAPI, cancleOrderAPI } from '@/services/order'
import { getMemberOrderAPI } from '@/services/order'
import { getPayMockAPI, getPayWxPayMiniPayAPI } from '@/services/pay' import { getPayMockAPI, getPayWxPayMiniPayAPI } from '@/services/pay'
import type { OrderItem } from '@/types/order' import type { OrderItem } from '@/types/order'
import type { OrderListParams } from '@/types/order' import type { OrderListParams } from '@/types/order'
@ -28,16 +27,14 @@ const props = defineProps<{
// const res = orderTabs[props.orderState] // const res = orderTabs[props.orderState]
// return res // return res
// }) // })
//
const location = uni.getStorageSync('location')
// //
const queryParams: Required<OrderListParams> = { const queryParams: Required<OrderListParams> = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
status: props.orderState, status: props.orderState,
location: { location: location,
latitude: 31.163973,
longitude: 121.404032,
},
} }
// //
@ -174,7 +171,6 @@ const onRefresherrefresh = async () => {
:refresher-triggered="isTriggered" :refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh" @refresherrefresh="onRefresherrefresh"
@scrolltolower="getMemberOrderData" @scrolltolower="getMemberOrderData"
> >
<view class="item" v-for="item in orderList" :key="item.id"> <view class="item" v-for="item in orderList" :key="item.id">
<view class="hd" @click="handleDetail(item.id)"> <view class="hd" @click="handleDetail(item.id)">
@ -207,8 +203,8 @@ const onRefresherrefresh = async () => {
// //
.orders { .orders {
.item { .item {
padding: 20rpx; padding: 20rpx 0;
margin: 20rpx 20rpx 0; margin: 20rpx 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
background-color: #fff; background-color: #fff;
.hd { .hd {
@ -217,7 +213,7 @@ const onRefresherrefresh = async () => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.statusLabel { .statusLabel {
font-size: 28rpx; font-size: 24rpx;
color: #FF7D00; color: #FF7D00;
} }
} }

@ -4,22 +4,21 @@ import { postListSiteAPI } from '@/services/site'
import SiteItem from './components/siteItem.vue' import SiteItem from './components/siteItem.vue'
type location = { type location = {
latitude: Number, latitude: String
longitude: Number, longitude: String
} }
type siteParams = { type siteParams = {
location: location location: location
pageNo: Number pageNo: Number
pageSize: Number pageSize: Number
} }
//
const locationStorge = uni.getStorageSync('location')
// //
const queryParams: Required<siteParams> = { const queryParams: Required<siteParams> = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
location: { location: locationStorge,
latitude: 31.163973,
longitude: 121.404032,
}
} }
// //
const dataList = ref<any[]>([]) const dataList = ref<any[]>([])

@ -17,16 +17,14 @@ const memberStore = useMemberStore()
const props = defineProps<{ const props = defineProps<{
orderState: string orderState: string
}>() }>()
//
const location = uni.getStorageSync('location')
// //
const queryParams: Required<OrderListParams> = { const queryParams: Required<OrderListParams> = {
pageNo: 1, pageNo: 1,
pageSize: 5, pageSize: 5,
status: props.orderState, status: props.orderState,
location: { location: location,
latitude: 31.163973,
longitude: 121.404032
},
id: memberStore.profile?.id, id: memberStore.profile?.id,
} }

@ -11,8 +11,8 @@
* 4. token * 4. token
*/ */
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
const baseURL = 'http://192.168.0.166:8808/api' // const baseURL = 'http://192.168.0.166:8808/api'
// const baseURL = 'http://222.71.165.188:8808/api' const baseURL = 'http://222.71.165.188:8808/api'
// 添加拦截器 // 添加拦截器
const httpInterceptor = { const httpInterceptor = {
// 拦截前触发 // 拦截前触发

Loading…
Cancel
Save