QuerySupplierScript.blade.php
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
$('#querySupplier').click(function () {
let supplierName = $('#supplier_name').val();
admin.showLoading({
type: 3,
});
let url = '/api/supplier/querySupplier?supplier_name=' + supplierName;
let res = ajax(url);
if (!res) {
admin.removeLoading();
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
let exists = res.data.supplier_id?'是(无需新建)':'否(可以新建)';
$('#exists').text(exists);
let uploadedSku = res.data.uploaded_sku?'是(有上传过sku)':'否(没有上传过sku)';
$('#uploaded_sku').text(uploadedSku);
let isYunxinSupplier = res.data.is_yunxin_supplier ? '是':'否';
$('#is_yunxin_supplier').text(isYunxinSupplier);
admin.removeLoading();
if (res.data.length === 0) {
layer.msg('供应商不存在',{icon:5})
}else{
layer.msg(res.err_msg, {icon: 6});
}
} else {
admin.removeLoading();
layer.msg(res.err_msg, {icon: 5});
}
}
return false;
});
});
</script>