重新提交冲突文件

This commit is contained in:
liuxiaoquan 2023-03-16 12:18:52 +08:00
parent a67c1beafa
commit 8cd4ef91f6
37 changed files with 4983 additions and 4885 deletions

5
\ Normal file
View File

@ -0,0 +1,5 @@
合并分支:更新
# 请输入一个提交信息以解释此合并的必要性,尤其是将一个更新后的上游分支
# 合并到主题分支。
#
# 以 '#' 开头的行将被忽略,而且空提交说明将会终止提交。

View File

@ -1,77 +1,77 @@
<?php
/**
* 商城 cache 管理
* 说明: 主要是一些说明、协议之类的文档管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
namespace app\admin\controller\merchant\system;
use app\admin\BaseController;
use think\App;
use app\common\model\merchant\system\Cache as CacheModel;
class Cache extends BaseController
{
protected $cache;
public function __construct(App $app, CacheModel $cache)
{
parent::__construct($app);
$this->cache = $cache;
}
/**
*
*/
public function getKeyLst()
{
$type = $this->request->param('type',0);
$data = $this->cache->getAgreeList($type);
return to_assign(0,'',$data);
}
/**
* @return mixed
*/
public function getAgree($key)
{
$allow = $this->cache->getAgreeKey();
if (!in_array($key, $allow)) return app('json')->fail('数据不存在');
$data = $this->cache->getResult($key);
return to_assign(0,'success', $data);
}
/**
* @return mixed
*/
public function saveAgree($key)
{
$allow = $this->cache->getAgreeKey();
if (!in_array($key, $allow)) return app('json')->fail('KEY不存在');
$value = get_params('agree');
$this->cache->saveCache($key, $value);
if ($key == CacheModel::USER_PRIVACY)
$this->cache->setUserAgreement($value);
if ($key == CacheModel::USER_AGREE)
$this->cache->setUserRegister($value);
return to_assign(0, '保存成功');
}
/**
* TODO 清除缓存
* @return \think\response\Json
*/
public function clearCache()
{
return to_assign(0,'清除缓存成功');
}
<?php
/**
* 商城 cache 管理
* 说明: 主要是一些说明、协议之类的文档管理
*
* @author刘孝全
* @emailq8197264@126.com
* @date 2023年03月3日
*/
namespace app\admin\controller\merchant\system;
use app\admin\BaseController;
use think\App;
use app\common\model\merchant\system\Cache as CacheModel;
class Cache extends BaseController
{
protected $cache;
public function __construct(App $app, CacheModel $cache)
{
parent::__construct($app);
$this->cache = $cache;
}
/**
*
*/
public function getKeyLst()
{
$type = $this->request->param('type',0);
$data = $this->cache->getAgreeList($type);
return to_assign(0,'',$data);
}
/**
* @return mixed
*/
public function getAgree($key)
{
$allow = $this->cache->getAgreeKey();
if (!in_array($key, $allow)) return app('json')->fail('数据不存在');
$data = $this->cache->getResult($key);
return to_assign(0,'success', $data);
}
/**
* @return mixed
*/
public function saveAgree($key)
{
$allow = $this->cache->getAgreeKey();
if (!in_array($key, $allow)) return app('json')->fail('KEY不存在');
$value = get_params('agree');
$this->cache->saveCache($key, $value);
if ($key == CacheModel::USER_PRIVACY)
$this->cache->setUserAgreement($value);
if ($key == CacheModel::USER_AGREE)
$this->cache->setUserRegister($value);
return to_assign(0, '保存成功');
}
/**
* TODO 清除缓存
* @return \think\response\Json
*/
public function clearCache()
{
return to_assign(0,'清除缓存成功');
}
}

View File

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

View File

@ -1,118 +1,118 @@
<?php
/**
* @date 2023年03月2日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户入驻申请管理
*/
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use app\validate\merchant\MerchantApplymentsValidate;
use app\common\model\merchant\system\merchant\MerchantApplyments as MerchantApplymentsModel;
class MerchantApplyments extends BaseController
{
/**
* @var MerchantModel
*/
protected $model;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
*/
function __construct(MerchantApplymentsModel $model){
$this->model = $model;
}
/**
* TODO 创建申请
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function create(MerchantApplymentsValidate $validate)
{
// if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻');
$data = $this->checkParams($validate);
}
/**
* TODO 创建申请
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function detail()
{}
/**
* TODO 编辑提交
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function update($id,MerchantApplymentsValidate $validate)
{}
/**
* TODO 查询更新状态
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function check()
{}
/**
* TODO 上传图片
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function uploadImage($field)
{}
/**
* TODO 检验参数
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function checkParams(MerchantApplymentsValidate $validate)
{
//'organization_cert_info',
$data = $this->request->params([
'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc'
]);
if($data['id_doc_type'] == 1){
unset($data['id_doc_info']);
}else{
unset($data['id_card_info']);
}
if(in_array($data['organization_type'],['2401','2500'])){
unset($data['business_license_info']);
}
if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']);
if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']);
if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){
unset($data['id_card_info']['id_card_address']);
}
$validate->check($data);
return $data;
}
<?php
/**
* @date 2023年03月2日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商户入驻申请管理
*/
namespace app\admin\controller\merchant\system\merchant;
use app\admin\BaseController;
use app\validate\merchant\MerchantApplymentsValidate;
use app\common\model\merchant\system\merchant\MerchantApplyments as MerchantApplymentsModel;
class MerchantApplyments extends BaseController
{
/**
* @var MerchantModel
*/
protected $model;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
*/
function __construct(MerchantApplymentsModel $model){
$this->model = $model;
}
/**
* TODO 创建申请
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function create(MerchantApplymentsValidate $validate)
{
// if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻');
$data = $this->checkParams($validate);
}
/**
* TODO 创建申请
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function detail()
{}
/**
* TODO 编辑提交
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function update($id,MerchantApplymentsValidate $validate)
{}
/**
* TODO 查询更新状态
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function check()
{}
/**
* TODO 上传图片
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function uploadImage($field)
{}
/**
* TODO 检验参数
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function checkParams(MerchantApplymentsValidate $validate)
{
//'organization_cert_info',
$data = $this->request->params([
'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc'
]);
if($data['id_doc_type'] == 1){
unset($data['id_doc_info']);
}else{
unset($data['id_card_info']);
}
if(in_array($data['organization_type'],['2401','2500'])){
unset($data['business_license_info']);
}
if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']);
if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']);
if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){
unset($data['id_card_info']['id_card_address']);
}
$validate->check($data);
return $data;
}
}

View File

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

View File

@ -129,10 +129,8 @@ class Merchant extends BaseController
$total = StoreOrderModel::where($where)->count();
$list = StoreOrderModel::with(['merchant'])->order('order_id desc')->page($params['page'])->limit($params['limit'])->select();
foreach ($list as $k =>$v){
$list[$k]['uid'] = Db::connect('shop')->table('eb_user')->where('uid',$v['uid'])->value('nickname');
}
$list = StoreOrderModel::with(['merchant'])->order('order_id desc')->select();
View::assign('url', $this->url);
View::assign('list', $list);

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,66 +1,66 @@
{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-2">审核状态<font>*</font>
</td>
<td>
<select name="status" lay-verify="required" lay-reqText="审核状态">
<option selected="selected" value="1">同意</option>
<option value="2">不同意</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray-2">创建商户<font>*</font>
</td>
<td>
<input type="radio" checked="checked" name="create_mer" value="1" title="是">
<input type="radio" name="create_mer" value="0" title="不是">
</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>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
console.log(data.field)
if (!data.field.status || data.field.id == '' || data.field.create_mer == '') {
layer.msg('请选择审核表单');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/merchant/intention/status', data.field, callback);
return false;
});
}
</script>
{/block}
{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-2">审核状态<font>*</font>
</td>
<td>
<select name="status" lay-verify="required" lay-reqText="审核状态">
<option selected="selected" value="1">同意</option>
<option value="2">不同意</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray-2">创建商户<font>*</font>
</td>
<td>
<input type="radio" checked="checked" name="create_mer" value="1" title="是">
<input type="radio" name="create_mer" value="0" title="不是">
</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>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
console.log(data.field)
if (!data.field.status || data.field.id == '' || data.field.create_mer == '') {
layer.msg('请选择审核表单');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/merchant/intention/status', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

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

View File

@ -15,29 +15,29 @@
<div class="layui-inline">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-block">
<div class="layui-btn-group" id="witch_date">
<button name="both" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="today" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">今天</button>
<button name="yeserday" lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">昨天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近30天</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本月</button>
<button lay-submit="" lay-filter="searchform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本年</button>
<div class="layui-btn-group">
<input id="chonse_start_date" type="hidden" name="start_date" value="" readonly placeholder="选择时间">
<input id="chonse_end_date" type="hidden" name="end_date" value="" readonly placeholder="选择时间">
<button id="both" name="both" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="today" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">今天</button>
<button name="yeserday" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">昨天</button>
<button name="week" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
<button name="30day" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近30天</button>
<button name="month" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本月</button>
<button name="year" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本年</button>
</div>
</div>
</div>
<div class="layui-inline">
<!-- <label class="layui-form-label">日期范围</label> -->
<div class="layui-inline" id="test6">
<div class="layui-inline" id="range_date">
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="start_date" id="test-startDate-1" class="layui-input"
placeholder="开始日期">
<input type="text" autocomplete="off" name="start_date" id="start-date" class="layui-input" placeholder="开始日期">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="end_date" id="test-endDate-1" class="layui-input"
placeholder="结束日期">
<input type="text" autocomplete="off" name="end_date" id="end-date" class="layui-input" placeholder="结束日期">
</div>
</div>
</div>
@ -46,14 +46,14 @@
<div class="layui-form-item">
<div class="layui-inline" style="width:46%">
<div class="layui-input-inline" style="width:45%;">
<div class="layui-form-item">
<label class="layui-form-label">关键字</label>
<div class="layui-input-block">
<input style="width:80%;float:left" type="text" name="keywords" placeholder="请输入关键字"
<div class="layui-input-block" style="display:flex">
<input style="width:70%;float:left" type="text" name="keyword" placeholder="请输入关键字"
class="layui-input" autocomplete="off" />
<button class="layui-btn layui-btn-normal" style="width:20%" lay-submit=""
lay-filter="searchform" type="button">提交搜索</button>
<button class="layui-btn layui-btn-normal" lay-submit=""
lay-filter="searchform">提交搜索</button>
</div>
</div>
</div>
@ -62,10 +62,10 @@
<div class="layui-form-item">
<label class="layui-form-label">商户类别</label>
<div class="layui-input-block">
<select name="dddd" lay-filter="searchform">
<select name="is_trader" lay-filter="searchform">
<option value=""></option>
<option value="10">自营</option>
<option value="11">非自营</option>
<option value="1">自营</option>
<option value="0">非自营</option>
</select>
</div>
</div>
@ -75,33 +75,29 @@
<div class="layui-form-item">
<div class="layui-input-inline" style="width:46%;">
<div class="layui-input-inline" style="width:45%;float:none;">
<div class="layui-form-item">
<label class="layui-form-label">商户分类</label>
<div class="layui-input-block">
<select name="category" lay-filter="searchform">
<select name="category_id" 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>
{volist name="category" key="k" id="vo"}
<option value="{$vo.merchant_category_id}">{$vo.category_name}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-input-inline" style="width:35%;">
<div class="layui-input-inline" style="width:45%;">
<div class="layui-form-item">
<label class="layui-form-label">店铺类型</label>
<div class="layui-input-block">
<select name="type" lay-filter="type">
<select name="type_id" 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>
{volist name="type" key="k" id="vo"}
<option value="{$vo.mer_type_id}">{$vo.type_name}</option>
{/volist}
</select>
</div>
</div>
@ -116,13 +112,10 @@
<label class="layui-form-label">保证金状态</label>
<div class="layui-input-block">
<select class="test_state" name="status" lay-filter="status">
<select class="is_margin" name="is_margin" 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>
<option value="10">已付</option>
<option value="0">未付</option>
</select>
</div>
@ -134,19 +127,18 @@
<!-- change tab -->
<div class="layui-form-item" id="refund_margin" style="display:none;">
<div class="layui-input-inline" style="width:46%;">
<div class="layui-input-inline" style="width:45%;">
<div class="layui-form-item">
<label class="layui-form-label">审核</label>
<div class="layui-input-block">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-normal">全部</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">待审核</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">已审核</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核失败</button>
<input type="hidden" id="status" name="status" value="" readonly placeholder="核审状态值">
<button name="both" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal">全部</button>
<button name="wait" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">待审核</button>
<button name="success" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核通过</button>
<button name="failed" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核未通过</button>
</div>
</div>
</div>
</div>
@ -155,13 +147,10 @@
<label class="layui-form-label">退回状态</label>
<div class="layui-input-block">
<select name="refund" lay-filter="refund">
<select name="refund" 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>
<option value="0">未退回</option>
<option value="1">已退回</option>
</select>
</div>
@ -178,14 +167,14 @@
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li lay-id="11" class="layui-this site-demo-active" data-type="tabChange">缴存保证金</li>
<li lay-id="22" class="site-demo-active" data-type="tabChange">退回保证金</li>
<li lay-id="11" class="layui-this tag-switch" data-type="tabChange">缴存保证金</li>
<li lay-id="22" class="tag-switch" data-type="tabChange">退回保证金</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<!-- 缴存列表 -->
<div class="layui-tab-item layui-show">
<table class="layui-hide" id="reduct_list" lay-filter="reduct_list">
<table class="layui-hide" id="pay_list" lay-filter="pay_list">
</table>
</div>
@ -232,8 +221,8 @@
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#reduct_list',
layui.payTable = table.render({
elem: '#pay_list',
title: '保证金列表',
toolbar: '#toolbarDemo',
url: '/admin/margin/lst',
@ -260,7 +249,7 @@
title: '店铺类型',
align: 'center',
width: 220,
templet: '<div>{{d.merchant.type_id}}</div>'
templet: '<div>{{d.merchant.merchantType.type_name}}</div>'
}, {
field: 'real_name',
title: '商户姓名',
@ -277,7 +266,22 @@
field: 'status',
title: '状态',
align: 'center',
width: 150
width: 150,
templet: function(d){
switch (d.merchant.is_margin) {
case 0:
return '<div></div>'
case 1:
return '<div>有未支付</div>'
case 10:
return '<div>已支付</div>'
case -1:
return '<div>申请退款</div>'
case -10:
return '<div>拒绝退款</div>'
}
}
}, {
field: 'pay_time',
title: '支付时间',
@ -298,7 +302,7 @@
});
layui.pageTable = table.render({
layui.refundTable = table.render({
elem: '#refund_list',
title: '退回保证金列表',
toolbar: '#refundToolbar',
@ -374,32 +378,10 @@
return data;
}
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();;
//执行重载
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//监听表头工具栏事件
// table.on('toolbar(store_product)', function (obj) {
// if (obj.event === 'add') {
// tool.side("/admin/merchant/type/form");
// return false;
// }
// });
//监听表格行工具事件
table.on('tool(reduct_list)', function (obj) {
table.on('tool(pay_list)', function (obj) {
var data = obj.data;
// console.log(data);
if (obj.event === 'reduct') {
@ -425,97 +407,233 @@
return false;
});
//触发事件
var $ = layui.$, active = {
tabChange: function(){
//切换到指定Tab项
// element.tabChange('demo', this.getAttribute('lay-id')); //切换tab
var marign = document.getElementById('set_margin');
var refund = document.getElementById('refund_margin');
if ('11'==this.getAttribute('lay-id')) {
marign.style.display = "block";
refund.style.display = "none";
}else{
refund.style.display = "block";
marign.style.display = "none";
}
},
reload: function(){
let dataRload = getformdata();
//执行重载
table.reload('pay_list', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
},
refund_reload: ()=>{
let dataRload = getformdata();
//执行重载
table.reload('refund_list', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//监听搜索提交
form.on('submit(searchform)', function(data) {
console.log(data.elem.name, data.field)
layui.pageTable.reload({
where: {
date:data.elem.name,
...data.field
},
page: {
curr: 1
}
});
// layui.form.render();
return false;
});
form.on('select(searchform)', function(e) {
let data = getformdata();
layui.pageTable.reload({
where: {
...data
},
page: {
curr: 1
}
});
return false;
});
//监听
$('.test_state .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// 日期范围
layui.use(['laydate','element', 'jquery'],
layui.use(['laydate','element','table', 'jquery'],
function () {
var laydate = layui.laydate;
var $ = layui.jquery,element = layui.element;
//日期范围
laydate.render({
elem: '#test6'
elem: '#range_date'
//设置开始日期、日期日期的 input 选择器
//数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
, range: ['#test-startDate-1', '#test-endDate-1']
, range: ['#start-date', '#end-date']
,done: function(value, date, endDate){
let data = getformdata()
data.date = ''
layui.pageTable.reload({
where: {
...data
},
page: {
curr: 1
}
});
switchDateForm(true);
$('#both').removeClass('layui-btn-primary')
$('#both').siblings().addClass('layui-btn-primary')
active['reload'] ? active['reload'].call(this) : '';
}
});
//触发事件
var active = {
tabChange: function(){
//切换到指定Tab项
// element.tabChange('demo', this.getAttribute('lay-id')); //切换tab
var marign = document.getElementById('set_margin');
var refund = document.getElementById('refund_margin');
if ('11'==this.getAttribute('lay-id')) {
marign.style.display = "block";
refund.style.display = "none";
// refund.childNodes().value='';
}else{
refund.style.display = "block";
marign.style.display = "none";
}
}
};
$('.site-demo-active').on('click', function(){
// 列表切换
$('.tag-switch').on('click', function(){
var othis = $(this), type = othis.data('type');
active[type] ? active[type].call(this, othis) : '';
if ('11'==this.getAttribute('lay-id')) {
active['reload'] ? active['reload'].call(this, othis) : '';
}else{
active['refund_reload'] ? active['refund_reload'].call(this, othis) : '';
}
});
//监听button提交
form.on('submit(searchform)', function(data) {
layui.payTable.reload({
where: {
...data.field
},
page: {
curr: 1
}
});
return false;
});
form.on('select(searchform)', function(e) {
let data = getformdata();
layui.payTable.reload({
where: {
...data
},
page: {
curr: 1
}
});
return false;
});
//Hash地址的定位
// var layid = location.hash.replace(/^#test=/, '');
// element.tabChange('test', layid);
//选择时间
form.on('submit(chonse_date)', function(data){
let start_date = '';
let end_date = getDaysAgo();
let name = data.elem.name;
if (name =='today') {
start_date=end_date;
end_date = getDaysAgo(-1);
}else if(name == 'yeserday'){
start_date = getDaysAgo(1);
}else if(name == 'week'){
start_date = getDaysAgo(7);
}else if(name == '30day'){
start_date = getDaysAgo(30);
}else if(name == 'month'){
let days = (new Date).getDate()-1
start_date = getDaysAgo(days);
}else if(name == 'year'){
var year = (new Date()).getFullYear();//获取当前年份
start_date = year+'-01-01'
}else{
end_date = '';
}
switchClass(this)
switchDateForm(false);
$('#chonse_start_date').val(start_date);
$('#chonse_end_date').val(end_date);
active['reload'] ? active['reload'].call(this) : '';
return false;
})
// 商户审核
form.on('submit(statusform)', function(data) {
let name = data.elem.name
let status = 0;
if (name=='wait') {
status = 0;
}else if(name=='success'){
status = 1;
}else if(name=='failed'){
status = 2;
}
if (name=='both'){
$('#status').attr('disabled', true);
}else{
$('#status').attr('disabled', false);
}
switchClass(this)
$('#status').val(status);
active['reload'] ? active['reload'].call(this) : '';
return false;
});
//监听select提交
form.on('select(seleform)', function(data) {
active['reload'] ? active['reload'].call(this) : '';
return false;
});
}
);
// 切换button选中样式
function switchClass(e)
{
$(e).removeClass('layui-btn-primary')
$(e).siblings().addClass('layui-btn-primary')
}
// 两个时间表单是互斥的,只能提交一个
function switchDateForm(chonse=false)
{
let range = chonse?false:true;
$('#start-date').attr("disabled",range);
$('#end-date').attr("disabled",range);
$('#chonse_start_date').attr("disabled",chonse);
$('#chonse_end_date').attr("disabled",chonse);
if (chonse) {
$('#chonse_start_date').val("");
$('#chonse_end_date').val("");
}else{
$('#start-date').val("");
$('#end-date').val("");
}
}
//获取n天以前日期
function getDaysAgo(n=0) {
let myDate = new Date();
let lw = new Date(myDate - 1000 * 60 * 60 * 24 * n); //最后一个数字30可改n天前的意思
let lastY = lw.getFullYear();
let lastM = lw.getMonth() + 1;
let lastD = lw.getDate();
lastM = lastM < 10 ? "0" + lastM : lastM;
lastD = lastD < 10 ? "0" + lastD : lastD;
let startData = lastY+"-"+lastM+"-" +lastD; //n天之前日期
return startData;
}
// 获取表单所有参数
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>

View File

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

View File

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

View File

@ -37,15 +37,15 @@
<tr>
<td colspan="2">
<div class="layui-input-block">
<input type="radio" name="is_margin" value="1" title="有" checked="{$detail.is_margin}">
<input type="radio" name="is_margin" value="0" title="无" checked="{$detail.is_margin}">
<input lay-filter="is_margin"type="radio" name="is_margin" value="1" title="有" {if $detail.is_margin == 1}checked{/if}>
<input lay-filter="is_margin" type="radio" name="is_margin" value="0" title="无" {if $detail.is_margin == 0}checked{/if}>
</div>
</td>
<td colspan="5"></td>
</tr>
<tr>
<td colspan="2">
<input type="text" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="{$detail.margin}">
<input id="margin" type="text" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="{$detail.margin}">
</td>
<td colspan="5">单位:元</td>
</tr>
@ -116,14 +116,34 @@
// }
});
let tval = '';
form.on('radio(is_margin)', (data)=>{
if (data.value>0) {
$('#margin').val(tval);
$('#margin').attr({'disabled':false});
}else{
tval = $('#margin').val();
$('#margin').val('');
$('#margin').attr('disabled',true);
}
});
//监听提交
form.on('submit(webform)', function (data) {
// data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field == '') {
layer.msg('请先完善店铺类型');
return false;
}
if (data.field.is_margin) {
if (data.field.margin <1) {
layer.msg('请输入店铺压金');
return false;
}
}else{
data.field.margin = ''
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {

View File

@ -132,6 +132,7 @@
height: 500
});
if (area_id != 0) {
street(area_id)
}

View File

@ -1,437 +1,437 @@
{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%;
}
#seleform{
border-color: #eee;
background-color: #fff;
color:#a39f9f;
width:100%;
}
</style>
<div class="p-3">
<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">
<input id="store_cate" type="hidden" readonly="readonly" name="store_cate">
<button id="seleform" lay-filter="seleform" class="layui-btn">请选择</button>
</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="1">上架</option>
<option value="0">下架</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>
<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,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBP5tRaW5CLx//374+PHjcHJyMnz//n24dOnScOXKleH69evDjRs35tIMx9mhwNGvQXXa4XE5pAsEvn79Orx8+XL48uXLBbX/vXT16tXhzp07w+XLl0ffo4LAmIBAGJPp7PUIgadPnw6np8vz++joaLh///4Q4WAhsIqAOYRVtA703giB58+fTwqDOMRV379Jsz5//jwcHx9vsgnrdiQgEDrqjLFDefv27dlcwVj9Ra/H3EKst8vl27dvZ0H15s2bs/mMXe7LtvcjIBD247zRXj59+rTW+uuuN2VncRby4sWL4cePH2dvj7kNy/wFBMIM+jCuJqyzrLvelH29evXqj8nN2FecKVjmLSAQ5t1/Bzn6d+/eDXHp8/wScwm7DKHz+/Pz9gUEwvZNt77FuMdgnWXd9bJ9xdWOODsYW3x1GJOZx+sCYQb9dO3atbWOct31xnYWE5VxtSNb4gzh9evX2VvUdSwgEDrunMWh3bp16+xuxMXPU/6NuxdjvalLXD5ctjx79mzS1Y64uuGrwzLNPusFQp/98sdRxY1Gd+/eHeLfKcuq74/T/Ljp6cOHD6Obj/es8iGPKxBTbqIa3aGKgwgIhIOwr77TuOvw4cOHS+8+nPq+xRHElYHFBGF8iOMZifNL1C/ec75u7Oe4zdpVhzGdfl9363K/fTN6ZPHh3MbDTbGdiyYB7927NyzmH2IS8cmTJ6PHsqziwYMHS0Ns2TbU709AIOzPuqs9RaBkE4TxLEQ8IPX48eNJ8wZjjYttxJnN1K87Y9vx+n4EBMJ+nLvay5QHpeIDHB/mVeYNxhp58+bN4fbt22PVXu9IwBxCR52xj0OJD3hcLVg24Rf12wiDaFPcyBQhZOlfQCD030dbO8J4GCnCYPH8wdY2PGFDrjpMQOrgLQKhg07YxyFECEy9j2AXxxNhlN3huIt92ubqAgJhdbPZrRGn/3GfQVwKPOQSVzWm3AB1yGOsvm+BUGAExNWEbc0HbMoVlzmXzV9sug/rry8gENa3m8Wa8QHc5d9FWBUhvjp41mFVtf29XyDsz3pre4r5gHjQaNkSH7xV7zBcts1t1MdVh55Cahtt+lu2IRBm1pPxQXr06NHZ3YPZnEB86Hb9J9Q2oYszl0Nc7djkmCusKxBm0svxvTtm6RdXCuLUO24pvuj6fjyk1PuMfpzh+OrQ3+ATCP31yf+OKCYE48Mfv/V/X+I3bFw9+P2BpJjFj2v+c1h6/DozB7ddHqP/uWmXulvYdoRA9ts+zhziKkL85yzxF5LiDMJCYF0BgbCu3I7Xi1PqVa4QxHvj+QOX9HbcMX/55gVChx0cXwHWmXQTBh125swOSSB01mERBL5bd9YphQ7HpGJnnS0MOuuQYocjEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMwF9dLtbhmksgE3CGkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCAiHTUUegmIBAKNbhmksgExAImY46AsUEBEKxDtdcApmAQMh01BEoJiAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
</div>`;
if(d.image)
{
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="` + d.image + `" />
</div>`;
}
return html;
},
},{
field: 'store_name',
title: '商品名称',
align: 'center',
width:120
},{
field: 'product_score',
title: '商户类别',
align: 'center',
width:150,
templet: function (d)
{
return d.storeCategory ? d.storeCategory.cate_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_show',
title: '商品状态',
align: 'center',
width:150,
templet: function (d)
{
var html = d.is_show ? '上架显示' : '平台关闭';
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;
});
layui.use(['rate','dropdown', 'util', 'layer', 'table'], function(){
var dropdown = layui.dropdown
,util = layui.util
,layer = layui.layer
,rate = layui.rate
// ,table = layui.table
,$ = layui.jquery;
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();;
console.log(dataRload)
//执行重载
table.reload('article', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//商户商品分类菜单
$.ajax({
url: '/admin/store/category/select',
method: "get",
data: {},
success: function(res) {
if (res.code!==0)return ;
//高级演示 - 各种组合
dropdown.render({
elem: '#seleform'
,isAllowSpread: false //禁止菜单组展开收缩
,style: 'width: 200px' //定义宽度,默认自适应
,id: 'test777' //定义唯一索引
,title: 'title1'
,data: res.data
,click: function(item){
$('#seleform').text(item.title);
$('#seleform').css({color:'rgba(0,0,0,.85)'});
$('#store_cate').val(item.id);
active['reload'] ? active['reload'].call(this) : '';
}
});
},
fail:function(){}
});
//基础效果
rate.render({
elem: '#is_good'
})
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
...data.field
},
page: {
curr: 1
}
});
return false;
});
//监听select提交
form.on('select(seleform)', function(data) {
active['reload'] ? active['reload'].call(this) : '';
return false;
});
});
// 获取表单所有参数
function getformdata() {
var form = $('#filterform').serializeArray();
var data = new Array();
for(let i=0;i<form.length; i++){
data[form[i].name] = form[i].value;
}
return data;
}
}
</script>
{/block}
{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%;
}
#seleform{
border-color: #eee;
background-color: #fff;
color:#a39f9f;
width:100%;
}
</style>
<div class="p-3">
<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">
<input id="store_cate" type="hidden" readonly="readonly" name="store_cate">
<button id="seleform" lay-filter="seleform" class="layui-btn">请选择</button>
</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="1">上架</option>
<option value="0">下架</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>
<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,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBP5tRaW5CLx//374+PHjcHJyMnz//n24dOnScOXKleH69evDjRs35tIMx9mhwNGvQXXa4XE5pAsEvn79Orx8+XL48uXLBbX/vXT16tXhzp07w+XLl0ffo4LAmIBAGJPp7PUIgadPnw6np8vz++joaLh///4Q4WAhsIqAOYRVtA703giB58+fTwqDOMRV379Jsz5//jwcHx9vsgnrdiQgEDrqjLFDefv27dlcwVj9Ra/H3EKst8vl27dvZ0H15s2bs/mMXe7LtvcjIBD247zRXj59+rTW+uuuN2VncRby4sWL4cePH2dvj7kNy/wFBMIM+jCuJqyzrLvelH29evXqj8nN2FecKVjmLSAQ5t1/Bzn6d+/eDXHp8/wScwm7DKHz+/Pz9gUEwvZNt77FuMdgnWXd9bJ9xdWOODsYW3x1GJOZx+sCYQb9dO3atbWOct31xnYWE5VxtSNb4gzh9evX2VvUdSwgEDrunMWh3bp16+xuxMXPU/6NuxdjvalLXD5ctjx79mzS1Y64uuGrwzLNPusFQp/98sdRxY1Gd+/eHeLfKcuq74/T/Ljp6cOHD6Obj/es8iGPKxBTbqIa3aGKgwgIhIOwr77TuOvw4cOHS+8+nPq+xRHElYHFBGF8iOMZifNL1C/ec75u7Oe4zdpVhzGdfl9363K/fTN6ZPHh3MbDTbGdiyYB7927NyzmH2IS8cmTJ6PHsqziwYMHS0Ns2TbU709AIOzPuqs9RaBkE4TxLEQ8IPX48eNJ8wZjjYttxJnN1K87Y9vx+n4EBMJ+nLvay5QHpeIDHB/mVeYNxhp58+bN4fbt22PVXu9IwBxCR52xj0OJD3hcLVg24Rf12wiDaFPcyBQhZOlfQCD030dbO8J4GCnCYPH8wdY2PGFDrjpMQOrgLQKhg07YxyFECEy9j2AXxxNhlN3huIt92ubqAgJhdbPZrRGn/3GfQVwKPOQSVzWm3AB1yGOsvm+BUGAExNWEbc0HbMoVlzmXzV9sug/rry8gENa3m8Wa8QHc5d9FWBUhvjp41mFVtf29XyDsz3pre4r5gHjQaNkSH7xV7zBcts1t1MdVh55Cahtt+lu2IRBm1pPxQXr06NHZ3YPZnEB86Hb9J9Q2oYszl0Nc7djkmCusKxBm0svxvTtm6RdXCuLUO24pvuj6fjyk1PuMfpzh+OrQ3+ATCP31yf+OKCYE48Mfv/V/X+I3bFw9+P2BpJjFj2v+c1h6/DozB7ddHqP/uWmXulvYdoRA9ts+zhziKkL85yzxF5LiDMJCYF0BgbCu3I7Xi1PqVa4QxHvj+QOX9HbcMX/55gVChx0cXwHWmXQTBh125swOSSB01mERBL5bd9YphQ7HpGJnnS0MOuuQYocjEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMwF9dLtbhmksgE3CGkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCAiHTUUegmIBAKNbhmksgExAImY46AsUEBEKxDtdcApmAQMh01BEoJiAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
</div>`;
if(d.image)
{
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
<img style="width:100%;" src="` + d.image + `" />
</div>`;
}
return html;
},
},{
field: 'store_name',
title: '商品名称',
align: 'center',
width:120
},{
field: 'product_score',
title: '商户类别',
align: 'center',
width:150,
templet: function (d)
{
return d.storeCategory ? d.storeCategory.cate_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_show',
title: '商品状态',
align: 'center',
width:150,
templet: function (d)
{
var html = d.is_show ? '上架显示' : '平台关闭';
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;
});
layui.use(['rate','dropdown', 'util', 'layer', 'table'], function(){
var dropdown = layui.dropdown
,util = layui.util
,layer = layui.layer
,rate = layui.rate
// ,table = layui.table
,$ = layui.jquery;
var $ = layui.$, active = {
reload: function(){
let dataRload = getformdata();;
console.log(dataRload)
//执行重载
table.reload('article', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
...dataRload
}
});
}
};
//商户商品分类菜单
$.ajax({
url: '/admin/store/category/select',
method: "get",
data: {},
success: function(res) {
if (res.code!==0)return ;
//高级演示 - 各种组合
dropdown.render({
elem: '#seleform'
,isAllowSpread: false //禁止菜单组展开收缩
,style: 'width: 200px' //定义宽度,默认自适应
,id: 'test777' //定义唯一索引
,title: 'title1'
,data: res.data
,click: function(item){
$('#seleform').text(item.title);
$('#seleform').css({color:'rgba(0,0,0,.85)'});
$('#store_cate').val(item.id);
active['reload'] ? active['reload'].call(this) : '';
}
});
},
fail:function(){}
});
//基础效果
rate.render({
elem: '#is_good'
})
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
...data.field
},
page: {
curr: 1
}
});
return false;
});
//监听select提交
form.on('select(seleform)', function(data) {
active['reload'] ? active['reload'].call(this) : '';
return false;
});
});
// 获取表单所有参数
function getformdata() {
var form = $('#filterform').serializeArray();
var data = new Array();
for(let i=0;i<form.length; i++){
data[form[i].name] = form[i].value;
}
return data;
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -19,7 +19,7 @@
<!--</script>-->
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}

View File

@ -21,13 +21,13 @@
<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="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">

View File

@ -21,13 +21,13 @@
<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="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">

View File

@ -1,230 +1,195 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\api;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\App;
use think\exception\HttpResponseException;
use think\facade\Db;
use think\facade\Request;
use think\Response;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* 分页数量
* @var string
*/
protected $pageSize = '';
/**
* jwt配置
* @var string
*/
protected $jwt_conf = [
'secrect' => 'ae47e94a7dcd1fdfacb499b60e361a8d',
'iss' => '', //签发者 可选
'aud' => '', //接收该JWT的一方可选
'exptime' => '', //过期时间,这里设置2个小时
];
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
$this->jwt_conf = get_system_config('token');
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{
//每页显示数据量
$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');
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){
$this->request->uid=$user['n_user_id'];
}else{
$this->request->uid=$this->addUser($decoded->jti[0],$user);
}
//return (array)$decoded;
// $decoded_array = json_decode(json_encode($decoded),TRUE);
// $jwt_data = $decoded_array['data'];
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 json(['code'=>404,'msg'=>'token不能为空']);
}
// 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('$this->request->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('$this->request->uid', '');
// }
// 暂时去除 -----------------------------------------------------
}
/**
* Api处理成功结果返回方法
* @param $message
* @param null $redirect
* @param null $extra
* @return mixed
* @throws ReturnException
*/
protected function apiSuccess($msg = 'success',$data=[])
{
return $this->apiReturn($data, 1, $msg);
}
/**
* Api处理结果失败返回方法
* @param $error_code
* @param $message
* @param null $redirect
* @param null $extra
* @return mixed
* @throws ReturnException
*/
protected function apiError($msg = 'fail',$data=[], $code = 0)
{
return $this->apiReturn($data, $code, $msg);
}
/**
* 返回封装后的API数据到客户端
* @param mixed $data 要返回的数据
* @param integer $code 返回的code
* @param mixed $msg 提示信息
* @param string $type 返回数据格式
* @param array $header 发送的Header信息
* @return Response
*/
protected function apiReturn($data, int $code = 0, $msg = '', string $type = '', array $header = []): Response
{
$result = [
'code' => $code,
'msg' => $msg,
'time' => time(),
'data' => $data,
];
$type = $type ?: 'json';
$response = Response::create($result, $type)->header($header);
throw new HttpResponseException($response);
}
}
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\api;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\App;
use think\exception\HttpResponseException;
use think\facade\Db;
use think\facade\Request;
use think\Response;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* 分页数量
* @var string
*/
protected $pageSize = '';
/**
* jwt配置
* @var string
*/
protected $jwt_conf = [
'secrect' => 'ae47e94a7dcd1fdfacb499b60e361a8d',
'iss' => '', //签发者 可选
'aud' => '', //接收该JWT的一方可选
'exptime' => '', //过期时间,这里设置2个小时
];
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
$this->jwt_conf = get_system_config('token');
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{
//每页显示数据量
$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');
// return json($token);
// JWT::$leeway = 60;//当前时间减去60把时间留点余地
// $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式这里要和签发的时候对应
// 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('$this->request->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('$this->request->uid', '');
// }
// 暂时去除 -----------------------------------------------------
}
/**
* Api处理成功结果返回方法
* @param $message
* @param null $redirect
* @param null $extra
* @return mixed
* @throws ReturnException
*/
protected function apiSuccess($msg = 'success',$data=[])
{
return $this->apiReturn($data, 1, $msg);
}
/**
* Api处理结果失败返回方法
* @param $error_code
* @param $message
* @param null $redirect
* @param null $extra
* @return mixed
* @throws ReturnException
*/
protected function apiError($msg = 'fail',$data=[], $code = 0)
{
return $this->apiReturn($data, $code, $msg);
}
/**
* 返回封装后的API数据到客户端
* @param mixed $data 要返回的数据
* @param integer $code 返回的code
* @param mixed $msg 提示信息
* @param string $type 返回数据格式
* @param array $header 发送的Header信息
* @return Response
*/
protected function apiReturn($data, int $code = 0, $msg = '', string $type = '', array $header = []): Response
{
$result = [
'code' => $code,
'msg' => $msg,
'time' => time(),
'data' => $data,
];
$type = $type ?: 'json';
$response = Response::create($result, $type)->header($header);
throw new HttpResponseException($response);
}
}

View File

@ -104,7 +104,7 @@ class Userinfo extends BaseController
$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

@ -1,10 +1,10 @@
<?php
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股cms是否完成安装
\app\home\middleware\Install::class,
\app\api\middleware\AllowOriginMiddleware::class,
<?php
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股cms是否完成安装
\app\home\middleware\Install::class,
\app\api\middleware\AllowOriginMiddleware::class,
];

View File

@ -2,7 +2,6 @@
use think\facade\Route;
Route::group('/',function () {
Route::get('ArticleComment/isread', 'ArticleComment/isread');
Route::get('ArticleComment/one list', 'ArticleComment/OneList');
Route::get('Village/get_my_village', 'Village/get_my_village');
Route::get('Village/get_my_town', 'Village/get_my_town');
Route::get('Userinfo/get_ranking', 'Userinfo/get_ranking');
@ -115,7 +114,6 @@ Route::group('/',function () {
//红白喜事轮播图
Route::get('Slide/get_slide_two', 'Slide/get_slide_two');
Route::get('User/index', 'User/index');
Route::get('Village/thumbs_up', 'Village/thumbs_up');
})->middleware(\app\api\middleware\Auth::class);
Route::group('/',function () {
@ -158,7 +156,7 @@ Route::group('/',function () {
Route::get('Village/get_ranking_list', 'Village/get_ranking_list');
Route::get('Census/get_list', 'Census/get_list');
Route::get('Village/get_village', 'Village/get_village');
Route::get('Village/thumbs_up', 'Village/thumbs_up');
Route::get('Village/get_detail', 'Village/get_detail');
Route::get('Village/get_list', 'Village/get_list');
Route::get('Village/get_json', 'Village/get_json');

File diff suppressed because it is too large Load Diff

View File

@ -1,126 +1,126 @@
<?php
namespace app\common\model\merchant\store;
use think\Model;
use think\facade\Db;
use think\exception\ValidateException;
class ShippingTemplate extends Model
{
protected $connection = 'shop';
protected $table = 'eb_shipping_template';
protected $pk = 'shipping_template_id';
/**
* @param int $merId
* @author Qinii
*/
public function createDefault(int $merId)
{
$data = [
"name" => "默认模板",
"type" => 1,
"appoint" => 0,
"undelivery" => 0,
'mer_id' => $merId,
"region" => [[
"first" => 0,
"first_price" => 0,
"continue" => 0,
"continue_price" => 0,
"city_id" => 0
]]
];
return $this->createTemp($data);
}
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param array $data
*/
public function createTemp(array $data)
{
Db::transaction(function()use ($data) {
$region = $data['region'];
$free = $data['free'] ?? '';
$undelives = $data['undelives'] ?? '';
unset($data['region'],$data['free'],$data['undelives'],$data['city_ids']);
$temp = self::create($data);
if($data['appoint']) {
$settlefree = $this->settleFree($free, $temp['shipping_template_id']);
(app()->make(ShippingTemplateFree::class))->addData($settlefree);
}
$settleRegion = $this->settleRegion($region, $temp['shipping_template_id']);
(app()->make(ShippingTemplateRegion::class))->addData($settleRegion);
if($data['undelivery'] == 1){
$settleUndelives = $this->settleUndelives($undelives,$temp['shipping_template_id']);
(app()->make(ShippingTemplateUndelive::class))->create($settleUndelives);
}
});
}
/**
* @param $data
* @param $id
* @return array
* @author Qinii
*/
public function settleFree($data,$id)
{
foreach ($data as $v){
if (isset($v['city_id']) && !is_array($v['city_id'])) throw new ValidateException('包邮参数类型错误');
$city = '/'.implode('/',$v['city_id']).'/';
$free[] = [
'temp_id' => $id,
'city_id' => $city,
'number' => $v['number'],
'price' => $v['price']
];
}
return $free;
}
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param $data
* @param $id
* @return array
*/
public function settleRegion($data,$id)
{
$result = [];
foreach ($data as $k => $v){
$result[] = [
'city_id' => ($k > 0 ) ? '/'.implode('/',$v['city_id']).'/' : 0,
'temp_id' => $id,
'first' => $v['first'],
'first_price'=> $v['first_price'],
'continue' => $v['continue'],
'continue_price'=> $v['continue_price'],
];
}
return $result;
}
/**
* @param $data
* @param $id
* @return array
* @author Qinii
*/
public function settleUndelives($data,$id)
{
if (isset($v['city_id']) && !is_array($data['city_id'])) throw new ValidateException('指定不配送参数类型错误');
return ['temp_id' => $id, 'city_id' => $data['city_id']];
}
<?php
namespace app\common\model\merchant\store;
use think\Model;
use think\facade\Db;
use think\exception\ValidateException;
class ShippingTemplate extends Model
{
protected $connection = 'shop';
protected $table = 'eb_shipping_template';
protected $pk = 'shipping_template_id';
/**
* @param int $merId
* @author Qinii
*/
public function createDefault(int $merId)
{
$data = [
"name" => "默认模板",
"type" => 1,
"appoint" => 0,
"undelivery" => 0,
'mer_id' => $merId,
"region" => [[
"first" => 0,
"first_price" => 0,
"continue" => 0,
"continue_price" => 0,
"city_id" => 0
]]
];
return $this->createTemp($data);
}
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param array $data
*/
public function createTemp(array $data)
{
Db::transaction(function()use ($data) {
$region = $data['region'];
$free = $data['free'] ?? '';
$undelives = $data['undelives'] ?? '';
unset($data['region'],$data['free'],$data['undelives'],$data['city_ids']);
$temp = self::create($data);
if($data['appoint']) {
$settlefree = $this->settleFree($free, $temp['shipping_template_id']);
(app()->make(ShippingTemplateFree::class))->addData($settlefree);
}
$settleRegion = $this->settleRegion($region, $temp['shipping_template_id']);
(app()->make(ShippingTemplateRegion::class))->addData($settleRegion);
if($data['undelivery'] == 1){
$settleUndelives = $this->settleUndelives($undelives,$temp['shipping_template_id']);
(app()->make(ShippingTemplateUndelive::class))->create($settleUndelives);
}
});
}
/**
* @param $data
* @param $id
* @return array
* @author Qinii
*/
public function settleFree($data,$id)
{
foreach ($data as $v){
if (isset($v['city_id']) && !is_array($v['city_id'])) throw new ValidateException('包邮参数类型错误');
$city = '/'.implode('/',$v['city_id']).'/';
$free[] = [
'temp_id' => $id,
'city_id' => $city,
'number' => $v['number'],
'price' => $v['price']
];
}
return $free;
}
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param $data
* @param $id
* @return array
*/
public function settleRegion($data,$id)
{
$result = [];
foreach ($data as $k => $v){
$result[] = [
'city_id' => ($k > 0 ) ? '/'.implode('/',$v['city_id']).'/' : 0,
'temp_id' => $id,
'first' => $v['first'],
'first_price'=> $v['first_price'],
'continue' => $v['continue'],
'continue_price'=> $v['continue_price'],
];
}
return $result;
}
/**
* @param $data
* @param $id
* @return array
* @author Qinii
*/
public function settleUndelives($data,$id)
{
if (isset($v['city_id']) && !is_array($data['city_id'])) throw new ValidateException('指定不配送参数类型错误');
return ['temp_id' => $id, 'city_id' => $data['city_id']];
}
}

View File

@ -1,24 +1,24 @@
<?php
namespace app\common\model\merchant\store;
use think\Model;
class ShippingTemplateFree extends Model
{
protected $connection = 'shop';
protected $table = 'eb_shipping_template_free';
protected $pk = 'shipping_template_free_id';
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param array $data
* @return mixed
*/
public function addData(array $data)
{
return self::insertAll($data);
}
<?php
namespace app\common\model\merchant\store;
use think\Model;
class ShippingTemplateFree extends Model
{
protected $connection = 'shop';
protected $table = 'eb_shipping_template_free';
protected $pk = 'shipping_template_free_id';
/**
* @Author:Qinii
* @Date: 2020/5/13
* @param array $data
* @return mixed
*/
public function addData(array $data)
{
return self::insertAll($data);
}
}

View File

@ -1,395 +1,395 @@
<?php
/**
* @date 2023年03月9日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商品参数关联表
*/
namespace app\common\model\merchant\system;
use app\common\model\merchant\store\product\Spu;
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;
use think\Model;
use think\exception\ValidateException;
class Relevance extends Model
{
protected $connection = 'shop';
protected $table = 'eb_relevance';
protected $pk = 'relevance_id';
//文章关联商品
const TYPE_COMMUNITY_PRODUCT = 'community_product';
//社区关注
const TYPE_COMMUNITY_FANS = 'fans';
//社区文章点赞
const TYPE_COMMUNITY_START = 'community_start';
//社区评论点赞
const TYPE_COMMUNITY_REPLY_START = 'community_reply_start';
//商户权限
const TYPE_MERCHANT_AUTH = 'mer_auth';
//指定范围类型
//0全部商品
const TYPE_ALL = 'scope_type';
//指定商品
const SCOPE_TYPE_PRODUCT = 'scope_type_product';
//指定分类
const SCOPE_TYPE_CATEGORY = 'scope_type_category';
//指定商户
const SCOPE_TYPE_STORE = 'scope_type_store';
//价格说明关联分类
const PRICE_RULE_CATEGORY = 'price_rule_category';
//商品参数关联
const PRODUCT_PARAMES_CATE = 'product_params_cate';
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);
}
/**
* @return static
*/
public static function getInstance(): self
{
return new static();
}
/**
* TODO 搜索
* @param $where
* @return BaseModel
* @author Qinii
* @day 2020-10-16
*/
protected function getSearch(array $where)
{
foreach ($where as $key => $item) {
if ($item !== '') {
$keyArray[] = $key;
$whereArr[$key] = $item;
}
}
if(empty($keyArray)){
return self::getInstance()->db();
}else{
return self::withSearch($keyArray, $whereArr);
}
}
/**
* TODO 添加
* @param int $leftId
* @param int $rightId
* @param string $type
* @param $check
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function insert(int $leftId, int $rightId, string $type, bool $check = false)
{
if ($check && $this->checkHas($leftId, $rightId, $type)) {
return false;
}
$data = [
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
];
try{
Relevance::create($data);
return true;
} catch (\Exception $exception) {
throw new ValidateException('创建失败');
}
}
/**
* TODO 删除
* @param int $leftId
* @param string $type
* @param int $rightId
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function destory(int $leftId, int $rightId, string $type)
{
return $this->getSearch([
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
])->delete();
}
/**
* TODO 检测是否存在
* @param int $leftId
* @param int $rightId
* @param string $type
* @return int
* @author Qinii
* @day 10/28/21
*/
public function checkHas(int $leftId, int $rightId, string $type)
{
return $this->getSearch([
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
])->count();
}
/**
* TODO 根据左键批量删除
* @param int $leftId
* @param $type
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function batchDelete(int $leftId, $type)
{
return $this->getSearch([
'left_id' => $leftId,
'type' => $type,
])->delete();
}
/**
* TODO 关注我的人
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserFans(int $uid, int $page, int $limit)
{
$query = $this->getSearch([
'right_id' => $uid,
'type' => self::TYPE_COMMUNITY_FANS,
])->with([
'fans' => function($query) {
$query->field('uid,avatar,nickname,count_fans');
}
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->append(['is_start']);
return compact('count','list');
}
/**
* TODO 我关注的人
* @param $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserFocus(int $uid, int $page, int $limit)
{
$query = $this->getSearch([
'left_id' => $uid,
'type' => self::TYPE_COMMUNITY_FANS,
])->with([
'focus' => function($query) {
$query->field('uid,avatar,nickname,count_fans');
}
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->append(['is_fans']);
return compact('count','list');
}
/**
* TODO 我点赞过的文章
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserStartCommunity(array $where, int $page, int $limit)
{
$query = $this->joinUser($where)->with([
'community'=> function($query) use($where){
$query->with([
'author' => function($query){
$query->field('uid,real_name,status,avatar,nickname,count_start');
},
'is_start' => function($query) use ($where) {
$query->where('left_id',$where['uid']);
},
'topic' => function($query) {
$query->where('status', 1)->where('is_del',0);
$query->field('topic_id,topic_name,status,category_id,pic,is_del');
},
'relevance' => [
'spu' => function($query) {
$query->field('spu_id,store_name,image,price,product_type,activity_id,product_id');
}
],
'is_fans' => function($query) use($where){
$query->where('left_id',$where['uid']);
}]);
},
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->each(function ($item){
$item['time'] = date('m月d日', strtotime($item['create_time']));
return $item;
});
return compact('count','list');
}
/**
* TODO 我点赞过的文章
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserStartCommunityByVideos(array $where, int $page, int $limit)
{
$query = $this->joinUser($where)->with([
'community'=> function($query) {
$query->with(['author'=> function($query) {
$query->field('uid,avatar,nickname');
}]);
},
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->each(function ($item){
$item['time'] = date('m月d日', strtotime($item['create_time']));
return $item;
});
return compact('count','list');
}
public function getFieldCount(string $field, int $value, string $type)
{
return $this->getSearch([$field => $value, 'type' => $type,])->count();
}
/**
*
*/
public function createMany(int $leftId, array $rightId, string $type)
{
if (!empty($rightId)) {
foreach ($rightId as $value) {
$res[] = [
'left_id' => $leftId,
'right_id' => $value,
'type' => $type,
];
}
self::batchInsert($res);
}
}
/**
* 批量插入
*
* @param array $data
* @return int
* @author xaboy
* @day 2020/6/8
*/
public function batchInsert(array $data)
{
$rows = Relevance::insertAll($data);
return $rows;
}
// ------- 2 ---------------
public function clear(int $id, $type, string $field)
{
if (is_string($type)) $type = [$type];
return Relevance::where($field, $id)->whereIn('type', $type)->delete();
}
public function joinUser($where)
{
$query = Relevance::hasWhere('community',function($query) use($where){
$query->where('status',1)->where('is_show',1)->where('is_del',0);
$query->when(isset($where['is_type']) && $where['is_type'] !== '',function($query) use($where){
$query->where('is_type',$where['is_type']);
});
});
$query->where('left_id',$where['uid'])->where('type',self::TYPE_COMMUNITY_START);
return $query;
}
//--------------------------
}
<?php
/**
* @date 2023年03月9日
* @author刘孝全
* @emailq8197264@126.com
*
* @ 商品参数关联表
*/
namespace app\common\model\merchant\system;
use app\common\model\merchant\store\product\Spu;
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;
use think\Model;
use think\exception\ValidateException;
class Relevance extends Model
{
protected $connection = 'shop';
protected $table = 'eb_relevance';
protected $pk = 'relevance_id';
//文章关联商品
const TYPE_COMMUNITY_PRODUCT = 'community_product';
//社区关注
const TYPE_COMMUNITY_FANS = 'fans';
//社区文章点赞
const TYPE_COMMUNITY_START = 'community_start';
//社区评论点赞
const TYPE_COMMUNITY_REPLY_START = 'community_reply_start';
//商户权限
const TYPE_MERCHANT_AUTH = 'mer_auth';
//指定范围类型
//0全部商品
const TYPE_ALL = 'scope_type';
//指定商品
const SCOPE_TYPE_PRODUCT = 'scope_type_product';
//指定分类
const SCOPE_TYPE_CATEGORY = 'scope_type_category';
//指定商户
const SCOPE_TYPE_STORE = 'scope_type_store';
//价格说明关联分类
const PRICE_RULE_CATEGORY = 'price_rule_category';
//商品参数关联
const PRODUCT_PARAMES_CATE = 'product_params_cate';
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);
}
/**
* @return static
*/
public static function getInstance(): self
{
return new static();
}
/**
* TODO 搜索
* @param $where
* @return BaseModel
* @author Qinii
* @day 2020-10-16
*/
protected function getSearch(array $where)
{
foreach ($where as $key => $item) {
if ($item !== '') {
$keyArray[] = $key;
$whereArr[$key] = $item;
}
}
if(empty($keyArray)){
return self::getInstance()->db();
}else{
return self::withSearch($keyArray, $whereArr);
}
}
/**
* TODO 添加
* @param int $leftId
* @param int $rightId
* @param string $type
* @param $check
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function insert(int $leftId, int $rightId, string $type, bool $check = false)
{
if ($check && $this->checkHas($leftId, $rightId, $type)) {
return false;
}
$data = [
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
];
try{
Relevance::create($data);
return true;
} catch (\Exception $exception) {
throw new ValidateException('创建失败');
}
}
/**
* TODO 删除
* @param int $leftId
* @param string $type
* @param int $rightId
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function destory(int $leftId, int $rightId, string $type)
{
return $this->getSearch([
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
])->delete();
}
/**
* TODO 检测是否存在
* @param int $leftId
* @param int $rightId
* @param string $type
* @return int
* @author Qinii
* @day 10/28/21
*/
public function checkHas(int $leftId, int $rightId, string $type)
{
return $this->getSearch([
'left_id' => $leftId,
'right_id'=> $rightId,
'type' => $type,
])->count();
}
/**
* TODO 根据左键批量删除
* @param int $leftId
* @param $type
* @return bool
* @author Qinii
* @day 10/28/21
*/
public function batchDelete(int $leftId, $type)
{
return $this->getSearch([
'left_id' => $leftId,
'type' => $type,
])->delete();
}
/**
* TODO 关注我的人
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserFans(int $uid, int $page, int $limit)
{
$query = $this->getSearch([
'right_id' => $uid,
'type' => self::TYPE_COMMUNITY_FANS,
])->with([
'fans' => function($query) {
$query->field('uid,avatar,nickname,count_fans');
}
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->append(['is_start']);
return compact('count','list');
}
/**
* TODO 我关注的人
* @param $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserFocus(int $uid, int $page, int $limit)
{
$query = $this->getSearch([
'left_id' => $uid,
'type' => self::TYPE_COMMUNITY_FANS,
])->with([
'focus' => function($query) {
$query->field('uid,avatar,nickname,count_fans');
}
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->append(['is_fans']);
return compact('count','list');
}
/**
* TODO 我点赞过的文章
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserStartCommunity(array $where, int $page, int $limit)
{
$query = $this->joinUser($where)->with([
'community'=> function($query) use($where){
$query->with([
'author' => function($query){
$query->field('uid,real_name,status,avatar,nickname,count_start');
},
'is_start' => function($query) use ($where) {
$query->where('left_id',$where['uid']);
},
'topic' => function($query) {
$query->where('status', 1)->where('is_del',0);
$query->field('topic_id,topic_name,status,category_id,pic,is_del');
},
'relevance' => [
'spu' => function($query) {
$query->field('spu_id,store_name,image,price,product_type,activity_id,product_id');
}
],
'is_fans' => function($query) use($where){
$query->where('left_id',$where['uid']);
}]);
},
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->each(function ($item){
$item['time'] = date('m月d日', strtotime($item['create_time']));
return $item;
});
return compact('count','list');
}
/**
* TODO 我点赞过的文章
* @param int $uid
* @return \think\Collection
* @author Qinii
* @day 10/28/21
*/
public function getUserStartCommunityByVideos(array $where, int $page, int $limit)
{
$query = $this->joinUser($where)->with([
'community'=> function($query) {
$query->with(['author'=> function($query) {
$query->field('uid,avatar,nickname');
}]);
},
]);
$count = $query->count();
$list = $query->page($page, $limit)->select()->each(function ($item){
$item['time'] = date('m月d日', strtotime($item['create_time']));
return $item;
});
return compact('count','list');
}
public function getFieldCount(string $field, int $value, string $type)
{
return $this->getSearch([$field => $value, 'type' => $type,])->count();
}
/**
*
*/
public function createMany(int $leftId, array $rightId, string $type)
{
if (!empty($rightId)) {
foreach ($rightId as $value) {
$res[] = [
'left_id' => $leftId,
'right_id' => $value,
'type' => $type,
];
}
self::batchInsert($res);
}
}
/**
* 批量插入
*
* @param array $data
* @return int
* @author xaboy
* @day 2020/6/8
*/
public function batchInsert(array $data)
{
$rows = Relevance::insertAll($data);
return $rows;
}
// ------- 2 ---------------
public function clear(int $id, $type, string $field)
{
if (is_string($type)) $type = [$type];
return Relevance::where($field, $id)->whereIn('type', $type)->delete();
}
public function joinUser($where)
{
$query = Relevance::hasWhere('community',function($query) use($where){
$query->where('status',1)->where('is_show',1)->where('is_del',0);
$query->when(isset($where['is_type']) && $where['is_type'] !== '',function($query) use($where){
$query->where('is_type',$where['is_type']);
});
});
$query->where('left_id',$where['uid'])->where('type',self::TYPE_COMMUNITY_START);
return $query;
}
//--------------------------
}

View File

@ -1,294 +1,294 @@
<?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\validate\merchant\admin;
use think\Validate;
class MerchantApplymentsValidate extends Validate
{
protected $failException = true;
//2401小微商户指无营业执照的个人商家。
//2500个人卖家指无营业执照已持续从事电子商务经营活动满6个月且期间经营收入累计超过20万元的个人商家。若选择该主体请在“补充说明”填写相关描述
//4个体工商户营业执照上的主体类型一般为个体户、个体工商户、个体经营。
//2企业营业执照上的主体类型一般为有限公司、有限责任公司。
//3党政、机关及事业单位包括国内各级、各类政府机构、事业单位等公安、党 团、司法、交通、旅游、工商税务、市政、医疗、教育、学校等机构)。
//1708其他组织不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基 金会),要求机构已办理组织机构代码证。
protected $rule = [
'organization_type|主体类型' => 'require|in:2,3,4,2401,2500,1708',
'business_license_info|营业执照/登记证书信息' => 'checkBusinessInfo',
// 'organization_cert_info|组织机构代码证信息' => 'checkOrganization',
'id_doc_type|证件类型' => 'require|in:1,2,3,4,5,6,7,8',
'id_card_info|经营者/法人身份证信息' => 'checkIdCardInfo',
'id_doc_info|经营者/法人身份证信息' => 'checkIdDocInfo',
// 'need_account_info|是否填写结算银行账户' => 'require|in:true,false', 废弃字段
'account_info|结算银行账户' => 'getAccountInfo',
'contact_info|超级管理员信息' => 'getContactInfo',
'sales_scene_info|店铺信息'=>'checkSalesSceneInfo',
'merchant_shortname|商户简称' => 'require',
'business_addition_desc' => 'checkBusinessAdditionDesc',
];
/**
* TODO 营业执照/登记证书信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkBusinessInfo($item,$rule,$data)
{
if(!in_array($data['organization_type'],['2401','2500'])){
if(empty($item)) return '营业执照/登记证书信息为空';
if(!isset($item['business_license_copy']) || empty($item['business_license_copy'])) return '证件扫描件为空';
if(!isset($item['business_license_number']) || empty($item['business_license_number'])) return '证件注册号为空';
if(!isset($item['merchant_name']) || empty($item['merchant_name'])) return '商户名称为空';
if(!isset($item['legal_person']) || empty($item['legal_person'])) return '经营者/法定代表人姓名为空';
if(isset($item['business_time'])) {
$statr = $item['business_time'][0];
$end = $item['business_time'][1];
if ($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if (($t / (3600 * 24)) <= 60) return '营业执照/登记证书有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
}
return true;
}
/**
* TODO 组织机构代码证信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkOrganization($item,$rule,$data)
{
$len = strlen($data['business_license_info']['business_license_number']);
if(!in_array($data['organization_type'],['4','2401','2500']) && $len === 18){
if(empty($item)) return '组织机构代码证信息为空';
if(!isset($item['organization_copy']) || empty($item['organization_copy'])) return '组织机构代码证照片为空';
if(!isset($item['organization_number']) || empty($item['organization_number'])) return '组织机构代码为空';
if(!isset($item['organization_time']) || empty($item['organization_time'])) return '组织机构代码有效期限为空';
// list($statr,$end) = explode(',',$item['organization_time']);
$statr = $item['organization_time'][0];
$end = $item['organization_time'][1];
if($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '组织机构代码证有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
return true;
}
/**
* TODO 经营者/法人身份证信息/身份证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdCardInfo($item,$rule,$data)
{
if($data['id_doc_type'] == 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_card_copy']) || empty($item['id_card_copy'])) return '身份证人像面照片为空';
if(!isset($item['id_card_national']) || empty($item['id_card_national'])) return '身份证国徽面照片为空';
if(!isset($item['id_card_name']) || empty($item['id_card_name'])) return '身份证姓名为空';
if(!isset($item['id_card_number']) || empty($item['id_card_number'])) return '身份证号码为空';
if(!isset($item['id_card_valid_time_begin']) || empty($item['id_card_valid_time_begin'])) return '经营者/法人身份证信息身份证开始时间为空';
if(!isset($item['id_card_valid_time']) || empty($item['id_card_valid_time'])) return '经营者/法人身份证信息身份证有效期限为空';
if($item['id_card_valid_time'] !== '长期') {
$statr = time();
$end = strtotime($item['id_card_valid_time']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人身份证信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['id_card_valid_time_begin']) >= strtotime($item['id_card_valid_time'])) return '经营者/法人身份证信息证件结束日期必须大于证件开始时间';
}
if($data['organization_type'] === 2){
if(!isset($item['id_card_address']) || empty($item['id_card_address'])) return '经营者/法人身份证信息身份证居住地址为空';
}
};
return true;
}
/**
* TODO 经营者/法人身份证信息/通行证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdDocInfo($item,$rule,$data)
{
if(in_array($data['organization_type'],['2401','2500']) && !empty($item)) return '小微/个人卖家可选证件类型:身份证';
if($data['id_doc_type'] !== 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_doc_name']) || empty($item['id_doc_name'])) return '证件姓名为空';
if(!isset($item['id_doc_number']) || empty($item['id_doc_number'])) return '证件号码为空';
if(!isset($item['id_doc_copy']) || empty($item['id_doc_copy'])) return '经营者/法人其他类型证件信息证件正面照片为空';
if($data['id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['id_doc_copy_back']) || empty($item['id_doc_copy_back'])) return '经营者/法人其他类型证件信息证件反面照片为空';
}
if(!isset($item['doc_period_begin']) || empty($item['doc_period_begin'])) return '经营者/法人其他类型证件信息证件有效期开始时间为空';
if(!isset($item['doc_period_end']) || empty($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期为空';
if($item['doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人其他类型证件信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['doc_period_begin']) >= strtotime($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期必须大于证件开始时间';
if($data['organization_type'] === 2){
if(!isset($item['id_doc_address']) || empty($item['id_doc_address'])) return '经营者/法人其他类型证件信息证件居住地址为空';
}
}
}
return true;
}
/**
* TODO 结算银行账户
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getAccountInfo($item,$rule,$data)
{
// if($data['need_account_info']){
if(empty($item)) return '结算银行账户信息为空';
if(!isset($item['bank_account_type']) || empty($item['bank_account_type'])) return '账户类型为空';
if(!isset($item['account_bank']) || empty($item['account_bank'])) return '开户银行为空';
if(!isset($item['account_name']) || empty($item['account_name'])) return '开户名称为空';
if(!isset($item['bank_address_code']) || empty($item['bank_address_code'])) return '开户银行省市编码为空';
if(!isset($item['account_number']) || empty($item['account_number'])) return '银行帐号为空';
// }
return true;
}
/**
* TODO 超级管理员信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getContactInfo($item,$rule,$data)
{
if(empty($item)) return '超级管理员信息信息为空';
if(!isset($item['contact_type']) || empty($item['contact_type'])) return '超级管理员类型为空';
if(!isset($item['contact_name']) || empty($item['contact_name'])) return '超级管理员姓名为空';
if(!isset($item['contact_id_card_number']) || empty($item['contact_id_card_number'])) return '超级管理员身份证件号码为空';
if(!isset($item['mobile_phone']) || empty($item['mobile_phone'])) return '超级管理员手机为空';
if(!in_array($data['organization_type'],['2401','2500'])){
if(!isset($item['contact_email']) || empty($item['contact_email'])) return '邮箱为空';
}
if($item['contact_type'] === 66) //当超级管理员类型为66经办人时
{
if(!isset($item['contact_id_doc_type']) || empty($item['contact_id_doc_type']) || !in_array($item['contact_id_doc_type'],[1,2,3,4,5,6,7,8])) return '超级管理员证件类型为空或不合法';
if(!isset($item['contact_id_doc_copy']) || empty($item['contact_id_doc_copy'])) return '超级管理员信息证件正面照片为空';
if($item['contact_id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['contact_id_doc_copy_back']) || empty($item['contact_id_doc_copy_back'])) return '超级管理员信息证件反面照片为空';
}
if(!isset($item['contact_id_doc_period_begin']) || empty($item['contact_id_doc_period_begin'])) return '超级管理员信息证件有效期开始时间为空';
if(!isset($item['contact_id_doc_period_end']) || empty($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期为空';
if($item['contact_id_doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['contact_id_doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '超级管理员信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['contact_id_doc_period_begin']) >= strtotime($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期必须大于证件开始时间';
}
if(!isset($item['business_authorization_letter']) || empty($item['business_authorization_letter'])) return '超级管理员信息业务办理授权函为空';
}
return true;
}
/**
* TODO 店铺信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkSalesSceneInfo($item,$rule,$data)
{
if(empty($item)) return '店铺信息为空';
if(!isset($item['store_name']) || empty($item['store_name'])) return '店铺名称为空';
if(!isset($item['store_url']) && !isset($item['store_url'])) return '店铺链接和店铺二维码二选一';
return true;
}
/**
* TODO 补充说明s
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/24/21
*/
protected function checkBusinessAdditionDesc($item,$rule,$data)
{
if($data['organization_type'] == 2500 && empty($item)) return '若主体为“个人卖家”:补充说明不能为空';
return true;
}
}
<?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\validate\merchant\admin;
use think\Validate;
class MerchantApplymentsValidate extends Validate
{
protected $failException = true;
//2401小微商户指无营业执照的个人商家。
//2500个人卖家指无营业执照已持续从事电子商务经营活动满6个月且期间经营收入累计超过20万元的个人商家。若选择该主体请在“补充说明”填写相关描述
//4个体工商户营业执照上的主体类型一般为个体户、个体工商户、个体经营。
//2企业营业执照上的主体类型一般为有限公司、有限责任公司。
//3党政、机关及事业单位包括国内各级、各类政府机构、事业单位等公安、党 团、司法、交通、旅游、工商税务、市政、医疗、教育、学校等机构)。
//1708其他组织不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基 金会),要求机构已办理组织机构代码证。
protected $rule = [
'organization_type|主体类型' => 'require|in:2,3,4,2401,2500,1708',
'business_license_info|营业执照/登记证书信息' => 'checkBusinessInfo',
// 'organization_cert_info|组织机构代码证信息' => 'checkOrganization',
'id_doc_type|证件类型' => 'require|in:1,2,3,4,5,6,7,8',
'id_card_info|经营者/法人身份证信息' => 'checkIdCardInfo',
'id_doc_info|经营者/法人身份证信息' => 'checkIdDocInfo',
// 'need_account_info|是否填写结算银行账户' => 'require|in:true,false', 废弃字段
'account_info|结算银行账户' => 'getAccountInfo',
'contact_info|超级管理员信息' => 'getContactInfo',
'sales_scene_info|店铺信息'=>'checkSalesSceneInfo',
'merchant_shortname|商户简称' => 'require',
'business_addition_desc' => 'checkBusinessAdditionDesc',
];
/**
* TODO 营业执照/登记证书信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkBusinessInfo($item,$rule,$data)
{
if(!in_array($data['organization_type'],['2401','2500'])){
if(empty($item)) return '营业执照/登记证书信息为空';
if(!isset($item['business_license_copy']) || empty($item['business_license_copy'])) return '证件扫描件为空';
if(!isset($item['business_license_number']) || empty($item['business_license_number'])) return '证件注册号为空';
if(!isset($item['merchant_name']) || empty($item['merchant_name'])) return '商户名称为空';
if(!isset($item['legal_person']) || empty($item['legal_person'])) return '经营者/法定代表人姓名为空';
if(isset($item['business_time'])) {
$statr = $item['business_time'][0];
$end = $item['business_time'][1];
if ($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if (($t / (3600 * 24)) <= 60) return '营业执照/登记证书有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
}
return true;
}
/**
* TODO 组织机构代码证信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkOrganization($item,$rule,$data)
{
$len = strlen($data['business_license_info']['business_license_number']);
if(!in_array($data['organization_type'],['4','2401','2500']) && $len === 18){
if(empty($item)) return '组织机构代码证信息为空';
if(!isset($item['organization_copy']) || empty($item['organization_copy'])) return '组织机构代码证照片为空';
if(!isset($item['organization_number']) || empty($item['organization_number'])) return '组织机构代码为空';
if(!isset($item['organization_time']) || empty($item['organization_time'])) return '组织机构代码有效期限为空';
// list($statr,$end) = explode(',',$item['organization_time']);
$statr = $item['organization_time'][0];
$end = $item['organization_time'][1];
if($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '组织机构代码证有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
return true;
}
/**
* TODO 经营者/法人身份证信息/身份证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdCardInfo($item,$rule,$data)
{
if($data['id_doc_type'] == 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_card_copy']) || empty($item['id_card_copy'])) return '身份证人像面照片为空';
if(!isset($item['id_card_national']) || empty($item['id_card_national'])) return '身份证国徽面照片为空';
if(!isset($item['id_card_name']) || empty($item['id_card_name'])) return '身份证姓名为空';
if(!isset($item['id_card_number']) || empty($item['id_card_number'])) return '身份证号码为空';
if(!isset($item['id_card_valid_time_begin']) || empty($item['id_card_valid_time_begin'])) return '经营者/法人身份证信息身份证开始时间为空';
if(!isset($item['id_card_valid_time']) || empty($item['id_card_valid_time'])) return '经营者/法人身份证信息身份证有效期限为空';
if($item['id_card_valid_time'] !== '长期') {
$statr = time();
$end = strtotime($item['id_card_valid_time']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人身份证信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['id_card_valid_time_begin']) >= strtotime($item['id_card_valid_time'])) return '经营者/法人身份证信息证件结束日期必须大于证件开始时间';
}
if($data['organization_type'] === 2){
if(!isset($item['id_card_address']) || empty($item['id_card_address'])) return '经营者/法人身份证信息身份证居住地址为空';
}
};
return true;
}
/**
* TODO 经营者/法人身份证信息/通行证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdDocInfo($item,$rule,$data)
{
if(in_array($data['organization_type'],['2401','2500']) && !empty($item)) return '小微/个人卖家可选证件类型:身份证';
if($data['id_doc_type'] !== 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_doc_name']) || empty($item['id_doc_name'])) return '证件姓名为空';
if(!isset($item['id_doc_number']) || empty($item['id_doc_number'])) return '证件号码为空';
if(!isset($item['id_doc_copy']) || empty($item['id_doc_copy'])) return '经营者/法人其他类型证件信息证件正面照片为空';
if($data['id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['id_doc_copy_back']) || empty($item['id_doc_copy_back'])) return '经营者/法人其他类型证件信息证件反面照片为空';
}
if(!isset($item['doc_period_begin']) || empty($item['doc_period_begin'])) return '经营者/法人其他类型证件信息证件有效期开始时间为空';
if(!isset($item['doc_period_end']) || empty($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期为空';
if($item['doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人其他类型证件信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['doc_period_begin']) >= strtotime($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期必须大于证件开始时间';
if($data['organization_type'] === 2){
if(!isset($item['id_doc_address']) || empty($item['id_doc_address'])) return '经营者/法人其他类型证件信息证件居住地址为空';
}
}
}
return true;
}
/**
* TODO 结算银行账户
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getAccountInfo($item,$rule,$data)
{
// if($data['need_account_info']){
if(empty($item)) return '结算银行账户信息为空';
if(!isset($item['bank_account_type']) || empty($item['bank_account_type'])) return '账户类型为空';
if(!isset($item['account_bank']) || empty($item['account_bank'])) return '开户银行为空';
if(!isset($item['account_name']) || empty($item['account_name'])) return '开户名称为空';
if(!isset($item['bank_address_code']) || empty($item['bank_address_code'])) return '开户银行省市编码为空';
if(!isset($item['account_number']) || empty($item['account_number'])) return '银行帐号为空';
// }
return true;
}
/**
* TODO 超级管理员信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getContactInfo($item,$rule,$data)
{
if(empty($item)) return '超级管理员信息信息为空';
if(!isset($item['contact_type']) || empty($item['contact_type'])) return '超级管理员类型为空';
if(!isset($item['contact_name']) || empty($item['contact_name'])) return '超级管理员姓名为空';
if(!isset($item['contact_id_card_number']) || empty($item['contact_id_card_number'])) return '超级管理员身份证件号码为空';
if(!isset($item['mobile_phone']) || empty($item['mobile_phone'])) return '超级管理员手机为空';
if(!in_array($data['organization_type'],['2401','2500'])){
if(!isset($item['contact_email']) || empty($item['contact_email'])) return '邮箱为空';
}
if($item['contact_type'] === 66) //当超级管理员类型为66经办人时
{
if(!isset($item['contact_id_doc_type']) || empty($item['contact_id_doc_type']) || !in_array($item['contact_id_doc_type'],[1,2,3,4,5,6,7,8])) return '超级管理员证件类型为空或不合法';
if(!isset($item['contact_id_doc_copy']) || empty($item['contact_id_doc_copy'])) return '超级管理员信息证件正面照片为空';
if($item['contact_id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['contact_id_doc_copy_back']) || empty($item['contact_id_doc_copy_back'])) return '超级管理员信息证件反面照片为空';
}
if(!isset($item['contact_id_doc_period_begin']) || empty($item['contact_id_doc_period_begin'])) return '超级管理员信息证件有效期开始时间为空';
if(!isset($item['contact_id_doc_period_end']) || empty($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期为空';
if($item['contact_id_doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['contact_id_doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '超级管理员信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['contact_id_doc_period_begin']) >= strtotime($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期必须大于证件开始时间';
}
if(!isset($item['business_authorization_letter']) || empty($item['business_authorization_letter'])) return '超级管理员信息业务办理授权函为空';
}
return true;
}
/**
* TODO 店铺信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkSalesSceneInfo($item,$rule,$data)
{
if(empty($item)) return '店铺信息为空';
if(!isset($item['store_name']) || empty($item['store_name'])) return '店铺名称为空';
if(!isset($item['store_url']) && !isset($item['store_url'])) return '店铺链接和店铺二维码二选一';
return true;
}
/**
* TODO 补充说明s
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/24/21
*/
protected function checkBusinessAdditionDesc($item,$rule,$data)
{
if($data['organization_type'] == 2500 && empty($item)) return '若主体为“个人卖家”:补充说明不能为空';
return true;
}
}

View File

@ -1,21 +1,21 @@
<?php
namespace app\validate\merchant\admin;
use think\Validate;
class MerchantTypeValidate extends Validate
{
protected $failException = true;
protected $rule = [
'type_name|店铺类型名称' => 'require|max:5',
'type_info|店铺类型要求' => 'max:256',
'is_margin|是否有保证金' => 'require|in:0,1',
'auth|权限' => 'require|array|min:1',
'margin|保证金(¥)' => 'requireIf:is_margin,1',
'description|其他说明' => 'max:256',
];
}
<?php
namespace app\validate\merchant\admin;
use think\Validate;
class MerchantTypeValidate extends Validate
{
protected $failException = true;
protected $rule = [
'type_name|店铺类型名称' => 'require|max:5',
'type_info|店铺类型要求' => 'max:256',
'is_margin|是否有保证金' => 'require|in:0,1',
'auth|权限' => 'require|array|min:1',
'margin|保证金(¥)' => 'requireIf:is_margin,1',
'description|其他说明' => 'max:256',
];
}

View File

@ -1,7 +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,5 +1,5 @@
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}