企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
:-: **分销产品供应商(非供应商用户)** 文件路径:shop/controllers/Seller/Supplier/SupplierCtl.php 供应商审核状态: ~~~ //审核状态 if(request_int('state')==1) { $cond_row['distributor_enable'] =1; //审核通过 }elseif(request_int('state')==2) { $cond_row['distributor_enable'] = 0; //未审核 }elseif(request_int('state')==3) { $cond_row['distributor_enable'] =-1; //审核未通过 } ~~~ 一、我的供应商 1.供应商列表 控制器:shop/controllers/Seller/Supplier/SupplierCtl.php ->index() `$data = $this->shopDistributorModel->listByWhere($cond_row, $order_row, $page, $rows);` 视图:shop/views/default/Seller/Supplier/SupplierCtl/index.php 2.添加、编辑 方法:addSupplier() ~~~ if(request_string('act') && request_string('act') == "edit") { $supplier_row['distributor_new_cat_ids'] = $cat_ids; $shop_distributor_id = request_string('shop_distributor_id'); $flag = $this->shopDistributorModel->editShopDistributor($shop_distributor_id,$supplier_row); }else { $supplier_row['distributor_enable'] = 0; $supplier_row['distributor_new_cat_ids'] = $cat_ids; $flag = $this->shopDistributorModel->addShopDistributor($supplier_row); } ~~~ 视图:shop/views/default/Seller/Supplier/SupplierCtl/apply.php 3.删除 视图:shop/views/default/Seller/Supplier/SupplierCtl/index.php 方法:edit_statu() ~~~ if(request_string('act') && request_string('act') =="again") { //再次申请 $edit_row['distributor_enable'] = 0; $flag=$this->shopDistributorModel->editShopDistributor($shop_distributor_id,$edit_row); }elseif(request_string('act') && request_string('act') =="del") { //删除 $supplier_base = $this->shopDistributorModel->getOne($shop_distributor_id); $flag=$this->shopDistributorModel->removeShopDistributor($shop_distributor_id); //删除分销商品 $goodsCommonModel = new Goods_CommonModel(); $commons =$goodsCommonModel -> getByWhere(array('shop_id'=>Perm::$shopId,'supply_shop_id'=>$supplier_base['shop_id'])); if(!empty($commons)) { foreach ($commons as $key => $value) { $goodsCommonModel->removeCommon($value['common_id']); } } } ~~~ :-: **我的分销商(供应商用户)** 文件路径:shop/controllers/Seller/Supplier/DistributorCtl.php 分销商审核状态: ~~~ //审核状态 if(request_int('state')==1) { $cond_row['distributor_enable'] =1; //审核通过 }elseif(request_int('state')==2) { $cond_row['distributor_enable'] =0; //未审核 }elseif(request_int('state')==3) { $cond_row['distributor_enable'] =-1; //审核未通过 } ~~~ 一、我的分销商 1.分销商列表 视图:shop/views/default/Seller/Supplier/DistributorCtl/index.php 方法:index() `$data = $this->shopDistributorModel->listByWhere($cond_row, $order_row, $page, $rows);` 二、操作 1.分销业绩 视图:shop/views/default/Seller/Supplier/DistributorCtl/distributor_salenum.php 方法:distributor_salenum() `$data = $Goods_CommonModel->listByWhere($cond_row, $order_row, $page, $rows);` 2.查看分销商详情 方法:index() 参数:distributor_id 视图:shop/views/default/Seller/Supplier/DistributorCtl/apply.php ~~~ if(request_int('distributor_id')) { $distributor_info = $this->shopDistributorModel->getOne(request_int('distributor_id')); $distributor_shop_info = $shopBaseModel->getOneByWhere(array('shop_id'=>$distributor_info['distributor_id'])); $shopGoodCatModel = new Shop_GoodCatModel(); $cat_row['shop_id'] = Perm::$shopId; $shop_cat = $shopGoodCatModel->getGoodCatList($cat_row, array()); $distributor_cat = explode(',',$distributor_info['distributor_cat_ids']); $distributor_new_cat = explode(',',$distributor_info['distributor_new_cat_ids']); $distributor_cat_name = array(); $distributor_new_cat_name = array(); if($distributor_cat) { foreach($distributor_cat as $k=>$v) { $temp = $shopGoodCatModel->getOneByWhere(array('shop_goods_cat_id'=>$v)); if($temp) { $distributor_cat_name[] = $temp['shop_goods_cat_name']; } } } $distributor_cat_name = implode(',',$distributor_cat_name); if($distributor_new_cat) { foreach($distributor_new_cat as $k=>$v) { $temp = $shopGoodCatModel->getOneByWhere(array('shop_goods_cat_id'=>$v)); if($temp) { $distributor_new_cat_name[] = $temp['shop_goods_cat_name']; } } } $distributor_new_cat_name = implode(',',$distributor_new_cat_name); $this->view->setMet('apply'); } ~~~ 3.设置等级 方法:addGrade()、editGrade() 视图:shop/views/default/Seller/Supplier/DistributorCtl/addGrade.php 确认提交:$('.bbc_seller_submit_btns').click(function (){}) ~~~ //新增、编辑分销商等级 if(request_string('act') && request_string('act') == "edit") { $flag = $this->shopDistributorLevelModel->editShopDistributorLevel($distributor_level_id,$cond_row); }else{ $flag = $this->shopDistributorLevelModel->addShopDistributorLevel($cond_row); } ~~~ 4.删除、审核分销商 方法:edit_statu() ~~~ if(request_string('act') && request_string('act') == 'agree') { $field_row['distributor_enable'] = 1; $field_row['distributor_cat_ids'] = $shop_dist_base['distributor_new_cat_ids']; $field_row['distributor_new_cat_ids'] = ''; $flag=$this->shopDistributorModel->editShopDistributor($shop_distributor_id,$field_row); //发送消息 $MessageModel->sendMessage('dist apply statu',$dist_shop_base['user_id'], $dist_shop_base['user_name'], $order_id = NULL, $shop_name=null, 1, 1, $end_time = Null,$common_id=null); } elseif(request_string('act') && request_string('act') == 'del') { $flag=$this->shopDistributorModel->removeShopDistributor($shop_distributor_id); //删除分销商品 $goodsCommonModel = new Goods_CommonModel(); $commons =$goodsCommonModel -> getByWhere(array('shop_id'=>$dist_shop_base['shop_id'],'supply_shop_id'=>Perm::$shopId)); if(!empty($commons)) { foreach ($commons as $key => $value) { $goodsCommonModel->removeCommon($value['common_id']); //发送消息 $des = '供货商删除你的分销权限'; $MessageModel->sendMessage('del goods',$dist_shop_base['user_id'], $dist_shop_base['user_name'], $order_id = NULL, $shop_name=null, 1, 1, $end_time = Null,$value['common_id'],$goods_id=null,$des); } } } ~~~ 5.分销商审核不通过 视图:shop/views/default/Seller/Supplier/DistributorCtl/index.php ~~~ <div id="apply-disagree" class="eject_con" > <input type="hidden" name="shop_grade_id" id="shop_grade_id" value="" /> <textarea id="reason"></textarea> <div class="eject_con mb10"> <div class="bottom"><a id="btn_apply_submit" class="button bbc_seller_submit_btns" href="javascript:void(0);"><?=__('提交')?></a></div> </div> </div> $("#btn_apply_submit").click(function (){ var shop_distributor_id = $("#shop_distributor_id").val(); var reason = $("#reason").val(); if(reason.length == 0){ Public.tips.error('<?=__('请填写原因!')?>'); return false; } var ajax_url = './index.php?ctl=Seller_Supplier_Distributor&met=apply_disagree&typ=json'; $.ajax({ url:ajax_url, data:{shop_distributor_id:shop_distributor_id,reason:reason}, success:function(a){ . . . } }) }) ~~~ 方法:apply_disagree() ~~~ //不通过分销商申请,添加原因 $flag = $this->shopDistributorModel->editShopDistributor($shop_distributor_id,$field_row); ~~~