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
076d0c01
authored
Jul 23, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
标签系统对接
parent
7ffee9ed
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
30 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierService.php
app/Http/Services/SupplierTagService.php
config/validate.php
public/plugins/assets/js/common.js
resources/views/script/SupplierDetailScript.blade.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
076d0c01
...
...
@@ -191,6 +191,11 @@ class SupplierFilter
$query
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_DISABLE
)
->
where
(
'purchase_uid'
,
''
);
break
;
case
"no_channel_uid"
:
//没有渠道开发
$query
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_DISABLE
)
->
where
(
'channel_uid'
,
''
);
break
;
case
"invalid_channel_uid"
:
//不合理的渠道开发(比如渠道开发离职了)
$adminUserService
=
new
AdminUserService
();
...
...
app/Http/Controllers/SupplierController.php
View file @
076d0c01
...
...
@@ -160,8 +160,6 @@ class SupplierController extends Controller
if
(
empty
(
$supplier
))
{
return
'供应商不存在'
;
}
$tagService
=
new
SupplierTagService
();
$supplier
[
'system_tags'
]
=
implode
(
','
,
$tagService
->
getSystemTagsBySupplierId
(
$supplierId
));
//省市id,给控件用
$this
->
data
[
'province_city'
]
=
[
$supplier
[
'province_id'
],
$supplier
[
'city_id'
]];
$this
->
data
[
'supplier'
]
=
$supplier
;
...
...
app/Http/Services/SupplierService.php
View file @
076d0c01
...
...
@@ -141,16 +141,17 @@ class SupplierService
$this
->
saveSkuUploadRulerToRedis
(
$supplierId
,
$channel
[
'sku_upload_ruler'
]);
//判断是否要移出待跟进
$this
->
updateIsFollowUp
(
$supplierId
);
//保存标签到标签系统
$oldCustomerTags
=
array_get
(
$oldSupplier
,
'customer_tags'
);
$oldSystemTags
=
array_get
(
$oldSupplier
,
'system_tags'
);
$tagService
=
new
SupplierTagService
();
$tagService
->
saveTags
(
$supplierId
,
14
,
$channel
[
'system_tags'
],
$oldSystemTags
);
$tagService
->
saveTags
(
$supplierId
,
4
,
$channel
[
'customer_tags'
],
$oldCustomerTags
);
}
//保存生成的内部编码
$this
->
saveSupplierCode
(
$supplierId
);
//重新生成外部显示的编码
$this
->
generateSupplierSn
(
$supplierId
,
$channel
[
'supplier_group'
]);
$oldSystemTags
=
array_get
(
$oldSupplier
,
'system_tags'
);
$oldCustomerTags
=
array_get
(
$oldSupplier
,
'customer_tags'
);
//保存标签到标签系统
$tagService
=
new
SupplierTagService
();
$tagService
->
saveSystemTag
(
$supplierId
,
$channel
[
'system_tags'
],
$oldSystemTags
);
return
true
;
});
...
...
@@ -205,6 +206,14 @@ class SupplierService
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'
];
...
...
@@ -214,6 +223,7 @@ class SupplierService
unset
(
$channel
[
'upload_file'
]);
$channel
[
'established_time'
]
=
strtotime
(
$channel
[
'established_time'
]);
//省市选择的处理
if
(
!
empty
(
$channel
[
'province_city'
]))
{
$regionData
=
explode
(
','
,
$channel
[
'province_city'
]);
...
...
app/Http/Services/SupplierTagService.php
View file @
076d0c01
...
...
@@ -7,6 +7,7 @@ namespace App\Http\Services;
use
GuzzleHttp\Client
;
use
GuzzleHttp\RequestOptions
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
class
SupplierTagService
{
...
...
@@ -46,27 +47,27 @@ class SupplierTagService
}
//新增/修改标签和供应商id对应关系到标签系统
public
function
save
SystemTag
(
$supplierId
,
$newSystemTags
,
$oldSystem
Tags
)
public
function
save
Tags
(
$supplierId
,
$tagUse
,
$newTags
,
$old
Tags
)
{
$new
SystemTags
=
explode
(
','
,
$newSystem
Tags
);
$old
SystemTags
=
explode
(
','
,
$oldSystem
Tags
);
$new
Tags
=
explode
(
','
,
$new
Tags
);
$old
Tags
=
explode
(
','
,
$old
Tags
);
//先区分哪些需要删除,哪些需要修改
$allSystemTags
=
array_merge
(
$new
SystemTags
,
$oldSystem
Tags
);
$allSystemTags
=
array_merge
(
$new
Tags
,
$old
Tags
);
$deleteTags
=
[];
$keepTags
=
[];
foreach
(
$allSystemTags
as
$tag
)
{
//在新标签,不在老标签,就是新增,否则就是删除
if
(
in_array
(
$tag
,
$new
SystemTags
)
&&
!
in_array
(
$tag
,
$oldSystem
Tags
))
{
if
(
in_array
(
$tag
,
$new
Tags
)
&&
!
in_array
(
$tag
,
$old
Tags
))
{
$keepTags
[]
=
$tag
;
}
if
(
!
in_array
(
$tag
,
$new
SystemTags
)
&&
in_array
(
$tag
,
$oldSystem
Tags
))
{
if
(
!
in_array
(
$tag
,
$new
Tags
)
&&
in_array
(
$tag
,
$old
Tags
))
{
$deleteTags
[]
=
$tag
;
}
}
$params
=
[];
foreach
(
$deleteTags
as
$tag
)
{
$params
[
$tag
]
=
[
'tag_use'
=>
14
,
'tag_use'
=>
$tagUse
,
'business'
=>
5
,
'modifier'
=>
1000
,
'modifier_name'
=>
'admin'
,
...
...
@@ -81,7 +82,7 @@ class SupplierTagService
foreach
(
$keepTags
as
$tag
)
{
$params
[
$tag
]
=
[
'tag_use'
=>
14
,
'tag_use'
=>
$tagUse
,
'business'
=>
5
,
'modifier'
=>
1000
,
'modifier_name'
=>
'admin'
,
...
...
@@ -97,7 +98,10 @@ class SupplierTagService
RequestOptions
::
JSON
=>
$params
,
]);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
dd
(
$data
);
dd
(
json_encode
(
$params
));
if
(
!
empty
(
$data
[
'status'
])
&&
$data
[
'status'
]
==
1
)
{
return
true
;
}
else
{
Log
::
error
(
'保存标签失败,'
.
json_encode
(
$data
));
}
}
}
\ No newline at end of file
config/validate.php
View file @
076d0c01
...
...
@@ -44,5 +44,7 @@ return [
'return_address'
=>
'退货地址'
,
'return_phone'
=>
'退货收货人电话 '
,
'return_consignee'
=>
'退货收货人'
,
'system_tags'
=>
'系统标签'
,
'customer_tags'
=>
'自定义标签'
,
]
];
\ No newline at end of file
public/plugins/assets/js/common.js
View file @
076d0c01
...
...
@@ -18,6 +18,7 @@ layui.config({ // common.js是配置layui扩展模块的目录,每个页面
zTree
:
'zTree/zTree'
,
xmSelect
:
'xmSelect'
,
selectN
:
'selectExt/layui_extends/selectN'
,
// selectN: 'selectExt/layui_extends/selectN',
}).
use
([
'layer'
,
'admin'
],
function
()
{
var
$
=
layui
.
jquery
;
var
layer
=
layui
.
layer
;
...
...
resources/views/script/SupplierDetailScript.blade.php
View file @
076d0c01
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'upload'
,
'index'
],
function
()
{
let
table
=
layui
.
table
;
let
layer
=
layui
.
layer
;
let
form
=
layui
.
form
;
let
index
=
layui
.
index
;
let
admin
=
layui
.
admin
;
let
element
=
layui
.
element
;
let
upload
=
layui
.
upload
;
let
supplierId
=
getQueryVariable
(
'supplier_id'
)
$
(
'#updateSupplierUrl'
).
click
(
function
()
{
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
076d0c01
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'laydate'
,
'xmSelect'
,
'selectN'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'laydate'
,
'xmSelect'
,
'selectN'
,
'tagsInput'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
selectN
=
layui
.
selectN
;
...
...
@@ -13,9 +13,11 @@
,
format
:
'yyyy-MM'
});
const
supplierId
=
getQueryVariable
(
'supplier_id'
);
$
(
"#supplier_name"
).
blur
(
function
()
{
const
supplier_name
=
$
(
this
).
val
();
const
supplier_id
=
getQueryVariable
(
"supplier_id"
)
;
const
supplier_id
=
supplierId
;
$
(
'#supplier_check_tip'
).
remove
();
let
url
=
'/api/supplier/CheckSupplierName?supplier_name='
+
supplier_name
+
'&supplier_id='
+
supplier_id
;
let
res
=
ajax
(
url
);
...
...
@@ -130,10 +132,15 @@
};
}
let
systemTagOption
=
getTagOption
(
'system_tags_selector'
,
2
);
let
tagSelector
=
xmSelect
.
render
(
systemTagOption
);
let
tagIds
=
$
(
'#system_tags'
).
attr
(
'value'
);
tagSelector
.
setValue
(
tagIds
.
split
(
','
));
if
(
supplierId
)
{
let
systemTagOption
=
getTagOption
(
'system_tags_selector'
,
2
);
let
tagSelector
=
xmSelect
.
render
(
systemTagOption
);
let
tagIds
=
$
(
'#system_tags'
).
attr
(
'value'
);
tagSelector
.
setValue
(
tagIds
.
split
(
','
));
//自定义标签
$
(
'#customer_tags'
).
tagsInput
({});
}
let
regionData
=
{
!!
json_encode
(
$region_data
)
!!
};
let
provinceCity
=
{
!!
!
empty
(
$province_city
)?
json_encode
(
$province_city
):
'[]'
!!
};
...
...
resources/views/web/SupplierDetail.blade.php
View file @
076d0c01
...
...
@@ -178,6 +178,32 @@
</div>
<hr/>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
供应商标签
</b>
</blockquote>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md12"
>
系统标签 :
@foreach (explode(',',$supplier['system_tags']) as $tag)
@if (empty($tag))
暂无
@continue
@endif
<span
class=
"layui-btn layui-btn-xs"
>
{{$tag}}
</span>
@endforeach
</div>
<div
class=
"layui-col-md12"
>
自定义标签 :
@foreach (explode(',',$supplier['customer_tags']) as $tag)
@if (empty($tag))
暂无
@continue
@endif
<span
class=
"layui-btn layui-btn-xs"
>
{{$tag}}
</span>
@endforeach
</div>
</div>
<hr/>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
财务信息
</b>
</blockquote>
@include('web.supplier.SupplierReceipt')
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
076d0c01
...
...
@@ -161,7 +161,7 @@
</blockquote>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
系统标签
</label>
系统标签
:
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<div
id=
"system_tags_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
...
...
@@ -169,6 +169,13 @@
id=
"system_tags"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
自定义标签 :
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<input
name=
"customer_tags"
id=
"customer_tags"
value=
"{{$supplier['customer_tags'] or ''}}"
>
</div>
</div>
@endif
@if($operate=='add')
...
...
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