订单确认

feat/task1-c-wallet
devil_gong 2018-09-25 18:50:24 +08:00
parent b76c054122
commit b859b63114
8 changed files with 116 additions and 25 deletions

View File

@ -79,6 +79,7 @@ class BuyController extends CommonController
$this->assign('base', $base);
$this->assign('goods_list', $ret['data']);
$this->assign('params', $params);
$this->display('Index');
} else {
$this->assign('msg', isset($ret['msg']) ? $ret['msg'] : L('common_param_error'));
@ -89,5 +90,24 @@ class BuyController extends CommonController
$this->display('/Public/TipsError');
}
}
/**
* 订单添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-25
* @desc description
*/
public function Add()
{
if(IS_POST)
{
print_r($_POST);
} else {
$this->assign('msg', L('common_unauthorized_access'));
$this->display('/Public/TipsError');
}
}
}
?>

View File

@ -27,7 +27,7 @@
<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}}">
<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">
<span class="buy-address-detail">
@ -72,7 +72,7 @@
<!-- 物流 -->
<div class="business-item logistics" data-type="logistics">
<h3>选择物流方式</h3>
<h3>选择快递</h3>
<notempty name="express_list">
<ul class="logistics-list">
<foreach name="express_list" item="express">
@ -93,7 +93,7 @@
<!-- 支付方式 -->
<div class="business-item payment" data-type="payment">
<h3>选择支付方式</h3>
<h3>选择支付</h3>
<notempty name="payment_list">
<ul class="payment-list">
<foreach name="payment_list" item="payment">
@ -236,12 +236,18 @@
</div>
</div>
</div>
<div class="nav-buy-submit">
<form action="{{:U('Home/Buy/Index')}}" method="post" class="nav-buy">
<input type="hidden" name="goods_id" value="<if condition="isset($params['goods_id'])">{{$params.goods_id}}<else />0</if>" />
<input type="hidden" name="buy_type" value="<if condition="isset($params['buy_type'])">{{$params.buy_type}}<else />goods</if>" />
<input type="hidden" name="stock" value="<if condition="isset($params['stock'])">{{$params.stock}}<else />1</if>" />
<input type="hidden" name="attr" value="<if condition="isset($params['attr'])">{{$params.attr}}</if>" />
<input type="hidden" name="address_id" value="0" />
<input type="hidden" name="express_id" value="0" />
<input type="hidden" name="payment_id" value="0" />
<div class="go-btn-wrap">
<a href="javascript:;" class="btn-go" title="点击此按钮,提交订单">提交订单</a>
<button type="submit" class="btn-go" title="点击此按钮,提交订单">提交订单</button>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@ -39,11 +39,14 @@
/**
*
*/
#common-prompt {position:fixed;top:0;left:0;right:0;text-align:center;padding:5px;font-size:14px;z-index:10000; border-radius: 2px; width: 260px; margin: 0 auto;}
#common-prompt {position:fixed;left:0;right:0;text-align:center;padding:5px;font-size:14px;z-index:10000; border-radius: 2px; width: 260px; margin: 0 auto;}
#common-prompt.am-alert-danger { background-color: #fef0f0; border-color: #fde2e2; color: #f56c6c; box-shadow: 0 2px 4px #fef1f1, 0 0 6px rgba(0, 0, 0, 0); }
#common-prompt.am-alert-success { background-color: #f0f9eb; border-color: #e1f3d8; color: #67c23a; box-shadow: 0 2px 4px #efffe5, 0 0 6px rgba(0, 0, 0, 0); }
#common-prompt p { text-align: left; font-size: 12px; }
#common-prompt .am-close { line-height: 20px; }
#common-prompt.prompt-center { top: 0; margin-top: 25%; }
#common-prompt.prompt-top { top: 0; }
#common-prompt.prompt-bottom { bottom: 0; }
/**
* iframe

View File

@ -9,7 +9,7 @@
* @param {[int]} time [自动关闭时间, 默认3秒]
*/
var temp_time_out;
function Prompt(msg, type, time)
function Prompt(msg, type, time, distance, animation_type, location)
{
if(msg != undefined && msg != '')
{
@ -21,8 +21,13 @@ function Prompt(msg, type, time)
// 提示信息添加
$('#common-prompt').remove();
if(type == undefined || type == '') type = 'danger';
var html = '<div id="common-prompt" class="am-alert am-alert-'+type+' am-animation-slide-top" data-am-alert><button type="button" class="am-close am-close-spin">&times;</button><p>'+msg+'</p></div>';
if((type || null) == null) type = 'danger';
if((animation_type || null) == null) animation_type = 'top';
if((location || null) == null) location = 'top';
var style = '';
if((distance || null) != null) style = 'margin-'+animation_type+':'+distance+'px;';
var html = '<div id="common-prompt" class="am-alert am-alert-'+type+' am-animation-slide-'+animation_type+' prompt-'+location+'" style="'+style+'" data-am-alert><button type="button" class="am-close am-close-spin">&times;</button><p>'+msg+'</p></div>';
$('body').append(html);
// 自动关闭提示
@ -32,6 +37,16 @@ function Prompt(msg, type, time)
}, (time || 3)*1000);
}
}
// 中间提示信息
function PromptCenter(msg, type, time, distance)
{
Prompt(msg, type, time, distance, 'top', 'center');
}
// 底部提示信息
function PromptBottom(msg, type, time, distance)
{
Prompt(msg, type, time, distance, 'bottom', 'bottom');
}
/**
* [ArrayTurnJson js数组转json]

View File

@ -42,9 +42,9 @@ ul.logistics-list li img, ul.payment-list li img { width: 36px; height: 36px; }
.pay-sum{color:#d2364c;margin-left:5px ;}
.box{float:left;width:70%;height:40px ;line-height:40px ;font-size: 14px;text-align: right;padding-right:10px ;}
.pay-address{display: none;}
.nav-buy-submit a{float:left;width:30%;color:#fff ;background:#d2364c ;text-align: center;height:40px ;line-height:40px ;font-size: 14px;}
.nav-buy .btn-go{float:left;width:30%;color:#fff ;background:#d2364c ;text-align: center;height:40px ;line-height:40px ;font-size: 14px; border: 0; }
.order-nav{position: fixed; left: 0; bottom: 0;width:100%; }
.nav-buy-submit a:hover, .nav-buy-submit a:focus { color: #fff !important; text-decoration: none; }
.nav-buy .btn-go:hover, .nav-buy .btn-go:focus { color: #fff !important; text-decoration: none; }
.link-list h3 { padding: 0 0 5px 5px; }
ul.address-list, .business-item ul { overflow: hidden; }
@ -82,15 +82,15 @@ ul.address-list, .business-item ul { overflow: hidden; }
.memo-input{min-width:280px ;width:80%; }
/*带个人信息的结算*/
.box ,.nav-buy-submit a{float:right;width:auto;height:auto;padding:10px 10px;}
.box ,.nav-buy .btn-go{float:right;width:auto;height:auto;padding:10px 10px;}
.pay-address{display:block;}
.box{font-size:12px;overflow: hidden;border: 2px solid #de9ba2;}
.order-nav {clear: both;text-align: right;position: relative;margin-top: 10px;border: none;}
.order-nav .address-confirm .box{position: relative;float: right;z-index: 100;padding-right:2%; padding-bottom:10px;border: 1px solid #f50;font-family: tahoma;display: inline-block;right: 0;background-color: #fff0e8;}
.nav-buy-submit .go-btn-wrap {width:100%;overflow: hidden;padding-top:10px;margin-bottom: 10px;}
.nav-buy-submit .btn-go {display: block;padding: 0 26px;height: 36px;font: 400 18px/36px arial;font-size: 18px;background-color: #d2364c;color: #fff;text-align: center;cursor: pointer;outline: 0; z-index:999;}
.nav-buy .go-btn-wrap {width:100%;overflow: hidden;padding-top:10px;margin-bottom: 10px;}
.nav-buy .btn-go {display: block;padding: 0 26px;height: 36px;font: 400 18px/36px arial;font-size: 18px;background-color: #d2364c;color: #fff;text-align: center;cursor: pointer;outline: 0; z-index:999;}
.base-real-pay {line-height: 16px;margin: 0px 0px 10px;position: relative;}
.base-real-pay .g_price span {font-size: 26px;}
.price .nav-total-price {color: #d2364c;font: 700 26px tahoma;}

View File

@ -19,6 +19,7 @@ time, mark, audio, video {
font-family: arial,"Lantinghei SC","Microsoft Yahei";
}
li { list-style-type: none; }
button { outline: none; }
*, body, .am-btn { font-size: 12px; }

View File

@ -121,5 +121,51 @@ $(function()
e.stopPropagation();
});
// 提交订单
$('.nav-buy .btn-go').on('click', function()
{
var msg = '';
var status = true;
var address_id = $('ul.address-list li.address-default').data('value') || null;
if(address_id === null)
{
status = false;
msg = '请选择地址';
}
if(status === true)
{
var express_id = $('ul.logistics-list li.selected').data('value') || null;
if(express_id === null)
{
status = false;
msg = '请选择快递';
}
}
if(status === true)
{
var payment_id = $('ul.payment-list li.selected').data('value') || null;
if(payment_id === null)
{
status = false;
msg = '请选择支付';
}
}
if(status === false)
{
if($(window).width() < 640)
{
PromptBottom(msg, null, null, 50);
} else {
PromptCenter(msg);
}
return false;
}
console.log(address_id, express_id, payment_id);
});
});

View File

@ -34,7 +34,7 @@ function CartAdd(e)
var stock = $('#text_box').val();
if((stock || 0) <= 0)
{
Prompt('购买数量有误');
PromptCenter('购买数量有误');
return false;
}
@ -46,7 +46,7 @@ function CartAdd(e)
var attr_count = $('.sku-line.selected').length;
if(attr_count < sku_count)
{
Prompt('请选择属性');
PromptCenter('请选择属性');
return false;
} else {
$('.sku-line.selected').each(function(k, v)
@ -90,9 +90,9 @@ function CartAdd(e)
if(result.code == 0)
{
Prompt(result.msg, 'success');
PromptCenter(result.msg, 'success');
} else {
Prompt(result.msg);
PromptCenter(result.msg);
}
},
error: function(xhr, type)
@ -100,14 +100,14 @@ function CartAdd(e)
poptit_close();
$.AMUI.progress.done();
$button.attr('disabled', false);
Prompt('网络异常错误');
PromptCenter('网络异常错误');
}
});
break;
// 默认
default :
Prompt('操作参数配置有误');
PromptCenter('操作参数配置有误');
}
return true;
}
@ -212,16 +212,16 @@ $(function() {
} else {
$this.removeClass('text-active');
}
Prompt(result.msg, 'success');
PromptCenter(result.msg, 'success');
} else {
Prompt(result.msg);
PromptCenter(result.msg);
}
},
error: function(xhr, type)
{
poptit_close();
$.AMUI.progress.done();
Prompt('网络异常错误');
PromptCenter('网络异常错误');
}
});
}