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
77caa55a
authored
Jul 26, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
附件管理
parent
076d0c01
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
274 additions
and
307 deletions
app/Http/Controllers/Api/CommonApiController.php
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/LogService.php
app/Http/Services/SupplierAttachmentService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
config/field.php
resources/views/script/SupplierListScript.blade.php
resources/views/script/supplier/SupplierFileScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SupplierFile.blade.php
app/Http/Controllers/Api/CommonApiController.php
View file @
77caa55a
...
...
@@ -37,31 +37,6 @@ class CommonApiController extends Controller
return
$this
->
response
(
0
,
'ok'
,
$brandList
);
}
public
function
upload
(
$request
)
{
$upload
=
$request
->
file
(
'qualification_photos'
);
$ext
=
$upload
->
getClientOriginalExtension
();
$fileName
=
time
()
.
'.'
.
$ext
;
$upload
->
move
(
storage_path
(
"uploads"
),
$fileName
);
$path
=
storage_path
(
"uploads"
)
.
'/'
.
$fileName
;
$result
=
UploadToOss
(
$path
);
$result
=
json_decode
(
$result
,
true
);
unlink
(
$path
);
if
(
!
empty
(
$result
)
&&
$result
[
'code'
]
===
200
)
{
echo
json_encode
([
'code'
=>
200
,
'src'
=>
$result
[
'data'
][
0
],
'msg'
=>
'ok'
,
]);
}
else
{
echo
json_encode
([
'code'
=>
-
1
,
'msg'
=>
'上传失败'
,
]);
}
exit
();
}
private
function
SearchBrand
(
$request
)
{
$brandName
=
$request
->
input
(
'brand_name'
);
...
...
app/Http/Controllers/Api/SupplierApiController.php
View file @
77caa55a
...
...
@@ -6,18 +6,15 @@ use App\Http\Controllers\Controller;
use
App\Http\Controllers\Filter\SupplierFilter
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\LogService
;
use
App\Http\Services\MessageService
;
use
App\Http\Services\SupplierAuditService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SyncSupplierService
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Http\Validators\SupplierValidator
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
//通用API,比如获取品牌列表,分类列表等
class
SupplierApiController
extends
Controller
{
...
...
@@ -64,7 +61,6 @@ class SupplierApiController extends Controller
//附加费
'cn'
,
'hk'
,
// 'status',
//商品上传规则
'sku_upload_ruler'
,
...
...
@@ -73,6 +69,7 @@ class SupplierApiController extends Controller
//标签
'system_tags'
,
'customer_tags'
,
];
public
function
Entrance
(
Request
$request
,
$id
)
...
...
@@ -100,6 +97,8 @@ class SupplierApiController extends Controller
'supplier_fax'
,
'can_check_uids'
]);
//附件
$channelMap
=
array_merge
(
$channelMap
,
config
(
'field.AttachmentFields'
));
$channel
=
$request
->
only
(
$channelMap
);
$service
=
new
SupplierService
();
$result
=
$service
->
saveSupplier
(
$channel
);
...
...
@@ -209,9 +208,6 @@ class SupplierApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'修改状态失败'
);
}
//发送短信
// $messageService = new MessageService();
// $messageService->sendSupplierMessage($supplierId, $status);
//发送队列消息同步到金蝶
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
...
...
@@ -426,7 +422,7 @@ class SupplierApiController extends Controller
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'拉黑'
,
'拉黑供应商'
);
$this
->
response
(
0
,
'拉黑成功'
);
}
else
{
$this
->
response
(
-
1
,
'拉黑操作失败
'
);
$this
->
response
(
-
1
,
'拉黑操作失败'
);
}
}
...
...
@@ -473,6 +469,6 @@ class SupplierApiController extends Controller
$supplierIds
=
explode
(
','
,
$supplierIds
);
$supplierService
=
new
SupplierService
();
$supplierService
->
batchApplyInReviewSupplier
(
$supplierIds
);
$this
->
response
(
0
,
'
批量
申请审核成功'
);
$this
->
response
(
0
,
'申请审核成功'
);
}
}
app/Http/Controllers/SupplierController.php
View file @
77caa55a
...
...
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
use
App\Http\Services\LogService
;
use
App\Http\Services\RegionService
;
use
App\Http\Services\SupplierAttachmentService
;
use
App\Http\Services\SupplierAuditService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierStatisticsService
;
use
App\Http\Services\SupplierTagService
;
...
...
@@ -164,6 +166,8 @@ class SupplierController extends Controller
$this
->
data
[
'province_city'
]
=
[
$supplier
[
'province_id'
],
$supplier
[
'city_id'
]];
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$supplierAttachmentService
=
new
SupplierAttachmentService
();
$this
->
data
[
'attachment'
]
=
$supplierAttachmentService
->
getAttachment
(
$supplierId
);
return
$this
->
view
(
'编辑供应商'
);
}
...
...
app/Http/Services/LogService.php
View file @
77caa55a
...
...
@@ -99,30 +99,6 @@ class LogService
$content
=
'Sku审核规则由 [ '
.
$oldValue
.
' ] 改成 [ '
.
$newValue
.
' ];'
;
$result
[]
=
$content
;
}
if
(
$key
==
'qualification_photos'
)
{
$oldFiles
=
json_decode
(
$oldSupplier
[
'qualification_photos'
],
true
);
$oldFileNames
=
array_map
(
function
(
$file
)
{
return
$file
[
'file_name'
];
},
$oldFiles
);
$newFiles
=
json_decode
(
$newSupplier
[
'qualification_photos'
],
true
);
$newFileNames
=
array_map
(
function
(
$file
)
{
return
$file
[
'file_name'
];
},
$newFiles
);
//对比文件名变化
$diffKeys
=
array_keys
(
array_diff_assoc
(
$newFileNames
,
$oldFileNames
));
$content
=
''
;
foreach
(
$diffKeys
as
$key
)
{
$oldFileName
=
array_get
(
$oldFileNames
,
$key
);
$oldFileName
=
$oldFileName
==
'选择文件上传'
?
' '
:
$oldFileName
;
$newFileName
=
array_get
(
$newFileNames
,
$key
);
if
(
$newFileName
==
"选择文件上传"
)
{
continue
;
}
$content
.=
array_get
(
config
(
'fixed.FileNameMapping'
),
$key
)
.
'由 [ '
.
$oldFileName
.
' ] 修改为 ['
.
$newFileName
.
']; '
;
}
$result
[]
=
$content
;
}
if
(
$key
==
'extra_fee'
)
{
$oldFee
=
json_decode
(
$oldSupplier
[
'extra_fee'
],
true
);
$newFee
=
json_decode
(
$newSupplier
[
'extra_fee'
],
true
);
...
...
app/Http/Services/SupplierAttachmentService.php
0 → 100644
View file @
77caa55a
<?php
namespace
App\Http\Services
;
//后台用户相关信息服务
use
App\Model\RedisModel
;
use
App\Model\SupplierAttachmentModel
;
use
Illuminate\Support\Facades\DB
;
//用于判断是否已经查看的服务
class
SupplierAttachmentService
{
public
function
getAttachment
(
$supplierId
)
{
$attachmentModel
=
new
SupplierAttachmentModel
();
$attachmentData
=
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$attachment
=
[];
if
(
!
empty
(
$attachmentData
))
{
$attachment
=
json_decode
(
$attachmentData
,
true
);
$attachment
=
array_map
(
function
(
$item
)
{
return
json_decode
(
$item
,
true
);
},
$attachment
);
}
return
$attachment
;
}
public
function
saveAttachment
(
$supplierId
,
$attachment
)
{
$attachmentModel
=
new
SupplierAttachmentModel
();
$attachmentData
=
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
!
empty
(
$attachmentData
))
{
$attachment
[
'update_time'
]
=
time
();
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$attachment
);
}
else
{
$attachment
[
'create_time'
]
=
time
();
$attachment
[
'supplier_id'
]
=
$supplierId
;
$attachmentModel
->
insert
(
$attachment
);
}
}
}
\ No newline at end of file
app/Http/Services/SupplierService.php
View file @
77caa55a
...
...
@@ -51,11 +51,11 @@ class SupplierService
public
function
saveSupplier
(
$channel
)
{
$supplierTransformer
=
new
SupplierTransformer
();
//先处理下数据
$channel
=
$
this
->
transf
ormData
(
$channel
);
$channel
=
$
supplierTransformer
->
transformF
ormData
(
$channel
);
$logService
=
new
LogService
();
$model
=
new
SupplierChannelModel
();
$supplierTransformer
=
new
SupplierTransformer
();
//获取未修改前的供应商,做数据比较存储
$oldSupplier
=
$newSupplier
=
[];
if
(
!
empty
(
$channel
[
'supplier_id'
]))
{
...
...
@@ -74,10 +74,10 @@ class SupplierService
$address
=
array_only
(
$channel
,
[
'supplier_id'
,
'shipping_address'
,
'return_address'
,
'return_consignee'
,
'return_phone'
]);
//插入
$attachment
=
$channel
[
'attachment'
];
unset
(
$channel
[
'hk'
],
$channel
[
'cn'
],
$channel
[
'return_phone'
],
$channel
[
'return_address'
],
$channel
[
'return_consignee'
],
$channel
[
'shipping_address'
],
$channel
[
'cn_delivery_time_period'
],
$channel
[
'us_delivery_time_period'
]);
$channel
[
'us_delivery_time_period'
]
,
$channel
[
'attachment'
]
);
$skuAuditRulerService
=
new
SupplierSkuAuditRulerService
();
$channel
[
'sku_audit_ruler'
]
=
$skuAuditRulerService
->
getSkuAuditRulerForDB
(
$channel
[
'sku_audit_ruler'
]);
...
...
@@ -148,6 +148,9 @@ class SupplierService
$tagService
->
saveTags
(
$supplierId
,
14
,
$channel
[
'system_tags'
],
$oldSystemTags
);
$tagService
->
saveTags
(
$supplierId
,
4
,
$channel
[
'customer_tags'
],
$oldCustomerTags
);
}
//保存附件
$attachmentService
=
new
SupplierAttachmentService
();
$attachmentService
->
saveAttachment
(
$supplierId
,
$attachment
);
//保存生成的内部编码
$this
->
saveSupplierCode
(
$supplierId
);
//重新生成外部显示的编码
...
...
@@ -189,88 +192,12 @@ class SupplierService
return
$dataResult
;
}
//处理数据
public
function
transformData
(
$channel
)
{
if
(
!
empty
(
$channel
[
'stockup_type'
]))
{
$stockupType
=
array_keys
(
$channel
[
'stockup_type'
]);
$stockupType
=
!
empty
(
$stockupType
)
?
implode
(
","
,
$stockupType
)
:
''
;
$channel
[
'stockup_type'
]
=
$stockupType
;
}
if
(
!
empty
(
$channel
[
'currency'
]))
{
if
(
$channel
[
'currency'
]
!=
1
)
{
$channel
[
'tax_number'
]
=
''
;
}
}
if
(
empty
(
$channel
[
'purchase_uid'
]))
{
unset
(
$channel
[
'purchase_uid'
]);
}
if
(
!
empty
(
$channel
[
'system_tags'
]))
{
$channel
[
'system_tags'
]
=
rtrim
(
$channel
[
'system_tags'
],
','
);
}
if
(
!
empty
(
$channel
[
'customer_tags'
]))
{
$channel
[
'customer_tags'
]
=
rtrim
(
$channel
[
'customer_tags'
],
','
);
}
$channel
[
'cn_ratio'
]
=
empty
(
$channel
[
'cn_ratio'
])
?
1
:
$channel
[
'cn_ratio'
];
$channel
[
'us_ratio'
]
=
empty
(
$channel
[
'us_ratio'
])
?
1
:
$channel
[
'us_ratio'
];
$channel
[
'cn_delivery_time'
]
=
$channel
[
'cn_delivery_time'
]
?
$channel
[
'cn_delivery_time'
]
.
$channel
[
'cn_delivery_time_period'
]
:
''
;
$channel
[
'us_delivery_time'
]
=
$channel
[
'us_delivery_time'
]
?
$channel
[
'us_delivery_time'
]
.
$channel
[
'us_delivery_time_period'
]
:
''
;
$channel
[
'qualification_photos'
]
=
$this
->
getPhotosData
(
$channel
[
'upload_file'
]);
unset
(
$channel
[
'upload_file'
]);
$channel
[
'established_time'
]
=
strtotime
(
$channel
[
'established_time'
]);
//省市选择的处理
if
(
!
empty
(
$channel
[
'province_city'
]))
{
$regionData
=
explode
(
','
,
$channel
[
'province_city'
]);
$channel
[
'province_id'
]
=
!
empty
(
$regionData
[
0
])
?
$regionData
[
0
]
:
0
;
$channel
[
'city_id'
]
=
!
empty
(
$regionData
[
1
])
?
$regionData
[
1
]
:
0
;
}
//判断所在区域,如果不是中国,则要把省市去掉
if
(
$channel
[
'region'
]
!=
2
)
{
$channel
[
'province_id'
]
=
$channel
[
'city_id'
]
=
0
;
}
unset
(
$channel
[
'province_city'
]);
$skuUploadRulerService
=
new
SupplierSkuUploadRulerService
();
$channel
[
'sku_upload_ruler'
]
=
$skuUploadRulerService
->
getSkuUploadRulerForDB
(
$channel
[
'sku_upload_ruler'
]);
return
$channel
;
}
public
function
getPhotosData
(
$uploadFiles
)
{
$data
=
[];
foreach
(
$uploadFiles
as
$name
=>
$file
)
{
if
(
empty
(
$file
))
{
$data
[
$name
]
=
[
'name'
=>
$name
,
'url'
=>
''
,
'file_name'
=>
''
];
}
else
{
$file
=
explode
(
'|_|'
,
$file
);
$data
[
$name
]
=
[
'name'
=>
$name
,
'url'
=>
$file
[
0
],
'file_name'
=>
$file
[
1
],
];
}
}
$data
=
json_encode
(
$data
);
return
$data
;
}
//报错供应商编码,包括系统生成的和自定义规则生成的
private
function
saveSupplierCode
(
$supplierId
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
!
empty
(
$supplier
))
{
$supplier
=
$supplier
->
toArray
();
$supplierCode
=
'L'
.
str_pad
(
$supplierId
,
7
,
"0"
,
STR_PAD_LEFT
);
return
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'supplier_code'
=>
$supplierCode
,
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
77caa55a
...
...
@@ -30,7 +30,7 @@ class SupplierTransformer
$supplier
=
$this
->
getStockupType
(
$supplier
);
$supplier
[
'supplier_group'
]
=
array_get
(
config
(
'fixed.SupplierGroup'
),
$supplier
[
'supplier_group'
],
'未设置'
);
$supplier
[
'region_name'
]
=
array_get
(
config
(
'fixed.Region'
),
$supplier
[
'region'
]);
$supplier
[
'create_time'
]
=
$supplier
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'create_time'
])
:
''
;
$supplier
[
'create_time'
]
=
$supplier
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'create_time'
])
:
''
;
$supplier
[
'audit_time'
]
=
$supplier
[
'audit_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'audit_time'
])
:
''
;
$supplier
[
'update_time'
]
=
$supplier
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'update_time'
])
:
''
;
$supplier
[
'channel_username'
]
=
$this
->
getChannelUserNames
(
$supplier
[
'channel_uid'
]);
...
...
@@ -91,7 +91,6 @@ class SupplierTransformer
}
$intracodeModel
=
new
IntracodeModel
();
$users
=
$intracodeModel
->
getSampleEncode
(
true
);
$supplier
[
'qualification_photos'
]
=
trim
(
$supplier
[
'qualification_photos'
]);
$supplier
[
'stockup_type_data'
]
=
$this
->
transformStockupTypeData
(
$supplier
[
'stockup_type'
]);
$supplier
[
'established_time'
]
=
!
empty
(
$supplier
[
'established_time'
])
?
date
(
'Y-m-d'
,
$supplier
[
'established_time'
])
:
''
;
...
...
@@ -107,8 +106,7 @@ class SupplierTransformer
$supplier
[
'create_time'
]
=
$supplier
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'create_time'
])
:
''
;
$supplier
[
'channel_username'
]
=
$this
->
getChannelUserNames
(
$supplier
[
'channel_uid'
]);
$supplier
[
'purchase_username'
]
=
array_get
(
$users
,
$supplier
[
'purchase_uid'
]);
$supplier
[
'yunxin_channel_username'
]
=
array_get
(
$users
,
array_get
(
$supplier
,
'yunxin_channel_uid'
));
$supplier
[
'qualification_photos'
]
=
$this
->
getPhotosDataForForm
(
$supplier
[
'qualification_photos'
]);
$supplier
[
'yunxin_channel_username'
]
=
array_get
(
$users
,
array_get
(
$supplier
,
'yunxin_channel_uid'
));
$uploadRulerService
=
new
SupplierSkuUploadRulerService
();
$supplier
[
'sku_upload_ruler'
]
=
$uploadRulerService
->
getSkuUploadRuler
(
$supplier
[
'sku_upload_ruler'
]);
$ruleService
=
new
SupplierSkuAuditRulerService
();
...
...
@@ -153,26 +151,6 @@ class SupplierTransformer
return
$supplier
;
}
private
function
getPhotosDataForForm
(
$photos
)
{
if
(
empty
(
$photos
))
{
return
[];
}
$photos
=
json_decode
(
$photos
,
true
);
if
(
empty
(
$photos
[
'business_license'
]))
{
return
[];
}
$data
=
[];
foreach
(
$photos
as
$name
=>
$photo
)
{
$data
[
$name
]
=
[
'value'
=>
$photo
[
'url'
]
.
'|_|'
.
$photo
[
'file_name'
],
'file_name'
=>
$photo
[
'file_name'
]
?:
'选择文件上传'
,
'url'
=>
$photo
[
'url'
],
];
}
return
$data
;
}
private
function
getStockupType
(
$supplier
)
{
$supplier
[
'stockup_type'
]
=
explode
(
','
,
$supplier
[
'stockup_type'
]);
...
...
@@ -201,4 +179,65 @@ class SupplierTransformer
return
[];
}
//转换表单数据
public
function
transformFormData
(
$channel
)
{
if
(
!
empty
(
$channel
[
'stockup_type'
]))
{
$stockupType
=
array_keys
(
$channel
[
'stockup_type'
]);
$stockupType
=
!
empty
(
$stockupType
)
?
implode
(
","
,
$stockupType
)
:
''
;
$channel
[
'stockup_type'
]
=
$stockupType
;
}
if
(
!
empty
(
$channel
[
'currency'
]))
{
if
(
$channel
[
'currency'
]
!=
1
)
{
$channel
[
'tax_number'
]
=
''
;
}
}
if
(
empty
(
$channel
[
'purchase_uid'
]))
{
unset
(
$channel
[
'purchase_uid'
]);
}
if
(
!
empty
(
$channel
[
'system_tags'
]))
{
$channel
[
'system_tags'
]
=
rtrim
(
$channel
[
'system_tags'
],
','
);
}
if
(
!
empty
(
$channel
[
'customer_tags'
]))
{
$channel
[
'customer_tags'
]
=
rtrim
(
$channel
[
'customer_tags'
],
','
);
}
$channel
[
'cn_ratio'
]
=
empty
(
$channel
[
'cn_ratio'
])
?
1
:
$channel
[
'cn_ratio'
];
$channel
[
'us_ratio'
]
=
empty
(
$channel
[
'us_ratio'
])
?
1
:
$channel
[
'us_ratio'
];
$channel
[
'cn_delivery_time'
]
=
$channel
[
'cn_delivery_time'
]
?
$channel
[
'cn_delivery_time'
]
.
$channel
[
'cn_delivery_time_period'
]
:
''
;
$channel
[
'us_delivery_time'
]
=
$channel
[
'us_delivery_time'
]
?
$channel
[
'us_delivery_time'
]
.
$channel
[
'us_delivery_time_period'
]
:
''
;
unset
(
$channel
[
'upload_file'
]);
$channel
[
'established_time'
]
=
strtotime
(
$channel
[
'established_time'
]);
//省市选择的处理
if
(
!
empty
(
$channel
[
'province_city'
]))
{
$regionData
=
explode
(
','
,
$channel
[
'province_city'
]);
$channel
[
'province_id'
]
=
!
empty
(
$regionData
[
0
])
?
$regionData
[
0
]
:
0
;
$channel
[
'city_id'
]
=
!
empty
(
$regionData
[
1
])
?
$regionData
[
1
]
:
0
;
}
//判断所在区域,如果不是中国,则要把省市去掉
if
(
$channel
[
'region'
]
!=
2
)
{
$channel
[
'province_id'
]
=
$channel
[
'city_id'
]
=
0
;
}
unset
(
$channel
[
'province_city'
]);
$skuUploadRulerService
=
new
SupplierSkuUploadRulerService
();
$channel
[
'sku_upload_ruler'
]
=
$skuUploadRulerService
->
getSkuUploadRulerForDB
(
$channel
[
'sku_upload_ruler'
]);
$attachment
=
[];
$attachmentFields
=
config
(
'field.AttachmentFields'
);
foreach
(
$channel
as
$key
=>
$field
)
{
if
(
in_array
(
$key
,
$attachmentFields
))
{
$attachment
[
$key
]
=
$field
;
unset
(
$channel
[
$key
]);
}
}
$channel
[
'attachment'
]
=
$attachment
;
return
$channel
;
}
}
\ No newline at end of file
app/Http/Validators/SupplierValidator.php
View file @
77caa55a
...
...
@@ -28,7 +28,7 @@ class SupplierValidator
'return_address'
=>
'max:100'
,
'return_consignee'
=>
'max:50'
,
'return_phone'
=>
'max:50'
,
'
upload_file.
business_license'
=>
'required'
,
'business_license'
=>
'required'
,
'cn_ratio'
=>
'min:1'
,
'us_ratio'
=>
'min:1'
,
];
...
...
@@ -99,7 +99,7 @@ class SupplierValidator
'region.required'
=>
'所在区域不能为空'
,
'purchase_uid.required'
=>
'渠道开发员不能为空'
,
'cn_ratio.min'
=>
'人民币系数必须是大于1的浮点数'
,
'
upload_file.
business_license.required'
=>
'营业执照不能为空'
,
'business_license.required'
=>
'营业执照不能为空'
,
'us_ratio.min'
=>
'美金系数必须是大于1的浮点数'
,
'us_delivery_time.regex'
=>
'香港货期格式不正确'
,
'cn_delivery_time.regex'
=>
'大陆货期格式不正确'
,
...
...
config/field.php
View file @
77caa55a
...
...
@@ -57,5 +57,19 @@ return [
'SupplierAccountType'
=>
[
0
=>
'其它'
,
1
=>
'云芯商家'
]
],
'AttachmentFields'
=>
[
'business_license'
,
'billing_information'
,
'registration_certificate'
,
'incorporation_certificate'
,
'certification_notice'
,
'supplier_survey'
,
'proxy_certificate'
,
'quality_assurance_agreement'
,
'confidentiality_agreement'
,
'cooperation_agreement'
,
'other_attachment'
,
],
];
\ No newline at end of file
resources/views/script/SupplierListScript.blade.php
View file @
77caa55a
...
...
@@ -249,9 +249,13 @@
layer
.
msg
(
'你没有复审供应商的权限'
,
{
icon
:
5
})
return
}
if
(
status
===
0
)
{
layer
.
msg
(
'该供应商还没有申请审核'
,
{
icon
:
5
});
return
;
}
if
(
status
!==
1
&&
status
!==
-
1
)
{
layer
.
msg
(
'该供应商已经被审核'
,
{
icon
:
5
})
return
layer
.
msg
(
'该供应商已经被审核'
,
{
icon
:
5
})
;
return
;
}
// if (status === -1) {
// layer.msg('要审核中的供应商才可以审核', {icon: 5});
...
...
resources/views/script/supplier/SupplierFileScript.blade.php
View file @
77caa55a
{{
Autograph
()}}
<
script
>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'upload'
],
function
()
{
let
table
=
layui
.
table
;
let
form
=
layui
.
form
;
let
admin
=
layui
.
admin
;
let
element
=
layui
.
element
;
let
upload
=
layui
.
upload
;
let
layer
=
layui
.
layer
;
let
form
=
layui
.
form
;
let
fileName
=
''
;
var
loadIndex
=
0
;
let
fileType
=
''
;
//监听附件上传选择,有值才显示上传按钮
form
.
on
(
'select(file_type_selector)'
,
function
(
data
)
{
fileType
=
data
.
value
;
if
(
data
.
value
)
{
$
(
'#disable_upload_button'
)
.
hide
();
$
(
'#upload_button'
)
.
show
();
}
else
{
$
(
'#disable_upload_button'
)
.
show
();
$
(
'#upload_button'
)
.
hide
();
}
});
upload
.
render
({
elem
:
'
.uploadB
utton'
elem
:
'
#upload_b
utton'
,
url
:
'{{config('
website
.
UploadUrl
')}}'
//改成您自己的上传接口
,
accept
:
'file'
//文件
,
field
:
'upload'
...
...
@@ -24,6 +35,7 @@
,
exts
:
'jpg|png|bmp|jpeg|zip|pdf'
,
size
:
20000
,
before
:
function
()
{
}
,
choose
:
function
(
obj
)
{
var
files
=
this
.
files
=
obj
.
pushFile
();
...
...
@@ -33,15 +45,46 @@
}
,
done
:
function
(
res
,
index
,
upload
)
{
if
(
res
.
code
===
200
)
{
this
.
item
.
parent
()
.
find
(
'.upload_obj'
)
.
val
(
res
.
data
[
0
]
+
'|_|'
+
fileName
);
this
.
item
.
parent
()
.
find
(
'.uploadButton'
)
.
text
(
fileName
);
//动态添加js
let
fileTemplateObj
=
$
(
'#file_template'
)
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'href'
,
res
.
data
[
0
]);
fileTemplateObj
.
find
(
'a'
)
.
text
(
fileName
);
let
fileTemplate
=
fileTemplateObj
.
html
();
$
(
'#'
+
fileType
+
'_div'
)
.
show
();
$
(
'#'
+
fileType
+
'_file_div'
)
.
append
(
fileTemplate
);
setFileTypeValue
(
fileType
);
}
else
{
layer
.
msg
(
'上传接口异常,请重试或者联系管理员 . '
+
res
.
message
);
}
// console.log(this.files[index]);
delete
this
.
files
[
index
];
layer
.
close
(
loadIndex
);
}
});
//删除文件操作
$
(
document
)
.
on
(
'click'
,
'.delete_file'
,
function
()
{
let
fileType
=
$
(
this
)
.
parent
()
.
parent
()
.
parent
()
.
find
(
'input'
)
.
attr
(
'id'
);
//找出对应的div删除
$
(
this
)
.
parent
()
.
remove
();
setFileTypeValue
(
fileType
)
});
//遍历找出文件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
)
.
text
();
let
fileValueMap
=
{
file_name
:
fileName
,
url
:
url
,
name
:
fileType
}
fileValueArr
.
push
(
fileValueMap
)
})
fileTypeObj
.
val
(
JSON
.
stringify
(
fileValueArr
));
}
});
</
script
>
\ No newline at end of file
resources/views/web/SupplierDetail.blade.php
View file @
77caa55a
...
...
@@ -58,14 +58,16 @@
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn layui-btn-disabled"
>
待复审,不能修改
</button>
@elseif($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT)
@elseif($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT
||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING)
<a
id=
"updateSupplierUrl"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
修改
</a>
@endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_DISABLE)
@if (checkPerm('CancelDisableSupplier'))
<button
id=
"cancel_disable_supplier"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
取消禁用
</button>
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
取消禁用
</button>
@endif
@endif
...
...
@@ -146,15 +148,15 @@
</div>
</div>
<div
class=
"layui-row"
style=
"width: 700px"
>
@foreach($supplier['qualification_photos'] as $name=>$file)
@if(!empty($file['url']))
<div
class=
"layui-col-md6"
>
{{array_get(config('fixed.FileNameMapping'),$name)}} :
<a
style=
"color: dodgerblue"
href=
"{{$file['url']}}"
target=
"_blank"
>
{{$file['file_name']}}
</a>
</div>
@endif
@endforeach
{{-- @foreach($supplier['qualification_photos'] as $name=>$file)--}}
{{-- @if(!empty($file['url']))--}}
{{--
<div
class=
"layui-col-md6"
>
--}}
{{-- {{array_get(config('fixed.FileNameMapping'),$name)}} :
<a--
}}
{{
--
style=
"color: dodgerblue"
href=
"{{$file['url']}}"
target=
"_blank"
>
--}}
{{-- {{$file['file_name']}}
</a>
--}}
{{--
</div>
--}}
{{-- @endif--}}
{{-- @endforeach--}}
</div>
<hr/>
<blockquote
class=
"layui-elem-quote layui-text"
>
...
...
resources/views/web/supplier/SupplierFile.blade.php
View file @
77caa55a
<div
class=
"layui-form-item"
>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
营业执照 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['business_license']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[business_license]"
value=
"{{$supplier['qualification_photos']['business_license']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
开票资料 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['billing_information']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[billing_information]"
value=
"{{$supplier['qualification_photos']['billing_information']['value'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
商业登记证 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['registration_certificate']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[registration_certificate]"
value=
"{{$supplier['qualification_photos']['registration_certificate']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
公司注册证 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['incorporation_certificate']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[incorporation_certificate]"
value=
"{{$supplier['qualification_photos']['incorporation_certificate']['value'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
认证通知书 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['certification_notice']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[certification_notice]"
value=
"{{$supplier['qualification_photos']['certification_notice']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
供应商调查表 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['supplier_survey']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[supplier_survey]"
value=
"{{$supplier['qualification_photos']['supplier_survey']['value'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
代理证 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['proxy_certificate']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[proxy_certificate]"
value=
"{{$supplier['qualification_photos']['proxy_certificate']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
品质保证协议 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['quality_assurance_agreement']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[quality_assurance_agreement]"
value=
"{{$supplier['qualification_photos']['quality_assurance_agreement']['value'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
保密协议 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['confidentiality_agreement']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[confidentiality_agreement]"
value=
"{{$supplier['qualification_photos']['confidentiality_agreement']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
合作协议 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['cooperation_agreement']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[cooperation_agreement]"
value=
"{{$supplier['qualification_photos']['cooperation_agreement']['value'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 5px"
>
<div
class=
"layui-col-sm5"
>
<label
class=
"layui-form-label"
>
其它附件 :
</label>
<div
class=
"layui-upload"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm uploadButton"
>
{{$supplier['qualification_photos']['other_attachment']['file_name'] or '选择文件上传'}}
</button>
<input
type=
"hidden"
class=
"upload_obj"
name=
"upload_file[other_attachment]"
value=
"{{$supplier['qualification_photos']['other_attachment']['value'] or ''}}"
>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md2"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
附件上传
</label>
<div
class=
"layui-input-block block-12"
style=
"width: 155px"
id=
"file_type_selector"
>
<select
lay-verify=
""
lay-filter=
"file_type_selector"
>
<option
value=
""
>
请选择
</option>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
<option
value=
"{{$name}}"
>
{{$cnName}}
</option>
@endforeach
</select>
</div>
</div>
<div
class=
"layui-col-md10"
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm layui-btn-disabled"
id=
"disable_upload_button"
>
请选择附件类型再上传
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm"
id=
"upload_button"
style=
"display: none"
>
选择文件上传
</button>
<input
type=
"hidden"
class=
"upload_obj"
value=
""
>
</div>
<div
class=
"layui-col-md12"
style=
"padding-left: 35px;margin-top: 20px"
>
<blockquote
class=
"layui-elem-quote layui-quote-nm"
>
<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"
></div>
@foreach($attachment[$name] as $k=>$item)
<span
class=
"single_file_div"
>
<a
href=
"{{$item['url']}}"
target=
"_blank"
>
{{$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
<hr>
</div>
@else
<div
id=
"{{$name}}_div"
style=
"display: none"
>
<input
type=
"hidden"
name=
"{{$name}}"
id=
"{{$name}}"
>
<span>
{{$cnName}} :
</span>
<div
id=
"{{$name}}_file_div"
></div>
<hr>
</div>
@endif
@endforeach
</blockquote>
</div>
</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>
@include('script.supplier.SupplierFileScript')
\ No newline at end of file
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