diff --git a/application/index/view/default/buy/index.html b/application/index/view/default/buy/index.html index a68dffd47ff9729a599767a45f7133f75b03c2bd..f2a69029d3e92f50726e116f4c998881828e7fb3 100755 --- a/application/index/view/default/buy/index.html +++ b/application/index/view/default/buy/index.html @@ -43,9 +43,19 @@ {{/foreach}} {{/if}} + + {{if $common_site_type eq 4}} +
+ +
+ {{/if}} + - {{if $common_site_type eq 0}} -
+ {{if $common_site_type eq 0 or ($common_site_type eq 4 and (!isset($params['site_model']) or isset($params['site_model']) and $params.site_model eq 0))}} +

确认收货地址 @@ -100,14 +110,15 @@

{{/if}}
+ {{/if}} - {{elseif $common_site_type eq 2 /}} -
+ {{if $common_site_type eq 2 or ($common_site_type eq 4 and isset($params['site_model']) and $params.site_model eq 2)}} +

确认自提点地址

{{if !empty($base['address'])}} - + {{/if}}
{{if empty($base['extraction_address'])}} @@ -144,7 +155,7 @@
没有地址 - +
{{/if}} @@ -175,7 +186,9 @@ 查看地图 {{/if}}

- {{if !isset($params['address_id']) or $params['address_id'] neq $key}} + {{if (isset($params['address_id']) and $params['address_id'] eq $key) or (!empty($base['address']) and $base.address.id eq $key)}} + + {{else /}} {{/if}} @@ -435,6 +448,7 @@ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
diff --git a/application/lang/zh-cn.php b/application/lang/zh-cn.php index 2a451bea69e2c000a2bd4fa86aba105d93040f46..4cca2e60ed1f0bab61054a8175900fbe8552ffdf 100755 --- a/application/lang/zh-cn.php +++ b/application/lang/zh-cn.php @@ -345,6 +345,7 @@ return array( 1 => array('value' => 1, 'name' => '展示型'), 2 => array('value' => 2, 'name' => '自提点'), 3 => array('value' => 3, 'name' => '虚拟销售'), + 4 => array('value' => 4, 'name' => '销售+自提型'), ), diff --git a/application/service/BuyService.php b/application/service/BuyService.php index e5b93363744fdb43bf70da453655ab160e279374..c270776d6fcd0ccaf48f870085446f2562643d09 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -612,39 +612,45 @@ class BuyService // 商品数据 $goods = $ret['data']; - // 站点模式 2自提模式, 则其它正常模式 + // 站点模式 0销售, 2自提, 4销售+自提, 则其它正常模式 + $common_site_type = MyC('common_site_type', 0, true); + $site_model = isset($params['site_model']) ? intval($params['site_model']) : -1; + + // 数据处理 $address = null; $extraction_address = []; - switch(MyC('common_site_type', 0, true)) + + // 站点模式 - 用户收货地址(未选择则取默认地址) + // 销售, 销售+自提(指定为销售) + if($common_site_type == 0 || ($common_site_type == 4 && $site_model == 0)) { - // 站点模式 - 用户收货地址(未选择则取默认地址) - case 0 : - $address_params = [ - 'user' => $params['user'], - ]; - if(!empty($params['address_id'])) - { - $address_params['where'] = ['id' => $params['address_id']]; - } - $ads = UserService::UserDefaultAddress($address_params); - if(!empty($ads['data'])) - { - $address = $ads['data']; - } - break; + $address_params = [ + 'user' => $params['user'], + ]; + if(!empty($params['address_id'])) + { + $address_params['where'] = ['id' => $params['address_id']]; + } + $ads = UserService::UserDefaultAddress($address_params); + if(!empty($ads['data'])) + { + $address = $ads['data']; + } + } - // 自提模式 - 自提点地址 - case 2 : - $extraction = self::SiteExtractionAddress($params); - if(!empty($extraction['data']['data_list'])) - { - $extraction_address = $extraction['data']['data_list']; - } - if(!empty($extraction['data']['default'])) - { - $address = $extraction['data']['default']; - } - break; + // 自提模式 - 自提点地址 + // 自提, 销售+自提(指定为自提) + if($common_site_type == 2 || ($common_site_type == 4 && $site_model == 2)) + { + $extraction = self::SiteExtractionAddress($params); + if(!empty($extraction['data']['data_list'])) + { + $extraction_address = $extraction['data']['data_list']; + } + if(!empty($extraction['data']['default'])) + { + $address = $extraction['data']['default']; + } } // 商品/基础信息 @@ -813,6 +819,9 @@ class BuyService return DataReturn('展示型不允许提交订单', -1); } + // 销售+自提, 用户自选站点类型 + $site_model = ($common_site_type == 4) ? (isset($params['site_model']) ? intval($params['site_model']) : 0) : $common_site_type; + // 请求参数 $p = [ [ @@ -820,15 +829,10 @@ class BuyService 'key_name' => 'user', 'error_msg' => '用户信息有误', ], - [ - 'checked_type' => 'isset', - 'key_name' => 'address_id', - 'error_msg' => '请选择地址', - ], ]; - // 销售型, 自提点则校验地址 - if(in_array($common_site_type, [0,2])) + // // 销售型,自提点,销售+自提 则校验地址 + if(in_array($site_model, [0,2])) { $p[] = [ 'checked_type' => 'isset', @@ -872,9 +876,9 @@ class BuyService return $check; } - // 销售型,自提点 地址处理 + // 销售型,自提点,销售+自提 地址处理 $address = []; - if(in_array($common_site_type, [0, 2])) + if(in_array($site_model, [0,2])) { if(empty($buy['data']['base']['address'])) { @@ -898,7 +902,7 @@ class BuyService 'payment_id' => isset($params['payment_id']) ? intval($params['payment_id']) : 0, 'buy_number_count' => array_sum(array_column($buy['data']['goods'], 'stock')), 'client_type' => (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE, - 'order_model' => $common_site_type, + 'order_model' => $site_model, 'add_time' => time(), ]; if($order['status'] == 1) @@ -941,7 +945,7 @@ class BuyService } // 订单模式 - 虚拟信息添加 - if($common_site_type == 3) + if($site_model == 3) { $ret = self::OrderFictitiousValueInsert($order_id, $detail_ret['data'], $params['user']['id'], $v['goods_id']); if($ret['code'] != 0) @@ -953,8 +957,8 @@ class BuyService } // 订单模式处理 - // 销售型模式+自提模式 - if(in_array($common_site_type, [0,2])) + // 销售型模式,自提模式,销售+自提 + if(in_array($site_model, [0,2])) { // 添加订单(收货|取货)地址 if(!empty($address)) @@ -968,7 +972,7 @@ class BuyService } // 自提模式 添加订单取货码 - if($common_site_type == 2) + if($site_model == 2) { $ret = self::OrderExtractionCcodeInsert($order_id, $params['user']['id']); if($ret['code'] != 0) @@ -1675,6 +1679,19 @@ class BuyService } } + // 默认地址 + if(empty($default) && !empty($address['data'])) + { + foreach($address['data'] as $v) + { + if(isset($v['is_default']) && $v['is_default'] == 1) + { + $default = $v; + break; + } + } + } + // 返回数据 $result = [ 'data_list' => $address['data'], diff --git a/application/tags.php b/application/tags.php index cfd1e60684d8b1b193ae10079f8d1f3c785d6718..527434a7d82e6a0491c8b159f9e4607f017feb2f 100755 --- a/application/tags.php +++ b/application/tags.php @@ -140,7 +140,6 @@ return array ( array ( 0 => 'app\\plugins\\coupon\\Hook', 1 => 'app\\plugins\\distribution\\Hook', - 2 => 'app\\plugins\\fictitioussecretkey\\Hook', ), 'plugins_service_user_register_end' => array ( diff --git a/config/shopxo.php b/config/shopxo.php index b87ec028dce7fdb3285f5bbe819f6ec04578fb35..496abba6e3ee55d28323573cd1eb68487c1f52da 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/common/js/common.js b/public/static/common/js/common.js index d3e3e12bc741d5070de44a17103b5b53eb4eef95..b114935c1d0905a28ccf670f40100d62289159ce 100755 --- a/public/static/common/js/common.js +++ b/public/static/common/js/common.js @@ -1124,7 +1124,7 @@ function FullscreenEscEvent() * @date 2019-03-20 * @desc description * @param {[string]} field [字段名称] - * @param {[string]} value [字段值] + * @param {[string]} value [字段值, null 则去除字段] * @param {[string]} url [自定义url] */ function UrlFieldReplace(field, value, url) @@ -1150,7 +1150,12 @@ function UrlFieldReplace(field, value, url) var last = str.substr(str.lastIndexOf(field)); last = last.replace(new RegExp(field+'/', 'g'), ''); last = (last.indexOf('/') >= 0) ? last.substr(last.indexOf('/')) : ''; - url = first+field+'/'+value+last+ext; + if(value === null) + { + url = first+last+ext; + } else { + url = first+field+'/'+value+last+ext; + } } else { if(ext.indexOf('?') >= 0) { @@ -1171,22 +1176,38 @@ function UrlFieldReplace(field, value, url) } if(temp[0] == field) { - p += field+'='+value; + if(value !== null) + { + p += field+'='+value; + } } else { p += params_all[i]; } } } } else { - p = exts+'&'+field+'='+value; + if(value === null) + { + p = exts; + } else { + p = exts+'&'+field+'='+value; + } } url = str+(ext.substr(0, ext.indexOf('?')))+'?'+p; } else { - url = str+'/'+field+'/'+value+ext; + if(value === null) + { + url = str+ext; + } else { + url = str+'/'+field+'/'+value+ext; + } } } } else { - url += '?'+field+'='+value; + if(value !== null) + { + url += '?'+field+'='+value; + } } return url+anchor; } diff --git a/public/static/index/default/css/buy.css b/public/static/index/default/css/buy.css index d50b0509867b15aa409c31cf5885608bdff129fa..49bb406934af3af754be9348c7edbbdb9007f913 100755 --- a/public/static/index/default/css/buy.css +++ b/public/static/index/default/css/buy.css @@ -121,7 +121,8 @@ ul.address-list, .business-item ul { overflow: hidden; } /*地址操作*/ .address-operation-btn {display:block;position: absolute;bottom:25px ;right:10px ;} - .address-right .am-icon-angle-right { display: none; } + .address-right .am-icon-angle-right, + .mobile-address-close-submit { display: none; } } @media only screen and (min-width:1025px) { @@ -208,12 +209,12 @@ strong.total-price-content { color: #d2364c; font-size: 16px; } margin-top: 2px; } @media only screen and (min-width: 640px) { - .extraction-address { + .extraction-address-container { padding: 0 5px; } } @media only screen and (min-width: 1025px) { - .extraction-address { + .extraction-address-container { padding: 0; } } @@ -280,3 +281,20 @@ strong.total-price-content { color: #d2364c; font-size: 16px; } width: 100%; height: calc(100% - 43px); } + +/** + * 销售+自提导航 + */ +@media only screen and (min-width: 640px) { + .buy-header-nav { + margin-top: 10px; + margin-left: 5px; + margin-right: 5px; + } +} +@media only screen and (min-width: 1025px) { + .buy-header-nav { + margin-left: 0; + margin-right: 0; + } +} \ No newline at end of file diff --git a/public/static/index/default/js/buy.js b/public/static/index/default/js/buy.js index f72345f45a888026e6e9611b4bf34a5d1e5f4cc5..f868002ccd9c2fef12981c1e61bc717fccf219c6 100755 --- a/public/static/index/default/js/buy.js +++ b/public/static/index/default/js/buy.js @@ -153,4 +153,12 @@ $(function() { $extraction_map_container.hide(); }); + + // 销售+自提 切换 + $('.buy-header-nav li a').on('click', function() + { + var value = $(this).data('value') || 0; + var url = UrlFieldReplace('address_id', null); + window.location.href = UrlFieldReplace('site_model', value, url); + }); }); \ No newline at end of file