Commit 9f281657 authored by hezhen's avatar hezhen Committed by chenzq

添加后台设为股东按钮

parent 491e3e4e
......@@ -89,19 +89,26 @@ if ($_GPC['action'] == 'edit') {
$data['staff_extract'] = 0;
}
}
//员工分销提成
if ($data['first_extract']) {
$data['first_extract'] = intval($data['first_extract']);
if ($data['first_extract'] < 0 || 100 < $data['first_extract']) {
$data['first_extract'] = 0;
}
}
//股东分销提成
if ($data['stock_extract']) {
$data['stock_extract'] = intval($data['stock_extract']);
if ($data['stock_extract'] < 0 || 100 < $data['stock_extract']) {
$data['stock_extract'] = 0;
}
}
if ($data['sec_extract']) {
$data['sec_extract'] = intval($data['sec_extract']);
if ($data['sec_extract'] < 0 || 100 < $data['sec_extract']) {
$data['sec_extract'] = 0;
}
$data['sec_extract'] = intval($data['sec_extract']);
if ($data['sec_extract'] < 0 || 100 < $data['sec_extract']) {
$data['sec_extract'] = 0;
}
}
$data['update_time'] = $time;
......
......@@ -5,7 +5,7 @@ function sendAll($content, $uniacid)
global $_GPC;
global $_W;
$appid = $_W['account']['key'];
$users = pdo_fetchall('SELECT a.id,a.openid,a.is_staff,a.uniacid,b.formId,b.id as bid FROM ' . tablename('longbing_company_user') . ' a INNER JOIN ' . tablename('longbing_company_formId') . (' b ON a.id = b.user_id WHERE a.uniacid = ' . $uniacid . ' GROUP BY b.user_id'));
$users = pdo_fetchall('SELECT a.id,a.openid,a.is_staff,a.uniacid,b.formId,b.id as bid FROM ' . tablename('longbing_company_user') . ' a INNER JOIN ' . tablename('longbing_company_formid') . (' b ON a.id = b.user_id WHERE a.uniacid = ' . $uniacid . ' GROUP BY b.user_id'));
$dataClient = array();
$dataStaff = array();
$access_token = getAccessToken2();
......
......@@ -217,12 +217,21 @@ if ($_GPC['action'] == 'addStaff') {
message('未找到用户', '', 'error');
}
if ($user['is_staff'] == 1) {
message('该用户已经是员工了', '', 'error');
}
if ($user['is_stock'] == 1&&$_GPC['is_stock']) {
message('该用户已经是股东了', '', 'error');
}
if($_GPC['is_stock']){
$where=array('update_time' => $time, 'is_staff' => 1,'is_stock'=>1);
}else{
$where=array('update_time' => $time, 'is_staff' => 1);
}
$user = pdo_get('longbing_company_user_info', array('fans_id' => $_GPC['id']));
pdo_update('longbing_company_user', array('update_time' => $time, 'is_staff' => 1), array('id' => $_GPC['id']));
pdo_update('longbing_company_user',$where , array('id' => $_GPC['id']));
if (!$user || empty($user)) {
$result = pdo_insert('longbing_company_user_info', array('fans_id' => $_GPC['id'], 'create_time' => $time, 'update_time' => $time, 'is_staff' => 1, 'status' => 1, 'uniacid' => $_W['uniacid'], 'is_default' => 1));
......@@ -248,6 +257,19 @@ if ($_GPC['action'] == 'addStaff') {
message('添加失败', '', 'error');
}
if ($_GPC['action'] == 'addBoss') {
$user = pdo_get('longbing_company_user', array('id' => $_GPC['id']));
......
......@@ -23,7 +23,7 @@ else {
}
$limit = array(1, 10);
$curr = 1;
$curr = 1;
if (isset($_GPC['page'])) {
$limit[0] = $_GPC['page'];
......
......@@ -231,10 +231,16 @@
<div class="layui-tab-item">
<form class="layui-form" action="" onsubmit="return false">
<div class="layui-form-item">
<label class="layui-form-label">股东分销提成</label>
<div class="layui-input-block">
<input type="number" min="0" max="100" name="stock_extract" placeholder="请输入分销提成" autocomplete="off" class="layui-input" value="{$info['first_extract']}">
<span class="span-remark">用户消费, 其上线所得提成。提成为百分比,取值0到100之间,超出取值范围按0计算,无上线时无提成</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分销提成</label>
<label class="layui-form-label">员工分销提成</label>
<div class="layui-input-block">
<input type="number" min="0" max="100" name="first_extract" placeholder="请输入分销提成" autocomplete="off" class="layui-input" value="{$info['first_extract']}">
<span class="span-remark">用户消费, 其上线所得提成。提成为百分比,取值0到100之间,超出取值范围按0计算,无上线时无提成</span>
......
......@@ -69,12 +69,16 @@
<td><span class="layui-badge layui-bg-blue">BOSS</span></td>
{else}
{if $item['is_staff'] == 1}
{if $item['is_stock'] == 1}
<td><span class="layui-badge layui-bg-blue">股东</span></td>
{else}
<td><span class="layui-badge layui-bg-blue">员工</span></td>
{/if}
{else}
<td><span class="layui-badge layui-bg-black">普通用户</span></td>
{/if}
{/if}
<td>
{if $item['is_staff'] == 1}
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger btn-del-staff"
......@@ -94,10 +98,6 @@
编辑名片
</button>
{if $item['is_boss'] == 1}
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger btn-del-boss"
itemId="{$item['id']}">
......@@ -111,10 +111,6 @@
</button>
{/if}
{if $item['is_default'] == 1}
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger btn-del-default"
itemId="{$item['id']}">
......@@ -127,15 +123,15 @@
</button>
{/if}
{else}
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-add-staff"
itemId="{$item['id']}">
设为员工并创建名片
</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-add-stock"
itemId="{$item['id']}">
设为股东并创建名片
</button>
{/if}
</td>
......@@ -192,6 +188,29 @@
return false;
});
// 添加员工
$('.btn-add-stock').click(function () {
var id = $(this).attr('itemId');
if (!id) {
layer.msg('获取用户id失败!');
return false;
}
layer.open({
content: '是否将该用户添加为股东并创建名片',
yes: function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
layer.load();
var url = "{php echo $this->createWebUrl('manage/users')}";
var data = {
action: 'addStaff',
is_stock:1,
id: id
};
postData(url, data);
}
});
});
// 添加员工
$('.btn-add-staff').click(function () {
var id = $(this).attr('itemId');
......@@ -214,6 +233,12 @@
}
});
});
// 添加BOSS
$('.btn-add-boss').click(function () {
var id = $(this).attr('itemId');
......
......@@ -453,6 +453,15 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
return $this->result(0, '', $data);
}
//地区列表
public function doPageRegion(){
global $_GPC;
$parent_id= isset($_GPC["parent_id"])?$_GPC["parent_id"]:1;
$sql = "select * from ".tablename('sys_region')." where parent_id =".$parent_id;
$list=pdo_fetchall($sql);
return $this->result(0, '',$list);
}
public function doPageCardV2()
{
$this->cross();
......
......@@ -9718,13 +9718,20 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
if($goods['first_extract'] > 0 && $goods['first_extract'] < 100){
$config['first_extract'] = $goods['first_extract'];
}
if($goods['stock_extract'] > 0 && $goods['stock_extract'] < 100){
$config['stock_extract'] = $goods['stock_extract'];
}
if($goods['sec_extract'] > 0 && $goods['sec_extract'] < 100){
$config['sec_extract'] = $goods['sec_extract'];
}
//员工
if (!$config || ($config['staff_extract'] + $config['first_extract'] + $config['sec_extract']) >= 100) {
return false;
}
if ($staff_id && $config['staff_extract']) {
$staff = pdo_get('longbing_company_user', array('id' => $staff_id));
$check_staff = pdo_get('longbing_company_selling_profit', array('user_id' => $staff_id));
......@@ -9747,7 +9754,7 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
if (!$user) {
return false;
}
//员工分销提成
if ($user['pid'] && $config['first_extract']) {
$check_first = pdo_get('longbing_company_selling_profit', array('user_id' => $user['pid']));
......@@ -9762,6 +9769,8 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
@pdo_insert('longbing_company_selling_water', $insert_data);
}
if ($user['pid'] && $config['sec_extract']) {
$user_first = pdo_get('longbing_company_user', array('id' => $user['pid']));
if ($user_first['pid'] && $config['sec_extract']) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment