Commit 450b32c7 by 朱继来

Merge branch 'master' of http://119.23.72.7/zhujilai/Order into zjl_merge_20200821

parents 45f8bb28 5b3edca0
......@@ -1665,15 +1665,16 @@ Class OrderController extends Controller
public function ajaxCancel(Request $request)
{
if ($request->isMethod('post')) {
$data['order_id'] = $request->input('order_id', 0);
$data['user_id'] = $request->input('user_id', 0);
$data['order_id'] = $request->input('order_id', 0);
$data['cancel_reason'] = $request->input('cancel_reason', '');
$data['type'] = $request->input('type', 2); // 2.取消订单,3.审核不通过,4-填写取消原因
$data['operator_id'] = $request->user->userId;
$data['type'] = $request->input('type', 2); // 2.取消订单,3.审核不通过,4-填写取消原因
$data['operator_id'] = $request->user->userId;
$url = Config('website.api_domain').'order/cancel';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true);
......
......@@ -301,8 +301,8 @@ class WebController extends Controller
if (!$user_id) return redirect('/web/selfSampleList');
$data['title'] = '自营样片领取和邀约记录';
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '自营样片领取和邀约记录', "href" => '#']];
$data['title'] = '领取和邀约记录';
$data['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单领取列表', "href" => '/web/selfSampleList'], ["title" => '领取和邀约记录', "href" => '#']];
$data['user_id'] = $user_id;
$UserMainModel = new UserMainModel;
......
......@@ -26,11 +26,12 @@ class UserSampleApplyModel extends Model
{
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['a.apply_id', 'a.user_id', 'a.account', 'a.order_id', 'order_sn', 'a.goods_id', 'a.goods_name', 'a.apply_num', 'a.quota', 'a.create_time'];
$field = ['a.apply_id', 'a.user_id', 'a.account', 'a.order_id', 'order_sn', 'a.goods_id', 'a.goods_name', 'a.apply_num', 'a.quota', 'a.type', 'a.create_time'];
$map['account'] = $request->input('account', ''); // 用户账户
$map['goods_name'] = $request->input('goods_name', ''); // 商品名称
$map['order_sn'] = $request->input('order_sn', ''); // 订单号
$map['type'] = $request->input('type', ''); // 活动名称
$map['begin_time'] = $request->input('begin_time', '') ? strtotime($request->input('begin_time')) : '';
$map['end_time'] = $request->input('end_time', '') ? strtotime($request->input('end_time')) + 86399 : '';
......@@ -55,6 +56,11 @@ class UserSampleApplyModel extends Model
$query->where('a.order_sn', '=', $map['order_sn']);
}
})->where(function($query) use ($map) {
// 活动名称
if ($map['type']) {
$query->where('a.type', '=', $map['type']);
}
})->where(function($query) use ($map) {
// 创建时间
if(!empty($map['begin_time']) && !empty($map['end_time'])) {
$query->whereBetween('a.create_time', [$map['begin_time'], $map['end_time']]);
......@@ -97,12 +103,14 @@ class UserSampleApplyModel extends Model
$UserSampleInviteModel = new UserSampleInviteModel;
$UserInfoModel = new UserInfoModel;
foreach ($data as &$v) {
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数
$v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片消耗总人数
// $v['quota_total'] = $this->getUsedCount($v['user_id']); //
$v['apply_count'] = $UserInfoModel->getUserApplyCount($v['user_id']);
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$v['work_function'] = $UserInfoModel->getWorkFunction($v['user_id']);
$v['sample_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id']);
$v['ruler_invite_count'] = $UserSampleInviteModel->getUserInviteCount($v['user_id'], 2);
$v['apply_num_total'] = $this->getSampleApplySum($v['user_id']); // 获取指定用户申请的样片总数
$v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片消耗总人数
// $v['quota_total'] = $this->getUsedCount($v['user_id']); //
$v['apply_count'] = $UserInfoModel->getUserApplyCount($v['user_id']);
}
return $data;
......@@ -126,7 +134,7 @@ class UserSampleApplyModel extends Model
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['apply_id', 'user_id', 'account', 'order_id', 'order_sn', 'goods_id', 'goods_name', 'apply_num', 'quota', 'is_expire', 'create_time'];
$field = ['apply_id', 'user_id', 'account', 'order_id', 'order_sn', 'goods_id', 'goods_name', 'apply_num', 'quota', 'is_expire', 'type', 'create_time'];
$list = $this->where('user_id', $user_id)
->select($field)
......@@ -147,6 +155,8 @@ class UserSampleApplyModel extends Model
$OrderModel = new OrderModel();
foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
$order = $OrderModel->where('order_id', $v['order_id'])->select('status')->first();
if (!$order) continue;
......
......@@ -28,7 +28,7 @@ class UserSampleInviteModel extends Model
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['invite_id', 'user_id', 'account', 'invitee_uid', 'invitee_mobile', 'is_expire', 'create_time'];
$field = ['invite_id', 'user_id', 'account', 'invitee_uid', 'invitee_mobile', 'is_expire', 'type', 'create_time'];
$list = $this->where('user_id', $user_id)
->select($field)
......@@ -36,13 +36,32 @@ class UserSampleInviteModel extends Model
->orderBy('invite_id', 'asc')
->paginate($limit, ['*'], 'page', $page)->toArray();
$list['data'] = $this->handleData($list['data']);
return [0, '获取成功', $list['data'], $list['total']];
}
public function handleData($data)
{
if (!$data) return false;
$OrderModel = new OrderModel();
foreach ($data as &$v) {
$v['type_val'] = $v['type'] == 1 ? '样片' : '工具尺';
}
return $data;
}
// 获取指定用户邀约人数
public function getUserInviteCount($user_id)
public function getUserInviteCount($user_id, $type=1)
{
return $this->where('user_id', $user_id)->where('is_expire', 1)->count();
$map = [];
$map['user_id'] = $user_id;
$map['type'] = $type;
return $this->where($map)->where('is_expire', 1)->count();
}
// 获取用户邀约列表
......
......@@ -780,7 +780,7 @@
return false;
}
var en_reg = /^[a-zA-Z0-9\.\s\,\(\)]+$/;
var en_reg = /^[a-zA-Z0-9\.\-\s\,\(\)]+$/;
if(!en_reg.test(customer_en)){
layer.msg('请填写全英文名称');
return false;
......
......@@ -101,7 +101,7 @@
var price = parseFloat($(this).find('.price').val()) || 0;
if (supplier.hasOwnProperty(sup)) { // 判断当前key是否存在于数组中
supplier[sup] += parseFloat(num * price).toFixed(2);
supplier[sup] = (parseFloat(supplier[sup]) + parseFloat(num * price)).toFixed(2);
} else {
supplier[sup] = parseFloat(num * price).toFixed(2);
}
......@@ -443,6 +443,9 @@
var goods_name = $(this).find('.change_goods_name').val();
var buyer_id = $(this).find('.change_buyer_id').selectpicker('val');
var batch = $(this).find('.change_batch').val();
var status = $(this).find('.change_status').val();
if (status == -1) return true;
if (goods_number == '' || goods_number == 0) {
change_goods_number = true;
......@@ -454,7 +457,7 @@
change_str += goods_name+'单价不能为0或空 ';
}
if (order_goods_type == 1 && buyer_id == null) {
if (order_goods_type == 1 && (buyer_id == null || buyer_id == '')) {
change_buyer_id = true;
change_str += goods_name+'采购员不能为空 ';
}
......
......@@ -94,6 +94,11 @@
var data = eval('('+resp.data+')');
var order_item = data.item; // 当前新增商品信息
var sup = order_item.canal ? order_item.supplier_id+'.'+order_item.canal : order_item.supplier_id;
var buyers_option = '';
for (var i = 0; i < buyers.length; i++) {
buyers_option += '<option value="'+buyers[i].userId+'">'+buyers[i].name+'</option>';
}
html += '<tr data-sup="'+sup+'" data-brand_name="'+order_item.brand_name+'">\
<td>'+curr_no+'</td>\
......@@ -134,6 +139,14 @@
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+order_item.goods_price+'" value="'+order_item.goods_price+'">\
</td>\
<td>\
<select id="buyer_id_'+curr_no+'" class="form-control change_buyer_id selectpicker" name="change_info['+curr_no+'][buyer_id]" data-live-search="true" data-size="5" title="请选择采购员">\
<option value="">请选择采购员</option>'+buyers_option+'\
</select>\
</td>\
<td>\
<input type="text" class="form-control change_batch" name="change_info['+curr_no+'][batch]" value="">\
</td>\
<td>\
<input class="change_status" type="hidden" name="change_info['+curr_no+'][status]" value="1">\
<span class="change_status_val">正常<i style="color:green;">(新增)</i></span>\
</td>\
......@@ -147,6 +160,7 @@
$('.order-change-table').find('tbody').append(html);
$('.order-change-table').find('tbody input').trigger('blur'); // 自动触发
$('.change_buyer_id').selectpicker();
// 添加附加费
var extend_fee_items = data.extend_fee_items;
......@@ -287,6 +301,15 @@
})
var curr_no = goods_len + 1; // 当前添加行序号
var buyers_option = '';
for (var i = 0; i < buyers.length; i++) {
if (add_buyer_id == buyers[i].userId) {
buyers_option += '<option value="'+buyers[i].userId+'" selected>'+buyers[i].name+'</option>';
} else {
buyers_option += '<option value="'+buyers[i].userId+'">'+buyers[i].name+'</option>';
}
}
html += '<tr data-brand_name="'+add_brand_name+'">\
<td>'+curr_no+'</td>\
......@@ -313,6 +336,14 @@
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+add_goods_price+'" value="'+add_goods_price+'">\
</td>\
<td>\
<select id="buyer_id_'+curr_no+'" class="form-control change_buyer_id selectpicker" name="change_info['+curr_no+'][buyer_id]" data-live-search="true" data-size="5" title="请选择采购员">\
<option value="">请选择采购员</option>'+buyers_option+'\
</select>\
</td>\
<td>\
<input type="text" class="form-control change_batch" name="change_info['+curr_no+'][batch]" value="'+add_batch+'">\
</td>\
<td>\
<input class="change_status" type="hidden" name="change_info['+curr_no+'][status]" value="1">\
<span class="change_status_val">正常<i style="color:green;">(新增)</i></span>\
</td>\
......@@ -324,14 +355,13 @@
<input type="hidden" name="change_info['+curr_no+'][goods_id]" value="'+add_goods_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][brand_name]" value="'+add_brand_name+'" />\
<input type="hidden" name="change_info['+curr_no+'][delivery_time]" value="'+add_delivery_time+'" />\
<input type="hidden" name="change_info['+curr_no+'][buyer_id]" value="'+add_buyer_id+'" />\
<input type="hidden" name="change_info['+curr_no+'][batch]" value="'+add_batch+'" />\
<input type="hidden" name="change_info['+curr_no+'][remarks]" value="'+add_remarks+'" />\
</td>\
</tr>';
$('.order-change-table').find('tbody').append(html);
$('.order-change-table').find('tbody input').trigger('blur'); // 自动触发
$('.change_buyer_id').selectpicker();
layer.close(index);
} else {
......
......@@ -555,10 +555,11 @@
cancelorder:function () {
// 填写订单取消原因
$('.input-cancel-reason').click(function(){
var self = $(this);
var self = $(this);
var user_id = self.data('uid');
var order_id = self.data('oid');
var type = self.data('type');
var title = '';
var type = self.data('type');
var title = '';
switch (type) {
case 2: title = '取消订单'; break;
......@@ -670,7 +671,7 @@
$.ajax({
url:'/ajaxCancel',
data: {order_id: order_id, cancel_reason: cancel_reason, type: type},
data: {user_id: user_id, order_id: order_id, cancel_reason: cancel_reason, type: type},
type:'post',
dataType: 'json',
success:function(resp){
......
......@@ -7,10 +7,11 @@
cancelorder:function () {
// 填写订单取消原因
$('.input-cancel-reason').click(function(){
var self = $(this);
var self = $(this);
var user_id = self.data('uid');
var order_id = self.data('oid');
var type = self.data('type');
var title = '';
var type = self.data('type');
var title = '';
switch (type) {
case 2: title = '取消订单'; break;
......@@ -122,7 +123,7 @@
$.ajax({
url:'/ajaxCancel',
data: {order_id: order_id, cancel_reason: cancel_reason, type: type},
data: {user_id: user_id, order_id: order_id, cancel_reason: cancel_reason, type: type},
type:'post',
dataType: 'json',
success:function(resp){
......
......@@ -22,8 +22,10 @@ layui.use(['form', 'table', 'laydate'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 100}
,{field: 'account', title: '用户账户', width: 150}
,{field: 'work_function', title: '用户职务', width: 150}
,{field: 'invite_count', title: '邀请人数', width: 100}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'work_function', title: '用户职务', width: 120}
,{field: 'sample_invite_count', title: '样片邀请人数', width: 130}
,{field: 'ruler_invite_count', title: '工具尺邀请人数', width: 130}
,{field: 'apply_num_total', title: '已申请样片数', width: 120}
,{field: 'apply_count', title: '剩余有效人数', width: 120}
,{field: 'quota_total', title: '总消耗人数', width: 120}
......
......@@ -16,13 +16,14 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID', width: 120}
,{field: 'account', title: '用户账户', width: 200}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'order_id', title: '订单ID', width: 120}
,{field: 'order_sn', title: '订单编号', width: 200}
,{field: 'order_status', title: '订单状态', width: 100}
,{field: 'goods_id', title: '样片ID', width: 120}
,{field: 'goods_name', title: '样片名称', width: 300}
,{field: 'goods_id', title: '商品ID', width: 120}
,{field: 'goods_name', title: '商品名称', width: 300}
,{field: 'apply_num', title: '领取数量', width: 120}
,{field: 'quota', title: '样片消耗人数', width: 120}
,{field: 'quota', title: '消耗人数', width: 120}
,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
,{field: 'create_time', title: '领取时间', width: 215}
]]
......@@ -45,6 +46,7 @@ layui.use(['table'], function(){
{title: '序号', type: 'numbers', fixed: 'left', width: 80}
,{field: 'user_id', title: '用户ID'}
,{field: 'account', title: '用户账户'}
,{field: 'type_val', title: '活动名称', width: 100}
,{field: 'invitee_uid', title: '受邀人ID'}
,{field: 'invitee_mobile', title: '受邀人手机号码'}
,{field: 'is_expire', title: '是否过期', templet: '#is_expire', width: 120}
......
......@@ -258,7 +258,7 @@
<div class="form-group">
<label class="col-sm-2 control-label"><i class="text-danger">*</i> 终端中文名称:</label>
<div class="col-sm-10">
<input type="text" class="form-control customer_cn" name="customer_cn" value="" autocomplete="off" disabled="disabled">
<input type="text" class="form-control customer_cn" name="customer_cn" value="" autocomplete="off">
</div>
</div>
</div>
......
......@@ -367,12 +367,12 @@
</tr>
@endif
@if ($order_info['order_goods_type'] == 2)
@if (($order_info['order_goods_type'] == 1 && $order_price_info['shipping_price']) || $order_info['order_goods_type'] == 2)
<tr>
<th>运费</th>
<td>
<span>{{$currency}}</span>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] ? $order_price_info['shipping_price'] : 0 }}">
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}">
</td>
</tr>
@endif
......@@ -553,6 +553,7 @@
var discount_amount = "{{ $order_price_info['discount_amount'] ? $order_price_info['discount_amount'] : 0 }}"; // 优惠券金额
var pay_preferential = "{{ $order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0 }}"; // 支付优惠(钱包)
var new_client_price = "{{ $order_price_info['new_client_price'] }}";
var buyers = eval('{!! isset($buyers) ? json_encode($buyers) : '' !!}'); // 采购员集合
// 明细数目
var item_count = "{{ count($order_items_info) }}";
......
......@@ -153,7 +153,7 @@
<div class="tabs-box">
@if (in_array($order_info['status'], [1, 2, 3, 4]) && in_array('cancel_order', $userPerms))
<!-- <a href="{{URL('cancelPay', ['order_id'=>$order_info['order_id']])}}" class="btn btn-danger">取消订单</a> -->
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-type="2">取消订单</a>
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-uid="{{$order_info['user_id']}}" data-type="2">取消订单</a>
@endif
@if (in_array('check_order', $userPerms) && $order_info['sale_id'])
......@@ -221,7 +221,7 @@
<div class="tabs-box">
@if (in_array($order_info['status'], [1, 2, 3, 4]) && in_array('self_order_cancel', $userPerms))
<!-- <a class="btn btn-danger self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}">取消订单</a> -->
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-type="2">取消订单</a>
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$order_info['order_id']}}" data-uid="{{$order_info['user_id']}}" data-type="2">取消订单</a>
@endif
<!-- 判断状态和权限 $extend-自营线下订单 -->
......
......@@ -90,7 +90,7 @@
<table class="table table-bordered">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">合同乙方信息
<?php if ($order_info['status'] == 1) { ?>
<?php if (in_array($order_info['status'], [1, 2])) { ?>
<a href="javascript:;" class="btn btn-success btn-sm changeBtn contract_info_edit">编辑</a>
<?php } ?>
</th>
......
......@@ -14,7 +14,7 @@
<script src="/js/details.js?v=<?= time() ?>"></script>
<script src="/js/order_audit.js?v=<?= time() ?>"></script>
<script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_cancel.js?v=<?= time() ?>"></script>
<script src="/js/order_send_email.js"></script>
<script src="/js/refund.js?v=<?= time() ?>"></script>
......
......@@ -389,7 +389,7 @@
?>
@if ($v['status'] == -1 && !$v['cancel_reason'])
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}" data-type="4">填写取消原因</a>
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}" data-uid="{{$v['user_id']}}" data-type="4">填写取消原因</a>
@endif
</div>
</td>
......
......@@ -13,7 +13,7 @@
<script src="/js/list.js?v=<?= time() ?>"></script>
<script src="/js/order_audit.js?v=<?= time() ?>"></script>
<script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_cancel.js?v=<?= time() ?>"></script>
<script src="/js/order_send_email.js"></script>
<script src="/js/refund.js?v=<?= time() ?>"></script>
......@@ -394,7 +394,7 @@
@endif
@if ($v['status'] == -1 && !$v['cancel_reason'])
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}" data-type="4">填写取消原因</a>
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}" data-uid="{{$v['user_id']}}" data-type="4">填写取消原因</a>
@endif
</div>
</td>
......
......@@ -28,10 +28,13 @@
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
@include('layouts.header')
<div class="layui-col-md6 layui-col-space12" style="margin: 10px;width: 100%;height: 100%;padding-right: 20px">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 20px; padding-bottom: 30px;">
@include("web.$id")
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins ibox-content" style="margin: 15px">
<div class="row mapping-rows" style="overflow:visible;margin: 10px">
@include("web.$id")
</div>
</div>
</div>
</div>
......
......@@ -22,6 +22,17 @@
</div>
<div class="layui-inline">
<label class="layui-form-label">活动名称</label>
<div class="layui-input-inline">
<select name="type" lay-verify="" lay-search>
<option value=""></option>
<option value="1">样片</option>
<option value="2">工具尺</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">领取时间</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
......@@ -30,7 +41,7 @@
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
......
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