diff --git a/src/pages/booking/booking.vue b/src/pages/booking/booking.vue index e93d147..45b033d 100644 --- a/src/pages/booking/booking.vue +++ b/src/pages/booking/booking.vue @@ -45,7 +45,7 @@ const isBooking = computed(() => { }) // 是否显示单位订单 const isShowUnit = computed(() => { - const flag = memberStore.profile?.clientType == 2 ? true : false + const flag = unitList.value.length ? true : false return flag }) const unitList = ref([]) @@ -53,21 +53,6 @@ const unitIndex = ref(0) const bindUnitPickerChange = (e: any) => { unitIndex.value = e.detail.value } -onLoad(async () => { - const categoryListStore = categoryStore.categoryVal - categoryList = Object.assign([], categoryListStore) - - if (isShowUnit.value) { - const params = { - mobilePhone: memberStore.profile?.phone - } - const res = await getUnitListAPI(params) - unitList.value = res.data - } -}) -onShow(() => { - init() -}) const init = async () => { // 分类 const productCode = uni.getStorageSync('productCode') @@ -83,6 +68,16 @@ const init = async () => { await getMemberAddressData() // 获取默认地址的站点类目 await getNearbySite() + //当前用户负责的单位列表 + await getUnitList() +} +// 判断是否是单位回收负责人 +const getUnitList = async () => { + const params = { + mobilePhone: memberStore.profile?.phone + } + const res = await getUnitListAPI(params) + unitList.value = res.data } // 是否触发下拉刷新 const isTriggered = ref(false) @@ -171,6 +166,13 @@ const getMemberAddressData = async () => { }) } } +onLoad(async () => { + const categoryListStore = categoryStore.categoryVal + categoryList = Object.assign([], categoryListStore) +}) +onShow(() => { + init() +}) // 预估重量 const activeWeightKey = ref(0) const handleWeightChange = (val) => { @@ -333,7 +335,7 @@ const handlePopClose = (item) => { - 单位名称: + 单位名称 {{ unitList[unitIndex] }} diff --git a/src/pages/my/my.vue b/src/pages/my/my.vue index f434a99..6100b3c 100644 --- a/src/pages/my/my.vue +++ b/src/pages/my/my.vue @@ -14,11 +14,6 @@ const isLogin = computed(() => { const token = memberStore.profile?.token return !!token }) -// 是否显示单位订单 -const isShowUnit = computed(() => { - const flag = memberStore.profile?.clientType == 2 ? true : false - return flag -}) const banlance = ref(0) const avatar = ref('') @@ -180,10 +175,6 @@ const handleJump = (type) => { 设置 -