:-: **分销员(非供应商用户)**
分销前提:在相应店铺购买过商品,且满足对应店铺申请成为分销员的条件
分销流程:分销中心申请分销 -> 店铺审核 -> 分销
一、申请分销
文件路径:shop/controllers/Distribution/Buyer/DirectsellerCtl.php
视图:shop/views/default/Distribution/Buyer/DirectsellerCtl/index.php
~~~
<!---满足申请条件-->
<a onclick="apply('<?=$val['shop_id']?>')" class="to_views bbc_btns "><i class="iconfont icon-duigou1"></i><?=__('申请分销')?></a>
<script>
function apply(id)
{
var e = $(this);
$.dialog.confirm("<?=__('您确定要申请吗?')?>",function()
{
$.post(SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=addDirectseller&typ=json',{shop_id:id},function(d)
{
if(d.status == 200)
{
var data = d.data;
Public.tips.success("<?=__('申请成功!')?>");
location.href = SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=index';
} else
{
Public.tips.error("<?=__('申请失败!')?>");
location.href = SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=index';
}
});
});
};
</script>
~~~
方法:addDirectseller()
~~~
// 添加店铺分销员
$flag = $this->directseller_model->addDirectseller($data);
~~~
二、供应商发布商品
文件路径:shop/controllers/Distribution/Seller/SettingCtl.php
视图:shop/views/default/Distribution/Seller/SettingCtl/addDirectsellerGoods.php
提交商品表单验证:`$('#form').validator({})`
方法:addGoods()
~~~
//新增分销商品
if($common_id_rows)
{
$Goods_CommonModel = new Goods_CommonModel();
foreach($common_id_rows as $k => $v)
{
//三级分佣
$common_data['common_cps_rate'] = request_float('common_cps_rate'); //一级分佣比例
$common_data['common_second_cps_rate'] = request_float('common_second_cps_rate'); //二级分佣比例
$common_data['common_third_cps_rate'] = request_float('common_third_cps_rate'); //三级分佣比例
$common_data['common_is_directseller'] = 1;
$common = $Goods_CommonModel->getOne($v);
$common_data['common_cps_commission'] = number_format((request_float('common_cps_rate')*$common['common_price']/100), 2, '.', '');
$flag = $Goods_CommonModel->editCommon($v, $common_data);
}
}
~~~
三、分销商品
文件路径:shop/controllers/Distribution/Buyer/GoodsCtl.php
视图:shop/views/default/Distribution/Buyer/GoodsCtl/index.php
分享推广:
~~~
<a data-param='<?php echo urlencode(Yf_Registry::get('base_url').'/shop/api/share.php?type=goods&gid='.$goods_id.'&rec='.$rec); ?>' data-url='<?php echo Yf_Registry::get('base_url').'/shop/api/share.php?type=goods&gid='.$goods_id.'&rec='.$rec; ?>' onclick="showLink(this);"><i class="iconfont icon-chakan"></i><?=__('分享')?></a>
//分享链接
function showLink(ele)
{
$('#dialog_link').yf_show_dialog({width: 550, title: "<?=__('分享链接')?>"});
var val = ele.getAttribute('data-url');
$('#share-link').val(val);
var param = ele.getAttribute("data-param");
var img = '<?=Yf_Registry::get('base_url')?>'+'/shop/api/qrcode.php?data='+param+'';
$('#share_code').attr('src',img);
}
~~~
四、店铺分销管理
文件路径:shop/controllers/Distribution/Seller/SettingCtl.php
* 分销设置
视图:shop/views/default/Distribution/Seller/SettingCtl/index.php
设置消费金额限制表单提交:`$('#form').validator({})`
方法:edit()
~~~
$temp = $this->Distribution_ShopDirectsellerConfigModel->getConfigList(array('shop_id'=>$shop_id));
if(!empty($temp))
{
$flag = $this->Distribution_ShopDirectsellerConfigModel->updateConfig($shop_id,$edit_directseller_row);
}else{
$edit_directseller_row['shop_id'] = $shop_id;
$flag = $this->Distribution_ShopDirectsellerConfigModel->addConfig($edit_directseller_row);
}
~~~
* 我的分销员
(1)分销员列表:
视图:shop/views/default/Distribution/Seller/SettingCtl/directseller.php
方法:directseller()
~~~
//获取店铺分销员
$Yf_Page = new Yf_Page();
$Yf_Page->listRows = 15;
$rows = $Yf_Page->listRows;
$offset = request_int('firstRow', 0);
$page = ceil_r($offset / $rows);
$data = $Distribution_ShopDirectsellerModel->getDirectseller($cond_row,$order_row,$page,$rows);
~~~
(2)分销员审核通过
方法:directseller()
~~~
<span <?php if($val['directseller_enable']){?>class="unclick"<?php } ?>>
<a href="javascript:void(0);" data-id='<?=$val['shop_directseller_id']?>' <?php if(!$val['directseller_enable']){ echo 'class="audit"';}?>><i class="iconfont icon-success"></i><?=__('通过')?></a>
</span>
$(".audit").click(function(){
var id = $(this).attr('data-id');
$.ajax({
url: ajax_url,
data:{id:id,op:'audit'},
success:function(a){
if(a.status == 200)
{
Public.tips.success("<?=__('操作成功!')?>");
location.href = SITE_URL + '?ctl=Distribution_Seller_Setting&met=directseller&typ=e';
}
else
{
Public.tips.error("<?=__('操作失败!')?>");
}
}
});
});
~~~
~~~
if(request_string('op')=='audit')
{
$id = request_int('id');
$field_row['directseller_enable'] = 1;
$flag = $Distribution_ShopDirectsellerModel->editBase($id,$field_row);
if ($flag === FALSE)
{
$status = 250;
$msg = __('failure');
}
else
{
$status = 200;
$msg = __('success');
}
$data = array();
$this->data->addBody(-140, $data, $msg, $status);
}
~~~
(3)删除分销员
方法:delDirectseller()
~~~
<span class="del">
<a data-param="{'ctl':'Distribution_Seller_Setting','met':'delDirectseller','id':'<?=$val['shop_directseller_id']?>'}" href="javascript:void(0)"><i class="iconfont icon-lajitong"></i><?=__('删除')?></a>
</span>
~~~
~~~
//判断删除操作是不是当前店铺
if ($directseller['shop_id'] == $shop_id)
{
$flag = $Distribution_ShopDirectsellerModel->removeShopDirectseller($shop_directseller_id);
if ($flag)
{
$status = 200;
$msg = __('success');
}
else
{
$status = 250;
$msg = __('failure');
}
}
~~~
* 分销商品
(1)分销商品列表
文件路径:shop/controllers/Distribution/Seller/SettingCtl.php
视图:shop/views/default/Distribution/Seller/SettingCtl/directsellerGoods.php
`$data = $Goods_CommonModel->getGoodsList($cond_row,array('common_id' => 'DESC'), $page, $rows);`
(2)删除分销商品
文件路径:shop/controllers/Seller/GoodsCtl.php
方法:deleteGoodsCommon()
~~~
<span class="del">
<a data-param="{'id':'<?= $item['common_id'] ?>','ctl':'Seller_Goods','met':'deleteGoodsCommon'}" href="javascript:void(0)"><i class="iconfont icon-lajitong"></i><?=__('删除')?></a>
</span>
~~~
~~~
//删除分销商的商品
$dist_common = $this->goodsCommonModel->getByWhere(array('common_parent_id' => $id));
if(!empty($dist_common)){
foreach ($dist_common as $key => $value) {
$common_base = $this->goodsCommonModel->getOne($value['common_id']);
$shop_base = $this->shopBaseModel->getOne($common_base['shop_id']);
$this->goodsCommonModel->removeCommon($value['common_id']);
//发送消息
$des = '供货商删除了该商品';
$MessageModel->sendMessage('del goods',$shop_base['user_id'], $shop_base['user_name'], $order_id = NULL, $shop_name=null, 1, 1, $end_time = Null,$common_base['common_id'],$goods_id=null,$des);
}
}
~~~
(3)设置分佣比例
视图:shop/views/default/Distribution/Seller/SettingCtl/directsellerGoods.php
方法:editDirectsellerGoods()
~~~
<span class="edit">
<a href="javascript:void(0)" common-id='<?=$item['common_id']?>' first_rate='<?=$item['common_cps_rate']?>' second_rate='<?=$item['common_second_cps_rate']?>' third_rate='<?=$item['common_third_cps_rate']?>' id="set_commission"><i class="iconfont icon-setting"></i><?=__('设置')?></a>
</span>
//设置分佣比例
$('.table-list-style').on('click', '#set_commission', function()
{
var common_id = $(this).attr('common-id');
$('#common_id').val(common_id);
var first_rate = $(this).attr('first_rate');
$('#common_cps_rate').val(first_rate);
var second_rate = $(this).attr('second_rate');
$('#common_second_cps_rate').val(second_rate);
var third_rate = $(this).attr('third_rate');
$('#common_third_cps_rate').val(third_rate);
$('#dialog_directseller').yf_show_dialog({width: 450, title: "<?=__('设置分佣比例')?>"});
});
~~~
~~~
//三级分佣
$common_data['common_cps_rate'] = request_float('common_cps_rate'); //一级分佣比例
$common_data['common_second_cps_rate'] = request_float('common_second_cps_rate'); //二级分佣比例
$common_data['common_third_cps_rate'] = request_float('common_third_cps_rate'); //三级分佣比例
$common_data['common_is_directseller'] = 1;
$common = $Goods_CommonModel->getOne($common_id);
$common_data['common_cps_commission'] = number_format((request_float('common_cps_rate')*$common['common_price']/100), 2, '.', '');
$flag = $Goods_CommonModel->editCommon($common_id, $common_data);
~~~
* 添加分销商品
文件路径:shop/controllers/Distribution/Seller/SettingCtl.php
视图:shop/views/default/Distribution/Seller/SettingCtl/addDirectsellerGoods.php
提交商品表单验证:`$('#form').validator({})`
方法:addGoods()
~~~
//新增分销商品
if($common_id_rows)
{
$Goods_CommonModel = new Goods_CommonModel();
foreach($common_id_rows as $k => $v)
{
//三级分佣
$common_data['common_cps_rate'] = request_float('common_cps_rate'); //一级分佣比例
$common_data['common_second_cps_rate'] = request_float('common_second_cps_rate'); //二级分佣比例
$common_data['common_third_cps_rate'] = request_float('common_third_cps_rate'); //三级分佣比例
$common_data['common_is_directseller'] = 1;
$common = $Goods_CommonModel->getOne($v);
$common_data['common_cps_commission'] = number_format((request_float('common_cps_rate')*$common['common_price']/100), 2, '.', '');
$flag = $Goods_CommonModel->editCommon($v, $common_data);
}
}
~~~
* 分销业绩列表
视图:shop/views/default/Distribution/Seller/SettingCtl/directsellerDetail.php
方法:directsellerDetail()
模型:shop/models/Order/StateModel.php
分销交易状态:
~~~
foreach($data['items'] as $k=>$v)
{
switch ($v['order_status'])
{
case Order_StateModel::ORDER_WAIT_PAY :
$data['items'][$k]['order_status_text'] = '订单已经提交,等待买家付款';
break;
case Order_StateModel::ORDER_PAYED :
$data['items'][$k]['order_status_text'] = '已经付款';
break;
case Order_StateModel::ORDER_WAIT_CONFIRM_GOODS :
$data['items'][$k]['order_status_text'] = '已经发货';
break;
case Order_StateModel::ORDER_RECEIVED || Order_StateModel::ORDER_FINISH :
$data['items'][$k]['order_status_text'] = '已经收货';
break;
case Order_StateModel::ORDER_CANCEL:
$data['items'][$k]['order_status_text'] = '交易关闭';
break;
}
if ($v['order_shipping_fee'] == 0) {
$data['items'][$k]['shipping_info'] = "(免运费)";
} else {
$shipping_fee = @format_money($v['order_shipping_fee']);
$data['items'][$k]['shipping_info'] = "(含运费$shipping_fee)";
}
}
~~~
五、分销员分销中心
1.分销申请:
文件路径:shop/controllers/Distribution/Buyer/DirectsellerCtl.php
视图:shop/views/default/Distribution/Buyer/DirectsellerCtl/index.php
~~~
<!---满足申请条件-->
<a onclick="apply('<?=$val['shop_id']?>')" class="to_views bbc_btns "><i class="iconfont icon-duigou1"></i><?=__('申请分销')?></a>
<script>
function apply(id)
{
var e = $(this);
$.dialog.confirm("<?=__('您确定要申请吗?')?>",function()
{
$.post(SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=addDirectseller&typ=json',{shop_id:id},function(d)
{
if(d.status == 200)
{
var data = d.data;
Public.tips.success("<?=__('申请成功!')?>");
location.href = SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=index';
} else
{
Public.tips.error("<?=__('申请失败!')?>");
location.href = SITE_URL + '?ctl=Distribution_Buyer_Directseller&met=index';
}
});
});
};
</script>
~~~
方法:addDirectseller()
~~~
// 添加店铺分销员
$flag = $this->directseller_model->addDirectseller($data);
~~~
2.商品列表
文件路径:shop/controllers/Distribution/Buyer/GoodsCtl.php
方法:index()
~~~
//获取推广商品
$data = array();
$Goods_CommonModel = new Goods_CommonModel();
$data = $Goods_CommonModel->getCommonList($cond_good_row,$order_row, $page, $rows);
$data['user_id'] = Perm::$userId;
~~~
3.我的推广
文件路径:shop/controllers/Distribution/Buyer/DirectsellerCtl.php
方法:directsellerList()
~~~
//分销用户下级列表
if(request_string('userName'))
{
$cond_row['user_name:LIKE'] = '%'.request_string('userName').'%';
}
if(request_string('act')=='month')
{
$cond_row['user_regtime:<='] = get_date_time();
$beginDate = date('Y-m-d H:i:s',mktime(0,0,0,date('m'),1,date('Y')));
$cond_row['user_regtime:>='] = $beginDate;
}
$order_row['user_regtime'] = 'DESC';
$Yf_Page = new Yf_Page();
$Yf_Page->listRows = 15;
$rows = $Yf_Page->listRows;
$offset = request_int('firstRow', 0);
$page = ceil_r($offset / $rows);
$data = $this->directseller_model->getInvitors($cond_row,$order_row,$page,$rows);
~~~
4.我的业绩
文件路径:shop/controllers/Distribution/Buyer/DirectsellerCtl.php
方法:directsellerOrder()
模型:shop/models/Order/StateModel.php
~~~
//用户推广订单
$cond_row['order_status'] = Order_StateModel::ORDER_FINISH;
$cond_row['directseller_id'] = Perm::$userId;
$Order_BaseModel = new Order_BaseModel();
$data = $Order_BaseModel->getBaseList($cond_row, array('order_create_time' => 'DESC'), $page, $rows);
~~~
订单交易状态:
~~~
//待付款
if ($status == 'wait_pay')
{
$cond_row['order_status'] = Order_StateModel::ORDER_WAIT_PAY;
}
//待发货 -> 只可退款
if ($status == 'wait_perpare_goods')
{
$cond_row['order_status'] = Order_StateModel::ORDER_WAIT_PREPARE_GOODS;
}
//已付款
if ($status == 'order_payed')
{
$cond_row['order_status'] = Order_StateModel::ORDER_PAYED;
}
//待收货、已发货 -> 退款退货
if ($status == 'wait_confirm_goods')
{
$cond_row['order_status'] = Order_StateModel::ORDER_WAIT_CONFIRM_GOODS;
}
//已完成 -> 订单评价
if ($status == 'finish')
{
$cond_row['order_status'] = Order_StateModel::ORDER_FINISH;
}
//已取消
if ($status == 'cancel')
{
$cond_row['order_status'] = Order_StateModel::ORDER_CANCEL;
}
~~~
5.佣金记录
文件路径:shop/controllers/Distribution/Buyer/DirectsellerCtl.php
方法:directsellerCommission()
~~~
$cond_row['order_status'] = Order_StateModel::ORDER_FINISH;
$Order_BaseModel = new Order_BaseModel();
$data = $Order_BaseModel->getBaseList($cond_row, array('order_create_time' => 'DESC'), $page, $rows);
~~~
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 系统架构
- 负载集群
- 云存储
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- shop1
- shop2
- shop3
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 集群架构图
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 商家微信公众号
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 杂项
- 远程上传图片
- 接口(废弃,参考最外层接口项)
- 接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明
- 接口
- 数据库中间键
- MyCat的优势
- 概念说明
- Mycat的下载及安装
- 参数配置案列
- Mycat读写分离
- 基本命令
- 常见错误