新建商品、商户类型、商户分类、商品分类、评论模型;新建商品、商品分类、评论控制器;新建商品、商品分类、评论视图;
This commit is contained in:
parent
85d6b9407a
commit
9b81c17b39
262
app/admin/controller/product/Classify.php
Normal file
262
app/admin/controller/product/Classify.php
Normal file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\controller\product;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\StoreCategory; // 商品分类模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
|
||||
/**
|
||||
*
|
||||
* 商品分类控制器
|
||||
*
|
||||
*/
|
||||
class Classify extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->adminInfo = get_login_admin();
|
||||
$this->category_id=354;
|
||||
$this->url=[
|
||||
'/admin/product.classify/index?category_id='.$this->category_id,
|
||||
'/admin/product.classify/add',
|
||||
'/admin/product.classify/edit',
|
||||
'/admin/product.classify/delete'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 商城分类列表
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params= get_params();
|
||||
|
||||
$where = [];
|
||||
|
||||
if (isset($params['keywords']) && !empty($params['keywords'])){
|
||||
$where[]= ['name','like','%'.$params['keywords'].'%'];
|
||||
}
|
||||
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
|
||||
$www['admin_id'] = $this->adminInfo['id'];
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address){
|
||||
if($user_address['auth_range'] == 1){
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}elseif ($user_address['auth_range'] == 2){
|
||||
$where[] = ['street_id','=',$user_address['street_id']];
|
||||
}elseif ($user_address['auth_range'] == 3){
|
||||
$where[] = ['area_id','=',$user_address['area_id']];
|
||||
}else{
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['village_id','=',''];
|
||||
}
|
||||
}
|
||||
|
||||
$total = StoreCategory::where('level', 0)->where('mer_id', 0)->where($where)->count();
|
||||
|
||||
// $list = StoreCategory::with(['merchant', 'street', 'area'])->order('id desc')->select();
|
||||
$list = StoreCategory::where('level', 0)->where('mer_id', 0)->order('store_category_id desc')->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
|
||||
$result = ['total' => $total, 'data' => $list];
|
||||
|
||||
return table_assign(0, '', $result);
|
||||
|
||||
}else{
|
||||
|
||||
$list = StoreCategory::where('level', 0)->where('mer_id', 0)->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
|
||||
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据入库
|
||||
$res = SupplyChain::create($data);
|
||||
|
||||
// 关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$res->linkMerchant()->save($dataLink); // 插入关联数据
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['id'] = $params['id']; // 当前ID
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据更新
|
||||
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
|
||||
$res = $supplyChain->update($data);
|
||||
|
||||
// 获取关联数据一对一---曲线救国
|
||||
$linkMerchant = $supplyChain['linkMerchant'];
|
||||
// $linkMerchantArr = $linkMerchant->column('id');
|
||||
|
||||
// 先删除关联数据-- 曲线救国
|
||||
$linkMerchant->delete();
|
||||
|
||||
// 关联商户状态
|
||||
if($data['mer_id_list'])
|
||||
{
|
||||
// 再重新将关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$supplyChain->linkMerchant()->save($dataLink);
|
||||
}
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
$category = StoreCategory::find($id); // 取出当前供应链数据
|
||||
|
||||
View::assign('detail', $category);
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除
|
||||
*
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
$supplyChain = SupplyChain::with(['linkMerchant'])->find($id);
|
||||
// 删除关联模型
|
||||
$res = $supplyChain->together(['linkMerchant'])->delete();
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}
|
||||
|
||||
}
|
263
app/admin/controller/product/Comment.php
Normal file
263
app/admin/controller/product/Comment.php
Normal file
@ -0,0 +1,263 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\controller\product;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\StoreCategory; // 商品分类模型
|
||||
use app\admin\model\StoreProductReply; // 商品评论模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
|
||||
/**
|
||||
*
|
||||
* 商品评论控制器
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Comment extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->adminInfo = get_login_admin();
|
||||
$this->category_id=354;
|
||||
$this->url=[
|
||||
'/admin/product.comment/index?category_id='.$this->category_id,
|
||||
'/admin/product.comment/add',
|
||||
'/admin/product.comment/edit',
|
||||
'/admin/product.comment/del',
|
||||
'/admin/product.comment/index',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 商品评论列表
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params= get_params();
|
||||
|
||||
$where = [];
|
||||
|
||||
if (isset($params['keywords']) && !empty($params['keywords'])){
|
||||
$where[]= ['name','like','%'.$params['keywords'].'%'];
|
||||
}
|
||||
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
|
||||
$www['admin_id'] = $this->adminInfo['id'];
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address){
|
||||
if($user_address['auth_range'] == 1){
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}elseif ($user_address['auth_range'] == 2){
|
||||
$where[] = ['street_id','=',$user_address['street_id']];
|
||||
}elseif ($user_address['auth_range'] == 3){
|
||||
$where[] = ['area_id','=',$user_address['area_id']];
|
||||
}else{
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['village_id','=',''];
|
||||
}
|
||||
}
|
||||
|
||||
$total = StoreProductReply::where($where)->count();
|
||||
|
||||
$list = StoreProductReply::with(['product'])->order('reply_id desc')->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
|
||||
$result = ['total' => $total, 'data' => $list];
|
||||
|
||||
return table_assign(0, '', $result);
|
||||
|
||||
}else{
|
||||
|
||||
$list = StoreProductReply::select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
|
||||
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据入库
|
||||
$res = SupplyChain::create($data);
|
||||
|
||||
// 关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$res->linkMerchant()->save($dataLink); // 插入关联数据
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['id'] = $params['id']; // 当前ID
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据更新
|
||||
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
|
||||
$res = $supplyChain->update($data);
|
||||
|
||||
// 获取关联数据一对一---曲线救国
|
||||
$linkMerchant = $supplyChain['linkMerchant'];
|
||||
// $linkMerchantArr = $linkMerchant->column('id');
|
||||
|
||||
// 先删除关联数据-- 曲线救国
|
||||
$linkMerchant->delete();
|
||||
|
||||
// 关联商户状态
|
||||
if($data['mer_id_list'])
|
||||
{
|
||||
// 再重新将关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$supplyChain->linkMerchant()->save($dataLink);
|
||||
}
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
|
||||
|
||||
View::assign('detail', $supplyChain);
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除
|
||||
*
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$id = get_params("id");
|
||||
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
$res = StoreProductReply::where('reply_id', $id)->delete();
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}
|
||||
|
||||
}
|
262
app/admin/controller/product/Product.php
Normal file
262
app/admin/controller/product/Product.php
Normal file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\controller\product;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\admin\model\Merchant; // 商户模型
|
||||
use app\admin\model\EbStoreProduct; // 商品模型
|
||||
use app\admin\model\GeoCity; // 省市模型
|
||||
use app\admin\model\GeoArea; // 区域模型
|
||||
use app\admin\model\GeoStreet; // 街道模型
|
||||
use app\admin\model\SupplyChain; // 供应链模型
|
||||
use app\api\model\Area as AreaModel; // 市场区域模型
|
||||
use app\api\model\AreaManager as AreaManagerModel; // 区域负责人模型
|
||||
|
||||
/**
|
||||
*
|
||||
* 商品控制器
|
||||
*
|
||||
*/
|
||||
class Product extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->adminInfo = get_login_admin();
|
||||
$this->category_id=354;
|
||||
$this->url=[
|
||||
'/admin/product.product/index?category_id='.$this->category_id,
|
||||
'/admin/product.product/add',
|
||||
'/admin/product.product/edit',
|
||||
'/admin/product.product/delete',
|
||||
'/admin/product.product/index',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 供应链团队列表
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params= get_params();
|
||||
|
||||
$where = [];
|
||||
|
||||
if (isset($params['keywords']) && !empty($params['keywords'])){
|
||||
$where[]= ['name','like','%'.$params['keywords'].'%'];
|
||||
}
|
||||
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
|
||||
$www['admin_id'] = $this->adminInfo['id'];
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address){
|
||||
if($user_address['auth_range'] == 1){
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}elseif ($user_address['auth_range'] == 2){
|
||||
$where[] = ['street_id','=',$user_address['street_id']];
|
||||
}elseif ($user_address['auth_range'] == 3){
|
||||
$where[] = ['area_id','=',$user_address['area_id']];
|
||||
}else{
|
||||
$where[] = ['village_id','=',$user_address['village_id']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['village_id','=',''];
|
||||
}
|
||||
}
|
||||
|
||||
$total = EbStoreProduct::where($where)->count();
|
||||
|
||||
$list = EbStoreProduct::with(['merchant' => ['merchantType', 'category']])->order('product_id desc')->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
|
||||
$result = ['total' => $total, 'data' => $list];
|
||||
|
||||
return table_assign(0, '', $result);
|
||||
|
||||
}else{
|
||||
|
||||
$list = SupplyChain::with(['merchant' => ['merchantType', 'category']])->select();
|
||||
|
||||
View::assign('url', $this->url);
|
||||
View::assign('list', $list);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户
|
||||
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据入库
|
||||
$res = SupplyChain::create($data);
|
||||
|
||||
// 关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$res->linkMerchant()->save($dataLink); // 插入关联数据
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
if (request()->isAjax()) {
|
||||
|
||||
$params = get_params();
|
||||
|
||||
$data['id'] = $params['id']; // 当前ID
|
||||
$data['user_id'] = $this->adminInfo['id']; // 操作用户ID
|
||||
$data['name'] = $params['title']; // 团队名称
|
||||
$data['tel'] = $params['phone']; // 联系电话
|
||||
$data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户
|
||||
$data['street_id'] = $params['street_id']; // 街道ID
|
||||
$street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据
|
||||
$data['lng'] = $street['lng']; // 经度
|
||||
$data['lat'] = $street['lat']; // 纬度
|
||||
$area = $street->area; // 区数据
|
||||
$data['area_id'] = $area['area_id']; // 区县id
|
||||
$city = $area->city; // 获取市级
|
||||
$data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
// 数据更新
|
||||
$supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']);
|
||||
$res = $supplyChain->update($data);
|
||||
|
||||
// 获取关联数据一对一---曲线救国
|
||||
$linkMerchant = $supplyChain['linkMerchant'];
|
||||
// $linkMerchantArr = $linkMerchant->column('id');
|
||||
|
||||
// 先删除关联数据-- 曲线救国
|
||||
$linkMerchant->delete();
|
||||
|
||||
// 关联商户状态
|
||||
if($data['mer_id_list'])
|
||||
{
|
||||
// 再重新将关联数据入库
|
||||
foreach ($params['mer_id'] as $v) {
|
||||
|
||||
$dataLink = [
|
||||
'eb_merchant_id' => $v, // 商户ID
|
||||
'user_id' => $data['user_id'],
|
||||
'create_time' => $data['create_time'],
|
||||
];
|
||||
|
||||
$supplyChain->linkMerchant()->save($dataLink);
|
||||
}
|
||||
}
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}else{
|
||||
|
||||
$supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据
|
||||
|
||||
View::assign('detail', $supplyChain);
|
||||
|
||||
// 取出正常的商家
|
||||
$merchant = Merchant::where('status', 1)->column('mer_id, real_name');
|
||||
// 区域模型
|
||||
$arealist = GeoArea::where('city_code', '510500')->select();
|
||||
|
||||
View::assign('arealist', $arealist);
|
||||
View::assign('merchant', $merchant);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除
|
||||
*
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if(!$id) return to_assign(1, '非法操作!');
|
||||
|
||||
$supplyChain = SupplyChain::with(['linkMerchant'])->find($id);
|
||||
// 删除关联模型
|
||||
$res = $supplyChain->together(['linkMerchant'])->delete();
|
||||
|
||||
if ($res){
|
||||
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||
}
|
||||
|
||||
return to_assign(1, '操作失败,原因:'.$res);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 时间:2023年03月04日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 订单模型
|
||||
@ -19,4 +19,13 @@
|
||||
protected $table = 'eb_store_product';
|
||||
protected $pk = 'product_id';
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户
|
||||
*
|
||||
*/
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
||||
}
|
||||
}
|
@ -29,5 +29,24 @@
|
||||
return $this->hasOneThrough(SupplyChainLinkMerchant::class, SupplyChain::class);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户类型
|
||||
*
|
||||
*/
|
||||
public function merchantType()
|
||||
{
|
||||
return $this->hasOne(MerchantType::class, 'mer_type_id', 'type_id');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户类别
|
||||
*
|
||||
*/
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne(MerchantCategory::class, 'merchant_category_id', 'category_id');
|
||||
}
|
||||
|
||||
}
|
22
app/admin/model/MerchantCategory.php
Normal file
22
app/admin/model/MerchantCategory.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月04日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 商户分类模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class MerchantCategory extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_merchant_category';
|
||||
protected $pk = 'merchant_category_id';
|
||||
|
||||
}
|
22
app/admin/model/MerchantType.php
Normal file
22
app/admin/model/MerchantType.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月04日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 商户类型模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class MerchantType extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_merchant_type';
|
||||
protected $pk = 'mer_type_id';
|
||||
|
||||
}
|
22
app/admin/model/StoreCategory.php
Normal file
22
app/admin/model/StoreCategory.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 商品分类模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class StoreCategory extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_store_category';
|
||||
protected $pk = 'store_category_id';
|
||||
|
||||
}
|
51
app/admin/model/StoreProductReply.php
Normal file
51
app/admin/model/StoreProductReply.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 时间:2023年03月02日
|
||||
* 作者:墨楠小
|
||||
* 邮箱:monanxiao@qq.com
|
||||
* 商品评论模型
|
||||
*
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class StoreProductReply extends Model
|
||||
{
|
||||
// 设置当前模型的数据库连接
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'eb_store_product_reply';
|
||||
protected $pk = 'reply_id';
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商户
|
||||
*
|
||||
*/
|
||||
public function merchant()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联用户
|
||||
*
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联商品
|
||||
*
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(EbStoreProduct::class, 'product_id', 'product_id');
|
||||
}
|
||||
}
|
200
app/admin/view/product/classify/add.html
Normal file
200
app/admin/view/product/classify/add.html
Normal file
@ -0,0 +1,200 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
.layui-td-gray {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.addrhelper-ok-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">关联商户</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >请选择商户</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">已选商户<font>*</font></label>
|
||||
<div class="layui-input-block" id="merchantList" >
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队电话<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
|
||||
<td>
|
||||
<div class="layui-col-md4">
|
||||
<select name="" lay-filter="merchantAddress" lay-search>
|
||||
<option value="">选择区域</option>
|
||||
{volist name='arealist' id='vo'}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">街道/镇</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="demo1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[1]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'street_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false,
|
||||
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
188
app/admin/view/product/classify/edit.html
Normal file
188
app/admin/view/product/classify/edit.html
Normal file
@ -0,0 +1,188 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
.layui-td-gray{
|
||||
width: 110px;
|
||||
}
|
||||
.addrhelper-ok-btn{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<input type="hidden" name="id" value="{$detail.store_category_id}">
|
||||
<h3 class="pb-3">编辑</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >上级分类</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">分类名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" value="{$detail.cate_name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传分类图片(尺寸:110x110)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||
<input type="hidden" name="avatar" value="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">排序<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="sort" required lay-verify="required" value="{$detail.sort}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[2]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
street("{$detail.store_category_id}");
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'pid',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: ['{$detail.pid}'],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
185
app/admin/view/product/classify/index.html
Normal file
185
app/admin/view/product/classify/index.html
Normal file
@ -0,0 +1,185 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<form class="layui-form gg-form-bar border-t border-x">
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="article" lay-filter="article"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="thumb">
|
||||
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group">
|
||||
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if} -->
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table,tool = layui.tool, form = layui.form;
|
||||
layui.pageTable = table.render({
|
||||
elem: '#article',
|
||||
title: '列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '{$url[0]}',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'store_category_id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width:80,
|
||||
},{
|
||||
field: 'cate_name',
|
||||
title: '分类名称',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'pic',
|
||||
title: '分类图标',
|
||||
align: 'center',
|
||||
width:120,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEA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class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="` + d.pic + `" />
|
||||
</div>`;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'is_show',
|
||||
title: '是否显示',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = d.is_show ? '显示' : '隐藏';
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'is_hot',
|
||||
title: '是否推荐',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = d.is_hot ? '推荐' : '不推荐';
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '添加时间',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(article)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side('{$url[1]}');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('{$url[2]}?id='+obj.data.store_category_id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('{$url[2]}?id='+obj.data.store_category_id);
|
||||
}
|
||||
else if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete('{$url[3]}', { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
200
app/admin/view/product/comment/add.html
Normal file
200
app/admin/view/product/comment/add.html
Normal file
@ -0,0 +1,200 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
.layui-td-gray {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.addrhelper-ok-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">关联商户</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >请选择商户</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">已选商户<font>*</font></label>
|
||||
<div class="layui-input-block" id="merchantList" >
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队电话<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
|
||||
<td>
|
||||
<div class="layui-col-md4">
|
||||
<select name="" lay-filter="merchantAddress" lay-search>
|
||||
<option value="">选择区域</option>
|
||||
{volist name='arealist' id='vo'}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">街道/镇</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="demo1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[1]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'street_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false,
|
||||
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
188
app/admin/view/product/comment/edit.html
Normal file
188
app/admin/view/product/comment/edit.html
Normal file
@ -0,0 +1,188 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
.layui-td-gray{
|
||||
width: 110px;
|
||||
}
|
||||
.addrhelper-ok-btn{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<input type="hidden" name="id" value="{$detail.store_category_id}">
|
||||
<h3 class="pb-3">编辑</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >上级分类</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">分类名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" value="{$detail.cate_name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传分类图片(尺寸:110x110)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||
<input type="hidden" name="avatar" value="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">排序<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="sort" required lay-verify="required" value="{$detail.sort}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[2]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
street("{$detail.store_category_id}");
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'pid',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: ['{$detail.pid}'],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
200
app/admin/view/product/comment/index.html
Normal file
200
app/admin/view/product/comment/index.html
Normal file
@ -0,0 +1,200 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<form class="layui-form gg-form-bar border-t border-x">
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="article" lay-filter="article"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="thumb">
|
||||
|
||||
</script>
|
||||
<!-- <script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加虚拟评论">+ 添加虚拟评论</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script> -->
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group">
|
||||
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if} -->
|
||||
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if} -->
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table,tool = layui.tool, form = layui.form;
|
||||
layui.pageTable = table.render({
|
||||
elem: '#article',
|
||||
title: '列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '{$url[0]}',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'reply_id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width:80,
|
||||
},{
|
||||
field: 'store_name',
|
||||
title: '商品名称',
|
||||
align: 'center',
|
||||
width:120,
|
||||
templet: function (d)
|
||||
{
|
||||
return d.product.store_name;
|
||||
},
|
||||
},{
|
||||
field: 'pic',
|
||||
title: '商品图',
|
||||
align: 'center',
|
||||
width:120,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPf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iAQinW45hLIBARCpqOOQDEBgVCswzWXQCYgEDIddQSKCQiEYh2uuQQyAYGQ6agjUExAIBTrcM0lkAkIhExHHYFiAgKhWIdrLoFMQCBkOuoIFBMQCMU6XHMJZAICIdNRR6CYgEAo1uGaSyATEAiZjjoCxQQEQrEO11wCmYBAyHTUESgmIBCKdbjmEsgEBEKmo45AMQGBUKzDNZdAJiAQMh11BIoJCIRiHa65BDIBgZDpqCNQTEAgFOtwzSWQCQiETEcdgWICAqFYh2sugUxAIGQ66ggUExAIxTpccwlkAgIh01FHoJiAQCjW4ZpLIBMQCJmOOgLFBARCsQ7XXAKZgEDIdNQRKCYgEIp1uOYSyAQEQqajjkAxAYFQrMM1l0AmIBAyHXUEigkIhGIdrrkEMgGBkOmoI1BMQCAU63DNJZAJCIRMRx2BYgICoViHay6BTEAgZDrqCBQTEAjFOlxzCWQCPwEYef7DpS5s4AAAAABJRU5ErkJggg==">
|
||||
</div>`;
|
||||
if(d.product.image)
|
||||
{
|
||||
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="` + d.product.image + `" />
|
||||
</div>`;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'nickname',
|
||||
title: '用户名称',
|
||||
align: 'center',
|
||||
width:150,
|
||||
|
||||
},{
|
||||
field: 'product_score',
|
||||
title: '产品评分',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'service_score',
|
||||
title: '服务评分',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'postage_score',
|
||||
title: '物流评分',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'comment',
|
||||
title: '评价内容',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'merchant_reply_content',
|
||||
title: '回复内容',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '评论时间',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(article)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side('{$url[1]}');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('{$url[2]}?id='+obj.data.reply_id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('{$url[2]}?id='+obj.data.reply_id);
|
||||
}
|
||||
else if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete('{$url[3]}', { id: data.reply_id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
200
app/admin/view/product/product/add.html
Normal file
200
app/admin/view/product/product/add.html
Normal file
@ -0,0 +1,200 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
.layui-td-gray {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.addrhelper-ok-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">关联商户</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >请选择商户</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">已选商户<font>*</font></label>
|
||||
<div class="layui-input-block" id="merchantList" >
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">团队电话<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" required lay-verify="required" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
|
||||
<td>
|
||||
<div class="layui-col-md4">
|
||||
<select name="" lay-filter="merchantAddress" lay-search>
|
||||
<option value="">选择区域</option>
|
||||
{volist name='arealist' id='vo'}
|
||||
<option value="{$vo.area_code}" >{$vo.area_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">街道/镇</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="demo1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[1]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'street_id',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: [],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false,
|
||||
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
188
app/admin/view/product/product/edit.html
Normal file
188
app/admin/view/product/product/edit.html
Normal file
@ -0,0 +1,188 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.editormd-code-toolbar select {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.editormd li {
|
||||
list-style: inherit;
|
||||
}
|
||||
.layui-td-gray{
|
||||
width: 110px;
|
||||
}
|
||||
.addrhelper-ok-btn{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<input type="hidden" name="id" value="{$detail.store_category_id}">
|
||||
<h3 class="pb-3">编辑</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">选择商户</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<select lay-filter="merchant" lay-search>
|
||||
<option value="" >上级分类</option>
|
||||
{volist name='merchant' id='vo'}
|
||||
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="layui-col-md4" id="address"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">分类名称<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" value="{$detail.cate_name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传分类图片(尺寸:110x110)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="{$detail.pic}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||
<input type="hidden" name="avatar" value="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" lay-skin="switch" {$detail.is_show?'checked':''}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="4">
|
||||
<div class="layui-col-md4">
|
||||
<label class="layui-form-label">排序<font>*</font></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="sort" required lay-verify="required" value="{$detail.sort}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="/static/assets/js/jquery.min.js"></script>
|
||||
<script src="/static/assets/js/addrHelper.js"></script>
|
||||
<script src="/static/assets/js/xm-select.js"></script>
|
||||
<script>
|
||||
var moduleInit = ['tool','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
var form = layui.form, tool = layui.tool;
|
||||
|
||||
// 下拉选中事件
|
||||
form.on('select(merchant)', function(data){
|
||||
|
||||
if(data.value == null || data.value == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const title = $('#merchant' + data.value).text();
|
||||
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
|
||||
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
|
||||
$('#merchantList').append(html);
|
||||
$("#merchant"+ data.value).remove();
|
||||
$(".layui-this").remove();
|
||||
});
|
||||
|
||||
form.on('select(merchantAddress)', function (data) {
|
||||
street(data.value);
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
|
||||
let callback = function (e) {
|
||||
console.log(e);
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
|
||||
tool.post('{$url[2]}', data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
// 删除选中商户
|
||||
function merchantxz(env)
|
||||
{
|
||||
if($('#mer_id'+env).attr("checked") == 'checked')
|
||||
{
|
||||
$('#mer_id'+env).removeAttr('checked');
|
||||
$('#mer_id_style'+env).removeClass('layui-form-checked');
|
||||
}else{
|
||||
$('#mer_id'+env).attr('checked', 'checked');
|
||||
$('#mer_id_style'+env).addClass('layui-form-checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||
|
||||
street("{$detail.store_category_id}");
|
||||
|
||||
function street (id) {
|
||||
if(id == null || id == '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
name: 'pid',
|
||||
el: '#demo1',
|
||||
prop: {
|
||||
name: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
data: [],
|
||||
radio: true,
|
||||
initValue: ['{$detail.pid}'],
|
||||
disabled: group_access == 2 || group_access==4 ? true : false
|
||||
});
|
||||
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
||||
demo1.update({
|
||||
data: result.data
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
236
app/admin/view/product/product/index.html
Normal file
236
app/admin/view/product/product/index.html
Normal file
@ -0,0 +1,236 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<form class="layui-form gg-form-bar border-t border-x">
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="请输入供应链名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="article" lay-filter="article"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="thumb">
|
||||
|
||||
</script>
|
||||
<!-- <script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加虚拟评论">+ 添加虚拟评论</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script> -->
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table,tool = layui.tool, form = layui.form;
|
||||
layui.pageTable = table.render({
|
||||
elem: '#article',
|
||||
title: '列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '{$url[0]}',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'product_id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width:80,
|
||||
},{
|
||||
field: 'image',
|
||||
title: '商品图',
|
||||
align: 'center',
|
||||
width:120,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACUCAYAAAB1GVf9AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABBKADAAQAAAABAAAAlAAAAAD7OG/zAAAH8ElEQVR4Ae3dWXPUOBQGUGcYoKCAByi2///f2LewE5bAzVSXIBPfdu8y9/gFpdVedKT+4pbtcHRycnI6WAgQIPBL4B8KBAgQWAgIhIWEfwkQcIZgDBAg0AScITQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1AiUF5AIJQfAgAINAGB0CyUCJQXEAjlhwAAAk1AIDQLJQLlBQRC+SEAgEATEAjNQolAeQGBUH4IACDQBARCs1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||||
{
|
||||
html = `<div data-v-d854fb86="" class="el-image" style="width: 36px; height: 36px;">
|
||||
<img style="width:100%;" src="` + d.image + `" />
|
||||
</div>`;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'store_name',
|
||||
title: '商品名称',
|
||||
align: 'center',
|
||||
width:120
|
||||
},{
|
||||
field: 'type_name',
|
||||
title: '商户类型',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
return d.merchant.merchantType ? d.merchant.merchantType.type_name : '待定';
|
||||
}
|
||||
|
||||
},{
|
||||
field: 'product_score',
|
||||
title: '商户类别',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
return d.merchant.category ? d.merchant.category.category_name : '待定';
|
||||
}
|
||||
},{
|
||||
field: 'price',
|
||||
title: '商品售价',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'sales',
|
||||
title: '销量',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'stock',
|
||||
title: '库存',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'is_good',
|
||||
title: '推荐级别',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width:120,
|
||||
},{
|
||||
field: 'is_used',
|
||||
title: '是否显示',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = d.is_used ? '显示' : '隐藏';
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'is_used',
|
||||
title: '商品状态',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: function (d)
|
||||
{
|
||||
var html = d.is_used ? '上架显示' : '平台关闭';
|
||||
return html;
|
||||
},
|
||||
},{
|
||||
field: 'keyword',
|
||||
title: '标签',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
align: 'center',
|
||||
width:180,
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(article)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side('{$url[1]}');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('{$url[2]}?id='+obj.data.reply_id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('{$url[2]}?id='+obj.data.reply_id);
|
||||
}
|
||||
else if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete('{$url[3]}', { id: data.reply_id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
layui.use('rate', function(){
|
||||
var rate = layui.rate;
|
||||
|
||||
//基础效果
|
||||
rate.render({
|
||||
elem: '#is_good'
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
Loading…
x
Reference in New Issue
Block a user