Commit efe5920b by mushishixian

Merge branch 'ysx-云芯相关-20210510'

parents b0e45ed2 13a9981d
......@@ -75,6 +75,12 @@ RABBITMQ_LOGIN=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_QUEUE=wms_service
#RABBITMQ_HOST=192.168.1.237
#RABBITMQ_PORT=5672
#RABBITMQ_VHOST=/
#RABBITMQ_LOGIN=huntadmin
#RABBITMQ_PASSWORD=jy2y2900
ES_SKU_URL=http://soso12.ichunt.com/search/Es/searchSku
MAIL_DRIVER=smtp
......
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Filter\SupplierAccountFilter;
use App\Http\Services\SupplierAccountService;
use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierAccountValidator;
use App\Model\LogModel;
use App\Model\RedisModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierLogModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
//通用API,比如获取品牌列表,分类列表等
class SupplierAccountApiController extends Controller
{
public function Entrance(Request $request, $id)
{
$this->$id($request, $id);
}
//获取供应商信息变更记录
public function GetSupplierAccountList($request)
{
$service = new SupplierAccountService();
$list = $service->getSupplierAccountList($request);
$this->response(0, 'ok', $list['data'], $list['total']);
}
//添加
public function AddSupplierAccount($request)
{
$data = $request->only([
'supplier_code',
'mobile',
'password_raw',
'a_type',
]);
$validator = new SupplierAccountValidator();
$check = $validator->checkSave($request);
if ($check !== true) {
$this->response(-1, $check);
}
$supplierModel = new SupplierChannelModel();
$supplierId = $supplierModel->where('supplier_code', $data['supplier_code'])->value('supplier_id');
$data['supplier_id'] = $supplierId;
$data['a_type'] = empty($data['a_type']) ? 0 : 1;
$data['create_time'] = time();
$data['create_uid'] = $request->user->userId;
$data['password'] = Hash::make($data['password_raw']);
$model = new SupplierAccountModel();
$id = $model->insertGetId($data);
if ($id) {
//还要插入一个redis
$redis = new RedisModel();
$redis->hset('yunxin_api_user_mobile', $data['mobile'], $id);
$accountService = new SupplierAccountService();
$accountService->pushToInitData($data['supplier_code']);
$this->response(0, '添加成功');
}
$this->response(-1, '添加失败');
}
//修改
public function UpdateSupplierAccount($request)
{
$data = $request->only([
'id',
'supplier_code',
'mobile',
'password_raw',
'a_type',
]);
$validator = new SupplierAccountValidator();
$check = $validator->checkSave($request);
if ($check !== true) {
$this->response(-1, $check);
}
$supplierModel = new SupplierChannelModel();
$supplierId = $supplierModel->where('supplier_code', $data['supplier_code'])->value('supplier_id');
$data['supplier_id'] = $supplierId;
$data['a_type'] = empty($data['a_type']) ? 0 : 1;
$data['update_time'] = time();
$data['create_uid'] = $request->user->userId;
$data['password'] = Hash::make($data['password_raw']);
$model = new SupplierAccountModel();
$result = $model->where('id', $data['id'])->update($data);
if ($result) {
//还要插入一个redis
$redis = new RedisModel();
$redis->hset('yunxin_api_user_mobile', $data['mobile'], $data['id']);
$accountService = new SupplierAccountService();
$accountService->pushToInitData($data['supplier_code']);
$this->response(0, '修改成功');
}
$this->response(-1, '修改失败', $result);
}
//启用
public function EnableSupplierAccount($request)
{
$id = $request->get('id');
$model = new SupplierAccountModel();
$data['update_time'] = date('Y-m-d H:i:s');
$data['a_status'] = 1;
$result = $model->where('id', $id)->update($data);
if ($result) {
$this->response(0, '启用成功');
}
$this->response(-1, '启用失败', $result);
}
//禁用
public function DisableSupplierAccount($request)
{
$id = $request->get('id');
$model = new SupplierAccountModel();
$data['update_time'] = date('Y-m-d H:i:s');
$data['a_status'] = 0;
$result = $model->where('id', $id)->update($data);
if ($result) {
$this->response(0, '禁用成功');
}
$this->response(-1, '禁用失败', $result);
}
}
......@@ -306,4 +306,29 @@ class SupplierApiController extends Controller
$this->response(0, '已发送同步请求');
}
public function SetYunxinChannelUid($request)
{
$supplierId = $request->get('supplier_id');
$channelUid = $request->get('yunxin_channel_uid');
$model = new SupplierChannelModel();
$result = $model->where('supplier_id', $supplierId)->update([
'yunxin_channel_uid' => $channelUid,
]);
if ($result) {
//修改供应商状态
$model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => SupplierChannelModel::STATUS_IN_REVIEW,
]);
$adminService = new AdminUserService();
$user = $adminService->getAdminUserInfoByCodeId($channelUid);
$logService = new LogService();
$logService->AddLog($supplierId,LogModel::UPDATE_OPERATE,'设置云芯采购员','设置云芯采购员为 : '.$user['name']);
$this->response(0, '设置云芯采购成功');
} else {
$this->response(-1, '设置云芯采购失败');
}
}
}
......@@ -141,7 +141,7 @@ class SupplierContactApiController extends Controller
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
'status' => SupplierChannelModel::STATUS_IN_REVIEW,
]);
}
$logService = new LogService();
......
<?php
namespace App\Http\Controllers\Filter;
use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel;
class SupplierAccountFilter
{
//查询条件
public function listFilter($request)
{
$map = $request->all();
$model = new SupplierAccountModel();
$query = $model->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_code'])) {
$query->where('supplier_code', 'like', "%${map['supplier_code']}%");
}
if ((isset($map['a_status']) && $map['a_status'] === '0') || !empty($map['a_status'])) {
$query->where('a_status', $map['a_status']);
}
if (!empty($map['mobile'])) {
$query->where('mobile', 'like', "%${map['mobile']}%");
}
if ((isset($map['a_type']) && $map['a_type'] === '0') || !empty($map['a_type'])) {
$query->where('a_type', $map['a_type']);
}
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['update_time'])) {
$times = explode('~', $map['update_time']);
$startTime = strtotime($times[0]);
$endTime = strtotime($times[1]);
$query->whereBetween('update_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\SupplierAccountModel;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class SupplierAccountController 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 SupplierAccountList($request)
{
$this->data['title'] = '供应商账号列表';
return $this->view('供应商账号列表');
}
public function AddSupplierAccount($request)
{
//获取所有启用的供应商编码,而且类型是包括云芯
$model = new SupplierChannelModel();
$suppliers = $model->where('is_type', 0)
->whereRaw('stockup_type like "%5%"')
->where('status', SupplierChannelModel::STATUS_PASSED)
->select(['supplier_name', 'supplier_code'])->get();
$supplierCodes = [];
foreach ($suppliers as $supplier) {
$supplier = $supplier->toArray();
$supplierCodes[$supplier['supplier_code']] = $supplier['supplier_name'] . '(' . $supplier['supplier_code'] . ')';
}
$this->data['supplierCodes'] = $supplierCodes;
$this->data['title'] = '添加供应商账号';
return $this->view('添加供应商账号');
}
public function UpdateSupplierAccount($request)
{
$id = $request->get('id');
$model = new SupplierAccountModel();
$account =$model->where('id',$id)->first()->toArray();
//获取所有启用的供应商编码,而且类型是包括云芯
$model = new SupplierChannelModel();
$suppliers = $model->where('is_type', 0)
->whereRaw('stockup_type like "%5%"')
->where('status', SupplierChannelModel::STATUS_PASSED)
->select(['supplier_name', 'supplier_code'])->get();
$supplierCodes = [];
foreach ($suppliers as $supplier) {
$supplier = $supplier->toArray();
$supplierCodes[$supplier['supplier_code']] = $supplier['supplier_name'] . '(' . $supplier['supplier_code'] . ')';
}
$this->data['supplierCodes'] = $supplierCodes;
$this->data['title'] = '编辑供应商账号';
$this->data['account'] = $account;
return $this->view('编辑供应商账号');
}
}
\ No newline at end of file
......@@ -200,4 +200,25 @@ class SupplierController extends Controller
return view('web', $data);
}
//分配云芯采购员
public function SetYunxinChannelUser($request)
{
$supplierId = $request->get('supplier_id');
$model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : [];
$this->data['supplier'] = $supplier;
$intracodeModel = new IntracodeModel();
$userCodes = $intracodeModel->getSampleEncode();
//去除非当前供应商所拥有的采购的人员,只能从当前供应商设置的采购里面选择云芯采购员
$channelUids = explode(',', $supplier['channel_uid']);
foreach ($userCodes as $codeId =>$value) {
if (!in_array($codeId, $channelUids)) {
unset($userCodes[$codeId]);
}
}
$this->data['userCodes'] = $userCodes;
return $this->view('审核供应商');
}
}
\ No newline at end of file
......@@ -35,7 +35,6 @@ class SkuService
$sku['goods_id'] = $goodsId;
$sku['update_time'] = date('Y-m-d H:i:s', $sku['update_time']);
$sku['status_name'] = Config('field.GoodsStatus')[$sku['goods_status']];
if (!empty($auditData[$goodsId])) {
$sku['audit_time'] = date('Y-m-d H:i:s', $auditData[$goodsId]['audit_time']);
$sku['audit_user'] = $auditData[$goodsId]['audit_name'];
......
<?php
namespace App\Http\Services;
use App\Http\Controllers\Filter\SupplierAccountFilter;
use App\Http\Transformers\SupplierAccountTransformer;
use App\Model\LogModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel;
use Carbon\Carbon;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
class SupplierAccountService
{
public function getSupplierAccountList($request)
{
$limit = $request->get('limit', 10);
$filter = new SupplierAccountFilter();
$query = $filter->listFilter($request);
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierAccountTransformer();
$list['data'] = $transformer->transformList($list['data']);
return $list;
}
//推送队列告诉搜索要去初始化数据
public function pushToInitData($supplierCode)
{
return true;
//还要去推送给搜索做品牌初始化任务
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password'));
$channel = $conn->channel();
$channel->queue_declare('yunxin_supplier_add', false, true, false, false);
$time = strtotime("2021-01-01 00:00:00");
$body = json_encode([
'canal' => $supplierCode,
'update_time' => $time
]);
$msg = new AMQPMessage($body,
['content_type' => 'text/plain', 'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT]);
$result = $channel->basic_publish($msg, '', 'yunxin_supplier_add');
$channel->close();
$conn->close();
}
}
\ No newline at end of file
<?php
namespace App\Http\Transformers;
use App\Model\SupplierChannelModel;
class SupplierAccountTransformer
{
public function transformList($list)
{
//获取供应商名称
$supplierIds = array_column($list, 'supplier_id');
$supplierModel = new SupplierChannelModel();
$suppliers = $supplierModel->whereIn('supplier_id', $supplierIds)->pluck('supplier_name', 'supplier_id');
foreach ($list as &$item) {
$item['supplier_name'] = array_get($suppliers, $item['supplier_id']);
$item['type_name'] = array_get(config('field.SupplierAccountType'), $item['a_type']);
$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']) : '';
}
unset($item);
return $list;
}
}
\ No newline at end of file
......@@ -107,6 +107,7 @@ class SupplierTransformer
$supplier['create_time'] = $supplier['create_time'] ? date('Y-m-d H:i:s', $supplier['create_time']) : '';
$supplier['channel_username'] = $this->getChannelUserNames($supplier['channel_uid']);
$supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']);
$supplier['yunxin_channel_username'] = array_get($users, array_get($supplier,'yunxin_channel_uid'));
$supplier['qualification_photos'] = $this->getPhotosDataForForm($supplier['qualification_photos']);
$uploadRulerService = new SupplierSkuUploadRulerService();
$supplier['sku_upload_ruler'] = $uploadRulerService->getSkuUploadRuler($supplier['sku_upload_ruler']);
......
<?php
namespace App\Http\Validators;
use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel;
use Validator;
class SupplierAccountValidator
{
//保存相关的验证,别问我为什么不用laravel自带的form-request类
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($request)
{
//整理下请求数据
$account = $request->all();
$rules = [
"supplier_code" => "required",
"mobile" => "required|regex:/^1[0-9][0-9]{9}$/",
"password_raw" => "required",
"a_type" => "required",
];
$messages = $this->messages();
$validator = Validator::make($account, $rules, $messages);
//判断联系方式的表单验证
if ($validator->fails()) {
return $validator->errors()->first();
}
if (empty($account['id'])) {
$supplierModel = new SupplierChannelModel();
$yunxinChannelUid = $supplierModel->where('supplier_code',
$account['supplier_code'])->value('yunxin_channel_uid');
if (empty($yunxinChannelUid)) {
return '该供应商没有绑定云芯采购,请完善相关信息';
}
$model = new SupplierAccountModel();
$supplierCount = $model->where('supplier_code', $account['supplier_code'])
->count();
if ($supplierCount > 0) {
return '该供应商已经存在账号';
}
$mobileCount = $model->where('mobile', $account['mobile'])
->count();
if ($mobileCount > 0) {
return '该手机号已经被注册';
}
}
return true;
}
private function messages()
{
return [
'supplier_code.required' => '请选择一个供应商',
'a_type.required' => '类型必须勾选为云芯商家',
'mobile.required' => '登录账号不能为空',
'mobile.regex' => '账号格式必须为手机号',
'password_raw.required' => '账号密码不能为空',
];
}
}
\ No newline at end of file
......@@ -15,17 +15,13 @@
Route::group(['middleware' => ['web', 'menu']], function () {
Route::get('/', 'WebController@Entrance');
Route::match(['get', 'post'], '/web/{key}', 'WebController@Entrance');
// 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'], '/supplier_receipt/{key}', 'SupplierReceiptController@info');
Route::match(['get', 'post'], '/supplier_account/{key}', 'SupplierAccountController@info');
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'], '/api/{key}', 'ApiController@Entrance');
// Route::match(['get', 'post'], '/hd/{key}', 'HandleController@Entrance');
Route::get('/pushAmq', 'QueuedController@pushAmq');
Route::get('/pullAmq', 'QueuedController@pullAmq');
});
......@@ -41,6 +37,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/sku/{key}', 'SkuApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_receipt/{key}', 'SupplierReceiptApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_sync_log/{key}', 'SupplierSyncLogApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_account/{key}', 'SupplierAccountApiController@Entrance');
});
Route::match(['get', 'post'], '/test', function () {
set_time_limit(0);
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class SupplierAccountModel extends Model
{
protected $connection='yunxin';
protected $table='yunxin_account';
protected $primaryKey = 'id';
public $timestamps = false;
}
......@@ -8,21 +8,21 @@ return [
2 => '专卖',
],
'GoodsStatus'=>[
'GoodsStatus' => [
1 => '上架',
3 => '下架',
],
//sku列表用
'SkuStatus' => array(
'SkuStatus' => [
0 => '待审核',
1 => '上架',
2 => '审核不通过',
3 => '下架',
4 => '删除'
),
],
'SKU' => array(
'SKU' => [
'spu_id' => 1,
'encoded' => 1,
'moq' => 1,
......@@ -40,5 +40,10 @@ return [
'canal' => 1,
'supplier_id' => 1,
'cp_time' => 1,
),
],
'SupplierAccountType' => [
0 => '其它',
1 => '云芯商家'
]
];
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin','xmSelect'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
let xmSelect = layui.xmSelect;
form.on('submit(addSupplierAccount)', function (data) {
let url = '/api/supplier_account/AddSupplierAccount';
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;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
form.on('submit(setYunxinChannelUid)', function (data) {
admin.btnLoading('.submit-loading');
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/SetYunxinChannelUid?supplier_id=' + supplierId;
let res = ajax(url, data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
//修改罗盘显示数量(cao)
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.btnLoading('.submit-loading',false);
parent.layer.msg(res.err_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 Split = layui.Split;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
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: 'radio'},
{field: 'id', title: 'ID', align: 'center', width: 80},
{
field: 'mobile', title: '账号', align: 'center', width: 170
},
{field: 'password_raw', title: '密码', align: 'center', width: 170},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 120
},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'type_name', title: '账号类型', align: 'center'},
{
field: 'a_status', title: '状态', align: 'center', width: 80, templet: function (data) {
return data.a_status === 1 ? '启用' : "<span style='color: red'>禁用</span>"
}
},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
{field: 'update_time', title: '更新时间', align: 'center', width: 150},
];
let currentPage = 0;
table.render({
elem: '#supplierAccountList'
, url: '/api/supplier_account/GetSupplierAccountList'
, method: 'post'
, size: 'sm'
, limit: 20
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'supplierAccountList'
, page: {}
, done: function (res, curr, count) {
currentPage = curr;
}
});
//启用
$("#enable_supplier_account").click(function () {
let checkStatus = table.checkStatus('supplierAccountList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商账号', {icon: 5})
} else {
layer.confirm('确定要启用该供应商账号吗?', function (index) {
let id = data[0].id;
let res = ajax('/api/supplier_account/EnableSupplierAccount', {id: id})
if (res.err_code === 0) {
table.reload('supplierAccountList');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
//禁用
$("#disable_supplier_account").click(function () {
let checkStatus = table.checkStatus('supplierAccountList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商账号', {icon: 5})
} else {
layer.confirm('确定要禁用该供应商账号吗?', function (index) {
let id = data[0].id;
let res = ajax('/api/supplier_account/DisableSupplierAccount', {id: id})
if (res.err_code === 0) {
table.reload('supplierAccountList');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
//根据供应商编码已经品牌等去基石调用接口下架
$("#add_supplier_account").click(function () {
layer.open({
type: 2,
content: '/supplier_account/AddSupplierAccount?view=iframe',
area: ['800px', '600px'],
title: '添加供应商账号',
end: function () {
table.reload('supplierAccountList');
// supplierStatistics();
}
});
});
$("#update_supplier_account").click(function () {
let checkStatus = table.checkStatus('supplierAccountList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let id = data[0].id;
layer.open({
type: 2,
content: '/supplier_account/UpdateSupplierAccount?view=iframe&id=' + id,
area: ['800px', '600px'],
title: '批量下架SKU',
end: function () {
table.reload('supplierAccountList');
// supplierStatistics();
}
});
}
});
form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('supplierAccountList', {
page: {
curr: 1
}
, where: whereCondition
});
return false;
});
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin','xmSelect'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
let xmSelect = layui.xmSelect;
form.on('submit(addSupplierAccount)', function (data) {
let url = '/api/supplier_account/UpdateSupplierAccount';
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;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
......@@ -52,6 +52,20 @@
});
})
//设置云芯采购
$("#set_yunxin_channel_user").click(function () {
let supplierId = getQueryVariable('supplier_id');
layer.open({
type: 2,
content: '/supplier/SetYunxinChannelUser?view=iframe&supplier_id=' + supplierId,
area: ['600px', '525px'],
title: '配置云芯采购员',
end: function () { // 监听弹窗关闭
table.reload('contactList');
}
});
})
//更新
$(document).on('click', '#update_contact', function () {
let checkStatus = table.checkStatus('contactList');
......
<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">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_code','供应商选择 : ',!empty($account['supplier_code'])?$account['supplier_code']:null,
$supplierCodes,['required'=>true,'width'=>'400px']) !!}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>登录账号 : </label>
<div class="layui-input-block">
<input type="text" name="mobile" id="mobile"
placeholder="请输入登录账号" class="layui-input"
value="{{$account['mobile'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>账号密码 : </label>
<div class="layui-input-block">
<input type="text" name="password_raw" id="password_raw"
placeholder="请输入账号密码" class="layui-input"
value="{{$account['password_raw'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>账号类型 : </label>
<div class="layui-input-block">
<input type="checkbox" name="a_type" title="云芯商家" lay-skin="primary" checked>
</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="addSupplierAccount">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-warm" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
<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="{{$supplier['supplier_id']}}">
<div class="layui-form-item">
<div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('yunxin_channel_uid','云芯采购',$supplier['yunxin_channel_uid'],
$userCodes,['required'=>true,'width'=>'150px']) !!}
</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="setYunxinChannelUid">保存
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-warm" 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('a_status','账号状态',request()->get('status'),[0=>'禁用',1=>'启用']) !!}
</div>
</div>
<div class="layui-row">
<div class="layui-inline">
<label class="layui-form-label">账号</label>
<div class="layui-input-inline">
<input type="text" value="" name="mobile" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['create_time'=>'创建时间','update_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" 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>
</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="add_supplier_account">新增账号</button>
<button type="button" class="layui-btn layui-btn-sm" id="update_supplier_account">修改</button>
<button type="button" class="layui-btn layui-btn-sm" id="enable_supplier_account">启用</button>
<button type="button" class="layui-btn layui-btn-sm" id="disable_supplier_account">禁用</button>
</div>
<table class="layui-table" id="supplierAccountList" lay-filter="supplierAccountList"></table>
</div>
<script>
</script>
......@@ -38,9 +38,12 @@
合作类型 :{{$supplier['stockup_type_name']}}
</div>
<div class="layui-col-md5">
<div class="layui-col-md2">
采购员 : {{$supplier['channel_username']}}
</div>
<div class="layui-col-md3">
云芯采购员 : {{$supplier['yunxin_channel_username']}}
</div>
<div class="layui-col-md3"></div>
</div>
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING
......
......@@ -59,9 +59,12 @@
<div class="layui-col-md2">
合作类型:{{$supplier['stockup_type_name']}}
</div>
<div class="layui-col-md5">
<div class="layui-col-md2">
采购员 : {{$supplier['channel_username']}}
</div>
<div class="layui-col-md3">
云芯采购员 : {{$supplier['yunxin_channel_username']}}
</div>
<div class="layui-col-md3"></div>
</div>
<div class="layui-row" style="margin-bottom: 25px;margin-top: 5px">
......
<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="id" value="{{$account['id']}}">
<div class="layui-form-item">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_code','供应商选择 : ',!empty($account['supplier_code'])?$account['supplier_code']:null,
$supplierCodes,['required'=>true,'width'=>'400px']) !!}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>登录账号 : </label>
<div class="layui-input-block">
<input type="text" name="mobile" id="mobile"
disabled
placeholder="请输入登录账号" class="layui-input layui-disabled"
value="{{$account['mobile'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>账号密码 : </label>
<div class="layui-input-block">
<input type="text" name="password_raw" id="password_raw"
placeholder="请输入账号密码" class="layui-input"
value="{{$account['password_raw'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>账号类型 : </label>
<div class="layui-input-block">
<input type="checkbox" name="a_type" title="云芯商家" lay-skin="primary" @if(!empty($account['a_type'])&&$account['a_type']==1) checked @endif>
</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="addSupplierAccount">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-warm" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
......@@ -13,6 +13,9 @@
@if(checkPerm('DeleteSupplierContact'))
<button type="button" class="layui-btn layui-btn-sm" id="batchDelete">删除</button>
@endif
@if(checkPerm('SetYunxinChannelUser'))
<button type="button" class="layui-btn layui-btn-sm" id="set_yunxin_channel_user">设置云芯采购</button>
@endif
</div>
@endif
<table class="layui-table" lay-filter="contactList" id="contactList"></table>
......
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