linwu 1 рік тому
батько
коміт
43a8d36d91

+ 20 - 3
app/admin/controller/Broker.php

@@ -33,7 +33,9 @@ class Broker extends BaseController
         $id         = input('id/d, 0');
         $broker     = BrokerModel::findOrEmpty($id);
         $workerlist = WorkerModel::with(['agent', 'muser'])->order(['id' => 'desc'])->select();
+        $townlist   = file_get_contents(root_path('public/static/jscss') . 'village.json');
         return view('broker/brokerform', [
+            'townlist'   => $townlist,
             'workerlist' => $workerlist,
             'broker'     => $broker,
         ]);
@@ -41,8 +43,8 @@ class Broker extends BaseController
 
     public function editBroker()
     {
-        $id   = input('id/d');
-        $data = [
+        $id          = input('id/d');
+        $data        = [
             'title'       => input('title/s', ""),
             'mobile'      => input('mobile/s', ""),
             'weixin'      => input('weixin/s', ""),
@@ -50,11 +52,24 @@ class Broker extends BaseController
             'province'    => input('province/s', ""),
             'city'        => input('city/s', ""),
             'district'    => input('district/s', ""),
-            'region'      => input('region/s', ""),
+            'town'        => input('town/s', ""),
             'details'     => input('details/s', ""),
             'powerreport' => input('powerreport/d') == 1 ? 1 : 2,
             'status'      => input('status/d') == 1 ? 1 : 2,
         ];
+
+        //镇街
+        $townvillage = input('townvillage');
+        if (empty($townvillage)) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择镇街',
+            ]));
+        }
+        $townvillage     = explode(',', $townvillage);
+        $data['town']    = $townvillage[0];
+        $data['village'] = $townvillage[1];
+
         if (empty($id)) {
             $vdata = [
                 'id'     => $id,
@@ -511,6 +526,8 @@ class Broker extends BaseController
             $data['mobile']     = $fbroker['mobile'];
             $data['province']   = $fbroker['province'];
             $data['city']       = $fbroker['city'];
+            $data['town']       = $fbroker['town'];
+            $data['village']    = $fbroker['village'];
             $data['district']   = $fbroker['district'];
             $data['region']     = $fbroker['region'];
             $data['createtime'] = time();

+ 2 - 2
app/admin/view/broker/applylist.html

@@ -34,7 +34,7 @@
 
 			<table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
 			<script type="text/html" id="address">
-					{{d.province}} - {{d.city}} - {{d.district}}
+					{{d.town}} - {{d.village}}
 			</script>
 			<script type="text/html" id="workertitleTpl">
 				{{d.worker.title}}
@@ -75,7 +75,7 @@
 					{ field: 'id', width: 80, title: '表ID', sort: true },
 					{ field: 'title', title: '姓名' },
 					{ field: 'mobile', title: '手机号' },
-					{ field: 'address', title: '省市区', templet: '#address' },
+					{ field: 'address', title: '镇街', templet: '#address' },
 					{ field: 'region', title: '区域', width: 100, align: 'center'},
 					{ field: 'workertitle', title: '劳务公司', templet: '#workertitleTpl' },
 					{ field: 'agenttitle', title: '代理门店', templet: '#agenttitleTpl' },

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

@@ -66,6 +66,11 @@
 								</select>
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">镇街/村社区</label>
+							<div class="layui-input-block" id="townvillage">
+							</div>
+						</div>
 						<div class="layui-form-item">
 							<label class="layui-form-label">区域</label>
 							<div class="layui-input-block">
@@ -141,6 +146,15 @@
 			field: { idName: 'id', titleName: 'title', childName: 'agent' }
 		});
 
+		var townvillage = selectN({
+				elem: '#townvillage',
+				search: [true, true],
+				tips: ["请选择镇街", "请选择村社区"],
+				data: {$townlist|raw},
+				selected: ['{$broker['town']}', '{$broker['village']}'],
+				field: { idName: 'name', titleName: 'name', childName: 'child' }
+		});
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({

+ 4 - 0
app/admin/view/broker/brokerlist.html

@@ -45,6 +45,9 @@
 			</div>
 
 			<table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
+			<script type="text/html" id="address">
+				{{d.town}} - {{d.village}}
+			</script>
 			<script type="text/html" id="muserTpl">
 				{{#  if(d.userid != 0){ }}
 					{{d.muser.realname}} - {{d.muser.mobile}} 
@@ -90,6 +93,7 @@
 					{ field: 'title', title: '姓名', edit: 'text' },
 					{ field: 'mobile', title: '手机号' },
 					{ field: 'muser', title: '关联的用户(姓名-手机号)', templet: '#muserTpl', minWidth: 250, align: 'left' },
+					{ field: 'address', title: '镇街', templet: '#address' },
 					{ field: 'region', title: '区域' },
 					{ field: 'workertitle', title: '劳务公司', templet: '#workertitleTpl' },
 					{ field: 'agenttitle', title: '代理门店', templet: '#agenttitleTpl' },

+ 11 - 0
app/agent/controller/Broker.php

@@ -53,6 +53,17 @@ class Broker extends BaseController
             'status'      => input('status/d') == 1 ? 1 : 2,
         ];
 
+        //镇街
+        $townvillage = input('townvillage');
+        if (empty($townvillage)) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择镇街',
+            ]));
+        }
+        $townvillage     = explode(',', $townvillage);
+        $data['town']    = $townvillage[0];
+        $data['village'] = $townvillage[1];
 
         if (empty($id)) {
             $id    = input('id/d');

+ 14 - 0
app/agent/view/broker/brokerform.html

@@ -68,6 +68,11 @@
 								</select>
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">镇街/村社区</label>
+							<div class="layui-input-block" id="townvillage">
+							</div>
+						</div>
 						<div class="layui-form-item">
 							<label class="layui-form-label">区域</label>
 							<div class="layui-input-block">
@@ -134,6 +139,15 @@
 			}
 		});
 
+		var townvillage = selectN({
+			elem: '#townvillage',
+			search: [true, true],
+			tips: ["请选择镇街", "请选择村社区"],
+			data: {$townlist|raw},
+			selected: ['{$broker['town']}', '{$broker['village']}'],
+			field: { idName: 'name', titleName: 'name', childName: 'child' }
+		});
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({

+ 4 - 0
app/agent/view/broker/brokerlist.html

@@ -33,6 +33,9 @@
 			</div>
 
 			<table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
+			<script type="text/html" id="address">
+				{{d.town}} - {{d.village}}
+			</script>
 			<script type="text/html" id="muserTpl">
 				{{#  if(d.userid != 0){ }}
 					{{d.muser.realname}} - {{d.muser.mobile}} 
@@ -82,6 +85,7 @@
 					{ field: 'income', title: '收益', width: 120 },
 					{ field: 'income_total', title: '总收益', width: 120 },
 					{ field: 'muser', title: '关联的用户(姓名-手机号)', templet: '#muserTpl', minWidth: 250, align: 'left' },
+					{ field: 'address', title: '镇街', templet: '#address' },
 					{ field: 'region', title: '区域' },
 					{ field: 'agenttitle', title: '代理门店', templet: '#agenttitleTpl' },
 					{ field: 'usercount', title: '用户邀请数', templet: '#usercountTpl', width: 100, align: 'center' },

+ 2 - 0
app/common/model/Broker.php

@@ -25,6 +25,8 @@ class Broker extends Model
         'province' => 'string',
         'city'     => 'string',
         'district' => 'string',
+        'town'       => 'string',
+        'village'    => 'string',
         'details'  => 'string',
 
         'status'       => 'tinyint',

+ 2 - 0
app/common/model/BrokerForm.php

@@ -18,6 +18,8 @@ class BrokerForm extends Model
         'province'   => 'string',
         'city'       => 'string',
         'district'   => 'string',
+        'town'       => 'string',
+        'village'    => 'string',
         'region'     => 'string',
         'createtime' => 'int',
         'status'     => 'tinyint',

+ 17 - 0
app/common/model/Village.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Village extends Model
+{
+    // 设置字段信息
+    protected $schema = [
+        'id'   => 'int',
+        'pid'  => 'int',
+        'name' => 'string',
+        'sort' => 'int',
+    ];
+
+}

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

@@ -582,7 +582,7 @@ class Broker extends BaseController
     {
         $data = input('param.');
 
-        $broker = BrokerModel::where('userid',$data['userid'])->find();
+        $broker = BrokerModel::where('userid', $data['userid'])->find();
         if (!empty($broker)) {
             page_result(1, "您已经是经纪人了!", $data);
         }
@@ -592,6 +592,9 @@ class Broker extends BaseController
             page_result(1, "请勿重复申请", $data);
         }
 
+        $data['province']   = '福建省';
+        $data['city']       = '泉州市';
+        $data['district']   = '晋江市';
         $data['createtime'] = time();
         BrokerFormModel::create($data);
         page_result();

+ 7 - 0
app/mainapp/controller/Index.php

@@ -4,6 +4,7 @@ namespace app\mainapp\controller;
 
 use app\common\model\Config;
 use app\common\model\RensheCode;
+use app\common\model\Village;
 use app\common\model\WorkerThird;
 use app\common\service\RensheService;
 use app\mainapp\BaseController;
@@ -238,4 +239,10 @@ class Index extends BaseController
 
         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));
+    }
 }

+ 12 - 0
app/worker/controller/Broker.php

@@ -55,6 +55,18 @@ class Broker extends BaseController
             'status'      => input('status/d', 0) == 1 ? 1 : 2,
         ];
 
+        //镇街
+        $townvillage = input('townvillage');
+        if (empty($townvillage)) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择镇街',
+            ]));
+        }
+        $townvillage     = explode(',', $townvillage);
+        $data['town']    = $townvillage[0];
+        $data['village'] = $townvillage[1];
+
         if (empty($id)) {
             $id    = input('id/d', 0);
             $vdata = [

+ 14 - 0
app/worker/view/broker/brokerform.html

@@ -80,6 +80,11 @@
 								</select>
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">镇街/村社区</label>
+							<div class="layui-input-block" id="townvillage">
+							</div>
+						</div>
 						<div class="layui-form-item">
 							<label class="layui-form-label">区域</label>
 							<div class="layui-input-block">
@@ -145,6 +150,15 @@
 			}
 		});
 
+		var townvillage = selectN({
+			elem: '#townvillage',
+			search: [true, true],
+			tips: ["请选择镇街", "请选择村社区"],
+			data: {$townlist|raw},
+			selected: ["{$broker['town']}", "{$broker['village']}"],
+			field: { idName: 'name', titleName: 'name', childName: 'child' }
+		});
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({

+ 4 - 0
app/worker/view/broker/brokerlist.html

@@ -44,6 +44,9 @@
 			</div>
 
 			<table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
+			<script type="text/html" id="address">
+				{{d.town}} - {{d.village}}
+			</script>
 			<script type="text/html" id="muserTpl">
 				{{#  if(d.userid != 0){ }}
 					{{d.muser.realname}} - {{d.muser.mobile}} 
@@ -90,6 +93,7 @@
 					{ field: 'income', title: '收益', width: 120 },
 					{ field: 'income_total', title: '总收益', width: 120 },
 					{ field: 'muser', title: '关联的用户(姓名-手机号)', templet: '#muserTpl', minWidth: 250, align: 'left' },
+					{ field: 'address', title: '镇街', templet: '#address' },
 					{ field: 'region', title: '区域' },
 					{ field: 'agenttitle', title: '代理门店', templet: '#agenttitleTpl' },
 					{ field: 'usercount', title: '用户邀请数', templet: '#usercountTpl', width: 100, align: 'center' },

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
public/static/jscss/town.json


Різницю між файлами не показано, бо вона завелика
+ 0 - 0
public/static/jscss/village.json


Деякі файли не було показано, через те що забагато файлів було змінено