Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

car-detail.vue 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="top-hint" v-if="!isHandle">
  3. <view class="txt">
  4. <image :src="`${$imgUrl}common/icon-tips.png`" mode="aspectFill" class="imgs"></image>
  5. <view>
  6. <view>温馨提示</view>
  7. <view class="grey-txt">有效期剩余一年才可续期,您暂时不用续期</view>
  8. </view>
  9. </view>
  10. </view>
  11. <vehicleDetail
  12. style="margin-top: -20rpx;"
  13. :vehicleId="state.vehicleId"
  14. isRenewal
  15. @getVehicleDetail="getVehicleDetail"
  16. ></vehicleDetail>
  17. <view class="main-block" v-if="isHandle">
  18. <view class="column-checkbox-group">
  19. <view
  20. v-for="item in state.checkboxOption"
  21. class="column-checkbox"
  22. @click="toggleCheckbox(item)">
  23. <view class="checkbox-icon" :class="{'is-checked': item.checked}">
  24. <u-icon name="checkbox-mark" :color="item.checked ? '#FFFFFF' : '#FFFFFF'"></u-icon>
  25. </view>
  26. <text>{{ item.label }}</text>
  27. </view>
  28. </view>
  29. </view>
  30. <FixedFooter v-if="isHandle">
  31. <button
  32. type="default"
  33. class="ui-btn"
  34. @click="renewal()">
  35. 卡签续期
  36. </button>
  37. </FixedFooter>
  38. </template>
  39. <script lang="ts" setup>
  40. import { reactive, ref, computed } from "vue";
  41. import { onLoad, onShow } from "@dcloudio/uni-app";
  42. import { confirm } from "@/utils/utils";
  43. import vehicleDetail from '@/components/vehicle-detail/vehicle-detail.vue'
  44. import FixedFooter from '@/components/common/FixedFooter.vue'
  45. const state = reactive({
  46. vehicleId: '',
  47. vehicleInfo: {
  48. customerName: '',
  49. customerIdType: '',
  50. customerIdNum: '',
  51. vehicleId: '',
  52. type: '',
  53. cardId: '',
  54. cardType: '',
  55. cardStatus: '',
  56. cardExpireTime: '',
  57. obuId: '',
  58. obuStatus: '',
  59. obuExpireTime: '',
  60. customerTel: '',
  61. renewalType: 0,
  62. cardIsHaveRenewal: false,
  63. obuIsHaveRenewal: false,
  64. },
  65. renewalStatus: '0',
  66. checkboxOption: [],
  67. checkboxValue: [],
  68. });
  69. onLoad(({vehicleId}) => {
  70. if (vehicleId) {
  71. state.vehicleId = decodeURIComponent(vehicleId)
  72. }
  73. });
  74. onShow(() => {
  75. });
  76. // 是否可以续期,有效期剩余一年才可续期
  77. const isHandle = computed(() => {
  78. return state.checkboxOption && state.checkboxOption.length > 0
  79. })
  80. // 获取车辆详情
  81. const getVehicleDetail = (res) => {
  82. state.vehicleInfo = res
  83. state.checkboxOption = []
  84. // 卡是否可以续期
  85. if (state.vehicleInfo.cardIsHaveRenewal) {
  86. state.checkboxOption.push({ label: '卡续期', value: 2, checked: false, isShow: false })
  87. }
  88. // obu是否可以续期
  89. if (state.vehicleInfo.obuIsHaveRenewal) {
  90. state.checkboxOption.push({ label: '签续期', value: 3, checked: false, isShow: false })
  91. }
  92. }
  93. const renewal = () => {
  94. if (state.checkboxOption && state.checkboxOption.length === 0) {
  95. uni.showToast({
  96. title: '有效期剩余一年才可续期,您暂时不用续期',
  97. icon: 'none'
  98. })
  99. return
  100. }
  101. let isChecked = state.checkboxOption.filter(item => item.checked)
  102. if (isChecked.length === 0) {
  103. uni.showToast({
  104. title: '最少选择一种续期类型',
  105. icon: 'none'
  106. })
  107. return
  108. }
  109. let isType = 0 // 1:卡签续签 2:卡续签 3:签续签
  110. let checkedData = state.checkboxOption.filter(item => item.checked)
  111. if (checkedData.length >= 2) {
  112. isType = 1
  113. } else if (checkedData[0].value === 2) {
  114. isType = 2
  115. } else if (checkedData[0].value === 3) {
  116. isType = 3
  117. }
  118. state.vehicleInfo.renewalType = isType
  119. //续签
  120. // confirm("是否确认续签?", () => {
  121. let renewalInfo = state.vehicleInfo // 续签缓存
  122. console.log(renewalInfo)
  123. uni.setStorageSync('renewalInfo', renewalInfo)
  124. uni.navigateTo({
  125. url: `/subpackage/after-sale/renewalContral/renewal-type?vehicleId=${state.vehicleId}`,
  126. });
  127. // })
  128. }
  129. //多项选择器
  130. const checkboxGroupChange = (e : any) => {
  131. console.log(e)
  132. // let data = e.detail.value
  133. // state.renewalStatus = data
  134. }
  135. const toggleCheckbox = (item: any) => {
  136. item.checked = !item.checked
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .main-block {
  141. background-color: white;
  142. width: 88%;
  143. margin: 0 auto;
  144. margin-top: 20rpx;
  145. border-radius: 12px;
  146. border: 1px solid #FFFFFF;
  147. padding: 20rpx;
  148. overflow: hidden;
  149. .title {
  150. font-weight: bold;
  151. font-size: 30rpx;
  152. color: #01243A;
  153. margin-bottom: 12rpx;
  154. }
  155. }
  156. .column-checkbox-group{
  157. display: flex;
  158. .column-checkbox{
  159. display: flex;
  160. align-items: center;
  161. margin-bottom: 20rpx;
  162. flex: 1;
  163. .u-icon{
  164. font-size: 24rpx;
  165. color: #2CE242;
  166. }
  167. .checkbox-icon{
  168. width: 38rpx;
  169. height: 38rpx;
  170. border: 1px solid #c8c9cc;
  171. border-radius: 50%;
  172. display: flex;
  173. justify-content: center;
  174. align-items: center;
  175. margin-right: 20rpx;
  176. }
  177. .is-checked{
  178. border-color: #2CE242;
  179. background-color: #2CE242;
  180. }
  181. .u-icon{
  182. margin-right: 10rpx;
  183. }
  184. }
  185. }
  186. </style>