Commit 3a27b127 by mushishixian

修改bug

parent cfdd2850
...@@ -12,6 +12,7 @@ use App\Http\Services\SyncSupplierService; ...@@ -12,6 +12,7 @@ use App\Http\Services\SyncSupplierService;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Http\Validators\SupplierValidator; use App\Http\Validators\SupplierValidator;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\RedisModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
...@@ -157,6 +158,10 @@ class SupplierApiController extends Controller ...@@ -157,6 +158,10 @@ class SupplierApiController extends Controller
//禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易 //禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//先保存原来的状态
$supplier = $model->where('supplier_id', $supplierId)->first()->toArray();
$redis = new RedisModel();
$redis->hset('supplier_status_before_disable', $supplierId, $supplier['status']);
$result = $model->where('supplier_id', $supplierId)->update([ $result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(), 'update_time' => time(),
'status' => $model::STATUS_DISABLE, 'status' => $model::STATUS_DISABLE,
...@@ -418,13 +423,13 @@ class SupplierApiController extends Controller ...@@ -418,13 +423,13 @@ class SupplierApiController extends Controller
if (empty($blockReason)) { if (empty($blockReason)) {
$this->response(-1, '必须填写拉黑原因'); $this->response(-1, '必须填写拉黑原因');
} }
if (mb_strlen($blockReason)>200) { if (mb_strlen($blockReason) > 200) {
$this->response(-1, '拉黑原因不能超过200字'); $this->response(-1, '拉黑原因不能超过200字');
} }
$channelModel = new SupplierChannelModel(); $channelModel = new SupplierChannelModel();
$result = $channelModel->where('supplier_id', $supplierId)->update([ $result = $channelModel->where('supplier_id', $supplierId)->update([
'block_reason' => $request->get('block_reason'), 'block_reason' => $request->get('block_reason'),
'status' => -3, 'status' => $channelModel::STATUS_BLOCK,
'update_time' => time(), 'update_time' => time(),
]); ]);
...@@ -460,11 +465,16 @@ class SupplierApiController extends Controller ...@@ -460,11 +465,16 @@ class SupplierApiController extends Controller
{ {
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$channelModel = new SupplierChannelModel(); $channelModel = new SupplierChannelModel();
//先找出原来的状态
$redis = new RedisModel();
$previousStatus = $redis->hget('supplier_status_before_disable', $supplierId);
$result = $channelModel->where('supplier_id', $supplierId)->update([ $result = $channelModel->where('supplier_id', $supplierId)->update([
'status' => 2, 'status' => $previousStatus,
'update_time' => time(), 'update_time' => time(),
]); ]);
if ($result) { if ($result) {
//删除redis状态
$redis->hdel('supplier_status_before_disable', $supplierId);
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '取消禁用', '取消禁用供应商'); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '取消禁用', '取消禁用供应商');
$this->response(0, '取消禁用成功'); $this->response(0, '取消禁用成功');
......
...@@ -178,7 +178,9 @@ class SupplierAuditService ...@@ -178,7 +178,9 @@ class SupplierAuditService
'province_id', 'province_id',
'city_id', 'city_id',
'established_time', 'established_time',
'credit_investigation' 'credit_investigation',
'system_tags',
'customer_tags',
]; ];
//先找出目前数据库里面的数据 //先找出目前数据库里面的数据
$selectField = array_keys($channel); $selectField = array_keys($channel);
...@@ -205,7 +207,6 @@ class SupplierAuditService ...@@ -205,7 +207,6 @@ class SupplierAuditService
$changeField[] = $key; $changeField[] = $key;
} }
} }
foreach ($changeField as $filed) { foreach ($changeField as $filed) {
//只要有一个不存在于不需要审核的字段,就返回需要审核 //只要有一个不存在于不需要审核的字段,就返回需要审核
if (!in_array($filed, $notNeedAuditField)) { if (!in_array($filed, $notNeedAuditField)) {
......
...@@ -82,7 +82,11 @@ ...@@ -82,7 +82,11 @@
} }
}, },
{ {
field: 'quality_assurance_agreement', title: '品质协议', align: 'center', width: 80, templet: function (data) { field: 'quality_assurance_agreement',
title: '品质协议',
align: 'center',
width: 80,
templet: function (data) {
if (data.attachment) { if (data.attachment) {
return data.attachment.quality_assurance_agreement ? '有' : '无'; return data.attachment.quality_assurance_agreement ? '有' : '无';
} }
...@@ -407,7 +411,7 @@ ...@@ -407,7 +411,7 @@
const status = data[0].status; const status = data[0].status;
const hasSku = data[0].sku_num; const hasSku = data[0].sku_num;
const needReview = data[0].need_review; const needReview = data[0].need_review;
if (needReview === 1) { if (needReview === 1 && status !== 0) {
layer.msg("该供应商还没有进行复审,不能直接禁用;", {icon: 5}) layer.msg("该供应商还没有进行复审,不能直接禁用;", {icon: 5})
return; return;
} }
......
...@@ -87,8 +87,14 @@ ...@@ -87,8 +87,14 @@
</button> </button>
@endif @endif
@endif @endif
<a href="/supplier/PrintSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}" @if (checkPerm('PrintSupplier'))
target="_blank" style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">打印</a> {{--禁用和黑名单不显示打印按钮--}}
@if($supplier['status']== \App\Model\SupplierChannelModel::STATUS_DISABLE || $supplier['status']== \App\Model\SupplierChannelModel::STATUS_BLOCK)
@else
<a href="/supplier/PrintSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}"
target="_blank" style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">打印</a>
@endif
@endif
</div> </div>
</div> </div>
<div class="layui-card-body" style="margin-top: 140px"> <div class="layui-card-body" style="margin-top: 140px">
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
@include('web.supplier.SupplierFile') @include('web.supplier.SupplierFile')
@if($operate!='add') @if($operate!='add' && checkPerm('UpdateSupplierTags'))
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>供应商标签 : </b> <b>供应商标签 : </b>
</blockquote> </blockquote>
......
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