| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <view class="entry-list-wrap">
- <safe-nav-bar title="我的入驻申请" />
- <view class="entry-list-page">
- <view v-if="loading" class="entry-list-page__loading">加载中…</view>
- <view v-else-if="list.length === 0" class="entry-empty">
- <text>暂无入驻申请记录</text>
- <button class="mine-btn-primary entry-empty__btn" @click="goApply">我要入驻</button>
- </view>
- <view v-else>
- <view
- v-for="item in list"
- :key="item.applyId"
- class="entry-card"
- @click="goDetail(item)"
- >
- <view class="entry-card__row">
- <text class="entry-card__no">{{ item.applyNo }}</text>
- <text class="entry-card__status" :style="{ color: statusStyle(item).color }">
- {{ statusStyle(item).label }}
- </text>
- </view>
- <text class="entry-card__time">申请时间:{{ item.applyTime || '—' }}</text>
- <text
- v-if="item.applyStatus === APPLY_STATUS_PUBLICITY && formatPublicityPeriod(item)"
- class="entry-card__publicity"
- >公示期:{{ formatPublicityPeriod(item) }}</text>
- <text
- v-if="item.applyStatus === '2' && item.rejectReason"
- class="entry-card__reject"
- >{{ item.rejectReason }}</text>
- </view>
- </view>
- <view v-if="canApply" class="entry-list-footer">
- <button class="form-footer__btn" @click="goApply">发起新申请</button>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import SafeNavBar from '@/components/common/SafeNavBar.vue'
- import { onShow } from '@dcloudio/uni-app'
- import { getMyEntryApplies } from '@/api/merchantEntry'
- import { getEntryStatus } from '@/api/merchantEntry'
- import { ensureApiToken } from '@/utils/apiAuth'
- import { formatApplyStatus, canSubmitNewApply, formatPublicityPeriod, APPLY_STATUS_PUBLICITY } from '@/utils/entryConstants'
- import { PAGE_ENTRY_APPLY, PAGE_ENTRY_DETAIL } from '@/utils/pageRoute'
- const list = ref([])
- const loading = ref(true)
- const entryOpen = ref(true)
- const canApply = ref(false)
- onShow(() => {
- if (!ensureApiToken(false)) return
- loadData()
- })
- function statusStyle(item) {
- return formatApplyStatus(item.applyStatus)
- }
- function loadData() {
- loading.value = true
- Promise.all([getMyEntryApplies(), getEntryStatus()])
- .then(([myRes, stRes]) => {
- list.value = myRes.data || []
- entryOpen.value = stRes.data?.entryOpen !== false
- canApply.value = canSubmitNewApply(list.value, entryOpen.value)
- })
- .catch(() => {
- list.value = []
- })
- .finally(() => {
- loading.value = false
- })
- }
- function goDetail(item) {
- uni.navigateTo({
- url: `${PAGE_ENTRY_DETAIL}?applyId=${item.applyId}`
- })
- }
- function goApply() {
- uni.navigateTo({ url: PAGE_ENTRY_APPLY })
- }
- </script>
- <style lang="scss" scoped>
- @import '@/styles/mine.scss';
- .entry-list-page {
- min-height: 100vh;
- padding: 24rpx;
- padding-bottom: 160rpx;
- background: #f0ebe5;
- }
- .entry-empty {
- padding: 100rpx 40rpx;
- text-align: center;
- background: #fff;
- border-radius: 16rpx;
- color: #999;
- font-size: 28rpx;
- }
- .entry-empty__btn {
- margin-top: 40rpx;
- width: 100%;
- }
- .entry-card {
- margin-bottom: 20rpx;
- padding: 28rpx;
- background: #fff;
- border-radius: 16rpx;
- }
- .entry-card__row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .entry-card__no {
- font-size: 28rpx;
- font-weight: 600;
- color: #333;
- }
- .entry-card__status {
- font-size: 26rpx;
- }
- .entry-card__time {
- display: block;
- margin-top: 12rpx;
- font-size: 24rpx;
- color: #999;
- }
- .entry-card__publicity {
- display: block;
- margin-top: 12rpx;
- font-size: 24rpx;
- color: #1976d2;
- }
- .entry-card__reject {
- display: block;
- margin-top: 12rpx;
- font-size: 24rpx;
- color: #d32f2f;
- }
- .entry-list-footer {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 24rpx 32rpx;
- padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
- background: #fff;
- }
- .entry-list-page__loading {
- padding: 80rpx;
- text-align: center;
- color: #999;
- }
- </style>
|