🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
批发市场 : 建立分销商、供应商关系 建立关系流程:批发市场申请成为分销商 -> 供应商同意 -> 成为分销商 一、申请成为分销商(供应商不能是分销商) 文件路径:shop/controllers/Supplier/GoodsCtl.php 视图:shop/views/default/Supplier/GoodsCtl/goodslist.php ~~~ <a class="apply_dist" data-id = <?=$val['shop_id']?> style="padding: 3.5px 50px;background-color: #e45050;color: white;"><?=__('申请分销商')?></a> $(".apply_dist").click(function (){ var self_shop_type = <?=$shop_info['shop_type']?>; var shop_id = $(this).attr("data-id"); if(self_shop_type == 2){ Public.tips.error("<?=__('供货商不能参与分销')?>!"); }else{ location.href = SITE_URL+"?ctl=Seller_Supplier_Supplier&met=apply&typ=e&shop_id="+shop_id; } }) ~~~ 申请路径:shop/controllers/Seller/Supplier/SupplierCtl.php 申请视图:shop/views/default/Seller/Supplier/SupplierCtl/apply.php 参数:shop_id 方法:apply() ~~~ if($shop_id) { $shop_info = $shopBaseModel->getOneByWhere(array('shop_id'=>$shop_id)); $cat_row['shop_id'] = $shop_id; $shop_cat = $shopGoodCatModel->getGoodCatList($cat_row, array()); } ~~~ 二、供应商审核分销商 文件路径:shop/controllers/Seller/Supplier/DistributorCtl.php 视图:shop/views/default/Seller/Supplier/DistributorCtl/index.php * 审核通过:方法: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); } } } ~~~ * 分销商审核不通过: 视图: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); ~~~