初始上传
This commit is contained in:
38
addon/freeshipping/config/diy_view.php
Executable file
38
addon/freeshipping/config/diy_view.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
|
||||
// 自定义模板页面类型,格式:[ 'title' => '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ]
|
||||
'template' => [],
|
||||
|
||||
// 后台自定义组件——装修
|
||||
'util' => [],
|
||||
|
||||
// 自定义页面路径
|
||||
'link' => [],
|
||||
|
||||
// 自定义图标库
|
||||
'icon_library' => [],
|
||||
|
||||
// uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件
|
||||
'component' => [],
|
||||
|
||||
// uni-app 页面,多个逗号隔开
|
||||
'pages' => [],
|
||||
|
||||
// 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述'
|
||||
'info' => [],
|
||||
|
||||
// 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】
|
||||
'theme' => [],
|
||||
|
||||
// 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ]
|
||||
'data' => []
|
||||
];
|
||||
22
addon/freeshipping/config/event.php
Executable file
22
addon/freeshipping/config/event.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// 事件定义文件
|
||||
return [
|
||||
'bind' => [
|
||||
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
//展示活动
|
||||
'ShowPromotion' => [
|
||||
'addon\freeshipping\event\ShowPromotion',
|
||||
],
|
||||
|
||||
'PromotionType' => [
|
||||
'addon\freeshipping\event\PromotionType',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
20
addon/freeshipping/config/info.php
Executable file
20
addon/freeshipping/config/info.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'name' => 'freeshipping',
|
||||
'title' => '满额包邮',
|
||||
'description' => '满额包邮',
|
||||
'type' => 'system', //插件类型 system :系统插件(自动安装), promotion:扩展营销插件 tool:工具插件
|
||||
'status' => 1,
|
||||
'author' => '',
|
||||
'version' => '5.5.3',
|
||||
'version_no' => '553250709001',
|
||||
'content' => '',
|
||||
];
|
||||
53
addon/freeshipping/config/menu_shop.php
Executable file
53
addon/freeshipping/config/menu_shop.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 店铺端菜单设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
|
||||
[
|
||||
'name' => 'PROMOTION_FREESHIPPING',
|
||||
'title' => '满额包邮',
|
||||
'url' => 'freeshipping://shop/freeshipping/lists',
|
||||
'parent' => 'PROMOTION_CENTER',
|
||||
'is_show' => 1,
|
||||
'sort' => 100,
|
||||
'child_list' => [
|
||||
[
|
||||
'name' => 'PROMOTION_FREESHIPPING_LIST',
|
||||
'title' => '满额包邮列表',
|
||||
'url' => 'freeshipping://shop/freeshipping/lists',
|
||||
'parent' => 'PROMOTION_FREESHIPPING',
|
||||
'is_show' => 0,
|
||||
'child_list' => [
|
||||
[
|
||||
'name' => 'PROMOTION_FREESHIPPING_ADD',
|
||||
'title' => '添加活动',
|
||||
'url' => 'freeshipping://shop/freeshipping/add',
|
||||
'sort' => 1,
|
||||
'is_show' => 0,
|
||||
'type' => 'button',
|
||||
],
|
||||
[
|
||||
'name' => 'PROMOTION_FREESHIPPING_EDIT',
|
||||
'title' => '编辑活动',
|
||||
'url' => 'freeshipping://shop/freeshipping/edit',
|
||||
'sort' => 1,
|
||||
'is_show' => 0,
|
||||
'type' => 'button',
|
||||
],
|
||||
[
|
||||
'name' => 'PROMOTION_FREESHIPPING_DELETE',
|
||||
'title' => '删除活动',
|
||||
'url' => 'freeshipping://shop/freeshipping/delete',
|
||||
'sort' => 1,
|
||||
'is_show' => 0,
|
||||
'type' => 'button',
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
];
|
||||
1
addon/freeshipping/data/install.sql
Executable file
1
addon/freeshipping/data/install.sql
Executable file
@@ -0,0 +1 @@
|
||||
SET NAMES 'utf8';
|
||||
1
addon/freeshipping/data/uninstall.sql
Executable file
1
addon/freeshipping/data/uninstall.sql
Executable file
@@ -0,0 +1 @@
|
||||
SET NAMES 'utf8';
|
||||
25
addon/freeshipping/event/Install.php
Executable file
25
addon/freeshipping/event/Install.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\freeshipping\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
28
addon/freeshipping/event/PromotionType.php
Executable file
28
addon/freeshipping/event/PromotionType.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\freeshipping\event;
|
||||
|
||||
/**
|
||||
* 活动类型
|
||||
*/
|
||||
class PromotionType
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动类型
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return ["name" => "满额包邮", "type" => "freeshipping"];
|
||||
}
|
||||
}
|
||||
45
addon/freeshipping/event/ShowPromotion.php
Executable file
45
addon/freeshipping/event/ShowPromotion.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\freeshipping\event;
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
/**
|
||||
* 活动展示
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$data = [
|
||||
'shop' => [
|
||||
[
|
||||
//插件名称
|
||||
'name' => 'freeshipping',
|
||||
//店铺端展示分类 shop:营销活动 member:互动营销
|
||||
'show_type' => 'shop',
|
||||
//展示主题
|
||||
'title' => '满额包邮',
|
||||
//展示介绍
|
||||
'description' => '购满指定金额订单包邮',
|
||||
//展示图标
|
||||
'icon' => 'addon/freeshipping/icon.png',
|
||||
//跳转链接
|
||||
'url' => 'freeshipping://shop/freeshipping/lists',
|
||||
]
|
||||
]
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
26
addon/freeshipping/event/UnInstall.php
Executable file
26
addon/freeshipping/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\freeshipping\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
BIN
addon/freeshipping/icon.png
Executable file
BIN
addon/freeshipping/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
152
addon/freeshipping/model/Freeshipping.php
Executable file
152
addon/freeshipping/model/Freeshipping.php
Executable file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\freeshipping\model;
|
||||
|
||||
use app\model\BaseModel;
|
||||
|
||||
class Freeshipping extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 添加满额包邮
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
public function addFreeshipping($data)
|
||||
{
|
||||
$data[ 'create_time' ] = time();
|
||||
$area_ids = json_decode($data[ 'area_ids' ], true);
|
||||
if (!empty($area_ids)) {
|
||||
foreach ($area_ids[ '3' ] as $k => $v) {
|
||||
foreach ($v as $area_id) {
|
||||
|
||||
//判断该城市是否已存在
|
||||
$count = model('promotion_freeshipping')->getCount(
|
||||
[
|
||||
[ 'site_id', '=', $data[ 'site_id' ] ],
|
||||
[ 'area_ids', 'like', '%' . $area_id . '%' ],
|
||||
]
|
||||
);
|
||||
if ($count > 0) {
|
||||
return $this->error('', '指定地区城市不能重复');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$res = model('promotion_freeshipping')->add($data);
|
||||
return $this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑满额包邮
|
||||
* @param $groupbuy_id
|
||||
* @param $site_id
|
||||
* @param $groupbuy_data
|
||||
* @return array|\multitype
|
||||
*/
|
||||
public function editFreeshipping($data)
|
||||
{
|
||||
$freeshipping_id = $data[ 'freeshipping_id' ];
|
||||
unset($data[ 'freeshipping_id' ]);
|
||||
$data[ 'update_time' ] = time();
|
||||
$area_ids = json_decode($data[ 'area_ids' ], true);
|
||||
if (!empty($area_ids)) {
|
||||
foreach ($area_ids[ '3' ] as $k => $v) {
|
||||
foreach ($v as $area_id) {
|
||||
|
||||
//判断该城市是否已存在
|
||||
$count = model('promotion_freeshipping')->getCount(
|
||||
[
|
||||
[ 'site_id', '=', $data[ 'site_id' ] ],
|
||||
[ 'area_ids', 'like', '%' . $area_id . '%' ],
|
||||
[ 'freeshipping_id', '<>', $freeshipping_id ]
|
||||
]
|
||||
);
|
||||
if ($count > 0) {
|
||||
return $this->error('', '指定地区城市不能重复');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$res = model('promotion_freeshipping')->update($data,
|
||||
[ [ 'site_id', '=', $data[ 'site_id' ] ], [ 'freeshipping_id', '=', $freeshipping_id ] ]
|
||||
);
|
||||
return $this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除满额包邮活动
|
||||
* @param $groupbuy_id
|
||||
* @param $site_id
|
||||
* @return array|\multitype
|
||||
*/
|
||||
public function deleteFreeshipping($freeshipping_id, $site_id)
|
||||
{
|
||||
$list = model('promotion_freeshipping')->delete([ [ 'freeshipping_id', '=', $freeshipping_id ], [ 'site_id', '=', $site_id ] ]);
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
* @param array $condition
|
||||
* @param string $field
|
||||
* @return array
|
||||
*/
|
||||
public function getFreeshippingInfo($condition = [], $field = '*')
|
||||
{
|
||||
$res = model('promotion_freeshipping')->getInfo($condition, $field);
|
||||
return $this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取满额包邮分页列表
|
||||
* @param array $condition
|
||||
* @param number $page
|
||||
* @param string $page_size
|
||||
* @param string $order
|
||||
* @param string $field
|
||||
*/
|
||||
public function getFreeshippingPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*')
|
||||
{
|
||||
$list = model('promotion_freeshipping')->pageList($condition, $field, $order, $page, $page_size);
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
/********************************************************************* 订单核验是否符合地区 start*****************************************************************************/
|
||||
|
||||
/**
|
||||
* 是否符合满额包邮
|
||||
* @param $money
|
||||
* @param $district_id
|
||||
* @param $site_id
|
||||
* @return array
|
||||
*/
|
||||
public function calculate($money, $district_id, $site_id)
|
||||
{
|
||||
$condition = array (
|
||||
[ 'price', '<=', $money ],
|
||||
[ 'site_id', '=', $site_id ],
|
||||
[ 'area_ids', 'like', '%"' . $district_id . '"%' ]
|
||||
);
|
||||
|
||||
$info = model('promotion_freeshipping')->getInfo($condition, '*');
|
||||
if (!empty($info)) {
|
||||
return $this->success($info);
|
||||
} else {
|
||||
return $this->error();
|
||||
}
|
||||
}
|
||||
/********************************************************************* 订单核验是否符合地区 end*****************************************************************************/
|
||||
|
||||
}
|
||||
111
addon/freeshipping/shop/controller/Freeshipping.php
Executable file
111
addon/freeshipping/shop/controller/Freeshipping.php
Executable file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\freeshipping\shop\controller;
|
||||
|
||||
use app\shop\controller\BaseShop;
|
||||
use addon\freeshipping\model\Freeshipping as FreeshippingModel;
|
||||
|
||||
class Freeshipping extends BaseShop
|
||||
{
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$model = new FreeshippingModel();
|
||||
|
||||
$condition[] = [ 'site_id', '=', $this->site_id ];
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$list = $model->getFreeshippingPageList($condition, $page, $page_size, 'price asc');
|
||||
return $list;
|
||||
} else {
|
||||
return $this->fetch('freeshipping/lists');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加活动
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
|
||||
$price = input('price', '');
|
||||
$json = input('json', '');
|
||||
$surplus_area_ids = input('surplus_area_ids', '');
|
||||
|
||||
$json_data = json_decode($json, true);
|
||||
$data = $json_data[ '1' ];
|
||||
$data[ 'price' ] = $price;
|
||||
$data[ 'site_id' ] = $this->site_id;
|
||||
$data[ 'surplus_area_ids' ] = $surplus_area_ids;
|
||||
$model = new FreeshippingModel();
|
||||
$result = $model->addFreeshipping($data);
|
||||
return $result;
|
||||
|
||||
} else {
|
||||
|
||||
// 地区等级设置 将来从配置中查询数据
|
||||
$area_level = 3;
|
||||
$this->assign('area_level', $area_level);//地址级别
|
||||
return $this->fetch('freeshipping/add');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑活动
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$model = new FreeshippingModel();
|
||||
$freeshipping_id = input('freeshipping_id', 0);
|
||||
if (request()->isJson()) {
|
||||
|
||||
$price = input('price', '');
|
||||
$json = input('json', '');
|
||||
$surplus_area_ids = input('surplus_area_ids', '');
|
||||
|
||||
$json_data = json_decode($json, true);
|
||||
$data = $json_data[ '1' ];
|
||||
$data[ 'price' ] = $price;
|
||||
$data[ 'site_id' ] = $this->site_id;
|
||||
$data[ 'surplus_area_ids' ] = $surplus_area_ids;
|
||||
$data[ 'freeshipping_id' ] = $freeshipping_id;
|
||||
|
||||
$result = $model->editFreeshipping($data);
|
||||
return $result;
|
||||
|
||||
} else {
|
||||
$this->assign('freeshipping_id', $freeshipping_id);
|
||||
// 地区等级设置 将来从配置中查询数据
|
||||
$area_level = 3;
|
||||
$this->assign('area_level', $area_level);//地址级别
|
||||
|
||||
$info = $model->getFreeshippingInfo([ [ 'freeshipping_id', '=', $freeshipping_id ], [ 'site_id', '=', $this->site_id ] ])[ 'data' ];
|
||||
$this->assign('info', $info);
|
||||
return $this->fetch('freeshipping/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$freeshipping_id = input('freeshipping_id', '');
|
||||
$site_id = $this->site_id;
|
||||
|
||||
$model = new FreeshippingModel();
|
||||
return $model->deleteFreeshipping($freeshipping_id, $site_id);
|
||||
}
|
||||
|
||||
}
|
||||
150
addon/freeshipping/shop/view/freeshipping/add.html
Executable file
150
addon/freeshipping/shop/view/freeshipping/add.html
Executable file
@@ -0,0 +1,150 @@
|
||||
<style>
|
||||
.add-distribution{cursor: pointer;}
|
||||
.area-modal{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 25px 0;
|
||||
}
|
||||
.area-modal .area-list{
|
||||
width: 255px;
|
||||
height: 375px;
|
||||
align-items: center;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.area-modal .title{
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
text-align: center;
|
||||
}
|
||||
.area-modal .add{
|
||||
background-color: transparent;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.area-modal .box{
|
||||
overflow-y: auto;
|
||||
padding: 10px 0;
|
||||
height: 340px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.modal-operation{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
}
|
||||
.area-list .box{
|
||||
height: 314px;
|
||||
margin: 10px 0;
|
||||
overflow-y:auto;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
.area-list .box ul li{
|
||||
line-height: 30px;
|
||||
cursor: pointer;
|
||||
background-color:#fff;
|
||||
}
|
||||
.area-list .box ul li .title-div{
|
||||
position:relative;
|
||||
padding-left:20px;
|
||||
}
|
||||
.area-list .box ul li[data-level='2'] .title-div{
|
||||
margin-left:10px;
|
||||
}
|
||||
.area-list .box ul li[data-level='3'] .title-div{
|
||||
margin-left:20px;
|
||||
}
|
||||
.area-list .box ul li[data-level='4'] .title-div{
|
||||
margin-left:30px;
|
||||
}
|
||||
.area-list.all-area .box ul li.selected{
|
||||
background: #d7d7d7;
|
||||
}
|
||||
.area-list .area-btn,.area-list .area-btn-null,.area-list .area-delete{
|
||||
position:absolute;
|
||||
top:9px;
|
||||
display:block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
background-color: #d7d7d7;
|
||||
color: #fff;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.area-list .area-btn{
|
||||
left:3px;
|
||||
}
|
||||
.area-list .area-btn-null{
|
||||
background-color:transparent;
|
||||
left:3px;
|
||||
}
|
||||
.area-list .area-delete{
|
||||
right:6px;
|
||||
}
|
||||
.area-list.all-area .area-delete{
|
||||
display:none;
|
||||
}
|
||||
.area-list.all-area .area-btn.selected{
|
||||
background-color: #fff;
|
||||
color: #d7d7d7;
|
||||
}
|
||||
.right-opt {
|
||||
float: right;
|
||||
}
|
||||
.right-opt span {
|
||||
cursor: pointer;
|
||||
}
|
||||
.bg-color-gray {
|
||||
background-color: #E5E5E5!important;
|
||||
}
|
||||
.area-table {width: 800px;}
|
||||
.layui-table .area-selected {border-right: 0;}
|
||||
.layui-table .area-btn {border-left: 0;}
|
||||
</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="price" type="number" min="0" placeholder="请输入金额" lay-verify="required" class="layui-input len-long" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>指定地区:</label>
|
||||
<div class="layui-input-block area-table">
|
||||
<table id="distributionArea" class="layui-table">
|
||||
<colgroup>
|
||||
<col width="92%" />
|
||||
<col width="8%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="area-selected">指定地区</th>
|
||||
<th class="area-btn"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2" class="text-color add-distribution js-add-record">选择地区</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick=" window.history.go(-1);">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value='{$area_level}' id="area_level"/><!-- 配送地区等级 -->
|
||||
<input type="hidden" value="" id="surplus_area_ids">
|
||||
<input type="hidden" value="" id="freeshipping_id">
|
||||
|
||||
<script type='text/javascript' src='SHOP_JS/freeshipping_template.js'></script>
|
||||
160
addon/freeshipping/shop/view/freeshipping/edit.html
Executable file
160
addon/freeshipping/shop/view/freeshipping/edit.html
Executable file
@@ -0,0 +1,160 @@
|
||||
|
||||
|
||||
<style>
|
||||
.area-modal{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 25px 0;
|
||||
}
|
||||
.area-modal .area-list{
|
||||
width: 255px;
|
||||
height: 375px;
|
||||
align-items: center;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.area-modal .title{
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
text-align: center;
|
||||
}
|
||||
.area-modal .add{
|
||||
background-color: transparent;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.area-modal .box{
|
||||
overflow-y: auto;
|
||||
padding: 10px 0;
|
||||
height: 340px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.modal-operation{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
}
|
||||
.area-list .box{
|
||||
height: 314px;
|
||||
margin: 10px 0;
|
||||
overflow-y:auto;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
.area-list .box ul li{
|
||||
line-height: 30px;
|
||||
cursor: pointer;
|
||||
background-color:#fff;
|
||||
}
|
||||
.area-list .box ul li .title-div{
|
||||
position:relative;
|
||||
padding-left:20px;
|
||||
}
|
||||
.area-list .box ul li[data-level='2'] .title-div{
|
||||
margin-left:10px;
|
||||
}
|
||||
.area-list .box ul li[data-level='3'] .title-div{
|
||||
margin-left:20px;
|
||||
}
|
||||
.area-list .box ul li[data-level='4'] .title-div{
|
||||
margin-left:30px;
|
||||
}
|
||||
.area-list.all-area .box ul li.selected{
|
||||
background: #d7d7d7;
|
||||
}
|
||||
.area-list .area-btn,.area-list .area-btn-null,.area-list .area-delete{
|
||||
position:absolute;
|
||||
top:9px;
|
||||
display:block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
background-color: #d7d7d7;
|
||||
color: #fff;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.area-list .area-btn{
|
||||
left:3px;
|
||||
}
|
||||
.area-list .area-btn-null{
|
||||
background-color:transparent;
|
||||
left:3px;
|
||||
}
|
||||
.area-list .area-delete{
|
||||
right:6px;
|
||||
}
|
||||
.area-list.all-area .area-delete{
|
||||
display:none;
|
||||
}
|
||||
.area-list.all-area .area-btn.selected{
|
||||
background-color: #fff;
|
||||
color: #d7d7d7;
|
||||
}
|
||||
.right-opt {
|
||||
float: right;
|
||||
}
|
||||
.right-opt span {
|
||||
cursor: pointer;
|
||||
}
|
||||
.bg-color-gray {
|
||||
background-color: #E5E5E5!important;
|
||||
}
|
||||
.area-table {width: 800px;}
|
||||
.layui-table .area-selected {border-right: 0;}
|
||||
.layui-table .area-btn {border-left: 0;}
|
||||
</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 value="{$info['price']}" name="price" type="number" min="0" placeholder="请输入金额" lay-verify="required" class="layui-input len-long" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>指定地区:</label>
|
||||
<div class="layui-input-block area-table">
|
||||
<table id="distributionArea" class="layui-table">
|
||||
<colgroup>
|
||||
<col width="92%" />
|
||||
<col width="8%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="area-selected">指定地区</th>
|
||||
<th class="area-btn"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr data-selected="1">
|
||||
<td class="area-selected">
|
||||
<p class="area-show">{$info.area_names}</p>
|
||||
</td>
|
||||
<td class="area-btn">
|
||||
<span class="right-opt">
|
||||
<span class="opt-update text-color" data-selected="1">修改</span>
|
||||
</span>
|
||||
</td>
|
||||
<input type="hidden" value="{$info.area_ids}" data-selected="1" class="area_ids" data-name="{$info.area_names}">
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick=" window.history.go(-1);">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value="{$info['freeshipping_id']}" id="freeshipping_id"/><!-- 模板id 添加为0 -->
|
||||
<input type="hidden" value="{$area_level}" id="area_level"/><!-- 配送地区等级 -->
|
||||
<input type="hidden" value="0" id="opt_total"/><!-- 模板项的总数 在修改的时候作为操作序列的起点 -->
|
||||
<input type="hidden" value="{$info['surplus_area_ids']}" id="surplus_area_ids"/>
|
||||
|
||||
<script type='text/javascript' src='SHOP_JS/freeshipping_template.js'></script>
|
||||
164
addon/freeshipping/shop/view/freeshipping/lists.html
Executable file
164
addon/freeshipping/shop/view/freeshipping/lists.html
Executable file
@@ -0,0 +1,164 @@
|
||||
<style>
|
||||
.layui-table-cell{
|
||||
height:auto;
|
||||
overflow:visible;
|
||||
text-overflow:inherit;
|
||||
white-space:normal;
|
||||
}
|
||||
.layui-layout-admin .single-filter-box{padding: 0;}
|
||||
</style>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加满额包邮规则</button>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="groupbuy_tab">
|
||||
|
||||
<div class="layui-tab-content">
|
||||
<table id="freeshipping_list" lay-filter="freeshipping_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="del">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'element'], function() {
|
||||
var table,
|
||||
form = layui.form,
|
||||
element = layui.element,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
element.on('tab(groupbuy_tab)', function() {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': this.getAttribute('data-status')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#freeshipping_list',
|
||||
url: ns.url("freeshipping://shop/freeshipping/lists"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'area_names',
|
||||
title: '包邮地区',
|
||||
unresize: 'false',
|
||||
width: '63%'
|
||||
}, {
|
||||
field: 'price',
|
||||
title: '包邮金额',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
align: 'right',
|
||||
templet: function(data) {
|
||||
return '¥'+ data.price;
|
||||
}
|
||||
}, {
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
width: '17%',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
//监听Tab切换
|
||||
element.on('tab(status)', function(data) {
|
||||
var status = $(this).attr("data-status");
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': status
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("freeshipping://shop/freeshipping/edit", {"freeshipping_id": data.freeshipping_id});
|
||||
break;
|
||||
case 'del': //删除
|
||||
deleteFreeshipping(data.freeshipping_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteFreeshipping(freeshipping_id) {
|
||||
layer.confirm('确定要删除吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("freeshipping://shop/freeshipping/delete"),
|
||||
data: {
|
||||
freeshipping_id: freeshipping_id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("freeshipping://shop/freeshipping/add");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user