Commit dcf3e3ca by mushishixian

联系人:

parent 6eac583f
......@@ -4,11 +4,8 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\SupplierContactService;
use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierContactValidator;
use App\Http\Validators\SupplierValidator;
use App\Model\SupplierContactModel;
use App\Model\SupplierLogModel;
use Illuminate\Http\Request;
//通用API,比如获取品牌列表,分类列表等
......@@ -19,6 +16,18 @@ class SupplierContactApiController extends Controller
$this->$id($request, $id);
}
//获取供应商收款信息
public function GetSupplierContactList($request)
{
$supplierId = $request->get('supplier_id');
$limit = $request->get('limit', 10);
$model = new SupplierContactModel();
$model->where('supplier_id',$supplierId)->paginate();
$list = $model->where('supplier_id', $supplierId)->orderBy('contact_id', 'desc')
->paginate($limit)->toArray();
$this->response(0, 'ok', $list['data'],$list['total']);
}
public function SaveSupplierContact($request)
{
$data = $request->only([
......@@ -31,6 +40,7 @@ class SupplierContactApiController extends Controller
'supplier_mobile',
'supplier_email',
'supplier_position',
'can_check_uids'
]);
//先去表单验证
$validator = new SupplierContactValidator();
......@@ -43,7 +53,7 @@ class SupplierContactApiController extends Controller
if (!$result) {
$this->response(-1, '操作失败');
}
$this->response(0, '操作成功');
$this->response(0, '保存成功');
}
public function DeleteSupplierContact($request)
......@@ -51,7 +61,7 @@ class SupplierContactApiController extends Controller
$contactId = $request->get('contact_id');
if ($contactId) {
$model = new SupplierContactModel();
$result = $model->where('contact_id', $contactId)->delete();
$result = $model->whereIn('contact_id', $contactId)->delete();
if (!$result) {
$this->response(-1, '删除失败');
}
......
<?php
namespace App\Http\Controllers;
use App\Http\Services\RoleService;
use App\Http\Services\SupplierContactService;
use App\Http\Services\SupplierService;
use App\Http\Services\SupplierStatisticsService;
use App\Http\Services\ViewCheckService;
use App\Model\IntracodeModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierReceiptModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ReceiptController 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
];
$userId = $request->user->userId;
$canAudit = perm($userId, 'AuditSupplier');
$this->data['canAudit'] = $canAudit;
//把是否是领导查看放到模板,用来区分部门老大能干的权限
$leaderView = perm($userId, 'LeaderView');
$this->data['leaderView'] = $leaderView;
return $this->$id($request);
}
}
public function __call($name, $arr)
{
$data['errinfo'] = '访问路径错误';
return view('errors.error', $data);
}
//供应商详情
public function PureAddReceipt($request)
{
$receiptId = $request->get('receipt_id');
if (!empty($receiptId)) {
$model = new SupplierReceiptModel();
$this->data['receipt'] = $model->where('receipt_id', $receiptId)->first()->toArray();
}
$this->data['title'] = '添加供应商多银行';
$this->data['stockup_type'] = Config('fixed.SupplierStockupType');
$this->data['currency'] = Config('fixed.Currency');
$this->data['pay_type'] = Config('fixed.SupplierPayType');
$this->data['receipt_type'] = Config('fixed.ReceiptType');
return $this->view('添加银行');
}
}
\ 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\SupplierStatisticsService;
use App\Http\Services\ViewCheckService;
use App\Model\IntracodeModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierReceiptModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class SupplierContactController 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
];
$userId = $request->user->userId;
$canAudit = perm($userId, 'AuditSupplier');
$this->data['canAudit'] = $canAudit;
//把是否是领导查看放到模板,用来区分部门老大能干的权限
$leaderView = perm($userId, 'LeaderView');
$this->data['leaderView'] = $leaderView;
return $this->$id($request);
}
}
public function __call($name, $arr)
{
$data['errinfo'] = '访问路径错误';
return view('errors.error', $data);
}
//供应商详情
public function AddSupplierContact($request)
{
$contactId = $request->get('contact_id');
if (!empty($contactId)) {
$model = new SupplierReceiptModel();
$this->data['receipt'] = $model->where('contact_id', $contactId)->first()->toArray();
}
$intracodeModel = new IntracodeModel();
$userCodes = $intracodeModel->getAdminIdEncode();
$this->data['userCodes'] = $userCodes;
return $this->view('添加联系方式');
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ use App\Http\Services\SupplierService;
use App\Http\Services\SupplierStatisticsService;
use App\Http\Services\ViewCheckService;
use App\Model\IntracodeModel;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
......@@ -61,6 +62,21 @@ class SupplierController extends Controller
return $this->view('供应商列表');
}
//供应商详情
public function SupplierDetail($request)
{
$supplierId = $request->get('supplier_id');
$supplierService = new SupplierService();
$supplier = $supplierService->getSupplier($supplierId);
// dd($supplier);
if (empty($supplier)) {
return '供应商不存在';
}
$this->data['supplier'] = $supplier;
$this->data['address'] = $supplierService->getAddress($supplierId);
return $this->view('供应商详情');
}
//添加供应商
public function AddSupplier($request, $data)
{
......@@ -88,7 +104,7 @@ class SupplierController extends Controller
$supplierId)->select('mobile', "password_raw")->first();
$data['supplier_account_info'] = $supplierAccountInfo;
$data['address'] = $supplierService->getAddress($supplierId);
}else{
} else {
$data['title'] = '添加供应商';
}
//审核人已经查看
......
......@@ -31,15 +31,16 @@ class Menu
$menuconfig = $menuconfig['data'];
}
$menusData = menu($menuconfig, $request->user->userId);
$menus = !in_array($request->user->userId, $permArr['adminGroup']) ?
menu($menuconfig, $request->user->userId) : $menuconfig;
$menusData['menus'] : $menuconfig;
if (empty($menus)) {
return $this->view('Auth', '没有访问权限', $permArr['goUrl']);
}
//还要判断是否是基石的url,是的话,要返回绝对地址
$menus = $this->getAbsoluteUrl($menus);
$request->menus = $menus;
$request->perms = $menusData['perms'];
}
if (!in_array($user->userId, $permArr['adminGroup']) && $action != 'Dashboard') {//不是超级管理员
$perm = perm($request->user->userId, $action);
......
......@@ -45,7 +45,6 @@ class SupplierContactService
$contact['update_time'] = time();
return $model->where('contact_id', $contact['contact_id'])->update($contact);
} else {
$contact['can_check_uids'] = request()->user->userId;
$contact['add_time'] = time();
return $model->insert($contact);
}
......
......@@ -7,6 +7,7 @@ namespace App\Http\Transformers;
use App\Http\Services\AdminUserService;
use App\Http\Services\ViewCheckService;
use App\Model\IntracodeModel;
use App\Model\RedisModel;
use App\Model\SupplierContactModel;
class SupplierTransformer
......@@ -19,38 +20,34 @@ class SupplierTransformer
$viewCheckService = new ViewCheckService();
$viewData = $viewCheckService->checkSupplierView($supplierIds);
$adminUserService = new AdminUserService();
foreach ($list as &$item) {
$item['viewed'] = array_get($viewData, $item['supplier_id'], false);
$item['stockup_type'] = explode(',', $item['stockup_type']);
$item['stockup_type'] = array_map(function ($value) {
return array_get(config('fixed.StockupType'), $value);
}, $item['stockup_type']);
$item['stockup_type'] = implode(' | ', $item['stockup_type']);
$item['supplier_group'] = array_get(config('fixed.SupplierGroup'), $item['supplier_group'], '未设置');
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
$item['audit_time'] = $item['audit_time'] ? date('Y-m-d H:i:s', $item['audit_time']) : '';
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
$item['channel_username'] = $this->getChannelNames($item['channel_uid']);
$item['purchase_username'] = array_get($users, $item['purchase_uid']);
$item['status_name'] = array_get(config('fixed.SupplierStatus'), $item['status']);
$item['contact_num'] = $this->getContactNum($item['supplier_id']);
$item['has_sku'] = $item['sku_num'] ? '是' : '否';
$item['is_own'] = $item['create_uid'] == request()->user->userId ? "创建" : "指派";
if (empty($item['create_name'])) {
$userInfo = $adminUserService->getAdminUserInfo($item['create_uid']);
$item['create_name'] = array_get($userInfo, 'name');
foreach ($list as &$supplier) {
$supplier['viewed'] = array_get($viewData, $supplier['supplier_id'], false);
$supplier = $this->getStockupType($supplier);
$supplier['supplier_group'] = array_get(config('fixed.SupplierGroup'), $supplier['supplier_group'], '未设置');
$supplier['create_time'] = date('Y-m-d H:i:s', $supplier['create_time']);
$supplier['audit_time'] = $supplier['audit_time'] ? date('Y-m-d H:i:s', $supplier['audit_time']) : '';
$supplier['update_time'] = $supplier['update_time'] ? date('Y-m-d H:i:s', $supplier['update_time']) : '';
$supplier['channel_username'] = $this->getChannelNames($supplier['channel_uid']);
$supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']);
$supplier['status_name'] = array_get(config('fixed.SupplierStatus'), $supplier['status']);
$supplier['contact_num'] = $this->getContactNum($supplier['supplier_id']);
$supplier['has_sku'] = $supplier['sku_num'] ? '是' : '否';
$supplier['is_own'] = $supplier['create_uid'] == request()->user->userId ? "创建" : "指派";
if (empty($supplier['create_name'])) {
$userInfo = $adminUserService->getAdminUserInfo($supplier['create_uid']);
$supplier['create_name'] = array_get($userInfo, 'name');
}
$item['is_channel_or_purchase_user_view'] = $this->getIsChannelOrPurchaseUserView($item);
$supplier['is_channel_or_purchase_user_view'] = $this->getIsChannelOrPurchaseUserView($supplier);
//黑名单
if (!empty($item['blacklist'])) {
$item['blacklist_name'] = $item['blacklist']['blacklist_name'];
$item['blacklist_time'] = date('Y-m-d H:i:s', $item['blacklist']['add_time']);
$item['blacklist_reason'] = $item['blacklist']['reason'];
if (!empty($supplier['blacklist'])) {
$supplier['blacklist_name'] = $supplier['blacklist']['blacklist_name'];
$supplier['blacklist_time'] = date('Y-m-d H:i:s', $supplier['blacklist']['add_time']);
$supplier['blacklist_reason'] = $supplier['blacklist']['reason'];
}
}
unset($item);
unset($supplier);
return $list;
}
......@@ -92,10 +89,25 @@ class SupplierTransformer
public function transformInfo($supplier)
{
$intracodeModel = new IntracodeModel();
$users = $intracodeModel->getSampleEncode();
$supplier['qualification_photos'] = trim($supplier['qualification_photos']);
$supplier['stockup_type_data'] = $this->transformStockupTypeData($supplier['stockup_type']);
$supplier['established_time'] = !empty($supplier['established_time']) ? date('Y-m-d',
$supplier['established_time']) : '';
$supplier = $this->getStockupType($supplier);
$supplier['supplier_group'] = array_get(config('fixed.SupplierGroup'), $supplier['supplier_group'], '未设置');
$supplier['status_name'] = array_get(config('fixed.SupplierStatus'), $supplier['status']);
$supplier['region_name'] = array_get(config('fixed.Region'), $supplier['region']);
$supplier['stockup_type_name'] = array_get(config('fixed.StockupType'), $supplier['stockup_type']);
$supplier['currency_name'] = array_get(config('fixed.Currency'), $supplier['currency']);
$supplier['supplier_group_name'] = array_get(config('fixed.SupplierGroup'), $supplier['supplier_group']);
$supplier['pay_type_name'] = array_get(config('fixed.PayType'), $supplier['pay_type']);
$supplier['main_brand_names'] = $this->getMainBrandNames($supplier['main_brands']);
$supplier['update_time'] = $supplier['update_time'] ? date('Y-m-d H:i:s', $supplier['update_time']) : '';
$supplier['create_time'] = $supplier['create_time'] ? date('Y-m-d H:i:s', $supplier['create_time']) : '';
$supplier['channel_username'] = $this->getChannelNames($supplier['channel_uid']);
$supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']);
$supplier['is_channel_or_purchase_user_view'] = $this->getIsChannelOrPurchaseUserView($supplier);
if (!empty($supplier['contact'])) {
$adminUserService = new AdminUserService();
......@@ -139,6 +151,25 @@ class SupplierTransformer
return $previewConfigs;
}
private function getStockupType($supplier)
{
$supplier['stockup_type'] = explode(',', $supplier['stockup_type']);
$supplier['stockup_type'] = array_map(function ($value) {
return array_get(config('fixed.StockupType'), $value);
}, $supplier['stockup_type']);
$supplier['stockup_type'] = implode(' | ', $supplier['stockup_type']);
return $supplier;
}
private function getMainBrandNames($mainBrandsIds)
{
$mainBrandsIds = explode(',', $mainBrandsIds);
$redis = new RedisModel();
$brands = $redis->hmget('brand',$mainBrandsIds);
$brands = implode(',', $brands);
return $brands;
}
public function transformStockupTypeData($stockupType)
{
if (!empty($stockupType)) {
......
......@@ -15,7 +15,9 @@ class SupplierContactValidator
$rules = [
"supplier_consignee" => "required",
"supplier_email" => "required",
"supplier_telephone" => "required",
"supplier_mobile" => "required",
"supplier_position" => "required",
"can_check_uids" => "required",
];
$messages = $this->messages();
$validator = Validator::make($data, $rules, $messages);
......@@ -31,7 +33,9 @@ class SupplierContactValidator
return [
'supplier_consignee.required' => '联系人不能为空',
'supplier_email.required' => '联系人邮箱不能为空',
'supplier_telephone.required' => '联系人座机不能为空',
'supplier_mobile.required' => '联系人电话不能为空',
'supplier_position.required' => '联系人职位不能为空',
'can_check_uids.required' => '采购员不能为空',
];
}
}
\ No newline at end of file
......@@ -88,7 +88,6 @@ function menu($menu, $user)
$url = $permArr['url'] . '/' . $user . '/' . $perm . '?perms=' . $perm1;
$result = json_decode(curl($url, '', false), true);
if ($result['retcode'] === 0) {
$find = $result['data']['perms'];
$menu = DeleteMenu($menu, $find);
if (!empty($menu) && is_array($menu)) {
......@@ -99,9 +98,15 @@ function menu($menu, $user)
}
}
}
return array_merge($menu);
return [
'menus' => array_merge($menu),
'perms' => $find,
];
} else {
return false;
return [
'menus' => false,
'perms' => [],
];
}
}
......
......@@ -18,6 +18,8 @@ Route::group(['middleware' => ['web', 'menu']], function () {
// Route::get('/', 'WebController@info');
// Route::match(['get', 'post'], '/web/{key}', 'WebController@info');
Route::match(['get', 'post'], '/supplier/{key}', 'SupplierController@info');
Route::match(['get', 'post'], '/supplier_contact/{key}', 'SupplierContactController@info');
Route::match(['get', 'post'], '/receipt/{key}', 'ReceiptController@info');
// Route::match(['get', 'post'], '/supplier_sync_log/{key}', 'SupplierSyncLogController@info');
Route::match(['get', 'post'], '/index/{key}', 'IndexController@Entrance');
// Route::match(['get', 'post'], '/api/{key}', 'ApiController@Entrance');
......
......@@ -41,6 +41,16 @@ class IntracodeModel extends Model
return $result;
}
public function getAdminIdEncode()
{
$codeList = $this->getEncode();
$result = [];
foreach ($codeList as $code) {
$result[$code['admin_id']] = $code['name'] . '(' . $code['code_id'] . ')';
}
return $result;
}
//获取admin_id对应user_code的用户数据
public function getAdminUserAndCode()
{
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
class SupplierAddressModel extends Model
{
protected $connection='web';
protected $table='supplier_address';
public $timestamps = false;
public function AddInfo($SupplierID='',$data=''){
if(empty($SupplierID) || empty($data) || !is_array($data)) return false;
$Add=$data[1];
$Add['supplier_id']=$SupplierID;
$Add['address_type']=1;
$this->insert($Add);
$Add=$data[2];
$Add['supplier_id']=$SupplierID;
$Add['address_type']=2;
$this->insert($Add);
}
public function SaveInfo($data=''){
if(!is_array($data) || empty($data[1]['info_id']) || empty($data[2]['info_id'])) return false;
$Save=$data[1];
$this->where('info_id','=',$data[1]['info_id'])->update($Save);
$Save=$data[2];
return $this->where('info_id','=',$data[2]['info_id'])->update($Save);
}
public function AddressInfo($SupplierID=''){
$collert=Request::only('supplier_id');
$collert=TrimX($collert,true,['supplier_id']);
empty($collert) && $collert['supplier_id']=$SupplierID;
if(empty($collert['supplier_id'])) return false;
$info=$this->where('supplier_id','=',$collert['supplier_id'])->get();
if(!$info) return false;
$info=$info->toArray();
$Arr=[];
foreach ($info as $k=>$v){
$Arr[$v['address_type']]=$v;
}
return $Arr;
}
}
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use request;
class SupplierReceiptModel extends Model
{
protected $connection='web';
protected $table='supplier_receipt';
public $timestamps = false;
public function AddInfo($SupplierID='',$data=''){
if(empty($SupplierID) || empty($data) || !is_array($data)) return false;
foreach ($data as $k=>$v){
unset($v['receipt_id']);
$v['supplier_id'] = $SupplierID;
$v['receipt_type'] = $k;
$result=$this->insert($v);
}
return $result;
}
public function SaveInfo($SupplierID='',$data=''){
if(!is_array($data) || (empty($data[1]['receipt_id']) && empty($data[2]['receipt_id']))) return false;
if(isset($data[1]['receipt_id']) && !empty($data[1]['receipt_id'])){
$data[1]['supplier_id'] = $SupplierID;
$receipt_id = $data[1]['receipt_id'];
unset($data[1]['receipt_id']);
$res = $this->where('receipt_id','=',$receipt_id)->update($data[1]);
}
if(isset($data[2]['receipt_id']) && !empty($data[2]['receipt_id'])){
$data[2]['supplier_id'] = $SupplierID;
$receipt_id = $data[2]['receipt_id'];
unset($data[2]['receipt_id']);
$res = $this->where('receipt_id','=',$receipt_id)->update($data[2]);
}else{
$data[2]['supplier_id'] = $SupplierID;
$data[2]['receipt_type'] = 2;
$result=$this->insert($data[2]);
}
return $res;
}
public function ReceiptInfo($SupplierID=''){
$collert=Request::only('supplier_id');
$collert=TrimX($collert,true,['supplier_id']);
empty($collert) && $collert['supplier_id']=$SupplierID;
if(empty($collert['supplier_id'])) return false;
$info=$this->where('supplier_id','=',$collert['supplier_id'])->get();
if(!$info) return false;
$res = $info->toArray();
$data = array();
foreach ($res as $k=>$v){
$data[$v['receipt_type']] = $v;
}
return $data;
}
}
......@@ -15,13 +15,13 @@ class DayTypePresenter
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" id="${unique}_today">今日</button>
</div>
<div class="layui-col-md2">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" id="${unique}_today">近三天</button>
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" id="${unique}_last_days">近三天</button>
</div>
<div class="layui-col-md2">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" style="margin-left: 11px" id="${unique}_today">本周</button>
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" style="margin-left: 11px" id="${unique}_this_week">本周</button>
</div>
<div class="layui-col-md2">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" style="margin-left: 10px" id="${unique}_today">本月</button>
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button" style="margin-left: 10px" id="${unique}_this_month">本月</button>
</div>
<div class="layui-col-md3">
</div>
......
......@@ -9,7 +9,7 @@ class StatusPresenter
public function render($name, $text, $status = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{
$isRequired = array_get($option, 'required', false);
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$requiredHtml = $isRequired ? '<span class="require">*</span>' : "";
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml
......
......@@ -37,3 +37,39 @@ function getProjectUrl() {
}
return layuiDir.substring(0, layuiDir.indexOf('assets'));
}
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return '';
}
function ajax(url,data){
layer.msg('加载中', {
icon: 16
,shade: 0.01
});
var result=false;
$.ajax({
url:url,
type:'post',
data:data,
async: false,
dataType:'json',
timeout:10000,
success:function (resp) {
if(resp){
result=resp;
}
}
})
layer.closeAll();
return result;
}
\ No newline at end of file
......@@ -15,6 +15,23 @@
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<style>
html *
{
font-size: 13px !important;
}
.layui-input {
height: 30px;
}
.layui-input-inline {
margin-top: 5px;
}
.require {
color: red;
font-size: 16px;
margin-right: 5px;
}
</style>
<body>
<!-- 正文开始 -->
<div class="layui-fluid ew-console-wrapper">
......
<script>
layui.use(['table', 'form', 'element', 'layer','admin'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
form.on('submit(load)', function (data) {
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier_contact/SaveSupplierContact?supplier_id=' + supplierId;
let res = ajax(url, data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
}
return false;
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'layer'], function () {
let table = layui.table;
let form = layui.form;
let element = layui.element;
table.render({
elem: '#receiptList',
url: '/api/receipt/getSupplierReceiptList',
method: 'get',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: getQueryVariable("supplier_id")
},
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{field: 'receipt_type', title: '收款账户所在地', align: 'center'},
{field: 'bank_name', title: '银行名称', align: 'center'},
{field: 'bank_adderss', title: '开户行', align: 'center'},
{field: 'account_no', title: '账户号码', align: 'center'},
{field: 'bank_code', title: '银行编号', align: 'center'},
{field: 'branch_no', title: '分行编号', align: 'center'},
{field: 'swift_code', title: '电汇号码', align: 'center'},
{field: 'account_no', title: '账户号码', align: 'center'},
{field: 'account_name', title: '账户名称', align: 'center'},
{field: 'account_adderss', title: '账户地址', align: 'center'},
{
field: 'certificate', title: '供应商银行信息凭证', align: 'center', templet: function (data) {
return "<img class='certificate_img' style='width: 70px;height: 60px' src='" + data.certificate + "'>";
}
},
]],
id: 'receiptList',
page: {},
});
table.render({
elem: '#list'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, size: 'sm'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
source_type: 'all'
}
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{type: 'radio'},
{field: 'supplier_id', title: '供应商ID', align: 'center', width: 80},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情'>" + data.supplier_code + "</a>"
}
},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 120},
{
field: 'stockup_type', title: '合作类型', align: 'center', width: 120, templet: function (data) {
return "<span title='" + data.stockup_type + "'>" + data.stockup_type + "</span>"
}
},
{
field: 'contact_num', title: '联系人', align: 'center', width: 80, templet: function (data) {
return "<a title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
}
},
{field: 'has_sku', title: 'SKU上传', align: 'center', width: 80},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status === 3) {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
} else {
return data.status_name;
}
}
},
{field: 'channel_username', title: '采购员', align: 'center', width: 150},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 110},
{field: 'create_name', title: '创建人', align: 'center', width: 80},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 150},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
]]
, id: 'SupplierList'
, page: {}
});
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
}
, where: data.field
});
return false;
});
table.on('tool(list)', function (obj) {
let data = obj.data;
let layEvent = obj.event;
let datas = {
group_id: data.group_id,
id: data.id
};
if (layEvent === 'edit') {
window.location = '/supplier'
} else if (layEvent === 'Del') {
datas.status = 3;
up_status(datas, '删除');
}
});
});
</script>
\ No newline at end of file
......@@ -24,9 +24,9 @@
{field: 'supplier_id', title: '供应商ID', align: 'center', width: 80},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
console.log(data)
return "<a href='/supplier/EditSupplier?view=iframe&supplier_id=" + data.supplier_id +
"' target='_blank' style='color: dodgerblue'>" + data.supplier_code + "</a>"
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情'>" + data.supplier_code + "</a>"
}
},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
......@@ -45,7 +45,6 @@
{field: 'has_sku', title: 'SKU上传', align: 'center', width: 80},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
console.log(data.status)
if (data.status === 3) {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
} else {
......@@ -54,9 +53,9 @@
}
},
{field: 'channel_username', title: '采购员', align: 'center', width: 150},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 110},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 120},
{field: 'create_name', title: '创建人', align: 'center', width: 80},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 150},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 160},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
]]
, id: 'SupplierList'
......
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>联系人</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_consignee" id="supplier_consignee"
placeholder="请输入联系人" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>职位</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_position" id="supplier_position"
placeholder="请输入职位" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>邮箱</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_email" id="supplier_email"
placeholder="请输入邮箱" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>手机号</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_mobile" id="supplier_mobile"
placeholder="请输入手机号" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">座机</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_telephone" id="supplier_telephone"
placeholder="请输入座机" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">QQ</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_qq" id="supplier_qq"
placeholder="请输入QQ" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">传真</label>
<div class="layui-input-block block-42">
<input type="text" name="supplier_fax" id="supplier_fax"
placeholder="请输入传真" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('can_check_uids','采购员','',
$userCodes,['required'=>true]) !!}
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px">
<button type="button" class="layui-btn layui-btn-info" lay-submit lay-filter="load">保存</button>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
<div class="layui-card">
<div class="layui-card-header" style="height: 90px;">
<div class="layui-row">
<div class="layui-col-md2">
<b>{{$supplier['supplier_name']}}</b>
</div>
<div class="layui-col-md2">
供应商编码 : {{$supplier['supplier_code']}}
</div>
<div class="layui-col-md2">
状态 : {{$supplier['status_name']}}
</div>
<div class="layui-col-md2">
渠道开发员 : {{$supplier['purchase_username']}}
</div>
<div class="layui-col-md4">
最近修改时间 : {{$supplier['update_time']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
公司性质 : {{$supplier['supplier_group']}}
</div>
<div class="layui-col-md2">
合作类型 : {{$supplier['stockup_type']}}
</div>
<div class="layui-col-md8"></div>
</div>
</div>
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title">
<li class="layui-this" id="base_info">基本信息</li>
<li id="contact">联系人</li>
<li id="ruler">特殊规则</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-row" style="padding: 10px">
<div class="layui-row">
<blockquote class="layui-elem-quote layui-text">
<b>基本资料</b>
</blockquote>
<div class="layui-row">
供应商名称:{{$supplier['supplier_name']}}
</div>
<div class="layui-row">
注册公司名:{{$supplier['supplier_name']}}
</div>
<div class="layui-row">
供应商英文名称:{{$supplier['supplier_name_en']}}
</div>
<div class="layui-row">
所在区域:{{$supplier['region_name']}}
</div>
<div class="layui-row">
<div class="layui-col-md2">
法人代表:{{$supplier['legal_representative']}}
</div>
<div class="layui-col-md3">
成立时间:{{$supplier['established_time']}}
</div>
</div>
<div class="layui-row">
资信调查:{{$supplier['credit_investigation']}}
</div>
<div class="layui-row">
主营品牌:{{$supplier['main_brand_names']}}
</div>
<div class="layui-row">
<div class="layui-col-md2">
合作类型:{{$supplier['stockup_type_name']}}
</div>
<div class="layui-col-md3">
公司性质:{{$supplier['supplier_group_name']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
结算币种:{{$supplier['currency_name']}}
</div>
<div class="layui-col-md3">
公司税号:{{$supplier['tax_number']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
营业执照:{{$supplier['supplier_name']}}
</div>
<div class="layui-col-md3">
发票资料:{{$supplier['supplier_name']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
认证通知书:{{$supplier['supplier_name']}}
</div>
<div class="layui-col-md3">
代理证:{{$supplier['supplier_name']}}
</div>
</div>
</div>
<hr/>
<blockquote class="layui-elem-quote layui-text">
<b>系统设置</b>
</blockquote>
<div class="layui-row">
<div class="layui-col-md2">
供应商编码:{{$supplier['supplier_code']}}
</div>
<div class="layui-col-md3">
供应商ID:{{$supplier['supplier_id']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
交易方式:暂无
</div>
<div class="layui-col-md3">
付款方式:{{$supplier['pay_type_name']}}
</div>
</div>
<hr/>
<blockquote class="layui-elem-quote layui-text">
<b>财务信息</b>
</blockquote>
<div class="layui-row">
<table class="layui-table" lay-filter="receiptList" id="receiptList"></table>
</div>
<blockquote class="layui-elem-quote layui-text">
<b>运输信息</b>
</blockquote>
<div class="layui-row">
发货地址:{{$address['shipping_address']}}
</div>
<div class="layui-row">
<div class="layui-col-md2">
退货地址:{{$address['return_address']}}
</div>
<div class="layui-col-md2">
退货收货人:{{$address['return_consignee']}}
</div>
<div class="layui-col-md2">
退货收货人电话:{{$address['return_phone']}}
</div>
</div>
<hr />
<blockquote class="layui-elem-quote layui-text">
<b>其他信息</b>
</blockquote>
<div class="layui-row">
<div class="layui-col-md2">
创建人:{{$supplier['create_name']}}
</div>
<div class="layui-col-md2">
创建时间:{{$supplier['create_time']}}
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
最近修改人:{{$supplier['supplier_name']}}
</div>
<div class="layui-col-md2">
最近修改时间:{{$supplier['update_time']}}
</div>
</div>
<hr />
</div>
</div>
<div class="layui-tab-item">
@include('web.supplier.SupplierContact')
</div>
<div class="layui-tab-item">内容3</div>
<div class="layui-tab-item">内容4</div>
<div class="layui-tab-item">内容5</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<style>
html *
{
font-size: 12px !important;
}
.layui-input {
height: 30px;
}
.layui-input-inline {
margin-top: 5px;
}
</style>
@include('web.supplier.SupplierListCommon')
......
<div class="layui-row">
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
<button class="layui-btn layui-btn-sm" id="add_contact">新增</button>
<button class="layui-btn layui-btn-sm" id="batchDelete">删除</button>
</div>
<table class="layui-table" lay-filter="contactList" id="contactList"></table>
</div>
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let element = layui.element;
table.render({
elem: '#contactList',
url: '/api/supplier_contact/GetSupplierContactList',
method: 'get',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: getQueryVariable("supplier_id")
},
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{type: 'checkbox',},
{field: 'supplier_consignee', title: '联系人', align: 'center'},
{field: 'supplier_position', title: '职位', align: 'center'},
{field: 'supplier_email', title: '邮箱', align: 'center'},
{field: 'supplier_mobile', title: '手机号', align: 'center'},
{field: 'supplier_telephone', title: '座机', align: 'center'},
{field: 'supplier_qq', title: 'QQ', align: 'center'},
{field: 'supplier_fax', title: '传真', align: 'center'},
{field: 'can_check_uids', title: '采购员', align: 'center'},
]],
id: 'contactList',
page: {},
});
//新增联系方式
$("#add_contact").click(function () {
let supplierId = getQueryVariable('supplier_id');
admin.open({
type: 2,
content: '/supplier_contact/AddSupplierContact?view=iframe&supplier_id=' + supplierId,
area: ['600px', '525px'],
title: '编辑联系人',
end: function () { // 监听弹窗关闭
table.reload('contactList');
}
});
})
//批量删除
$(document).on('click', '#batchDelete', function () {
let checkStatus = table.checkStatus('contactList');
let data = checkStatus.data;
let contactIds = [];
$.each(data, function (index, value) {
contactIds.push(value.contact_id);
});
batchDeleteContact(contactIds);
});
//批量上下架操作
function batchDeleteContact(contactId) {
layer.confirm('确定要删除所选联系方式?', function (index) {
let resp = ajax('/api/supplier_contact/DeleteSupplierContact', {contact_id: contactId});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
table.reload('contactList');
layer.closeAll();
layer.msg(resp.err_msg, {'icon': 6});
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
});
}
});
</script>
\ No newline at end of file
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