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

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

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

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

@ -5,9 +5,10 @@ import { getHouseInfoAPI } from '@/services/home'
import { postBookingHouseAPI } from '@/services/booking'
import { serviceDomain, bannerList } from '@/services/constants'
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 isLoading = ref(false)

@ -2,13 +2,12 @@
* @Author: 王文杰
* @Date: 2024-03-04 14:13:16
* @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
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script setup lang="ts">
import type { CategoryItem } from '@/types/home'
import { categoryListDefault } from '@/services/constants'
// props
defineProps<{
list: Object[]

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

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

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

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

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

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

@ -6,11 +6,13 @@ import { getPayMockAPI, getPayWxPayMiniPayAPI } from '@/services/pay'
import type { OrderItem } from '@/types/order'
import type { OrderListParams } from '@/types/order'
import { onMounted, ref } from 'vue'
import { useMemberStore } from '@/stores'
//
const { safeAreaInsets } = uni.getSystemInfoSync()
//
const location = uni.getStorageSync('location')
const memberStore = useMemberStore()
const location = memberStore.location
//
const queryParams: Required<any> = {
pageNo: 1,

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

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

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

@ -180,12 +180,7 @@ const onSubmit = async () => {
</uni-forms-item>
<uni-forms-item name="receiveMobilePhone" class="form-item">
<text class="label">手机号码</text>
<input
class="input"
placeholder="请填写手机号码"
:maxlength="11"
v-model="form.receiveMobilePhone"
/>
<input class="input" placeholder="请填写手机号码" :maxlength="11" v-model="form.receiveMobilePhone" />
</uni-forms-item>
<!-- <uni-forms-item name="countyCode" class="form-item">
<text class="label">所在地区</text>
@ -211,12 +206,7 @@ const onSubmit = async () => {
</uni-forms-item>
<view class="form-item">
<label class="label">设为默认地址</label>
<switch
@change="onSwitchChange"
class="switch"
color="#3775F6"
:checked="form.isDefault === 1"
/>
<switch @change="onSwitchChange" class="switch" color="#3775F6" :checked="form.isDefault === 1" />
</view>
</uni-forms>
</view>

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

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

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

@ -1,12 +1,12 @@
<script setup lang="ts">
import { useMemberStore } from '@/stores'
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 isLogin = computed(() => {
const token = memberStore.profile?.token
const storage_token = uni.getStorageSync('storage_userInfo')?.token
return !!token || !!storage_token
return !!token
})
// 退
@ -26,6 +26,11 @@ const onLogout = () => {
},
})
}
const version = ref('')
onLoad(() => {
const accountInfo = uni.getAccountInfoSync()
version.value = accountInfo.miniProgram.version || '1.0.0' //
})
</script>
<template>
@ -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="feedback">问题反馈</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 class="action" v-if="isLogin">
@ -63,6 +72,7 @@ page {
background-color: #fff;
margin-bottom: 20rpx;
border-radius: 10rpx;
.item {
line-height: 90rpx;
padding-left: 10rpx;
@ -73,19 +83,28 @@ page {
text-align: left;
border-radius: 0;
background-color: #fff;
&.flex-version {
display: flex;
justify-content: space-between;
}
&::after {
width: auto;
height: auto;
left: auto;
border: none;
}
&:first-child {
border: none;
}
&::after {
right: 5rpx;
}
}
.arrow::after {
content: '\e6c2';
position: absolute;
@ -104,6 +123,7 @@ page {
margin-top: 40rpx;
font-size: 32rpx;
color: #333;
.button {
background-color: #fff;
margin-bottom: 20rpx;

@ -2,7 +2,7 @@
* @Author:
* @Date: 2024-01-04 12:54:56
* @LastEditors:
* @LastEditTime: 2024-03-27 13:09:06
* @LastEditTime: 2024-03-29 22:49:49
* @FilePath: /app-nx-personal/src/services/constants.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -51,76 +51,9 @@ export const bannerList = [
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 = 'http://222.71.165.188:8808'
export const serviceDomain = 'https://nxhs.cjyx.cc'
// export const serviceDomain = 'http://222.71.165.188:8808'
// export const serviceDomain = 'http://192.168.0.166:8808'
export const storage_userInfo = {
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 },
})
}

@ -10,19 +10,19 @@ import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
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(() => {
return selectedCategory.value
const categoryVal = computed(() => {
return category.value
})
return {
selectedCategory,
selectedCategoryVal,
changeSelectedCategory,
categoryVal,
changeCategory,
}
})

@ -2,20 +2,20 @@
* @Author:
* @Date: 2024-01-04 12:54:56
* @LastEditors:
* @LastEditTime: 2024-03-15 09:16:13
* @LastEditTime: 2024-03-30 01:13:20
* @FilePath: /app-nx-recycle/src/stores/modules/member.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import type { LoginResult } from '@/types/member'
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { ref, computed } from 'vue'
// 定义 Store
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
uni.setStorageSync('storage_userInfo', val)
}
@ -25,11 +25,15 @@ export const useMemberStore = defineStore('member', () => {
profile.value = undefined
uni.setStorageSync('storage_userInfo', {})
}
const setLocation = (val: Object) => {
location.value = val
}
// 记得 return
return {
profile,
setProfile,
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 请求头标识
const memberStore = useMemberStore()
const storage_token = uni.getStorageSync('storage_userInfo')?.token
const token = memberStore.profile?.token || storage_token
const token = memberStore.profile?.token
if (token) {
options.header.authorization = token
}

Loading…
Cancel
Save