爱简收旧衣按件回收前端代码仓库
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.

210 lines
4.8 KiB

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