Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b86faa69
authored
Apr 25, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
整理表单提交数据
parent
51920721
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
252 additions
and
141 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierAttachmentService.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
app/Http/Validators/SupplierValidator.php
resources/views/script/AddSupplierScript.blade.php
resources/views/script/supplier/SupplierFileScript.blade.php
resources/views/script/supplier/SupplierPayTypeScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/supplier/SupplierAdd.blade.php
resources/views/web/supplier/SupplierFile.blade.php
resources/views/web/supplier/SupplierPayType.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
b86faa69
...
...
@@ -95,6 +95,7 @@ class SupplierApiController extends Controller
//先去表单验证
$validator
=
new
SupplierValidator
();
$data
=
$request
->
all
();
//直接提交的不需要做复杂的表单校验
if
(
request
()
->
get
(
'direct_apply'
))
{
$validateResult
=
$validator
->
checkSave
(
$data
,
true
);
}
else
{
...
...
@@ -114,9 +115,8 @@ class SupplierApiController extends Controller
'supplier_fax'
,
'can_check_uids'
]);
//附件
$channelMap
=
array_merge
(
$channelMap
,
config
(
'field.AttachmentFields'
));
$channel
=
$request
->
only
(
$channelMap
);
dd
(
$channel
);
$service
=
new
SupplierService
();
$result
=
$service
->
saveSupplier
(
$channel
);
if
(
!
$result
)
{
...
...
app/Http/Services/SupplierAttachmentService.php
View file @
b86faa69
...
...
@@ -52,4 +52,9 @@ class SupplierAttachmentService
return
$attachmentModel
->
where
(
'attachment_id'
,
$attachmentId
)
->
update
(
$attachment
);
}
}
public
function
batchInsertAttachment
(
$attachmentData
)
{
return
SupplierAttachmentsModel
::
insert
(
$attachmentData
);
}
}
\ No newline at end of file
app/Http/Services/SupplierAuditService.php
View file @
b86faa69
...
...
@@ -194,7 +194,7 @@ class SupplierAuditService
}
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
public
function
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
,
$payTypeData
)
public
function
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
)
{
$notNeedAuditField
=
[
'register_company_name'
,
...
...
app/Http/Services/SupplierService.php
View file @
b86faa69
...
...
@@ -27,42 +27,23 @@ class SupplierService
return
$supplier
?
$supplier
->
toArray
()
:
[];
}
//生成供应商编码(外部用,展示用),supplierCode是供应商的核心编码,内部使用,可以理解为唯一标识
public
function
generateSupplierSn
(
$supplierId
,
$supplierGroup
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$snMap
=
config
(
'fixed.SupplierSnMap'
);
$supplierCodeNumber
=
substr
(
$supplier
[
'supplier_code'
],
1
);
$supplierSn
=
array_get
(
$snMap
,
$supplierGroup
,
"ERR"
)
.
$supplierCodeNumber
;
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'supplier_sn'
=>
$supplierSn
]);
}
//保存价格系数到redis
public
function
saveRatioToRedis
(
$supplierId
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$Redis
=
new
RedisModel
();
$pre
=
config
(
'fixed.SUPPLIER_RATION'
);
$data
=
array_only
(
$supplier
,
[
'cn_delivery_time'
,
'us_delivery_time'
,
'cn_ratio'
,
'us_ratio'
,
'supplier_id'
]);
$data
[
'supplier_id'
]
=
strval
(
$data
[
'supplier_id'
]);
$Redis
->
hset
(
$pre
,
$supplier
[
'supplier_code'
],
json_encode
(
$data
));
}
public
function
saveSupplier
(
$channel
)
{
$supplierTransformer
=
new
SupplierTransformer
();
//先处理下数据
$channel
=
$supplierTransformer
->
transformPostData
(
$channel
);
$logService
=
new
LogService
();
$model
=
new
SupplierChannelModel
();
//获取未修改前的供应商,做数据比较存储
$oldSupplier
=
$newSupplier
=
[];
if
(
!
empty
(
$channel
[
'supplier_id'
]))
{
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
$oldSupplier
=
$supplierTransformer
->
transformInfo
(
$oldSupplier
);
}
//走事务
$dataResult
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
)
{
$tagService
=
new
SupplierTagService
();
...
...
@@ -76,23 +57,56 @@ class SupplierService
unset
(
$channel
[
'hk'
],
$channel
[
'cn'
]);
//获取收发货地有关的数据
$address
=
array_only
(
$channel
,
[
'supplier_id'
,
'shipping_address'
,
'return_address'
,
'return_consignee'
,
'return_phone'
]);
$address
=
array_only
(
$channel
,
[
'supplier_id'
,
'shipping_address'
,
'return_address'
,
'return_consignee'
,
'return_phone'
]);
$shippingAddress
=
array_get
(
$channel
,
'shipping_address'
);
$attachment
=
$channel
[
'attachment'
];
unset
(
$channel
[
'return_phone'
],
$channel
[
'return_address'
],
$channel
[
'return_consignee'
],
$channel
[
'shipping_address'
],
$channel
[
'cn_delivery_time_period'
],
$channel
[
'return_consignee'
]);
unset
(
$channel
[
'shipping_address'
],
$channel
[
'cn_delivery_time_period'
],
$channel
[
'us_delivery_time_period'
],
$channel
[
'attachment'
]);
//获取付款类型有关的数据
$payTypeData
=
array_only
(
$channel
,
[
'pay_type'
,
'pay_type_value'
,
'pay_type_extra'
]);
unset
(
$channel
[
'pay_type'
],
$channel
[
'pay_type_value'
],
$channel
[
'pay_type_extra'
]);
//sku上传规则相关设置
$skuAuditRulerService
=
new
SupplierSkuAuditRulerService
();
$channel
[
'sku_audit_ruler'
]
=
$skuAuditRulerService
->
getSkuAuditRulerForDB
(
$channel
[
'sku_audit_ruler'
]);
//新增供应商操作
if
(
empty
(
$channel
[
'supplier_id'
]))
{
//处理附件信息,新增的时候才会有附件信息提交过来
$attachmentField
=
[
'file_name'
,
'file_url'
,
'field_name'
,
'field_name'
,
'validity_type'
,
'validity_period'
,
];
$attachmentData
=
array_only
(
$channel
,
$attachmentField
);
$channel
=
array_except
(
$channel
,
$attachmentField
);
//处理银行信息,新增的时候才会有附件信息过来
$receiptField
=
[
'receipt_type'
,
'bank_name'
,
'bank_adderss'
,
'account_no'
,
'account_name'
,
'account_adderss'
,
'certificate'
,
'swift_code'
,
];
$receiptData
=
array_only
(
$channel
,
$receiptField
);
$channel
=
array_except
(
$channel
,
$receiptField
);
//先去插入到channel表
$channel
[
'create_uid'
]
=
request
()
->
user
->
userId
;
$channel
[
'create_name'
]
=
request
()
->
user
->
name
;
...
...
@@ -113,6 +127,8 @@ class SupplierService
}
//第一次新增的供应商,都需要进行复审
$channel
[
'need_review'
]
=
1
;
//构建联系人的数据,只有新增的时候才有联系人数据
$contactField
=
[
'supplier_consignee'
,
'supplier_position'
,
...
...
@@ -128,7 +144,7 @@ class SupplierService
$channel
[
'channel_uid'
]
=
$contact
[
'can_check_uids'
];
$supplierId
=
$this
->
newSupplierId
=
$model
->
insertGetId
(
$channel
);
//
同时
添加联系人
//添加联系人
$contact
[
'supplier_id'
]
=
$supplierId
;
$contact
[
'add_time'
]
=
time
();
$contact
[
'admin_id'
]
=
request
()
->
user
->
userId
;
...
...
@@ -140,21 +156,26 @@ class SupplierService
$tagService
->
saveTags
(
$supplierId
,
SupplierTagService
::
TAG_TYPE_SYSTEM
,
'临时供应商'
,
''
);
}
//保存生成的内部编码
$this
->
saveSupplierCode
(
$supplierId
);
//新增的时候也要去添加地址了
$supplierAddressService
=
new
SupplierAddressService
();
$supplierAddressService
->
saveShippingAddress
(
$supplierId
,
$shippingAddress
);
}
else
{
//这里的是更新供应商的操作
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
//要做进一步判断,部分字段修改不需要审核
$auditService
=
new
SupplierAuditService
();
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
,
$payTypeData
);
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
);
if
(
$needAudit
)
{
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
}
$channel
[
'update_time'
]
=
time
();
$channel
[
'update_time'
]
=
time
();
//这里有个逻辑,就是如果供应商类型是临时,那么要打上临时供应商的标签,如果不是,那么就要去掉这个标签
if
(
$channel
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_TEMPORARY
)
{
...
...
@@ -174,7 +195,7 @@ class SupplierService
if
(
$channel
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
&&
$oldSupplier
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_TEMPORARY
)
{
$channel
[
'need_review'
]
=
1
;
if
(
$channel
[
'level'
]
==
'E'
)
{
if
(
$channel
[
'level'
]
==
'E'
)
{
$channel
[
'level'
]
=
''
;
}
}
...
...
@@ -251,6 +272,30 @@ class SupplierService
return
$dataResult
;
}
//生成供应商编码(外部用,展示用),supplierCode是供应商的核心编码,内部使用,可以理解为唯一标识
public
function
generateSupplierSn
(
$supplierId
,
$supplierGroup
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$snMap
=
config
(
'fixed.SupplierSnMap'
);
$supplierCodeNumber
=
substr
(
$supplier
[
'supplier_code'
],
1
);
$supplierSn
=
array_get
(
$snMap
,
$supplierGroup
,
"ERR"
)
.
$supplierCodeNumber
;
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'supplier_sn'
=>
$supplierSn
]);
}
//保存价格系数到redis
public
function
saveRatioToRedis
(
$supplierId
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$Redis
=
new
RedisModel
();
$pre
=
config
(
'fixed.SUPPLIER_RATION'
);
$data
=
array_only
(
$supplier
,
[
'cn_delivery_time'
,
'us_delivery_time'
,
'cn_ratio'
,
'us_ratio'
,
'supplier_id'
]);
$data
[
'supplier_id'
]
=
strval
(
$data
[
'supplier_id'
]);
$Redis
->
hset
(
$pre
,
$supplier
[
'supplier_code'
],
json_encode
(
$data
));
}
//报错供应商编码,包括系统生成的和自定义规则生成的
public
function
saveSupplierCode
(
$supplierId
)
{
...
...
@@ -380,7 +425,7 @@ class SupplierService
$contact
=
[
'supplier_id'
=>
$supplierId
,
'can_check_uids'
=>
$channelUid
,
'add_time'
=>
time
(),
'add_time'
=>
time
(),
'admin_id'
=>
request
()
->
user
->
userId
,
];
$contactResult
=
$contactModel
->
insert
(
$contact
);
...
...
@@ -427,7 +472,6 @@ class SupplierService
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'is_type'
=>
$isType
,
// 'supplier_type'=> 1,
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
]);
if
(
$result
)
{
...
...
app/Http/Validators/SupplierValidator.php
View file @
b86faa69
...
...
@@ -17,15 +17,19 @@ class SupplierValidator
{
//整理下请求数据
$validateData
=
$this
->
transformRequestData
(
$validateData
);
$supplierId
=
$validateData
[
'supplier_id'
]
;
$supplierId
=
array_get
(
$validateData
,
'supplier_id'
)
;
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称是否存在即可
if
(
!
$isAudit
&&
!
empty
(
$supplierId
)
)
{
if
(
!
$isAudit
)
{
if
(
empty
(
$validateData
[
'supplier_name'
]))
{
return
'供应商名称不能为空'
;
}
$count
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$validateData
[
'supplier_name'
])
->
where
(
'supplier_id'
,
'!='
,
$supplierId
)
->
count
();
if
(
empty
(
$supplierId
))
{
$count
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$validateData
[
'supplier_name'
])
->
count
();
}
else
{
$count
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$validateData
[
'supplier_name'
])
->
where
(
'supplier_id'
,
'!='
,
$supplierId
)
->
count
();
}
if
(
$count
)
{
return
"该供应商名称已经存在,请核验后再提交"
;
}
...
...
resources/views/script/AddSupplierScript.blade.php
View file @
b86faa69
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'laydate'
,
'xmSelect'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'laydate'
,
'xmSelect'
,
'upload'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
layDate
=
layui
.
laydate
;
let
laydate
=
layui
.
laydate
;
let
upload
=
layui
.
upload
;
let
element
=
layui
.
element
;
let
xmSelect
=
layui
.
xmSelect
;
//图片上传
upload
.
render
({
elem
:
'.upload-img'
,
url
:
UploadImgUrl
,
field
:
'upload'
,
data
:
{
k1
:
k1
,
k2
:
k2
,
source
:
1
}
,
accept
:
'file'
,
exts
:
'jpg|png|bmp|jpeg|zip|pdf'
,
before
:
function
(
obj
)
{
layer
.
msg
(
'加载中'
,
{
icon
:
16
,
shade
:
0.01
});
let
item
=
this
.
item
;
//预读本地文件示例,不支持ie8
obj
.
preview
(
function
(
index
,
file
,
result
)
{
// if (file.type.indexOf('image') !== -1){
// $('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
// }else{
// $('#' + item.attr('preview')).attr('src', '/images/file.png');
// }
});
}
,
done
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
layer
.
msg
(
'上传成功'
,
{
icon
:
6
});
let
item
=
this
.
item
;
$
(
'#'
+
item
.
attr
(
'data-obj'
)).
val
(
res
.
data
[
0
]);
$
(
'#certificate_url'
).
text
(
res
.
data
[
0
]);
return
false
;
}
else
{
layer
.
msg
(
'上传失败'
,
{
icon
:
5
});
return
false
;
}
}
,
error
:
function
(
res
)
{
layer
.
msg
(
'上传失败'
,
{
icon
:
5
});
return
false
;
}
});
});
</script>
\ No newline at end of file
resources/views/script/supplier/SupplierFileScript.blade.php
View file @
b86faa69
{{
Autograph
()}}
<
script
>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'upload'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'upload'
,
'laydate'
],
function
()
{
let
upload
=
layui
.
upload
;
let
layer
=
layui
.
layer
;
let
form
=
layui
.
form
;
let
laydate
=
layui
.
laydate
;
let
fileName
=
''
;
var
loadIndex
=
0
;
...
...
@@ -21,6 +22,31 @@
}
});
// laydate.render({
// elem: '.validity_period',
// type: 'date',
// trigger: 'click',
// range: '~', //或 range: '~' 来自定义分割字符,
// value: '',
// });
form
.
on
(
'select(validity_period_selector)'
,
function
(
data
)
{
fileType
=
data
.
value
;
let
validityPeriodTimeSelector
=
$
(
this
)
.
parents
(
'.layui-col-md7'
)
.
find
(
'.validity_period'
);
if
(
data
.
value
===
'1'
)
{
validityPeriodTimeSelector
.
attr
(
'disabled'
,
true
);
validityPeriodTimeSelector
.
addClass
(
'layui-disabled'
);
}
else
{
validityPeriodTimeSelector
.
attr
(
'disabled'
,
false
);
validityPeriodTimeSelector
.
removeClass
(
'layui-disabled'
);
}
});
upload
.
render
({
elem
:
'#upload_button'
,
url
:
'{{config('
website
.
UploadUrl
')}}'
,
//改成您自己的上传接口
...
...
@@ -49,16 +75,34 @@
if
(
res
.
code
===
200
)
{
//动态添加js
let
fileTemplateObj
=
$
(
'#file_template'
)
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'href'
,
res
.
data
[
0
]);
fileTemplateObj
.
find
(
'a'
)
.
text
(
fileName
);
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'value'
,
fileName
);
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'value'
,
fileName
);
fileTemplateObj
.
find
(
'#file_name'
)
.
val
(
fileName
);
fileTemplateObj
.
find
(
'#file_url'
)
.
val
(
res
.
data
[
0
]);
fileTemplateObj
.
find
(
'#field_name'
)
.
val
(
$
(
'#file_type_select'
)
.
val
());
fileTemplateObj
.
find
(
'#validity_period_input'
)
.
addClass
(
'layui-input validity_period layui-disabled'
);
let
fileTemplate
=
fileTemplateObj
.
html
();
$
(
'#'
+
fileType
+
'_div'
)
.
show
();
$
(
'#'
+
fileType
+
'_file_div'
)
.
append
(
fileTemplate
);
setFileTypeValue
(
fileType
);
fileTemplateObj
.
find
(
'#validity_period_input'
)
.
removeClass
(
'layui-input validity_period layui-disabled'
);
form
.
render
();
}
else
{
layer
.
msg
(
'上传接口异常,请重试或者联系管理员 . '
+
res
.
message
);
}
lay
(
'.validity_period'
)
.
each
(
function
(){
console
.
log
(
this
)
laydate
.
render
({
elem
:
this
,
type
:
'date'
,
trigger
:
'click'
,
range
:
'~'
,
//或 range: '~' 来自定义分割字符,
value
:
''
,
});
});
delete
this
.
files
[
index
];
layer
.
close
(
loadIndex
);
},
...
...
@@ -67,39 +111,11 @@
//删除文件操作
$
(
document
)
.
on
(
'click'
,
'.delete_file'
,
function
()
{
// layer.confirm('确定要删除该文件吗?', function (index) {
let
fileType
=
$
(
this
)
.
parent
()
.
parent
()
.
parent
()
.
find
(
'input'
)
.
attr
(
'id'
);
//找出对应的div删除
$
(
this
)
.
parent
()
.
remove
();
setFileTypeValue
(
fileType
)
// return false;
//找出对应的div删除
$
(
this
)
.
parents
(
'.single_file_div'
)
.
remove
();
// return false;
// });
});
//遍历找出文件list复制到表单域
function
setFileTypeValue
(
fileType
)
{
let
fileTypeObj
=
$
(
'#'
+
fileType
);
let
fileTypeDiv
=
$
(
'#'
+
fileType
+
'_div'
);
let
fileValueArr
=
[];
fileTypeDiv
.
find
(
'a'
)
.
each
(
function
()
{
let
url
=
$
(
this
)
.
attr
(
'href'
);
let
fileName
=
$
(
this
)
.
attr
(
'value'
);
let
fileValueMap
=
{
file_name
:
fileName
,
url
:
url
,
name
:
fileType
}
fileValueArr
.
push
(
fileValueMap
)
})
if
(
fileValueArr
.
length
===
0
)
{
fileTypeObj
.
val
(
''
);
}
else
{
fileTypeObj
.
val
(
JSON
.
stringify
(
fileValueArr
));
}
//判断是否没有子元素了,没有的话直接隐藏父元素
// let fileListSize = $('#fileType').find('a').size();
// if (fileListSize === 0) {
// fileTypeDiv.hide();
// }
}
});
</
script
>
\ No newline at end of file
resources/views/script/supplier/SupplierPayTypeScript.blade.php
View file @
b86faa69
...
...
@@ -3,12 +3,12 @@
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
//要根据付款类型的不同选项,切换不同的显示
form
.
on
(
'select(pay_type
[]
)'
,
function
(
data
)
{
form
.
on
(
'select(pay_type)'
,
function
(
data
)
{
const
payType
=
data
.
value
;
let
parentDiv
=
$
(
this
).
parents
(
'.pay_type_div'
);
parentDiv
.
find
(
'.pay_type_'
+
payType
+
'_div'
).
show
();
parentDiv
.
find
(
'.pay_type_'
+
payType
+
'_div'
).
find
(
'.valueInput'
).
first
().
attr
(
'name'
,
'pay_type_value
[]
'
);
parentDiv
.
find
(
'.pay_type_'
+
payType
+
'_div'
).
find
(
'.valueInput'
).
eq
(
1
).
attr
(
'name'
,
'pay_type_extra
[]
'
);
parentDiv
.
find
(
'.pay_type_'
+
payType
+
'_div'
).
find
(
'.valueInput'
).
first
().
attr
(
'name'
,
'pay_type_value'
);
parentDiv
.
find
(
'.pay_type_'
+
payType
+
'_div'
).
find
(
'.valueInput'
).
eq
(
1
).
attr
(
'name'
,
'pay_type_extra'
);
if
(
payType
===
'1'
)
{
parentDiv
.
find
(
'.pay_type_2_div'
).
hide
();
parentDiv
.
find
(
'.pay_type_2_div'
).
find
(
'.valueInput'
).
attr
(
'name'
,
''
);
...
...
@@ -66,9 +66,9 @@
$
(
document
).
on
(
'click'
,
'.add_pay_type'
,
function
()
{
$
(
'#pay_type_div_list'
).
append
(
$
(
'#pay_type_template'
).
html
());
//不知道为什么元素的name总会变来变去,所以手动固定死,确保提交的时候,顺序和名称都是对的
$
(
"input[name^='pay_type_value[']"
).
attr
(
'name'
,
'pay_type_value
[]
'
)
$
(
"input[name^='pay_type_extra[']"
).
attr
(
'name'
,
'pay_type_extra
[]
'
)
$
(
"select[name^='pay_type[']"
).
attr
(
'name'
,
'pay_type
[]
'
)
$
(
"input[name^='pay_type_value[']"
).
attr
(
'name'
,
'pay_type_value'
)
$
(
"input[name^='pay_type_extra[']"
).
attr
(
'name'
,
'pay_type_extra'
)
$
(
"select[name^='pay_type[']"
).
attr
(
'name'
,
'pay_type'
)
form
.
render
(
'select'
);
});
...
...
resources/views/web/AddSupplier.blade.php
View file @
b86faa69
...
...
@@ -36,7 +36,7 @@
<div
class=
"layui-form-item"
>
<div
class=
"layui-col-md5"
>
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('supplier_type','供应商类别',!empty($supplier)?array_get($supplier,'supplier_type',0):'1',
config('field.SupplierType')
,['require'=>true]) !!}
{!! $singleSelectPresenter->render('supplier_type','供应商类别',!empty($supplier)?array_get($supplier,'supplier_type',0):'1',
[1=>'正式',2=>'临时']
,['require'=>true]) !!}
</div>
<div
class=
"layui-col-md7"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
...
...
@@ -177,7 +177,7 @@
<input
type=
"hidden"
name=
"stockup_type"
value=
"{{$supplier['stockup_type'] or ''}}"
>
@foreach(config('fixed.StockupType') as $k=>$type)
<input
type=
"checkbox"
name=
"stockup_type[{{$k}}]"
<input
type=
"checkbox"
lay-skin=
"primary"
title=
"{{$type}}"
>
@endforeach
...
...
@@ -254,16 +254,7 @@
</div>
</div>
<div
class=
"layui-col-md4"
>
<div
id=
"swift_code_div"
@
if
((!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
1
)||
empty
($
receipt
['
receipt_type
']))
style=
"display: none"
@
endif
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
Swift Code :
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"swift_code"
id=
"Swift Code"
placeholder=
"请输入电汇号码"
class=
"layui-input"
value=
"{{$receipt['swift_code'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-col-md4"
>
<label
class=
"layui-form-label"
>
...
...
@@ -273,7 +264,8 @@
<input
type=
"hidden"
name=
"certificate"
id=
"certificate"
value=
"{{$receipt['certificate'] or ''}}"
>
<button
type=
"button"
class=
"layui-btn upload-img layui-btn-sm"
preview=
"preview"
data-obj=
"certificate"
>
<button
type=
"button"
class=
"layui-btn upload-img layui-btn-sm"
preview=
"preview"
data-obj=
"certificate"
>
<i
class=
"layui-icon"
>

</i>
上传文件
</button>
<a
target=
"_blank"
id=
"certificate_url"
...
...
@@ -371,7 +363,8 @@
</blockquote>
@include('web.supplier.SupplierFile')
<div
style=
"height: 100px"
></div>
<div
class=
"fix-button"
>
{{--
<div
class=
"fix-button"
>
--}}
<div>
<div
class=
"layui-row"
style=
"width: 90%;"
>
<hr>
<div
class=
"layui-col-md7"
>
...
...
resources/views/web/supplier/SupplierAdd.blade.php
deleted
100644 → 0
View file @
51920721
This diff is collapsed.
Click to expand it.
resources/views/web/supplier/SupplierFile.blade.php
View file @
b86faa69
...
...
@@ -3,7 +3,7 @@
<div
clas=
"layui-col-md3"
>
<label
class=
"layui-form-label"
><span
class=
"require"
id=
"attachment_required_span"
>
*
</span>
附件上传
</label>
<div
class=
"layui-input-inline"
style=
"width: 155px"
id=
"file_type_selector"
>
<select
lay-verify=
""
lay-filter=
"file_type_selector"
>
<select
lay-verify=
""
lay-filter=
"file_type_selector"
id=
"file_type_select"
>
<option
value=
""
>
请选择
</option>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
<option
value=
"{{$name}}"
>
{{$cnName}}
</option>
...
...
@@ -27,33 +27,13 @@
<blockquote
class=
"layui-elem-quote layui-quote-nm"
style=
"padding-bottom: 5px"
>
<div
id=
"file_list"
class=
"layui-row"
>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
@if (!empty($attachment[$name]))
<div
id=
"{{$name}}_div"
>
<input
type=
"hidden"
name=
"{{$name}}"
id=
"{{$name}}"
value=
"{{json_encode($attachment[$name])}}"
>
<span>
{{$cnName}} :
</span>
<div
id=
"{{$name}}_file_div"
>
@foreach($attachment[$name] as $k=>$item)
<span
class=
"single_file_div"
>
<a
href=
"{{$item['url']}}"
target=
"_blank"
value=
"{{array_get($item,'file_name','未知文件名')}}"
>
{{array_get($item,'file_name','未知文件名')}}
</a>
<i
class=
"layui-icon delete_file"
style=
"font-size: 15px !important; color: red;cursor: pointer;margin-left: 3px;"
>
X
</i>
</span>
@endforeach
</div>
<hr>
</div>
@else
<div
id=
"{{$name}}_div"
style=
"display: none"
>
<input
type=
"hidden"
name=
"{{$name}}"
id=
"{{$name}}"
>
<input
type=
"hidden"
id=
"{{$name}}"
>
<span>
{{$cnName}} :
</span>
<div
id=
"{{$name}}_file_div"
></div>
<hr>
</div>
@endif
@endforeach
</blockquote>
</div>
...
...
@@ -61,10 +41,31 @@
</div>
</div>
<div
id=
"file_template"
style=
"display: none"
>
<span
class=
"single_file_div"
>
<a
href=
""
target=
"_blank"
></a>
<i
class=
"layui-icon delete_file"
style=
"font-size: 15px !important; color: red;cursor: pointer;margin-left: 3px;"
>
X
</i>
</span>
<div
class=
"layui-row single_file_div"
>
<div
class=
"layui-col-md3"
>
<label
class=
"layui-form-label"
>
附件文件名 :
</label>
<div
class=
"layui-input-inline"
style=
"padding-top: 10px"
>
<a
href=
""
target=
"_blank"
></a>
<input
type=
"hidden"
name=
"file_name[]"
id=
"file_name"
>
<input
type=
"hidden"
name=
"file_url[]"
id=
"file_url"
>
<input
type=
"hidden"
name=
"field_name[]"
id=
"field_name"
>
</div>
</div>
<div
class=
"layui-col-md7"
>
<label
class=
"layui-form-label"
>
有效期 :
</label>
<div
class=
"layui-input-inline"
style=
"width: 100px"
>
<select
name=
"validity_type[]"
lay-filter=
"validity_period_selector"
>
<option
value=
""
>
请选择
</option>
<option
value=
"1"
>
长期有效
</option>
<option
value=
"2"
>
自定义
</option>
</select>
</div>
<div
class=
"layui-input-inline"
style=
"width: 300px"
>
<input
type=
"text"
name=
"validity_period[]"
placeholder=
"请选择时间区间"
autocomplete=
"off"
id=
"validity_period_input"
class=
""
disabled
>
</div>
<button
style=
"margin-top: 3px"
class=
"layui-btn layui-btn-xs layui-btn-danger delete_file"
>
删除
</button>
</div>
</div>
</div>
@include('script.supplier.SupplierFileScript')
\ No newline at end of file
resources/views/web/supplier/SupplierPayType.blade.php
View file @
b86faa69
...
...
@@ -20,13 +20,13 @@
<div
class=
"layui-row pay_type_div"
style=
"margin-bottom: 5px;"
>
<div
class=
"layui-col-md3"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('
SettlementT
ype','结算方式 : ',
{!! $statusPresenter->render('
settlement_t
ype','结算方式 : ',
'',config('field.SettlementType'),['required'=>true]) !!}
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('pay_type
[]','付款方式
: ',
{!! $statusPresenter->render('pay_type
','付款周期
: ',
$payType['pay_type'],config('fixed.SupplierPayType'),['required'=>true]) !!}
</div>
</div>
...
...
@@ -37,7 +37,7 @@
<div
class=
"layui-row"
style=
"padding-left:70px"
>
<span
class=
"require"
>
*
</span>
月结 :
&
nbsp
<div
class=
"layui-input-inline"
style=
"width: 80px;"
>
<input
class=
"layui-input valueInput"
type=
"hidden"
name=
"pay_type_value
[]
"
<input
class=
"layui-input valueInput"
type=
"hidden"
name=
"pay_type_value"
value=
"{{$payType['pay_type_value'] or ''}}"
>
<select
lay-filter=
"pay_type_month"
>
<option
value=
""
>
请选择
</option>
...
...
@@ -59,7 +59,7 @@
</select>
</div>
&
nbsp天
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
value=
"天"
>
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
value=
"天"
>
</div>
</div>
@else
...
...
@@ -83,8 +83,8 @@
@if ($payType['pay_type']==2)
<div
class=
"pay_type_2_div"
>
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_value
[]
"
>
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
value=
""
>
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_value"
>
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
value=
""
>
</div>
@else
<div
class=
"pay_type_2_div"
style=
"display: none"
>
...
...
@@ -118,19 +118,19 @@
{{--
</div>
--}}
{{--
<div
class=
"layui-col-md6"
>
--}}
{{--
<div
class=
"layui-input-inline"
style=
"width: 100px;margin-left: -20px;"
>
--}}
{{--
<input
class=
"layui-input valueInput"
type=
"text"
name=
"pay_type_value
[]
"
--
}}
{{--
<input
class=
"layui-input valueInput"
type=
"text"
name=
"pay_type_value"
--
}}
{{
--
value=
"{{$payType['pay_type_value']}}"
>
--}}
{{--
</div>
--}}
{{--
&
nbsp--}}
{{-- @if (!empty($payType['pay_type_extra'])
&&
strpos($payType['pay_type_extra'],'%')!==false)--}}
{{--
<span
class=
"temp"
>
%
</span>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
value=
"%"
>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
value=
"%"
>
--}}
{{-- @elseif (!empty($payType['pay_type_extra'])
&&
strpos($payType['pay_type_extra'],'RMB')!==false)--}}
{{--
<span
class=
"temp"
>
RMB
</span>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
value=
"RMB"
>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
value=
"RMB"
>
--}}
{{-- @else--}}
{{--
<span
class=
"temp"
>
%
</span>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
--
}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
--
}}
{{
--
value=
"%"
>
--}}
{{-- @endif--}}
{{--
</div>
--}}
...
...
@@ -171,14 +171,14 @@
<div
class=
"layui-row pay_type_div"
style=
"margin-bottom: 5px;"
>
<div
class=
"layui-col-md3"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('
SettlementT
ype','结算方式 : ',
{!! $statusPresenter->render('
settlement_t
ype','结算方式 : ',
'',config('field.SettlementType'),['required'=>true]) !!}
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('pay_type
[]
','付款方式 : ',
isset($supplier['pay_type
[]'])?$supplier['pay_type[]
']:'',config('fixed.SupplierPayType'),['required'=>true]) !!}
{!! $statusPresenter->render('pay_type','付款方式 : ',
isset($supplier['pay_type
'])?$supplier['pay_type
']:'',config('fixed.SupplierPayType'),['required'=>true]) !!}
</div>
</div>
<div
class=
"layui-col-md6"
style=
"width:500px;margin-bottom: 3px;margin-left: -20px;"
>
...
...
@@ -199,10 +199,10 @@
{{--
</div>
--}}
{{--
<div
class=
"layui-col-md6"
>
--}}
{{--
<div
class=
"layui-input-inline"
style=
"width: 100px;margin-left: -20px;"
>
--}}
{{--
<input
class=
"layui-input valueInput"
type=
"text"
name=
"pay_type_value
[]
"
>
--}}
{{--
<input
class=
"layui-input valueInput"
type=
"text"
name=
"pay_type_value"
>
--}}
{{--
</div>
--}}
{{--
&
nbsp
<span
class=
"temp"
>
%
</span>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra
[]
"
value=
"%"
>
--}}
{{--
<input
type=
"hidden"
class=
"valueInput"
name=
"pay_type_extra"
value=
"%"
>
--}}
{{--
</div>
--}}
</div>
<div
class=
"pay_type_1_div"
style=
"display: none"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment