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
2cf1da52
authored
Apr 27, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复
parent
40a2d47b
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
17 deletions
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Controllers/Api/SupplierReceiptApiController.php
app/Http/Services/LogService.php
app/Http/Services/SupplierContactService.php
app/Http/Services/SupplierExtraFeeService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/LogTransformer.php
app/Http/Transformers/SupplierTransformer.php
config/validate.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/web/UpdateSupplier.blade.php
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
2cf1da52
...
...
@@ -124,12 +124,18 @@ class SupplierContactApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'删除失败'
);
}
$supplierModel
=
new
SupplierChannelModel
();
$supplierStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
value
(
'status'
);
//不等于-1的时候是第一次新增供应商,单独操作联系人,不需要修改状态
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
//修改为审核状态
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
}
$logService
=
new
LogService
();
$content
=
'删除联系人'
;
$remark
=
json_encode
([
'old_contact'
=>
$contact
,
'new_contact'
=>
[]]);
...
...
app/Http/Controllers/Api/SupplierReceiptApiController.php
View file @
2cf1da52
...
...
@@ -67,12 +67,17 @@ class SupplierReceiptApiController extends Controller
$result
=
$model
->
insert
(
$receipt
);
}
if
(
$result
)
{
$supplierModel
=
new
SupplierChannelModel
();
$supplierStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'status'
);
//不等于-1的时候是第一次新增供应商,单独银行信息,不需要修改状态
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
//供应商变成待审核
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
}
$logService
=
new
LogService
();
$content
=
!
empty
(
$receipt
[
'receipt_id'
])
?
'修改银行信息'
:
'添加银行信息'
;
$remark
=
json_encode
(
$receipt
);
...
...
app/Http/Services/LogService.php
View file @
2cf1da52
...
...
@@ -58,7 +58,7 @@ class LogService
$newSupplier
=
$transformer
->
transformInfo
(
$newSupplier
);
$oldSupplier
=
$transformer
->
transformInfo
(
$oldSupplier
);
}
unset
(
$newSupplier
[
'update_time'
],
$oldSupplier
[
'update_time'
]);
//二维数组转成一维数组,因为array_diff只支持一维,反正二维的内容还要更细致的比较
$newSupplier
=
array_map
(
function
(
$value
)
{
if
(
is_array
(
$value
))
{
...
...
@@ -120,7 +120,6 @@ class LogService
$result
[]
=
$content
;
}
if
(
$key
==
'extra_fee'
)
{
if
(
!
empty
(
$oldSupplier
[
'extra_fee'
]))
{
$oldFee
=
json_decode
(
$oldSupplier
[
'extra_fee'
],
true
);
$newFee
=
json_decode
(
$newSupplier
[
'extra_fee'
],
true
);
$content
=
"采购附加费由 [商品总价不满"
.
$oldFee
[
'cn'
][
'max'
]
.
"元,收取"
.
$oldFee
[
'cn'
][
'price'
]
.
"元;商品总价不满"
.
...
...
@@ -130,17 +129,11 @@ class LogService
$result
[]
=
$content
;
}
}
}
$result
=
array_unique
(
$result
);
}
return
$result
;
}
public
function
compareContactChange
(
$oldContact
,
$newContact
)
{
}
//获取修改联系人的变化内容
public
function
getContactDesc
(
$contact
)
...
...
app/Http/Services/SupplierContactService.php
View file @
2cf1da52
...
...
@@ -76,12 +76,15 @@ class SupplierContactService
//修改供应商为审核状态
$supplierModel
=
new
SupplierChannelModel
();
$supplierStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
value
(
'status'
);
//不等于-1的时候是第一次新增供应商,单独操作联系人,不需要修改状态
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
}
//待审核(没有完善过联系人的,不需要记录日志,让其继续保持一条日志,就叫新增供应商)
if
(
$supplierStatus
!=
-
1
)
{
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
$logService
=
new
LogService
();
$content
=
!
empty
(
$contact
[
'contact_id'
])
?
'修改联系人'
:
'添加联系人'
;
$remark
=
json_encode
([
...
...
app/Http/Services/SupplierExtraFeeService.php
View file @
2cf1da52
...
...
@@ -10,6 +10,10 @@ class SupplierExtraFeeService
public
function
saveSupplierExtraFee
(
$extraFee
)
{
$supplierExtendFee
=
[];
if
(
empty
(
$extraFee
[
'cn'
][
'max'
])
&&
empty
(
$extraFee
[
'cn'
][
'price'
])
&&
empty
(
$extraFee
[
'hk'
][
'max'
])
&&
empty
(
$extraFee
[
'hk'
][
'price'
]))
{
return
true
;
}
if
(
!
empty
(
$extraFee
[
'cn'
]))
{
$supplierExtendFee
[
'cn'
]
=
$extraFee
[
'cn'
];
}
...
...
@@ -19,7 +23,6 @@ class SupplierExtraFeeService
if
(
empty
(
$supplierExtendFee
))
{
return
true
;
}
$model
=
new
SupplierExtendModel
();
$cache
=
$model
->
getExtendExtra
(
$extraFee
[
'supplier_code'
],
$extraFee
[
'supplier_id'
]);
$extraFee
[
'charge_content'
]
=
json_encode
(
$supplierExtendFee
);
...
...
app/Http/Services/SupplierService.php
View file @
2cf1da52
...
...
@@ -144,11 +144,16 @@ class SupplierService
$newSupplier
=
$supplierTransformer
->
transformInfo
(
$newSupplier
);
$logType
=
!
empty
(
$channel
[
'supplier_id'
])
?
LogModel
::
UPDATE_OPERATE
:
LogModel
::
ADD_OPERATE
;
$logAction
=
!
empty
(
$channel
[
'supplier_id'
])
?
"修改供应商基本资料"
:
"新增供应商"
;
$logContent
=
!
empty
(
$channel
[
'supplier_id'
])
?
'修改供应商'
:
'新增供应商'
;
$logContent
=
!
empty
(
$channel
[
'supplier_id'
])
?
'修改供应商'
:
'新增供应商
基础信息
'
;
//判断是不是申请入驻
if
(
!
empty
(
$oldSupplier
[
'status'
])
&&
$oldSupplier
[
'status'
]
==
=
-
2
)
{
if
(
!
empty
(
$oldSupplier
[
'status'
])
&&
$oldSupplier
[
'status'
]
==
-
2
)
{
$logAction
=
"申请重新入驻"
;
}
if
(
!
empty
(
$oldSupplier
[
'status'
])
&&
$oldSupplier
[
'status'
]
==
-
1
)
{
$logType
=
2
;
$logAction
=
'新增供应商'
;
$logContent
=
'确认新增供应商'
;
}
$logService
->
AddLog
(
$this
->
newSupplierId
,
$logType
,
$logAction
,
$logContent
,
json_encode
([
'old_supplier'
=>
$oldSupplier
,
'new_supplier'
=>
$newSupplier
...
...
app/Http/Transformers/LogTransformer.php
View file @
2cf1da52
...
...
@@ -36,6 +36,7 @@ class LogTransformer
if
(
!
is_array
(
$item
[
'content'
])
&&
strpos
(
$item
[
'content'
],
'联系'
)
!==
false
)
{
$item
[
'content'
]
=
$item
[
'content'
]
.
':'
.
$logService
->
getContactDesc
(
$item
[
'remark'
]);
}
$item
[
'content'
]
=
$item
[
'content'
]
?:
'没有内容变化'
;
}
return
$item
;
}
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
2cf1da52
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Transformers;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierSkuAuditRulerService
;
use
App\Http\Services\SupplierSkuUploadRulerService
;
use
App\Http\Services\ViewCheckService
;
...
...
@@ -13,6 +14,7 @@ use App\Model\LogModel;
use
App\Model\RedisModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierExtendModel
;
use
function
Sodium
\add
;
class
SupplierTransformer
{
...
...
@@ -113,12 +115,15 @@ class SupplierTransformer
$ExtendModel
=
new
SupplierExtendModel
();
//获取该supplier_code对应的数据
$supplier
[
'extra_fee'
]
=
$ExtendModel
->
getExtendExtra
(
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_id'
]);
//获取供应商地址信息
$supplier
=
$this
->
getSupplierAddress
(
$supplier
);
//获取最近修改信息
$logModel
=
new
LogModel
();
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$supplier
[
'last_update_time'
]
=
!
empty
(
$supplier
[
'last_update_time'
])
?
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
])
:
'无'
;
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$supplier
[
'last_update_time'
]
=
!
empty
(
$supplier
[
'last_update_time'
])
?
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
])
:
'无'
;
return
$supplier
;
}
...
...
@@ -135,6 +140,17 @@ class SupplierTransformer
return
$supplier
;
}
private
function
getSupplierAddress
(
$supplier
)
{
$supplierService
=
new
SupplierService
();
$address
=
$supplierService
->
getAddress
(
$supplier
[
'supplier_id'
]);
$supplier
[
'shipping_address'
]
=
array_get
(
$address
,
'shipping_address'
,
''
);
$supplier
[
'return_address'
]
=
array_get
(
$address
,
'return_address'
,
''
);
$supplier
[
'return_consignee'
]
=
array_get
(
$address
,
'return_consignee'
,
''
);
$supplier
[
'return_phone'
]
=
array_get
(
$address
,
'return_phone'
,
''
);
return
$supplier
;
}
private
function
getPhotosDataForForm
(
$photos
)
{
if
(
empty
(
$photos
))
{
...
...
config/validate.php
View file @
2cf1da52
...
...
@@ -40,5 +40,9 @@ return [
'purchase_username'
=>
'渠道开发员'
,
'us_delivery_time_full'
=>
'香港交期'
,
'cn_delivery_time_full'
=>
'国内交期'
,
'shipping_address'
=>
'发货地址'
,
'return_address'
=>
'退货地址'
,
'return_phone'
=>
'退货收货人电话 '
,
'return_consignee'
=>
'退货收货人'
,
]
];
\ No newline at end of file
resources/views/script/UpdateSupplierScript.blade.php
View file @
2cf1da52
...
...
@@ -18,13 +18,15 @@
let
confirmMessage
=
''
;
if
(
data
.
field
.
status
===
'-2'
)
{
confirmMessage
=
'确定要重新入驻吗,该供应商就会再次进入审核阶段'
}
else
if
(
data
.
field
.
status
===
'-1'
)
{
confirmMessage
=
'确定要提交新增供应商信息吗?一旦提交,该供应商就会进入审核中阶段,审核过程中无法进行信息修改'
}
else
{
confirmMessage
=
'确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核
阶段
'
confirmMessage
=
'确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核
中阶段,审核过程中无法进行信息修改
'
}
layer
.
confirm
(
confirmMessage
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier/UpdateSupplier'
,
data
.
field
)
if
(
res
.
err_code
===
0
)
{
admin
.
putTempData
(
"needFreshList"
,
1
)
admin
.
putTempData
(
"needFreshList"
,
1
)
table
.
reload
(
'receiptList'
)
location
.
href
=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
2cf1da52
...
...
@@ -65,9 +65,15 @@
<div
class=
"layui-col-md3"
></div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 25px;margin-top: 5px"
>
@if($supplier['status']==-1)
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
提交
lay-filter=
"updateSupplier"
>
确认新建供应商
</button>
@else
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
确认修改供应商
</button>
@endif
<a
id=
"supplierDetailUrl"
href=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
class=
"layui-btn layui-btn-primary"
>
取消
</a>
...
...
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