Commit 30c9091f by 胡悦

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.0

2 parents 08e60f07 bbf2f1f9
......@@ -554,4 +554,13 @@ module.exports = {
...data
})
},
// VIN车架号校验
checkVinValidate(data={}) {
console.log("调用接口checkVinValidate",data);
return http.post({
method: 'dj.pad.api.vin.validate',
projectName: 'pad',
...data,
})
},
}
......@@ -2,7 +2,7 @@ import http from '../request/http'
module.exports = {
/** 销售顾问/录单员 & 交付专员 */
getEmployeeList (data) {
getEmployeeList(data) {
return http.post({
method: 'dj.api.smartcarlife.employee.onTheJob.getByMerchantId',
projectName: 'boutique',
......@@ -13,7 +13,7 @@ module.exports = {
* 二级流量方
*/
getDiversionMerchantRef (data) {
getDiversionMerchantRef(data) {
return http.post({
method: 'dj.api.smartcarlife.diversionMerchant.getDiversionMerchantRef',
projectName: 'boutique',
......@@ -24,7 +24,7 @@ module.exports = {
* 获取门店品牌车型
*/
getMerchantCarBrandList (data) {
getMerchantCarBrandList(data) {
return http.post({
method: 'dj.api.get.car.brandList',
projectName: 'boutique',
......@@ -36,7 +36,7 @@ module.exports = {
/***
* 获取门店礼券列表
*/
getMerchantCouponList (data) {
getMerchantCouponList(data) {
return http.post({
method: 'dj.api.smartCarLife.merchant.coupon.list',
projectName: 'boutique',
......@@ -46,7 +46,7 @@ module.exports = {
/**
* 获取客户礼券列表
*/
getCustomerCouponList (data) {
getCustomerCouponList(data) {
return http.post({
method: 'dj.api.customer.coupon.list',
projectName: 'boutique',
......@@ -56,7 +56,7 @@ module.exports = {
/**
* 获取商品列表
*/
getGoodsList (data) {
getGoodsList(data) {
return http.post({
method: 'dj.api.smartcarlife.selectOrderGoods.list',
projectName: 'boutique',
......@@ -65,7 +65,7 @@ module.exports = {
},
/**获取订单列表筛选转化人员&销售顾问 */
getOrderScreenEmployeeList (data) {
getOrderScreenEmployeeList(data) {
return http.post({
method: 'dj.api.smartcarlife.employee.getByMerchantId',
projectName: 'boutique',
......@@ -75,7 +75,7 @@ module.exports = {
/**
* 获取园区店配置
*/
getYqStoreConfig (data) {
getYqStoreConfig(data) {
return http.get({
method: 'dj.api.smarcarlife.yqMerchantConfig.detail',
projectName: 'boutique',
......@@ -84,9 +84,9 @@ module.exports = {
},
/**
* 战败下单商品列表
*
*
*/
getOrderUpgradeGoodsList (data) {
getOrderUpgradeGoodsList(data) {
return http.post({
method: 'dj.api.smartcarlife.orderUpgradeGoods.listByMerchantId',
projectName: 'boutique',
......@@ -96,7 +96,7 @@ module.exports = {
/**
* 获取精品升级场景 太阳膜类商品部位数据
*/
getPositionList (data) {
getPositionList(data) {
return http.post({
method: 'dj.api.smartcarlife.goodsPosition.list',
projectName: 'boutique',
......@@ -104,14 +104,32 @@ module.exports = {
})
},
/**
* 获取提单客户档案列表
*
*/
getQuotationCustomerList (data) {
* 获取提单客户档案列表
*
*/
getQuotationCustomerList(data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.customer.page',
projectName: 'boutique',
...data
})
},
/**搜索订单(含套餐) */
getWorkPackageGoodsList(data) {
let params = data || {}
params.sceneType = 1
return http.post(
{
method: 'dj.api.smartcarlife.order.search.containPackageGoods',
projectName: 'boutique',
...data,
pageSize: 10,
pageSize: 999999,
statusList: [1]
},
false,
'dj',
1000000
)
}
}
\ No newline at end of file
}
......@@ -11,8 +11,8 @@ class Request {
get(params, returnAll = false, hostType) {
return this.request('GET', params, returnAll, hostType)
}
post(params, returnAll = false, hostType) {
return this.request('POST', params, returnAll, hostType)
post(params, returnAll = false, hostType, timeout) {
return this.request('POST', params, returnAll, hostType, timeout)
}
fetch(method, data, returnAll = true, hostType) {
return this.post(
......@@ -24,7 +24,7 @@ class Request {
hostType
)
}
request(RequestMethods, params, returnAll, hostType = 'dj') {
request(RequestMethods, params, returnAll, hostType = 'dj', timeout) {
return new Promise((resolve, reject) => {
let _this = this
uni.getNetworkType({
......@@ -57,6 +57,7 @@ class Request {
header,
dataType: 'json',
responseType: 'text',
timeout: timeout || 60000,
success(response) {
/**业务代码 */
let { data, statusCode } = response
......@@ -162,4 +163,4 @@ class Request {
})
}
}
export default new Request()
\ No newline at end of file
export default new Request()

2.92 MB | W: | H:

2.92 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -326,7 +326,7 @@ export default {
}
.uni-list-cell {
margin-left: toRpx(57.2);
margin-left: toRpx(48);
}
.radio-name {
......
<template>
<view class="customer-list">
<template v-for="(i, index) in listData">
<view
:key="index"
@click="choose(i)"
:class="['item flex', { active: checkActive(i) }]"
>
<view :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
<view class="sprite-icon icon-tag-checked"></view>
<template v-if="i.customerName">
{{i.customerName}}
<template v-if="i.customerName || (i.customer && i.customer.customerName)">
{{ i.customerName || (i.customer && i.customer.customerName) }}
</template>
<template v-if="i.carSeriesName">
<view class="car-model">({{i.carChildsBrandName || ''}}-{{i.carSeriesName}})</view>
<template v-if="i.carSeriesName || i.carType">
<view class="car-model">({{ i.carType ? i.carType : i.carChildsBrandName + '-' + i.carSeriesName || '' }})</view>
</template>
<template v-if="i.customerPhone">
<view class="phone">|{{i.customerPhone}}</view>
<template v-if="i.customerPhone || i.customer.customerPhone">
<view class="phone">|{{ i.customerPhone || (i.customer && i.customer.customerPhone) }}</view>
</template>
</view>
</template>
......@@ -27,14 +23,14 @@ export default {
mixins: [popupmixin],
name: 'Customer',
inject: ['userInfo'],
data () {
data() {
return {
}
},
mounted () {
mounted() {
},
methods: {
async getList (searchValue, search) {
async getList(searchValue, search) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
......@@ -50,30 +46,48 @@ export default {
currentPage: 1,
search: searchValue
}
const { list } = await uni.$api.popupApi.getQuotationCustomerList(apiParams)
this.updateParams(params, list || [])
let apiTargetName = !params.defeat ? 'getQuotationCustomerList' : 'getWorkPackageGoodsList'
console.log(apiTargetName, 'apiTargetName')
const { list } = await uni.$api.popupApi[apiTargetName](apiParams)
let customerList = list
if (params.defeat) {
const listArray = list.map(item => {
if (item.customer && item.customer.carSeriesName) {
item.carType = `${item.customer.carBrand || ''}-${item.customer.carChildsBrandName || ''}-${item.customer.carSeriesName || ''}`
}
return item
})
customerList = listArray
}
console.log(customerList, 'customerList')
this.updateParams(params, customerList || [])
},
initData (list) {
const { params: { idKey }, data } = this
initData(list) {
const { params: { idKey, defeat }, data } = this
let key = defeat ? 'id' : 'customerPhone'
console.log(data, idKey)
if (data[idKey]) {
this.currentId = data[idKey]
let item = list.find(i => i.id == this.currentId)
let item = list.find(i => i[key] == this.currentId)
this.$emit('choose', item)
}
this.list = list
this.$emit('onComplete')
},
handleSearch (searchValue) {
handleSearch(searchValue) {
this.list = []
this.getList(searchValue, true)
},
choose (i) {
this.currentId = i.id
choose(i) {
let { params } = this
let key = params.defeat ? 'id' : 'customerPhone'
this.currentId = i[key]
this.$emit('choose', i)
},
checkActive (i) {
checkActive(i) {
let { currentId, data, params } = this
return currentId ? i.id == currentId : i.id == data[params.idKey]
let key = params.defeat ? 'id' : 'customerPhone'
return currentId ? (i[key] == currentId) : (i[key]) == data[params.idKey]
}
}
}
......@@ -85,6 +99,7 @@ export default {
grid-template-columns: repeat(2, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
......@@ -94,6 +109,7 @@ export default {
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
......@@ -101,10 +117,12 @@ export default {
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
......
......@@ -127,6 +127,7 @@ export default {
const { days } = this
const { value } = e.detail
const index = value[0]
console.log( days[index],days,index)
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = dayjs().format('YYYY/MM/DD')
......@@ -175,6 +176,7 @@ export default {
this.minutes = minutes
},
getResult () {
console.log(this.currentDate,this.currentHour,this.currentMinute)
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute + ":00"
const result = dayjs(str).format('YYYY/MM/DD HH:mm:ss')
......
......@@ -50,7 +50,7 @@ export default {
},
initData (list) {
const { idKey, data } = this
console.log(idKey)
console.log(idKey,data)
if (data[idKey]) {
this.currentId = data[idKey]
let item = list.find(i => i.uuid == this.currentId)
......
......@@ -49,7 +49,7 @@
<text class="price">¥{{ i.goods.price }}</text>
</view>
<template v-if="i.goods.serveName">
<view class="base-tips">(包含{{i.goods.serveName}})</view>
<view class="base-tips">包含{{i.goods.serveName}}</view>
</template>
</template>
<template v-if="i.goodsFlag == 2">
......@@ -74,7 +74,7 @@
</template>
</view>
<template v-if="sceneType == 0 && i.multipleSpecificationsGoods.goods && i.multipleSpecificationsGoods.goods.serveName">
<view class="base-tips">(包含{{i.multipleSpecificationsGoods.goods.serveName}})</view>
<view class="base-tips">包含{{i.multipleSpecificationsGoods.goods.serveName}}</view>
</template>
<template v-if="i.multipleSpecificationsGoods.specificationList && i.multipleSpecificationsGoods.specificationList.length">
<view class="package-list">
......@@ -564,6 +564,7 @@ export default {
.price {
margin-left: auto;
flex-shrink: 0;
font-weight: 600;
}
.title {
......
......@@ -20,6 +20,7 @@
* 17:所在城市
* 18: 座位数
* 19: 客户档案
* 20: 战败客户档案
*/
const componentConfig = {
......@@ -184,7 +185,7 @@ const componentConfig = {
15: {
name: 'GoodsCategory',
title: '选择商品类目',
hideSearch: true,
loadComplete: false
},
......@@ -225,6 +226,19 @@ const componentConfig = {
loadComplete: false,
searchValue: '',
noData: false
},
20: {
name: 'Customer',
title: '客户档案',
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'id',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
defeat: true
}
}
export default { componentConfig }
<template>
<view class="employee-list">
<view
@click="currentIds = []"
:class="['item flex',{active:!currentIds.length}]"
>
<view @click="currentIds = []" :class="['item flex', { active: !currentIds.length }]">
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view
:key="index"
@click="choose(i)"
:class="['item flex',{active:checkActive(i)}]"
>
<view :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
<view class="sprite-icon icon-tag-checked"></view>
{{i.staffName}}
{{ i.staffName }}
</view>
</template>
</view>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
export default {
name: 'EmployeeList',
inject: ['userInfo'],
......@@ -59,8 +52,8 @@ export default {
}
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getOrderScreenEmployeeList({
merchantId: params.idKey == 'sellerUserIdList' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'sellerUserIdList' ? '' : [sceneType]
merchantId: params.idKey == 'transferIds' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'transferIds' ? '' : [sceneType]
})
if (data && data.length) {
this.initList(data)
......@@ -97,7 +90,7 @@ export default {
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.employee-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
......@@ -128,4 +121,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 2
const index = 1
/**
*
0本地
......
......@@ -52,6 +52,7 @@ import Package from './Package.vue'
import SkuGoods from './SkuGoods.vue'
import { FORM_LIST, popupTypeEnum, payTypeList } from '../contant'
import { interceptionMixin } from '@/mixin/index'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'CreateOrder',
mixins: [interceptionMixin],
......@@ -216,6 +217,7 @@ export default {
positionTypeList: [],
valueKey: '',
totalPrice: 0,
validateState:null,
// 产品槽位配置,用于循环渲染产品组件
productSlots: {
frontGear: true,
......@@ -382,6 +384,21 @@ export default {
inputBlur(e, val) {
console.log(e, val)
this.orderObj.customer[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let standNoVal = this.orderObj.standNo;
if (val.value === 'standNo' && standNoVal) {
this.orderObj.standNo = formatVinInput(standNoVal)
validateVin(this.orderObj.standNo).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
// 校验必填等规则
checkRequired() {
......@@ -430,9 +447,9 @@ export default {
}
}
if (this.orderObj.standNo) {
if (!utils.validateVIN(this.orderObj.standNo)) throw '车架号校验不匹配,请核对后重新输入'
}
// if (this.orderObj.standNo) {
// if (!utils.validateVIN(this.orderObj.standNo)) throw '车架号校验不匹配,请核对后重新输入'
// }
// 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) {
......@@ -458,8 +475,22 @@ export default {
// 提交
async submit() {
console.log(this.orderObj)
if (!this.checkRequired()) return
// VIN车架号-动态校验
const carVin = this.orderObj.standNo
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
if (!(await this.checkDailyReport())) {
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
......
......@@ -896,7 +896,7 @@ export default {
}
.info {
display: flex;
padding: toRpx(16) toRpx(32);
padding: 0 toRpx(32) toRpx(16);
flex-wrap: wrap;
&-item {
width: 25%;
......@@ -908,7 +908,10 @@ export default {
color: #777777;
font-size: toRpx(24);
line-height: toRpx(48);
padding: toRpx(8) 0;
padding: toRpx(24) 0 toRpx(8);
}
&-value {
padding-bottom: toRpx(8);
}
}
.block {
......
......@@ -62,6 +62,7 @@ import SkuGoods from './SkuGoods.vue'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import { DEFEAT_FORM_LIST, popupTypeEnum, payTypeList } from '../contant'
import { debounce } from 'lodash'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'DefeatOrder',
components: {
......@@ -182,6 +183,7 @@ export default {
positionTypeList: [],
valueKey: '',
totalPrice: 0,
validateState:null,
// 产品槽位配置,用于循环渲染产品组件
productSlots: {
frontGear: true,
......@@ -333,13 +335,27 @@ export default {
console.log(e, val)
console.log(this.orderObj)
this.orderObj.customer[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let standNoVal = this.orderObj.standNo;
if (val.value === 'standNo' && standNoVal) {
this.orderObj.standNo = formatVinInput(standNoVal)
validateVin(this.orderObj.standNo).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
checkRequired() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/
// 把formList中所有required为true的对象放到一个数组中
const requiredArr = []
const onlyLabelItem = []
this.formList.forEach(group => {
group.forEach(item => {
if (item.required === true && item.hidden !== true) {
......@@ -351,7 +367,22 @@ export default {
}
})
})
// VIN车架号-动态校验
const carVin = this.orderObj.standNo
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
// 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i]
......@@ -380,18 +411,17 @@ export default {
}
}
if (this.orderObj.standNo) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
if (!vinRex.test(this.orderObj.standNo)) {
uni.showToast({
title: `请输入正确的VIN码`,
icon: 'none'
})
return false
}
}
// if (this.orderObj.standNo) {
// const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
// console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
// if (!vinRex.test(this.orderObj.standNo)) {
// uni.showToast({
// title: `请输入正确的VIN码`,
// icon: 'none'
// })
// return false
// }
// }
// 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) {
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
......@@ -419,6 +449,7 @@ export default {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
console.log("this.checkRequired()",this.checkRequired());
if (!this.checkRequired()) return
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
......
......@@ -110,7 +110,7 @@ import UploadProofOfPayment from './UploadProofOfPayment.vue'
import dayjs from 'dayjs'
import OrderPay from './OrderPay.vue'
import NP from 'number-precision'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'CreateOrder',
mixins: [interceptionMixin],
......@@ -202,7 +202,8 @@ export default {
valueKey: '',
popupTitle: '',
pointsMultiRole: 'Y',
formKey: Date.now()
formKey: Date.now(),
validateState:null
}
......@@ -507,12 +508,27 @@ export default {
},
// 输入框失去焦点事件
inputBlur (e, val) {
console.log("SSSSSS");
console.log(e, val)
if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value]
return
}
this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let carVinVal = this.orderObj.carVin;
if (val.value === 'carVin' && carVinVal) {
this.orderObj.carVin = formatVinInput(carVinVal)
validateVin(this.orderObj.carVin).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
// 校验必填等规则
checkRequired () {
......@@ -530,6 +546,21 @@ export default {
}
})
})
// VIN车架号-动态校验
const carVin = this.orderObj.carVin
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
// 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i]
......@@ -539,9 +570,9 @@ export default {
// 如果是customerPhone,添加phoneRex校验
if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}`
}
if (orderObj.carVin) {
if (!utils.validateVIN(orderObj.carVin)) throw '车架号校验不匹配,请核对后重新输入'
}
// if (orderObj.carVin) {
// if (!utils.validateVIN(orderObj.carVin)) throw '车架号校验不匹配,请核对后重新输入'
// }
if (onlyLabelItem.length) {
const labelFields = ['skuGoods']
......
......@@ -724,7 +724,6 @@ export default {
userInfo,
carBandList
} = this
console.log(carBandList,'===')
let { value } = e.detail
if (value) {
let { key, max } = i,
......@@ -1043,7 +1042,7 @@ export default {
}
.info {
display: flex;
padding: toRpx(16) toRpx(32);
padding: 0 toRpx(32) toRpx(16);
flex-wrap: wrap;
&-item {
width: 25%;
......@@ -1055,7 +1054,10 @@ export default {
color: #777777;
font-size: toRpx(24);
line-height: toRpx(48);
padding: toRpx(8) 0;
padding: toRpx(24) 0 toRpx(8);
}
&-value {
padding-bottom: toRpx(8);
}
}
.block {
......
......@@ -12,7 +12,7 @@
class="customer-file flex"
@click="
handleCell({
key: 'customer'
value: 'defeatCustomer'
})
"
>
......@@ -30,9 +30,13 @@
</template>
</GlCell>
</view>
<view @click.stop="submit" class="btn">战败下单</view>
</scroll-view>
<view class="btns flex">
<view @click.stop="submit('reload')" class="btn save">提交后继续添加</view>
<view @click.stop="submit" class="btn">战败下单</view>
</view>
</view>
<!-- 弹窗 -->
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" :isDefeatOrder="true" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" />
</view>
......@@ -200,6 +204,19 @@ export default {
this.initData()
},
methods: {
resetParams() {
// 重置表单数据
this.orderObj = {
deafeatReason: '',
customerName: '',
customerPhone: '',
salesType: 0
}
// 重置表单列表
this.formList = utils.deepClone(DEFEAT_FORM_LIST)
this.initData()
},
async initData() {
const { userInfo } = this
console.log(this.orderObj, 'this.orderObj')
......@@ -236,7 +253,7 @@ export default {
// 获取当前选中的popupType
console.log(val, 'val')
console.log(this.popupTypeEnum, 'this.popupTypeEnum')
this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key].key === val.key) * 1
this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key].key === val.value) * 1
// 获取对应的list字段
const popupConfig = this.popupTypeEnum[this.popupType]
if (popupConfig && popupConfig.list) {
......@@ -278,6 +295,7 @@ export default {
console.log(res, '上一个订单的销售顾问信息')
this.$set(this.orderObj, 'employeeName', res.employeeName)
this.orderObj.userId = res.userId
this.orderObj.referrerId = res.userId
console.log(res, '上一个订单的销售顾问信息')
},
// 单选框change事件
......@@ -303,11 +321,19 @@ export default {
// 根据popupTypeEnum优化处理
const _typeValue = this.popupTypeEnum[this.popupType]
console.log(_typeValue)
if (_typeValue.key == 'todayShow') {
const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
this.$set(this.orderObj, 'todayShow', dayjs(chooseContent).format('YYYY-MM-DD') + ' ' + weeks[dayjs(chooseContent).day()])
this.$set(this.orderObj, 'createDate', dayjs(chooseContent).format('YYYY-MM-DD'))
} else if (_typeValue.key) {
this.orderObj[_typeValue.targetIdKey] = chooseContent[_typeValue.sourceIdKey]
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey])
}
// 定义产品相关字段数组
if (val.popupType == 19) {
if (val.popupType == 20) {
console.log(chooseContent, 'chooseContent')
this.orderObj.customerName = chooseContent.customerName
this.orderObj.customerPhone = chooseContent.customerPhone
this.orderObj.customerName = chooseContent.customer.customerName
this.orderObj.customerPhone = chooseContent.customer.customerPhone
}
if (val.popupType == 0) {
console.log(chooseContent, 'chooseContent')
......@@ -394,7 +420,7 @@ export default {
},
// 提交
submit: debounce(async function () {
submit: debounce(async function (type) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
......@@ -424,7 +450,11 @@ export default {
title: '保存成功',
icon: 'success'
})
this.$emit('jump', 'OrderManagement')
if (type == 'reload') {
this.resetParams()
} else {
this.$emit('jump', 'OrderManagement')
}
}
}, 300),
......@@ -651,7 +681,7 @@ export default {
.box {
height: calc(100% - #{toRpx(120)});
padding-bottom: toRpx(24);
position: relative;
.scroll-view {
height: 100%;
}
......@@ -859,13 +889,26 @@ export default {
}
.defeat-order ::v-deep .cell-value .textarea {
margin-bottom: 0;
height: toRpx(192);
}
.btns {
padding: 24rpx 128rpx;
gap: 32rpx;
position: absolute;
bottom: 0;
width: 100%;
left: 0;
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: 28rpx;
font-weight: 500;
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
margin: toRpx(88) auto 0;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
......
<template>
<view class="order">
<view :class="['order-box', { hide: showUpload }]" :key="formKey">
<view :class="['order-box', { hide: showUpload }]">
<view class="common-title">修改客户信息</view>
<view class="box">
<scroll-view class="scroll-view" scroll-y="true">
......@@ -15,7 +15,7 @@
</view>
</view>
<!-- 弹窗 -->
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" :popupTitle="popupTitle" />
<!-- <order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" :popupTitle="popupTitle" /> -->
<template v-if="showUpload">
<view class="upload-box">
<upload-proof-of-payment @back="showUpload = false" @confirm="uploadConfirm" />
......@@ -29,7 +29,7 @@
<script>
import utils from '@/utils/utils'
import OrderPopup from '@/components/OrderPopup/index.vue'
// import OrderPopup from '@/components/OrderPopup/index.vue'
import GlCell from '../../../../components/Form/GlCell.vue'
import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant'
import { interceptionMixin } from '@/mixin/index'
......@@ -44,7 +44,7 @@ export default {
mixins: [interceptionMixin],
components: {
GlCell,
OrderPopup,
// OrderPopup,
UploadProofOfPayment,
OrderPay,
NoticePopup
......@@ -60,7 +60,9 @@ export default {
showUpload: false,
titleList,
formList: utils.deepClone(UpdateOrderInfo),
valueKey: '',
externalData: [],
popupType: 0,
baseConfigData: {},
requiredList: [], // 录单设置的必填项
orderObj: {
......@@ -163,7 +165,6 @@ export default {
}
},
// 提交
async submit() {
if (!this.checkRequired() || (await this.checkDailyReport())) return
let params = {
......@@ -216,6 +217,10 @@ export default {
]
// 打开弹窗
this.$refs.notice.open()
},
radioChange(val) {
console.log(val)
this.orderObj.salesType = val.detail.value
}
}
}
......
......@@ -387,6 +387,9 @@ const popupTypeEnum = {
},
19: {
key: 'customer'
},
20: {
key: 'defeatCustomer'
}
}
const titleList = [null, { addHtml: 'customer' }, { name: '车辆信息' }, { name: '增值车损险' }, { name: '其他信息' }]
......
......@@ -151,6 +151,7 @@ import dayjs from 'dayjs'
import permision from '@/js_sdk/wa-permission/permission.js'
import { sign, md532, md516 } from 'utils/common'
import { signSecretKey } from '@/env.js'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'AddEvaluationFrom',
components: {
......@@ -548,7 +549,8 @@ export default {
],
uploadOtherFields: [{ key: 41, label: '其他图片', required: false, accept: 'image', maxCount: 30, fullwidth: true }],
currentField: null,
query: {}
query: {},
validateVinState:null
}
},
onLoad(options) {
......@@ -872,23 +874,39 @@ export default {
}
// 车架号验证 - 长度17且只能包含数字和大写字母
const vin = this.formData.carBaseReqDTO.vin
const vinRegex = /^[A-Z0-9]+$/
if (!vinRegex.test(vin)) {
uni.showToast({
title: '车架号只能包含数字和大写字母',
icon: 'none'
})
return
}
if (vin.length != 17) {
uni.showToast({
title: '车架号必须为17位',
icon: 'none'
})
return
}
// const vin = this.formData.carBaseReqDTO.vin
// const vinRegex = /^[A-Z0-9]+$/
// if (!vinRegex.test(vin)) {
// uni.showToast({
// title: '车架号只能包含数字和大写字母',
// icon: 'none'
// })
// return
// }
// if (vin.length != 17) {
// uni.showToast({
// title: '车架号必须为17位',
// icon: 'none'
// })
// return
// }
// VIN车架号-动态校验
const carVin = this.formData.carBaseReqDTO.vin
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
const engineNumber = this.formData.carBaseReqDTO.engineNumber
const engineNumberRegex = /^[A-Za-z0-9]+$/
if (!engineNumberRegex.test(engineNumber)) {
......@@ -990,7 +1008,7 @@ export default {
},
handleCell(field) {
const that = this
console.log("handleCellAAAAA");
if (field.isCar) {
this.openSelectCar()
} else if (field.isCity) {
......@@ -1110,6 +1128,17 @@ export default {
if (upperValue !== value) {
this.$set(this.formData.carBaseReqDTO, 'vin', upperValue)
}
// VIN车架号动态校验:车架号字段,动态转换为大写
validateVin(upperValue).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
if (field.key === 'mileage') {
let numValue = Number(value)
......@@ -1285,6 +1314,15 @@ export default {
if (res.data.code == 0) {
if (res.data.data.status == 1) {
this.formData.carBaseReqDTO.vin = res.data.data.vin
validateVin(this.formData.carBaseReqDTO.vin).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
uni.showToast({ title: '车架号识别完成并已自动填写到表单中', icon: 'none' })
uni.hideLoading()
} else {
......
import api from '@/api/index.js'
// 有效字符:大写 A-H/J-N/P-Z、0-9(排除 I、O、Q)
const VALID_VIN_REG = /^[A-HJ-NPR-Z0-9]{17}$/
const ERROR_MSG = '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)'
// 防抖相关变量
let debounceTimer = null
let pendingResolve = null
let pendingReject = null
let pendingVin = null
const DEBOUNCE_DELAY = 500 // 防抖延迟时间(毫秒)
/**
* 车架号校验(统一处理版本)
* @param {string} vin - 车架号
* @returns {Promise<Object>} 返回校验结果 { success: boolean, message: string, data?: any, vin?: string }
*/
export function validateVin(vin) {
console.log("工具调用",vin);
return new Promise((resolve, reject) => {
const upperVin = vin ? vin.toUpperCase() : ''
// 格式校验失败
if (!upperVin || upperVin.length !== 17 || !VALID_VIN_REG.test(upperVin)) {
uni.showToast({
title: ERROR_MSG,
icon: 'none'
})
reject({
success: false,
message: ERROR_MSG
})
return
}
// 保存当前调用的 resolve 和 reject
pendingResolve = resolve
pendingReject = reject
pendingVin = upperVin
// 清除之前的定时器
if (debounceTimer) {
clearTimeout(debounceTimer)
}
// 设置防抖定时器
debounceTimer = setTimeout(() => {
// 执行接口调用
const currentVin = pendingVin
const currentResolve = pendingResolve
const currentReject = pendingReject
// 清空待处理变量
pendingVin = null
pendingResolve = null
pendingReject = null
debounceTimer = null
// 调用后端接口校验
api.commonApi.checkVinValidate({ vin: currentVin })
.then(res => {
console.log("checkVinValidate接口校验",res);
let { valid,message } = res
if (valid) {
// 校验成功但有提示信息
if (message) {
uni.showToast({
title: message,
icon: 'none'
})
}
currentResolve({
success: true,
message: message || '校验成功',
data: res,
vin: currentVin
})
} else {
// 接口返回失败
const errorMsg = message || '车架号校验失败'
uni.showToast({
title: errorMsg,
icon: 'none'
})
currentResolve({
success: false,
message: errorMsg,
data: res
})
}
})
.catch(err => {
const errorMsg = err.message || '车架号校验异常'
uni.showToast({
title: errorMsg,
icon: 'none'
})
currentReject({
success: false,
message: errorMsg
})
})
}, DEBOUNCE_DELAY)
})
}
/**
* 实时输入处理:自动转大写
*/
export function formatVinInput(value) {
return value ? value.toUpperCase() : ''
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!