pay.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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. <!-- 内容区域 -->
  11. <scroll-view class="body" scroll-y @scrolltolower="scrolltolower">
  12. <view class="body_title">选择充值面额</view>
  13. <!-- 每一个充值选项区域 -->
  14. <view class="body_item" :class="{ active: currentIndex == index }" v-for="(item, index) in 6" :key="item" @click="hadnleChange(index)">
  15. <view class="item_price">
  16. ¥
  17. <text class="text">100</text>
  18. </view>
  19. <view class="item_msg">赠送100元补贴包,立得200元出行金</view>
  20. <view class="item_check" v-if="currentIndex == index">
  21. <wd-icon name="check-bold" color="#fff" size="20"></wd-icon>
  22. </view>
  23. </view>
  24. </scroll-view>
  25. <!-- 底部支付区域 -->
  26. <view class="foot">
  27. <view class="foot_left">
  28. <view class="left_top">
  29. 合计
  30. <text class="text">¥200</text>
  31. </view>
  32. <view class="left_bottom">
  33. 充值成功后赠送补贴金
  34. <text class="text">¥200</text>
  35. </view>
  36. </view>
  37. <view class="foot_right" @click="handlePay">点击支付</view>
  38. </view>
  39. </view>
  40. <!-- 选择付款方式弹窗区域 -->
  41. <wd-popup v-model="popShow_pay" position="bottom" safe-area-inset-bottom :close-on-click-modal="false">
  42. <view class="pop_pay">
  43. <view class="pay_title">选择付款方式</view>
  44. <view class="pay_close" @click="handleClose">
  45. <wd-icon name="close-bold" color="#ABA6A6" size="22"></wd-icon>
  46. </view>
  47. <!-- 支付方式列表区域 -->
  48. <view class="pay_list">
  49. <!-- 每一个支付方式区域 -->
  50. <view class="list_item" v-for="(item, index) in payList" :key="index">
  51. <view class="item_left">
  52. <image class="img" :src="item.icon" mode="aspectFill"></image>
  53. {{ item.text }}
  54. </view>
  55. <view class="item_right">
  56. <radio style="scale: 0.8" color="#FF8205" :checked="item.isCheck" @click="item.isCheck = !item.isCheck" />
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 立即付款按钮区域 -->
  61. <view class="pay_btn">立即付款</view>
  62. </view>
  63. </wd-popup>
  64. </template>
  65. <script setup>
  66. import { onMounted, ref } from 'vue'
  67. // 胶囊按钮距离页面顶部的距离
  68. const paddingTop = ref(0)
  69. // 当前选择的索引
  70. const currentIndex = ref(0)
  71. // 付款方式弹窗显示隐藏控制
  72. const popShow_pay = ref(false)
  73. // 支付方式列表
  74. const payList = ref([
  75. {
  76. text: '微信支付',
  77. icon: '/static/images/pay/wx.png',
  78. isCheck: false
  79. },
  80. {
  81. text: '电子交通卡支付',
  82. icon: '/static/images/pay/card.png',
  83. isCheck: false
  84. }
  85. ])
  86. onMounted(() => {
  87. paddingTop.value = uni.getMenuButtonBoundingClientRect().top
  88. })
  89. // 点击切换选项的回调
  90. const hadnleChange = (index) => {
  91. currentIndex.value = index
  92. }
  93. // 页面下滑到底部触发的回调
  94. const scrolltolower = () => {
  95. console.log(111)
  96. }
  97. // 点击支付按钮回调
  98. const handlePay = () => {
  99. popShow_pay.value = true
  100. }
  101. // 点击弹窗关闭按钮回调
  102. const handleClose = () => {
  103. popShow_pay.value = false
  104. }
  105. // 顶部返回图标回调
  106. const handleBack = () => {
  107. uni.navigateBack()
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .container {
  112. position: relative;
  113. height: 100vh;
  114. color: #001713;
  115. background-color: #fff;
  116. overflow: hidden;
  117. .banner {
  118. width: 100%;
  119. height: 482rpx;
  120. }
  121. .title {
  122. position: absolute;
  123. display: flex;
  124. align-items: center;
  125. width: 100vh;
  126. font-size: 40rpx;
  127. .title_back {
  128. margin-left: 26rpx;
  129. margin-right: 192rpx;
  130. }
  131. }
  132. .body {
  133. position: absolute;
  134. top: 160rpx;
  135. box-sizing: border-box;
  136. padding: 0 30rpx 30rpx;
  137. width: 100%;
  138. height: calc(100vh - 406rpx);
  139. font-size: 32rpx;
  140. color: #001713;
  141. .body_title {
  142. margin-bottom: 30rpx;
  143. }
  144. .body_item {
  145. position: relative;
  146. box-sizing: border-box;
  147. padding: 30rpx;
  148. margin-bottom: 40rpx;
  149. border: 2rpx solid #aba6a6;
  150. border-radius: 16rpx;
  151. background-color: #fff;
  152. .item_price {
  153. font-size: 28rpx;
  154. .text {
  155. font-size: 40rpx;
  156. }
  157. }
  158. .item_msg {
  159. margin-top: 20rpx;
  160. }
  161. .item_check {
  162. position: absolute;
  163. top: 0;
  164. right: 0;
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. width: 60rpx;
  169. height: 44rpx;
  170. border-radius: 0 14rpx 0 16rpx;
  171. background-color: #ff8205;
  172. }
  173. }
  174. .active {
  175. background-color: #fff6ee;
  176. border: 2rpx solid #ff8205;
  177. }
  178. }
  179. .foot {
  180. position: absolute;
  181. left: 0;
  182. right: 0;
  183. bottom: 0;
  184. box-sizing: border-box;
  185. padding: 0 30rpx 30rpx;
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. height: 244rpx;
  190. box-shadow: 0px 3px 6px #000000;
  191. .foot_left {
  192. .left_top {
  193. font-size: 32rpx;
  194. .text {
  195. font-size: 48rpx;
  196. color: #dc2626;
  197. }
  198. }
  199. .left_bottom {
  200. margin-top: 10rpx;
  201. font-size: 24rpx;
  202. .text {
  203. color: #dc2626;
  204. }
  205. }
  206. }
  207. .foot_right {
  208. display: flex;
  209. align-items: center;
  210. justify-content: center;
  211. width: 272rpx;
  212. height: 94rpx;
  213. color: #fff;
  214. font-size: 36rpx;
  215. border-radius: 50rpx;
  216. background-color: #ff8205;
  217. }
  218. }
  219. }
  220. .pop_pay {
  221. height: 566rpx;
  222. color: #001713;
  223. font-size: 28rpx;
  224. .pay_title {
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. height: 80rpx;
  229. font-size: 32rpx;
  230. border-bottom: 18rpx solid #ff8205;
  231. }
  232. .pay_close {
  233. position: absolute;
  234. top: 24rpx;
  235. right: 42rpx;
  236. }
  237. .pay_list {
  238. box-sizing: border-box;
  239. padding: 55rpx 0;
  240. display: flex;
  241. flex-direction: column;
  242. justify-content: space-between;
  243. height: 265rpx;
  244. .list_item {
  245. display: flex;
  246. align-items: center;
  247. justify-content: space-between;
  248. box-sizing: border-box;
  249. padding: 0 32rpx 0 46rpx;
  250. .item_left {
  251. display: flex;
  252. align-items: center;
  253. .img {
  254. margin-right: 26rpx;
  255. width: 54rpx;
  256. height: 54rpx;
  257. }
  258. }
  259. .item_right {
  260. }
  261. }
  262. }
  263. .pay_btn {
  264. display: flex;
  265. align-items: center;
  266. justify-content: center;
  267. margin: auto;
  268. width: 720rpx;
  269. height: 94rpx;
  270. font-size: 36rpx;
  271. color: #fff;
  272. border-radius: 50rpx;
  273. background-color: #ff8205;
  274. }
  275. }
  276. </style>