order_page.html
7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>学考无忧-确认订单</title>
<link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
<style>
.order_address {
padding-bottom: 0.26rem;
background-repeat: no-repeat;
background-image: url("__TMPL__/public/assets/images/32.png");
background-position: bottom;
background-size: 100% 0.06rem;
background-color: white;
}
</style>
</head>
<body>
<div class="order_box">
<!-- 顶部 -->
<div class="order_top">
<a href="javascript:history.back(-1)">
<img src="__TMPL__/public/assets/images/left.png" alt="">
</a>
<p>订单确认</p>
</div>
<!-- 地址 -->
<div class="order_address">
<!-- 暂无 -->
<if condition="$address eq 4">
<div class="order_addressNo">
<div class="order_adImg">
<img src="__TMPL__/public/assets/images/31.png" alt="">
</div>
<p class="order_addressGo">暂无默认收货地址,<a href="{:url('Personalcenter/shop_address')}">去添加</a></p>
</div>
<else/>
<div class="order_addressYes">
<div class="or_addressYesImg1">
<img src="__TMPL__/public/assets/images/38.png" alt="">
</div>
<div class="or_addressYesTxt1">
<div class="or_addressYesTxt2">
<div class="or_addressName" id="name">{$address.name}</div>
<p class="or_addressPhone" id="phone">{$address.phone}</p>
</div>
<p class="or_address_detailed" id="detailed">{$address.region}{$address.detailed}</p>
</div>
<div class="or_addressYesImg2">
<a href="{:url('Personalcenter/shop_address')}">
<img src="__TMPL__/public/assets/images/29.png" alt="">
</a>
</div>
</div>
</if>
<!-- 有地址 -->
</div>
<!-- 订单信息 -->
<div class="order_news">
<h1 class="order_newsTit">订单信息</h1>
<ul class="order_newsUl">
<input type="hidden" name="indet_id" value="{$indent_id}">
<volist name="data" id="vo">
<li>
<div class="order_newsImg">
<img src="{:cmf_get_image_url($vo.thumbnail)}" alt="">
</div>
<div class="order_newsCon">
<div class="order_newsTxt1 txt-cut">{$vo.book_name}</div>
<div class="order_newsTxt2">×<span>{$vo.number}</span></div>
<div class="order_newsTxt3">
<p class="de_topTxt1_1">¥<span>{$vo.price}</span></p>
<p class="de_topTxt1_2">¥<span>{$vo.pricing0}</span>.{$vo.pricing1}</p>
<div class="order_newsNum">
<div class="order_newsJian" onclick="jian({$vo.id},{$vo.price})">-</div>
<input class="order_newsnum" type="text" readonly="readonly" value="{$vo.number}">
<div class="order_newsJia" onclick="jia({$vo.id},{$vo.price})">+</div>
</div>
</div>
</div>
</li>
</volist>
</ul>
</div>
<!-- 支付方式/配送方式 -->
<div class="order_Etc">
<div class="order_Etc1">
<p class="order_EtcTxt">支付方式</p>
<img class="order_EtcImg" src="__TMPL__/public/assets/images/34.png" alt="">
</div>
<div class="order_Etc1">
<p class="order_EtcTxt">配送方式</p>
<span class="order_EtcTxt2">快递</span>
</div>
<div class="order_Etc2">
<p class="order_EtcTxt">买家留言</p>
<textarea placeholder="在此填写您的留言" id="liuyan"></textarea>
</div>
</div>
<!-- 底部 -->
<div class="order_bottom">
<div class="order_bottom1">
<p class="order_bottomHe">合计金额:</p>
<p class="de_topTxt1_1 zoji">¥<span>{$money}</span></p>
</div>
<div class="order_bottom2" onclick="go_pay()">
立即支付
</div>
</div>
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
/**
*点击去支付
*/
function go_pay(){
name = $('#name').text();
phone = $('#phone').text();
detailed = $('#detailed').text();
if(name == ''){
alert('姓名不能为空');
}else if(phone == ''){
alert('手机号不能为空');
}else if(detailed == ''){
alert('地址不能为空');
}else{
id = {$indent_id};
liuyan = $('#liuyan').val();
$.post("{:url('Orderpage/goods_leave_word_update')}",{id:id,leave_word:liuyan},function(data){
if(data){
window.location.href = "{:url('Pay/index',array('id'=>$indent_id))}";
}else{
alert('订单更新失败!');
}
});
}
}
/**
*点击加一
*/
function jia(id,price){
$.post("{:url('Orderpage/shop_cart_numadd')}",{id:id,price:price},function(data){
});
}
/**
* 点击减一
*/
function jian(id,price){
$.post("{:url('Orderpage/shop_cart_numdec')}",{id:id,price:price},function(data){
});
}
</script>
<script>
$(document).ready(function() {
// 为减少和添加商品数量的按钮绑定事件回调
$('.order_newsNum div').on('click', function(evt) {
if ($(this).text() == '-') {
var count = parseInt($(this).next().val());
if (count > 1) {
count -= 1;
$(this).next().val(count);
} else {
alert('商品数量最少为1');
}
$(this).parents('.order_newsCon').find('.order_newsTxt2 span').text(count);
} else {
var count = parseInt($(this).prev().val());
if (count < 200) {
count += 1;
$(this).prev().val(count);
} else {
alert('商品数量最多为200');
}
$(this).parents('.order_newsCon').find('.order_newsTxt2 span').text(count);
}
var price = parseFloat($(this).parents('.order_newsTxt3').children('.de_topTxt1_1').text().split('¥')[1]);
calcTotal();
});
// 计算总计
function calcTotal() {
var priceSpans = $('.order_newsTxt3 .de_topTxt1_1 span');
var countInputs = $('.order_newsNum .order_newsnum');
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < priceSpans.length; i += 1) {
// 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
var price = parseFloat($(priceSpans[i]).text());
var count = parseInt($(countInputs[i]).val());
totalCount += count;
totalPrice += price * count;
}
$('.zoji span').html(totalPrice.toFixed(2));
}
})
</script>
</body>
</html>