123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- {layout name="layout" /}
- <nav class="breadcrumb">
- <span><a href="/">首页</a></span>
- <span>></span>
- <span><a href="/order/index">销售订单</a></span>
- <span>></span>
- <span>{$year!=0?$year:"全部"} 年度</span>
- </nav>
- <div class="content">
- <div class="row" style="margin: 10px 0;">
- <div class="col-md-2 col-xs-3 text-center">
- <a href="/order/save/{$year}/0" class="btn btn-success radius">新增</a>
- </div>
- <div class="col-md-8">
- <form action="/order/lists/{$year}" method="get">
- {notempty name="year"}
- <label for="month" class="form-label col-md-2 text-right mt-5">
- 请选择月份 :
- </label>
- <div class="formControls col-md-2" style="width: 100px;">
- <select class="form-control input-sm" name="month" id="month">
- {for start="0" end="13"}
- {eq name="i" value="0"}
- <option value="{$i}" {eq name="month" value="0" }selected{/eq}>全年</option>
- {else/}
- <option value="{$i}" {eq name="month" value="$i" }selected{/eq}>{$i}月</option>
- {/eq}
- {/for}
- </select>
- </div>
- {/notempty}
- <div class="col-md-4">
- <input type="text" class="form-control" name="key" id="key" value="{$key}" placeholder="请输入公司名称">
- </div>
- <div class="col-md-3" style="text-align:left;">
- <div class="btn-group ">
- <button type="submit" class="btn btn-success">搜索</button>
- </div>
- <div class="btn-group ">
- <a href="/order/lists/{$year}" class="btn btn-danger ml-10">清除</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div class="col-md-12" style="min-width: 1200px;">
- <table class="table table-hover table-bordered table-condensed">
- <thead>
- <tr class="text-center bg-info">
- <td>统计</td>
- <td colspan="11" class="text-left">
- 总销售金额 : ¥{$total_contract_money} | 总到款金额: ¥{$total_payment}
- </td>
- <td colspan="3">
- <span>每页行数:</span>
- <select name="limit" id="limit" onchange="changLimit()">
- {for start="10" end="101" step="10"}
- <option value="{$i}" {eq name="limit" value="$i" }selected{/eq}>{$i}</option>
- {/for}
- </select>
- </td>
- </tr>
- <tr>
- <th>序号</th>
- <th>月份</th>
- <th style="width: 250px;">购货单位</th>
- <th style="min-width: 160px;">合同号</th>
- <th>合同总金额</th>
- <th>签订时间</th>
- <th>运费</th>
- <th>代理费</th>
- <th>销售员</th>
- <th>到款金额</th>
- <th>未到款</th>
-
- <th style="min-width: 40px;">提成</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- {foreach $list as $value}
- <tr class="text-center {eq name='value.status' value='-1'}bg-danger{/eq}">
- <td>{$value.no}</td>
- <td>{$value.month}</td>
- <td class="text-left">{$value.company_name}</td>
- <td class="text-left"><a href="/order_item/{$value.id}">{$value.contract_no}</a></td>
- <td>{$value.contract_money|format_money}</td>
- <td>{$value.contract_time}</td>
- <td>{$value.fare|format_money}</td>
- <td>{$value.agency|format_money}</td>
- <td>{$value.seller_name}</td>
- <td>{$value.payment|format_money}</td>
- <td>{$value.contract_money-$value.payment|format_money}</td>
-
- <td class="td-status">
- {eq name="value.is_commission" value="0"}
- <a href="javascript:void(0);" title="计提" data-value='{$value.is_commission}'
- onclick="commission('{$value.id}', this)"><span
- class="label label-default radius">否</span></a>
- {else/}
- <a href="javascript:void(0);" title="取消" data-value='{$value.is_commission}'
- onclick="commission('{$value.id}', this)"><span
- class="label label-success radius">是</span></a>
- {/eq}
- </td>
- <td class="td-manager">
- <a href="/order_item/{$value.id}">明细</a>
- <a href="/order/save/{$year}/{$value.id}" onclick="edit()">修改</a>
- {eq name='value.status' value='-1'}
- <a href="javascript:void(0);" data-value='-1' onclick="status('{$value.id}', this)">恢复</a>
- {else/}
- <a href="javascript:void(0);" data-value='0' onclick="status('{$value.id}', this)">取消</a>
- {/eq}
- <a href="javascript:void(0);" onclick="del('{$value.id}', this)">删除</a>
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
- </div>
- <div class="pagelist">
- {$page|raw}
- </div>
- </div>
- <div class="modal" tabindex="-1" role="dialog" data-backdrop="false" id="myModal" aria-labelledby="myModalLabel"
- style="right: 10%;">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
- aria-hidden="true">×</span></button>
- <h4 class="modal-title">计提</h4>
- </div>
- <div class="modal-body">
- <form role="form" id="form-commission">
- <input type="hidden" name="id" id="id" value="0">
- <input type="hidden" name="order_id" id="order_id" value="">
- <div class="row">
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">序号</label>
- <input type="text" class="form-control" name="no" id="no" placeholder="序号">
- </div>
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">合同号</label>
- <input type="text" class="form-control" name="contract_no" id="contract_no"
- placeholder="合同号">
- </div>
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">购货单位</label>
- <input type="text" class="form-control" name="company_name" id="company_name"
- placeholder="公司名称">
- <input type="hidden" name="company_id" id="company_id" value="">
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">一般提成金额</label>
- <input type="number" class="form-control" name="general_money" id="general_money"
- placeholder="一般提成金额">
- </div>
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">特别提成金额</label>
- <input type="number" class="form-control" name="special_money" id="special_money"
- placeholder="特别提成金额">
- </div>
- </div>
- <div class="col-md-3">
- <div class="form-group">
- <label for="name">提成日期</label>
- <input type="date" class="form-control" name="time" id="time" value=""
- placeholder="提成日期">
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-4">
- <div class="form-group">
- <label for="name">销售员</label>
- <input type="text" class="form-control" name="seller_name" id="seller_name"
- placeholder="销售员">
- <input type="hidden" name="seller_id" id="seller_id" value="">
- <input type="hidden" name="department_id" id="department_id" value="">
- <input type="hidden" name="department_name" id="department_name" value="">
- </div>
- </div>
- <div class="col-md-8">
- <div class="form-group">
- <label for="name">备注</label>
- <textarea class="form-control" name="remark" id="remark" rows="3"></textarea>
- </div>
- </div>
- </div>
- </form>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" onclick="closeModel()">Close</button>
- <button type="button" class="btn btn-success" onclick="doSave()">Save</button>
- </div>
- </div>
- </div>
- </div>
- <script>
- function del(id, obj) {
- $.ajax({
- url: "/order/delete",
- type: "POST",
- data: {
- "id": id
- },
- dataType: 'json',
- success: function (data) {
- if (data.code == 2) {
- $(obj).parents("tr").remove();
- } else {
- alert(data.msg);
- }
- return false;
- }
- });
- }
- function status(id, obj) {
- var status = $(obj).data('value');
- if (status == 0) {
- cancel(id, obj);
- } else {
- restore(id, obj);
- }
- }
- function cancel(id, obj) {
- $.ajax({
- url: "/order/cancel",
- type: "POST",
- data: {
- "id": id,
- },
- dataType: 'json',
- success: function (data) {
- if (data.code == 2) {
- $(obj).parents("tr").addClass('bg-danger');
- $(obj).data('value', -1)
- $(obj).text('恢复');
- } else {
- alert(data.msg);
- }
- return false;
- }
- });
- }
- function restore(id, obj) {
- $.ajax({
- url: "/order/restore",
- type: "POST",
- data: {
- "id": id
- },
- dataType: 'json',
- success: function (data) {
- if (data.code == 2) {
- $(obj).parents("tr").removeClass();
- $(obj).parents("tr").addClass('text-center');
- $(obj).data('value', 0);
- $(obj).text('取消');
- } else {
- alert(data.msg);
- }
- return false;
- }
- });
- }
- function commission(id, obj) {
- var is_commission = $(obj).data('value');
- if (is_commission == 0) {
- saveCommission(id, obj);
- } else {
- deleteCommission(is_commission, obj);
- }
- }
- function saveCommission(order_id, obj) {
-
- $.get('/commission/infobyorderid', {
- 'id': order_id,
- }, function (res) {
-
- if (res.code == 2) {
- var data = res.data;
- $("#id").val(0);
- $("#order_id").val(order_id);
- $("#no").val(data.no);
- $("#contract_no").val(data.contract_no);
- $("#company_id").val(data.company_id);
- $("#company_name").val(data.company_name);
- $("#seller_id").val(data.seller_id);
- $("#seller_name").val(data.seller_name);
- $("#department_id").val(data.department_id);
- $("#department_name").val(data.department_name);
- $("#general_money").val(Number(data.general_money));
- $("#special_money").val(Number(data.special_money));
- $('#myModal').modal('show');
- }
- }, 'json');
- }
- function closeModel() {
- $("#form-commission")[0].reset();
- $('#myModal').modal('hide');
- }
- function doSave() {
- var jttime = $("#time").val();
- if (!jttime) {
- alert("请选择计提日期");
- return false;
- }
- var data = $("#form-commission").serializeArray();
- $.post('/commission/save', data, function (res) {
- if (res.code == 2) {
- alert('保存成功');
- $("#form-commission")[0].reset();
- $('#myModal').modal('hide');
- window.location.reload();
- } else {
- alert(res.msg);
- }
- return false;
- }, 'json');
- return false;
- }
- function deleteCommission(commission_id, obj) {
- if (confirm('确定删除此计提数据?')) {
- $.post('/commission/delete', {'id': commission_id}, function (res) {
- if (res.code == 2) {
- alert("删除成功");
- $(obj).attr('title', '计提');
- $(obj).data('value', 0);
- $(obj).children('span').text('否');
- $(obj).children('span').removeClass('label-success');
- $(obj).children('span').addClass('label-default');
- } else {
- alert('删除失败!');
- }
- return false;
- }, 'json');
- }
- return false;
- }
- </script>
|