# Conflicts:
#	public/.htaccess
#	public/nginx.htaccess
This commit is contained in:
彭桃 2023-03-13 17:06:21 +08:00
commit 6fc491eb1c
151 changed files with 18042 additions and 223 deletions

View File

@ -4,4 +4,58 @@ APP_DEBUG = true
DEFAULT_TIMEZONE = Asia/Shanghai
[LANG]
default_lang = zh-cn
default_lang = zh-cn
[DATABASE]
TYPE = mysql
HOSTNAME = 47.92.112.123
DATABASE = nk_lihaink_cn
PREFIX = cms_
USERNAME = nk_lihaink_cn
PASSWORD = 5MnmkZTW2tmahha7
HOSTPORT = 3306
CHARSET = utf8mb4
DEBUG = true
TYPE = mysql
HOSTNAME = 47.92.112.123
DATABASE = nk_lihaink_cn
PREFIX = cms_
USERNAME = view_oa_lihaink_cn
PASSWORD = 5MnmkZTW2tmahha7
HOSTPORT = 3306
CHARSET = utf8mb4
DEBUG = true
[DATABASE]
TYPE = mysql
HOSTNAME = 47.92.112.123
DATABASE = nk_lihaink_cn
PREFIX = cms_
USERNAME = view_oa_lihaink_cn
PASSWORD = 5MnmkZTW2tmahha7
HOSTPORT = 3306
CHARSET = utf8mb4
DEBUG = true
[DATABASESHOP]
TYPE = mysql
HOSTNAME = 47.108.186.87
HOSTPORT = 3306
USERNAME = shop_lihaink_com
PASSWORD = EeYym2PFctFfrMde
DATABASE = shop_lihaink_com
PREFIX = eb_
CHARSET = utf8
DEBUG = true
[DATABASESHOP]
TYPE = mysql
HOSTNAME = 122.9.139.134
HOSTPORT = 3306
USERNAME = shop_lihaink_com
PASSWORD = EeYym2PFctFfrMde
DATABASE = shop_lihaink_com
PREFIX = eb_
CHARSET = utf8
DEBUG = true

6
.gitignore vendored
View File

@ -3,11 +3,17 @@
/.gitee
*.log
*.env
*.env.debug
*.lock
*.ini
.htaccess
404.html
# index.html
/runtime/*
/public/storage/*
/public/backup/*
/public/static/home/dev
/public/static/home/oa
/config/database.php
/public/.htaccess
/public/nginx.htaccess

1
.htaccess Normal file
View File

@ -0,0 +1 @@

7
404.html Normal file
View File

@ -0,0 +1,7 @@
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

View File

@ -9,6 +9,9 @@ use think\facade\Config;
use think\facade\Request;
use think\facade\Cache;
use think\facade\Db;
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreBrandCategory; // 商品品牌列表模型
//获取后台模块当前登录用户的信息
function get_login_admin($key = "")
{
@ -93,6 +96,7 @@ function set_recursion($result, $pid = 0, $level=-1)
static $list = array();
static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─'];
$level++;
foreach ($result as $k => $v) {
if ($v['pid'] == $pid) {
if ($pid != 0) {
@ -103,9 +107,69 @@ function set_recursion($result, $pid = 0, $level=-1)
set_recursion($result, $v['id'],$level);
}
}
return $list;
}
//读取商品品牌节点列表
function get_band_calss()
{
$result = StoreBrandCategory::where('pid', 0)->order('sort desc')->select()->toArray();
return $result;
}
//递归排序,用于分类选择
function set_band_recursion($result, $pid = 0, $level=-1)
{
/*记录排序后的类别数组*/
static $list = array();
static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─'];
$level++;
foreach ($result as $k => $v) {
if ($v['pid'] == $pid) {
if ($pid != 0) {
$v['cate_name'] = $space[$level] . $v['cate_name'];
}
/*将该类别的数据放入list中*/
$list[] = $v;
set_band_recursion($result, $v['store_brand_category_id'],$level);
}
}
return $list;
}
//读取商品品牌分类节点列表
function get_product_calss()
{
$result = StoreCategory::select()->toArray();
return $result;
}
//递归排序,用于分类选择
function set_product_recursion($result, $pid = 0, $level=-1)
{
/*记录排序后的类别数组*/
static $list = array();
static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─'];
$level++;
foreach ($result as $k => $v) {
if ($v['pid'] == $pid) {
if ($pid != 0) {
$v['cate_name'] = $space[$level] . $v['cate_name'];
}
/*将该类别的数据放入list中*/
$list[] = $v;
set_product_recursion($result, $v['store_category_id'],$level);
}
}
return $list;
}
/**
* 根据id递归返回子数据
* @param $data 数据

View File

@ -1,30 +1,30 @@
<?php
namespace app\admin\controller\nk;
namespace app\admin\controller\accounts;
use app\admin\BaseController;
use think\exception\ValidateException;
use think\facade\Db;
use app\admin\controller\nk\Article;
use think\facade\View;
/**
* 区域订单手续费(佣金)管理
* 财务相关控制器
*
* @icon fa fa-circle-o
*/
class Regioncommission extends BaseController
{
class Accounts extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.regioncommission/index',
];
}
/**
* 查看
* 提现管理
*
*/
public function index()
public function extract()
{
$total=0;
$list=[];
@ -46,17 +46,6 @@ class Regioncommission extends BaseController
}
View::assign('brokerage_price', $brokerage_price);
return view('',['url'=>$this->url]);
return view();
}
/**
* 查看信息
*/
public function read()
{
$params = get_params();
return view('',['url'=>$this->url]);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace app\merchant\controller;
use app\admin\BaseController;
class Common extends BaseController
{
protected $adminInfo;
function __construct()
{
// $this->adminInfo = get_login_admin();
}
}

View File

@ -0,0 +1,133 @@
<?php
/**
* 商户菜单管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
namespace app\admin\controller\merchant\system\auth;
use app\admin\BaseController;
use app\common\model\merchant\system\auth\Menu as MenuModel;
use think\facade\View;
use app\common\controller\FormatList;
use think\exception\ValidateException;
/**
* class Menu
*/
class Menu extends BaseController
{
protected $menu;
protected $params;
function __construct(MenuModel $menu) {
// $this->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());
}
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @date 2023年03月2日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户管理
*/
namespace app\admin\controller\merchant\system;
use app\admin\BaseController;
use app\common\model\merchant\system\merchant\Merchant as MerchantModel;
class Merchant extends BaseController{
protected $model;
public function __construct()
{
}
function classify(){
}
public function system() {
}
}

View File

@ -0,0 +1,118 @@
<?php
/**
* @date 2023年03月2日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户入驻申请管理
*/
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use app\validate\merchant\MerchantApplymentsValidate;
use app\common\model\merchant\system\merchant\MerchantApplyments as MerchantApplymentsModel;
class MerchantApplyments extends BaseController
{
/**
* @var MerchantModel
*/
protected $model;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
*/
function __construct(MerchantApplymentsModel $model){
$this->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;
}
}

View File

@ -0,0 +1,86 @@
<?php
declare (strict_types = 1);
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use think\Request;
class MerchantCategory extends BaseController
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function lst()
{
//
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}

View File

@ -0,0 +1,158 @@
<?php
/**
* 店铺入驻申请审核管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
declare (strict_types = 1);
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use think\facade\Request;
use app\common\model\merchant\system\merchant\MerchantIntention as MerchantIntentionModel;
use think\facade\View;
use app\common\model\merchant\system\merchant\MerchantCategory;
use app\common\model\merchant\system\merchant\MerchantType;
class MerchantIntention extends BaseController
{
protected $path;
protected $request;
protected $intention;
public function __construct(Request $request, MerchantIntentionModel $intention)
{
$this->request = $request;
$this->intention = $intention;
$this->path = [
'index' => 'merchant/system/merchant/intention/lst',
'mark' => 'merchant/system/merchant/intention/mark',
'read' => 'merchant/system/merchant/intention/read',
'add' => 'merchant/system/merchant/intention/add'
];
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function Index(MerchantCategory $category, MerchantType $type)
{
// 商户分类
$category = $category->select();
//审核
// 店铺类弄
$type = $type->select();
// search
View::assign('category',$category);
View::assign('type',$type);
return View($this->path['index']);
}
public function Lst()
{
$params = get_params();
$page = empty($params['page'])? 1 : (int)$params['page'];
$limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit'];
$where = get_params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id']);
$data = $this->intention->GetList($where, $page, $limit);
return to_assign(0, '', $data);
}
public function StatusForm()
{
return View($this->path['index']);
}
public function MarkForm()
{
$id = get_params('id');
View::assign('id', $id);
return View($this->path['mark']);
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function SetMark()
{
$id = get_params('id');
$mark = get_params('mark');
if (!$this->intention->getWhereCount($id))
return to_assign(1, '数据不存在');
$rows = $this->intention->Edit($id, ['mark' => $mark]);
return $rows>0?to_assign(1, '修改成功'):to_assign(0, '修改失败');
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}

View File

@ -0,0 +1,166 @@
<?php
/**
* 店铺保证金管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
declare (strict_types = 1);
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use app\common\model\merchant\system\serve\ServeOrder as ServeOrderModel;
use app\common\model\merchant\user\UserBill as UserBillModel;
use app\common\model\merchant\system\merchant\Merchant as MerchantModel;
use think\facade\View;
use think\exception\ValidateException;
use think\facade\Request;
/**
* 店铺保证金管理类
*/
class MerchantMargin extends BaseController
{
protected $margin;
protected $path;
public function __construct()
{
// $this->margin = $margin;
$this->path = [
'index' => 'merchant/system/merchant/margin/list',
'read' => 'merchant/system/merchant/margin/read',
'edit' => 'merchant/system/merchant/margin/edit'
];
}
public function Index()
{
return View($this->path['index']);
}
/**
* 显示保证金列表
*
* @return \think\Response
*/
public function Lst(ServeOrderModel $order)
{
$params = get_params();
$page = empty($params['page'])? 1 : (int)$params['page'];
$limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit'];
$where = ['date','keyword','is_trader','category_id','type_id'];
$where['type'] = 10;//10==保证金
$data = $order->GetList($where, $page, $limit);
return to_assign(0,'success', $data['data']=$data['list']);
}
/**
* 打开保证金扣费记录面
*
* @param int $id
* @return \think\Response
*/
public function GetMarginLstForm($id)
{
view::assign('id', $id);
return View($this->path['read']);
}
/**
* 获取保证金扣费记录 record
*
*/
public function GetMarginLst(UserBillModel $bill)
{
$params = get_params();
$mer_id = empty($params['id']) ? 0 : $params['id'];
$page = empty($params['page'])? 1 : (int)$params['page'];
$limit = empty($params['limit'])? (int)get_config('app . page_size') :(int)$params['limit'];
$where['mer_id'] = (int)$mer_id;
$where['category'] = 'mer_margin';
$data = $bill->GetList($where, $page, $limit);
return to_assign(0,'请求成功', $data);
}
/**
* 设置扣减保证金表单
*/
public function setMarginForm(MerchantModel $merchant)
{
$mer_id = get_params('id');
$data = $merchant->GetMerchantById($mer_id);
if (isset($data->is_margin) && $data->is_margin !== 10) {
throw new ValidateException('商户无保证金可扣');
}
return View($this->path['edit'], ['data'=>$data]);
}
/**
* 设置扣减保证金
*/
public function setMargin(MerchantModel $merchant)
{
$data = get_params(['mer_id','number','mer_name','margin','mark']);
if (empty($data['mer_name']) || empty($data['mer_id'])) {
return to_assign(0,'商户信息不能为空');
}
$data['title'] = '保证金扣除';
$data['type'] = 'mer_margin';//明细类型=保证金扣除
if (!empty($data['number']) && $data['number'] < 0)
return to_assign(0,'扣除金额不能小于0');
$data = $merchant->SetMargin($data);
return to_assign(0,'扣除保证金成功',[]);
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
}

View File

@ -0,0 +1,210 @@
<?php
/**
* 店铺类型管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
declare(strict_types=1);
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use app\common\model\merchant\system\merchant\MerchantType as MerchantTypeModel;
use app\common\model\merchant\system\auth\Menu as MenuModel;
use app\common\controller\FormatList;
use think\facade\View;
/**
* 店铺类型管理类
*/
class MerchantType extends BaseController
{
protected $merchant;
protected $path;
public function __construct(MerchantTypeModel $merchant)
{
$this->merchant = $merchant;
$this->path = [
'index' => 'merchant/system/merchant/type/index',
'read' => 'merchant/system/merchant/type/read',
'add' => 'merchant/system/merchant/type/add'
];
}
/**
* 空白菜单页,由前端 ajax 获取数据
*/
public function Index()
{
return View($this->path['index']);
}
/**
* 添加/编辑 表单页
*/
public function Form(MenuModel $menu, FormatList $format)
{
$param = get_params();
$id = isset($param['id']) ? (int)$param['id'] : 0;
if (!empty($id)) {
// 进入编辑页,显示店铺数据
$detail = $this->merchant->Find($id);
}
if (empty($detail)) {
$detail = [
"create_time" => '',
"description" => '',
"id" => '',
"margin" => 0,
"is_margin" => 0,
"type_info" => '',
"description" => '',
"type_name" => '',
"update_time" => ''
];
}
// 查出商户所有菜单数据
$data = $menu->Search([], 1);
View::assign('dataTree', $format->FormatCategory($data['list']));
View::assign('detail', $detail);
return view($this->path['add']);
}
/**
* 输出店铺类型列表数据
*
* @return \think\Response
*/
public function Lst()
{
$param = get_params();
$page = empty($param['page']) ? 1 : (int)$param['page'];
$limit = empty($param['limit']) ? 10 : (int)$param['limit'];
$data = $this->merchant->GetList($page, $limit);
return table_assign(0, '', $data);
}
/**
* TODO: 关联权限待完成
*
* 添加店铺类型.
*
* @return \think\Response
*/
public function Add()
{
$params = get_params();
$batch['type_name'] = $params['type_name'];
$batch['description'] = $params['description'];
$batch['is_margin'] = $params['is_margin'];
$batch['margin'] = $params['margin'];
$batch['type_info'] = $params['type_info'];
$menu_ids = $params['auth'];
// 更新权限
// $this->menu->update($menu_ids);
$rows = $this->merchant->Add($batch);
return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败');
}
/**
* 查看指定的店铺详情
*
* @return \think\Response
*/
public function Read()
{
$param = get_params();
$id = isset($param['id']) ? (int)$param['id'] : 0;
$detail = $this->merchant->Find($id);
if (!empty($detail)) {
View::assign('detail', $detail);
return view($this->path['read']);
} else {
throw new \think\exception\HttpException(404, '找不到页面');
}
}
/**
* TODO: 关联权限待完成
* 编辑指定菜单.
*
* @param int $id
* @return \think\Response
*/
public function Edit()
{
$params = get_params();
$batch['type_name'] = $params['type_name'];
$batch['description'] = $params['description'];
$batch['is_margin'] = $params['is_margin'];
$batch['margin'] = $params['margin'];
$batch['type_info'] = $params['type_info'];
$menu_ids = $params['auth'];
// 更新权限
// $this->menu->update($menu_ids);
$rows = $this->merchant->Add($batch);
return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败');
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function Del()
{
$param = get_params();
if (empty($param['id'])) {
return 0;
}
$id = (int)$param['id'];
$rows = $this->merchant->Del($id);
return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败');
}
/**
* 备注表单页
*/
/**
* 店铺类型备注
*/
public function Mark()
{
$params = get_params();
return to_assign(0, '');
}
/**
* 店铺类型说明
*/
public function Description()
{
View::assign('detail', []);
return View('merchant/system/merchant/descr/index', ['id' => 1]);
}
}

View File

@ -18,4 +18,4 @@ class PublicBenefitActivities extends ArticleCommon{
'/admin/nk.public_benefit_activities/read',
];
}
}
}

View File

@ -0,0 +1,208 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\StoreBrand; // 商品品牌列表模型
use app\admin\model\StoreBrandCategory; // 商品品牌分类列表模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品品牌管理控制器
*
*
*/
class Band extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.band/index?category_id='.$this->category_id,
'/admin/product.band/add',
'/admin/product.band/edit',
'/admin/product.band/del',
'/admin/product.band/index',
];
}
/**
*
* 商品品牌列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreBrand::where($where)->count();
$list = StoreBrand::order('sort desc, brand_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreBrand::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['brand_name'] = $params['brand_name']; // 品牌名称
$data['is_show'] = isset($params['is_show']); // 状态
$data['brand_category_id'] = $params['brand_category_id']; // 所属ID
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreBrand::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('pid', 0)
->where('is_show', 1)
->select();
View::assign('storeBrandCategory', $storeBrandCategory);
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['brand_name'] = $params['brand_name']; // 品牌名称
$data['is_show'] = isset($params['is_show']); // 状态
$data['brand_category_id'] = $params['brand_category_id']; // 所属ID
$data['sort'] = $params['sort']; // 排序
// 数据更新
$res = StoreBrand::where('brand_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$supplyChain = StoreBrand::with(['storeBrandCategory'])->find($id); // 取出当前品牌数据
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('pid', 0)
->where('is_show', 1)
->select();
View::assign('storeBrandCategory', $storeBrandCategory);
View::assign('detail', $supplyChain);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$res = StoreBrand::where('brand_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,216 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\StoreBrandCategory; // 商品品牌分类模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品品牌分类管理控制器
*
*
*/
class BrandClassify extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.brandClassify/index?category_id='.$this->category_id,
'/admin/product.brandClassify/add',
'/admin/product.brandClassify/edit',
'/admin/product.brandClassify/del',
'/admin/product.brandClassify/index',
];
}
/**
*
* 商品品牌列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreBrandCategory::where($where)->count();
$list = StoreBrandCategory::order('sort desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreBrandCategory::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreBrandCategory::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息
View::assign('detail', $storeBrandCtegory);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
// 验证下面是否有子分类
if(StoreBrandCategory::where('pid', $id)->count())
{
return to_assign(1, '请先删除子分类!');
}
$res = StoreBrandCategory::where('store_brand_category_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
/**
*
* 子分类
*
*/
public function street($pcode)
{
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('is_show', 1)
->where('pid', $pcode)
->select();
return json($storeBrandCategory);
}
}

View File

@ -0,0 +1,226 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品分类控制器
*
*/
class Classify extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.classify/index?category_id='.$this->category_id,
'/admin/product.classify/add',
'/admin/product.classify/edit',
'/admin/product.classify/delete'
];
}
/**
*
* 商城分类列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreCategory::where($where)->count();
// $list = StoreCategory::with(['merchant', 'street', 'area'])->order('id desc')->select();
$list = StoreCategory::order('store_category_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreCategory::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pic'] = $params['pic']; // 图标
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreCategory::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$pid = isset($param['pid']) ? $param['pid'] : 0;
if($id > 0){
$detail = StoreCategory::find($id); // 分类模型
View::assign('detail', $detail);
}
$storeCategoryList = StoreCategory::order('store_category_id desc')->where('pid', 0)->select();
View::assign('storeCategoryList', $storeCategoryList);
View::assign('url', $this->url);
View::assign('id', $id);
View::assign('pid', $pid);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pic'] = $params['pic']; // 图标
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
// 数据更新
$res = StoreCategory::where('store_category_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
$category = StoreCategory::with(['storeCategory'])->find($id); // 取出当前供应链数据
$storeCategoryList = StoreCategory::order('store_category_id desc')->where('pid', 0)->select();
View::assign('storeCategoryList', $storeCategoryList);
View::assign('detail', $category);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function delete()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$supplyChain = SupplyChain::with(['linkMerchant'])->find($id);
// 删除关联模型
$res = $supplyChain->together(['linkMerchant'])->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
/**
*
* 获取子分类
*
*/
public function street($pcode)
{
$storeCategory = StoreCategory::order('sort desc')
->where('is_show', 1)
->where('pid', $pcode)
->select();
return json($storeCategory);
}
}

View File

@ -0,0 +1,263 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品评论控制器
*
*
*/
class Comment extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.comment/index?category_id='.$this->category_id,
'/admin/product.comment/add',
'/admin/product.comment/edit',
'/admin/product.comment/del',
'/admin/product.comment/index',
];
}
/**
*
* 商品评论列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreProductReply::where($where)->count();
$list = StoreProductReply::with(['product'])->order('reply_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreProductReply::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = SupplyChain::create($data);
// 关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$res->linkMerchant()->save($dataLink); // 插入关联数据
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('editor', get_system_config('other','editor'));
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['id'] = $params['id']; // 当前ID
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
$res = $supplyChain->update($data);
// 获取关联数据一对一---曲线救国
$linkMerchant = $supplyChain['linkMerchant'];
// $linkMerchantArr = $linkMerchant->column('id');
// 先删除关联数据-- 曲线救国
$linkMerchant->delete();
// 关联商户状态
if($data['mer_id_list'])
{
// 再重新将关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$supplyChain->linkMerchant()->save($dataLink);
}
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
View::assign('detail', $supplyChain);
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$res = StoreProductReply::where('reply_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,196 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品保障服务控制器
*
*
*/
class Guarantee extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.guarantee/index?category_id='.$this->category_id,
'/admin/product.guarantee/add',
'/admin/product.guarantee/edit',
'/admin/product.guarantee/del',
'/admin/product.guarantee/index',
];
}
/**
*
* 商品保障服务列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = GuaranteeModel::where($where)->count();
$list = GuaranteeModel::order('guarantee_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = GuaranteeModel::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['guarantee_name'] = $params['guarantee_name']; // 标签名
$data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态
$data['guarantee_info'] = $params['guarantee_info']; // 说明
$data['image'] = $params['image']; // 说明
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = GuaranteeModel::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['guarantee_name'] = $params['guarantee_name']; // 标签名
$data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态
$data['guarantee_info'] = $params['guarantee_info']; // 说明
$data['image'] = $params['image']; // 说明
$data['sort'] = $params['sort']; // 排序
$data['update_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = GuaranteeModel::where('guarantee_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$supplyChain = GuaranteeModel::find($id); // 取出当前保障服务数据
View::assign('detail', $supplyChain);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$res = GuaranteeModel::where('guarantee_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,194 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\StoreProductLabel; // 商品标签模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品标签控制器
*
*
*/
class Label extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.label/index?category_id='.$this->category_id,
'/admin/product.label/add',
'/admin/product.label/edit',
'/admin/product.label/del',
'/admin/product.label/index',
];
}
/**
*
* 商品评论列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreProductLabel::where($where)->count();
$list = StoreProductLabel::with(['product'])->order('product_label_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreProductLabel::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['label_name'] = $params['label_name']; // 标签名
$data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态
$data['info'] = $params['info']; // 说明
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreProductLabel::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['label_name'] = $params['label_name']; // 标签名
$data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态
$data['info'] = $params['info']; // 说明
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = StoreProductLabel::where('product_label_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$supplyChain = StoreProductLabel::find($id); // 取出当前供应链数据
View::assign('detail', $supplyChain);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$res = StoreProductLabel::where('product_label_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,216 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\StoreBrandCategory; // 商品品牌分类模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商户商品参数控制器
*
*
*/
class MerSpecs extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.priceDescription/index?category_id='.$this->category_id,
'/admin/product.priceDescription/add',
'/admin/product.priceDescription/edit',
'/admin/product.priceDescription/del',
'/admin/product.priceDescription/index',
];
}
/**
*
* 商品价格列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreBrandCategory::where($where)->count();
$list = StoreBrandCategory::order('sort desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreBrandCategory::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreBrandCategory::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息
View::assign('detail', $storeBrandCtegory);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
// 验证下面是否有子分类
if(StoreBrandCategory::where('pid', $id)->count())
{
return to_assign(1, '请先删除子分类!');
}
$res = StoreBrandCategory::where('store_brand_category_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
/**
*
* 子分类
*
*/
public function street($pcode)
{
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('is_show', 1)
->where('pid', $pcode)
->select();
return json($storeBrandCategory);
}
}

View File

@ -0,0 +1,252 @@
<?php
/**
* @date 2023年03月9日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商品参数列表与模板添加
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
use app\admin\model\store\paramter\ParameterTemplate as ParameterTemplateModel;//商品参数model
use app\common\controller\FormatList;
/**
*
* 平台商品参数控制器
*
*
*/
class Parameter extends BaseController
{
protected $url;
protected $adminInfo;
protected $temp;
public function __construct(ParameterTemplateModel $temp)
{
$this->adminInfo = get_login_admin();
$this->temp = $temp;
$this->url=[
'/admin/product/params/index',
'/admin/product/params/add',
'/admin/product/params/edit',
'/admin/product/params/del',
];
}
/**
* 非超级管理员登入 需更新当前用户所属地区
* @param array $where 地区id数组
* @return array $where 更改后的地区id数组
*/
protected function auth(array $where):array
{
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
return $where;
}
/**
* 商品参数列表
* @
*/
public function index(StoreCategory $category)
{
if (request()->isAjax()) {
// Ajax 获取列表数据
$params= get_params();
// 构建查询条件
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
$where = $this->auth($where);
// 获取列表数据
$page = empty($params['page'])? 1 : (int)$params['page'];
$limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit'];
$where['template_name'] = empty($params['template_name'])?'':$params['template_name'];
$where['cate_id'] = empty($params['cate_id'])?'':$params['cate_id'];
$where['mer_name'] = empty($params['mer_name'])?'':$params['mer_name'];
$where['mer_id'] = empty($params['mer_id'])?'':$params['mer_id'];
if (isset($params['is_mer'])) {
$merId = $params['mer_id'];
$where['mer_id'] = $merId;
unset($where['is_mer']);
}
$data = $this->temp->getList($where,$page, $limit);
$data['list'] = [[
'template_id'=>1,
'template_name'=>'测试',
'cateid'=>'',
'sort'=>'1',
'create_time'=> '2023-03-09 171322',
]];
return to_assign(0, '', $data);
}else{
// 初始空页面展示
$where['mer_id'] = 0;
$where['is_show'] = 0;
$cate_list = $category->getList($where);
$cate_list = FormatList::DropDownMenu($cate_list);
View::assign('url', $this->url);
View::assign('cate_list', $cate_list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
// $res = StoreBrandCategory::create($data);
// if ($res){
// return to_assign(0,'操作成功',['aid'=>$res]);
// }
// return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息
View::assign('detail', $storeBrandCtegory);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
// 验证下面是否有子分类
if(StoreBrandCategory::where('pid', $id)->count())
{
return to_assign(1, '请先删除子分类!');
}
$res = StoreBrandCategory::where('store_brand_category_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
/**
*
* 子分类
*
*/
public function street($pcode)
{
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('is_show', 1)
->where('pid', $pcode)
->select();
return json($storeBrandCategory);
}
}

View File

@ -0,0 +1,216 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\admin\model\StoreProductReply; // 商品评论模型
use app\admin\model\StoreBrandCategory; // 商品品牌分类模型
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品价格说明控制器
*
*
*/
class PriceDescription extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.priceDescription/index?category_id='.$this->category_id,
'/admin/product.priceDescription/add',
'/admin/product.priceDescription/edit',
'/admin/product.priceDescription/del',
'/admin/product.priceDescription/index',
];
}
/**
*
* 商品价格列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreBrandCategory::where($where)->count();
$list = StoreBrandCategory::order('sort desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = StoreBrandCategory::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = StoreBrandCategory::create($data);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['cate_name'] = $params['cate_name']; // 分类名称
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
$data['pid'] = $params['pid']; // 上级分类
$data['sort'] = $params['sort']; // 排序
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data);
if ($res){
return to_assign(0,'更新成功',['aid'=>$res]);
}
return to_assign(1, '更新失败,原因:'.$res);
}else{
$storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息
View::assign('detail', $storeBrandCtegory);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function del()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
// 验证下面是否有子分类
if(StoreBrandCategory::where('pid', $id)->count())
{
return to_assign(1, '请先删除子分类!');
}
$res = StoreBrandCategory::where('store_brand_category_id', $id)->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
/**
*
* 子分类
*
*/
public function street($pcode)
{
$storeBrandCategory = StoreBrandCategory::order('sort desc')
->where('is_show', 1)
->where('pid', $pcode)
->select();
return json($storeBrandCategory);
}
}

View File

@ -0,0 +1,377 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\EbStoreProduct; // 商品模型
use app\admin\model\StoreCategory; // 商品分类模型
use app\common\controller\FormatList;
// use app\admin\model\GeoCity; // 省市模型
// use app\admin\model\GeoArea; // 区域模型
// use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
// use app\api\model\Area as AreaModel; // 市场区域模型
// use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
/**
*
* 商品控制器
*
*/
class Product extends BaseController
{
protected $adminInfo;
protected $url;
protected $product;
protected $mer_id = 4;//待开发成自动获取商城登陆商户id
public function __construct(EbStoreProduct $product)
{
$this->adminInfo = get_login_admin();
$this->product = $product;
$this->url=[
'/admin/product.product/index',
'/admin/product.product/add',
'/admin/product.product/edit',
'/admin/product.product/delete',
'/admin/product.product/index',
];
}
protected function auth()
{
$where = [];
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
return $where;
}
/**
*
* 商户商品列表
*
*/
public function index(StoreCategory $category)
{
if (request()->isAjax()) {
// request()->isAjax()
// Ajax 前端获取数据
$params= get_params();
$where = self::auth();
if (isset($params['keywords']) && !empty($params['keywords'])){
// $where[]= ['sotre_name','like','%'.$params['keywords'].'%'];
$where['keywords'] = $where['store_name'] = $params['keywords'];
}
$page = empty($params['page'])?1:$params['page'];
$limit = empty($params['limit'])?10:$params['limit'];
// 平台商品分类id
$where['cate_id'] = empty($params['plate_cate'])?'':$params['plate_cate'];
// 商户商品分类id
// $where['mer_cate_id'] = empty($params['store_cate'])?'':$params['store_cate'];
$where['is_trader'] = isset($params['is_trader'])?$params['is_trader']:1; // 是否自营 1自营 0 不是自营
// product
$where['is_gift_bag'] = empty($params['is_gift'])?'':$params['is_gift'];
$where['is_show'] = empty($params['state'])?'':$params['state'];
$where['temp_id'] = empty($params['shipping_tem'])?'':$params['shipping_tem'];
$where['labels'] = empty($params['tag'])?'':$params['tag'];
$where['type'] = empty($params['type'])?'':$params['type'];//实体商品0 虚拟商品:1
// $where['status'] = 0;//管理、审核、通过
// $where['is_ficti'] = 1;//是否虚拟销量
// $where['product_id'] = 0;
// ['order','sort']
// soft //软删除
// $params['mer_id'] = $this->mer_id;
if (!empty($params['mer_id'])) {
$mer_id = get_params('mer_id');
$where = array_merge($where, $this->switchType($where['type'],$mer_id,0));
}
$mer_id = isset($params['mer_id'])?$params['mer_id']:NULL;
$data = $this->product->getList($mer_id, $where, $page, $limit);
// $list = EbStoreProduct::with(['merchant' => ['merchantType', 'category']])->order('product_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $data['list']);
$result = ['total' => $data['count'], 'data' => $data['list']];
return table_assign(0, '', $result);
}else{
$list = SupplyChain::with(['merchant' => ['merchantType', 'category']])->select();
// 初始空页面展示
$where['mer_id'] = 0;
$where['is_show'] = 0;
$cate_list = $category->getList($where);
$cate_list = FormatList::DropDownMenu($cate_list);
View::assign('cate_list', $cate_list);
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
* 与类型相对应的sql字段
*
* @Author:Liuxiaoquan
* @Date: 2020/5/18
* @param $type
* @param int|null $merId 商户id
* @param int|null $productType 产品类型
* @return array $where 条件
*/
public function switchType($type, ?int $merId = 0, $productType = 0)
{
$stock = 0;
// 获得库存
// if ($merId) $stock = merchantConfig($merId, 'mer_store_stock');
switch ($type) {
case 1:
$where = ['is_show' => 1, 'status' => 1,];
break;
case 2:
$where = ['is_show' => 0, 'status' => 1];
break;
case 3:
$where = ['is_show' => 1, 'stock' => 0, 'status' => 1];
break;
case 4:
$where = ['stock' => $stock ? $stock : 0, 'status' => 1];
break;
case 5:
$where = ['soft' => true];
break;
case 6:
$where = ['status' => 0];
break;
case 7:
$where = ['status' => -1];
break;
case 20:
$where = ['status' => 1];
break;
default:
// $where = ['is_show' => 1, 'status' => 1];
break;
}
if ($productType == 0) {
$where['product_type'] = $productType;
if (!$merId) $where['is_gift_bag'] = 0;
}
if ($productType == 1) {
$where['product_type'] = $productType;
}
if ($productType == 10) {
$where['is_gift_bag'] = 1;
}
if (!$merId) $where['star'] = '';
return $where;
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = SupplyChain::create($data);
// 关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$res->linkMerchant()->save($dataLink); // 插入关联数据
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('editor', get_system_config('other','editor'));
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['id'] = $params['id']; // 当前ID
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
$res = $supplyChain->update($data);
// 获取关联数据一对一---曲线救国
$linkMerchant = $supplyChain['linkMerchant'];
// $linkMerchantArr = $linkMerchant->column('id');
// 先删除关联数据-- 曲线救国
$linkMerchant->delete();
// 关联商户状态
if($data['mer_id_list'])
{
// 再重新将关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$supplyChain->linkMerchant()->save($dataLink);
}
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
View::assign('detail', $supplyChain);
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function delete()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$supplyChain = SupplyChain::with(['linkMerchant'])->find($id);
// 删除关联模型
$res = $supplyChain->together(['linkMerchant'])->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,56 @@
<?php
/**
* @date 2023年03月11日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商品分类列表
*/
namespace app\admin\controller\product;
use app\admin\BaseController;
use app\admin\model\StoreCategory as StoreCategoryModel;
use app\common\controller\FormatList;
use app\common\model\merchant\user\UserMerchant;
class StoreCategory extends BaseController
{
protected $category;
protected $mer_id = 4;
public function __construct(StoreCategoryModel $category)
{
$this->category = $category;
}
protected function getMerId(UserMerchant $user)
{
// $user->isMerUser($uid, $mer_id);
}
/**
* 平台商品分类Tree列表
*
*/
public function getList()
{
$where['mer_id'] = 0;
$where['is_show'] = 0;
$list = $this->category->getList($where);
$list = FormatList::DropDownMenu($list);
return to_assign(0,'', $list);
}
/**
* 商户商品分类Tree列表
*/
public function getStoreCategoryList(){
$data = $this->category->getStoreCategoryList($this->mer_id, 1);
$list = FormatList::FormatCategory($data,'store_category_id', 'pid', 'cate_name','child', 'id', 'title');
return to_assign(0, '', $list);
}
}

View File

@ -0,0 +1,259 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\supplychain;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant; // 商户模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
class Index extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/supplychain.index/index?category_id='.$this->category_id,
'/admin/supplychain.index/add',
'/admin/supplychain.index/edit',
'/admin/supplychain.index/delete',
'/admin/supplychain.merchant/index',
'/admin/supplychain.merchant/bill',
];
}
/**
*
* 供应链团队列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where[]= ['status','=',0];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = SupplyChain::where($where)->count();
$list = SupplyChain::with(['merchant', 'street', 'area'])->order('id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$list = SupplyChain::select();
View::assign('url', $this->url);
View::assign('list', $list);
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
if (request()->isAjax()) {
$params = get_params();
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['shareRate'] = $params['shareRate']; // 分润比例
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据入库
$res = SupplyChain::create($data);
// 关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$res->linkMerchant()->save($dataLink); // 插入关联数据
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('editor', get_system_config('other','editor'));
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 编辑
*
*/
public function edit()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
if (request()->isAjax()) {
$params = get_params();
$data['id'] = $params['id']; // 当前ID
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
$data['name'] = $params['title']; // 团队名称
$data['tel'] = $params['phone']; // 联系电话
$data['shareRate'] = $params['shareRate']; // 分润比例
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
$data['street_id'] = $params['street_id']; // 街道ID
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
$data['lng'] = $street['lng']; // 经度
$data['lat'] = $street['lat']; // 纬度
$area = $street->area; // 区数据
$data['area_id'] = $area['area_id']; // 区县id
$city = $area->city; // 获取市级
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
$data['create_time'] = date('Y-m-d H:i:s');
// 数据更新
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
$res = $supplyChain->update($data);
// 获取关联数据一对一---曲线救国
$linkMerchant = $supplyChain['linkMerchant'];
// $linkMerchantArr = $linkMerchant->column('id');
// 先删除关联数据-- 曲线救国
$linkMerchant->delete();
// 关联商户状态
if($data['mer_id_list'])
{
// 再重新将关联数据入库
foreach ($params['mer_id'] as $v) {
$dataLink = [
'eb_merchant_id' => $v, // 商户ID
'user_id' => $data['user_id'],
'create_time' => $data['create_time'],
];
$supplyChain->linkMerchant()->save($dataLink);
}
}
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
View::assign('detail', $supplyChain);
// 取出正常的商家
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
// 区域模型
$arealist = GeoArea::where('city_code', '510500')->select();
View::assign('arealist', $arealist);
View::assign('merchant', $merchant);
View::assign('url', $this->url);
return view();
}
}
/**
*
* 删除
*
*/
public function delete()
{
$id = get_params("id");
if(!$id) return to_assign(1, '非法操作!');
$supplyChain = SupplyChain::with(['linkMerchant'])->find($id);
// 删除关联模型
$res = $supplyChain->together(['linkMerchant'])->delete();
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}
}

View File

@ -0,0 +1,185 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\controller\supplychain;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
use app\admin\model\Merchant as MerchantModel; // 商户模型
use app\admin\model\StoreOrder as StoreOrderModel; // 商户订单模型
use app\admin\model\GeoCity; // 省市模型
use app\admin\model\GeoArea; // 区域模型
use app\admin\model\GeoStreet; // 街道模型
use app\admin\model\SupplyChain; // 供应链模型
use app\admin\model\SupplyChainLinkMerchant; // 供应链关联商户模型
use app\api\model\Area as AreaModel; // 市场区域模型
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
class Merchant extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/supplychain.index/index?category_id='.$this->category_id,
'/admin/supplychain.index/add',
'/admin/supplychain.index/edit',
'/admin/supplychain.index/delete',
'/admin/supplychain.merchant/index',
'/admin/supplychain.merchant/bill',
];
}
/**
*
* 供应链团队列表
*
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = SupplyChainLinkMerchant::where($where)->count();
$list = SupplyChainLinkMerchant::with(['supplyChain', 'merchant'])->order('id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$total = SupplyChainLinkMerchant::count();
$list = SupplyChainLinkMerchant::with(['merchant', 'supplyChain'])->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return view();
}
}
/**
*
* 交易订单
*
*/
public function bill()
{
if (request()->isAjax()) {
$params= get_params();
$where = [];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['name','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = StoreOrderModel::where($where)->count();
$list = StoreOrderModel::with(['merchant'])->order('order_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}else{
$total = StoreOrderModel::count();
$list = StoreOrderModel::with(['merchant'])->select();
View::assign('url', $this->url);
View::assign('list', $list);
$result = ['total' => $total, 'data' => $list];
return view();
}
}
/**
*
* 新增
*
*/
public function add()
{
return view();
}
/**
*
* 编辑
*
*/
public function edit()
{
return view();
}
/**
*
* 删除
*
*/
public function delete()
{
return view();
}
}

View File

@ -65,6 +65,7 @@ class Auth
*/
protected function checkAuth($controller, $pathInfo, $action, $uid)
{
return true;
//Cache::delete('RulesSrc' . $uid);
if (!Cache::get('RulesSrc' . $uid) || !Cache::get('RulesSrc0')) {
//用户所在权限组及所拥有的权限

View File

@ -0,0 +1,287 @@
<?php
/**
* 时间2023年03月04日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 订单模型
*
*/
namespace app\admin\model;
use think\Model;
use app\admin\model\store\ProductCate;
class EbStoreProduct extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_product';
protected $pk = 'product_id';
protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id';
/**
*
* 关联商户
*
*/
public function merchant()
{
return $this->hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count');
}
public function storeCategory()
{
return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name');
}
public function merCateId()
{
return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id, mer_cate_id');
}
public function brand()
{
return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name');
}
/**
* TODO 商户商品列表
* @Author:Qinii
* @Date: 2020/5/11
* @param int $merId
* @param array $where
* @param int $page
* @param int $limit
* @return array
*/
public function getList(?int $mer_id, array $where, int $page, int $limit)
{
$query = self::search($mer_id, $where)
->with(['merCateId.category', 'storeCategory', 'brand', 'Merchant']);
$count = $query->count();
$data = $query->field($this->filed)->page($page, $limit)
->order('Product.product_id desc')
// ->fetchSql()
->select();
// echo $data;exit('--');
$data->append(['us_status']);
$list = hasMany(
$data,
'mer_labels',
ProductLabel::class,
'product_label_id',
'mer_labels',
['status' => 1],
'product_label_id,product_label_id id,label_name name'
);
return compact('count', 'list');
}
// public function StoreSpu()
// {}
/**
* @Author:Qinii
* @Date: 2020/5/11
* @param int $merId
* @param array $where
* @return mixed
*/
protected function search(?int $merId, array $where)
{
$keyArray = $whereArr = [];
unset($where['type']);
// 以下字段为要搜索的字段
$out = ['soft', 'us_status', 'mer_labels', 'sys_labels', 'order', 'hot_type'];
foreach ($where as $key => $item) {
if ($item !== '' && !in_array($key, $out)) {
$keyArray[] = $key;
$whereArr[$key] = $item;
}
}
// $query = isset($where['soft']) ? model::onlyTrashed()->alias('Product') : model::alias('Product');
$query = self::alias('Product');
if (isset($where['is_trader']) && $where['is_trader'] !== '') {
// hasWhere添加别名不生效 alias 改为Join
// $query->hasWhere('merchant',
// function ($query) use ($where) {
// $query->where('is_trader', $where['is_trader']);
// }
// );
$query->Join('Merchant', 'Merchant.mer_id = Product.mer_id')
->where('Merchant.is_trader', $where['is_trader']);
}
$query->withSearch($keyArray, $whereArr)
->Join('StoreSpu U', 'Product.product_id = U.product_id')
->where('U.product_type', $where['product_type'] ?? 0)
->when(($merId !== null),
function ($query) use ($merId) {
$query->where('Product.mer_id', $merId);
}
)
->when(isset($where['hot_type']) && $where['hot_type'] !== '',
function ($query) use ($where) {
if ($where['hot_type'] == 'new')
$query->where('is_new', 1);
else if ($where['hot_type'] == 'hot')
$query->where('is_hot', 1);
else if ($where['hot_type'] == 'best')
$query->where('is_best', 1);
else if ($where['hot_type'] == 'good')
$query->where('is_benefit', 1);
}
)
->when(isset($where['pid']) && $where['pid'] !== '',
function ($query) use ($where) {
$ids = array_merge(self::findChildrenId((int)$where['pid']), [(int)$where['pid']]);
if (count($ids)) $query->whereIn('cate_id', $ids);
}
)
->when(isset($where['us_status']) && $where['us_status'] !== '', function ($query) use ($where) {
if ($where['us_status'] == 0) {
$query->where('Product.is_show', 0)->where('Product.is_used', 1)->where('Product.status', 1);
}
if ($where['us_status'] == 1) {
$query->where('Product.is_show', 1)->where('Product.is_used', 1)->where('Product.status', 1);
}
if ($where['us_status'] == -1) {
$query->where(function ($query) {
$query->where('Product.is_used', 0)->whereOr('Product.status', '<>', 1);
});
}
})
->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) {
$query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%");
})
->when(isset($where['sys_labels']) && $where['sys_labels'] !== '', function ($query) use ($where) {
$query->whereLike('U.sys_labels', "%,{$where['sys_labels']},%");
})
->when(isset($where['order']), function ($query) use ($where, $merId) {
if (in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales'])) {
if ($where['order'] == 'price_asc') {
$where['order'] = 'price ASC';
} else if ($where['order'] == 'price_desc') {
$where['order'] = 'price DESC';
} else {
$where['order'] = $where['order'] . ' DESC';
}
$query->order($where['order'] . ',rank DESC ,create_time DESC ');
} else if ($where['order'] !== '') {
$query->order('U.' . $where['order'] . ' DESC,U.create_time DESC');
} else {
$query->order('U.create_time DESC');
}
})
->when(isset($where['star']), function ($query) use ($where) {
$query->when($where['star'] !== '', function ($query) use ($where) {
$query->where('U.star', $where['star']);
});
$query->order('U.star DESC,U.rank DESC,Product.create_time DESC');
});
return $query;
}
/**
*
*/
public function findChildrenId($id)
{
return StoreCategory::whereLike('path', '%/' . $id . '/%')->column('store_category_id');
}
protected function hasMany1($collection, $field, $model, $searchKey, $insertKey, $where = [] ,$select = '*')
{
$ids = [];
$link = [];
if (!$collection) return [];
$collection = $collection->toArray();
foreach ($collection as $k => $item) {
if (is_array($item[$field])) {
$link[$k] = array_unique($item[$field]);
$ids = array_merge($item[$field], $ids);
} else {
$link[$k] = array_unique(explode(',', $item[$field]));
}
$ids = array_merge($link[$k], $ids);
if (isset($collection[$k][$insertKey])) unset($collection[$k][$insertKey]);
}
$ids = array_filter(array_unique($ids));
if (!count($ids)) {
return $collection;
}
$many = $model::whereIn($searchKey, array_unique($ids))->where($where)->field($select)->select();
if (!$many) return $collection;
$many = $many->toArray();
foreach ($link as $k => $val) {
foreach ($many as $item) {
if (in_array($item[$searchKey], $val)) {
if (!isset($collection[$k][$insertKey])) $collection[$k][$insertKey] = [];
$collection[$k][$insertKey][] = $item;
}
}
}
return $collection;
}
}
if (!function_exists('hasMany')) {
function hasMany($collection, $field, $model, $searchKey, $insertKey, $where = [] ,$select = '*')
{
$ids = [];
$link = [];
if (!$collection) return [];
$collection = $collection->toArray();
foreach ($collection as $k => $item) {
if (is_array($item[$field])) {
$link[$k] = array_unique($item[$field]);
$ids = array_merge($item[$field], $ids);
} else {
$link[$k] = array_unique(explode(',', $item[$field]));
}
$ids = array_merge($link[$k], $ids);
if (isset($collection[$k][$insertKey])) unset($collection[$k][$insertKey]);
}
$ids = array_filter(array_unique($ids));
if (!count($ids)) {
return $collection;
}
$many = $model::whereIn($searchKey, array_unique($ids))->where($where)->field($select)->select();
if (!$many) return $collection;
$many = $many->toArray();
foreach ($link as $k => $val) {
foreach ($many as $item) {
if (in_array($item[$searchKey], $val)) {
if (!isset($collection[$k][$insertKey])) $collection[$k][$insertKey] = [];
$collection[$k][$insertKey][] = $item;
}
}
}
return $collection;
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 地区 区域模型
*
*/
namespace app\admin\model;
use think\Model;
class GeoArea extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_geo_area';
/**
* 关联市
*/
public function city()
{
return $this->hasOne(GeoArea::class, 'area_code', 'area_code');
}
}

View File

@ -0,0 +1,19 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 地区 省市模型
*
*/
namespace app\admin\model;
use think\Model;
class GeoCity extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_geo_city';
}

View File

@ -0,0 +1,27 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 地区 街道模型
*
*/
namespace app\admin\model;
use think\Model;
class GeoStreet extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_geo_street';
/**
* 关联区
*
*/
public function area()
{
return $this->hasOne(GeoArea::class, 'area_code', 'area_code');
}
}

View File

@ -0,0 +1,23 @@
<?php
/**
* 时间2023年03月06日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 地区 商品保障服务模型
*
*/
namespace app\admin\model;
use think\Model;
class Guarantee extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_guarantee';
protected $pk = 'guarantee_id';
}

View File

@ -0,0 +1,52 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商户模型
*
*/
namespace app\admin\model;
use think\Model;
class Merchant extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_merchant';
protected $pk = 'mer_id';
/**
* 所属供应链
* 远程一对一
*
*/
public function supplyChain()
{
return $this->hasOneThrough(SupplyChainLinkMerchant::class, SupplyChain::class);
}
/**
*
* 关联商户类型
*
*/
public function merchantType()
{
return $this->hasOne(MerchantType::class, 'mer_type_id', 'type_id');
}
/**
*
* 关联商户类别
*
*/
public function category()
{
return $this->hasOne(MerchantCategory::class, 'merchant_category_id', 'category_id');
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* 时间2023年03月04日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商户分类模型
*
*/
namespace app\admin\model;
use think\Model;
class MerchantCategory extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_merchant_category';
protected $pk = 'merchant_category_id';
}

View File

@ -0,0 +1,22 @@
<?php
/**
* 时间2023年03月04日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商户类型模型
*
*/
namespace app\admin\model;
use think\Model;
class MerchantType extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_merchant_type';
protected $pk = 'mer_type_id';
}

View File

@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\store\product;
use app\common\model\BaseModel;
class ProductLabel extends BaseModel
{
/**
* TODO
* @return string
* @author Qinii
* @day 8/17/21
*/
public static function tablePk(): string
{
return 'product_label_id';
}
/**
* TODO
* @return string
* @author Qinii
* @day 8/17/21
*/
public static function tableName(): string
{
return 'store_product_label';
}
public function searchMerIdAttr($query, $value)
{
$query->where('mer_id', $value);
}
public function searchStatusAttr($query, $value)
{
$query->where('status', $value);
}
public function searchNameAttr($query, $value)
{
$query->whereLike('name', "%{$value}%");
}
public function searchIsDelAttr($query, $value)
{
$query->where('is_del', $value);
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* 时间2023年03月06日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商品品牌列表模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreBrand extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_brand';
protected $pk = 'brand_id';
/**
* 关联品牌分类
*/
public function storeBrandCategory()
{
return $this->hasOne(StoreBrandCategory::class, 'store_brand_category_id', 'brand_category_id');
}
}

View File

@ -0,0 +1,33 @@
<?php
/**
* 时间2023年03月06日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商品品牌分类模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreBrandCategory extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_brand_category';
protected $pk = 'store_brand_category_id';
/**
* 关联品牌分类
*/
public function storeBrandCategory()
{
return $this->hasOne(StoreBrandCategory::class, 'store_brand_category_id', 'brand_category_id');
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 购物车模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreCart extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_cart';
protected $pk = 'cart_id';
/**
* 所属商品
*
*/
public function product()
{
return $this->hasOne(EbStoreProduct::class, 'product_id', 'product_id');
}
/**
*
* 所属用户
*
*/
public function user()
{
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
}
}

View File

@ -0,0 +1,107 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商品分类模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreCategory extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_category';
protected $pk = 'store_category_id';
/**
* 关联商品分类
*/
public function storeCategory()
{
return $this->hasOne(StoreCategory::class, 'store_category_id', 'pid');
}
/**
* 获取商品分类表数据
*@author Liuxiaoquan
*
*@param array $where 查询条件
*@return object|array $list 查询商品分类结果集
*/
public function getList($where)
{
$where['is_show'] = empty($where['is_show'])? 1 : $where['is_show'];
$list = self::search($where)
->field('store_category_id as id,pid,cate_name,path,sort,pic,level,is_hot')
->order('sort DESC')->select();
return $list;
}
public function getStoreCategoryList(int $merId = 0,$status = 0)
{
$data = self::getAllOptions($merId,$status);
return $data;
}
/**
* 获取列表 -- 筛选用
* @Date: 2020/5/16
* @param int|null $mer_id
* @return mixed
*/
protected function getAllOptions($mer_id = null,$status = null,$level = null)
{
$field = 'pid,cate_name';
$query = StoreCategory::when(($mer_id !== null),
function($query)use($mer_id){
$query->where('mer_id', $mer_id);
})
->when($status,function($query)use($status){
$query->where('is_show',$status);
})
->when(($level != '' && $level != null),function($query)use($level){
$query->where('level','<',$level);
}
);
return $query->order('sort DESC,'.$this->getPk().' DESC')->column($field, $this->getPk());
}
/**
* 查询语句构建
*@author Liuxiaoquan
*
*@param array $where 查询条件
*@return Query
*/
protected function search($where)
{
$query = self::when(isset($where['mer_id'])&&$where['mer_id']!=='',
function ($query)use($where) {
$query->where('mer_id', $where['mer_id']);
}
)
->when(isset($where['level'])&&$where['level']!=='',
function($query)use($where){
$query->where('level', $where['level']);
}
)
->when(isset($where['is_show'])&&$where['is_show']!=='',
function($query)use($where){
$query->where('is_show', $where['is_show']);
}
);
return $query;
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 订单模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreOrder extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_order';
protected $pk = 'order_id';
/**
* 所属商户
* 一对一
*
*/
public function merchant()
{
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
}
/**
* 所属商品
*
*/
public function cart()
{
return $this->hasOne(StoreCart::class, 'cart_id', 'cart_id');
}
/**
* 获取购物车商品
*
*/
public function getCartIdAttr($value)
{
// 分割为数组
$cartId = explode(',', $value);
// 购物车ID
$scartList = StoreCart::whereIn('cart_id', $cartId)->with(['product'])->select();
return $scartList;
}
/**
*
* 所属用户
*
*/
public function user()
{
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商品标签模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreProductLabel extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_product_label';
protected $pk = 'product_label_id';
/**
*
* 关联商户
*
*/
public function merchant()
{
}
/**
*
* 关联用户
*
*/
public function user()
{
}
/**
*
* 关联商品
*
*/
public function product()
{
return $this->hasOne(EbStoreProduct::class, 'product_id', 'product_id');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 商品评论模型
*
*/
namespace app\admin\model;
use think\Model;
class StoreProductReply extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'shop';
// 设置当前模型对应的完整数据表名称
protected $table = 'eb_store_product_reply';
protected $pk = 'reply_id';
/**
*
* 关联商户
*
*/
public function merchant()
{
}
/**
*
* 关联用户
*
*/
public function user()
{
}
/**
*
* 关联商品
*
*/
public function product()
{
return $this->hasOne(EbStoreProduct::class, 'product_id', 'product_id');
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 供应链团队模型
*
*/
namespace app\admin\model;
use think\Model;
class SupplyChain extends Model
{
// 设置当前模型的数据库连接
protected $connection = 'mysql';
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_supply_chain';
/**
* 关联拥有多个商户
* 远程一对多
* 关联模型、中间模型
*/
public function merchant()
{
return $this->hasManyThrough(Merchant::class, SupplyChainLinkMerchant::class, 'fa_supply_chain_id', 'mer_id', 'id', 'eb_merchant_id');
}
/**
*
* 关联中间表
*
*/
public function linkMerchant()
{
return $this->hasMany(SupplyChainLinkMerchant::class, 'fa_supply_chain_id');
}
/**
* 关联街道
*
*
*/
public function street()
{
return $this->hasOne(GeoStreet::class, 'street_id', 'street_id');
}
/**
* 关联区县
*
*
*/
public function area()
{
return $this->hasOne(GeoArea::class, 'area_id', 'area_id');
}
}

View File

@ -0,0 +1,44 @@
<?php
/**
* 时间2023年03月02日
* 作者:墨楠小
* 邮箱monanxiao@qq.com
* 供应链团队和商户中间件模型
*
*/
namespace app\admin\model;
use think\Model;
use think\model\Pivot;
class SupplyChainLinkMerchant extends Pivot
{
protected $autoWriteTimestamp = true;
// 设置当前模型的数据库连接
protected $connection = 'mysql';
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_supply_chain_link_merchant';
/**
* 所属供应链
* 一对一
*
*/
public function supplyChain()
{
return $this->hasOne(SupplyChain::class, 'id', 'fa_supply_chain_id');
}
/**
*
* 所属商户
* 一对一
*
*/
public function merchant()
{
return $this->hasOne(Merchant::class, 'mer_id', 'eb_merchant_id');
}
}

View File

@ -0,0 +1,542 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\store\product;
use app\common\dao\store\StoreSeckillActiveDao;
use app\common\model\BaseModel;
use app\common\model\store\coupon\StoreCouponProduct;
use app\common\model\store\Guarantee;
use app\common\model\store\GuaranteeTemplate;
use app\common\model\store\GuaranteeValue;
use app\common\model\store\parameter\ParameterValue;
use app\common\model\store\shipping\ShippingTemplate;
use app\common\model\store\StoreBrand;
use app\common\model\store\StoreCategory;
use app\common\model\store\StoreSeckillActive;
use app\common\model\system\merchant\Merchant;
use app\common\repositories\store\StoreCategoryRepository;
use crmeb\services\VicWordService;
use Darabonba\GatewaySpi\Models\InterceptorContext\request;
use think\db\BaseQuery;
use think\facade\Db;
use think\model\concern\SoftDelete;
/**
* TODO:
*/
class Product extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'is_del';
protected $defaultSoftDelete = 0;
/**
* @Author:Qinii
* @Date: 2020/5/8
* @return string
*/
public static function tablePk(): string
{
return 'product_id';
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @return string
*/
public static function tableName(): string
{
return 'store_product';
}
/*
* -----------------------------------------------------------------------------------------------------------------
* 属性
* -----------------------------------------------------------------------------------------------------------------
*/
public function getSliderImageAttr($value)
{
return $value ? explode(',',$value) : [];
}
public function getGiveCouponIdsAttr($value)
{
return $value ? explode(',',$value) : [];
}
public function getMaxExtensionAttr($value)
{
if($this->extension_type){
$org_extension = ($this->attrValue()->order('extension_two DESC')->value('extension_one'));
} else {
$org_extension = bcmul(($this->attrValue()->order('price DESC')->value('price')) , systemConfig('extension_one_rate'),2);
}
$spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
}
return $org_extension;
}
public function getMinExtensionAttr($value)
{
if($this->extension_type){
$org_extension = ($this->attrValue()->order('extension_two ASC')->value('extension_two'));
} else {
$org_extension = bcmul(($this->attrValue()->order('price ASC')->value('price')) , systemConfig('extension_one_rate'),2);
}
$spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null;
if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
}
return $org_extension;
}
public function check()
{
if(!$this || !$this->is_show || !$this->is_used || !$this->status || $this->is_del || !$this->mer_status) return false;
return true;
}
/**
* TODO 秒杀商品结束时间
* @return false|int
* @author Qinii
* @day 2020-08-15
*/
public function getEndTimeAttr()
{
if($this->product_type !== 1) return true;
$day = date('Y-m-d',time());
$_day = strtotime($day);
$end_day = strtotime($this->seckillActive['end_day']);
if($end_day >= $_day)
return strtotime($day.$this->seckillActive['end_time'].':00:00');
if($end_day < strtotime($day))
return strtotime(date('Y-m-d',$end_day).$this->seckillActive['end_time'].':00:00');
}
/**
* TODO 秒杀商品状态
* @return array|int
* @author Qinii
* @day 2020-08-19
*/
public function getSeckillStatusAttr()
{
if($this->product_type !== 1) return true;
$day = strtotime(date('Y-m-d',time()));
$_h = date('H',time());
$start_day = strtotime($this->seckillActive['start_day']);
$end_day = strtotime($this->seckillActive['end_day']);
if(!$this->seckillActive) return '';
if($this->seckillActive['status'] !== -1){
//还未开始
if($start_day > time() || $this->is_show !== 1)return 0;
//已结束
if($end_day < $day) return -1;
//开始 - 结束
if($start_day <= $day && $day <= $end_day){
//未开始
if($this->seckillActive['start_time'] > $_h) return 0;
//已结束
if($this->seckillActive['end_time'] <= $_h) return -1;
//进行中
if($this->seckillActive['start_time'] <= $_h && $this->seckillActive['end_time'] > $_h) return 1;
}
}
//已结束
return -1;
}
public function getImageAttr($value)
{
if (is_int(strpos($value, 'http'))){
return $value;
}else{
return rtrim(systemConfig('site_url'),'/') .$value;
}
}
public function getTopReplyAttr()
{
$res = ProductReply::where('product_id',$this->product_id)->where('is_del',0)->with(['orderProduct'])->field('reply_id,uid,nickname,merchant_reply_content,avatar,order_product_id,product_id,product_score,service_score,postage_score,comment,pics,rate,create_time')
->order('sort DESC,create_time DESC')->limit(1)->find();
if(!$res) return null;
if ($res['orderProduct'])
$res['sku'] = $res['orderProduct']['cart_info']['productAttr']['sku'];
unset($res['orderProduct']);
if (strlen($res['nickname']) > 1) {
$str = mb_substr($res['nickname'],0,1) . '*';
if (strlen($res['nickname']) > 2) {
$str .= mb_substr($res['nickname'], -1,1);
}
$res['nickname'] = $str;
}
return $res;
}
public function getUsStatusAttr()
{
return ($this->status == 1) ? ($this->is_used == 1 ? ( $this->is_show ? 1 : 0 ) : -1) : -1;
}
public function getGuaranteeTemplateAttr()
{
$gua = GuaranteeTemplate::where('guarantee_template_id',$this->guarantee_template_id)->where('status',1)->where('is_del',0)->find();
if(!$gua) return [];
$guarantee_id = GuaranteeValue::where('guarantee_template_id',$this->guarantee_template_id)->column('guarantee_id');
return Guarantee::where('guarantee_id','in',$guarantee_id)->where('status',1)->where('is_del',0)->select();
}
public function getMaxIntegralAttr()
{
if(systemConfig('integral_status') && merchantConfig($this->mer_id,'mer_integral_status')){
$price = ($this->attrValue()->order('price DESC')->value('price'));
$rate = ($this->integral_rate < 0) ? merchantConfig($this->mer_id,'mer_integral_rate') : $this->integral_rate;
$rate = $rate < 0 ? $rate / 100 : 0;
return bcmul($price ,$rate,2);
}
return '0';
}
public function getHotRankingAttr()
{
if ($this->product_type == 0) {
$where = [
'is_show' => 1,
'status' => 1,
'is_used' => 1,
'product_type' => 0,
'mer_status' => 1,
'is_gift_bag' => 0,
'cate_id' => $this->cate_id
];
self::where($where)->order('sales DESC');
}
}
/**
* TODO 商品参数
* @author Qinii
* @day 2022/11/24
*/
public function getParamsAttr()
{
if(in_array($this->product_type,[0,2])) {
$product_id = $this->product_id;
} else {
$product_id = $this->old_product_id;
}
return ParameterValue::where('product_id',$product_id)->order('parameter_value_id ASC')->select();
}
public function getParamTempIdAttr($value)
{
return $value ? explode(',',$value) : $value;
}
/*
* -----------------------------------------------------------------------------------------------------------------
* 关联模型
* -----------------------------------------------------------------------------------------------------------------
*/
public function merCateId()
{
return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id,mer_cate_id');
}
public function attr()
{
return $this->hasMany(ProductAttr::class,'product_id','product_id');
}
public function attrValue()
{
return $this->hasMany(ProductAttrValue::class,'product_id','product_id');
}
public function oldAttrValue()
{
return $this->hasMany(ProductAttrValue::class,'product_id','old_product_id');
}
public function content()
{
return $this->hasOne(ProductContent::class,'product_id','product_id');
}
protected function temp()
{
return $this->hasOne(ShippingTemplate::class,'shipping_template_id','temp_id');
}
public function storeCategory()
{
return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name');
}
public function merchant()
{
return $this->hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count');
}
public function reply()
{
return $this->hasMany(ProductReply::class,'product_id','product_id')->order('create_time DESC');
}
public function brand()
{
return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name');
}
public function seckillActive()
{
return $this->hasOne(StoreSeckillActive::class,'product_id','product_id');
}
public function issetCoupon()
{
return $this->hasOne(StoreCouponProduct::class, 'product_id', 'product_id')->alias('A')
->rightJoin('StoreCoupon B', 'A.coupon_id = B.coupon_id')->where(function (BaseQuery $query) {
$query->where('B.is_limited', 0)->whereOr(function (BaseQuery $query) {
$query->where('B.is_limited', 1)->where('B.remain_count', '>', 0);
});
})->where(function (BaseQuery $query) {
$query->where('B.is_timeout', 0)->whereOr(function (BaseQuery $query) {
$time = date('Y-m-d H:i:s');
$query->where('B.is_timeout', 1)->where('B.start_time', '<', $time)->where('B.end_time', '>', $time);
});
})->field('A.product_id,B.*')->where('status', 1)->where('type', 1)->where('send_type', 0)->where('is_del', 0)
->order('sort DESC,coupon_id DESC')->hidden(['is_del', 'status']);
}
public function assist()
{
return $this->hasOne(ProductAssist::class,'product_id','product_id');
}
public function productGroup()
{
return $this->hasOne(ProductGroup::class,'product_id','product_id');
}
public function guarantee()
{
return $this->hasOne(GuaranteeTemplate::class,'guarantee_template_id','guarantee_template_id')->where('status',1)->where('is_del',0);
}
/**
* TODO 是否是会员
* @return bool
* @author Qinii
* @day 2023/1/4
*/
public function getIsVipAttr()
{
if (request()->isLogin()) {
if (request()->userType() == 1) {
$userInfo = request()->userInfo();
return $userInfo->is_svip ? true : false;
} else {
return true;
}
}
return false;
}
/**
* TODO 是否展示会员价
* @return bool
* @author Qinii
* @day 2023/1/4
*/
public function getShowSvipPriceAttr()
{
if ($this->mer_svip_status != 0 && (systemConfig('svip_show_price') != 1 || $this->is_vip) && $this->svip_price_type > 0 ) {
return true;
}
return false;
}
/**
* TODO 是否显示会员价等信息
* @return array
* @author Qinii
* @day 2022/11/24
*/
public function getShowSvipInfoAttr()
{
$res = [
'show_svip' => true, //是否展示会员入口
'is_svip' => false, //当前用户是否是会员
'show_svip_price' => false, //是否展示会员价
'save_money' => 0, //当前商品会员优化多少钱
];
if ($this->product_type == 0) {
if (!systemConfig('svip_switch_status')) {
$res['show_svip'] = false;
} else {
$res['is_svip'] = $this->is_vip;
if ($this->show_svip_price) {
$res['show_svip_price'] = true;
$res['save_money'] = bcsub($this->price, $this->svip_price, 2);
}
}
}
return $res;
}
/**
* TODO 获取会员价
* @return int|string
* @author Qinii
* @day 2023/1/4
*/
public function getSvipPriceAttr()
{
if ($this->product_type == 0 && $this->mer_svip_status != 0 && $this->show_svip_price) {
//默认比例
if ($this->svip_price_type == 1) {
$rate = merchantConfig($this->mer_id,'svip_store_rate');
$svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0;
$price = $this->attrValue()->order('price ASC')->value('price');
return bcmul($price,$svip_store_rate,2);
}
//自定义
if ($this->svip_price_type == 2) {
return $this->getData('svip_price');
}
}
return 0;
}
/*
* -----------------------------------------------------------------------------------------------------------------
* 搜索器
* -----------------------------------------------------------------------------------------------------------------
*/
public function searchMerCateIdAttr($query, $value)
{
$cate_ids = (StoreCategory::where('path','like','%/'.$value.'/%'))->column('store_category_id');
$cate_ids[] = intval($value);
$product_id = ProductCate::whereIn('mer_cate_id',$cate_ids)->column('product_id');
$query->whereIn('Product.product_id',$product_id);
}
public function searchKeywordAttr($query, $value)
{
if (!$value) return;
if (is_numeric($value)) {
$query->whereLike("Product.store_name|Product.keyword|bar_code|Product.product_id", "%{$value}%");
} else {
$word = app()->make(VicWordService::class)->getWord($value);
$query->where(function ($query) use ($word, $value) {
foreach ($word as $item) {
$query->whereOr('Product.store_name|Product.keyword', 'LIKE', "%$item%");
}
$query->order(Db::raw('REPLACE(Product.store_name,\'' . $value . '\',\'\')'));
});
}
}
public function searchStatusAttr($query, $value)
{
if($value === -1){
$query->where('Product.status', 'in',[-1,-2]);
}else {
$query->where('Product.status',$value);
}
}
public function searchCateIdAttr($query, $value)
{
$query->where('cate_id',$value);
}
public function searchCateIdsAttr($query, $value)
{
$query->whereIn('cate_id',$value);
}
public function searchIsShowAttr($query, $value)
{
$query->where('is_show',$value);
}
public function searchPidAttr($query, $value)
{
$cateId = app()->make(StoreCategoryRepository::class)->allChildren(intval($value));
$query->whereIn('cate_id', $cateId);
}
public function searchStockAttr($query, $value)
{
$value ? $query->where('stock','<=', $value) : $query->where('stock', $value);
}
public function searchIsNewAttr($query, $value)
{
$query->where('is_new',$value);
}
public function searchPriceAttr($query, $value)
{
if(empty($value[0]) && !empty($value[1]))
$query->where('price','<',$value[1]);
if(!empty($value[0]) && empty($value[1]))
$query->where('price','>',$value[0]);
if(!empty($value[0]) && !empty($value[1]))
$query->whereBetween('price',[$value[0],$value[1]]);
}
public function searchBrandIdAttr($query, $value)
{
$query->whereIn('brand_id',$value);
}
public function searchIsGiftBagAttr($query, $value)
{
$query->where('is_gift_bag',$value);
}
public function searchIsGoodAttr($query, $value)
{
$query->where('is_good',$value);
}
public function searchIsUsedAttr($query, $value)
{
$query->where('is_used',$value);
}
public function searchProductTypeAttr($query, $value)
{
$query->where('Product.product_type',$value);
}
public function searchSeckillStatusAttr($query, $value)
{
$product_id = (new StoreSeckillActiveDao())->getStatus($value)->column('product_id');
$query->whereIn('Product.product_id',$product_id);
}
public function searchStoreNameAttr($query, $value)
{
$query->where('Product.store_name','like','%'.$value.'%');
}
public function searchMerStatusAttr($query, $value)
{
$query->where('mer_status',$value);
}
public function searchProductIdAttr($query, $value)
{
$query->where('Product.product_id',$value);
}
public function searchPriceOnAttr($query, $value)
{
$query->where('price','>=',$value);
}
public function searchPriceOffAttr($query, $value)
{
$query->where('price','<=',$value);
}
public function searchisFictiAttr($query, $value)
{
$query->where('type',$value);
}
public function searchGuaranteeTemplateIdAttr($query, $value)
{
$query->whereIn('guarantee_template_id',$value);
}
public function searchTempIdAttr($query, $value)
{
$query->whereIn('Product.temp_id',$value);
}
}

View File

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\admin\model\store;
use think\Model;
use app\admin\model\StoreCategory;
class ProductCate extends Model
{
protected $connection = 'shop';
protected $table = 'eb_store_product_cate';
public function category()
{
return $this->hasOne(StoreCategory::class,'store_category_id','mer_cate_id')->field('store_category_id, cate_name');
}
public function searchProductIdAttr($query, $value)
{
$query->where('product_id',$value);
}
}

View File

@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\admin\model\store\paramter;
use think\Model;
class Parameter extends Model
{
protected $connection = 'shop';
protected $pk = 'parameter_id';
// public static function tablePk(): string
// {
// return 'parameter_id';
// }
// public static function tableName(): string
// {
// return 'parameter';
// }
public function searchTemplateIdAttr($query, $value)
{
$query->where('template_id',$value);
}
/**
* TODO 搜索
* @param $where
*/
public function getSearch(array $where)
{
foreach ($where as $key => $item) {
if ($item !== '') {
$keyArray[] = $key;
$whereArr[$key] = $item;
}
}
// var_dump($where);
$class = get_called_class();
if(empty($keyArray)){
return $class::self();
}else{
return $class::withSearch($keyArray, $whereArr);
}
}
}

View File

@ -0,0 +1,129 @@
<?php
/**
* @date 2023年03月9日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商品参数列表与模板添加
*/
namespace app\admin\model\store\paramter;
use think\Model;
use app\common\model\merchant\system\merchant\Merchant;
use app\common\model\merchant\system\Relevance;
// use app\admin\model\store\paramter\Parameter as ParameterModel;
class ParameterTemplate extends Model
{
protected $connection = 'shop';
public static function tablePk(): string
{
return 'template_id';
}
public static function tableName(): string
{
return 'eb_parameter_template';
}
public function merchant()
{
return $this->hasOne(Merchant::class,'mer_id','mer_id');
}
public function parameter()
{
return $this->hasMany(Parameter::class,'template_id','template_id');
}
public function cateId()
{
return $this->hasMany(Relevance::class,'left_id','template_id')->where('type', 'product_params_cate');
}
public function searchCateIdAttr($query, $value)
{
$id = Relevance::where('right_id',$value)->where('type', 'product_params_cate')->column('left_id');
$query->where('template_id','in',$id);
}
public function searchTemplateNameAttr($query, $value)
{
$query->whereLike('template_name',"%{$value}%");
}
public function searchTemplateIdsAttr($query, $value)
{
$query->whereIn('template_id',$value);
}
public function searchMerIdAttr($query, $value)
{
$query->where('mer_id',$value);
}
public function searchMerNameAttr($query, $value)
{
$value = Merchant::whereLike('mer_name',"%{$value}%")->coupon('mer_id');
$query->whereIn('mer_id',$value);
}
public function searchIsMerAttr($query, $value)
{
if ($value == 1) {
$query->where('mer_id','>',0);
} else {
$query->where('mer_id',0);
}
}
public function getList($where, $page, $limit)
{
$paramterModel = new Parameter();
$query = self::getSearch($where)->field('template_id,mer_id,template_name,sort,create_time')
->with([
'cateId' => function($query){
$query->with(['category' =>function($query) {
$query->field('store_category_id,cate_name');
}]);
},
'merchant' => function($query) {
$query->field('mer_id,mer_name');
}
// 'parameter' =>function($query){
// $query->field('parameter_id,template_id,name,value,sort')->order('sort DESC');
// }
])
->order('sort DESC,create_time DESC');
$count = $query->count();
$list = $query->page($page, $limit)->select();
return compact('count', 'list');
}
/**
* TODO 搜索
* @param $where
*/
public static function getSearch(array $where)
{
foreach ($where as $key => $item) {
if ($item !== '') {
$keyArray[] = $key;
$whereArr[$key] = $item;
}
}
if(empty($keyArray)){
return new self;
}else{
return self::withSearch($keyArray, $whereArr);
}
}
}

View File

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\store\parameter;
use app\common\model\BaseModel;
class ParameterValue extends BaseModel
{
public static function tablePk(): string
{
return 'parameter_attr_id';
}
public static function tableName(): string
{
return 'parameter_value';
}
public function parameter()
{
return $this->hasOne(Parameter::class,'parameter_id','parameter_id');
}
}

View File

@ -0,0 +1,157 @@
<?php
namespace app\common\dao\user;
// use app\common\model\user\UserLabel;
use think\db\BaseQuery;
use think\Model;
/**
* Class UserMerchant
*/
class UserMerchant extends Model
{
/**
* @return string|null
* @author xaboy
*/
public static function tablePk(): ?string
{
return 'user_merchant_id';
}
/**
* @return string
* @author xaboy
* @day 2020/10/20
*/
public static function tableName(): string
{
return 'user_merchant';
}
public function user()
{
return $this->hasOne(User::class, 'uid', 'uid');
}
/**
* @param $value
* @return array
* @author xaboy
* @day 2020-05-09
*/
public function getLabelIdAttr($value)
{
return $value ? explode(',', $value) : [];
}
/**
* @param $value
* @return string
* @author xaboy
* @day 2020-05-09
*/
public function setLabelIdAttr($value)
{
return implode(',', $value);
}
public function getAuthLabelAttr()
{
return app()->make(UserLabel::class)->whereIn('label_id', $this->label_id)->where('mer_id', $this->mer_id)->where('type', 1)->column('label_id');
}
/**
* @return string
* @author xaboy
* @day 2020/10/20
*/
protected function getModel(): string
{
return UserMerchant::class;
}
/**
* @param $uid
* @param $mer_id
* @return bool
* @author xaboy
* @day 2020/10/20
*/
public function isMerUser($uid, $mer_id)
{
return $this->existsWhere(compact('uid', 'mer_id'));
}
/**
* @param $uid
* @param $mer_id
* @return int
* @throws \think\db\exception\DbException
* @author xaboy
* @day 2020/10/20
*/
public function updateLastTime($uid, $mer_id)
{
return UserMerchant::getDB()->where(compact('uid', 'mer_id'))->update([
'last_time' => date('Y-m-d H:i:s')
]);
}
/**
* @param array $where
* @return mixed
* @author xaboy
* @day 2020/10/20
*/
public function search(array $where)
{
return UserMerchant::getDB()->alias('A')->leftJoin('User B', 'A.uid = B.uid')
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
$query->where('A.mer_id', $where['mer_id']);
})->when(isset($where['nickname']) && $where['nickname'], function (BaseQuery $query) use ($where) {
return $query->where('B.nickname', 'like', '%' . $where['nickname'] . '%');
})->when(isset($where['sex']) && $where['sex'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.sex', intval($where['sex']));
})->when(isset($where['is_promoter']) && $where['is_promoter'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.is_promoter', $where['is_promoter']);
})->when(isset($where['uids']), function (BaseQuery $query) use ($where) {
return $query->whereIn('A.uid', $where['uids']);
})->when(isset($where['user_time_type']) && $where['user_time_type'] !== '' && $where['user_time'] != '', function ($query) use ($where) {
if ($where['user_time_type'] == 'visit') {
getModelTime($query, $where['user_time'], 'A.last_time');
}
if ($where['user_time_type'] == 'add_time') {
getModelTime($query, $where['user_time'], 'A.create_time');
}
})->when(isset($where['pay_count']) && $where['pay_count'] !== '', function ($query) use ($where) {
if ($where['pay_count'] == -1) {
$query->where('A.pay_num', 0);
} else {
$query->where('A.pay_num', '>', $where['pay_count']);
}
})->when(isset($where['label_id']) && $where['label_id'] !== '', function (BaseQuery $query) use ($where) {
return $query->whereRaw('CONCAT(\',\',A.label_id,\',\') LIKE \'%,' . $where['label_id'] . ',%\'');
})->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.user_type', $where['user_type']);
})->where('A.status', 1);
}
public function numUserIds($mer_id, $min, $max = null)
{
return UserMerchant::getDB()->where('mer_id', $mer_id)->where('pay_num', '>=', $min)->when(!is_null($max), function ($query) use ($max) {
$query->where('pay_num', '<=', $max);
})->group('uid')->column('uid');
}
public function priceUserIds($mer_id, $min, $max = null)
{
return UserMerchant::getDB()->where('mer_id', $mer_id)->where('pay_price', '>=', $min)->when(!is_null($max), function ($query) use ($max, $min) {
$query->where('pay_price', $min == $max ? '<=' : '<', $max);
})->group('uid')->column('uid');
}
}

16
app/admin/route/app.php Normal file
View File

@ -0,0 +1,16 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
Route::get('home', function () {
return 'hello,ThinkPHP6!';
});

56
app/admin/route/menu.php Normal file
View File

@ -0,0 +1,56 @@
<?php
/**
* @date 2023年03月2日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户菜单路由
*/
use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
Route::group(function () {
//商户权限管理
Route::group('merchant/menu', function () {
Route::get('index', '/index')->name('systemMerchantMenuIndex')->option([
'_alias' => '商户菜单/权限表单',
'_auth' => false,
'_form' => 'systemMerchantMenuIndex',
]);
Route::get('lst', '/lst')->name('systemMerchantMenuGetLst')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限列表',
]);
Route::post('add', '/add')->name('systemMerchantMenuCreate')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限添加',
]);
Route::post('edit/:id', '/edit')->name('systemMerchantMenuUpdate')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限编辑',
]);
Route::get('addform', '/AddForm')->name('systemMerchantMenuCreateForm')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限添加表单',
'_auth' => false,
'_form' => 'systemMerchantMenuCreate',
]);
Route::get('editform', '/editform')->name('systemMerchantMenuUpdateForm')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限编辑表单',
'_auth' => false,
'_form' => 'systemMerchantMenuUpdate',
]);
Route::delete('del/:id', '/del')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限删除',
]);
})->prefix('merchant.system.auth.Menu')->option([
'_path' => '/merchant/menu',
'_auth' => true,
]);
});
// ->middleware(AllowOriginMiddleware::class)
// ->middleware(AdminTokenMiddleware::class, true)
// ->middleware(AdminAuthMiddleware::class)
// ->middleware(LogMiddleware::class);

View File

@ -0,0 +1,194 @@
<?php
use think\facade\Route;
/**
* 路由访问示例: http://nk1.lihaink.cn/admin/merchant/type/lst
* 物理地址: http://nk1.lihaink.cn/admin/merchant.system.merchant.MerchantType/index
*/
Route::group(function(){
// 商户分类
Route::group('/merchant/classify', function(){
Route::get('lst', '/lst')->name('systemMerchantCategoryLst')->option([
'_alias' => '商户分类列表',
]);
// Route::get('category_lst', '/lst')->option([
// '_alias' => '商户分类列表',
// '_auth' => false,
// ]);
Route::post('add', '/create')->name('systemMerchantCategoryCreate')->option([
'_alias' => '商户分类添加',
]);
Route::get('form', '/createForm')->name('systemMerchantCategoryCreateForm')->option([
'_alias' => '商户分类添加表单',
'_auth' => false,
'_form' => 'systemMerchantCategoryCreate',
]);
Route::delete('del/:id', '/delete')->name('systemMerchantCategoryDelete')->option([
'_alias' => '商户分类删除',
]);
Route::post('edit/:id', '/update')->name('systemMerchantCategoryUpdate')->option([
'_alias' => '商户分类编辑',
]);
Route::get('edit/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm')->option([
'_alias' => '商户分类编辑表单',
'_auth' => false,
'_form' => 'systemMerchantCategoryUpdate',
]);
Route::get('options', '/getOptions')->option([
'_alias' => '商户分类筛选',
'_auth' => false,
]);
})->prefix('merchant.system.merchant.MerchantCategory')->option([
'_path' => '/merchant/classify',
'_auth' => true,
]);
//入驻申请列表
Route::group('merchant/intention', function () {
Route::get('index', '/index')->name('systemMerchantIntentionLst')->option([
'_alias' => '列表',
]);
Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([
'_alias' => '列表',
]);
Route::post('status', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
'_alias' => '审核',
]);
Route::delete('delete', '/delete')->name('systemMerchantIntentionDelete')->option([
'_alias' => '删除',
]);
Route::get('markform', '/markform')->name('systemMerchantIntentionMarkForm')->option([
'_alias' => '备注',
'_auth' => false,
'_form' => 'systemMerchantIntentionMark',
]);
Route::get('statusform', '/statusForm')->name('systemMerchantIntentionStatusForm')->option([
'_alias' => '申请商户',
'_auth' => false,
'_form' => 'systemMerchantIntentionStatus',
]);
Route::post('mark', '/setmark')->name('systemMerchantIntentionMark')->option([
'_alias' => '备注',
]);
Route::get('excel', '/excel');
})->prefix('merchant.system.merchant.MerchantIntention')->option([
'_path' => '/merchant/application',
'_auth' => true,
]);
// 店铺类型
Route::group('/merchant/type',function(){
Route::get('index', '/index')->name('systemMerchantTypeLst')->option([
'_alias' => '列表',
]);
Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([
'_alias' => '列表',
]);
Route::get('read', '/read')->name('systemMerchantTypeDetail')->option([
'_alias' => '详情',
]);
Route::get('form', '/form')->name('systemMerchantTypeAdd')->option([
'_alias' => '添加/编辑页',
]);
Route::post('add', '/add')->name('systemMerchantTypeAdd')->option([
'_alias' => '添加',
]);
Route::put('edit', '/edit')->name('systemMerchantTypeUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('del', '/del')->name('systemMerchantTypeDelete')->option([
'_alias' => '删除',
]);
Route::get('mark/:id', '/markForm')->name('systemMerchantTypeMarkForm')->option([
'_alias' => '备注',
'_auth' => false,
'_form' => 'systemMerchantTypeMark',
]);
Route::post('mark', '/mark')->name('systemMerchantTypeMark')->option([
'_alias' => '备注',
]);
Route::get('descr', '/description')->name('systemMerchantTypeDescrForm')->option([
'_alias' => '店铺类型说明',
]);
Route::post('description', '/description')->name('systemMerchantTypeDescr')->option([
'_alias' => '店铺类型说明',
]);
})->prefix('merchant.system.merchant.MerchantType')->option([
'_path' => '/merchant/type',
'_auth' => true,
]);
//店铺保证金
Route::group('/margin', function(){
// 主页
Route::get('index', '/index')->name('systemMerchantMarginIndex'
)->option([
'_alias'=>'主页列表 ',
]);
//缴纳记录
Route::get('lst', '/lst')->name('systemMerchantMarginLst')->option([
'_alias' => '缴纳记录',
]);
//扣费记录页
Route::get('read', '/GetMarginLstForm')->name('systemMarginList')->option([
'_alias' => '扣费记录页',
]);
//扣费记录帐单接口
Route::get('reductlst', '/GetMarginLst')->name('systemMarginList')->option([
'_alias' => '扣费记录',
]);
//扣除保证金
Route::get('form', '/setMarginForm')->name('systemMarginSetForm')->option([
'_alias' => '扣除保证金表单',
'_auth' => false,
'_form' => 'systemMarginSet',
]);
Route::post('reduct', '/setMargin')->name('systemMarginSet')->option([
'_alias' => '扣除保证金',
]);
})->prefix('merchant.system.merchant.MerchantMargin')->option([
'_path' => '/margin',
'_auth' => true,
]);
// 保证金退还
Route::group('margin/refund', function(){
//退款申请
Route::get('refund/lst', 'financial.Financial/getMarginLst')->name('systemMarginRefundList')->option([
'_alias' => '退款申请列表',
]);
Route::get('refund/show/:id', 'financial.Financial/refundShow')->name('systemMarginRefundShow')->option([
'_alias' => '退款申请详情',
]);
// //审核
Route::get('refund/status/:id/form', 'financial.Financial/statusForm')->name('systemMarginRefundSwitchStatusForm')->option([
'_alias' => '审核表单',
'_auth' => false,
'_form' => 'systemMarginRefundSwitchStatus',
]);
Route::post('refund/status/:id', 'financial.Financial/switchStatus')->name('systemMarginRefundSwitchStatus')->append(['type' => 1])->option([
'_alias' => '审核',
]);
// //备注
Route::get('refund/mark/:id/form', 'financial.Financial/markMarginForm')->name('systemMarginRefundMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'systemMarginRefundMark',
]);
Route::post('refund/mark/:id', 'financial.Financial/mark')->name('systemMarginRefundMark')->option([
'_alias' => '备注',
]);
});
});

View File

@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
Route::group(function () {
//权限管理
// Route::group('system/menu', function () {
// Route::get('lst', '/getList')->name('systemMenuGetLst')->option([
// '_alias' => '平台菜单/权限列表',
// ]);
// Route::get('create/form', '/createForm')->name('systemMenuCreateForm')->option([
// '_alias' => '平台菜单/权限添加表单',
// '_auth' => false,
// '_form' => 'systemMenuCreate',
// ]);
// Route::get('update/form/:id', '/updateForm')->name('systemMenuUpdateForm')->option([
// '_alias' => '平台菜单/权限编辑表单',
// '_auth' => false,
// '_form' => 'systemMenuUpdate',
// ]);
// Route::post('create', '/create')->name('systemMenuCreate')->option([
// '_alias' => '平台菜单/权限添加',
// ]);
// Route::post('update/:id', '/update')->name('systemMenuUpdate')->option([
// '_alias' => '平台菜单/权限编辑',
// ]);
// Route::delete('delete/:id', '/delete')->name('systemMenuDelete')->option([
// '_alias' => '平台菜单/权限删除',
// ]);
// })->prefix('admin.system.auth.Menu')->option([
// '_path' => '/setting/menu',
// '_auth' => true,
// ]);
//商户权限管理
Route::group('merchant/menu', function () {
Route::get('lst', '/getList')->name('systemMerchantMenuGetLst')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限列表',
]);
Route::get('create/form', '/createForm')->name('systemMerchantMenuCreateForm')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限添加表单',
'_auth' => false,
'_form' => 'systemMerchantMenuCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('systemMerchantMenuUpdateForm')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限编辑表单',
'_auth' => false,
'_form' => 'systemMerchantMenuUpdate',
]);
Route::post('create', '/create')->name('systemMerchantMenuCreate')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限添加',
]);
Route::post('update/:id', '/update')->name('systemMerchantMenuUpdate')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限编辑',
]);
Route::delete('delete/:id', '/delete')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([
'_alias' => '商户菜单/权限删除',
]);
})->prefix('admin.system.auth.Menu')->option([
'_path' => '/merchant/system',
'_auth' => true,
]);
});
// ->middleware(AllowOriginMiddleware::class)
// ->middleware(AdminTokenMiddleware::class, true)
// ->middleware(AdminAuthMiddleware::class)
// ->middleware(LogMiddleware::class);

View File

@ -0,0 +1,246 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
Route::group(function () {
//商户分类
Route::group('system/merchant', function () {
Route::get('category/lst', '/lst')->name('systemMerchantCategoryLst')->option([
'_alias' => '商户分类列表',
]);
Route::get('category_lst', '/lst')->option([
'_alias' => '商户分类列表',
'_auth' => false,
]);
Route::post('category', '/create')->name('systemMerchantCategoryCreate')->option([
'_alias' => '商户分类添加',
]);
Route::get('category/form', '/createForm')->name('systemMerchantCategoryCreateForm')->option([
'_alias' => '商户分类添加表单',
'_auth' => false,
'_form' => 'systemMerchantCategoryCreate',
]);
Route::delete('category/:id', '/delete')->name('systemMerchantCategoryDelete')->option([
'_alias' => '商户分类删除',
]);
Route::post('category/:id', '/update')->name('systemMerchantCategoryUpdate')->option([
'_alias' => '商户分类编辑',
]);
Route::get('category/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm')->option([
'_alias' => '商户分类编辑表单',
'_auth' => false,
'_form' => 'systemMerchantCategoryUpdate',
]);
Route::get('category/options', '/getOptions')->option([
'_alias' => '商户分类筛选',
'_auth' => false,
]);
})->prefix('admin.system.merchant.MerchantCategory')->option([
'_path' => '/merchant/classify',
'_auth' => true,
]);
//申请列表
Route::group('merchant/intention', function () {
Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([
'_alias' => '列表',
]);
Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
'_alias' => '审核',
]);
Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([
'_alias' => '删除',
]);
Route::get('mark/:id/form', '/form')->name('systemMerchantIntentionMarkForm')->option([
'_alias' => '备注',
'_auth' => false,
'_form' => 'systemMerchantIntentionMark',
]);
Route::get('status/:id/form', '/statusForm')->name('systemMerchantIntentionStatusForm')->option([
'_alias' => '申请商户',
'_auth' => false,
'_form' => 'systemMerchantIntentionStatus',
]);
Route::post('mark/:id', '/mark')->name('systemMerchantIntentionMark')->option([
'_alias' => '备注',
]);
Route::get('excel', '/excel');
})->prefix('admin.system.merchant.MerchantIntention')->option([
'_path' => '/merchant/application',
'_auth' => true,
]);
//商户管理
Route::group('system/merchant', function () {
Route::get('create/form', '.Merchant/createForm')->name('systemMerchantCreateForm')->option([
'_alias' => '商户列表',
]);
Route::get('count', '.Merchant/count')->name('systemMerchantCount')->option([
'_alias' => '商户列表统计',
]);
Route::get('lst', '.Merchant/lst')->name('systemMerchantLst')->option([
'_alias' => '商户列表',
]);
Route::post('create', '.Merchant/create')->name('systemMerchantCreate')->option([
'_alias' => '商户添加',
]);
Route::get('update/form/:id', '.Merchant/updateForm')->name('systemMerchantUpdateForm')->option([
'_alias' => '商户编辑表单',
'_auth' => false,
'_form' => 'systemMerchantUpdate',
]);
Route::post('update/:id', '.Merchant/update')->name('systemMerchantUpdate')->option([
'_alias' => '商户编辑',
]);
Route::post('status/:id', '.Merchant/switchStatus')->name('systemMerchantStatus')->option([
'_alias' => '商户修改推荐',
]);
Route::post('close/:id', '.Merchant/switchClose')->name('systemMerchantClose')->option([
'_alias' => '商户开启/关闭',
]);
Route::delete('delete/:id', '.Merchant/delete')->name('systemMerchantDelete')->option([
'_alias' => '商户删除',
]);
Route::post('password/:id', '.MerchantAdmin/password')->name('systemMerchantAdminPassword')->option([
'_alias' => '商户修改密码',
]);
Route::get('password/form/:id', '.MerchantAdmin/passwordForm')->name('systemMerchantAdminPasswordForm')->option([
'_alias' => '商户修改密码表单',
'_auth' => false,
'_form' => 'systemMerchantAdminPassword',
]);
Route::post('login/:id', '.Merchant/login')->name('systemMerchantLogin')->option([
'_alias' => '商户登录',
]);
Route::get('changecopy/:id/form', '.Merchant/changeCopyNumForm')->name('systemMerchantChangeCopyForm')->option([
'_alias' => '修改采集商品次数表单',
'_auth' => false,
'_form' => 'systemMerchantChangeCopy',
]);
Route::post('changecopy/:id', '.Merchant/changeCopyNum')->name('systemMerchantChangeCopy')->option([
'_alias' => '修改采集商品次数',
]);
})->prefix('admin.system.merchant')->option([
'_path' => '/merchant/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'uploadImage',
'_path' =>'/merchant/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'systemAttachmentLst',
'_path' =>'/merchant/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
// 店铺类型
Route::group('merchant/type', function () {
Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([
'_alias' => '列表',
]);
Route::post('create', '/create')->name('systemMerchantTypeCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id', '/update')->name('systemMerchantTypeUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('systemMerchantTypeDelete')->option([
'_alias' => '删除',
]);
Route::get('mark/:id', '/markForm')->name('systemMerchantTypeMarkForm')->option([
'_alias' => '备注',
'_auth' => false,
'_form' => 'systemMerchantTypeMark',
]);
Route::post('mark/:id', '/mark')->name('systemMerchantTypeMark')->option([
'_alias' => '备注',
]);
Route::get('detail/:id', '/detail')->name('systemMerchantTypeDetail')->option([
'_alias' => '备注',
]);
Route::get('options', '/options')->option([
'_alias' => '筛选',
'_auth' => false,
]);
Route::get('mer_auth', '/mer_auth')->option([
'_alias' => '权限',
'_auth' => false,
]);
})->prefix('admin.system.merchant.MerchantType')->option([
'_path' => '/merchant/type',
'_auth' => true,
]);
//保证金
Route::group('margin', function () {
//缴纳记录
Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([
'_alias' => '缴纳记录',
]);
//扣费记录
Route::get('list/:id', 'merchant.MerchantMargin/getMarginLst')->name('systemMarginList')->option([
'_alias' => '扣费记录',
]);
//扣除保证金
Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([
'_alias' => '扣除保证金表单',
'_auth' => false,
'_form' => 'systemMarginSet',
]);
Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([
'_alias' => '扣除保证金',
]);
//退款申请
Route::get('refund/lst', 'financial.Financial/getMarginLst')->name('systemMarginRefundList')->option([
'_alias' => '退款申请列表',
]);
Route::get('refund/show/:id', 'financial.Financial/refundShow')->name('systemMarginRefundShow')->option([
'_alias' => '退款申请详情',
]);
//审核
Route::get('refund/status/:id/form', 'financial.Financial/statusForm')->name('systemMarginRefundSwitchStatusForm')->option([
'_alias' => '审核表单',
'_auth' => false,
'_form' => 'systemMarginRefundSwitchStatus',
]);
Route::post('refund/status/:id', 'financial.Financial/switchStatus')->name('systemMarginRefundSwitchStatus')->append(['type' => 1])->option([
'_alias' => '审核',
]);
//备注
Route::get('refund/mark/:id/form', 'financial.Financial/markMarginForm')->name('systemMarginRefundMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'systemMarginRefundMark',
]);
Route::post('refund/mark/:id', 'financial.Financial/mark')->name('systemMarginRefundMark')->option([
'_alias' => '备注',
]);
})->prefix('admin.system.')->option([
'_path' => '/merchant/deposit_list',
'_auth' => true,
]);
});

304
app/admin/route/product.php Normal file
View File

@ -0,0 +1,304 @@
<?php
/**
* @date 2023年03月9日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户管理路由
*/
use think\facade\Route;
Route::group(function () {
//参数模板
Route::group('/product/params', function () {
Route::get('index', '/index')->name('merchantStoreParameterTemplateLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('merchantStoreParameterTemplateDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id', '/delete')->name('merchantStoreParameterTemplateDelete')->option([
'_alias' => '删除',
]);
Route::get('add', '/add')->name('merchantStoreParameterTemplateCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id', '/update')->name('merchantStoreParameterTemplateUpdate')->option([
'_alias' => '编辑',
]);
Route::get('select', '/select')->option([
'_alias' => '筛选列表',
'_auth' => false,
]);
// Route::get('temp/show', '/show')->option([
// '_alias' => '参数',
// '_auth' => false,
// ]);
})->prefix('product.Parameter')->option([
'_path' => '/product/params',
'_auth' => true,
]);
//商品
Route::group('store/product', function () {
Route::get('config', '/config')->option([
'_alias' => '配置',
'_auth' => false,
]);
Route::get('lst_filter', '/getStatusFilter')->name('merchantStoreProductLstFilter')->option([
'_alias' => '头部统计',
]);
Route::get('lst', '/lst')->name('merchantStoreProductLst')->option([
'_alias' => '列表',
]);
Route::get('list', '/lst')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::post('create', '/create')->name('merchantStoreProductCreate')->option([
'_alias' => '添加',
]);
Route::get('detail/:id', '/detail')->name('merchantStoreProductDetail')->option([
'_alias' => '详情',
]);
Route::get('temp_key', '/temp_key')->name('merchantStoreProductTempKey')->option([
'_alias' => '上传视频配置',
]);
Route::post('update/:id', '/update')->name('merchantStoreProductUpdate')->option([
'_alias' => '编辑',
]);
Route::post('free_trial/:id', '/freeTrial')->name('merchantStoreProductFreeTrial')->option([
'_alias' => '免审编辑',
]);
Route::delete('delete/:id', '/delete')->name('merchantStoreProductDelete')->option([
'_alias' => '删除',
]);
Route::delete('destory/:id', '/destory')->name('merchantStoreProductDestory')->option([
'_alias' => '加入回收站',
]);
Route::post('restore/:id', '/restore')->name('merchantStoreProductRestore')->option([
'_alias' => '恢复',
]);
Route::post('status/:id', '/switchStatus')->name('merchantStoreProductSwitchStatus')->option([
'_alias' => '上下架',
]);
Route::post('batch_status', '/batchShow')->name('merchantStoreProductSwitchBatchStatus')->option([
'_alias' => '批量上下架',
]);
Route::post('batch_temp', '/batchTemplate')->name('merchantStoreProductSwitchBatchTemplate')->option([
'_alias' => '批量设置运费模板',
]);
Route::post('batch_labels', '/batchLabels')->name('merchantStoreProductSwitchBatchLabels')->option([
'_alias' => '批量设置标签',
]);
Route::post('batch_hot', '/batchHot')->name('merchantStoreProductSwitchBatchHot')->option([
'_alias' => '批量设置推荐',
]);
Route::post('batch_ext', '/batchExtension')->name('merchantStoreProductSwitchBatchExtension')->option([
'_alias' => '批量设置推荐',
]);
Route::post('batch_svip', '/batchSvipType')->name('merchantStoreProductSwitchBatchSvipType')->option([
'_alias' => '批量设置会员价',
]);
Route::post('sort/:id', '/updateSort')->name('merchantStoreProductUpdateSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('merchantStoreProductPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('merchantStoreProductLabels')->option([
'_alias' => '标签',
]);
Route::get('attr_value/:id', '/getAttrValue')->name('merchantStoreProductAttrValue')->option([
'_alias' => '获取规格',
]);
})->prefix('merchant.store.product.Product')->option([
'_path' => '/product/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'merchantUploadImage',
'_path' =>'/product/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'merchantAttachmentLst',
'_path' =>'/product/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//商品分类
Route::group('store/category', function () {
Route::get('create/form', '/createForm')->name('merchantStoreCategoryCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'merchantStoreCategoryCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('merchantStoreCategoryUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'merchantStoreCategoryUpdate',
]);
Route::post('update/:id', '/update')->name('merchantStoreCategoryUpdate')->option([
'_alias' => '编辑',
]);
Route::get('lst', '/lst')->name('merchantStoreCategoryLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('merchantStoreCategoryDtailt')->option([
'_alias' => '详情',
]);
Route::post('create', '/create')->name('merchantStoreCategoryCreate')->option([
'_alias' => '添加',
]);
Route::delete('delete/:id', '/delete')->name('merchantStoreCategoryDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('merchantStoreCategorySwitchStatus')->option([
'_alias' => '修改状态',
]);
Route::get('list', '/getList')->option([
'_alias' => '筛选',
'_auth' => false,
])->append(['type' => 1]);
Route::get('select', '/getStoreCategoryList')->option([
'_alias' => '',
'_auth' => false,
]);
Route::get('brandlist', '/BrandList')->option([
'_alias' => '品牌列表',
'_auth' => false,
]);
})->prefix('product.StoreCategory')->option([
'_path' => '/product/classify',
'_auth' => true,
'_append'=> [
[
'_name' =>'merchantUploadImage',
'_path' =>'/product/classify',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'merchantAttachmentLst',
'_path' =>'/product/classify',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//品牌分类
Route::group('store/brand/category', function () {
Route::get('create/form', '/createForm')->name('systemStoreBrandCategoryCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'systemStoreBrandCategoryCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('systemStoreBrandCategoryUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'systemStoreBrandCategoryUpdate',
]);
Route::post('update/:id', '/update')->name('systemStoreBrandCategoryUpdate')->option([
'_alias' => '编辑',
]);
Route::get('lst', '/lst')->name('systemStoreBrandCategoryLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('systemStoreBrandCategoryDtailt')->option([
'_alias' => '详情',
]);
Route::post('create', '/create')->name('systemStoreBrandCategoryCreate')->option([
'_alias' => '添加',
]);
Route::delete('delete/:id', '/delete')->name('systemStoreBrandCategoryDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('systemStoreBrandCategorySwitchStatus')->option([
'_alias' => '修改状态',
]);
})->prefix('admin.store.StoreBrandCategory')->option([
'_path' => '/product/band/brandClassify',
'_auth' => true,
]);
//品牌
Route::group('store/brand', function () {
Route::get('create/form', '/createForm')->name('systemStoreBrandCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'systemStoreBrandCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('systemStoreBrandUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'systemStoreBrandUpdate',
]);
Route::get('lst', '/lst')->name('systemStoreBrandLst')->option([
'_alias' => '列表',
]);
Route::post('status/:id', '/switchStatus')->name('systemStoreBrandSwithStatus')->option([
'_alias' => '修改状态',
]);
Route::post('create', '/create')->name('systemStoreBrandCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id', '/update')->name('systemStoreBrandUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('systemStoreBrandDelete')->option([
'_alias' => '删除',
]);
})->prefix('admin.store.StoreBrand')->option([
'_path' => '/product/band/brandList',
'_auth' => true,
]);
//商品标签
Route::group('product/label', function () {
Route::get('lst', '/lst')->name('merchantStoreProductLabelLst')->option([
'_alias' => '列表',
]);
Route::get('create/form', '/createForm')->name('merchantStoreProductLabelCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'merchantStoreProductLabelCreate',
]);
Route::post('create', '/create')->name('merchantStoreProductLabelCreate')->option([
'_alias' => '添加',
]);
Route::get('update/:id/form', '/updateForm')->name('merchantStoreProductLabelUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'merchantStoreProductLabelUpdate',
]);
Route::post('update/:id', '/update')->name('merchantStoreProductLabelUpdate')->option([
'_alias' => '编辑',
]);
Route::get('detail/:id', '/detail')->name('merchantStoreProductLabelDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id', '/delete')->name('merchantStoreProductLabelDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchWithStatus')->name('merchantStoreProductLabelStatus')->option([
'_alias' => '修改状态',
]);
Route::get('option', '/getOptions')->option([
'_alias' => '筛选',
'_auth' => false,
]);
})->prefix('merchant.store.product.ProductLabel')->option([
'_path' => '/product/label',
'_auth' => true,
]);
});

View File

@ -0,0 +1,26 @@
<?php
use think\facade\Route;
//协议
Route::group('agreement', function () {
Route::get('keylst', '/getKeyLst')->name('systemAgreeKeyLsy')->option([
'_alias' => '协议列表',
]);
Route::get(':key', '/getAgree')->name('systemAgreeDetail')->option([
'_alias'=> '协议',
'_auth' => false,
'_form' => 'systemAgreeSave',
]);
Route::post(':key', '/saveAgree')->name('systemAgreeSave')->option([
'_alias' => '协议保存',
'_init' => [ \crmeb\services\UpdateAuthInit::class,'agreement'],
]);
})->prefix('admin.system.Cache')->option([
'_path' => '/setting/agreements',
'_auth' => true,
]);

View File

@ -0,0 +1,150 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">功能菜单/节点</h3>
{if condition="$id eq 0"}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
<option value="0">作为顶级菜单/节点</option>
{volist name="$menus" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
{/volist}
</select>
</td>
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
</td>
<td>
<input type="radio" name="menu" value="1" title="是">
<input type="radio" name="menu" value="2" title="不是">
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单/节点名称<font>*</font>
</td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称"
lay-reqText="请输入菜单/节点名称" class="layui-input">
</td>
<td class="layui-td-gray">操作日志名称<font>*</font>
</td>
<td>
<input type="text" name="name" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称"
autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单/节点URL</td>
<td>
<input type="text" name="src" placeholder="请输入菜单/节点URL可空" autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray">菜单排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单图标</td>
<td colspan="3">
<input type="text" name="icon" style="width:150px; display:inline" placeholder="请输入图标,可空"
autocomplete="off" class="layui-input">
bi-gear<a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
<option value="0">作为顶级节点</option>
{volist name="$menus" id="v"}
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
</td>
<td>
<input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1" } checked{/eq}>
<input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2" } checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单/节点名称<font>*</font>
</td>
<td>
<input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off"
placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
</td>
<td class="layui-td-gray">操作日志名称<font>*</font>
</td>
<td>
<input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称"
lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单/节点URL</td>
<td>
<input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL可空" autocomplete="off"
class="layui-input">
</td>
<td class="layui-td-gray">菜单排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">菜单图标</td>
<td colspan="3">
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
<i class="bi {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
{/if}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
if (!data.field.menu || data.field.menu == '') {
layer.msg('请选择是否在左侧菜单显示');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post("/admin/rule/add", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,93 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-sm add-menu">+ 添加菜单/节点</button>
</div>
<div>
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
var pageTable = treeGrid.render({
id: 'treeTable'
, elem: '#treeTable'
, idField: 'id'
, url: "/admin/merchant/menu/lst"
, cellMinWidth: 80
, treeId: 'id'//树形id字段名称
, treeUpId: 'pid'//树形父id字段名称
, treeShowName: 'title'//以树形式显示的字段
, cols: [[
{ field: 'id', width: 80, title: 'ID号', align: 'center' }
, { field: 'sort', width: 60, title: '排序', align: 'center' }
,{field:'icon',title: '菜单图标',width: 80, align: 'center' ,templet: function(d){
var html='<strong class="bi '+d.icon+'"></strong>';
return html;
}}
, { field: 'title', width: 160, title: '菜单/节点名称' }
, { field: 'pid', title: '父ID', width: 80, align: 'center' }
, { field: 'src', title: 'URL链接' }
, {
field: 'menu', width: 100, title: '是否是菜单', align: 'center', templet: function (d) {
var html = '<span style="color:#fbbc05"></span>';
if (d.menu == '1') {
html = '<span style="color:#12bb37"></span>';
}
return html;
}
}
, { field: 'name', width: 110, title: '操作日志名称', align: 'center' }
, {
width: 188, title: '操作', align: 'center'
, templet: function (d) {
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="add">添加子菜单/节点</button><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return html;
}
}
]]
, page: false
});
//表头工具栏事件
$('.add-menu').on('click', function () {
tool.side("/admin/merchant/menu/addform");
return;
});
//操作按钮
treeGrid.on('tool(treeTable)', function (obj) {
console.log(obj);
if (obj.event === 'add') {
tool.side('/admin/merchant/menu/addform?pid=' + obj.data.id);
return;
}
if (obj.event === 'edit') {
tool.side('/admin/merchant/menu/addform?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/merchant/menu/del", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,135 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {display: inline-block}
.editormd li {list-style: inherit;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<!-- <h3 class="pb-3">新建文章</h3> -->
<table class="layui-table layui-table-form">
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">店铺说明</td>
</tr>
<tr>
<td colspan="6">
<textarea class="layui-textarea" id="container_content"></textarea>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
laydate.render({
elem: '#test1' //指定元素
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
street();
village();
form.on('select(area_id)', function (data) {
street(data.value)
});
function street (id) {
var demo1 = xmSelect.render({
name: 'township',
el: '#demo1',
initValue: [],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
disabled: group_access == 2 ||group_access == 4? true : false,
on: function (data) {
var arr = data.arr;
if(arr.length > 0){
village(arr[0]['code']);
}else{
village();
}
},
})
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
})
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village',
el: '#demo2',
initValue: [],
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
}
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field.content == '') {
layer.msg('请先完善文章内容');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,332 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<!-- 时间选择 -->
<div class="layui-form">
<form id="filterform" class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-block">
<div class="layui-btn-group" id="chonse_date">
<input type="hidden" name="chonse_date" value="" disabled placeholder="选择时间">
<button name="both" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="today" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">今天</button>
<button name="yeserday" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">昨天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近30天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本月</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本年</button>
</div>
</div>
</div>
<div class="layui-inline">
<!-- <label class="layui-form-label">日期范围</label> -->
<div class="layui-inline" id="range_date">
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="start_date" id="test-startDate-1" class="layui-input"
placeholder="开始日期">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="end_date" id="test-endDate-1" class="layui-input"
placeholder="结束日期">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline" style="width:35%;">
<div class="layui-form-item">
<label class="layui-form-label">商户审核</label>
<div class="layui-input-block">
<div class="layui-btn-group" id="store_status">
<input type="hidden" name="status" value="0" disabled placeholder="核审状态值">
<button name="both" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="wait_status" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">待审核</button>
<button name="success_status" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核通过</button>
<button name="failed_status" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核未通过</button>
</div>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;float:none;">
<div class="layui-form-item">
<label class="layui-form-label">商户分类</label>
<div class="layui-input-block">
<select name="mer_cate" lay-filter="aihao">
<option value=""></option>
{volist name="category" key="k" id="vo"}
<option value="0">{$vo.category_name}</option>
{/volist}
</select>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline" style="width:35%;">
<div class="layui-form-item">
<label class="layui-form-label">店铺类型</label>
<div class="layui-input-block">
<select name="type" lay-filter="aihao">
<option value=""></option>
{volist name="type" key="k" id="vo"}
<option value="0">{$vo.type_name}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;">
<div class="layui-form-item">
<label class="layui-form-label">关键字</label>
<div class="layui-input-block">
<input style="width:70%;float:left" type="text" name="keywords" placeholder="请输入关键字"
class="layui-input" autocomplete="off" />
<button class="layui-btn layui-btn-normal" lay-submit=""
lay-filter="searchform">提交搜索</button>
</div>
</div>
</div>
</div>
</form>
<table class="layui-hide" id="intention_list" lay-filter="intention_list">
</table>
</div>
<!-- test end -->
</div>
<!-- 操作 -->
<script type="text/html" id="toolbarDemo"></script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="mark">备注</a>
<a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#intention_list',
title: '商户入驻申请列表',
toolbar: '#toolbarDemo',
url: '/admin/merchant/intention/lst',
parseData: function(res){ //res 即为原始返回的数据
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.count, //解析数据长度
"data": res.data.list //解析数据列表
};
},
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'ID',
field: 'mer_intention_id',
title: 'ID',
align: 'center',
width: 80
},
{
field: 'mer_name',
title: '商户名称',
align: 'center',
width: 200,
}, {
field: 'category_name',
title: '商户分类',
align: 'center',
width: 220,
templet: '<div>{{d.merchantCategory.category_name}}</div>'
},{
field: 'type_name',
title: '店铺类型',
align: 'center',
width: 220,
templet: '<div>{{d.merchantType.type_name}}</div>'
}, {
field: 'name',
title: '商户姓名',
align: 'center',
width: 220,
}, {
field: 'phone',
title: '联系方式',
align: 'center',
width: 100,
}, {
field: 'create_time',
title: '申请时间',
align: 'center',
width: 220,
},{
field: 'images',
title: '资质图片',
align: 'center',
width: 220,
},{
field: 'status',
title: '状态',
align: 'center',
width: 150
}, {
field: 'mark',
title: '备注',
align: 'center',
width: 150
},
{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 190,
align: 'center'
}
]
]
});
//监听表头工具栏事件
// table.on('toolbar(store_product)', function (obj) {
// if (obj.event === 'add') {
// tool.side("/admin/merchant/type/form");
// return false;
// }
// });
//监听表格行工具事件
table.on('tool(intention_list)', function (obj) {
var data = obj.data;
// console.log(data);
if (obj.event === 'mark') {
tool.side('/admin/merchant/intention/markform?id=' + obj.data.mer_intention_id);
} else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/merchant/intention/del", { id: data.mer_intention_id }, callback);
layer.close(index);
});
}
return false;
});
// 日期范围
layui.use(['laydate','table','element', 'jquery'], function () {
var laydate = layui.laydate;
//日期范围
laydate.render({
elem: '#range_date'
//设置开始日期、日期日期的 input 选择器
//数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
, range: ['#test-startDate-1', '#test-endDate-1']
,done: function(value, date, endDate){
active['reload'] ? active['reload'].call(this) : '';
}
});
//
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();;
console.log(dataRload)
//执行重载
table.reload('intention_list', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//监听button提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
...data.field
},
page: {
curr: 1
}
});
return false;
});
//监听select提交
form.on('select(seleform)', function(data) {
active['reload'] ? active['reload'].call(this) : '';
return false;
});
// 获取表单所有参数
function getformdata() {
var form = $('#filterform').serializeArray();
var data = new Array();
for(let i=0;i<form.length; i++){
data[form[i].name] = form[i].value;
}
return data;
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,57 @@
{extend name="common/base"/}
{block name="style"}
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">备注</h3>
<table class="layui-table layui-table-form">
<tr>
<td colspan="6">
<textarea class="layui-textarea" name="mark"></textarea>
<input type="hidden" name="id" value="{$id}">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform" type="button">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker;
//监听提交
form.on('submit(webform)', function (data) {
console.log(data);
if (data.field == '') {
layer.msg('请先完善商品详情');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('/admin/merchant/intention/mark', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,116 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">保证金扣费</h3>
<table class="layui-table layui-table-form">
<tr>
<td colspan="2" class="layui-td-gray">商户名称<font>*</font></td>
<td colspan="6">
<input type="text" name="mer_name" lay-verify="required"
lay-reqText="商户名称" disabled autocomplete="off" placeholder="商户名称" class="layui-input" value="{$data.mer_name}">
<!-- <input type="text" name="type" lay-verify="required"
lay-reqText="明细类型" hidden= autocomplete="off" placeholder="明细类型" class="layui-input" value="{$data.type}"> -->
</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">商户ID</td>
<td colspan="6">
<input type="number" name="mer_id" lay-verify="required" lay-reqText="0" autocomplete="off" disabled placeholder="0" class="layui-input" value="{$data.mer_id}">
</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">商户剩余保证金</td>
<td >
<input type="number" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" disabled placeholder="0" class="layui-input" value="{$data.margin}">
</td>
<td >单位:元</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">保证金扣除金额<font>*</font></td>
<td >
<input type="number" name="number" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="">
</td>
<td >单位:元</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">保证金扣除原因<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="mark"></textarea>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform" type='button'>扣除保证金</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','treeGrid', 'tagpicker', 'tinymce', 'admin'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table
var tool = layui.tool;
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500,
});
//监听提交
form.on('submit(webform)', function (data) {
// console.log(data.field);
// data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field == '') {
layer.msg('请先完善表单输入');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('/admin/margin/reduct', data.field, callback);
return true;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,523 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<!-- 时间选择 -->
<div class="layui-form">
<form id="filterform" class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-block">
<div class="layui-btn-group" id="witch_date">
<button name="both" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="today" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">今天</button>
<button name="yeserday" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">昨天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近30天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本月</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本年</button>
</div>
</div>
</div>
<div class="layui-inline">
<!-- <label class="layui-form-label">日期范围</label> -->
<div class="layui-inline" id="test6">
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="start_date" id="test-startDate-1" class="layui-input"
placeholder="开始日期">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="end_date" id="test-endDate-1" class="layui-input"
placeholder="结束日期">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width:46%">
<div class="layui-form-item">
<label class="layui-form-label">关键字</label>
<div class="layui-input-block">
<input style="width:80%;float:left" type="text" name="keywords" placeholder="请输入关键字"
class="layui-input" autocomplete="off" />
<button class="layui-btn layui-btn-normal" style="width:20%" lay-submit=""
lay-filter="searchform" type="button">提交搜索</button>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;float:none;">
<div class="layui-form-item">
<label class="layui-form-label">商户类别</label>
<div class="layui-input-block">
<select name="dddd" lay-filter="searchform">
<option value=""></option>
<option value="10">自营</option>
<option value="11">非自营</option>
</select>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline" style="width:46%;">
<div class="layui-form-item">
<label class="layui-form-label">商户分类</label>
<div class="layui-input-block">
<select name="category" lay-filter="searchform">
<option value=""></option>
<option value="0">写作</option>
<option value="1">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
</select>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;">
<div class="layui-form-item">
<label class="layui-form-label">店铺类型</label>
<div class="layui-input-block">
<select name="type" lay-filter="type">
<option value=""></option>
<option value="0">写作</option>
<option value="1">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
</select>
</div>
</div>
</div>
</div>
<!-- change tab -->
<div class="layui-form-item" id="set_margin" style="display:block;">
<div class="layui-input-inline" style="width:46%;">
<div class="layui-form-item">
<label class="layui-form-label">保证金状态</label>
<div class="layui-input-block">
<select class="test_state" name="status" lay-filter="status">
<option value=""></option>
<option value="0">写作</option>
<option value="1">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
</select>
</div>
</div>
</div>
</div>
<!-- change tab end -->
<!-- change tab -->
<div class="layui-form-item" id="refund_margin" style="display:none;">
<div class="layui-input-inline" style="width:46%;">
<div class="layui-form-item">
<label class="layui-form-label">审核</label>
<div class="layui-input-block">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-normal">全部</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">待审核</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">已审核</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核失败</button>
</div>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;">
<div class="layui-form-item">
<label class="layui-form-label">退回状态</label>
<div class="layui-input-block">
<select name="refund" lay-filter="refund">
<option value=""></option>
<option value="0">写作</option>
<option value="1">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
</select>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- test end -->
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li lay-id="11" class="layui-this site-demo-active" data-type="tabChange">缴存保证金</li>
<li lay-id="22" class="site-demo-active" data-type="tabChange">退回保证金</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<!-- 缴存列表 -->
<div class="layui-tab-item layui-show">
<table class="layui-hide" id="reduct_list" lay-filter="reduct_list">
</table>
</div>
<!-- 退回保证金列表 -->
<div class="layui-tab-item">
<div class="layui-tab-item layui-show">
<table class="layui-hide" id="refund_list" lay-filter="refund_list">
</table>
</div>
</div>
</div>
</div>
</div>
<!-- 缴存操作 -->
<script type="text/html" id="toolbarDemo"></script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reduct">保证金扣费</a>
<a class="layui-btn layui-btn-xs" lay-event="record">扣费记录</a>
</div>
</script>
<!-- 退回操作 -->
<script type="text/html" id="refundToolbar"></script>
<script type="text/html" id="refundBar">
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="status">审核</a>
<a class="layui-btn layui-btn-xs" lay-event="mark">备注</a>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#reduct_list',
title: '保证金列表',
toolbar: '#toolbarDemo',
url: '/admin/margin/lst',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'ID',
field: 'mer_id',
title: 'ID',
align: 'center',
width: 80
},
{
field: 'mer_name',
title: '商户名称',
align: 'center',
width: 200,
templet: '<div>{{d.merchant.mer_name}}</div>'
}, {
field: 'type_id',
title: '店铺类型',
align: 'center',
width: 220,
templet: '<div>{{d.merchant.type_id}}</div>'
}, {
field: 'real_name',
title: '商户姓名',
align: 'center',
width: 220,
templet: '<div>{{d.merchant.real_name}}</div>'
}, {
field: 'margin',
title: '保证金额度',
align: 'center',
width: 100,
templet: '<div>{{d.merchant.margin}}</div>'
}, {
field: 'status',
title: '状态',
align: 'center',
width: 150
}, {
field: 'pay_time',
title: '支付时间',
align: 'center',
width: 150
},
{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 190,
align: 'center'
}
]
]
});
layui.pageTable = table.render({
elem: '#refund_list',
title: '退回保证金列表',
toolbar: '#refundToolbar',
url: '/admin/margin/refund/lst',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'ID',
field: 'mer_id',
title: 'ID',
align: 'center',
width: 80
},
{
field: 'mer_name',
title: '商户名称1',
align: 'center',
width: 200,
templet: '<div>{{d.merchant.mer_name}}</div>'
}, {
field: 'type_id',
title: '店铺类型',
align: 'center',
width: 220,
templet: '<div>{{d.merchant.type_id}}</div>'
}, {
field: 'real_name',
title: '商户姓名',
align: 'center',
width: 220,
templet: '<div>{{d.merchant.real_name}}</div>'
}, {
field: 'margin',
title: '保证金额度',
align: 'center',
width: 100,
templet: '<div>{{d.merchant.margin}}</div>'
}, {
field: 'status',
title: '状态',
align: 'center',
width: 150
}, {
field: 'pay_time',
title: '支付时间',
align: 'center',
width: 150
},
{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#refundBar',
width: 190,
align: 'center'
}
]
]
});
// 获取表单所有参数
function getformdata() {
var form = $('#filterform').serializeArray();
var data = new Array();
for(let i=0;i<form.length; i++){
data[form[i].name] = form[i].value;
}
return data;
}
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();;
//执行重载
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//监听表头工具栏事件
// table.on('toolbar(store_product)', function (obj) {
// if (obj.event === 'add') {
// tool.side("/admin/merchant/type/form");
// return false;
// }
// });
//监听表格行工具事件
table.on('tool(reduct_list)', function (obj) {
var data = obj.data;
// console.log(data);
if (obj.event === 'reduct') {
tool.side('/admin/margin/form?id=' + obj.data.mer_id);
} else if (obj.event === 'record') {
tool.side('/admin/margin/read?id=' + obj.data.mer_id);
}
return false;
});
//监听表格行工具事件
table.on('tool(refund_list)', function (obj) {
var data = obj.data;
if (obj.event === 'status') {
alert("审核");
tool.post('/admin/margin/status?id=' + obj.data.mer_id, obj.data);
} else if (obj.event === 'mark') {
tool.side('/admin/margin/form?id=' + obj.data.mer_id);
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
console.log(data.elem.name, data.field)
layui.pageTable.reload({
where: {
date:data.elem.name,
...data.field
},
page: {
curr: 1
}
});
// layui.form.render();
return false;
});
form.on('select(searchform)', function(e) {
let data = getformdata();
layui.pageTable.reload({
where: {
...data
},
page: {
curr: 1
}
});
return false;
});
//监听
$('.test_state .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// 日期范围
layui.use(['laydate','element', 'jquery'],
function () {
var laydate = layui.laydate;
var $ = layui.jquery,element = layui.element;
//日期范围
laydate.render({
elem: '#test6'
//设置开始日期、日期日期的 input 选择器
//数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
, range: ['#test-startDate-1', '#test-endDate-1']
,done: function(value, date, endDate){
let data = getformdata()
data.date = ''
layui.pageTable.reload({
where: {
...data
},
page: {
curr: 1
}
});
}
});
//触发事件
var active = {
tabChange: function(){
//切换到指定Tab项
// element.tabChange('demo', this.getAttribute('lay-id')); //切换tab
var marign = document.getElementById('set_margin');
var refund = document.getElementById('refund_margin');
if ('11'==this.getAttribute('lay-id')) {
marign.style.display = "block";
refund.style.display = "none";
// refund.childNodes().value='';
}else{
refund.style.display = "block";
marign.style.display = "none";
}
}
};
$('.site-demo-active').on('click', function(){
var othis = $(this), type = othis.data('type');
active[type] ? active[type].call(this, othis) : '';
});
//Hash地址的定位
// var layid = location.hash.replace(/^#test=/, '');
// element.tabChange('test', layid);
}
);
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,102 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li class="layui-this">扣费记录</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<!-- 缴存列表 -->
<div class="layui-tab-item layui-show">
<table class="layui-hide" id="reduct_list" lay-filter="reduct_list">
</table>
</div>
</div>
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
var context = "";
if (r != null)
context = decodeURIComponent(r[2]);
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : context;
}
// alert(GetQueryString("id"));
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#reduct_list',
title: '扣费记录',
toolbar: '#toolbarDemo',
url: '/admin/margin/reductlst?id='+GetQueryString("id"),
parseData: function(res){ //res 即为原始返回的数据
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.count, //解析数据长度
"data": res.data.list //解析数据列表
};
},
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'ID',
field: 'bill_id',
title: 'ID',
align: 'center',
width: 80
},
{
field: 'mark',
title: '扣费原因',
align: 'center',
width: 500,
},{
field: 'number',
title: '扣费金额',
align: 'center',
width: 200,
},{
field: 'create_time',
title: '操作时间',
align: 'center',
width: 200
}
]
]
});
// 日期范围
// layui.use('laydate', function () {
// var laydate = layui.laydate;
// //日期范围
// laydate.render({
// elem: '#test6'
// //设置开始日期、日期日期的 input 选择器
// //数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
// , range: ['#test-startDate-1', '#test-endDate-1']
// });
// });
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,63 @@
{extend name="common/base"/}
{block name="style"}
<style>
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="layui-form p-4">
<h3 class="pb-3">查看店铺类型</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">店铺类型名称</td>
<td colspan="7"><input type="text" name="store_name" lay-verify="required" lay-reqText="请输入商品名称"
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_name}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">店铺类型要求</td>
<td colspan="7">
<input type="text" name="store_name" lay-verify="required" lay-reqText="请输入商品名称"
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_info}" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">店铺保证金</td>
<td colspan="7"><input type="text" name="price" lay-verify="required" lay-reqText="请输入商品关键字"
autocomplete="off" placeholder="请输入商品关键字" class="layui-input" value="{$detail.margin}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">店铺权限</td>
<td colspan="3">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">其它说明</td>
<td colspan="6">
<textarea class="layui-textarea" name="store_info" readonly>{$detail.store_info}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">创建时间</td>
<td colspan="6">
{$detail.create_time}
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">修改时间</td>
<td colspan="6">
{$detail.update_time}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->

View File

@ -0,0 +1,209 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加店铺类型</h3>
<table class="layui-table layui-table-form">
<tr>
<td colspan="2" class="layui-td-gray">店铺类型名称<font>*</font></td>
<td colspan="6">
<input type="text" name="type_name" lay-verify="required" lay-reqText="请输入商品名称"
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_name}">
</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">店铺类型要求</td>
<td colspan="6">
<textarea class="layui-textarea" name="type_info">{$detail.type_name}</textarea>
</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">店铺保证金</td>
<td colspan="6">
<table class="layui-table layui-table-form">
<tr>
<td colspan="2">
<div class="layui-input-block">
<input type="radio" name="is_margin" value="1" title="有" checked="{$detail.is_margin}">
<input type="radio" name="is_margin" value="0" title="无" checked="{$detail.is_margin}">
</div>
</td>
<td colspan="5"></td>
</tr>
<tr>
<td colspan="2">
<input type="text" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="{$detail.margin}">
</td>
<td colspan="5">单位:元</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="height: 360px;" class="layui-td-gray">店铺权限<font>*</font></td>
<td colspan="6" >
<div class="data-box" data-admin='{:json_encode($dataTree)}'></div>
<div id="test7" class="demo-tree"></div>
</td>
</tr>
<tr>
<td colspan="2" class="layui-td-gray">其它说明</td>
<td colspan="6">
<textarea class="layui-textarea" name="description">{$detail.description}</textarea>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform" type='button'>立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','treeGrid', 'tagpicker', 'tinymce', 'admin'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table
var tool = layui.tool;
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500,
});
// 店铺权限
layui.use(['tree', 'util'], function(){
var tree = layui.tree
,layer = layui.layer
,util = layui.util
//模拟数据
,data = getData();
// [{
// title: '一级1'
// ,id: 1
// ,field: 'name1'
// ,checked: true
// ,spread: true
// ,children: [{}]
// }]
//开启复选框
tree.render({
elem: '#test7'
,data: data
,showCheckbox: true
,id:'id',//菜单id
});
//监听提交
form.on('submit(webform)', function (data) {
console.log(data.field);
// data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field == '') {
layer.msg('请先完善店铺类型');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
//获得选中的节点
var checkData = tree.getChecked('id');
var list = new Array();
list = getChecked_list(checkData);
data.field.auth = list
tool.post('/admin/merchant/type/add', data.field, callback);
return true;
});
// 获取选中节点的id
function getChecked_list(data) {
var id = "";
$.each(data, function (index, item) {
if (id != "") {
id = id + "," + item.id;
}
else {
id = item.id;
}
var i = getChecked_list(item.children);
if (i != "") {
id = id + "," + i;
}
});
return id;
}
});
}
//获取店铺权限的数据
function getData(){
/* 初始化页面渲染时传过来的js变量 */
let dataContainerElem = document.querySelector('.data-box'),
data = dataContainerElem ? dataContainerElem.dataset : {},
dataBox = {}; //模板变量容器,`.data-box`类选择器所在的所有`data`属性值集合
Object.keys(data).forEach(function (key) {
dataBox[key] = data[key];
if (isJsonString(data[key])) dataBox[key] = JSON.parse(data[key]); //是json格式的字串才转对象
});
/**
* 判断字串是否属于json字串
*/
function isJsonString(str) {
let flag = false;
if (typeof str != 'string') return flag;
try {
JSON.parse(str);
flag = true;
} catch (e) {}
return flag;
}
//所有保存到数据节点的变量都成为`dataBox`对象的属性
return dataBox.admin;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,138 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<table class="layui-hide" id="store_product" lay-filter="store_product"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm side-alert" lay-event="add" data-title="添加商品">+ 添加店铺类型</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#store_product',
title: '商品表列表',
toolbar: '#toolbarDemo',
url: '/admin/merchant/type/lst',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'ID',
field: 'id',
title: '编号',
align: 'center',
width: 80
},
{
field: 'type_name',
title: '店铺类型名称',
align: 'center',
width: 200
},{
field: 'margin',
title: '店铺保证金',
align: 'center',
width: 100
},{
field: 'type_info',
title: '店铺类型要求',
align: 'center',
width: 220
},{
field: 'create_time',
title: '创建时间',
align: 'center',
width: 150
},{
field: 'update_time',
title: '最近修改时问',
align: 'center',
width: 150
},
{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 190,
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(store_product)', function(obj){
if (obj.event === 'add') {
tool.side("/admin/merchant/type/form");
return false;
}
});
//监听表格行工具事件
table.on('tool(store_product)', function(obj) {
console.log(obj.data);
var data = obj.data;
if (obj.event === 'read') {
tool.side('/admin/merchant/type/read?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('/admin/merchant/type/form?id='+obj.data.id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/merchant/type/del", { id: data.id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
// form.on('submit(searchform)', function(data) {
// layui.pageTable.reload({
// where: {
// keywords: data.field.keywords
// },
// page: {
// curr: 1
// }
// });
// return false;
// });
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,63 @@
{extend name="common/base"/}
{block name="style"}
<style>
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="layui-form p-4">
<h3 class="pb-3">查看店铺类型</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">店铺类型名称</td>
<td colspan="7"><input type="text" name="store_name" lay-verify="required" lay-reqText="请输入商品名称"
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_name}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">店铺类型要求</td>
<td colspan="7">
<input type="text" name="store_name" lay-verify="required" lay-reqText="请输入商品名称"
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_info}" readonly>
</td>
</tr>
<tr>
<td class="layui-td-gray">店铺保证金</td>
<td colspan="7"><input type="text" name="price" lay-verify="required" lay-reqText="请输入商品关键字"
autocomplete="off" placeholder="请输入商品关键字" class="layui-input" value="{$detail.margin}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">店铺权限</td>
<td colspan="3">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">其它说明</td>
<td colspan="6">
<textarea class="layui-textarea" name="store_info" readonly>{$detail.store_info}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">创建时间</td>
<td colspan="6">
{$detail.create_time}
</td>
</tr>
<tr>
<td class="layui-td-gray" style="text-align:left">修改时间</td>
<td colspan="6">
{$detail.update_time}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->

View File

@ -0,0 +1,102 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标签名称<font>*</font></td>
<td colspan="4">
<input type="text" name="label_name" lay-verify="required" lay-reqText="请输入标签名称"
autocomplete="off" placeholder="请输入标签名称" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">说明</td>
<td colspan="4">
<input type="text" name="info" lay-verify="required" lay-reqText="请输入说明"
autocomplete="off" placeholder="请输入说明" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="status" lay-skin="switch">
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.label/add', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,97 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.product_label_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标签名称<font>*</font></td>
<td colspan="4">
<input type="text" name="label_name" lay-verify="required" lay-reqText="请输入标签名称"
autocomplete="off" value="{$detail.label_name}" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">说明</td>
<td colspan="4">
<input type="text" name="info" lay-verify="required" lay-reqText="请输入说明"
autocomplete="off" value="{$detail.info}" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" autocomplete="off"
class="layui-input">
</td>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="status" lay-skin="switch" {$detail.status?'checked':''}>
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,157 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加商品标签">+ 添加商品标签</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'product_label_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'label_name',
title: '分类名称',
align: 'center',
},{
field: 'info',
title: '标签说明',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'status',
title: '评价内容',
align: 'center',
templet: function (d)
{
return d.status ? '显示' : '隐藏';
},
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.product_label_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.product_label_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.product_label_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,167 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" placeholder="请输入品牌名称" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch">
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.band/add', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,165 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.brand_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
{if $detail.storeBrandCategory.pid == $vo.store_brand_category_id}
<option value="{$vo.store_brand_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" value="{$detail.brand_name}" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
street("{$detail.storeBrandCategory.pid}");
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: ['{$detail.storeBrandCategory.store_brand_category_id}'],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,152 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加品牌">+ 添加品牌</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'brand_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'brand_name',
title: '品牌名称',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'status',
title: '是否显示',
align: 'center',
templet: function (d)
{
return d.is_show ? '显示' : '隐藏';
},
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.brand_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,122 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择上级分类" lay-search="">
<option value="0" selected>顶级分类</option>
{volist name=":set_band_recursion(get_band_calss())" id="v"}
<option value="{$v.store_brand_category_id}">{$v.cate_name} </option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">分类名称</td>
<td colspan="4">
<input type="text" name="cate_name" lay-verify="required" lay-reqText="请输入分类名称"
autocomplete="off" placeholder="请输入分类名称" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch">
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.brandClassify/add', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,119 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.store_brand_category_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择上级分类" lay-search="">
<option value="0" selected>顶级分类</option>
{volist name=":set_band_recursion(get_band_calss())" id="vo"}
{if $detail.pid == $vo.store_brand_category_id}
<option value="{$vo.store_brand_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">分类名称</td>
<td colspan="4">
<input type="text" name="cate_name" lay-verify="required" lay-reqText="请输入分类名称"
autocomplete="off" value="{$detail.cate_name}" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,126 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入品牌分类名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-sm add-menu">+ 添加品牌分类</button>
</div>
<div>
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
</div>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加品牌分类">+ 添加品牌分类</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
var pageTable = treeGrid.render({
id: 'treeTable'
, elem: '#treeTable'
, idField: 'store_brand_category_id'
, url: "/admin/product.brandClassify/index"
, cellMinWidth: 80
, treeId: 'store_brand_category_id'//树形id字段名称
, treeUpId: 'pid'//树形父id字段名称
, treeShowName: 'cate_name'//以树形式显示的字段
, cols: [[
{ field: 'store_brand_category_id', width: 80, title: 'ID号', align: 'center' }
, { field: 'cate_name', title: '菜单/节点名称' }
// , { field: 'pid', title: '父ID', width: 80, align: 'center' }
// , { field: 'path', title: '父级', width: 80 }
, { field: 'sort', title: '排序', align: 'center' }
, {
field: 'is_show', title: '是否显示', align: 'center', templet: function (d) {
var html = '<span style="color:#fbbc05">隐藏</span>';
if (d.is_show == '1') {
html = '<span style="color:#12bb37">显示</span>';
}
return html;
}
}
, { field: 'create_time', title: '创建时间', align: 'center' }
, {
width: 188, title: '操作', align: 'center'
, templet: function (d) {
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return html;
}
}
]]
, page: false
});
//表头工具栏事件
$('.add-menu').on('click', function () {
tool.side("/admin/product.brandClassify/add");
return;
});
//操作按钮
treeGrid.on('tool(treeTable)', function (obj) {
console.log(obj);
if (obj.event === 'add') {
tool.side('/admin/product.brandClassify/add?pid=' + obj.data.store_brand_category_id);
return;
}
if (obj.event === 'edit') {
tool.side('/admin/product.brandClassify/edit?id=' + obj.data.store_brand_category_id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/product.brandClassify/del", { id: obj.data.store_brand_category_id }, callback);
layer.close(index);
});
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,108 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加分类</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font></td>
<td>
<select name="pid" lay-filter="storeBrandCategory" lay-search>
<option value="0" selected>顶级分类</option>
{volist name=":set_product_recursion(get_product_calss())" id="v"}
<option value="{$v.store_category_id}">{$v.cate_name} </option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">分类名称<font>*</font>
</td>
<td>
<input type="text" name="cate_name" lay-verify="required" autocomplete="off" placeholder="请输入分类名称"
lay-reqText="请输入分类名称" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">分类图片</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:110*110px)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="pic" value="">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch">
</div>
</div>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post("/admin/product.classify/add", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,144 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.store_category_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font></td>
<td>
<select name="pid" lay-filter="storeBrandCategory" lay-search>
<option value="0" selected>顶级分类</option>
{volist name=":set_product_recursion(get_product_calss())" id="vo"}
{if $detail.pid == $vo.store_category_id}
<option value="{$vo.store_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
</tr>
<tr>
<td>
<div class="layui-col-md4" id="address"></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md12">
<label class="layui-form-label">分类名称<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="cate_name" required lay-verify="required" value="{$detail.cate_name}" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">分类图片</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:110*110px)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="pic" value="">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">排序<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="sort" required lay-verify="required" value="{$detail.sort}" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,143 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-sm add-menu">+ 添加商品分类</button>
</div>
<div>
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
</div>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加商品分类">+ 添加商品分类</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
var pageTable = treeGrid.render({
id: 'treeTable'
, elem: '#treeTable'
, idField: 'store_category_id'
, url: "/admin/product.classify/index"
, cellMinWidth: 80
, treeId: 'store_category_id'//树形id字段名称
, treeUpId: 'pid'//树形父id字段名称
, treeShowName: 'cate_name'//以树形式显示的字段
, cols: [[
{ field: 'store_category_id', width: 80, title: 'ID号', align: 'center' }
, { field: 'cate_name', title: '分类名称' }
,{field:'pic',title: '分类图标',width: 80, align: 'center' ,templet: function(d){
var html = `<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBP5tRaW5CLx//374+PHjcHJyMnz//n24dOnScOXKleH69evDjRs35tIMx9mhwNGvQXXa4XE5pAsEvn79Orx8+XL48uXLBbX/vXT16tXhzp07w+XLl0ffo4LAmIBAGJPp7PUIgadPnw6np8vz++joaLh///4Q4WAhsIqAOYRVtA703giB58+fTwqDOMRV379Jsz5//jwcHx9vsgnrdiQgEDrqjLFDefv27dlcwVj9Ra/H3EKst8vl27dvZ0H15s2bs/mMXe7LtvcjIBD247zRXj59+rTW+uuuN2VncRby4sWL4cePH2dvj7kNy/wFBMIM+jCuJqyzrLvelH29evXqj8nN2FecKVjmLSAQ5t1/Bzn6d+/eDXHp8/wScwm7DKHz+/Pz9gUEwvZNt77FuMdgnWXd9bJ9xdWOODsYW3x1GJOZx+sCYQb9dO3atbWOct31xnYWE5VxtSNb4gzh9evX2VvUdSwgEDrunMWh3bp16+xuxMXPU/6NuxdjvalLXD5ctjx79mzS1Y64uuGrwzLNPusFQp/98sdRxY1Gd+/eHeLfKcuq74/T/Ljp6cOHD6Obj/es8iGPKxBTbqIa3aGKgwgIhIOwr77TuOvw4cOHS+8+nPq+xRHElYHFBGF8iOMZifNL1C/ec75u7Oe4zdpVhzGdfl9363K/fTN6ZPHh3MbDTbGdiyYB7927NyzmH2IS8cmTJ6PHsqziwYMHS0Ns2TbU709AIOzPuqs9RaBkE4TxLEQ8IPX48eNJ8wZjjYttxJnN1K87Y9vx+n4EBMJ+nLvay5QHpeIDHB/mVeYNxhp58+bN4fbt22PVXu9IwBxCR52xj0OJD3hcLVg24Rf12wiDaFPcyBQhZOlfQCD030dbO8J4GCnCYPH8wdY2PGFDrjpMQOrgLQKhg07YxyFECEy9j2AXxxNhlN3huIt92ubqAgJhdbPZrRGn/3GfQVwKPOQSVzWm3AB1yGOsvm+BUGAExNWEbc0HbMoVlzmXzV9sug/rry8gENa3m8Wa8QHc5d9FWBUhvjp41mFVtf29XyDsz3pre4r5gHjQaNkSH7xV7zBcts1t1MdVh55Cahtt+lu2IRBm1pPxQXr06NHZ3YPZnEB86Hb9J9Q2oYszl0Nc7djkmCusKxBm0svxvTtm6RdXCuLUO24pvuj6fjyk1PuMfpzh+OrQ3+ATCP31yf+OKCYE48Mfv/V/X+I3bFw9+P2BpJjFj2v+c1h6/DozB7ddHqP/uWmXulvYdoRA9ts+zhziKkL85yzxF5LiDMJCYF0BgbCu3I7Xi1PqVa4QxHvj+QOX9HbcMX/55gVChx0cXwHWmXQTBh125swOSSB01mERBL5bd9YphQ7HpGJnnS0MOuuQYocjEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMwF9dLtbhmksgE3CGkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCAiHTUUegmIBAKNbhmksgExAImY46AsUEBEKxDtdcApmAQMh01BEoJiAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
`;
if(d.pic)
{
html = `<img style="width:100%;height:100%;" src="` + d.pic + `" />`;
}
return html;
}}
, { field: 'sort', title: '排序', align: 'center' }
, {
field: 'is_show', title: '是否显示', align: 'center', templet: function (d) {
var html = '<span style="color:#fbbc05">隐藏</span>';
if (d.is_show == '1') {
html = '<span style="color:#12bb37">显示</span>';
}
return html;
}
}
, {
field: 'is_hot', title: '是否推荐', align: 'center', templet: function (d) {
var html = '<span style="color:#fbbc05">不推荐</span>';
if (d.is_hot == '1') {
html = '<span style="color:#12bb37">推荐</span>';
}
return html;
}
}
, {
width: 188, title: '操作', align: 'center'
, templet: function (d) {
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return html;
}
}
]]
, page: false
});
//表头工具栏事件
$('.add-menu').on('click', function () {
tool.side("/admin/product.classify/add");
return;
});
//操作按钮
treeGrid.on('tool(treeTable)', function (obj) {
console.log(obj);
if (obj.event === 'add') {
tool.side('/admin/product.classify/add?pid=' + obj.data.store_category_id);
return;
}
if (obj.event === 'edit') {
tool.side('/admin/product.classify/edit?id=' + obj.data.store_category_id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/product.classify/delete", { id: obj.data.store_category_id }, callback);
layer.close(index);
});
}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,200 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">关联商户</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">选择商户</td>
<td colspan="4">
<div class="layui-col-md4">
<select lay-filter="merchant" lay-search>
<option value="" >请选择商户</option>
{volist name='merchant' id='vo'}
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">已选商户<font>*</font></label>
<div class="layui-input-block" id="merchantList" >
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="layui-col-md4" id="address"></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队名称<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队电话<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
<td>
<div class="layui-col-md4">
<select name="" lay-filter="merchantAddress" lay-search>
<option value="">选择区域</option>
{volist name='arealist' id='vo'}
<option value="{$vo.area_code}" >{$vo.area_name}</option>
{/volist}
</select>
</div>
<div class="layui-col-md4">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
// 下拉选中事件
form.on('select(merchant)', function(data){
if(data.value == null || data.value == '')
{
return false;
}
const title = $('#merchant' + data.value).text();
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
$('#merchantList').append(html);
$("#merchant"+ data.value).remove();
$(".layui-this").remove();
});
form.on('select(merchantAddress)', function (data) {
street(data.value);
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[1]}', data.field, callback);
return false;
});
// 删除选中商户
function merchantxz(env)
{
if($('#mer_id'+env).attr("checked") == 'checked')
{
$('#mer_id'+env).removeAttr('checked');
$('#mer_id_style'+env).removeClass('layui-form-checked');
}else{
$('#mer_id'+env).attr('checked', 'checked');
$('#mer_id_style'+env).addClass('layui-form-checked');
}
}
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,188 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.store_category_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">选择商户</td>
<td colspan="4">
<div class="layui-col-md4">
<select lay-filter="merchant" lay-search>
<option value="" >上级分类</option>
{volist name='merchant' id='vo'}
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td>
<div class="layui-col-md4" id="address"></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">分类名称<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" value="{$detail.cate_name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
</div>
</div>
</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传分类图片(尺寸:110x110)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="avatar" value="">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">排序<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="sort" required lay-verify="required" value="{$detail.sort}" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
// 下拉选中事件
form.on('select(merchant)', function(data){
if(data.value == null || data.value == '')
{
return false;
}
const title = $('#merchant' + data.value).text();
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
$('#merchantList').append(html);
$("#merchant"+ data.value).remove();
$(".layui-this").remove();
});
form.on('select(merchantAddress)', function (data) {
street(data.value);
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
// 删除选中商户
function merchantxz(env)
{
if($('#mer_id'+env).attr("checked") == 'checked')
{
$('#mer_id'+env).removeAttr('checked');
$('#mer_id_style'+env).removeClass('layui-form-checked');
}else{
$('#mer_id'+env).attr('checked', 'checked');
$('#mer_id_style'+env).addClass('layui-form-checked');
}
}
var group_access = "{:session('gougu_admin')['group_access']}";
street("{$detail.store_category_id}");
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'pid',
el: '#demo1',
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
initValue: ['{$detail.pid}'],
disabled: group_access == 2 || group_access==4 ? true : false
});
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,200 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<!-- <script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加虚拟评论">+ 添加虚拟评论</span>
{/if}
</div>
</script> -->
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'reply_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'store_name',
title: '商品名称',
align: 'center',
width:120,
templet: function (d)
{
return d.product.store_name;
},
},{
field: 'pic',
title: '商品图',
align: 'center',
width:120,
templet: function (d)
{
var html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBP5tRaW5CLx//374+PHjcHJyMnz//n24dOnScOXKleH69evDjRs35tIMx9mhwNGvQXXa4XE5pAsEvn79Orx8+XL48uXLBbX/vXT16tXhzp07w+XLl0ffo4LAmIBAGJPp7PUIgadPnw6np8vz++joaLh///4Q4WAhsIqAOYRVtA703giB58+fTwqDOMRV379Jsz5//jwcHx9vsgnrdiQgEDrqjLFDefv27dlcwVj9Ra/H3EKst8vl27dvZ0H15s2bs/mMXe7LtvcjIBD247zRXj59+rTW+uuuN2VncRby4sWL4cePH2dvj7kNy/wFBMIM+jCuJqyzrLvelH29evXqj8nN2FecKVjmLSAQ5t1/Bzn6d+/eDXHp8/wScwm7DKHz+/Pz9gUEwvZNt77FuMdgnWXd9bJ9xdWOODsYW3x1GJOZx+sCYQb9dO3atbWOct31xnYWE5VxtSNb4gzh9evX2VvUdSwgEDrunMWh3bp16+xuxMXPU/6NuxdjvalLXD5ctjx79mzS1Y64uuGrwzLNPusFQp/98sdRxY1Gd+/eHeLfKcuq74/T/Ljp6cOHD6Obj/es8iGPKxBTbqIa3aGKgwgIhIOwr77TuOvw4cOHS+8+nPq+xRHElYHFBGF8iOMZifNL1C/ec75u7Oe4zdpVhzGdfl9363K/fTN6ZPHh3MbDTbGdiyYB7927NyzmH2IS8cmTJ6PHsqziwYMHS0Ns2TbU709AIOzPuqs9RaBkE4TxLEQ8IPX48eNJ8wZjjYttxJnN1K87Y9vx+n4EBMJ+nLvay5QHpeIDHB/mVeYNxhp58+bN4fbt22PVXu9IwBxCR52xj0OJD3hcLVg24Rf12wiDaFPcyBQhZOlfQCD030dbO8J4GCnCYPH8wdY2PGFDrjpMQOrgLQKhg07YxyFECEy9j2AXxxNhlN3huIt92ubqAgJhdbPZrRGn/3GfQVwKPOQSVzWm3AB1yGOsvm+BUGAExNWEbc0HbMoVlzmXzV9sug/rry8gENa3m8Wa8QHc5d9FWBUhvjp41mFVtf29XyDsz3pre4r5gHjQaNkSH7xV7zBcts1t1MdVh55Cahtt+lu2IRBm1pPxQXr06NHZ3YPZnEB86Hb9J9Q2oYszl0Nc7djkmCusKxBm0svxvTtm6RdXCuLUO24pvuj6fjyk1PuMfpzh+OrQ3+ATCP31yf+OKCYE48Mfv/V/X+I3bFw9+P2BpJjFj2v+c1h6/DozB7ddHqP/uWmXulvYdoRA9ts+zhziKkL85yzxF5LiDMJCYF0BgbCu3I7Xi1PqVa4QxHvj+QOX9HbcMX/55gVChx0cXwHWmXQTBh125swOSSB01mERBL5bd9YphQ7HpGJnnS0MOuuQYocjEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMwF9dLtbhmksgE3CGkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCAiHTUUegmIBAKNbhmksgExAImY46AsUEBEKxDtdcApmAQMh01BEoJiAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
</div>`;
if(d.product.image)
{
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="` + d.product.image + `" />
</div>`;
}
return html;
},
},{
field: 'nickname',
title: '用户名称',
align: 'center',
width:150,
},{
field: 'product_score',
title: '产品评分',
align: 'center',
width:150,
},{
field: 'service_score',
title: '服务评分',
align: 'center',
width:150,
},{
field: 'postage_score',
title: '物流评分',
align: 'center',
width:150,
},{
field: 'sort',
title: '排序',
align: 'center',
width:150,
},{
field: 'comment',
title: '评价内容',
align: 'center',
width:120,
},{
field: 'merchant_reply_content',
title: '回复内容',
align: 'center',
width:120,
},{
field: 'create_time',
title: '评论时间',
align: 'center',
width:150,
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.reply_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.reply_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.reply_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,129 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">服务条款<font>*</font></td>
<td colspan="4">
<input type="text" name="guarantee_name" lay-verify="required" lay-reqText="请输入服务条款"
autocomplete="off" placeholder="请输入服务条款" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">服务内容描述</td>
<td colspan="4">
<input type="text" name="guarantee_info" lay-verify="required" lay-reqText="请输入服务内容描述"
autocomplete="off" placeholder="请输入服务内容描述" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">服务条款图标</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:100*100px)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="image" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="status" lay-skin="switch">
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.guarantee/add', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,122 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.guarantee_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">服务条款<font>*</font></td>
<td colspan="4">
<input type="text" name="guarantee_name" lay-verify="required" lay-reqText="请输入服务条款"
autocomplete="off" value="{$detail.guarantee_name}" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">服务内容描述</td>
<td colspan="4">
<input type="text" name="guarantee_info" lay-verify="required" lay-reqText="请输入服务内容描述"
autocomplete="off" value="{$detail.guarantee_info}" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">服务条款图标</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:100*100px)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="image" value="">
</div>
</div>
</td>
<tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="status" lay-skin="switch" {$detail.status?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,182 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加保障服务">+ 添加保障服务</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'guarantee_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'guarantee_name',
title: '服务条款',
align: 'center',
},{
field: 'image',
title: '图标',
align: 'center',
templet: function (d)
{
var html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBP5tRaW5CLx//374+PHjcHJyMnz//n24dOnScOXKleH69evDjRs35tIMx9mhwNGvQXXa4XE5pAsEvn79Orx8+XL48uXLBbX/vXT16tXhzp07w+XLl0ffo4LAmIBAGJPp7PUIgadPnw6np8vz++joaLh///4Q4WAhsIqAOYRVtA703giB58+fTwqDOMRV379Jsz5//jwcHx9vsgnrdiQgEDrqjLFDefv27dlcwVj9Ra/H3EKst8vl27dvZ0H15s2bs/mMXe7LtvcjIBD247zRXj59+rTW+uuuN2VncRby4sWL4cePH2dvj7kNy/wFBMIM+jCuJqyzrLvelH29evXqj8nN2FecKVjmLSAQ5t1/Bzn6d+/eDXHp8/wScwm7DKHz+/Pz9gUEwvZNt77FuMdgnWXd9bJ9xdWOODsYW3x1GJOZx+sCYQb9dO3atbWOct31xnYWE5VxtSNb4gzh9evX2VvUdSwgEDrunMWh3bp16+xuxMXPU/6NuxdjvalLXD5ctjx79mzS1Y64uuGrwzLNPusFQp/98sdRxY1Gd+/eHeLfKcuq74/T/Ljp6cOHD6Obj/es8iGPKxBTbqIa3aGKgwgIhIOwr77TuOvw4cOHS+8+nPq+xRHElYHFBGF8iOMZifNL1C/ec75u7Oe4zdpVhzGdfl9363K/fTN6ZPHh3MbDTbGdiyYB7927NyzmH2IS8cmTJ6PHsqziwYMHS0Ns2TbU709AIOzPuqs9RaBkE4TxLEQ8IPX48eNJ8wZjjYttxJnN1K87Y9vx+n4EBMJ+nLvay5QHpeIDHB/mVeYNxhp58+bN4fbt22PVXu9IwBxCR52xj0OJD3hcLVg24Rf12wiDaFPcyBQhZOlfQCD030dbO8J4GCnCYPH8wdY2PGFDrjpMQOrgLQKhg07YxyFECEy9j2AXxxNhlN3huIt92ubqAgJhdbPZrRGn/3GfQVwKPOQSVzWm3AB1yGOsvm+BUGAExNWEbc0HbMoVlzmXzV9sug/rry8gENa3m8Wa8QHc5d9FWBUhvjp41mFVtf29XyDsz3pre4r5gHjQaNkSH7xV7zBcts1t1MdVh55Cahtt+lu2IRBm1pPxQXr06NHZ3YPZnEB86Hb9J9Q2oYszl0Nc7djkmCusKxBm0svxvTtm6RdXCuLUO24pvuj6fjyk1PuMfpzh+OrQ3+ATCP31yf+OKCYE48Mfv/V/X+I3bFw9+P2BpJjFj2v+c1h6/DozB7ddHqP/uWmXulvYdoRA9ts+zhziKkL85yzxF5LiDMJCYF0BgbCu3I7Xi1PqVa4QxHvj+QOX9HbcMX/55gVChx0cXwHWmXQTBh125swOSSB01mERBL5bd9YphQ7HpGJnnS0MOuuQYocjEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMwF9dLtbhmksgE3CGkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCAiHTUUegmIBAKNbhmksgExAImY46AsUEBEKxDtdcApmAQMh01BEoJiAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
</div>`;
if(d.image)
{
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="` + d.image + `" />
</div>`;
}
return html;
},
},{
field: 'guarantee_info',
title: '服务内容描述',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'status',
title: '是否显示',
align: 'center',
templet: function (d)
{
return d.status ? '显示' : '隐藏';
},
},{
field: 'mer_count',
title: '使用的商户数',
align: 'center',
},{
field: 'product_cout',
title: '使用商品数',
align: 'center',
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.guarantee_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.guarantee_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.guarantee_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,167 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" placeholder="请输入品牌名称" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch">
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.band/add', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,165 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.brand_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
{if $detail.storeBrandCategory.pid == $vo.store_brand_category_id}
<option value="{$vo.store_brand_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" value="{$detail.brand_name}" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
street("{$detail.storeBrandCategory.pid}");
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: ['{$detail.storeBrandCategory.store_brand_category_id}'],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,152 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加品牌">+ 添加品牌</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'brand_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'brand_name',
title: '品牌名称',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'status',
title: '是否显示',
align: 'center',
templet: function (d)
{
return d.is_show ? '显示' : '隐藏';
},
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.brand_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,178 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">参数模板名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" placeholder="请输入品牌名称" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
<tr>
<td></td>
<td>
<table class="layui-table layui-table-form">
<tr>
<th>参数名称</th>
<th>参数值</th>
<th>排序</th>
<th>操作</th>
</tr>
<tr>
<td >
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入参数名称"
autocomplete="off" placeholder="请输入参数名称" class="layui-input">
</td>
<td >
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入参数值"
autocomplete="off" placeholder="请输入参数值" class="layui-input">
</td>
<td>
<input type="number" name="sort" lay-verify="required"
autocomplete="off" class="layui-input">
</td>
<td>
删除
</td>
</tr>
<tr>
<td colspan="4">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="add_paramter">添加参数</button>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.band/add', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,165 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.brand_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
{if $detail.storeBrandCategory.pid == $vo.store_brand_category_id}
<option value="{$vo.store_brand_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" value="{$detail.brand_name}" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
street("{$detail.storeBrandCategory.pid}");
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: ['{$detail.storeBrandCategory.store_brand_category_id}'],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,195 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x" style="display:flex;justify-content: 'space-around';">
<div>
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入参数模板名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</div>
<div>
<table class="layui-table layui-table-form">
<tr>
<td style="padding-right:10px;">
<b>平台分类 </b>
</td>
<td>
<select name="pid" lay-filter="seleCate" lay-verify="required" lay-reqText="请选择">
<option value="0">请选择</option>
{volist name="$cate_list" id="v"}
<option value="{$v.id}" >{$v.title}{$v.cate_name} </option>
{/volist}
</select>
</td>
</tr>
</table>
</div>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加参数模板">+ 添加参数模板</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
parseData: function(res){ //res 即为原始返回的数据
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.count, //解析数据长度
"data": res.data.list //解析数据列表
};
},
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'template_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'template_name',
title: '模板名称',
align: 'center',
},{
field: 'cateid',
title: '关联分类',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.brand_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
//监听分类提交
form.on('select(seleCate)', function(data) {
console.log(data);
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,167 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" placeholder="请输入品牌名称" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch">
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/product.band/add', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,165 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.brand_id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">上级分类<font>*</font>
</td>
<td>
<select name="" lay-filter="storeBrandCategory" lay-search>
<option value="">选择分类</option>
{volist name='storeBrandCategory' id='vo'}
{if $detail.storeBrandCategory.pid == $vo.store_brand_category_id}
<option value="{$vo.store_brand_category_id}" selected >{$vo.cate_name}</option>
{else /}
<option value="{$vo.store_brand_category_id}" >{$vo.cate_name}</option>
{/if}
{/volist}
</select>
</td>
<td>
<div class="layui-col-md4">
<label class="layui-form-label">子分类</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">品牌名称<font>*</font></td>
<td colspan="4">
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
autocomplete="off" value="{$detail.brand_name}" class="layui-input">
</td>
</tr>
<tr>
<td>
<div class="layui-form-item">
<label class="layui-form-label">是否显示</label>
<div class="layui-input-block">
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
</div>
</div>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
form.on('select(storeBrandCategory)', function (data) {
street(data.value);
});
street("{$detail.storeBrandCategory.pid}");
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'brand_category_id',
el: '#demo1',
prop: {
name: 'cate_name',
value: 'store_brand_category_id',
},
data: [],
radio: true,
initValue: ['{$detail.storeBrandCategory.store_brand_category_id}'],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
demo1.update({
data: result
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,152 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加品牌">+ 添加品牌</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'brand_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'brand_name',
title: '品牌名称',
align: 'center',
},{
field: 'sort',
title: '排序',
align: 'center',
},{
field: 'status',
title: '是否显示',
align: 'center',
templet: function (d)
{
return d.is_show ? '显示' : '隐藏';
},
},{
field: 'create_time',
title: '创建时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.brand_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.brand_id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,200 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray {
width: 110px;
}
.addrhelper-ok-btn {
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">关联商户</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">选择商户</td>
<td colspan="4">
<div class="layui-col-md4">
<select lay-filter="merchant" lay-search>
<option value="" >请选择商户</option>
{volist name='merchant' id='vo'}
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">已选商户<font>*</font></label>
<div class="layui-input-block" id="merchantList" >
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="layui-col-md4" id="address"></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队名称<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队电话<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
<td>
<div class="layui-col-md4">
<select name="" lay-filter="merchantAddress" lay-search>
<option value="">选择区域</option>
{volist name='arealist' id='vo'}
<option value="{$vo.area_code}" >{$vo.area_name}</option>
{/volist}
</select>
</div>
<div class="layui-col-md4">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
// 下拉选中事件
form.on('select(merchant)', function(data){
if(data.value == null || data.value == '')
{
return false;
}
const title = $('#merchant' + data.value).text();
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
$('#merchantList').append(html);
$("#merchant"+ data.value).remove();
$(".layui-this").remove();
});
form.on('select(merchantAddress)', function (data) {
street(data.value);
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[1]}', data.field, callback);
return false;
});
// 删除选中商户
function merchantxz(env)
{
if($('#mer_id'+env).attr("checked") == 'checked')
{
$('#mer_id'+env).removeAttr('checked');
$('#mer_id_style'+env).removeClass('layui-form-checked');
}else{
$('#mer_id'+env).attr('checked', 'checked');
$('#mer_id_style'+env).addClass('layui-form-checked');
}
}
var group_access = "{:session('gougu_admin')['group_access']}";
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
initValue: [],
disabled: group_access == 2 || group_access==4 ? true : false,
});
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
});
});
}
}
</script>
{/block}
<!-- /脚本 -->

Some files were not shown because too many files have changed in this diff Show More