新增销售+自提模式并行
parent
89ecb43b53
commit
7a70c4a819
|
|
@ -43,9 +43,19 @@
|
|||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 销售+自提 -->
|
||||
{{if $common_site_type eq 4}}
|
||||
<div data-am-widget="tabs" class="am-tabs am-tabs-d2 buy-header-nav">
|
||||
<ul class="am-tabs-nav am-cf">
|
||||
<li {{if !isset($params['site_model']) or (isset($params['site_model']) and $params.site_model eq 0)}}class="am-active"{{/if}}><a href="javascript:;" data-value="0">快递邮寄</a></li>
|
||||
<li {{if isset($params['site_model']) and $params.site_model eq 2}}class="am-active"{{/if}}><a href="javascript:;" data-value="2">自提点取货</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<!-- 销售型 - 用户地址 -->
|
||||
{{if $common_site_type eq 0}}
|
||||
<div class="address">
|
||||
{{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))}}
|
||||
<div class="address user-address-container">
|
||||
<div class="control">
|
||||
<h3>
|
||||
<span>确认收货地址</span>
|
||||
|
|
@ -100,14 +110,15 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<!-- 自提点 - 自提地址 -->
|
||||
{{elseif $common_site_type eq 2 /}}
|
||||
<div class="address extraction-address">
|
||||
{{if $common_site_type eq 2 or ($common_site_type eq 4 and isset($params['site_model']) and $params.site_model eq 2)}}
|
||||
<div class="address extraction-address-container">
|
||||
<div class="control">
|
||||
<h3>确认自提点地址</h3>
|
||||
{{if !empty($base['address'])}}
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary am-radius" data-am-modal="{target: '#extraction-address-popup'}">选择地址</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary am-radius" data-am-modal="{target: '#extraction-address-popup'}">选择取货地址</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{if empty($base['extraction_address'])}}
|
||||
|
|
@ -144,7 +155,7 @@
|
|||
<div class="table-no">
|
||||
<i class="am-icon-warning"></i>
|
||||
<span>没有地址</span>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary am-radius am-margin-left-sm" data-am-modal="{target: '#extraction-address-popup'}">选择地址</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-secondary am-radius am-margin-left-sm" data-am-modal="{target: '#extraction-address-popup'}">选择取货地址</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -175,7 +186,9 @@
|
|||
<a href="javascript:;" class="am-badge am-radius extraction-address-map-submit am-icon-map-marker am-margin-left-sm" data-lng="{{$address.lng}}" data-lat="{{$address.lat}}"> 查看地图</a>
|
||||
{{/if}}
|
||||
</p>
|
||||
{{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)}}
|
||||
<button type="button" class="am-btn am-btn-default am-radius" disabled>已选</button>
|
||||
{{else /}}
|
||||
<button type="button" class="am-btn am-btn-default am-radius" data-value="{{$key}}">选择</button>
|
||||
{{/if}}
|
||||
</li>
|
||||
|
|
@ -435,6 +448,7 @@
|
|||
<input type="hidden" name="address_id" value="{{if isset($base['address']) and isset($base['address']['id'])}}{{$base.address.id}}{{else /}}{{if isset($params['address_id'])}}{{$params.address_id}}{{else /}}-1{{/if}}{{/if}}" />
|
||||
<input type="hidden" name="payment_id" value="{{if isset($params['payment_id'])}}{{$params.payment_id}}{{else /}}0{{/if}}" />
|
||||
<input type="hidden" name="user_note" value="" />
|
||||
<input type="hidden" name="site_model" value="{{if isset($params['site_model'])}}{{$params.site_model}}{{else /}}0{{/if}}" />
|
||||
<!-- 订单确认页面提交订单表单内部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
|
||||
<div class="plugins-tag">
|
||||
|
|
|
|||
|
|
@ -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' => '销售+自提型'),
|
||||
),
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
// 站点模式 - 用户收货地址(未选择则取默认地址)
|
||||
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;
|
||||
|
||||
// 自提模式 - 自提点地址
|
||||
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 == 0 || ($common_site_type == 4 && $site_model == 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'];
|
||||
}
|
||||
}
|
||||
|
||||
// 自提模式 - 自提点地址
|
||||
// 自提, 销售+自提(指定为自提)
|
||||
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'],
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
return [
|
||||
// 开发模式
|
||||
'is_develop' => true,
|
||||
'is_develop' => false,
|
||||
|
||||
// 默认编码
|
||||
'default_charset' => 'utf-8',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue