diff --git a/app/admin/controller/merchant/system/Merchant.php b/app/admin/controller/merchant/system/Merchant.php new file mode 100644 index 0000000..3b67d20 --- /dev/null +++ b/app/admin/controller/merchant/system/Merchant.php @@ -0,0 +1,26 @@ +model = $model; + } + + /** + * TODO 创建申请 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function create(MerchantApplymentsValidate $validate) + { + // if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻'); + $data = $this->checkParams($validate); + + } + + /** + * TODO 创建申请 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function detail() + {} + + /** + * TODO 编辑提交 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function update($id,MerchantApplymentsValidate $validate) + {} + + /** + * TODO 查询更新状态 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function check() + {} + + /** + * TODO 上传图片 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function uploadImage($field) + {} + + /** + * TODO 检验参数 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function checkParams(MerchantApplymentsValidate $validate) + { + //'organization_cert_info', + $data = $this->request->params([ + 'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc' + ]); + + if($data['id_doc_type'] == 1){ + unset($data['id_doc_info']); + }else{ + unset($data['id_card_info']); + } + + if(in_array($data['organization_type'],['2401','2500'])){ + unset($data['business_license_info']); + } + + if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']); + + if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']); + if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){ + unset($data['id_card_info']['id_card_address']); + } + $validate->check($data); + return $data; + } +} \ No newline at end of file diff --git a/app/admin/controller/merchant/system/auth/Menu.php b/app/admin/controller/merchant/system/auth/Menu.php new file mode 100644 index 0000000..24b50a9 --- /dev/null +++ b/app/admin/controller/merchant/system/auth/Menu.php @@ -0,0 +1,133 @@ +adminInfo = get_login_admin(); + + $this->menu = $menu; + + $this->params = get_params() ; + } + + /** + * 空白菜单页,由前端 ajax 获取数据 + */ + function Index() { + return view('merchant/system/auth/menu/index'); + } + + /** + * 菜单列表 + */ + function Lst(){ + // 查出商户所有菜单数据 + $data = $this->menu->Search([], 1); + + to_assign(0,'',$data['list']); + } + + /** + * 表单页 + * TODO: 操作日志要另建表做关联 + * 操作日志待开发 + * + */ + function AddForm(FormatList $format){ + $id = isset($this->params['id']) ? $this->params['id'] : 0; + $pid = isset($this->params['pid']) ? $this->params['pid'] : 0; + if($id>0){ + $detail = $this->menu->Find($id); + $detail['name'] = $detail['title']; + View::assign('detail', $detail); + } + // 查出商户所有菜单数据 + $data = $this->menu->Search([], 1); + $menus = $format->DropDownMenu($data['list']); + + View::assign('id', $id); + View::assign('pid', $pid); + View::assign('menus',$menus); + + return view('merchant/system/auth/menu/add'); + } + + /** + * 添加菜单 + */ + function Add(){ + echo 'add'; + $this->params['src'] = preg_replace('# #','',$this->params['src']); + // if ($param['id'] == 0) { + try { + validate(RuleCheck::class)->scene('add')->check($this->params); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + $this->params['create_time'] = time(); + $rid = Db::name('AdminRule')->strict(false)->field(true)->insertGetId($this->params); + //自动为系统所有者管理组分配新增的节点 + $group = Db::name('AdminGroup')->find(1); + if (!empty($group)) { + $newGroup['id'] = 1; + $newGroup['rules'] = $group['rules'] . ',' . $rid; + Db::name('AdminGroup')->strict(false)->field(true)->update($newGroup); + add_log('add', $rid, $this->params); + } + // } + // 删除后台节点缓存 + clear_cache('adminRules'); + return to_assign(); + } + + /** + * 编辑菜单 + */ + function Edit(){ + echo 'edit'; + if ($this->params['id'] > 0) { + try { + validate(RuleCheck::class)->scene('edit')->check($this->params); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + Db::name('AdminRule')->strict(false)->field(true)->update($this->params); + add_log('edit', $this->params['id'], $this->params); + } + } + + /** + * 删除菜单 + */ + function Del(){ + $id = get_params("id"); + try{ + $this->menu->Del($id); + return to_assign(0, "删除节点成功"); + }catch(ValidateException $e){ + return to_assign(1, $e->getMessage()); + } + } +} \ No newline at end of file diff --git a/app/admin/controller/merchant/system/merchant/MerchantMargin.php b/app/admin/controller/merchant/system/merchant/MerchantMargin.php index 80c38a4..0f7f159 100644 --- a/app/admin/controller/merchant/system/merchant/MerchantMargin.php +++ b/app/admin/controller/merchant/system/merchant/MerchantMargin.php @@ -1,13 +1,32 @@ margin = $margin; + } + /** * 显示资源列表 * diff --git a/app/admin/controller/merchant/system/merchant/MerchantType.php b/app/admin/controller/merchant/system/merchant/MerchantType.php index 56a55d6..29ac1ce 100644 --- a/app/admin/controller/merchant/system/merchant/MerchantType.php +++ b/app/admin/controller/merchant/system/merchant/MerchantType.php @@ -1,13 +1,65 @@ mer_type = $mer_type; + } + + /** + * 空白菜单页,由前端 ajax 获取数据 + */ + function Index() + { + return View('merchant/system/merchant/type/index'); + } + + /** + * 添加/编辑 表单页 + */ + public function Form() + { + if ($param['mer_id']>0) { + $product_id = isset($param['product_id']) ? $param['product_id'] : 0; + $detail = $this->model->getStoreProductById($product_id); + if (!empty($detail)) { + $detail['content'] = Db::table('cms_store_product_content')->where('product_id',$detail['product_id'])->value('content'); + $detail['slider_image_arr'] = explode(',',$detail['slider_image']); + // halt($detail['slider_image_arr']); + View::assign('detail', $detail); + $store_brand= Db::connect('shop')->table('eb_store_brand')->where(['is_show' => 1]) + ->select(); + View::assign('store_brand', $store_brand); + + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } + } + return view(); + } + /** * 显示店铺类型列表 * @@ -16,6 +68,14 @@ class MerchantType extends BaseController public function Lst() { echo 1723; + $param = get_params(); + $where = []; + if (isset($param['keywords']) && !empty($param['keywords'])){ + $where[]=['store_name','like','%'.$param['keywords'].'%']; + } + $list = $this->model->getStoreProductList($where,$param); + + return table_assign(0, '', $list); } /** @@ -25,18 +85,9 @@ class MerchantType extends BaseController */ public function Add() { - // - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save(Request $request) - { - // + $store_brand= Db::connect('shop')->table('eb_store_brand')->where(['is_show' => 1]) + ->select(); + return to_assign(0,'操作成功'); } /** @@ -47,7 +98,21 @@ class MerchantType extends BaseController */ public function Detail($id) { - // + $param = get_params(); + $product_id = isset($param['product_id']) ? $param['product_id'] : 0; + $detail = $this->model->getStoreProductById($product_id); + if (!empty($detail)) { + $detail['content'] = Db::table('cms_store_product_content')->where('product_id',$detail['product_id'])->value('content'); + $detail['slider_image_arr'] = explode(',',$detail['slider_image']); + View::assign('detail', $detail); + $store_brand= Db::connect('shop')->table('eb_store_brand')->where(['is_show' => 1]) + ->select(); + View::assign('store_brand', $store_brand); + return view(); + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } } /** @@ -58,19 +123,7 @@ class MerchantType extends BaseController */ public function edit($id) { - // - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update(Request $request, $id) - { - // + return to_assign(0,''); } /** @@ -79,12 +132,36 @@ class MerchantType extends BaseController * @param int $id * @return \think\Response */ - public function delete($id) + public function del($id) { - // + $param = get_params(); + $product_id = isset($param['product_id']) ? $param['product_id'] : 0; + $type = isset($param['type']) ? $param['type'] : 0; + + $this->model->delStoreProductById($product_id,1); } - public function Mark(){} + /** + * 备注表单页 + */ + public function MarkForm() + { + return View(''); + } - public function Description(){} + /** + * 店铺类型备注 + */ + public function Mark() + { + return to_assign(0, ''); + } + + /** + * 店铺类型说明 + */ + public function Description(){ + View::assign('detail',[]); + return View('merchant/system/merchant/descr/index',['id'=>1]); + } } diff --git a/app/admin/route/menu.php b/app/admin/route/menu.php index 5b15ac9..63c5290 100644 --- a/app/admin/route/menu.php +++ b/app/admin/route/menu.php @@ -47,7 +47,7 @@ Route::group(function () { Route::delete('del/:id', '/del')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([ '_alias' => '商户菜单/权限删除', ]); - })->prefix('merchant.system.merchant.auth.Menu')->option([ + })->prefix('merchant.system.auth.Menu')->option([ '_path' => '/merchant/menu', '_auth' => true, ]); diff --git a/app/admin/route/merchant.php b/app/admin/route/merchant.php index 8b9e287..c65f134 100644 --- a/app/admin/route/merchant.php +++ b/app/admin/route/merchant.php @@ -46,6 +46,9 @@ Route::group(function(){ // 店铺类型 Route::group('/merchant/type',function(){ + Route::get('index', '/index')->name('systemMerchantTypeLst')->option([ + '_alias' => '列表', + ]); Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([ '_alias' => '列表', ]); @@ -70,7 +73,7 @@ Route::group(function(){ '_alias' => '备注', ]); - Route::get('description', '/description')->name('systemMerchantTypeDescrForm')->option([ + Route::get('descr', '/description')->name('systemMerchantTypeDescrForm')->option([ '_alias' => '店铺类型说明', ]); Route::post('description', '/description')->name('systemMerchantTypeDescr')->option([ diff --git a/app/admin/view/merchant/system/auth/menu/add.html b/app/admin/view/merchant/system/auth/menu/add.html new file mode 100644 index 0000000..2b494c5 --- /dev/null +++ b/app/admin/view/merchant/system/auth/menu/add.html @@ -0,0 +1,150 @@ +{extend name="common/base" /} + +{block name="body"} +
+

功能菜单/节点

+ {if condition="$id eq 0"} + + + + + + + + + + + + + + + + + + + + + + + +
父级菜单/节点* + + + 左侧菜单显示* + + + +
菜单/节点名称* + + + 操作日志名称* + + +
菜单/节点URL + + 菜单排序 + +
菜单图标 + + 如:bi-gear[查看图标] +
+ {else/} + + + + + + + + + + + + + + + + + + + + + + + +
父级菜单/节点* + + + 左侧菜单显示* + + + +
菜单/节点名称* + + + 操作日志名称* + + +
菜单/节点URL + + 菜单排序 + +
菜单图标 + + [查看图标] +
+ {/if} +
+ + + +
+
+{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/type/add.html b/app/admin/view/merchant/system/merchant/type/add.html new file mode 100644 index 0000000..d5368fe --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/add.html @@ -0,0 +1,249 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
商品名称*
平台商品分类* +
+ +
+
品牌选择* +
+ +
+
商品封面图 +
+ +
+ + +
+
+
商品轮播图 +
+ + +
+ +
+
+
单位*
商品关键字*
售价*
成本价*
市场价*
库存*
商品简介 + +
商品详情 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/type/edit.html b/app/admin/view/merchant/system/merchant/type/edit.html new file mode 100644 index 0000000..2ad9a35 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/edit.html @@ -0,0 +1,252 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

编辑文章表

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
商品名称*
平台商品分类* +
+ +
+
品牌选择* +
+ +
+
商品封面图 +
+ +
+ + +
+
+
商品轮播图 +
+ +
+ {volist name='detail.slider_image_arr' id='vo'} + {if $vo} + + {/if} + {/volist} + +
+
+
单位*
商品关键字*
售价*
成本价*
市场价*
库存*
商品简介 + +
商品详情 + +
+
+ + + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/type/read.html b/app/admin/view/merchant/system/merchant/type/read.html new file mode 100644 index 0000000..c3637d7 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/read.html @@ -0,0 +1,148 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

文章详情

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
商品名称*
商户商品分类* +
+ +
+
品牌选择* +
+ +
+
商品封面图 +
+ + + +
+ + +
+
+
商品轮播图 +
+ + + +
+ {volist name='detail.slider_image_arr' id='vo'} + {if $vo} + + {/if} + {/volist} + +
+
+
单位*
商品关键字*
售价*
成本价*
市场价*
库存*
商品简介 + +
商品详情 + +
+
+{/block} + \ No newline at end of file diff --git a/app/common/model/merchant/system/merchant/MerchantMargin.php b/app/common/model/merchant/system/merchant/MerchantMargin.php new file mode 100644 index 0000000..62e8eaa --- /dev/null +++ b/app/common/model/merchant/system/merchant/MerchantMargin.php @@ -0,0 +1,25 @@ +