初始上传
This commit is contained in:
336
addon/pc/shop/controller/Adv.php
Executable file
336
addon/pc/shop/controller/Adv.php
Executable file
@@ -0,0 +1,336 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pc\shop\controller;
|
||||
|
||||
use app\model\web\Adv as AdvModel;
|
||||
use app\model\web\AdvPosition;
|
||||
use addon\pc\model\Pc as PcModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
|
||||
|
||||
/**
|
||||
* 广告管理
|
||||
*/
|
||||
class Adv extends BaseShop
|
||||
{
|
||||
|
||||
/**
|
||||
* 广告位管理
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$adv_position = new AdvPosition();
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
$type = input('type', '');//位置类型 1 电脑端 2 手机端
|
||||
|
||||
$condition = [
|
||||
[ 'site_id', '=', $this->site_id ],
|
||||
[ 'type', '=', 1 ]
|
||||
];
|
||||
if (!empty($search_text)) {
|
||||
$condition[] = [ 'ap_name', 'like', '%' . $search_text . '%' ];
|
||||
}
|
||||
if ($type !== '') {
|
||||
$condition[] = [ 'type', '=', $type ];
|
||||
}
|
||||
return $adv_position->getAdvPositionPageList($condition, $page, $page_size);
|
||||
} else {
|
||||
|
||||
return $this->fetch('adv/index');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加广告位
|
||||
*/
|
||||
public function addPosition()
|
||||
{
|
||||
$adv_position = new AdvPosition();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'ap_name' => input('ap_name', ''),
|
||||
'keyword' => input('keyword', ''),
|
||||
'ap_intro' => input('ap_intro', ''),
|
||||
'ap_height' => input('ap_height', 0),
|
||||
'ap_width' => input('ap_width', 0),
|
||||
'default_content' => input('default_content', ''),
|
||||
'ap_background_color' => input('ap_background_color', ''),
|
||||
'type' => input('type', 1),
|
||||
'site_id' => $this->site_id,
|
||||
'state' => input('state', 0),
|
||||
];
|
||||
return $adv_position->addAdvPosition($data);
|
||||
} else {
|
||||
return $this->fetch('adv/add_position');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑广告位
|
||||
*/
|
||||
public function editPosition()
|
||||
{
|
||||
$adv_position = new AdvPosition();
|
||||
$ap_id = input('ap_id', 0);
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'ap_name' => input('ap_name', ''),
|
||||
'keyword' => input('keyword', ''),
|
||||
'ap_intro' => input('ap_intro', ''),
|
||||
'ap_height' => input('ap_height', 0),
|
||||
'ap_width' => input('ap_width', 0),
|
||||
'default_content' => input('default_content', ''),
|
||||
'ap_background_color' => input('ap_background_color', ''),
|
||||
'state' => input('state', 0),
|
||||
];
|
||||
return $adv_position->editAdvPosition($data, [ [ 'ap_id', '=', $ap_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
} else {
|
||||
$ap_info = $adv_position->getAdvPositionInfo([ [ 'ap_id', '=', $ap_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
$this->assign('info', $ap_info[ 'data' ]);
|
||||
return $this->fetch('adv/edit_position');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改广告位字段
|
||||
*/
|
||||
public function editPositionField()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$adv_position = new AdvPosition();
|
||||
$type = input('type', '');
|
||||
$value = input('value', 0);
|
||||
$ap_id = input('ap_id', 0);
|
||||
$data = [
|
||||
$type => $value
|
||||
];
|
||||
return $adv_position->editAdvPosition($data, [ [ 'ap_id', '=', $ap_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除广告位
|
||||
*/
|
||||
public function deletePosition()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$ap_ids = input('ap_ids', 0);
|
||||
$adv_position = new AdvPosition();
|
||||
return $adv_position->deleteAdvPosition([ [ 'ap_id', 'in', $ap_ids ], [ 'site_id', '=', $this->site_id ] ], $ap_ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 广告列表
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$adv = new AdvModel();
|
||||
$adv_position = new AdvPosition();
|
||||
$ap_id = input('ap_id', '');
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
$ap_id = input('ap_id', '');
|
||||
//查询所有手机端广告位
|
||||
$conditions[] = [ 'type', '=', 1 ];
|
||||
$positions = $adv_position->getAdvPositionList($conditions);
|
||||
$positions_ids = array_column($positions[ 'data' ], 'ap_id');
|
||||
$condition = [
|
||||
[ 'a.site_id', '=', $this->site_id ],
|
||||
[ 'a.ap_id', 'in', $positions_ids ]
|
||||
];
|
||||
if (!empty($search_text)) {
|
||||
$condition[] = [ 'a.adv_title', 'like', '%' . $search_text . '%' ];
|
||||
}
|
||||
if ($ap_id !== '') {
|
||||
$condition[] = [ 'a.ap_id', '=', $ap_id ];
|
||||
}
|
||||
|
||||
//排序
|
||||
$order = input('order', 'slide_sort');
|
||||
$sort = input('sort', 'desc');
|
||||
if ($order == 'slide_sort') {
|
||||
$order_by = 'a.' . $order . ' ' . $sort;
|
||||
} else {
|
||||
$order_by = 'a.' . $order . ' ' . $sort . ',a.slide_sort desc';
|
||||
}
|
||||
|
||||
return $adv->getAdvPageList($condition, $page, $page_size, $order_by);
|
||||
} else {
|
||||
$this->assign('ap_id', $ap_id);
|
||||
|
||||
|
||||
$adv_position = new AdvPosition();
|
||||
$adv_position_list = $adv_position->getAdvPositionList([ [ 'site_id', '=', $this->site_id ], [ 'type', '=', 1 ] ], 'ap_id,ap_name');
|
||||
$this->assign('adv_position', $adv_position_list[ 'data' ]);
|
||||
|
||||
return $this->fetch('adv/lists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加广告
|
||||
*/
|
||||
public function addAdv()
|
||||
{
|
||||
$adv = new AdvModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'ap_id' => input('ap_id', 0),
|
||||
'adv_title' => input('adv_title', ''),
|
||||
'adv_url' => input('adv_url', ''),
|
||||
'adv_image' => input('adv_image', ''),
|
||||
'slide_sort' => input('slide_sort', 0),
|
||||
'price' => input('price', 0),
|
||||
'background' => input('background', ''),
|
||||
'state' => input('state', 0),
|
||||
'site_id' => $this->site_id
|
||||
];
|
||||
return $adv->addAdv($data);
|
||||
} else {
|
||||
$pc_model = new PcModel();
|
||||
$pc_link = $pc_model->getLink();
|
||||
$this->assign('pc_link', $pc_link);
|
||||
|
||||
$adv_position = new AdvPosition();
|
||||
$adv_position_list = $adv_position->getAdvPositionList([
|
||||
[ 'site_id', '=', $this->site_id ],
|
||||
[ 'type', '=', 1 ],
|
||||
]);
|
||||
$this->assign('adv_position_list', $adv_position_list[ 'data' ]);
|
||||
|
||||
$ap_id = input('ap_id', 0);
|
||||
$this->assign('ap_id', $ap_id);
|
||||
return $this->fetch('adv/add_adv');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑广告
|
||||
*/
|
||||
public function editAdv()
|
||||
{
|
||||
$adv_id = input('adv_id', '');
|
||||
$adv = new AdvModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'ap_id' => input('ap_id', 0),
|
||||
'adv_title' => input('adv_title', ''),
|
||||
'adv_url' => input('adv_url', ''),
|
||||
'adv_image' => input('adv_image', ''),
|
||||
'slide_sort' => input('slide_sort', 0),
|
||||
'price' => input('price', 0),
|
||||
'background' => input('background', ''),
|
||||
'state' => input('state', 0),
|
||||
];
|
||||
return $adv->editAdv($data, [ [ 'adv_id', '=', $adv_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
} else {
|
||||
$pc_model = new PcModel();
|
||||
$pc_link = $pc_model->getLink();
|
||||
$this->assign('pc_link', $pc_link);
|
||||
|
||||
$adv_position = new AdvPosition();
|
||||
$adv_position_list = $adv_position->getAdvPositionList([
|
||||
[ 'site_id', '=', $this->site_id ],
|
||||
[ 'type', '=', 1 ],
|
||||
]);
|
||||
$this->assign('adv_position_list', $adv_position_list[ 'data' ]);
|
||||
$adv_info = $adv->getAdvInfo($adv_id);
|
||||
//得出推荐宽高
|
||||
foreach ($adv_position_list[ 'data' ] as $k => $v) {
|
||||
if ($v[ 'ap_id' ] == $adv_info[ 'data' ][ 'ap_id' ]) {
|
||||
$adv_info[ 'data' ][ 'ap_width' ] = $v[ 'ap_width' ];
|
||||
$adv_info[ 'data' ][ 'ap_height' ] = $v[ 'ap_height' ];
|
||||
}
|
||||
}
|
||||
$this->assign('adv_info', $adv_info[ 'data' ]);
|
||||
// 得到当前广告图类型
|
||||
$type = 2;// 1 pc、2 wap
|
||||
foreach ($adv_position_list[ 'data' ] as $k => $v) {
|
||||
if ($v[ 'ap_id' ] == $adv_info[ 'data' ][ 'ap_id' ]) {
|
||||
$type = $v[ 'type' ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assign('type', $type);
|
||||
|
||||
$ap_id = input('ap_id', 0);
|
||||
$this->assign('ap_id', $ap_id);
|
||||
|
||||
return $this->fetch('adv/edit_adv');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改广告字段
|
||||
*/
|
||||
public function editAdvField()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$adv = new AdvModel();
|
||||
$type = input('type', '');
|
||||
$value = input('value', '');
|
||||
$adv_id = input('adv_id', '');
|
||||
$data = [
|
||||
$type => $value
|
||||
];
|
||||
return $adv->editAdv($data, [ [ 'adv_id', '=', $adv_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除广告
|
||||
*/
|
||||
public function deleteAdv()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$adv_ids = input('adv_ids', 0);
|
||||
$adv = new AdvModel();
|
||||
return $adv->deleteAdv([ [ 'adv_id', 'in', $adv_ids ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改广告位状态
|
||||
* @return array
|
||||
*/
|
||||
public function alterAdvPositionState()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$ap_id = input('ap_id', 0);
|
||||
$state = input('state', 0);
|
||||
$ap_model = new AdvPosition();
|
||||
return $ap_model->editAdvPosition([ 'state' => $state ], [ [ 'ap_id', '=', $ap_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改广告状态
|
||||
* @return array
|
||||
*/
|
||||
public function alterAdvState()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$adv_id = input('adv_id', 0);
|
||||
$state = input('state', 0);
|
||||
$ap_model = new AdvModel();
|
||||
return $ap_model->editAdv([ 'state' => $state ], [ [ 'adv_id', '=', $adv_id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
508
addon/pc/shop/controller/Pc.php
Executable file
508
addon/pc/shop/controller/Pc.php
Executable file
@@ -0,0 +1,508 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pc\shop\controller;
|
||||
|
||||
use app\model\goods\GoodsCategory as GoodsCategoryModel;
|
||||
use addon\pc\model\Pc as PcModel;
|
||||
use app\model\web\Config;
|
||||
use app\shop\controller\BaseShop;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Pc端 控制器
|
||||
*/
|
||||
class Pc extends BaseShop
|
||||
{
|
||||
private $pc_model;
|
||||
|
||||
public function __construct(App $app = null)
|
||||
{
|
||||
$this->replace = [
|
||||
'ADDON_PC_CSS' => __ROOT__ . '/addon/pc/shop/view/public/css',
|
||||
'ADDON_PC_JS' => __ROOT__ . '/addon/pc/shop/view/public/js',
|
||||
'ADDON_PC_IMG' => __ROOT__ . '/addon/pc/shop/view/public/img',
|
||||
];
|
||||
$this->pc_model = new PcModel();
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取PC端部署信息
|
||||
* @return array
|
||||
*/
|
||||
public function getDeploy()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$config_model = new Config();
|
||||
$config = $config_model->getPcDomainName($this->site_id)[ 'data' ][ 'value' ];
|
||||
if ($config[ 'deploy_way' ] == 'separate') {
|
||||
$root_url = $config[ 'domain_name_pc' ];
|
||||
} else {
|
||||
$root_url = __ROOT__;
|
||||
}
|
||||
|
||||
$res = [
|
||||
'root_url' => __ROOT__,
|
||||
'roots_url' => $root_url,
|
||||
'config' => $config,
|
||||
];
|
||||
return success('', '', $res);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置pc端域名
|
||||
* @return array
|
||||
*/
|
||||
public function pcDomainName()
|
||||
{
|
||||
$config_model = new Config();
|
||||
$domain_name = input("domain", "");
|
||||
$deploy_way = input("deploy_way", "default");
|
||||
|
||||
if ($deploy_way == 'default') $domain_name = __ROOT__ . '/web';
|
||||
|
||||
$result = $config_model->setPcDomainName([
|
||||
'domain_name_pc' => $domain_name,
|
||||
'deploy_way' => $deploy_way
|
||||
]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认部署:无需下载,一键刷新,API接口请求地址为当前域名,编译代码存放到web文件夹中
|
||||
*/
|
||||
public function downloadCsDefault()
|
||||
{
|
||||
$this->pcDomainName();
|
||||
return $this->pc_model->downloadCsDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* 独立部署:下载编译代码包,参考开发文档进行配置
|
||||
*/
|
||||
public function downloadCsSeparate()
|
||||
{
|
||||
if (strstr(ROOT_URL, 'niuteam.cn') === false) {
|
||||
$domain_name = input("domain", "");
|
||||
$res = $this->pc_model->downloadCsSeparate($domain_name);
|
||||
if ($res[ 'code' ] >= 0) {
|
||||
$config_model = new Config();
|
||||
$result = $config_model->setPcDomainName([
|
||||
'domain_name_pc' => $domain_name,
|
||||
'deploy_way' => 'separate'
|
||||
]);
|
||||
}
|
||||
echo $res[ 'message' ];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 源码下载:下载开源代码包,参考开发文档进行配置,结合业务需求进行二次开发
|
||||
*/
|
||||
public function downloadOs()
|
||||
{
|
||||
if (strstr(ROOT_URL, 'niuteam.cn') === false) {
|
||||
$res = $this->pc_model->downloadOs();
|
||||
echo $res[ 'message' ];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页浮层
|
||||
* @return mixed
|
||||
*/
|
||||
public function floatLayer()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'title' => input("title", ""),
|
||||
'url' => input("url", ""),
|
||||
'is_show' => input("is_show", 0),
|
||||
'number' => input("number", ""),
|
||||
'img_url' => input("img_url", "")
|
||||
];
|
||||
$res = $this->pc_model->setFloatLayer($data, $this->site_id);
|
||||
return $res;
|
||||
} else {
|
||||
$link = $this->pc_model->getLink();
|
||||
$this->assign("link", $link);
|
||||
$float_layer = $this->pc_model->getFloatLayer($this->site_id)[ 'data' ][ 'value' ];
|
||||
$this->assign("float_layer", $float_layer);
|
||||
return $this->fetch('pc/float_layer');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航设置
|
||||
* @return mixed
|
||||
*/
|
||||
public function navList()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
|
||||
$condition = [
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
];
|
||||
if (!empty($search_text)) $condition[] = [ 'nav_title', 'like', '%' . $search_text . '%' ];
|
||||
$order = 'create_time desc';
|
||||
|
||||
$model = new PcModel();
|
||||
return $model->getNavPageList($condition, $page, $page_size, $order);
|
||||
} else {
|
||||
return $this->fetch('pc/nav_list');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加导航
|
||||
* @return mixed
|
||||
*/
|
||||
public function addNav()
|
||||
{
|
||||
$model = new PcModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'nav_title' => input('nav_title', ''),
|
||||
'nav_url' => input('nav_url', ''),
|
||||
'sort' => input('sort', ''),
|
||||
'is_blank' => input('is_blank', ''),
|
||||
'nav_icon' => input('nav_icon', ''),
|
||||
'is_show' => input('is_show', ''),
|
||||
'create_time' => time(),
|
||||
'site_id' => $this->site_id
|
||||
];
|
||||
|
||||
return $model->addNav($data);
|
||||
} else {
|
||||
$link_list = $model->getLink();
|
||||
$this->assign('link', $link_list);
|
||||
|
||||
return $this->fetch('pc/add_nav');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑导航
|
||||
* @return mixed
|
||||
*/
|
||||
public function editNav()
|
||||
{
|
||||
$model = new PcModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'nav_title' => input('nav_title', ''),
|
||||
'nav_url' => input('nav_url', ''),
|
||||
'sort' => input('sort', ''),
|
||||
'is_blank' => input('is_blank', ''),
|
||||
'nav_icon' => input('nav_icon', ''),
|
||||
'is_show' => input('is_show', ''),
|
||||
'modify_time' => time(),
|
||||
];
|
||||
$id = input('id', 0);
|
||||
$condition = [
|
||||
[ 'id', '=', $id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
];
|
||||
|
||||
return $model->editNav($data, $condition);
|
||||
} else {
|
||||
$link_list = $model->getLink();
|
||||
$this->assign('link', $link_list);
|
||||
|
||||
$id = input('id', 0);
|
||||
$this->assign('id', $id);
|
||||
|
||||
$nav_info = $model->getNavInfo($id);
|
||||
$this->assign('nav_info', $nav_info[ 'data' ]);
|
||||
|
||||
return $this->fetch('pc/edit_nav');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除导航
|
||||
* @return mixed
|
||||
*/
|
||||
public function deleteNav()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$model = new PcModel();
|
||||
return $model->deleteNav([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排序
|
||||
*/
|
||||
public function modifySort()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$sort = input('sort', 0);
|
||||
$id = input('id', 0);
|
||||
$model = new PcModel();
|
||||
return $model->modifyNavSort($sort, $id);
|
||||
}
|
||||
}
|
||||
|
||||
public function modifyNavIsShow()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$is_show = input('is_show', 0);
|
||||
$id = input('id', 0);
|
||||
$model = new PcModel();
|
||||
return $model->editNav([ 'is_show' => $is_show ], [ [ 'id', '=', $id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 友情链接
|
||||
* @return mixed
|
||||
*/
|
||||
public function linklist()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
|
||||
$condition = [
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
];
|
||||
if (!empty($search_text)) $condition[] = [ 'link_title', 'like', '%' . $search_text . '%' ];
|
||||
|
||||
//排序
|
||||
$link_sort = input('order', 'link_sort');
|
||||
$sort = input('sort', 'desc');
|
||||
if ($link_sort == 'link_sort') {
|
||||
$order_by = $link_sort . ' ' . $sort;
|
||||
} else {
|
||||
$order_by = $link_sort . ' ' . $sort . ',link_sort desc';
|
||||
}
|
||||
|
||||
$model = new PcModel();
|
||||
return $model->getLinkPageList($condition, $page, $page_size, $order_by);
|
||||
} else {
|
||||
return $this->fetch('pc/link_list');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加友情链接
|
||||
* @return mixed
|
||||
*/
|
||||
public function addLink()
|
||||
{
|
||||
$model = new PcModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'link_title' => input('link_title', ''),
|
||||
'link_url' => input('link_url', ''),
|
||||
'link_pic' => input('link_pic', ''),
|
||||
'link_sort' => input('link_sort', ''),
|
||||
'is_blank' => input('is_blank', ''),
|
||||
'is_show' => input('is_show', ''),
|
||||
'site_id' => $this->site_id
|
||||
];
|
||||
|
||||
return $model->addLink($data);
|
||||
} else {
|
||||
return $this->fetch('pc/add_link');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑友情链接
|
||||
* @return mixed
|
||||
*/
|
||||
public function editLink()
|
||||
{
|
||||
$model = new PcModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'link_title' => input('link_title', ''),
|
||||
'link_url' => input('link_url', ''),
|
||||
'link_pic' => input('link_pic', ''),
|
||||
'link_sort' => input('link_sort', ''),
|
||||
'is_blank' => input('is_blank', ''),
|
||||
'is_show' => input('is_show', ''),
|
||||
];
|
||||
$id = input('id', 0);
|
||||
$condition = [
|
||||
[ 'id', '=', $id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
];
|
||||
return $model->editLink($data, $condition);
|
||||
} else {
|
||||
|
||||
$id = input('id', 0);
|
||||
$this->assign('id', $id);
|
||||
|
||||
$link_info = $model->getLinkInfo($id);
|
||||
$this->assign('link_info', $link_info[ 'data' ]);
|
||||
|
||||
return $this->fetch('pc/edit_link');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除友情链接
|
||||
* @return mixed
|
||||
*/
|
||||
public function deleteLink()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$model = new PcModel();
|
||||
return $model->deleteLink([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排序
|
||||
*/
|
||||
public function modifyLinkSort()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$sort = input('sort', 0);
|
||||
$id = input('id', 0);
|
||||
return $this->pc_model->modifyLinkSort($sort, $id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页楼层
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function floor()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_text', '');
|
||||
$condition = [
|
||||
[ 'pf.site_id', '=', $this->site_id ]
|
||||
];
|
||||
if (!empty($search_text)) $condition[] = [ 'pf.title', 'like', '%' . $search_text . '%' ];
|
||||
$list = $this->pc_model->getFloorPageList($condition, $page, $page_size);
|
||||
return $list;
|
||||
} else {
|
||||
return $this->fetch('pc/floor');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改首页楼层排序
|
||||
*/
|
||||
public function modifyFloorSort()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$sort = input('sort', 0);
|
||||
$id = input('id', 0);
|
||||
$condition = array (
|
||||
[ 'id', '=', $id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
);
|
||||
$res = $this->pc_model->modifyFloorSort($sort, $condition);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除首页楼层
|
||||
* @return array
|
||||
*/
|
||||
public function deleteFloor()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$res = $this->pc_model->deleteFloor([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑楼层
|
||||
* @return mixed
|
||||
*/
|
||||
public function editFloor()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$id = input("id", 0);
|
||||
$data = [
|
||||
'block_id' => input("block_id", 0), //楼层模板关联id
|
||||
'title' => input("title", ''), // 楼层标题
|
||||
'value' => input("value", ''),
|
||||
'state' => input("state", 0),// 状态(0:禁用,1:启用)
|
||||
'sort' => input("sort", 0), //排序号
|
||||
'site_id' => $this->site_id
|
||||
];
|
||||
if ($id == 0) {
|
||||
$res = $this->pc_model->addFloor($data);
|
||||
} else {
|
||||
$res = $this->pc_model->editFloor($data, [ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
return $res;
|
||||
} else {
|
||||
$id = input("id", 0);
|
||||
$this->assign("id", $id);
|
||||
|
||||
if (!empty($id)) {
|
||||
$floor_info = $this->pc_model->getFloorDetail($id, $this->site_id);
|
||||
$floor_info = $floor_info[ 'data' ];
|
||||
$this->assign("floor_info", $floor_info);
|
||||
}
|
||||
|
||||
$floor_block_list = $this->pc_model->getFloorBlockList();
|
||||
$floor_block_list = $floor_block_list[ 'data' ];
|
||||
$this->assign("floor_block_list", $floor_block_list);
|
||||
|
||||
$pc_link = $this->pc_model->getLink();
|
||||
$this->assign("pc_link", $pc_link);
|
||||
|
||||
$goods_category_model = new GoodsCategoryModel();
|
||||
$category_list = $goods_category_model->getCategoryTree([ [ 'site_id', '=', $this->site_id ] ]);
|
||||
$category_list = $category_list[ 'data' ];
|
||||
$this->assign("category_list", $category_list);
|
||||
return $this->fetch('pc/edit_floor');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PC端首页分类设置
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function category()
|
||||
{
|
||||
$config_model = new Config();
|
||||
if (request()->isJson()) {
|
||||
$data = array (
|
||||
"category" => input("category", "1"),
|
||||
"img" => input("img", "0")
|
||||
);
|
||||
$res = $config_model->setCategoryConfig($data, $this->site_id, $this->app_module);
|
||||
return $res;
|
||||
} else {
|
||||
$config_info = $config_model->getCategoryConfig($this->site_id, $this->app_module);
|
||||
$this->assign('config_info', $config_info[ 'data' ][ 'value' ]);
|
||||
return $this->fetch('pc/category');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
242
addon/pc/shop/view/adv/add_adv.html
Executable file
242
addon/pc/shop/view/adv/add_adv.html
Executable file
@@ -0,0 +1,242 @@
|
||||
<style>
|
||||
.adv-url-show{margin-right: 10px;}
|
||||
.layui-colorpicker-main-input div.layui-inline{margin-right: 0;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 130px;height: 34px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="adv_title" type="text" lay-verify="required" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{notempty name="$adv_position_list"}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所属广告位:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="ap_id" lay-filter="ap_id">
|
||||
{foreach $adv_position_list as $adv_position_k => $adv_position_v}
|
||||
<option value="{$adv_position_v.ap_id}" {if $ap_id == $adv_position_v.ap_id}selected{/if} data-type="{$adv_position_v.type}" data-width="{$adv_position_v.ap_width}" data-height="{$adv_position_v.ap_height}">{$adv_position_v.ap_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" data-type="1" {if $adv_position_list[0]['type'] == 2}style="display: none"{/if}>
|
||||
<label class="layui-form-label">PC端广告链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="pc_link" lay-filter="pc_link">
|
||||
<option value="">请选择</option>
|
||||
{foreach $pc_link as $k => $v}
|
||||
<option value="{$v.url}">{$v.title}</option>
|
||||
{/foreach}
|
||||
<option value="diy">自定义</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" data-type="2" {if $adv_position_list[0]['type'] == 1}style="display: none"{/if}>
|
||||
<label class="layui-form-label">移动端广告链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<span class="adv-url-show"></span>
|
||||
<button class="layui-btn layui-btn-primary sm" onclick="selectedLink()">选择链接</button>
|
||||
</div>
|
||||
</div>
|
||||
<input name="adv_url" type="hidden" />
|
||||
{/notempty}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告图片:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default" id="adv_image">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="adv_image" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">建议宽度<span class="pic_width">{$adv_position_list[0]['ap_width']}</span>px 建议高度<span class="pic_height">{$adv_position_list[0]['ap_height']}</span>px</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="slide_sort" value="0" type="number" placeholder="排序" lay-verify="num" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">排序值必须为整数</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<label class="layui-form-label">广告价格:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price" value="0.00" type="number" placeholder="广告价格" lay-verify="flo" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">广告价格 / 月</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">背景色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div id="bg_color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" checked />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backPcAdvList()">返回</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="background" id="ap_background_color" value="#FFFFFF" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'colorpicker'], function () {
|
||||
var form = layui.form,
|
||||
colorpicker = layui.colorpicker,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('select(ap_id)', function(data){
|
||||
var type = $(data.elem).find("option:selected").attr("data-type");
|
||||
var width = $(data.elem).find("option:selected").attr("data-width");
|
||||
var height = $(data.elem).find("option:selected").attr("data-height");
|
||||
$(".pic_width").text(width);
|
||||
$(".pic_height").text(height);
|
||||
$("[data-type]").hide();
|
||||
$("[data-type='"+ type+"']").show();
|
||||
});
|
||||
|
||||
form.on('select(pc_link)', function(data){
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
|
||||
if(data.value != 'diy'){
|
||||
$("input[name='adv_url']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": data.value
|
||||
}));
|
||||
}else{
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value :$("input[name='adv_url']").val() ? JSON.parse($("input[name='adv_url']").val()).url : '',
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel : function () {
|
||||
$("input[name='adv_url']").val("");
|
||||
}
|
||||
}, function(value, index, elem){
|
||||
$("input[name='adv_url']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": value
|
||||
}));
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
colorpicker.render({
|
||||
elem: '#bg_color', //绑定元素
|
||||
color: "#FFFFFF",
|
||||
done: function(color) {
|
||||
$(".tdrag-name").css("color", color);
|
||||
$("#ap_background_color").val(color);
|
||||
}
|
||||
});
|
||||
|
||||
// 广告图片
|
||||
var logo_upload = new Upload({
|
||||
elem: '#adv_image'
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/addAdv"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续添加'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("pc://shop/adv/lists", {ap_id: '{$ap_id}'})
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function (value) {
|
||||
let reg = ns.getRegexp('>=0num');
|
||||
if (value !== '' && !reg.test(value)) {
|
||||
return '排序数值必须为大于或等于0的整数'
|
||||
}
|
||||
},
|
||||
flo: function (value) {
|
||||
let reg = ns.getRegexp('>=0float2');
|
||||
if (value !== '' && !reg.test(value)) {
|
||||
return '价格必须大于或等于0,最多保留两位小数'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function backPcAdvList() {
|
||||
location.hash = ns.hash("pc://shop/adv/lists", {ap_id : '{$ap_id}'})
|
||||
}
|
||||
|
||||
function selectedLink() {
|
||||
ns.select_link('', function (data) {
|
||||
for (var o in data) {
|
||||
if (data[o] == null) delete data[o];
|
||||
}
|
||||
|
||||
$("input[name='adv_url']").val(JSON.stringify(data));
|
||||
$(".adv-url-show").text(data.title);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
146
addon/pc/shop/view/adv/add_position.html
Executable file
146
addon/pc/shop/view/adv/add_position.html
Executable file
@@ -0,0 +1,146 @@
|
||||
<style>
|
||||
.layui-colorpicker-main-input div.layui-inline{margin-right: 0;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 130px;height: 34px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告位置名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_name" type="text" lay-verify="required" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告关键字:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="keyword" type="text" lay-verify="required" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告位简介:</label>
|
||||
<div class="layui-input-block len-long">
|
||||
<textarea name="ap_intro" class="layui-textarea" maxlength="150"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">建议广告图片宽度:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_width" value="1920" type="number" lay-verify="int" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">单位:px 宽度值不能小于0(例:首页轮播图一般为1920px * 400px)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">建议广告图片高度:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_height" value="400" type="number" lay-verify="int" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">单位:px 高度值不能小于0(例:首页轮播图一般为1920px * 400px)</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!--<label class="layui-form-label">广告位类型:</label>-->
|
||||
<!--<div class="layui-input-inline" id="type">-->
|
||||
<!--<input type="radio" name="type" lay-filter="type" value="1" title="电脑端" checked>-->
|
||||
<!--<input type="radio" name="type" lay-filter="type" value="2" title="手机端" >-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告位背景色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div id="bg_color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" checked/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backPcAdvIndex()">返回</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="ap_background_color" id="ap_background_color" value="#FFFFFF" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'colorpicker'], function () {
|
||||
var form = layui.form,
|
||||
colorpicker = layui.colorpicker,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
colorpicker.render({
|
||||
elem: '#bg_color', //绑定元素
|
||||
color: "#FFFFFF",
|
||||
done: function(color) {
|
||||
$(".tdrag-name").css("color", color);
|
||||
$("#ap_background_color").val(color);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/addPosition"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续添加'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("pc://shop/adv/index")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
int: function (value) {
|
||||
if (value == '') {
|
||||
return;
|
||||
}
|
||||
if (value < 0 || value%1 != 0) {
|
||||
return '请输入0或正整数!'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function backPcAdvIndex() {
|
||||
location.hash = ns.hash("pc://shop/adv/index")
|
||||
}
|
||||
</script>
|
||||
268
addon/pc/shop/view/adv/edit_adv.html
Executable file
268
addon/pc/shop/view/adv/edit_adv.html
Executable file
@@ -0,0 +1,268 @@
|
||||
<style>
|
||||
.adv-url-show{margin-right: 10px;}
|
||||
.layui-colorpicker-main-input div.layui-inline{margin-right: 0;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 130px;height: 34px;}
|
||||
.iconreview{margin-right: 20px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="adv_title" type="text" value="{$adv_info.adv_title}" lay-verify="required" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{notempty name="$adv_position_list"}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所属广告位:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="ap_id" lay-filter="ap_id">
|
||||
{foreach $adv_position_list as $adv_position_k => $adv_position_v}
|
||||
<option value="{$adv_position_v.ap_id}" data-type="{$adv_position_v.type}" data-width="{$adv_position_v.ap_width}" data-height="{$adv_position_v.ap_height}" {if condition="$adv_position_v.ap_id == $adv_info.ap_id"}selected{/if} >{$adv_position_v.ap_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" data-type="1" {if $type == 2}style="display: none"{/if}>
|
||||
<label class="layui-form-label">PC端广告链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="pc_link" lay-filter="pc_link">
|
||||
<option value="">请选择</option>
|
||||
{foreach $pc_link as $k => $v}
|
||||
<option value="{$v.url}" {if $adv_info.adv_url && (json_decode($adv_info.adv_url,true)['url'] ?? '') == $v.url}selected{/if}>{$v.title}</option>
|
||||
{/foreach}
|
||||
<option value="diy"{if $adv_info.adv_url && (json_decode($adv_info.adv_url,true)['title'] ?? '') == '自定义'}selected{/if}>自定义</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" data-type="2" {if $type == 1}style="display: none"{/if}>
|
||||
<label class="layui-form-label">移动端广告链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<span class="adv-url-show"></span>
|
||||
<button class="layui-btn layui-btn-primary sm" onclick="selectedLink()">选择链接</button>
|
||||
</div>
|
||||
</div>
|
||||
<input name="adv_url" type="hidden" value="{$adv_info.adv_url}" />
|
||||
{/notempty}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告图片:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box {notempty name="$adv_info['adv_image']"}hover{/notempty}">
|
||||
<div class="upload-default" id="adv_image">
|
||||
{if condition="$adv_info.adv_image"}
|
||||
<div id="preview_adv_image" class="preview_img">
|
||||
<img layer-src src="{:img($adv_info.adv_image)}" class="img_prev"/>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" ></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="adv_image" value="{$adv_info.adv_image}">
|
||||
</div>
|
||||
<!-- <div class="upload-img-box icon">
|
||||
{if condition="$adv_info.adv_image"}
|
||||
<img layer-src src="{:img($adv_info.adv_image)}" />
|
||||
{else/}
|
||||
<div class="upload-default">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<p id="adv_image" class=" {if condition="$adv_info.adv_image"} replace {else/} no-replace{/if}">替换</p>
|
||||
<input type="hidden" name="adv_image" value="{$adv_info.adv_image}">
|
||||
<i class="del {if condition="$adv_info.adv_image"}show{/if}">x</i> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">建议宽度<span class="pic_width">{$adv_info['ap_width']}</span>px 建议高度<span class="pic_height">{$adv_info['ap_height']}</span>px</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="slide_sort" value="{$adv_info.slide_sort}" type="number" placeholder="排序" lay-verify="num" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">排序值必须为整数</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<label class="layui-form-label">广告价格:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="price" value="{$adv_info.price}" type="number" placeholder="广告价格" lay-verify="flo" class="layui-input len-short">
|
||||
</div>
|
||||
<div class="word-aux">单位:元 价格不能小于0,可以保留两位小数</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">背景色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div id="bg_color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" {if condition="$adv_info.state == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backPcAdvList()">返回</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="background" id="background" value="{$adv_info.background}" />
|
||||
<input type="hidden" name="adv_id" value="{$adv_info.adv_id}" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var color = $("#background").val();
|
||||
var adv_url_json = $("input[name='adv_url']").val();
|
||||
var ap_id = '{$ap_id}';
|
||||
if(adv_url_json) adv_url_json = JSON.parse(adv_url_json);
|
||||
$(".adv-url-show").text(adv_url_json.title);
|
||||
|
||||
layui.use(['form', 'colorpicker'], function () {
|
||||
var form = layui.form,
|
||||
colorpicker = layui.colorpicker,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('select(ap_id)', function(data){
|
||||
var type = $(data.elem).find("option:selected").attr("data-type");
|
||||
var width = $(data.elem).find("option:selected").attr("data-width");
|
||||
var height = $(data.elem).find("option:selected").attr("data-height");
|
||||
$(".pic_width").text(width);
|
||||
$(".pic_height").text(height);
|
||||
$("[data-type]").hide();
|
||||
$("[data-type='"+ type+"']").show();
|
||||
});
|
||||
|
||||
form.on('select(pc_link)', function(data){
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
|
||||
if(data.value != 'diy'){
|
||||
$("input[name='adv_url']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": data.value
|
||||
}));
|
||||
}else{
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value :$("input[name='adv_url']").val() ? JSON.parse($("input[name='adv_url']").val()).url : '',
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel : function () {
|
||||
$("input[name='url']").val("");
|
||||
}
|
||||
}, function(value, index, elem){
|
||||
$("input[name='adv_url']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": value
|
||||
}));
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
colorpicker.render({
|
||||
elem: '#bg_color', //绑定元素
|
||||
color: color,
|
||||
done: function(color) {
|
||||
$(".tdrag-name").css("color", color);
|
||||
$("#background").val(color);
|
||||
}
|
||||
});
|
||||
|
||||
// 广告图片
|
||||
var logo_upload = new Upload({
|
||||
elem: '#adv_image'
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/editAdv"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("pc://shop/adv/lists", {ap_id:ap_id})
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function (value) {
|
||||
let reg = ns.getRegexp('>=0num');
|
||||
if (value !== '' && !reg.test(value)) {
|
||||
return '排序数值必须为大于或等于0的整数'
|
||||
}
|
||||
},
|
||||
flo: function (value) {
|
||||
let reg = ns.getRegexp('>=0float2');
|
||||
if (value !== '' && !reg.test(value)) {
|
||||
return '价格必须大于或等于0,最多保留两位小数'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function backPcAdvList() {
|
||||
location.hash = ns.hash("pc://shop/adv/lists", {ap_id:ap_id})
|
||||
}
|
||||
|
||||
function selectedLink() {
|
||||
ns.select_link(adv_url_json, function (data) {
|
||||
for (var o in data) {
|
||||
if (data[o] == null) delete data[o];
|
||||
}
|
||||
|
||||
$("input[name='adv_url']").val(JSON.stringify(data));
|
||||
$(".adv-url-show").text(data.title);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
148
addon/pc/shop/view/adv/edit_position.html
Executable file
148
addon/pc/shop/view/adv/edit_position.html
Executable file
@@ -0,0 +1,148 @@
|
||||
<style>
|
||||
.layui-colorpicker-main-input div.layui-inline{margin-right: 0;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 130px;height: 34px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告位置名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_name" type="text" value="{$info.ap_name}" lay-verify="required" class="layui-input len-long {if condition="$info.is_system == 1"}layui-btn-disabled{/if}" {if condition="$info.is_system == 1"}disabled{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>广告关键字:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="keyword" value='{$info.keyword}'type="text" lay-verify="required" class="layui-input len-long {if condition="$info.is_system == 1"}layui-btn-disabled{/if}" {if condition="$info.is_system == 1"}disabled{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告位简介:</label>
|
||||
<div class="layui-input-block len-long">
|
||||
<textarea name="ap_intro" maxlength="150" class="layui-textarea {if condition="$info.is_system == 1"}layui-btn-disabled{/if}" {if condition="$info.is_system == 1"}disabled{/if}>{$info.ap_intro}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">建议广告图片宽度:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_width" value="{$info.ap_width}" type="number" lay-verify="int" class="layui-input len-short {if condition="$info.is_system == 1"}layui-btn-disabled{/if}" {if condition="$info.is_system == 1"}disabled{/if}>
|
||||
</div>
|
||||
<div class="word-aux">单位:px 宽度值不能小于0(例:首页轮播图一般为1920px * 400px)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">建议广告图片高度:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="ap_height" value="{$info.ap_height}" type="number" lay-verify="int" class="layui-input len-short {if condition="$info.is_system == 1"}layui-btn-disabled{/if}" {if condition="$info.is_system == 1"}disabled{/if}>
|
||||
</div>
|
||||
<div class="word-aux">单位:px 高度值不能小于0(例:首页轮播图一般为1920px * 400px)</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!--<label class="layui-form-label">广告位类型:</label>-->
|
||||
<!--<div class="layui-input-inline" id="type">-->
|
||||
<!--<input type="radio" name="type" lay-filter="type" value="1" title="电脑端" {if condition="$info.type == 1"}checked{/if}>-->
|
||||
<!--<input type="radio" name="type" lay-filter="type" value="2" title="手机端" {if condition="$info.type == 2"}checked{/if}>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">广告位背景色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div id="font_color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" {if condition="$info.state == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backPcAdvIndex()">返回</button>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="ap_id" value="{$info.ap_id}" />
|
||||
<input type="hidden" name="ap_background_color" id="ap_background_color" value="{$info.ap_background_color}" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var colorN = $("#ap_background_color").val();
|
||||
|
||||
layui.use(['form', 'colorpicker'], function () {
|
||||
var form = layui.form,
|
||||
colorpicker = layui.colorpicker,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
colorpicker.render({
|
||||
elem: '#font_color', //绑定元素
|
||||
color: colorN,
|
||||
done: function(color) {
|
||||
$(".tdrag-name").css("color", color);
|
||||
$("#ap_background_color").val(color);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/editPosition"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("pc://shop/adv/index")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
int: function (value) {
|
||||
if (value == '') {
|
||||
return;
|
||||
}
|
||||
if (value < 0 || value%1 != 0) {
|
||||
return '请输入0或正整数!'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function backPcAdvIndex() {
|
||||
location.hash = ns.hash("pc://shop/adv/index")
|
||||
}
|
||||
</script>
|
||||
243
addon/pc/shop/view/adv/index.html
Executable file
243
addon/pc/shop/view/adv/index.html
Executable file
@@ -0,0 +1,243 @@
|
||||
<div class="single-filter-box">
|
||||
<div>
|
||||
<!--<button class="layui-btn" onclick="add()">添加广告位</button>-->
|
||||
</div>
|
||||
<div class="layui-form" style="margin-left: unset">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入广告位置" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="adv_position" lay-filter="adv_position"></table>
|
||||
|
||||
<!-- 广告位宽度 -->
|
||||
<script type="text/html" id="ap_width">
|
||||
<input name="ap_width" type="number" onchange="editPosition({{d.ap_id}}, 'ap_width', this)" value="{{d.ap_width}}" class="layui-input sort-len">
|
||||
</script>
|
||||
|
||||
<!-- 广告位高度 -->
|
||||
<script type="text/html" id="ap_height">
|
||||
<input name="ap_height" type="number" onchange="editPosition({{d.ap_id}}, 'ap_height', this)" value="{{d.ap_height}}" class="layui-input sort-len">
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="manager">管理广告</a>
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<!-- <a class="layui-btn" lay-event="delete">删除</a>-->
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<script type="text/html" id="toolbarOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="del">批量删除</button>
|
||||
</script>
|
||||
<!-- 批量删除 -->
|
||||
<script type="text/html" id="batchOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="del">批量删除</button>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table, form,
|
||||
repeat_flag = false; //防重复标识
|
||||
|
||||
layui.use('form', function() {
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
form.on('switch(state)', function(data){
|
||||
let state = data.elem.checked ? 1 : 0;
|
||||
let ap_id = $(data.elem).attr('data-ap-id');
|
||||
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/alterAdvPositionState"),
|
||||
data: {
|
||||
ap_id : ap_id,
|
||||
state : state,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
table = new Table({
|
||||
elem: '#adv_position',
|
||||
url: ns.url("pc://shop/adv/index"),
|
||||
cols: [
|
||||
[
|
||||
// {
|
||||
// width: '3%',
|
||||
// type: 'checkbox',
|
||||
// unresize: 'false'
|
||||
// },
|
||||
{
|
||||
field: 'ap_name',
|
||||
title: '广告位置名',
|
||||
unresize: 'false',
|
||||
width: '30%',
|
||||
}, {
|
||||
field: 'keyword',
|
||||
title: '广告关键字',
|
||||
unresize: 'false',
|
||||
width: '30%',
|
||||
},{
|
||||
title: '是否是系统',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return data.is_system == 0 ? "否" : "是";
|
||||
},
|
||||
width: '10%',
|
||||
},{
|
||||
title: '是否启用',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return '<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" data-ap-id="'+ data.ap_id +'" '+ (data.state == 1 ? 'checked' : '') +' />';
|
||||
},
|
||||
width: '10%',
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
// toolbar: "#toolbarOperation",
|
||||
// bottomToolbar: "#batchOperation"
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'manager': //管理
|
||||
location.hash = ns.hash("pc://shop/adv/lists?ap_id=" + data.ap_id);
|
||||
break;
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("pc://shop/adv/editPosition?ap_id=" + data.ap_id);
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deletePosition(data.ap_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 批量操作
|
||||
*/
|
||||
table.toolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
switch (obj.event) {
|
||||
case "del":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push(obj.data[i].ap_id);
|
||||
deletePosition(id_array.toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
table.bottomToolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
switch (obj.event) {
|
||||
case "del":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push(obj.data[i].ap_id);
|
||||
deletePosition(id_array.toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deletePosition(ap_ids) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('删除将会影响广告位的使用,确定要删除吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/deletePosition"),
|
||||
data: {'ap_ids': ap_ids},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听搜索
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 监听单元格编辑--编辑宽度
|
||||
function editPosition(id, type, event) {
|
||||
var value = $(event).val();
|
||||
|
||||
if (!new RegExp("^\\d+$").test(value)) {
|
||||
layer.msg("广告位宽高必须为大于等于0的整数");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("pc://shop/adv/editPositionField"),
|
||||
data: {
|
||||
'type': type,
|
||||
'value': value,
|
||||
'ap_id': id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("pc://shop/adv/addPosition");
|
||||
}
|
||||
</script>
|
||||
294
addon/pc/shop/view/adv/lists.html
Executable file
294
addon/pc/shop/view/adv/lists.html
Executable file
@@ -0,0 +1,294 @@
|
||||
<div>
|
||||
<button class="layui-btn" onclick="add()">添加广告</button>
|
||||
|
||||
<div class="layui-form" style="display:none;">
|
||||
<div class="layui-input-inline">
|
||||
<select name="ap_id">
|
||||
<option value="">所属广告位</option>
|
||||
{notempty name="adv_position"}
|
||||
{foreach name="adv_position" item="vo"}
|
||||
<option value="{$vo.ap_id}" {if $ap_id == $vo.ap_id}selected{/if}>{$vo.ap_name}</option>
|
||||
{/foreach}
|
||||
{/notempty}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="layui-input-inline len-mid">
|
||||
<input type="text" name="search_text" placeholder="请输入广告名称" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="adv_list" lay-filter="adv_list"></table>
|
||||
|
||||
<!-- 广告图片 -->
|
||||
<script type="text/html" id="adv_image">
|
||||
<div class="img-box">
|
||||
<img layer-src src="{{ns.img(d.adv_image)}}" />
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 排序 -->
|
||||
<script type="text/html" id="slide_sort">
|
||||
<input name="slide_sort" type="number" onchange="editSort({{d.adv_id}},'slide_sort', this)" value="{{d.slide_sort}}" class="layui-input sort-len">
|
||||
</script>
|
||||
|
||||
<!-- 广告链接 -->
|
||||
<script type="text/html" id="adv_url">
|
||||
<a href="{{d.adv_url}}">{{d.adv_url}}</a>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<script type="text/html" id="toolbarOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="del">批量删除</button>
|
||||
</script>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<script type="text/html" id="batchOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="del">批量删除</button>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var ap_id = '{$ap_id}';
|
||||
layui.use('form', function () {
|
||||
var table,
|
||||
form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('switch(state)', function(data){
|
||||
let state = data.elem.checked ? 1 : 0;
|
||||
let adv_id = $(data.elem).attr('data-adv-id');
|
||||
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/alterAdvState"),
|
||||
data: {
|
||||
adv_id : adv_id,
|
||||
state : state,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
table = new Table({
|
||||
elem: '#adv_list',
|
||||
url: ns.url("pc://shop/adv/lists"),
|
||||
where: {
|
||||
'ap_id': '{$ap_id}'
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
width: '3%',
|
||||
type: 'checkbox',
|
||||
unresize: 'false',
|
||||
}, {
|
||||
field: 'adv_title',
|
||||
title: '广告名称',
|
||||
unresize: 'false',
|
||||
width: '15%'
|
||||
}, {
|
||||
title: '广告链接',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function(data) {
|
||||
var adv_url = data.adv_url;
|
||||
if(adv_url){
|
||||
adv_url = JSON.parse(data.adv_url);
|
||||
return adv_url.title ? adv_url.title : '';
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'ap_name',
|
||||
title: '所属广告位',
|
||||
unresize: 'false',
|
||||
templet:'#ap_posi',
|
||||
width: '15%'
|
||||
}, {
|
||||
title: '广告图片',
|
||||
unresize: 'false',
|
||||
templet: '#adv_image',
|
||||
width: '15%'
|
||||
}, {
|
||||
field: 'slide_sort',
|
||||
title: '排序',
|
||||
unresize: 'false',
|
||||
templet: '#slide_sort',
|
||||
width: '12%',
|
||||
sort: true
|
||||
}, {
|
||||
title: '是否启用',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return '<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="state" data-adv-id="'+ data.adv_id +'" '+ (data.state == 1 ? 'checked' : '') +' />';
|
||||
},
|
||||
width: '10%',
|
||||
},{
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
],
|
||||
bottomToolbar: "#batchOperation",
|
||||
toolbar: "#toolbarOperation"
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("pc://shop/adv/editadv",{"adv_id":data.adv_id, ap_id:ap_id});
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deleteAdv(data.adv_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 批量操作
|
||||
*/
|
||||
table.bottomToolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
switch (obj.event) {
|
||||
case "del":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push(obj.data[i].adv_id);
|
||||
deleteAdv(id_array.toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 批量操作
|
||||
*/
|
||||
table.toolbar(function(obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
switch (obj.event) {
|
||||
case "del":
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push(obj.data[i].adv_id);
|
||||
deleteAdv(id_array.toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteAdv(adv_ids) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定要删除该广告吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/adv/deleteAdv"),
|
||||
data: {'adv_ids': adv_ids},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听搜索
|
||||
*/
|
||||
form.on('submit(search)', function(data){
|
||||
ap_id = $("select[name='ap_id']").val();
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(adv_id, type, event){
|
||||
var value = $(event).val();
|
||||
|
||||
if(!new RegExp("^-?[1-9]\\d*$").test(value)){
|
||||
layer.msg("排序号只能是整数");
|
||||
return ;
|
||||
}
|
||||
if(value<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("pc://shop/adv/editAdvField"),
|
||||
data: {'type': type, 'value': value, 'adv_id': adv_id},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if(res.code==0){
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("pc://shop/adv/addAdv", {ap_id : ap_id});
|
||||
}
|
||||
</script>
|
||||
104
addon/pc/shop/view/pc/add_link.html
Executable file
104
addon/pc/shop/view/pc/add_link.html
Executable file
@@ -0,0 +1,104 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_title" type="text" lay-verify="required" class="layui-input len-mid" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接地址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_url" type="text" lay-verify="required" class="layui-input len-mid" >
|
||||
</div>
|
||||
<div class="word-aux">当填写链接链接地址后点击标题将打开链接地址,链接格式请以http://开头</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" value="1" lay-skin="switch" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否新窗口打开:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_blank" value="1" lay-skin="switch" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_sort" type="text" value="0" class="layui-input len-short">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">导航图标:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default" id="imgUpload">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="link_pic" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>建议图片尺寸:不能大于100k。图片格式:jpg、png、jpeg。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form, repeat_flag=false;
|
||||
|
||||
// 普通图片上传
|
||||
var logo_upload = new Upload({
|
||||
elem: '#imgUpload',
|
||||
size:100
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if(!data.field.link_url){
|
||||
layer.msg("请输入链接地址");
|
||||
return;
|
||||
}
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/addLink"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
location.hash = ns.hash("pc://shop/pc/linklist");
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
137
addon/pc/shop/view/pc/add_nav.html
Executable file
137
addon/pc/shop/view/pc/add_nav.html
Executable file
@@ -0,0 +1,137 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>导航名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="nav_title" type="text" lay-verify="required" class="layui-input len-mid" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接地址:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="link" lay-filter="link">
|
||||
<option value="">请选择</option>
|
||||
{foreach $link as $k => $v}
|
||||
<option value="{$v.url}">{$v.title}</option>
|
||||
{/foreach}
|
||||
<option value="diy">自定义</option>
|
||||
</select>
|
||||
<input name="nav_url" type="hidden" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" value="1" lay-skin="switch" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否新窗口打开:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_blank" value="1" lay-skin="switch" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" type="text" value="0" class="layui-input len-short">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">导航图标:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default" id="imgUpload">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="nav_icon" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>建议图片尺寸:不能大于100k。图片格式:jpg、png、jpeg。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form, repeat_flag=false;
|
||||
form.render();
|
||||
form.on('select(link)', function(data){
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
if(data.value != 'diy'){
|
||||
$("input[name='nav_url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:data.value
|
||||
}));
|
||||
}else{
|
||||
var value = $("input[name='nav_url']").val();
|
||||
if(value) value = JSON.parse(value).url;
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value :value,
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel : function () {
|
||||
$("input[name='nav_url']").val("");
|
||||
}
|
||||
}, function(value, index, elem){
|
||||
$("input[name='nav_url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:value
|
||||
}));
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 普通图片上传
|
||||
var logo_upload = new Upload({
|
||||
elem: '#imgUpload',
|
||||
size:100
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if(!data.field.nav_url){
|
||||
layer.msg("请输入链接地址");
|
||||
return;
|
||||
}
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/addNav"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
location.hash = ns.hash("pc://shop/pc/navlist");
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
128
addon/pc/shop/view/pc/category.html
Executable file
128
addon/pc/shop/view/pc/category.html
Executable file
@@ -0,0 +1,128 @@
|
||||
<style>
|
||||
.new-footer {
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
left: 180px;
|
||||
width: 89%;
|
||||
height: 50px;
|
||||
}
|
||||
.new-footer .layui-btn1 {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 790px;
|
||||
}
|
||||
.new-footer .layui-btn2 {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 870px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show" lay-filter="addForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模板选择</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="category" value="1" lay-filter="category_filter" title="一级分类" {$config_info.category==1?'checked':''}>
|
||||
<input type="radio" name="category" value="2" lay-filter="category_filter" title="二级分类" {$config_info.category==2?'checked':''}>
|
||||
<input type="radio" name="category" value="3" lay-filter="category_filter" title="三级分类" {$config_info.category==3?'checked':''}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" name="img" id="img" value="{$config_info.img}" />
|
||||
<label class="layui-form-label">分类图</label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary propertychange noimg">无图模式</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary propertychange youimg">有图模式</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form form-wrap new-footer">
|
||||
<div class="form-row">
|
||||
<button class="layui-btn layui-btn1" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn2 layui-btn-primary" lay-submit lay-filter="back">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<img class="index-classify" src="" alt="" width="800" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer"></div>
|
||||
|
||||
<script>
|
||||
var template = {$config_info.category};
|
||||
var img = {$config_info.img};
|
||||
var classifyData = {
|
||||
template: template,
|
||||
img: img
|
||||
};
|
||||
renderImg();
|
||||
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form;
|
||||
form.on('radio(category_filter)', function (data) {
|
||||
classifyData.template = data.value;
|
||||
// classifyData.img = 0;
|
||||
renderImg();
|
||||
// $(".noimg").addClass('border-color text-color').siblings().removeClass('border-color text-color');
|
||||
});
|
||||
form.on('submit(save)', function (data) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
url: ns.url("pc://shop/pc/category"),
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.on('submit(back)', function (data) {
|
||||
history.go(-1);
|
||||
return false;
|
||||
});
|
||||
|
||||
if(classifyData.img==1){
|
||||
$(".youimg").addClass('border-color text-color');
|
||||
$('.noimg').removeClass('border-color text-color');
|
||||
}else{
|
||||
$('.noimg').addClass('border-color text-color');
|
||||
$('.youimg').removeClass('border-color text-color');
|
||||
}
|
||||
});
|
||||
|
||||
$('.youimg').click(function () {
|
||||
classifyData.img = 1;
|
||||
$("#img").attr("value","1");
|
||||
$(".youimg").addClass('border-color text-color');
|
||||
$('.noimg').removeClass('border-color text-color');
|
||||
renderImg();
|
||||
});
|
||||
|
||||
$('.noimg').click(function () {
|
||||
classifyData.img = 0;
|
||||
$("#img").attr("value","0");
|
||||
$('.noimg').addClass('border-color text-color');
|
||||
$('.youimg').removeClass('border-color text-color');
|
||||
renderImg();
|
||||
});
|
||||
|
||||
function renderImg() {
|
||||
var imgSrc = "public/static/img/shop/category_" + classifyData.template + '_' + classifyData.img + '.png';
|
||||
imgSrc = ns.img(imgSrc);
|
||||
$(".index-classify").attr("src",imgSrc);
|
||||
}
|
||||
</script>
|
||||
246
addon/pc/shop/view/pc/edit_floor.html
Executable file
246
addon/pc/shop/view/pc/edit_floor.html
Executable file
@@ -0,0 +1,246 @@
|
||||
<link rel="stylesheet" href="ADDON_PC_CSS/edit_floor.css">
|
||||
<style>
|
||||
.upload-default{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>楼层名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="title" type="text" lay-verify="title" class="layui-input len-mid" {notempty name="$floor_info"}value="{$floor_info['title']}"{/notempty} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>楼层模板:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="block_id" lay-filter="block_id" lay-verify="block_id">
|
||||
<option value="">请选择</option>
|
||||
{foreach name="$floor_block_list" item="vo"}
|
||||
<option value="{$vo.id}" data-value='{$vo.value}' data-block-id="{$vo.id}" {if condition="!empty($floor_info) && $floor_info['block_id'] == $vo['id']" }selected{/if}>{$vo.title}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="state" value="1" lay-skin="switch" {if condition="!empty($floor_info) && $floor_info['state'] == 1" }checked{elseif condition="!empty($floor_info) && $floor_info['state'] == 0"}{else/}checked{/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" type="text" class="layui-input len-short" value="{if condition="!empty($floor_info)" }{$floor_info['sort']}{else/}0{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="app">
|
||||
{foreach name="$floor_block_list" item="vo"}
|
||||
{notempty name="$vo['value']"}
|
||||
<{$vo['name']} :data='data' v-if="blockId == {$vo.id}">{$vo.title}</{$vo['name']}>
|
||||
{/notempty}
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{$id}"/>
|
||||
{notempty name="$floor_info"}
|
||||
<input type="hidden" id="info" value='{$floor_info.value}' />
|
||||
<input type="hidden" id="block_id" value='{$floor_info.block_id}' />
|
||||
{/notempty}
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="setTitleHtml">
|
||||
|
||||
<div class="layui-form form-wrap set-title">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">{{# if(!('isTextRequired' in d) || ('isTextRequired' in d) && d.isTextRequired){ }}<span class="required">*</span>{{# } }}文本:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="text" type="text" lay-verify="{{(!('isTextRequired' in d) || ('isTextRequired' in d) && d.isTextRequired) && 'required' || ''}}" class="layui-input len-mid" value="{{ d.text ? d.text : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{# if(d.textAlign){ }}
|
||||
<div class="layui-form-item ">
|
||||
<label class="layui-form-label sm">位置</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="textAlign" value="left" title="左边" {{(d.textAlign == 'left') && 'checked' || ''}}>
|
||||
<input type="radio" name="textAlign" value="center" title="居中" {{(d.textAlign == 'center') && 'checked' || ''}}>
|
||||
<input type="radio" name="textAlign" value="right" title="右边" {{(d.textAlign == 'right') && 'checked' || ''}}>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="pc_link_text" lay-filter="pc_link_text">
|
||||
<option value="">请选择</option>
|
||||
{foreach $pc_link as $k => $v}
|
||||
{{# if(d.link && d.link.title == '{$v.title}'){ }}
|
||||
<option value="{$v.url}" selected>{$v.title}</option>
|
||||
{{# }else{ }}
|
||||
<option value="{$v.url}">{$v.title}</option>
|
||||
{{# } }}
|
||||
{/foreach}
|
||||
{{# if(d.link && d.link.title == '自定义'){ }}
|
||||
<option value="diy" selected>自定义</option>
|
||||
{{# }else{ }}
|
||||
<option value="diy">自定义</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{# if(d.link && d.link.title){ }}
|
||||
<input name="text_link" type="hidden" value='{{ JSON.stringify(d.link) }}' />
|
||||
{{# }else{ }}
|
||||
<input name="text_link" type="hidden" />
|
||||
{{# } }}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">颜色:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<div id="text_color"></div>
|
||||
</div>
|
||||
<input name="text_color" type="hidden" value="" class="layui-input len-short" id="text_color_input">
|
||||
</div>
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="save_text">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="uploadImg">
|
||||
|
||||
<div class="layui-form form-wrap upload-img">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">图片:</label>
|
||||
<div class="layui-input-inline img-upload">
|
||||
<input type="hidden" class="layui-input" name="upload_image" value="{{ d.url ? d.url : '' }}" />
|
||||
<div class="upload-img-block icon">
|
||||
<div class="upload-img-box" id="upload_image">
|
||||
{{# if(d.url){ }}
|
||||
<img src="{{ ns.img(d.url) }}" />
|
||||
{{# }else{ }}
|
||||
<div class="upload-default">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">链接:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="pc_link_upload" lay-filter="pc_link_upload">
|
||||
<option value="">请选择</option>
|
||||
{foreach $pc_link as $k => $v}
|
||||
{{# if(d.link && d.link.title == '{$v.title}'){ }}
|
||||
<option value="{$v.url}" selected>{$v.title}</option>
|
||||
{{# }else{ }}
|
||||
<option value="{$v.url}">{$v.title}</option>
|
||||
{{# } }}
|
||||
{/foreach}
|
||||
{{# if(d.link && d.link.title == '自定义'){ }}
|
||||
<option value="diy" selected>自定义</option>
|
||||
{{# }else{ }}
|
||||
<option value="diy">自定义</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{# if(d.link && d.link.title){ }}
|
||||
<input name="upload_link" type="hidden" value='{{ JSON.stringify(d.link) }}' />
|
||||
{{# }else{ }}
|
||||
<input name="upload_link" type="hidden" />
|
||||
{{# } }}
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="save_upload">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="setCategoryHtml">
|
||||
|
||||
<div class="layui-form form-wrap set-category">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">商品分类:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="goods_category" lay-filter="goods_category">
|
||||
<option value="">请选择</option>
|
||||
{foreach $category_list as $k => $v}
|
||||
<option value="{$v.category_id}" data-category-name="{$v.category_name}">{$v.category_name}</option>
|
||||
{notempty name="$v['child_list']"}
|
||||
{foreach $v['child_list'] as $second_k => $second_v}
|
||||
<option value="{$second_v.category_id}" data-category-name="{$second_v.category_name}"> {$second_v.category_name}</option>
|
||||
{notempty name="$second_v['child_list']"}
|
||||
{foreach $second_v['child_list'] as $third_k => $third_v}
|
||||
<option value="{$third_v.category_id}" data-category-name="{$third_v.category_name}"> {$third_v.category_name}</option>
|
||||
{/foreach}
|
||||
{/notempty}
|
||||
{/foreach}
|
||||
{/notempty}
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">已选:</label>
|
||||
<div class="layui-input-block selected-wrap">
|
||||
<ul>
|
||||
{{# if(d.list){ }}
|
||||
{{# for(var i=0;i<d.list.length;i++){ }}
|
||||
<li>
|
||||
<span>{{d.list[i].category_name}}</span>
|
||||
<i class='delete-category' data-id="{{d.list[i].category_id}}">x</i>
|
||||
</li>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{# if(d.list){ }}
|
||||
<input name="category_list" type="hidden" value='{{ JSON.stringify(d.list) }}' />
|
||||
<input name="category_ids" type="hidden" value="
|
||||
{{# for(var i=0;i<d.list.length;i++){ }}
|
||||
{{ d.list[i].category_id }}
|
||||
{{# if((i+1)!=d.list.length){ }}
|
||||
,
|
||||
{{# } }}
|
||||
{{# } }}" />
|
||||
{{# }else{ }}
|
||||
<input name="category_ids" type="hidden" />
|
||||
<input name="category_list" type="hidden" />
|
||||
{{# } }}
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="save_category">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script src="STATIC_JS/vue.js"></script>
|
||||
<script src="ADDON_PC_JS/floor/edit.js"></script>
|
||||
<script src="ADDON_PC_JS/floor/floor_style_1.js"></script>
|
||||
<script src="ADDON_PC_JS/floor/floor_style_2.js"></script>
|
||||
<script src="ADDON_PC_JS/floor/floor_style_3.js"></script>
|
||||
<script src="ADDON_PC_JS/floor/floor_style_4.js"></script>
|
||||
112
addon/pc/shop/view/pc/edit_link.html
Executable file
112
addon/pc/shop/view/pc/edit_link.html
Executable file
@@ -0,0 +1,112 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<input type="hidden" name="id" value="{$id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_title" value="{$link_info['link_title']}" type="text" lay-verify="required" class="layui-input len-mid" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接地址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_url" value="{$link_info['link_url']}" type="text" lay-verify="required" class="layui-input len-mid" >
|
||||
</div>
|
||||
<div class="word-aux">当填写链接链接地址后点击标题将打开链接地址,链接格式请以http://开头</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" value="1" lay-skin="switch" {if condition="$link_info && $link_info.is_show == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否新窗口打开:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_blank" value="1" lay-skin="switch" {if condition="$link_info && $link_info.is_blank == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="link_sort" type="text" value="{$link_info['link_sort']}" class="layui-input len-short">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">导航图标:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box {notempty name="$link_info['link_pic']"}hover{/notempty}">
|
||||
<div class="upload-default" id="imgUpload">
|
||||
{if condition="$link_info.link_pic"}
|
||||
<div id="preview_imgUpload" class="preview_img">
|
||||
<img layer-src src="{:img($link_info.link_pic)}" class="img_prev"/>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="link_pic" value="{$link_info.link_pic}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>建议图片尺寸:不能大于100k。图片格式:jpg、png、jpeg。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form, repeat_flag=false;
|
||||
|
||||
// 普通图片上传
|
||||
var logo_upload = new Upload({
|
||||
elem: '#imgUpload',
|
||||
size:100
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if(!data.field.link_url){
|
||||
layer.msg("请输入链接地址");
|
||||
return;
|
||||
}
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/editLink"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
location.hash = ns.hash("pc://shop/pc/linklist");
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
145
addon/pc/shop/view/pc/edit_nav.html
Executable file
145
addon/pc/shop/view/pc/edit_nav.html
Executable file
@@ -0,0 +1,145 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<input type="hidden" name="id" value="{$nav_info.id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>导航名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="nav_title" type="text" lay-verify="required" class="layui-input len-mid" {if $nav_info} value="{$nav_info.nav_title}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>链接地址:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="link" lay-filter="link">
|
||||
<option value="">请选择</option>
|
||||
{foreach $link as $k => $v}
|
||||
<option value="{$v.url}" {if $nav_info && $nav_info.nav_url && json_decode($nav_info.nav_url,true)['title'] == $v.title}selected{/if}>{$v.title}</option>
|
||||
{/foreach}
|
||||
<option value="diy" {if $nav_info && $nav_info.nav_url && json_decode($nav_info.nav_url,true)['title'] == '自定义'}selected{/if}>自定义</option>
|
||||
</select>
|
||||
<input name="nav_url" type="hidden" {if $nav_info} value="{$nav_info.nav_url}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" value="1" lay-skin="switch" {if condition="$nav_info && $nav_info.is_show == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否新窗口打开:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_blank" value="1" lay-skin="switch" {if condition="$nav_info && $nav_info.is_blank == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" type="text" class="layui-input len-short" {if $nav_info} value="{$nav_info.sort}"{else /}value="0" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">导航图标:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box {notempty name="$nav_info['nav_icon']"}hover{/notempty}">
|
||||
<div class="upload-default" id="imgUpload">
|
||||
{if condition="$nav_info.nav_icon"}
|
||||
<div id="preview_imgUpload" class="preview_img">
|
||||
<img layer-src src="{:img($nav_info.nav_icon)}" class="img_prev"/>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="nav_icon" value="{$nav_info.nav_icon}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>建议图片尺寸:不能大于100k。图片格式:jpg、png、jpeg。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form, repeat_flag=false;
|
||||
form.render();
|
||||
form.on('select(link)', function(data){
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
if(data.value != 'diy'){
|
||||
$("input[name='nav_url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:data.value
|
||||
}));
|
||||
}else{
|
||||
var value = $("input[name='nav_url']").val();
|
||||
if(value) value = JSON.parse(value).url;
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value :value,
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel : function () {
|
||||
$("input[name='nav_url']").val("");
|
||||
}
|
||||
}, function(value, index, elem){
|
||||
$("input[name='nav_url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:value
|
||||
}));
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 普通图片上传
|
||||
var logo_upload = new Upload({
|
||||
elem: '#imgUpload',
|
||||
size:100
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if(!data.field.nav_url){
|
||||
layer.msg("请输入链接地址");
|
||||
return;
|
||||
}
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/editNav"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
location.hash = ns.hash("pc://shop/pc/navlist");
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
138
addon/pc/shop/view/pc/float_layer.html
Executable file
138
addon/pc/shop/view/pc/float_layer.html
Executable file
@@ -0,0 +1,138 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>浮窗名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="title" type="text" lay-verify="required" class="layui-input len-mid" {if $float_layer} value="{$float_layer.title}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">链接地址:</label>
|
||||
<div class="layui-input-block len-mid">
|
||||
<select name="link" lay-filter="link">
|
||||
<option value="">请选择</option>
|
||||
{foreach $link as $k => $v}
|
||||
<option value="{$v.url}" {if $float_layer && $float_layer.url && json_decode($float_layer.url,true)['title'] == $v.title}selected{/if}>{$v.title}</option>
|
||||
{/foreach}
|
||||
<option value="diy" {if $float_layer && $float_layer.url && json_decode($float_layer.url,true)['title'] == '自定义'}selected{/if}>自定义</option>
|
||||
</select>
|
||||
<input name="url" type="hidden" {if $float_layer} value="{$float_layer.url}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否显示:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_show" value="1" lay-skin="switch" {if condition="$float_layer && $float_layer.is_show == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>显示次数:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="number" type="text" lay-verify="required" class="layui-input len-short" {if $float_layer} value="{$float_layer.number}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">浮窗图片:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="upload-img-block img-upload">
|
||||
<div class="upload-img-box {notempty name="$float_layer['img_url']"}hover{/notempty}">
|
||||
<div class="upload-default" id="imgUpload">
|
||||
{if condition="$float_layer.img_url"}
|
||||
<div id="preview_imgUpload" class="preview_img">
|
||||
<img layer-src src="{:img($float_layer.img_url)}" class="img_prev"/>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="img_url" value="{$float_layer.img_url}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag=false;
|
||||
form.render();
|
||||
|
||||
form.on('select(link)', function(data){
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
if(data.value != 'diy'){
|
||||
$("input[name='url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:data.value
|
||||
}));
|
||||
}else{
|
||||
var value = $("input[name='url']").val();
|
||||
if(value) value = JSON.parse(value).url;
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value :value,
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel : function () {
|
||||
$("input[name='url']").val("");
|
||||
}
|
||||
}, function(value, index, elem){
|
||||
$("input[name='url']").val(JSON.stringify({
|
||||
title : title,
|
||||
url:value
|
||||
}));
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 普通图片上传
|
||||
var logo_upload = new Upload({
|
||||
elem: '#imgUpload'
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if(!data.field.url){
|
||||
layer.msg("请输入链接地址");
|
||||
return;
|
||||
}
|
||||
if(!data.field.img_url){
|
||||
layer.msg("请上传浮层图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/floatLayer"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
177
addon/pc/shop/view/pc/floor.html
Executable file
177
addon/pc/shop/view/pc/floor.html
Executable file
@@ -0,0 +1,177 @@
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加楼层</button>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入楼层名称" autocomplete="off" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="floor_list" lay-filter="floor_list"></table>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="sort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.id}},this)" value="{{d.sort}}" placeholder="请输入排序" class="layui-input edit-sort sort-len">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table, repeat_flag = false;//防重复标识;
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#floor_list',
|
||||
url: ns.url("pc://shop/pc/floor"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'title',
|
||||
title: '楼层名称',
|
||||
width: '25%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'block_title',
|
||||
title: '所属模板',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'state',
|
||||
title: '状态',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.state == 1 ? "开启" : "禁用";
|
||||
}
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
width: '10%',
|
||||
sort : true,
|
||||
unresize: 'false',
|
||||
templet: '#sort'
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("pc://shop/pc/editfloor?id=" + data.id);
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deleteFloor(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteFloor(id) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.confirm('确定要删除该首页楼层吗?', function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/deletefloor"),
|
||||
data: {id: id},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
function () {
|
||||
repeat_flag = false;
|
||||
layer.close();
|
||||
});
|
||||
}
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(id, event) {
|
||||
var data = $(event).val();
|
||||
if (!new RegExp("^-?[1-9]\\d*$").test(data)) {
|
||||
layer.msg("排序号只能是整数");
|
||||
return;
|
||||
}
|
||||
if(data<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("pc://shop/pc/modifyFloorSort"),
|
||||
data: {
|
||||
sort: data,
|
||||
id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("pc://shop/pc/editfloor");
|
||||
}
|
||||
</script>
|
||||
187
addon/pc/shop/view/pc/link_list.html
Executable file
187
addon/pc/shop/view/pc/link_list.html
Executable file
@@ -0,0 +1,187 @@
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加链接</button>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入链接名称" autocomplete="off" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="nav_list" lay-filter="nav_list"></table>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="sort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.id}},this)" value="{{d.link_sort}}" placeholder="请输入排序" class="layui-input edit-sort sort-len">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table, repeat_flag = false;//防重复标识;
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#nav_list',
|
||||
url: ns.url("pc://shop/pc/linkList"),
|
||||
cols: [
|
||||
[ {
|
||||
field: 'link_sort',
|
||||
title: '排序',
|
||||
width: '8%',
|
||||
sort : true,
|
||||
unresize: 'false',
|
||||
templet: '#sort'
|
||||
},{
|
||||
field: 'link_title',
|
||||
title: '链接名称',
|
||||
width: '15%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'link_url',
|
||||
title: '链接地址',
|
||||
width: '30%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'is_show',
|
||||
title: '是否显示',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
if(data.is_show){
|
||||
return '是';
|
||||
}else {
|
||||
return '否';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'is_blank',
|
||||
title: '新窗口打开',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
if(data.is_blank){
|
||||
return '是';
|
||||
}else {
|
||||
return '否';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("pc://shop/pc/editLink?id=" + data.id);
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deleteHelp(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteHelp(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定要删除该链接吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/deleteLink"),
|
||||
data: {id},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
function() {
|
||||
repeat_flag = false;
|
||||
layer.close();
|
||||
});
|
||||
}
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(id, event) {
|
||||
var data = $(event).val();
|
||||
if (!new RegExp("^-?[1-9]\\d*$").test(data)) {
|
||||
layer.msg("排序号只能是整数");
|
||||
return;
|
||||
}
|
||||
if(data<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("pc://shop/pc/modifyLinkSort"),
|
||||
data: {
|
||||
sort: data,
|
||||
id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("pc://shop/pc/addLink");
|
||||
}
|
||||
</script>
|
||||
205
addon/pc/shop/view/pc/nav_list.html
Executable file
205
addon/pc/shop/view/pc/nav_list.html
Executable file
@@ -0,0 +1,205 @@
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加导航</button>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入导航名称" autocomplete="off" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="nav_list" lay-filter="nav_list"></table>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="sort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.id}},this)" value="{{d.sort}}" placeholder="请输入排序" class="layui-input edit-sort sort-len">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table, repeat_flag = false;//防重复标识;
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
form.render();
|
||||
|
||||
form.on('switch(is_show)', function(data){
|
||||
let is_show = data.elem.checked ? 1 : 0;
|
||||
let id = $(data.elem).attr('data-id');
|
||||
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/modifyNavIsShow"),
|
||||
data: {
|
||||
id : id,
|
||||
is_show : is_show,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#nav_list',
|
||||
url: ns.url("pc://shop/pc/navList"),
|
||||
cols: [
|
||||
[ {
|
||||
field: 'nav_title',
|
||||
title: '导航名称',
|
||||
width: '15%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'nav_url',
|
||||
title: '链接地址',
|
||||
width: '17%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return JSON.parse(data.nav_url).url;
|
||||
}
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
width: '8%',
|
||||
sort : true,
|
||||
unresize: 'false',
|
||||
templet: '#sort'
|
||||
},{
|
||||
title: '是否显示',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return '<input type="checkbox" name="state" value="1" lay-skin="switch" lay-filter="is_show" data-id="'+ data.id +'" '+ (data.is_show == 1 ? 'checked' : '') +' />';
|
||||
},
|
||||
width: '10%',
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("pc://shop/pc/editNav?id=" + data.id);
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deleteHelp(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteHelp(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定要删除该导航吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/deleteNav"),
|
||||
data: {id},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
function() {
|
||||
repeat_flag = false;
|
||||
layer.close();
|
||||
});
|
||||
}
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(id, event) {
|
||||
var data = $(event).val();
|
||||
|
||||
let reg = ns.getRegexp('>=0num');
|
||||
if (!reg.test(data)) {
|
||||
layer.msg("排序号必须是大于或等于0的整数");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("pc://shop/pc/modifySort"),
|
||||
data: {
|
||||
sort: data,
|
||||
id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("pc://shop/pc/addNav");
|
||||
}
|
||||
</script>
|
||||
146
addon/pc/shop/view/public/css/edit_floor.css
Executable file
146
addon/pc/shop/view/public/css/edit_floor.css
Executable file
@@ -0,0 +1,146 @@
|
||||
#app{background: #F5F5F5;width: 1210px;margin-left: 200px;}
|
||||
/* 楼层样式一*/
|
||||
.floor-style-1{}
|
||||
.floor-style-1 .head-wrap h2{line-height: 30px;color: #333;padding: 10px;font-size: 18px;cursor: pointer;width: 95%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
|
||||
.floor-style-1 .body-wrap .left-wrap{float: left;width: 234px;height: 614px;cursor: pointer;}
|
||||
.floor-style-1 .body-wrap .left-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-1 .body-wrap .left-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-1 .body-wrap .left-wrap img{max-width: 100%;cursor: pointer;}
|
||||
.floor-style-1 .body-wrap .goods-list{margin-left: 235px;display: flex;flex-wrap: wrap;}
|
||||
.floor-style-1 .body-wrap .goods-list li{width: 23%;margin-left: 15px;margin-bottom: 15px;background: #fff;cursor: pointer;padding: 17px 0;}
|
||||
.floor-style-1 .body-wrap .goods-list li.empty{background: #F5F5F5;}
|
||||
/*.floor-style-1 .body-wrap .goods-list li:nth-child(4n+1){margin-left: 0;}*/
|
||||
.floor-style-1 .body-wrap .goods-list li .img-wrap{width: 160px;height: 160px;margin: 0 auto 18px;text-align: center;line-height: 160px;}
|
||||
.floor-style-1 .body-wrap .goods-list li .img-wrap.empty{background: #ebf8fd;color: #88c4dc;}
|
||||
.floor-style-1 .body-wrap .goods-list li .img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-1 .body-wrap .goods-list li h3{font-size: 14px;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;margin: 5px 15px;}
|
||||
.floor-style-1 .body-wrap .goods-list li .desc{margin: 0 30px 10px;height: 20px;font-size: 12px;color: #b0b0b0;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;}
|
||||
.floor-style-1 .body-wrap .goods-list li .price{margin: 0 10px 14px;text-align: center;}
|
||||
.floor-style-1 .body-wrap .goods-list li .price del{margin-left: .5em;color: #b0b0b0 !important;}
|
||||
.floor-style-1 .bottom-wrap{margin-top: 15px;width: 1210px;height: 118px;cursor: pointer;overflow: hidden;}
|
||||
.floor-style-1 .bottom-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-1 .bottom-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-1 .bottom-wrap img{max-width: 100%;}
|
||||
.floor-style-1 .body-wrap .left-wrap-box{position:relative;display: block;}
|
||||
.floor-style-1 .body-wrap .mask{position: absolute;z-index: 10;background: rgba(101, 101, 101, 0.6);color: #ffffff;opacity: 0;top: 0;right: 0;width: 100%;height: 100%;}
|
||||
.floor-style-1 .body-wrap .mask .left-img-replace {text-align: center;height: 100%;position: relative;}
|
||||
.floor-style-1 .body-wrap .mask .left-img-replace .replace{height:100%;width:100%;position:absolute;z-index:11;display: flex;}
|
||||
.floor-style-1 .body-wrap .mask .left-img-replace .replace span{margin: auto}
|
||||
.floor-style-1 .body-wrap .mask h4{text-align: right;position:absolute; top:5px; right:5px; display:inline-block;z-index:12}
|
||||
.floor-style-1 .body-wrap .left-wrap-box:hover .mask{opacity: 1;}
|
||||
.floor-style-1 .body-wrap .left-wrap{width: 234px;height: 614px;float: left;cursor: pointer;position: absolute;z-index: 9;}
|
||||
|
||||
/* 楼层样式二(通用,方块)*/
|
||||
.floor-style-2{}
|
||||
.floor-style-2 .head-wrap{text-align: center;}
|
||||
.floor-style-2 .head-wrap h2{line-height: 30px;color: #333;padding: 10px;font-size: 22px;cursor: pointer;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
|
||||
.floor-style-2 .head-wrap p{color: #b0b0b0;padding: 0 10px;font-size: 14px;cursor: pointer;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;margin-bottom: 20px;}
|
||||
.floor-style-2 .body-wrap .goods-list{display: flex;flex-wrap: wrap;}
|
||||
.floor-style-2 .body-wrap .goods-list li{width: 18.5%;margin-left: 15px;margin-bottom: 15px;background: #fff;cursor: pointer;padding: 15px 0;}
|
||||
.floor-style-2 .body-wrap .goods-list li.empty{background: #F5F5F5;}
|
||||
.floor-style-2 .body-wrap .goods-list li .img-wrap{width: 160px;height: 160px;margin: 0 auto 18px;text-align: center;line-height: 160px;}
|
||||
.floor-style-2 .body-wrap .goods-list li .img-wrap.empty{background: #ebf8fd;color: #88c4dc;}
|
||||
.floor-style-2 .body-wrap .goods-list li .img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-2 .body-wrap .goods-list li h3{font-size: 14px;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;margin: 5px 15px;}
|
||||
.floor-style-2 .body-wrap .goods-list li .desc{margin: 0 30px 10px;height: 20px;font-size: 12px;color: #b0b0b0;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;}
|
||||
.floor-style-2 .body-wrap .goods-list li .price{margin: 0 10px 14px;text-align: center;}
|
||||
.floor-style-2 .body-wrap .goods-list li .price del{margin-left: .5em;color: #b0b0b0 !important;}
|
||||
.floor-style-2 .bottom-wrap{margin-top: 15px;width: 1210px;height: 118px;cursor: pointer;overflow: hidden;}
|
||||
.floor-style-2 .bottom-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-2 .bottom-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-2 .bottom-wrap img{max-width: 100%;}
|
||||
.floor-style-2 .left-wrap-box{position:relative;display: block;}
|
||||
.floor-style-2 .mask{position: absolute;z-index: 10;background: rgba(101, 101, 101, 0.6);color: #ffffff;opacity: 0;top: 0;right: 0;width: 100%;height: 100%;}
|
||||
.floor-style-2 .mask .left-img-replace {text-align: center;height: 100%;position: relative;}
|
||||
.floor-style-2 .mask .left-img-replace .replace{height:100%;width:100%;position:absolute;z-index:11;display: flex;}
|
||||
.floor-style-2 .mask .left-img-replace .replace span{margin: auto}
|
||||
.floor-style-2 .mask h4{text-align: right;position:absolute; top:5px; right:5px; display:inline-block;z-index:12}
|
||||
.floor-style-2 .left-wrap-box:hover .mask{opacity: 1;}
|
||||
.floor-style-2 .left-wrap-box .bottom-wrap{width: 1210px;height: 118px;float: left;cursor: pointer;position: absolute;z-index: 9;}
|
||||
|
||||
|
||||
|
||||
/* 楼层样式三*/
|
||||
.floor-style-3{overflow: hidden;}
|
||||
.floor-style-3 .item-wrap .head-wrap{height: 50px;line-height: 50px;}
|
||||
.floor-style-3 .item-wrap .head-wrap .title-name{display: inline-block;}
|
||||
.floor-style-3 .item-wrap .head-wrap .title-name span{float: left;width: 5px;height: 21px;margin-top: 15px;}
|
||||
.floor-style-3 .item-wrap .head-wrap .title-name h2{float: left;margin-left: 10px;font-weight: bold;font-size: 20px;}
|
||||
.floor-style-3 .item-wrap .head-wrap .category-wrap{float: right;display: flex;}
|
||||
.floor-style-3 .item-wrap .head-wrap .category-wrap li{margin-right: 10px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-img-box{position:absolute;right:-10px;top:-10px;z-index:10;color:#fff;width: 20px;height: 20px;line-height: 20px;background: black;opacity: .3;text-align: center;border-radius: 50%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-wrap-box{position:relative;display: block;}
|
||||
.floor-style-3 .item-wrap .body-wrap .mask{position: absolute;z-index: 10;background: rgba(101, 101, 101, 0.6);color: #ffffff;opacity: 0;top: 0;right: 0;width: 100%;height: 100%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .mask .left-img-replace {text-align: center;height: 100%;position: relative;}
|
||||
.floor-style-3 .item-wrap .body-wrap .mask .left-img-replace .replace{height:100%;width:100%;position:absolute;z-index:11;display: flex;}
|
||||
.floor-style-3 .item-wrap .body-wrap .mask .left-img-replace .replace span{margin: auto}
|
||||
.floor-style-3 .item-wrap .body-wrap .mask h4{text-align: right;position:absolute; top:5px; right:5px; display:inline-block;z-index:12}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-wrap-box:hover .mask{opacity: 1;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-img-wrap{width: 190px;height: 360px;float: left;cursor: pointer;position: absolute;z-index: 9;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-img-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-3 .item-wrap .body-wrap .left-img-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap{margin-left: 190px;text-align: center;overflow: hidden;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li{float: left;width: 19.9%;background: #ffff;border-width: 0 0 1px 1px;border-color: #f9f9f9;border-style: solid;cursor: pointer;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li h4{font-size: 14px;margin: 10px 20px 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-weight: normal;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li p{font-size: 12px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin: 10px 30px;height: 20px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li .img-wrap{width: 105px;height: 105px;line-height: 105px;display: inline-block;margin-bottom: 5px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li .img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .right-goods-wrap li .img-wrap.empty{background: #ebf8fd;color: #88c4dc;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap{overflow: hidden;display: flex;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li{flex: 1;background: #fff;border-width: 0 0 1px 1px;border-color: #f9f9f9;border-style: solid;cursor: pointer;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li:first-child{border-left: 0;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .info-wrap{display: inline-block;vertical-align: middle;text-align: center;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .info-wrap h4{font-size: 14px;margin: 0 10px 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 90px;font-weight: normal; }
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .info-wrap p{font-size: 12px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin: 0 20px;width: 70px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .img-wrap{width: 60px;height: 60px;line-height: 60px;display: inline-block;vertical-align: middle;text-align: center;padding: 10px;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .bottom-goods-wrap li .img-wrap.empty{background: #ebf8fd;color: #88c4dc;}
|
||||
.floor-style-3 .item-wrap .body-wrap .brand-wrap{display: flex;background: #fff;}
|
||||
.floor-style-3 .item-wrap .body-wrap .brand-wrap li{flex: 1;height: 50px;cursor: pointer;line-height: 50px;text-align: center;background: #fff;}
|
||||
.floor-style-3 .item-wrap .body-wrap .brand-wrap li img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-3 .item-wrap .body-wrap .brand-wrap li .empty{background: #ebf8fd;color: #88c4dc;}
|
||||
|
||||
.floor-style-4 {}
|
||||
.floor-style-4 .head-wrap {display: flex;align-items: center;justify-content: space-between;}
|
||||
.floor-style-4 .head-wrap h2{line-height: 30px;color: #333;padding: 10px;font-size: 18px;cursor: pointer;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
|
||||
.floor-style-4 .head-wrap .more {cursor: pointer;}
|
||||
.floor-style-4 .body-wrap .left-wrap{float: left;width: 500px;height: 323px;cursor: pointer;}
|
||||
.floor-style-4 .body-wrap .left-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-4 .body-wrap .left-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-4 .body-wrap .left-wrap img{max-width: 100%;cursor: pointer;}
|
||||
.floor-style-4 .body-wrap .goods-list{display: flex;flex-wrap: wrap;}
|
||||
.floor-style-4 .body-wrap .goods-list li{width:calc((100% - 45px) / 3);margin-left: 15px;background: #fff;cursor: pointer;padding: 29px 0;}
|
||||
.floor-style-4 .body-wrap .goods-list li.empty{background: #F5F5F5;}
|
||||
.floor-style-4 .body-wrap .goods-list li .img-wrap{width: 160px;height: 160px;margin: 0 auto 20px;text-align: center;line-height: 160px;}
|
||||
.floor-style-4 .body-wrap .goods-list li .img-wrap.empty{background: #ebf8fd;color: #88c4dc;}
|
||||
.floor-style-4 .body-wrap .goods-list li .img-wrap img{max-width: 100%;max-height: 100%;}
|
||||
.floor-style-4 .body-wrap .goods-list li h3{font-size: 14px;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;margin: 5px 15px;}
|
||||
.floor-style-4 .body-wrap .goods-list li .desc{margin: 0 30px 10px;height: 20px;font-size: 12px;color: #b0b0b0;text-align: center;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;}
|
||||
.floor-style-4 .body-wrap .goods-list li .price{margin: 0 10px 14px;text-align: center;}
|
||||
.floor-style-4 .body-wrap .goods-list li .price del{margin-left: .5em;color: #b0b0b0 !important;}
|
||||
.floor-style-4 .body-wrap .left-wrap-box{position:relative;display: block;}
|
||||
.floor-style-4 .body-wrap .mask{position: absolute;z-index: 10;background: rgba(101, 101, 101, 0.6);color: #ffffff;opacity: 0;top: 0;right: 0;width: 100%;height: 100%;}
|
||||
.floor-style-4 .body-wrap .mask .left-img-replace {text-align: center;height: 100%;position: relative;}
|
||||
.floor-style-4 .body-wrap .mask .left-img-replace .replace{height:100%;width:100%;position:absolute;z-index:11;display: flex;}
|
||||
.floor-style-4 .body-wrap .mask .left-img-replace .replace span{margin: auto}
|
||||
.floor-style-4 .body-wrap .mask h4{text-align: right;position:absolute; top:5px; right:5px; display:inline-block;z-index:12}
|
||||
.floor-style-4 .body-wrap .left-wrap-box:hover .mask{opacity: 1;}
|
||||
.floor-style-4 .switch-wrap {margin-left: 500px;display: flex;padding: 15px 0;justify-content: center}
|
||||
.floor-style-4 .switch-wrap .switch-item {display: flex;align-items: center;justify-content: center;width: 28px;height: 28px;background: #FFFFFF;margin-left: 20px;color: #999999}
|
||||
.floor-style-4 .bottom-wrap{margin-top: 35px; width: 1210px;height: 118px;cursor: pointer;overflow: hidden;}
|
||||
.floor-style-4 .bottom-wrap div.empty{background: #ebf8fd;height: 100%;text-align: center;color: #88c4dc;position: relative;}
|
||||
.floor-style-4 .bottom-wrap div.empty span{position: absolute;top: 50%;left: 0;width: 100%;margin-top: -27px;}
|
||||
.floor-style-4 .bottom-wrap img{max-width: 100%;}
|
||||
|
||||
.layui-layer-content .layui-form.set-title{padding: 0;}
|
||||
.layui-layer-content .layui-form.upload-img{padding: 0;}
|
||||
.layui-layer-content .layui-form.set-category{padding: 0;}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap{}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap ul{}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap ul li{float: left;margin: 0 5px 10px 0;padding: 0 15px 0 10px;color: #636363;line-height: 28px;border: 1px solid #ccc;font-size: 12px;cursor: pointer;position: relative;}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap ul li i{position: absolute;top: 0;right: 0;width: 14px;height: 14px;line-height: 14px;text-align: center;font-style: normal;background-color: #eee;z-index: 2;font-size: 12px;display: none;}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap ul li:hover {color: var(--base-color);border-color: var(--base-color);background-color: #eff7fe;}
|
||||
.layui-layer-content .layui-form.set-category .selected-wrap ul li:hover i{display: block;}
|
||||
.layui-colorpicker-main-input div.layui-inline{margin-right: 0;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 130px;height: 34px;}
|
||||
274
addon/pc/shop/view/public/js/floor/edit.js
Executable file
274
addon/pc/shop/view/public/js/floor/edit.js
Executable file
@@ -0,0 +1,274 @@
|
||||
var floorForm, floorLayer, floorUpload, floorLaytpl, floorColorpicker, repeatFlag = false;
|
||||
layui.use(['form', 'layer', 'upload', 'laytpl', 'colorpicker'], function () {
|
||||
floorForm = layui.form;
|
||||
floorLayer = layui.layer;
|
||||
floorUpload = layui.upload;
|
||||
floorLaytpl = layui.laytpl;
|
||||
floorColorpicker = layui.colorpicker;
|
||||
floorForm.render();
|
||||
|
||||
if ($("#info").length > 0) {
|
||||
setTimeout(function () {
|
||||
vm.data = JSON.parse($("#info").val().toString());
|
||||
vm.blockId = parseInt($("#block_id").val().toString());
|
||||
}, 100);
|
||||
}
|
||||
|
||||
floorForm.on('select(block_id)', function (data) {
|
||||
var value = $(data.elem).find("option:selected").attr("data-value");
|
||||
var blockId = $(data.elem).find("option:selected").attr("data-block-id");
|
||||
vm.blockId = blockId;
|
||||
if (value) {
|
||||
vm.data = JSON.parse(value);
|
||||
}
|
||||
});
|
||||
|
||||
floorForm.verify({
|
||||
title: function (value) {
|
||||
if (value == '') {
|
||||
return '请输入楼层名称';
|
||||
}
|
||||
if (value.length > 100) {
|
||||
return '最多100个字符';
|
||||
}
|
||||
},
|
||||
block_id: function (value) {
|
||||
if (!value) return '请选择楼层模板';
|
||||
}
|
||||
});
|
||||
|
||||
floorForm.on('submit(save)', function (data) {
|
||||
|
||||
var value = JSON.parse(JSON.stringify(vm.data));
|
||||
for (var i in value) {
|
||||
if ($.inArray(value[i].type, ['goods', 'brand', 'category']) == -1) {
|
||||
value[i].value.list = [];
|
||||
}
|
||||
}
|
||||
data.field.value = JSON.stringify(value);
|
||||
if (repeatFlag) return;
|
||||
repeatFlag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("pc://shop/pc/editFloor"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
floorLayer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
location.hash = ns.hash("pc://shop/pc/floor");
|
||||
}
|
||||
repeatFlag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var vm = new Vue({
|
||||
el: "#app",
|
||||
data: function () {
|
||||
return {
|
||||
data: null,
|
||||
blockId: 0
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
methods: {
|
||||
img: function (url, type = '') {
|
||||
return url ? ns.img(url, type) : "";
|
||||
},
|
||||
/**
|
||||
* 初始化链接下拉框
|
||||
* @param select_tag
|
||||
* @param link_tag
|
||||
*/
|
||||
initLink: function (select_tag, link_tag) {
|
||||
floorForm.on('select(' + select_tag + ')', function (data) {
|
||||
var title = $(data.elem).find("option:selected").text();
|
||||
if (data.value != 'diy') {
|
||||
$("input[name='" + link_tag + "']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": data.value
|
||||
}));
|
||||
} else {
|
||||
floorLayer.prompt({
|
||||
formType: 2,
|
||||
value: $("input[name='" + link_tag + "']").val() ? JSON.parse($("input[name='" + link_tag + "']").val()).url : '',
|
||||
title: '自定义链接地址',
|
||||
area: ['450px', '100px'],
|
||||
cancel: function () {
|
||||
$("input[name='" + link_tag + "']").val("");
|
||||
}
|
||||
}, function (value, index, elem) {
|
||||
$("input[name='" + link_tag + "']").val(JSON.stringify({
|
||||
"title": title,
|
||||
"url": value
|
||||
}));
|
||||
floorLayer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 设置文本
|
||||
* @param data 当前数据
|
||||
* @param callback 回调
|
||||
*/
|
||||
setText: function (data, callback) {
|
||||
var self = this;
|
||||
var getTpl = $("#setTitleHtml").html();
|
||||
if (!data) data = {};
|
||||
floorLaytpl(getTpl).render(data, function (html) {
|
||||
var textLayer = floorLayer.open({
|
||||
type: 1,
|
||||
title: "编辑文本",
|
||||
content: html,
|
||||
area: ['400px', 'auto'],
|
||||
success: function (layero, index) {
|
||||
floorForm.render();
|
||||
self.initLink("pc_link_text", "text_link");
|
||||
|
||||
// 文字颜色
|
||||
floorColorpicker.render({
|
||||
elem: '#text_color', //绑定元素
|
||||
color: data.color ? data.color : "",
|
||||
done: function (color) {
|
||||
$("#text_color_input").attr("value", color);
|
||||
}
|
||||
});
|
||||
|
||||
floorForm.on('submit(save_text)', function (data) {
|
||||
if (data.field.text_link) data.field.text_link = JSON.parse(data.field.text_link);
|
||||
if (callback) callback({
|
||||
text: data.field.text,
|
||||
link: data.field.text_link,
|
||||
color: data.field.text_color,
|
||||
textAlign: data.field.textAlign
|
||||
});
|
||||
floorLayer.close(textLayer);
|
||||
});
|
||||
}
|
||||
});
|
||||
floorForm.render();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 上传图片
|
||||
* @param data 当前数据
|
||||
* @param callback 回调
|
||||
*/
|
||||
uploadImg: function (data, callback) {
|
||||
var self = this;
|
||||
var getTpl = $("#uploadImg").html();
|
||||
if (!data) data = {};
|
||||
floorLaytpl(getTpl).render(data, function (html) {
|
||||
var textLayer = floorLayer.open({
|
||||
type: 1,
|
||||
title: "上传图片",
|
||||
content: html,
|
||||
area: ['450px', '300px'],
|
||||
success: function (layero, index) {
|
||||
floorForm.render();
|
||||
floorUpload.render({
|
||||
elem: "#upload_image",
|
||||
url: ns.url("shop/upload/upload"),
|
||||
done: function (res) {
|
||||
$("input[name='upload_image']").val(res.data.pic_path);
|
||||
$("#upload_image").html("<img src=" + ns.img(res.data.pic_path) + " >");
|
||||
}
|
||||
});
|
||||
self.initLink("pc_link_upload", "upload_link");
|
||||
floorForm.on('submit(save_upload)', function (data) {
|
||||
if (data.field.upload_link) data.field.upload_link = JSON.parse(data.field.upload_link);
|
||||
if (callback) callback({
|
||||
url: data.field.upload_image,
|
||||
link: data.field.upload_link
|
||||
});
|
||||
floorLayer.close(textLayer);
|
||||
});
|
||||
}
|
||||
});
|
||||
floorForm.render();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 设置商品分类
|
||||
* @param data 当前数据
|
||||
* @param callback 回调
|
||||
*/
|
||||
setCategory: function (data, callback) {
|
||||
var self = this;
|
||||
var getTpl = $("#setCategoryHtml").html();
|
||||
if (!data) data = {};
|
||||
floorLaytpl(getTpl).render(data, function (html) {
|
||||
var textLayer = floorLayer.open({
|
||||
type: 1,
|
||||
title: "编辑商品分类",
|
||||
content: html,
|
||||
area: ['600px', '400px'],
|
||||
success: function (layero, index) {
|
||||
floorForm.render();
|
||||
floorForm.on('select(goods_category)', function (categoryData) {
|
||||
var category_name = $.trim($(categoryData.elem).find("option:selected").text());
|
||||
var category_id = $(categoryData.elem).val();
|
||||
var isAdd = true;
|
||||
for (var i = 0; i < data.list.length; i++) {
|
||||
if (data.list[i].category_id == category_id) {
|
||||
isAdd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isAdd) {
|
||||
data.list.push({
|
||||
category_id: category_id,
|
||||
category_name: category_name
|
||||
});
|
||||
floorLaytpl(getTpl).render(data, function (html) {
|
||||
$(".set-category").html(html);
|
||||
floorForm.render();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
floorForm.on('submit(save_category)', function (data) {
|
||||
if (data.field.category_ids) data.field.category_ids = data.field.category_ids.replace(/\s+/g, "");
|
||||
if (callback) callback({
|
||||
category_ids: data.field.category_ids,
|
||||
list: data.field.category_list ? JSON.parse(data.field.category_list) : [],
|
||||
});
|
||||
floorLayer.close(textLayer);
|
||||
});
|
||||
|
||||
$(document).on('click','.delete-category',function(){
|
||||
var catrgoryId = $(this).attr('data-id');
|
||||
var data_catrgoryIds = data.category_ids.split(',');
|
||||
for (var i = 0; i< data_catrgoryIds.length; i ++) {
|
||||
if(catrgoryId == data_catrgoryIds[i]){
|
||||
delete data_catrgoryIds[i];
|
||||
}
|
||||
}
|
||||
data.category_ids = data_catrgoryIds.toString();
|
||||
if(data_catrgoryIds.length == 2){
|
||||
data.category_ids = data.category_ids.substring(0, data.category_ids.length-1)
|
||||
}
|
||||
|
||||
for (var y = 0; y < data.list.length; y ++ ){
|
||||
if(data.list[y].category_id == catrgoryId){
|
||||
data.list.splice(y, 1);
|
||||
}
|
||||
}
|
||||
|
||||
floorLaytpl(getTpl).render(data, function (html) {
|
||||
$(".set-category").html(html);
|
||||
floorForm.render();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
floorForm.render();
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
119
addon/pc/shop/view/public/js/floor/floor_style_1.js
Executable file
119
addon/pc/shop/view/public/js/floor/floor_style_1.js
Executable file
@@ -0,0 +1,119 @@
|
||||
var templateFloorStyle1 = `
|
||||
<div class="floor-style-1">
|
||||
<div class="head-wrap"><h2 @click="setTitle()" :style="{ color : mData.title.value.color }">{{ mData.title.value.text }}</h2></div>
|
||||
<div class="body-wrap">
|
||||
<div class="left-wrap left-wrap-box">
|
||||
<div v-if="mData.leftImg.value.url" class="mask">
|
||||
<div class="left-img-replace" @click="uploadLeftImg()">
|
||||
<h4 @click.stop="delLeftImg()" class="iconfont iconshanchu">删除</h4>
|
||||
<div class="replace"><span>点击替换</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left-wrap">
|
||||
<img v-if="mData.leftImg.value.url" :src="$parent.img(mData.leftImg.value.url)">
|
||||
<div v-else class="empty" @click="uploadLeftImg()"><span>点击上传图片<br/><br/>建议尺寸 234 x 614 像素</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="goods-list" @click="selectedGoods()">
|
||||
<li v-for="(item,index) in goodsLength" :key="index">
|
||||
<template v-if="mData.goodsList.value.list.length > index && mData.goodsList.value.list[index].goods_name">
|
||||
<div class="img-wrap">
|
||||
<img alt="商品图片" :src="$parent.img(mData.goodsList.value.list[index].goods_image.split(',')[0], 'mid')">
|
||||
</div>
|
||||
<h3>{{mData.goodsList.value.list[index].goods_name}}</h3>
|
||||
<p class="desc">{{mData.goodsList.value.list[index].introduction}}</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">{{mData.goodsList.value.list[index].price}}元</span>
|
||||
<del>{{mData.goodsList.value.list[index].market_price}}元</del>
|
||||
</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="img-wrap empty">商品图片</div>
|
||||
<h3>商品名称</h3>
|
||||
<p class="desc">商品描述</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">99元</span>
|
||||
<del>199元</del>
|
||||
</p>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="bottom-wrap" @click="uploadBottomImg()">
|
||||
<img v-if="mData.bottomImg.value.url" :src="$parent.img(mData.bottomImg.value.url)">
|
||||
<div v-else class="empty"><span>点击上传图片<br/><br/>建议尺寸 1210 x 118 像素</span></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
Vue.component('floor-style-1', {
|
||||
template: templateFloorStyle1,
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
mData: {},
|
||||
selectGoodsId: [],
|
||||
goodsLength: 8
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.mData = this.data;
|
||||
},
|
||||
methods: {
|
||||
setTitle: function () {
|
||||
var self = this;
|
||||
this.$parent.setText(self.mData.title.value, function (data) {
|
||||
self.mData.title.value = data;
|
||||
});
|
||||
},
|
||||
delLeftImg:function(){
|
||||
this.mData.leftImg.value.url = '';
|
||||
},
|
||||
uploadLeftImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.leftImg.value, function (data) {
|
||||
self.mData.leftImg.value = data;
|
||||
});
|
||||
},
|
||||
uploadBottomImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.bottomImg.value, function (data) {
|
||||
self.mData.bottomImg.value = data;
|
||||
});
|
||||
},
|
||||
selectedGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (data) {
|
||||
|
||||
self.selectGoodsId = [];
|
||||
var goods_ids = [];
|
||||
self.mData.goodsList.value.list = [];
|
||||
|
||||
var i = 0;
|
||||
for (var key in data) {
|
||||
var item = data[key];
|
||||
delete item.sku_list;
|
||||
delete item.selected_sku_list;
|
||||
self.mData.goodsList.value.list[i] = item;
|
||||
self.selectGoodsId.push(item.goods_id);
|
||||
goods_ids.push(item.goods_id);
|
||||
i++;
|
||||
}
|
||||
self.mData.goodsList.value.goods_ids = goods_ids.toString();
|
||||
vm.$forceUpdate();
|
||||
}, self.selectGoodsId, {mode: "spu", max_num: self.goodsLength, min_num: 1, disabled: 0});
|
||||
}
|
||||
|
||||
},
|
||||
watch: {
|
||||
mData: function (curr) {
|
||||
for (var i = 0; i < curr.goodsList.value.list.length; i++) {
|
||||
this.selectGoodsId.push(curr.goodsList.value.list[i].goods_id);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
122
addon/pc/shop/view/public/js/floor/floor_style_2.js
Executable file
122
addon/pc/shop/view/public/js/floor/floor_style_2.js
Executable file
@@ -0,0 +1,122 @@
|
||||
var templateFloorStyle2 = `
|
||||
<div class="floor-style-2">
|
||||
<div class="head-wrap">
|
||||
<h2 @click="setTitle()" :style="{ textAlign: mData.title.value.textAlign, color : mData.title.value.color }">{{ mData.title.value.text }}</h2>
|
||||
<p @click="setSubTitle()" :style="{ color : mData.subTitle.value.color }">{{ mData.subTitle.value.text }}</p>
|
||||
</div>
|
||||
<div class="body-wrap">
|
||||
<ul class="goods-list" @click="selectedGoods()">
|
||||
<li v-for="(item,index) in goodsLength" :key="index">
|
||||
<template v-if="mData.goodsList.value.list.length > index && mData.goodsList.value.list[index].goods_name">
|
||||
<div class="img-wrap">
|
||||
<img alt="商品图片" :src="$parent.img(mData.goodsList.value.list[index].goods_image.split(',')[0], 'mid')">
|
||||
</div>
|
||||
<h3>{{mData.goodsList.value.list[index].goods_name}}</h3>
|
||||
<p class="desc">{{mData.goodsList.value.list[index].introduction}}</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">{{mData.goodsList.value.list[index].price}}元</span>
|
||||
<del>{{mData.goodsList.value.list[index].market_price}}元</del>
|
||||
</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="img-wrap empty">商品图片</div>
|
||||
<h3>商品名称</h3>
|
||||
<p class="desc">商品描述</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">99元</span>
|
||||
<del>199元</del>
|
||||
</p>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="bottom-wrap left-wrap-box">
|
||||
<div v-if="mData.bottomImg.value.url" class="mask">
|
||||
<div class="left-img-replace" @click="uploadBottomImg()">
|
||||
<h4 @click.stop="delLeftImg()" class="iconfont iconshanchu">删除</h4>
|
||||
<div class="replace"><span>点击替换</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-wrap">
|
||||
<img v-if="mData.bottomImg.value.url" :src="$parent.img(mData.bottomImg.value.url)">
|
||||
<div v-else class="empty" @click="uploadBottomImg()"><span>点击上传图片<br/><br/>建议尺寸 1210 x 118 像素</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
Vue.component('floor-style-2', {
|
||||
template: templateFloorStyle2,
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
mData: {},
|
||||
selectGoodsId: [],
|
||||
goodsLength: 20
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.mData = this.data;
|
||||
if(!('textAlign' in this.mData.title.value))
|
||||
this.mData.title.value.textAlign = "center";
|
||||
},
|
||||
methods: {
|
||||
setTitle: function () {
|
||||
var self = this;
|
||||
this.$parent.setText(self.mData.title.value, function (data) {
|
||||
self.mData.title.value = data;
|
||||
});
|
||||
},
|
||||
setSubTitle: function () {
|
||||
var self = this;
|
||||
self.mData.subTitle.value.isTextRequired=false;
|
||||
this.$parent.setText(self.mData.subTitle.value, function (data) {
|
||||
self.mData.subTitle.value = data;
|
||||
});
|
||||
},
|
||||
delLeftImg:function(){
|
||||
this.mData.bottomImg.value.url = '';
|
||||
},
|
||||
uploadBottomImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.bottomImg.value, function (data) {
|
||||
self.mData.bottomImg.value = data;
|
||||
});
|
||||
},
|
||||
selectedGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (data) {
|
||||
|
||||
self.selectGoodsId = [];
|
||||
var goods_ids = [];
|
||||
self.mData.goodsList.value.list = [];
|
||||
|
||||
var i = 0;
|
||||
for (var key in data) {
|
||||
var item = data[key];
|
||||
delete item.sku_list;
|
||||
delete item.selected_sku_list;
|
||||
self.mData.goodsList.value.list[i] = item;
|
||||
self.selectGoodsId.push(item.goods_id);
|
||||
goods_ids.push(item.goods_id);
|
||||
i++;
|
||||
}
|
||||
self.mData.goodsList.value.goods_ids = goods_ids.toString();
|
||||
vm.$forceUpdate();
|
||||
}, self.selectGoodsId, {mode: "spu", max_num: self.goodsLength, min_num: 1, disabled: 0});
|
||||
}
|
||||
|
||||
},
|
||||
watch: {
|
||||
mData: function (curr) {
|
||||
for (var i = 0; i < curr.goodsList.value.list.length; i++) {
|
||||
this.selectGoodsId.push(curr.goodsList.value.list[i].goods_id);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
196
addon/pc/shop/view/public/js/floor/floor_style_3.js
Executable file
196
addon/pc/shop/view/public/js/floor/floor_style_3.js
Executable file
@@ -0,0 +1,196 @@
|
||||
var templateFloorStyle3 = `
|
||||
<div class="floor-style-3">
|
||||
<div class="item-wrap">
|
||||
<div class="head-wrap">
|
||||
<div class="title-name">
|
||||
<span :style="{ backgroundColor : mData.title.value.color }"></span>
|
||||
<h2 @click="setTitle()" :style="{ color : mData.title.value.color }">{{ mData.title.value.text }}</h2>
|
||||
</div>
|
||||
<div class="category-wrap" @click="setCategory()">
|
||||
<li v-for="(item,index) in categoryLength" :key="index">
|
||||
<template v-if="mData.categoryList.value.list.length > index && mData.categoryList.value.list[index].category_name">
|
||||
<a href="javascript:;">{{mData.categoryList.value.list[index].category_name}}</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a href="javascript:;">商品分类名称</a>
|
||||
</template>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body-wrap">
|
||||
<div class="left-img-wrap left-wrap-box">
|
||||
<div v-if="mData.leftImg.value.url" class="mask">
|
||||
<div class="left-img-replace" @click="uploadLeftImg()">
|
||||
<h4 @click.stop="delLeftImg()" class="iconfont iconshanchu">删除</h4>
|
||||
<div class="replace"><span>点击替换</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left-img-wrap">
|
||||
<img v-if="mData.leftImg.value.url" :src="$parent.img(mData.leftImg.value.url)">
|
||||
<div v-else class="empty" @click="uploadLeftImg()"><span>点击上传图片<br/><br/>建议尺寸 190 x 360 像素</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="right-goods-wrap" @click="selectedRightGoods()">
|
||||
<li v-for="(item,index) in rightGoodsLength" :key="index">
|
||||
<template v-if="mData.rightGoodsList.value.list.length > index && mData.rightGoodsList.value.list[index].goods_name">
|
||||
<h4>{{mData.rightGoodsList.value.list[index].goods_name}}</h4>
|
||||
<p class="text-color">{{mData.rightGoodsList.value.list[index].introduction}}</p>
|
||||
<div class="img-wrap">
|
||||
<img alt="商品图片" :src="$parent.img(mData.rightGoodsList.value.list[index].goods_image.split(',')[0], 'mid')">
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<h4>商品名称</h4>
|
||||
<p class="text-color">商品描述</p>
|
||||
<div class="img-wrap empty">商品图片</div>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="bottom-goods-wrap" @click="selectedBottomGoods()">
|
||||
<li v-for="(item,index) in bottomGoodsLength" :key="index">
|
||||
<template v-if="mData.bottomGoodsList.value.list.length > index && mData.bottomGoodsList.value.list[index].goods_name">
|
||||
<div class="info-wrap">
|
||||
<h4>{{mData.bottomGoodsList.value.list[index].goods_name}}</h4>
|
||||
<p class="text-color">{{mData.bottomGoodsList.value.list[index].introduction}}</p>
|
||||
</div>
|
||||
<div class="img-wrap">
|
||||
<img alt="商品图片" :src="$parent.img(mData.bottomGoodsList.value.list[index].goods_image.split(',')[0], 'mid')">
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="info-wrap">
|
||||
<h4>商品名称</h4>
|
||||
<p class="text-color">商品描述</p>
|
||||
</div>
|
||||
<div class="img-wrap empty">商品图片</div>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
Vue.component('floor-style-3', {
|
||||
template: templateFloorStyle3,
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
mData: {},
|
||||
categoryLength: 6,
|
||||
rightGoodsLength: 10,
|
||||
rightSelectGoodsId: [],
|
||||
bottomGoodsLength: 6,
|
||||
bottomSelectGoodsId: [],
|
||||
// brandLength: 8,
|
||||
// selectBrandsId: []
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.mData = this.data;
|
||||
},
|
||||
methods: {
|
||||
setTitle: function () {
|
||||
var self = this;
|
||||
this.$parent.setText(self.mData.title.value, function (data) {
|
||||
self.mData.title.value = data;
|
||||
});
|
||||
},
|
||||
delLeftImg:function(){
|
||||
this.mData.leftImg.value.url = '';
|
||||
},
|
||||
uploadLeftImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.leftImg.value, function (data) {
|
||||
self.mData.leftImg.value = data;
|
||||
});
|
||||
},
|
||||
setCategory: function () {
|
||||
var self = this;
|
||||
this.$parent.setCategory(self.mData.categoryList.value, function (data) {
|
||||
self.mData.categoryList.value = data;
|
||||
vm.$forceUpdate();
|
||||
});
|
||||
},
|
||||
selectedRightGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (data) {
|
||||
|
||||
self.rightSelectGoodsId = [];
|
||||
var goods_ids = [];
|
||||
self.mData.rightGoodsList.value.list = [];
|
||||
|
||||
var i = 0;
|
||||
for (var key in data) {
|
||||
var item = data[key];
|
||||
delete item.sku_list;
|
||||
delete item.selected_sku_list;
|
||||
self.mData.rightGoodsList.value.list[i] = item;
|
||||
self.rightSelectGoodsId.push(item.goods_id);
|
||||
goods_ids.push(item.goods_id);
|
||||
i++;
|
||||
}
|
||||
self.mData.rightGoodsList.value.goods_ids = goods_ids.toString();
|
||||
vm.$forceUpdate();
|
||||
}, self.rightSelectGoodsId, {mode: "spu", max_num: self.rightGoodsLength, min_num: 1});
|
||||
},
|
||||
selectedBottomGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (data) {
|
||||
|
||||
self.bottomSelectGoodsId = [];
|
||||
var goods_ids = [];
|
||||
self.mData.bottomGoodsList.value.list = [];
|
||||
|
||||
var i = 0;
|
||||
for (var key in data) {
|
||||
var item = data[key];
|
||||
delete item.sku_list;
|
||||
delete item.selected_sku_list;
|
||||
self.mData.bottomGoodsList.value.list[i] = item;
|
||||
self.bottomSelectGoodsId.push(item.goods_id);
|
||||
goods_ids.push(item.goods_id);
|
||||
i++;
|
||||
}
|
||||
self.mData.bottomGoodsList.value.goods_ids = goods_ids.toString();
|
||||
vm.$forceUpdate();
|
||||
}, self.bottomSelectGoodsId, {mode: "spu", max_num: self.bottomGoodsLength, min_num: 1, disabled: 0});
|
||||
},
|
||||
// selectedBrand: function () {
|
||||
// var self = this;
|
||||
// brandSelect(function (res) {
|
||||
// self.selectBrandsId = [];
|
||||
// var brand_ids = [];
|
||||
// self.mData.brandList.value.list = [];
|
||||
// for (var i = 0; i < res.length; i++) {
|
||||
// var item = res[i];
|
||||
// self.mData.brandList.value.list[i] = item;
|
||||
// self.selectBrandsId.push(item.brand_id);
|
||||
// brand_ids.push(item.brand_id);
|
||||
// }
|
||||
// self.mData.brandList.value.brand_ids = brand_ids.toString();
|
||||
// vm.$forceUpdate();
|
||||
|
||||
// }, self.selectBrandsId, {max_num: self.brandLength, min_num: 1});
|
||||
// }
|
||||
|
||||
},
|
||||
watch: {
|
||||
mData: function (curr) {
|
||||
for (var i = 0; i < curr.rightGoodsList.value.list.length; i++) {
|
||||
this.rightSelectGoodsId.push(curr.rightGoodsList.value.list[i].goods_id);
|
||||
}
|
||||
for (var i = 0; i < curr.bottomGoodsList.value.list.length; i++) {
|
||||
this.bottomSelectGoodsId.push(curr.bottomGoodsList.value.list[i].goods_id);
|
||||
}
|
||||
// for (var i = 0; i < curr.brandList.value.list.length; i++) {
|
||||
// this.selectBrandsId.push(curr.brandList.value.list[i].brand_id);
|
||||
// }
|
||||
},
|
||||
},
|
||||
});
|
||||
137
addon/pc/shop/view/public/js/floor/floor_style_4.js
Executable file
137
addon/pc/shop/view/public/js/floor/floor_style_4.js
Executable file
@@ -0,0 +1,137 @@
|
||||
var templateFloorStyle4 = `
|
||||
<div class="floor-style-4">
|
||||
<div class="head-wrap">
|
||||
<h2 @click="setTitle()" :style="{ color : mData.title.value.color }">{{ mData.title.value.text }}</h2>
|
||||
<div class="more" :style="{ color : mData.more.value.color }" @click="setMore()">
|
||||
<span>{{ mData.more.value.text }}</span>
|
||||
<i class="iconfont iconyoujiantou"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body-wrap">
|
||||
<div class="left-wrap left-wrap-box">
|
||||
<div v-if="mData.leftImg.value.url" class="mask">
|
||||
<div class="left-img-replace" @click="uploadLeftImg()">
|
||||
<h4 @click.stop="delLeftImg()" class="iconfont iconshanchu">删除</h4>
|
||||
<div class="replace"><span>点击替换</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left-wrap">
|
||||
<img v-if="mData.leftImg.value.url" :src="$parent.img(mData.leftImg.value.url)">
|
||||
<div v-else class="empty" @click="uploadLeftImg()"><span>点击上传图片<br/><br/>建议尺寸 500 x 323 像素</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="goods-list" @click="selectedGoods()">
|
||||
<li v-for="(item,index) in goodsLength" :key="index">
|
||||
<template v-if="mData.goodsList.value.list.length > index && mData.goodsList.value.list[index].goods_name">
|
||||
<div class="img-wrap">
|
||||
<img alt="商品图片" :src="$parent.img(mData.goodsList.value.list[index].goods_image.split(',')[0], 'mid')">
|
||||
</div>
|
||||
<h3>{{mData.goodsList.value.list[index].goods_name}}</h3>
|
||||
<p class="desc">{{mData.goodsList.value.list[index].introduction}}</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">{{mData.goodsList.value.list[index].price}}元</span>
|
||||
<del>{{mData.goodsList.value.list[index].market_price}}元</del>
|
||||
</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="img-wrap empty">商品图片</div>
|
||||
<h3>商品名称</h3>
|
||||
<p class="desc">商品描述</p>
|
||||
<p class="price text-color">
|
||||
<span class="num">99元</span>
|
||||
<del>199元</del>
|
||||
</p>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="switch-wrap layui-hide">
|
||||
<div class="switch-item"><i class="iconfont iconback_light"></i></div>
|
||||
<div class="switch-item"><i class="iconfont iconyoujiantou"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-wrap" @click="uploadBottomImg()">
|
||||
<img v-if="mData.bottomImg.value.url" :src="$parent.img(mData.bottomImg.value.url)">
|
||||
<div v-else class="empty"><span>点击上传图片<br/><br/>建议尺寸 1210 x 118 像素</span></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
Vue.component('floor-style-4', {
|
||||
template: templateFloorStyle4,
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
mData: {},
|
||||
selectGoodsId: [],
|
||||
goodsLength: 3
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.mData = this.data;
|
||||
},
|
||||
methods: {
|
||||
setTitle: function () {
|
||||
var self = this;
|
||||
this.$parent.setText(self.mData.title.value, function (data) {
|
||||
self.mData.title.value = data;
|
||||
});
|
||||
},
|
||||
setMore: function () {
|
||||
var self = this;
|
||||
this.$parent.setText(self.mData.more.value, function (data) {
|
||||
self.mData.more.value = data;
|
||||
});
|
||||
},
|
||||
delLeftImg:function(){
|
||||
this.mData.leftImg.value.url = '';
|
||||
},
|
||||
uploadLeftImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.leftImg.value, function (data) {
|
||||
self.mData.leftImg.value = data;
|
||||
});
|
||||
},
|
||||
uploadBottomImg: function () {
|
||||
var self = this;
|
||||
this.$parent.uploadImg(self.mData.bottomImg.value, function (data) {
|
||||
self.mData.bottomImg.value = data;
|
||||
});
|
||||
},
|
||||
selectedGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (data) {
|
||||
|
||||
self.selectGoodsId = [];
|
||||
var goods_ids = [];
|
||||
self.mData.goodsList.value.list = [];
|
||||
|
||||
var i = 0;
|
||||
for (var key in data) {
|
||||
var item = data[key];
|
||||
delete item.sku_list;
|
||||
delete item.selected_sku_list;
|
||||
self.mData.goodsList.value.list[i] = item;
|
||||
self.selectGoodsId.push(item.goods_id);
|
||||
goods_ids.push(item.goods_id);
|
||||
i++;
|
||||
}
|
||||
self.mData.goodsList.value.goods_ids = goods_ids.toString();
|
||||
vm.$forceUpdate();
|
||||
}, self.selectGoodsId, {mode: "spu", min_num: 1, disabled: 0});
|
||||
}
|
||||
|
||||
},
|
||||
watch: {
|
||||
mData: function (curr) {
|
||||
for (var i = 0; i < curr.goodsList.value.list.length; i++) {
|
||||
this.selectGoodsId.push(curr.goodsList.value.list[i].goods_id);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user