mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-01 11:29:59 +08:00
用户地址管理
This commit is contained in:
parent
60868e4afe
commit
b76c27129c
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Home\Controller;
|
namespace Home\Controller;
|
||||||
|
|
||||||
use Service\BuyService;
|
|
||||||
use Service\UserService;
|
use Service\UserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,15 +38,9 @@ class UserAddressController extends CommonController
|
|||||||
*/
|
*/
|
||||||
public function Index()
|
public function Index()
|
||||||
{
|
{
|
||||||
$cart_list = BuyService::CartList(['user'=>$this->user]);
|
// 用户地址
|
||||||
$this->assign('cart_list', $cart_list['data']);
|
$this->assign('user_address_list', UserService::UserAddressList(['user'=>$this->user])['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');
|
$this->display('Index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,13 @@ return array(
|
|||||||
'is_show' => 1,
|
'is_show' => 1,
|
||||||
'icon' => 'am-icon-gear',
|
'icon' => 'am-icon-gear',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'control' => 'UserAddress',
|
||||||
|
'action' => 'Index',
|
||||||
|
'name' => '我的地址',
|
||||||
|
'is_show' => 1,
|
||||||
|
'icon' => 'am-icon-map-marker',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'control' => 'Safety',
|
'control' => 'Safety',
|
||||||
'action' => 'Index',
|
'action' => 'Index',
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<div class="control">
|
<div class="control">
|
||||||
<h3>确认收货地址</h3>
|
<h3>确认收货地址</h3>
|
||||||
<notempty name="user_address_list">
|
<notempty name="user_address_list">
|
||||||
<button class="am-btn am-btn-primary am-btn-xs address-submit-save" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}">使用新地址</button>
|
<button class="am-btn am-btn-primary am-btn-xs address-submit-save" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}" data-popup-title="新增地址">使用新地址</button>
|
||||||
</notempty>
|
</notempty>
|
||||||
</div>
|
</div>
|
||||||
<notempty name="user_address_list">
|
<notempty name="user_address_list">
|
||||||
@ -30,6 +30,9 @@
|
|||||||
<li class="<if condition="isset($address['is_default']) and $address['is_default'] eq 1">address-default</if>" id="data-list-{{$address.id}}" data-value="{{$address.id}}">
|
<li class="<if condition="isset($address['is_default']) and $address['is_default'] eq 1">address-default</if>" id="data-list-{{$address.id}}" data-value="{{$address.id}}">
|
||||||
<div class="address-left">
|
<div class="address-left">
|
||||||
<div class="user-base">
|
<div class="user-base">
|
||||||
|
<notempty name="address.alias">
|
||||||
|
<span class="am-badge am-badge-danger am-radius">{{$address.alias}}</span>
|
||||||
|
</notempty>
|
||||||
<span class="buy-address-detail">
|
<span class="buy-address-detail">
|
||||||
<span class="buy-user">{{$address.name}}</span>
|
<span class="buy-user">{{$address.name}}</span>
|
||||||
<span class="buy-phone">{{$address.tel}}</span>
|
<span class="buy-phone">{{$address.tel}}</span>
|
||||||
@ -37,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="buy-line-title buy-line-title-type">收货地址:</span>
|
<span class="buy-line-title buy-line-title-type">收货地址:</span>
|
||||||
<span class="buy--address-detail">
|
<span class="buy-address-detail">
|
||||||
<span class="province">{{$address.province_name}}</span>
|
<span class="province">{{$address.province_name}}</span>
|
||||||
<span class="city">{{$address.city_name}}</span>
|
<span class="city">{{$address.city_name}}</span>
|
||||||
<span class="dist">{{$address.county_name}}</span>
|
<span class="dist">{{$address.county_name}}</span>
|
||||||
@ -54,7 +57,7 @@
|
|||||||
<div class="new-addr-btn">
|
<div class="new-addr-btn">
|
||||||
<a href="javascript:;" class="address-default-submit" data-url="{{:U('Home/UserAddress/SetDefault')}}" data-id="{{$address.id}}">设为默认</a>
|
<a href="javascript:;" class="address-default-submit" data-url="{{:U('Home/UserAddress/SetDefault')}}" data-id="{{$address.id}}">设为默认</a>
|
||||||
<span class="new-addr-bar">|</span>
|
<span class="new-addr-bar">|</span>
|
||||||
<a href="javascript:;" class="address-submit-save" data-url="{{:U('Home/UserAddress/SaveInfo', ['id'=>$address['id']])}}">编辑</a>
|
<a href="javascript:;" class="address-submit-save" data-url="{{:U('Home/UserAddress/SaveInfo', ['id'=>$address['id']])}}" data-popup-title="编辑地址">编辑</a>
|
||||||
<span class="new-addr-bar">|</span>
|
<span class="new-addr-bar">|</span>
|
||||||
<a href="javascript:;" class="address-submit-delete" data-url="{{:U('Home/UserAddress/Delete')}}" data-id="{{$address.id}}">删除</a>
|
<a href="javascript:;" class="address-submit-delete" data-url="{{:U('Home/UserAddress/Delete')}}" data-id="{{$address.id}}">删除</a>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +69,7 @@
|
|||||||
<div class="table-no">
|
<div class="table-no">
|
||||||
<i class="am-icon-warning"></i>
|
<i class="am-icon-warning"></i>
|
||||||
{{:L('buy_user_address_not_data_tips')}}
|
{{:L('buy_user_address_not_data_tips')}}
|
||||||
<button class="am-btn am-btn-secondary am-btn-xs address-submit-save" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}">使用新地址</button></div>
|
<button class="am-btn am-btn-secondary am-btn-xs address-submit-save" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}" data-popup-title="新增地址">使用新地址</button></div>
|
||||||
</empty>
|
</empty>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
73
service/Application/Home/View/Default/UserAddress/Index.html
Normal file
73
service/Application/Home/View/Default/UserAddress/Index.html
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<include file="Public/Header" />
|
||||||
|
|
||||||
|
<!-- header top nav -->
|
||||||
|
<include file="Public/HeaderTopNav" />
|
||||||
|
|
||||||
|
<!-- search -->
|
||||||
|
<include file="Public/NavSearch" />
|
||||||
|
|
||||||
|
<!-- header nav -->
|
||||||
|
<include file="Public/HeaderNav" />
|
||||||
|
|
||||||
|
<!-- goods category -->
|
||||||
|
<include file="Public/GoodsCategory" />
|
||||||
|
|
||||||
|
<!-- content -->
|
||||||
|
<div class="am-container user-main">
|
||||||
|
|
||||||
|
<!-- user menu start -->
|
||||||
|
<include file="Public/UserMenu" />
|
||||||
|
<!-- user menu end -->
|
||||||
|
|
||||||
|
<!-- content start -->
|
||||||
|
<div class="user-content">
|
||||||
|
<div class="user-content-body">
|
||||||
|
<div class="control">
|
||||||
|
<button class="am-btn am-btn-primary am-btn-xs am-icon-plus address-submit-save" type="button" data-url="{{:U('Home/UserAddress/SaveInfo')}}" data-popup-title="新增地址"> 新增新地址</button>
|
||||||
|
</div>
|
||||||
|
<notempty name="user_address_list">
|
||||||
|
<ul class="address-list">
|
||||||
|
<foreach name="user_address_list" item="address">
|
||||||
|
<li class="<if condition="isset($address['is_default']) and $address['is_default'] eq 1">address-default</if>" id="data-list-{{$address.id}}" data-value="{{$address.id}}">
|
||||||
|
<div class="address-left">
|
||||||
|
<div class="user-base">
|
||||||
|
<notempty name="address.alias">
|
||||||
|
<span class="am-badge am-badge-danger am-radius">{{$address.alias}}</span>
|
||||||
|
</notempty>
|
||||||
|
<span class="buy-address-detail">
|
||||||
|
<span class="buy-user">{{$address.name}}</span>
|
||||||
|
<span class="buy-phone">{{$address.tel}}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="buy-line-title buy-line-title-type">收货地址:</span>
|
||||||
|
<span class="buy-address-detail">
|
||||||
|
<span class="province">{{$address.province_name}}</span>
|
||||||
|
<span class="city">{{$address.city_name}}</span>
|
||||||
|
<span class="dist">{{$address.county_name}}</span>
|
||||||
|
<span class="street">{{$address.address}}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<if condition="isset($address['is_default']) and $address['is_default'] eq 1">
|
||||||
|
<span class="deftip">默认地址</span>
|
||||||
|
</if>
|
||||||
|
</div>
|
||||||
|
<div class="new-addr-btn">
|
||||||
|
<a href="javascript:;" class="address-default-submit" data-url="{{:U('Home/UserAddress/SetDefault')}}" data-id="{{$address.id}}" data-view="reload">设为默认</a>
|
||||||
|
<span class="new-addr-bar">|</span>
|
||||||
|
<a href="javascript:;" class="address-submit-save" data-url="{{:U('Home/UserAddress/SaveInfo', ['id'=>$address['id']])}}" data-popup-title="编辑地址">编辑</a>
|
||||||
|
<span class="new-addr-bar">|</span>
|
||||||
|
<a href="javascript:;" class="address-submit-delete" data-url="{{:U('Home/UserAddress/Delete')}}" data-id="{{$address.id}}">删除</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</foreach>
|
||||||
|
</ul>
|
||||||
|
</notempty>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- content end -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- footer start -->
|
||||||
|
<include file="Public/Footer" />
|
||||||
|
<!-- footer end -->
|
@ -667,7 +667,7 @@ background:url(../Images/ibar_sprites.png) no-repeat;background-position:0px -23
|
|||||||
.user-content-body {-webkit-box-flex:1;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto; }
|
.user-content-body {-webkit-box-flex:1;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto; }
|
||||||
.user-offcanvas-bar { z-index: 900; }
|
.user-offcanvas-bar { z-index: 900; }
|
||||||
@media only screen and (min-width:640px) {
|
@media only screen and (min-width:640px) {
|
||||||
.user-sidebar {display:block;position:static;background:none; border-top: 5px solid #f78590;}
|
.user-sidebar {display:block;position:static;background:none; border-top: 5px solid #e94353;}
|
||||||
.user-offcanvas-bar {position:static;width:auto;background:none;-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0);overflow-y:hidden;}
|
.user-offcanvas-bar {position:static;width:auto;background:none;-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0);overflow-y:hidden;}
|
||||||
.user-offcanvas-bar:after {content:none;}
|
.user-offcanvas-bar:after {content:none;}
|
||||||
.user-main { padding: 0 5px; }
|
.user-main { padding: 0 5px; }
|
||||||
|
@ -1,4 +1,76 @@
|
|||||||
.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%; }
|
*/
|
||||||
#map { width: 100%; height: 250px; }
|
ul.address-list {
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.address-list li.address-default {
|
||||||
|
background-image: url(../Images/peraddressbg.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.address-list li {
|
||||||
|
display: block;
|
||||||
|
width: calc(50% - 5px);
|
||||||
|
height: 150px;
|
||||||
|
float: left;
|
||||||
|
background-image: url(../Images/peraddbg.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
margin: 0 10px 10px 0;
|
||||||
|
padding: 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.address-list li .user-base {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-addr-btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 25px;
|
||||||
|
color: #282828;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.address-list li:nth-child(2n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 1025px) {
|
||||||
|
ul.address-list li {
|
||||||
|
width: calc(25% - 8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.address-list li:nth-child(2n) {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
ul.address-list li:nth-child(4n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址添加/编辑
|
||||||
|
*/
|
||||||
|
.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%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
}
|
@ -93,7 +93,7 @@ $(function()
|
|||||||
// 弹出地址选择
|
// 弹出地址选择
|
||||||
$('.address-submit-save').on('click', function(e)
|
$('.address-submit-save').on('click', function(e)
|
||||||
{
|
{
|
||||||
ModalLoad($(this).data('url'), '地址管理', 'popup-modal-address', 'common-address-modal');
|
ModalLoad($(this).data('url'), $(this).data('popup-title'), 'popup-modal-address', 'common-address-modal');
|
||||||
|
|
||||||
// 阻止事件冒泡
|
// 阻止事件冒泡
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
25
service/Public/Home/Default/Js/UserAddress.js
Normal file
25
service/Public/Home/Default/Js/UserAddress.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
$(function()
|
||||||
|
{
|
||||||
|
// 弹出地址选择
|
||||||
|
$('.address-submit-save').on('click', function(e)
|
||||||
|
{
|
||||||
|
ModalLoad($(this).data('url'), $(this).data('popup-title'), 'popup-modal-address', 'common-address-modal');
|
||||||
|
|
||||||
|
// 阻止事件冒泡
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 阻止事件冒泡
|
||||||
|
$('.address-submit-delete').on('click', function(e)
|
||||||
|
{
|
||||||
|
DataDelete($(this));
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设为默认地址
|
||||||
|
$('.address-default-submit').on('click', function(e)
|
||||||
|
{
|
||||||
|
ConfirmNetworkAjax($(this));
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user