master
王文杰 7 months ago
parent a10530173a
commit 9830ab7fe4

@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, toRaw, reactive } from 'vue' import { computed, ref, toRaw, reactive } from 'vue'
import { onShow, onLoad } from '@dcloudio/uni-app' import { onShow, onLoad } from '@dcloudio/uni-app'
import AddressPopup from './components/addressPopup.vue' // import AddressPopup from './components/addressPopup.vue'
import SitePopup from './components/sitePopup.vue' // import SitePopup from './components/sitePopup.vue'
import { postBookingAPI } from '@/services/booking' import { postBookingAPI } from '@/services/booking'
import { getNearbySiteAPI } from '@/services/home' import { getNearbySiteAPI } from '@/services/home'
import { getMemberAddressAPI } from '@/services/address' import { getMemberAddressAPI } from '@/services/address'
@ -12,17 +12,15 @@ import TimePanel from './components/TimePanel.vue'
import SitePanel from './components/SitePanel.vue' import SitePanel from './components/SitePanel.vue'
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
import { useCategoryStore } from '@/stores/modules/category' import { useCategoryStore } from '@/stores/modules/category'
const categoryStore = useCategoryStore() const categoryStore = useCategoryStore()
const locationStorge = uni.getStorageSync('location')
const storage_staffId = uni.getStorageSync('storage_userInfo').id
// id // id
const memberStore = useMemberStore() const memberStore = useMemberStore()
const staffId = memberStore.profile?.id || storage_staffId let staffId = memberStore.profile?.id
// //
let location = reactive({ let location = reactive({
longitude: locationStorge.longitude, longitude: '',
latitude: locationStorge.latitude, latitude: '',
}) })
// //
@ -47,17 +45,21 @@ const isBooking = computed(() => {
const categorySelecteds = categoryList.filter((e) => e.selected) const categorySelecteds = categoryList.filter((e) => e.selected)
return appointmentTime.value && recycleAddress.value && categorySelecteds.length return appointmentTime.value && recycleAddress.value && categorySelecteds.length
}) })
onShow(() => { onLoad(() => {
const categoryListStore = categoryStore.categoryVal
categoryList = Object.assign([], categoryListStore)
})
onShow(async () => {
// //
const categoryListStore = categoryStore.selectedCategoryVal || []
const productCode = uni.getStorageSync('productCode') const productCode = uni.getStorageSync('productCode')
categoryListStore.forEach((e) => { categoryList.forEach((e) => {
e.selected = e.code == productCode e.selected = e.code == productCode
e.disabled = false // e.disabled = false
}) })
categoryList = Object.assign(categoryList, categoryListStore) categoryList = Object.assign([], categoryList)
}) if (!staffId) {
onLoad(async () => { staffId = uni.getStorageSync('storage_userInfo').id
}
// //
await getMemberAddressData() await getMemberAddressData()
// //
@ -69,14 +71,13 @@ onLoad(async () => {
* @return {[type]} [return description] * @return {[type]} [return description]
*/ */
const getNearbySite = async () => { const getNearbySite = async () => {
// const productCode = uni.getStorageSync('productCode')
const params = { const params = {
...location, ...location,
} }
console.log('getNearbySiteAPI-params', params) console.log('getNearbySiteAPI-params', params)
const res = await getNearbySiteAPI(params) const res = await getNearbySiteAPI(params)
const obj = res.data const obj = res.data
console.log('getNearbySiteAPI', res.data.stationProducts) console.log('getNearbySiteAPI', res.data)
if (obj) { if (obj) {
if (obj.stationProducts && obj.stationProducts.length) { if (obj.stationProducts && obj.stationProducts.length) {
categoryList.forEach((e) => { categoryList.forEach((e) => {
@ -91,33 +92,41 @@ const getNearbySite = async () => {
} }
}) })
recycleStationId.value = obj.id recycleStationId.value = obj.id
console.log('categoryList', categoryList) categoryList = Object.assign([], categoryList)
// categoryStore.changeCategory(categoryList)
// console.log('categoryList', categoryList)
} else { } else {
uni.showToast({ icon: 'none', title: '当前位置的回收站点没有配置回收品类...' }) categoryList.forEach((e) => {
e.disabled = true
e.selected = false
})
categoryList = Object.assign([], categoryList)
uni.showToast({ icon: 'none', duration: 3000, title: '下单地址附近的回收站没有配置回收品类...' })
} }
} else { } else {
categoryList.forEach((e) => { categoryList.forEach((e) => {
e.disabled = true e.disabled = true
e.selected = false e.selected = false
}) })
uni.showToast({ icon: 'none', title: '当前位置附近没有回收站点...' }) categoryList = Object.assign([], categoryList)
uni.showToast({ icon: 'none', duration: 3000, title: '下单地址附近没有回收站...' })
} }
} }
// //
const getMemberAddressData = async () => { const getMemberAddressData = async () => {
console.log(staffId)
const params = { const params = {
clientId: staffId, clientId: staffId,
} }
const res = await getMemberAddressAPI(params) const res = await getMemberAddressAPI(params)
const index = res.data.findIndex((e) => e.isDefault) const index = res.data.findIndex((e) => e.isDefault)
const defaultAddress = res.data[index] const defaultAddress = res.data[index]
recycleAddress.value = defaultAddress.receiveStreet recycleAddress.value = defaultAddress?.receiveStreet
clientAddressId.value = defaultAddress.id clientAddressId.value = defaultAddress.id
location = Object.assign(location, { location = Object.assign(location, {
longitude: defaultAddress.location.longitude, longitude: defaultAddress.location.longitude,
latitude: defaultAddress.location.latitude, latitude: defaultAddress.location.latitude,
}) })
uni.setStorageSync('location', location)
addressList = Object.assign(addressList, res.data) addressList = Object.assign(addressList, res.data)
} }
// //
@ -209,7 +218,6 @@ const handlePopClose = (item) => {
longitude: item.location.longitude, longitude: item.location.longitude,
latitude: item.location.latitude, latitude: item.location.latitude,
}) })
uni.setStorageSync('location', location)
// //
getNearbySite() getNearbySite()
} }

@ -10,8 +10,7 @@ const emit = defineEmits<{
// id // id
const memberStore = useMemberStore() const memberStore = useMemberStore()
const storage_staffId = uni.getStorageSync('storage_userInfo').id const staffId = memberStore.profile?.id
const staffId = memberStore.profile?.id || storage_staffId
// //
const addressList = ref<any[]>([]) const addressList = ref<any[]>([])
@ -59,15 +58,8 @@ onShow(async () => {
<!-- 内容 --> <!-- 内容 -->
<view class="content"> <view class="content">
<template v-if="addressList.length"> <template v-if="addressList.length">
<view <view class="item" v-for="(item, index) in addressList" :key="item.id" :data-val="index" @click="handleChange">
class="item" <view class="user">{{ item.receiveUserName }}
v-for="(item, index) in addressList"
:key="item.id"
:data-val="index"
@click="handleChange"
>
<view class="user"
>{{ item.receiveUserName }}
<text class="contact">{{ item.receiveMobilePhone }}</text> <text class="contact">{{ item.receiveMobilePhone }}</text>
<text v-if="item.isDefault" class="badge"></text> <text v-if="item.isDefault" class="badge"></text>
</view> </view>
@ -116,6 +108,7 @@ onShow(async () => {
max-height: 540rpx; max-height: 540rpx;
overflow: auto; overflow: auto;
padding: 20rpx; padding: 20rpx;
.item { .item {
padding: 30rpx 50rpx 30rpx 60rpx; padding: 30rpx 50rpx 30rpx 60rpx;
background-size: 40rpx; background-size: 40rpx;
@ -124,6 +117,7 @@ onShow(async () => {
background-image: url(/static/images/location.png); background-image: url(/static/images/location.png);
position: relative; position: relative;
} }
.icon { .icon {
color: #999; color: #999;
font-size: 40rpx; font-size: 40rpx;
@ -132,19 +126,24 @@ onShow(async () => {
top: 50%; top: 50%;
right: 0; right: 0;
} }
.icon-checked { .icon-checked {
color: #3775F6; color: #3775F6;
} }
.icon-ring { .icon-ring {
color: #444; color: #444;
} }
.user { .user {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333; color: #333;
.contact { .contact {
color: #666; color: #666;
} }
.badge { .badge {
display: inline-block; display: inline-block;
padding: 4rpx 10rpx 2rpx 14rpx; padding: 4rpx 10rpx 2rpx 14rpx;
@ -155,10 +154,12 @@ onShow(async () => {
border: 1rpx solid #3775F6; border: 1rpx solid #3775F6;
} }
} }
.address { .address {
font-size: 26rpx; font-size: 26rpx;
color: #666; color: #666;
} }
.blank { .blank {
margin-top: 100rpx; margin-top: 100rpx;
text-align: center; text-align: center;
@ -194,4 +195,3 @@ onShow(async () => {
} }
} }
</style> </style>

@ -3,11 +3,13 @@ import { ref, reactive } from 'vue'
import { onReady } from '@dcloudio/uni-app' import { onReady } from '@dcloudio/uni-app'
import { postListSiteAPI } from '@/services/site' import { postListSiteAPI } from '@/services/site'
import SiteItem from './siteItem.vue' import SiteItem from './siteItem.vue'
import { useMemberStore } from '@/stores'
const siteSelected = ref(null) const siteSelected = ref(null)
const activeIndex = ref(0) const activeIndex = ref(0)
// //
const location = uni.getStorageSync('location')
const memberStore = useMemberStore()
const location = memberStore.location
const sitePopup = ref<UniHelper.UniPopupInstance>() const sitePopup = ref<UniHelper.UniPopupInstance>()
// //
const queryParams: Required<siteParams> = { const queryParams: Required<siteParams> = {

@ -5,9 +5,10 @@ import { getHouseInfoAPI } from '@/services/home'
import { postBookingHouseAPI } from '@/services/booking' import { postBookingHouseAPI } from '@/services/booking'
import { serviceDomain, bannerList } from '@/services/constants' import { serviceDomain, bannerList } from '@/services/constants'
import PageSkeleton from './components/PageSkeleton.vue' import PageSkeleton from './components/PageSkeleton.vue'
import { useMemberStore } from '@/stores'
// //
const location = uni.getStorageSync('location') const memberStore = useMemberStore()
const location = memberStore.location
const Info = ref({}) const Info = ref({})
const isLoading = ref(false) const isLoading = ref(false)

@ -1,14 +1,13 @@
<!-- <!--
* @Author: 王文杰 * @Author: 王文杰
* @Date: 2024-03-04 14:13:16 * @Date: 2024-03-04 14:13:16
* @LastEditors: 王文杰 * @LastEditors: 王文杰
* @LastEditTime: 2024-03-22 11:51:04 * @LastEditTime: 2024-03-29 22:49:41
* @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
--> -->
<script setup lang="ts"> <script setup lang="ts">
import type { CategoryItem } from '@/types/home' import type { CategoryItem } from '@/types/home'
import { categoryListDefault } from '@/services/constants'
// props // props
defineProps<{ defineProps<{
list: Object[] list: Object[]

@ -10,7 +10,7 @@ import PhoneContact from './components/PhoneContact.vue'
import NeighborhoodHouse from './components/NeighborhoodHouse.vue' import NeighborhoodHouse from './components/NeighborhoodHouse.vue'
import NeighborhoodSite from './components/NeighborhoodSite.vue' import NeighborhoodSite from './components/NeighborhoodSite.vue'
import { getHomeCategoryAPI, getNearbySiteAPI, getHouseNearbyAPI } from '@/services/home' import { getHomeCategoryAPI, getNearbySiteAPI, getHouseNearbyAPI } from '@/services/home'
import { serviceDomain, bannerList, categoryListDefault } from '@/services/constants' import { serviceDomain, bannerList } from '@/services/constants'
import { useCategoryStore } from '@/stores/modules/category' import { useCategoryStore } from '@/stores/modules/category'
const memberStore = useMemberStore() const memberStore = useMemberStore()
@ -18,8 +18,7 @@ const categoryStore = useCategoryStore()
const isLogin = computed(() => { const isLogin = computed(() => {
const token = memberStore.profile?.token const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_userInfo')?.token return !!token
return !!token || !!storage_token
}) })
// //
@ -34,24 +33,19 @@ let location = reactive({
// //
const isLoading = ref(false) const isLoading = ref(false)
const isUpdate = ref(true) // const isUpdate = ref(true)
// //
onShow(async () => { onShow(async () => {
// getHomeCategory() getHomeCategory()
if (isLogin.value) { if (isLogin.value) {
getSettingInfo() getSettingInfo()
} else {
categoryList.value = categoryListDefault
} }
}) })
const init = async () => { const init = async () => {
isLoading.value = true // isLoading.value = true
await getHomeCategory()
await getHouseNearBy() await getHouseNearBy()
await getHomeSite() await getHomeSite()
isUpdate.value = false // isLoading.value = false
// await Promise.all([getHomeCategory(), getHomeSite()])
isLoading.value = false
} }
// //
const getHomeCategory = async () => { const getHomeCategory = async () => {
@ -62,9 +56,11 @@ const getHomeCategory = async () => {
const obj2 = arr[0] const obj2 = arr[0]
const imgUrl = serviceDomain + obj2?.url const imgUrl = serviceDomain + obj2?.url
e.imgUrl = imgUrl e.imgUrl = imgUrl
e.selected = false
e.disabled = false
}) })
categoryList.value = res.data categoryList.value = res.data
categoryStore.changeSelectedCategory(res.data) categoryStore.changeCategory(res.data)
} }
// //
const getHouseNearBy = async () => { const getHouseNearBy = async () => {
@ -117,10 +113,11 @@ const getLocationInfo = () => {
longitude: longitude, longitude: longitude,
latitude: latitude, latitude: latitude,
}) })
uni.setStorageSync('location', location) memberStore.setLocation(location)
if (isUpdate.value) { // if (isUpdate.value) {
init() // init()
} // }
init()
}, },
fail(err) { fail(err) {
console.log(err) console.log(err)

@ -4,7 +4,7 @@ import { useMemberStore } from '@/stores'
import type { LoginResult } from '@/types/member' import type { LoginResult } from '@/types/member'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue' import { ref } from 'vue'
const memberStore = useMemberStore()
// code // code
let code = '' let code = ''
onLoad(async () => { onLoad(async () => {
@ -33,7 +33,6 @@ const onGetphonenumber: UniHelper.ButtonOnGetphonenumber = async (ev) => {
const loginSuccess = (profile: LoginResult) => { const loginSuccess = (profile: LoginResult) => {
// //
const memberStore = useMemberStore()
memberStore.setProfile(profile) memberStore.setProfile(profile)
// //
uni.showToast({ icon: 'success', title: '登录成功' }) uni.showToast({ icon: 'success', title: '登录成功' })
@ -74,11 +73,7 @@ const onOpenPrivacyContract = () => {
</view> </view>
<view class="login"> <view class="login">
<view class="button-privacy-wrap"> <view class="button-privacy-wrap">
<button <button :hidden="isAgreePrivacy" class="button-opacity button phone" @tap="checkedAgreePrivacy">
:hidden="isAgreePrivacy"
class="button-opacity button phone"
@tap="checkedAgreePrivacy"
>
请先阅读并勾选协议 请先阅读并勾选协议
</button> </button>
<button class="button phone" open-type="getPhoneNumber" @getphonenumber="onGetphonenumber"> <button class="button phone" open-type="getPhoneNumber" @getphonenumber="onGetphonenumber">

@ -11,8 +11,7 @@ const memberStore = useMemberStore()
const isLogin = computed(() => { const isLogin = computed(() => {
const token = memberStore.profile?.token const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_userInfo')?.token return !!token
return !!token || !!storage_token
}) })
const servicesList = reactive([ const servicesList = reactive([
@ -91,7 +90,7 @@ const handleJump = (type) => {
return return
} }
if (type == 'site') { if (type == 'site') {
uni.navigateTo({ url: '/pages/orderSiteList/orderSiteList' }) uni.navigateTo({ url: '/pages/orderSiteList/orderSiteList' })
} }
} }
</script> </script>
@ -119,11 +118,9 @@ const handleJump = (type) => {
<!-- 情况2未登录 --> <!-- 情况2未登录 -->
<view class="overview" v-else> <view class="overview" v-else>
<navigator url="/pages/login/login" hover-class="none"> <navigator url="/pages/login/login" hover-class="none">
<image <image class="avatar gray" mode="aspectFill"
class="avatar gray" src="https://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-06/db628d42-88a7-46e7-abb8-659448c33081.png">
mode="aspectFill" </image>
src="https://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-06/db628d42-88a7-46e7-abb8-659448c33081.png"
></image>
</navigator> </navigator>
<view class="meta"> <view class="meta">
<navigator url="/pages/login/login" hover-class="none" class="nickname"> <navigator url="/pages/login/login" hover-class="none" class="nickname">
@ -164,7 +161,7 @@ const handleJump = (type) => {
</view> </view>
</view> </view>
</view> --> </view> -->
<view class="module"> <!-- <view class="module">
<view class="module-title">订单中心</view> <view class="module-title">订单中心</view>
<view class="module-list"> <view class="module-list">
<view class="item" @click="handleJump('book')"> <view class="item" @click="handleJump('book')">
@ -180,7 +177,7 @@ const handleJump = (type) => {
<view class="label">到站回收</view> <view class="label">到站回收</view>
</view> </view>
</view> </view>
</view> </view> -->
<view class="list"> <view class="list">
<!-- <navigator class="loation item arrow" url="/pages/orderList/orderList" hover-class="none"> <!-- <navigator class="loation item arrow" url="/pages/orderList/orderList" hover-class="none">
@ -196,13 +193,10 @@ const handleJump = (type) => {
<view class="label"> 联系我们 </view> <view class="label"> 联系我们 </view>
</button> </button>
<navigator class="loation item arrow" url="/pagesMember/address/address" hover-class="none"> <navigator class="loation item arrow" url="/pagesMember/address/address" hover-class="none">
<uni-icons type="location" color="#3775F6" size="20"></uni-icons> <uni-icons type="location" color="#3775F6" size="20"></uni-icons>
<view class="label"> 地址 </view> <view class="label"> 地址 </view>
</navigator> </navigator>
<navigator <navigator class="settings item arrow" url="/pagesMember/settings/settings" hover-class="none">
class="settings item arrow"
url="/pagesMember/settings/settings"
hover-class="none">
<uni-icons type="settings" color="#3775F6" size="20"></uni-icons> <uni-icons type="settings" color="#3775F6" size="20"></uni-icons>
<view class="label"> 设置 </view> <view class="label"> 设置 </view>
</navigator> </navigator>
@ -216,16 +210,19 @@ page {
overflow: hidden; overflow: hidden;
background-color: #f7f7f8; background-color: #f7f7f8;
} }
.viewport { .viewport {
position: relative; position: relative;
height: 100%; height: 100%;
} }
.default { .default {
position: absolute; position: absolute;
background: #3775F6; background: #3775F6;
width: 100vw; width: 100vw;
height: 300rpx; height: 300rpx;
} }
/* 用户信息 */ /* 用户信息 */
.profile { .profile {
position: relative; position: relative;
@ -337,6 +334,7 @@ page {
color: #999a9f; color: #999a9f;
margin-top: 20rpx; margin-top: 20rpx;
} }
.num { .num {
color: #0d0d26; color: #0d0d26;
font-size: 40rpx; font-size: 40rpx;
@ -442,16 +440,19 @@ page {
background-color: #fff; background-color: #fff;
padding: 20rpx; padding: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
.module-title { .module-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
margin: 20rpx; margin: 20rpx;
} }
.module-list { .module-list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.item { .item {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
@ -461,6 +462,7 @@ page {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.label { .label {
font-size: 28rpx; font-size: 28rpx;
margin-top: 10rpx; margin-top: 10rpx;

@ -138,16 +138,8 @@ const { guessRef, onScrolltolower } = useGuessList()
<!-- 商品信息 --> <!-- 商品信息 -->
<view class="goods"> <view class="goods">
<!-- 选中状态 --> <!-- 选中状态 -->
<text <text @tap="onChangeSelected(item)" class="checkbox" :class="{ checked: item.selected }"></text>
@tap="onChangeSelected(item)" <navigator :url="`/pages/goods/goods?id=${item.id}`" hover-class="none" class="navigator">
class="checkbox"
:class="{ checked: item.selected }"
></text>
<navigator
:url="`/pages/goods/goods?id=${item.id}`"
hover-class="none"
class="navigator"
>
<image mode="aspectFill" class="picture" :src="item.picture"></image> <image mode="aspectFill" class="picture" :src="item.picture"></image>
<view class="meta"> <view class="meta">
<view class="name ellipsis">{{ item.name }}</view> <view class="name ellipsis">{{ item.name }}</view>
@ -157,13 +149,8 @@ const { guessRef, onScrolltolower } = useGuessList()
</navigator> </navigator>
<!-- 商品数量 --> <!-- 商品数量 -->
<view class="count"> <view class="count">
<vk-data-input-number-box <vk-data-input-number-box v-model="item.count" :min="1" :max="item.stock" :index="item.skuId"
v-model="item.count" @change="onChangeCount" />
:min="1"
:max="item.stock"
:index="item.skuId"
@change="onChangeCount"
/>
</view> </view>
</view> </view>
<!-- 右侧删除按钮 --> <!-- 右侧删除按钮 -->
@ -184,20 +171,13 @@ const { guessRef, onScrolltolower } = useGuessList()
</navigator> </navigator>
</view> </view>
<!-- 吸底工具栏 --> <!-- 吸底工具栏 -->
<view <view v-if="showCartList" class="toolbar"
v-if="showCartList" :style="{ paddingBottom: safeAreaInsetBottom ? safeAreaInsets?.bottom + 'px' : 0 }">
class="toolbar"
:style="{ paddingBottom: safeAreaInsetBottom ? safeAreaInsets?.bottom + 'px' : 0 }"
>
<text @tap="onChangeSelectedAll" class="all" :class="{ checked: isSelectedAll }">全选</text> <text @tap="onChangeSelectedAll" class="all" :class="{ checked: isSelectedAll }">全选</text>
<text class="text">合计:</text> <text class="text">合计:</text>
<text class="amount">{{ selectedCartListMoney }}</text> <text class="amount">{{ selectedCartListMoney }}</text>
<view class="button-grounp"> <view class="button-grounp">
<view <view @tap="gotoPayment" class="button payment-button" :class="{ disabled: selectedCartListCount === 0 }">
@tap="gotoPayment"
class="button payment-button"
:class="{ disabled: selectedCartListCount === 0 }"
>
去结算({{ selectedCartListCount }}) 去结算({{ selectedCartListCount }})
</view> </view>
</view> </view>
@ -399,15 +379,18 @@ const { guessRef, onScrolltolower } = useGuessList()
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
height: 60vh; height: 60vh;
.image { .image {
width: 400rpx; width: 400rpx;
height: 281rpx; height: 281rpx;
} }
.text { .text {
color: #444; color: #444;
font-size: 26rpx; font-size: 26rpx;
margin: 20rpx 0; margin: 20rpx 0;
} }
.button { .button {
width: 240rpx !important; width: 240rpx !important;
height: 60rpx; height: 60rpx;
@ -502,6 +485,7 @@ const { guessRef, onScrolltolower } = useGuessList()
} }
} }
} }
// //
.toolbar-height { .toolbar-height {
height: 100rpx; height: 100rpx;

@ -4,10 +4,12 @@ import { getOrderByIdAPI, cancleOrderAPI } from '@/services/order'
import { onLoad, onReady } from '@dcloudio/uni-app' import { onLoad, onReady } from '@dcloudio/uni-app'
import PageSkeleton from './components/PageSkeleton.vue' import PageSkeleton from './components/PageSkeleton.vue'
import { computed, ref, reactive } from 'vue' import { computed, ref, reactive } from 'vue'
import { useMemberStore } from '@/stores'
// //
const { safeAreaInsets } = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
// //
const location = uni.getStorageSync('location') const memberStore = useMemberStore()
const location = memberStore.location
// //
onLoad((options) => { onLoad((options) => {
getMemberOrderByIdData(options.orderId) getMemberOrderByIdData(options.orderId)
@ -84,9 +86,9 @@ const handleCancleOrder = () => {
<view class="order-detail"> <view class="order-detail">
<view class="status"> <view class="status">
<view class="title">订单状态{{ order.orderStatus?.desc }}</view> <view class="title">订单状态{{ order.orderStatus?.desc }}</view>
<view class="desc">订单类型{{ order.orderType?.desc }}</view> <view class="desc">订单类型{{ order.orderType?.desc || '散户下单' }}</view>
<template <template
v-if="order.orderStatus?.code == '520192817293693253' || order.orderStatus?.code == '520192868833300805'"> v-if="order.orderStatus?.code == '520192817293693253' || order.orderStatus?.code == '520192868833300805' || order.orderStatus?.code == '520192993311854917'">
<view class="time">预约时间{{ order.appointmentTime }}</view> <view class="time">预约时间{{ order.appointmentTime }}</view>
<view class="action"> <view class="action">
<view class="button cancle" @click="handleCancleOrder"></view> <view class="button cancle" @click="handleCancleOrder"></view>

@ -14,7 +14,7 @@ const props = defineProps<{
orderState: string orderState: string
}>() }>()
// //
const location = uni.getStorageSync('location') const location = memberStore.location
// //
const queryParams: Required<OrderListParams> = { const queryParams: Required<OrderListParams> = {
pageNo: 1, pageNo: 1,
@ -128,7 +128,9 @@ const onRefresherrefresh = async () => {
<view class="appointment-time"> 预约时间 {{ item.appointmentTime }}</view> <view class="appointment-time"> 预约时间 {{ item.appointmentTime }}</view>
<view class="complete-time" v-if="props.orderState == 'FINISHED'"> <view class="complete-time" v-if="props.orderState == 'FINISHED'">
完成时间 {{ item.completeTime }}</view> 完成时间 {{ item.completeTime }}</view>
<view class="cancle" v-if="props.orderState == 'PENDING'" @click="handleCancle(item.id)"> </view> <view class="cancle"
v-if="props.orderState == 'PENDING' || props.orderState == 'UNPROCESSED' || props.orderState == 'RECYCLING'"
@click="handleCancle(item.id)"> 取消订单 </view>
</view> </view>
</view> </view>
<!-- 底部提示文字 --> <!-- 底部提示文字 -->

@ -6,11 +6,13 @@ 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'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { useMemberStore } from '@/stores'
// //
const { safeAreaInsets } = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
// //
const location = uni.getStorageSync('location')
const memberStore = useMemberStore()
const location = memberStore.location
// //
const queryParams: Required<any> = { const queryParams: Required<any> = {
pageNo: 1, pageNo: 1,

@ -17,7 +17,7 @@ const props = defineProps<{
orderState: string orderState: string
}>() }>()
// //
const location = uni.getStorageSync('location') const location = memberStore.location
// //
const queryParams: Required<OrderListParams> = { const queryParams: Required<OrderListParams> = {
pageNo: 1, pageNo: 1,

@ -4,6 +4,8 @@ import { onShow } from '@dcloudio/uni-app'
import { postListSiteAPI } from '@/services/site' import { postListSiteAPI } from '@/services/site'
import { serviceDomain } from '@/services/constants' import { serviceDomain } from '@/services/constants'
import SiteItem from './components/siteItem.vue' import SiteItem from './components/siteItem.vue'
import { useMemberStore } from '@/stores'
const memberStore = useMemberStore()
type location = { type location = {
latitude: String latitude: String
longitude: String longitude: String
@ -84,8 +86,8 @@ const init = () => {
getDataList() getDataList()
} }
onShow(() => { onShow(() => {
const locationStorge = uni.getStorageSync('location') const location = memberStore.location
queryParams.location = locationStorge queryParams.location = location
init() init()
}) })
</script> </script>

@ -4,9 +4,10 @@ import { onLoad, onReady } from '@dcloudio/uni-app'
import { getSiteDetailAPI } from '@/services/site' import { getSiteDetailAPI } from '@/services/site'
import { serviceDomain, bannerList } from '@/services/constants' import { serviceDomain, bannerList } from '@/services/constants'
import PageSkeleton from './components/PageSkeleton.vue' import PageSkeleton from './components/PageSkeleton.vue'
import { useMemberStore } from '@/stores'
// //
const location = uni.getStorageSync('location') const memberStore = useMemberStore()
const location = memberStore.location
const siteInfo = ref({}) const siteInfo = ref({})
const rateValue = ref(5) const rateValue = ref(5)
@ -107,41 +108,50 @@ onLoad((options) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.site-detail { .site-detail {
background: #f2f2fa; background: #f2f2fa;
.cont { .cont {
background-color: #fff; background-color: #fff;
margin: 20rpx; margin: 20rpx;
padding: 16rpx; padding: 16rpx;
min-height: 80vh; min-height: 80vh;
overflow: auto; overflow: auto;
.info { .info {
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
box-shadow: 0px 0px 8px 0px rgba(161, 161, 177, 0.12); box-shadow: 0px 0px 8px 0px rgba(161, 161, 177, 0.12);
.hd { .hd {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.name { .name {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #0d0d26; color: #0d0d26;
} }
.num { .num {
font-size: 28rpx; font-size: 28rpx;
color: #95969d; color: #95969d;
} }
} }
.md { .md {
margin: 10rpx 0; margin: 10rpx 0;
font-size: 24rpx; font-size: 24rpx;
color: #95969d; color: #95969d;
display: flex; display: flex;
} }
.fd { .fd {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.label { .label {
font-size: 24rpx; font-size: 24rpx;
} }
.img { .img {
width: 72rpx; width: 72rpx;
height: 72rpx; height: 72rpx;
@ -150,40 +160,48 @@ onLoad((options) => {
} }
} }
} }
.module-menu { .module-menu {
// display: flex; // display: flex;
padding: 36rpx 20rpx; padding: 36rpx 20rpx;
box-shadow: 0px 0px 8px 0px rgba(161, 161, 177, 0.12); box-shadow: 0px 0px 8px 0px rgba(161, 161, 177, 0.12);
.item { .item {
flex: 1; flex: 1;
color: #95969d; color: #95969d;
padding: 10rpx 0; padding: 10rpx 0;
border-radius: 10rpx; border-radius: 10rpx;
text-align: center; text-align: center;
&.active { &.active {
background: #fff7e8; background: #fff7e8;
} }
} }
.order-details { .order-details {
.detail-item { .detail-item {
margin: 20rpx; margin: 20rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
.product-name { .product-name {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 28rpx; font-size: 28rpx;
.img-url { .img-url {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.name { .name {
font-size: 28rpx; font-size: 28rpx;
color: #95969d; color: #95969d;
} }
} }
.product-price { .product-price {
font-size: 28rpx; font-size: 28rpx;
margin: 20rpx; margin: 20rpx;
@ -192,11 +210,13 @@ onLoad((options) => {
} }
} }
} }
.detail-list { .detail-list {
padding: 0 20rpx; padding: 0 20rpx;
background-color: #fff; background-color: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
.item { .item {
// line-height: 90rpx; // line-height: 90rpx;
padding-left: 10rpx; padding-left: 10rpx;
@ -208,23 +228,27 @@ onLoad((options) => {
border-radius: 0; border-radius: 0;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
&::after { &::after {
width: auto; width: auto;
height: auto; height: auto;
left: auto; left: auto;
border: none; border: none;
} }
// &:first-child { // &:first-child {
// border: none; // border: none;
// } // }
&::after { &::after {
right: 5rpx; right: 5rpx;
} }
&.flex-column { &.flex-column {
flex-direction: column; flex-direction: column;
&:first-child {
} &:first-child {}
} }
&.rate { &.rate {
line-height: 90rpx; line-height: 90rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
@ -234,20 +258,26 @@ onLoad((options) => {
line-height: 90rpx; line-height: 90rpx;
flex-direction: row; flex-direction: row;
} }
.tag-list { .tag-list {
display: flex; display: flex;
margin-left: 20rpx; margin-left: 20rpx;
.tag { .tag {
color: #95969d; color: #95969d;
font-size: 24rpx; font-size: 24rpx;
} }
} }
&.activity { &.activity {
margin: 20rpx 0; margin: 20rpx 0;
.activity-list { .activity-list {
display: flex; display: flex;
.activity-item { .activity-item {
margin: 20rpx 10rpx; margin: 20rpx 10rpx;
&:first-child { &:first-child {
background: #484540; background: #484540;
padding: 4rpx 6rpx; padding: 4rpx 6rpx;
@ -255,6 +285,7 @@ onLoad((options) => {
color: #ffe6b5; color: #ffe6b5;
font-size: 24rpx; font-size: 24rpx;
} }
&:last-child { &:last-child {
padding: 4rpx 6rpx; padding: 4rpx 6rpx;
border-radius: 10rpx; border-radius: 10rpx;
@ -266,6 +297,7 @@ onLoad((options) => {
} }
} }
} }
.arrow::after { .arrow::after {
content: '\e6c2'; content: '\e6c2';
position: absolute; position: absolute;

@ -141,7 +141,7 @@ const onSubmit = async () => {
} }
await postMemberAddressAPI(params) await postMemberAddressAPI(params)
} }
isLoading.value = false isLoading.value = false
// //
uni.showToast({ icon: 'success', title: isEdit.value ? '修改成功' : '添加成功' }) uni.showToast({ icon: 'success', title: isEdit.value ? '修改成功' : '添加成功' })
// //
@ -180,12 +180,7 @@ const onSubmit = async () => {
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="receiveMobilePhone" class="form-item"> <uni-forms-item name="receiveMobilePhone" class="form-item">
<text class="label">手机号码</text> <text class="label">手机号码</text>
<input <input class="input" placeholder="请填写手机号码" :maxlength="11" v-model="form.receiveMobilePhone" />
class="input"
placeholder="请填写手机号码"
:maxlength="11"
v-model="form.receiveMobilePhone"
/>
</uni-forms-item> </uni-forms-item>
<!-- <uni-forms-item name="countyCode" class="form-item"> <!-- <uni-forms-item name="countyCode" class="form-item">
<text class="label">所在地区</text> <text class="label">所在地区</text>
@ -211,12 +206,7 @@ const onSubmit = async () => {
</uni-forms-item> </uni-forms-item>
<view class="form-item"> <view class="form-item">
<label class="label">设为默认地址</label> <label class="label">设为默认地址</label>
<switch <switch @change="onSwitchChange" class="switch" color="#3775F6" :checked="form.isDefault === 1" />
@change="onSwitchChange"
class="switch"
color="#3775F6"
:checked="form.isDefault === 1"
/>
</view> </view>
</uni-forms> </uni-forms>
</view> </view>

@ -9,8 +9,7 @@ import { ref } from 'vue'
// //
const addressList = ref<AddressItem[]>([]) const addressList = ref<AddressItem[]>([])
const memberStore = useMemberStore() const memberStore = useMemberStore()
const storage_staffId = uni.getStorageSync('storage_userInfo').id const staffId = memberStore.profile?.id
const staffId = memberStore.profile?.id || storage_staffId
const getMemberAddressData = async () => { const getMemberAddressData = async () => {
const params = { const params = {
@ -70,13 +69,9 @@ const onChangeAddress = (item: AddressItem) => {
<text v-if="item.isDefault" class="badge"></text> <text v-if="item.isDefault" class="badge"></text>
</view> </view>
<view class="locate">{{ item.receiveStreet }}</view> <view class="locate">{{ item.receiveStreet }}</view>
<navigator <navigator class="edit" hover-class="none"
class="edit" :url="`/pagesMember/address-form/address-form?info=${JSON.stringify(item)}`" @tap.stop="() => { }"
hover-class="none" @tap.prevent="() => { }">
:url="`/pagesMember/address-form/address-form?info=${JSON.stringify(item)}`"
@tap.stop="() => {}"
@tap.prevent="() => {}"
>
修改 修改
</navigator> </navigator>
</view> </view>
@ -202,4 +197,3 @@ page {
background-color: #3775F6; background-color: #3775F6;
} }
</style>import type { stringify } from 'querystring' </style>import type { stringify } from 'querystring'

@ -13,8 +13,8 @@ const props = defineProps<{
orderState: string orderState: string
}>() }>()
// //
const location = uni.getStorageSync('location')
const memberStore = useMemberStore() const memberStore = useMemberStore()
const location = memberStore.location
const staffId = memberStore.profile?.id const staffId = memberStore.profile?.id
// //
let queryParams = { let queryParams = {
@ -74,15 +74,8 @@ const onRefresherrefresh = async () => {
</script> </script>
<template> <template>
<scroll-view <scroll-view enable-back-to-top scroll-y class="orders" refresher-enabled :refresher-triggered="isTriggered"
enable-back-to-top @refresherrefresh="onRefresherrefresh" @scrolltolower="getMemberOrderData">
scroll-y
class="orders"
refresher-enabled
:refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh"
@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="name ellipsis">{{ item.remark }}</view> <view class="name ellipsis">{{ item.remark }}</view>
@ -105,15 +98,18 @@ const onRefresherrefresh = async () => {
border-bottom: 2rpx solid #dcd6d6; border-bottom: 2rpx solid #dcd6d6;
color: #afb0b6; color: #afb0b6;
font-size: 28rpx; font-size: 28rpx;
.name {
} .name {}
.time { .time {
margin: 10rpx 0; margin: 10rpx 0;
} }
&:last-child { &:last-child {
padding-bottom: 40rpx; padding-bottom: 40rpx;
} }
} }
.action { .action {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -150,6 +146,7 @@ const onRefresherrefresh = async () => {
} }
} }
} }
.loading-text { .loading-text {
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;

@ -28,9 +28,6 @@ const getMemberProfileData = async () => {
nickName: obj.nickName, nickName: obj.nickName,
birthday: obj.birthday?.slice(0, 10), birthday: obj.birthday?.slice(0, 10),
} }
// Store
// memberStore.profile!.avatar = avatar
// memberStore.profile!.nickName = obj.nickName
} }
onLoad(() => { onLoad(() => {
@ -67,8 +64,6 @@ const uploadFile = (file: string) => {
// //
const imgUrl = serviceDomain + avatar const imgUrl = serviceDomain + avatar
profile.value.avatar = imgUrl profile.value.avatar = imgUrl
// Store
// memberStore.profile!.avatar = imgUrl
uni.showToast({ icon: 'success', title: '更新成功' }) uni.showToast({ icon: 'success', title: '更新成功' })
} else { } else {
uni.showToast({ icon: 'error', title: '出现错误' }) uni.showToast({ icon: 'error', title: '出现错误' })
@ -106,7 +101,6 @@ const onSubmit = async () => {
const res = await postMemberProfileAPI(params) const res = await postMemberProfileAPI(params)
isLoading.value = false isLoading.value = false
// Store // Store
// memberStore.profile!.nickName = nickName
uni.showToast({ icon: 'success', title: '保存成功' }) uni.showToast({ icon: 'success', title: '保存成功' })
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack()
@ -156,14 +150,8 @@ const onSubmit = async () => {
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="label">生日</text> <text class="label">生日</text>
<picker <picker @change="onBirthdayChange" mode="date" class="picker" :value="profile?.birthday" start="1900-01-01"
@change="onBirthdayChange" :end="formatDate(new Date())">
mode="date"
class="picker"
:value="profile?.birthday"
start="1900-01-01"
:end="formatDate(new Date())"
>
<view v-if="profile?.birthday">{{ profile?.birthday }}</view> <view v-if="profile?.birthday">{{ profile?.birthday }}</view>
<view class="placeholder" v-else></view> <view class="placeholder" v-else></view>
</picker> </picker>
@ -288,6 +276,7 @@ page {
.picker { .picker {
flex: 1; flex: 1;
} }
.placeholder { .placeholder {
color: #808080; color: #808080;
} }
@ -305,4 +294,3 @@ page {
} }
} }
</style>import type { parse } from 'path' </style>import type { parse } from 'path'

@ -1,12 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
import { getLogoutWxMinAPI } from '@/services/login' import { getLogoutWxMinAPI } from '@/services/login'
import { computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const memberStore = useMemberStore() const memberStore = useMemberStore()
const isLogin = computed(() => { const isLogin = computed(() => {
const token = memberStore.profile?.token const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_userInfo')?.token return !!token
return !!token || !!storage_token
}) })
// 退 // 退
@ -19,18 +19,23 @@ const onLogout = () => {
if (res.confirm) { if (res.confirm) {
// //
memberStore.clearProfile() memberStore.clearProfile()
const res = await getLogoutWxMinAPI() const res = await getLogoutWxMinAPI()
// //
uni.navigateBack() uni.navigateBack()
} }
}, },
}) })
} }
const version = ref('')
onLoad(() => {
const accountInfo = uni.getAccountInfoSync()
version.value = accountInfo.miniProgram.version || '1.0.0' //
})
</script> </script>
<template> <template>
<view class="viewport"> <view class="viewport">
<!-- 列表1 --> <!-- 列表1 -->
<!-- <view class="list" v-if="isLogin"> <!-- <view class="list" v-if="isLogin">
<navigator url="/pagesMember/address/address" hover-class="none" class="item arrow"> <navigator url="/pagesMember/address/address" hover-class="none" class="item arrow">
我的地址 我的地址
@ -40,6 +45,10 @@ const onLogout = () => {
<button hover-class="none" class="item arrow" open-type="openSetting">授权管理</button> <button hover-class="none" class="item arrow" open-type="openSetting">授权管理</button>
<button hover-class="none" class="item arrow" open-type="feedback">问题反馈</button> <button hover-class="none" class="item arrow" open-type="feedback">问题反馈</button>
<button hover-class="none" class="item arrow" open-type="contact">联系我们</button> <button hover-class="none" class="item arrow" open-type="contact">联系我们</button>
<button hover-class="none" class="item flex-version" open-type="openSetting">
<view class="label">版本</view>
<view class="version">{{ version }}</view>
</button>
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="action" v-if="isLogin"> <view class="action" v-if="isLogin">
@ -63,6 +72,7 @@ page {
background-color: #fff; background-color: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
.item { .item {
line-height: 90rpx; line-height: 90rpx;
padding-left: 10rpx; padding-left: 10rpx;
@ -73,19 +83,28 @@ page {
text-align: left; text-align: left;
border-radius: 0; border-radius: 0;
background-color: #fff; background-color: #fff;
&.flex-version {
display: flex;
justify-content: space-between;
}
&::after { &::after {
width: auto; width: auto;
height: auto; height: auto;
left: auto; left: auto;
border: none; border: none;
} }
&:first-child { &:first-child {
border: none; border: none;
} }
&::after { &::after {
right: 5rpx; right: 5rpx;
} }
} }
.arrow::after { .arrow::after {
content: '\e6c2'; content: '\e6c2';
position: absolute; position: absolute;
@ -104,6 +123,7 @@ page {
margin-top: 40rpx; margin-top: 40rpx;
font-size: 32rpx; font-size: 32rpx;
color: #333; color: #333;
.button { .button {
background-color: #fff; background-color: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;

@ -1,8 +1,8 @@
/* /*
* @Author: * @Author:
* @Date: 2024-01-04 12:54:56 * @Date: 2024-01-04 12:54:56
* @LastEditors: * @LastEditors:
* @LastEditTime: 2024-03-27 13:09:06 * @LastEditTime: 2024-03-29 22:49:49
* @FilePath: /app-nx-personal/src/services/constants.ts * @FilePath: /app-nx-personal/src/services/constants.ts
* @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
*/ */
@ -51,76 +51,9 @@ export const bannerList = [
type: '1', type: '1',
}, },
] ]
/** 订单状态列表 */
export const categoryListDefault = [
{
id: '1',
code: 'SPHS2024031700019',
name: '旧衣服',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/6e946650966a4d741dfdf5b9159d9b81.png',
},
{
id: '2',
code: '旧衣服回收不浪费',
name: '家用电器',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/6bc7408b70d1a6bfbd6e1073e2e5f477.png',
},
{
id: '3',
code: 'SPHS2024031700016',
name: '废纸废书',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/4cc88d4fcea3c905ed18b0262a597612.png',
},
{
id: '4',
code: 'SPHS2024031700015',
name: '废金属',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/3775f85ee4a06d23a2cc57be2ada03f3.png',
},
{
id: '5',
code: 'SPHS2024031700014',
name: '废塑料',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/d2bf68bb986aed78053d32fd066a3091.png',
},
{
id: '6',
code: 'SPHS2024031700013',
name: '废玻璃',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/0a838dfa3cd0d574a31aa6e8f0537513.png',
},
{
id: '7',
code: 'SPHS2024031700012',
name: '有害垃圾',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/6e8a73123202a5da37e3824031a8af7f.png',
},
{
id: '8',
code: 'SPHS2024031700011',
name: '其他',
desc: '',
weightNum: '',
imgUrl: 'https://nxhs.cjyx.cc/upload/image/406437440626ac2961721cb493b2e45e.png',
},
]
// 文件路径 // 文件路径
// export const serviceDomain = 'https://nxhs.cjyx.cc' export const serviceDomain = 'https://nxhs.cjyx.cc'
export const serviceDomain = 'http://222.71.165.188:8808' // export const serviceDomain = 'http://222.71.165.188:8808'
// export const serviceDomain = 'http://192.168.0.166:8808' // export const serviceDomain = 'http://192.168.0.166:8808'
export const storage_userInfo = { export const storage_userInfo = {
userType: { userType: {

@ -1,14 +0,0 @@
import type { GoodsResult } from '@/types/goods'
import { http } from '@/utils/http'
/**
*
* @param id id
*/
export const getGoodsByIdAPI = (id: string) => {
return http<GoodsResult>({
method: 'GET',
url: '/goods',
data: { id },
})
}

@ -1,7 +1,7 @@
/* /*
* @Author: * @Author:
* @Date: 2024-03-14 13:54:56 * @Date: 2024-03-14 13:54:56
* @LastEditors: * @LastEditors:
* @LastEditTime: 2024-03-14 13:55:23 * @LastEditTime: 2024-03-14 13:55:23
* @FilePath: /app-nx-personal/src/stores/modules/category.ts * @FilePath: /app-nx-personal/src/stores/modules/category.ts
* @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
@ -10,19 +10,19 @@ import { defineStore } from 'pinia'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
export const useCategoryStore = defineStore('category', () => { export const useCategoryStore = defineStore('category', () => {
const selectedCategory = ref<any>() const category = ref<any>()
const changeCategory = (val: any) => {
category.value = val
const changeSelectedCategory = (val: any) => {
selectedCategory.value = val
} }
const selectedCategoryVal = computed(() => { const categoryVal = computed(() => {
return selectedCategory.value return category.value
}) })
return { return {
selectedCategory, categoryVal,
selectedCategoryVal, changeCategory,
changeSelectedCategory,
} }
}) })

@ -2,20 +2,20 @@
* @Author: * @Author:
* @Date: 2024-01-04 12:54:56 * @Date: 2024-01-04 12:54:56
* @LastEditors: * @LastEditors:
* @LastEditTime: 2024-03-15 09:16:13 * @LastEditTime: 2024-03-30 01:13:20
* @FilePath: /app-nx-recycle/src/stores/modules/member.ts * @FilePath: /app-nx-recycle/src/stores/modules/member.ts
* @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
*/ */
import type { LoginResult } from '@/types/member' import type { LoginResult } from '@/types/member'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' import { ref, computed } from 'vue'
// 定义 Store // 定义 Store
export const useMemberStore = defineStore('member', () => { export const useMemberStore = defineStore('member', () => {
// 会员信息 // 会员信息
const profile = ref<LoginResult>() const profile = ref<any>()
const location = ref({})
// 保存会员信息,登录时使用 // 保存会员信息,登录时使用
const setProfile = (val: LoginResult) => { const setProfile = (val: any) => {
profile.value = val profile.value = val
uni.setStorageSync('storage_userInfo', val) uni.setStorageSync('storage_userInfo', val)
} }
@ -25,11 +25,15 @@ export const useMemberStore = defineStore('member', () => {
profile.value = undefined profile.value = undefined
uni.setStorageSync('storage_userInfo', {}) uni.setStorageSync('storage_userInfo', {})
} }
const setLocation = (val: Object) => {
location.value = val
}
// 记得 return // 记得 return
return { return {
profile, profile,
setProfile, setProfile,
clearProfile, clearProfile,
location,
setLocation
} }
}) })

@ -1,25 +0,0 @@
/** 购物车类型 */
export type CartItem = {
/** 商品 ID */
id: string
/** SKU ID */
skuId: string
/** 商品名称 */
name: string
/** 图片 */
picture: string
/** 数量 */
count: number
/** 加入时价格 */
price: number
/** 当前的价格 */
nowPrice: number
/** 库存 */
stock: number
/** 是否选中 */
selected: boolean
/** 属性文字 */
attrsText: string
/** 是否为有效商品 */
isEffective: boolean
}

@ -29,8 +29,7 @@ const httpInterceptor = {
} }
// 4. 添加 token 请求头标识 // 4. 添加 token 请求头标识
const memberStore = useMemberStore() const memberStore = useMemberStore()
const storage_token = uni.getStorageSync('storage_userInfo')?.token const token = memberStore.profile?.token
const token = memberStore.profile?.token || storage_token
if (token) { if (token) {
options.header.authorization = token options.header.authorization = token
} }

Loading…
Cancel
Save