diff --git a/src/api/basicdata/globalc.js b/src/api/basicdata/globalc.js index 5f201008..e85b616a 100644 --- a/src/api/basicdata/globalc.js +++ b/src/api/basicdata/globalc.js @@ -40,7 +40,278 @@ export async function useGetGlobalProperties (){ return shu; } -export default { useGetGlobalProperties , optioner} ; + +export function validateTelephone(rule,value,callback) { + const reg = /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/ + if(!reg.test(value)){ + callback(new Error('请输入正确的固话')) + }else{ + callback() + } +} + + +export function validatePhTelNumber(str) { + const reg = /^1[3|4|5|7|8|9][0-9]d{8}$/ + return reg.test(str) +} + +// 验证手机号 +const testPhone = (resPhone) => { + console.log(resPhone, "resPhone") + let phone = new Promise((resolve, reject) => { + const reg = /^1[3|4|5|7|8|9][0-9]d{8}$/; + if (resPhone == "" || resPhone == undefined || resPhone == null || resPhone.length == 0) { + this.$message.warning("手机号不能为空"); + resolve(false); + } else if (!reg.test(resPhone)) { + this.$message.warning("手机号格式不正确"); + resolve(false); + } else { + resolve(true); + } + }); + return phone; +}; +// // 验证验证码是否为空 +// const testCode = (resCode) => { +// console.log(resCode, "resCode") +// let code = new Promise((resolve, reject) => { +// if (resCode == "" || resCode == undefined || resCode == null || resCode.length == 0) { +// this.$message.warning("验证码不能为空"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return code; +// }; +// // 密码验证testPassWord +// const testPassWord = (resPassWord) => { +// let password = new Promise((resolve, reject) => { +// const reg = /^(?!D+$)(?![^a-zA-Z]+$)S{6,20}$/; +// if (resPassWord == "") { +// this.$message.warning("密码不能为空"); +// resolve(false); +// } else if (!reg.test(resPassWord)) { +// this.$message.warning("密码是6-20位数字和字母的组合"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return password; +// }; +// // 企业名称验证 中文验证 +// const testCompanyName = (resName) => { +// // var reg =/^[Α-¥]+$/; +// // var reg = /^[一-龥]{2,4}$/; +// // var nameLength=resName.trim().length; +// let companyname = new Promise((resolve, reject) => { +// if (resName == "") { +// this.$message.warning("企业名称不能为空"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return companyname; +// }; +// +// // 真实姓名认证 中文验证 +// const testPersonName = (resTrueName) => { +// var reg = /^[一-龥]{2,4}$/; +// let trueName = new Promise((resolve, reject) => { +// if (resTrueName == "") { +// this.$message.warning("真实姓名不能为空"); +// resolve(false); +// } else if (!reg.test(resTrueName.trim())) { +// this.$message.warning("真实姓名必须是中文且字符在2-4个"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return trueName; +// }; +// // 身份证号 +// const testCard = (resCard) => { +// let card = new Promise((resolve, reject) => { +// let reg = /(^d{15}$)|(^d{18}$)|(^d{17}(d|X|x)$)/ +// if (resCard == "") { +// this.$message.warning("身份证号码不能为空"); +// resolve(false); +// } else if (!reg.test(resCard)) { +// this.$message.warning("身份证号格式错误"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return card; +// }; +// +// // 计算字符串的字节长度 +// const fucCheckLength = (text, strTemp) => { +// let companyCard = new Promise((resolve, reject) => { +// let reg = /^[S +// s]{0,20}$/ +// if (strTemp == "") { +// this.$message.warning(text + "不能为空"); +// resolve(false); +// } else if (!reg.test(strTemp)) { +// this.$message.warning(text + "必须在20个字符以内"); +// resolve(false); +// } else if (text == "车辆长度" && strTemp >= 100.00) { +// this.$message.warning(text + "只能100以内"); +// resolve(false); +// } else if (text == "车辆宽度" && strTemp >= 100.00) { +// this.$message.warning(text + "只能100以内"); +// resolve(false); +// } else if (text == "车辆高度" && strTemp >= 100.00) { +// this.$message.warning(text + "只能100以内"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return companyCard; +// }; +// // 转换成年月日时间格式 +// const formatDateTime = (date) => { +// var y = date.getFullYear(); +// var m = date.getMonth() + 1; +// m = m < 10 ? ('0' + m) : m; +// var d = date.getDate(); +// d = d < 10 ? ('0' + d) : d; +// return y + '-' + m + '-' + d +// }; +// // 转换完整 年月日-时分秒 +// const formatCompleteDateTime = (date) => { +// var y = date.getFullYear(); +// var m = date.getMonth() + 1; +// m = m < 10 ? ('0' + m) : m; +// var d = date.getDate(); +// d = d < 10 ? ('0' + d) : d; +// +// var hh = date.getHours(); +// hh = hh < 10 ? ('0' + hh) : hh; +// var mm = date.getMinutes(); +// mm = mm < 10 ? ('0' + mm) : mm; +// var ss = date.getSeconds(); +// ss = ss < 10 ? ('0' + ss) : ss; +// return y + '-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss +// }; +// // 判断是图片类型 +// function isImage(str) { +// var reg = /.(png|jpg|gif|jpeg|webp)$/; +// return reg.test(str); +// } +// //只能是数字或者小数 +// const numberFloat = (text, strTemp) => { +// let numberFloat = new Promise((resolve, reject) => { +// let reg = /^d+(.d{0,2})?$/ +// let reg1 = /^[S +// s]{0,10}$/ +// if (strTemp == "") { +// this.$message.warning(text + "不能为空"); +// resolve(false); +// } else if (!reg.test(strTemp)) { +// this.$message.warning(text + "必须是数字和小数,且只有两位小数"); +// resolve(false); +// } else if (!reg1.test(strTemp)) { +// this.$message.warning(text + "必须在10个字符以内"); +// resolve(false); +// } else { +// resolve(true); +// } +// }); +// return numberFloat; +// } +// // 封装为空 +// function isEmpty(value) { +// if (value == null || value == "" || value == "undefined" || value == undefined || value == "null" || value.length == 0) { +// return true; +// } else { +// return false; +// } +// } +// //判断是否是微信浏览器的函数 +// const isWeiXin = ()=>{ +// //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型 +// var ua = window.navigator.userAgent.toLowerCase(); +// //通过正则表达式匹配ua中是否含有MicroMessenger字符串 +// if(ua.match(/MicroMessenger/i) == 'micromessenger'){ +// return true; +// } else{ +// return false; +// } +// } +// +// //判断是否是安卓还是ios +// const isAndroid_ios = () => { +// // const u = navigator.userAgent; +// // const isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); +// // if (isiOS) { +// // return "ios"; +// // } else { +// // return "andriod"; +// // } +// // new +// let a = navigator.userAgent; +// let isAndroid = a.indexOf('Android') > -1 || a.indexOf('Adr') > -1; //android终端 +// let isiOS = !!a.match(`/(i[^;]+;( U;)? CPU.+Mac OS X/`); //ios终端 +// if (isAndroid) { +// return 'andriod'; +// } else if(isiOS){ +// return "ios"; +// } +// } +// +// // 封装循环重置值 +// const resertShipList = (array) => { +// let arr = array.map(item => { +// return { +// text: item.text, +// time: '', +// isFinish: item.isFinish, +// code: item.code +// } +// }) +// return arr; +// }; +// const beautify_time = (timestamp) => { +// var mistiming = Math.round(new Date() / 1000) - timestamp; +// var postfix = mistiming > 0 ? '前' : '后' +// mistiming = Math.abs(mistiming) +// var arrr = ['年', '个月', '星期', '天', '小时', '分钟', '秒']; +// var arrn = [31536000, 2592000, 604800, 86400, 3600, 60, 1]; +// +// for (var i = 0; i < 7; i++) { +// var inm = Math.floor(mistiming / arrn[i]) +// if (inm != 0) { +// return inm + arrr[i] + postfix +// } +// } +// } +// +// +// // 相差的天数 +// const distanceDay = (futureTime) =>{ +// let futureDate = new Date(futureTime); +// let nowDate = new Date(); +// let date = (futureDate.getTime() - nowDate.getTime()) / (24 * 60 * 60 * 1000); +// return parseInt(date+1); // 打印得到的相差天数 +// } +//导出 +export default { + testPhone,validateTelephone,validatePhTelNumber, + // isWeiXin,distanceDay, + useGetGlobalProperties , optioner +} + + + diff --git a/src/views/basicdata/brand/basicBrand.vue b/src/views/basicdata/brand/basicBrand.vue index e3d36e73..454d5790 100644 --- a/src/views/basicdata/brand/basicBrand.vue +++ b/src/views/basicdata/brand/basicBrand.vue @@ -253,7 +253,7 @@ export default { rules: { brandName: [ { required: true, message: '请输入品牌名称', trigger: 'blur' }, - { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' } + // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' } ], brandCode: [ { required: true, message: '请输入品牌编号', trigger: 'change' } diff --git a/src/views/basicdata/brand/basicClient.vue b/src/views/basicdata/brand/basicClient.vue index 59c180f5..f02fbbd3 100644 --- a/src/views/basicdata/brand/basicClient.vue +++ b/src/views/basicdata/brand/basicClient.vue @@ -551,6 +551,7 @@ export default { handleAdd () { this.title = '新增' this.form = {} + this.fileList = []; this.box = true }, handleEdit (row) { diff --git a/src/views/basicdata/brand/basicHistoricalContract.vue b/src/views/basicdata/brand/basicHistoricalContract.vue index 143792ca..1be8dcb2 100644 --- a/src/views/basicdata/brand/basicHistoricalContract.vue +++ b/src/views/basicdata/brand/basicHistoricalContract.vue @@ -65,6 +65,7 @@ :prop="item.prop" :label="item.label" :width="item.width" + show-overflow-tooltip :key="index" align="center"> diff --git a/src/views/basicdata/brand/basicShop.vue b/src/views/basicdata/brand/basicShop.vue index 5e3ebd00..df7c12d2 100644 --- a/src/views/basicdata/brand/basicShop.vue +++ b/src/views/basicdata/brand/basicShop.vue @@ -239,6 +239,7 @@ import {mapGetters} from "vuex"; import BasicStoreContact from "@/views/basicdata/brand/BasicStoreContact.vue"; import { getLazyTreeAll } from '@/api/base/region'; import { selectName } from "@/api/basicdata/basicClient"; +import { validatePhTelNumber, validateTelephone } from '@/api/basicdata/globalc'; @@ -247,6 +248,23 @@ export default { BasicStoreContact }, data () { + var validatePhone = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入电话号码')) + } + if (value.length !== 11) { + callback(new Error('请输入正确电话号码')) + } + if (value.length !== 11) { + callback(new Error('请输入正确电话号码')) + } + // 验证电话号码手机号码,包含至今所有号段? ? + var ab = /^[1][3,4,5,7,8][0-9]{9}$/ + if (ab.test(value) === false) { + callback(new Error('请输入正确电话号码')) + } + callback() + } return { shortcuts : [ { @@ -328,7 +346,8 @@ export default { { required: true, message: '请输入门店联系人', trigger: 'blur' } ], phone: [ - { required: true, message: '请输入联系电话', trigger: 'change' } + { required: true, message: '请输入联系电话', trigger: 'change' }, + { validator: validatePhone, trigger: 'blur' } ], bladeRegionProvinceId: [ { required: true, message: '请选择地址', trigger: 'blur' } diff --git a/src/views/basicdata/brand/basicStorageServices.vue b/src/views/basicdata/brand/basicStorageServices.vue index 7fc52b09..9bb852e8 100644 --- a/src/views/basicdata/brand/basicStorageServices.vue +++ b/src/views/basicdata/brand/basicStorageServices.vue @@ -104,7 +104,7 @@ @@ -124,7 +124,7 @@ diff --git a/src/views/basicdata/brand/basicZonePrice.vue b/src/views/basicdata/brand/basicZonePrice.vue index 0bcffb68..57fe017e 100644 --- a/src/views/basicdata/brand/basicZonePrice.vue +++ b/src/views/basicdata/brand/basicZonePrice.vue @@ -152,33 +152,55 @@ - - --> + + + + + + + + + + - + >{{item.dictValue}} + + + + - - - + + + - - --> + + + + + + + + + - - - - + >{{item.dictValue}} + + + + + + { + if(value.includes(i.dictValue)){ + // console.log(i); + i.pitch = true; + // this.$set(i,'pitch',false); + this.costWraeListName = value; + }else{ + i.pitch = false; + this.costWraeList[i] = null; + i.remark = null; + } + }); + // let checkedCount = value.length; + // this.checkAll = checkedCount === this.cities.length; + // this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length; + }, + handleCheckedCitiesChange(value) { + // console.log(value); + if(value.length < 1){ + this.costList = []; + this.costListName = []; + } + this.clientType.forEach(i =>{ + if(value.includes(i.dictValue)){ + // console.log(i); + i.pitch = true; + this.costListName = value; + // console.log(this.costListName); + // this.$set(i,'pitch',false); + }else{ + i.pitch = false; + this.costList[i] = null; + i.remark = null; + } + }); + // let checkedCount = value.length; + // this.checkAll = checkedCount === this.cities.length; + // this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length; + }, remoteMethod(query){ if (query) { this.loading = true @@ -366,10 +445,44 @@ export default { this.page.currentPage = 1; this.onLoad(this.page); }, + bianli(costListName,clientType,costList,fei){ + this.pan = false; + // fei = []; + for (let i = 0;i< costListName.length;i++){ + if(!costList){ this.pan = true; return } + let zhi = costList[i]; + if(!zhi){ + this.pan = true; + continue; + } + let yon ={ + lable: 1, + value: zhi + }; + clientType.forEach( it =>{ + if(it.dictValue == this.costListName[i]){ + yon.lable = it.dictKey; + } + }) + fei.push(yon); + } + }, handleSubmit (from) { - this.$refs[from].validate((valid) => { + this.$refs[from].validate(async (valid) => { if (valid) { if (!this.form.id) { + let fei = []; + await this.bianli(this.costListName,this.clientType,this.costList,fei); + this.form.fei = fei; + this.form.freightMark = null; + let feishi = []; + await this.bianli(this.costWraeListName,this.wareType,this.costWraeList,feishi); + this.form.feishi = feishi; + this.form.warehousingTimeStatus = null; + if(this.pan){ + this.$message.warning("请填写完整已勾选的数据费用"); + return + } this.form.city = this.form.province[1]; this.form.district = this.form.province[2]; this.form.province = this.form.province[0]; @@ -410,6 +523,7 @@ export default { handleAdd () { this.title = '新增' this.form = {} + this.init (); this.box = true }, handleEdit (row) { diff --git a/src/views/basicdata/brand/basicdataFreight.vue b/src/views/basicdata/brand/basicdataFreight.vue index 4b29e0db..de4f205d 100644 --- a/src/views/basicdata/brand/basicdataFreight.vue +++ b/src/views/basicdata/brand/basicdataFreight.vue @@ -242,28 +242,32 @@ span:12, allowCreate: true, filterable: true, - dicUrl: "/api/logpm-basicdata/basicdataZonePrice/listName?name={{key}}", + dicUrl: "/api/logpm-basicdata/basicdataStoreBrand/listName?name={{key}}", props: { - label: 'brandName', + label: 'storeBrandName', value: 'id' }, change: (val) => { - // console.log(">>>>",val); + // let dic = val.dic; if(!!val.value){ + // console.log(">>>>。。。。",val); let d = []; let a = []; val.dic.forEach(i =>{ - let dataZhi = { - label: i.brandName, - value: i.brand - } - let data = { - label: i.name, - value: i.goalGranary + if(i.id == val.value){ + console.log("iiiiii",i); + let dataZhi = { + label: i.brandName, + value: i.brandId + } + let data = { + label: i.storeName, + value: i.shopId + } + d.push(dataZhi); + a.push(data); } - d.push(dataZhi); - a.push(data); }) // this.selectionChange(); // console.log(",.,.",this.option.column[26]); @@ -393,15 +397,17 @@ label: "门店", prop: "shop", type: "select", - search: true, + search: false, dicData: [], + disabled: true, }, { label: "品牌", prop: "brand", type: "select", - search: true, + search: false, dicData: [], + disabled: true, }, { label: "服务类型", //;1 干 2干仓 3干仓配 4干配 @@ -572,13 +578,13 @@ }, methods: { fuzhi(led,ed){ - console.log(">>>>",led); - this.option.column[26].dicData = led; - this.option.column[26].value = led[0].value; - this.option.column[27].dicData = ed; - this.option.column[27].value = ed[0].value; - this.form.shop= led[0].value; - this.form.brand= ed[0].value; + // console.log(">>>>",led,ed); + this.option.column[27].dicData = led; + this.option.column[27].value = led[0].value; + this.option.column[26].dicData = ed; + this.option.column[26].value = ed[0].value; + this.form.shop= ed[0].value; + this.form.brand= led[0].value; }, rowSave(row, done, loading) { diff --git a/src/views/basicdata/brand/basicdataSupportValue.vue b/src/views/basicdata/brand/basicdataSupportValue.vue index b42d3a2d..855fdacb 100644 --- a/src/views/basicdata/brand/basicdataSupportValue.vue +++ b/src/views/basicdata/brand/basicdataSupportValue.vue @@ -162,7 +162,7 @@ ] }, { - label: "保费率", + label: "保费率(%)", prop: "premiumRate", type: "input", rules: [ @@ -182,9 +182,10 @@ { required: true, message: '请输入收货用户地址', - trigger: 'blur' + trigger: 'blur', } - ] + ], + }, { label: "收货用户电话", @@ -195,7 +196,14 @@ { required: true, message: '请输入收货用户电话', - trigger: 'blur' + trigger: 'blur', + validator: function (rule, value, callback) { + if (/^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/.test(value) == false) { + callback(new Error("请输入正确的电话号码!")); + } else { + callback(); + } + }, } ] },