• uniapp微信小程序_自定义交费逻辑编写


    一、首先看最终效果 

    先说下整体逻辑,选中状态为淡紫色,点击哪个金额,充值页面上就显示多少金额 

    二、代码 

    1. class="addMoney">
    2. <view class="addMoneyTittle">
    3. 充值金额
    4. view>
    5. <view class="selfaddmoney" :class="{'selfaddmoney1':isActive}">
    6. <text>自定义交费text> <input @focus="isActive = true" @blur="isActive = false" type="text"
    7. v-model="addmoney" class="selfinput"><text class="selfinputtext">text>
    8. view>
    9. <view class="moneyLaut">
    10. <view class="money" v-for="(item,index) in money" @click="addmoneyValue(index)"
    11. :class="{'active':selectedIndex === index}">
    12. {{item.money}}<text class="selfinputtext">text>
    13. view>
    14. view>
    15. view>
    16. data() {
    17. return {
    18. show: false,
    19. show1: false,
    20. showOverlay: false, // 控制overlay显示与否的变量
    21. appointmentStatus: true, // 假设初始状态为预约失败
    22. selectedOldMan: 0,
    23. selectedIndex: null, // 用于存储当前选中的元素索引
    24. inforList: [{
    25. name: "吴海军",
    26. phon: "135 2589 3657",
    27. idNumber: "430525199401053654",
    28. identifier: "2358697454"
    29. }],
    30. money: [{
    31. money: 500
    32. }, {
    33. money: 1000
    34. }, {
    35. money: 2000
    36. }, {
    37. money: 3000
    38. }, {
    39. money: 5000
    40. }, {
    41. money: 10000
    42. }, ],
    43. addmoney: 15000,
    44. isActive: false
    45. }
    46. addmoneyValue(index) {
    47. this.selectedIndex = index; // 设置当前选中的索引
    48. this.addmoney = this.money[index].money;
    49. },
    50. .addMoney {
    51. margin-top: 20rpx;
    52. height: 530rpx;
    53. padding: 30rpx 20rpx 54rpx 22rpx;
    54. background: #FFFFFF;
    55. box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 0, 0, 0.05);
    56. border-radius: 10rpx 10rpx 10rpx 10rpx;
    57. .money {
    58. width: 202rpx;
    59. height: 124rpx;
    60. border-radius: 10rpx 10rpx 10rpx 10rpx;
    61. border: 1rpx solid #999999;
    62. text-align: center;
    63. line-height: 124rpx;
    64. margin-bottom: 20rpx;
    65. }
    66. .selfaddmoney1 {
    67. display: flex;
    68. align-items: center;
    69. margin-top: 28rpx;
    70. margin-bottom: 36rpx;
    71. width: 650rpx;
    72. height: 76rpx;
    73. background: #F6F5FF;
    74. border-radius: 10rpx 10rpx 10rpx 10rpx;
    75. border: 2rpx solid #5448FF;
    76. text-align: center;
    77. line-height: 76rpx;
    78. padding-left: 32rpx;
    79. box-sizing: border-box;
    80. }
    81. .selfaddmoney {
    82. display: flex;
    83. align-items: center;
    84. margin-top: 28rpx;
    85. margin-bottom: 36rpx;
    86. width: 650rpx;
    87. height: 76rpx;
    88. border-radius: 10rpx 10rpx 10rpx 10rpx;
    89. border: 2rpx solid #999999;
    90. text-align: center;
    91. line-height: 76rpx;
    92. padding-left: 32rpx;
    93. box-sizing: border-box;
    94. }
    95. .selfinput {
    96. width: 400rpx;
    97. text-align: right;
    98. }
    99. .selfinputtext {
    100. font-size: 20rpx;
    101. margin-top: 8rpx;
    102. }
    103. .addMoneyTittle {
    104. font-size: 32rpx;
    105. color: #5448FF;
    106. }
    107. .moneyLaut {
    108. display: flex;
    109. justify-content: space-between;
    110. flex-wrap: wrap;
    111. }
    112. }

    搞定收工

  • 相关阅读:
    Application启动流程
    大模型之Bloom&LLAMA----RHLF(强化学习)
    基于深度学习YOLOv8\YOLOv5的骨科骨折诊断检测系统设计
    还没搞明白 Spring AOP 就去美团面试,结果被面试官 KO
    蓝桥杯 第 1 场算法双周赛 第三题 分组【算法赛】c++ 贪心+双指针
    MySQL高级_索引的数据结构
    python进阶(28)import导入机制原理
    【Rust学习】《Rust程序设计语言》第二章:编写猜数字游戏
    传统项目管理与敏捷项目管理
    Spring aop和事务源码连接口
  • 原文地址:https://blog.csdn.net/apple_70049717/article/details/136716782