Commit 213600ae authored by dragondean@qq.com's avatar dragondean@qq.com
parents 9259c5cf 1d24e683
import request from '@/utils/request'
// 校验手机号
export function validatorMobile(params) {
return request({
url: '/param/validator/mobile',
method: 'post',
params
})
}
......@@ -107,7 +107,7 @@ service.interceptors.response.use(res => {
Notification.error({
title: msg
})
return Promise.reject('error')
return Promise.reject(msg || 'error')
} else {
return res.data
}
......
......@@ -381,7 +381,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="开票电话" prop="billingTell">
<el-input v-model="form.billingTell" placeholder="请输入开票电话" />
<el-input v-model="form.billingTell" placeholder="请输入开票电话" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -417,6 +417,7 @@ import { getZhongPaoBest, getZhongPaoPage } from '@/api/ecw/zhongPao'
import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
import { getCountryListAll } from '@/api/ecw/country'
import Template from "@/views/cms/template";
import {validatorMobile} from "@/api/ecw/validate"
export default {
name: "edit",
......@@ -436,6 +437,10 @@ export default {
this.form.customerContacts = r.data
})
})
} else {
const obj = Object.assign({}, this.$route, { title: "自定义标题" })
this.$tab.updatePage(obj);
this.$tab.updatePage({...this.$route, meta: {...this.$route.meta, name: 'abc'}})
}
getNodeList().then(r => {
......@@ -492,7 +497,11 @@ export default {
contactRules: {
name: [{ required: true, message: "请输入联系人", trigger: "blur" }],
areaCode: [{ required: true, message: "请选择区号", trigger: "change" }],
phoneNew: [{ required: true, message: "请输入联系方式", trigger: "blur" }],
phoneNew: [{
required: true,
trigger: "blur",
validator: this.phoneValidator
}],
},
// 网点
nodeList: [],
......@@ -515,6 +524,24 @@ export default {
},
methods: {
phoneValidator(rule, value, callback){
if (!value) {
return callback(new Error('请输入联系方式'));
}
validatorMobile({
code: this.form.customerContacts.find(e => e.phoneNew === value).areaCode,
mobile: value
}).then(r => {
if (r.data){
callback()
} else {
callback(new Error(r.msg || '手机号验证失败'))
}
}).catch(e => {
console.error(e)
callback(new Error('手机号验证失败'))
})
},
handleDefaultChange($index){
// 只有一个联系人,设置成非默认
if (this.form.customerContacts.length === 1 && this.form.customerContacts[0].isDefault === 0){
......@@ -549,6 +576,10 @@ export default {
},
/** 提交按钮 */
submitForm() {
if(this.form.customerContacts.length === 0){
this.$modal.alert('至少添加一位联系人')
return
}
this.$refs["contactForm"].validate(valid1 => {
this.$refs["form"].validate(valid2 => {
if (!valid1 || !valid2) {
......@@ -558,13 +589,16 @@ export default {
this.$modal.msgError("至少填写一个联系人信息");
return
}
const form = {...this.form, type: this.form.type?.join(','), taxRate: Number(this.form.taxRate)}
// 修改的提交
if (this.form.id != null) {
this.form.customerContacts.forEach(e => {
e.customerId = this.customerId
})
updateCustomer(this.form).then(response => {
updateCustomer(form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
// this.getList();
......@@ -576,7 +610,7 @@ export default {
return;
}
// 添加的提交
createCustomer(this.form).then(response => {
createCustomer(form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
// this.getList();
......
......@@ -120,13 +120,8 @@
</div>
</el-card>
<div style="text-align: center;margin-top: 15px" v-if="order.status !== 5">
<el-button @click="escapeBol = true;" type="primary">转异</el-button>
<el-button type="primary" @click="finishVisible = true">完成入仓</el-button>
</div>
<template v-if="order.status === 5">
<h2>标枪箱号</h2>
<template v-if="order.parentOrderId && isEdit">
<h2>标签箱号</h2>
<div v-for="(item, index) in label.orderLabelDtoList" :key="index" style="margin-bottom: 10px">
<el-input-number v-model="item.start" controls-position="right"></el-input-number> -
......@@ -138,6 +133,10 @@
<el-button type="primary" @click="handleLabelSubmit">修改箱号</el-button>
</div>
</template>
<div style="text-align: center;margin-top: 15px" v-if="order.status !== 5">
<el-button @click="escapeBol = true;" type="primary">转异</el-button>
<el-button type="primary" @click="finishVisible = true">完成入仓</el-button>
</div>
</el-form>
<warehouse-area-dialog ref="area" :visible.sync="areaVisible" v-model="form.orderLocationCreateReqVOList"
......@@ -281,7 +280,7 @@ export default {
orderId: this.orderId
}).then(r => {
if (r.code === 0){
this.$message.success(r.msg || '修改标签箱号成功')
}
})
},
......
......@@ -2,7 +2,7 @@
<el-form ref="form" :model="form" label-width="80px">
<el-card class="box-card" style="margin-bottom: 15px">
<div slot="header" class="clearfix">
<el-button style="float: right; padding: 3px 0" type="text" @click="$emit('delete')">删除</el-button>
<el-button v-show="isShowDelete" style="float: right; padding: 3px 0" type="text" @click="$emit('delete')">删除</el-button>
</div>
<el-form-item :label="'商标' + (index + 1)">
<el-input v-model="form.brandName" placeholder="商标"></el-input>
......@@ -37,6 +37,10 @@
export default {
name: "BrandForm",
props: {
isShowDelete: {
type: Boolean,
default: true
},
productTypeList: {
type: Array,
default: []
......
......@@ -110,6 +110,7 @@
<h3>包含商标列表</h3>
<brand-form
:is-show-delete="form.trademarkList.length > 1"
v-for="(item, index) in form.trademarkList"
v-model="form.trademarkList[index]"
:index="index"
......@@ -119,9 +120,9 @@
@delete="form.trademarkList.splice(index, 1)"></brand-form>
<el-button type="primary" @click="form.trademarkList.push({
brandName: '',
brandName: form.titleZh,
productBrandId: form.id,
trademarkCategoryRelList: []
trademarkCategoryRelList: [{productCategoryId:0, productId:0}]
})">添加商标</el-button>
<div slot="footer" style="text-align: center">
......@@ -287,21 +288,26 @@ export default {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateProductBrank(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
if (this.form.trademarkList?.length > 0){
// 修改的提交
if (this.form.id != null) {
updateProductBrank(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createProductBrank(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
return;
} else {
this.$modal.alert('请至少添加一个商标')
}
// 添加的提交
createProductBrank(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment