selectDriving.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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="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. console.log(this.dirvingList);
  58. }
  59. },
  60. methods: {
  61. submit() {
  62. let pages = getCurrentPages(); //获取所有页面栈实例列表
  63. let nowPage = pages[pages.length - 1]; //当前页页面实例
  64. let prevPage = pages[pages.length - 2]; //上一页页面实例
  65. console.log(this.dirvingList.filter(val => val.quantity > 0));
  66. prevPage.$vm.accidentalDrivingVo = this.dirvingList.filter(val => val.quantity > 0); //替换特约
  67. uni.navigateBack(-1)
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. page {
  74. background-color: #f8f8f8;
  75. height: 100%;
  76. }
  77. .page {
  78. background-color: #f8f8f8;
  79. height: 100%;
  80. }
  81. .body {
  82. padding: 20rpx 30rpx 166rpx;
  83. box-sizing: border-box;
  84. .drivingItem {
  85. padding: 25rpx 30rpx;
  86. box-sizing: border-box;
  87. background: #FFFFFF;
  88. border-radius: 10rpx 10rpx 10rpx 10rpx;
  89. margin-bottom: 20rpx;
  90. .title {
  91. font-size: 32rpx;
  92. color: #333;
  93. font-weight: bold;
  94. }
  95. .sum {
  96. font-size: 30rpx;
  97. color: #333;
  98. }
  99. }
  100. }
  101. .minus {
  102. padding: 6rpx;
  103. box-sizing: border-box;
  104. border-radius: 20rpx 20rpx 20rpx 20rpx;
  105. border: 1rpx solid #FDE935;
  106. }
  107. .input {
  108. font-size: 30rpx;
  109. color: #333;
  110. padding: 0 20rpx;
  111. box-sizing: border-box;
  112. text-align: center;
  113. }
  114. .plus {
  115. padding: 6rpx;
  116. box-sizing: border-box;
  117. border-radius: 20rpx 20rpx 20rpx 20rpx;
  118. background-color: #FDE935;
  119. border: 1rpx solid #FDE935;
  120. }
  121. .footer {
  122. position: fixed;
  123. bottom: 0;
  124. left: 0;
  125. right: 0;
  126. padding: 25rpx 30rpx 55rpx;
  127. box-sizing: border-box;
  128. background: linear-gradient(0deg, #FFFFFF 0%, rgba(255, 254, 245, 0.8) 100%);
  129. border-radius: 0rpx 0rpx 0rpx 0rpx;
  130. backdrop-filter: blur(12rpx);
  131. text:first-child {
  132. font-size: 28rpx;
  133. color: #FF540A;
  134. font-weight: bold;
  135. }
  136. text:last-child {
  137. font-size: 42rpx;
  138. color: #FF540A;
  139. font-weight: bold;
  140. line-height: 1.1;
  141. }
  142. .btn {
  143. width: 65%;
  144. background: #FDE935;
  145. border: 1rpx solid #FDE935;
  146. padding: 18rpx 20rpx;
  147. box-sizing: border-box;
  148. border-radius: 58rpx 58rpx 58rpx 58rpx;
  149. font-size: 36rpx;
  150. color: #1F1F1F;
  151. margin-left: 90rpx;
  152. }
  153. }
  154. </style>