const validateorderPrice = (rule, value, callback) => {
//必須包含大小寫字母、數字、特殊字元長度再9-16位之間
var regex = new RegExp("(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^0-9]).{8,16}");
if (value === "") {
callback(new Error("請輸入服務費,不能為空"));
}else {
//銷售價不能超過(-5% < 服務費 < +15%)
getSalePrice(this.carProduct.id,this.formCar.carBasicInfo.id,this.carProduct.canalId,this.carProduct.insurerId).then(response => {
if(response.data!=undefined){
var maxSalesPrice = response.data.salesPrice*1.15;
var minSalesPrice = response.data.salesPrice*0.95;
if(value>maxSalesPrice || value < minSalesPrice){
console.log("銷售價不能超過(-5% < 服務費 < +15%)");
callback(new Error('服務費不能超過['+maxSalesPrice+'],且不能低于['+minSalesPrice+']'))
}
}
});
//callback();
}
};
orderPrice: [
//{required: true, message: "服務費不能為空", trigger: "blur"},
{required: true, validator: validateorderPrice, trigger: "blur" }
],
orderPrice: [
//{required: true, message: "服務費不能為空", trigger: "blur"},
{required: true, validator: validateorderPrice, trigger: "blur" }
],