Commit 2cf1da52 by mushishixian

修复

parent 40a2d47b
......@@ -124,12 +124,18 @@ class SupplierContactApiController extends Controller
if (!$result) {
$this->response(-1, '删除失败');
}
//修改为审核状态
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
]);
$supplierStatus = $supplierModel->where('supplier_id', $contact['supplier_id'])->value('status');
//不等于-1的时候是第一次新增供应商,单独操作联系人,不需要修改状态
if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) {
//修改为审核状态
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
]);
}
$logService = new LogService();
$content = '删除联系人';
$remark = json_encode(['old_contact' => $contact, 'new_contact' => []]);
......
......@@ -67,12 +67,17 @@ class SupplierReceiptApiController extends Controller
$result = $model->insert($receipt);
}
if ($result) {
//供应商变成待审核
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => 1,
]);
$supplierStatus = $supplierModel->where('supplier_id',$supplierId)->value('status');
//不等于-1的时候是第一次新增供应商,单独银行信息,不需要修改状态
if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) {
//供应商变成待审核
$supplierModel = new SupplierChannelModel();
$supplierModel->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => 1,
]);
}
$logService = new LogService();
$content = !empty($receipt['receipt_id']) ? '修改银行信息' : '添加银行信息';
$remark = json_encode($receipt);
......
......@@ -58,7 +58,7 @@ class LogService
$newSupplier = $transformer->transformInfo($newSupplier);
$oldSupplier = $transformer->transformInfo($oldSupplier);
}
unset($newSupplier['update_time'], $oldSupplier['update_time']);
//二维数组转成一维数组,因为array_diff只支持一维,反正二维的内容还要更细致的比较
$newSupplier = array_map(function ($value) {
if (is_array($value)) {
......@@ -120,15 +120,13 @@ class LogService
$result[] = $content;
}
if ($key == 'extra_fee') {
if (!empty($oldSupplier['extra_fee'])) {
$oldFee = json_decode($oldSupplier['extra_fee'], true);
$newFee = json_decode($newSupplier['extra_fee'], true);
$content = "采购附加费由 [商品总价不满" . $oldFee['cn']['max'] . "元,收取" . $oldFee['cn']['price'] . "元;商品总价不满" .
$oldFee['cn']['max'] . "美金,收取" . $oldFee['cn']['price'] .
"元;] 修改为 [商品总价不满" . $newFee['hk']['max'] . "元,收取" . $newFee['hk']['price'] . "元;商品总价不满" .
$newFee['hk']['max'] . "美金,收取" . $newFee['hk']['price'] . "元;]";
$result[] = $content;
}
$oldFee = json_decode($oldSupplier['extra_fee'], true);
$newFee = json_decode($newSupplier['extra_fee'], true);
$content = "采购附加费由 [商品总价不满" . $oldFee['cn']['max'] . "元,收取" . $oldFee['cn']['price'] . "元;商品总价不满" .
$oldFee['cn']['max'] . "美金,收取" . $oldFee['cn']['price'] .
"元;] 修改为 [商品总价不满" . $newFee['hk']['max'] . "元,收取" . $newFee['hk']['price'] . "元;商品总价不满" .
$newFee['hk']['max'] . "美金,收取" . $newFee['hk']['price'] . "元;]";
$result[] = $content;
}
}
$result = array_unique($result);
......@@ -136,11 +134,6 @@ class LogService
return $result;
}
public function compareContactChange($oldContact, $newContact)
{
}
//获取修改联系人的变化内容
public function getContactDesc($contact)
......
......@@ -76,12 +76,15 @@ class SupplierContactService
//修改供应商为审核状态
$supplierModel = new SupplierChannelModel();
$supplierStatus = $supplierModel->where('supplier_id', $contact['supplier_id'])->value('status');
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
]);
//不等于-1的时候是第一次新增供应商,单独操作联系人,不需要修改状态
if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) {
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(),
'status' => 1,
]);
}
//待审核(没有完善过联系人的,不需要记录日志,让其继续保持一条日志,就叫新增供应商)
if ($supplierStatus != -1) {
if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) {
$logService = new LogService();
$content = !empty($contact['contact_id'])?'修改联系人':'添加联系人';
$remark = json_encode([
......
......@@ -10,6 +10,10 @@ class SupplierExtraFeeService
public function saveSupplierExtraFee($extraFee)
{
$supplierExtendFee = [];
if (empty($extraFee['cn']['max']) && empty($extraFee['cn']['price'])
&& empty($extraFee['hk']['max']) && empty($extraFee['hk']['price'])) {
return true;
}
if (!empty($extraFee['cn'])) {
$supplierExtendFee['cn'] = $extraFee['cn'];
}
......@@ -19,7 +23,6 @@ class SupplierExtraFeeService
if (empty($supplierExtendFee)) {
return true;
}
$model = new SupplierExtendModel();
$cache = $model->getExtendExtra($extraFee['supplier_code'], $extraFee['supplier_id']);
$extraFee['charge_content'] = json_encode($supplierExtendFee);
......
......@@ -144,11 +144,16 @@ class SupplierService
$newSupplier = $supplierTransformer->transformInfo($newSupplier);
$logType = !empty($channel['supplier_id']) ? LogModel::UPDATE_OPERATE : LogModel::ADD_OPERATE;
$logAction = !empty($channel['supplier_id']) ? "修改供应商基本资料" : "新增供应商";
$logContent = !empty($channel['supplier_id']) ? '修改供应商' : '新增供应商';
$logContent = !empty($channel['supplier_id']) ? '修改供应商' : '新增供应商基础信息';
//判断是不是申请入驻
if (!empty($oldSupplier['status']) && $oldSupplier['status'] === -2) {
if (!empty($oldSupplier['status']) && $oldSupplier['status'] == -2) {
$logAction = "申请重新入驻";
}
if (!empty($oldSupplier['status']) && $oldSupplier['status'] == -1) {
$logType = 2;
$logAction = '新增供应商';
$logContent = '确认新增供应商';
}
$logService->AddLog($this->newSupplierId, $logType, $logAction, $logContent, json_encode([
'old_supplier' => $oldSupplier,
'new_supplier' => $newSupplier
......
......@@ -36,6 +36,7 @@ class LogTransformer
if (!is_array($item['content'])&&strpos($item['content'], '联系') !== false) {
$item['content'] = $item['content'] .':'.$logService->getContactDesc($item['remark']);
}
$item['content'] = $item['content'] ?: '没有内容变化';
}
return $item;
}
......
......@@ -5,6 +5,7 @@ namespace App\Http\Transformers;
use App\Http\Services\AdminUserService;
use App\Http\Services\SupplierService;
use App\Http\Services\SupplierSkuAuditRulerService;
use App\Http\Services\SupplierSkuUploadRulerService;
use App\Http\Services\ViewCheckService;
......@@ -13,6 +14,7 @@ use App\Model\LogModel;
use App\Model\RedisModel;
use App\Model\SupplierContactModel;
use App\Model\SupplierExtendModel;
use function Sodium\add;
class SupplierTransformer
{
......@@ -113,12 +115,15 @@ class SupplierTransformer
$ExtendModel = new SupplierExtendModel();
//获取该supplier_code对应的数据
$supplier['extra_fee'] = $ExtendModel->getExtendExtra($supplier['supplier_code'], $supplier['supplier_id']);
//获取供应商地址信息
$supplier = $this->getSupplierAddress($supplier);
//获取最近修改信息
$logModel = new LogModel();
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
->where('type', LogModel::UPDATE_OPERATE)->orderBy('id', 'desc')->first();
$supplier['last_update_name'] = $log['admin_name']?:'无';
$supplier['last_update_time'] = !empty($supplier['last_update_time']) ? date('Y-m-d H:i:s', $log['add_time']) : '无';
$supplier['last_update_name'] = $log['admin_name'] ?: '无';
$supplier['last_update_time'] = !empty($supplier['last_update_time']) ? date('Y-m-d H:i:s',
$log['add_time']) : '无';
return $supplier;
}
......@@ -135,6 +140,17 @@ class SupplierTransformer
return $supplier;
}
private function getSupplierAddress($supplier)
{
$supplierService = new SupplierService();
$address = $supplierService->getAddress($supplier['supplier_id']);
$supplier['shipping_address'] = array_get($address, 'shipping_address', '');
$supplier['return_address'] = array_get($address, 'return_address', '');
$supplier['return_consignee'] = array_get($address, 'return_consignee', '');
$supplier['return_phone'] = array_get($address, 'return_phone', '');
return $supplier;
}
private function getPhotosDataForForm($photos)
{
if (empty($photos)) {
......
......@@ -40,5 +40,9 @@ return [
'purchase_username' => '渠道开发员',
'us_delivery_time_full' => '香港交期',
'cn_delivery_time_full' => '国内交期',
'shipping_address' => '发货地址',
'return_address' => '退货地址',
'return_phone' => '退货收货人电话 ',
'return_consignee' => '退货收货人',
]
];
\ No newline at end of file
......@@ -18,13 +18,15 @@
let confirmMessage = '';
if (data.field.status === '-2') {
confirmMessage = '确定要重新入驻吗,该供应商就会再次进入审核阶段'
} else if (data.field.status === '-1') {
confirmMessage = '确定要提交新增供应商信息吗?一旦提交,该供应商就会进入审核中阶段,审核过程中无法进行信息修改'
} else {
confirmMessage = '确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核阶段'
confirmMessage = '确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'
}
layer.confirm(confirmMessage, function (index) {
let res = ajax('/api/supplier/UpdateSupplier', data.field)
if (res.err_code === 0) {
admin.putTempData("needFreshList",1)
admin.putTempData("needFreshList", 1)
table.reload('receiptList')
location.href = "/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer.msg(res.err_msg, {icon: 6})
......
......@@ -65,9 +65,15 @@
<div class="layui-col-md3"></div>
</div>
<div class="layui-row" style="margin-bottom: 25px;margin-top: 5px">
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">提交
</button>
@if($supplier['status']==-1)
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">确认新建供应商
</button>
@else
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">确认修改供应商
</button>
@endif
<a id="supplierDetailUrl"
href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
class="layui-btn layui-btn-primary">取消</a>
......
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