Ver código fonte

个人中心

linwu 1 ano atrás
pai
commit
ff50d982e3

+ 59 - 0
app/BaseController.php

@@ -100,4 +100,63 @@ abstract class BaseController
         return $v->failException(true)->check($data);
     }
 
+
+
+
+    /**
+     * 等于条件
+     */
+    protected function dealEqualInput($equal_array, $result = [])
+    {
+        foreach ($equal_array as $k => $v) {
+            if (!is_numeric($k)) {
+                $value = input($k);
+            } else {
+                $value = input($v);
+            }
+            if (!empty($value)) {
+                $result[] = [$v, '=', $value];
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * like条件
+     */
+    protected function dealLikeInput($like_array, $result = [])
+    {
+        foreach ($like_array as $k => $v) {
+            if (!is_numeric($k)) {
+                $value = input($k);
+            } else {
+                $value = input($v);
+            }
+            if (!empty($value)) {
+                $result[] = [$v, 'like', "%{$value}%"];
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * in条件
+     */
+    protected function dealInInput($in_array, $result = [])
+    {
+        foreach ($in_array as $k => $v) {
+            if (!is_numeric($k)) {
+                $value = input($k);
+            } else {
+                $value = input($v);
+            }
+            if (!empty($value)) {
+                $result[] = [$v, 'in', $value];
+            }
+        }
+
+        return $result;
+    }
 }

+ 2 - 1
app/admin/controller/Agent.php

@@ -82,6 +82,7 @@ class Agent extends BaseController
             'remark'    => input('remark/s', ""),
             'status'    => input('status/d', 1),
             'is_settle' => input('is_settle/d', 1),
+            'type'      => input('type/d', 1),
         ];
         $password = input('password/s', "");
         if (empty($id)) {
@@ -282,7 +283,7 @@ class Agent extends BaseController
     public function settleIncome()
     {
         $agentid = input('agentid');
-        $value    = input('value');
+        $value   = input('value');
 
         if (empty($agentid) || $value <= 0) {
             exit(json_encode([

+ 7 - 0
app/admin/view/agent/agentform.html

@@ -46,6 +46,13 @@
 								<div class="layui-form-mid layui-word-aux">可以是代理特定编号,需要确保唯一性。</div>
 							</div>
 						</div>
+						<div class="layui-form-item" pane>
+							<label class="layui-form-label">类型</label>
+							<div class="layui-input-block">
+								<input type="radio" name="type" value="1" title="普通门店" {eq name="agent.type|default=1" value="1" }checked{/eq} />
+								<input type="radio" name="type" value="2" title="省外经纪人" {eq name="agent.type" value="2" }checked{/eq} />
+							</div>
+						</div>
 						<div class="layui-form-item">
 							<label class="layui-form-label"><span style="color:#f90c05;">*</span>代理名称</label>
 							<div class="layui-input-block">

+ 1 - 0
app/admin/view/broker/applylist.html

@@ -26,6 +26,7 @@
 							<option value="">全部</option>
 							<option value="1">经纪人</option>
 							<option value="2">红色合伙人</option>
+							<option value="3">省外经纪人</option>
 						</select>
 					</div>
 				</div>

+ 1 - 0
app/admin/view/broker/brokerform.html

@@ -62,6 +62,7 @@
 							<div class="layui-input-block">
 								<input type="radio" name="type" value="1" title="经纪人" {eq name="broker.type|default=1" value="1" }checked{/eq} />
 								<input type="radio" name="type" value="2" title="红色合伙人" {eq name="broker.type" value="2" }checked{/eq} />
+								<input type="radio" name="type" value="3" title="省外经纪人" {eq name="broker.type" value="3" }checked{/eq} />
 							</div>
 						</div>
 						<div class="layui-form-item" id="LAY-broker-brokerform-edit-areapicker">

+ 1 - 0
app/common/model/Agent.php

@@ -41,6 +41,7 @@ class Agent extends Model
         'is_settle'    => 'tinyint',
         'money'        => 'decimal',
         'money_total'  => 'decimal',
+        'type'         => 'tinyint',
     ];
 
     // 设置字段自动转换类型

+ 1 - 1
app/common/model/Broker.php

@@ -59,7 +59,7 @@ class Broker extends Model
 
     public function getTypeTextAttr($value, $data)
     {
-        $status = [1 => '经纪人', 2 => '红色合伙人'];
+        $status = [1 => '经纪人', 2 => '红色合伙人', 3 => '省外经纪人'];
         return $status[$data['type']];
     }
 

+ 1 - 1
app/common/model/BrokerForm.php

@@ -39,7 +39,7 @@ class BrokerForm extends Model
 
     public function getTypeTextAttr($value, $data)
     {
-        $status = [1 => '经纪人', 2 => '红色合伙人'];
+        $status = [1 => '经纪人', 2 => '红色合伙人', 3 => '省外经纪人'];
         return $status[$data['type']];
     }
 

+ 1 - 0
app/mainapp/controller/Broker.php

@@ -30,6 +30,7 @@ class Broker extends BaseController
         $psize     = input('psize/d', 20);
         $map       = [];
         $map[]     = ['status', '=', 1];
+        $map[]     = ['type', '<>', 3];
         $searchval = input('searchval/s', "");
         if (!empty($searchval)) {
             $map[] = ['title|region', 'like', '%' . $searchval . '%'];

+ 14 - 14
app/mainapp/controller/Index.php

@@ -221,40 +221,40 @@ class Index extends BaseController
 
     public function getAgent()
     {
-        $agent = AgentModel::field('id,workerid,title')->where('status',1)->select();
-        page_result(0,'',$agent);
+        $agent = AgentModel::field('id,workerid,title')->where('type', 1)->where('status', 1)->select();
+        page_result(0, '', $agent);
     }
 
     public function getWorker()
     {
-        $workerids = AgentModel::field('workerid')->where('status',1)->distinct(true)->select()->column('workerid');
-        $list = WorkerModel::field('id,title')->where('status',5)->whereIn('id',$workerids)->select();
-        $agent = AgentModel::field('id,title')->where('status',1)->where('workerid',$list[0]['id'])->select();
+        $workerids = AgentModel::field('workerid')->where('status', 1)->distinct(true)->select()->column('workerid');
+        $list      = WorkerModel::field('id,title')->where('status', 5)->whereIn('id', $workerids)->select();
+        $agent     = AgentModel::field('id,title')->where('status', 1)->where('workerid', $list[0]['id'])->select();
 
-        page_result(0,'',[$list,$agent]);
+        page_result(0, '', [$list, $agent]);
     }
 
     public function getAgentByWorker()
     {
-        $workerid = input('workerid',0);
+        $workerid = input('workerid', 0);
         if (empty($workerid)) {
             page_result(0, "", []);
         }
-        $agent = AgentModel::field('id,title')->where('status',1)->where('workerid',$workerid)->select();
+        $agent = AgentModel::field('id,title')->where('status', 1)->where('workerid', $workerid)->select();
 
-        page_result(0,'',$agent);
+        page_result(0, '', $agent);
     }
 
     public function getTown()
     {
-        $town = file_get_contents(root_path('public/static/jscss').'town.json');
-        page_result(0,'',json_decode($town,true));
+        $town = file_get_contents(root_path('public/static/jscss') . 'town.json');
+        page_result(0, '', json_decode($town, true));
     }
 
     public function getStreet()
     {
-        $town = file_get_contents(root_path('public/static/jscss').'town.json');
-        $street = json_decode($town,true)['town'];
-        page_result(0,'',$street);
+        $town   = file_get_contents(root_path('public/static/jscss') . 'town.json');
+        $street = json_decode($town, true)['town'];
+        page_result(0, '', $street);
     }
 }

+ 0 - 1
app/mainapp/controller/Login.php

@@ -11,7 +11,6 @@ use app\common\model\UserPart as UserPartModel;
 
 use alisms\SignatureHelper;
 use app\common\service\BalanceService;
-use app\common\service\IntegralService;
 use chuanglan\Chuanglan;
 use echowx\WxProgram;
 

+ 4 - 4
app/mainapp/controller/My.php

@@ -172,7 +172,7 @@ class My extends BaseController
         // $user['nickname']  = mb_substr($user['nickname'],0,6,'utf-8').'...';
         $workerall = WorkerModel::where('userid', '=', $user->id)->select();
         $agentall  = AgentModel::where('userid', '=', $user->id)->select();
-        $brokerall = BrokerModel::where('userid', '=', $user->id)->select();
+        $brokerall = BrokerModel::where('userid', '=', $user->id)->where('status', 1)->where('type', '<>', 3)->select();
         $resident  = ResidentModel::where('userid', '=', $user->id)->findOrEmpty();
         page_result(0, "", [
             'param'     => $param,
@@ -483,9 +483,9 @@ class My extends BaseController
 
     public function perfectUserInfo()
     {
-        $userid = input('userid/d');
-        $skill_cert = input('skill_cert/a',[]);
-        $user   = UserModel::findOrEmpty($userid);
+        $userid     = input('userid/d');
+        $skill_cert = input('skill_cert/a', []);
+        $user       = UserModel::findOrEmpty($userid);
         if ($user->isEmpty()) {
             page_result(1, "用户信息不存在");
         }

+ 56 - 1
app/mobile/common.php

@@ -1,4 +1,11 @@
 <?php
+function page_result($code = 0, $msg = '', $data = [])
+{
+    $res      = ['code' => $code, 'msg' => $msg, 'data' => $data];
+    $response = \think\Response::create($res, 'json');
+    throw new \think\exception\HttpResponseException($response);
+}
+
 // 应用公共文件
 function jump($msg = '', $url = null, $wait = 3)
 {
@@ -29,7 +36,7 @@ function get_user_id()
 {
     $sessionUserId = session('mobile.user.id');
     if (empty($sessionUserId)) {
-        session('back_url',request()->url());
+        session('back_url', request()->url());
         $response = redirect('/mobile/login/login');
         throw new \think\exception\HttpResponseException($response);
     }
@@ -37,3 +44,51 @@ function get_user_id()
     return $sessionUserId;
 }
 
+function get_user()
+{
+    $sessionUserId = session('mobile.user.id');
+    if (empty($sessionUserId)) {
+        if (request()->isAjax()) {
+            $res      = ['code' => 401, 'msg' => '请登录'];
+            $response = \think\Response::create($res, 'json');
+            throw new \think\exception\HttpResponseException($response);
+        } else {
+            session('back_url', request()->url());
+            $response = redirect('/mobile/login/login');
+            throw new \think\exception\HttpResponseException($response);
+        }
+    }
+
+    $user = \app\common\model\User::where('id', $sessionUserId)->find();
+    if (empty($user)) {
+        jump('该用户已删除');
+    }
+
+    return $user;
+}
+
+function get_broker()
+{
+    $broker_id = session('mobile.broker.id');
+    if (empty($broker_id)) {
+        $user   = get_user();
+        $broker = \app\common\model\Broker::where('userid', $user['id'])->find();
+        if (empty($broker)) {
+            if (request()->isAjax()) {
+                $res      = ['code' => 401, 'msg' => '请登录'];
+                $response = \think\Response::create($res, 'json');
+                throw new \think\exception\HttpResponseException($response);
+            } else {
+                session('back_url', request()->url());
+                $response = redirect('/mobile/login/login');
+                throw new \think\exception\HttpResponseException($response);
+            }
+        }
+
+        session('mobile.broker.id', $broker_id);
+    } else {
+        $broker = \app\common\model\Broker::where('id', $broker_id)->find();
+    }
+
+    return $broker;
+}

+ 246 - 27
app/mobile/controller/Login.php

@@ -3,12 +3,17 @@
 namespace app\mobile\controller;
 
 use app\mobile\MobileBaseController;
+use app\common\model\UserAuths as UserAuthsModel;
+use app\common\model\Broker as BrokerModel;
+use app\common\model\User as UserModel;
+use app\common\model\Agent as AgentModel;
+use app\common\model\BrokerForm as BrokerFormModel;
+use chuanglan\Chuanglan;
 
 class Login extends MobileBaseController
 {
     public function login()
     {
-        halt('https://www.jucai.gov.cn/api/auth/wechat_auth?url=' . urlencode(url('/mobile/login/wechatBack')));
         return redirect('https://www.jucai.gov.cn/api/auth/wechat_auth?url=' . urlencode(url('/mobile/login/wechatBack')));
     }
 
@@ -17,42 +22,231 @@ class Login extends MobileBaseController
      */
     public function wechatBack()
     {
-        $param   = input('param.');
-        halt($param);
-        $open_id = $param['openid'];
-
-        //登录
-        $user = UserModel::where(['openid' => $open_id])->find();
-        if (empty($user)) {
-            $user = UserModel::create([
-                'nickname'  => $param['nickname'],
-                'avatar'    => $param['headimgurl'],
-                'openid'    => $open_id,
-                'unionid'   => $param['unionid'],
-                'logintime' => time(),
-                'loginip'   => request()->ip(),
-            ]);
+        $param     = input('param.');
+        $unionid   = $param['unionid'];
+        $userauths = UserAuthsModel::where(['identifier' => $unionid, 'identitytype' => "weixin"])->find();
+
+        //登录成功
+        if (!empty($userauths)) {
+            $user = UserModel::where(['id' => $userauths->userid])->find();
+            session('mobile.user.id', $user['id']);
+
+            //非经济人
+            $broker = BrokerModel::where('userid', $user['id'])->find();
+            if (empty($broker)) {
+                return redirect('/mobile/login/broker');
+            }
+            session('mobile.broker.id', $broker['id']);
+
+            return redirect('/mobile/my/index');
+        }
+
+        session('mobile.user.unionid', $param['unionid']);
+        if (!empty($param['nickname'])) {
+            session('mobile.user.nickname', $param['nickname']);
+        }
+        if (!empty($param['avatar'])) {
+            session('mobile.user.avatar', $param['avatar']);
+        }
+
+        return redirect('/mobile/login/mobile');
+    }
+
+    /**
+     * 手机号注册
+     */
+    public function mobile()
+    {
+        $unionid = session('mobile.user.unionid');
+        if (empty($unionid)) {
+            return redirect('/mobile/login/login');
+        }
+
+        return view('login/mobile');
+    }
+
+    public function mobilePost()
+    {
+        $param = input('post.');
+        empty($param['mobile']) && page_result(1, '请输入手机号');
+        empty($param['verify']) && page_result(1, '请输入验证码');
+
+        //验证码校验
+        /*$verify_expire = session('mobile.login.verify_expire');
+        if ($verify_expire > time()) {
+            session('mobile.login.verify', null);
+            session('mobile.login.verify_expire', null);
+            page_result(1, '验证码已过期');
+        }
+        $verify = session('mobile.login.verify');
+        if ($verify != $param['verify']) {
+            page_result(1, '验证码不正确');
+        }*/
+
+        //手机号
+        $unionid   = session('mobile.user.unionid');
+        $userauths = UserAuthsModel::where(['identifier' => $param['mobile'], 'identitytype' => "mobile"])->find();
+        if (!empty($userauths)) {
+            $password = md5(time() . mt_rand(100000, 999999));
+            $this->authsRegister($userauths->userid, "weixin", $unionid, $password);
+            $this->authsRegister($userauths->userid, "mobile", $param['mobile'], $password);
+            session('mobile.user.id', $userauths->userid);
+
+            //非经济人
+            $broker = BrokerModel::where('userid', $userauths->userid)->find();
+            if (empty($broker)) {
+                return page_result(0, '', ['url' => '/mobile/login/broker']);
+            }
+            session('mobile.broker.id', $broker['id']);
+
+            page_result(0, '', ['url' => '/mobile/my/my']);
+        }
+
+        //登录注册
+        $nickname = session('mobile.user.nickname') ?? '';
+        $avatar   = session('mobile.user.avatar') ?? '';
+        $data     = [
+            'groupsid'       => 7,
+            'nickname'       => $nickname,
+            'avatar'         => $avatar,
+            'realname'       => $nickname,
+            'mobile'         => $param['mobile'],
+            'status'         => 2,
+            'bankcard'       => [],
+            'emp_time'       => [],
+            'com_cate'       => [],
+            'work_place'     => [],
+            'user_tags'      => [],
+            'skill_cert'     => [],
+            'createtime'     => time(),
+            'workexperience' => '',
+            'eduexperience'  => '',
+            'broker_channel' => 2,
+            'education'      => '',
+        ];
+        $user     = UserModel::create($data);
+        $password = md5(time() . mt_rand(100000, 999999));
+        $this->authsRegister($user->id, "weixin", $unionid, $password);
+        $this->authsRegister($user->id, "mobile", $param['mobile'], $password);
+        session('mobile.user.id', $user->userid);
+
+        return page_result(0, '', ['url' => '/mobile/login/broker']);
+    }
+
+    public function sendSms()
+    {
+        $mobile   = input('mobile');
+        $ismobile = preg_match('/^1[3456789]{1}[0-9]{9}$/', $mobile);
+        if (!$ismobile) {
+            page_result(1, "请填入正确的手机号");
+        }
+        $userauths = UserAuthsModel::where(['identifier' => $mobile, 'identitytype' => "mobile"])->findOrEmpty();
+        if (!$userauths->isEmpty()) {
+            page_result(1, "该手机号已注册");
+        }
+
+        $smscode = mt_rand(100000, 999999);
+        $sms     = new Chuanglan();
+        $res     = $sms->send($mobile, ['message' => "尊敬的用户,您的短信验证码为{$smscode},5分钟内有效。若非本人操作请忽略。"]);
+        if ($res['code']) {
+            session('mobile.login.verify', $smscode);
+            session('mobile.login.verify_expire', time() + 300);
         } else {
-            $user->logintime = time();
-            $user->loginip   = request()->ip();
-            $user->save();
+            page_result(1, '发送失败,请联系管理员');
         }
 
-        session('mobile.user.id', $user['id']);
+        page_result();
+    }
 
-        $back_url = '/';
-        if (session('?back_url')) {
-            $back_url = session('back_url');
-            session('back_url', null);
+    public function broker()
+    {
+        $unionid = session('mobile.user.unionid');
+        $user_id = session('mobile.user.id');
+        if (empty($unionid) || empty($user_id)) {
+            return redirect('/mobile/login/login');
         }
 
-        return redirect($back_url);
+        $broker = BrokerModel::where('userid', $user_id)->find();
+        if (!empty($broker)) {
+            return redirect('/mobile/my/index');
+        }
+
+        $broker_form = BrokerFormModel::where('userid', $user_id)->find();
+        if (!empty($broker_form)) {
+            return redirect('/mobile/login/brokerTip');
+        }
+
+        $agent_list = AgentModel::where('type', 2)->where('status', 1)->field('title as text,id as value')->select();
+
+        return view('login/broker', ['agent_list' => $agent_list]);
+    }
+
+    public function brokerPost()
+    {
+        $user_id = session('mobile.user.id');
+        empty($user_id) && page_result(401, '请先登录');
+
+        $broker_form = BrokerFormModel::where('userid', $user_id)->find();
+        if (!empty($broker_form)) {
+            return page_result(1, '请不要重复申请');
+        }
+
+        $param = input('post.');
+        empty($param['title']) && page_result(1, '请输入姓名');
+        empty($param['mobile']) && page_result(1, '请输入手机号');
+        empty($param['agent_id']) && page_result(1, '请选择门店');
+        empty($param['region']) && page_result(1, '请输入区域');
+
+        $agent = AgentModel::where([
+            ['id', '=', $param['agent_id']],
+            ['type', '=', 2],
+            ['status', '=', 1],
+        ])->find();
+        if (empty($agent)) {
+            page_result(1, '门店不存在');
+        }
+
+        $user_id = session('mobile.user.id');
+        BrokerFormModel::create([
+            'userid'     => $user_id,
+            'workerid'   => $agent['workerid'],
+            'agentid'    => $agent['id'],
+            'title'      => $param['title'],
+            'avatar'     => '',
+            'mobile'     => $param['mobile'],
+            'province'   => $agent['province'],
+            'city'       => $agent['city'],
+            'district'   => $agent['district'],
+            'town'       => '',
+            'village'    => '',
+            'region'     => $param['region'],
+            'createtime' => time(),
+            'type'       => 3,
+        ]);
+
+        page_result(0, '', ['url' => '/mobile/login/brokerTip']);
+    }
+
+    public function brokerTip()
+    {
+        $user_id = session('mobile.user.id');
+        if (empty($user_id)) {
+            return redirect('/mobile/login/login');
+        }
+        $broker = BrokerModel::where('userid', $user_id)->find();
+        if (!empty($broker)) {
+            session('mobile.broker.id', $broker['id']);
+            return redirect('/mobile/my/index');
+        }
+
+        return view('login/broker_tip');
     }
 
     public function login1()
     {
-        session('mobile.user.id', 1);
-        $back_url = '/';
+        session('mobile.user.id', 293);
+        session('mobile.broker.id', 19);
+        $back_url = '/mobile/my/index';
         if (session('?back_url')) {
             $back_url = session('back_url');
             session('back_url', null);
@@ -60,9 +254,34 @@ class Login extends MobileBaseController
         return redirect($back_url);
     }
 
+    /**
+     * 登出
+     */
     public function logout()
     {
         session('mobile.user.id', null);
+        session('mobile.broker.id', null);
         return '退出';
     }
+
+    public function authsRegister($userid, $identitytype, $identifier, $password)
+    {
+        $userauths = UserAuthsModel::where(['userid' => $userid, 'identitytype' => $identitytype])->findOrEmpty();
+        if (!empty($identifier) && $userauths->isEmpty()) {
+            $userauths = new UserAuthsModel();
+            $userauths->save([
+                'userid'       => $userid,
+                'identitytype' => $identitytype,
+                'identifier'   => $identifier,
+                'password'     => $password,
+                'logintime'    => time(),
+                'loginip'      => $_SERVER['SERVER_ADDR'],
+            ]);
+        } elseif (!empty($identifier) && $identifier !== $userauths->identifier) {
+            $userauths->identifier = $identifier;
+            $userauths->password   = $password;
+            $userauths->save();
+        }
+        return true;
+    }
 }

+ 61 - 0
app/mobile/controller/My.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace app\mobile\controller;
+
+use app\common\model\BrokerIncome as BrokerIncomeModel;
+use app\mobile\MobileBaseController;
+use think\App;
+use think\facade\View;
+
+class My extends MobileBaseController
+{
+    private $_broker = null;
+
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->_broker = get_broker();
+        View::assign('broker', $this->_broker);
+    }
+
+    /**
+     * 个人中心
+     */
+    public function index()
+    {
+        return view('my/index');
+    }
+
+    /**
+     * 收益明细
+     */
+    public function income()
+    {
+        $data = [];
+
+        //上月收益
+        $month_time           = date('Ym', strtotime('-1 month'));
+        $month_income         = BrokerIncomeModel::where(['monthtime' => $month_time, 'brokerid' => $this->_broker['id']])->sum('value');
+        $data['month_income'] = $month_income;
+
+        return view('my/income', $data);
+    }
+
+    /**
+     * 收益明细列表
+     */
+    public function listIncome()
+    {
+        $map = $this->dealEqualInput(['cate_id']);
+
+        $map[] = ['brokerid', '=', $this->_broker['id']];
+        $list  = BrokerIncomeModel::where($map)
+            ->order(['id' => 'desc'])
+            ->limit(input('limit', 10))
+            ->page(input('page', 1))
+            ->append(['status_text'])
+            ->select();
+
+        ajax_success($list);
+    }
+}

+ 112 - 0
app/mobile/view/login/broker.html

@@ -0,0 +1,112 @@
+{extend name="public/base"/}
+{block name="css"}
+<style>
+</style>
+{/block}
+{block name="body"}
+<van-nav-bar
+        class="nav-theme"
+        :fixed="true"
+        :placeholder="true"
+>
+    <template #title>
+        <span class="text-white">省外经纪人注册</span>
+    </template>
+</van-nav-bar>
+<van-image src="__STATIC__/images/applet/bg/broker.png"></van-image>
+<van-form @submit="onSubmit">
+    <van-cell-group>
+        <van-field
+                v-model="form.title"
+                required
+                label="姓名"
+                placeholder="请输入姓名"
+                :rules="[
+                        { required: true, message: '请输入姓名' }
+                    ]"
+        ></van-field>
+        <van-field
+                v-model="form.mobile"
+                required
+                label="手机号"
+                placeholder="请输入手机号"
+                :rules="[
+                        { required: true, message: '请输入手机号' },
+                        { validator, message: '请输入正确的手机号'}
+                    ]"
+        ></van-field>
+        <van-field
+                v-model="agent_name"
+                is-link
+                required
+                readonly
+                label="门店"
+                placeholder="选择门店"
+                @click="showAgent = true"
+                :rules="[
+                        { required: true, message: '请选择门店' }
+                    ]"
+        ></van-field>
+        <van-popup v-model:show="showAgent" round position="bottom">
+            <van-picker
+                    :columns="agentList"
+                    @cancel="showAgent = false"
+                    @confirm="onAgentListConfirm"
+            ></van-picker>
+        </van-popup>
+        <van-field
+                v-model="form.region"
+                required
+                label="区域"
+                placeholder="请输入区域"
+                :rules="[
+                        { required: true, message: '请输入区域' }
+                    ]"
+        ></van-field>
+    </van-cell-group>
+    <div style="margin: 16px;">
+        <van-button block type="primary" native-type="submit">确定</van-button>
+    </div>
+</van-form>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        //表单
+        base.form = Vue.reactive({
+            title: '',
+            mobile: '',
+            agent_id: 0,
+            region: '',
+        });
+
+        //门店选择
+        base.agent_name = Vue.ref('');
+        base.showAgent = Vue.ref(false);
+        base.agentList = Vue.reactive({$agent_list});
+        base.onAgentListConfirm = ({selectedOptions}) => {
+            base.showAgent.value = false;
+            base.form.agent_id = selectedOptions[0].value;
+            base.agent_name.value = selectedOptions[0].text;
+        };
+
+        //登录
+        base.onSubmit = () => {
+            const param = base.form;
+
+            postJson("{:url('login/brokerPost')}", param).then(({data}) => {
+                location.href = data.url;
+            });
+        };
+
+        //手机号验证
+        base.validator = (val) => {
+            return /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(val);
+        };
+
+        return base;
+    }
+</script>
+{/block}

+ 41 - 0
app/mobile/view/login/broker_tip.html

@@ -0,0 +1,41 @@
+{extend name="public/base"/}
+{block name="css"}
+<style>
+    .icon{
+        text-align:center;
+        margin-top:50px;
+    }
+
+    .msg{
+        text-align:center;
+        margin:0;
+        padding:0;
+        font-size:24px;
+    }
+</style>
+{/block}
+{block name="body"}
+<van-nav-bar
+        class="nav-theme"
+        :fixed="true"
+        :placeholder="true"
+>
+    <template #title>
+        <span class="text-white">提示</span>
+    </template>
+</van-nav-bar>
+<div style="width:100%;height:46px;"></div>
+<div class="icon">
+    <van-icon name="warning-o" size="160" color="#0081ff"></van-icon>
+</div>
+<h3 class="msg">您申请的经纪人正在审核中</h3>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        return base;
+    }
+</script>
+{/block}

+ 116 - 0
app/mobile/view/login/mobile.html

@@ -0,0 +1,116 @@
+{extend name="public/base"/}
+{block name="css"}
+<style>
+    .other-login {width:60%;margin:50px auto 0 auto;}
+    .other-login .other-login-icon{display:flex;align-items:center;justify-content:space-around;}
+    .service {display: flex;justify-content: center;text-align:center;margin-top:50px;font-size:14px;}
+    .service a {color:#0081ff;}
+    .lw-title {font-size:18px;text-align:center;font-weight:bold;padding-top:10px;}
+    .content {width:100%;padding-top:10px;}
+    .content p {padding:0;margin:0;text-indent:2em;}
+</style>
+{/block}
+{block name="body"}
+<van-nav-bar
+        class="nav-theme"
+        :fixed="true"
+        :placeholder="true"
+>
+    <template #title>
+        <span class="text-white">登录</span>
+    </template>
+</van-nav-bar>
+    <van-form @submit="onSubmit">
+        <van-cell-group>
+            <van-field
+                    v-model="mobile"
+                    required
+                    label="电话"
+                    placeholder="请输入电话"
+                    :rules="[
+                        { required: true, message: '请填写电话' },
+                        { validator, message: '请输入正确的手机号'}
+                    ]"
+            ></van-field>
+            <van-field
+                    v-model="verify"
+                    required
+                    center
+                    clearable
+                    label="短信验证码"
+                    placeholder="请输入短信验证码"
+                    :rules="[{ required: true, message: '请填写短信验证码' }]"
+            >
+                <template #button>
+                    <van-button size="small" :disabled="second != 60" type="primary" @click="sendSms">{{second_text}}</van-button>
+                </template>
+            </van-field>
+        </van-cell-group>
+        <div style="margin: 16px;">
+            <van-button block type="primary" native-type="submit">确定</van-button>
+        </div>
+    </van-form>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        base.mobile = Vue.ref('');
+        base.verify = Vue.ref('');
+
+        //短信验证码
+        base.is_send = false;
+        base.second = Vue.ref(60);
+        base.set = null;
+        base.sendSms = () => {
+            if (base.is_send) {
+                return false;
+            }
+
+            if (base.mobile.value === '') {
+                vant.showToast('请输入电话');
+                return false;
+            }
+
+            base.is_send = true;
+            postJson("{:url('login/sendSms')}", {mobile:base.mobile.value},({msg})=>{
+                vant.showToast(msg);
+                base.is_send = false;
+            }).then(() => {
+                base.set = setInterval(function(){
+                    base.second.value--;
+                    if (base.second.value === 0) {
+                        base.second.value = 60;
+                        base.is_send = false;
+                        clearInterval(base.set);
+                    }
+                },1000);
+            });
+        };
+        base.second_text = Vue.computed(()=>{
+            if (base.second.value === 60) {
+                return '发送验证码';
+            } else {
+                return `${base.second.value}秒`;
+            }
+        });
+
+        //登录
+        base.onSubmit = () => {
+            const param = {mobile:base.mobile.value,verify:base.verify.value};
+
+            postJson("{:url('login/mobilePost')}", param).then(({data}) => {
+                location.href = data.url;
+            });
+        };
+
+        //手机号验证
+        base.validator = (val) => {
+            return /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(val);
+        }
+
+        return base;
+    }
+</script>
+{/block}

+ 58 - 0
app/mobile/view/my/income.html

@@ -0,0 +1,58 @@
+{extend name="public/base"/}
+{block name="css"}
+<style>
+    .header {background-color: var(--blue);color: #ffffff;padding: 15px;}
+    .header .title {text-align: center;}
+    .header .title .money{font-size: 40px;padding-bottom: 5px;}
+    .header .sub-title{padding-top: 30px;display: flex;justify-content: space-between;}
+</style>
+{/block}
+{block name="body"}
+<van-nav-bar
+        class="nav-theme"
+        :fixed="true"
+        :placeholder="true"
+        left-text="返回"
+        left-arrow
+        @click-left="onBack"
+>
+    <template #title>
+        <span class="text-white">收益明细</span>
+    </template>
+</van-nav-bar>
+
+<div class="header">
+    <div class="title">
+        <div class="money">{{broker.income}}</div>
+        <div>
+            当前收益
+        </div>
+    </div>
+    <div class="sub-title">
+        <div>上月获得:<span>{{month_income}}</span> 元</div>
+        <div>累计已获:<span>{{broker.income_total}}</span> 元</div>
+    </div>
+</div>
+
+{include file="public/list_load" list="<income-list :list='list'></income-list>" /}
+
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = list_load('my/listIncome');
+
+        base.onBack = () => {
+            location.href = "{:url('/mobile/my/index')}";
+        };
+
+        base.broker = {$broker};
+        base.month_income = {$month_income};
+
+        return base;
+    }
+</script>
+{/block}
+{block name="vue"}
+<script src="__COMPONENTS__/incomeList.js"></script>
+{/block}

+ 83 - 0
app/mobile/view/my/index.html

@@ -0,0 +1,83 @@
+{extend name="public/base"/}
+{block name="css"}
+<style>
+    .van-grid .van-grid-item .price {font-size:25px;color: #e54d42;}
+    .van-grid .van-grid-item .price-title {font-size:16px;color: #aaaaaa;}
+    .van-grid .van-grid-item .van-badge__wrapper {text-align:center;}
+</style>
+{/block}
+{block name="body"}
+<van-nav-bar
+        class="nav-theme"
+        :fixed="true"
+        :placeholder="true"
+>
+    <template #title>
+        <span class="text-white">工作台</span>
+    </template>
+</van-nav-bar>
+<div class="header">
+    <van-image src="__STATIC__/images/applet/broker/topBg.png"></van-image>
+</div>
+<van-cell-group>
+    <van-cell title="我的收益" size="large" value="详情" is-link url="{:url('/mobile/my/income')}">
+    </van-cell>
+    <van-grid :column-num="2">
+        <van-grid-item>
+            <template #icon>
+                <span class="price">¥{{broker.income_total}}</span>
+            </template>
+            <template #text>
+                <span class="price-title">总收益</span>
+            </template>
+        </van-grid-item>
+        <van-grid-item>
+            <template #icon>
+                <span class="price">¥{{broker.income}}</span>
+            </template>
+            <template #text>
+                <span class="price-title">当前收益</span>
+            </template>
+        </van-grid-item>
+    </van-grid>
+</van-cell-group>
+
+<div style="width:100%;height:30px;"></div>
+<van-grid clickable :column-num="3">
+    <van-grid-item text="招聘信息">
+        <template #icon>
+            <van-image
+                    width="50%"
+                    src="__MIMAGES__/icon_recruit.png"
+            ></van-image>
+        </template>
+    </van-grid-item>
+    <van-grid-item text="简历库">
+        <template #icon>
+            <van-image
+                    width="50%"
+                    src="__MIMAGES__/icon_resume.png"
+            ></van-image>
+        </template>
+    </van-grid-item>
+    <van-grid-item text="报备管理">
+        <template #icon>
+            <van-image
+                    width="50%"
+                    src="__MIMAGES__/icon_report.png"
+            ></van-image>
+        </template>
+    </van-grid-item>
+</van-grid>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        base.broker = {$broker};
+
+        return base;
+    }
+</script>
+{/block}

+ 8 - 0
config/view.php

@@ -24,4 +24,12 @@ return [
     'taglib_begin' => '{',
     // 标签库标签结束标记
     'taglib_end'   => '}',
+    // 模板常量
+    'tpl_replace_string' => [
+        '__STATIC__'        => '/static',
+        '__COMMON_IMAGES__' => '/static/common/images',
+        '__COMMON_CSS__'    => '/static/common/css',
+        '__COMMON_JS__'     => '/static/common/js',
+    ],
+    'default_filter'     => '',
 ];

+ 9 - 0
public/static/mobile/css/style.css

@@ -26,3 +26,12 @@ html {
 .article-list article .s-left .s-title{font-size: 16px;text-overflow: ellipsis;display: -webkit-box;overflow: hidden;-webkit-box-orient: vertical;-webkit-line-clamp: 3;text-align:left;}
 .article-list article .s-left .s-time{font-size: 12px;color:#999;margin-top:auto;}
 .article-list article .s-right {width:110px;margin-left:auto;}
+
+.income-list {display: block;overflow: hidden;box-sizing: border-box;}
+.income-list .income-item {position: relative;display: flex;padding: 0 15px;min-height: 50px;background-color: #ffffff;justify-content: space-between;align-items: center;transition: all .6s ease-in-out 0s;-webkit-transform: translateX(0px);transform: translateX(0px);box-sizing: border-box;}
+.income-list .income-item .left {font-size: 15px;line-height: 1.6em;flex: 1;padding-top: 10px;padding-bottom: 10px;padding-right: 10px;box-sizing: border-box;}
+.income-list .income-item .left .time {color: #aaaaaa;font-size: 12px;}
+.income-list .income-item .left .comment {color: #aaaaaa;font-size: 12px;}
+.income-list .income-item .right {color: #e54d42;}
+.income-list .income-item .right .text {color: #0081ff;}
+.income-list .income-item .right .money {color: #e54d42;}

BIN
public/static/mobile/images/icon_recruit.png


BIN
public/static/mobile/images/icon_report.png


BIN
public/static/mobile/images/icon_resume.png


+ 0 - 34
public/static/mobile/js/components/articleList.js

@@ -1,34 +0,0 @@
-app.component('article-list', {
-    template: `
-    <div class="article-list">
-        <article v-for="item in list" @click="toDetail(item.id)">
-            <section class="s-left" :class="{image:!!item.header_image}">
-                <div class="s-title">{{item.title}}</div>
-                <div class="s-time">{{item.update_time}}</div>
-            </section>
-            <section class="s-right" v-if="item.header_image">
-                <van-image
-                        width="110"
-                        height="85"
-                        fit="cover"
-                        :src="item.header_image"
-                ></van-image>
-            </section>
-        </article>
-    </div>
-    `,
-    data() {
-        return {}
-    },
-    props: {
-        list: {
-            type: Array,
-            default: [],
-        },
-    },
-    methods: {
-        toDetail(id) {
-            location.href = "/mobile/article/detail.html?id=" + id;
-        },
-    },
-});

+ 29 - 0
public/static/mobile/js/components/incomeList.js

@@ -0,0 +1,29 @@
+app.component('income-list', {
+    template: `
+    <div class="income-list">
+        <div class="income-item" v-for="item in list">
+            <div class="left">
+                <div class="title">{{item.title}}</div>
+                <div class="time">{{item.createtime}}</div>
+                <div class="comment">{{item.remark}}</div>
+            </div>
+            <div class="right">
+                <div class="text">{{item.status_text}}</div>
+                <div class="price">{{item.value > 0 ? '+' : ''}}{{item.value}}元</div>
+            </div>
+        </div>
+    </div>
+    `,
+    data() {
+        return {}
+    },
+    props: {
+        list: {
+            type: Array,
+            default: [],
+        },
+    },
+    methods: {
+
+    },
+});

+ 0 - 26
public/static/mobile/js/components/voteList.js

@@ -1,26 +0,0 @@
-app.component('vote-list', {
-    template: `
-    <div class="article-list">
-        <article v-for="item in list" @click="toDetail(item.id)">
-            <section class="s-left">
-                <div class="s-title">{{item.title}}</div>
-                <div class="s-time">{{item.start_time}} 至 {{item.end_time}}</div>
-            </section>
-        </article>
-    </div>
-    `,
-    data() {
-        return {}
-    },
-    props: {
-        list: {
-            type: Array,
-            default: [],
-        },
-    },
-    methods: {
-        toDetail(id) {
-            location.href = "/mobile/vote/detail.html?id=" + id;
-        },
-    },
-});