lilei 1 anno fa
parent
commit
8033957b40

+ 41 - 17
pagesA/qualityPolicy/creatCarInfo.vue

@@ -2,13 +2,14 @@
 	<view class="pages flex flex_column">
 		<u-read-more toggle close-text="展开全部">
 			<view class="uuid-list">
-				<view class="flex align_center" v-for="item in uuid" :key="item.code">
+				<view class="flex align_center" v-for="item in uuid" :key="item.id">
 					<view class="uuid-info">
-						<view>轮胎名称:{{item.name}}</view>
-						<view class="uuid">轮胎唯一码:{{item.code}}</view>
+						<view>产品名称:{{item.productName}}</view>
+						<view>产品编码:{{item.productCode}}</view>
+						<view class="uuid">唯一码:{{item.traceCode}}</view>
 					</view>
 					<view class="uuid-img">
-						<image style="width: 100%;height: 80px;background: #eaeaea;" :src="item.img"></image>
+						<image style="width: 100%;height: 80px;background: #eaeaea;" :src="item.productMsg"></image>
 					</view>
 				</view>
 			</view>
@@ -23,16 +24,16 @@
 			</view>
 			<view class="flex align_center">
 				<view class="labes"><text>*</text>识别VIN码:</view>
-				<view class="inputs"><u-input :focus="focusInput" v-model="form.vinCode" maxlength="17" border clearable type="text" placeholder="请输入VIN码"></u-input></view>
+				<view class="inputs"><u-input :focus="focusInput" @blur="getCarInfo" v-model="form.vin" maxlength="17" border clearable type="text" placeholder="请输入VIN码"></u-input></view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes"><text>*</text>里程数:</view>
-				<view class="inputs"><u-input v-model="form.mileage" disabled border clearable @click="openKey('number')" placeholder="请输入里程数"></u-input></view>
+				<view class="inputs"><u-input v-model="form.mileage" border clearable @click="openKey('number')" placeholder="请输入里程数"></u-input></view>
 				<view class="btns">KM</view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes">车牌号:</view>
-				<view class="inputs"><u-input v-model="form.carNo" disabled @click="openKey('car')" maxlength="12" border clearable type="text" placeholder="请输入车牌号"></u-input></view>
+				<view class="inputs"><u-input v-model="form.vehicleNumber" @click="openKey('car')" maxlength="8" border clearable type="text" placeholder="请输入车牌号"></u-input></view>
 			</view>
 		</view>
 		 
@@ -45,6 +46,7 @@
 </template>
 
 <script>
+	import { getVehicleInfoByVin } from '@/api/car'
 	export default {
 		data() {
 			return {
@@ -52,9 +54,14 @@
 				showkeyboard: false,
 				tempImg: '',
 				form:{
-					vinCode: '',
+					vin: '',
 					mileage: '',
-					carNo: ''
+					vehicleNumber: '',
+					carBrand: '',
+					carModel: '',
+					// icon:'',
+					// year:'',
+					// text:''
 				},
 				uuid: [],
 				focusInput: false
@@ -62,13 +69,14 @@
 		},
 		onLoad() {
 			const tempData = this.$store.state.vuex_uuidTempData
-			this.uuid = tempData&&tempData.uuid ? tempData.uuid : []
+			this.uuid = tempData&&tempData.traceCodeList ? tempData.traceCodeList : []
 		},
 		onShow() {
 			const ret = this.$store.state.vuex_tempData
 			if(ret&&ret.retCode){
 				this.tempImg = ret.filePath
-				this.form.vinCode = ret.retCode
+				this.form.vin = ret.retCode
+				this.getCarInfo()
 			}
 			this.focusInput = ret&&ret=="inputCode"
 		},
@@ -87,7 +95,7 @@
 					this.form.mileage += val;
 				}
 				if(this.keyMode == 'car'){
-					this.form.carNo += val;
+					this.form.vehicleNumber += val;
 				}
 			},
 			// 退格键被点击
@@ -96,9 +104,9 @@
 					console.log(this.form.mileage)
 					this.form.mileage = this.form.mileage.substr(0, this.form.mileage.length - 1)
 				}
-				if(this.keyMode == 'car' && this.form.carNo.length){
-					console.log(this.form.carNo)
-					this.form.carNo = this.form.carNo.substr(0, this.form.carNo.length - 1)
+				if(this.keyMode == 'car' && this.form.vehicleNumber.length){
+					console.log(this.form.vehicleNumber)
+					this.form.vehicleNumber = this.form.vehicleNumber.substr(0, this.form.vehicleNumber.length - 1)
 				}
 			},
 			// 清空键盘输入框
@@ -107,7 +115,7 @@
 					this.form.mileage = '';
 				}
 				if(this.keyMode == 'car'){
-					this.form.carNo = '';
+					this.form.vehicleNumber = '';
 				}
 			},
 			openKey(mode){
@@ -119,8 +127,24 @@
 					url: "/pages/scan-frame/scan-frame?pageType=UUID"
 				})
 			},
+			//获取车辆信息
+			async getCarInfo(){
+				const ret = await getVehicleInfoByVin({vin: this.form.vin})
+				if(ret.data){
+					this.form.carBrand = ret.data.brand_name
+					this.form.carModel = ret.data.model_name
+					// this.form.icon = ret.data.icon
+					// this.form.year = ret.data.year
+					// this.form.text = ret.data.text
+				}else{
+					uni.showToast({
+						icon: 'none',
+						title: ret.message
+					})
+				}
+			},
 			saveForm(){
-				if(this.form.vinCode == ''){
+				if(this.form.vin == ''){
 					uni.showToast({
 						icon: 'none',
 						title: '请扫描或手动输入VIN码'

+ 49 - 20
pagesA/qualityPolicy/creatCustomInfo.vue

@@ -1,14 +1,14 @@
 <template>
 	<view class="pages flex flex_column">
-		<view class="forms">
+		<view class="forms" v-if="carInfo">
 			<view class="forms-tits">车辆信息</view>
 			<view class="flex align_center">
 				<view class="labes">车辆品牌:</view>
-				<view class="inputs">日产(东风)</view>
+				<view class="inputs">{{carInfo.carBrand}}</view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes">车型:</view>
-				<view class="inputs">轩逸</view>
+				<view class="inputs">{{carInfo.carModel}}</view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes">里程数:</view>
@@ -16,7 +16,7 @@
 			</view>
 			<view class="flex align_center">
 				<view class="labes">车牌号:</view>
-				<view class="inputs">{{carInfo.carNo}}</view>
+				<view class="inputs">{{carInfo.vehicleNumber}}</view>
 			</view>
 		</view>
 		
@@ -24,11 +24,11 @@
 			<view class="forms-tits">客户联系方式</view>
 			<view class="flex align_center">
 				<view class="labes"><text>*</text>客户姓名:</view>
-				<view class="inputs"><u-input :focus="focusInput" v-model="form.customerName" maxlength="30" border clearable type="text" placeholder="请输入客户姓名"></u-input></view>
+				<view class="inputs"><u-input :focus="focusInput" v-model="form.customName" maxlength="30" border clearable type="text" placeholder="请输入客户姓名"></u-input></view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes"><text>*</text>手机号码:</view>
-				<view class="inputs"><u-input v-model="form.phone" type="number" maxlength="11" border clearable placeholder="请输入手机号码"></u-input></view>
+				<view class="inputs"><u-input v-model="form.customMobile" type="number" maxlength="11" border clearable placeholder="请输入手机号码"></u-input></view>
 			</view>
 			<view class="flex align_center">
 				<view class="labes"><text>*</text>验证码:</view>
@@ -43,7 +43,7 @@
 		 
 		<view class="buttons flex align_center">
 			<u-button type="default" @click="toBack">上一步</u-button>
-			<u-button type="primary" @click="saveForm">确定</u-button>
+			<u-button type="primary" :loading="loading" @click="saveForm">确定</u-button>
 		</view>
 		<!-- 图文验证码 -->
 		<uni-popup @change="changeModal" ref="imageTxtPopup" type="center">
@@ -55,9 +55,14 @@
 <script>
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import popupCon from '@/components/uni-popup/popup-con.vue'
+	import {
+		sendLoginVerifyCode
+	} from '../../api/login.js'
 	import {
 		isvalidPhone
 	} from '@/libs/validate.js'
+	import{ traceWarrantySave } from '@/api/trace.js'
+	
 	export default {
 		components: {
 			uniPopup,
@@ -74,21 +79,24 @@
 				isDisabled: false ,// 倒计时按钮是否禁用
 				checkedXy: true,
 				carInfo:{
-					vinCode: '',
+					vin: '',
 					mileage: '',
-					carNo: ''
+					vehicleNumber: '',
+					carBrand: '',
+					carModel: '',
 				},
 				form:{
-					customerName: '',
-					phone: '',
+					customName: '',
+					customMobile: '',
 					vericode: ''
 				},
 				uuid: [],
+				loading: false
 			}
 		},
 		onLoad() {
 			const tempData = this.$store.state.vuex_uuidTempData
-			this.uuid = tempData&&tempData.uuid ? tempData.uuid : [],
+			this.uuid = tempData&&tempData.traceCodeList ? tempData.traceCodeList : [],
 			this.carInfo = Object.assign(this.carInfo, tempData.carInfo)
 		},
 		methods: {
@@ -120,9 +128,9 @@
 			checkMobile() {
 				if(this.isDisabled){return}
 				if (!this.getCodeing) {
-					if (this.form.phone) {
-						console.log(!isvalidPhone(this.form.phone))
-						if (!isvalidPhone(this.form.phone)) {
+					if (this.form.customMobile) {
+						console.log(!isvalidPhone(this.form.customMobile))
+						if (!isvalidPhone(this.form.customMobile)) {
 							uni.showToast({
 								title: '请输入正确的手机号码',
 								icon: 'none'
@@ -151,7 +159,7 @@
 			captchaVerify(code, nowRandomCode) {
 				const _this = this
 				let obj = {}
-				obj.mobile = this.form.phone
+				obj.mobile = this.form.customMobile
 				obj.random = nowRandomCode
 				obj.code = code
 				obj.signName = '修配易码通'
@@ -191,14 +199,14 @@
 				})
 			},
 			saveForm(){
-				if(this.form.customerName == ''){
+				if(this.form.customName == ''){
 					uni.showToast({
 						icon: 'none',
 						title: '请输入客户名称'
 					})
 					return
 				}
-				if(this.form.phone == ''){
+				if(this.form.customMobile == ''){
 					uni.showToast({
 						icon: 'none',
 						title: '请输入电话号码'
@@ -213,8 +221,28 @@
 					return
 				}
 				this.$store.state.vuex_uuidTempData.customerInfo = this.form
-				uni.redirectTo({
-					url: "/pagesA/qualityPolicy/resultOrder"
+				const formData = this.$store.state.vuex_uuidTempData
+				console.log(formData)
+				const params = {...formData.carInfo,...formData.customerInfo}
+				const uuidList = []
+				formData.traceCodeList.map(item => {
+					uuidList.push(item.traceCode)
+				})
+				params.traceCodeList = uuidList
+				console.log(params)
+				// 保存数据
+				this.loading = true
+				traceWarrantySave(params).then(res => {
+					uni.showToast({
+						icon: 'none',
+						title: res.message
+					})
+					if(res.status == 200){
+						uni.redirectTo({
+							url: "/pagesA/qualityPolicy/resultOrder"
+						})
+					}
+					this.loading = false
 				})
 			}
 		}
@@ -279,6 +307,7 @@
 		text-align: center;
 		color: dodgerblue;
 		font-size: 0.8rem;
+		width: 5rem;
 	}
 }
 </style>

+ 9 - 9
pagesA/qualityPolicy/creatOrder.vue

@@ -9,11 +9,11 @@
 			<view class="flex align_center">
 				<view class="labes">识别唯一码:</view>
 				<view class="inputs"><u-input :focus="focusInput" v-model="uuidCode" maxlength="10" border clearable type="text" placeholder="请输入唯一码"></u-input></view>
-				<view class="btns"><u-button type="primary" size="mini" @click="addTags">添加</u-button></view>
+				<view class="btns"><u-button :loading="loading" type="primary" size="mini" @click="addTags">添加</u-button></view>
 			</view>
 		</view>
 		<view class="tags-box">
-			<u-tag v-for="item in uuid" :key="item.code" :text="item.code" closeable @close="tagClick(item)" />
+			<u-tag v-for="item in uuid" :key="item.id" :text="item.traceCode" closeable @close="tagClick(item)" />
 		</view>
 		<view class="buttons">
 			<u-button type="primary" @click="saveForm">确定</u-button>
@@ -29,7 +29,8 @@
 				tempImg: '',
 				uuidCode: '',
 				uuid: [],
-				focusInput: false
+				focusInput: false,
+				loading: false
 			}
 		},
 		onShow() {
@@ -52,7 +53,7 @@
 		},
 		methods: {
 			tagClick(item){
-				const index = this.uuid.findIndex(k => k.code == item.code)
+				const index = this.uuid.findIndex(k => k.traceCode == item.traceCode)
 				if(index>=0){
 					this.uuid.splice(index,1)
 				}
@@ -66,6 +67,7 @@
 					return
 				}
 				if(this.uuidCode){
+					this.loading = true
 					const hasCode = await getTraceCodeQueryList({traceCode: this.uuidCode,pageSize:1,pageNo:1}).then(res => res.data)
 					console.log(hasCode)
 					// 已存在,且没有使用过
@@ -74,16 +76,14 @@
 							icon: 'none',
 							title: '唯一码不存在'
 						})
+						this.loading = false
 						return
 					}
 					if(hasCode.list && hasCode.list.length > 0 && !hasCode.list[0].warrantyState){
-						this.uuid.push({
-							code: this.uuidCode,
-							name: '箭冠轮胎雪胎RT-8000',
-							state: ['inhand','outof'][Math.random() < 0.5 ? 0 : 1]
-						})
+						this.uuid.push(hasCode.list[0])
 					}
 					this.uuidCode = ''
+					this.loading = false
 				}else{
 					uni.showToast({
 						icon: 'none',