二手车小程序

This commit is contained in:
浅念
2025-09-19 09:54:43 +08:00
parent 91e604a6af
commit 507bff6d65
869 changed files with 107160 additions and 0 deletions
+551
View File
@@ -0,0 +1,551 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.carinfo')"></uni-nav-bar>
<view class="content">
<view class="cell">
<view>{{$t('carinfo.productName')}} <text class="red">*</text></view>
<view class="right">
<input :placeholder="$t('carinfo.inputproduct')" v-model="carinfo.name" />
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.product_image')}}</view>
<view class="right">
<uni-file-picker fileMediatype="image" limit="1" @select="select" @delete="delfn" :del-icon="false" disable-preview :imageStyles="imageStyles">
<image :src="carinfo.cover_full==''?'/static/image/img.png':carinfo.cover_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.vin')}}</view>
<view class="right">
<input :placeholder="$t('carinfo.inputVIN')" v-model="carinfo.vin" />
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.brand')}}</view>
<view class="right select" @click="showbrand=true">
<input :placeholder="$t('carinfo.selectbrand')" disabled v-model="brandname" />
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.model')}}</view>
<view class="right select" @click="showmodel = true">
<input :placeholder="$t('carinfo.selectmodel')" disabled v-model="model" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showmodel" @cancel="cancel('showmodel')" :defaultIndex="defaultIndexm" :columns="modelList" keyName="name" @confirm="modelChange"></u-picker>
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.price')}}</view>
<view class="right">
<input :placeholder="$t('carinfo.inputprice')" type="digit" v-model="carinfo.price" />
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.type')}}</view>
<view class="right select" @click="showtype=true">
<input :placeholder="$t('carinfo.selecttype')" disabled v-model="type" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showtype" @cancel="cancel('showtype')" :defaultIndex="defaultIndex2" :columns="typesList" keyName="name" @confirm="typesChange"></u-picker>
<!-- <ld-select :list="typesList" label-key="name" value-key="id" placeholder="选择车辆类型" v-model="carinfo.type" @change="typesChange"></ld-select> -->
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.energy')}}</view>
<view class="right select" @click="showenergy=true">
<input :placeholder="$t('carinfo.selectenergy')" disabled v-model="energy" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showenergy" @cancel="cancel('showenergy')" :defaultIndex="defaultIndex3" :columns="energyList" keyName="name" @confirm="energyChange"></u-picker>
<!-- <ld-select :list="energyList" label-key="name" value-key="id" placeholder="选择能源类型" v-model="carinfo.energy" @change="energyChange"></ld-select> -->
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.store_status')}}</view>
<view class="right select" @click="showstatus = true">
<input :placeholder="$t('carinfo.select')" disabled v-model="store_status" />
<u-picker :defaultIndex="defaultIndexs" :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showstatus" @cancel="cancel('showstatus')" :columns="statusList" keyName="name" @confirm="statusChange"></u-picker>
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.location')}}</view>
<view class="right select" @click="showlocation = true">
<input :placeholder="$t('carinfo.select')" disabled v-model="location" />
<u-picker :defaultIndex="defaultIndexl" :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showlocation" @cancel="cancel('showlocation')" :columns="locationList" keyName="name" @confirm="locationChange"></u-picker>
<uni-icons type="right" size="18" color="#747474"></uni-icons>
</view>
</view>
<view class="cell">
<view>{{$t('carinfo.mileage')}}</view>
<view class="right">
<input :placeholder="$t('carinfo.inputmileage')" type="digit" v-model="carinfo.mileage"/>
</view>
</view>
<view class="cell1">
<view>{{$t('carinfo.age')}}</view>
<view class="right">
<input :placeholder="$t('carinfo.inputage')" type="digit" v-model="carinfo.vehicle_age" />
</view>
</view>
</view>
<view class="zw"></view>
<view class="foot">
<button class="btn" @click="nextFn">{{$t('button.next')}}</button>
</view>
<u-popup closeOnClickOverlay :show="showbrand" mode="bottom" :round="10" @close="cancel('showbrand')">
<view class="text">
<view class="qx" @click="cancel('showbrand') ">{{$t('cancel')}}</view>
<view class="qd" @click="brandChange">{{$t('confirm')}}</view>
</view>
<view class="popup-content">
<!-- 搜索框 -->
<u-input
v-model="searchKeyword"
:placeholder="$t('keyword')"
@input="handleSearch"
></u-input>
<!-- 选项列表 -->
<scroll-view scroll-y class="option-list">
<view
v-for="(item, index) in filteredOptions"
:key="index"
class="option-item"
@click="handleSelect(item)"
:class="actives==item.id?'actives':''"
>
{{ item.name }}
</view>
<view v-if="filteredOptions.length === 0" class="no-data">
{{$t('noresults')}}
</view>
</scroll-view>
</view>
</u-popup>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
// import ldSelect from '@/components/ld-select/ld-select.vue'
export default {
data() {
return {
id:'',
imageStyles: {
width: 50,
height: 50,
},
i18locale:uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh',
actives:'',
searchKeyword: "", // 搜索关键词
selectedLabel: "", // 选中的值(显示在输入框中)
filteredOptions: [], // 过滤后的数据
brandList:[],
energyList:[],
typesList:[],
brandList1:[],
energyList1:[],
typesList1:[],
modelList:[],
locationList:[],
modelList1:[],
locationList1:[],
showbrand: false,
showtype: false,
showenergy: false,
showmodel: false,
showlocation: false,
showstatus: false,
defaultIndex1:[0],
defaultIndex2:[0],
defaultIndex3:[0],
defaultIndexm:[0],
defaultIndexl:[0],
defaultIndexs:[0],
brandname:'',
type:'',
energy:'',
statusList:[[{
name: this.$t('carinfo.in_stock'),
id: '1'
}, {
name: this.$t('carinfo.in_transit'),
id: '2'
},{
name: this.$t('carinfo.on_order'),
id: '3'
}]],
model:'',
location:'',
store_status:'',
carinfo:{
cover:'',
model:'',
location:'',
store_status:'',
name:'',
vin:'',
brand:'',
price:'',
type:'',
energy:'',
mileage :'',
vehicle_age:'',
condition_desc:'',
front_45_degree:'',
front_left_45_degree:'',
front_left_headlight:'',
front_view:'',
lower_front:'',
wheel_hub:'',
front_right_seat:'',
right_lower_side:'',
rear_right_taillight:'',
rear_right_45_degree:'',
lower_rear:'',
trunk:'',
left_lower_side:'',
rear_seats:'',
center_console:'',
control_panel:'',
gear_shift:'',
car_key:'',
steering_wheel:'',
dashboard:'',
odometer_reading:'',
front_left_door_panel:'',
front_left_door_function_area:'',
front_left_seat:'',
interior_ceiling:'',
}
}
},
onLoad(options) {
console.log(options);
this.getbrand()
this.getenergy()
this.gettypes()
this.getlocation()
this.id = options.id;
this.getcontList()
var that = this
},
methods: {
getbrand(){
request({
url:'brand',
method:'get',
data:{
language:this.i18locale
}
}).then(res => {
var list = res.data.data
this.brandList1= list;
this.filteredOptions = list;
this.brandList = [list]
})
},
getmodel(brand_id,items){
var that =this
that.model = ''
that.defaultIndexm=['']
request({
url:'models',
method:'get',
data:{
brand_id:brand_id
}
}).then(res => {
var list = res.data.data
this.modelList1 = list
this.modelList = [list]
if(items){
that.modelList1.forEach((item,index) => {
if(item.id == items){
that.model = item.name
that.defaultIndexm=[index]
}
})
}else{
if(list.length>0){
that.model = list[0].name
that.carinfo.model = list[0].id
}else{
that.model =''
that.carinfo.model =''
}
}
})
},
getenergy(){
request({
url:'energy',
method:'get',
data:{
language:this.i18locale
}
}).then(res => {
var list = res.data.data
this.energyList1= res.data.data
this.energyList = [list]
})
},
gettypes(){
request({
url:'types',
method:'get',
data:{
language:this.i18locale
}
}).then(res => {
var list = res.data.data
this.typesList1= res.data.data
this.typesList = [list]
})
},
getlocation(){
request({
url:'location/presets',
method:'get'
}).then(res => {
var list = res.data.data
this.locationList1 = list
this.locationList = [list]
})
},
// 搜索处理函数
handleSearch() {
if (this.searchKeyword) {
console.log(this.searchKeyword)
this.filteredOptions = this.brandList1.filter((item) =>
item.name.includes(this.searchKeyword)
);
console.log(this.filteredOptions)
} else {
// 如果搜索框为空,显示全部数据
this.filteredOptions = this.brandList1;
}
},
// 选择选项
handleSelect(item) {
this.selectedLabel = item.name; // 回显选中的值
// this.searchKeyword = item.name
this.actives = item.id
// this.showPicker = false; // 关闭弹窗
console.log("选中的值:", item.id);
console.log("选中的值:", item.name);
},
brandChange(){
this.carinfo.brand = this.actives
this.brandname = this.selectedLabel
this.showbrand = false
this.getmodel(this.actives)
},
energyChange(val){
this.carinfo.energy = val.value[0].id
this.energy = val.value[0].name
this.showenergy = false
},
typesChange(val){
this.carinfo.type = val.value[0].id
this.type = val.value[0].name
this.showtype = false
},
modelChange(val){
this.carinfo.model = val.value[0].id
this.model = val.value[0].name
this.showmodel = false
},
statusChange(val){
this.carinfo.store_status = val.value[0].id
this.store_status = val.value[0].name
this.showstatus = false
},
locationChange(val){
this.carinfo.location = val.value[0].id
this.location = val.value[0].name
this.showlocation = false
},
leftClick(){
uni.navigateBack({})
},
cancel(val){
this[val] = false
},
getcontList(){
var that = this;
request({
url:'draft/detail/'+this.id,
method:'get',
}).then(res => {
that.carinfo = res.data.data
this.actives = res.data.data.brand
this.getmodel(that.carinfo.brand,that.carinfo.model)
that.brandname = that.carinfo.brand_name
that.energy = that.carinfo.energy_name
that.type = that.carinfo.type_name
that.location = that.carinfo.location_name
var statusList = that.statusList[0]
statusList.forEach((item,index) => {
if(item.id == that.carinfo.store_status){
that.store_status = item.name
that.defaultIndexs=[index]
}
})
that.brandList1.forEach((item,index) => {
if(item.id == that.carinfo.brand){
that.defaultIndex1=[index]
}
})
that.energyList1.forEach((item,index) => {
if(item.energy_id == that.carinfo.energy){
that.defaultIndex3=[index]
}
})
that.typesList1.forEach((item,index) => {
if(item.energy_id == that.carinfo.type){
that.defaultIndex2=[index]
}
})
that.locationList1.forEach((item,index) => {
if(item.id == that.carinfo.location){
that.defaultIndexl=[index]
}
})
})
},
nextFn(){
const carinfo = JSON.stringify(this.carinfo);
uni.setStorageSync('newcarinfo', carinfo);
uni.navigateTo({
url: '/pages/mine/drafts/draftsDetil1?id='+this.id
});
}
}
}
</script>
<style lang="scss">
.zw{
height: 120px;
}
.uniui-right{
position: absolute;
top: 2px;
}
.content{
margin: 20px 12px;
background: #FFFFFF;
border-radius: 10px;
}
.red{
color: red;
}
.cell{
position: relative;
display: flex;
justify-content:space-between;
padding: 18px 20px;
/* border-bottom: 1px solid #C3C3C3; */
align-items: center;
font-weight: 500;
}
.cell::after{
content : '';
position : absolute;
width : 200%;
height : 200%;
top : 0;
left : 0;
transform-origin: 0 0;
border-width: 0;
border-bottom-width:1px;
border-style : solid;
transform : scale(0.5, 0.5);
border-radius : 1px;
box-sizing : border-box;
pointer-events : none;
border-color:#C3C3C3;
}
.cell1{
display: flex;
justify-content:space-between;
padding: 18px 20px;
align-items: center;
font-weight: 500;
}
.right{
text-align: right;
}
.select{
display: flex;
position: relative;
margin-right: 10px;
}
.foot{
position: fixed;
bottom: 0px;
width: 100%;
height: 240rpx;
background: #FFFFFF;
z-index: 2;
}
.btn{
background-color: #3F435B;
color: white;
border-radius: 50px;
width: 92%;
margin-bottom: 40px;
margin: 15px 4%;
}
.actives{
background-color: #dfdfdf;
}
.text{
display: flex;
align-items: center;
justify-content: space-between;
line-height: 30px;
padding: 10px 15px 0px;
.qd{
color: #3471FF;
}
}
.popup-content {
padding: 20px;
background-color: #fff;
}
.option-list {
max-height: 400rpx;
margin-top: 20rpx;
}
.option-item {
padding: 20rpx;
border-bottom: 1rpx solid #eee;
}
.option-item:last-child {
border-bottom: none;
}
.no-data {
text-align: center;
padding: 20rpx;
color: #999;
}
.addimg{
width: 50px;
height: 50px;
}
</style>
+664
View File
@@ -0,0 +1,664 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.carinfo')"></uni-nav-bar>
<view class="cont">
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.front45Degree')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select" @delete="delfn('front_45_degree')">
<image :src="carinfo.front_45_degree_full==''?'/static/image/img.png':carinfo.front_45_degree_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftFront45Degree')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select1" @delete="delfn('front_left_45_degree')">
<image :src="carinfo.front_left_45_degree_full==''?'/static/image/img.png':carinfo.front_left_45_degree_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftFrontHeadlight')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select2" @delete="delfn('front_left_headlight')">
<image :src="carinfo.front_left_headlight_full==''?'/static/image/img.png':carinfo.front_left_headlight_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.front')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select3" @delete="delfn('front_view')">
<image :src="carinfo.front_view_full==''?'/static/image/img.png':carinfo.front_view_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.frontLowerPart')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select4" @delete="delfn('lower_front')">
<image :src="carinfo.lower_front_full==''?'/static/image/img.png':carinfo.lower_front_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.wheelHub')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select5" @delete="delfn('wheel_hub')">
<image :src="carinfo.wheel_hub_full==''?'/static/image/img.png':carinfo.wheel_hub_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rightFrontSeat')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select6" @delete="delfn('front_right_seat')">
<image :src="carinfo.front_right_seat_full==''?'/static/image/img.png':carinfo.front_right_seat_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rightBottomEdge')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select7" @delete="delfn('right_lower_side')">
<image :src="carinfo.right_lower_side_full==''?'/static/image/img.png':carinfo.right_lower_side_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rightRearTaillight')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select8" @delete="delfn('rear_right_taillight')">
<image :src="carinfo.rear_right_taillight_full==''?'/static/image/img.png':carinfo.rear_right_taillight_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rightRear45Degree')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select9" @delete="delfn('rear_right_45_degree')">
<image :src="carinfo.rear_right_45_degree_full==''?'/static/image/img.png':carinfo.rear_right_45_degree_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rearLowerPart')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select10" @delete="delfn('lower_rear')">
<image :src="carinfo.lower_rear_full==''?'/static/image/img.png':carinfo.lower_rear_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.trunk')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select11" @delete="delfn('trunk')">
<image :src="carinfo.trunk_full==''?'/static/image/img.png':carinfo.trunk_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftBottomEdge')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select12" @delete="delfn('left_lower_side')">
<image :src="carinfo.left_lower_side_full==''?'/static/image/img.png':carinfo.left_lower_side_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.rearSeat')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select13" @delete="delfn('rear_seats')">
<image :src="carinfo.rear_seats_full==''?'/static/image/img.png':carinfo.rear_seats_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.console')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select14" @delete="delfn('center_console')">
<image :src="carinfo.center_console_full==''?'/static/image/img.png':carinfo.center_console_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.controlPanel')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select15" @delete="delfn('control_panel')">
<image :src="carinfo.control_panel_full==''?'/static/image/img.png':carinfo.control_panel_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.gearLever')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select16" @delete="delfn('gear_shift')">
<image :src="carinfo.gear_shift_full==''?'/static/image/img.png':carinfo.gear_shift_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.key')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select17" @delete="delfn('car_key')">
<image :src="carinfo.car_key_full==''?'/static/image/img.png':carinfo.car_key_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.steeringWheel')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select18" @delete="delfn('steering_wheel')">
<image :src="carinfo.steering_wheel_full==''?'/static/image/img.png':carinfo.steering_wheel_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.dashboard')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select19" @delete="delfn('dashboard')">
<image :src="carinfo.dashboard_full==''?'/static/image/img.png':carinfo.dashboard_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.displayedMileage')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select20" @delete="delfn('odometer_reading')">
<image :src="carinfo.odometer_reading_full==''?'/static/image/img.png':carinfo.odometer_reading_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftFrontDoorPanel')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select21" @delete="delfn('front_left_door_panel')">
<image :src="carinfo.front_left_door_panel_full==''?'/static/image/img.png':carinfo.front_left_door_panel_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftFrontDoorFunctionArea')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select22" @delete="delfn('front_left_door_function_area')">
<image :src="carinfo.front_left_door_function_area_full==''?'/static/image/img.png':carinfo.front_left_door_function_area_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.leftFrontSeat')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select23" @delete="delfn('front_left_seat')">
<image :src="carinfo.front_left_seat_full==''?'/static/image/img.png':carinfo.front_left_seat_full" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="content">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false">
<template v-slot:title>
<view class="con-title">
<text>{{$t('carinfo.ceiling')}}</text>
</view>
</template>
<view class="contents">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select24" @delete="delfn('interior_ceiling')">
<image :src="carinfo.interior_ceiling==''?'/static/image/img.png':carinfo.interior_ceiling" mode="" class="addimg"></image>
</uni-file-picker>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</view>
<view class="foot">
<view>
<button class="btn1" plain="true" @click="goFn">{{$t('button.previous')}}</button>
<button class="btn" @click="nextFn">{{$t('button.next')}}</button>
</view>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
carinfo:{},
}
},
onLoad(options) {
this.id = options.id;
const carinfo = uni.getStorageSync('newcarinfo');
this.carinfo = JSON.parse(carinfo);
// this.getcontList()
},
methods: {
getcontList(){
request({
url:'draft/detail/'+this.id,
method:'get',
}).then(res => {
this.carinfo = res.data.data.detail
})
},
uploadfn(imgUrl,name){
var that = this;
uni.uploadFile({
url: 'https://usedcar.server.hnxinyouhe.com/applet/upload/image',
filePath: imgUrl,
name: 'image',
header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
success: (uploadFileRes) => {
const path=JSON.parse(uploadFileRes.data)
that.carinfo[name] = path.data.image_name
console.log(that.carinfo)
}
});
},
delfn(name){
that.carinfo[name] =''
},
select(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_45_degree')
},
select1(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_left_45_degree')
},
select2(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_left_headlight')
},
select3(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_view')
},
select4(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'lower_front')
},
select5(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'wheel_hub')
},
select6(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_right_seat')
},
select7(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'right_lower_side')
},
select8(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'rear_right_taillight')
},
select9(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'rear_right_45_degree')
},
select10(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'lower_rear')
},
select11(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'trunk')
},
select12(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'left_lower_side')
},
select13(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'rear_seats')
},
select14(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'center_console')
},
select15(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'control_panel')
},
select16(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'gear_shift')
},
select17(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'car_key')
},
select18(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'steering_wheel')
},
select19(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'dashboard')
},
select20(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'odometer_reading')
},
select21(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_left_door_panel')
},
select22(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_left_door_function_area')
},
select23(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_left_seat')
},
select24(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'interior_ceiling')
},
leftClick(){
uni.navigateBack({})
},
goFn(){
uni.navigateBack({})
},
nextFn(){
const carinfo = JSON.stringify(this.carinfo);
uni.setStorageSync('newcarinfo', carinfo);
uni.navigateTo({
url: '/pages/mine/drafts/draftsDetil2?id='+this.id
});
}
}
}
</script>
<style>
.uni-file-picker {
margin-left: 33.3%;
}
.cont{
padding: 10px 0px 130px;
}
.content{
margin: 10px 12px;
background: #FFFFFF;
border-radius: 10px;
overflow: hidden;
}
.con-title{
padding: 18px 10px;
font-weight: 500;
}
.red{
color: red;
}
.contents{
padding:10px;
text-align: center;
}
.addimg{
width: 110px;
height:110px;
}
.caogao{
position: fixed;
right: 0px;
bottom: 280rpx;
}
.caogao image{
width: 64px;
height: 64px;
}
.foot{
position: fixed;
bottom: 0px;
width: 100%;
height: 240rpx;
background: #FFFFFF;
}
.foot view{
display: flex;
width: 94%;
margin: 15px 3%;
}
.btn{
background-color: #3F435B;
color: white;
border-radius: 50px;
margin-bottom: 40px;
margin-left: 2%;
flex-grow:1
}
.btn1{
border-color:#9E9E9E !important;
border-radius: 50px;
color: #414141;
margin-bottom: 40px;
width: 110px;
background-color: #fff;
}
</style>
+140
View File
@@ -0,0 +1,140 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.carinfo')"></uni-nav-bar>
<view class="content">
<view class="cont">{{$t('carinfo.mag')}}</view>
<view class="">
<textarea auto-height v-model="carinfo.condition_desc" :placeholder="$t('carinfo.maginput')"/>
</view>
</view>
<view class="foot">
<view>
<button class="btn1" plain="true" @click="leftClick">{{$t('button.previous')}}</button>
<button class="btn" @click="addFn">{{$t('button.submit')}}</button>
</view>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
carinfo:{},
}
},
onLoad(options) {
this.id = options.id;
const carinfo = uni.getStorageSync('newcarinfo');
this.carinfo = JSON.parse(carinfo);
this.carinfo .draft_id=this.id
},
methods: {
leftClick(){
uni.navigateBack({})
},
addFn(){
console.log(this.carinfo)
request({
url:'vehicle/add',
method:'post',
data:this.carinfo
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
if(res.data.code ==0){
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/mine',// 替换为你要跳转的页面路径
});
}, 1000);
}
})
}
}
}
</script>
<style lang="scss">
textarea {
min-height: 640rpx;// 设置默认高度 ,解决设置自适应高度之后高度无效问题
width: 100%;
}
.content{
margin: 20px 12px;
background: #FFFFFF;
border-radius: 10px;
.cont{
position: relative;
font-weight: 500;
}
.cont::after{
content : '';
position : absolute;
width : 200%;
height : 200%;
top : 0;
left : 0;
transform-origin: 0 0;
border-width: 0;
border-bottom-width:1px;
border-style : solid;
transform : scale(0.5, 0.5);
border-radius : 1px;
box-sizing : border-box;
pointer-events : none;
border-color:#C3C3C3;
}
}
.content view{
padding: 20px 10px;
}
.right{
text-align: right;
}
.select{
display: flex;
}
.caogao{
position: fixed;
right: 0px;
bottom: 280rpx;
}
.caogao image{
width: 64px;
height: 64px;
}
.foot{
position: fixed;
bottom: 0px;
width: 100%;
height: 240rpx;
background: #FFFFFF;
}
.foot view{
display: flex;
width: 94%;
margin: 15px 3%;
}
.btn{
background-color: #3F435B;
color: white;
border-radius: 50px;
margin-bottom: 40px;
margin-left: 2%;
flex-grow:1
}
.btn1{
border-color:#9E9E9E !important;
border-radius: 50px;
color: #414141;
margin-bottom: 40px;
width: 110px;
background-color: #fff;
}
</style>