Commit 0193d720 by 杨树贤

供应商申请需求

parent d7765ded
......@@ -125,6 +125,7 @@ MAIL_ENCRYPTION=null
LOGIN_DOMAIN=user.liexin.net
DOMAIN=liexin.net
API_DOMAIN=http://api.liexin.com
API_ONLINE_DOMAIN=https://api.ichunt.com
PERM_URL=http://perm.liexin.net/api/check
PERM_LIST=http://perm.liexin.net/api/perms
PERM_ID=25
......
......@@ -50,6 +50,7 @@ class ExternalApiController extends Controller
'contact_name',
'email',
'mobile',
'source',
]);
$rules = [
"supplier_name" => "required|max:300",
......@@ -57,6 +58,7 @@ class ExternalApiController extends Controller
"contact_name" => "required|max:10",
"email" => "required|email",
'mobile' => 'required',
'source' => 'required',
];
$attributes = [
'supplier_name' => '公司名称',
......@@ -64,6 +66,7 @@ class ExternalApiController extends Controller
'contact_name' => '联系人',
'email' => '邮箱',
'mobile' => '注册手机号',
'source' => '来源',
];
$validator = Validator::make($data, $rules, [], $attributes);
if ($validator->fails()) {
......
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\LogService;
use App\Http\Services\SupplierApplyService;
use App\Http\Services\SupplierExaminationService;
use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierExaminationValidator;
use App\Model\LogModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierApplyModel;
use App\Model\SupplierLogModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
//供应商检测
class SupplierApplyApiController extends Controller
{
public function Entrance(Request $request, $id)
{
$this->$id($request, $id);
}
//获取列表
public function GetSupplierApplyList($request)
{
$service = new SupplierApplyService();
$list = $service->getSupplierApplyList($request->all());
$this->response(0, 'ok', $list['data'], $list['total']);
}
//审核供应商
public function AuditSupplierApply($request)
{
$status = $request->get('status');
$rejectReason = $request->get('reject_reason');
$rejectReason = trim($rejectReason);
if (empty($status)) {
$this->response(-1, '必须选择一个审核结果');
}
if ($status == -1 && empty($rejectReason)) {
$this->response(-1, '不通过时必须填写原因');
}
$applyId = $request->get('id');
$service = new SupplierApplyService();
$result = $service->auditSupplierApply($applyId, $status, $rejectReason);
if (!$result) {
$this->response(-1, '审核失败');
}
$this->response(0, '审核成功');
}
//查看供应商申请账号信息
public function GetSupplierApplyAccount($request)
{
$id = $request->input('id');
$type = $request->input('type');
$apply = SupplierApplyModel::where('id', $id)->first()->toArray();
$apply['password'] = '123456';
$apply['password_raw'] = '123456';
if ($apply['status'] == SupplierApplyModel::STATUS_PASS) {
$apply['password'] = SupplierAccountModel::where('supplier_code', $apply['supplier_code'])
->value('password_raw');
$apply['password_raw'] = $apply['password'];
}
$logService = new LogService();
$temp = ($type == 'mobile') ? '账号' : '密码';
$content = $request->user->name . ' 查看了供应商申请账号的' . $temp;
$logService->AddLog($apply['supplier_id'], LogModel::VIEW_OPERATE, '查看供应商基本资料', $content);
$this->response(0, 'ok', $apply);
}
}
<?php
namespace App\Http\Controllers\Filter;
use App\Model\SupplierAccountModel;
use App\Model\SupplierApplyModel;
use App\Model\SupplierChannelModel;
class SupplierApplyFilter
{
//查询条件
public function listFilter($map)
{
$model = new SupplierApplyModel();
$query = $model->with('supplier')->orderBy('id', 'desc');
// if (!empty($map['supplier_name'])) {
// //先去供应商主表找出id
// $supplierChannelModel = new SupplierChannelModel();
// $supplierIds = $supplierChannelModel->where('supplier_name', 'like',
// "%${map['supplier_name']}%")->pluck('supplier_id');
// $query->whereIn('supplier_id', $supplierIds);
// }
if (!empty($map['supplier_name'])) {
$query->where('supplier_name', 'like', "%${map['supplier_name']}%");
}
if (!empty($map['supplier_code'])) {
$query->where('supplier_code', 'like', "%${map['supplier_code']}%");
}
if (!empty($map['status'])) {
$query->where('status', $map['status']);
}
if (!empty($map['audit_name'])) {
$query->where('audit_name', 'like', "%${map['audit_name']}%");
}
if (!empty($map['create_time'])) {
$times = explode('~', $map['create_time']);
$startTime = strtotime($times[0]);
$endTime = strtotime($times[1]);
$query->whereBetween('create_time', [$startTime, $endTime]);
}
if (!empty($map['audit_time'])) {
$times = explode('~', $map['audit_time']);
$startTime = strtotime($times[0]);
$endTime = strtotime($times[1]);
$query->whereBetween('audit_time', [$startTime, $endTime]);
}
return $query;
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use App\Http\Services\RoleService;
use App\Http\Services\SupplierContactService;
use App\Http\Services\SupplierService;
use App\Http\Services\ViewCheckService;
use App\Model\IntracodeModel;
use App\Model\SupplierApplyModel;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class SupplierApplyController extends Controller
{
public function info(Request $request, $id = '')
{
if ($request->path() == '/') {
$path = 'web/index';
} else {
$path = $request->path();
}
$this->data = [
'menus' => $request->menus,
'header' => $request->user->header,
'username' => $request->user->email,
'user_email' => $request->user->email,
'uri' => '/' . $path,
'id' => $id
];
return $this->$id($request);
}
public function __call($name, $arr)
{
$data['errinfo'] = '访问路径错误';
return view('errors.error', $data);
}
//操作日志列表
public function SupplierApplyList($request)
{
$this->data['auditUidList'] = SupplierApplyModel::pluck('audit_name', 'audit_uid')->toArray();
$this->data['title'] = '供应商账号列表';
return $this->view('供应商账号列表');
}
public function AuditSupplierApply($request)
{
$id = $request->get('id');
$apply = SupplierApplyModel::with('supplier')->where('id', $id)->first()->toArray();
$apply['supplier_group_name'] = array_get(config('fixed.SupplierGroup'), $apply['supplier']['supplier_group']);
$this->data['apply'] = $apply;
$this->data['title'] = '云芯入驻审核';
return $this->view('云芯入驻审核');
}
}
\ No newline at end of file
......@@ -241,7 +241,6 @@ class SupplierController extends Controller
//获取最后一条非分配渠道员的日志
$logModel = new LogModel();
$auditContent = $logModel->where('supplier_id', $supplierId)
// ->where('action', '!=', '分配渠道开发员')
->where('action', '!=', '')
->where('type', '!=', 3)
->orderBy('id', 'desc')->first();
......
......@@ -9,62 +9,49 @@ use App\Model\SupplierChannelModel;
class MessageService
{
public function sendSupplierMessage($supplierId, $status)
public function sendMessage($keyword, $data, $to_user = '', $cnUncode = false)
{
//先去判断状态是否需要通知
if (!in_array($status, [1, -2, 2, 3, -3])) {
return false;
// 推送给内部人员
if ($cnUncode) {
if (isset($data['data'])) {
$send_data = json_encode($data['data'], JSON_UNESCAPED_UNICODE); //防止中文乱码
} else {
$send_data = json_encode($data, JSON_UNESCAPED_UNICODE); //防止中文乱码
}
} else {
$send_data = json_encode($data['data']);
}
$model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first();
if (empty($supplier)) {
return false;
if (!$to_user) { // 给正式的内部人员推送
$to_user = 'INNER_PERSON';
}
$supplier = $supplier->toArray();
$blacklistModel = new SupplierBlacklistModel();
$blacklist = $blacklistModel->where('supplier_id', $supplierId)->first();
$blacklist = !empty($blacklist) ? $blacklist->toArray() : [];
$createName = $supplier['create_name'];
$createUid = $supplier['create_uid'];
$adminUserService = new AdminUserService();
$user = $adminUserService->getAdminUserInfo($supplier['audit_uid']);
$auditName = array_get($user, 'name');
$supplierCode = $supplier['supplier_code'];
$supplierName = $supplier['supplier_name'];
$rejectReason = $supplier['reject_reason'];
//还要获取自己的审批人
$auditUserId = 0;
$statusName = array_get(config('fixed.SupplierStatus'), $status);
//状态为2的话,有两个情况,一种是审核通过,一种是重新启用
$messagePass = empty($supplier['audit_time']) ? $auditName . '已审核通过供应商' . $supplierName . ',编码为' . $supplierCode :
$supplierName . '供应商已经被重新启用';
$messageMap = [
-2 => $supplierName . '供应商已经被禁用',
1 => $createName . '已提交审核供应商' . $supplierName . ',编码为' . $supplierCode,
2 => $messagePass,
3 => $auditName . '已驳回审核供应商' . $supplierName . ',编码为' . $supplierCode . ',驳回原因为 : ' . $rejectReason,
-3 => $supplierName . '供应商已经被加入黑名单,原因是' . array_get($blacklist, 'reason'),
];
$sendUserMap = [
-2 => $createUid,
1 => $auditUserId,
2 => $createUid,
3 => $createUid,
-3 => $createUid,
];
$data['supplier_remark'] = array_get($messageMap, $status);
$sendUerId = array_get($sendUserMap, $status);
$user = $adminUserService->getAdminUserInfo($sendUerId);
$mobile = array_get($user, 'mobile', '');
if (!$mobile) {
$result = SendMessage($data, 'supplier-audit-alarm', $mobile);
$toUserJson = json_encode($to_user);
$check['touser'] = $toUserJson;
$check['data'] = $send_data;
$check['pf'] = -1;
$check['keyword'] = $keyword;
$check['is_ignore'] = 1;
$check = array_merge($check, $this->authkey());
// dd($check);
$res = curl(config('website.MessageUrl') . '/msg/sendMessageByAuto', $check, true);
if (!empty($res)) {
$res = json_decode($res, true);
}
//再找出邮箱
$email = array_get($user, 'email');
if (!$email) {
$result = SendMessage($data, 'supplier-audit-email', $email, 1);
}
return $res;
}
public function authkey($pf = -1)
{
return array(
'pf' => 1,
'k1' => $_SERVER['REQUEST_TIME'],
'k2' => $this->pwdhash($_SERVER['REQUEST_TIME'], config('website.MessageKey'))
);
}
private function pwdhash($pwd, $salt)
{
return md5(md5($pwd).$salt);
}
}
\ No newline at end of file
......@@ -4,20 +4,37 @@
namespace App\Http\Services;
//后台用户相关信息服务
use App\Http\Controllers\Filter\SupplierApplyFilter;
use App\Http\Transformers\SupplierApplyTransformer;
use App\Model\SupplierAccountModel;
use App\Model\SupplierApplyModel;
use App\Model\SupplierBlacklistModel;
use App\Model\SupplierChannelModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class SupplierApplyService
{
//供应商申请列表
public function getSupplierApplyList($map)
{
$limit = array_get($map, 'limit', 10);
$filter = new SupplierApplyFilter();
$query = $filter->listFilter($map);
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierApplyTransformer();
$list['data'] = $transformer->transformList($list['data']);
return $list;
}
//判断是否能申请供应商
public function checkCanApplySupplier($supplierName)
{
//先去判断是否已经有申请,并且是通过或者待审核的,如果是的话,直接返回已申请
$supplierName = trim($supplierName);
$supplier = SupplierChannelModel::where('supplier_name', $supplierName)->first();
$supplier = SupplierChannelModel::where('supplier_name', $supplierName)
->where('is_type', 0)->first();
$supplier = !empty($supplier) ? $supplier->toArray() : [];
if ($supplier) {
$existSupplierApply = SupplierApplyModel::where('supplier_id', $supplier['supplier_id'])
......@@ -30,7 +47,7 @@ class SupplierApplyService
if ($uploadedSku != SupplierChannelModel::HAS_UPLOADED_SKU) {
return '贵司暂未与猎芯进行商品接入合作,请先联系猎芯对应采购经理或渠道经理进行商品合作';
}
}else{
} else {
//供应商不存在
return '贵司暂未入驻猎芯网,请先申请供应商入驻';
}
......@@ -40,22 +57,45 @@ class SupplierApplyService
//申请供应商(通过供应商名称,申请已经存在的供应商)
public function applySupplier($data)
{
$supplierId = SupplierChannelModel::where('supplier_name', $data['supplier_name'])->value('supplier_id');
$supplier = SupplierChannelModel::where('supplier_name', $data['supplier_name'])->first()->toArray();
$data['create_time'] = time();
$data['supplier_id'] = $supplierId;
$data['supplier_id'] = $supplier['supplier_id'];
$data['supplier_code'] = $supplier['supplier_code'];
return SupplierApplyModel::insert($data);
}
//审核供应商申请
public function auditSupplierApply($applyId,$status,$auditReason)
public function auditSupplierApply($applyId, $status, $auditReason)
{
return SupplierApplyModel::where('id',$applyId)->update([
$result = SupplierApplyModel::where('id', $applyId)->update([
'status' => $status,
'audit_reason' => $auditReason,
'update_time' => time(),
'audit_time' => time(),
'audit_name'=> request()->user->name,
'audit_name' => request()->user->name,
'audit_uid' => request()->user->userId,
]);
$apply = SupplierApplyModel::where('id', $applyId)->first()->toArray();
if ($result) {
//如果是通过,那么就要替换掉对应供应商的账号和密码
SupplierAccountModel::where('supplier_code', $apply['supplier_code'])->update([
'mobile' => $apply['mobile'],
'update_time' => time(),
'password_raw' => 123456,
'password' => Hash::make(123456),
'source' => 2,
]);
//无论是否通过,都要发短信通知
if ($status == SupplierApplyModel::STATUS_REJECT) {
$message = "${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:${auditReason},如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com";
} else {
$message = "【猎芯网】${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:通过,云芯登录网址:http://yunxin.ichunt.com,您的云芯登录账号:${apply['mobile']},初始密码:123456,请在登录云芯后修改密码,后续有任何疑问都可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com;";
}
$data = [];
$data['data']['title'] = $message;
(new MessageService())->sendMessage('supplier_apply_audit_mobile', $data, $apply['mobile'], true);
(new MessageService())->sendMessage('supplier_apply_audit_email', $data, $apply['email'], true);
}
return $result;
}
}
\ No newline at end of file
<?php
namespace App\Http\Transformers;
use App\Model\RedisModel;
use App\Model\SupplierApplyModel;
use App\Model\SupplierChannelModel;
class SupplierApplyTransformer
{
public function transformList($list)
{
$redis = new RedisModel();
foreach ($list as &$item) {
$item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : '';
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
$item['audit_time'] = $item['audit_time'] ? date('Y-m-d H:i:s', $item['audit_time']) : '';
if (!empty($item['mobile'])) {
$item['mobile'] = substr($item['mobile'], 0, 3) . '****' . substr($item['mobile'], 7);
}
$item['password_raw'] = '******';
if ($item['status'] == SupplierApplyModel::STATUS_PASS) {
$item['password_raw'] = '*****';
}
$item['supplier_group_name'] = array_get(config('fixed.SupplierGroup'), $item['supplier']['supplier_group']);
$item['is_yunxin'] = strpos($item['supplier']['stockup_type'], '5') !== false ? 1 : 0;
$rule = $redis->hget('magic_cube_price_rule_v2', $item['supplier_code']);
$item['has_ladder_ratio'] = $rule ? 1 : 0;
$item['audit_condition'] = ($item['is_yunxin'] && $item['has_ladder_ratio']) ? 1 : 0;
$item['audit_condition_name'] = ($item['is_yunxin'] && $item['has_ladder_ratio']) ? '符合' : '不符合';
$item['source_name'] = array_get(config('field.SupplierApplySource'), $item['source'], '');
$item['status_name'] = array_get(config('field.SupplierApplyStatus'), $item['status'], '');
$item['supplier'] = (new SupplierTransformer())->getStockupType($item['supplier']);
}
unset($item);
return $list;
}
}
\ No newline at end of file
......@@ -238,7 +238,7 @@ class SupplierTransformer
return $supplier;
}
private function getStockupType($supplier)
public function getStockupType($supplier)
{
$supplier['stockup_type'] = explode(',', $supplier['stockup_type']);
$supplier['stockup_type'] = array_map(function ($value) {
......
......@@ -29,6 +29,7 @@ Route::group(['middleware' => ['web', 'menu']], function () {
Route::match(['get', 'post'], '/index/{key}', 'IndexController@Entrance');
Route::match(['get', 'post'], '/sku/{key}', 'SkuController@Entrance');
Route::match(['get', 'post'], '/log/{key}', 'LogController@Entrance');
Route::match(['get', 'post'], '/supplier_apply/{key}', 'SupplierApplyController@info');
});
Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
......@@ -48,6 +49,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/supplier_share_apply/{key}', 'SupplierShareApplyApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_examination/{key}', 'SupplierExaminationApiController@Entrance');
Route::match(['get', 'post'], '/api/sku_upload_log/{key}', 'SkuUploadLogApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_apply/{key}', 'SupplierApplyApiController@Entrance');
});
//提供给其它系统使用的接口,不需要验证那种
......@@ -65,4 +67,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
$data['data']['title'] = "【猎芯网】 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:,如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com";
//// (new \App\Http\Services\MessageService())->sendMessage('supplier_apply_audit_mobile', $data, 18825159814, true);
// (new \App\Http\Services\MessageService())->sendMessage('supplier_apply_audit_email', $data, '648132694@qq.com', true);
});
......@@ -15,7 +15,7 @@ class SupplierApplyModel extends Model
const STATUS_NEED_AUDIT = 1;
const STATUS_REJECT = -1;
public function supplierChannel()
public function supplier()
{
return $this->hasOne(SupplierChannelModel::class, 'supplier_id', 'supplier_id');
}
......
......@@ -227,4 +227,14 @@ return [
7 => '专营云芯上传',
8 => '专营采集',
],
'SupplierApplySource' => [
1 => '猎芯网',
],
'SupplierApplyStatus' => [
-1 => '不通过',
1 => '待审核',
2 => '通过',
],
];
\ No newline at end of file
......@@ -24,6 +24,9 @@ return [
'InternalApiDomain' => 'http://192.168.1.252:8200',
'UnitedDataDomain' => 'http://united_data.liexindev.net',
'MessageUrl' => env('API_ONLINE_DOMAIN') . '/msg/sendMessageByAuto',
'MessageKey' => 'fh6y5t4rr351d2c3bryi',
'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a',
'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045',
......
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
form.on('submit(auditSupplierApply)', function (data) {
admin.showLoading({type: 3});
let id = getQueryVariable('id');
let url = '/api/supplier_apply/AuditSupplierApply?id=' + id;
$.ajax({
url: url,
type: 'post',
data: data.field,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.err_code === 0) {
admin.removeLoading();
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.removeLoading();
parent.layer.msg(res.err_msg, {icon: 5});
}
},
error: function () {
admin.removeLoading();
return layer.msg('网络错误,请重试', {icon: 5});
}
});
return false;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'layer', 'Split', 'admin', 'xmSelect'], function () {
let $ = layui.jquery;
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let xmSelect = layui.xmSelect;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
let cols = [
{type: 'checkbox'},
{field: 'supplier_name', title: '供应商名称', align: 'center', width: 200},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 110
},
{
field: 'supplier_group_name', title: '供应商性质', align: 'center', width: 120, templet: function (data) {
return data.supplier_group_name
}
},
{
field: 'main_product', title: '主营产品', align: 'center', width: 140
},
{
field: 'mobile', title: '申请账号', align: 'center', width: 160,
templet: function (data) {
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">查看</span>'
}
},
{
field: 'password_raw', title: '密码', align: 'center', width: 160,
templet: function (data) {
return '<span>' + data.password_raw + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">查看</span>'
}
},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
return data.status === -1 ? "<span title='" + data.audit_reason + "' style='color: red'>" + data.status_name + "</span>" : data.status_name;
}
},
{field: 'source_name', title: '申请渠道', align: 'center', width: 80},
{
field: 'audit_condition_name', title: '审核条件', align: 'center', width: 80, templet: function (data) {
return '<span style="color: dodgerblue" class="view_audit_condition">' + data.audit_condition_name + '</span>';
}
},
{field: 'audit_name', title: '审核人', align: 'center', width: 100},
{field: 'create_time', title: '申请时间', align: 'center', width: 150},
{field: 'audit_time', title: '审核时间', align: 'center', width: 150},
];
let currentPage = 0;
table.render({
elem: '#supplierApplyList'
, url: '/api/supplier_apply/GetSupplierApplyList'
, method: 'post'
, size: 'sm'
, limit: 20
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'supplierApplyList'
, page: {}
, done: function (res, curr, count) {
currentPage = curr;
}
});
//审核供应商申请
$("#audit_supplier_apply").click(function () {
let checkStatus = table.checkStatus('supplierApplyList');
let data = checkStatus.data;
let id = data[0].id;
if (!data.length) {
layer.msg('请先选择要操作的申请', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
if (data[0].status !== 1) {
layer.msg('请选择“待审核”的数据进行审核操作', {icon: 5});
return;
}
if (data[0].has_ladder_ratio !== 1 && data[0].has_ladder_ratio !== 1) {
layer.msg('请先设置该供应商为“云芯商家”,并且配置“阶梯系数”后,再进行审核操作', {icon: 5});
return;
}
if (data[0].is_yunxin !== 1) {
layer.msg('请先设置该供应商为“云芯商家”,再进行审核操作', {icon: 5});
return;
}
if (data[0].has_ladder_ratio !== 1) {
layer.msg('请先配置该供应商的“阶梯系数”,再进行审核操作', {icon: 5});
return;
}
layer.open({
type: 2,
content: '/supplier_apply/AuditSupplierApply?view=iframe&id=' + id,
area: ['800px', '600px'],
title: '云芯入驻审核',
end: function () {
table.reload('supplierApplyList');
}
});
}
});
//划过显示审核条件
let auditConditionTipsVal = '';
$(document).on('mouseenter', '.view_audit_condition', function () {
let self = this;
let rowIndex = $(this).parent().parent().parent().attr('data-index');
let isYunxin = table.cache['supplierApplyList'][rowIndex].is_yunxin;
let hasLadderRatio = table.cache['supplierApplyList'][rowIndex].has_ladder_ratio;
let yunxinHtml = isYunxin ? '<i class="layui-icon layui-icon-ok-circle" style="color: limegreen"></i>' : '<i class="layui-icon layui-icon-close-fill" style="color: orangered"></i>';
let ratioHtml = hasLadderRatio ? '<i class="layui-icon layui-icon-ok-circle" style="color: limegreen"></i>' : '<i class="layui-icon layui-icon-close-fill" style="color:orangered"></i>';
let html = '<p>云芯商家 ' + yunxinHtml + '</p><p>阶梯系数 ' + ratioHtml + '</p>'
auditConditionTipsVal = layer.tips(html, self, {
tips: [3, "#555555"],
time: 1000000,
area: ['100px', 'auto'],
skin: 'custom'
});
}).on('mouseleave', '.view_audit_condition', function () {
layer.close(auditConditionTipsVal);
});
form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('supplierApplyList', {
page: {
curr: 1
}
, where: whereCondition
});
return false;
});
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
$(document).on('click', '.viewAccount', function () {
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
let id = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_apply/GetSupplierApplyAccount', {id: id, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'password_raw':
$(this).prev().text(resp.data.password_raw);
break;
}
console.log(resp);
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: id || 0,
source_from: window.location.href
});
$(this).text('隐藏');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
}
});
});
</script>
\ No newline at end of file
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<input type="hidden" name="supplier_id" value="{{$apply['supplier_id']}}">
<div class="layui-form-item">
<blockquote class="layui-elem-quote layui-text">
<b>基本信息</b>
</blockquote>
</div>
<div class="layui-form-item">
<div class="layui-col-md6">
<label class="layui-form-label">供应商名称 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$apply['supplier_name']}}
</div>
</div>
<div class="layui-col-md6">
<label class="layui-form-label">供应商编码 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$apply['supplier_code']}}
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-col-md6">
<label class="layui-form-label">供应商性质 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$apply['supplier_group_name']}}
</div>
</div>
<div class="layui-col-md6">
<label class="layui-form-label">主营产品 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$apply['main_product']}}
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核结果 : </label>
<div class="layui-input-block">
<input type="radio" name="status" value="2" title="通过">
<input type="radio" name="status" value="-1" title="不通过">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">原因说明 : </label>
<div class="layui-input-block">
<textarea name="reject_reason" placeholder="不通过时必须填写原因" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="auditSupplierApply">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
<div class="layui-collapse">
<form class="layui-form" style="margin-top: 15px">
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-inline">
<label class="layui-form-label">供应商名称</label>
<div class="layui-input-inline">
<input type="text" value="" name="supplier_name" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">供应商编码</label>
<div class="layui-input-inline">
<input type="text" value="" name="supplier_code" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('status','状态',request()->get('status'),config('field.SupplierApplyStatus')) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('审核uid','审核人',request()->get('audit_uid'),$auditUidList) !!}
</div>
</div>
<div class="layui-row">
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['create_time'=>'申请时间','audit_time'=>'审核时间']) !!}
</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" lay-submit=""
lay-filter="load">查询
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-submit="" lay-filter="reset">重置
</button>
</div>
</form>
</div>
<div style="margin-left: 20px;margin-right: 20px">
<div class="layui-btn-group demoTable" style="margin-top: 15px">
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier_apply">审核</button>
</div>
<table class="layui-table" id="supplierApplyList" lay-filter="supplierApplyList"></table>
</div>
<script>
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment