商品管理列表
This commit is contained in:
parent
3a9708470a
commit
c4935e1f1c
38
.env.debug
38
.env.debug
@ -8,11 +8,32 @@ default_lang = zh-cn
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 192.168.0.106
|
||||
HOSTNAME = 47.92.112.123
|
||||
DATABASE = nk_lihaink_cn
|
||||
PREFIX = cms_
|
||||
USERNAME = root
|
||||
PASSWORD = 123321a
|
||||
USERNAME = nk_lihaink_cn
|
||||
PASSWORD = 5MnmkZTW2tmahha7
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8mb4
|
||||
DEBUG = true
|
||||
|
||||
TYPE = mysql
|
||||
HOSTNAME = 47.92.112.123
|
||||
DATABASE = nk_lihaink_cn
|
||||
PREFIX = cms_
|
||||
USERNAME = view_oa_lihaink_cn
|
||||
PASSWORD = 5MnmkZTW2tmahha7
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8mb4
|
||||
DEBUG = true
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 47.92.112.123
|
||||
DATABASE = nk_lihaink_cn
|
||||
PREFIX = cms_
|
||||
USERNAME = view_oa_lihaink_cn
|
||||
PASSWORD = 5MnmkZTW2tmahha7
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8mb4
|
||||
DEBUG = true
|
||||
@ -26,4 +47,15 @@ PASSWORD = EeYym2PFctFfrMde
|
||||
DATABASE = shop_lihaink_com
|
||||
PREFIX = eb_
|
||||
CHARSET = utf8
|
||||
DEBUG = true
|
||||
|
||||
[DATABASESHOP]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 122.9.139.134
|
||||
HOSTPORT = 3306
|
||||
USERNAME = shop_lihaink_com
|
||||
PASSWORD = EeYym2PFctFfrMde
|
||||
DATABASE = shop_lihaink_com
|
||||
PREFIX = eb_
|
||||
CHARSET = utf8
|
||||
DEBUG = true
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
/.gitee
|
||||
*.log
|
||||
*.env
|
||||
*.env.debug
|
||||
*.lock
|
||||
*.ini
|
||||
.htaccess
|
||||
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* 表单页面
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商户管理
|
||||
*/
|
||||
namespace app\admin\controller\merchant\system;
|
||||
|
||||
|
252
app/admin/controller/product/Parameter.php
Normal file
252
app/admin/controller/product/Parameter.php
Normal file
@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月9日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商品参数列表与模板添加
|
||||
*/
|
||||
namespace app\admin\controller\product;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\StoreCategory; // 商品分类模型
|
||||
use app\admin\model\StoreProductReply; // 商品评论模型
|
||||
use app\admin\model\Guarantee as GuaranteeModel; // 商品保障服务模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
|
||||
use app\admin\model\store\paramter\ParameterTemplate as ParameterTemplateModel;//商品参数model
|
||||
use app\common\controller\FormatList;
|
||||
|
||||
/**
|
||||
*
|
||||
* 平台商品参数控制器
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Parameter extends BaseController
|
||||
{
|
||||
protected $url;
|
||||
protected $adminInfo;
|
||||
protected $temp;
|
||||
|
||||
public function __construct(ParameterTemplateModel $temp)
|
||||
{
|
||||
$this->adminInfo = get_login_admin();
|
||||
$this->temp = $temp;
|
||||
$this->url=[
|
||||
'/admin/product/params/index',
|
||||
'/admin/product/params/add',
|
||||
'/admin/product/params/edit',
|
||||
'/admin/product/params/del',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 非超级管理员登入 需更新当前用户所属地区
|
||||
* @param array $where 地区id数组
|
||||
* @return array $where 更改后的地区id数组
|
||||
*/
|
||||
protected function auth(array $where):array
|
||||
{
|
||||
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
|
||||
$www['admin_id'] = $this->adminInfo['id'];
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address){
|
||||
if($user_address['auth_range'] == 1){
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}elseif ($user_address['auth_range'] == 2){
|
||||
$where[] = ['street_id','=',$user_address['street_id']];
|
||||
}elseif ($user_address['auth_range'] == 3){
|
||||
$where[] = ['area_id','=',$user_address['area_id']];
|
||||
}else{
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['village_id','=',''];
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品参数列表
|
||||
* @
|
||||
*/
|
||||
public function index(StoreCategory $category)
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
// Ajax 获取列表数据
|
||||
|
||||
$params= get_params();
|
||||
|
||||
// 构建查询条件
|
||||
$where = [];
|
||||
if (isset($params['keywords']) && !empty($params['keywords'])){
|
||||
$where[]= ['name','like','%'.$params['keywords'].'%'];
|
||||
}
|
||||
$where = $this->auth($where);
|
||||
|
||||
// 获取列表数据
|
||||
$page = empty($params['page'])? 1 : (int)$params['page'];
|
||||
$limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit'];
|
||||
|
||||
$where['template_name'] = empty($params['template_name'])?'':$params['template_name'];
|
||||
$where['cate_id'] = empty($params['cate_id'])?'':$params['cate_id'];
|
||||
$where['mer_name'] = empty($params['mer_name'])?'':$params['mer_name'];
|
||||
$where['mer_id'] = empty($params['mer_id'])?'':$params['mer_id'];
|
||||
|
||||
if (isset($params['is_mer'])) {
|
||||
$merId = $params['mer_id'];
|
||||
$where['mer_id'] = $merId;
|
||||
unset($where['is_mer']);
|
||||
}
|
||||
$data = $this->temp->getList($where,$page, $limit);
|
||||
$data['list'] = [[
|
||||
'template_id'=>1,
|
||||
'template_name'=>'测试',
|
||||
'cateid'=>'',
|
||||
'sort'=>'1',
|
||||
'create_time'=> '2023-03-09 17:13:22',
|
||||
]];
|
||||
|
||||
return to_assign(0, '', $data);
|
||||
}else{
|
||||
// 初始空页面展示
|
||||
$where['mer_id'] = 0;
|
||||
$where['is_show'] = 0;
|
||||
$cate_list = $category->getList($where);
|
||||
$cate_list = FormatList::DropDownMenu($cate_list);
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('cate_list', $cate_list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['cate_name'] = $params['cate_name']; // 分类名称
|
||||
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
|
||||
$data['pid'] = $params['pid']; // 上级分类
|
||||
$data['sort'] = $params['sort']; // 排序
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据入库
|
||||
// $res = StoreBrandCategory::create($data);
|
||||
|
||||
// if ($res){
|
||||
// return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
// }
|
||||
|
||||
// return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['cate_name'] = $params['cate_name']; // 分类名称
|
||||
$data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示
|
||||
$data['pid'] = $params['pid']; // 上级分类
|
||||
$data['sort'] = $params['sort']; // 排序
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据更新
|
||||
$res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data);
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'更新成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '更新失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
$storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息
|
||||
|
||||
View::assign('detail', $storeBrandCtegory);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除
|
||||
*
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$id = get_params("id");
|
||||
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
// 验证下面是否有子分类
|
||||
if(StoreBrandCategory::where('pid', $id)->count())
|
||||
{
|
||||
return to_assign(1, '请先删除子分类!');
|
||||
}
|
||||
|
||||
$res = StoreBrandCategory::where('store_brand_category_id', $id)->delete();
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 子分类
|
||||
*
|
||||
*/
|
||||
public function street($pcode)
|
||||
{
|
||||
$storeBrandCategory = StoreBrandCategory::order('sort desc')
|
||||
->where('is_show', 1)
|
||||
->where('pid', $pcode)
|
||||
->select();
|
||||
|
||||
return json($storeBrandCategory);
|
||||
}
|
||||
|
||||
}
|
@ -11,12 +11,14 @@ use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\EbStoreProduct; // 商品模型
|
||||
use app\admin\model\StoreCategory; // 商品分类模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
use app\common\controller\FormatList;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -25,12 +27,17 @@ use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
*/
|
||||
class Product extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
|
||||
protected $adminInfo;
|
||||
protected $url;
|
||||
protected $product;
|
||||
|
||||
public function __construct(EbStoreProduct $product)
|
||||
{
|
||||
$this->adminInfo = get_login_admin();
|
||||
$this->category_id=354;
|
||||
$this->product = $product;
|
||||
$this->url=[
|
||||
'/admin/product.product/index?category_id='.$this->category_id,
|
||||
'/admin/product.product/index',
|
||||
'/admin/product.product/add',
|
||||
'/admin/product.product/edit',
|
||||
'/admin/product.product/delete',
|
||||
@ -38,42 +45,86 @@ class Product extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
protected function auth()
|
||||
{
|
||||
$where = [];
|
||||
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
|
||||
$www['admin_id'] = $this->adminInfo['id'];
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address){
|
||||
if($user_address['auth_range'] == 1){
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}elseif ($user_address['auth_range'] == 2){
|
||||
$where[] = ['street_id','=',$user_address['street_id']];
|
||||
}elseif ($user_address['auth_range'] == 3){
|
||||
$where[] = ['area_id','=',$user_address['area_id']];
|
||||
}else{
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['village_id','=',''];
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 供应链团队列表
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
public function index(StoreCategory $category)
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
if (true) {
|
||||
// request()->isAjax()
|
||||
// Ajax 前端获取数据
|
||||
$params= get_params();
|
||||
|
||||
$where = [];
|
||||
$where = self::auth();
|
||||
|
||||
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','=',''];
|
||||
}
|
||||
// $where[]= ['sotre_name','like','%'.$params['keywords'].'%'];
|
||||
$where['keywords'] = $where['store_name'] = $params['keywords'];
|
||||
}
|
||||
|
||||
$page = empty($params['page'])?1:$params['page'];
|
||||
$limit = empty($params['limit'])?10:$params['limit'];
|
||||
|
||||
// 平台商品分类id
|
||||
$where['cate_id'] = empty($params['plate_cate'])?'':$params['plate_cate'];
|
||||
|
||||
// 商户商品分类id
|
||||
$where['mer_cate_id'] = empty($params['store_cate'])?'':$params['store_cate'];
|
||||
$where['is_trader'] = isset($params['is_trader'])?$params['is_trader']:0; // 是否自营 1自营, 0 不是自营
|
||||
|
||||
// product
|
||||
$where['is_gift_bag'] = empty($params['is_gift'])?'':$params['is_gift'];
|
||||
$where['is_show'] = empty($params['state'])?'':$params['state'];
|
||||
$where['temp_id'] = empty($params['shipping_tem'])?'':$params['shipping_tem'];
|
||||
$where['labels'] = empty($params['tag'])?'':$params['tag'];
|
||||
$where['type'] = 1;//实体商品:0 虚拟商品:1
|
||||
$where['status'] = 0;//管理、审核、通过
|
||||
|
||||
|
||||
// $where['is_ficti'] = 1;//是否虚拟销量
|
||||
// $where['product_id'] = 0;
|
||||
// ['order','sort']
|
||||
// soft //软删除
|
||||
if (!empty(get_params('mer_id'))) {
|
||||
$mer_id = get_params('mer_id');
|
||||
$where = array_merge($where, $this->switchType($where['type'],$mer_id,0));
|
||||
}
|
||||
$mer_id = 77;
|
||||
|
||||
$this->product->getList($mer_id, $where, $page, $limit);
|
||||
|
||||
return;
|
||||
|
||||
$total = EbStoreProduct::where($where)->count();
|
||||
|
||||
|
||||
|
||||
$list = EbStoreProduct::with(['merchant' => ['merchantType', 'category']])->order('product_id desc')->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
@ -87,12 +138,77 @@ class Product extends BaseController
|
||||
|
||||
$list = SupplyChain::with(['merchant' => ['merchantType', 'category']])->select();
|
||||
|
||||
// 初始空页面展示
|
||||
$where['mer_id'] = 0;
|
||||
$where['is_show'] = 0;
|
||||
$cate_list = $category->getList($where);
|
||||
$cate_list = FormatList::DropDownMenu($cate_list);
|
||||
|
||||
View::assign('cate_list', $cate_list);
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 与类型相对应的sql字段
|
||||
*
|
||||
* @Author:Liuxiaoquan
|
||||
* @Date: 2020/5/18
|
||||
* @param $type 商
|
||||
* @param int|null $merId 商户id
|
||||
* @param int|null $productType 产品类型
|
||||
* @return array $where 条件
|
||||
*/
|
||||
public function switchType($type, ?int $merId = 0, $productType = 0)
|
||||
{
|
||||
$stock = 0;
|
||||
// 获得库存
|
||||
// if ($merId) $stock = merchantConfig($merId, 'mer_store_stock');
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$where = ['is_show' => 1, 'status' => 1,];
|
||||
break;
|
||||
case 2:
|
||||
$where = ['is_show' => 0, 'status' => 1];
|
||||
break;
|
||||
case 3:
|
||||
$where = ['is_show' => 1, 'stock' => 0, 'status' => 1];
|
||||
break;
|
||||
case 4:
|
||||
$where = ['stock' => $stock ? $stock : 0, 'status' => 1];
|
||||
break;
|
||||
case 5:
|
||||
$where = ['soft' => true];
|
||||
break;
|
||||
case 6:
|
||||
$where = ['status' => 0];
|
||||
break;
|
||||
case 7:
|
||||
$where = ['status' => -1];
|
||||
break;
|
||||
case 20:
|
||||
$where = ['status' => 1];
|
||||
break;
|
||||
default:
|
||||
// $where = ['is_show' => 1, 'status' => 1];
|
||||
break;
|
||||
}
|
||||
if ($productType == 0) {
|
||||
$where['product_type'] = $productType;
|
||||
if (!$merId) $where['is_gift_bag'] = 0;
|
||||
}
|
||||
if ($productType == 1) {
|
||||
$where['product_type'] = $productType;
|
||||
}
|
||||
if ($productType == 10) {
|
||||
$where['is_gift_bag'] = 1;
|
||||
}
|
||||
if (!$merId) $where['star'] = '';
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 时间:2023年03月04日
|
||||
* 作者:墨楠小
|
||||
@ -6,26 +7,171 @@
|
||||
* 订单模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class EbStoreProduct extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_store_product';
|
||||
protected $pk = 'product_id';
|
||||
namespace app\admin\model;
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户
|
||||
*
|
||||
*/
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
||||
use think\Model;
|
||||
use StoreCategory as StoreCategoryModel;
|
||||
|
||||
class EbStoreProduct extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_store_product';
|
||||
protected $pk = 'product_id';
|
||||
|
||||
protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id';
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户
|
||||
*
|
||||
*/
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO 商户商品列表
|
||||
* @Author:Qinii
|
||||
* @Date: 2020/5/11
|
||||
* @param int $merId
|
||||
* @param array $where
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getList(?int $mer_id, array $where, int $page, int $limit)
|
||||
{
|
||||
$query = self::search($mer_id, $where);
|
||||
// ->with(['merCateId.category', 'storeCategory', 'brand']);
|
||||
$count = $query->count();
|
||||
$data = $query->field($this->filed)->page($page, $limit)->select();
|
||||
|
||||
// $data->append(['us_status']);
|
||||
|
||||
// $list = hasMany(
|
||||
// $data,
|
||||
// 'mer_labels',
|
||||
// ProductLabel::class,
|
||||
// 'product_label_id',
|
||||
// 'mer_labels',
|
||||
// ['status' => 1],
|
||||
// 'product_label_id,product_label_id id,label_name name'
|
||||
// );
|
||||
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
|
||||
// public function StoreSpu()
|
||||
// {}
|
||||
|
||||
|
||||
/**
|
||||
* @Author:Qinii
|
||||
* @Date: 2020/5/11
|
||||
* @param int $merId
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
*/
|
||||
protected function search(?int $merId, array $where)
|
||||
{
|
||||
$keyArray = $whereArr = [];
|
||||
unset($where['type']);
|
||||
|
||||
// 以下字段为要搜索的字段
|
||||
$out = ['soft', 'us_status', 'mer_labels', 'sys_labels', 'order', 'hot_type'];
|
||||
foreach ($where as $key => $item) {
|
||||
if ($item !== '' && !in_array($key, $out)) {
|
||||
$keyArray[] = $key;
|
||||
$whereArr[$key] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
// $query = isset($where['soft']) ? model::onlyTrashed()->alias('Product') : model::alias('Product');
|
||||
|
||||
$query = self::alias('Product');
|
||||
if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
$query->hasWhere('merchant', function ($query) use ($where) {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
});
|
||||
}
|
||||
|
||||
$query->withSearch($keyArray, $whereArr)
|
||||
->Join('StoreSpu U', 'Product.product_id = U.product_id')->where('U.product_type', $where['product_type'] ?? 0)
|
||||
->when(($merId !== null), function ($query) use ($merId) {
|
||||
$query->where('Product.mer_id', $merId);
|
||||
})
|
||||
->when(isset($where['hot_type']) && $where['hot_type'] !== '', function ($query) use ($where) {
|
||||
if ($where['hot_type'] == 'new')
|
||||
$query->where('is_new', 1);
|
||||
else if ($where['hot_type'] == 'hot')
|
||||
$query->where('is_hot', 1);
|
||||
else if ($where['hot_type'] == 'best')
|
||||
$query->where('is_best', 1);
|
||||
else if ($where['hot_type'] == 'good')
|
||||
$query->where('is_benefit', 1);
|
||||
});
|
||||
|
||||
$query->when(
|
||||
isset($where['pid']) && $where['pid'] !== '',
|
||||
function ($query) use ($where) {
|
||||
$ids = array_merge(self::findChildrenId((int)$where['pid']), [(int)$where['pid']]);
|
||||
if (count($ids)) $query->whereIn('cate_id', $ids);
|
||||
}
|
||||
)
|
||||
->when(isset($where['us_status']) && $where['us_status'] !== '', function ($query) use ($where) {
|
||||
if ($where['us_status'] == 0) {
|
||||
$query->where('Product.is_show', 0)->where('Product.is_used', 1)->where('Product.status', 1);
|
||||
}
|
||||
if ($where['us_status'] == 1) {
|
||||
$query->where('Product.is_show', 1)->where('Product.is_used', 1)->where('Product.status', 1);
|
||||
}
|
||||
if ($where['us_status'] == -1) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('Product.is_used', 0)->whereOr('Product.status', '<>', 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%");
|
||||
})
|
||||
->when(isset($where['sys_labels']) && $where['sys_labels'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('U.sys_labels', "%,{$where['sys_labels']},%");
|
||||
})
|
||||
->when(isset($where['order']), function ($query) use ($where, $merId) {
|
||||
if (in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales'])) {
|
||||
if ($where['order'] == 'price_asc') {
|
||||
$where['order'] = 'price ASC';
|
||||
} else if ($where['order'] == 'price_desc') {
|
||||
$where['order'] = 'price DESC';
|
||||
} else {
|
||||
$where['order'] = $where['order'] . ' DESC';
|
||||
}
|
||||
$query->order($where['order'] . ',rank DESC ,create_time DESC ');
|
||||
} else if ($where['order'] !== '') {
|
||||
$query->order('U.' . $where['order'] . ' DESC,U.create_time DESC');
|
||||
} else {
|
||||
$query->order('U.create_time DESC');
|
||||
}
|
||||
})
|
||||
->when(isset($where['star']), function ($query) use ($where) {
|
||||
$query->when($where['star'] !== '', function ($query) use ($where) {
|
||||
$query->where('U.star', $where['star']);
|
||||
});
|
||||
$query->order('U.star DESC,U.rank DESC,Product.create_time DESC');
|
||||
});
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function findChildrenId($id)
|
||||
{
|
||||
return StoreCategoryModel::whereLike('path', '%/'. $id . '/%')->column('store_category_id');
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,49 @@
|
||||
return $this->hasOne(StoreCategory::class, 'store_category_id', 'pid');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类表数据
|
||||
*@author Liuxiaoquan
|
||||
*
|
||||
*@param array $where 查询条件
|
||||
*@return object|array $list 查询商品分类结果集
|
||||
*/
|
||||
public function getList($where)
|
||||
{
|
||||
$where['is_show'] = empty($where['is_show'])? 1 : $where['is_show'];
|
||||
$list = self::search($where)
|
||||
->field('store_category_id as id,pid,cate_name,path,sort,pic,level,is_hot')
|
||||
->order('sort DESC')->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询语句构建
|
||||
*@author Liuxiaoquan
|
||||
*
|
||||
*@param array $where 查询条件
|
||||
*@return Query
|
||||
*/
|
||||
protected function search($where)
|
||||
{
|
||||
$query = self::when(isset($where['mer_id'])&&$where['mer_id']!=='',
|
||||
function ($query)use($where) {
|
||||
$query->where('mer_id', $where['mer_id']);
|
||||
}
|
||||
)
|
||||
->when(isset($where['level'])&&$where['level']!=='',
|
||||
function($query)use($where){
|
||||
$query->where('level', $where['level']);
|
||||
}
|
||||
)
|
||||
->when(isset($where['is_show'])&&$where['is_show']!=='',
|
||||
function($query)use($where){
|
||||
$query->where('is_show', $where['is_show']);
|
||||
}
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
59
app/admin/model/store/paramter/Parameter.php
Normal file
59
app/admin/model/store/paramter/Parameter.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model\store\paramter;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Parameter extends Model
|
||||
{
|
||||
protected $connection = 'shop';
|
||||
protected $pk = 'parameter_id';
|
||||
|
||||
|
||||
// public static function tablePk(): string
|
||||
// {
|
||||
// return 'parameter_id';
|
||||
// }
|
||||
|
||||
// public static function tableName(): string
|
||||
// {
|
||||
// return 'parameter';
|
||||
// }
|
||||
|
||||
public function searchTemplateIdAttr($query, $value)
|
||||
{
|
||||
$query->where('template_id',$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 搜索
|
||||
* @param $where
|
||||
*/
|
||||
public function getSearch(array $where)
|
||||
{
|
||||
foreach ($where as $key => $item) {
|
||||
if ($item !== '') {
|
||||
$keyArray[] = $key;
|
||||
$whereArr[$key] = $item;
|
||||
}
|
||||
}
|
||||
// var_dump($where);
|
||||
$class = get_called_class();
|
||||
if(empty($keyArray)){
|
||||
return $class::self();
|
||||
}else{
|
||||
return $class::withSearch($keyArray, $whereArr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
129
app/admin/model/store/paramter/ParameterTemplate.php
Normal file
129
app/admin/model/store/paramter/ParameterTemplate.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月9日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商品参数列表与模板添加
|
||||
*/
|
||||
namespace app\admin\model\store\paramter;
|
||||
|
||||
use think\Model;
|
||||
use app\common\model\merchant\system\merchant\Merchant;
|
||||
use app\common\model\merchant\system\Relevance;
|
||||
// use app\admin\model\store\paramter\Parameter as ParameterModel;
|
||||
|
||||
class ParameterTemplate extends Model
|
||||
{
|
||||
|
||||
protected $connection = 'shop';
|
||||
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'template_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'eb_parameter_template';
|
||||
}
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class,'mer_id','mer_id');
|
||||
}
|
||||
|
||||
public function parameter()
|
||||
{
|
||||
return $this->hasMany(Parameter::class,'template_id','template_id');
|
||||
}
|
||||
|
||||
public function cateId()
|
||||
{
|
||||
return $this->hasMany(Relevance::class,'left_id','template_id')->where('type', 'product_params_cate');
|
||||
}
|
||||
|
||||
public function searchCateIdAttr($query, $value)
|
||||
{
|
||||
$id = Relevance::where('right_id',$value)->where('type', 'product_params_cate')->column('left_id');
|
||||
$query->where('template_id','in',$id);
|
||||
}
|
||||
|
||||
public function searchTemplateNameAttr($query, $value)
|
||||
{
|
||||
$query->whereLike('template_name',"%{$value}%");
|
||||
}
|
||||
|
||||
public function searchTemplateIdsAttr($query, $value)
|
||||
{
|
||||
$query->whereIn('template_id',$value);
|
||||
}
|
||||
|
||||
public function searchMerIdAttr($query, $value)
|
||||
{
|
||||
$query->where('mer_id',$value);
|
||||
}
|
||||
|
||||
public function searchMerNameAttr($query, $value)
|
||||
{
|
||||
$value = Merchant::whereLike('mer_name',"%{$value}%")->coupon('mer_id');
|
||||
$query->whereIn('mer_id',$value);
|
||||
}
|
||||
|
||||
public function searchIsMerAttr($query, $value)
|
||||
{
|
||||
if ($value == 1) {
|
||||
$query->where('mer_id','>',0);
|
||||
} else {
|
||||
$query->where('mer_id',0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getList($where, $page, $limit)
|
||||
{
|
||||
$paramterModel = new Parameter();
|
||||
$query = self::getSearch($where)->field('template_id,mer_id,template_name,sort,create_time')
|
||||
->with([
|
||||
'cateId' => function($query){
|
||||
$query->with(['category' =>function($query) {
|
||||
$query->field('store_category_id,cate_name');
|
||||
}]);
|
||||
},
|
||||
'merchant' => function($query) {
|
||||
$query->field('mer_id,mer_name');
|
||||
}
|
||||
// 'parameter' =>function($query){
|
||||
// $query->field('parameter_id,template_id,name,value,sort')->order('sort DESC');
|
||||
// }
|
||||
])
|
||||
->order('sort DESC,create_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 搜索
|
||||
* @param $where
|
||||
*/
|
||||
public static function getSearch(array $where)
|
||||
{
|
||||
foreach ($where as $key => $item) {
|
||||
if ($item !== '') {
|
||||
$keyArray[] = $key;
|
||||
$whereArr[$key] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($keyArray)){
|
||||
return new self;
|
||||
}else{
|
||||
return self::withSearch($keyArray, $whereArr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
35
app/admin/model/store/paramter/ParameterValue.php
Normal file
35
app/admin/model/store/paramter/ParameterValue.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\store\parameter;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class ParameterValue extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'parameter_attr_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'parameter_value';
|
||||
}
|
||||
|
||||
public function parameter()
|
||||
{
|
||||
return $this->hasOne(Parameter::class,'parameter_id','parameter_id');
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商户菜单路由
|
||||
*/
|
||||
use think\facade\Route;
|
||||
use app\common\middleware\AdminAuthMiddleware;
|
||||
use app\common\middleware\AdminTokenMiddleware;
|
||||
|
176
app/admin/route/product.php
Normal file
176
app/admin/route/product.php
Normal file
@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月9日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商户管理路由
|
||||
*/
|
||||
use think\facade\Route;
|
||||
|
||||
Route::group(function () {
|
||||
|
||||
//参数模板
|
||||
Route::group('/product/params', function () {
|
||||
Route::get('index', '/index')->name('merchantStoreParameterTemplateLst')->option([
|
||||
'_alias' => '列表',
|
||||
]);
|
||||
Route::get('detail/:id', '/detail')->name('merchantStoreParameterTemplateDetail')->option([
|
||||
'_alias' => '详情',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('merchantStoreParameterTemplateDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
Route::get('add', '/add')->name('merchantStoreParameterTemplateCreate')->option([
|
||||
'_alias' => '添加',
|
||||
]);
|
||||
Route::post('update/:id', '/update')->name('merchantStoreParameterTemplateUpdate')->option([
|
||||
'_alias' => '编辑',
|
||||
]);
|
||||
Route::get('select', '/select')->option([
|
||||
'_alias' => '筛选列表',
|
||||
'_auth' => false,
|
||||
]);
|
||||
// Route::get('temp/show', '/show')->option([
|
||||
// '_alias' => '参数',
|
||||
// '_auth' => false,
|
||||
// ]);
|
||||
})->prefix('product.Parameter')->option([
|
||||
'_path' => '/product/params',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
//商品
|
||||
Route::group('store/product', function () {
|
||||
Route::get('config', '/config')->option([
|
||||
'_alias' => '配置',
|
||||
'_auth' => false,
|
||||
]);
|
||||
Route::get('lst_filter', '/getStatusFilter')->name('merchantStoreProductLstFilter')->option([
|
||||
'_alias' => '头部统计',
|
||||
]);
|
||||
Route::get('lst', '/lst')->name('merchantStoreProductLst')->option([
|
||||
'_alias' => '列表',
|
||||
]);
|
||||
Route::get('list', '/lst')->option([
|
||||
'_alias' => '列表',
|
||||
'_auth' => false,
|
||||
]);
|
||||
Route::post('create', '/create')->name('merchantStoreProductCreate')->option([
|
||||
'_alias' => '添加',
|
||||
]);
|
||||
Route::get('detail/:id', '/detail')->name('merchantStoreProductDetail')->option([
|
||||
'_alias' => '详情',
|
||||
]);
|
||||
Route::get('temp_key', '/temp_key')->name('merchantStoreProductTempKey')->option([
|
||||
'_alias' => '上传视频配置',
|
||||
]);
|
||||
Route::post('update/:id', '/update')->name('merchantStoreProductUpdate')->option([
|
||||
'_alias' => '编辑',
|
||||
]);
|
||||
Route::post('free_trial/:id', '/freeTrial')->name('merchantStoreProductFreeTrial')->option([
|
||||
'_alias' => '免审编辑',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('merchantStoreProductDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
Route::delete('destory/:id', '/destory')->name('merchantStoreProductDestory')->option([
|
||||
'_alias' => '加入回收站',
|
||||
]);
|
||||
Route::post('restore/:id', '/restore')->name('merchantStoreProductRestore')->option([
|
||||
'_alias' => '恢复',
|
||||
]);
|
||||
Route::post('status/:id', '/switchStatus')->name('merchantStoreProductSwitchStatus')->option([
|
||||
'_alias' => '上下架',
|
||||
]);
|
||||
Route::post('batch_status', '/batchShow')->name('merchantStoreProductSwitchBatchStatus')->option([
|
||||
'_alias' => '批量上下架',
|
||||
]);
|
||||
Route::post('batch_temp', '/batchTemplate')->name('merchantStoreProductSwitchBatchTemplate')->option([
|
||||
'_alias' => '批量设置运费模板',
|
||||
]);
|
||||
Route::post('batch_labels', '/batchLabels')->name('merchantStoreProductSwitchBatchLabels')->option([
|
||||
'_alias' => '批量设置标签',
|
||||
]);
|
||||
Route::post('batch_hot', '/batchHot')->name('merchantStoreProductSwitchBatchHot')->option([
|
||||
'_alias' => '批量设置推荐',
|
||||
]);
|
||||
Route::post('batch_ext', '/batchExtension')->name('merchantStoreProductSwitchBatchExtension')->option([
|
||||
'_alias' => '批量设置推荐',
|
||||
]);
|
||||
Route::post('batch_svip', '/batchSvipType')->name('merchantStoreProductSwitchBatchSvipType')->option([
|
||||
'_alias' => '批量设置会员价',
|
||||
]);
|
||||
Route::post('sort/:id', '/updateSort')->name('merchantStoreProductUpdateSort')->option([
|
||||
'_alias' => '排序',
|
||||
]);
|
||||
Route::post('preview', '/preview')->name('merchantStoreProductPreview')->option([
|
||||
'_alias' => '预览',
|
||||
]);
|
||||
Route::post('labels/:id', '/setLabels')->name('merchantStoreProductLabels')->option([
|
||||
'_alias' => '标签',
|
||||
]);
|
||||
Route::get('attr_value/:id', '/getAttrValue')->name('merchantStoreProductAttrValue')->option([
|
||||
'_alias' => '获取规格',
|
||||
]);
|
||||
})->prefix('merchant.store.product.Product')->option([
|
||||
'_path' => '/product/list',
|
||||
'_auth' => true,
|
||||
'_append'=> [
|
||||
[
|
||||
'_name' =>'merchantUploadImage',
|
||||
'_path' =>'/product/list',
|
||||
'_alias' => '上传图片',
|
||||
'_auth' => true,
|
||||
],
|
||||
[
|
||||
'_name' =>'merchantAttachmentLst',
|
||||
'_path' =>'/product/list',
|
||||
'_alias' => '图片列表',
|
||||
'_auth' => true,
|
||||
],
|
||||
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
//商品标签
|
||||
Route::group('product/label', function () {
|
||||
Route::get('lst', '/lst')->name('merchantStoreProductLabelLst')->option([
|
||||
'_alias' => '列表',
|
||||
]);
|
||||
Route::get('create/form', '/createForm')->name('merchantStoreProductLabelCreateForm')->option([
|
||||
'_alias' => '添加表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'merchantStoreProductLabelCreate',
|
||||
]);
|
||||
Route::post('create', '/create')->name('merchantStoreProductLabelCreate')->option([
|
||||
'_alias' => '添加',
|
||||
]);
|
||||
Route::get('update/:id/form', '/updateForm')->name('merchantStoreProductLabelUpdateForm')->option([
|
||||
'_alias' => '编辑表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'merchantStoreProductLabelUpdate',
|
||||
]);
|
||||
Route::post('update/:id', '/update')->name('merchantStoreProductLabelUpdate')->option([
|
||||
'_alias' => '编辑',
|
||||
]);
|
||||
Route::get('detail/:id', '/detail')->name('merchantStoreProductLabelDetail')->option([
|
||||
'_alias' => '详情',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('merchantStoreProductLabelDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
Route::post('status/:id', '/switchWithStatus')->name('merchantStoreProductLabelStatus')->option([
|
||||
'_alias' => '修改状态',
|
||||
]);
|
||||
Route::get('option', '/getOptions')->option([
|
||||
'_alias' => '筛选',
|
||||
'_auth' => false,
|
||||
]);
|
||||
|
||||
})->prefix('merchant.store.product.ProductLabel')->option([
|
||||
'_path' => '/product/label',
|
||||
'_auth' => true,
|
||||
]);
|
||||
});
|
@ -116,7 +116,7 @@
|
||||
|
||||
<label class="layui-form-label">保证金状态</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="status" lay-filter="status">
|
||||
<select class="test_state" name="status" lay-filter="status">
|
||||
<option value=""></option>
|
||||
<option value="0">写作</option>
|
||||
<option value="1">阅读</option>
|
||||
@ -231,6 +231,7 @@
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table, tool = layui.tool, form = layui.form;
|
||||
|
||||
layui.pageTable = table.render({
|
||||
elem: '#reduct_list',
|
||||
title: '保证金列表',
|
||||
@ -362,6 +363,32 @@
|
||||
|
||||
});
|
||||
|
||||
// 获取表单所有参数
|
||||
function getformdata() {
|
||||
var form = $('#filterform').serializeArray();
|
||||
var data = new Array();
|
||||
for(let i=0;i<form.length; i++){
|
||||
data[form[i].name] = form[i].value;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var $ = layui.$, active = {
|
||||
reload: function(){
|
||||
let dataRload = getformdata();;
|
||||
|
||||
//执行重载
|
||||
table.reload('testReload', {
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
}
|
||||
,where: {
|
||||
...dataRload
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//监听表头工具栏事件
|
||||
// table.on('toolbar(store_product)', function (obj) {
|
||||
@ -374,7 +401,7 @@
|
||||
//监听表格行工具事件
|
||||
table.on('tool(reduct_list)', function (obj) {
|
||||
var data = obj.data;
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
if (obj.event === 'reduct') {
|
||||
tool.side('/admin/margin/form?id=' + obj.data.mer_id);
|
||||
} else if (obj.event === 'record') {
|
||||
@ -398,17 +425,6 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
// 获取表单所有参数
|
||||
function getformdata() {
|
||||
var form = $('#filterform').serializeArray();
|
||||
var data = new Array();
|
||||
for(let i=0;i<form.length; i++){
|
||||
data[form[i].name] = form[i].value;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
@ -439,6 +455,12 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听
|
||||
$('.test_state .layui-btn').on('click', function(){
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
// 日期范围
|
||||
layui.use(['laydate','element', 'jquery'],
|
||||
function () {
|
||||
|
178
app/admin/view/product/parameter/add.html
Normal file
178
app/admin/view/product/parameter/add.html
Normal file
@ -0,0 +1,178 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
.layui-td-gray {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.addrhelper-ok-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">添加</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">参数模板名称<font>*</font></td>
|
||||
<td colspan="4">
|
||||
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入品牌名称"
|
||||
autocomplete="off" placeholder="请输入品牌名称" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
|
||||
class="layui-input">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
<tr>
|
||||
<th>参数名称</th>
|
||||
<th>参数值</th>
|
||||
<th>排序</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入参数名称"
|
||||
autocomplete="off" placeholder="请输入参数名称" class="layui-input">
|
||||
</td>
|
||||
<td >
|
||||
<input type="text" name="brand_name" lay-verify="required" lay-reqText="请输入参数值"
|
||||
autocomplete="off" placeholder="请输入参数值" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="sort" lay-verify="required"
|
||||
autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
删除
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="add_paramter">添加参数</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
|
||||
<script>
|
||||
const editorType = '{$editor}';
|
||||
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool, laydate = layui.laydate;
|
||||
var editor = layui.tinymce;
|
||||
var edit = editor.render({
|
||||
selector: "#container_content",
|
||||
height: 500
|
||||
});
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
setTimeout(function () {
|
||||
parent.location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
tool.post('/admin/product.band/add', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
form.on('select(storeBrandCategory)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'brand_category_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'cate_name',
|
||||
value: 'store_brand_category_id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false,
|
||||
|
||||
});
|
||||
|
||||
$.get('/admin/product.brandClassify/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
165
app/admin/view/product/parameter/edit.html
Normal file
165
app/admin/view/product/parameter/edit.html
Normal 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}
|
||||
<!-- /脚本 -->
|
195
app/admin/view/product/parameter/index.html
Normal file
195
app/admin/view/product/parameter/index.html
Normal file
@ -0,0 +1,195 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<form class="layui-form gg-form-bar border-t border-x" style="display:flex;justify-content: 'space-around';">
|
||||
<div>
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="请输入参数模板名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td style="padding-right:10px;">
|
||||
<b>平台分类 </b>
|
||||
</td>
|
||||
<td>
|
||||
<select name="pid" lay-filter="seleCate" lay-verify="required" lay-reqText="请选择">
|
||||
<option value="0">请选择</option>
|
||||
{volist name="$cate_list" id="v"}
|
||||
<option value="{$v.id}" >{$v.title}{$v.cate_name} </option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<table class="layui-hide" id="article" lay-filter="article"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="thumb">
|
||||
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加参数模板">+ 添加参数模板</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group">
|
||||
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if} -->
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table,tool = layui.tool, form = layui.form;
|
||||
layui.pageTable = table.render({
|
||||
elem: '#article',
|
||||
title: '列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '{$url[0]}',
|
||||
parseData: function(res){ //res 即为原始返回的数据
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.data.count, //解析数据长度
|
||||
"data": res.data.list //解析数据列表
|
||||
};
|
||||
},
|
||||
page: true,
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'template_id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width:80,
|
||||
},{
|
||||
field: 'template_name',
|
||||
title: '模板名称',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'cateid',
|
||||
title: '关联分类',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(article)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side('{$url[1]}');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('{$url[2]}?id='+obj.data.brand_id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('{$url[2]}?id='+obj.data.brand_id);
|
||||
}
|
||||
else if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete('{$url[3]}', { id: data.brand_id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听分类提交
|
||||
form.on('select(seleCate)', function(data) {
|
||||
console.log(data);
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,14 +1,145 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<style>
|
||||
.layui-input-inline{
|
||||
width:35% !important;
|
||||
}
|
||||
.layui-input-inline .layui-form-item{
|
||||
display:flex;
|
||||
}
|
||||
.layui-input-inline .layui-form-item .layui-form-label{
|
||||
width:30%;
|
||||
}
|
||||
.layui-input-block{
|
||||
margin-left:unset !important;
|
||||
width:75%;
|
||||
}
|
||||
</style>
|
||||
<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="layui-form">
|
||||
<form id="filterform" class="layui-form gg-form-bar border-t border-x" >
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">平台商品分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="plate_cate" name="plate_cate" lay-filter="seleform">
|
||||
<option value="">请选择商品分类</option>
|
||||
{volist name="$cate_list" id="v"}
|
||||
<option value="{$v.id}" >{$v.title}{$v.cate_name} </option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商户商品分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="store_cate" lay-filter="seleform">
|
||||
<option value=""></option>
|
||||
<option value="10">自营</option>
|
||||
<option value="11">非自营</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否为礼包</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="is_gift" lay-filter="seleform">
|
||||
<option value=""></option>
|
||||
<option value="0">是</option>
|
||||
<option value="1">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品状态</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="state" lay-filter="seleform">
|
||||
<option value=""></option>
|
||||
<option value="0">上架</option>
|
||||
<option value="1">下架</option>
|
||||
<option value="2">平台关闭</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标签</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="tag" lay-filter="seleform" data-type="reload">
|
||||
<option value=""></option>
|
||||
<option value="0">写作</option>
|
||||
<option value="1">阅读</option>
|
||||
<option value="2">游戏</option>
|
||||
<option value="3">音乐</option>
|
||||
<option value="4">旅行</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">运费模板</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="shipping_tem" lay-filter="seleform">
|
||||
<option value=""></option>
|
||||
<option value="0">写作</option>
|
||||
<option value="1">阅读</option>
|
||||
<option value="2">游戏</option>
|
||||
<option value="3">音乐</option>
|
||||
<option value="4">旅行</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline" style="display:flex;">
|
||||
<label class="layui-form-label">关键字搜索</label>
|
||||
|
||||
<div class="layui-input-block" style="display:flex">
|
||||
<div class="layui-input-inline" style="width: 78% !important">
|
||||
<input type="text" name="keywords" placeholder="请输入商品名称、关键字" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="layui-hide" id="article" lay-filter="article"></table>
|
||||
</div>
|
||||
|
||||
@ -206,29 +337,67 @@
|
||||
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(){
|
||||
layui.use(['rate','table'], function(){
|
||||
var rate = layui.rate;
|
||||
|
||||
//基础效果
|
||||
rate.render({
|
||||
elem: '#is_good'
|
||||
})
|
||||
|
||||
var $ = layui.$, active = {
|
||||
reload: function(){
|
||||
let dataRload = getformdata();;
|
||||
console.log(dataRload)
|
||||
//执行重载
|
||||
table.reload('article', {
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
}
|
||||
,where: {
|
||||
...dataRload
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
...data.field
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听select提交
|
||||
form.on('select(seleform)', function(data) {
|
||||
active['reload'] ? active['reload'].call(this) : '';
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 获取表单所有参数
|
||||
function getformdata() {
|
||||
var form = $('#filterform').serializeArray();
|
||||
var data = new Array();
|
||||
for(let i=0;i<form.length; i++){
|
||||
data[form[i].name] = form[i].value;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -21,7 +21,7 @@ class FormatList
|
||||
*
|
||||
* @date 2023-03-3
|
||||
*/
|
||||
function FormatCategory(array $data, string $idName = "id", string $fieldName = 'pid', $childrenKey = 'children')
|
||||
static function FormatCategory(array $data, string $idName = "id", string $fieldName = 'pid', $childrenKey = 'children')
|
||||
{
|
||||
$items = [];
|
||||
foreach ($data as $item) {
|
||||
@ -49,22 +49,23 @@ class FormatList
|
||||
*
|
||||
* @date 2023-03-3
|
||||
*/
|
||||
function DropDownMenu($result, $pid = 0, $level=-1)
|
||||
static function DropDownMenu($data, $pid = 0, $level=-1)
|
||||
{
|
||||
/*记录排序后的类别数组*/
|
||||
static $list = array();
|
||||
static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─'];
|
||||
$level++;
|
||||
foreach ($result as $k => $v) {
|
||||
foreach ($data as $k => $v) {
|
||||
if ($v['pid'] == $pid) {
|
||||
if ($pid != 0) {
|
||||
$v['title'] = $space[$level] . $v['title'];
|
||||
}
|
||||
/*将该类别的数据放入list中*/
|
||||
$list[] = $v;
|
||||
self::DropDownMenu($result, $v['id'],$level);
|
||||
self::DropDownMenu($data, $v['id'],$level);
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
104
app/common/model/merchant/system/Relevance.php
Normal file
104
app/common/model/merchant/system/Relevance.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月9日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商品参数关联表
|
||||
*/
|
||||
namespace app\common\model\merchant\system;
|
||||
|
||||
use app\common\model\merchant\store\product\Spu;
|
||||
use think\Model;
|
||||
use app\common\model\merchant\community\Community;
|
||||
use app\common\model\merchant\store\StoreCategory;
|
||||
use app\common\model\merchant\system\auth\Menu;
|
||||
use app\common\model\merchant\system\merchant\Merchant;
|
||||
use app\common\model\merchant\user\User;
|
||||
|
||||
class Relevance extends Model
|
||||
{
|
||||
protected $connetion = 'shop';
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @return string
|
||||
* @author Qinii
|
||||
* @day 10/26/21
|
||||
*/
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'relevance_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @return string
|
||||
* @author Qinii
|
||||
* @day 10/26/21
|
||||
*/
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'relevance';
|
||||
}
|
||||
|
||||
public function fans()
|
||||
{
|
||||
return $this->hasOne(User::class,'uid','left_id');
|
||||
}
|
||||
|
||||
public function focus()
|
||||
{
|
||||
return $this->hasOne(User::class,'uid','right_id');
|
||||
}
|
||||
|
||||
public function community()
|
||||
{
|
||||
return $this->hasOne(Community::class,'community_id','right_id')
|
||||
->bind(['community_id','title','image','start','uid','create_time','count_start','author','is_type']);
|
||||
}
|
||||
|
||||
public function getIsStartAttr()
|
||||
{
|
||||
return self::where('left_id', $this->right_id)
|
||||
->where('right_id',$this->left_id)
|
||||
->where('type', 'fans')
|
||||
->count() > 0;
|
||||
}
|
||||
|
||||
public function spu()
|
||||
{
|
||||
return $this->hasOne(Spu::class, 'spu_id','right_id');
|
||||
}
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id','right_id');
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne(StoreCategory::class, 'store_category_id','right_id');
|
||||
}
|
||||
|
||||
|
||||
public function auth()
|
||||
{
|
||||
return $this->hasOne(Menu::class, 'menu_id','right_id');
|
||||
}
|
||||
|
||||
public function searchLeftIdAttr($query, $value)
|
||||
{
|
||||
$query->where('left_id', $value);
|
||||
}
|
||||
|
||||
public function searchRightIdAttr($query, $value)
|
||||
{
|
||||
$query->where('right_id', $value);
|
||||
}
|
||||
|
||||
public function searchTypeAttr($query, $value)
|
||||
{
|
||||
$query->where('type', $value);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user