linwu 2 gadi atpakaļ
vecāks
revīzija
705eae53ff

+ 23 - 0
app/worker/BaseController.php

@@ -130,4 +130,27 @@ abstract class  BaseController
         return $v->failException(true)->check($data);
     }
 
+    protected function dealEqualInput($result ,$equal_array)
+    {
+        foreach ($equal_array as $k => $v) {
+            $value = input($v);
+            if (!empty($value)) {
+                $result[] = [is_numeric($k) ? $v : $k,'=',$value];
+            }
+        }
+
+        return $result;
+    }
+
+    protected function dealLikeInput($result,$like_array)
+    {
+        foreach ($like_array as $k => $v) {
+            $value = input($v);
+            if (!empty($value)) {
+                $result[] = [is_numeric($k) ? $v : $k,'like',"%{$value}%"];
+            }
+        }
+
+        return $result;
+    }
 }

+ 66 - 31
app/worker/controller/Demand.php

@@ -867,6 +867,12 @@ class Demand extends BaseController
                     'msg'  => "订单不存在 ",
                 ]));
             }
+            if ($demand != 3) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "订单已结束",
+                ]));
+            }
             $total  = DemandSnatchModel::where('status', '>', 1)->where('demand_id', $id)->sum('num');
             $remain = $demand['num'] - $total;
             if ($demand['num'] - $total < $num) {
@@ -984,7 +990,7 @@ class Demand extends BaseController
 
             $mobile = input('mobile/s', '');
             $idcard = input('idcard/s', '');
-            $check = DemandReportModel::where('snatchid',$id)->where('mobile',$mobile)->whereOr('idcard',$idcard)->find();
+            $check  = DemandReportModel::where('snatchid', $id)->where('mobile', $mobile)->whereOr('idcard', $idcard)->find();
             if (!empty($check)) {
                 exit(json_encode([
                     'code' => 1,
@@ -1019,49 +1025,78 @@ class Demand extends BaseController
         }
 
         if (Request::isAjax()) {
-            //订单信息
-            $snatch = DemandSnatchModel::with('demand')->find($id);
-            if (empty($snatch)) {
+            $limit = input('limit/d', 20);
+            $page  = input('page/d', 1);
+            $map   = [['snatchid', '=', $id]];
+            $map   = $this->dealLikeInput($map, ['realname', 'mobile', 'idcard']);
+
+            $list  = DemandReportModel::with(['agent', 'broker'])
+                ->where($map)
+                ->order(['id' => 'desc'])
+                ->limit($limit)
+                ->page($page)
+                ->select();
+            $count = DemandReportModel::where($map)->count();
+            if ($count == 0) {
                 exit(json_encode([
                     'code' => 1,
-                    'msg'  => "订单不存在",
+                    'msg'  => "未查询到数据",
                 ]));
             }
+            exit(json_encode([
+                'code'  => 0,
+                'msg'   => "",
+                'count' => $count,
+                'data'  => $list,
+            ]));
 
-            $snatch_num = DemandReportModel::where('snatchid', $id)->count();
-            if ($snatch_num >= $snatch['num']) {
-                exit(json_encode([
-                    'code' => 1,
-                    'msg'  => "人数已满",
-                ]));
+        } else {
+            return view('demand/reportlog', [
+                'id' => $id,
+            ]);
+        }
+    }
+
+    public function snatchDetailList()
+    {
+        $id = input('id/d', 0);
+        if (empty($id)) {
+            return '未查询到数据';
+        }
+
+        if (Request::isAjax()) {
+            $limit = input('limit/d', 20);
+            $page  = input('page/d', 1);
+            $map   = [['demand_id', '=', $id], ['status', '>', 1]];
+
+            $list = DemandSnatchModel::with(['worker'])
+                ->where($map)
+                ->order(['id' => 'desc'])
+                ->limit($limit)
+                ->page($page)
+                ->select();
+            if (!$list->isEmpty()) {
+                foreach ($list as $v) {
+                    $v['snatch_num'] = DemandReportModel::where('snatchid',$v['id'])->count();
+                }
             }
 
-            $mobile = input('mobile/s', '');
-            $idcard = input('idcard/s', '');
-            $check = DemandReportModel::where('snatchid',$id)->where('mobile',$mobile)->whereOr('idcard',$idcard)->find();
-            if (!empty($check)) {
+            $count = DemandSnatchModel::where($map)->count();
+            if ($count == 0) {
                 exit(json_encode([
                     'code' => 1,
-                    'msg'  => "该手机号或身份证号已报备,请勿重复",
+                    'msg'  => "未查询到数据",
                 ]));
             }
+            exit(json_encode([
+                'code'  => 0,
+                'msg'   => "",
+                'count' => $count,
+                'data'  => $list,
+            ]));
 
-            DemandReportModel::create([
-                'demandid'   => $snatch['demand_id'],
-                'snatchid'   => $id,
-                'workerid'   => $snatch['demand']['workerid'],
-                'realname'   => input('realname/s', ''),
-                'mobile'     => $mobile,
-                'idcard'     => $idcard,
-                'arrivetime' => input('arrivetime/s', ''),
-                'remark'     => input('remark/s', ''),
-                'createtime' => time(),
-            ]);
-            exit(json_encode(['code' => 0]));
         } else {
-            return view('demand/reportlog', [
-                'id' => $id,
-            ]);
+            return view('demand/snatchdetaillist', ['id' => $id]);
         }
     }
 }

+ 11 - 21
app/worker/view/demand/demandlist.html

@@ -85,6 +85,7 @@
 				<select name="status" lay-filter="status" data-value=""></select>
 			</script>
 			<script type="text/html" id="setTpl">
+				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="snatch"><i class="layui-icon layui-icon-edit"></i>抢单详情</a>
 				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
 				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
 			</script>
@@ -137,7 +138,7 @@
 					{ field: 'volume', title: '浏览量', width: 100, align: 'right' },
 					{ field: 'updatetime', title: '更新时间', width: 170 },
 					{ field: 'createtime', title: '创建时间', width: 170 },
-					{ title: '操作', width: 200, align: 'center', fixed: 'right', toolbar: '#setTpl' }
+					{ title: '操作', width: 250, align: 'center', fixed: 'right', toolbar: '#setTpl' }
 				]
 			],
 			page: true,
@@ -214,26 +215,6 @@
 					layer.full(index);
 				});
 			},
-
-			add_wyd: function() {
-
-				if(is_released == 1001){
-					layer.msg('待审核状态时,最多只能发3条免费消息');
-					return false;
-				}
-
-				layer.confirm('发布新的悬赏单时,会扣除{$param->adddemandwyd}积分。确定新发布吗?',function(one) {
-					layer.close(one);
-					var index = layer.open({
-						type: 2,
-						title: '发布悬赏单',
-						content: 'demandFormWyd.html?id=0',
-						maxmin: true,
-						area: ['750px', '480px']
-					});
-					layer.full(index);
-				});
-			},
 		};
 
 		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
@@ -261,6 +242,15 @@
 					area: ['750px', '480px']
 				});
 				layer.full(index);
+			} else if (obj.event === 'snatch') {
+				var index = layer.open({
+					type: 2,
+					title: '抢单详情',
+					content: 'snatchDetailList.html?id=' + data.id,
+					maxmin: true,
+					area: ['750px', '480px']
+				});
+				layer.full(index);
 			}
 		});
 

+ 24 - 56
app/worker/view/demand/reportlog.html

@@ -2,15 +2,23 @@
 	<div class="layui-card">
 		<div class="layui-form layui-form-pane layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-demand-demandlist-search">
 			<div class="layui-form-item">
+				<input type="hidden" name="id" value="{$id}">
 				<div class="layui-inline">
-					<label class="layui-form-label">状态</label>
+					<label class="layui-form-label">姓名</label>
 					<div class="layui-input-block">
-						<select name="status">
-							<option value="">全部状态</option>
-							<option value="1">待审核</option>
-							<option value="2">审核通过</option>
-							<option value="3">已完成</option>
-						</select>
+						<input type="text" name="realname" placeholder="请输入姓名" autocomplete="off" class="layui-input">
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">电话</label>
+					<div class="layui-input-block">
+						<input type="text" name="mobile" placeholder="请输入电话" autocomplete="off" class="layui-input">
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">身份证号</label>
+					<div class="layui-input-block">
+						<input type="text" name="idcard" placeholder="请输入身份证号" autocomplete="off" class="layui-input">
 					</div>
 				</div>
 				<div class="layui-inline">
@@ -23,16 +31,6 @@
 
 		<div class="layui-card-body">
 			<table id="LAY-demand-demandlist-table" lay-filter="LAY-demand-demandlist-table"></table>
-			<script type="text/html" id="selectStatus">
-				<select name="status" lay-filter="status" data-value=""></select>
-			</script>
-			<script type="text/html" id="setTpl">
-				{{# if(d.status > 1){ }}
-					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="report"><i class="layui-icon layui-icon-edit"></i>报备</a>
-					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reportlog"><i class="layui-icon layui-icon-edit"></i>报备记录</a>
-				{{# } }}
-				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-delete"></i>订单详情</a>
-			</script>
 		</div>
 	</div>
 </div>
@@ -54,17 +52,18 @@
 		table.render({
 			elem: '#LAY-demand-demandlist-table',
 			height: 'full-20',
-			url: setter.baseWorkerUrl + 'demand/reportlog',
+			url: setter.baseWorkerUrl + 'demand/reportlog?id={$id}',
 			cols: [
 				[
 					{ field: 'id', width: 80, title: '表ID', sort: true },
-					{ field: 'demand', title: '岗位标题', minWidth: 200, toolbar: '<div>{{d.demand.title}}</div>' },
-					{ field: 'worker', title: '公司名称', width: 200, toolbar: '<div>{{d.demand.worker.title}}</div>'  },
-					{ field: 'demand', title: '联系电话', width: 120, toolbar: '<div>{{d.demand.telephone}}</div>' },
-					{ field: 'num', title: '招聘人数', width: 100 },
-					{ field: 'status_text', title: '状态', width: 100 },
-					{ field: 'createtime', title: '接单时间', width: 180 },
-					{ title: '操作', width: 280, align: 'center', fixed: 'right', toolbar: '#setTpl' }
+					{ field: 'realname', title: '姓名', width: 100 },
+					{ field: 'mobile', title: '手机号', width: 120 },
+					{ field: 'idcard', title: '身份证号', width: 180 },
+					{ field: 'arrivetime', title: '预计到达时间', width: 150 },
+					{ field: 'remark', title: '备注信息', width: 200 },
+					{ field: 'createtime', title: '报备时间', width: 150 },
+					{ field: 'agentid', title: '门店', minWidth: 100, toolbar: '<div>{{d.agent ? d.agent.title : ""}}</div>' },
+					{ field: 'brokerid', title: '经纪人', minWidth: 100, toolbar: '<div>{{d.broker ? d.broker.title : ""}}</div>' },
 				]
 			],
 			page: true,
@@ -83,37 +82,6 @@
 			});
 		});
 
-		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
-			var data = obj.data;
-			if (obj.event === 'report') {
-				let index = layer.open({
-					type: 2,
-					title: '报备',
-					content: 'report.html?id=' + data.id,
-					maxmin: true,
-					area: ['750px', '480px']
-				});
-				layer.full(index);
-			} else if (obj.event === 'reportlog') {
-				let index = layer.open({
-					type: 2,
-					title: '编辑其他订单信息',
-					content: 'reportlog.html?id=' + data.id,
-					maxmin: true,
-					area: ['750px', '480px']
-				});
-				layer.full(index);
-			} else if (obj.event === 'detail') {
-				let index = layer.open({
-					type: 2,
-					title: '订单详情',
-					content: 'demanddetail.html?id=' + data.demand_id,
-					maxmin: true,
-					area: ['750px', '480px']
-				});
-				layer.full(index);
-			}
-		});
 
 	});
 </script>

+ 1 - 1
app/worker/view/demand/roblist.html

@@ -98,7 +98,7 @@
 				let index = layer.open({
 					type: 2,
 					title: '编辑其他订单信息',
-					content: 'reportlog.html?id=' + data.id,
+					content: 'reportLog.html?id=' + data.id,
 					maxmin: true,
 					area: ['750px', '480px']
 				});

+ 43 - 0
app/worker/view/demand/snatchdetaillist.html

@@ -0,0 +1,43 @@
+<div class="layui-fluid">
+	<div class="layui-card">
+		<div class="layui-card-body">
+			<table id="LAY-demand-demandlist-table" lay-filter="LAY-demand-demandlist-table"></table>
+		</div>
+	</div>
+</div>
+
+<script>
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set', 'table'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			form = layui.form,
+			table = layui.table;
+
+		form.render();
+
+		table.render({
+			elem: '#LAY-demand-demandlist-table',
+			height: 'full-20',
+			url: setter.baseWorkerUrl + 'demand/snatchDetailList?id={$id}',
+			cols: [
+				[
+					{ field: 'id', width: 80, title: '表ID' },
+					{ field: 'worker', title: '公司名称', width: 200, toolbar: '<div>{{d.worker.title}}</div>'  },
+					{ field: 'num', title: '接单人数', width: 100 },
+					{ field: 'snatch_num', title: '报备人数', width: 100 },
+					{ field: 'createtime', title: '接单时间', width: 180 },
+				]
+			],
+			page: true,
+			limit: 50,
+			toolbar: true,
+			cellMinWidth: 150,
+			text: '对不起,加载出现异常!'
+		});
+
+	});
+</script>