feat: 新增内容

This commit is contained in:
admin 2024-09-24 15:45:18 +08:00
parent efb6d77ed0
commit 390ca4a892
21 changed files with 26219 additions and 805 deletions

View File

@ -0,0 +1,162 @@
<template>
<u-popup
:show="show"
mode="bottom"
:round="10"
:closeable="false"
@close="handleClose"
>
<view class="c-dialog">
<view class="confrim-box">
<text @click="cancel()">取消</text>
<text class="btn" @click="confirm()">完成</text>
</view>
<!-- :class="{ active: state.currentStates === item.id }" -->
<view class="box-btn">
<text
v-for="(item, index) in state.statusList"
:key="index"
@click="handleSelect(item)"
>{{ item.name }}</text
></view
>
<view class="timeBox">
<uni-datetime-picker
class="my-datetime-picker"
v-model="state.datetimerange"
type="datetimerange"
rangeSeparator="-"
/>
</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import { formatDate, timeRange } from "@/utils";
const props = defineProps<{
show: boolean;
}>();
const state = reactive<any>({
datetimerange: [],
startTime: "",
endTime: "",
currentStates: -1,
statusList: [
{
id: 1,
name: "今日",
},
{
id: 2,
name: "昨日",
},
{
id: 3,
name: "本月",
},
{
id: 4,
name: "本年",
},
],
});
const emit = defineEmits(["handleDialog", "changeTime"]);
const handleClose = () => {
emit("handleDialog", false);
};
const handleSelect = (item: any) => {
state.currentStates = item.id;
const range = timeRange(item.id);
state.startTime = range.startTime + ' 00:00:00';
state.endTime = range.endTime + ' 23:59:59';
state.datetimerange = [state.startTime, state.endTime]
};
const cancel = () => {
emit("handleDialog", false)
}
const confirm = () => {
emit("changeTime", {
startTime: state.datetimerange[0],
endTime: state.datetimerange[1],
name: "自定义",
});
emit("handleDialog", false);
};
</script>
<style lang="scss" scoped>
::v-deep .u-popup__content {
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 32rpx 32rpx 0rpx 0rpx;
}
.c-dialog {
margin: 22rpx;
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 26rpx;
color: #000000;
.box-btn,
.box {
line-height: 80rpx;
display: flex;
justify-content: space-between;
.btn {
font-weight: 500;
font-size: 26rpx;
color: $u-primary;
}
}
.box-btn {
line-height: 40rpx;
margin-bottom: 30rpx;
text {
font-weight: 400;
font-size: 26rpx;
color: #999999;
width: 140rpx;
background: #ffffff;
border-radius: 6rpx;
border: 1px solid rgba(153, 153, 153, 0.64);
text-align: center;
cursor: pointer;
}
.active {
border-color: $u-primary;
color: $u-primary;
}
}
.box-border {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
.line {
height: 18rpx;
background: #f8f8f8;
}
}
.confrim-box {
line-height: 80rpx;
display: flex;
justify-content: space-between;
.btn {
font-weight: 500;
font-size: 26rpx;
color: $u-primary;
}
}
.timeBox {
display: flex;
justify-content: center;
align-items: center;
text {
margin: 0rpx 22rpx;
}
}
</style>

View File

@ -0,0 +1,114 @@
<template>
<u-popup :show="show" mode="bottom" :round="10" :closeable="false" @close="handleClose">
<view class="c-dialog">
<view>
<view class="box">
<text @click="handleClose">取消</text>
<text class="btn" @click="handleOk">完成</text>
</view>
<uni-calendar
:insert="true"
:lunar="true"
:start-date="'2014-1-1'"
:end-date="'2099-1-1'"
:range="true"
@change="handleChangeDate"
/>
</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import { formatDate } from '@/utils';
const props = defineProps<{
show: boolean,
}>()
const beforeTime = ref(null)
const emit = defineEmits(['handleDialog', 'handleOk']);
const handleClose = () => {
emit('handleDialog', false)
}
const handleOk = () => {
emit('handleOk', {startTime: state.startTime || beforeTime.value, endTime: state.endTime || beforeTime.value})
emit('handleDialog', false)
}
const showCalendar = ref(false)
const state = reactive({
startTime: '',
endTime: ''
})
const handleChangeDate = (v: any) => {
const time1 = v.range.before;
const time2 = v.range.after;
beforeTime.value = time1
if (time1 && time2) {
const date1 = new Date(time1);
const date2 = new Date(time2);
if (date1 < date2) {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
} else if (date1 > date2) {
state.startTime = formatDate(time2, "{y}-{m}-{d}");
state.endTime = formatDate(time1, "{y}-{m}-{d}");
} else {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
}
}
};
</script>
<style lang="scss" scoped>
::v-deep .u-popup__content {
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 32rpx 32rpx 0rpx 0rpx;
}
.c-dialog {
margin: 30rpx;
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #000000;
.box-btn,
.box {
line-height: 80rpx;
display: flex;
justify-content: space-between;
}
.box-btn {
line-height: 40rpx;
margin-bottom: 30rpx;
text {
font-weight: 400;
font-size: 24rpx;
color: #999999;
width: 117rpx;
background: #ffffff;
border-radius: 6rpx;
border: 1px solid rgba(153, 153, 153, 0.64);
text-align: center;
cursor: pointer;
}
.active {
border-color: $u-primary;
color: $u-primary;
}
}
.btn {
font-weight: 500;
font-size: 24rpx;
color: $u-primary;
}
.box-border {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
.line {
height: 18rpx;
background: #f8f8f8;
}
}
</style>

View File

@ -0,0 +1,99 @@
<template>
<scroll-view
:scroll-y="true"
class="scroll-view-custom"
@scrolltolower="loadMore"
:style="{ height: clientHeight + 'px' }"
>
<slot> </slot>
<!-- 加载更多提示 -->
<view
v-if="noMoreData || isLoading"
class="no-more-data-text"
style="padding: 20rpx"
>
<u-loadmore
:status="isLoading ? 'loading' : 'nomore'"
:line="true"
:fontSize="12"
:marginTop="30"
/>
</view>
<view
v-if="!isLoading && list.length === 0"
style="justify-content: center; padding: 20rpx"
>
<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</u-empty>
</view>
</scroll-view>
</template>
<script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
const props = withDefaults(
defineProps<{
noMoreData: boolean;
isLoading: boolean;
list: any;
height: number;
}>(),
{
noMoreData: false,
isLoading: false,
list: [],
height: 80,
}
);
const emit = defineEmits(["loadList"]);
const clientHeight = ref(800);
const loadMore = () => {
console.log("**** 加载更多");
if (props.noMoreData) return; //
emit("loadList", true);
};
const getBarHeight = () => {
const res = uni.getSystemInfoSync();
if (res.platform === "ios" || res.osName === "ios") {
return 44;
} else if (res.platform === "android") {
return 48;
} else {
return 0;
}
};
//
const getClineHeight = () => {
uni.getSystemInfo({
success: (res) => {
console.log(res, getBarHeight())
clientHeight.value =
res.windowHeight - uni.upx2px(props.height);
},
});
};
watch(
() => props.height,
(newValue, oldValue) => {
getClineHeight();
}
);
// ,{ deep: true, immediate:true}
// onLoad(() => {
// });
// #ifdef MP-TOUTIAO || MP-WEIXIN || H5
getClineHeight();
// #endif
</script>
<style lang="scss">
.no-more-data-text {
font-size: 24rpx;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,339 @@
<template>
<view>
<!--自定义地址选择器-->
<view class="cc_area_mask" v-show="show == true"></view>
<view :class="'cc_area_view ' + (show ? 'show':'hide')">
<view class="cc_area_view_btns">
<text class="cc_area_view_btn_cancle" @tap="handleNYZAreaCancle">取消</text>
<text class="cc_area_view_btn_sure" @tap="handleNYZAreaSelect" :data-province="province"
:data-city="city" :data-area="area">确定</text>
</view>
<picker-view class="cc_area_pick_view" indicator-style="height: 35px;" @change="handleNYZAreaChange"
:value="value">
<picker-view-column>
<view v-for="(item, index) in provinces" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in citys" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in areas" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</template>
<script>
import {getProvinces,getMyCity,getAreas,getAreasCode} from "./area.js"
let index = [0, 0, 0];
let provinces = getProvinces();
let citys = getMyCity(index[0]);
let areas = getMyCity(index[0], index[1]);
export default {
mixins: [{
methods: {
setData: function(obj, callback) {
let that = this;
const handleData = (tepData, tepKey, afterKey) => {
tepKey = tepKey.split('.');
tepKey.forEach(item => {
if (tepData[item] === null || tepData[item] === undefined) {
let reg = /^[0-9]+$/;
tepData[item] = reg.test(afterKey) ? [] : {};
tepData = tepData[item];
} else {
tepData = tepData[item];
}
});
return tepData;
};
const isFn = function(value) {
return typeof value == 'function' || false;
};
Object.keys(obj).forEach(function(key) {
let val = obj[key];
key = key.replace(/\]/g, '').replace(/\[/g, '.');
let front, after;
let index_after = key.lastIndexOf('.');
if (index_after != -1) {
after = key.slice(index_after + 1);
front = handleData(that, key.slice(0, index_after), after);
} else {
after = key;
front = that;
}
if (front.$data && front.$data[after] === undefined) {
Object.defineProperty(front, after, {
get() {
return front.$data[after];
},
set(newValue) {
front.$data[after] = newValue;
that.$forceUpdate();
},
enumerable: true,
configurable: true
});
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
} else {
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
}
});
isFn(callback) && this.$nextTick(callback);
}
}
}],
data() {
return {
provinces: getProvinces(),
citys: getMyCity(index[0]),
areas: getAreas(index[0], index[1]),
value: [0, 0, 0]
};
},
components: {},
props: {
//
province: {
//area_select
type: String,
default: ''
},
//
city: {
//area_select
type: String,
default: ''
},
//
area: {
//area_select
type: String,
default: ''
},
show: {
//area_select
type: Boolean,
default: false
},
maskShow: {
//
type: Boolean,
default: true
}
},
watch: {
province() {
this.init();
},
city() {
this.init();
},
area() {
this.init();
}
},
mounted() {
// let provinceIndex = this.provinces.indexOf(this.province);
// this.citys = getMyCity(provinceIndex);
// let cityIndex = this.citys.indexOf(this.city);
// this.areas = getAreas(provinceIndex, cityIndex);
// let areaIndex = this.areas.indexOf(this.area);
// //
// this.value = [provinceIndex, cityIndex, areaIndex];
// let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
this.init();
//console.log(areaCode)
//console.log("this.value = " + JSON.stringify(this.value));
},
methods: {
init() {
//console.log(this.area)
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
//
this.value = [provinceIndex, cityIndex, areaIndex];
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
},
handleNYZAreaChange: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
var value = e.detail.value;
/**
* 滚动的是省
* 省改变 区都不变
*/
if (index[0] != value[0]) {
index = [value[0], 0, 0];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], 0);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], 0, 0],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],areaCode);
} else if (index[1] != value[1]) {
/**
* 市改变了 省不变 区变
*/
index = [value[0], value[1], 0];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], index[1], 0],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],areaCode);
} else if (index[2] != value[2]) {
/**
* 区改变了
*/
index = [value[0], value[1], value[2]];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], index[1], index[2]],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],areaCode);
}
},
/**
* 确定按钮的点击事件
*/
handleNYZAreaSelect: function(e) {
var myEventDetail = e; // detail
var myEventOption = {}; //
this.$emit('sureSelectArea', {
detail: myEventDetail
}, myEventOption);
index = [0, 0, 0];
},
/**
* 取消按钮的点击事件
*/
handleNYZAreaCancle: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
this.$emit('hideShow', {
detail: false
});
//
index = [0, 0, 0];
}
}
};
</script>
<style scoped lang="scss">
.cc_area_view {
width: 100%;
position: fixed;
bottom: -1000px;
left: 0px;
background-color: #fff;
z-index: 21;
transition: all 0.3s;
}
.cc_area_pick_view {
height: 400px;
width: 100%;
}
.cc_area_colum_view {
line-height: 35px;
text-align: center;
font-size: 28upx;
}
.hide {
bottom: -1000upx;
transition: all 0.3s;
}
.show {
bottom: 0upx;
transition: all 0.3s;
}
.cc_area_view_btns {
background-color: #fff;
border-bottom: 1px solid #eeeeee;
font-size: 30upx;
padding: 18upx 0upx;
}
.cc_area_view_btns>text {
display: inline-block;
word-spacing: 4upx;
letter-spacing: 4upx;
}
.cc_area_view_btn_cancle {
color: #939393;
padding-right: 20upx;
padding-left: 25upx;
}
.cc_area_view_btn_sure {
float: right;
padding-left: 20upx;
padding-right: 25upx;
}
.cc_area_mask {
width: 100%;
height: 100vh;
background-color: rgba(28, 28, 28, 0.6);
position: absolute;
top: 0upx;
left: 0upx;
z-index: 20;
}
</style>

View File

@ -0,0 +1,332 @@
<template>
<view>
<!--自定义地址选择器-->
<view class="cc_area_mask" v-show="show == true"></view>
<view :class="'cc_area_view ' + (show ? 'show':'hide')">
<view class="cc_area_view_btns">
<text class="cc_area_view_btn_cancle" @tap="handleNYZAreaCancle">取消</text>
<text class="cc_area_view_btn_title" style="color: #393939;font-size: 32upx;">地区选择</text>
<text class="cc_area_view_btn_sure" @tap="handleNYZAreaSelect" :data-province="province"
:data-city="city" :data-area="area" style="color: #4284e5;">确定</text>
</view>
<picker-view class="cc_area_pick_view" indicator-style="height: 35px;" @change="handleNYZAreaChange"
:value="value">
<picker-view-column>
<view v-for="(item, index) in provinces" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in citys" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in areas" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</template>
<script>
import {
getProvinces,
getMyCity,
getAreas,
getAreasCode
} from "./area.js"
let index = [0, 0, 0];
let provinces = getProvinces();
let citys = getMyCity(index[0]);
let areas = getMyCity(index[0], index[1]);
export default {
mixins: [{
methods: {
setData: function(obj, callback) {
let that = this;
const handleData = (tepData, tepKey, afterKey) => {
tepKey = tepKey.split('.');
tepKey.forEach(item => {
if (tepData[item] === null || tepData[item] === undefined) {
let reg = /^[0-9]+$/;
tepData[item] = reg.test(afterKey) ? [] : {};
tepData = tepData[item];
} else {
tepData = tepData[item];
}
});
return tepData;
};
const isFn = function(value) {
return typeof value == 'function' || false;
};
Object.keys(obj).forEach(function(key) {
let val = obj[key];
key = key.replace(/\]/g, '').replace(/\[/g, '.');
let front, after;
let index_after = key.lastIndexOf('.');
if (index_after != -1) {
after = key.slice(index_after + 1);
front = handleData(that, key.slice(0, index_after), after);
} else {
after = key;
front = that;
}
if (front.$data && front.$data[after] === undefined) {
Object.defineProperty(front, after, {
get() {
return front.$data[after];
},
set(newValue) {
front.$data[after] = newValue;
that.$forceUpdate();
},
enumerable: true,
configurable: true
});
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
} else {
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
}
});
isFn(callback) && this.$nextTick(callback);
}
}
}],
data() {
return {
provinces: getProvinces(),
citys: getMyCity(index[0]),
areas: getAreas(index[0], index[1]),
value: [0, 0, 0]
};
},
components: {},
props: {
//
province: {
//area_select
type: String,
default: ''
},
//
city: {
//area_select
type: String,
default: ''
},
//
area: {
//area_select
type: String,
default: ''
},
show: {
//area_select
type: Boolean,
default: false
},
maskShow: {
//
type: Boolean,
default: true
}
},
watch: {
province() {
this.init();
},
city() {
this.init();
},
area() {
this.init();
}
},
mounted() {
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
//
this.value = [provinceIndex, cityIndex, areaIndex];
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
//console.log(areaCode)
//console.log("this.value = " + JSON.stringify(this.value));
},
methods: {
init() {
//console.log(this.area)
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
//
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
//
this.value = [provinceIndex, cityIndex, areaIndex];
},
handleNYZAreaChange: function(e) {
var that = this;
var value = e.detail.value;
// index
index = value;
//
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], index[1]);
// setData
that.setData({
citys: selectCitys,
areas: selectAreas,
value: index
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
//
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]], areaCode);
},
/**
* 确定按钮的点击事件
*/
handleNYZAreaSelect: function(e) {
var myEventDetail = e;
var myEventOption = {};
this.$emit('sureSelectArea', {
detail: myEventDetail
}, myEventOption);
//
index = [0, 0, 0];
},
handleNYZAreaCancle: function(e) {
var that = this;
this.$emit('hideShow', {
detail: false
});
//
index = [0, 0, 0];
}
},
/**
* 取消按钮的点击事件
*/
handleNYZAreaCancle: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
this.$emit('hideShow', {
detail: false
});
//
index = [0, 0, 0];
}
}
</script>
<style scoped lang="scss">
.cc_area_view {
width: 100%;
position: fixed;
bottom: -1000px;
left: 0px;
background-color: #fff;
z-index: 21;
transition: all 0.3s;
}
.cc_area_pick_view {
height: 400px;
width: 100%;
}
.cc_area_colum_view {
line-height: 35px;
text-align: center;
font-size: 28upx;
}
.hide {
bottom: -1000upx;
transition: all 0.3s;
}
.show {
bottom: 0upx;
transition: all 0.3s;
}
.cc_area_view_btns {
background-color: #fff;
border-bottom: 1px solid #eeeeee;
font-size: 30upx;
padding: 18upx 0upx;
display: flex;
justify-content: space-between;
}
.cc_area_view_btns>text {
display: inline-block;
word-spacing: 4upx;
letter-spacing: 4upx;
}
.cc_area_view_btn_cancle {
color: #939393;
padding-right: 20upx;
padding-left: 25upx;
}
.cc_area_view_btn_sure {
float: right;
padding-left: 20upx;
padding-right: 25upx;
}
.cc_area_mask {
width: 100%;
height: 100vh;
background-color: rgba(28, 28, 28, 0.6);
position: absolute;
top: 0upx;
left: 0upx;
z-index: 20;
}
</style>

View File

@ -149,6 +149,18 @@
"style": { "style": {
"navigationBarTitleText": "订单详情" "navigationBarTitleText": "订单详情"
} }
},
{
"path": "battery/index",
"style": {
"navigationBarTitleText": "报废电池回收"
}
},
{
"path": "battery/detail",
"style": {
"navigationBarTitleText": "订单详情"
}
} }
] ]
} }

View File

@ -98,7 +98,7 @@ const entryItemList = ref([
{ {
path: "2.png", path: "2.png",
name: "电池回收", name: "电池回收",
url: "/pagesBattery/index", url: "/pagesOrder/battery/index",
}, },
{ {
path: "3.png", path: "3.png",

View File

@ -0,0 +1,250 @@
<template>
<view class="detail">
<!-- 订单状态0已取消1待登记2待处理3待上门4待打款5已完结 -->
<block v-for="(item, value) in listMap" :key="value">
<view v-if="statusInfo[model1.status].indexOf(value) > -1">
<view>
<view class="title">{{ item.name }}</view>
<view class="content">
<view v-for="(iitem, index) in item.attrList" :key="index">
{{ iitem.name }}:
<view v-if="iitem.name === '行驶证'" class="license">
<up-row customStyle="flex-wrap: wrap" :gutter="8">
<up-col span="6">
<view class="grid-item">
<image
v-if="model1.formData[iitem.key]"
:src="model1.formData[iitem.key]"
:mode="'widthFix'"
:width="'100%'"
></image>
</view>
</up-col>
<up-col span="6">
<view class="grid-item">
<image
v-if="model1.formData['licenseBackUrl']"
:src="model1.formData['licenseBackUrl']"
:mode="'widthFix'"
:width="'100%'"
></image>
</view>
</up-col>
</up-row>
<view> </view>
</view>
<text v-else
>{{ model1.formData[iitem.key] || "-" }} {{ iitem.unit }}</text
>
</view></view
>
</view>
</view>
</block>
</view>
</template>
<script setup lang="ts">
import { VehicleApi } from "@/services";
import { onLoad } from "@dcloudio/uni-app";
import { reactive } from "vue";
const model1 = reactive<any>({
formData: {},
status: 0,
});
const statusInfo = reactive<any>({
0: ["regis", "car", "vehicle"],
1: ["vehicle"],
2: ["regis", "car", "vehicle"],
3: ["room", "regis", "car", "vehicle"],
4: ["settle", "room", "regis", "car", "vehicle"],
5: ["payment", "settle", "room", "regis", "car", "vehicle"],
});
const listMap = reactive<any>({
payment: {
name: "打款信息",
attrList: [
{
name: "打款时间",
value: "",
key: "paymentTime",
unit: "",
},
{
name: "打款金额",
value: "",
key: "paymentPrice",
unit: "元",
},
],
},
settle: {
name: "结算信息",
attrList: [
{
name: "过磅重量",
value: "",
key: "netWeight",
unit: "KG",
},
{
name: "结算金额",
value: "",
key: "paymentPrice",
unit: "元",
},
],
},
room: {
name: "上门服务",
attrList: [
{
name: "上门时间",
value: "",
key: "upDoorTime",
},
],
},
regis: {
name: "登记信息",
attrList: [
{
name: "车辆所属",
value: "",
key: "ownerType",
},
{
name: "联系人",
value: "",
key: "owner_name",
},
{
name: "联系方式",
value: "",
key: "owner_phone",
},
{
name: "上门地址",
value: "",
key: "location",
},
],
},
car: {
name: "我要选新车",
attrList: [
{
name: "选择品牌",
value: "",
key: "brandName",
},
{
name: "预算范围",
value: "",
key: "budgetRange",
},
],
},
vehicle: {
name: "车辆信息",
attrList: [
{
name: "行驶证",
value: "",
key: "licensePhotoUrl",
},
{
name: "车辆类型",
value: "",
key: "vehicleType",
},
{
name: "燃油类别",
value: "",
key: "fuelType",
},
{
name: "钢圈材质",
value: "",
key: "wheelMaterial",
},
{
name: "整车质量",
value: "",
key: "curbWeight",
unit: "KG",
},
{
name: "车架号",
value: "",
key: "vin",
},
{
name: "品牌型号",
value: "",
key: "brandModel",
},
{
name: "系列",
value: "",
key: "series",
},
{
name: "总重量",
value: "",
key: "totalWeight",
unit: "KG",
},
{
name: "车牌号",
value: "",
key: "licensePlate",
},
],
},
});
onLoad((option: any) => {
//
if (option.id) {
model1.formData.id = option.id;
model1.status = option.status;
VehicleApi.getDetail({ id: option.id }).then((res: any) => {
if (res.code === 200) {
model1.formData = {
...res.data,
ownerType: res.data.ownerType ? "单位" : "个人",
};
}
});
}
});
</script>
<style lang="scss" scoped>
.detail {
padding: 40rpx;
font-size: 32rpx;
.title {
font-weight: bold;
font-size: 34rpx;
line-height: 80rpx;
}
.content {
> view {
line-height: 60rpx;
}
.license {
.grid-item {
position: relative;
padding: 10rpx;
image {
width: 100% !important;
}
}
}
}
}
</style>

View File

@ -0,0 +1,288 @@
<template>
<view>
<view class="filter">
<view @click="handleSort"
>创建时间<u-icon :name="state.isUp ? 'arrow-up' : 'arrow-down'"></u-icon
></view>
<view @click="state.isShowStatus = true"
>状态<u-icon name="arrow-down"></u-icon
></view>
<view style="width: 65%" @click="state.showTime = true">
<u-input
v-model="state.startTime"
disabled
disabledColor=""
placeholder="开始时间"
></u-input>
<text>-</text>
<u-input
v-model="state.endTime"
disabled
disabledColor=""
placeholder="结束时间"
></u-input>
<u-icon name="arrow-down"></u-icon>
</view>
</view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="204"
:isLoading="pageList.isLoading"
>
<view class="box">
<scroll-view scroll-x class="scroll-view">
<uni-table stripe emptyText="">
<!-- 表头行 -->
<uni-tr>
<uni-th v-for="(item, index) in tableTitleList" :key="index"
>{{ item.name }}
</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item, index) in pageList.list" :key="index">
<uni-td v-for="(tItem, index) in tableTitleList" :key="index">
<view @click="goDetail(item)">
<text v-if="tItem.key === 'status'">
{{ ['已取消', '待登记', '待处理', '待上门', '待打款', '已完结'][item[tItem.key]] }}
</text>
<text v-else>
{{ item[tItem.key] }}
</text>
</view></uni-td
>
</uni-tr>
</uni-table>
</scroll-view>
</view>
</page-view>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="goInquiry()"
>去询价</u-button
>
</view>
</view>
<!-- 状态 -->
<u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
:actions="actionSheet.statusList"
:title="'单据状态'"
:show="state.isShowStatus"
@select="handleSelectStatus"
@close="state.isShowStatus = false"
></u-action-sheet>
<TimeRangeFilter
:show="state.showTime"
@handleDialog="(v:boolean) => {state.showTime = v}"
@handleOk="changeTime"
/>
</view>
</template>
<script setup lang="ts">
import PageView from "@/components/PageView/index.vue";
import TimeRangeFilter from "@/components/Dialog/TimeRangeFilter.vue";
import { VehicleApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const state = reactive({
startTime: "",
endTime: "",
showTime: false,
status: -1,
isShowStatus: false,
isUp: false,
});
const pageList: PageResult<any> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 100;
};
const tableTitleList = reactive([
{
name: "时间",
key: "createdTime",
},
{
name: "状态",
key: "status",
},
{
name: "品牌型号",
key: "brandModel",
},
{
name: "总重量",
key: "totalWeight",
},
{
name: "预估价格",
key: "totalPrice",
},
{
name: "过磅重量",
key: "netWeight",
},
{
name: "实际价格",
key: "paymentPrice",
},
]);
const actionSheet = reactive({
statusList: [
{
name: "全部",
key: -1,
},
{
name: "已取消",
key: 0,
},
{
name: "待登记",
key: 1,
},
{
name: "待处理",
key: 2,
},
{
name: "待上门",
key: 3,
},
{
name: "待打款",
key: 4,
},
{
name: "已完结",
key: 5,
},
],
});
const changeTime = (obj: any) => {
state.startTime = obj.startTime;
state.endTime = obj.endTime;
resetPageList();
getList();
};
const handleSelectStatus = (v: any) => {
state.isShowStatus = false;
state.status = v.key;
resetPageList();
getList();
};
const handleSort = () => {
state.isUp = !state.isUp;
resetPageList();
getList();
};
const goInquiry = () => {
uni.navigateTo({
url: "/pagesVehicle/inquiry", //
});
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
};
if (state.status > -1) {
params.status = state.status;
}
if (state.startTime && state.endTime) {
params.startTime = state.startTime;
params.endTime = state.endTime;
}
if (state.isUp) {
params.isUp = state.isUp;
}
pageList.isLoading = true;
VehicleApi.getRegisList(params).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
pageList.list = pageList.list = pageList.list.concat(res.data.list);
pageList.total = res.data.total;
}
});
};
function goDetail(item: any) {
uni.navigateTo({
url: "/pagesOrder/vehicle/detail?id=" + item.id + `&status=${item.status}`,
});
}
getList();
</script>
<style lang="scss" scoped>
.filter {
display: flex;
justify-content: space-around;
font-size: 28rpx;
padding: 10rpx 20rpx;
> view {
display: flex;
align-items: center;
}
::v-deep.u-input__content__field-wrapper__field {
font-size: 14px !important;
}
}
.box {
padding: 28rpx 20rpx;
.scroll-view {
white-space: nowrap;
width: 100%;
overflow: auto;
}
::v-deep.uni-table {
min-width: 700px !important;
}
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
.regis {
font-size: 12px;
text-align: center;
padding-top: 15px;
width: 100% !important;
color: $u-primary;
font-weight: bold;
}
</style>

View File

@ -1,155 +1,250 @@
<template> <template>
<view> <view class="detail">
<view></view> <!-- 订单状态0已取消1待登记2待处理3待上门4待打款5已完结 -->
<block v-for="(item, value) in listMap" :key="value">
<view v-if="statusInfo[model1.status].indexOf(value) > -1">
<view>
<view class="title">{{ item.name }}</view>
<view class="content">
<view v-for="(iitem, index) in item.attrList" :key="index">
{{ iitem.name }}:
<view v-if="iitem.name === '行驶证'" class="license">
<up-row customStyle="flex-wrap: wrap" :gutter="8">
<up-col span="6">
<view class="grid-item">
<image
v-if="model1.formData[iitem.key]"
:src="model1.formData[iitem.key]"
:mode="'widthFix'"
:width="'100%'"
></image>
</view>
</up-col>
<up-col span="6">
<view class="grid-item">
<image
v-if="model1.formData['licenseBackUrl']"
:src="model1.formData['licenseBackUrl']"
:mode="'widthFix'"
:width="'100%'"
></image>
</view>
</up-col>
</up-row>
<view> </view>
</view>
<text v-else
>{{ model1.formData[iitem.key] || "-" }} {{ iitem.unit }}</text
>
</view></view
>
</view>
</view>
</block>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue'; import { VehicleApi } from "@/services";
import { onLoad } from "@dcloudio/uni-app";
const listMap = reactive({ import { reactive } from "vue";
const model1 = reactive<any>({
formData: {},
status: 0,
});
const statusInfo = reactive<any>({
0: ["regis", "car", "vehicle"],
1: ["vehicle"],
2: ["regis", "car", "vehicle"],
3: ["room", "regis", "car", "vehicle"],
4: ["settle", "room", "regis", "car", "vehicle"],
5: ["payment", "settle", "room", "regis", "car", "vehicle"],
});
const listMap = reactive<any>({
payment: { payment: {
name: '打款信息', name: "打款信息",
attrList: [ attrList: [
{ {
name: '打款时间', name: "打款时间",
value: '', value: "",
key: '' key: "paymentTime",
unit: "",
}, },
{ {
name: '打款金额', name: "打款金额",
value: '', value: "",
key: '', key: "paymentPrice",
unit: '元' unit: "元",
} },
] ],
}, },
settle: { settle: {
name: '结算信息', name: "结算信息",
attrList: [ attrList: [
{ {
name: '过磅重量', name: "过磅重量",
value: '', value: "",
key: '', key: "netWeight",
unit: 'KG' unit: "KG",
}, },
{ {
name: '结算金额', name: "结算金额",
value: '', value: "",
key: '', key: "paymentPrice",
unit: '元' unit: "元",
} },
] ],
}, },
room: { room: {
name: '上门服务', name: "上门服务",
attrList: [ attrList: [
{ {
name: '上门时间', name: "上门时间",
value: '', value: "",
key: '' key: "upDoorTime",
} },
] ],
}, },
regis: { regis: {
name: '登记信息', name: "登记信息",
attrList: [ attrList: [
{ {
name: '车辆所属', name: "车辆所属",
value: '', value: "",
key: '' key: "ownerType",
}, },
{ {
name: '联系人', name: "联系人",
value: '', value: "",
key: '' key: "owner_name",
}, },
{ {
name: '联系方式', name: "联系方式",
value: '', value: "",
key: '' key: "owner_phone",
}, },
{ {
name: '上门地址', name: "上门地址",
value: '', value: "",
key: '' key: "location",
} },
] ],
}, },
car: { car: {
name: '我要选新车', name: "我要选新车",
attrList: [ attrList: [
{ {
name: '选择品牌', name: "选择品牌",
value: '', value: "",
key: '' key: "brandName",
}, },
{ {
name: '预算范围', name: "预算范围",
value: '', value: "",
key: '' key: "budgetRange",
} },
] ],
}, },
vehicle: { vehicle: {
name: '车辆信息', name: "车辆信息",
attrList: [ attrList: [
{ {
name: '行驶证', name: "行驶证",
value: '', value: "",
key: '' key: "licensePhotoUrl",
}, },
{ {
name: '车辆类型', name: "车辆类型",
value: '', value: "",
key: '' key: "vehicleType",
}, },
{ {
name: '燃油类别', name: "燃油类别",
value: '', value: "",
key: '' key: "fuelType",
}, },
{ {
name: '钢圈材质', name: "钢圈材质",
value: '', value: "",
key: '' key: "wheelMaterial",
}, },
{ {
name: '整车质量', name: "整车质量",
value: '', value: "",
key: '', key: "curbWeight",
unit: 'KG' unit: "KG",
}, },
{ {
name: '车架号', name: "车架号",
value: '', value: "",
key: '' key: "vin",
}, },
{ {
name: '品牌型号', name: "品牌型号",
value: '', value: "",
key: '' key: "brandModel",
}, },
{ {
name: '系列', name: "系列",
value: '', value: "",
key: '' key: "series",
}, },
{ {
name: '总重量', name: "总重量",
value: '', value: "",
key: '', key: "totalWeight",
unit: 'KG' unit: "KG",
}, },
{ {
name: '车牌号', name: "车牌号",
value: '', value: "",
key: '' key: "licensePlate",
} },
] ],
}, },
}) });
onLoad((option: any) => {
//
if (option.id) {
model1.formData.id = option.id;
model1.status = option.status;
VehicleApi.getDetail({ id: option.id }).then((res: any) => {
if (res.code === 200) {
model1.formData = {
...res.data,
ownerType: res.data.ownerType ? "单位" : "个人",
};
}
});
}
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> .detail {
padding: 40rpx;
font-size: 32rpx;
.title {
font-weight: bold;
font-size: 34rpx;
line-height: 80rpx;
}
.content {
> view {
line-height: 60rpx;
}
.license {
.grid-item {
position: relative;
padding: 10rpx;
image {
width: 100% !important;
}
}
}
}
}
</style>

View File

@ -1,85 +1,276 @@
<template> <template>
<view> <view>
<view> <view class="filter">
<view @click="handleSort"
</view> >创建时间<u-icon :name="state.isUp ? 'arrow-up' : 'arrow-down'"></u-icon
<view class="box"> ></view>
<uni-table stripe emptyText="暂无订单数据"> <view @click="state.isShowStatus = true"
<!-- 表头行 --> >状态<u-icon name="arrow-down"></u-icon
<uni-tr> ></view>
<uni-th v-for="(item, index) in tableTitleList" :key="index" <view style="width: 65%" @click="state.showTime = true">
>{{ item.name }} <u-input
</uni-th> v-model="state.startTime"
</uni-tr> disabled
<!-- 表格数据行 --> disabledColor=""
<uni-tr v-for="(item, index) in []" :key="index"> placeholder="开始时间"
<uni-td v-for="(tItem, index) in tableTitleList" :key="index">{{ ></u-input>
item[tItem.key] <text>-</text>
}}</uni-td> <u-input
</uni-tr> v-model="state.endTime"
</uni-table> disabled
</view> disabledColor=""
<view class="btn-box-fix-btn"> placeholder="结束时间"
<view ></u-input>
><u-button type="primary" shape="circle" @click="goInquiry()">去询价</u-button> <u-icon name="arrow-down"></u-icon>
</view> </view>
</view> </view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="204"
:isLoading="pageList.isLoading"
>
<view class="box">
<scroll-view scroll-x class="scroll-view">
<uni-table stripe emptyText="">
<!-- 表头行 -->
<uni-tr>
<uni-th v-for="(item, index) in tableTitleList" :key="index"
>{{ item.name }}
</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item, index) in pageList.list" :key="index">
<uni-td v-for="(tItem, index) in tableTitleList" :key="index">
<view @click="goDetail(item)">
<text v-if="tItem.key === 'status'">
{{ ['已取消', '待登记', '待处理', '待上门', '待打款', '已完结'][item[tItem.key]] }}
</text>
<text v-else>
{{ item[tItem.key] }}
</text>
</view></uni-td
>
</uni-tr>
</uni-table>
</scroll-view>
</view>
</page-view>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="goInquiry()"
>去询价</u-button
>
</view>
</view>
<!-- 状态 -->
<u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
:actions="actionSheet.statusList"
:title="'单据状态'"
:show="state.isShowStatus"
@select="handleSelectStatus"
@close="state.isShowStatus = false"
></u-action-sheet>
<TimeRangeFilter
:show="state.showTime"
@handleDialog="(v:boolean) => {state.showTime = v}"
@handleOk="changeTime"
/>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import PageView from "@/components/PageView/index.vue";
import TimeRangeFilter from "@/components/Dialog/TimeRangeFilter.vue";
import { VehicleApi } from "@/services"; import { VehicleApi } from "@/services";
import pinia from "@/store"; import pinia from "@/store";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
const state = reactive({
startTime: "",
endTime: "",
showTime: false,
status: -1,
isShowStatus: false,
isUp: false,
});
const pageList: PageResult<any> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 100;
};
const tableTitleList = reactive([ const tableTitleList = reactive([
{ {
name: "时间", name: "时间",
key: "paymentName", key: "createdTime",
}, },
{ {
name: "状态", name: "状态",
key: "paymentPrice", key: "status",
}, },
{ {
name: "品牌型号", name: "品牌型号",
key: "revenuePrice", key: "brandModel",
}, },
{ {
name: "总重量", name: "总重量",
key: "revenuePrice", key: "totalWeight",
}, },
{ {
name: "预估价格", name: "预估价格",
key: "revenuePrice", key: "totalPrice",
}, },
{ {
name: "过磅重量", name: "过磅重量",
key: "revenuePrice", key: "netWeight",
}, },
{ {
name: "实际价格", name: "实际价格",
key: "revenuePrice", key: "paymentPrice",
}, },
]); ]);
// VehicleApi.queryRegis({ const actionSheet = reactive({
// startTime: "2024-09-01 00:00:00", statusList: [
// endTime: "2024-09-30 23:59:59", {
// }).then((res:any) => { name: "全部",
// if(res.code === 200) { key: -1,
// res.data.list },
// } {
// }); name: "已取消",
key: 0,
},
{
name: "待登记",
key: 1,
},
{
name: "待处理",
key: 2,
},
{
name: "待上门",
key: 3,
},
{
name: "待打款",
key: 4,
},
{
name: "已完结",
key: 5,
},
],
});
const changeTime = (obj: any) => {
state.startTime = obj.startTime;
state.endTime = obj.endTime;
resetPageList();
getList();
};
const handleSelectStatus = (v: any) => {
state.isShowStatus = false;
state.status = v.key;
resetPageList();
getList();
};
const handleSort = () => {
state.isUp = !state.isUp;
resetPageList();
getList();
};
const goInquiry = () => { const goInquiry = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pagesVehicle/inquiry', // url: "/pagesVehicle/inquiry", //
});
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
};
if (state.status > -1) {
params.status = state.status;
}
if (state.startTime && state.endTime) {
params.startTime = state.startTime;
params.endTime = state.endTime;
}
if (state.isUp) {
params.isUp = state.isUp;
}
pageList.isLoading = true;
VehicleApi.getRegisList(params).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
pageList.list = pageList.list = pageList.list.concat(res.data.list);
pageList.total = res.data.total;
}
});
};
function goDetail(item: any) {
uni.navigateTo({
url: "/pagesOrder/vehicle/detail?id=" + item.id + `&status=${item.status}`,
}); });
} }
getList();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.filter {
display: flex;
justify-content: space-around;
font-size: 28rpx;
padding: 10rpx 20rpx;
> view {
display: flex;
align-items: center;
}
::v-deep.u-input__content__field-wrapper__field {
font-size: 14px !important;
}
}
.box {
padding: 28rpx 20rpx;
.scroll-view {
white-space: nowrap;
width: 100%;
overflow: auto;
}
::v-deep.uni-table {
min-width: 700px !important;
}
}
.btn-box-fix-btn { .btn-box-fix-btn {
justify-content: center; justify-content: center;
view { view {

View File

@ -5,7 +5,6 @@
:border="false" :border="false"
> >
<view class="uni-card__content"> <view class="uni-card__content">
<view class="title">车辆信息</view>
<u-form <u-form
labelPosition="left" labelPosition="left"
:model="model1" :model="model1"
@ -15,6 +14,7 @@
:labelStyle="{ padding: '0rpx 10rpx' }" :labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'" :errorType="'border-bottom'"
> >
<view class="title">车辆信息</view>
<view v-for="(item, index) in formAttrList" :key="index"> <view v-for="(item, index) in formAttrList" :key="index">
<u-form-item <u-form-item
v-if="item.name !== '行驶证'" v-if="item.name !== '行驶证'"
@ -65,9 +65,9 @@
</u-form-item> </u-form-item>
<view v-else-if="item.name === '行驶证'"> <view v-else-if="item.name === '行驶证'">
<view style="padding: 22rpx"> <view style="padding: 22rpx">
<text style="color: #f56c6c; font-size: 20px; margin-right: 5px" <text
>*</text style="color: #f56c6c; font-size: 20px; margin-right: 5px"
> ></text>
<text style="color: #303133; font-size: 15px; line-height: 22px" <text style="color: #303133; font-size: 15px; line-height: 22px"
>行驶证</text >行驶证</text
>拍照上传后自动识别车辆信息</view >拍照上传后自动识别车辆信息</view
@ -76,7 +76,7 @@
<view> <view>
<view style="padding-left: 20rpx; margin-top: 20rpx"> <view style="padding-left: 20rpx; margin-top: 20rpx">
<image <image
@click="handleUpload" @click="handleUpload(1)"
:src=" :src="
model1.formData.licensePhotoUrl || model1.formData.licensePhotoUrl ||
`${url}/static/img/vehicle/upload.png` `${url}/static/img/vehicle/upload.png`
@ -92,9 +92,9 @@
<view> <view>
<view style="padding-left: 20rpx; margin-top: 20rpx"> <view style="padding-left: 20rpx; margin-top: 20rpx">
<image <image
@click="handleUpload" @click="handleUpload(2)"
:src=" :src="
model1.formData.licensePhotoUrl || model1.formData.licenseBackUrl ||
`${url}/static/img/vehicle/upload.png` `${url}/static/img/vehicle/upload.png`
" "
style="width: 203rpx; height: 133rpx" style="width: 203rpx; height: 133rpx"
@ -107,19 +107,103 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="title">登记信息</view>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList1"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
:disabledColor="'#ffffff'"
:type="['contactInfo'].indexOf(item.key) > -1 ? 'number' : 'text'"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
<view class="title mt-30">我要选新车</view>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList2"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item> -->
</u-form> </u-form>
</view> </view>
</uni-card> </uni-card>
<view class="btn-box-fix-btn"> <view class="btn-box-fix-btn">
<view <view
><u-button type="primary" shape="circle" @click="save" ><u-button type="primary" shape="circle" @click="beforeSave"
>提交询价</u-button >提交询价</u-button
></view ></view
> >
</view> </view>
<block v-for="(item, index) in formAttrList" :key="index"> <block
v-for="(item, index) in formAttrList
.concat(formAttrList1)
.concat(formAttrList2)"
:key="index"
>
<u-action-sheet <u-action-sheet
v-if="item.type === 'select' && item.childKey" v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list" :actions="contrlModalParams[item.childKey].list"
@ -131,15 +215,50 @@
></u-action-sheet> ></u-action-sheet>
</block> </block>
<!-- 车牌号 -->
<CarNoDialog
:show="showDialog.showCarNo"
@handleDialog="(v:boolean) => {handleDialog('showCarNo', v)}"
@changeCarNo="changeCarNo"
ref="carNoRef"
></CarNoDialog>
<!-- 供应商选择弹框 -->
<BrandDialog
ref="BrandDialog"
:show="showDialog.showBrand"
@handleDialog="(v:boolean) => {handleDialog('showBrand', v)}"
@handleChange="handleChange"
></BrandDialog>
<!-- <u-picker
:show="contrlModalParams['location'].isShow"
:title="contrlModalParams['location'].title"
ref="uPicker"
:columns="contrlModalParams['location'].list"
@cancel="contrlModalParams['location'].isShow = false"
keyName="cityName"
@confirm="confirm"
></u-picker> -->
<ccSelectDity
:province="contrlModalParams['location'].province"
:city="contrlModalParams['location'].city"
:area="contrlModalParams['location'].area"
:show="contrlModalParams['location'].isShow"
@changeClick="changeClick"
@sureSelectArea="onsetCity"
@hideShow="onhideShow"
></ccSelectDity>
<up-modal <up-modal
title="你的爱车回收参考价为" title="你的爱车回收参考价为"
:show="true" :show="isShowPrice"
closeOnClickOverlay closeOnClickOverlay
showCancelButton showCancelButton
contentTextAlign="center" contentTextAlign="center"
> >
<view> <view>
<view class="price"> 9999</view> <view class="price"> {{totalPrice}}</view>
<view class="tip"> <view class="tip">
该价格为参考价格实际价格根据过磅重量进行结算</view 该价格为参考价格实际价格根据过磅重量进行结算</view
> >
@ -152,7 +271,11 @@
@click="goRegis" @click="goRegis"
></up-button> ></up-button>
<view class="mt-30"> <view class="mt-30">
<up-button text="暂不登记" shape="circle" @click="handleBack"></up-button> <up-button
text="暂不登记"
shape="circle"
@click="handleBack"
></up-button>
</view> </view>
<!-- @click="show8 = false" --> <!-- @click="show8 = false" -->
@ -167,24 +290,16 @@ import pinia from "@/store";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
import valid from "@/utils/validate"; import valid from "@/utils/validate";
const store = useMemberStore(pinia); const store = useMemberStore(pinia);
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
import BrandDialog from "@/components/Dialog/BrandDialog.vue";
import ccSelectDity from "@/components/cc-selectDity/cc-selectDity.vue";
const model1 = reactive<any>({ const model1 = reactive<any>({
formData: {}, formData: {},
}); });
const isShowPrice = ref(false);
const totalPrice = ref(9999);
const formAttrList = reactive<any>([ const formAttrList = reactive<any>([
// {
// name: "",
// key: "name",
// type: "input",
// required: true,
// unit: "",
// },
// {
// name: "",
// key: "contactInfo",
// type: "input",
// required: true,
// unit: "",
// },
{ {
name: "行驶证", name: "行驶证",
key: "", key: "",
@ -256,32 +371,96 @@ const formAttrList = reactive<any>([
}, },
{ {
name: "总重量", name: "总重量",
key: "series", key: "totalWeight",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
}, },
{ {
name: "车牌号", name: "车牌号",
key: "series", key: "licensePlate",
type: "input",
required: true,
unit: "",
disabled: true,
fn: () => {
uni.hideKeyboard();
showDialog.showCarNo = true;
},
},
]);
const formAttrList1 = reactive<any>([
{
name: "车辆所属",
key: "ownerType",
type: "select",
childKey: "ownerType",
required: true,
unit: "",
fn: () => {
contrlModalParams["ownerType"].isShow = true;
},
},
{
name: "联系人",
key: "owner_name",
type: "input",
required: true,
unit: "",
},
{
name: "联系方式",
key: "owner_phone",
type: "input",
required: true,
unit: "",
},
{
name: "所在地",
key: "location",
type: "input",
required: true,
unit: "",
fn: () => {
contrlModalParams.location.isShow = true;
contrlModalParams.location.title = "所在地";
},
},
{
name: "详细地址",
key: "address",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
}, },
]); ]);
const formAttrList2 = reactive<any>([
{
name: "选择品牌",
key: "brandName",
type: "select",
required: false,
unit: "",
fn: () => {
uni.hideKeyboard();
showDialog.showBrand = true;
},
},
{
name: "预算范围",
key: "budgetRange",
type: "select",
childKey: "budgetRange",
required: false,
unit: "",
fn: () => {
contrlModalParams["budgetRange"].isShow = true;
},
},
]);
const rules = reactive({ const rules = reactive({
"formData.name": {
type: "string",
required: true,
message: "请输入姓名",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.licensePhotoUrl": { "formData.licensePhotoUrl": {
type: "string", type: "string",
required: true, required: true,
@ -312,6 +491,66 @@ const rules = reactive({
message: "请输入整备质量", message: "请输入整备质量",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.vin": {
type: "string",
required: true,
message: "请输入车架号",
trigger: ["blur", "change"],
},
"formData.brandModel": {
type: "string",
required: true,
message: "请输入品牌型号",
trigger: ["blur", "change"],
},
"formData.series": {
type: "string",
required: true,
message: "请输入系列",
trigger: ["blur", "change"],
},
"formData.totalWeight": {
type: "string",
required: true,
message: "请输入总重量",
trigger: ["blur", "change"],
},
"formData.licensePlate": {
type: "string",
required: true,
message: "请输入车牌号",
trigger: ["blur", "change"],
},
// "formData.ownerType": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.location": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.address": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.owner_name": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.owner_phone": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
}); });
const contrlModalParams = reactive<any>({ const contrlModalParams = reactive<any>({
@ -353,8 +592,65 @@ const contrlModalParams = reactive<any>({
title: "钢圈材质", title: "钢圈材质",
list: [{ name: "铝质" }, { name: "铁质" }], list: [{ name: "铝质" }, { name: "铁质" }],
}, },
ownerType: {
isShow: false,
title: "车辆所属",
list: [{ name: "个人" }, { name: "单位" }],
},
budgetRange: {
isShow: false,
title: "预算范围",
list: [
{ name: "10万以下" },
{ name: "10-15万" },
{ name: "15-20万" },
{ name: "20-25万" },
{ name: "25-30万" },
{ name: "30-40万" },
{ name: "40-50万" },
{ name: "50万以上" },
],
},
location: {
isShow: false,
title: "所在地",
list: [],
province: "广东省",
city: "广州市",
area: "天河区",
areaCode: "440106",
address: "",
},
}); });
//
const showDialog = <any>reactive({
showCarNo: false,
showBrand: false,
});
const handleDialog = (key: string, v: boolean) => {
showDialog[key] = v;
};
const changeCarNo = (plate: string) => {
if (plate.length >= 7) model1.formData.licensePlate = plate;
showDialog.showCarNo = false;
};
const handleChange = (arr: any) => {
model1.formData.brandName = arr
.map((item: any) => {
return item.brandName;
})
.toString();
model1.formData.brandId = arr
.map((item: any) => {
return item.id;
})
.toString();
};
const handleSelect = (key: string, v: any) => { const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false; contrlModalParams[key].isShow = false;
if (key === "vehicleType") { if (key === "vehicleType") {
@ -363,11 +659,28 @@ const handleSelect = (key: string, v: any) => {
model1.formData.fuelType = v.name; model1.formData.fuelType = v.name;
} else if (key === "material") { } else if (key === "material") {
model1.formData.wheelMaterial = v.name; model1.formData.wheelMaterial = v.name;
} else if (key === "ownerType") {
model1.formData.ownerType = v.name;
} else if (key === "budgetRange") {
model1.formData.budgetRange = v.name;
} }
}; };
// const confirm = (e: any) => {
// if (e.value[1]) {
// // model1.formData.shmCategoryId = e.value[1].id;
// // model1.formData.location = e.value[1].shmCategoryName;
// contrlModalParams["location"].isShow = false;
// }
// };
// //
const handleUpload = () => { const handleUpload = (type: number) => {
upload(); if (type === 1) {
uploadFront();
} else if (type === 2) {
uploadBack();
}
// uni.authorize({ // uni.authorize({
// // #ifdef MP-TOUTIAO // // #ifdef MP-TOUTIAO
// scope: "scope.album, scope.writePhotosAlbum,scope.camera", // scope: "scope.album, scope.writePhotosAlbum,scope.camera",
@ -404,13 +717,14 @@ const handleUpload = () => {
// }); // });
}; };
// //
const upload = () => { const uploadFront = () => {
uni.chooseImage({ uni.chooseImage({
success: (chooseImageRes) => { success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths; const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({ PictureApi.upload({
files: tempFilePaths[0], files: tempFilePaths[0],
path: tempFilePaths[0], path: tempFilePaths[0],
front: true,
}).then((res: any) => { }).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
model1.formData.licensePhotoUrl = res.data.url; model1.formData.licensePhotoUrl = res.data.url;
@ -422,12 +736,12 @@ const upload = () => {
}); });
model1.formData.licensePhotoUrl = ""; model1.formData.licensePhotoUrl = "";
model1.formData.ascription = ""; model1.formData.ascription = "";
model1.formData.licenseNumber = ""; model1.formData.licensePlate = "";
model1.formData.vin = ""; model1.formData.vin = "";
model1.formData.brandModel = ""; model1.formData.brandModel = "";
} else { } else {
model1.formData.ascription = ocr.words_result["所有人"].words; model1.formData.ascription = ocr.words_result["所有人"].words;
model1.formData.licenseNumber = ocr.words_result["号牌号码"].words; model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
model1.formData.vin = ocr.words_result["车辆识别代号"].words; model1.formData.vin = ocr.words_result["车辆识别代号"].words;
model1.formData.brandModel = ocr.words_result["品牌型号"].words; model1.formData.brandModel = ocr.words_result["品牌型号"].words;
} }
@ -440,6 +754,47 @@ const upload = () => {
}); });
}; };
const uploadBack = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
front: false,
}).then((res: any) => {
if (res.code === 200) {
// console.log(res);
model1.formData.licenseBackUrl = res.data.url;
const ocr = JSON.parse(res.data.ocr);
if (ocr.error_code) {
uni.showToast({
icon: "none",
title: "未识别出相关信息",
});
} else {
const curbWeight = ocr.words_result["整备质量"].words;
const totalWeight = ocr.words_result["总质量"].words;
model1.formData.curbWeight = curbWeight.slice(
0,
curbWeight.length - 2
);
model1.formData.totalWeight = totalWeight.slice(
0,
totalWeight.length - 2
);
model1.formData.fuelType = ocr.words_result["燃油类型"].words;
model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
}
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/** /**
* 校验 * 校验
*/ */
@ -461,10 +816,19 @@ const check = () => {
}); });
}; };
const beforeSave = () => {
check().then((res) => {
if (res) {
// startSave();
isShowPrice.value = true;
}
});
};
const save = () => { const save = () => {
check().then((res) => { check().then((res) => {
if (res) { if (res) {
startSave(); // startSave();
} }
}); });
// if (store.profile?.token) { // if (store.profile?.token) {
@ -494,28 +858,77 @@ const save = () => {
// } // }
}; };
const startSave = () => { const startSave = (type: number) => {
VehicleApi.add(model1.formData).then((res) => { VehicleApi.addRegis({
...model1.formData,
ownerType: model1.formData.ownerType === "个人",
status: 1, //
totalPrice: totalPrice.value
}).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "提交成功", title: "提交成功",
}); });
uni.navigateBack(); if (type === 1) {
uni.navigateTo({
url: "/pagesVehicle/registration?id=" + res.data, //
});
} else if (type === 2) {
uni.navigateBack();
}
} }
}); });
}; };
const goRegis = () => { const goRegis = () => {
uni.navigateTo({ startSave(1);
url: '/pagesVehicle/registration', // };
});
}
const handleBack = () => { const handleBack = () => {
uni.navigateBack(); startSave(2);
};
const getLocationList = () => {
VehicleApi.getLocation({}).then((res: any) => {
if (res.code === 200) {
contrlModalParams.location.list = res.data[0].children;
// console.log(contrlModalParams.location.list);
// contrlModalParams.reCategory.list = [
// (res.data as any).map((item: any) => {
// return { ...item, name: item.reCategoryName };
// }),
// ];
// contrlModalParams.reCategory.list.push(
// contrlModalParams.reCategory.list[0][0].childrenList
// );
}
});
};
function changeClick(value, value2, value3, value4) {
// console.log(" = " + value + value2 + value3 + value4);
contrlModalParams["location"].province = value;
contrlModalParams["location"].city = value2;
contrlModalParams["location"].area = value3;
contrlModalParams["location"].areaCode = value4;
}
function onhideShow() {
contrlModalParams["location"].isShow = false;
// console.log("");
}
//
function onsetCity(e) {
let data = e.detail.target.dataset;
let address = data.province + data.city + data.area;
contrlModalParams["location"].isShow = false;
contrlModalParams["location"].address = address;
model1.formData.location = address;
} }
onMounted(() => {
getLocationList();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uni-card__content { .uni-card__content {

View File

@ -65,9 +65,9 @@
</u-form-item> </u-form-item>
<view v-else-if="item.name === '行驶证'"> <view v-else-if="item.name === '行驶证'">
<view style="padding: 22rpx"> <view style="padding: 22rpx">
<text style="color: #f56c6c; font-size: 20px; margin-right: 5px" <text
>*</text style="color: #f56c6c; font-size: 20px; margin-right: 5px"
> ></text>
<text style="color: #303133; font-size: 15px; line-height: 22px" <text style="color: #303133; font-size: 15px; line-height: 22px"
>行驶证</text >行驶证</text
>拍照上传后自动识别车辆信息</view >拍照上传后自动识别车辆信息</view
@ -76,7 +76,7 @@
<view> <view>
<view style="padding-left: 20rpx; margin-top: 20rpx"> <view style="padding-left: 20rpx; margin-top: 20rpx">
<image <image
@click="handleUpload" @click="handleUpload(1)"
:src=" :src="
model1.formData.licensePhotoUrl || model1.formData.licensePhotoUrl ||
`${url}/static/img/vehicle/upload.png` `${url}/static/img/vehicle/upload.png`
@ -92,9 +92,9 @@
<view> <view>
<view style="padding-left: 20rpx; margin-top: 20rpx"> <view style="padding-left: 20rpx; margin-top: 20rpx">
<image <image
@click="handleUpload" @click="handleUpload(2)"
:src=" :src="
model1.formData.licensePhotoUrl || model1.formData.licenseBackUrl ||
`${url}/static/img/vehicle/upload.png` `${url}/static/img/vehicle/upload.png`
" "
style="width: 203rpx; height: 133rpx" style="width: 203rpx; height: 133rpx"
@ -193,12 +193,17 @@
<view class="btn-box-fix-btn"> <view class="btn-box-fix-btn">
<view <view
><u-button type="primary" shape="circle" @click="save" ><u-button type="primary" shape="circle" @click="save"
>提交询价</u-button >提交登记</u-button
></view ></view
> >
</view> </view>
<block v-for="(item, index) in formAttrList.concat(formAttrList1).concat(formAttrList2)" :key="index"> <block
v-for="(item, index) in formAttrList
.concat(formAttrList1)
.concat(formAttrList2)"
:key="index"
>
<u-action-sheet <u-action-sheet
v-if="item.type === 'select' && item.childKey" v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list" :actions="contrlModalParams[item.childKey].list"
@ -225,6 +230,25 @@
@handleDialog="(v:boolean) => {handleDialog('showBrand', v)}" @handleDialog="(v:boolean) => {handleDialog('showBrand', v)}"
@handleChange="handleChange" @handleChange="handleChange"
></BrandDialog> ></BrandDialog>
<!-- <u-picker
:show="contrlModalParams['location'].isShow"
:title="contrlModalParams['location'].title"
ref="uPicker"
:columns="contrlModalParams['location'].list"
@cancel="contrlModalParams['location'].isShow = false"
keyName="cityName"
@confirm="confirm"
></u-picker> -->
<ccSelectDity
:province="contrlModalParams['location'].province"
:city="contrlModalParams['location'].city"
:area="contrlModalParams['location'].area"
:show="contrlModalParams['location'].isShow"
@changeClick="changeClick"
@sureSelectArea="onsetCity"
@hideShow="onhideShow"
></ccSelectDity>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -236,24 +260,11 @@ import valid from "@/utils/validate";
const store = useMemberStore(pinia); const store = useMemberStore(pinia);
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue"; import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
import BrandDialog from "@/components/Dialog/BrandDialog.vue"; import BrandDialog from "@/components/Dialog/BrandDialog.vue";
import ccSelectDity from "@/components/cc-selectDity/cc-selectDity.vue";
const model1 = reactive<any>({ const model1 = reactive<any>({
formData: {}, formData: {},
}); });
const formAttrList = reactive<any>([ const formAttrList = reactive<any>([
// {
// name: "",
// key: "name",
// type: "input",
// required: true,
// unit: "",
// },
// {
// name: "",
// key: "contactInfo",
// type: "input",
// required: true,
// unit: "",
// },
{ {
name: "行驶证", name: "行驶证",
key: "", key: "",
@ -325,35 +336,7 @@ const formAttrList = reactive<any>([
}, },
{ {
name: "总重量", name: "总重量",
key: "series", key: "totalWeight",
type: "input",
required: true,
unit: "",
},
{
name: "车牌号",
key: "series",
type: "input",
required: true,
unit: "",
},
]);
const formAttrList1 = reactive<any>([
{
name: "车辆所属",
key: "ownerType",
type: "select",
childKey: "ownerType",
required: true,
unit: "",
fn: () => {
contrlModalParams["ownerType"].isShow = true;
},
},
{
name: "联系方式",
key: "contactInfo",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
@ -370,12 +353,51 @@ const formAttrList1 = reactive<any>([
showDialog.showCarNo = true; showDialog.showCarNo = true;
}, },
}, },
]);
const formAttrList1 = reactive<any>([
{
name: "车辆所属",
key: "ownerType",
type: "select",
childKey: "ownerType",
required: true,
unit: "",
fn: () => {
contrlModalParams["ownerType"].isShow = true;
},
},
{
name: "联系人",
key: "owner_name",
type: "input",
required: true,
unit: "",
},
{
name: "联系方式",
key: "owner_phone",
type: "input",
required: true,
unit: "",
},
{ {
name: "所在地", name: "所在地",
key: "location", key: "location",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
fn: () => {
contrlModalParams.location.isShow = true;
contrlModalParams.location.title = "所在地";
},
},
{
name: "详细地址",
key: "address",
type: "input",
required: true,
unit: "",
}, },
]); ]);
@ -404,13 +426,13 @@ const formAttrList2 = reactive<any>([
}, },
]); ]);
const rules = reactive({ const rules = reactive({
"formData.name": { "formData.owner_name": {
type: "string", type: "string",
required: true, required: true,
message: "请输入姓名", message: "请输入姓名",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.contactInfo": { "formData.owner_phone": {
type: "string", type: "string",
required: true, required: true,
message: "请输入联系方式", message: "请输入联系方式",
@ -446,11 +468,28 @@ const rules = reactive({
message: "请输入整备质量", message: "请输入整备质量",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.vin": {
"formData.ownerType": {
type: "string", type: "string",
required: true, required: true,
message: "请选择车辆所属", message: "请输入车架号",
trigger: ["blur", "change"],
},
"formData.brandModel": {
type: "string",
required: true,
message: "请输入品牌型号",
trigger: ["blur", "change"],
},
"formData.series": {
type: "string",
required: true,
message: "请输入系列",
trigger: ["blur", "change"],
},
"formData.totalWeight": {
type: "string",
required: true,
message: "请输入总重量",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.licensePlate": { "formData.licensePlate": {
@ -459,10 +498,23 @@ const rules = reactive({
message: "请输入车牌号", message: "请输入车牌号",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.ownerType": {
type: "string",
required: true,
message: "请选择车辆所属",
trigger: ["blur", "change"],
},
"formData.location": { "formData.location": {
type: "string", type: "string",
required: true, required: true,
message: "请输入所在地", message: "请选择省市区",
trigger: ["blur", "change"],
},
"formData.address": {
type: "string",
required: true,
message: "请输入详细地址",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
}); });
@ -525,6 +577,16 @@ const contrlModalParams = reactive<any>({
{ name: "50万以上" }, { name: "50万以上" },
], ],
}, },
location: {
isShow: false,
title: "所在地",
list: [],
province: "广东省",
city: "广州市",
area: "天河区",
areaCode: "440106",
address: ''
},
}); });
// //
@ -563,11 +625,28 @@ const handleSelect = (key: string, v: any) => {
model1.formData.fuelType = v.name; model1.formData.fuelType = v.name;
} else if (key === "material") { } else if (key === "material") {
model1.formData.wheelMaterial = v.name; model1.formData.wheelMaterial = v.name;
} else if (key === "ownerType") {
model1.formData.ownerType = v.name;
} else if (key === "budgetRange") {
model1.formData.budgetRange = v.name;
} }
}; };
// const confirm = (e: any) => {
// if (e.value[1]) {
// // model1.formData.shmCategoryId = e.value[1].id;
// // model1.formData.location = e.value[1].shmCategoryName;
// contrlModalParams["location"].isShow = false;
// }
// };
// //
const handleUpload = () => { const handleUpload = (type: number) => {
upload(); if (type === 1) {
uploadFront();
} else if (type === 2) {
uploadBack();
}
// uni.authorize({ // uni.authorize({
// // #ifdef MP-TOUTIAO // // #ifdef MP-TOUTIAO
// scope: "scope.album, scope.writePhotosAlbum,scope.camera", // scope: "scope.album, scope.writePhotosAlbum,scope.camera",
@ -604,13 +683,14 @@ const handleUpload = () => {
// }); // });
}; };
// //
const upload = () => { const uploadFront = () => {
uni.chooseImage({ uni.chooseImage({
success: (chooseImageRes) => { success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths; const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({ PictureApi.upload({
files: tempFilePaths[0], files: tempFilePaths[0],
path: tempFilePaths[0], path: tempFilePaths[0],
front: true
}).then((res: any) => { }).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
model1.formData.licensePhotoUrl = res.data.url; model1.formData.licensePhotoUrl = res.data.url;
@ -622,12 +702,12 @@ const upload = () => {
}); });
model1.formData.licensePhotoUrl = ""; model1.formData.licensePhotoUrl = "";
model1.formData.ascription = ""; model1.formData.ascription = "";
model1.formData.licenseNumber = ""; model1.formData.licensePlate = "";
model1.formData.vin = ""; model1.formData.vin = "";
model1.formData.brandModel = ""; model1.formData.brandModel = "";
} else { } else {
model1.formData.ascription = ocr.words_result["所有人"].words; model1.formData.ascription = ocr.words_result["所有人"].words;
model1.formData.licenseNumber = ocr.words_result["号牌号码"].words; model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
model1.formData.vin = ocr.words_result["车辆识别代号"].words; model1.formData.vin = ocr.words_result["车辆识别代号"].words;
model1.formData.brandModel = ocr.words_result["品牌型号"].words; model1.formData.brandModel = ocr.words_result["品牌型号"].words;
} }
@ -640,6 +720,41 @@ const upload = () => {
}); });
}; };
const uploadBack = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
front: false
}).then((res: any) => {
if (res.code === 200) {
// console.log(res);
model1.formData.licenseBackUrl = res.data.url;
const ocr = JSON.parse(res.data.ocr);
if (ocr.error_code) {
uni.showToast({
icon: "none",
title: "未识别出相关信息",
});
} else {
const curbWeight = ocr.words_result["整备质量"].words
const totalWeight = ocr.words_result["总质量"].words
model1.formData.curbWeight = curbWeight.slice(0, curbWeight.length - 2);
model1.formData.totalWeight = totalWeight.slice(0, totalWeight.length - 2);
model1.formData.fuelType = ocr.words_result["燃油类型"].words;
model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
}
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/** /**
* 校验 * 校验
*/ */
@ -695,7 +810,7 @@ const save = () => {
}; };
const startSave = () => { const startSave = () => {
VehicleApi.add(model1.formData).then((res) => { VehicleApi.addRegis({...model1.formData, ownerType: model1.formData.ownerType === '个人', status: 2}).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "提交成功", title: "提交成功",
@ -708,6 +823,48 @@ const startSave = () => {
const handleBack = () => { const handleBack = () => {
uni.navigateBack(); uni.navigateBack();
}; };
const getLocationList = () => {
VehicleApi.getLocation({}).then((res: any) => {
if (res.code === 200) {
contrlModalParams.location.list = res.data[0].children;
// console.log(contrlModalParams.location.list);
// contrlModalParams.reCategory.list = [
// (res.data as any).map((item: any) => {
// return { ...item, name: item.reCategoryName };
// }),
// ];
// contrlModalParams.reCategory.list.push(
// contrlModalParams.reCategory.list[0][0].childrenList
// );
}
});
};
function changeClick(value, value2, value3, value4) {
// console.log(" = " + value + value2 + value3 + value4);
contrlModalParams['location'].province = value;
contrlModalParams['location'].city = value2;
contrlModalParams['location'].area = value3;
contrlModalParams['location'].areaCode = value4;
}
function onhideShow() {
contrlModalParams['location'].isShow = false;
// console.log("");
}
//
function onsetCity(e) {
let data = e.detail.target.dataset;
let address = data.province + data.city + data.area;
contrlModalParams['location'].isShow = false;
contrlModalParams['location'].address = address;
model1.formData.location = address
}
onMounted(() => {
getLocationList();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uni-card__content { .uni-card__content {

View File

@ -1,58 +1,87 @@
<template> <template>
<view> <view
<view class="box"> ><page-view
<uni-table stripe emptyText="暂无询价记录"> @loadList="
<!-- 表头行 --> (v) => {
<uni-tr> getList(v);
<uni-th v-for="(item, index) in tableTitleList" :key="index" }
>{{ item.name }} "
</uni-th> :noMoreData="pageList.noMoreData"
</uni-tr> :list="pageList.list"
<!-- 表格数据行 --> :height="204"
<uni-tr v-for="(item, index) in [{paymentName: '2022'}]" :key="index"> :isLoading="pageList.isLoading"
<uni-td v-for="(tItem, index) in tableTitleList" :key="index">{{ >
item[tItem.key] <view class="box">
}}</uni-td> <scroll-view scroll-x class="scroll-view">
<uni-td> <uni-table stripe emptyText="">
<u-button type="primary" shape="circle" @click="goRegis()">去登记</u-button> <!-- 表头行 -->
</uni-td> <uni-tr>
</uni-tr> <uni-th v-for="(item, index) in tableTitleList" :key="index"
</uni-table> >{{ item.name }}
</view> </uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item, index) in pageList.list" :key="index">
<uni-td v-for="(tItem, index) in tableTitleList" :key="index">{{
item[tItem.key]
}}</uni-td>
<uni-td>
<u-button type="primary" shape="circle" @click="goRegis(item.id)"
>去登记</u-button
>
</uni-td>
</uni-tr>
</uni-table>
</scroll-view>
</view>
</page-view>
<view class="btn-box-fix-btn"> <view class="btn-box-fix-btn">
<view <view
><u-button type="primary" shape="circle" @click="goInquiry()">去询价</u-button> ><u-button type="primary" shape="circle" @click="goInquiry()"
<view @click="goRecovery" class="regis" >不需询价, 直接登记回收</view> >去询价</u-button
>
<view @click="goRecovery" class="regis">不需询价, 直接登记回收</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import PageView from "@/components/PageView/index.vue";
import { VehicleApi } from "@/services"; import { VehicleApi } from "@/services";
import pinia from "@/store"; import pinia from "@/store";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
const pageList: PageResult<any> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 100;
};
const tableTitleList = reactive([ const tableTitleList = reactive([
{ {
name: "时间", name: "时间",
key: "paymentName", key: "createdTime",
}, },
{ {
name: "品牌型号", name: "品牌型号",
key: "paymentPrice", key: "brandModel",
}, },
{ {
name: "总重量", name: "总重量",
key: "revenuePrice", key: "totalWeight",
}, },
{ {
name: "预估价格", name: "预估价格",
key: "revenuePrice", key: "totalPrice",
}, }
{
name: "操作",
key: "revenuePrice",
},
]); ]);
// VehicleApi.queryRegis({ // VehicleApi.queryRegis({
// startTime: "2024-09-01 00:00:00", // startTime: "2024-09-01 00:00:00",
@ -62,27 +91,62 @@ const tableTitleList = reactive([
// res.data.list // res.data.list
// } // }
// }); // });
const goRegis = () => { const goRegis = (id:number) => {
uni.navigateTo({ uni.navigateTo({
url: '/pagesVehicle/registration', // url: "/pagesVehicle/registration?id=" + id, //
}); });
} };
const goInquiry = () => { const goInquiry = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pagesVehicle/inquiry', // url: "/pagesVehicle/inquiry", //
}); });
} };
const goRecovery = () => { const goRecovery = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pagesVehicle/recovery', // url: "/pagesVehicle/recovery", //
}); });
} };
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: pageList.pageSize,
pageNum: pageList.pageNum,
status: 1, //
};
pageList.isLoading = true;
VehicleApi.getRegisList(params).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
pageList.list = pageList.list = pageList.list.concat(res.data.list);
pageList.total = res.data.total;
}
});
};
getList();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box {
padding: 28rpx 20rpx;
.scroll-view {
white-space: nowrap;
width: 100%;
overflow: auto;
}
::v-deep.uni-table{
min-width: 700px !important;
}
}
.btn-box-fix-btn { .btn-box-fix-btn {
justify-content: center; justify-content: center;
view { view {

View File

@ -1,369 +0,0 @@
<template>
<uni-card
:shadow="'0rpx 0rpx 10rpx 0rpx rgba(5,68,37,0.12)'"
:margin="'20px'"
:border="false"
>
<view class="title">车辆信息</view>
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'input'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
:disabledColor="'#ffffff'"
:type="['contactInfo'].indexOf(item.key) > -1 ? 'number' : 'text'"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
<view class="title mt-30">我要选新车</view>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList1"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</uni-card>
<view class="btn-box-fix-btn">
<view
><u-button type="primary" shape="circle" @click="save"
>提交登记</u-button
></view
>
</view>
<block v-for="(item, index) in formAttrList.concat(formAttrList1)" :key="index">
<u-action-sheet
v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
<!-- 车牌号 -->
<CarNoDialog
:show="showDialog.showCarNo"
@handleDialog="(v:boolean) => {handleDialog('showCarNo', v)}"
@changeCarNo="changeCarNo"
ref="carNoRef"
></CarNoDialog>
<!-- 供应商选择弹框 -->
<BrandDialog
ref="BrandDialog"
:show="showDialog.showBrand"
@handleDialog="(v:boolean) => {handleDialog('showBrand', v)}"
@handleChange="handleChange"
></BrandDialog>
</template>
<script setup lang="ts">
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
import BrandDialog from "@/components/Dialog/BrandDialog.vue";
import { VehicleApi, UserApi } from "@/services";
import pinia from "@/store";
import { useMemberStore } from "@/store/index";
const store = useMemberStore(pinia);
//
const showDialog = <any>reactive({
showCarNo: false,
showBrand: false
});
const model1 = reactive<any>({
formData: {},
});
const formAttrList = reactive<any>([
{
name: "车辆所属",
key: "ownerType",
type: "select",
childKey: "ownerType",
required: true,
unit: "",
fn: () => {
contrlModalParams["ownerType"].isShow = true;
},
},
{
name: "联系方式",
key: "contactInfo",
type: "input",
required: true,
unit: "",
},
{
name: "车牌号",
key: "licensePlate",
type: "input",
required: true,
unit: "",
disabled: true,
fn: () => {
uni.hideKeyboard();
showDialog.showCarNo = true;
},
},
{
name: "所在地",
key: "location",
type: "input",
required: true,
unit: "",
},
]);
const formAttrList1 = reactive<any>([
{
name: "选择品牌",
key: "brandName",
type: "select",
required: false,
unit: "",
fn: () => {
uni.hideKeyboard();
showDialog.showBrand = true;
},
},
{
name: "预算范围",
key: "budgetRange",
type: "select",
childKey: "budgetRange",
required: false,
unit: "",
fn: () => {
contrlModalParams["budgetRange"].isShow = true;
},
},
]);
const rules = reactive({
"formData.ownerType": {
type: "string",
required: true,
message: "请选择车辆所属",
trigger: ["blur", "change"],
},
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.licensePlate": {
type: "string",
required: true,
message: "请输入车牌号",
trigger: ["blur", "change"],
},
"formData.location": {
type: "string",
required: true,
message: "请输入所在地",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
ownerType: {
isShow: false,
title: "车辆所属",
list: [{ name: "个人" }, { name: "单位" }],
},
budgetRange: {
isShow: false,
title: "预算范围",
list: [
{ name: "10万以下" },
{ name: "10-15万" },
{ name: "15-20万" },
{ name: "20-25万" },
{ name: "25-30万" },
{ name: "30-40万" },
{ name: "40-50万" },
{ name: "50万以上" },
],
},
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "ownerType") {
model1.formData.ownerType = v.name;
} else if(key === 'budgetRange') {
model1.formData.budgetRange = v.name;
}
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
// if (store.profile?.token) {
// check().then((res) => {
// if (res) {
// startSave();
// }
// });
// } else {
// uni.login({
// provider: "toutiao",
// success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res) => {
// });
// },
// });
// }
};
const startSave = () => {
VehicleApi.addRegis({
...model1.formData,
ownerType: model1.formData.ownerType === "个人" ? 0 : 1,
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "提交成功",
});
uni.navigateBack();
}
});
};
const handleDialog = (key: string, v: boolean) => {
showDialog[key] = v;
};
const changeCarNo = (plate: string) => {
if (plate.length >= 7) model1.formData.licensePlate = plate;
showDialog.showCarNo = false;
};
const handleChange = (arr: any) => {
model1.formData.brandName = arr.map((item:any) => {return item.brandName}).toString()
model1.formData.brandId = arr.map((item:any) => {return item.id}).toString()
};
</script>
<style lang="scss" scoped>
::v-deep .uni-card__content {
padding: 20rpx !important;
height: calc(100vh - 200px);
overflow: auto;
}
::v-deep .uni-card--shadow {
padding: 0px !important;
}
::v-deep .u-form-item {
height: auto;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx;
padding: 0px 20rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.btn-box-fix-btn {
justify-content: center;
view {
width: 70%;
}
}
</style>

View File

@ -4,93 +4,190 @@
:margin="'20px'" :margin="'20px'"
:border="false" :border="false"
> >
<view class="title">登记信息</view> <view class="uni-card__content">
<u-form <u-form
labelPosition="left" labelPosition="left"
:model="model1" :model="model1"
:rules="rules" :rules="rules"
ref="form" ref="form"
:labelWidth="80" :labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }" :labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'" :errorType="'border-bottom'"
>
<u-form-item
:prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
> >
<u-input <!-- <view class="title">车辆信息</view>
v-if="item.type === 'input'" <view v-for="(item, index) in formAttrList" :key="index">
v-model="(model1.formData as any)[item.key]" <u-form-item
:placeholder="`请输入${item.name}`" v-if="item.name !== '行驶证'"
clearable :prop="`formData.${item.key}`"
:customStyle="{}" :label="item.name"
border="none" :required="item.required"
:disabled="item.disabled" @click="item.fn"
:disabledColor="'#ffffff'" >
:type="['contactInfo'].indexOf(item.key) > -1 ? 'number' : 'text'" <u-input
> v-if="item.type === 'input'"
<template #suffix> v-model="(model1.formData as any)[item.key]"
<text v-if="item.unit"> :placeholder="`请输入${item.name}`"
{{ item.unit }} clearable
</text> :customStyle="{}"
</template> border="none"
</u-input> :disabled="item.disabled"
<u-input :type="
v-if="item.type === 'select'" ['contactInfo', 'curbWeight'].indexOf(item.key) > -1
:disabled="true" ? 'number'
:disabledColor="'#ffffff'" : 'text'
v-model="(model1.formData as any)[item.key]" "
:placeholder="`请选择${item.name}`" >
clearable <template #suffix>
:customStyle="{}" <text v-if="item.unit">
border="none" {{ item.unit }}
> </text>
<template #suffix> </template>
<text v-if="item.unit"> </u-input>
{{ item.unit }} <u-input
</text> v-if="item.type === 'select'"
</template> :disabled="true"
</u-input> :disabledColor="'#ffffff'"
<template #right v-if="item.type === 'select'"> v-model="(model1.formData as any)[item.key]"
<u-icon name="arrow-right" @click="item.fn"></u-icon> :placeholder="`请选择${item.name}`"
</template> clearable
</u-form-item> :customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
<view v-else-if="item.name === '行驶证'">
<view style="padding: 22rpx">
<text
style="color: #f56c6c; font-size: 20px; margin-right: 5px"
></text>
<text style="color: #303133; font-size: 15px; line-height: 22px"
>行驶证</text
>拍照上传后自动识别车辆信息</view
>
<view style="display: flex; justify-content: space-around">
<view>
<view style="padding-left: 20rpx; margin-top: 20rpx">
<image
@click="handleUpload(1)"
:src="
model1.formData.licensePhotoUrl ||
`${url}/static/img/vehicle/upload.png`
"
style="width: 203rpx; height: 133rpx"
/>
</view>
<view style="padding-left: 20rpx; margin-top: 10rpx"
>点击上传行驶证主页</view
>
</view>
<view class="title mt-30">我要选新车</view> <view>
<view style="padding-left: 20rpx; margin-top: 20rpx">
<image
@click="handleUpload(2)"
:src="
model1.formData.licenseBackUrl ||
`${url}/static/img/vehicle/upload.png`
"
style="width: 203rpx; height: 133rpx"
/>
</view>
<view style="padding-left: 20rpx; margin-top: 10rpx"
>点击上传行驶证副页</view
>
</view>
</view>
</view>
</view> -->
<u-form-item <view class="title">登记信息</view>
:prop="`formData.${item.key}`"
:label="item.name" <u-form-item
:required="item.required" :prop="`formData.${item.key}`"
v-for="(item, index) in formAttrList1" :label="item.name"
:key="index" :required="item.required"
@click="item.fn" v-for="(item, index) in formAttrList1"
> :key="index"
<u-input @click="item.fn"
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
> >
<template #suffix> <u-input
<text v-if="item.unit"> v-if="item.type === 'input'"
{{ item.unit }} v-model="(model1.formData as any)[item.key]"
</text> :placeholder="`请输入${item.name}`"
clearable
:customStyle="{}"
border="none"
:disabled="item.disabled"
:disabledColor="'#ffffff'"
:type="['contactInfo'].indexOf(item.key) > -1 ? 'number' : 'text'"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template> </template>
</u-input> </u-form-item>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon> <view class="title mt-30">我要选新车</view>
</template>
</u-form-item> <u-form-item
</u-form> :prop="`formData.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList2"
:key="index"
@click="item.fn"
>
<u-input
v-if="item.type === 'select'"
:disabled="true"
:disabledColor="'#ffffff'"
v-model="(model1.formData as any)[item.key]"
:placeholder="`请选择${item.name}`"
clearable
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.unit">
{{ item.unit }}
</text>
</template>
</u-input>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right" @click="item.fn"></u-icon>
</template>
</u-form-item>
</u-form>
</view>
</uni-card> </uni-card>
<view class="btn-box-fix-btn"> <view class="btn-box-fix-btn">
@ -101,7 +198,12 @@
> >
</view> </view>
<block v-for="(item, index) in formAttrList.concat(formAttrList1)" :key="index"> <block
v-for="(item, index) in formAttrList
.concat(formAttrList1)
.concat(formAttrList2)"
:key="index"
>
<u-action-sheet <u-action-sheet
v-if="item.type === 'select' && item.childKey" v-if="item.type === 'select' && item.childKey"
:actions="contrlModalParams[item.childKey].list" :actions="contrlModalParams[item.childKey].list"
@ -128,24 +230,133 @@
@handleDialog="(v:boolean) => {handleDialog('showBrand', v)}" @handleDialog="(v:boolean) => {handleDialog('showBrand', v)}"
@handleChange="handleChange" @handleChange="handleChange"
></BrandDialog> ></BrandDialog>
<!-- <u-picker
:show="contrlModalParams['location'].isShow"
:title="contrlModalParams['location'].title"
ref="uPicker"
:columns="contrlModalParams['location'].list"
@cancel="contrlModalParams['location'].isShow = false"
keyName="cityName"
@confirm="confirm"
></u-picker> -->
<ccSelectDity
:province="contrlModalParams['location'].province"
:city="contrlModalParams['location'].city"
:area="contrlModalParams['location'].area"
:show="contrlModalParams['location'].isShow"
@changeClick="changeClick"
@sureSelectArea="onsetCity"
@hideShow="onhideShow"
></ccSelectDity>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import CarNoDialog from "@/components/Dialog/CarNoDialog.vue"; import { url } from "@/utils/data";
import BrandDialog from "@/components/Dialog/BrandDialog.vue"; import { PictureApi, VehicleApi, UserApi } from "@/services";
import { VehicleApi, UserApi } from "@/services";
import pinia from "@/store"; import pinia from "@/store";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
import valid from "@/utils/validate";
const store = useMemberStore(pinia); const store = useMemberStore(pinia);
// import CarNoDialog from "@/components/Dialog/CarNoDialog.vue";
const showDialog = <any>reactive({ import BrandDialog from "@/components/Dialog/BrandDialog.vue";
showCarNo: false, import ccSelectDity from "@/components/cc-selectDity/cc-selectDity.vue";
showBrand: false import { onLoad } from "@dcloudio/uni-app";
});
const model1 = reactive<any>({ const model1 = reactive<any>({
formData: {}, formData: {},
}); });
const formAttrList = reactive<any>([ const formAttrList = reactive<any>([
{
name: "行驶证",
key: "",
type: "upload",
required: false,
unit: "",
},
{
name: "车辆类型",
key: "vehicleType",
type: "select",
childKey: "vehicleType",
required: true,
unit: "",
fn: () => {
contrlModalParams["vehicleType"].isShow = true;
},
},
{
name: "燃油类别",
key: "fuelType",
type: "select",
childKey: "fuelType",
required: true,
unit: "",
fn: () => {
contrlModalParams["fuelType"].isShow = true;
},
},
{
name: "钢圈材质",
key: "wheelMaterial",
type: "select",
childKey: "material",
required: true,
unit: "",
fn: () => {
contrlModalParams["material"].isShow = true;
},
},
{
name: "整备质量",
key: "curbWeight",
type: "input",
required: true,
unit: "KG",
},
{
name: "车架号",
key: "vin",
type: "input",
required: true,
unit: "",
},
{
name: "品牌型号",
key: "brandModel",
type: "input",
required: true,
unit: "",
},
{
name: "系列",
key: "series",
type: "input",
required: true,
unit: "",
},
{
name: "总重量",
key: "totalWeight",
type: "input",
required: true,
unit: "",
},
{
name: "车牌号",
key: "licensePlate",
type: "input",
required: true,
unit: "",
disabled: true,
fn: () => {
uni.hideKeyboard();
showDialog.showCarNo = true;
},
},
]);
const formAttrList1 = reactive<any>([
{ {
name: "车辆所属", name: "车辆所属",
key: "ownerType", key: "ownerType",
@ -159,35 +370,39 @@ const formAttrList = reactive<any>([
}, },
{ {
name: "联系人", name: "联系人",
key: "name", key: "owner_name",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
}, },
{ {
name: "联系方式", name: "联系方式",
key: "contactInfo", key: "owner_phone",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
}, },
{ {
name: "上门地址", name: "所在地",
key: "location", key: "location",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
fn: () => {
contrlModalParams.location.isShow = true;
contrlModalParams.location.title = "所在地";
},
}, },
{ {
name: "详细地址", name: "详细地址",
key: "location", key: "address",
type: "input", type: "input",
required: true, required: true,
unit: "", unit: "",
}, },
]); ]);
const formAttrList1 = reactive<any>([ const formAttrList2 = reactive<any>([
{ {
name: "选择品牌", name: "选择品牌",
key: "brandName", key: "brandName",
@ -212,33 +427,138 @@ const formAttrList1 = reactive<any>([
}, },
]); ]);
const rules = reactive({ const rules = reactive({
"formData.owner_name": {
type: "string",
required: true,
message: "请输入姓名",
trigger: ["blur", "change"],
},
"formData.owner_phone": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
// "formData.licensePhotoUrl": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.vehicleType": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.fuelType": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.wheelMaterial": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.curbWeight": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.vin": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.brandModel": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.series": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.totalWeight": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
// "formData.licensePlate": {
// type: "string",
// required: true,
// message: "",
// trigger: ["blur", "change"],
// },
"formData.ownerType": { "formData.ownerType": {
type: "string", type: "string",
required: true, required: true,
message: "请选择车辆所属", message: "请选择车辆所属",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"formData.contactInfo": {
type: "string",
required: true,
message: "请输入联系方式",
trigger: ["blur", "change"],
},
"formData.licensePlate": {
type: "string",
required: true,
message: "请输入车牌号",
trigger: ["blur", "change"],
},
"formData.location": { "formData.location": {
type: "string", type: "string",
required: true, required: true,
message: "请输入所在地", message: "请选择省市区",
trigger: ["blur", "change"],
},
"formData.address": {
type: "string",
required: true,
message: "请输入详细地址",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
}); });
const contrlModalParams = reactive<any>({ const contrlModalParams = reactive<any>({
vehicleType: {
isShow: false,
title: "车辆类型",
list: [
{ name: "轿车含MPV" },
{ name: "面包车" },
{ name: "中型客车" },
{ name: "大型客车" },
{ name: "轻型载货汽车" },
{ name: "中型载货汽车" },
{ name: "重型载货汽车" },
{ name: "越野汽车SUV" },
{ name: "农用运输车" },
{ name: "牵引汽车" },
{ name: "挂车" },
{ name: "农用机械" },
{ name: "摩托车" },
{ name: "电瓶摩托车" },
],
},
fuelType: {
isShow: false,
title: "燃油类别",
list: [
{ name: "汽油" },
{ name: "柴油" },
{ name: "油气" },
{ name: "纯电" },
{ name: "油电" },
{ name: "无动力" },
{ name: "天然气" },
],
},
material: {
isShow: false,
title: "钢圈材质",
list: [{ name: "铝质" }, { name: "铁质" }],
},
ownerType: { ownerType: {
isShow: false, isShow: false,
title: "车辆所属", title: "车辆所属",
@ -258,17 +578,190 @@ const contrlModalParams = reactive<any>({
{ name: "50万以上" }, { name: "50万以上" },
], ],
}, },
location: {
isShow: false,
title: "所在地",
list: [],
province: "广东省",
city: "广州市",
area: "天河区",
areaCode: "440106",
address: "",
},
}); });
//
const showDialog = <any>reactive({
showCarNo: false,
showBrand: false,
});
const handleDialog = (key: string, v: boolean) => {
showDialog[key] = v;
};
const changeCarNo = (plate: string) => {
if (plate.length >= 7) model1.formData.licensePlate = plate;
showDialog.showCarNo = false;
};
const handleChange = (arr: any) => {
model1.formData.brandName = arr
.map((item: any) => {
return item.brandName;
})
.toString();
model1.formData.brandId = arr
.map((item: any) => {
return item.id;
})
.toString();
};
const handleSelect = (key: string, v: any) => { const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false; contrlModalParams[key].isShow = false;
if (key === "ownerType") { if (key === "vehicleType") {
model1.formData.vehicleType = v.name;
} else if (key === "fuelType") {
model1.formData.fuelType = v.name;
} else if (key === "material") {
model1.formData.wheelMaterial = v.name;
} else if (key === "ownerType") {
model1.formData.ownerType = v.name; model1.formData.ownerType = v.name;
} else if(key === 'budgetRange') { } else if (key === "budgetRange") {
model1.formData.budgetRange = v.name; model1.formData.budgetRange = v.name;
} }
}; };
// const confirm = (e: any) => {
// if (e.value[1]) {
// // model1.formData.shmCategoryId = e.value[1].id;
// // model1.formData.location = e.value[1].shmCategoryName;
// contrlModalParams["location"].isShow = false;
// }
// };
//
const handleUpload = (type: number) => {
if (type === 1) {
uploadFront();
} else if (type === 2) {
uploadBack();
}
// uni.authorize({
// // #ifdef MP-TOUTIAO
// scope: "scope.album, scope.writePhotosAlbum,scope.camera",
// // #endif
// success(res) {
// console.log("", res);
// },
// fail(err) {
// console.log("", err);
// uni.hideLoading();
// },
// });
// uni.authorize({
// scope: "scope.writePhotosAlbum",
// success() {
// console.log("");
// //
// },
// fail() {
// console.log("");
// //
// if (uni.getSystemInfoSync().platform === "android") {
// uni.showModal({
// title: "",
// content: "访访",
// success: function (modalRes) {
// if (modalRes.confirm) {
// uni.openSetting();
// }
// },
// });
// }
// },
// });
};
//
const uploadFront = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
front: true,
}).then((res: any) => {
if (res.code === 200) {
model1.formData.licensePhotoUrl = res.data.url;
const ocr = JSON.parse(res.data.ocr);
if (ocr.error_code) {
uni.showToast({
icon: "none",
title: "未识别出相关信息",
});
model1.formData.licensePhotoUrl = "";
model1.formData.ascription = "";
model1.formData.licensePlate = "";
model1.formData.vin = "";
model1.formData.brandModel = "";
} else {
model1.formData.ascription = ocr.words_result["所有人"].words;
model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
model1.formData.vin = ocr.words_result["车辆识别代号"].words;
model1.formData.brandModel = ocr.words_result["品牌型号"].words;
}
}
});
},
fail: (error) => {
console.log(error);
},
});
};
const uploadBack = () => {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
PictureApi.upload({
files: tempFilePaths[0],
path: tempFilePaths[0],
front: false,
}).then((res: any) => {
if (res.code === 200) {
// console.log(res);
model1.formData.licenseBackUrl = res.data.url;
const ocr = JSON.parse(res.data.ocr);
if (ocr.error_code) {
uni.showToast({
icon: "none",
title: "未识别出相关信息",
});
} else {
const curbWeight = ocr.words_result["整备质量"].words;
const totalWeight = ocr.words_result["总质量"].words;
model1.formData.curbWeight = curbWeight.slice(
0,
curbWeight.length - 2
);
model1.formData.totalWeight = totalWeight.slice(
0,
totalWeight.length - 2
);
model1.formData.fuelType = ocr.words_result["燃油类型"].words;
model1.formData.licensePlate = ocr.words_result["号牌号码"].words;
}
}
});
},
fail: (error) => {
console.log(error);
},
});
};
/** /**
* 校验 * 校验
*/ */
@ -304,20 +797,30 @@ const save = () => {
// }); // });
// } else { // } else {
// uni.login({ // uni.login({
// provider: "toutiao", // provider: "toutiao",
// success: function (loginRes) { // success: function (loginRes) {
// UserApi.login({ code: loginRes.code }).then((res) => { // UserApi.login({ code: loginRes.code }).then((res: any) => {
// if (res.data) {
// }); // store.setProfile({ token: res.data.token });
// }, // check().then((res) => {
// }); // if (res) {
// startSave();
// }
// });
// } else {
// uni.showToast({ title: "", icon: "none" });
// }
// });
// },
// });
// } // }
}; };
const startSave = () => { const startSave = () => {
VehicleApi.addRegis({ VehicleApi.updateRegis({
...model1.formData, ...model1.formData,
ownerType: model1.formData.ownerType === "个人" ? 0 : 1, ownerType: model1.formData.ownerType === "个人",
status: 2,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
@ -328,31 +831,78 @@ const startSave = () => {
}); });
}; };
const handleDialog = (key: string, v: boolean) => { const handleBack = () => {
showDialog[key] = v; uni.navigateBack();
}; };
const changeCarNo = (plate: string) => { const getLocationList = () => {
if (plate.length >= 7) model1.formData.licensePlate = plate; VehicleApi.getLocation({}).then((res: any) => {
showDialog.showCarNo = false; if (res.code === 200) {
contrlModalParams.location.list = res.data[0].children;
// console.log(contrlModalParams.location.list);
// contrlModalParams.reCategory.list = [
// (res.data as any).map((item: any) => {
// return { ...item, name: item.reCategoryName };
// }),
// ];
// contrlModalParams.reCategory.list.push(
// contrlModalParams.reCategory.list[0][0].childrenList
// );
}
});
}; };
const handleChange = (arr: any) => { function changeClick(value, value2, value3, value4) {
model1.formData.brandName = arr.map((item:any) => {return item.brandName}).toString() // console.log(" = " + value + value2 + value3 + value4);
model1.formData.brandId = arr.map((item:any) => {return item.id}).toString()
}; contrlModalParams["location"].province = value;
contrlModalParams["location"].city = value2;
contrlModalParams["location"].area = value3;
contrlModalParams["location"].areaCode = value4;
}
function onhideShow() {
contrlModalParams["location"].isShow = false;
// console.log("");
}
//
function onsetCity(e) {
let data = e.detail.target.dataset;
let address = data.province + data.city + data.area;
contrlModalParams["location"].isShow = false;
contrlModalParams["location"].address = address;
model1.formData.location = address;
}
onMounted(() => {
getLocationList();
});
onLoad((option: any) => {
//
if (option.id) {
model1.formData.id = option.id;
VehicleApi.getDetail({ id: option.id }).then((res: any) => {
if (res.code === 200) {
model1.formData = {
...res.data,
ownerType: res.data.ownerType ? "单位" : "个人",
};
}
});
}
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .uni-card__content { .uni-card__content {
padding: 20rpx !important; padding: 10px !important;
height: calc(100vh - 200px); height: calc(100vh - 100px);
overflow: auto; overflow: auto;
} }
::v-deep .uni-card--shadow { ::v-deep .uni-card--shadow {
padding: 0px !important; padding: 0px !important;
} }
::v-deep .u-form-item { ::v-deep .u-form-item {
height: auto; height: auto !important;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76); border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
margin: 0px 20rpx; margin: 0px 20rpx;
padding: 0px 20rpx; padding: 0px 20rpx;
@ -368,4 +918,17 @@ const handleChange = (arr: any) => {
width: 70%; width: 70%;
} }
} }
.price {
font-size: 38rpx;
font-weight: bold;
color: red;
text-align: center;
}
.tip {
font-size: 22rpx;
color: rgba(0, 0, 0, 0.35);
margin-top: 20rpx;
text-align: center;
}
</style> </style>

View File

@ -7,7 +7,7 @@ export const upload = (data: any) => {
return http({ return http({
method: "POST", method: "POST",
header: {type: 'UPLOAD'}, header: {type: 'UPLOAD'},
url: "/api/v1/upload/file/upload", url: "/api/v1/upload/file/upload?front=" + data.front,
data, data,
}); });
}; };

View File

@ -3,13 +3,13 @@ import { http } from "@/utils/http";
// 新增咨询 // 新增咨询
export const add = (data: any) => { // export const add = (data: any) => {
return http({ // return http({
method: "POST", // method: "POST",
url: "/api/v1/vehicleInfo/add", // url: "/api/v1/vehicleInfo/add",
data, // data,
}); // });
}; // };
// 新增登记 // 新增登记
export const addRegis = (data: any) => { export const addRegis = (data: any) => {
@ -20,6 +20,14 @@ export const addRegis = (data: any) => {
}); });
}; };
export const updateRegis = (data: any) => {
return http({
method: "POST",
url: "/api/v1/vehicleRegistration/updateById",
data,
});
};
export const getBrand = (data: any) => { export const getBrand = (data: any) => {
return http({ return http({
@ -31,12 +39,43 @@ export const getBrand = (data: any) => {
export const queryRegis = (data: any) => { export const queryRegis = (data: any) => {
return http({ return http({
method: "get", method: "GET",
url: "/api/v1/vehicleRegistration/findPage", url: "/api/v1/vehicleRegistration/findPage",
data, data,
}); });
}; };
export const getLocation = (data: any) => {
return http({
method: "GET",
url: "/api/v1/city/findPage",
data,
});
};
export const getRegisList = (data: any) => {
return http({
method: "GET",
url: "/api/v1/vehicleRegistration/findPage",
data,
});
};
export const getDetail = (data: any) => {
return http({
method: "GET",
url: "/api/v1/vehicleRegistration/selectOne",
data,
});
};

View File

@ -53,17 +53,17 @@ body {
position: fixed; position: fixed;
width: calc(100vw - 100rpx); width: calc(100vw - 100rpx);
bottom: 0rpx; bottom: 0rpx;
z-index: 999; z-index: 98;
} }
.uni-calendar-item--multiple .uni-calendar-item--before-checked, .uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked, .uni-calendar-item--multiple .uni-calendar-item--after-checked,
.uni-calendar-item__weeks-box .uni-calendar-item--checked, .uni-calendar-item__weeks-box .uni-calendar-item--checked,
.uni-datetime-picker--btn { .uni-datetime-picker--btn {
background-color: #00d2e3 !important; background-color: #294AC7 !important;
} }
.uni-datetime-picker-btn-text { .uni-datetime-picker-btn-text {
color: #00d2e3 !important; color: #294AC7 !important;
} }
.uni-date__x-input { .uni-date__x-input {
font-size: 12px; font-size: 12px;
@ -113,4 +113,4 @@ body {
font-size: 24rpx; font-size: 24rpx;
color: #000000; color: #000000;
} }
} }