爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

227 lines
5.8 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="byc-container" :style="{paddingTop: 'calc(150rpx + ' + statusBarHeight + 'px)'}">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar" :style="{paddingTop: statusBarHeight + 'px'}">
  5. <view class="back" @tap="goBack">
  6. <uni-icons type="left" size="20" color="#fff"></uni-icons>
  7. </view>
  8. <text class="nav-title">包邮服务城市</text>
  9. <view class="nav-icons">
  10. <!-- 占位元素保持布局对称 -->
  11. </view>
  12. </view>
  13. <!-- 蓝色banner卡片 -->
  14. <view class="byc-banner">
  15. <image class="byc-banner-img" :src="myCityImage" mode="widthFix" />
  16. </view>
  17. <!-- 主内容卡片 -->
  18. <view class="byc-main-card">
  19. <view class="byc-main-title">已开通包邮服务的城市</view>
  20. <view class="byc-main-desc">
  21. 我们很高兴为以下城市的用户提供一键包邮的便捷服务进一步简化旧衣回收流程降低参与环保行动的门槛期待未来能将这一服务拓展至更多地区邀请全国人民共同投身于旧衣回收的环保事业中
  22. </view>
  23. <view class="byc-dashed-line"></view>
  24. <view class="byc-province-list">
  25. <view class="byc-province-item" v-for="(province, idx) in cityList" :key="province.id">
  26. <view class="byc-province-name">{{ province.name }}</view>
  27. <view class="byc-city-group" v-for="(city, cidx) in (province.children || [])" :key="city.id">
  28. <view class="byc-city-name">{{ city.name }}</view>
  29. <view class="byc-district-list" v-if="city.children && city.children.length > 0">
  30. <text v-for="(district, didx) in city.children" :key="district.id" class="byc-district">
  31. <text v-if="didx !== 0" class="byc-dot">·</text>{{ district.name }}
  32. </text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. statusBarHeight: 0,
  45. navBarHeight: 88, // 默认
  46. menuButtonInfo: null,
  47. cityList: [],
  48. bannerTop: 0 // banner距离顶部距离
  49. }
  50. },
  51. onLoad() {
  52. const sysInfo = uni.getSystemInfoSync()
  53. this.statusBarHeight = sysInfo.statusBarHeight
  54. let menuButtonInfo = null
  55. try {
  56. menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  57. } catch (e) {}
  58. this.menuButtonInfo = menuButtonInfo
  59. if (menuButtonInfo && menuButtonInfo.height) {
  60. // 导航栏高度 = 胶囊 bottom + top - 状态栏高度
  61. this.navBarHeight = menuButtonInfo.bottom + menuButtonInfo.top - sysInfo.statusBarHeight
  62. } else {
  63. this.navBarHeight = 88 // 兜底
  64. }
  65. this.bannerTop = this.statusBarHeight + this.navBarHeight
  66. this.$api('getFreeCityList', {}, res => {
  67. if (res && res.success && Array.isArray(res.result)) {
  68. this.cityList = res.result.filter(item => item.open === 'Y');
  69. // console.log(this.cityList);
  70. }
  71. });
  72. },
  73. computed: {
  74. city_desc() {
  75. const item = getApp().globalData.configData.find(i => i.keyName === 'city_desc')
  76. return item ? item.keyContent : ''
  77. },
  78. myCityImage() {
  79. const item = getApp().globalData.configData.find(i => i.keyName === 'city_banner')
  80. return item ? item.keyContent : ''
  81. },
  82. },
  83. methods: {
  84. goBack() {
  85. uni.navigateBack()
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .byc-container {
  92. min-height: 100vh;
  93. background: #f8f8f8;
  94. padding-bottom: env(safe-area-inset-bottom);
  95. }
  96. .nav-bar {
  97. display: flex;
  98. align-items: center;
  99. height: calc(150rpx + var(--status-bar-height));
  100. padding: 0 32rpx;
  101. background: #2486f6;
  102. position: fixed;
  103. top: 0;
  104. left: 0;
  105. right: 0;
  106. z-index: 999;
  107. box-sizing: border-box;
  108. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  109. .back {
  110. padding: 20rpx;
  111. margin-left: -20rpx;
  112. }
  113. .nav-title {
  114. flex: 1;
  115. text-align: center;
  116. font-size: 32rpx;
  117. font-weight: 500;
  118. color: #fff;
  119. }
  120. .nav-icons {
  121. display: flex;
  122. align-items: center;
  123. gap: 12px;
  124. }
  125. }
  126. .byc-banner {
  127. margin: -60rpx 0 0 0;
  128. overflow: hidden;
  129. box-shadow: 0 4rpx 24rpx rgba(60, 167, 250, 0.10);
  130. background: none;
  131. position: relative;
  132. z-index: 1;
  133. max-height: 400rpx;
  134. }
  135. .byc-banner-left {
  136. flex: 1;
  137. }
  138. .byc-banner-title {
  139. color: #fff;
  140. font-size: 44rpx;
  141. font-weight: bold;
  142. margin-bottom: 16rpx;
  143. text-shadow: 0 4rpx 12rpx rgba(0,0,0,0.12);
  144. }
  145. .byc-banner-desc {
  146. color: #e3f2fd;
  147. font-size: 28rpx;
  148. margin-top: 4rpx;
  149. }
  150. .byc-banner-img {
  151. width: 100%;
  152. height: 100%;
  153. max-height: 400rpx;
  154. display: block;
  155. object-fit: cover;
  156. }
  157. .byc-main-card {
  158. background: #fff;
  159. border-radius: 36rpx;
  160. margin: -40rpx 0 0 0;
  161. box-shadow: 0 8rpx 32rpx rgba(60, 167, 250, 0.08);
  162. padding: 48rpx 32rpx 32rpx 32rpx;
  163. position: relative;
  164. z-index: 2;
  165. }
  166. .byc-main-title {
  167. font-size: 36rpx;
  168. font-weight: bold;
  169. color: #222;
  170. margin-bottom: 24rpx;
  171. }
  172. .byc-main-desc {
  173. color: #888;
  174. font-size: 28rpx;
  175. line-height: 1.7;
  176. margin-bottom: 32rpx;
  177. }
  178. .byc-dashed-line {
  179. border-bottom: 2rpx dashed #e5e5e5;
  180. margin-bottom: 32rpx;
  181. }
  182. .byc-province-list {
  183. .byc-province-item {
  184. margin-bottom: 36rpx;
  185. &:last-child { margin-bottom: 0; }
  186. }
  187. .byc-province-name {
  188. font-size: 32rpx;
  189. font-weight: bold;
  190. color: #222;
  191. margin-bottom: 12rpx;
  192. }
  193. .byc-city-group {
  194. margin-bottom: 20rpx;
  195. padding-left: 16rpx;
  196. border-left: 3rpx solid #e5e5e5;
  197. &:last-child { margin-bottom: 0; }
  198. }
  199. .byc-city-name {
  200. font-size: 30rpx;
  201. font-weight: 600;
  202. color: #333;
  203. margin-bottom: 8rpx;
  204. }
  205. .byc-district-list {
  206. display: flex;
  207. flex-wrap: wrap;
  208. font-size: 26rpx;
  209. color: #666;
  210. line-height: 1.6;
  211. padding-left: 20rpx;
  212. }
  213. .byc-district {
  214. margin-right: 16rpx;
  215. margin-bottom: 6rpx;
  216. display: flex;
  217. align-items: center;
  218. }
  219. .byc-dot {
  220. margin-right: 6rpx;
  221. color: #bbb;
  222. font-size: 24rpx;
  223. }
  224. }
  225. </style>