Commit 9d87174c by mushishixian

修整

parent f3014987
......@@ -25,12 +25,12 @@ class SupplierContactApiController extends Controller
$supplierId = $request->get('supplier_id');
$limit = $request->get('limit', 10);
$model = new SupplierContactModel();
$model->where('supplier_id',$supplierId)->paginate();
$model->where('supplier_id', $supplierId)->paginate();
$list = $model->where('supplier_id', $supplierId)->orderBy('contact_id', 'desc')
->paginate($limit)->toArray();
$transformer = new SupplierContactTransformer();
$list['data'] = $transformer->transformList($list['data']);
$this->response(0, 'ok', $list['data'],$list['total']);
$this->response(0, 'ok', $list['data'], $list['total']);
}
public function SaveSupplierContact($request)
......@@ -66,11 +66,15 @@ class SupplierContactApiController extends Controller
$contactId = $request->get('contact_id');
if ($contactId) {
$model = new SupplierContactModel();
$supplierId = $model->where('contact_id', $contactId)->value('supplier_id');
$contactCount = $model->where('supplier_id', $supplierId)->count();
if ($contactCount == 1) {
$this->response(-1, '供应商至少要有一个联系方式');
}
$result = $model->whereIn('contact_id', $contactId)->delete();
if (!$result) {
$this->response(-1, '删除失败');
}
$supplierId = $model->where('contact_id', $contactId)->value('supplier_id');
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $supplierId)->update([
'update_time' => time(),
......
......@@ -4,6 +4,7 @@
namespace App\Http\Validators;
use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel;
use Validator;
class SupplierValidator
......@@ -23,6 +24,10 @@ class SupplierValidator
'region' => 'required',
'cn_delivery_time' => 'regex:/^\d+\-\d$/',
'us_delivery_time' => 'regex:/^\d+\-\d$/',
'shipping_address' => 'max:100',
'return_address' => 'max:100',
'return_consignee' => 'max:50',
'return_phone' => 'max:50',
'cn_ratio' => 'min:1',
'us_ratio' => 'min:1',
'contact.supplier_consignee.*' => 'required|max:50',
......@@ -55,6 +60,12 @@ class SupplierValidator
} else {
$count = $supplierModel->where('supplier_name', $request->get('supplier_name'))
->where('supplier_id', '!=', $request->get('supplier_id'))->count();
//至少要有一个联系方式
$contactModel = new SupplierContactModel();
$contactCount = $contactModel->where('supplier_id',$request->get('supplier_id'))->count();
if ($contactCount) {
return "供应商至少要有一个联系方式,请补全";
}
}
if ($count) {
return "该供应商名称已经存在,请核验后再提交";
......@@ -86,6 +97,10 @@ class SupplierValidator
'contact.supplier_mobile.*.max' => '联系方式的手机号不能超过30个字符',
'contact.supplier_email.*.required' => '联系方式的邮箱不能为空',
'contact.supplier_email.*.email' => '联系方式的邮箱格式不对',
'shipping_address.max' => '发货地址不能超过100个字符',
'return_address.max' => '退货地址不能超过100个字符',
'return_consignee.max' => '退货收货人不能超过50个字符',
'return_phone.max' => '退货收货人电话不能超过50个字符',
];
}
......
......@@ -15,7 +15,7 @@ layui.config({ // common.js是配置layui扩展模块的目录,每个页面
citypicker: 'city-picker/city-picker',
introJs: 'introJs/introJs',
zTree: 'zTree/zTree',
xmSelect: 'xmSelect/xm-select'
xmSelect: 'xmSelect'
}).use(['layer', 'admin'], function () {
var $ = layui.jquery;
var layer = layui.layer;
......
<script>
layui.use(['table', 'form', 'element', 'layer','admin'], function () {
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
form.on('submit(load)', function (data) {
layer.confirm('确定要保存联系人吗?一旦保存,该供应商就会再次进入审核阶段', function (index) {
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier_contact/SaveSupplierContact?supplier_id=' + supplierId;
let res = ajax(url, data.field);
......@@ -17,6 +18,7 @@
parent.layer.msg(res.err_msg, {icon: 5});
}
}
});
return false;
});
});
......
{!! Autograph() !!}
<script>
layui.use(['form', 'upload','admin'], function () {
layui.use(['form', 'upload', 'admin'], function () {
const form = layui.form
const upload = layui.upload;
const admin = layui.admin;
//提交数据
form.on('submit(addSupplierReceipt)', function (data) {
layer.confirm('确定要保存银行信息吗?一旦保存,该供应商就会再次进入审核阶段', function (index) {
let res = ajax('/api/supplier_receipt/AddSupplierReceipt', data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
......@@ -18,6 +19,8 @@
}
}
return false;
});
return false;
})
//图片上传
upload.render({
......
......@@ -139,9 +139,9 @@
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">退电话 : </label>
<label class="layui-form-label">退货收货人电话 : </label>
<div class="layui-input-inline">
<input type="text" name="return_phone" id="return_phone" placeholder="请输入收件电话"
<input type="text" name="return_phone" id="return_phone" placeholder="请输入退货收货人电话"
class="layui-input" value="{{$address['return_phone']}}">
</div>
</div>
......
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 sign in to comment