Commit 96107765 by cen

feat: 新加车型提示

1 parent b01dbdf7
......@@ -228,7 +228,10 @@ Component({
// 品牌车型
handleJumpBrand(e) {
wx.$router.go('packageEquity.carBrands')
const thisPage = wx.$router.getPageInstance()
const carTips = thisPage?.data?.carTips || ''
const url = carTips ? `packageEquity.carBrands?cartips=${encodeURIComponent(carTips)}` : 'packageEquity.carBrands'
wx.$router.go(url)
},
handleCellClick(e) {
......
......@@ -7,7 +7,8 @@ Page({
data: {
inputHeight: 0,
searchValue: '',
scrollTop: 0
scrollTop: 0,
cartips: ''
},
/**
......@@ -20,6 +21,12 @@ Page({
})
})
if (options.level == 2) this.level = 2
// 接收 carTips 参数
if (options.cartips) {
this.setData({
cartips: decodeURIComponent(options.cartips)
})
}
carLifeApi.getCarBrandList().then(res => {
// this.setLocalStorage('wx_scrm_car_brand_list', carInfo)
const carInfo = res.data
......
<!--packageEquity/pages/carEquity/carBrands/carBrands.wxml-->
<!-- packageEquity/pages/carEquity/carBrands/carBrands.wxml -->
<view class="car-brands-box">
<view class="car-brands">
<view wx-if="{{cartips}}" class="cartips">{{cartips}}</view>
<search-input bindsearch="search" value="{{searchValue}}" id="search-input" />
<scroll-view style="height:calc(100vh - {{inputHeight}}px);" scroll-y scroll-into-view="{{letter}}" scroll-top="{{scrollTopNum}}" bindscroll="scroll">
<block wx:if="{{flag}}">
......@@ -25,27 +26,25 @@
<view class="nothing">暂无数据</view>
</block>
</block>
</scroll-view>
<view class="side-bar" id="side-bar">
<block wx:for="{{brandList}}" wx:key="index">
<view data-letter="{{item.letter}}" class="view {{item.active?'active':''}}" capture-catch:touchstart="start" id="letter-{{item.letter}}" data-index="{{index}}" capture-catch:touchmove="move" capture-catch:touchend="end">{{item.letter}}
<view data-letter="{{item.letter}}" class="view {{item.active?'active':''}}" capture-catch:touchstart="start" id="letter-{{item.letter}}" data-index="{{index}}" capture-catch:touchmove="move" capture-catch:touchend="end">
{{item.letter}}
</view>
</block>
</view>
<!-- 提示 -->
<view class='tips' hidden='{{!showTip}}'>{{letter}}</view>
</view>
<block wx:if="{{carSeriesList.length}}">
<view class="car-type-box">
<view class="bg" bindtap="cancel" ></view>
<view class="bg" bindtap="cancel"></view>
<view class="brands-box">
<block wx:for="{{carSeriesList}}" wx:key="index">
<view class="title" bindtap="choose" data-item="{{item}}">{{item.name}}
</view>
<view class="title" bindtap="choose" data-item="{{item}}">{{item.name}}</view>
</block>
</view>
</view>
</block>
</view>
</view>
\ No newline at end of file
......@@ -4,6 +4,15 @@
align-items: center;
transform: translateY(0);
}
.cartips {
border-radius: var(--fontSize16);
background: #fef4e8;
color: #ff9d0a;
font-size: var(--fontSize26);
font-weight: 400;
padding: var(--fontSize8) var(--fontSize16);
margin: var(--fontSize16) var(--fontSize32) 0 var(--fontSize32);
}
.car-brands-box {
width: 100%;
......@@ -15,12 +24,11 @@
position: relative;
}
.car-brands .title {
position: sticky;
top: 0;
z-index: 2;
background: #F7F8FA;
background: #f7f8fa;
font-size: var(--fontSize24);
color: #323233;
padding-left: var(--fontSize32);
......@@ -38,17 +46,17 @@
.list::after {
position: absolute;
box-sizing: border-box;
content: ' ';
content: " ";
pointer-events: none;
right: var(--fontSize32);
bottom: 0;
left: var(--fontSize32);
border-bottom: var(--fontSize1) solid #ebedf0;
}
.list .icon{
width: var(--fontSize68);
height: var(--fontSize68);
margin-right: var(--fontSize8);
.list .icon {
width: var(--fontSize68);
height: var(--fontSize68);
margin-right: var(--fontSize8);
}
.side-bar {
......@@ -59,7 +67,7 @@
color: #4c4c4c;
width: 10%;
opacity: 0;
animation: show-side-bar .5s forwards;
animation: show-side-bar 0.5s forwards;
}
@keyframes show-side-bar {
......@@ -114,7 +122,7 @@
}
@media screen and (min-device-width: 600px) and (-webkit-min-device-pixel-ratio: 1) {
.side-bar{
.side-bar {
font-size: var(--fontSize18);
}
}
......@@ -160,7 +168,7 @@
box-sizing: border-box;
padding-left: 32rpx;
color: #969799;
background: #F7F8FA;
background: #f7f8fa;
}
.car-type-box .brands-box .brands-list {
......@@ -168,15 +176,15 @@
box-sizing: border-box;
padding-left: 32rpx;
border-bottom: 1rpx solid #e9e9e9;
animation: show-car-type .25s forwards;
animation: show-car-type 0.25s forwards;
}
@keyframes show-car-type{
0%{
@keyframes show-car-type {
0% {
min-height: 0;
opacity: 0;
}
100%{
100% {
min-height: 100rpx;
opacity: 1;
}
}
\ No newline at end of file
}
......@@ -332,4 +332,10 @@ module.exports = {
returnAll: true,
});
},
/** 根据VIN查询查博士数据 */
queryByVin(data) {
return newApi.post(`/chaboshi/queryByVin`, data, {
returnAll: true,
});
},
};
......@@ -27,6 +27,7 @@ Page({
isEdit: false, // 是否为编辑模式
detailsInfo: null, // 详情数据(编辑模式使用)
statusMap, // 状态映射
carTips: "", // 车辆提示信息(从车架号识别获取)
// FirstStep 的 picker 状态(移到页面级别避免被 scroll-view 遮挡)
firstStepReferrerPicker: false,
firstStepDeliveryPicker: false,
......@@ -517,7 +518,7 @@ Page({
reWrite(type, data) {
let { formData } = this.data;
console.log("ASCSAC",type);
console.log("ASCSAC", type);
if (type === "licensePlate") {
// 行驶证识别
// 根据返回数据结构映射到表单字段
......@@ -589,7 +590,6 @@ Page({
}
});
const upperVin = formatVinInput(vin);
// 先验证车架号
validateVin(upperVin)
.then((result) => {
......@@ -658,21 +658,29 @@ Page({
if (vin) {
// 转换为大写
const upperVin = formatVinInput(vin);
newApi.queryByVin({ vin: upperVin }).then((res) => {
console.log(res, "res");
if (res.data.code == 0) {
const carTips = res.data.data.base.commonName || "";
this.setData({ carTips });
} else {
this.setData({ carTips: "" });
}
});
// 先验证车架号
validateVin(upperVin)
.then((result) => {
// validateVin 返回 { success, message, data, vin }
// data 中包含后端接口返回的完整数据
let { valid } = result.data.data || {};
// 将 valid 值赋值到 FirstStep 组件的 vinValid 属性
const firstStepComponent = this.selectComponent("#FirstStep");
if (firstStepComponent) {
firstStepComponent.setData({
vinValid: valid,
});
}
// 将 valid 值赋值到 FirstStep 组件的 vinValid 属性
const firstStepComponent = this.selectComponent("#FirstStep");
if (firstStepComponent) {
firstStepComponent.setData({
vinValid: valid,
});
}
if (valid) {
// 验证通过,赋值到表单
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!