From 321aba9650b7bcb749d23909cc7b7fc33ca230bb Mon Sep 17 00:00:00 2001 From: devil_gong Date: Mon, 18 Nov 2019 18:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=AE=A2=E5=8D=95=E8=87=AA=E6=8F=90?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Buy.php | 4 +- application/index/view/default/buy/index.html | 183 +++++++++++++----- application/service/BuyService.php | 34 ++++ config/shopxo.php | 2 +- public/static/admin/default/css/site.css | 20 +- public/static/index/default/css/buy.css | 63 +++++- public/static/index/default/js/buy.js | 14 ++ 7 files changed, 262 insertions(+), 58 deletions(-) diff --git a/application/index/controller/Buy.php b/application/index/controller/Buy.php index d0f3db06a..c93df1ecd 100755 --- a/application/index/controller/Buy.php +++ b/application/index/controller/Buy.php @@ -15,7 +15,6 @@ use app\service\GoodsService; use app\service\UserService; use app\service\PaymentService; use app\service\BuyService; -use app\service\ConfigService; /** * 购买 @@ -87,7 +86,8 @@ class Buy extends Common $this->assign('payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); // 站点类型 - 自提模式下提货地址 - $this->assign('common_self_extraction_address', ConfigService::SiteTypeExtractionAddressList()); + $extraction_address = BuyService::SiteExtractionAddress($params); + $this->assign('self_extraction_address', $extraction_address['data']); // 页面数据 $this->assign('base', $ret['data']['base']); diff --git a/application/index/view/default/buy/index.html b/application/index/view/default/buy/index.html index 7f5e5de71..6a09a9815 100755 --- a/application/index/view/default/buy/index.html +++ b/application/index/view/default/buy/index.html @@ -43,59 +43,144 @@ {{/foreach}} {{/if}} - -
-
-

确认收货地址

- {{if !empty($user_address_list)}} - + + {{if $common_site_type eq 2}} + +
+
+

确认自提点地址

+ {{if !empty($self_extraction_address['default'])}} + + {{/if}} +
+ {{if empty($self_extraction_address['data_list'])}} +

请联系管理员配置自提点地址

+ {{else /}} + + {{if !empty($self_extraction_address['default'])}} +
+
+
+ +
+
+

+ {{if !empty($self_extraction_address['default']['alias'])}} + {{$self_extraction_address.default.alias}} + {{/if}} + {{$self_extraction_address.default.name}} + {{$self_extraction_address.default.tel}} +

+

+ {{$self_extraction_address.default.province_name}} + {{$self_extraction_address.default.city_name}} + {{$self_extraction_address.default.county_name}} + {{$self_extraction_address.default.address}} +

+
+
+ +
+
+
+ {{else /}} +
+ + 没有地址 + +
+ {{/if}} + + +
+
+
+

自提点选择

+ × +
+
+
    + {{foreach $self_extraction_address.data_list as $key=>$address}} +
  • +

    + {{if !empty($address['alias'])}} + {{$address.alias}} + {{/if}} + {{$address.name}} + {{$address.tel}} +

    +

    + {{$address.province_name}} + {{$address.city_name}} + {{$address.county_name}} + {{$address.address}} +

    + {{if !isset($params['address_id']) or $params['address_id'] neq $key}} + + {{/if}} +
  • + {{/foreach}} +
+
+
+
{{/if}}
- {{if !empty($user_address_list)}} -
    - {{foreach $user_address_list as $address}} -
  • -
    -
    - {{if !empty($address.alias)}} - {{$address.alias}} - {{/if}} - {{if isset($address['is_default']) and $address['is_default'] eq 1}} - 默认 - {{/if}} - - {{$address.name}} - {{$address.tel}} - + {{else /}} + +
    +
    +

    确认收货地址

    + {{if !empty($user_address_list)}} + + {{/if}} +
    + {{if !empty($user_address_list)}} +
      + {{foreach $user_address_list as $address}} +
    • +
      +
      + {{if !empty($address.alias)}} + {{$address.alias}} + {{/if}} + {{if isset($address['is_default']) and $address['is_default'] eq 1}} + 默认 + {{/if}} + + {{$address.name}} + {{$address.tel}} + +
      +
      + {{$address.province_name}} + {{$address.city_name}} + {{$address.county_name}} + {{$address.address}} +
      -
      - {{$address.province_name}} - {{$address.city_name}} - {{$address.county_name}} - {{$address.address}} +
      +
      -
      -
      - -
      - -
    • - {{/foreach}} -
    - {{/if}} - {{if empty($user_address_list)}} -
    - - 没有地址 -
    - {{/if}} -
    + +
  • + {{/foreach}} +
+ {{else /}} +
+ + 没有地址 + +
+ {{/if}} +
+ {{/if}} {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} diff --git a/application/service/BuyService.php b/application/service/BuyService.php index 89b9ab2d0..44cd8bd83 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -15,6 +15,7 @@ use think\facade\Hook; use app\service\GoodsService; use app\service\UserService; use app\service\ResourcesService; +use app\service\ConfigService; /** * 购买服务层 @@ -1243,5 +1244,38 @@ class BuyService } return DataReturn('没有需要回滚的数据', 0); } + + /** + * 自提点地址选中地址获取 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-11-18 + * @desc description + * @param [int] $params['address_id'] [自提点地址索引值] + * @param [array] $params['address_id'] [自提点地址列表] + */ + public static function SiteExtractionAddress($params = []) + { + // 自提地址列表 + $address = ConfigService::SiteTypeExtractionAddressList(); + + // 选中地址处理 + $default = null; + if(isset($params['address_id']) && !empty($address['data']) && is_array($address['data'])) + { + if(isset($address['data'][$params['address_id']])) + { + $default = $address['data'][$params['address_id']]; + } + } + + // 返回数据 + $result = [ + 'data_list' => $address['data'], + 'default' => $default, + ]; + return DataReturn('操作成功', 0, $result); + } } ?> \ No newline at end of file diff --git a/config/shopxo.php b/config/shopxo.php index c7111a6b0..586bb6b24 100755 --- a/config/shopxo.php +++ b/config/shopxo.php @@ -15,7 +15,7 @@ return [ // 开发模式 - 'is_develop' => true, + 'is_develop' => false, // 默认编码 'default_charset' => 'utf-8', diff --git a/public/static/admin/default/css/site.css b/public/static/admin/default/css/site.css index fdf516201..c12668531 100755 --- a/public/static/admin/default/css/site.css +++ b/public/static/admin/default/css/site.css @@ -49,10 +49,24 @@ ul.home_site_user_register_bg_images-images-view li { .address-detail, #map { border-bottom: 0 !important; } -.address-list { - padding: 0 20% 0 0 !important; -} .address-list .edit-submit, .address-list .delete-submit { cursor: pointer; +} +@media only screen and (min-width:640px) { + .address-list { + padding: 0 20% 0 0 !important; + } +} +@media only screen and (max-width:640px) { + .address-list .edit-submit, + .address-list .delete-submit { + position: absolute; + top: 12px; + right: 5px; + float: none !important; + } + .address-list .delete-submit { + right: 70px; + } } \ No newline at end of file diff --git a/public/static/index/default/css/buy.css b/public/static/index/default/css/buy.css index 32e642c9a..e57115060 100755 --- a/public/static/index/default/css/buy.css +++ b/public/static/index/default/css/buy.css @@ -1,5 +1,5 @@ /*页面*/ -.buy-items h3{border-bottom: 3px solid #e3e3e3; margin-top:15px;} +.buy-items h3{border-bottom: 2px solid #e3e3e3; margin-top:15px;} /*地址管理*/ h3 { font-size: 14px;font-weight: 700;} @@ -161,7 +161,7 @@ ul.address-list, .business-item ul { overflow: hidden; } .pay-confirm .nav-total-price { color: #d2364c; font-weight: 700; } .order-nav { background: #f5f5f5; z-index: 100; } .am-footer { padding-bottom: 45px; } -} +} /** @@ -190,5 +190,62 @@ strong.total-price-content { color: #d2364c; font-size: 16px; } .cart-content table tr .number { width: 20%; } .cart-content table tr .total-price { width: 20%; } .cart-content { margin-top: 20px; } -} +} + +/** + * 自提地址 + */ +.extraction-address-item { + box-shadow: none; +} +.extraction-address-item .first-icon { + width: 15px; +} +.extraction-address-item .first-icon i { + color: #666; +} +.extraction-address-item .address-detail { + margin-top: 2px; +} +@media only screen and (min-width: 640px) { + .extraction-address { + padding: 0 5px; + } +} +@media only screen and (min-width: 1025px) { + .extraction-address { + padding: 0; + } +} +@media only screen and (max-width: 640px) { + .extraction-default { + background: url(../images/buy-peraddress.png) repeat-x; + background-position: bottom; + border: 0; + } + .extraction-default .am-panel-bd { + padding: 20px 5px; + } + .extraction-default .am-panel-bd .address-right { + padding-top: 5px; + } +} +/** + * 自提地址-弹层 + */ +#extraction-address-popup .am-list { + margin-top: 0; +} +#extraction-address-popup .am-list > li { + padding: 10px 5px; + border-color: #eee; +} +#extraction-address-popup .am-list > li:first-child { + border-top: 0; +} +#extraction-address-popup .extraction-address-item button { + position: absolute; + top: 15px; + right: 5px; +} diff --git a/public/static/index/default/js/buy.js b/public/static/index/default/js/buy.js index 220c4328f..b321e8393 100755 --- a/public/static/index/default/js/buy.js +++ b/public/static/index/default/js/buy.js @@ -119,5 +119,19 @@ $(function() $('form.nav-buy input[name=payment_id]').val(payment_id); $('form.nav-buy input[name=user_note]').val($('.order-user-info input.memo-input').val()); }); + + // 自提点地址 + $extraction_popup = $('#extraction-address-popup'); + $extraction_popup.find('.extraction-address-item button').on('click', function() + { + window.location.href = UrlFieldReplace('address_id', $(this).data('value')); + }); + $('.extraction-default .extraction-address-item').on('click', function(e) + { + if($(window).width() < 640) + { + $extraction_popup.modal(); + } + }); }); \ No newline at end of file