完成供应链平台后台功能添加,编辑
This commit is contained in:
parent
a6fd1e14f8
commit
09048ec2e5
@ -10,6 +10,10 @@ use app\admin\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
|
||||
@ -63,15 +67,12 @@ class Index extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
$total = AreaManagerModel::where($where)->count();
|
||||
$total = SupplyChain::where($where)->count();
|
||||
|
||||
// 负责人信息
|
||||
$list = AreaManagerModel::with('area')
|
||||
->where($where)
|
||||
->page($params['page'])
|
||||
->limit($params['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
$list = SupplyChain::order('id desc')->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
|
||||
$result = ['total' => $total, 'data' => $list];
|
||||
|
||||
@ -79,7 +80,11 @@ class Index extends BaseController
|
||||
|
||||
}else{
|
||||
|
||||
return view('nk/areamanager/index',['url'=>$this->url]);
|
||||
$list = SupplyChain::select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,20 +97,37 @@ class Index extends BaseController
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params= get_params();
|
||||
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['avatar'] = $params['avatar']; // 头像
|
||||
$data['name'] = $params['name']; // 姓名
|
||||
$data['duty'] = $params['duty']; // 职务
|
||||
$data['phone'] = $params['phone']; // 手机号
|
||||
$data['area_id'] = $params['area_id']; // 区域ID
|
||||
$params = get_params();
|
||||
|
||||
$area = AreaModel::find($params['area_id']);
|
||||
$data['farm_product_market_id'] = $area->id; // 市场ID
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
|
||||
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据入库
|
||||
$res = SupplyChain::create($data);
|
||||
|
||||
$data['created_at'] = date('Y-m-d H:i:s');
|
||||
$res = AreaManagerModel::create($data);
|
||||
// 关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'mer_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$res->linkMerchant()->save($dataLink); // 插入关联数据
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
@ -115,14 +137,16 @@ class Index extends BaseController
|
||||
|
||||
}else{
|
||||
|
||||
$area = AreaModel::where('status', 0)->column('id, area_name');
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
View::assign('area', $area);
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
@ -134,6 +158,21 @@ class Index extends BaseController
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
|
||||
|
||||
View::assign('detail', $supplyChain);
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
@ -146,5 +185,5 @@ class Index extends BaseController
|
||||
{
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
}
|
26
app/admin/model/GeoArea.php
Normal file
26
app/admin/model/GeoArea.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 地区 区域模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class GeoArea extends Model
|
||||
{
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'fa_geo_area';
|
||||
|
||||
/**
|
||||
* 关联市
|
||||
*/
|
||||
public function city()
|
||||
{
|
||||
return $this->hasOne(GeoArea::class, 'area_code', 'area_code');
|
||||
}
|
||||
}
|
19
app/admin/model/GeoCity.php
Normal file
19
app/admin/model/GeoCity.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 地区 省市模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class GeoCity extends Model
|
||||
{
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'fa_geo_city';
|
||||
|
||||
}
|
27
app/admin/model/GeoStreet.php
Normal file
27
app/admin/model/GeoStreet.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 地区 街道模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class GeoStreet extends Model
|
||||
{
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'fa_geo_street';
|
||||
|
||||
/**
|
||||
* 关联区
|
||||
*
|
||||
*/
|
||||
public function area()
|
||||
{
|
||||
return $this->hasOne(GeoArea::class, 'area_code', 'area_code');
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_merchant';
|
||||
protected $pk = 'mer_id';
|
||||
|
||||
/**
|
||||
* 所属供应链
|
||||
|
@ -22,8 +22,36 @@
|
||||
*/
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasManyThrough(SupplyChainLinkMerchant::class, Merchant::class);
|
||||
return $this->belongsToMany(Merchant::class, SupplyChainLinkMerchant::class, 'eb_merchant_id', 'fa_supply_chain_id');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联中间表
|
||||
*
|
||||
*/
|
||||
public function linkMerchant()
|
||||
{
|
||||
return $this->hasMany(SupplyChainLinkMerchant::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联街道
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function street()
|
||||
{
|
||||
return $this->hasOne(GeoStreet::class, 'street_id', 'street_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联区县
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function area()
|
||||
{
|
||||
return $this->hasOne(GeoArea::class, 'area_id', 'area_id');
|
||||
}
|
||||
}
|
@ -9,12 +9,18 @@
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class SupplyChainLinkMerchant extends Model
|
||||
{
|
||||
use think\model\Pivot;
|
||||
|
||||
class SupplyChainLinkMerchant extends Pivot
|
||||
{
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'mysql';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'fa_supply_chain_link_merchant';
|
||||
|
||||
|
||||
/**
|
||||
* 所属供应链
|
||||
* 一对一
|
||||
|
@ -20,14 +20,14 @@
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4" >
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">关联商户</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户<font>*</font></td>
|
||||
<td colspan="12">
|
||||
<div class="layui-col-md12">
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >请选择商户</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
@ -39,9 +39,9 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">已选商户</label>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">已选商户<font>*</font></label>
|
||||
<div class="layui-input-block" id="merchantList" >
|
||||
</div>
|
||||
</div>
|
||||
@ -50,13 +50,13 @@
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div id="address"></div>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">团队名称</label>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
@ -65,15 +65,33 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">团队电话</label>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队电话<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
|
||||
<td>
|
||||
<div class="layui-col-md4">
|
||||
<select name="" lay-filter="merchantAddress" lay-search>
|
||||
<option value="">选择区域</option>
|
||||
{volist name='arealist' id='vo'}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">街道/镇</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="demo1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
@ -86,64 +104,95 @@
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script src="{__GOUGU__}/layui/layui.js"></script>
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
|
||||
layui.use('form', function(){
|
||||
var form = layui.form;
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" checked/>`
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
});
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
console.log('已选择');
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
console.log('未选择');
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[1]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
layui.use('tree', function(){
|
||||
var tree = layui.tree;
|
||||
|
||||
//渲染
|
||||
var inst1 = tree.render({
|
||||
elem: '#test1' //绑定元素
|
||||
,data: [{
|
||||
title: '江西' //一级菜单
|
||||
,children: [{
|
||||
title: '南昌' //二级菜单
|
||||
,children: [{
|
||||
title: '高新区' //三级菜单
|
||||
//…… //以此类推,可无限层级
|
||||
}]
|
||||
}]
|
||||
},{
|
||||
title: '陕西' //一级菜单
|
||||
,children: [{
|
||||
title: '西安' //二级菜单
|
||||
}]
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'street_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
@ -22,49 +22,81 @@
|
||||
<h3 class="pb-3">编辑</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">所属区域<font>*</font></td>
|
||||
<td colspan="12">
|
||||
<div class="layui-col-md12">
|
||||
<select name="area_id" lay-verify="required" lay-search="">
|
||||
<option value="" >请选择</option>
|
||||
{volist name='area' id='vo'}
|
||||
{if $detail.area_id == $vo.id}
|
||||
<option value="{$vo.id}" selected>{$vo.area_name}</option>
|
||||
{else/}
|
||||
<option value="{$vo.id}">{$vo.area_name}</option>
|
||||
{/if}
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >请选择商户</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">已选商户<font>*</font></label>
|
||||
<div class="layui-input-block" id="merchantList" >
|
||||
{$detail}
|
||||
{volist name='arealist' id='vo'}
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" value="{$detail.name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">姓名<font>*</font></td>
|
||||
<td colspan="7">
|
||||
<input type="text" name="name" lay-verify="required" lay-reqText="请输入负责人姓名"
|
||||
autocomplete="off" placeholder="请输入负责人姓名" class="layui-input" value="{$detail.name}">
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队电话<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" required lay-verify="required" value="{$detail.tel}" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">负责人头像</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="{$detail.avatar}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||
<input type="hidden" name="avatar" value="{$detail.avatar}">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">职务<font>*</font></td>
|
||||
<td colspan="4">
|
||||
<input type="text" name="duty" lay-verify="required" lay-reqText="请输入负责人职务"
|
||||
autocomplete="off" placeholder="请输入负责人职务" class="layui-input" value="{$detail.duty}">
|
||||
</td>
|
||||
<td class="layui-td-gray">电话<font>*</td>
|
||||
<td colspan="4">
|
||||
<input type="text" name="phone" lay-verify="required" lay-reqText="请输入负责人电话"
|
||||
autocomplete="off" placeholder="请输入负责人电话" class="layui-input" value="{$detail.phone}">
|
||||
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
|
||||
<td>
|
||||
<div class="layui-col-md4">
|
||||
<select name="" lay-filter="merchantAddress" lay-search>
|
||||
<option value="">选择区域</option>
|
||||
{volist name='arealist' id='vo'}
|
||||
{if $detail.area.area_code == $vo.area_code}
|
||||
<option value="{$vo.area_code}" selected >{$vo.area_name}</option>
|
||||
{else /}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/if}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">街道/镇</label>
|
||||
<div class="layui-input-block">
|
||||
{$detail.address}
|
||||
<div id="demo1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -83,51 +115,93 @@
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
|
||||
var editor = layui.tinymce;
|
||||
var lat = "{$detail.lat}";
|
||||
var lng = "{$detail.lng}";
|
||||
var edit = editor.render({
|
||||
selector: "#container_content",
|
||||
height: 500
|
||||
});
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
layer.msg('上传失败');
|
||||
return false;
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[1]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'street_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/nk.areamanager/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
//日期选择
|
||||
laydate.render({
|
||||
elem: '#formDate',
|
||||
max: 17,
|
||||
showBottom: false
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -5,7 +5,7 @@
|
||||
<div class="p-3">
|
||||
<form class="layui-form gg-form-bar border-t border-x">
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="请输入负责人姓名" class="layui-input" autocomplete="off" />
|
||||
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
</form>
|
||||
@ -69,30 +69,60 @@
|
||||
width:80,
|
||||
},{
|
||||
field: 'area',
|
||||
title: '区域',
|
||||
title: '地址',
|
||||
align: 'center',
|
||||
templet: function (d)
|
||||
{
|
||||
var html = '【' + d['area']['area_name'] + '】'
|
||||
var html = 11;
|
||||
return html;
|
||||
},
|
||||
width:120,
|
||||
},{
|
||||
field: 'mer_id',
|
||||
title: '主商户',
|
||||
align: 'center',
|
||||
width:120,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = d.mer_id?d.mer_id:'待定';
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'name',
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'duty',
|
||||
title: '职务',
|
||||
field: 'tel',
|
||||
title: '联系电话',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'phone',
|
||||
title: '电话',
|
||||
field: 'earnings_amount',
|
||||
title: '净收益',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'bill_amount',
|
||||
title: '流水',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'brokerage',
|
||||
title: '分销佣金',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'order_number',
|
||||
title: '支付订单数量',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'cancel_order_number',
|
||||
title: '取消支付订单数量',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},,{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
@ -105,7 +135,7 @@
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'created_at',
|
||||
field: 'create_time',
|
||||
title: '添加时间',
|
||||
align: 'center',
|
||||
width:150,
|
||||
|
Loading…
x
Reference in New Issue
Block a user