运费插件优化

feat/task1-c-wallet
devil_gong 2019-04-26 15:22:08 +08:00
parent 482c6a5049
commit ea9a62f329
17 changed files with 812 additions and 237 deletions

View File

@ -70,59 +70,8 @@ class Goods extends Common
// 商品收藏总数
$ret['data'][0]['favor_count'] = GoodsService::GoodsFavorTotal(['goods_id'=>$id]);
// 商品页面相册底部钩子
$this->assign('plugins_view_goods_detail_photo_bottom_data', Hook::listen('plugins_view_goods_detail_photo_bottom',
[
'hook_name' => 'plugins_view_goods_detail_photo_bottom',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 商品页面基础信息顶部钩子
$this->assign('plugins_view_goods_detail_base_top_data', Hook::listen('plugins_view_goods_detail_base_top',
[
'hook_name' => 'plugins_view_goods_detail_base_top',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 商品页面基础信息面板底部钩子
$this->assign('plugins_view_goods_detail_panel_bottom_data', Hook::listen('plugins_view_goods_detail_panel_bottom',
[
'hook_name' => 'plugins_view_goods_detail_panel_bottom',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 商品页面tabs顶部钩子
$this->assign('plugins_view_goods_detail_tabs_top_data', Hook::listen('plugins_view_goods_detail_tabs_top',
[
'hook_name' => 'plugins_view_goods_detail_tabs_top',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 商品页面tabs顶部钩子
$this->assign('plugins_view_goods_detail_tabs_bottom_data', Hook::listen('plugins_view_goods_detail_tabs_bottom',
[
'hook_name' => 'plugins_view_goods_detail_tabs_bottom',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 商品页面左侧顶部钩子
$this->assign('plugins_view_goods_detail_left_top_data', Hook::listen('plugins_view_goods_detail_left_top',
[
'hook_name' => 'plugins_view_goods_detail_left_top',
'is_backend' => false,
'goods_id' => $id,
'goods' => &$ret['data'][0],
]));
// 钩子
$this->PluginsHook($id, $ret['data'][0]);
// 商品数据
$this->assign('goods', $ret['data'][0]);
@ -170,6 +119,90 @@ class Goods extends Common
}
}
/**
* 钩子处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-22
* @desc description
* @param [array] $params [输入参数]
*/
private function PluginsHook($goods_id, &$goods)
{
// 商品页面相册底部钩子
$this->assign('plugins_view_goods_detail_photo_bottom_data', Hook::listen('plugins_view_goods_detail_photo_bottom',
[
'hook_name' => 'plugins_view_goods_detail_photo_bottom',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面基础信息顶部钩子
$this->assign('plugins_view_goods_detail_base_top_data', Hook::listen('plugins_view_goods_detail_base_top',
[
'hook_name' => 'plugins_view_goods_detail_base_top',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面基础信息面板底部钩子
$this->assign('plugins_view_goods_detail_panel_bottom_data', Hook::listen('plugins_view_goods_detail_panel_bottom',
[
'hook_name' => 'plugins_view_goods_detail_panel_bottom',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面基础信息面板底部钩子
$this->assign('plugins_view_goods_detail_base_bottom_data', Hook::listen('plugins_view_goods_detail_base_bottom',
[
'hook_name' => 'plugins_view_goods_detail_base_bottom',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面tabs顶部钩子
$this->assign('plugins_view_goods_detail_tabs_top_data', Hook::listen('plugins_view_goods_detail_tabs_top',
[
'hook_name' => 'plugins_view_goods_detail_tabs_top',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面tabs顶部钩子
$this->assign('plugins_view_goods_detail_tabs_bottom_data', Hook::listen('plugins_view_goods_detail_tabs_bottom',
[
'hook_name' => 'plugins_view_goods_detail_tabs_bottom',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面左侧顶部钩子
$this->assign('plugins_view_goods_detail_left_top_data', Hook::listen('plugins_view_goods_detail_left_top',
[
'hook_name' => 'plugins_view_goods_detail_left_top',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
// 商品页面基础信息标题里面钩子
$this->assign('plugins_view_goods_detail_title_data', Hook::listen('plugins_view_goods_detail_title',
[
'hook_name' => 'plugins_view_goods_detail_title',
'is_backend' => false,
'goods_id' => $goods_id,
'goods' => &$goods,
]));
}
/**
* 商品收藏
* @author Devil

View File

@ -107,7 +107,22 @@
<!--规格-->
<!--名称-->
<div class="tb-detail-hd">
<h1 class="detail-title" {{if !empty($goods.title_color)}}style="color:{{$goods.title_color}};"{{/if}}>{{$goods.title}}</h1>
<h1 class="detail-title" {{if !empty($goods.title_color)}}style="color:{{$goods.title_color}};"{{/if}}>
{{$goods.title}}
<!-- 商品页面基础信息标题里面钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>plugins_view_goods_detail_title</span>
</div>
{{/if}}
{{if !empty($plugins_view_goods_detail_title_data) and is_array($plugins_view_goods_detail_title_data)}}
{{foreach $plugins_view_goods_detail_title_data as $hook}}
{{if is_string($hook) or is_int($hook)}}
{{$hook|raw}}
{{/if}}
{{/foreach}}
{{/if}}
</h1>
</div>
<div class="tb-detail-list">
<!-- 商品页面基础信息顶部钩子 -->
@ -292,6 +307,20 @@
<p class="goods-not-buy-tips">商品已下架</p>
{{/if}}
</div>
<!-- 商品页面基础信息底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>plugins_view_goods_detail_base_bottom</span>
</div>
{{/if}}
{{if !empty($plugins_view_goods_detail_base_bottom_data) and is_array($plugins_view_goods_detail_base_bottom_data)}}
{{foreach $plugins_view_goods_detail_base_bottom_data as $hook}}
{{if is_string($hook) or is_int($hook)}}
{{$hook|raw}}
{{/if}}
{{/foreach}}
{{/if}}
</div>
</div>

View File

@ -37,9 +37,9 @@ class Hook extends Controller
{
switch($params['hook_name'])
{
// style css
case 'plugins_common_header' :
$ret = $this->StyleCss($params);
// css
case 'plugins_css' :
$ret = $this->CssFile($params);
break;
// 底部导航上面钩子
@ -80,43 +80,12 @@ class Hook extends Controller
* @datetime 2019-02-06T16:16:34+0800
* @param [array] $params [输入参数]
*/
public function StyleCss($params = [])
public function CssFile($params = [])
{
$ret = $this->IsNormal($params);
if($ret['code'] == 0)
{
return '<style type="text/css">
.plugins-footercustomerservice-customer-service {
background: #f8f8f8;
padding: 10px 0;
margin-top: 20px;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item img {
width: 50px;
float: left;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base {
margin-left: 60px;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base .title {
font-weight: 500;
font-size: 16px;
color: #505050;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base .desc {
color: #999;
margin-top: 5px;
}
@media only screen and (max-width:1025px) {
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item {
border-bottom: 1px solid #f0f0f0;
padding-bottom: 10px;
}
}
.am-footer-default {
margin-top: 0;
}
</style>';
return __MY_ROOT_PUBLIC__.'static/plugins/css/footercustomerservice/style.css';
}
return '';
}

View File

@ -17,7 +17,7 @@
"is_home":false
},
"hook":{
"plugins_common_header":[
"plugins_css":[
"app\\plugins\\footercustomerservice\\Hook"
],
"plugins_view_common_footer_top":[

View File

@ -12,9 +12,11 @@ namespace app\plugins\freightfee;
use think\Db;
use think\Controller;
use app\plugins\freightfee\Service;
use app\service\PluginsService;
use app\service\RegionService;
use app\service\PaymentService;
use app\service\GoodsService;
/**
* 运费设置 - 管理
@ -38,7 +40,7 @@ class Admin extends Controller
$ret = PluginsService::PluginsData('freightfee');
if($ret['code'] == 0)
{
$this->assign('data', $this->DataHandle($ret['data']));
$this->assign('data', Service::DataHandle($ret['data']));
return $this->fetch('../../../plugins/view/freightfee/admin/index');
} else {
return $ret['msg'];
@ -78,45 +80,18 @@ class Admin extends Controller
// 支付方式
$this->assign('payment_list', PaymentService::PaymentList(['is_enable'=>1, 'is_open_user'=>1]));
// 商品分类
$this->assign('goods_category_list', GoodsService::GoodsCategoryAll());
$this->assign('region_list', $region);
$this->assign('is_whether_list', $is_whether_list);
$this->assign('data', $this->DataHandle($ret['data']));
$this->assign('data', Service::DataHandle($ret['data']));
return $this->fetch('../../../plugins/view/freightfee/admin/saveinfo');
} else {
return $ret['msg'];
}
}
/**
* 数据处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-22
* @desc description
* @param [array] $data [应用数据]
*/
private function DataHandle($data)
{
if(!empty($data['data']))
{
if(empty($data['payment']))
{
$data['payment'] = [];
$data['payment_names'] = '';
} else {
$data['payment'] = explode(',', $data['payment']);
$data['payment_names'] = implode('、', array_map(function($v){return mb_substr($v, strrpos($v, '-')+1, null, 'utf-8');}, $data['payment']));
}
foreach($data['data'] as &$v)
{
$v['region_names'] = empty($v['region_show']) ? '' : implode('、', Db::name('Region')->where('id', 'in', explode('-', $v['region_show']))->column('name'));
}
}
return $data;
}
/**
* 数据保存
* @author Devil
@ -129,5 +104,25 @@ class Admin extends Controller
{
return PluginsService::PluginsDataSave(['plugins'=>'freightfee', 'data'=>$params]);
}
/**
* 商品搜索
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public function goodssearch($params = [])
{
// 是否ajax请求
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 搜索数据
return Service::GoodsSearchList($params);
}
}
?>

View File

@ -35,11 +35,21 @@ class Hook
{
switch($params['hook_name'])
{
// css
case 'plugins_css' :
$ret = __MY_ROOT_PUBLIC__.'static/plugins/css/freightfee/style.css';
break;
// 运费计算
case 'plugins_service_buy_handle' :
$ret = $this->FreightFeeCalculate($params);
break;
// 商品免运费icon
case 'plugins_view_goods_detail_title' :
$ret = $this->FreeShippingGoodsIcon($params);
break;
default :
$ret = '';
}
@ -47,6 +57,29 @@ class Hook
}
}
/**
* 商品免运费icon
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-26
* @desc description
* @param [array] $params [输入参数]
*/
private function FreeShippingGoodsIcon($params = [])
{
$ret = PluginsService::PluginsData('freightfee');
if($ret['code'] == 0 && !empty($ret['data']['goods_ids']) && !empty($params['goods_id']))
{
$goods_all = explode(',', $ret['data']['goods_ids']);
if(in_array($params['goods_id'], $goods_all))
{
return '<span class="am-badge am-radius plugins-freightfee-goods-icon">免运费</span>';
}
}
return '';
}
/**
* 运费计算
* @author Devil
@ -81,6 +114,11 @@ class Hook
}
}
}
// 免运费商品
$free_goods = $this->FreeShippingGoods($ret['data']['goods_ids'], $params);
$params['data']['base']['buy_count'] -= $free_goods['buy_count'];
$params['data']['base']['spec_weight_total'] -= $free_goods['spec_weight'];
// 是否设置运费数据
if($is_payment === true && !empty($ret['data']['data'][0]))
@ -91,17 +129,22 @@ class Hook
// 计费方式
if(!empty($rules))
{
switch($ret['data']['valuation'])
// 订单金额满免运费
if(empty($rules['free_shipping_price']) || $params['data']['base']['total_price'] < $rules['free_shipping_price'])
{
// 按件
case 0 :
$price = $this->PieceCalculate($rules, $params['data']);
break;
// 根据规则计算运费
switch($ret['data']['valuation'])
{
// 按件
case 0 :
$price = $this->PieceCalculate($rules, $params['data']);
break;
// 按量
case 1 :
$price = $this->QuantityCalculate($rules, $params['data']);
break;
// 按量
case 1 :
$price = $this->QuantityCalculate($rules, $params['data']);
break;
}
}
}
}
@ -125,6 +168,38 @@ class Hook
}
}
/**
* 免运费商品
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-26
* @desc description
* @param [string] $goods_ids [商品ids]
* @param [array] $params [钩子参数]
*/
private function FreeShippingGoods($goods_ids, $params)
{
$result = [
'buy_count' => 0,
'spec_weight' => 0,
];
if(!empty($goods_ids))
{
$goods_all = explode(',', $goods_ids);
foreach($params['data']['goods'] as $goods)
{
if(in_array($goods['goods_id'], $goods_all))
{
$result['buy_count'] += $goods['stock'];
$result['spec_weight'] += $goods['spec_weight'];
}
}
}
return $result;
}
/**
* 按重计费
* @author Devil

View File

@ -0,0 +1,132 @@
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\plugins\freightfee;
use think\Db;
use app\service\ResourcesService;
use app\service\GoodsService;
use app\service\AnswerService;
/**
* 问答系统服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Service
{
/**
* 数据处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-22
* @desc description
* @param [array] $data [应用数据]
*/
public static function DataHandle($data)
{
if(!empty($data['data']))
{
// 支付方式
if(empty($data['payment']))
{
$data['payment'] = [];
$data['payment_names'] = '';
} else {
$data['payment'] = explode(',', $data['payment']);
$data['payment_names'] = implode('、', array_map(function($v){return mb_substr($v, strrpos($v, '-')+1, null, 'utf-8');}, $data['payment']));
}
// 地区
foreach($data['data'] as &$v)
{
$v['region_names'] = empty($v['region_show']) ? '' : implode('、', Db::name('Region')->where('id', 'in', explode('-', $v['region_show']))->column('name'));
}
// 商品列表
$data['goods_list'] = empty($data['goods_ids']) ? [] : self::GoodsList($data['goods_ids']);
}
return $data;
}
/**
* 商品搜索
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public static function GoodsSearchList($params = [])
{
// 条件
$where = [
['g.is_delete_time', '=', 0],
['g.is_shelves', '=', 1]
];
// 关键字
if(!empty($params['keywords']))
{
$where[] = ['g.title', 'like', '%'.$params['keywords'].'%'];
}
// 分类id
if(!empty($params['category_id']))
{
$category_ids = GoodsService::GoodsCategoryItemsIds([$params['category_id']], 1);
$category_ids[] = $params['category_id'];
$where[] = ['gci.category_id', 'in', $category_ids];
}
// 指定字段
$field = 'g.id,g.title';
// 获取数据
return GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>0, 'n'=>100, 'field'=>$field, 'is_admin_access'=>1]);
}
/**
* 商品列表
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [string] $goods_ids [商品id]
*/
public static function GoodsList($goods_ids = [])
{
// 商品id
if(empty($goods_ids))
{
return [];
} else {
$goods_ids = explode(',', $goods_ids);
}
// 条件
$where = [
['g.is_delete_time', '=', 0],
['g.is_shelves', '=', 1],
['g.id', 'in', $goods_ids],
];
// 指定字段
$field = 'g.id,g.title,g.images,g.price';
// 获取数据
$ret = GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>0, 'n'=>100, 'field'=>$field]);
return $ret['data'];
}
}
?>

View File

@ -21,8 +21,14 @@
"is_home":false
},
"hook":{
"plugins_css":[
"app\\plugins\\freightfee\\Hook"
],
"plugins_service_buy_handle":[
"app\\plugins\\freightfee\\Hook"
],
"plugins_view_goods_detail_title":[
"app\\plugins\\freightfee\\Hook"
]
}
}

View File

@ -9,93 +9,133 @@
</legend>
<div class="freightfee-content">
<div class="items">
<label>展示名称</label>
<div>
{{if empty($data['show_name'])}}
运费
{{else /}}
{{$data.show_name}}
{{/if}}
<div class="am-panel am-panel-secondary">
<div class="am-panel-hd">
<span class="am-panel-title">基础数据</span>
<a class="am-fr" href="{{:PluginsAdminUrl('freightfee', 'admin', 'saveinfo')}}">编辑</a>
</div>
</div>
<div class="items">
<label>免运费支付方式</label>
<div>
{{if empty($data['payment_names'])}}
未设置
{{else /}}
{{$data.payment_names}}
{{/if}}
</div>
</div>
<div class="items">
<label>计价方式</label>
<div>
{{if isset($data['valuation']) and $data['valuation'] eq 0}}
按件数
{{else /}}
按重量
{{/if}}
</div>
</div>
<div class="items">
<label>运费模板</label>
<div class="freightfee-rules">
<table class="am-table am-table-striped">
{{if empty($data['data'])}}
没有配置
{{else /}}
{{if isset($data['valuation']) and $data['valuation'] eq 0}}
<thead>
<tr>
<th>运送到</th>
<th>首件数(件)</th>
<th>首费(元)</th>
<th>续件数(件)</th>
<th>续费(元)</th>
<th>满(免运费)</th>
</tr>
</thead>
<div class="am-panel-bd">
<div class="items">
<label>展示名称</label>
<div>
{{if empty($data['show_name'])}}
运费
{{else /}}
<thead>
<tr>
<th>运送到</th>
<th>首件数(kg)</th>
<th>首费(元)</th>
<th>续件数(kg)</th>
<th>续费(元)</th>
<th>满(免运费)</th>
</tr>
</thead>
{{$data.show_name}}
{{/if}}
<tbody>
{{foreach $data.data as $k=>$v}}
<tr class="data-list-{{$k}}">
<td class="first">
{{if $v['region'] eq 'default'}}
默认运费
{{else /}}
<div class="region-td">{{$v.region_names}}</div>
{{/if}}
</div>
</div>
<div class="items">
<label>免运费支付方式</label>
<div>
{{if empty($data['payment_names'])}}
未设置
{{else /}}
{{$data.payment_names}}
{{/if}}
</div>
</div>
<div class="items">
<label>计价方式</label>
<div>
{{if isset($data['valuation']) and $data['valuation'] eq 0}}
按件数
{{else /}}
按重量
{{/if}}
</div>
</div>
</div>
</div>
<div class="am-panel am-panel-secondary index-goods-list">
<div class="am-panel-hd">
<span class="am-panel-title">免运费商品</span>
<a class="am-fr" href="{{:PluginsAdminUrl('freightfee', 'admin', 'saveinfo')}}">编辑</a>
</div>
<div class="am-panel-bd">
<table class="am-table">
<thead>
<tr>
<th>标题</th>
<th>价格</th>
</tr>
</thead>
<tbody>
{{if !empty($data['goods_list'])}}
{{foreach $data['goods_list'] as $v}}
<tr>
<td>
<a href="{{$v.goods_url}}" target="_blank">{{$v.title}}</a>
</td>
<td>{{$v.first}}</td>
<td>{{$v.first_price}}</td>
<td>{{$v.continue}}</td>
<td>{{$v.continue_price}}</td>
<td>{{$v.free_shipping_price}}</td>
<td>¥{{$v.price}}</td>
</tr>
{{/foreach}}
</tbody>
{{/if}}
{{/if}}
</tbody>
</table>
</div>
</div>
<a href="{{:PluginsAdminUrl('freightfee', 'admin', 'saveinfo')}}" class="am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit">编辑</a>
<div class="am-panel am-panel-secondary">
<div class="am-panel-hd">
<span class="am-panel-title">运费模板</span>
<a class="am-fr" href="{{:PluginsAdminUrl('freightfee', 'admin', 'saveinfo')}}">编辑</a>
</div>
<div class="am-panel-bd">
<div class="freightfee-rules">
<table class="am-table am-table-striped">
{{if empty($data['data'])}}
没有配置
{{else /}}
{{if isset($data['valuation']) and $data['valuation'] eq 0}}
<thead>
<tr>
<th>运送到</th>
<th>首件数(件)</th>
<th>首费(元)</th>
<th>续件数(件)</th>
<th>续费(元)</th>
<th>满(免运费)</th>
</tr>
</thead>
{{else /}}
<thead>
<tr>
<th>运送到</th>
<th>首件数(kg)</th>
<th>首费(元)</th>
<th>续件数(kg)</th>
<th>续费(元)</th>
<th>满(免运费)</th>
</tr>
</thead>
{{/if}}
<tbody>
{{foreach $data.data as $k=>$v}}
<tr class="data-list-{{$k}}">
<td class="first">
{{if $v['region'] eq 'default'}}
默认运费
{{else /}}
<div class="region-td">{{$v.region_names}}</div>
{{/if}}
</td>
<td>{{if isset($v['first'])}}{{$v.first}}{{/if}}</td>
<td>{{if isset($v['first_price'])}}{{$v.first_price}}{{/if}}</td>
<td>{{if isset($v['continue'])}}{{$v.continue}}{{/if}}</td>
<td>{{if isset($v['continue_price'])}}{{$v.continue_price}}{{/if}}</td>
<td>{{if isset($v['free_shipping_price'])}}{{$v.free_shipping_price}}{{/if}}</td>
</tr>
{{/foreach}}
</tbody>
{{/if}}
</table>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -24,6 +24,58 @@
</select>
</div>
<div class="am-form-group">
<label>免运费商品</label>
<div class="forth-selection-container">
<div class="forth-selection-form" data-search-url="{{:PluginsAdminUrl('freightfee', 'admin', 'goodssearch')}}">
<select class="am-radius c-p chosen-select forth-selection-form-category" data-placeholder="可选择..." data-validation-message="请选择商品分类">
<option value="">可选择...</option>
{{if !empty($goods_category_list)}}
{{foreach $goods_category_list as $v}}
<option value="{{$v.id}}">一级 - {{$v.name}}</option>
{{if !empty($v['items'])}}
{{foreach $v.items as $vs}}
<option style="padding-left: 30px;" value="{{$vs.id}}">二级 - {{$vs.name}}</option>
{{if !empty($vs['items'])}}
{{foreach $vs.items as $vss}}
<option style="padding-left: 60px;" value="{{$vss.id}}">三级 - {{$vss.name}}</option>
{{/foreach}}
{{/if}}
{{/foreach}}
{{/if}}
{{/foreach}}
{{/if}}
</select>
<input type="text" placeholder="商品名称" class="am-radius forth-selection-form-keywords" />
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-sm search-submit">搜索</button>
</div>
<div class="forth-selection-list">
<input type="text" name="goods_ids" value="{{if !empty($data['goods_ids'])}}{{$data.goods_ids}}{{/if}}" data-validation-message="请选择商品" />
<div class="forth-selection-items am-fl">
<div class="title">可选</div>
<ul class="forth-selection-content am-list ul-left">
<div class="table-no">没有相关数据</div>
</ul>
</div>
<button type="button" class="am-btn am-btn-default am-btn-xs selected-all">全选 <i class="am-icon-angle-double-right"></i></button>
<div class="forth-selection-items am-fr">
<div class="title">已选</div>
<ul class="forth-selection-content am-list ul-right">
<div class="table-no {{if !empty($data['goods_list'])}}none{{/if}}">没有相关数据</div>
{{if !empty($data['goods_list'])}}
{{foreach $data['goods_list'] as $v}}
<li class="am-animation-slide-bottom items-li-{{$v.id}}">
<span class="name" data-value="{{$v.id}}">{{$v.title}}</span>
<i class="am-icon-trash-o am-fr"></i>
</li>
{{/foreach}}
{{/if}}
</ul>
</div>
</div>
</div>
</div>
<div class="business-form-block am-form-group">
<label>计价方式</label>
<div>

View File

@ -73,7 +73,6 @@ return array (
0 => 'app\\plugins\\expressforkdn\\Hook',
1 => 'app\\plugins\\touristbuy\\Hook',
2 => 'app\\plugins\\homemiddleadv\\Hook',
3 => 'app\\plugins\\footercustomerservice\\Hook',
),
'plugins_admin_common_header' =>
array (
@ -103,11 +102,21 @@ return array (
array (
0 => 'app\\plugins\\touristbuy\\Hook',
),
'plugins_css' =>
array (
0 => 'app\\plugins\\freightfee\\Hook',
1 => 'app\\plugins\\share\\Hook',
2 => 'app\\plugins\\footercustomerservice\\Hook',
),
'plugins_service_buy_handle' =>
array (
0 => 'app\\plugins\\freightfee\\Hook',
1 => 'app\\plugins\\newuserreduction\\Hook',
),
'plugins_view_goods_detail_title' =>
array (
0 => 'app\\plugins\\freightfee\\Hook',
),
'plugins_service_users_center_left_menu_handle' =>
array (
0 => 'app\\plugins\\petscms\\Hook',
@ -116,10 +125,6 @@ return array (
array (
0 => 'app\\plugins\\petscms\\Hook',
),
'plugins_css' =>
array (
0 => 'app\\plugins\\share\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\share\\Hook',

File diff suppressed because one or more lines are too long

View File

@ -213,7 +213,7 @@ color:#F03726;font-size: 14px;text-align: center;border: 0;}
.buy-nav div.submit { width: 30%; }
.buy-nav span{display:inline-block;width: 50%;float: left; ;cursor: pointer; border-top: 1px solid #f5f5f5; border-left: 1px solid #f5f5f5;}
.tb-detail-hd h1 {padding-bottom:0.4em; line-height: 1;font-size: 14px;font-weight: 600;color: #333; line-height: 20px;}
.tb-detail-hd h1 {padding-bottom:0.4em; line-height: 1;font-size: 14px;font-weight: 600;color: #333; line-height: 24px;}
li.am-active hr{border-top: 1px solid #f00;}

View File

@ -0,0 +1,30 @@
.plugins-footercustomerservice-customer-service {
background: #f8f8f8;
padding: 10px 0;
margin-top: 20px;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item img {
width: 50px;
float: left;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base {
margin-left: 60px;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base .title {
font-weight: 500;
font-size: 16px;
color: #505050;
}
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item .base .desc {
color: #999;
margin-top: 5px;
}
@media only screen and (max-width:1025px) {
.plugins-footercustomerservice-customer-service .am-gallery-overlay .am-gallery-item {
border-bottom: 1px solid #f0f0f0;
padding-bottom: 10px;
}
}
.am-footer-default {
margin-top: 0;
}

View File

@ -1,6 +1,9 @@
/**
*
*/
.freightfee-content .am-panel-bd .am-table {
margin-bottom: 0;
}
.freightfee-content .items {
margin: 10px 0 20px 0;
border-bottom: 1px dashed #f1f1f1;
@ -9,6 +12,11 @@
.freightfee-content .edit-submit {
margin-bottom: 20px;
}
.freightfee-content .index-goods-list .am-panel-bd {
max-height: 300px;
overflow-y: scroll;
overflow-x: hidden;
}
/**
*
@ -88,4 +96,93 @@
background: #4CAF50;
color: #fff;
border: 1px solid #409643;
}
}
/**
*
*/
.forth-selection-container select.forth-selection-form-category {
display: -webkit-inline-box;
}
.forth-selection-container .forth-selection-form-category, .forth-selection-container .chosen-container, .forth-selection-container .forth-selection-form-keywords {
width: 30% !important;
}
.forth-selection-container .chosen-container, .forth-selection-container .forth-selection-form-keywords {
display: -webkit-inline-box !important;
}
.forth-selection-container .chosen-single {
width: 100%;
}
.forth-selection-container .forth-selection-form {
margin-bottom: 2px;
}
.forth-selection-list {
overflow: hidden;
margin-bottom: 20px;
position: relative;
}
.forth-selection-list .forth-selection-items {
width: calc(50% - 50px);
height: 300px;
}
.forth-selection-list .forth-selection-items .title {
text-align: center;
}
.forth-selection-list .forth-selection-items .forth-selection-content {
border: 1px solid #eee;
height: calc(100% - 25px);
overflow-y: scroll;
overflow-x: hidden;
border-radius: 2px;
margin-top: 5px;
background: #fff;
}
.forth-selection-list .forth-selection-items .forth-selection-content li {
padding: 5px 45px 5px 5px;
border-style: dotted;
border-color: #eaeaea;
border-width: 1px 0;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 100%;
color: #666;
position: relative;
}
.forth-selection-list .forth-selection-items .forth-selection-content li:nth-child(2) {
border-top: 0;
}
.forth-selection-list .forth-selection-items .forth-selection-content li i {
cursor: pointer;
padding: 0 10px 0 5px;
position: absolute;
top: 5px;
right: 5px;
}
.forth-selection-list .selected-all {
position: absolute;
margin-top: 140px;
margin-left: 20px;
}
.forth-selection-container input[name="goods_ids"] {
position: absolute;
left: -1000000px;
top: -1000000px;
}
.forth-selection-list i {
color: #888 !important;
}
.forth-selection-container .am-form-error .forth-selection-items .forth-selection-content {
border-color: #dd514c;
}
@media only screen and (max-width: 641px) {
.forth-selection-container .forth-selection-form-category, .forth-selection-container .forth-selection-form-keywords
{
width: calc(55% - 60px) !important;
display: -webkit-inline-box !important;
}
.forth-selection-container .chosen-container {
display: none !important;
}
}

View File

@ -0,0 +1,7 @@
.plugins-freightfee-goods-icon {
background: #fff;
border: 1px solid #5eb95e;
color: #5eb95e;
font-weight: 500;
vertical-align: middle;
}

View File

@ -274,4 +274,109 @@ $(function()
$('#freightfee-region-popup').modal('close');
});
// 添加元素到右侧
function RightElementAdd(value, name)
{
if($('.forth-selection-container ul.ul-right').find('.items-li-'+value).length == 0)
{
var html = '<li class="am-animation-slide-bottom items-li-'+value+'"><span class="name" data-value="'+value+'">'+name+'</span><i class="am-icon-trash-o am-fr"></i></li>';
$('.forth-selection-container ul.ul-right').append(html);
}
// 右侧数据同步
RightElementGoods();
// 左侧是否还有内容
if($('.forth-selection-container ul.ul-left li').length == 0)
{
$('.forth-selection-container ul.ul-left .table-no').removeClass('none');
} else {
$('.forth-selection-container ul.ul-left .table-no').addClass('none');
}
}
// 批量-商品id同步
function RightElementGoods()
{
var value_all = [];
$('.forth-selection-container ul.ul-right li').each(function(k, v)
{
value_all[k] = $(this).find('span.name').data('value');
});
$('.forth-selection-container input[name="goods_ids"]').val(value_all.join(',')).blur();
// 右侧是否还有数据
if($('.forth-selection-container ul.ul-right li').length == 0)
{
$('.forth-selection-container ul.ul-right .table-no').removeClass('none');
} else {
$('.forth-selection-container ul.ul-right .table-no').addClass('none');
}
}
// 左侧点击到右侧
$('.forth-selection-container ul.ul-left').on('click', 'i.am-icon-angle-right', function()
{
var value = $(this).prev().data('value');
var name = $(this).prev().text();
$(this).parent().remove();
RightElementAdd(value, name);
});
// 左侧全部移动到右侧
$('.forth-selection-container .selected-all').on('click', function()
{
$('.forth-selection-container ul.ul-left li').each(function(k, v)
{
var value = $(this).find('span.name').data('value');
var name = $(this).find('span.name').text();
$(this).remove();
RightElementAdd(value, name);
});
});
// 右侧删除
$('.forth-selection-container ul.ul-right').on('click', 'i.am-icon-trash-o', function()
{
$(this).parent().remove();
RightElementGoods();
});
// 商品搜索
$('.forth-selection-form .search-submit').on('click', function()
{
var category_id = $('.forth-selection-form .forth-selection-form-category').val();
var keywords = $('.forth-selection-form .forth-selection-form-keywords').val();
console.log(category_id, keywords)
// ajax请求
$.ajax({
url:$('.forth-selection-form').data('search-url'),
type:'POST',
dataType:"json",
timeout:10000,
data:{"category_id": category_id, "keywords": keywords},
success:function(result)
{
if(result.code == 0)
{
var html = '';
for(var i in result.data)
{
html += '<li class="am-animation-slide-bottom"><span class="name" data-value="'+result['data'][i]['id']+'">'+result['data'][i]['title']+'</span><i class="am-icon-angle-right am-fr"></i></li>';
}
$('ul.ul-left .table-no').addClass('none');
$('ul.ul-left li').remove();
$('ul.ul-left').append(html);
} else {
Prompt(result.msg);
}
},
error:function()
{
Prompt('网络异常错误');
}
});
});
});