Commit 21169948 by 杨树贤

云芯设置

parent 1173a10a
......@@ -705,4 +705,15 @@ class SupplierApiController extends Controller
$this->response(0, '申请审核成功');
}
//判断是否有阶梯价设置
public function checkHasLadderPriceSetting($request)
{
$supplierId = $request->get('supplier_id');
$exists = SupplierService::checkHasLadderPriceSetting($supplierId);
if ($exists) {
$this->response(0, 'ok');
}
$this->response(-1, '不存在');
}
}
......@@ -650,4 +650,13 @@ class SupplierService
return $validator->checkSave($supplier, true);
}
//检验供应商是否有设置对应的阶梯价格系数
public static function checkHasLadderPriceSetting($supplierId)
{
$supplierCode = SupplierChannelModel::where('supplier_id',$supplierId)->value('supplier_code');
$redis = new RedisModel();
$rule = $redis->hget('magic_cube_price_rule', $supplierCode);
return (bool)$rule;
}
}
\ No newline at end of file
......@@ -16,6 +16,14 @@
}
});
//不让选,也不隐藏
form.on('checkbox(stockup_type_filter)', function (data) {
if (data.elem.checked && data.elem.name === "stockup_type[5]") {
layer.msg('新增供应商没法设置为云芯账号类型,设置云芯账号要先去魔方系统配置阶梯系数', {icon: 5})
$('input[name="stockup_type[5]"]').next().click();
}
});
//图片上传
upload.render({
elem: '.upload-img'
......
......@@ -11,6 +11,35 @@
});
//点击云芯
form.on('checkbox(stockup_type_filter)', function (data) {
if (data.elem.checked && data.elem.name === "stockup_type[5]") {
let url = '/api/supplier/checkHasLadderPriceSetting?supplier_id=' + getQueryVariable('supplier_id');
let elem = data.elem;
let self = $(this);
$.ajax({
url: url,
type: 'POST',
async: true,
data: data.field,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (res.err_code === 0) {
} else {
layer.msg('请先去魔方系统配置阶梯系数,再新建云芯账号', {icon: 5})
$('input[name="stockup_type[5]"]').next().click();
}
},
error: function () {
layer.msg('网络错误', {icon: 5});
}
});
}
});
form.on('submit(updateSupplier)', function (data) {
let confirmMessage = '';
if (data.field.status === '-2') {
......
......@@ -236,7 +236,6 @@
dataType: 'json',
timeout: 10000,
success: function (res) {
console.log(res)
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.err_code === 0) {
cb(res.data, res.last_page);
......
......@@ -235,7 +235,7 @@
<input type="hidden" name="stockup_type"
value="{{$supplier['stockup_type'] or ''}}">
@foreach(config('fixed.StockupType') as $k=>$type)
<input type="checkbox" name="stockup_type[{{$k}}]"
<input type="checkbox" name="stockup_type[{{$k}}]" lay-filter="stockup_type_filter"
lay-skin="primary"
title="{{$type}}">
@endforeach
......
......@@ -244,10 +244,8 @@
<div class="layui-inline">
<label class="layui-form-label"><span class="require">*</span>合作类型</label>
<div class="layui-input-block">
{{-- <input type="hidden" name="stockup_type"--}}
{{-- value="{{$supplier['stockup_type'] or ''}}">--}}
@foreach(config('fixed.StockupType') as $k=>$type)
<input type="checkbox" name="stockup_type[{{$k}}]"
<input type="checkbox" lay-filter="stockup_type_filter" name="stockup_type[{{$k}}]"
lay-skin="primary"
@if(!empty($supplier['stockup_type_data'])&&in_array($k,$supplier['stockup_type_data']))
checked
......
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