selectDriving.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="page">
  3. <!-- 头部吸顶区域 -->
  4. <u-sticky zIndex="999" customNavHeight="0">
  5. <uni-NavBar headerTitle="选择驾意险" background="#fff" :isSlot="false" :rightIcon="false">
  6. </uni-NavBar>
  7. </u-sticky>
  8. <view class="body">
  9. <view class="drivingItem dis f-c j-s" v-for="(item,index) in dirvingList" :key="index">
  10. <text class="title">{{item.productName}} </text>
  11. <view class="dis a-c j-s mt-2">
  12. <text class="sum">¥{{item.premium}}</text>
  13. <u-number-box v-model="item.quantity" :min="item.selectedStatus == 2 ? 1 : 0">
  14. <view slot="minus" class="minus dis a-c j-c ">
  15. <u-icon name="minus" size="12" color="#333" bold></u-icon>
  16. </view>
  17. <text slot="input" class="input">
  18. {{item.quantity}}
  19. </text>
  20. <view slot="plus" class="plus dis a-c j-c ">
  21. <u-icon name="plus" color="#333" size="12" bold></u-icon>
  22. </view>
  23. </u-number-box>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="footer dis a-c j-s">
  28. <view class="dis a-end">
  29. <text>¥</text>
  30. <text>{{totalCount}}</text>
  31. </view>
  32. <view class="btn dis a-c j-c " @click="submit">
  33. 确定
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. value: 0,
  43. dirvingList: [],
  44. }
  45. },
  46. onShow() {
  47. },
  48. computed: {
  49. totalCount() {
  50. const total = this.dirvingList.reduce((sum, item) => sum + (item.quantity * item.premium), 0);
  51. return total
  52. }
  53. },
  54. onLoad(options) {
  55. if (options) {
  56. this.dirvingList = JSON.parse(options.list);
  57. }
  58. },
  59. methods: {
  60. submit() {
  61. let pages = getCurrentPages(); //获取所有页面栈实例列表
  62. let nowPage = pages[pages.length - 1]; //当前页页面实例
  63. let prevPage = pages[pages.length - 2]; //上一页页面实例
  64. prevPage.$vm.accidentalDrivingVo = this.dirvingList.filter(val => val.quantity > 0); //替换特约
  65. uni.navigateBack(-1)
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. page {
  72. background-color: #f8f8f8;
  73. height: 100%;
  74. }
  75. .page {
  76. background-color: #f8f8f8;
  77. height: 100%;
  78. }
  79. .body {
  80. padding: 20rpx 30rpx 166rpx;
  81. box-sizing: border-box;
  82. .drivingItem {
  83. padding: 25rpx 30rpx;
  84. box-sizing: border-box;
  85. background: #FFFFFF;
  86. border-radius: 10rpx 10rpx 10rpx 10rpx;
  87. margin-bottom: 20rpx;
  88. .title {
  89. font-size: 32rpx;
  90. color: #333;
  91. font-weight: bold;
  92. }
  93. .sum {
  94. font-size: 30rpx;
  95. color: #333;
  96. }
  97. }
  98. }
  99. .minus {
  100. padding: 6rpx;
  101. box-sizing: border-box;
  102. border-radius: 20rpx 20rpx 20rpx 20rpx;
  103. border: 1rpx solid #FDE935;
  104. }
  105. .input {
  106. font-size: 30rpx;
  107. color: #333;
  108. padding: 0 20rpx;
  109. box-sizing: border-box;
  110. text-align: center;
  111. }
  112. .plus {
  113. padding: 6rpx;
  114. box-sizing: border-box;
  115. border-radius: 20rpx 20rpx 20rpx 20rpx;
  116. background-color: #FDE935;
  117. border: 1rpx solid #FDE935;
  118. }
  119. .footer {
  120. position: fixed;
  121. bottom: 0;
  122. left: 0;
  123. right: 0;
  124. padding: 25rpx 30rpx 55rpx;
  125. box-sizing: border-box;
  126. background: linear-gradient(0deg, #FFFFFF 0%, rgba(255, 254, 245, 0.8) 100%);
  127. border-radius: 0rpx 0rpx 0rpx 0rpx;
  128. backdrop-filter: blur(12rpx);
  129. text:first-child {
  130. font-size: 28rpx;
  131. color: #FF540A;
  132. font-weight: bold;
  133. }
  134. text:last-child {
  135. font-size: 42rpx;
  136. color: #FF540A;
  137. font-weight: bold;
  138. line-height: 1.1;
  139. }
  140. .btn {
  141. width: 65%;
  142. background: #FDE935;
  143. border: 1rpx solid #FDE935;
  144. padding: 18rpx 20rpx;
  145. box-sizing: border-box;
  146. border-radius: 58rpx 58rpx 58rpx 58rpx;
  147. font-size: 36rpx;
  148. color: #1F1F1F;
  149. margin-left: 90rpx;
  150. }
  151. }
  152. </style>