diff --git "a/\\" "b/\\" deleted file mode 100644 index caab504..0000000 --- "a/\\" +++ /dev/null @@ -1,5 +0,0 @@ -合并分支:更新 -# 请输入一个提交信息以解释此合并的必要性,尤其是将一个更新后的上游分支 -# 合并到主题分支。 -# -# 以 '#' 开头的行将被忽略,而且空提交说明将会终止提交。 diff --git a/app/admin/controller/SupplyBrokerage.php b/app/admin/controller/SupplyBrokerage.php index c1ea4d1..2a06f5d 100644 --- a/app/admin/controller/SupplyBrokerage.php +++ b/app/admin/controller/SupplyBrokerage.php @@ -36,21 +36,28 @@ class SupplyBrokerage extends BaseController $param = get_params(); $where = []; - $list = $this->model->getSupplyBrokerageList($where,$param); + $list = $this->model->with(['merchant', 'supplyChain', 'level'])->order('id desc')->select(); // 只读取来源为供应链小组的订单 + $total = $this->model->count(); foreach ($list as $k =>$v){ - $list[$k]['fa_supply_chain_id'] = Db::table('fa_supply_team')->where('id',$v['fa_supply_chain_id'])->value('name'); - $list[$k]['mer_id'] = Db::connect('shop')->table('eb_merchant')->where('mer_id',$v['mer_id'])->value('mer_name'); - $list[$k]['user_id'] = Db::table('fa_szxc_information_usermsg')->where('user_id',$v['user_id'])->value('name'); + + // $list[$k]['fa_supply_chain_id'] = Db::table('fa_supply_team')->where('id',$v['fa_supply_chain_id'])->value('name'); + // $list[$k]['mer_id'] = Db::connect('shop')->table('eb_merchant')->where('mer_id',$v['mer_id'])->value('mer_name'); + // $list[$k]['user_id'] = Db::table('fa_szxc_information_usermsg')->where('user_id',$v['user_id'])->value('name'); + if($v['status'] == 1){ $list[$k]['status'] = '成功'; }else{ $list[$k]['status'] = '待分佣'; } - $list[$k]['supply_level_id'] = Db::table('fa_supply_level')->where('id',$v['supply_level_id'])->value('name'); - $list[$k]['supply_userId'] = Db::table('cms_admin')->where('id',$v['supply_userId'])->value('nickname'); + + // $list[$k]['supply_level_id'] = Db::table('fa_supply_level')->where('id',$v['supply_level_id'])->value('name'); + // $list[$k]['supply_userId'] = Db::table('cms_admin')->where('id',$v['supply_team_id'])->value('nickname'); } - return table_assign(0, '', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); } else{ return view(); diff --git a/app/admin/controller/SupplyTeam.php b/app/admin/controller/SupplyTeam.php index 7f84ab0..925c7cd 100644 --- a/app/admin/controller/SupplyTeam.php +++ b/app/admin/controller/SupplyTeam.php @@ -36,13 +36,17 @@ class SupplyTeam extends BaseController $param = get_params(); $where = []; - $list = $this->model->getSupplyTeamList($where,$param); - foreach ($list as $k =>$v){ - $list[$k]['area_id'] = Db::table('fa_geo_area')->where('area_id',$v['area_id'])->value('area_name'); - $list[$k]['supply_level_id'] = Db::table('fa_supply_level')->where('id',$v['supply_level_id'])->value('name'); - $list[$k]['user_id'] = Db::table('fa_szxc_information_usermsg')->where('user_id',$v['user_id'])->value('name'); - } - return table_assign(0, '', $list); + $list = $this->model->with('level')->select(); + $total = $this->model->count(); + // $list = $this->model->getSupplyTeamList($where,$param); + // foreach ($list as $k =>$v){ + // $list[$k]['area_id'] = Db::table('fa_geo_area')->where('area_id',$v['parent_code'])->value('area_name'); + // $list[$k]['supply_level_id'] = Db::table('fa_supply_level')->where('id',$v['supply_level_id'])->value('name'); + // $list[$k]['user_id'] = Db::table('fa_szxc_information_usermsg')->where('user_id',$v['user_id'])->value('name'); + // } + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); } else{ return view(); @@ -56,7 +60,8 @@ class SupplyTeam extends BaseController { if (request()->isAjax()) { $param = get_params(); - + + return json($param); // 检验完整性 try { validate(SupplyTeamValidate::class)->check($param); @@ -66,13 +71,19 @@ class SupplyTeam extends BaseController } $this->model->addSupplyTeam($param); + }else{ $geo_area = Db::table('fa_geo_area')->where('city_code',510500)->select(); View::assign('geo_area', $geo_area); - $level = Db::table('fa_supply_level')->select(); + $level = Db::table('fa_supply_level')->whereNotIn('id', [1])->select(); View::assign('level', $level); + //获取用户信息 - $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select(); + $this->users = Db::table('cms_admin') + ->where('status',1) + ->whereNotIn('id', [1]) + ->field('id, username, nickname')->select(); + View::assign('users', $this->users); return view(); } diff --git a/app/admin/controller/nk/User.php b/app/admin/controller/nk/User.php index c50972d..234e284 100644 --- a/app/admin/controller/nk/User.php +++ b/app/admin/controller/nk/User.php @@ -560,6 +560,18 @@ class User extends BaseController // 'village_id' => $params['village_id'] != '' ? $village['village_id'] : 0, // 'admin_id' => $admin['id'], // ]; + $phone = Db::table('fa_szxc_information_usermsg')->where('user_id', $params['id'])->value('phone'); + + // 如果为工作人员 == 服务小组采购人员 + if($params['group_id'] == 3) + { + Db::connect('shop')->table('eb_user')->where('phone', $phone)->update(['fa_supply_team_id' => 1]); // 默认分佣比例 1 为小组服务 + + }else{ + + Db::connect('shop')->table('eb_user')->where('phone', $phone)->update(['fa_supply_team_id' => null]); // 如果不是工作人员,则去除分佣 + } + if ($admin) { Db::startTrans(); try { diff --git a/app/admin/controller/supplychain/Merchant.php b/app/admin/controller/supplychain/Merchant.php index d77e5f8..cb7a9ec 100644 --- a/app/admin/controller/supplychain/Merchant.php +++ b/app/admin/controller/supplychain/Merchant.php @@ -141,7 +141,9 @@ class Merchant extends BaseController }else{ $total = StoreOrderModel::count(); - $list = StoreOrderModel::with(['merchant'])->select(); + $list = StoreOrderModel::with(['merchant', 'user']) + ->where('source', 1) // 只读取来源为供应链小组的订单 + ->select(); View::assign('url', $this->url); View::assign('list', $list); diff --git a/app/admin/model/ShopUser.php b/app/admin/model/ShopUser.php new file mode 100644 index 0000000..63d5420 --- /dev/null +++ b/app/admin/model/ShopUser.php @@ -0,0 +1,25 @@ +hasOne(Merchant::class, 'mer_id', 'mer_id'); + return $this->hasOne(ShopUser::class, 'uid', 'uid'); } } \ No newline at end of file diff --git a/app/admin/model/SupplyBrokerage.php b/app/admin/model/SupplyBrokerage.php index 4ef17d4..c6539fa 100644 --- a/app/admin/model/SupplyBrokerage.php +++ b/app/admin/model/SupplyBrokerage.php @@ -11,6 +11,35 @@ class SupplyBrokerage extends Model // 设置当前模型对应的完整数据表名称 protected $table = 'fa_supply_brokerage'; + /** + * 关联商户 + * + */ + public function merchant() + { + return $this->hasOne(Merchant::class, 'mer_id', 'mer_id'); + } + + /** + * + * 关联供应链团队 + * + */ + public function supplyChain() + { + return $this->hasOne(SupplyChain::class, 'id', 'fa_supply_chain_id'); + } + + /** + * + * 关联分佣等级 + * + */ + public function level() + { + return $this->hasOne(SupplyLevel::class, 'id', 'supply_level_id'); + } + /** * 获取分页列表 * @param $where @@ -20,7 +49,7 @@ class SupplyBrokerage extends Model { $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; $order = empty($param['order']) ? 'id desc' : $param['order']; - $list = self::where($where)->field('id,supply_sn,mer_id,fa_supply_chain_id,order_sn,order_id,user_info,user_id,supply_userId,pay_price,brokerage_price,brokerage_rate,status,supply_level_id,group_user,create_time')->order($order)->paginate($rows, false, ['query' => $param]); + $list = self::where($where)->field('id,supply_sn,mer_id,fa_supply_chain_id,order_sn,order_id,user_info,user_id,supply_team_id,pay_price,brokerage_price,brokerage_rate,status,supply_level_id,group_user,create_time')->order($order)->paginate($rows, false, ['query' => $param]); return $list; } diff --git a/app/admin/model/SupplyLevel.php b/app/admin/model/SupplyLevel.php index e0c3e46..658aff5 100644 --- a/app/admin/model/SupplyLevel.php +++ b/app/admin/model/SupplyLevel.php @@ -6,6 +6,7 @@ */ namespace app\admin\model; use think\model; + class SupplyLevel extends Model { // 设置当前模型对应的完整数据表名称 diff --git a/app/admin/model/SupplyTeam.php b/app/admin/model/SupplyTeam.php index 1b83f92..77e5ecf 100644 --- a/app/admin/model/SupplyTeam.php +++ b/app/admin/model/SupplyTeam.php @@ -10,6 +10,17 @@ class SupplyTeam extends Model { // 设置当前模型对应的完整数据表名称 protected $table = 'fa_supply_team'; + + /** + * + * 关联分佣等级 + * + */ + public function level() + { + return $this->hasOne(SupplyLevel::class, 'id', 'supply_level_id'); + } + /** * 获取分页列表 * @param $where @@ -17,10 +28,13 @@ class SupplyTeam extends Model */ public function getSupplyTeamList($where, $param) { - $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; - $order = empty($param['order']) ? 'id desc' : $param['order']; - $list = self::where($where)->field('id,name,lng,lat,area_id,brokerage,withdraw_brokerage,free_brokerage,supply_level_id,user_id')->order($order)->paginate($rows, false, ['query' => $param]); - return $list; + $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; + + $order = empty($param['order']) ? 'id desc' : $param['order']; + $list = self::where($where)->field('id,name,lng,lat,parent_code,brokerage,withdraw_brokerage,free_brokerage,supply_level_id,user_id') + ->order($order) + ->paginate($rows, false, ['query' => $param]); + return $list; } /** diff --git a/app/admin/view/supply_brokerage/datalist.html b/app/admin/view/supply_brokerage/datalist.html index d61742a..a7848c8 100644 --- a/app/admin/view/supply_brokerage/datalist.html +++ b/app/admin/view/supply_brokerage/datalist.html @@ -12,12 +12,6 @@
后台供应链团队分组名称* | -+ | 团队分组名称* | +|||||||||||
区县ID* | -- - | 团队分佣金额* | -团队分佣已提现金额* | -- | |||||||||
分佣冻结金额* | -- - | 团队所属等级* | +|||||||||||
团队所属等级* | - | 团队后台负责人ID* | -- - | -||||||||||
供应链后台团队负责人* | ++ + | +||||||||||||
坐标 |
@@ -81,7 +69,6 @@
function gouguInit() {
var form = layui.form, tool = layui.tool;
-
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传,腾讯地图api key 申请方法见:https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
@@ -97,6 +84,9 @@
});
//监听提交
form.on('submit(webform)', function (data) {
+
+ console.log($('.lng').text());
+ console.log($('.lat').text());
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
diff --git a/app/admin/view/supply_team/datalist.html b/app/admin/view/supply_team/datalist.html
index beb1b15..35c3009 100644
--- a/app/admin/view/supply_team/datalist.html
+++ b/app/admin/view/supply_team/datalist.html
@@ -33,7 +33,7 @@
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#supply_team',
- title: '供应链分组列表',
+ title: '供应链分组',
toolbar: '#toolbarDemo',
url: '/admin/supply_team/datalist',
page: true,
@@ -49,10 +49,46 @@
width: 80
},{
field: 'name',
- title: '后台供应链团队分组名称',
+ title: '分组名称',
align: 'center',
width: 100
},{
+ field: 'supply_level_id',
+ title: '分佣等级',
+ align: 'center',
+ width: 300,
+ templet: function (d)
+ {
+ return d.level.name + ',分佣比例:' + d.level.rate + '%';
+ }
+ },{
+ field: 'user_id',
+ title: '后台负责人',
+ align: 'center',
+ width: 100
+ },{
+ field: 'parent_code',
+ title: '市/区县/镇/村',
+ align: 'center',
+ width: 100
+ },{
+ field: 'brokerage',
+ title: '分佣金额',
+ align: 'center',
+ width: 100
+ },{
+ field: 'free_brokerage',
+ title: '冻结金额',
+ align: 'center',
+ width: 100
+ },{
+ field: 'withdraw_brokerage',
+ title: '已提现金额',
+ align: 'center',
+ width: 100
+
+ },{
+
field: 'lng',
title: '经度',
align: 'center',
@@ -62,36 +98,6 @@
title: '维度',
align: 'center',
width: 100
- },{
- field: 'area_id',
- title: '区县ID',
- align: 'center',
- width: 100
- },{
- field: 'brokerage',
- title: '团队分佣金额',
- align: 'center',
- width: 100
- },{
- field: 'withdraw_brokerage',
- title: '团队分佣已提现金额',
- align: 'center',
- width: 100
- },{
- field: 'free_brokerage',
- title: '分佣冻结金额',
- align: 'center',
- width: 100
- },{
- field: 'supply_level_id',
- title: '团队所属等级',
- align: 'center',
- width: 100
- },{
- field: 'user_id',
- title: '团队后台负责人ID',
- align: 'center',
- width: 100
},
{
fixed: 'right',
diff --git a/app/admin/view/supplychain/merchant/bill.html b/app/admin/view/supplychain/merchant/bill.html
index d1e1ab5..51d340f 100644
--- a/app/admin/view/supplychain/merchant/bill.html
+++ b/app/admin/view/supplychain/merchant/bill.html
@@ -115,14 +115,35 @@
align: 'center',
width:150,
},{
- field: 'uid',
+ field: 'supply_chain_price',
+ title: '佣金金额',
+ align: 'center',
+ width:120,
+ },{
+ field: 'supply_chain_rate',
+ title: '佣金比例',
+ align: 'center',
+ width:120,
+ templet: function (d)
+ {
+ return d.supply_chain_rate + '%';
+ }
+ }
+ // ,{
+ // field: 'uid',
+ // title: '用户',
+ // align: 'center',
+ // templet: function (d)
+ // {
+ // var html = d.uid;
+ // return html;
+ // },
+ // width:150,
+ // }
+ ,{
+ field: 'real_name',
title: '用户',
align: 'center',
- templet: function (d)
- {
- var html = d.uid;
- return html;
- },
width:150,
},{
field: 'paid',
diff --git a/public/.htaccess b/public/.htaccess
index e69de29..8932768 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -0,0 +1,7 @@
+ |