transportation.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="container">
  3. <image class="banner" src="@/static/images/mine/back.png" mode="aspectFill" />
  4. <view class="title" :style="{ top: `${paddingTop * 2}rpx` }">
  5. <view class="title_back" @click="handleBack">
  6. <wd-icon name="thin-arrow-left" color="#001713" size="18"></wd-icon>
  7. </view>
  8. 电子交通卡
  9. </view>
  10. <view class="body">
  11. <!-- 交通卡区域 -->
  12. <view class="body_card" :class="[{ excellent: cardType == '优行卡' }, { teacher: cardType == '教师卡' }, { warm: cardType == '暖心卡' }]">
  13. <view class="card_type">
  14. <view class="type_name">
  15. <image v-if="cardType == '优行卡'" class="img" src="/static/images/transportation/logo.png" mode="aspectFill"></image>
  16. <image v-if="cardType == '教师卡'" class="img" src="/static/images/transportation/logo2.png" mode="aspectFill"></image>
  17. <image v-if="cardType == '暖心卡'" class="img" src="/static/images/transportation/logo3.png" mode="aspectFill"></image>
  18. {{ cardType }}
  19. </view>
  20. <view class="type_au" @click="goPage('/pages/identity/identity')">
  21. <text class="text">身份认证</text>
  22. <wd-icon name="arrow-right" color="#376477" size="8"></wd-icon>
  23. </view>
  24. </view>
  25. <view class="card_num">
  26. 可用余额:
  27. <text class="text">100元</text>
  28. </view>
  29. <view class="">充值余额:100元 补贴金额度:100元</view>
  30. <view
  31. class="card_btn"
  32. :class="[{ btn_excellent: cardType == '优行卡' }, { btn_teacher: cardType == '教师卡' }, { btn_warm: cardType == '暖心卡' }]"
  33. @click="handleDetail"
  34. >
  35. 查看使用明细
  36. </view>
  37. <view class="card_line" :class="[{ line_excellent: cardType == '优行卡' }, { line_teacher: cardType == '教师卡' }, { line_warm: cardType == '暖心卡' }]"></view>
  38. </view>
  39. <!-- 按钮区域 -->
  40. <view class="body_btns">
  41. <view class="btn pull" @click="handlePull">点击充值</view>
  42. <view class="btn refund" @click="handleRefund">点击退款</view>
  43. </view>
  44. <!-- 使用规则区域 -->
  45. <view class="body_rule">交通卡使用规则</view>
  46. </view>
  47. </view>
  48. <!-- 退款弹窗区域 -->
  49. <wd-popup v-model="popShow" position="bottom" safe-area-inset-bottom :close-on-click-modal="false">
  50. <view class="pop">
  51. <view class="pop_title">
  52. <view class="title_close" @click="closePop">
  53. <wd-icon name="close" size="16"></wd-icon>
  54. </view>
  55. </view>
  56. <view class="pop_tips">退款余额为50</view>
  57. <view class="pop_msg">退款后可用余额为0,主余额为0补贴余额为0</view>
  58. <view class="pop_btn">立即退款</view>
  59. </view>
  60. </wd-popup>
  61. </template>
  62. <script setup>
  63. import { onMounted, ref } from 'vue'
  64. // 胶囊按钮距离页面顶部的距离
  65. const paddingTop = ref(0)
  66. // 交通卡类型
  67. const cardType = ref('优行卡')
  68. // 退款弹窗显示隐藏控制
  69. const popShow = ref(false)
  70. onMounted(() => {
  71. paddingTop.value = uni.getMenuButtonBoundingClientRect().top
  72. })
  73. // 查看使用明细按钮回调
  74. const handleDetail = () => {
  75. uni.navigateTo({
  76. url: '/pages/useDetail/useDetail'
  77. })
  78. }
  79. // 点击充值按钮回调
  80. const handlePull = () => {
  81. uni.navigateTo({
  82. url: '/pages/pay/pay'
  83. })
  84. }
  85. // 跳转页面
  86. const goPage = (url) => {
  87. uni.navigateTo({
  88. url
  89. })
  90. }
  91. // 点击退款按钮回调
  92. const handleRefund = () => {
  93. popShow.value = true
  94. }
  95. // 弹窗关闭按钮回调
  96. const closePop = () => {
  97. popShow.value = false
  98. }
  99. // 顶部返回图标回调
  100. const handleBack = () => {
  101. uni.navigateBack()
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .container {
  106. position: relative;
  107. height: 100vh;
  108. color: #001713;
  109. background-color: #fff;
  110. overflow-y: auto;
  111. .banner {
  112. width: 100%;
  113. height: 482rpx;
  114. }
  115. .title {
  116. position: absolute;
  117. display: flex;
  118. align-items: center;
  119. width: 100vh;
  120. font-size: 40rpx;
  121. .title_back {
  122. margin-left: 26rpx;
  123. margin-right: 232rpx;
  124. }
  125. }
  126. .body {
  127. position: absolute;
  128. top: 160rpx;
  129. box-sizing: border-box;
  130. padding: 0 40rpx;
  131. width: 100%;
  132. .body_card {
  133. box-sizing: border-box;
  134. padding: 40rpx 50rpx 30rpx;
  135. width: 100%;
  136. height: 316rpx;
  137. font-size: 24rpx;
  138. border-radius: 60rpx;
  139. border-radius: 30px;
  140. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  141. .card_type {
  142. display: flex;
  143. align-items: center;
  144. font-weight: bold;
  145. .type_name {
  146. display: flex;
  147. align-items: center;
  148. font-size: 40rpx;
  149. .img {
  150. margin-right: 10rpx;
  151. width: 40rpx;
  152. height: 40rpx;
  153. }
  154. }
  155. .type_au {
  156. display: flex;
  157. align-items: center;
  158. margin-left: 40rpx;
  159. font-size: 24rpx;
  160. .text {
  161. margin-right: 5rpx;
  162. }
  163. }
  164. }
  165. .card_num {
  166. margin-top: 22rpx;
  167. margin-bottom: 18rpx;
  168. .text {
  169. font-weight: bold;
  170. }
  171. }
  172. .card_btn {
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. margin-top: 20rpx;
  177. margin-left: auto;
  178. width: 234rpx;
  179. height: 50rpx;
  180. font-size: 28rpx;
  181. font-weight: bold;
  182. border-radius: 8rpx;
  183. }
  184. .btn_excellent {
  185. color: #2b507a;
  186. border: 2rpx solid #2d537d;
  187. background-color: #cfe0eb;
  188. }
  189. .btn_teacher {
  190. color: #a46509;
  191. border: 2rpx solid #c77417;
  192. background-color: #fddb9f;
  193. }
  194. .btn_warm {
  195. color: #1580ed;
  196. border: 2rpx solid #0d71fb;
  197. background-color: #e2eef9;
  198. }
  199. .card_line {
  200. margin-top: 16rpx;
  201. width: 100%;
  202. height: 8rpx;
  203. border-radius: 10rpx;
  204. }
  205. .line_excellent {
  206. background: linear-gradient(90deg, #72a8d2 0%, #2b507a 100%);
  207. }
  208. .line_teacher {
  209. background: linear-gradient(90deg, #f1a045 0%, #bf6c0f 100%);
  210. }
  211. .line_warm {
  212. background: linear-gradient(90deg, #218dfb 0%, #0c70fb 100%);
  213. }
  214. }
  215. .excellent {
  216. color: #2b507a;
  217. background: linear-gradient(146.58deg, rgba(243, 245, 245, 0.5) 0%, rgba(229, 240, 244, 0.5) 100%);
  218. }
  219. .teacher {
  220. color: #9f5300;
  221. background: linear-gradient(148.48deg, rgba(254, 228, 182, 0.5) 0%, rgba(253, 205, 121, 0.5) 59.21%, rgba(248, 212, 140, 0.5) 100%);
  222. }
  223. .warm {
  224. color: #1580ed;
  225. background: linear-gradient(146.58deg, rgba(243, 245, 245, 0.5) 0%, rgba(201, 229, 255, 0.5) 100%);
  226. }
  227. .body_btns {
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. margin: 40rpx 0;
  232. .btn {
  233. display: flex;
  234. align-items: center;
  235. justify-content: center;
  236. width: 310rpx;
  237. height: 72rpx;
  238. font-size: 32rpx;
  239. border-radius: 16rpx;
  240. }
  241. .pull {
  242. color: #fff;
  243. background-color: #ff8205;
  244. }
  245. .refund {
  246. color: #ff8205;
  247. border: 2rpx solid #ff8205;
  248. }
  249. }
  250. .body_rule {
  251. font-size: 36rpx;
  252. }
  253. }
  254. }
  255. .pop {
  256. display: flex;
  257. flex-direction: column;
  258. align-items: center;
  259. box-sizing: border-box;
  260. padding-bottom: 60rpx;
  261. font-size: 32rpx;
  262. color: #001713;
  263. line-height: 46rpx;
  264. .pop_title {
  265. position: relative;
  266. height: 60rpx;
  267. width: 100%;
  268. background-color: #ff8205;
  269. .title_close {
  270. position: absolute;
  271. top: 6rpx;
  272. right: 30rpx;
  273. }
  274. }
  275. .pop_tips {
  276. margin-top: 24rpx;
  277. }
  278. .pop_msg {
  279. margin: 50rpx 0;
  280. width: 456rpx;
  281. }
  282. .pop_btn {
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. width: 480rpx;
  287. height: 72rpx;
  288. color: #ff8205;
  289. border-radius: 16rpx;
  290. border: 2rpx solid #ff8205;
  291. }
  292. }
  293. </style>