This commit is contained in:
PQZ 2024-10-18 17:21:12 +08:00
commit c1998e6f88
3 changed files with 211 additions and 97 deletions

View File

@ -18,24 +18,25 @@
</view>
</view>
</view>
<view v-if="typeList && typeList.length > 0" class="projPicker">
<view v-if="typeList && typeList.length > 0" class="projPicker" style="display: flex">
<view class="type">
<view v-for="item in typeList" :key="item.id" :class="{'active': typeId === item.id}" class="typeItem"
<view v-for="item in typeList" :key="item.typeId" :class="{'active': typeId === item.typeId}" class="typeItem"
@click="chooseType(item)">
{{ item.name }}
{{ item.typeName }}
</view>
</view>
<view class="container">
<view v-for="item in groupList" :key="item.id" class="groupList">
<view class="groupHeader">
<view class="line"></view>
<text>{{ item.name }}</text>
<view class="line"></view>
</view>
<view class="groupList">
<!-- <view class="groupHeader">-->
<!-- <view class="line"></view>-->
<!-- <text>{{ item.name }}</text>-->
<!-- <view class="line"></view>-->
<!-- </view>-->
<view class="projList">
<view v-for="(proj, index) in item.projList" :key="proj.id" class="projItem" @click="chooseProj(proj)">
<text class="projName">{{ proj.name }}</text>
<image v-if="selectedProj && selectedProj.find(f => f.id === proj.id)" class="projChooseIcon"
<!-- <view v-for="(proj, index) in item.projList" :key="proj.id" class="projItem" @click="chooseProj(proj)">-->
<view v-for="item in groupList" :key="item.id" class="projItem" @click="chooseProj(item)">
<text class="projName">{{ item.name }}</text>
<image v-if="selectedProj && selectedProj.find(f => f.id === item.id)" class="projChooseIcon"
mode="aspectFit" src="/static/icons/duihao.png"></image>
</view>
</view>
@ -48,52 +49,26 @@
</view>
</template>
<script>
import request from "@/utils/request";
export default {
name: "projectPicker",
data() {
return {
selectedProj: [
{name: '精洗内饰', id: 1},
{name: '内饰精洗除臭', id: 2},
{
name: '烘干底板胶及脚垫',
id: 3
},
{name: '精致洗车(轿车)', id: 4},
{name: '人保核销洗车劵', id: 5},
{name: '人保核销洗车劵', id: 6}
],
typeList: [
{
name: '洗车',
id: 1,
groupList: [
{
name: '精洗',
id: 'groupId1',
projList: [{name: '清洗内饰', id: 1}, {name: '内饰精洗除臭', id: 2}]
}
]
},
{
name: '二手车',
id: 2
}
],
typeList: [],
typeId: 1,
groupList: [
{
name: '精洗',
id: 'groupId1',
projList: [{name: '清洗内饰', id: 1}, {name: '内饰精洗除臭', id: 2}]
}
]
groupList: []
}
},
methods: {
open(selectedProj = []) {
console.log("执行onload")
this.$refs.popup.open()
this.selectedProj = JSON.parse(JSON.stringify(selectedProj))
this.getProjeectList()
// this.selectedProj = JSON.parse(JSON.stringify(selectedProj))
},
removeProj(index) {
this.selectedProj.splice(index, 1)
@ -108,7 +83,46 @@ export default {
},
chooseType(type) {
this.groupList = type.groupList
this.typeId = type.id
this.typeId = type.typeId
},
getProjeectList() {
const categoryList = []
console.log("执行")
const params = {
pageNo: 1,
pageSize: 10000,
type: '03'
}
request({
url: '/admin-api/repair/project/getRepairProjectAndCateGory',
method: 'GET',
params: params
}).then(res => {
console.log("分类",res);
this.typeList = res.data
// categoryList.push(...res.data)
// console.log("categoryList",categoryList)
//
// categoryList.forEach(item => {
// let a = {
// name: item.name,
// id: item.id,
// groupList: [
//
// ]
// }
// this.typeList.push(a)
// })
// console.log("typeList",this.typeList)
})
request({
url: '/admin-api/repair/project/page',
method: 'GET',
params: params
}).then(res => {
console.log("项目",res);
this.projectList = res.data.records
})
},
confirm() {

View File

@ -7,6 +7,14 @@
<view class="phoneHeader">
<view class="title">查找手机号</view>
<view class="desc">根据手机号查找/建立客户信息</view>
<view>
<radio-group @change="handleChange">
<label v-for="(option, index) in options" :key="index" class="radio-label">
<radio :value="option.value" :checked="option.value === ticketType" />
<text>{{ option.label }}</text>
</label>
</radio-group>
</view>
</view>
<view class="phoneBody">
<view class="searchBox">
@ -41,7 +49,10 @@
<image :src="carList[activeCarIndex].carLicenseImg" class="carImage" mode="aspectFill"></image>
<view class="carHeaderRight">
<text class="carNumber">{{ carList[activeCarIndex].licenseNumber }}</text>
<text class="carType">{{ (carList[activeCarIndex].brandStr == null ? '' : carList[activeCarIndex].brandStr) + ' ' + (carList[activeCarIndex].modelStr == null ? '' : carList[activeCarIndex].modelStr) }}</text>
<text class="carType">{{
(carList[activeCarIndex].brandStr == null ? '' : carList[activeCarIndex].brandStr) + ' ' + (carList[activeCarIndex].modelStr == null ? '' : carList[activeCarIndex].modelStr)
}}
</text>
</view>
</view>
<view class="carBody">
@ -159,6 +170,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import ProjectPicker from "@/components/projectPicker.vue";
import {bus} from "@/utils/eventBus";
import request from "@/utils/request";
import {getToken,setUserInfo,getUserInfo} from '@/utils/auth.js'
export default {
components: {
@ -171,20 +183,59 @@ export default {
carList: [],
activeCarIndex: 0,
userInfo: null,
selectedProj: []
selectedProj: [],
typeList:[],
ticketType: '01',
options: [
{ label: 'A单', value: '01' },
{ label: 'B单', value: '02' }
],
}
},
onLoad(data) {
},
methods: {
//
submit() {
uni.showToast({
title: '创建成功',
icon: 'success'
console.log('userInfo',this.userInfo)
console.log(this.carList[this.activeCarIndex])
console.log('selectedProj',this.selectedProj)
console.log("ticketType",this.ticketType)
console.log('登陆人信息',getUserInfo())
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0){
uni.showToast({
title: '请完善信息',
icon: 'none'
})
return
}
request({
url: '/admin-api/repair/tickets/create',
method: 'POST',
data: {
userId: this.userInfo.id,
userName: this.userInfo.cusName,
userMobile: this.userInfo.phoneNumber,
carId: this.carList[this.activeCarIndex].id,
carNo: this.carList[this.activeCarIndex].licenseNumber,
carVin: this.carList[this.activeCarIndex].vin,
carBrandId: this.carList[this.activeCarIndex].carBrand,
carBrandName: this.carList[this.activeCarIndex].brandStr,
carBrandType: this.carList[this.activeCarIndex].brandType,
adviserId: getUserInfo().id,
adviserName: getUserInfo().nickname,
ticketType: this.ticketType,
itemList: this.formatItem(this.selectedProj)
}
}).then(res => {
uni.showToast({
title: '创建成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack();
}, 600)
})
setTimeout(() => {
uni.navigateBack();
}, 600)
},
listUserInfo() {
this.carList = []
@ -205,6 +256,33 @@ export default {
}
})
},
//
formatItem(list) {
if (!(list && list.length > 0)) {
return []
}
return list.map(item => {
const temp = {
...item,
itemName: item.name,
itemCount: 1,
itemUnit: item.unit,
itemPrice: item.price,
itemMoney: item.price,
itemTypeId: item.type,
remark: item.remark,
itemStatus: item.itemStatus,
itemType: "01",
projectId: item.id,
id: null
}
return temp;
})
},
handleChange(event) {
this.ticketType = event.detail.value;
},
getCarList() {
const params = {
userId: this.userInfo.userId
@ -228,9 +306,18 @@ export default {
this.carList.push(carInfo)
}
})
uni.navigateTo({
url: `/pages/myCar/carDetail?car=${index >= 0 ? encodeURIComponent(JSON.stringify(this.carList[index])) : ''}`
})
if (this.userInfo == null) {
//
uni.showToast({
title: '请先选择客户',
icon: 'none'
})
} else {
uni.navigateTo({
url: `/pages/myCar/carDetail?car=${index >= 0 ? encodeURIComponent(JSON.stringify(this.carList[index])) : ''}&userInfo=${encodeURIComponent(JSON.stringify(this.userInfo))}`
});
}
},
editUserInfo(userInfo) {
bus.$off('updateUserInfo')
@ -247,6 +334,7 @@ export default {
},
projConfirm(proj) {
this.selectedProj = proj
console.log("回到主页后", proj)
}
}
}
@ -528,6 +616,15 @@ export default {
}
}
.radio-label {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
.radio-label text {
margin-left: 10rpx;
}
}
</style>

View File

@ -7,7 +7,7 @@
<u-form-item borderBottom label="上传图片" labelWidth="200">
<u-upload></u-upload>
</u-form-item>
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick(); hideKeyboard()">
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick();">
<u-input
v-model="car.licenseNumber"
border="none"
@ -20,7 +20,7 @@
name="arrow-right"
></u-icon>
</u-form-item>
<u-form-item label="车辆品牌" labelWidth="200" @click="brandType = true; hideKeyboard()">
<u-form-item label="车辆品牌" labelWidth="200" @click="brandType = true;">
<u-input
v-model="car.brandStr"
border="none"
@ -33,18 +33,12 @@
name="arrow-right"
></u-icon>
</u-form-item>
<u-form-item label="车辆型号" labelWidth="200" @click="showType = true; hideKeyboard()">
<u-form-item label="车辆型号" labelWidth="200">
<u-input
v-model="car.modelStr"
v-model="car.carModel"
border="none"
disabled
disabledColor="#ffffff"
placeholder="请选择车辆型号"
placeholder="请输入车辆型号"
></u-input>
<u-icon
slot="right"
name="arrow-right"
></u-icon>
</u-form-item>
</view>
@ -55,7 +49,7 @@
<u-form-item borderBottom label="发动机号" labelWidth="200">
<u-input v-model="car.engineNumber" border="none" placeholder="请输入发动机号"></u-input>
</u-form-item>
<u-form-item borderBottom label="年检时间" labelWidth="200" @click="openDatePicker('nj'); hideKeyboard()">
<u-form-item borderBottom label="年检时间" labelWidth="200" @click="openDatePicker('nj'); ">
<u-input
v-model="car.inspectionDate"
border="none"
@ -159,10 +153,11 @@ export default {
//
carNature: '',
//
carRegisterDate: '2024-09-24',
carRegisterDate: '',
//
brandAndModel: '',
brandAndModel: [],
},
userInfo: {},
bo1: false,
bo2: true,
@ -192,6 +187,9 @@ export default {
this.bo2 = true;
this.pageTitle = '添加车辆信息'
}
this.car.userId = JSON.parse(decodeURIComponent(options.userInfo)).userId;
this.userInfo = JSON.parse(decodeURIComponent(options.userInfo))
console.log(this.car)
this.getBrandList()
},
methods: {
@ -201,25 +199,7 @@ export default {
brandSelect(e) {
console.log('e', e)
this.brandId = e.value
this.getCarModule()
},
getCarModule() {
request({
url: '/admin-api/base/carModel/pageById',
method: 'GET',
params: {
page: 1,
size: 10000,
brandId: this.brandId
}
}).then(res => {
console.log(res);
res.data.records.forEach(item => {
item.name = item.modelName,
item.value = item.id
})
this.typeList = res.data.records
})
// this.getCarModule()
},
getBrandList() {
request({
@ -249,11 +229,11 @@ export default {
openDatePicker(picker) {
if (picker === 'nj') {
this.pickerConfirmField = 'njDate'
this.pickerConfirmField = 'inspectionDate'
} else if (picker === 'bx') {
this.pickerConfirmField = 'bxDate'
this.pickerConfirmField = 'insuranceDate'
} else if (picker === 'zcrq') {
this.pickerConfirmField = 'zcrqDate'
this.pickerConfirmField = 'carRegisterDate'
}
this.datePickerShow = true
},
@ -281,8 +261,9 @@ export default {
},
//
async submit() {
bus.$emit('updateCarInfo', this.car)
// bus.$emit('updateCarInfo', this.car)
this.car.brandAndModel = [this.brandId, this.car.carModel]
console.log("car",this.car)
if (this.car.id != null) {
request({
url: '/admin-api/base/carMain/update',
@ -294,9 +275,31 @@ export default {
url: '/admin-api/base/carMain/create',
method: 'POST',
data: this.car,
}).then(res => {
request({
url: '/admin-api/base/carMain/page',
method: 'GET',
params: {
licenseNumber:this.car.licenseNumber
}
}).then( res =>{
this.car = res.data.records[0]
console.log("执行")
request({
url: '/admin-api/base/custom/bindCustomerCar',
method: 'post',
data :{
carList: [this.car],
id: this.userInfo.id
}
}).then( res =>{
uni.navigateBack();
})
})
})
}
uni.navigateBack();
// let res = await request({
// url: '/userClient/base/myCar/create',
// method: 'POST',