Commit 1bf54d9f by 杨树贤

修复各种bug

parent f4887d4c
......@@ -8,6 +8,7 @@ use App\Http\Services\PurchaseRemarkService;
use App\Http\Transformers\PurchaseRemarkTransformer;
use App\Model\LogModel;
use App\Model\PurchaseRemarkModel;
use Carbon\Carbon;
use Illuminate\Http\Request;
class PurchaseRemarkApiController extends Controller
......@@ -42,17 +43,20 @@ class PurchaseRemarkApiController extends Controller
$supplierId = $request->input('supplier_id');
$remark = $request->input('remark');
if (!$supplierId) {
$this->response(-1,'供应商id不能为空');
$this->response(-1, '供应商id不能为空');
}
if (!$participateContent) {
$this->response(-1,'参与内容不能为空');
if ($request->input('participate_type') != 1) {
if (!$participateContent) {
$this->response(-1, '参与内容不能为空');
}
}
if (!$startTime || !$endTime) {
$this->response(-1,'开始和结束时间都不能为空');
$this->response(-1, '开始和结束时间都不能为空');
}
if (!$remark) {
$this->response(-1,'备注内容不能为空');
$this->response(-1, '备注内容不能为空');
}
$remark = $request->only([
......@@ -65,12 +69,15 @@ class PurchaseRemarkApiController extends Controller
'remark',
]);
$remark['start_time'] = strtotime($remark['start_time']);
if ($remark['start_time'] < time()) {
$this->response(-1,'开始时间不能低于当前日期');
if ($remark['start_time'] < Carbon::now()->startOfDay()->timestamp) {
$this->response(-1, '开始时间不能低于当前日期');
}
$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();
$result = $remarkService->savePurchaseRemark($id,$remark);
$result = $remarkService->savePurchaseRemark($id, $remark);
if (!$result) {
$this->response(-1, '操作失败');
} else {
......
......@@ -55,6 +55,7 @@ class ShippingCostRulerApiController extends Controller
'order_amount',
'shipping_cost',
'currency',
'condition',
'ruler_text',
]);
$rulerService = new ShippingCostRulerService();
......
......@@ -10,17 +10,17 @@ use App\Model\ShippingCostRulerModel;
class ShippingCostRulerService
{
public function saveShippingCostRuler($remarkId,$remark)
public function saveShippingCostRuler($rulerId,$ruler)
{
$remarkModel = new ShippingCostRulerModel();
if (empty($remarkId)) {
$remark['create_uid'] = request()->user->userId;
$remark['create_name'] = request()->user->name;
$remark['create_time'] = time();
return $remarkModel->insertGetId($remark);
$rulerModel = new ShippingCostRulerModel();
if (empty($rulerId)) {
$ruler['create_uid'] = request()->user->userId;
$ruler['create_name'] = request()->user->name;
$ruler['create_time'] = time();
return $rulerModel->insertGetId($ruler);
} else {
$remark['update_time'] = time();
return $remarkModel->where('id', $remarkId)->update($remark)?$remarkId:0;
$ruler['update_time'] = time();
return $rulerModel->where('id', $rulerId)->update($ruler)?$rulerId:0;
}
}
......
......@@ -34,9 +34,14 @@
setConditionCurrencyName(data.value);
setRulerText();
});
let condition = $('#condition').val();
form.on('select(condition)', function (data) {
condition = data.value;
setConditionCurrencyName(currency);
setRulerText();
});
function setRulerText(){
let condition = $('#condition').val();
let conditionName = condition == 1 ? '小于' : '大于等于';
//订单金额小于¥100.00,收取运费¥5.00;
let rulerText = '';
......
......@@ -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({
elem: '#purchaseRemarkList',
url: '/api/purchase_remark/GetPurchaseRemarkList',
......@@ -30,17 +43,7 @@
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
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: '备注内容',},
]],
cols: [cols],
id: 'purchaseRemarkList',
page: {},
});
......@@ -61,7 +64,6 @@
table.on('tool(purchaseRemarkList)', function (obj) {
let data = obj.data;
console.log(data);
let layEvent = obj.event;
if (layEvent === 'edit') {
layer.open({
......@@ -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({
elem: '#shippingCostRulerList',
......@@ -103,11 +112,7 @@
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{field: 'operate', title: '操作', fixed: 'left', width: 130, templet: '#operate'},
{field: 'id', title: '规则', width: 80},
{field: 'ruler_text', title: '内容',},
]],
cols: [cols],
id: 'shippingCostRulerList',
page: {},
});
......
......@@ -10,6 +10,7 @@
@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]) !!}
</div>
<input type="hidden" name="id" value="{{$remark['id'] or ''}}">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>参与内容 : </label>
<div class="layui-input-block">
......
......@@ -6,6 +6,7 @@
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<input type="hidden" name="id" value="{{$ruler['id'] or ''}}">
<div class="layui-form-item">
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('currency','订单币种 :',!empty($ruler)?$ruler['currency']:1,config('field.ShippingCostRulerCurrency'),['required'=>true]) !!}
......@@ -14,10 +15,10 @@
<label class="layui-form-label"><span style="color: red">*</span>单笔订单金额</label>
<div class="layui-input-block" style="max-height: 30px">
<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)
<option value="{{$key}}"
@if(!empty($ruler)&&$ruler['condition']==$key) checked @endif
@if(!empty($ruler)&&$ruler['condition']==$key) checked selected='selected' @endif
>{{$name}}</option>
@endforeach
</select>
......
......@@ -344,6 +344,9 @@
@endif
>
<div class="layui-row" style="padding-bottom: 10px">
@include('web.supplier.SupplierRuler')
<blockquote class="layui-elem-quote layui-text">
<b>采购附加费设置</b>
</blockquote>
......
<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>
{{--运费规则--}}
......@@ -20,7 +21,7 @@
<table class="layui-table" lay-filter="purchaseRemarkList" id="purchaseRemarkList"></table>
</div>
<div>
<div @if($operate=="detail") style="display: none" @endif>
<blockquote class="layui-elem-quote layui-text">
<b>采购附加费设置</b>
</blockquote>
......@@ -64,72 +65,74 @@
</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_ratio" value="{{$supplier['cn_ratio'] or 1}}"
placeholder="请输入人民币系数" autocomplete="off" class="layui-input"
style="display: inline-block">
</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">
<blockquote class="layui-elem-quote layui-text">
</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_ratio" value="{{$supplier['cn_ratio'] or 1}}"
placeholder="请输入人民币系数" autocomplete="off" class="layui-input"
style="display: inline-block">
</div>
</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 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>
<div class="layui-inline">
<label class="layui-form-label">香港交期</label>
<div class="layui-input-inline" style="width: 50px">
<input type="text" name="us_delivery_time" value="{{$supplier['us_delivery_time'] or 1}}"
autocomplete="off" class="layui-input">
<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 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 class="layui-input-inline" style="width: 50px">
<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 class="layui-inline">
<label class="layui-form-label">香港交期</label>
<div class="layui-input-inline" style="width: 50px">
<input type="text" name="us_delivery_time" value="{{$supplier['us_delivery_time'] or 1}}"
autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 50px">
<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>
<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>
<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')
\ 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