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
834f3e46
authored
Jun 04, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-呆料库存管理-供应商侧-20260602'
parents
f4987535
586bb9e5
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
462 additions
and
1612 deletions
.gitignore
app/Http/Controllers/Api/SkuApiController.php
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SkuController.php
app/Http/Controllers/SupplierController.php
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Services/SkuService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/SupplierTransformer.php
config/field.php
resources/views/script/BatchAllocateReversePurchaserScript.blade.php
resources/views/script/BatchUpdateGoodsLabelScript.blade.php
resources/views/script/SkuListScript.blade.php
resources/views/script/SupplierListScript.blade.php
resources/views/web/BatchAllocateReversePurchaser.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/SupplierList.blade.php
resources/views/web/sku/SkuListFilter.blade.php
resources/views/web/supplier/SupplierBase.blade.php
resources/views/web/supplier/SupplierListFilter.blade.php
storage/framework/views/587faa134dc1f8953abf61cb2995b8264ba36a12.php
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
.gitignore
View file @
834f3e46
...
...
@@ -14,4 +14,5 @@ storage/framework/views
CLAUDE.md
/.windsurf
/skills-lock.json
getSignComs
/.codewhale
/.codebuddy
\ No newline at end of file
app/Http/Controllers/Api/SkuApiController.php
View file @
834f3e46
...
...
@@ -333,6 +333,9 @@ class SkuApiController extends Controller
if
(
empty
(
$goodsLabel
))
{
$this
->
response
(
-
1
,
'请选择显示类型'
);
}
if
((
string
)
$goodsLabel
===
(
string
)
SkuService
::
GOODS_LABEL_DEAD_STOCK
)
{
$this
->
response
(
-
1
,
'呆料库存不可以设置显示类型'
);
}
(
new
SkuService
())
->
batchUpdateGoodsLabel
(
$type
,
$supplierCode
,
$skuIds
,
$goodsLabel
);
$text
=
$type
==
1
?
'设置显示类型成功'
:
'批量设置供应SKU商显示类型任务已开始,请等待任务完成'
;
...
...
app/Http/Controllers/Api/SupplierApiController.php
View file @
834f3e46
...
...
@@ -108,6 +108,7 @@ class SupplierApiController extends Controller
'sku_optional_batch'
,
'nation_id'
,
'supplier_source'
,
'reverse_purchaser'
,
];
public
function
Entrance
(
Request
$request
,
$id
)
...
...
@@ -481,6 +482,26 @@ class SupplierApiController extends Controller
$this
->
response
(
0
,
'批量分配数据维护员成功'
);
}
//批量分配逆向采购员
public
function
BatchAllocateReversePurchaser
(
$request
)
{
$reversePurchaser
=
trim
(
$request
->
get
(
'reverse_purchaser'
));
$supplierIds
=
$request
->
get
(
'supplier_ids'
);
$supplierIds
=
explode
(
','
,
$supplierIds
);
if
(
empty
(
$reversePurchaser
))
{
$this
->
response
(
-
1
,
'请选择逆向采购员'
);
}
$hasCrmSupplier
=
SupplierChannelModel
::
whereIn
(
'supplier_id'
,
$supplierIds
)
->
where
(
'supplier_source'
,
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
->
exists
();
if
(
$hasCrmSupplier
)
{
$this
->
response
(
-
1
,
'CRM来源的供应商不允许分配逆向采购员'
);
}
$supplierService
=
new
SupplierService
();
$supplierService
->
batchAllocateReversePurchaser
(
$supplierIds
,
$reversePurchaser
);
$this
->
response
(
0
,
'批量分配逆向采购员成功'
);
}
//分配采购员(支持批量操作)
public
function
BatchAllocateChannelUser
(
$request
)
{
...
...
app/Http/Controllers/SkuController.php
View file @
834f3e46
...
...
@@ -7,6 +7,7 @@ use GuzzleHttp\Client;
use
App\Model\LogModel
;
use
App\Model\TagsModel
;
use
App\Model\BrandModel
;
use
App\Model\RedisModel
;
use
Illuminate\Http\Request
;
use
App\Model\IntracodeModel
;
use
App\Model\SupplierLogModel
;
...
...
@@ -67,6 +68,10 @@ class SkuController extends Controller
$intraCodeModel
=
new
IntracodeModel
();
$this
->
data
[
'userCodes'
]
=
$intraCodeModel
->
getSampleEncode
();
$this
->
data
[
'createUserDepartmentList'
]
=
(
new
DepartmentService
())
->
getCreateUserDepartmentListForXmSelect
();
$redis
=
new
RedisModel
();
$hashKey
=
'col_settings:sku_list'
;
$colSettings
=
$redis
->
hget
(
$hashKey
,
$request
->
user
->
userId
);
$this
->
data
[
'colSettings'
]
=
$colSettings
?
$colSettings
:
'{}'
;
return
$this
->
view
(
'供应商日志'
);
}
...
...
app/Http/Controllers/SupplierController.php
View file @
834f3e46
...
...
@@ -228,7 +228,8 @@ class SupplierController extends Controller
{
$intraCodeModel
=
new
IntracodeModel
();
$userCodes
=
$intraCodeModel
->
getSampleEncode
();
$this
->
data
[
'userCodes'
]
=
$intraCodeModel
->
getChannelUsersEncode
();
$channelUserCodes
=
$intraCodeModel
->
getChannelUsersEncode
();
$this
->
data
[
'userCodes'
]
=
$channelUserCodes
;
$this
->
data
[
'user'
]
=
$userCodes
;
$this
->
data
[
'purchase_users'
]
=
[];
$this
->
data
[
'operate'
]
=
'update'
;
...
...
@@ -349,6 +350,24 @@ class SupplierController extends Controller
return
$this
->
view
(
'批量分配数据维护员'
);
}
//批量分配逆向采购员
public
function
BatchAllocateReversePurchaser
(
$request
)
{
$supplierIds
=
$request
->
get
(
'supplier_ids'
);
$this
->
data
[
'supplierIds'
]
=
$supplierIds
;
$supplierIds
=
explode
(
','
,
$supplierIds
);
$model
=
new
SupplierChannelModel
();
$suppliers
=
$model
->
whereIn
(
'supplier_id'
,
$supplierIds
)
->
get
()
->
toArray
();
$transformer
=
new
SupplierTransformer
();
$suppliers
=
$transformer
->
transformList
(
$suppliers
);
$this
->
data
[
'suppliers'
]
=
$suppliers
;
$intraCodeModel
=
new
IntracodeModel
();
$this
->
data
[
'reversePurchaserOptions'
]
=
$this
->
buildReversePurchaseUserOptions
(
$intraCodeModel
->
getChannelUsersEncode
(
false
)
);
return
$this
->
view
(
'批量分配逆向采购员'
);
}
//批量添加采购员
public
function
AllocateChannelUser
(
$request
)
{
...
...
@@ -474,6 +493,23 @@ class SupplierController extends Controller
return
$this
->
view
(
'转化供应商确认'
);
}
private
function
buildReversePurchaseUserOptions
(
$userCodes
,
$currentValue
=
''
)
{
$options
=
[];
foreach
(
$userCodes
as
$label
)
{
$plainName
=
preg_replace
(
'/\(\d+\).*$/'
,
''
,
$label
);
$plainName
=
trim
(
$plainName
);
if
(
$plainName
===
''
)
{
continue
;
}
$options
[
$plainName
]
=
$label
;
}
if
(
$currentValue
!==
''
&&
!
isset
(
$options
[
$currentValue
]))
{
$options
[
$currentValue
]
=
$currentValue
;
}
return
$options
;
}
//导出供应商详情表格
public
function
PrintSupplier
(
$request
)
{
...
...
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
834f3e46
...
...
@@ -273,6 +273,7 @@ class SupplierSyncController extends BaseSyncController
'supplier_type'
=>
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
,
// 正式供应商
'is_business_abnormal'
=>
-
1
,
// 默认无异常
'has_legal_ID_card'
=>
-
1
,
// 默认无法人身份证
'sku_upload_ruler'
=>
json_encode
(
SupplierService
::
normalizeCrmSkuUploadRuler
(
config
(
'fixed.SkuUploadDefaultRuler'
))),
'apply_uid'
=>
$applyUid
,
// 状态设为待确认
'status'
=>
SupplierChannelModel
::
STATUS_CONFIRM
,
...
...
@@ -307,6 +308,7 @@ class SupplierSyncController extends BaseSyncController
'supplier_code'
=>
$supplierCode
,
'supplier_sn'
=>
'FOO'
.
ltrim
(
$supplierCode
,
'L'
),
]);
(
new
SupplierService
())
->
saveSkuUploadRulerToRedis
(
$supplierId
,
$channel
[
'sku_upload_ruler'
]);
// 提交审批到审核中心(在事务中,失败则回滚)
$auditService
=
new
SupplierAuditService
();
...
...
app/Http/Services/SkuService.php
View file @
834f3e46
...
...
@@ -8,6 +8,7 @@ use App\Model\LogModel;
use
App\Model\TagsModel
;
use
App\Model\RedisModel
;
use
App\Model\IntracodeModel
;
use
App\Model\SupplierExtendModel
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\ManualPutawaySkuLog
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -20,6 +21,7 @@ use PhpAmqpLib\Connection\AMQPStreamConnection;
class
SkuService
extends
BaseService
{
const
GOODS_LABEL_DEAD_STOCK
=
7
;
const
OPERATE_TYPE_PUTAWAY
=
1
;
const
OPERATE_TYPE_OFF_SHELVES
=
-
1
;
...
...
@@ -190,14 +192,19 @@ class SkuService extends BaseService
$canalList
=
array_filter
(
array_unique
(
array_column
(
$list
,
'canal'
)));
if
(
!
empty
(
$canalList
))
{
$suppliers
=
SupplierChannelModel
::
whereIn
(
'supplier_code'
,
$canalList
)
->
pluck
(
'purchase_uid'
,
'supplier_code'
)
->
get
([
'supplier_code'
,
'purchase_uid'
,
'supplier_id'
])
->
keyBy
(
'supplier_code'
)
->
toArray
();
$reversePurchaserMap
=
SupplierExtendModel
::
getReversePurchaserBySupplierIds
(
array_column
(
$suppliers
,
'supplier_id'
));
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleEncode
(
true
);
foreach
(
$list
as
&
$item
)
{
$canal
=
array_get
(
$item
,
'canal'
);
$purchaseUid
=
array_get
(
$suppliers
,
$canal
,
''
);
$supplier
=
array_get
(
$suppliers
,
$canal
,
[]);
$purchaseUid
=
array_get
(
$supplier
,
'purchase_uid'
,
''
);
$supplierId
=
array_get
(
$supplier
,
'supplier_id'
,
0
);
$item
[
'purchase_username'
]
=
array_get
(
$users
,
$purchaseUid
,
''
);
$item
[
'reverse_purchaser'
]
=
array_get
(
$reversePurchaserMap
,
$supplierId
,
''
);
}
unset
(
$item
);
}
...
...
app/Http/Services/SupplierService.php
View file @
834f3e46
...
...
@@ -14,6 +14,7 @@ use App\Model\SupplierAddressModel;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierExtendModel
;
use
App\Model\SupplierReceiptModel
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Redis
;
...
...
@@ -68,6 +69,9 @@ class SupplierService
$supplierTransformer
=
new
SupplierTransformer
();
//先处理下数据
$channel
=
$supplierTransformer
->
transformPostData
(
$channel
);
$hasReversePurchaserField
=
array_key_exists
(
'reverse_purchaser'
,
$channel
);
$reversePurchaser
=
$hasReversePurchaserField
?
array_get
(
$channel
,
'reverse_purchaser'
,
''
)
:
null
;
unset
(
$channel
[
'reverse_purchaser'
]);
$logService
=
new
LogService
();
$model
=
new
SupplierChannelModel
();
...
...
@@ -84,7 +88,7 @@ class SupplierService
$isDirectApply
=
request
()
->
get
(
'direct_apply'
);
//走事务
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
,
&
$needAudit
,
$isDirectApply
,
&
$address
)
{
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$
hasReversePurchaserField
,
$reversePurchaser
,
$
model
,
$oldSupplier
,
&
$needAudit
,
$isDirectApply
,
&
$address
)
{
//是否直接申请审核,如果是直接申请审核,那就变成待审核
// $isDirectApply 已经从外部传入
...
...
@@ -204,6 +208,9 @@ class SupplierService
//插入sku上传规则
$this
->
saveSkuUploadRulerToRedis
(
$supplierId
,
$channel
[
'sku_upload_ruler'
]);
if
(
$hasReversePurchaserField
)
{
$this
->
saveReversePurchaser
(
$supplierId
,
$reversePurchaser
);
}
//添加联系人
//要有数据才新增,麻烦得要死
...
...
@@ -282,10 +289,17 @@ class SupplierService
$channel
[
'system_tags'
]
=
trim
(
implode
(
','
,
$channel
[
'system_tags'
]),
','
);
if
(
array_get
(
$oldSupplier
,
'supplier_source'
)
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
{
$channel
[
'sku_upload_ruler'
]
=
json_encode
(
self
::
normalizeCrmSkuUploadRuler
(
$channel
[
'sku_upload_ruler'
]));
}
// 防御:禁止编辑时覆盖 supplier_source,防止被意外改为0
unset
(
$channel
[
'supplier_source'
]);
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
if
(
$hasReversePurchaserField
)
{
$this
->
saveReversePurchaser
(
$supplierId
,
$reversePurchaser
);
}
$supplierAddressService
=
new
SupplierAddressService
();
//保存地址
...
...
@@ -628,6 +642,58 @@ class SupplierService
return
true
;
}
public
function
allocateReversePurchaser
(
$supplierId
,
$reversePurchaser
)
{
return
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$reversePurchaser
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
empty
(
$supplier
))
{
return
false
;
}
$supplier
=
$supplier
->
toArray
();
if
(
$supplier
[
'supplier_source'
]
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
{
throw
new
\Exception
(
'CRM来源的供应商不允许分配逆向采购员'
);
}
$extend
=
SupplierExtendModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$previousReversePurchaser
=
$extend
?
$extend
[
'reverse_purchaser'
]
:
''
;
$time
=
time
();
if
(
$extend
)
{
SupplierExtendModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'reverse_purchaser'
=>
$reversePurchaser
,
'update_time'
=>
$time
,
]);
}
else
{
SupplierExtendModel
::
insert
([
'supplier_id'
=>
$supplierId
,
'reverse_purchaser'
=>
$reversePurchaser
,
'create_time'
=>
$time
,
'update_time'
=>
$time
,
]);
}
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
$time
,
]);
$logService
=
new
LogService
();
$content
=
"将逆向采购员由 [
{
$previousReversePurchaser
}
] 改为 [
{
$reversePurchaser
}
]"
;
$logService
->
AddIgnoreAuditCheckLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'分配逆向采购员'
,
$content
);
return
true
;
});
}
public
function
batchAllocateReversePurchaser
(
$supplierIds
,
$reversePurchaser
)
{
foreach
(
$supplierIds
as
$supplierId
)
{
if
(
empty
(
$supplierId
))
{
continue
;
}
$this
->
allocateReversePurchaser
(
$supplierId
,
$reversePurchaser
);
}
return
true
;
}
//批量分配线上采购员
public
function
batchAllocateYunxinChannelUser
(
$supplierIds
,
$yunxinChannelUid
)
{
...
...
@@ -958,6 +1024,57 @@ class SupplierService
return
'{"allow_stock_lte_0":0,"allow_moq_lte_0":0,"allow_stock_lt_moq":0,"allow_price_null":0,"futures_allow_stock_lte_0":0,"futures_allow_moq_lte_0":0,"futures_allow_price_null":0}'
;
}
public
static
function
normalizeCrmSkuUploadRuler
(
$ruler
)
{
if
(
empty
(
$ruler
))
{
$ruler
=
config
(
'fixed.SkuUploadDefaultRuler'
);
}
elseif
(
is_string
(
$ruler
))
{
$ruler
=
json_decode
(
$ruler
,
true
);
}
if
(
!
is_array
(
$ruler
))
{
$ruler
=
config
(
'fixed.SkuUploadDefaultRuler'
);
}
foreach
(
self
::
getCrmSkuUploadRulerKeys
()
as
$key
)
{
$ruler
[
$key
]
=
1
;
}
return
$ruler
;
}
public
static
function
getCrmSkuUploadRulerKeys
()
{
return
[
'allow_stock_lte_0'
,
'allow_moq_lte_0'
,
'allow_price_null'
,
'futures_allow_stock_lte_0'
,
'futures_allow_moq_lte_0'
,
'futures_allow_price_null'
,
];
}
private
function
saveReversePurchaser
(
$supplierId
,
$reversePurchaser
)
{
$extend
=
SupplierExtendModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
$extend
)
{
SupplierExtendModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'reverse_purchaser'
=>
$reversePurchaser
,
'update_time'
=>
time
(),
]);
return
;
}
if
(
$reversePurchaser
===
''
||
$reversePurchaser
===
null
)
{
return
;
}
SupplierExtendModel
::
insert
([
'supplier_id'
=>
$supplierId
,
'reverse_purchaser'
=>
$reversePurchaser
,
'create_time'
=>
time
(),
'update_time'
=>
time
(),
]);
}
//修改供应商名称
public
function
changeSupplierName
(
$supplierId
,
$supplierName
)
{
...
...
@@ -1426,4 +1543,4 @@ class SupplierService
return
$result
;
}
}
\ No newline at end of file
}
app/Http/Transformers/SupplierTransformer.php
View file @
834f3e46
...
...
@@ -315,6 +315,9 @@ class SupplierTransformer
$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'
]);
if
(
$supplier
[
'supplier_source'
]
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
{
$supplier
[
'sku_upload_ruler'
]
=
SupplierService
::
normalizeCrmSkuUploadRuler
(
$supplier
[
'sku_upload_ruler'
]);
}
$ruleService
=
new
SupplierSkuAuditRulerService
();
$supplier
[
'sku_audit_ruler'
]
=
$ruleService
->
getSkuAuditRuler
(
array_get
(
$supplier
,
'sku_audit_ruler'
));
$supplier
=
$this
->
transformDeliveryTimeData
(
$supplier
);
...
...
config/field.php
View file @
834f3e46
...
...
@@ -50,6 +50,7 @@ return [
4
=>
'询价现货'
,
5
=>
'原厂直售'
,
6
=>
'猎芯精选'
,
7
=>
'呆料库存'
,
-
1
=>
'代购现货'
],
...
...
@@ -60,6 +61,7 @@ return [
4
=>
'询价现货'
,
5
=>
'原厂直售'
,
6
=>
'猎芯精选'
,
7
=>
'呆料库存'
,
-
1
=>
'代购现货'
],
...
...
resources/views/script/BatchAllocateReversePurchaserScript.blade.php
0 → 100644
View file @
834f3e46
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'table'
,
'layer'
,
'admin'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
form
.
on
(
'submit(allocateReversePurchaser)'
,
function
(
data
)
{
admin
.
showLoading
({
type
:
3
});
let
supplierIds
=
getQueryVariable
(
'supplier_ids'
);
let
url
=
'/api/supplier/BatchAllocateReversePurchaser?supplier_ids='
+
supplierIds
;
$
.
ajax
({
url
:
url
,
type
:
'GET'
,
async
:
true
,
data
:
data
.
field
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
admin
.
removeLoading
();
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
},
error
:
function
()
{
admin
.
removeLoading
();
parent
.
layer
.
msg
(
'网络错误'
,
{
icon
:
5
});
}
});
return
false
;
});
form
.
on
(
'submit(cancel)'
,
function
()
{
admin
.
closeThisDialog
();
});
});
</script>
resources/views/script/BatchUpdateGoodsLabelScript.blade.php
View file @
834f3e46
...
...
@@ -6,8 +6,13 @@
let
element
=
layui
.
element
;
let
xmSelect
=
layui
.
xmSelect
;
let
tagsInput
=
layui
.
tagsInput
;
let
deadStockGoodsLabel
=
'{{ \App\Http\Services\SkuService::GOODS_LABEL_DEAD_STOCK }}'
;
form
.
on
(
'submit(updateGoodsLabel)'
,
function
(
data
)
{
if
(
data
.
field
.
goods_label
===
deadStockGoodsLabel
)
{
layer
.
msg
(
'呆料库存不可以设置显示类型'
,
{
icon
:
5
});
return
false
;
}
if
(
data
.
field
.
type
==
1
&&
data
.
field
.
sku_tags
===
''
)
{
}
admin
.
showLoading
({
...
...
resources/views/script/SkuListScript.blade.php
View file @
834f3e46
...
...
@@ -12,6 +12,10 @@
let
initCondition
=
{
source_type
:
'all'
};
let
whereCondition
=
initCondition
;
let
type
=
'all'
;
let
colSettingsData
=
{
!!
$colSettings
!!
};
let
colSettingsUserId
=
'{{request()->user->userId}}'
;
let
colSettingsPageKey
=
'sku_list'
;
let
deadStockGoodsLabel
=
'{{ \App\Http\Services\SkuService::GOODS_LABEL_DEAD_STOCK }}'
;
//点击罗盘筛选
$
(
'.main_filter'
).
click
(
function
()
{
...
...
@@ -90,6 +94,7 @@
},
{
field
:
'encoded_user_name'
,
title
:
'线上采购员'
,
align
:
'center'
,
width
:
100
},
{
field
:
'purchase_username'
,
title
:
'数据维护员'
,
align
:
'center'
,
width
:
100
},
{
field
:
'reverse_purchaser'
,
title
:
'逆向采购员'
,
align
:
'center'
,
width
:
120
},
{
field
:
'spu_name'
,
title
:
'spu型号'
,
align
:
'center'
,
width
:
200
},
{
field
:
'goods_name'
,
title
:
'商品型号'
,
align
:
'center'
,
width
:
200
,
templet
:
function
(
data
)
{
...
...
@@ -187,6 +192,14 @@
{
field
:
'cp_time'
,
title
:
'上架有效期'
,
align
:
'center'
,
width
:
180
},
{
field
:
'is_expire_name'
,
title
:
'是否过期'
,
align
:
'center'
,
width
:
90
},
];
if
(
colSettingsData
&&
Object
.
keys
(
colSettingsData
).
length
>
0
)
{
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
colSettingsData
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
colSettingsData
[
field
];
}
}
}
let
currentPage
=
0
;
table
.
render
({
elem
:
'#skuList'
...
...
@@ -207,6 +220,84 @@
}
});
$
(
"#col_setting"
).
click
(
function
()
{
let
html
=
'
<
div
style
=
"padding: 15px;"
>
';
html += '
<
div
style
=
"margin-bottom: 10px;"
>
';
html += '
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-info"
id
=
"col_select_all"
>
全选
<
/button>'
;
html
+=
'
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-danger"
id
=
"col_invert_select"
>
反选
<
/button>'
;
html
+=
'
<
/div>'
;
html
+=
'
<
div
style
=
"max-height: 600px; overflow-y: auto;"
>
';
html += '
<
form
class
=
"layui-form"
lay
-
filter
=
"colSettingForm"
>
'
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
if
(
cols
[
i
].
type
===
'checkbox'
)
continue
;
let
field
=
cols
[
i
].
field
;
let
title
=
cols
[
i
].
title
||
''
;
let
checked
=
cols
[
i
].
hide
?
''
:
'checked'
;
html
+=
'
<
div
class
=
"layui-form-item"
style
=
"display:inline-block;width:33%;margin-bottom:5px;"
>
';
html += '
<
input
type
=
"checkbox"
name
=
"' + field + '"
lay
-
skin
=
"primary"
title
=
"' + title + '"
' + checked + '
>
';
html += '
<
/div>'
;
}
html
+=
'
<
/form></
div
><
/div>'
;
layer
.
open
({
type
:
1
,
title
:
'显示列设置'
,
area
:
[
'600px'
,
'600px'
],
content
:
html
,
btn
:
[
'确定'
,
'取消'
],
success
:
function
(
layero
,
index
)
{
form
.
render
(
'checkbox'
,
'colSettingForm'
);
layero
.
find
(
'#col_select_all'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
prop
(
'checked'
,
true
);
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
layero
.
find
(
'#col_invert_select'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
each
(
function
()
{
$
(
this
).
prop
(
'checked'
,
!
$
(
this
).
is
(
':checked'
));
});
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
},
yes
:
function
(
index
,
layero
)
{
let
settings
=
{};
let
checkboxes
=
layero
.
find
(
'input[type="checkbox"]'
);
checkboxes
.
each
(
function
()
{
let
name
=
$
(
this
).
attr
(
'name'
);
let
checked
=
$
(
this
).
is
(
':checked'
);
settings
[
name
]
=
checked
;
});
$
.
ajax
({
url
:
'/api/external/SaveColSettings'
,
type
:
'post'
,
data
:
{
user_id
:
colSettingsUserId
,
page_key
:
colSettingsPageKey
,
settings
:
JSON
.
stringify
(
settings
)
},
dataType
:
'json'
,
async
:
false
});
colSettingsData
=
settings
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
settings
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
settings
[
field
];
}
}
table
.
reload
(
'skuList'
,
{
cols
:
[
cols
],
page
:
{
curr
:
currentPage
},
where
:
whereCondition
});
layer
.
close
(
index
);
}
});
});
//渲染多选
let
brandSelect
=
xmSelect
.
render
({
el
:
'#brandSelect'
,
...
...
@@ -540,6 +631,17 @@
$
(
"#update_goods_label"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'skuList'
);
let
data
=
checkStatus
.
data
;
if
(
data
.
length
===
0
)
{
layer
.
msg
(
'请选择要操作的sku'
,
{
icon
:
5
});
return
false
;
}
let
hasDeadStockGoodsLabel
=
data
.
some
(
function
(
item
)
{
return
String
(
item
.
goods_label
)
===
String
(
deadStockGoodsLabel
);
});
if
(
hasDeadStockGoodsLabel
)
{
parent
.
layer
.
msg
(
'不可修改为“呆料库存”'
,
{
icon
:
5
});
return
false
;
}
let
skuIds
=
Array
.
from
(
data
,
({
goods_id
})
=>
goods_id
);
skuIds
=
skuIds
.
join
(
','
);
layer
.
open
({
...
...
resources/views/script/SupplierListScript.blade.php
View file @
834f3e46
...
...
@@ -788,6 +788,34 @@
}
})
$
(
"#batch_allocate_reverse_purchaser"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
supplierIds
=
supplierIds
.
join
(
','
);
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
let
hasCrmSupplier
=
data
.
some
(
function
(
item
)
{
return
Number
(
item
.
supplier_source
)
===
2
;
});
if
(
hasCrmSupplier
)
{
layer
.
msg
(
'CRM来源的供应商不允许分配逆向采购员'
,
{
icon
:
5
})
return
;
}
layer
.
open
({
type
:
2
,
content
:
'/supplier/BatchAllocateReversePurchaser?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'700px'
,
'70%'
],
title
:
'批量分配逆向采购员'
,
end
:
function
()
{
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
})
//禁用供应商
$
(
"#disable_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
...
...
resources/views/web/BatchAllocateReversePurchaser.blade.php
0 → 100644
View file @
834f3e46
<style>
.layui-form-item
{
margin-bottom
:
5px
;
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
style=
"height: 170px"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
逆向采购员设置
</b>
</blockquote>
<form
class=
"layui-form"
action=
""
>
<input
type=
"hidden"
name=
"supplier_ids"
value=
"{{$supplierIds}}"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"margin-left: -30px"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('reverse_purchaser','逆向采购员',null,
$reversePurchaserOptions,['required'=>true,'width'=>'260px']) !!}
</div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 10px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"allocateReversePurchaser"
>
确认
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
</form>
</div>
<div
class=
"layui-card-body"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
当前选中需要批量修改逆向采购员的供应商列表
</b>
</blockquote>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"280"
>
<col
width=
"120"
>
<col
width=
"140"
>
<col>
</colgroup>
<thead>
<tr>
<th>
供应商名称
</th>
<th>
供应商来源
</th>
<th>
当前逆向采购员
</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
<tr>
<td>
{{$supplier['supplier_name']}}
</td>
<td>
{{$supplier['supplier_source_name']}}
</td>
<td>
{{$supplier['reverse_purchaser'] ?: '未设置'}}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
resources/views/web/SupplierDetail.blade.php
View file @
834f3e46
...
...
@@ -152,6 +152,11 @@
供应商英文名称 :{{$supplier['supplier_name_en']}}
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md3"
>
逆向采购员 :{{$supplier['reverse_purchaser'] ?: '未设置'}}
</div>
</div>
<div
class=
"layui-row"
>
<span
class=
"required_field"
>
*
</span>
注册资金
:{{$supplier['registered_capital']?$supplier['registered_capital']."(万)":'未设置'}}
</div>
...
...
resources/views/web/SupplierList.blade.php
View file @
834f3e46
...
...
@@ -17,6 +17,9 @@
{{-- <button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_allocate_purchase_user
">批量分配数据维护员</button>--}}
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_allocate_purchase_user
">分配数据维护员</button>
@endif
@if(checkPerm('BatchAllocateReversePurchaser'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_allocate_reverse_purchaser
">分配逆向采购员</button>
@endif
@if(checkPerm('AllocateChannelUser'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
allocate_channel_user
">分配采购员</button>
@endif
...
...
@@ -82,7 +85,6 @@
@if(checkPerm('ConfirmCrmSupplier'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
confirm_crm_supplier
">确认客户转化供应商</button>
@endif
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
layui
-
btn
-
normal
" id="
col_setting
">展示列设置</button>
</div>
<button type="
button
" id="
refreshWindow
" style="
display
:
none
">刷新页面</button>
<table class="
layui
-
table
" id="
list
" lay-filter="
list
"></table>
...
...
resources/views/web/sku/SkuListFilter.blade.php
View file @
834f3e46
...
...
@@ -183,6 +183,7 @@
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn"
lay-submit=
""
lay-filter=
"reset"
>
重置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn hide_filter_type"
>
隐藏罗盘
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-normal"
id=
"col_setting"
>
展示列设置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn show_filter_type"
style=
"display: none"
>
显示罗盘
</button>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
834f3e46
...
...
@@ -119,13 +119,6 @@
{!! $statusPresenter->render('purchase_uid','数据维护员 : ',$supplier['purchase_uid'],$userCodes,['width'=>'150px']) !!}
</div>
<div
class=
"layui-col-md3"
>
<label
class=
"layui-form-label"
>
逆向采购员 :
</label>
<div
class=
"layui-input-block"
style=
"width: 150px"
>
<input
type=
"text"
class=
"layui-input layui-disabled"
disabled
value=
"{{$supplier['reverse_purchaser'] or ''}}"
>
</div>
</div>
<div
class=
"layui-col-md3"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
注册资金(万):
</label>
<div
class=
"layui-input-block"
style=
"width: 150px"
>
<input
type=
"text"
name=
"registered_capital"
id=
"registered_capital"
...
...
resources/views/web/supplier/SupplierListFilter.blade.php
View file @
834f3e46
...
...
@@ -294,15 +294,18 @@
</div>
<div
class=
"layui-row"
style=
"margin-top:10px;margin-bottom: 10px;margin-left: 20px;"
>
<button
class=
"layui-btn layui-btn-sm layui-btn load"
id=
"getSupplierListButton"
lay-submit=
""
lay-filter=
"load"
>
查询
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn"
lay-submit=
""
lay-filter=
"reset"
>
重置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn hide_filter_type"
>
隐藏罗盘
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn show_filter_type"
style=
"display: none"
>
显示罗盘
</button>
</div>
</form>
<div
class=
"layui-row"
style=
"margin-top:10px;margin-bottom: 10px;margin-left: 20px;"
>
<button
class=
"layui-btn layui-btn-sm layui-btn load"
id=
"getSupplierListButton"
lay-submit=
""
lay-filter=
"load"
>
查询
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn"
lay-submit=
""
lay-filter=
"reset"
>
重置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn hide_filter_type"
>
隐藏罗盘
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-normal"
id=
"col_setting"
>
展示列设置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn show_filter_type"
style=
"display: none"
>
显示罗盘
</button>
</div>
</form>
@endif
</div>
storage/framework/views/587faa134dc1f8953abf61cb2995b8264ba36a12.php
deleted
100644 → 0
View file @
f4987535
<style>
.main_filter
{
cursor
:
pointer
;
}
</style>
<div
class=
"layui-fluid"
id=
"type_filter"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
style=
"padding: 0;"
>
<div
class=
"split-group"
style=
"height: 170px;"
>
<div
class=
"split-item"
id=
"s1"
style=
"text-align: center"
>
<div
class=
"layui-row"
>
<a
class=
"main_filter layui-badge layui-bg-green"
id=
"total"
>
全部
</a>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"待复审"
id=
"need_review"
>
待复审
</a>
</div>
--}}
</div>
</div>
<div
class=
"split-item"
id=
"s6"
style=
"text-align: center"
>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"战略供应商"
id=
"level_a"
>
战略供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"账期供应商"
id=
"pay_type_term"
>
账期供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"缺少平台合作协议(线上)"
id=
"no_cooperation_agreement"
>
缺少平台合作协议(线上)
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"缺少品质协议(线上)"
id=
"no_quality_assurance_agreement_all"
>
缺少品质协议(线上)
</a>
</div>
<?php
if
(
checkPerm
(
'SupplierBlockList'
))
:
?>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
id=
"block"
data-value=
"-3"
>
黑名单
</a>
</div>
<?php
endif
;
?>
</div>
<div
class=
"split-item"
id=
"s7"
style=
"text-align: center"
>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"历史平台合作供应商"
id=
"uploaded_sku"
>
历史平台合作供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"非芯链供应商"
id=
"not_yunxin"
>
非芯链供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已上架(非芯链)供应商"
id=
"not_yunxin_and_has_sku"
>
已上架(非芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已下架(非芯链)供应商"
id=
"not_yunxin_and_has_no_sku"
>
已下架(非芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"芯链供应商"
id=
"yunxin"
>
芯链供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已上架(芯链)供应商"
id=
"yunxin_and_has_sku"
>
已上架(芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已下架(芯链)供应商"
id=
"yunxin_and_has_no_sku"
>
已下架(芯链)供应商
</a>
</div>
</div>
<div
class=
"split-item"
id=
"s8"
style=
"text-align: center"
>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"3天内到期(芯链)供应商"
id=
"yunxin_expired_at_days"
>
3天内到期(芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"3天内到期(非芯链)供应商"
id=
"not_yunxin_expired_at_days"
>
3天内到期(非芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已过期(芯链)供应商"
id=
"yunxin_expired"
>
已过期(芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"已过期(非芯链)供应商"
id=
"not_yunxin_expired"
>
已过期(非芯链)供应商
</a>
</div>
<div
class=
"layui-row"
>
<a
class=
"main_filter"
title=
"商品已过期供应商"
id=
"sku_expired"
>
商品已过期供应商
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-collapse"
>
<?php
if
(
checkPerm
(
'ViewFilter'
))
:
?>
<!--通用的筛选-->
<form
class=
"layui-form"
style=
"margin-top: 15px"
>
<?php
$routerName
=
explode
(
'/'
,
request
()
->
path
())[
1
];
?>
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'supplier_group'
=>
'供应商性质'
],
[
'supplier_group'
=>
config
(
'fixed.SupplierGroup'
)]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableInputPresenter
=
app
(
'App\Presenters\Filter\TransformableInputPresenter'
);
?>
<?php
echo
$transformableInputPresenter
->
render
([
'supplier_name'
=>
'供应商名称'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableInputPresenter
=
app
(
'App\Presenters\Filter\TransformableInputPresenter'
);
?>
<?php
echo
$transformableInputPresenter
->
render
([
'supplier_code'
=>
'供应商编码'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiSelectorPresenter
=
app
(
'App\Presenters\MultiSelectorPresenter'
);
?>
<?php
echo
$multiSelectorPresenter
->
render
(
'status'
,
'供应商状态'
,
''
,
$statusData
);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiSelectorPresenter
=
app
(
'App\Presenters\MultiSelectorPresenter'
);
?>
<?php
echo
$multiSelectorPresenter
->
render
(
'stockup_type'
,
'合作类型'
,
''
,
$stockupTypeData
);
?>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'has_sku'
=>
'SKU上传'
],[
'has_sku'
=>
[
1
=>
'是'
,
-
1
=>
'否'
]]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'yunxin_channel_uid'
=>
'线上采购员'
],[
'yunxin_channel_uid'
=>
$userCodes
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'purchase_uid'
=>
'数据维护员'
],[
'purchase_uid'
=>
$userCodes
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'source'
=>
'SKU上传方式'
],[
'source'
=>
config
(
'field.SkuSource'
)]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'purchase_type'
,
'代购类型'
,
''
,
config
(
'field.PurchaseType'
));
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'purchase_type'
,
'代购类型'
,
''
,
config
(
'field.PurchaseType'
));
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'has_uploaded_sku'
=>
'历史SKU合作'
],[
'has_uploaded_sku'
=>
[
1
=>
'是'
,
-
1
=>
'否'
]]);
?>
</div>
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"show_filter_row2"
style=
"margin-left: 10px"
>
展开
</button>
</div>
</div>
<div
class=
"layui-row"
id=
"filter_row2"
style=
"display: none"
>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'company_nature'
=>
'公司实际性质'
],[
'company_nature'
=>
config
(
'field.CompanyNature'
)]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableInputPresenter
=
app
(
'App\Presenters\Filter\TransformableInputPresenter'
);
?>
<?php
echo
$transformableInputPresenter
->
render
([
'group_code'
=>
'集团编码'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableInputPresenter
=
app
(
'App\Presenters\Filter\TransformableInputPresenter'
);
?>
<?php
echo
$transformableInputPresenter
->
render
([
'supplier_id'
=>
'供应商ID'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableSelectPresenter
=
app
(
'App\Presenters\Filter\TransformableSelectPresenter'
);
?>
<?php
echo
$transformableSelectPresenter
->
render
([
'channel_uid'
=>
'采购员'
],
$userCodes
);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$transformableSelectPresenter
=
app
(
'App\Presenters\Filter\TransformableSelectPresenter'
);
?>
<?php
echo
$transformableSelectPresenter
->
render
([
'create_uid'
=>
'创建人'
],
$userCodes
);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'sku_tag'
=>
'SKU标准'
],[
'sku_tag'
=>
config
(
'field.SkuTag'
)]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'sku_mode'
=>
'SKU模式'
],[
'sku_mode'
=>
config
(
'field.SkuMode'
)]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiSelectorPresenter
=
app
(
'App\Presenters\MultiSelectorPresenter'
);
?>
<?php
echo
$multiSelectorPresenter
->
render
(
'supplier_type'
,
'供应商类型'
,
''
,
$supplierTypeData
);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiSelectorPresenter
=
app
(
'App\Presenters\MultiSelectorPresenter'
);
?>
<?php
echo
$multiSelectorPresenter
->
render
(
'level'
,
'等级'
,
''
,
$levelData
);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'has_cooperation_agreement'
=>
'平台合作协议'
],[
'has_cooperation_agreement'
=>
[
1
=>
'有'
,
-
1
=>
'无'
]]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'has_yunxin_agreement'
=>
'采购合作框架协议'
],[
'has_yunxin_agreement'
=>
[
1
=>
'有'
,
-
1
=>
'无'
]]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'has_supplier_account'
,
'启用芯链账号'
,
''
,[
1
=>
'是'
,
-
1
=>
'否'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'has_order_contract'
,
'芯链上传合同'
,
''
,[
1
=>
'是'
,
-
1
=>
'否'
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'is_entity'
,
'实体名单'
,
''
,
config
(
'field.IsEntity'
));
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'is_sku_expire'
,
'商品是否过期'
,
''
,[
1
=>
'是'
,
-
1
=>
'否'
]);
?>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
商品过期天数
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"sku_expired_in_days"
placeholder=
"请输入数字"
autocomplete=
"off"
class=
"layui-input"
value=
"
<?php
echo
e
(
request
()
->
get
(
'sku_expired_in_days'
));
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'sign_com_id'
,
'签约公司'
,
0
,
\App\Http\Services\CrmService
::
getSignCompanyListMap
());
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'supplier_source'
,
'供应商来源'
,
0
,
config
(
'fixed.SupplierSource'
));
?>
</div>
<div
class=
"layui-inline"
>
<?php
$multiSelectorPresenter
=
app
(
'App\Presenters\MultiSelectorPresenter'
);
?>
<?php
echo
$multiSelectorPresenter
->
render
(
'region'
,
'区域'
,
''
,
$regionData
);
?>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
创建部门
</label>
<div
class=
"layui-input-inline"
>
<div
id=
"create_user_department"
style=
"width: 150px"
></div>
</div>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 10px"
>
<?php
$multiTransformableSelectPresenter
=
app
(
'App\Presenters\Filter\MultiTransformableSelectPresenter'
);
?>
<?php
echo
$multiTransformableSelectPresenter
->
render
([
'data_channel_uid'
=>
'数据跟单员'
],[
'data_channel_uid'
=>
$userCodes
]);
?>
</div>
<div
class=
"layui-inline"
>
<?php
$statusPresenter
=
app
(
'App\Presenters\StatusPresenter'
);
?>
<?php
echo
$statusPresenter
->
render
(
'supplier_source'
,
'供应商来源'
,
0
,
config
(
'fixed.SupplierSource'
));
?>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
代理品牌
</label>
<div
class=
"layui-input-inline"
>
<div
id=
"agency_brands_filter"
style=
"width: 425px"
></div>
<input
type=
"hidden"
name=
"agency_brands"
id=
"agency_brands_filter_value"
value=
""
>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-inline"
style=
"width: 600px"
>
<?php
$transformableTimeIntervalPresenter
=
app
(
'App\Presenters\Filter\TransformableTimeIntervalPresenter'
);
?>
<?php
echo
$transformableTimeIntervalPresenter
->
render
([
'update_time'
=>
'更新时间'
,
'create_time'
=>
'创建时间'
,
'sku_create_time'
=>
'首次上传sku时间'
]);
?>
</div>
</div>
</div>
<div
class=
"layui-row"
style=
"margin-top:10px;margin-bottom: 10px;margin-left: 20px;"
>
<button
class=
"layui-btn layui-btn-sm layui-btn load"
id=
"getSupplierListButton"
lay-submit=
""
lay-filter=
"load"
>
查询
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn"
lay-submit=
""
lay-filter=
"reset"
>
重置
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn hide_filter_type"
>
隐藏罗盘
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn show_filter_type"
style=
"display: none"
>
显示罗盘
</button>
</div>
</form>
<?php
endif
;
?>
</div>
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
deleted
100644 → 0
View file @
f4987535
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'Split'
,
'admin'
,
'index'
,
'xmSelect'
],
function
()
{
let
$
=
layui
.
jquery
;
let
Split
=
layui
.
Split
;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
Split
([
'#s1'
,
'#s6'
,
'#s7'
,
'#s8'
],
{
sizes
:
[
9
,
12
,
12
,
12
],
minSize
:
70
});
// Split(['#s1', '#s2', '#s3', '#s4', '#s5', '#s6', '#s7','#s8'], {sizes: [9, 12, 12, 12, 12, 12, 12,19], minSize: 70});
let
table
=
layui
.
table
;
let
form
=
layui
.
form
;
let
index
=
layui
.
index
;
let
admin
=
layui
.
admin
;
let
xmSelect
=
layui
.
xmSelect
;
let
initCondition
=
{
source_type
:
'all'
};
let
whereCondition
=
initCondition
;
let
type
=
'all'
;
let
currentPage
=
1
;
//一进来就去获取统计数据
function
supplierStatistics
(
hasLoading
=
false
)
{
if
(
hasLoading
)
{
admin
.
showLoading
({
elem
:
'#type_filter'
,
type
:
3
,
});
}
$
.
ajax
({
url
:
'/api/supplier_statistics/GetSupplierStatistics'
,
type
:
'post'
,
async
:
true
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
if
(
res
.
err_code
===
0
)
{
$
.
each
(
res
.
data
,
function
(
index
,
value
)
{
let
menuObj
=
$
(
'#'
+
index
);
menuObj
.
text
(
''
);
menuObj
.
append
(
value
);
});
if
(
getQueryVariable
(
'source_type'
))
{
$
(
'#'
+
getQueryVariable
(
'source_type'
)).
click
();
}
}
if
(
hasLoading
)
{
admin
.
removeLoading
(
'#type_filter'
);
}
}
})
}
supplierStatistics
(
true
);
//罗盘隐藏
$
(
'.hide_filter_type'
).
click
(
function
()
{
$
(
this
).
hide
();
$
(
'#type_filter'
).
hide
();
$
(
'.show_filter_type'
).
show
();
});
$
(
'.show_filter_type'
).
click
(
function
()
{
$
(
this
).
hide
();
$
(
'#type_filter'
).
show
();
$
(
'.hide_filter_type'
).
show
();
});
$
(
'#show_filter_row2'
).
click
(
function
()
{
let
isHidden
=
$
(
'#filter_row2'
).
is
(
':hidden'
);
if
(
isHidden
)
{
$
(
'#filter_row2'
).
show
();
$
(
'#show_filter_row2'
).
text
(
'隐藏'
);
}
else
{
$
(
'#filter_row2'
).
hide
();
$
(
'#show_filter_row2'
).
text
(
'展开'
);
}
});
$
(
function
()
{
$
(
'.layui-form .layui-col-md5 .layui-edge'
).
remove
();
});
//这个是页面点击刷新方法,隐藏起来是为了页面切换回这个列表的时候触发的
$
(
'#refreshWindow'
).
click
(
function
()
{
//判断当前是否有layui弹窗窗口,有的话不刷新
let
hasLayerIframe
=
$
(
'.layui-layer'
).
size
()
>
0
;
if
(
!
hasLayerIframe
)
{
$
(
'#getSupplierListButton'
).
click
();
}
});
//点击罗盘筛选
$
(
'.main_filter'
).
click
(
function
()
{
clearTypeFilter
();
$
(
this
).
attr
(
'class'
,
'main_filter layui-badge layui-bg-green'
);
type
=
$
(
this
).
attr
(
'id'
);
whereCondition
.
source_type
=
type
table
.
reload
(
'list'
,
{
page
:
{
curr
:
1
}
,
where
:
whereCondition
});
});
if
(
getQueryVariable
(
'source_type'
))
{
whereCondition
.
source_type
=
getQueryVariable
(
'source_type'
);
}
var
createUserDepartmentSelector
=
xmSelect
.
render
({
el
:
'#create_user_department'
,
autoRow
:
true
,
name
:
'create_user_department'
,
filterable
:
true
,
direction
:
'down'
,
tree
:
{
show
:
true
,
showFolderIcon
:
true
,
showLine
:
true
,
indent
:
20
,
expandedKeys
:
true
,
},
size
:
'mini'
,
toolbar
:
{
show
:
true
,
list
:
[
'ALL'
,
'CLEAR'
]
},
height
:
'auto'
,
data
:
function
()
{
//这个数据在对应的blade页面下面...
return
<?php
echo
json_encode
(
$createUserDepartmentList
);
?>
;
}
})
var
agencyBrandsSelector
=
xmSelect
.
render
({
el
:
'#agency_brands_filter'
,
filterable
:
true
,
paging
:
true
,
height
:
'250px'
,
size
:
'mini'
,
direction
:
'auto'
,
autoRow
:
true
,
prop
:
{
name
:
'brand_name'
,
value
:
'brand_id'
,
},
remoteSearch
:
true
,
pageRemote
:
true
,
template
({
item
,
sels
,
name
,
value
})
{
return
item
.
brand_name
+
'
<
span
style
=
"position: absolute; right: 10px; color: #8799a3"
>
' +
item.mapping_brand_names + '
<
/span>
'
},
filterMethod
:
function
(
val
,
item
,
index
,
prop
)
{},
pageSize
:
30
,
remoteMethod
:
function
(
val
,
cb
,
show
,
pageIndex
)
{
$
.
ajax
({
url
:
'/api/common/getStandardBrandList'
,
type
:
'post'
,
data
:
{
brand_name
:
val
,
page
:
pageIndex
},
dataType
:
'json'
,
timeout
:
10000
,
success
:
function
(
res
)
{
if
(
!
res
)
return
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
5
});
if
(
res
.
err_code
===
0
)
{
cb
(
res
.
data
,
res
.
last_page
);
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
},
error
:
function
()
{
return
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
5
});
}
});
},
on
:
function
(
data
)
{
let
arr
=
data
.
arr
;
let
brandIds
=
''
;
for
(
let
i
in
arr
)
{
brandIds
+=
arr
[
i
].
brand_id
+
','
;
}
$
(
'#agency_brands_filter_value'
).
val
(
brandIds
);
},
})
let
cols
=
[
{
type
:
'checkbox'
,
fixed
:
true
},
{
field
:
'supplier_code'
,
title
:
'供应商编码'
,
align
:
'center'
,
width
:
90
,
templet
:
function
(
data
)
{
return
"
<
a
ew
-
href
=
'/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"'
class
=
'list-href'
ew
-
title
=
'供应商详情 - " + data.supplier_code + "'
>
" + data.supplier_code + "
<
/a>
"
}
},
{
field
:
'group_code'
,
title
:
'集团编码'
,
align
:
'center'
,
width
:
90
},
{
field
:
'supplier_name'
,
title
:
'供应商名称'
,
align
:
'left'
,
width
:
180
,
templet
:
function
(
data
)
{
let
supplierName
=
data
.
supplier_name
;
if
(
data
.
has_attachment_expired
===
1
)
{
supplierName
+=
"
<
i
class
=
'layui-icon layui-icon-notice'
style
=
'color: #FF5722;'
title
=
'存在已过期附件'
><
/i>"
;
}
if
(
data
.
status
===
-
3
)
{
return
"
<
span
title
=
'" + data.block_reason + "'
>
" + supplierName + "
<
/span>
"
}
else
{
return
supplierName
;
}
}
},
{
field
:
'supplier_group'
,
title
:
'供应商性质'
,
align
:
'center'
,
width
:
115
},
{
field
:
'company_nature'
,
title
:
'公司实际性质'
,
align
:
'center'
,
width
:
125
},
{
field
:
'level'
,
title
:
'等级'
,
align
:
'center'
,
width
:
60
,
templet
:
function
(
d
)
{
return
d
.
level
?
d
.
level
:
'-'
;
}
},
{
field
:
'region_name'
,
title
:
'区域'
,
align
:
'center'
,
width
:
60
},
{
field
:
'stockup_type'
,
title
:
'合作类型'
,
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
"
<
span
title
=
'" + data.stockup_type + "'
>
" + data.stockup_type + "
<
/span>
"
}
},
{
field
:
'purchase_type_name'
,
title
:
'代购类型'
,
align
:
'center'
,
width
:
80
},
{
field
:
'has_quality_assurance_agreement'
,
title
:
'品质协议'
,
align
:
'center'
,
width
:
80
,
},
{
field
:
'has_cooperation_agreement'
,
title
:
'平台合作协议'
,
align
:
'center'
,
width
:
120
,
},
{
field
:
'has_yunxin_agreement'
,
title
:
'采购合作框架协议'
,
align
:
'center'
,
width
:
140
,
},
//启用芯链账号
{
field
:
'has_supplier_account'
,
title
:
'启用芯链账号'
,
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
data
.
yunxin_account
?
(
data
.
yunxin_account
.
a_status
==
1
?
'是'
:
'否'
)
:
'否'
;
}
},
//通过芯链上传合同
{
field
:
'has_order_contract'
,
title
:
'通过芯链上传合同'
,
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
data
.
has_order_contract
==
1
?
'是'
:
'否'
;
}
},
{
field
:
'channel_username'
,
title
:
'采购员'
,
align
:
'center'
,
width
:
130
,
templet
:
function
(
data
)
{
if
(
data
.
resign_channel_username
)
{
if
(
data
.
on_job_channel_username
)
{
return
`<span>
${
data
.
on_job_channel_username
}
</span>`
+
`,<span style="color: #D7D7D7">
${
data
.
resign_channel_username
}
</span>`
;
}
else
{
return
`<span style="color: #D7D7D7">
${
data
.
resign_channel_username
}
</span>`
}
}
else
{
return
`<span>
${
data
.
on_job_channel_username
}
</span>`
;
}
}
},
{
field
:
'is_entity'
,
title
:
'实体名单'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
let
color
=
''
;
switch
(
data
.
is_entity
)
{
case
1
:
color
=
'#FF0000'
;
break
;
case
0
:
color
=
'#FFA500'
;
break
;
case
-
2
:
color
=
'#ff0000'
;
break
;
default
:
color
=
''
;
}
return
'
<
span
style
=
"color: ' + color + ';"
title
=
"' + data.disable_reason + '"
>
' + data.is_entity_name + '
<
/span>'
;
}
},
{
field
:
'status_name'
,
title
:
'状态'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
let
statusHtml
=
''
;
let
color
=
''
;
let
title
=
''
;
switch
(
data
.
status
)
{
case
3
:
color
=
'red'
;
title
=
data
.
reject_reason
;
break
;
case
-
3
:
color
=
'red'
;
title
=
data
.
block_reason
;
break
;
case
-
2
:
color
=
'red'
;
title
=
data
.
disable_reason
;
break
;
}
statusHtml
=
'
<
span
class
=
"audit-status-hover"
data
-
status
=
"' + data.status + '"
data
-
supplier
-
id
=
"' + data.supplier_id + '"
style
=
"cursor: pointer; color: ' + color + ';"
title
=
"' + title + '"
>
' + data.status_name + '
<
/span>'
;
return
statusHtml
;
}
},
{
field
:
'supplier_source_name'
,
title
:
'供应商来源'
,
align
:
'center'
,
width
:
120
},
{
field
:
'reverse_purchaser'
,
title
:
'逆向采购员'
,
align
:
'center'
,
width
:
100
},
{
field
:
'last_update_name'
,
title
:
'最新修改人'
,
align
:
'center'
,
width
:
110
},
{
field
:
'sign_com_name'
,
title
:
'签约公司'
,
align
:
'center'
,
width
:
150
},
{
field
:
'contact_num'
,
title
:
'联系人'
,
align
:
'center'
,
width
:
70
,
templet
:
function
(
data
)
{
return
"
<
a
ew
-
href
=
'/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id +
"'
class
=
'list-href'
ew
-
title
=
'供应商详情 - " + data.supplier_code + "'
title
=
'点击跳转查看联系人列表'
>
" + data.contact_num + "
<
/a>
"
}
},
{
field
:
'purchase_username'
,
title
:
'数据维护员'
,
align
:
'center'
,
width
:
110
},
{
field
:
'yunxin_channel_username'
,
title
:
'线上采购员'
,
align
:
'center'
,
width
:
110
},
{
field
:
'inventory_channel_username'
,
title
:
'数据跟单员'
,
align
:
'center'
,
width
:
130
,
templet
:
function
(
data
)
{
if
(
data
.
inventory_resign_channel_username
)
{
if
(
data
.
inventory_on_job_channel_username
)
{
return
`<span>
${
data
.
inventory_on_job_channel_username
}
</span>`
+
`,<span style="color: #D7D7D7">
${
data
.
inventory_resign_channel_username
}
</span>`
;
}
else
{
return
`<span style="color: #D7D7D7">
${
data
.
inventory_resign_channel_username
}
</span>`
}
}
else
{
return
`<span>
${
data
.
inventory_on_job_channel_username
}
</span>`
;
}
}
},
{
field
:
'has_sku'
,
title
:
'SKU上传'
,
align
:
'center'
,
width
:
80
},
{
field
:
'uploaded_sku'
,
title
:
'SKU合作'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
return
data
.
uploaded_sku
>
0
?
'是'
:
'否'
;
}
},
{
field
:
'average_sku_num'
,
title
:
'日均上架数'
,
align
:
'center'
,
width
:
100
},
{
field
:
'is_sku_expire'
,
title
:
'商品是否过期'
,
align
:
'center'
,
width
:
130
,
templet
:
function
(
data
)
{
if
(
Number
(
data
.
sku_expired_in_days
)
===
1000
)
{
return
'无SKU'
;
}
return
data
.
sku_expired_in_days
>
0
?
'
<
span
style
=
"color: red;"
>
是
<
/span>' : '否'
;
}
},
{
field
:
'sku_expired_in_days'
,
title
:
'商品过期天数'
,
align
:
'center'
,
width
:
130
,
templet
:
function
(
data
)
{
if
(
Number
(
data
.
sku_expired_in_days
)
===
1000
)
{
return
'无SKU'
;
}
if
(
data
.
sku_expired_in_days
>
0
)
{
return
'
<
span
style
=
"color: red;"
>
' + data.sku_expired_in_days + '
<
/span>'
;
}
return
data
.
sku_expired_in_days
||
0
;
}
},
{
field
:
'cp_time_day'
,
title
:
'有效期最高天数'
,
align
:
'center'
,
width
:
180
,
templet
:
function
(
data
)
{
let
cpTime
=
data
.
cp_time_day
==
-
1
?
'无限制'
:
data
.
cp_time_day
+
'天'
;
let
futuresCpTime
=
data
.
futures_cp_time_day
==
-
1
?
'无限制'
:
data
.
futures_cp_time_day
+
'天'
;
return
'现货 : '
+
cpTime
+
' | 期货 : '
+
futuresCpTime
;
}
},
{
field
:
'create_name'
,
title
:
'创建人'
,
align
:
'center'
,
width
:
70
},
{
field
:
'create_user_department_name'
,
title
:
'创建部门'
,
align
:
'center'
,
width
:
100
},
{
field
:
'update_time'
,
title
:
'最近修改时间'
,
align
:
'center'
,
width
:
145
},
{
field
:
'supplier_type_name'
,
title
:
'供应商类别'
,
align
:
'center'
,
width
:
110
},
{
field
:
'create_time'
,
title
:
'创建时间'
,
align
:
'center'
,
width
:
145
},
{
field
:
'sku_create_time'
,
title
:
'首次上传sku时间'
,
align
:
'center'
,
width
:
145
},
{
field
:
'last_upload_sku_time'
,
title
:
'最新上传sku时间'
,
align
:
'center'
,
width
:
145
},
];
cols
.
push
(
);
// 列显示设置 - 从后端Redis hash渲染
let
colSettingsData
=
<?php
echo
$colSettings
;
?>
;
let
colSettingsUserId
=
'
<?php
echo
e
(
request
()
->
user
->
userId
);
?>
';
let colSettingsPageKey = '
supplier_list
'
;
function
applyColSettings
()
{
if
(
colSettingsData
&&
Object
.
keys
(
colSettingsData
).
length
>
0
)
{
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
colSettingsData
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
colSettingsData
[
field
];
}
}
}
}
applyColSettings
();
table
.
render
({
elem
:
'#list'
,
url
:
'/api/supplier/GetSupplierList'
,
method
:
'post'
,
size
:
'sm'
,
limit
:
20
,
cellMinWidth
:
50
//全局定义常规单元格的最小宽度
,
where
:
whereCondition
,
loading
:
true
,
first
:
true
//不显示首页
,
last
:
false
//不显示尾页
,
cols
:
[
cols
]
,
id
:
'list'
,
page
:
{}
,
done
:
function
(
res
,
curr
,
count
)
{
//得到当前页码
currentPage
=
curr
;
res
.
data
.
forEach
(
function
(
item
,
index
)
{
if
(
item
.
status
===
-
3
)
{
//禁用复选框,设置不可选中标识,将该行设置为阴影色
var
tr
=
$
(
".layui-table tr[data-index="
+
index
+
"]"
);
tr
.
find
(
"input[type='checkbox']"
).
prop
(
'disabled'
,
true
);
tr
.
find
(
"input[type='checkbox']"
).
next
().
addClass
(
'layui-btn-disabled'
);
tr
.
find
(
'.layui-form-checkbox'
).
addClass
(
'layui-hide'
);
tr
.
css
(
"color"
,
"#A9A5A5"
);
tr
.
addClass
(
'block-class'
)
}
});
// 绑定审核状态悬停事件
bindAuditStatusHover
();
}
});
// 点击行checkbox选中
$
(
document
).
on
(
"click"
,
".layui-table-body table.layui-table tbody tr"
,
function
()
{
let
index
=
$
(
this
).
attr
(
'data-index'
);
let
tableBox
=
$
(
this
).
parents
(
'.layui-table-box'
);
let
tableDiv
=
null
;
if
(
tableBox
.
find
(
".layui-table-fixed.layui-table-fixed-l"
).
length
>
0
)
{
tableDiv
=
tableBox
.
find
(
".layui-table-fixed.layui-table-fixed-l"
);
}
else
{
tableDiv
=
tableBox
.
find
(
".layui-table-body.layui-table-main"
);
}
let
checkCell
=
tableDiv
.
find
(
"tr[data-index="
+
index
+
"]"
).
find
(
"td div.laytable-cell-checkbox div.layui-form-checkbox I"
);
if
(
checkCell
.
length
>
0
)
{
checkCell
.
click
();
}
});
$
(
document
).
on
(
"click"
,
"td div.laytable-cell-checkbox div.layui-form-checkbox"
,
function
(
e
)
{
e
.
stopPropagation
();
});
//监听复选框事件,被选中的行高亮显示
table
.
on
(
'checkbox(list)'
,
function
(
obj
)
{
//拉黑就不用变色了
if
(
obj
.
data
.
status
===
-
3
)
{
return
}
if
(
obj
.
checked
===
true
&&
obj
.
type
===
'all'
)
{
//点击全选,拉黑的不用选上
$
(
'.layui-table-body table.layui-table tbody tr:not(.block-class)'
).
addClass
(
'layui-table-click'
);
$
(
'.layui-table-body table.layui-table tbody'
).
find
(
'.block-class'
).
find
(
'.layui-form-checkbox'
).
remove
();
$
(
'.layui-table-body table.layui-table tbody tr .block-class'
).
addClass
(
'layui-table-click'
);
}
else
if
(
obj
.
checked
===
false
&&
obj
.
type
===
'all'
)
{
//点击全不选
$
(
'.layui-table-body table.layui-table tbody tr'
).
removeClass
(
'layui-table-click'
);
}
else
if
(
obj
.
checked
===
true
&&
obj
.
type
===
'one'
)
{
//点击单行
if
(
obj
.
checked
===
true
)
{
obj
.
tr
.
addClass
(
'layui-table-click'
);
}
else
{
obj
.
tr
.
removeClass
(
'layui-table-click'
);
}
}
else
if
(
obj
.
checked
===
false
&&
obj
.
type
===
'one'
)
{
//点击全选之后点击单行
if
(
obj
.
tr
.
hasClass
(
'layui-table-click'
))
{
obj
.
tr
.
removeClass
(
'layui-table-click'
);
}
}
});
//保存需要刷新的页面数据
function
saveRefreshData
(
type
,
supplierId
=
0
)
{
admin
.
putTempData
(
"needFreshDetail_supplier_id="
+
supplierId
,
1
);
}
//列设置
$
(
"#col_setting"
).
click
(
function
()
{
let
html
=
'
<
div
style
=
"padding: 15px;"
>
';
html += '
<
div
style
=
"margin-bottom: 10px;"
>
';
html += '
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-info"
id
=
"col_select_all"
>
全选
<
/button>'
;
html
+=
'
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-danger"
id
=
"col_invert_select"
>
反选
<
/button>'
;
html
+=
'
<
/div>'
;
html
+=
'
<
div
style
=
"max-height: 600px; overflow-y: auto;"
>
';
html += '
<
form
class
=
"layui-form"
lay
-
filter
=
"colSettingForm"
>
'
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
if
(
cols
[
i
].
type
===
'checkbox'
)
continue
;
let
field
=
cols
[
i
].
field
;
let
title
=
cols
[
i
].
title
||
''
;
let
checked
=
cols
[
i
].
hide
?
''
:
'checked'
;
html
+=
'
<
div
class
=
"layui-form-item"
style
=
"display:inline-block;width:33%;margin-bottom:5px;"
>
';
html += '
<
input
type
=
"checkbox"
name
=
"' + field + '"
lay
-
skin
=
"primary"
title
=
"' + title + '"
' + checked + '
>
';
html += '
<
/div>'
;
}
html
+=
'
<
/form></
div
><
/div>'
;
layer
.
open
({
type
:
1
,
title
:
'显示列设置'
,
area
:
[
'600px'
,
'600px'
],
content
:
html
,
btn
:
[
'确定'
,
'取消'
],
success
:
function
(
layero
,
index
)
{
form
.
render
(
'checkbox'
,
'colSettingForm'
);
//全选
layero
.
find
(
'#col_select_all'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
prop
(
'checked'
,
true
);
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
//反选
layero
.
find
(
'#col_invert_select'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
each
(
function
()
{
$
(
this
).
prop
(
'checked'
,
!
$
(
this
).
is
(
':checked'
));
});
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
},
yes
:
function
(
index
,
layero
)
{
let
settings
=
{};
let
checkboxes
=
layero
.
find
(
'input[type="checkbox"]'
);
checkboxes
.
each
(
function
()
{
let
name
=
$
(
this
).
attr
(
'name'
);
let
checked
=
$
(
this
).
is
(
':checked'
);
settings
[
name
]
=
checked
;
});
//保存到后端Redis
$
.
ajax
({
url
:
'/api/external/SaveColSettings'
,
type
:
'post'
,
data
:
{
user_id
:
colSettingsUserId
,
page_key
:
colSettingsPageKey
,
settings
:
JSON
.
stringify
(
settings
)
},
dataType
:
'json'
,
async
:
false
});
colSettingsData
=
settings
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
settings
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
settings
[
field
];
}
}
table
.
reload
(
'list'
,
{
cols
:
[
cols
],
page
:
{
curr
:
currentPage
},
where
:
whereCondition
});
layer
.
close
(
index
);
}
});
});
//新增供应商弹窗
$
(
"#add_supplier"
).
click
(
function
()
{
index
.
openTab
({
title
:
'新增供应商'
,
url
:
'/supplier/AddSupplier?view=iframe'
,
end
:
function
()
{
// insTb.reload();
}
});
})
//同步金蝶的手动操作
$
(
"#sync_supplier_to_erp"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
let
supplierId
=
data
[
0
].
supplier_id
;
let
res
=
ajax
(
'/api/supplier/SyncToErp'
,
{
supplier_id
:
supplierId
})
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'list'
)
layer
.
closeAll
();
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
}
});
//同步一体化的手动操作
$
(
"#sync_supplier_to_united"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
let
supplierId
=
data
[
0
].
supplier_id
;
let
res
=
ajax
(
'/api/supplier/SyncToUnited'
,
{
supplier_id
:
supplierId
})
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'list'
)
layer
.
closeAll
();
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
}
});
//审批供应商弹窗
$
(
"#audit_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
let
supplierId
=
data
[
0
].
supplier_id
;
let
status
=
data
[
0
].
status
;
let
canReviewSupplier
=
<?php
echo
e
(
checkPerm
(
"ReviewSupplier"
)
?
1
:
0
);
?>
;
if
(
status
===
4
){
layer
.
msg
(
'该供应商状态为待确认,需要先确认客户转化供应商'
,
{
icon
:
5
});
return
;
}
if
(
canReviewSupplier
===
0
&&
status
===
-
1
)
{
layer
.
msg
(
'你没有复审供应商的权限'
,
{
icon
:
5
})
return
}
if
(
status
===
0
)
{
layer
.
msg
(
'该供应商还没有申请审核'
,
{
icon
:
5
});
return
;
}
if
(
status
!==
1
&&
status
!==
-
1
)
{
layer
.
msg
(
'该供应商已经被审核'
,
{
icon
:
5
});
return
;
}
let
checkAuditMsg
=
checkCanAudit
(
supplierId
);
if
(
checkAuditMsg
!==
''
)
{
layer
.
msg
(
checkAuditMsg
,
{
icon
:
5
});
return
}
layer
.
open
({
type
:
2
,
content
:
'/supplier/AuditSupplier?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'800px'
,
'65%'
],
title
:
'审核供应商'
,
end
:
function
()
{
table
.
reload
(
'list'
);
saveRefreshData
(
'detail'
,
supplierId
)
supplierStatistics
();
}
});
}
})
//批量修改(分配)数据维护员
$
(
"#batch_allocate_purchase_user"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
supplierIds
=
supplierIds
.
join
(
','
);
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
let
status
=
Array
.
from
(
data
,
({
status
})
=>
status
);
//分配采购员的多选操作,需要先去判断是否存在审核中的供应商,存在的话,要提示
if
(
status
.
indexOf
(
1
)
!==
-
1
||
status
.
indexOf
(
-
3
)
!==
-
1
||
status
.
indexOf
(
-
1
)
!==
-
1
)
{
layer
.
msg
(
'选择的供应商里,存在审核中/待复审/黑名单的供应商,无法分配数据维护员'
,
{
icon
:
5
})
return
}
layer
.
open
({
type
:
2
,
content
:
'/supplier/BatchAllocatePurchaseUser?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'600px'
,
'70%'
],
title
:
'批量分配数据维护员'
,
end
:
function
()
{
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
})
//申请进入审核中的状态
$
(
"#batch_apply_in_review_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
supplierIds
=
supplierIds
.
join
(
','
);
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
let
status
=
Array
.
from
(
data
,
({
status
})
=>
status
);
let
canApplyInReview
=
true
;
$
.
each
(
status
,
function
(
index
,
value
)
{
if
(
value
!==
0
)
{
canApplyInReview
=
false
;
}
});
if
(
!
canApplyInReview
)
{
layer
.
msg
(
'选择的供应商里,存在非待提审状态的供应商,无法申请审核'
,
{
icon
:
5
})
return
;
}
//还要去事先检测供应商信息是否完整
let
checkApplyMsg
=
checkCanApplyInReview
(
supplierIds
);
if
(
checkApplyMsg
!==
''
)
{
return
false
;
}
layer
.
open
({
type
:
2
,
content
:
'/supplier/BatchApplyInReviewSupplier?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'800px'
,
'70%'
],
title
:
'申请审核供应商'
,
end
:
function
()
{
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
})
//分配采购员,现在改成可以批量的了
$
(
"#allocate_channel_user"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
let
status
=
Array
.
from
(
data
,
({
status
})
=>
status
);
let
canApplyInReview
=
true
;
$
.
each
(
status
,
function
(
index
,
value
)
{
console
.
log
(
value
);
if
(
value
===
-
1
||
value
===
1
)
{
canApplyInReview
=
false
;
}
});
if
(
!
canApplyInReview
)
{
layer
.
msg
(
'选择的供应商里,存在 审核中/待复审 状态的供应商,无法分配采购员'
,
{
icon
:
5
})
}
else
{
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
if
(
supplierIds
.
length
>
20
)
{
layer
.
msg
(
'最多一次操作20个供应商'
,
{
icon
:
5
})
return
;
}
supplierIds
=
supplierIds
.
join
(
','
);
layer
.
open
({
type
:
2
,
content
:
'/supplier/AllocateChannelUser?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'80%'
,
'80%'
],
title
:
'新增采购员'
,
end
:
function
()
{
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
}
})
//禁用供应商
$
(
"#disable_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
const
status
=
data
[
0
].
status
;
const
hasSku
=
data
[
0
].
sku_num
;
const
needReview
=
data
[
0
].
need_review
;
if
(
needReview
===
1
&&
status
!==
0
)
{
layer
.
msg
(
"该供应商还没有进行复审,不能直接禁用;"
,
{
icon
:
5
})
return
;
}
if
((
status
===
3
||
status
===
2
||
status
===
0
)
&&
!
hasSku
)
{
let
supplierId
=
data
[
0
].
supplier_id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier/DisableSupplier?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'700px'
,
'70%'
],
title
:
'禁用供应商'
,
end
:
function
()
{
saveRefreshData
(
'detail'
,
supplierId
)
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
else
{
layer
.
msg
(
'只有待提审,已通过或者未通过状态,并且没有sku的供应商才可以禁用'
,
{
'icon'
:
5
});
}
}
});
//转正供应商
$
(
"#change_supplier_is_type"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
const
isType
=
data
[
0
].
is_type
;
if
(
isType
===
0
)
{
layer
.
msg
(
'该供应商已经是正式供应商'
,
{
'icon'
:
5
});
return
}
layer
.
confirm
(
'如果转成正式供应商,会进入审核中状态,需要补全相关信息申请审核,确定要转正该供应商吗?'
,
function
(
index
)
{
let
supplierId
=
data
[
0
].
supplier_id
;
let
res
=
ajax
(
'/api/supplier/ChangeSupplierIsType'
,
{
supplier_id
:
supplierId
,
is_type
:
0
})
if
(
res
.
err_code
===
0
)
{
saveRefreshData
(
'detail'
,
supplierId
)
table
.
reload
(
'list'
)
supplierStatistics
();
layer
.
closeAll
();
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
});
}
});
//加入黑名单
$
(
"#block_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
const
status
=
data
[
0
].
status
;
if
(
status
===
-
3
)
{
layer
.
msg
(
'该供应商已经在黑名单'
,
{
icon
:
5
});
return
false
;
}
if
((
status
===
-
1
||
status
===
1
))
{
layer
.
msg
(
'审核中/待复审状态的供应商无法加入黑名单'
,
{
icon
:
5
});
return
false
;
}
else
{
let
supplierId
=
data
[
0
].
supplier_id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier/BlockSupplier?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'700px'
,
'70%'
],
title
:
'加入黑名单'
,
end
:
function
()
{
saveRefreshData
(
'detail'
,
supplierId
)
table
.
reload
(
'list'
);
supplierStatistics
();
}
});
}
}
});
//共用供应商申请
$
(
"#apply_supplier_share"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_share_apply/ApplySupplierShare?view=iframe'
,
area
:
[
'700px'
,
'80%'
],
title
:
'申请共用供应商'
,
end
:
function
()
{
}
});
});
//共用供应商审核
$
(
"#audit_supplier_share_apply"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_share_apply/AuditSupplierShareApply?view=iframe'
,
area
:
[
'70%'
,
'80%'
],
title
:
'共用申请审核'
,
end
:
function
()
{
}
});
});
//批量修改供应商标签
$
(
"#batch_add_tags"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_tag/BatchAddTag?view=iframe'
,
area
:
[
'70%'
,
'90%'
],
title
:
'供应商标签添加'
,
end
:
function
()
{
}
});
});
//设置SKU采购
$
(
"#batch_allocate_yunxin_channel_user"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
supplierIds
=
supplierIds
.
join
(
','
);
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
layer
.
open
({
type
:
2
,
content
:
'/supplier/BatchAllocateYunxinChannelUser?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'80%'
,
'80%'
],
title
:
'批量配置线上采购员'
,
end
:
function
()
{
table
.
reload
(
'list'
);
}
});
}
})
//查询供应商
$
(
"#query_supplier"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier/QuerySupplier?view=iframe'
,
area
:
[
'70%'
,
'30%'
],
title
:
'查询供应商'
,
end
:
function
()
{
}
});
})
//交接供应商
$
(
"#transfer_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
let
supplierId
=
data
[
0
].
supplier_id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier/TransferSupplier?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'50%'
,
'70%'
],
title
:
'交接供应商'
,
end
:
function
()
{
table
.
reload
(
'list'
);
}
});
}
})
//确认客户转化供应商
$
(
"#confirm_crm_supplier"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
})
return
;
}
const
status
=
data
[
0
].
status
;
const
source
=
data
[
0
].
supplier_source
;
// 前置条件:供应商状态为待确认(4),供应商来源为CRM客户转化供应商(2)
if
(
status
!==
4
||
source
!==
2
)
{
layer
.
msg
(
'只有状态为"待确认"且来源为"CRM客户转化供应商"的供应商才可以操作'
,
{
icon
:
5
});
return
;
}
let
supplierId
=
data
[
0
].
supplier_id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier/ConfirmCrmSupplier?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'70%'
,
'720px'
],
title
:
'转化供应商确认'
,
end
:
function
()
{
table
.
reload
(
'list'
);
}
});
}
})
//判断是否要展示有全部离职采购员的供应商,有的话提示
if
(
!
admin
.
getTempData
(
'has_pop_up_all_channel_user_supplier_tips'
))
{
$
.
ajax
({
url
:
'/api/supplier/checkHasAllResignedChannelUserSupplier'
,
type
:
'POST'
,
async
:
true
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
layer
.
confirm
(
'
<
div
style
=
"width: 400px;height: 50px;"
><
p
>
属于你部门的正式供应商有
<
span
style
=
"color: red;"
>
' + res.data + '
家
<
/span> 没有有效采购员
(
采购员全离职
)
<p><p>请尽快分配采购员进行维护</
p
><
/div>',
{
btn
:
[
'立即前往'
,
'关闭提示'
],
//按钮
offset
:
'rb'
,
},
function
()
{
admin
.
putTempData
(
'has_pop_up_all_channel_user_supplier_tips'
,
1
);
layer
.
closeAll
();
index
.
openTab
({
title
:
'供应商列表'
,
url
:
'/supplier/SupplierList?view=iframe&source_type=all_channel_user_resigned'
,
end
:
function
()
{
}
});
},
function
()
{
admin
.
putTempData
(
'has_pop_up_all_channel_user_supplier_tips'
,
1
);
layer
.
closeAll
();
});
}
else
{
}
}
},
error
:
function
()
{
layer
.
msg
(
'网络错误'
,
{
icon
:
5
});
}
});
}
let
formValue
=
{};
$
(
'#export_supplier'
).
click
(
function
()
{
window
.
open
(
'/api/supplier/exportSupplier'
,
'_blank'
);
});
//点击查询按钮
form
.
on
(
'submit(load)'
,
function
(
data
)
{
formValue
=
data
.
field
;
//罗盘选项会跳回全部
clearTypeFilter
();
$
(
'#total'
).
attr
(
'class'
,
'main_filter layui-badge layui-bg-green'
);
whereCondition
.
source_type
=
'all'
;
initCondition
.
source_type
=
whereCondition
.
source_type
;
whereCondition
=
$
.
extend
(
false
,
initCondition
,
data
.
field
);
//执行重载
table
.
reload
(
'list'
,
{
page
:
{
curr
:
1
}
,
where
:
whereCondition
});
supplierStatistics
();
return
false
;
});
//点击重置按钮
form
.
on
(
'submit(reset)'
,
function
(
data
)
{
layer
.
load
(
1
);
location
.
reload
();
});
})
;
//检查是否能够审核,因为审核人只能审自己相关部门人员修改的供应商记录
function
checkCanAudit
(
supplierId
)
{
let
url
=
'/api/supplier/CheckCanAuditSupplier?supplier_id='
+
supplierId
;
let
res
=
ajax
(
url
);
if
(
res
.
err_code
!==
0
)
{
return
res
.
err_msg
;
}
else
{
return
''
;
}
}
function
checkCanApplyInReview
(
supplierIds
)
{
let
url
=
'/api/supplier/CheckCanApplyInReview?supplier_ids='
+
supplierIds
;
let
res
=
ajax
(
url
);
if
(
res
.
err_code
!==
0
)
{
let
errMsg
=
res
.
err_msg
;
let
msg
=
''
;
$
.
each
(
errMsg
.
split
(
'|'
),
function
(
index
,
value
)
{
msg
+=
"
<
span
>
" + value + "
<
/span><br>
"
});
layer
.
msg
(
msg
,
{
icon
:
5
})
return
false
;
}
else
{
return
''
;
}
}
function
clearTypeFilter
()
{
$
(
'.main_filter'
).
attr
(
'class'
,
'main_filter'
);
}
// 绑定审核状态悬停事件
function
bindAuditStatusHover
()
{
let
auditFlowCache
=
{};
// 缓存审核流程数据
$
(
'.audit-status-hover'
).
hover
(
function
()
{
let
$this
=
$
(
this
);
let
supplierId
=
$this
.
data
(
'supplier-id'
);
let
status
=
$this
.
data
(
'status'
);
// 审核中(1)和待确认(4)状态显示审批节点
if
(
status
!==
1
&&
status
!==
4
)
{
return
;
}
// 如果已经有缓存,直接显示
if
(
auditFlowCache
[
supplierId
])
{
showAuditFlowTips
(
$this
,
auditFlowCache
[
supplierId
]);
return
;
}
// 请求审核流程数据
$
.
ajax
({
url
:
'/api/supplier/GetAuditFlow'
,
type
:
'get'
,
data
:
{
supplier_id
:
supplierId
},
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
res
.
err_code
===
0
&&
res
.
data
)
{
auditFlowCache
[
supplierId
]
=
res
.
data
;
showAuditFlowTips
(
$this
,
res
.
data
);
}
}
});
},
function
()
{
// 鼠标移出时关闭tips
layer
.
closeAll
(
'tips'
);
}
);
}
// 显示审核流程时间线
function
showAuditFlowTips
(
$element
,
auditData
)
{
if
(
auditData
.
length
===
0
)
{
return
;
}
else
{
let
timelineHtml
=
buildAuditTimeline
(
auditData
);
layer
.
tips
(
timelineHtml
,
$element
,
{
tips
:
[
3
,
'#009688'
],
time
:
0
,
area
:
[
'auto'
,
'auto'
],
maxWidth
:
550
});
}
}
// 构建审核时间线HTML - 横向展示
function
buildAuditTimeline
(
auditData
)
{
let
nodeList
=
auditData
.
node_list
||
[];
let
currentNodeId
=
auditData
.
current_node
;
let
approvalStatus
=
auditData
.
approval_status
;
let
html
=
'
<
div
style
=
"padding: 20px; background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); min-width: 500px;"
>
';
html += '
<
div
style
=
"display: flex; justify-content: space-between; align-items: flex-start;"
>
';
nodeList.forEach(function(node, index) {
let isPassed = node.approval_status == 1;
let isRejected = node.approval_status == 2;
let isWaiting = node.approval_status == 0;
// 确定图标和颜色
let iconNumber = index + 1;
let iconBgColor = '';
let iconTextColor = '
#
fff
';
let nodeTitle = '';
if (isPassed) {
iconBgColor = '
#
5
FB878
';
nodeTitle = '
审核通过
';
} else if (isRejected) {
iconBgColor = '
#
FF5722
';
nodeTitle = '
审核拒绝
';
} else if (isWaiting) {
iconBgColor = '
#
D2D2D2
';
nodeTitle = '
待审核
';
}
// 每个节点
html += '
<
div
style
=
"flex: 1; text-align: center; position: relative;"
>
';
// 圆形图标
html += '
<
div
style
=
"width: 40px; height: 40px; border-radius: 50%; background: ' + iconBgColor + '; color: ' + iconTextColor + '; line-height: 40px; font-size: 18px; font-weight: bold; margin: 0 auto 10px;"
>
';
html += iconNumber;
html += '
<
/div>'
;
// 节点标题
html
+=
'
<
div
style
=
"font-weight: bold; margin-bottom: 8px; font-size: 14px; color: #333;"
>
' + nodeTitle + '
<
/div>'
;
// 节点详情
html
+=
'
<
div
style
=
"color: #666; font-size: 12px; line-height: 1.8; text-align: left; padding: 0 10px;"
>
';
html += '
<
div
>
审核人:
' + (node.approval_names || '
-
') + '
<
/div>'
;
html
+=
'
<
div
>
审核结果:
' + (node.approval_status_text || '
-
') + '
<
/div>'
;
html
+=
'
<
div
>
审核时间:
' + (node.update_time || '
-
') + '
<
/div>'
;
if
(
node
.
remark
)
{
html
+=
'
<
div
>
附加说明:
' + node.remark + '
<
/div>'
;
}
html
+=
'
<
/div>'
;
html
+=
'
<
/div>'
;
// 连接线(最后一个节点不需要)
if
(
index
<
nodeList
.
length
-
1
)
{
let
lineColor
=
isPassed
?
'#5FB878'
:
'#D2D2D2'
;
html
+=
'
<
div
style
=
"flex: 0 0 50px; padding-top: 20px;"
>
';
html += '
<
div
style
=
"height: 2px; background: ' + lineColor + ';"
><
/div>'
;
html
+=
'
<
/div>'
;
}
});
html
+=
'
<
/div>'
;
html
+=
'
<
/div>'
;
return
html
;
}
</script>
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