更新本地分支

This commit is contained in:
liuxiaoquan 2023-03-09 10:08:11 +08:00
commit c9b49ddfba
79 changed files with 9745 additions and 161 deletions

2
.gitignore vendored
View File

@ -14,3 +14,5 @@
/public/static/home/dev
/public/static/home/oa
/config/database.php
/public/.htaccess
/public/nginx.htaccess

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

@ -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,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,262 @@
<?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\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
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/product.product/index?category_id='.$this->category_id,
'/admin/product.product/add',
'/admin/product.product/edit',
'/admin/product.product/delete',
'/admin/product.product/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 = EbStoreProduct::where($where)->count();
$list = EbStoreProduct::with(['merchant' => ['merchantType', 'category']])->order('product_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::with(['merchant' => ['merchantType', 'category']])->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 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,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 Specs 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,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

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

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,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,30 @@
<?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');
}
}

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,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,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">
`;
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,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">
</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,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">
</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,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}
<!-- /脚本 -->

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,236 @@
{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_id',
title: '编号',
align: 'center',
width:80,
},{
field: 'image',
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,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">
</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: 'store_name',
title: '商品名称',
align: 'center',
width:120
},{
field: 'type_name',
title: '商户类型',
align: 'center',
width:150,
templet: function (d)
{
return d.merchant.merchantType ? d.merchant.merchantType.type_name : '待定';
}
},{
field: 'product_score',
title: '商户类别',
align: 'center',
width:150,
templet: function (d)
{
return d.merchant.category ? d.merchant.category.category_name : '待定';
}
},{
field: 'price',
title: '商品售价',
align: 'center',
width:150,
},{
field: 'sales',
title: '销量',
align: 'center',
width:150,
},{
field: 'stock',
title: '库存',
align: 'center',
width:150,
},{
field: 'is_good',
title: '推荐级别',
align: 'center',
width:120,
},{
field: 'sort',
title: '排序',
align: 'center',
width:120,
},{
field: 'is_used',
title: '是否显示',
align: 'center',
width:150,
templet: function (d)
{
var html = d.is_used ? '显示' : '隐藏';
return html;
},
},{
field: 'is_used',
title: '商品状态',
align: 'center',
width:150,
templet: function (d)
{
var html = d.is_used ? '上架显示' : '平台关闭';
return html;
},
},{
field: 'keyword',
title: '标签',
align: 'center',
width:150,
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center',
width:180,
}
]
]
});
//监听表头工具栏事件
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;
});
layui.use('rate', function(){
var rate = layui.rate;
//基础效果
rate.render({
elem: '#is_good'
})
});
}
</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,210 @@
{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 colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">分润比例<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="shareRate" 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,218 @@
{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.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 colspan="4">
<div class="layui-col-md12">
<label class="layui-form-label">已选商户<font>*</font></label>
<div class="layui-input-block" id="merchantList" >
{volist name='detail.merchant' id='vo'}
<input type="checkbox" name="mer_id[]" value="{$vo.mer_id}" title="{$vo.mer_name}" checked>
{/volist}
</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" value="{$detail.name}" 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" value="{$detail.tel}" 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="shareRate" required lay-verify="required" placeholder="{$detail.shareRate}" 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'}
{if $detail.area.area_code == $vo.area_code}
<option value="{$vo.area_code}" selected >{$vo.area_name}</option>
{else /}
<option value="{$vo.area_code}" >{$vo.area_name}</option>
{/if}
{/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">
<input type="hidden" name="id" value="{$detail.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/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.area.area_code}");
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: ['{$detail.street_id}'],
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,208 @@
{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[4])}==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: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area',
title: '地址',
align: 'center',
templet: function (d)
{
return d.area.area_name + d.street.street_name;
},
width:120,
},{
field: 'mer_id',
title: '主商户',
align: 'center',
width:120,
templet: function (d)
{
var html = d.mer_id?d.mer_id:'待定';
return html;
},
},{
field: 'name',
title: '名称',
align: 'center',
width:120,
},{
field: 'tel',
title: '联系电话',
align: 'center',
width:150,
},{
field: 'shareRate',
title: '分佣比例',
align: 'center',
width:150,
},{
field: 'earnings_amount',
title: '净收益',
align: 'center',
width:150,
},{
field: 'bill_amount',
title: '流水',
align: 'center',
width:150,
},{
field: 'brokerage',
title: '分销佣金',
align: 'center',
width:150,
},{
field: 'order_number',
title: '支付订单数量',
align: 'center',
width:150,
},{
field: 'cancel_order_number',
title: '取消支付订单数量',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
templet: function (d)
{
var html = '<span style="color:#fbbc05">禁用</span>';
if (d.status == '0') {
html = '<span style="color:#12bb37">正常</span>';
}
return html;
},
},{
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[4]}?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?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('{$url[3]}', { id: data.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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,138 @@
{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="12">
<div class="layui-col-md12">
<select name="area_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='area' id='vo'}
<option value="{$vo.id}" >{$vo.area_name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">姓名<font>*</font></td>
<td colspan="4">
<input type="text" name="name" lay-verify="required" lay-reqText="请输入负责人姓名"
autocomplete="off" placeholder="请输入负责人姓名" class="layui-input">
</td>
<td class="layui-td-gray" style="vertical-align:top;">负责人头像</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</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="avatar" value="">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">职务<font>*</font></td>
<td colspan="4">
<input type="text" name="duty" lay-verify="required" lay-reqText="请输入负责人职务"
autocomplete="off" placeholder="请输入负责人职务" class="layui-input">
</td>
<td class="layui-td-gray">电话<font>*</td>
<td colspan="4">
<input type="text" name="phone" lay-verify="required" lay-reqText="请输入负责人电话"
autocomplete="off" placeholder="请输入负责人电话" 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) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.areamanager/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,280 @@
{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[4])}==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[5]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'order_id',
title: '编号',
align: 'center',
width:80,
},{
fixed: 'left',
field: 'order_sn',
title: '订单号',
align: 'center',
width:200,
},{
field: 'merchant',
title: '商户',
align: 'center',
templet: function (d)
{
return d.merchant.mer_name;
},
width:120,
},{
field: 'cart_id',
title: '商品名称',
align: 'center',
templet: function (d)
{
var cart = d.cart_id;
var html = '';
for (let index = 0; index < cart.length; index++) {
const element = cart[index];
html+= element.product.store_name;
}
return html;
},
width:120,
},{
field: 'total_num',
title: '商品数量',
align: 'center',
width:120,
},{
field: 'total_price',
title: '订单金额',
align: 'center',
width:120,
},{
field: 'pay_price',
title: '支付金额',
align: 'center',
width:150,
},{
field: 'uid',
title: '用户',
align: 'center',
templet: function (d)
{
var html = d.uid;
return html;
},
width:150,
},{
field: 'paid',
title: '支付状态',
align: 'center',
templet: function (d)
{
switch (d.paid) {
case 0:
var html = '未支付';
break;
case 1:
var html = '已支付';
break;
}
return html;
},
width:150,
},{
field: 'delivery_type',
title: '物品类型',
align: 'center',
templet: function (d)
{
switch (d.delivery_type) {
case 1:
var html = '发货';
break;
case 2:
var html = '送货';
break;
case 3:
var html = '虚拟';
break;
default:
var html = '待定';
break;
}
return html;
},
width:150,
},{
field: 'pay_type',
title: '支付方式',
align: 'center',
templet: function (d)
{
switch (d.pay_type) {
case 0:
var html = '余额';
break;
case 1:
var html = '微信';
break;
case 2:
var html = '小程序';
break;
case 3:
var html = 'h5';
break;
case 4:
var html = '支付宝';
break;
case 5:
var html = '支付宝扫码';
break;
case 6:
var html = '微信扫码';
break;
default:
var html = '未知的支付方式';
break;
}
return html;
},
width:150,
},{
field: 'mark',
title: '备注',
align: 'center',
width:150,
},{
field: 'verify_time',
title: '核销时间',
align: 'center',
width:150,
},{
field: 'pay_time',
title: '支付时间',
align: 'center',
width:150,
},{
field: 'create_time',
title: '下单时间',
align: 'center',
width:150,
}
]
]
});
//监听表头工具栏事件
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[4]}?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?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('{$url[3]}', { id: data.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,133 @@
{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="12">
<div class="layui-col-md12">
<select name="area_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='area' id='vo'}
{if $detail.area_id == $vo.id}
<option value="{$vo.id}" selected>{$vo.area_name}</option>
{else/}
<option value="{$vo.id}">{$vo.area_name}</option>
{/if}
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">姓名<font>*</font></td>
<td colspan="7">
<input type="text" name="name" lay-verify="required" lay-reqText="请输入负责人姓名"
autocomplete="off" placeholder="请输入负责人姓名" class="layui-input" value="{$detail.name}">
</td>
<td class="layui-td-gray" style="vertical-align:top;">负责人头像</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.avatar}" 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="{$detail.avatar}">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">职务<font>*</font></td>
<td colspan="4">
<input type="text" name="duty" lay-verify="required" lay-reqText="请输入负责人职务"
autocomplete="off" placeholder="请输入负责人职务" class="layui-input" value="{$detail.duty}">
</td>
<td class="layui-td-gray">电话<font>*</td>
<td colspan="4">
<input type="text" name="phone" lay-verify="required" lay-reqText="请输入负责人电话"
autocomplete="off" placeholder="请输入负责人电话" class="layui-input" value="{$detail.phone}">
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var lat = "{$detail.lat}";
var lng = "{$detail.lng}";
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) {
layer.msg('上传失败');
return false;
}
//上传成功
$('#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) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.areamanager/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,259 @@
{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[4])}==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[4]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
fixed: 'left',
field: 'supplyChain',
title: '供应链',
align: 'center',
templet: function (d)
{
var html = d.supplyChain.name;
return html;
},
width:120,
},{
field: 'brokerage',
title: '团队负责人',
align: 'center',
templet: function (d)
{
var html = d.principal ? '是': '否';
return html;
},
width:150,
},{
field: 'merchant',
title: '商户',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_name;
return html;
},
width:120,
},{
field: 'merchant',
title: '姓名',
align: 'center',
templet: function (d)
{
var html = d.merchant.real_name;
return html;
},
width:150,
},{
field: 'merchant',
title: '联系电话',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '店铺状态',
align: 'center',
templet: function (d)
{
var html = '<span style="color:#fbbc05">锁定</span>';
if (d.merchant.status == 1) {
html = '<span style="color:#12bb37">正常</span>';
}
return html;
},
},{
field: 'merchant',
title: '产品数量',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '产品数量',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '余额',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_money;
return html;
},
width:150,
},{
field: 'merchant',
title: '保证金',
align: 'center',
templet: function (d)
{
var html = d.merchant.margin;
return html;
},
width:150,
},{
field: 'order_number',
title: '销量',
align: 'center',
templet: function (d)
{
var html = d.merchant.sales;
return html;
},
width:150,
},{
field: 'merchant',
title: '商户地址',
templet: function (d)
{
var html = d.merchant.mer_address;
return html;
},
align: 'center',
width:150,
},{
field: 'merchant',
title: '入驻时间',
align: 'center',
templet: function (d)
{
var html = d.merchant.create_time;
return html;
},
width:150,
}
]
]
});
//监听表头工具栏事件
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[4]}?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?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('{$url[3]}', { id: data.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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -83,52 +83,62 @@ abstract class BaseController
//每页显示数据量
$this->pageSize = Request::param('page_size', \think\facade\Config::get('app.page_size'));
$token = Request::header('x-Token');
if ($token) {
if (strpos($token, 'Bearer') === 0){
$token = trim(substr($token, 6));
}
if (count(explode('.', $token)) != 3) {
return json(['code'=>404,'msg'=>'非法请求']);
}
$config = get_system_config('token');
//var_dump($config);exit;
try {
JWT::$leeway = 60;//当前时间减去60把时间留点余地
$decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式这里要和签发的时候对应
// 暂时去除 -----------------------------------------------------
// $token = Request::header('x-Token');
// if ($token) {
// if (strpos($token, 'Bearer') === 0){
// $token = trim(substr($token, 6));
// }
// if (count(explode('.', $token)) != 3) {
// return json(['code'=>404,'msg'=>'非法请求']);
// }
// $config = get_system_config('token');
//return (array)$decoded;
// $decoded_array = json_decode(json_encode($decoded),TRUE);
// $jwt_data = $decoded_array['data'];
// return json($token);
// JWT::$leeway = 60;//当前时间减去60把时间留点余地
// $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式这里要和签发的时候对应
$user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find();
if (!$user){
return json(['code'=>403,'msg'=>'签名错误']);
return false;
}
$user = Db::table('fa_user')->where('id',$user['n_user_id'])->find();
//$request->uid = $jwt_data['userid'];
define('JWT_UID', $user['id']);
// $response = $next($request);
// return $response;
//return $next($request);
} catch(\Firebase\JWT\SignatureInvalidException $e) { //签名不正确
return json(['code'=>403,'msg'=>'签名错误']);
}catch(\Firebase\JWT\BeforeValidException $e) { // 签名在某个时间点之后才能用
return json(['code'=>401,'msg'=>'token失效']);
}catch(\Firebase\JWT\ExpiredException $e) { // token过期
return json(['code'=>401,'msg'=>'token已过期']);
}catch(Exception $e) { //其他错误
return json(['code'=>404,'msg'=>'非法请求']);
}catch(\UnexpectedValueException $e) { //其他错误
return json(['code'=>404,'msg'=>'非法请求']);
} catch(\DomainException $e) { //其他错误
return json(['code'=>404,'msg'=>'非法请求']);
}
}else{
define('JWT_UID', '');
}
// return $decoded->jti[0];
// exit;
// //var_dump($config);exit;
// try {
// JWT::$leeway = 60;//当前时间减去60把时间留点余地
// $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式这里要和签发的时候对应
// //return (array)$decoded;
// // $decoded_array = json_decode(json_encode($decoded),TRUE);
// // $jwt_data = $decoded_array['data'];
// $user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find();
// if (!$user){
// return json(['code'=>403,'msg'=>'签名错误']);
// return false;
// }
// $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find();
// //$request->uid = $jwt_data['userid'];
// define('JWT_UID', $user['id']);
// // $response = $next($request);
// // return $response;
// //return $next($request);
// } catch(\Firebase\JWT\SignatureInvalidException $e) { //签名不正确
// return json(['code'=>403,'msg'=>'签名错误']);
// }catch(\Firebase\JWT\BeforeValidException $e) { // 签名在某个时间点之后才能用
// return json(['code'=>401,'msg'=>'token失效']);
// }catch(\Firebase\JWT\ExpiredException $e) { // token过期
// return json(['code'=>401,'msg'=>'token已过期']);
// }catch(Exception $e) { //其他错误
// return json(['code'=>404,'msg'=>'非法请求']);
// }catch(\UnexpectedValueException $e) { //其他错误
// return json(['code'=>404,'msg'=>'非法请求']);
// } catch(\DomainException $e) { //其他错误
// return json(['code'=>404,'msg'=>'非法请求']);
// }
// }else{
// define('JWT_UID', '');
// }
// 暂时去除 -----------------------------------------------------
}
/**

View File

@ -41,8 +41,8 @@ class Article extends BaseController
unset($where[1]);
}
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']];
@ -54,7 +54,7 @@ class Article extends BaseController
}
// 登录返回村名和村地址
$cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name');
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name');
}else{
$cun_arr = [];
}
@ -183,8 +183,8 @@ class Article extends BaseController
unset($where[1]);
}
// 如果登录
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']];
@ -312,8 +312,8 @@ class Article extends BaseController
['status', '=', 1],
];
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']];
@ -497,7 +497,7 @@ class Article extends BaseController
// if (!$res) {
// return $this->apiError($valdate->getError());
// }
$useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find();
$useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find();
$data = [];
if ($useraddress) {
@ -507,7 +507,7 @@ class Article extends BaseController
}
$data['end_time'] = date('Y-m-d H:i:s', strtotime('+1 day'));
$data['view_time'] = date('Y-m-d H:i:s');
$data['user_id'] = JWT_UID;//添加用户的id
$data['user_id'] = $this->request->uid;//添加用户的id
$data['category_id'] = $input['category_id'];//大分类id
$data['category_type'] = $input['category_type'];//小分类id
$data['title'] = $input['title'];//标题
@ -518,7 +518,7 @@ class Article extends BaseController
$data['image'] = $input['image'];//封面
$data['is_vote'] =empty($input['is_vote'])?0:$input['is_vote'];//是否投票
if ($input['category_id']==150){
$name=Db::table('fa_szxc_information_usermsg')->where('user_id',JWT_UID)->value('name');
$name=Db::table('fa_szxc_information_usermsg')->where('user_id',$this->request->uid)->value('name');
$data['title'] = '来自于'.$name.'的一键求救';
}
$res = Db::table('fa_article')->insertGetId($data);
@ -575,7 +575,7 @@ class Article extends BaseController
$data['describe'] = empty($input['describe'])?'':$input['describe'];//简介
$data['image'] = $input['image'];//封面
$data['is_vote'] = $input['is_vote'];//是否投票
$input['update_user_id'] = JWT_UID;//更新用户的id
$input['update_user_id'] = $this->request->uid;//更新用户的id
$res = Db::table('fa_article')->where('id', $id)->update($data);
if ($input['is_vote'] == 1) {
@ -596,8 +596,8 @@ class Article extends BaseController
{
// $model = Db::table('fa_article');
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']];
@ -650,12 +650,12 @@ class Article extends BaseController
{
// $model = Db::table('fa_article');
//根据个人id进行查询
$where[] = ['a.user_id','=',JWT_UID];
$where[] = ['a.user_id','=',$this->request->uid];
$where[] = ['b.is_read','=','0'];
$which = [];
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$www[] = ['a.village', '=', $find['village_id']];
@ -665,7 +665,7 @@ class Article extends BaseController
$www[] = ['a.county', '=', $find['area_id']];
}
}
$which['user_id'] = JWT_UID;
$which['user_id'] = $this->request->uid;
}
$yishi = Db::table('fa_article')->alias('a')->join(['fa_article_vote_side_tables' => 'b'],'a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count();
$maodun = Db::table('fa_article')->alias('a')->join(['fa_article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count();
@ -708,8 +708,8 @@ class Article extends BaseController
}
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']];
@ -721,7 +721,7 @@ class Article extends BaseController
}
// 登录返回村名和村地址
$cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name');
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name');
}else{
$cun_arr = [];
}

View File

@ -29,9 +29,9 @@ class User extends BaseController
* 会员中心.
*/
public function index()
{
$user = Db::table('fa_user')->where('id',JWT_UID)->find();
$user_msg = Db::table('fa_szxc_information_usermsg')->where('user_id',JWT_UID)->field('id,name,address_name,phone')->find();
{
$user = Db::table('fa_user')->where('id', $this->request->uid)->find();
$user_msg = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->field('id,name,address_name,phone')->find();
$this->apiSuccess('', [
'nickname' => $user['nickname'],
'phone'=>$user_msg['phone'],
@ -472,7 +472,7 @@ class User extends BaseController
// 获取实名认证信息
public function get_shiming(){
$uid = JWT_UID;
$uid = $this->request->uid;
$is_have = Db::table('cms_szxc_user_authentication')->where('user_id',$uid)->find();
if($is_have){
$this->apiSuccess('获取成功',$is_have);
@ -483,7 +483,7 @@ class User extends BaseController
// 获取后台账号信息
public function get_backstage(){
$uid = JWT_UID;
$uid = $this->request->uid;
$admin = Db::table('cms_admin')->where('user_id',$uid)->find();
if($admin){
$data['url'] = 'https://nk.lihaink.cn';

View File

@ -94,16 +94,17 @@ class Userinfo extends BaseController
public function Binding()
{
$post = get_params();
if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){
$this->apiError('缺少参数');
}
if($post['phone'] == 'undefined'){
$this->apiError('手机号错误');
}
$where['id'] = $this->request->uid;
$post['user_id'] = $this->request->uid;
$user = Db::table('fa_user')->where($where)->field('id,nickname,group_id,mobile,avatar,username,createtime,score')->find();
// 已绑定
if ($user) {
Db::startTrans();

View File

@ -664,7 +664,7 @@ class Village extends BaseController
})
->withAttr('is_dz', function ($value, $data) {
// 判断redis
$user_id = JWT_UID;
$user_id = $this->request->uid;
if($user_id){
$name = $user_id . $data['id'];
$is_zan = Cache::store('redis')->get($name);

View File

@ -6,4 +6,6 @@ return [
//验证勾股cms是否完成安装
\app\home\middleware\Install::class,
\app\api\middleware\AllowOriginMiddleware::class,
\app\api\middleware\Auth::class,
];

View File

@ -27,11 +27,12 @@ class Auth
if (count(explode('.', $token)) != 3) {
return json(['code'=>404,'msg'=>'非法请求']);
}
try {
JWT::$leeway = 60;//当前时间减去60把时间留点余地
$decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式这里要和签发的时候对应
$user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find();
if ($user &&$user['n_user_id']!=0){
if ($user && $user['n_user_id']!=0){
$request->uid=$user['n_user_id'];
}else{
$request->uid=$this->addUser($decoded->jti[0],$user);
@ -61,41 +62,41 @@ class Auth
$msg=Db::table('fa_szxc_information_usermsg')->where('phone',$user['account'])->find();
Db::startTrans();
try {
if ($msg){
$users=Db::table('fa_user')->where('id',$msg['user_id'])->find();
if (!$nk_user){
if ($msg){
$users=Db::table('fa_user')->where('id',$msg['user_id'])->find();
if (!$nk_user){
$datas=[
'user_id'=>$user['uid'],
'n_user_id'=>$msg['user_id'],
'group_id'=>$users['group_id']
];
Db::connect('shop')->name('nk_user')->insert($datas);
}else{
Db::connect('shop')->name('nk_user')->where('id',$nk_user['id'])->update(['user_id'=>$user['uid'],'group_id'=>$users['group_id']]);
}
}else{
$time=time();
$user_data=[
'openid'=>'wx'.$time,
'group_id'=>1,
'username'=>'wx'.$time,
'nickname'=>'微信用户'.$time,
'avatar'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230104/32a639be4ee32349705e947fbbd1e114.png',
'level'=>1,
'prevtime'=>$time,
'jointime'=>$time,
'createtime'=>$time,
'updatetime'=>$time,
'status'=>'normal'
];
$n_user_id= Db::table('fa_user')->insertGetId($user_data);
$datas=[
'user_id'=>$user['uid'],
'n_user_id'=>$msg['user_id'],
'group_id'=>$users['group_id']
'n_user_id'=>$n_user_id,
'group_id'=>1
];
Db::connect('shop')->name('nk_user')->insert($datas);
}else{
Db::connect('shop')->name('nk_user')->where('id',$nk_user['id'])->update(['user_id'=>$user['uid'],'group_id'=>$users['group_id']]);
}
}else{
$time=time();
$user_data=[
'openid'=>'wx'.$time,
'group_id'=>1,
'username'=>'wx'.$time,
'nickname'=>'微信用户'.$time,
'avatar'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230104/32a639be4ee32349705e947fbbd1e114.png',
'level'=>1,
'prevtime'=>$time,
'jointime'=>$time,
'createtime'=>$time,
'updatetime'=>$time,
'status'=>'normal'
];
$n_user_id= Db::table('fa_user')->insertGetId($user_data);
$datas=[
'user_id'=>$user['uid'],
'n_user_id'=>$n_user_id,
'group_id'=>1
];
Db::connect('shop')->name('nk_user')->insert($datas);
return $n_user_id;
return $n_user_id;
}
Db::commit();
} catch (\Exception $e) {

View File

@ -1,8 +0,0 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

View File

@ -1,51 +0,0 @@
#此文件为Nginx的伪静态文件 PHPCUSTOM官方网址http://www.phpcustom.com http://www.lccee.com
# 将以下是301跳转设置请自定修改为您的域名
if ($Host = 'xxx.com'){
rewrite ^/(.*)$ http://www.phpcustom.com/$1 permanent;
}
#以下为phpwind9.0伪静态规则,去掉下面的#即可生效
#------------------------------------------------------------------------------------------------
# if (-f $request_filename) {
# break;
# }
# if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
# break;
# }
# if (!-e $request_filename) {
# rewrite . /index.php last;
# }
# 这个是ThinkPHP V5伪静态规则示例 请去掉以下代码前边的#号即可生效
#------------------------------------------------------------------------------------------------
#if (!-e $request_filename) {
# rewrite ^(.*)$ /index.php?s=/$1 last;
# break;
# }
#------------------------------------------------------------------------------------------------