123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <view class="top-hint" v-if="!isHandle">
- <view class="txt">
- <image :src="`${$imgUrl}common/icon-tips.png`" mode="aspectFill" class="imgs"></image>
- <view>
- <view>温馨提示</view>
- <view class="grey-txt">有效期剩余一年才可续期,您暂时不用续期</view>
- </view>
- </view>
-
- </view>
-
- <vehicleDetail
- style="margin-top: -20rpx;"
- :vehicleId="state.vehicleId"
- isRenewal
- @getVehicleDetail="getVehicleDetail"
- ></vehicleDetail>
-
- <view class="main-block" v-if="isHandle">
- <view class="column-checkbox-group">
- <view
- v-for="item in state.checkboxOption"
- class="column-checkbox"
- @click="toggleCheckbox(item)">
- <view class="checkbox-icon" :class="{'is-checked': item.checked}">
- <u-icon name="checkbox-mark" :color="item.checked ? '#FFFFFF' : '#FFFFFF'"></u-icon>
- </view>
- <text>{{ item.label }}</text>
- </view>
- </view>
- </view>
-
- <FixedFooter v-if="isHandle">
- <button
- type="default"
- class="ui-btn"
- @click="renewal()">
- 卡签续期
- </button>
- </FixedFooter>
- </template>
-
- <script lang="ts" setup>
- import { reactive, ref, computed } from "vue";
- import { onLoad, onShow } from "@dcloudio/uni-app";
- import { confirm } from "@/utils/utils";
- import vehicleDetail from '@/components/vehicle-detail/vehicle-detail.vue'
- import FixedFooter from '@/components/common/FixedFooter.vue'
-
- const state = reactive({
- vehicleId: '',
- vehicleInfo: {
- customerName: '',
- customerIdType: '',
- customerIdNum: '',
- vehicleId: '',
- type: '',
- cardId: '',
- cardType: '',
- cardStatus: '',
- cardExpireTime: '',
- obuId: '',
- obuStatus: '',
- obuExpireTime: '',
- customerTel: '',
- renewalType: 0,
- cardIsHaveRenewal: false,
- obuIsHaveRenewal: false,
- },
- renewalStatus: '0',
- checkboxOption: [],
- checkboxValue: [],
-
- });
-
- onLoad(({vehicleId}) => {
- if (vehicleId) {
- state.vehicleId = decodeURIComponent(vehicleId)
- }
- });
-
- onShow(() => {
-
- });
-
- // 是否可以续期,有效期剩余一年才可续期
- const isHandle = computed(() => {
- return state.checkboxOption && state.checkboxOption.length > 0
- })
-
- // 获取车辆详情
- const getVehicleDetail = (res) => {
- state.vehicleInfo = res
-
- state.checkboxOption = []
-
- // 卡是否可以续期
- if (state.vehicleInfo.cardIsHaveRenewal) {
- state.checkboxOption.push({ label: '卡续期', value: 2, checked: false, isShow: false })
- }
-
- // obu是否可以续期
- if (state.vehicleInfo.obuIsHaveRenewal) {
- state.checkboxOption.push({ label: '签续期', value: 3, checked: false, isShow: false })
- }
- }
-
-
- const renewal = () => {
-
- if (state.checkboxOption && state.checkboxOption.length === 0) {
- uni.showToast({
- title: '有效期剩余一年才可续期,您暂时不用续期',
- icon: 'none'
- })
- return
- }
-
- let isChecked = state.checkboxOption.filter(item => item.checked)
- if (isChecked.length === 0) {
- uni.showToast({
- title: '最少选择一种续期类型',
- icon: 'none'
- })
- return
- }
- let isType = 0 // 1:卡签续签 2:卡续签 3:签续签
-
- let checkedData = state.checkboxOption.filter(item => item.checked)
-
- if (checkedData.length >= 2) {
- isType = 1
- } else if (checkedData[0].value === 2) {
- isType = 2
- } else if (checkedData[0].value === 3) {
- isType = 3
- }
-
- state.vehicleInfo.renewalType = isType
-
- //续签
- // confirm("是否确认续签?", () => {
- let renewalInfo = state.vehicleInfo // 续签缓存
- console.log(renewalInfo)
- uni.setStorageSync('renewalInfo', renewalInfo)
- uni.navigateTo({
- url: `/subpackage/after-sale/renewalContral/renewal-type?vehicleId=${state.vehicleId}`,
- });
- // })
- }
-
- //多项选择器
- const checkboxGroupChange = (e : any) => {
- console.log(e)
- // let data = e.detail.value
- // state.renewalStatus = data
- }
-
- const toggleCheckbox = (item: any) => {
- item.checked = !item.checked
- }
- </script>
-
- <style lang="scss" scoped>
- .main-block {
- background-color: white;
- width: 88%;
- margin: 0 auto;
- margin-top: 20rpx;
- border-radius: 12px;
- border: 1px solid #FFFFFF;
- padding: 20rpx;
- overflow: hidden;
-
- .title {
- font-weight: bold;
- font-size: 30rpx;
- color: #01243A;
- margin-bottom: 12rpx;
- }
- }
- .column-checkbox-group{
- display: flex;
- .column-checkbox{
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- flex: 1;
- .u-icon{
- font-size: 24rpx;
- color: #2CE242;
- }
- .checkbox-icon{
- width: 38rpx;
- height: 38rpx;
- border: 1px solid #c8c9cc;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 20rpx;
- }
- .is-checked{
- border-color: #2CE242;
- background-color: #2CE242;
- }
- .u-icon{
- margin-right: 10rpx;
- }
- }
- }
- </style>
|