linwu před 2 roky
rodič
revize
ab49846ec5

+ 39 - 0
app/common/model/DemandSnatch.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class DemandSnatch extends Model
+{
+    // 设置字段信息
+    protected $schema = [
+        'id'         => 'int',
+        'demand_id'  => 'int',
+        'worker_id'  => 'int',
+        'num'        => 'int',
+        'status'     => 'int',
+        'createtime' => 'int',
+    ];
+
+    // 设置字段自动转换类型
+    protected $type = [
+        'createtime' => 'timestamp:Y-m-d H:i:s',
+    ];
+
+    public function demand()
+    {
+        return $this->hasOne(Demand::class, 'id', 'demand_id');
+    }
+
+    public function worker()
+    {
+        return $this->hasOne(Worker::class, 'id', 'worker_id');
+    }
+
+    public function getStatusTextAttr($value,$data)
+    {
+        $fstatus = [1=>'待审核', 2=>'审核通过', 3=>'已完成'];
+        return $fstatus[$data['status']];
+    }
+}

+ 122 - 59
app/mainapp/controller/Demand.php

@@ -2,19 +2,14 @@
 
 namespace app\mainapp\controller;
 
-use think\facade\Session;
 use app\mainapp\BaseController;
 
-use app\common\model\User as UserModel;
 use app\common\model\Demand as DemandModel;
 use app\common\model\DemandCate as DemandCateModel;
 use app\common\model\DemandLog as DemandLogModel;
 use app\common\model\Param as ParamModel;
-use app\common\model\Worker as WorkerModel;
 use app\common\model\WorkerLog as WorkerLogModel;
-use app\common\model\UserIntegral as UserIntegralModel;
-
-use echowx\WxProgram;
+use app\common\model\DemandSnatch as DemandSnatchModel;
 
 class Demand extends BaseController
 {
@@ -108,7 +103,7 @@ class Demand extends BaseController
             $map[] = ['district', '=', $district];
         }
         $orderby = ['status' => 'asc', 'updatetime' => 'desc', 'id' => 'desc'];
-        $plist   = DemandModel::with(['worker', 'demandCate'])->where($map)->order($orderby)->page($ppage)->limit($psize)->append(['ftype_text','type_text'])->select();
+        $plist   = DemandModel::with(['worker', 'demandCate'])->where($map)->order($orderby)->page($ppage)->limit($psize)->append(['ftype_text', 'type_text'])->select();
         page_result(0, "", [
             'plist'   => $plist,
             'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
@@ -119,7 +114,7 @@ class Demand extends BaseController
     public function getDemand()
     {
         $demandid = input('demandid/d', 0);
-        $demand   = DemandModel::with(['worker'])->where('status', 'in', '3,4')->where('id', '=', $demandid)->append(['ftype_text','type_text'])->findOrEmpty();
+        $demand   = DemandModel::with(['worker'])->where('status', 'in', '3,4')->where('id', '=', $demandid)->append(['ftype_text', 'type_text'])->findOrEmpty();
         if ($demand->isEmpty()) {
             page_result(1, "订单信息不存在。");
         }
@@ -173,65 +168,133 @@ class Demand extends BaseController
         ]);
     }
 
-    public function setDemandLog()
+    public function demandSnatch()
     {
-        $demandid = input('demandid/d', 0);
-        $demand   = DemandModel::findOrEmpty($demandid);
-        if ($demand->isEmpty()) {
-            page_result(1, "订单信息不存在");
+        $id = input('id/d', 0);
+        if (empty($id)) {
+            page_result(1, "未查询到数据。");
         }
-        if (strtotime($demand->enddate) + 86400 < time()) {
-            page_result(1, "该订单信息接单已截止,不能再接单了。");
+
+        //数据校验
+        $num      = input('num/d', 0);
+        $workerid = input('workerid/d', 0);
+        if ($num <= 0) {
+            page_result(1, "抢单人数必须大于0。");
         }
-        $gworkerid = input('gworkerid/d', 0);
-        $worker    = WorkerModel::findOrEmpty($gworkerid);
-        if ($worker->isEmpty()) {
-            page_result(1, "劳务企业信息不存在");
+        if (empty($workerid)) {
+            page_result(1, "登录信息异常,请重新登录。");
         }
-        $log = DemandLogModel::where(['demandid' => $demandid, 'gworkerid' => $gworkerid])->findOrEmpty();
-        if ($log->isEmpty()) {
-            $log = new DemandLogModel;
-            $log->save([
-                'workerid'   => $demand->workerid,
-                'demandid'   => $demandid,
-                'gworkerid'  => $gworkerid,
-                'createtime' => time(),
-            ]);
-            $userid = input('userid/d', 0);
-            $user   = UserModel::where(1)->findOrEmpty($userid);
-            $param  = ParamModel::where(1)->findOrEmpty();
-            if ($user->integral < $param->teldemand) {
-                page_result(1, "接单&咨询该订单会扣除" . $param->teldemand . "积分,你当前积分不足。");
-            }
-            $intdata = [
-                'userid'      => $userid,
-                'title'       => "接单&咨询订单信息扣除",
-                'intvalue'    => 0 - $param->teldemand,
-                'intmoney'    => 0.00,
-                'onlycontent' => "",
-                'remark'      => $demand->title,
-                'itype'       => 5,
-                'status'      => 2,
-                'createtime'  => date("Y-m-d H:i:s"),
-                'yeartime'    => date("Y"),
-                'monthtime'   => date("Ym"),
+        $demand = DemandModel::find($id);
+        if (empty($demand)) {
+            page_result(1, "订单不存在。");
+        }
+        $check = DemandSnatchModel::where('demand_id', $id)->where('worker_id', $workerid)->find();
+        if (!empty($check)) {
+            page_result(1, "请勿重复抢单。");
+        }
+        $total  = DemandSnatchModel::where('status', '>', 1)->where('demand_id', $id)->sum('num');
+        $remain = $demand['num'] - $total;
+        if ($demand['num'] - $total < $num) {
+            page_result(1, "订单剩余{$remain}人,请输入该人数以下的值。");
+        }
+
+        //抢单
+        DemandSnatchModel::create([
+            'demand_id'  => $id,
+            'worker_id'  => $workerid,
+            'num'        => $num,
+            'status'     => 1,
+            'createtime' => date("Y-m-d H:i:s"),
+        ]);
+
+        page_result(0, "", []);
+    }
+
+    public function listSnatch()
+    {
+        $ppage    = input('ppage/d', 1);
+        $psize    = input('psize/d', 20);
+        $workerid = input('workerid/d', 0);
+        $map[]    = ['worker_id', '=', $workerid];
+        $status   = input('status/d', 0);
+        if (!empty($status)) {
+            $map[] = [
+                ['status', '=', $status],
             ];
-            UserIntegralModel::create($intdata);
-            $integral = intval($user->integral) - intval($param->teldemand);
-            $user->save([
-                'integral' => $integral,
-            ]);
-            $telearr   = $demand->telearr;
-            $telearr[] = $userid;
-            $demand->save([
-                'telearr' => $telearr,
-            ]);
-            page_result(0, "", []);
-        } else {
-            page_result(1, "你已接单过了,无需重复接单。");
         }
+        $plist = DemandSnatchModel::with(['demand', 'worker'])
+            ->where($map)
+            ->order(['createtime' => 'desc', 'id' => 'desc'])
+            ->page($ppage)
+            ->limit($psize)
+            ->append(['status_text', 'demand'=>['ftype_text','wtype_text']])
+            ->select();
+
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
     }
 
+//    public function setDemandLog()
+//    {
+//        $demandid = input('demandid/d', 0);
+//        $demand   = DemandModel::findOrEmpty($demandid);
+//        if ($demand->isEmpty()) {
+//            page_result(1, "订单信息不存在");
+//        }
+//        if (strtotime($demand->enddate) + 86400 < time()) {
+//            page_result(1, "该订单信息接单已截止,不能再接单了。");
+//        }
+//        $gworkerid = input('gworkerid/d', 0);
+//        $worker    = WorkerModel::findOrEmpty($gworkerid);
+//        if ($worker->isEmpty()) {
+//            page_result(1, "劳务企业信息不存在");
+//        }
+//        $log = DemandLogModel::where(['demandid' => $demandid, 'gworkerid' => $gworkerid])->findOrEmpty();
+//        if ($log->isEmpty()) {
+//            $log = new DemandLogModel;
+//            $log->save([
+//                'workerid'   => $demand->workerid,
+//                'demandid'   => $demandid,
+//                'gworkerid'  => $gworkerid,
+//                'createtime' => time(),
+//            ]);
+//            $userid = input('userid/d', 0);
+//            $user   = UserModel::where(1)->findOrEmpty($userid);
+//            $param  = ParamModel::where(1)->findOrEmpty();
+//            if ($user->integral < $param->teldemand) {
+//                page_result(1, "接单&咨询该订单会扣除" . $param->teldemand . "积分,你当前积分不足。");
+//            }
+//            $intdata = [
+//                'userid'      => $userid,
+//                'title'       => "接单&咨询订单信息扣除",
+//                'intvalue'    => 0 - $param->teldemand,
+//                'intmoney'    => 0.00,
+//                'onlycontent' => "",
+//                'remark'      => $demand->title,
+//                'itype'       => 5,
+//                'status'      => 2,
+//                'createtime'  => date("Y-m-d H:i:s"),
+//                'yeartime'    => date("Y"),
+//                'monthtime'   => date("Ym"),
+//            ];
+//            UserIntegralModel::create($intdata);
+//            $integral = intval($user->integral) - intval($param->teldemand);
+//            $user->save([
+//                'integral' => $integral,
+//            ]);
+//            $telearr   = $demand->telearr;
+//            $telearr[] = $userid;
+//            $demand->save([
+//                'telearr' => $telearr,
+//            ]);
+//            page_result(0, "", []);
+//        } else {
+//            page_result(1, "你已接单过了,无需重复接单。");
+//        }
+//    }
+
     // public function teleDemand()
     // {
     // 	$demandid = input('demandid/d', 0);

+ 157 - 0
app/worker/controller/Demand.php

@@ -10,6 +10,7 @@ use app\common\model\DemandCate as DemandCateModel;
 use app\common\model\DemandLog as DemandLogModel;
 use app\common\model\User as UserModel;
 use app\common\model\UserIntegral as UserIntegralModel;
+use app\common\model\DemandSnatch as DemandSnatchModel;
 
 use app\common\validate\Demand as DemandValidate;
 use think\exception\ValidateException;
@@ -774,4 +775,160 @@ class Demand extends BaseController
             'code' => 0,
         ]));
     }
+
+    // 企业招聘
+    public function allhall()
+    {
+        if (Request::isAjax()) {
+            $limit = input('limit/d', 20);
+            $page  = input('page/d', 1);
+            $map   = [];
+            $map[] = ['status', '=', 3];
+
+            $keywords = input('keywords/s', "");
+            if (!empty($keywords)) {
+                $map[] = ['title', 'like', '%' . $keywords . '%'];
+            }
+
+            $cateid = input('cateid/d', 0);
+            if (!empty($cateid)) {
+                $map[] = ['cateid', '=', $cateid];
+            }
+            $wtype = input('wtype/d');
+            if (!empty($wtype)) {
+                $map[] = ['wtype', '=', $wtype];
+            }
+            $ftype = input('ftype/d');
+            if (!empty($ftype)) {
+                $map[] = ['ftype', '=', $ftype];
+            }
+            $isfree = input('isfree/d', 0);
+            if (!empty($isfree)) {
+                $map[] = ['isfree', '=', $isfree];
+            }
+            $list  = DemandModel::with(['worker', 'demandCate'])
+                ->withCount(['demandLog'])
+                ->where($map)
+                ->order(['priority' => 'desc', 'id' => 'desc',])
+                ->limit($limit)
+                ->page($page)
+                ->append(['wtype_text', 'ftype_text', 'status_text', 'isfree_text'])
+                ->select();
+            $count = DemandModel::where($map)->count();
+            if ($count == 0) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "未查询到数据",
+                ]));
+            }
+            exit(json_encode([
+                'code'  => 0,
+                'msg'   => "",
+                'count' => $count,
+                'data'  => $list,
+            ]));
+
+        } else {
+            $catelist = DemandCateModel::order(['priority' => 'desc', 'id' => 'desc'])->select();
+            $param    = ParamModel::where(1)->findOrEmpty();
+
+            return view('demand/allhall', [
+                'param'    => $param,
+                'catelist' => $catelist,
+            ]);
+        }
+
+    }
+
+    public function snatchDemand()
+    {
+        $id = input('id/d', 0);
+        if (empty($id)) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "未查询到数据",
+            ]));
+        }
+
+        if (Request::isAjax()) {
+            //数据校验
+            $num = input('num/d', 0);
+            if ($num <= 0) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "抢单人数必须大于等于0",
+                ]));
+            }
+            $demand = DemandModel::findOrEmpty($id);
+            if (empty($demand)) {
+                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) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "订单剩余{$remain}人,请输入该人数以下的值",
+                ]));
+            }
+
+            //抢单
+            $worker_data = Session::get('access_worker');
+            DemandSnatchModel::create([
+                'demand_id'  => $id,
+                'worker_id'  => $worker_data['id'],
+                'num'        => $num,
+                'status'     => 1,
+                'createtime' => date("Y-m-d H:i:s"),
+            ]);
+
+            exit(json_encode(['code' => 0]));
+        } else {
+            return view('demand/snatchDemand', [
+                'id' => $id,
+            ]);
+        }
+    }
+
+    public function roblist()
+    {
+        if (Request::isAjax()) {
+            $limit = input('limit/d', 20);
+            $page  = input('page/d', 1);
+            $map   = [];
+
+            $status = input('status/d', 0);
+            if (!empty($status)) {
+                $map[] = ['status', '=', $status];
+            }
+            $list  = DemandSnatchModel::with(['demand','worker'])
+                ->where($map)
+                ->order(['id' => 'desc',])
+                ->limit($limit)
+                ->page($page)
+                ->append([ 'status_text'])
+                ->select();
+//            halt($list);
+            $count = DemandSnatchModel::where($map)->count();
+            if ($count == 0) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "未查询到数据",
+                ]));
+            }
+            exit(json_encode([
+                'code'  => 0,
+                'msg'   => "",
+                'count' => $count,
+                'data'  => $list,
+            ]));
+
+        } else {
+            return view('demand/roblist');
+        }
+    }
+
 }

+ 163 - 0
app/worker/view/demand/allhall.html

@@ -0,0 +1,163 @@
+<div class="layui-fluid">
+	<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">
+				<div class="layui-inline">
+					<label class="layui-form-label">岗位标题</label>
+					<div class="layui-input-block">
+						<input type="text" name="keywords" placeholder="请输入" autocomplete="off" class="layui-input">
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">岗位类型</label>
+					<div class="layui-input-block">
+						<select name="cateid" lay-search>
+							<option value="">全部岗位类型(可搜索)</option>
+							{volist name="catelist" id="vo"}
+							<option value="{$vo['id']}">{$vo['title']}</option>
+							{/volist}
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">薪资类型</label>
+					<div class="layui-input-block">
+						<select name="wtype">
+							<option value="">全部类型</option>
+							<option value="1">按月</option>
+							<option value="2">按时</option>
+							<option value="3">按件</option>
+							<option value="4">按项目</option>
+							<option value="5">其他</option>
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">返费类型</label>
+					<div class="layui-input-block">
+						<select name="ftype">
+							<option value="">全部类型</option>
+							<option value="1">一次性</option>
+							<option value="2">小时工</option>
+							<option value="3">管理费</option>
+							<option value="4">其他</option>
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">状态</label>
+					<div class="layui-input-block">
+						<select name="status">
+							<option value="">全部状态</option>
+							<option value="2">待审核</option>
+							<option value="3">已上架</option>
+							<option value="4">已停招</option>
+							<option value="5">已下架</option>
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">是否悬赏单</label>
+					<div class="layui-input-block">
+						<select name="isfree">
+							<option value="">全部类型</option>
+							<option value="1">否</option>
+							<option value="2">是</option>
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<button class="layui-btn" lay-submit lay-filter="LAY-demand-demandlist-btn">
+						<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+					</button>
+				</div>
+			</div>
+		</div>
+
+		<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">
+				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="snatch"><i class="layui-icon layui-icon-edit"></i>抢单</a>
+			</script>
+		</div>
+	</div>
+</div>
+
+<script>
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set', 'table'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			admin = layui.admin,
+			form = layui.form,
+			table = layui.table;
+
+		form.render();
+
+		table.render({
+			elem: '#LAY-demand-demandlist-table',
+			height: 'full-20',
+			url: setter.baseWorkerUrl + 'demand/demandList',
+			cols: [
+				[
+					{ type: 'checkbox', fixed: 'left' },
+					{ field: 'id', width: 80, title: '表ID', sort: true },
+					{ field: 'title', title: '岗位标题', minWidth: 300},
+					{ field: 'num', title: '招聘人数', width: 100 },
+					{ field: 'cateid', title: '岗位类型', width: 120, toolbar: '<div>{{d.demandCate.title}}</div>' },
+					{ field: 'province', title: '省', width: 100 },
+					{ field: 'city', title: '市', width: 100 },
+					{ field: 'district', title: '区县', width: 100 },
+					{ field: 'agegroup', title: '招工年龄', width: 120 },
+					{ field: 'enddate', title: '截止日期', width: 120 },
+					{ field: 'wtype_text', title: '薪资类型', align: 'center', width: 100 },
+					{ field: 'bwagall', title: '基本工资'},
+					{ field: 'zwagall', title: '综合月薪'},
+					{ field: 'ftype_text', title: '返费类型', align: 'center', width: 100 },
+					{ field: 'fwagall', title: '供人方利润'},
+					{ field: 'telephone', title: '咨询电话' },
+					{ field: 'remark', title: '补充说明', minWidth: 240},
+					{ field: 'status_text', title: '状态', width: 80, align: 'center' },
+					{ field: 'isfree_text', title: '悬赏单', width: 80, align: 'center' },
+					{ field: 'volume', title: '浏览量', width: 100, align: 'right' },
+					{ field: 'updatetime', title: '更新时间', width: 170 },
+					{ field: 'createtime', title: '创建时间', width: 170 },
+					{ title: '操作', width: 100, align: 'center', fixed: 'right', toolbar: '#setTpl' }
+				]
+			],
+			page: true,
+			limit: 50,
+			toolbar: true,
+			cellMinWidth: 150,
+			text: '对不起,加载出现异常!'
+		});
+
+		form.on('submit(LAY-demand-demandlist-btn)', function(data) {
+			table.reload('LAY-demand-demandlist-table', {
+				where: data.field,
+				page: {
+					curr: 1
+				}
+			});
+		});
+
+		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
+			var data = obj.data;
+			 if (obj.event === 'snatch') {
+				layer.open({
+					type: 2,
+					title: '抢单',
+					content: 'snatchDemand.html?id=' + data.id,
+					area: ['450px', '220px']
+				});
+			}
+		});
+
+	});
+</script>

+ 1 - 2
app/worker/view/demand/demandlist.html

@@ -23,7 +23,6 @@
 					<label class="layui-form-label">薪资类型</label>
 					<div class="layui-input-block">
 						<select name="wtype">
-							<option value="">全部类型</option>
 							<option value="">全部类型</option>
 							<option value="1">按月</option>
 							<option value="2">按时</option>
@@ -36,7 +35,7 @@
 				<div class="layui-inline">
 					<label class="layui-form-label">返费类型</label>
 					<div class="layui-input-block">
-						<select name="wtype">
+						<select name="ftype">
 							<option value="">全部类型</option>
 							<option value="1">一次性</option>
 							<option value="2">小时工</option>

+ 162 - 0
app/worker/view/demand/roblist.html

@@ -0,0 +1,162 @@
+<div class="layui-fluid">
+	<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">
+				<div class="layui-inline">
+					<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>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<button class="layui-btn" lay-submit lay-filter="LAY-demand-demandlist-btn">
+						<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+					</button>
+				</div>
+			</div>
+		</div>
+
+		<div class="layui-card-body">
+			<div style="padding-bottom: 10px;">
+				<button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
+			</div>
+
+			<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">
+				<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-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>
+		</div>
+	</div>
+</div>
+
+<script>
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set', 'table'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			admin = layui.admin,
+			form = layui.form,
+			table = layui.table;
+
+		form.render();
+
+		table.render({
+			elem: '#LAY-demand-demandlist-table',
+			height: 'full-20',
+			url: setter.baseWorkerUrl + 'demand/roblist',
+			cols: [
+				[
+					{ type: 'checkbox', fixed: 'left' },
+					{ 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.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' }
+				]
+			],
+			page: true,
+			limit: 50,
+			toolbar: true,
+			cellMinWidth: 150,
+			text: '对不起,加载出现异常!'
+		});
+
+		form.on('submit(LAY-demand-demandlist-btn)', function(data) {
+			table.reload('LAY-demand-demandlist-table', {
+				where: data.field,
+				page: {
+					curr: 1
+				}
+			});
+		});
+
+		var active = {
+			batchdel: function() {
+				var checkStatus = table.checkStatus('LAY-demand-demandlist-table'),
+					checkData = checkStatus.data; //得到选中的数据
+				if (checkData.length === 0) {
+					return layer.msg('请选择数据');
+				}
+				var idarr = [];
+				for (var i = 0; i < checkData.length; i++) {
+					idarr.push(checkData[i].id);
+				}
+				layer.confirm('确定删除此订单信息吗?', function(index) {
+					admin.req({
+						url: setter.baseWorkerUrl + 'demand/deldemand',
+						data: {
+							idarr: idarr
+						},
+						done: function(res) {
+							obj.del();
+							layer.msg('已删除');
+						}
+					});
+					table.reload('LAY-demand-demandlist-table');
+					layer.msg('已删除');
+				});
+			},
+
+			add: function() {
+				var index = layer.open({
+					type: 2,
+					title: '发布其他订单',
+					content: 'otherForm.html?id=0',
+					maxmin: true,
+					area: ['750px', '480px']
+				});
+				layer.full(index);
+			},
+		};
+
+		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
+			var data = obj.data;
+			if (obj.event === 'del') {
+				layer.confirm('确定删除此订单信息吗?', function(index) {
+					admin.req({
+						url: setter.baseWorkerUrl + 'demand/deldemand',
+						data: {
+							idarr: [data.id]
+						},
+						done: function(res) {
+							obj.del();
+							layer.msg('已删除');
+						}
+					});
+					layer.close(index);
+				});
+			} else if (obj.event === 'edit') {
+				var index = layer.open({
+					type: 2,
+					title: '编辑其他订单信息',
+					content: 'otherform.html?id=' + data.id,
+					maxmin: true,
+					area: ['750px', '480px']
+				});
+				layer.full(index);
+			}
+		});
+
+		$('.layui-btn.layuiadmin-btn').on('click', function() {
+			var type = $(this).data('type');
+			active[type] ? active[type].call(this) : '';
+		});
+
+	});
+</script>

+ 59 - 0
app/worker/view/demand/snatchDemand.html

@@ -0,0 +1,59 @@
+<div class="layui-fluid">
+	<div class="layui-row layui-col-space15">
+		<div class="layui-col-md12">
+			<div class="layui-card">
+				<div class="layui-card-body" pad15>
+					<div class="layui-form layui-form-pane" lay-filter="LAY-demand-demandform-edit">
+						<input type="hidden" name="id" value="{$id}">
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>抢单人数</label>
+							<div class="layui-input-block">
+								<input type="text" name="num" value="{$demand.num|default=1}" lay-verify="number" placeholder="请输入..."
+									   autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<div class="layui-input-block">
+								<input type="button" lay-submit lay-filter="LAY-demand-demandform-edit-submit" value="确认提交" class="layui-btn">
+							</div>
+						</div>
+					</div>
+
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+
+
+<script>
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			admin = layui.admin,
+			form = layui.form;
+
+		form.render();
+
+
+		form.on('submit(LAY-demand-demandform-edit-submit)', function(obj) {
+			var index = parent.layer.getFrameIndex(window.name);
+			admin.req({
+				url: setter.baseWorkerUrl + 'demand/snatchDemand',
+				data: obj.field,
+				type: 'post',
+				done: function(res) {
+					layer.msg("提交成功", {
+						icon: 1
+					});
+					parent.layui.table.reload('LAY-demand-demandlist-table'); //重载表格
+					parent.layer.close(index);
+				}
+			});
+		});
+	});
+</script>

+ 6 - 6
app/worker/view/index.html

@@ -116,12 +116,12 @@
 							<dd>
 								<a lay-href="{:url('/demand/otherlist')}" lay-text="其他订单">其他订单</a>
 							</dd>
-							<!--<dd>-->
-								<!--<a lay-href="{:url('/demand/allhall')}" lay-text="抢单大厅">抢单大厅</a>-->
-							<!--</dd>-->
-							<!--<dd>-->
-								<!--<a lay-href="{:url('/demand/roblist')}" lay-text="抢到的订单">抢到的订单</a>-->
-							<!--</dd>-->
+							<dd>
+								<a lay-href="{:url('/demand/allhall')}" lay-text="抢单大厅">抢单大厅</a>
+							</dd>
+							<dd>
+								<a lay-href="{:url('/demand/roblist')}" lay-text="抢到的订单">抢到的订单</a>
+							</dd>
 							<dd>
 								<a lay-href="{:url('/demand/logList')}" lay-text="报名记录">报名记录</a>
 							</dd>