下订单确认

feat/task1-c-wallet
devil_gong 2018-09-21 18:35:37 +08:00
parent cf835bd5cf
commit 664df587e3
15 changed files with 286 additions and 50 deletions

View File

@ -300,6 +300,14 @@ return array(
'common_favor_not_text' => '收藏',
'common_not_install_text' => '未安装',
'common_linkage_province_text' => '省份',
'common_linkage_city_text' => '城市',
'common_linkage_county_text' => '区/县',
'common_linkage_province_format' => '请选择省份',
'common_linkage_city_format' => '请选择城市',
'common_linkage_county_format' => '请选择区/县',
// 性别
'common_gender_list' => array(
0 => array('id' => 0, 'name' => '保密', 'checked' => true),

View File

@ -0,0 +1,54 @@
<?php
namespace Home\Controller;
use Service\ResourcesService;
/**
* 地区
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class RegionController extends CommonController
{
/**
* [_initialize 前置操作-继承公共前置方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function _initialize()
{
// 调用父类前置方法
parent::_initialize();
// 是否ajax请求
if(!IS_AJAX)
{
$this->error(L('common_unauthorized_access'));
}
}
/**
* 获取地区
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-21
* @desc description
*/
public function Index()
{
$params = [
'where' => [
'pid' => intval(I('pid', 0)),
],
];
$data = ResourcesService::RegionNode($params);
$this->ajaxReturn(L('common_operation_success'), 0, $data);
}
}
?>

View File

@ -0,0 +1,79 @@
<?php
namespace Home\Controller;
use Service\BuyService;
/**
* 用户地址管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class UserAddressController extends CommonController
{
/**
* [_initialize 前置操作-继承公共前置方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function _initialize()
{
// 调用父类前置方法
parent::_initialize();
// 是否登录
$this->Is_Login();
}
/**
* [Index 首页]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-02-22T16:50:32+0800
*/
public function Index()
{
$cart_list = BuyService::CartList(['user'=>$this->user]);
$this->assign('cart_list', $cart_list['data']);
$base = [
'total_price' => empty($cart_list['data']) ? 0 : array_sum(array_column($cart_list['data'], 'total_price')),
'total_stock' => empty($cart_list['data']) ? 0 : array_sum(array_column($cart_list['data'], 'stock')),
'ids' => empty($cart_list['data']) ? '' : implode(',', array_column($cart_list['data'], 'id')),
];
$this->assign('base', $base);
$this->display('Index');
}
/**
* [SaveInfo 地址添加/编辑页面]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-14T21:37:02+0800
*/
public function SaveInfo()
{
$this->assign('is_header', 0);
$this->assign('is_footer', 0);
// 文章信息
if(empty($_REQUEST['id']))
{
$data = array();
} else {
$data = M('Article')->find(I('id'));
}
$this->assign('data', $data);
// 地区
$this->display('SaveInfo');
}
}
?>

View File

@ -0,0 +1,12 @@
<?php
/**
* 模块语言包-用户地址
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
return array(
);
?>

View File

@ -20,7 +20,7 @@
<div class="address">
<div class="control">
<h3>确认收货地址</h3>
<button class="am-btn am-btn-danger am-btn-xs address-submit" type="button">使用新地址</button>
<button class="am-btn am-btn-danger am-btn-xs address-submit" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}">使用新地址</button>
</div>
<notempty name="user_address_list">
<ul class="address-list">

View File

@ -0,0 +1,12 @@
<div class="am-form-group region-linkage" data-url="{{:U('Home/Region/Index')}}">
<label class="block">{{:L('common_linkage_province_text')}}</label>
<select name="province" data-next="city" class="am-radius c-p chosen-select" data-placeholder="{{:L('common_linkage_province_text')}}" data-validation-message="{{:L('common_linkage_province_format')}}" required>
<option value="">{{:L('common_linkage_province_text')}}</option>
</select>
<select name="city" data-next="county" class="am-radius c-p chosen-select" data-placeholder="{{:L('common_linkage_city_text')}}" data-validation-message="{{:L('common_linkage_city_format')}}" required>
<option value="">{{:L('common_linkage_city_text')}}</option>
</select>
<select name="county" class="am-radius c-p chosen-select" data-placeholder="{{:L('common_linkage_county_text')}}" data-validation-message="{{:L('common_linkage_county_format')}}" required>
<option value="">{{:L('common_linkage_county_text')}}</option>
</select>
</div>

View File

@ -16,6 +16,10 @@
<js href="__PUBLIC__/Common/Lib/assets/js/amazeui.min.js?v={{:MyC('home_static_cache_version')}}" />
<js href="__PUBLIC__/Common/Lib/echarts/echarts.min.js?v={{:MyC('home_static_cache_version')}}" />
<js href="__PUBLIC__/Common/Lib/imagezoom/jquery.imagezoom.min.js?v={{:MyC('home_static_cache_version')}}" />
<!-- amazeui插件 -->
<js href="__PUBLIC__/Common/Lib/amazeui-switch/amazeui.switch.min.js?v={{:MyC('home_static_cache_version')}}" />
<js href="__PUBLIC__/Common/Lib/amazeui-chosen/amazeui.chosen.min.js?v={{:MyC('home_static_cache_version')}}" />
<js href="__PUBLIC__/Common/Lib/amazeui-dialog/amazeui.dialog.min.js?v={{:MyC('home_static_cache_version')}}" />
<!-- ueditor 编辑器 -->

View File

@ -12,6 +12,9 @@
<link rel="shortcut icon" type="image/x-icon" href="{{:__MY_URL__}}favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1, maximum-scale=1">
<css href="__PUBLIC__/Common/Lib/assets/css/amazeui.css?v={{:MyC('home_static_cache_version')}}" />
<css href="__PUBLIC__/Common/Lib/amazeui-switch/amazeui.switch.css?v={{:MyC('home_static_cache_version')}}" />
<css href="__PUBLIC__/Common/Lib/amazeui-chosen/amazeui.chosen.css?v={{:MyC('home_static_cache_version')}}" />
<css href="__PUBLIC__/Common/Css/Common.css?v={{:MyC('home_static_cache_version')}}" />
<css href="__PUBLIC__/Home/{{$default_theme}}/Css/Common.css?v={{:MyC('home_static_cache_version')}}" />
<if condition="!empty($module_css)">

View File

@ -0,0 +1,38 @@
<include file="Public/Header" />
<!-- conntent start -->
<div class="am-g my-content">
<!-- form start -->
<form class="am-form form-validation" method="post" action="{{:U('Home/User/Login')}}" request-type="ajax-fun" request-value="ViewModalBack">
<include file="Lib/RegionLinkage" />
</form>
<!-- form end -->
</div>
<!-- conntent end -->
<!-- footer start -->
<include file="Public/Footer" />
<!-- footer end -->
<script type="text/javascript">
// 返回处理
function ViewModalBack(e)
{
if(e.code == 0)
{
$.AMUI.progress.done();
Prompt(e.msg, 'success');
setTimeout(function()
{
parent.location.reload();
}, 1500);
} else {
$('form.form-validation').find('button[type="submit"]').button('reset');
$.AMUI.progress.done();
Prompt(e.msg);
}
}
</script>

View File

@ -72,5 +72,23 @@ class ResourcesService
}
return $data;
}
/**
* 获取地区节点数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-21
* @desc description
* @param [array] $params [输入参数]
*/
public static function RegionNode($params = [])
{
$field = empty($params['field']) ? 'id,name,level,letters' : $params['field'];
$where = empty($params['where']) ? [] : $params['where'];
$where['is_enable'] = 1;
return M('Region')->where($where)->field($field)->order('id asc, sort asc')->select();
}
}
?>

View File

@ -22,8 +22,6 @@
.c-p {cursor:pointer;}
.c-m {cursor: move !important;}
legend {padding-bottom:0.2rem !important; margin-bottom: 1rem; }
.none {display:none !important;}
.block {display:block !important;}
.am-popup-bd {background:#fff;}
.cr-eee {color:#eee !important;}
.cr-ccc {color:#ccc !important;}

View File

@ -1,3 +1,9 @@
/**
*
*/
.none {display:none !important;}
.block {display:block !important;}
/* 没数据 */
.table-no {text-align:center;padding:30px 0;background:#FFF !important; color: #888; }
@ -27,6 +33,8 @@
.chosen-choices { padding: 0px 3px !important; min-height: 32px; }
.chosen-container-single .chosen-single { height: 32px; line-height: 32px; }
.chosen-container-multi .chosen-choices li.search-field { padding-left: 3px; }
.chosen-container-single .chosen-single { color: #444 !important; }
.chosen-container-single .chosen-default { color: #999 !important; }
/**
*

View File

@ -1071,21 +1071,14 @@ $(function()
});
});
// 地区联动
$('.region-linkage select').on('change', function()
function RegionNodeData(value, name, next_name)
{
var temp_name = $(this).attr('name');
var find_all = (temp_name == 'province') ? ["city", "county"] : ((temp_name == 'city') ? ["county"] : 'no');
var name = (temp_name == 'province') ? 'city' : ((temp_name == 'city') ? 'county' : 'no');
var v = $(this).val();
var $this_next_obj = $('.region-linkage select[name='+name+']');
if(name !== 'no')
if(value != null)
{
$.ajax({
url:$(this).parent().data('url'),
url:$('.region-linkage').data('url'),
type:'POST',
data:{"pid": v},
data:{"pid": value},
dataType:'json',
success:function(result)
{
@ -1099,26 +1092,53 @@ $(function()
}
/* 下一级数据添加 */
$this_next_obj.append(html);
$('.region-linkage select[name='+next_name+']').append(html).trigger('chosen:updated');
} else {
Prompt(result.msg);
}
}
});
}
/* 子级元素数据清空 */
if(find_all != 'no')
/* 子级元素数据清空 */
var child = null;
switch(name)
{
case 'province' :
child = ['city', 'county'];
break;
case 'city' :
child = ['county'];
break;
}
if(child != null)
{
for(var i in child)
{
for(var i in find_all)
{
var $temp_obj = $('.region-linkage select[name='+find_all[i]+']');
var temp_find = $temp_obj.find('option').first().text();
var temp_html = '<option value="">'+temp_find+'</option>';
$temp_obj.html(temp_html);
}
var $temp_obj = $('.region-linkage select[name='+child[i]+']');
var temp_find = $temp_obj.find('option').first().text();
var temp_html = '<option value="">'+temp_find+'</option>';
$temp_obj.html(temp_html).trigger('chosen:updated');
}
}
}
// 地区联动
$('.region-linkage select').on('change', function()
{
var name = $(this).attr('name') || null;
var next_name = (name == 'province') ? 'city' : ((name == 'city') ? 'county' : null);
var value = $(this).val() || null;
if(next_name != null)
{
RegionNodeData(value, name, next_name);
}
});
if($('.region-linkage select').length > 0)
{
RegionNodeData(0, 'province', 'province');
}
// 根据字符串地址获取坐标位置
$('#map-location-submit').on('click', function()

View File

@ -0,0 +1,3 @@
.my-content { padding: 15px 10px; }
.region-linkage .chosen-select { display: -webkit-inline-box; width: calc(33.3% - 3px) !important; }
.region-linkage .chosen-select .chosen-single { width: 100%; }

View File

@ -15,33 +15,12 @@ $(function() {
// 弹出地址选择
var $ww = $(window).width();
$('.address-submit').click(function() {
// 禁止遮罩层下面的内容滚动
$(document.body).css("overflow","hidden");
$(this).addClass("selected");
$(this).parent().addClass("selected");
$('.theme-popover-mask').show();
$('.theme-popover-mask').height($(window).height());
$('.theme-popover').slideDown(200);
})
$('.theme-poptit .close,.btn-op .close').click(function() {
$(document.body).css("overflow","visible");
$('.address-submit').removeClass("selected");
$('.item-props-can').removeClass("selected");
$('.theme-popover-mask').hide();
$('.theme-popover').slideUp(200);
// 弹出地址选择
$('.address-submit').on('click', function()
{
ModalLoad($(this).data('url'), '地址管理', 'popup-modal-address', 'common-address-modal');
});
});