dev_oa/app/customer/view/api/add_chance.html

143 lines
5.3 KiB
HTML

{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">新增销售机会</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">客户名称</td>
<td colspan="3">{$customer_name}</td>
<td class="layui-td-gray-2">客户联系人<font>*</font></td>
<td>
<select name="contact_id" lay-verify="required" lay-reqText="请选择联系人">
<option value="">请选择</option>
{volist name=":customer_contact($customer_id)" id="v"}
<option value="{$v.id}">{$v.name}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">机会标题<font>*</font></td>
<td colspan="3">
<input type="text" name="title" autocomplete="off" lay-verify="required" lay-reqText="请输入机会标题" placeholder="请输入机会标题" class="layui-input">
</td>
<td class="layui-td-gray">发现时间<font>*</font></td>
<td>
<input type="text" id="discovery_time" name="discovery_time" readonly autocomplete="off" lay-verify="required" lay-reqText="请选择发现时间" placeholder="请选择发现时间" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">销售阶段<font>*</font></td>
<td>
<select name="stage" lay-verify="required" lay-reqText="请选择">
<option value="">请选择</option>
{volist name=":trace_stage()" id="v"}
<option value="{$key}">{$v}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">预计金额<font>*</font></td>
<td>
<input type="text" name="expected_amount" autocomplete="off" lay-verify="required|number" lay-reqText="请输入预计金额" placeholder="请输入预计金额" class="layui-input">
</td>
<td class="layui-td-gray-2">预计签单时间<font>*</font></td>
<td>
<input type="text" id="expected_time" name="expected_time" readonly autocomplete="off" lay-verify="required" lay-reqText="请选择预计签单时间" placeholder="请选择预计签单时间" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top">需求描述<font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入需求描述" lay-verify="required" lay-reqText="请输入需求描述" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">归属人员<font>*</font></td>
<td>
<input type="text" name="belong_name" readonly autocomplete="off" placeholder="请选择归属人员" class="layui-input">
<input type="hidden" name="belong_uid" lay-verify="required" lay-reqText="请选择归属人员">
</td>
<td class="layui-td-gray">协助人员</td>
<td colspan="3">
<input type="text" name="assist_names" autocomplete="off" placeholder="请选择协助人员" class="layui-input">
<input type="hidden" name="assist_ids">
</td>
</tr>
</table>
<div class="py-3">
<input type="hidden" name="cid" value="{$customer_id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','employeepicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool,laydate = layui.laydate,employeepicker=layui.employeepicker;
laydate.render({
elem: '#discovery_time'
});
laydate.render({
elem: '#expected_time'
,min: 0
});
//选择归属人人弹窗
$('body').on('click','[name="belong_name"]',function () {
var ids=$('[name="belong_uid"]').val(),names=$('[name="belong_name"]').val();
employeepicker.init({
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
$('[name="belong_uid"]').val(ids);
$('[name="belong_name"]').val(names);
}
});
});
//选择共享成员弹窗
$('body').on('click','[name="assist_names"]',function () {
var ids=$('[name="assist_ids"]').val(),names=$(this).val(),share_ids_array=[],share_names_array=[];
if(ids.length>0){
share_ids_array=ids.split(',');
share_names_array=names.split(',');
}
employeepicker.init({
ids:share_ids_array,
names:share_names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
$('[name="assist_ids"]').val(ids);
$('[name="assist_names"]').val(names);
}
});
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.tool.close();
parent.layui.chanceTable.reload();
}
}
tool.post("/customer/api/add_chance", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->