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

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

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

@ -2,7 +2,7 @@
* @Author: 王文杰
* @Date: 2024-03-04 14:13:16
* @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
* @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
defineProps<{
list: CategoryItem[]
list: Object[]
}>()
const handleToBooking = (productCode) => {
@ -33,7 +33,7 @@ const handleToBooking = (productCode) => {
>
<view class="left">
<view class="title">{{ item.name }}</view>
<view class="desc">{{ item.desc }}</view>
<view class="desc">{{ item.description }}</view>
</view>
<view class="right">
<image class="icon" :src="item.icon"></image>

@ -31,8 +31,10 @@ const bannerList = reactive<BannerItem[]>([
const categoryList = ref<CategoryItem[]>([])
let siteList = reactive([])
//
const longitude = ref(0)
const latitude = ref(0)
let location = reactive({
longitude: '',
latitude: '',
})
const isLogin = computed(() => {
const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_token')
@ -43,17 +45,25 @@ const isLogin = computed(() => {
const isLoading = ref(false)
//
onLoad(async () => {
isLoading.value = true
await Promise.all([getHomeCategory(), getHomeSite()])
isLoading.value = false
if (isLogin.value) {
getSettingInfo()
}
})
const init = async () => {
isLoading.value = true
await Promise.all([getHomeCategory(), getHomeSite()])
isLoading.value = false
}
const getHomeCategory = async () => {
const params = {}
const res = await getHomeCategoryAPI(params)
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
}
}
@ -62,10 +72,7 @@ const getHomeSite = async () => {
const params = {
pageNo: 1,
pageSize: 10,
location: {
latitude: 31.163973,
longitude: 121.404032,
},
location: location,
}
const res = await getHomeSiteAPI(params)
if (res.code == 200) {
@ -79,10 +86,12 @@ const getLocationInfo = () => {
// isHighAccuracy: true,
// highAccuracyExpireTime: 5000,
success(res) {
console.log(res)
longitude.value = res.longitude
latitude.value = res.latitude
location = {
longitude: res.longitude,
latitude: res.latitude,
}
uni.setStorageSync('location', location)
init()
},
fail(err) {
console.log(err)
@ -151,7 +160,7 @@ const getSettingInfo = () => {
<!-- 自定义轮播图 -->
<XtxSwiper :list="bannerList" />
<!-- 分类面板 -->
<CategoryPanel :list="categoryListDefault" />
<CategoryPanel :list="categoryList" />
<!-- 电话联系> -->
<PhoneContact />
<!-- 附近回收站> -->
@ -214,4 +223,5 @@ page {
}
}
}
</style>
</style>import type { parse } from 'path'

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

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

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

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

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

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

Loading…
Cancel
Save