王文杰 7 months ago
parent d9481c6e4a
commit c1535f07ba

@ -13,15 +13,15 @@
}, },
"pages": [ "pages": [
{ {
"path": "pages/login/login", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/index/index", "path": "pages/login/login",
"style": { "style": {
"navigationStyle": "custom" "navigationBarTitleText": "登录"
} }
}, },
{ {

@ -11,19 +11,23 @@ import SitePanel from './components/SitePanel.vue'
const activeMenuKey = ref(0) const activeMenuKey = ref(0)
const activeWeightKey = ref(0) const activeWeightKey = ref(0)
const locationStorge = uni.getStorageSync('location')
// //
let location = reactive({ let location = reactive({
longitude: 0, longitude: locationStorge.longitude,
latitude: 0, latitude: locationStorge.latitude,
}) })
// //
const isShowTimePop = ref(false) const isShowTimePop = ref(false)
const isShowAddressPop = ref(false) const isShowAddressPop = ref(false)
const isShowSitePop = ref(false) const isShowSitePop = ref(false)
// {} // {}
const recycleAddress = ref('请选择回收地址') const recycleAddress = ref('')
const appointmentTime = ref('请选择回收时间') const appointmentTime = ref('')
const siteObj = ref({}) const siteObj = ref({})
// //
@ -90,15 +94,15 @@ const categoryList = ref([
const weightMenuList = [ const weightMenuList = [
{ {
val: 'I', val: 'I',
name: '10kg以下', name: '10Kg以下',
}, },
{ {
val: 'II', val: 'II',
name: '10-20kg', name: '10Kg-20Kg',
}, },
{ {
val: 'III', val: 'III',
name: '20kg以上', name: '20Kg以上',
}, },
] ]
@ -108,44 +112,7 @@ const handleMenuChange = (val) => {
const handleWeightChange = (val) => { const handleWeightChange = (val) => {
activeWeightKey.value = val activeWeightKey.value = val
} }
// -
const getLocationInfo = () => {
uni.getLocation({
type: 'gcj02',
// isHighAccuracy: true,
// highAccuracyExpireTime: 5000,
success(res) {
console.log(res)
const longitude = res.longitude.toFixed(6)
const latitude = res.latitude.toFixed(6)
location = Object.assign(location, {
longitude: longitude,
latitude: latitude,
})
uni.setStorageSync('location', location)
},
fail(err) {
console.log(err)
uni.showModal({
content: '检测到您没打开获取定位功能权限,是否去设置打开?',
confirmText: '确认',
cancelText: '取消',
success: function (res) {
if (res.confirm) {
uni.openSetting({
success() {
getLocationInfo()
},
})
}
},
})
},
})
}
onReady(() => { onReady(() => {
getLocationInfo()
}) })
// //
@ -243,6 +210,13 @@ const handlePointer = () => {
uni.chooseLocation({ uni.chooseLocation({
success: async function (res) { success: async function (res) {
recycleAddress.value = res.address recycleAddress.value = res.address
const longitude = res.longitude.toFixed(6)
const latitude = res.latitude.toFixed(6)
location = Object.assign(location, {
longitude: longitude,
latitude: latitude,
})
uni.setStorageSync('location', location)
console.log(res, '返回地址') console.log(res, '返回地址')
}, },
fail: function (e) { fail: function (e) {
@ -268,11 +242,11 @@ const handlePointer = () => {
<view class="action"> <view class="action">
<view @tap="openPopup('time')" class="item arrow"> <view @tap="openPopup('time')" class="item arrow">
<text class="label">时间</text> <text class="label">时间</text>
<text class="text ellipsis"> {{ appointmentTime }} </text> <text class="text ellipsis"> {{ appointmentTime || '请选择回收时间' }} </text>
</view> </view>
<view @tap="handlePointer()" class="item arrow"> <view @tap="handlePointer()" class="item arrow">
<text class="label">地址</text> <text class="label">地址</text>
<text class="text ellipsis"> {{ recycleAddress }} </text> <text class="text ellipsis"> {{ recycleAddress || '请选择回收地址' }} </text>
</view> </view>
<!-- <view @tap="openPopup('site')" class="item arrow"> <!-- <view @tap="openPopup('site')" class="item arrow">
<text class="label">地址</text> <text class="label">地址</text>

@ -94,7 +94,19 @@ onReady(async () => {
<view class="text">回收站点</view> <view class="text">回收站点</view>
<view class="close" @click="handleClose">X</view> <view class="close" @click="handleClose">X</view>
</view> </view>
<view class="content"> <!-- <view class="content">
</view> -->
<!-- 地址列表 -->
<scroll-view
enable-back-to-top
scroll-y
class="scroll-view"
:refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh"
@scrolltolower="getDataList"
>
<view <view
class="item" class="item"
v-for="(item, index) in dataList" v-for="(item, index) in dataList"
@ -107,20 +119,8 @@ onReady(async () => {
<view class="address">{{ item.address }}</view> <view class="address">{{ item.address }}</view>
<text :class="[activeIndex == index ? 'icon-checked' : 'icon-ring', 'icon']"></text> <text :class="[activeIndex == index ? 'icon-checked' : 'icon-ring', 'icon']"></text>
</view> </view>
</view> <!-- <siteItem class="item" :site-val="item" :data-val="item" v-for="item in dataList" :key="item.id" /> -->
</scroll-view>
<!-- 地址列表 -->
<!-- <scroll-view
enable-back-to-top
scroll-y
class="scroll-view"
:refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh"
@scrolltolower="getDataList"
@click="handleSelected"
>
<siteItem class="item" :site-val="item" :data-val="item" v-for="item in dataList" :key="item.id" />
</scroll-view> -->
</view> </view>
</view> </view>
</template> </template>
@ -151,17 +151,17 @@ page {
text-align: center; text-align: center;
} }
} }
.content { .scroll-view {
min-height: 300rpx; min-height: 300rpx;
max-height: 540rpx; max-height: 540rpx;
overflow: auto; overflow: auto;
padding: 20rpx; padding: 20rpx 10rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.item { .item {
padding: 30rpx 50rpx 30rpx 60rpx; padding: 30rpx 50rpx 30rpx 60rpx;
position: relative; position: relative;
box-shadow: 0px -2px 8px 0px rgba(133, 155, 180, 0.4); box-shadow: 0px -2px 8px 0px rgba(133, 155, 180, 0.4);
margin: 10rpx 0; margin: 10rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
.location { .location {

@ -120,7 +120,7 @@ const selectLDate = (val) => {
t[3].disabled = true t[3].disabled = true
t[4].disabled = true t[4].disabled = true
timeList = t timeList = t
} else if (nowH <= 21) { } else if (nowH <= 21 || nowH > 21) {
t[0].disabled = true t[0].disabled = true
t[1].disabled = true t[1].disabled = true
t[2].disabled = true t[2].disabled = true

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { BannerItem, CategoryItem } from '@/types/home' import type { BannerItem, CategoryItem } from '@/types/home'
import { onShow, onReady } from '@dcloudio/uni-app' import { onShow, onLoad, onReady } from '@dcloudio/uni-app'
import { computed, ref, reactive } from 'vue' import { computed, ref, reactive } from 'vue'
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
import CustomNavbar from './components/CustomNavbar.vue' import CustomNavbar from './components/CustomNavbar.vue'
@ -44,10 +44,12 @@ const isLogin = computed(() => {
// //
const isLoading = ref(false) const isLoading = ref(false)
// //
onReady(async () => { onShow(async () => {
// getHomeCategory() // getHomeCategory()
if (isLogin.value) { if (isLogin.value) {
getSettingInfo() getSettingInfo()
} else {
uni.navigateTo({ url: '/pages/login/login' })
} }
}) })
const init = async () => { const init = async () => {
@ -95,7 +97,9 @@ const getLocationInfo = () => {
latitude: latitude, latitude: latitude,
}) })
uni.setStorageSync('location', location) uni.setStorageSync('location', location)
if (!categoryList.value.length) {
init() init()
}
}, },
fail(err) { fail(err) {
console.log(err) console.log(err)
@ -227,5 +231,4 @@ page {
} }
} }
} }
</style>import type { parse } from 'path' </style>
, onReady, onShow

@ -15,7 +15,7 @@
// margin: 20rpx 0 0; // margin: 20rpx 0 0;
padding: 10rpx 0; padding: 10rpx 0;
display: flex; display: flex;
justify-content: center; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
min-height: 328rpx; min-height: 328rpx;
.category-item { .category-item {
@ -24,7 +24,7 @@
margin: 8rpx; margin: 8rpx;
padding: 16rpx 0; padding: 16rpx 0;
display: flex; display: flex;
justify-content: center; // flex-direction: row; justify-content: space-between; // flex-direction: row;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
.left { .left {

@ -0,0 +1,49 @@
@charset "UTF-8";
/* 前台类目 */
.category {
padding: 32rpx 20rpx;
margin: 16rpx;
background-color: #fff;
border-radius: 4rpx;
}
.category .module-title {
font-size: 30rpx;
color: #0D0D26;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #F2F2F2;
}
.category .category-items {
padding: 10rpx 0;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
min-height: 328rpx;
}
.category .category-items .category-item {
width: 45%;
border-radius: 16rpx;
margin: 8rpx;
padding: 16rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
}
.category .category-items .category-item .left .title {
font-size: 26rpx;
color: #666;
}
.category .category-items .category-item .left .desc {
font-size: 24rpx;
color: #7BAFBD;
}
.category .category-items .category-item .right .icon {
width: 100rpx;
height: 100rpx;
}

@ -178,13 +178,11 @@ const onRefresherrefresh = async () => {
<view class="statusLabel">{{ item.orderStatus.desc }}</view> <view class="statusLabel">{{ item.orderStatus.desc }}</view>
</view> </view>
<view class="md" @click="handleDetail(item.id)"> <view class="md" @click="handleDetail(item.id)">
<!-- <view class="orderDetails" v-for="detail in item.orderDetails" :key="detail.id">
<view class="productName">{{ detail.productName }}</view>
<view class="productName">{{ detail.productWeight.desc }}</view>
</view> -->
<view class="orderDetails"> <view class="orderDetails">
<view class="productName">{{ item.orderDetails[0].productName }}</view> <view class="detail-item" v-for="item2 in item.orderDetails" :key="item2.id">
<!-- <view class="productName">{{ item.orderDetails[0].productWeight.desc }}</view> --> <view class="productName">{{ item2.product.name }}</view>
<view class="productName">{{ item2.productWeight.desc }}</view>
</view>
</view> </view>
</view> </view>
<view class="foot"> <view class="foot">
@ -223,6 +221,14 @@ const onRefresherrefresh = async () => {
font-size: 28rpx; font-size: 28rpx;
border-top: 2rpx solid #F2F2F2; border-top: 2rpx solid #F2F2F2;
border-bottom: 2rpx solid #F2F2F2; border-bottom: 2rpx solid #F2F2F2;
.orderDetails {
.detail-item {
margin: 20rpx 0;
.productName {
margin: 10rpx 0;
}
}
}
} }
.foot { .foot {
padding: 10rpx; padding: 10rpx;

@ -21,6 +21,14 @@ const orderTabs = ref([
const activeIndex = ref(orderTabs.value.findIndex((v) => v.orderState === 'PENDING')) const activeIndex = ref(orderTabs.value.findIndex((v) => v.orderState === 'PENDING'))
// //
orderTabs.value[activeIndex.value].isRender = true orderTabs.value[activeIndex.value].isRender = true
const handleIndexChange = (index: any) => {
orderTabs.value.forEach((e) => {
e.isRender = false
})
activeIndex.value = index
orderTabs.value[index].isRender = true
}
</script> </script>
<template> <template>
@ -31,12 +39,7 @@ orderTabs.value[activeIndex.value].isRender = true
class="item" class="item"
v-for="(item, index) in orderTabs" v-for="(item, index) in orderTabs"
:key="item.title" :key="item.title"
@tap=" @tap="handleIndexChange(index)"
() => {
activeIndex = index
item.isRender = true
}
"
> >
{{ item.title }} {{ item.title }}
</text> </text>
@ -44,7 +47,11 @@ orderTabs.value[activeIndex.value].isRender = true
<view class="cursor" :style="{ left: activeIndex * 20 + '%' }"></view> <view class="cursor" :style="{ left: activeIndex * 20 + '%' }"></view>
</view> </view>
<!-- 滑动容器 --> <!-- 滑动容器 -->
<swiper class="swiper" :current="activeIndex" @change="activeIndex = $event.detail.current"> <swiper
class="swiper"
:current="activeIndex"
@change="handleIndexChange($event.detail.current)"
>
<!-- 滑动项 --> <!-- 滑动项 -->
<swiper-item v-for="item in orderTabs" :key="item.title"> <swiper-item v-for="item in orderTabs" :key="item.title">
<!-- 订单列表 --> <!-- 订单列表 -->

@ -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