巴青农资商城

entry-list.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="entry-list-wrap">
  3. <safe-nav-bar title="我的入驻申请" />
  4. <view class="entry-list-page">
  5. <view v-if="loading" class="entry-list-page__loading">加载中…</view>
  6. <view v-else-if="list.length === 0" class="entry-empty">
  7. <text>暂无入驻申请记录</text>
  8. <button class="mine-btn-primary entry-empty__btn" @click="goApply">我要入驻</button>
  9. </view>
  10. <view v-else>
  11. <view
  12. v-for="item in list"
  13. :key="item.applyId"
  14. class="entry-card"
  15. @click="goDetail(item)"
  16. >
  17. <view class="entry-card__row">
  18. <text class="entry-card__no">{{ item.applyNo }}</text>
  19. <text class="entry-card__status" :style="{ color: statusStyle(item).color }">
  20. {{ statusStyle(item).label }}
  21. </text>
  22. </view>
  23. <text class="entry-card__time">申请时间:{{ item.applyTime || '—' }}</text>
  24. <text
  25. v-if="item.applyStatus === APPLY_STATUS_PUBLICITY && formatPublicityPeriod(item)"
  26. class="entry-card__publicity"
  27. >公示期:{{ formatPublicityPeriod(item) }}</text>
  28. <text
  29. v-if="item.applyStatus === '2' && item.rejectReason"
  30. class="entry-card__reject"
  31. >{{ item.rejectReason }}</text>
  32. </view>
  33. </view>
  34. <view v-if="canApply" class="entry-list-footer">
  35. <button class="form-footer__btn" @click="goApply">发起新申请</button>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script setup>
  41. import { ref } from 'vue'
  42. import SafeNavBar from '@/components/common/SafeNavBar.vue'
  43. import { onShow } from '@dcloudio/uni-app'
  44. import { getMyEntryApplies } from '@/api/merchantEntry'
  45. import { getEntryStatus } from '@/api/merchantEntry'
  46. import { ensureApiToken } from '@/utils/apiAuth'
  47. import { formatApplyStatus, canSubmitNewApply, formatPublicityPeriod, APPLY_STATUS_PUBLICITY } from '@/utils/entryConstants'
  48. import { PAGE_ENTRY_APPLY, PAGE_ENTRY_DETAIL } from '@/utils/pageRoute'
  49. const list = ref([])
  50. const loading = ref(true)
  51. const entryOpen = ref(true)
  52. const canApply = ref(false)
  53. onShow(() => {
  54. if (!ensureApiToken(false)) return
  55. loadData()
  56. })
  57. function statusStyle(item) {
  58. return formatApplyStatus(item.applyStatus)
  59. }
  60. function loadData() {
  61. loading.value = true
  62. Promise.all([getMyEntryApplies(), getEntryStatus()])
  63. .then(([myRes, stRes]) => {
  64. list.value = myRes.data || []
  65. entryOpen.value = stRes.data?.entryOpen !== false
  66. canApply.value = canSubmitNewApply(list.value, entryOpen.value)
  67. })
  68. .catch(() => {
  69. list.value = []
  70. })
  71. .finally(() => {
  72. loading.value = false
  73. })
  74. }
  75. function goDetail(item) {
  76. uni.navigateTo({
  77. url: `${PAGE_ENTRY_DETAIL}?applyId=${item.applyId}`
  78. })
  79. }
  80. function goApply() {
  81. uni.navigateTo({ url: PAGE_ENTRY_APPLY })
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. @import '@/styles/mine.scss';
  86. .entry-list-page {
  87. min-height: 100vh;
  88. padding: 24rpx;
  89. padding-bottom: 160rpx;
  90. background: #f0ebe5;
  91. }
  92. .entry-empty {
  93. padding: 100rpx 40rpx;
  94. text-align: center;
  95. background: #fff;
  96. border-radius: 16rpx;
  97. color: #999;
  98. font-size: 28rpx;
  99. }
  100. .entry-empty__btn {
  101. margin-top: 40rpx;
  102. width: 100%;
  103. }
  104. .entry-card {
  105. margin-bottom: 20rpx;
  106. padding: 28rpx;
  107. background: #fff;
  108. border-radius: 16rpx;
  109. }
  110. .entry-card__row {
  111. display: flex;
  112. justify-content: space-between;
  113. align-items: center;
  114. }
  115. .entry-card__no {
  116. font-size: 28rpx;
  117. font-weight: 600;
  118. color: #333;
  119. }
  120. .entry-card__status {
  121. font-size: 26rpx;
  122. }
  123. .entry-card__time {
  124. display: block;
  125. margin-top: 12rpx;
  126. font-size: 24rpx;
  127. color: #999;
  128. }
  129. .entry-card__publicity {
  130. display: block;
  131. margin-top: 12rpx;
  132. font-size: 24rpx;
  133. color: #1976d2;
  134. }
  135. .entry-card__reject {
  136. display: block;
  137. margin-top: 12rpx;
  138. font-size: 24rpx;
  139. color: #d32f2f;
  140. }
  141. .entry-list-footer {
  142. position: fixed;
  143. left: 0;
  144. right: 0;
  145. bottom: 0;
  146. padding: 24rpx 32rpx;
  147. padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
  148. background: #fff;
  149. }
  150. .entry-list-page__loading {
  151. padding: 80rpx;
  152. text-align: center;
  153. color: #999;
  154. }
  155. </style>