Commit 1bf54d9f by 杨树贤

修复各种bug

parent f4887d4c
...@@ -8,6 +8,7 @@ use App\Http\Services\PurchaseRemarkService; ...@@ -8,6 +8,7 @@ use App\Http\Services\PurchaseRemarkService;
use App\Http\Transformers\PurchaseRemarkTransformer; use App\Http\Transformers\PurchaseRemarkTransformer;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\PurchaseRemarkModel; use App\Model\PurchaseRemarkModel;
use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class PurchaseRemarkApiController extends Controller class PurchaseRemarkApiController extends Controller
...@@ -42,17 +43,20 @@ class PurchaseRemarkApiController extends Controller ...@@ -42,17 +43,20 @@ class PurchaseRemarkApiController extends Controller
$supplierId = $request->input('supplier_id'); $supplierId = $request->input('supplier_id');
$remark = $request->input('remark'); $remark = $request->input('remark');
if (!$supplierId) { if (!$supplierId) {
$this->response(-1,'供应商id不能为空'); $this->response(-1, '供应商id不能为空');
} }
if (!$participateContent) { if ($request->input('participate_type') != 1) {
$this->response(-1,'参与内容不能为空'); if (!$participateContent) {
$this->response(-1, '参与内容不能为空');
}
} }
if (!$startTime || !$endTime) { if (!$startTime || !$endTime) {
$this->response(-1,'开始和结束时间都不能为空'); $this->response(-1, '开始和结束时间都不能为空');
} }
if (!$remark) { if (!$remark) {
$this->response(-1,'备注内容不能为空'); $this->response(-1, '备注内容不能为空');
} }
$remark = $request->only([ $remark = $request->only([
...@@ -65,12 +69,15 @@ class PurchaseRemarkApiController extends Controller ...@@ -65,12 +69,15 @@ class PurchaseRemarkApiController extends Controller
'remark', 'remark',
]); ]);
$remark['start_time'] = strtotime($remark['start_time']); $remark['start_time'] = strtotime($remark['start_time']);
if ($remark['start_time'] < time()) { if ($remark['start_time'] < Carbon::now()->startOfDay()->timestamp) {
$this->response(-1,'开始时间不能低于当前日期'); $this->response(-1, '开始时间不能低于当前日期');
} }
$remark['end_time'] = strtotime($remark['end_time']); $remark['end_time'] = strtotime($remark['end_time']);
if ($remark['start_time'] > $remark['end_time'] || ($remark['start_time'] == $remark['end_time'])) {
$this->response(-1, '结束时间要大于开始时间,并且间隔要大于1天');
}
$remarkService = new PurchaseRemarkService(); $remarkService = new PurchaseRemarkService();
$result = $remarkService->savePurchaseRemark($id,$remark); $result = $remarkService->savePurchaseRemark($id, $remark);
if (!$result) { if (!$result) {
$this->response(-1, '操作失败'); $this->response(-1, '操作失败');
} else { } else {
......
...@@ -55,6 +55,7 @@ class ShippingCostRulerApiController extends Controller ...@@ -55,6 +55,7 @@ class ShippingCostRulerApiController extends Controller
'order_amount', 'order_amount',
'shipping_cost', 'shipping_cost',
'currency', 'currency',
'condition',
'ruler_text', 'ruler_text',
]); ]);
$rulerService = new ShippingCostRulerService(); $rulerService = new ShippingCostRulerService();
......
...@@ -10,17 +10,17 @@ use App\Model\ShippingCostRulerModel; ...@@ -10,17 +10,17 @@ use App\Model\ShippingCostRulerModel;
class ShippingCostRulerService class ShippingCostRulerService
{ {
public function saveShippingCostRuler($remarkId,$remark) public function saveShippingCostRuler($rulerId,$ruler)
{ {
$remarkModel = new ShippingCostRulerModel(); $rulerModel = new ShippingCostRulerModel();
if (empty($remarkId)) { if (empty($rulerId)) {
$remark['create_uid'] = request()->user->userId; $ruler['create_uid'] = request()->user->userId;
$remark['create_name'] = request()->user->name; $ruler['create_name'] = request()->user->name;
$remark['create_time'] = time(); $ruler['create_time'] = time();
return $remarkModel->insertGetId($remark); return $rulerModel->insertGetId($ruler);
} else { } else {
$remark['update_time'] = time(); $ruler['update_time'] = time();
return $remarkModel->where('id', $remarkId)->update($remark)?$remarkId:0; return $rulerModel->where('id', $rulerId)->update($ruler)?$rulerId:0;
} }
} }
......
...@@ -34,9 +34,14 @@ ...@@ -34,9 +34,14 @@
setConditionCurrencyName(data.value); setConditionCurrencyName(data.value);
setRulerText(); setRulerText();
}); });
let condition = $('#condition').val();
form.on('select(condition)', function (data) {
condition = data.value;
setConditionCurrencyName(currency);
setRulerText();
});
function setRulerText(){ function setRulerText(){
let condition = $('#condition').val();
let conditionName = condition == 1 ? '小于' : '大于等于'; let conditionName = condition == 1 ? '小于' : '大于等于';
//订单金额小于¥100.00,收取运费¥5.00; //订单金额小于¥100.00,收取运费¥5.00;
let rulerText = ''; let rulerText = '';
......
...@@ -18,7 +18,20 @@ ...@@ -18,7 +18,20 @@
} }
}); });
let isDetail = {{$operate==="update"?0:1}};
let cols = [
{
field: 'status', title: '状态', width: 80, templet: function (data) {
return data.status == 1 ? "<span style='color: red'>停用</span>" : '启用';
}
},
{field: 'participate_type_name', title: '参与类型', width: 140},
{field: 'duration', title: '开始时间 - 截至时间', width: 250},
{field: 'remark', title: '备注内容',},
];
if (!isDetail) {
cols.unshift({field: 'operate', title: '操作', width: 130, templet: '#operate'});
}
table.render({ table.render({
elem: '#purchaseRemarkList', elem: '#purchaseRemarkList',
url: '/api/purchase_remark/GetPurchaseRemarkList', url: '/api/purchase_remark/GetPurchaseRemarkList',
...@@ -30,17 +43,7 @@ ...@@ -30,17 +43,7 @@
loading: true, loading: true,
first: true,//不显示首页 first: true,//不显示首页
last: false,//不显示尾页 last: false,//不显示尾页
cols: [[ cols: [cols],
{field: 'operate', title: '操作', fixed: 'left', width: 130, templet: '#operate'},
{
field: 'status', title: '状态', width: 80, templet: function (data) {
return data.status == 1 ? "<span style='color: red'>停用</span>" : '启用';
}
},
{field: 'participate_type_name', title: '参与类型', width: 140},
{field: 'duration', title: '开始时间 - 截至时间', width: 250},
{field: 'remark', title: '备注内容',},
]],
id: 'purchaseRemarkList', id: 'purchaseRemarkList',
page: {}, page: {},
}); });
...@@ -61,7 +64,6 @@ ...@@ -61,7 +64,6 @@
table.on('tool(purchaseRemarkList)', function (obj) { table.on('tool(purchaseRemarkList)', function (obj) {
let data = obj.data; let data = obj.data;
console.log(data);
let layEvent = obj.event; let layEvent = obj.event;
if (layEvent === 'edit') { if (layEvent === 'edit') {
layer.open({ layer.open({
...@@ -91,6 +93,13 @@ ...@@ -91,6 +93,13 @@
} }
}); });
cols = [
{field: 'id', title: '规则', width: 80},
{field: 'ruler_text', title: '内容',},
];
if (!isDetail) {
cols.unshift({field: 'operate', title: '操作', width: 130, templet: '#operate'});
}
table.render({ table.render({
elem: '#shippingCostRulerList', elem: '#shippingCostRulerList',
...@@ -103,11 +112,7 @@ ...@@ -103,11 +112,7 @@
loading: true, loading: true,
first: true,//不显示首页 first: true,//不显示首页
last: false,//不显示尾页 last: false,//不显示尾页
cols: [[ cols: [cols],
{field: 'operate', title: '操作', fixed: 'left', width: 130, templet: '#operate'},
{field: 'id', title: '规则', width: 80},
{field: 'ruler_text', title: '内容',},
]],
id: 'shippingCostRulerList', id: 'shippingCostRulerList',
page: {}, page: {},
}); });
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter') @inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('participate_type','参与类型 :',!empty($remark)?$remark['participate_type']:1,config('field.PurchaseRemarkParticipateType'),['required'=>true,'disable' => !empty($remark)?true:false]) !!} {!! $singleSelectPresenter->render('participate_type','参与类型 :',!empty($remark)?$remark['participate_type']:1,config('field.PurchaseRemarkParticipateType'),['required'=>true,'disable' => !empty($remark)?true:false]) !!}
</div> </div>
<input type="hidden" name="id" value="{{$remark['id'] or ''}}">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>参与内容 : </label> <label class="layui-form-label"><span style="color: red">*</span>参与内容 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<form class="layui-form" action=""> <form class="layui-form" action="">
<input type="hidden" name="id" value="{{$ruler['id'] or ''}}">
<div class="layui-form-item"> <div class="layui-form-item">
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter') @inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('currency','订单币种 :',!empty($ruler)?$ruler['currency']:1,config('field.ShippingCostRulerCurrency'),['required'=>true]) !!} {!! $singleSelectPresenter->render('currency','订单币种 :',!empty($ruler)?$ruler['currency']:1,config('field.ShippingCostRulerCurrency'),['required'=>true]) !!}
...@@ -14,10 +15,10 @@ ...@@ -14,10 +15,10 @@
<label class="layui-form-label"><span style="color: red">*</span>单笔订单金额</label> <label class="layui-form-label"><span style="color: red">*</span>单笔订单金额</label>
<div class="layui-input-block" style="max-height: 30px"> <div class="layui-input-block" style="max-height: 30px">
<div class="layui-col-xs2"> <div class="layui-col-xs2">
<select name="condition" value="{{$ruler['condition'] or 1}}"> <select name="condition" value="{{$ruler['condition'] or 1}}" lay-filter="condition">
@foreach(config('field.ShippingCostRulerCondition') as $key => $name) @foreach(config('field.ShippingCostRulerCondition') as $key => $name)
<option value="{{$key}}" <option value="{{$key}}"
@if(!empty($ruler)&&$ruler['condition']==$key) checked @endif @if(!empty($ruler)&&$ruler['condition']==$key) checked selected='selected' @endif
>{{$name}}</option> >{{$name}}</option>
@endforeach @endforeach
</select> </select>
......
...@@ -344,6 +344,9 @@ ...@@ -344,6 +344,9 @@
@endif @endif
> >
<div class="layui-row" style="padding-bottom: 10px"> <div class="layui-row" style="padding-bottom: 10px">
@include('web.supplier.SupplierRuler')
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>采购附加费设置</b> <b>采购附加费设置</b>
</blockquote> </blockquote>
......
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>运费设置-国际运费<span style="color: orange;margin-left: 10px">PS:设置后的运费规则,将会应用在【询报价系统】供销售看到(仅做为提示)</span></b> <b>运费设置-国际运费<span
style="color: orange;margin-left: 10px">PS:设置后的运费规则,将会应用在【询报价系统】供销售看到(仅做为提示)</span></b>
</blockquote> </blockquote>
{{--运费规则--}} {{--运费规则--}}
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
<table class="layui-table" lay-filter="purchaseRemarkList" id="purchaseRemarkList"></table> <table class="layui-table" lay-filter="purchaseRemarkList" id="purchaseRemarkList"></table>
</div> </div>
<div> <div @if($operate=="detail") style="display: none" @endif>
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>采购附加费设置</b> <b>采购附加费设置</b>
</blockquote> </blockquote>
...@@ -64,72 +65,74 @@ ...@@ -64,72 +65,74 @@
</div> </div>
</div> </div>
</div> </div>
<blockquote class="layui-elem-quote layui-text">
<b>采购价格系数调整</b> <blockquote class="layui-elem-quote layui-text">
</blockquote> </blockquote>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">人民币系数</label> <label class="layui-form-label">人民币系数</label>
<div class="layui-input-inline" style="width: 50px"> <div class="layui-input-inline" style="width: 50px">
<input type="text" name="cn_ratio" value="{{$supplier['cn_ratio'] or 1}}" <input type="text" name="cn_ratio" value="{{$supplier['cn_ratio'] or 1}}"
placeholder="请输入人民币系数" autocomplete="off" class="layui-input" placeholder="请输入人民币系数" autocomplete="off" class="layui-input"
style="display: inline-block"> style="display: inline-block">
</div> </div>
</div>
<div class="layui-inline">
<label class="layui-form-label">美金系数</label>
<div class="layui-input-inline" style="width: 50px">
<input type="text" name="us_ratio" value="{{$supplier['us_ratio'] or 1}}"
placeholder="请输入采购附加费" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
基数为1,如利润为10%,请填写1.1
</div>
</div>
</div>
<blockquote class="layui-elem-quote layui-text">
<b>货期调整</b>
</blockquote>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">大陆交期</label>
<div class="layui-input-inline" style="width: 50px">
<input type="text" name="cn_delivery_time" value="{{$supplier['cn_delivery_time'] or 1}}"
autocomplete="off" class="layui-input">
</div> </div>
<div class="layui-input-inline" style="width: 50px"> <div class="layui-inline">
<select name="cn_delivery_time_period"> <label class="layui-form-label">美金系数</label>
<option value="天" @if($supplier['cn_delivery_time_period'] == '天') selected @endif></option> <div class="layui-input-inline" style="width: 50px">
<option value="周" @if($supplier['cn_delivery_time_period'] == '周') selected @endif></option> <input type="text" name="us_ratio" value="{{$supplier['us_ratio'] or 1}}"
</select> placeholder="请输入采购附加费" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
基数为1,如利润为10%,请填写1.1
</div>
</div> </div>
</div> </div>
<div class="layui-inline"> <blockquote class="layui-elem-quote layui-text">
<label class="layui-form-label">香港交期</label> <b>货期调整</b>
<div class="layui-input-inline" style="width: 50px"> </blockquote>
<input type="text" name="us_delivery_time" value="{{$supplier['us_delivery_time'] or 1}}" <div class="layui-form-item">
autocomplete="off" class="layui-input"> <div class="layui-inline">
<label class="layui-form-label">大陆交期</label>
<div class="layui-input-inline" style="width: 50px">
<input type="text" name="cn_delivery_time" value="{{$supplier['cn_delivery_time'] or 1}}"
autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 50px">
<select name="cn_delivery_time_period">
<option value="天" @if($supplier['cn_delivery_time_period'] == '天') selected @endif></option>
<option value="周" @if($supplier['cn_delivery_time_period'] == '周') selected @endif></option>
</select>
</div>
</div> </div>
<div class="layui-input-inline" style="width: 50px"> <div class="layui-inline">
<select name="us_delivery_time_period"> <label class="layui-form-label">香港交期</label>
<option value="天" @if($supplier['us_delivery_time_period'] == '天') selected @endif></option> <div class="layui-input-inline" style="width: 50px">
<option value="周" @if($supplier['us_delivery_time_period'] == '周') selected @endif></option> <input type="text" name="us_delivery_time" value="{{$supplier['us_delivery_time'] or 1}}"
</select> autocomplete="off" class="layui-input">
</div> </div>
<div class="layui-form-mid layui-word-aux"> <div class="layui-input-inline" style="width: 50px">
单位为工作日,周。格式2-6工作日,1-2周 <select name="us_delivery_time_period">
<option value="天" @if($supplier['us_delivery_time_period'] == '天') selected @endif></option>
<option value="周" @if($supplier['us_delivery_time_period'] == '周') selected @endif></option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">
单位为工作日,周。格式2-6工作日,1-2周
</div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/html" id="shippingCostOperate">
<button class="layui-btn layui-btn-xs" type="button" lay-event="edit">查看</button>
<button class="layui-btn layui-btn-xs layui-btn-danger" type="button" lay-event="delete">删除</button>
</script>
<script type="text/html" id="operate">
<button class="layui-btn layui-btn-xs" type="button" lay-event="edit">查看</button>
<button class="layui-btn layui-btn-xs layui-btn-danger" type="button" lay-event="delete">删除</button>
</script>
</div> </div>
<script type="text/html" id="shippingCostOperate">
<button class="layui-btn layui-btn-xs" type="button" lay-event="edit">查看</button>
<button class="layui-btn layui-btn-xs layui-btn-danger" type="button" lay-event="delete">删除</button>
</script>
<script type="text/html" id="operate">
<button class="layui-btn layui-btn-xs" type="button" lay-event="edit">查看</button>
<button class="layui-btn layui-btn-xs layui-btn-danger" type="button" lay-event="delete">删除</button>
</script>
@include('script.supplier.SupplierRulerScript') @include('script.supplier.SupplierRulerScript')
\ 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