巴青农资商城

about-mall.vue 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="about-mall-page">
  3. <view v-if="pageLoading" class="about-mall-state">
  4. <u-loading-icon mode="circle" />
  5. </view>
  6. <view v-else-if="pageError" class="about-mall-state">
  7. <u-empty mode="page" :text="pageError" icon-size="80" />
  8. <u-button type="primary" text="重试" size="small" custom-style="margin-top:24rpx" @click="loadConfig" />
  9. </view>
  10. <scroll-view v-else class="about-mall-scroll" scroll-y>
  11. <view class="about-hero">
  12. <image class="about-hero__logo" src="/static/logo.png" mode="aspectFit" />
  13. <text class="about-hero__name">巴青农资商城</text>
  14. <text class="about-hero__desc">专注农资供应,服务广大农户与经销商</text>
  15. </view>
  16. <view class="about-card">
  17. <text class="about-card__title">商城信息</text>
  18. <view class="about-row">
  19. <text class="about-row__label">货币符号</text>
  20. <text class="about-row__val">{{ about.currencySymbol }}</text>
  21. </view>
  22. <view class="about-row">
  23. <text class="about-row__label">商品销量展示</text>
  24. <text class="about-row__val">{{ about.showSales ? '展示' : '不展示' }}</text>
  25. </view>
  26. </view>
  27. <view v-if="about.hasFiling" class="about-card">
  28. <text class="about-card__title">备案信息</text>
  29. <view
  30. v-for="item in about.filings"
  31. :key="item.key"
  32. class="about-filing"
  33. @click="onFilingClick(item)"
  34. >
  35. <text class="about-filing__label">{{ item.label }}</text>
  36. <view class="about-filing__link">
  37. <text class="about-filing__no">{{ item.no }}</text>
  38. <u-icon name="arrow-right" color="#2e7d32" size="14" />
  39. </view>
  40. </view>
  41. <text class="about-card__tip">点击备案号可在浏览器查看主管机关公示页</text>
  42. </view>
  43. <view v-else class="about-card about-card--empty">
  44. <text class="about-card__title">备案信息</text>
  45. <text class="about-empty-text">暂无备案信息</text>
  46. </view>
  47. <view class="about-footer">
  48. <text class="about-footer__text">© 巴青农资商城</text>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script setup>
  54. import { ref, reactive } from 'vue'
  55. import { onShow } from '@dcloudio/uni-app'
  56. import { getMallConfig } from '@/api/mallConfig'
  57. import { mapMallAboutPage, openExternalLink } from '@/utils/mallConfigDisplay'
  58. const pageLoading = ref(true)
  59. const pageError = ref('')
  60. const about = reactive({
  61. currencySymbol: '¥',
  62. showSales: true,
  63. filings: [],
  64. hasFiling: false
  65. })
  66. async function loadConfig() {
  67. pageLoading.value = true
  68. pageError.value = ''
  69. try {
  70. const res = await getMallConfig()
  71. const mapped = mapMallAboutPage(res.data)
  72. about.currencySymbol = mapped.currencySymbol
  73. about.showSales = mapped.showSales
  74. about.filings = mapped.filings
  75. about.hasFiling = mapped.hasFiling
  76. } catch (e) {
  77. pageError.value = (e && e.message) || '加载失败'
  78. } finally {
  79. pageLoading.value = false
  80. }
  81. }
  82. function onFilingClick(item) {
  83. if (!item || !item.link) return
  84. openExternalLink(item.link)
  85. }
  86. onShow(() => {
  87. loadConfig()
  88. })
  89. </script>
  90. <style lang="scss" scoped>
  91. .about-mall-page {
  92. min-height: 100vh;
  93. background: #f5f6f8;
  94. }
  95. .about-mall-state {
  96. display: flex;
  97. flex-direction: column;
  98. align-items: center;
  99. justify-content: center;
  100. min-height: 60vh;
  101. padding: 48rpx;
  102. }
  103. .about-mall-scroll {
  104. height: 100vh;
  105. box-sizing: border-box;
  106. }
  107. .about-hero {
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. padding: 64rpx 32rpx 40rpx;
  112. background: linear-gradient(145deg, #3d9b6e 0%, #22c55e 55%, #86efac 100%);
  113. }
  114. .about-hero__logo {
  115. width: 120rpx;
  116. height: 120rpx;
  117. border-radius: 24rpx;
  118. background: rgba(255, 255, 255, 0.9);
  119. }
  120. .about-hero__name {
  121. margin-top: 24rpx;
  122. font-size: 36rpx;
  123. font-weight: 600;
  124. color: #fff;
  125. }
  126. .about-hero__desc {
  127. margin-top: 12rpx;
  128. font-size: 26rpx;
  129. color: rgba(255, 255, 255, 0.9);
  130. text-align: center;
  131. }
  132. .about-card {
  133. margin: 24rpx 24rpx 0;
  134. padding: 28rpx 28rpx 20rpx;
  135. background: #fff;
  136. border-radius: 16rpx;
  137. }
  138. .about-card--empty {
  139. padding-bottom: 28rpx;
  140. }
  141. .about-card__title {
  142. display: block;
  143. margin-bottom: 20rpx;
  144. font-size: 30rpx;
  145. font-weight: 600;
  146. color: #333;
  147. }
  148. .about-card__tip {
  149. display: block;
  150. margin-top: 16rpx;
  151. font-size: 22rpx;
  152. color: #999;
  153. line-height: 1.5;
  154. }
  155. .about-row {
  156. display: flex;
  157. align-items: center;
  158. justify-content: space-between;
  159. padding: 20rpx 0;
  160. border-bottom: 1rpx solid #f0f0f0;
  161. }
  162. .about-row:last-child {
  163. border-bottom: none;
  164. }
  165. .about-row__label {
  166. font-size: 28rpx;
  167. color: #666;
  168. }
  169. .about-row__val {
  170. font-size: 28rpx;
  171. color: #333;
  172. }
  173. .about-filing {
  174. padding: 20rpx 0;
  175. border-bottom: 1rpx solid #f0f0f0;
  176. }
  177. .about-filing:last-of-type {
  178. border-bottom: none;
  179. }
  180. .about-filing__label {
  181. display: block;
  182. font-size: 26rpx;
  183. color: #999;
  184. margin-bottom: 8rpx;
  185. }
  186. .about-filing__link {
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. }
  191. .about-filing__no {
  192. flex: 1;
  193. font-size: 28rpx;
  194. color: #2e7d32;
  195. word-break: break-all;
  196. }
  197. .about-empty-text {
  198. font-size: 28rpx;
  199. color: #999;
  200. }
  201. .about-footer {
  202. padding: 48rpx 32rpx 64rpx;
  203. text-align: center;
  204. }
  205. .about-footer__text {
  206. font-size: 24rpx;
  207. color: #bbb;
  208. }
  209. </style>