submit.html
34.5 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
<!DOCTYPE html >
<html>
<head>
<meta charset="UTF-8">
<title>提交订单-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta name="format-detection" content="address=no;">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="stylesheet" href="__STATIC__/css/public.css">
<link rel="stylesheet" href="__STATIC__/css/style_jm.css">
<link rel="stylesheet" href="__STATIC__/css/user.css">
<link rel="stylesheet" href="__STATIC__/css/flow.css">
<link rel="stylesheet" href="__STATIC__/css/integral.css">
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__STATIC__/js/layer.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
<script src="__STATIC__/js/common.js"></script>
</head>
<body style="background: rgb(235, 236, 237);position:relative;">
<!--<div class="tab_nav">-->
<!--<div class="header">-->
<!--<div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>-->
<!--<div class="h-mid"> 确认订单</div>-->
<!--</div>-->
<!--</div>-->
{$slist1}
<div class="screen-wrap fullscreen login">
<form name="cart2_form" id="cart2_form" method="post">
<input type="hidden" id="setadd" name="setadd" value="{$setadd}" />
<input type="hidden" name="state" value="{$Think.request.tocart}" />
<input type="hidden" id="u_money" value="{$u_money}" />
<section class="content" style="min-height: 294px;">
<div class="wrap">
<div class="active" style="min-height: 294px;">
<div class="content-buy">
<div class="wrap order-buy">
<section class="order-info">
<div class="order-list">
<div class="content ptop0">
<div class="panel panel-default info-box">
<div class="panel-body" id="pay_div">
<div class="title" id="zhifutitle" style="border-bottom:1px solid #eeeeee;">
<img src="__STATIC__/images/car.png" style="width: 25px;height: 25px;" />
<span class="text">配送方式</span>
</div>
<ul id="fcheckbox_type" class="nav nav-list-sidenav">
<!--pty 0 为快递 1为自提-->
<li pty="0"><span class="c_checkbox_t c_checkbox_on"></span>快递邮寄</li>
<li pty="1"><span class="c_checkbox_t"></span>门店自提</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<div id="faddmone" class="addmone <eq name='setadd' value='0'>dn</eq>" style="padding: 0 10px;" onclick="addaddr(0)">
<div class="jia"></div>
<span class="addTxt">新增收货地址</span>
<img src="__STATIC__/images/flow/shop_arrow.png" class="shop_arrow" />
<p class="clear"></p>
</div>
<!--收货人-->
<section id="newadd" class="address address1 <eq name='setadd' value='1'>dn</eq>" onclick="addressList()">
<div id="faddrshow" class="address-info">
<p class="address-name">收货人:{$address.consignee}</p>
<p class="address-phone">手机:{$address.mobile}</p>
</div>
<div class="address-details">收货地址:{$address.addrstr} {$address.address}</div>
<input id="address_id" type="hidden" value="{$address.address_id}" name="address_id" />
</section>
<!--商品详细情况-->
<section class="order " id="order4">
<div class="order-info" style="margin-top:0;">
<!--<h4 class="seller-name" > <img src="/template/mobile/new/static/images/flow/dingdan.png" width="28">
订单详情 <a class="modify" href="/index.php/mobile/Cart/cart.html">修改</a></h4>-->
</div>
<section class="order-info" style=" margin-top:0px;">
<div class="order-list">
<div class="goods-list-title">贝贝蓝天门店</div>
<ul class="order-list-info">
<li class="item">
<div class="itemInfo list-info" id="itemInfo12">
<div class="list-img">
<a href="/index.php/Mobile/Goods/goodsInfo/stoid/1/id/23.html">
<img src="__PUBLIC__/images/not_adv.jpg"></a>
</div>
<div class="list-cont">
<h5 class="goods-title">纽西小精灵紫草赋活清润卸妆水 </h5>
<p class="godds-specification">
规格1</p>
<div class="itemPay list-price-nums" id="itemPay17">
<p class="price"><span class="cr font18">1000</span> 积分 +
<span class="cr">¥<em class="font18">0.01</em></span></p>
<p class="nums">x1</p>
</div>
</div>
</div>
</li>
<li class="flow_youhui_no fexp">
<label>
选择物流:
<select onchange="ajax_order_price();" class="vam ou-no fwuliu" name="shipping_code[24]">
<option value="">请选择物流</option>
<option value="zhongtong">
中通 </option>
<option value="ems">
EMS </option>
</select>
</label>
</li>
<li class="flow_youhui_no">
<label>
给卖家留言:
<input placeholder="给卖家留言" name="user_note[24]" style="vertical-align:middle" class="txt1" type="text">
</label>
</li>
<ul>
<ul class="order-list-info">
<li class="flow_youhui_no dn">如果是会员
<font color="red"></font>,可以享受会员折扣价
</li>
<li class="flow_youhui_no" style="display: none">
<label>
使用积分:
<input id="pay_points" name="pay_points" placeholder="输入积分" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" class="txt1" style="width:100px;" type="text">
<input name="validate_bonus" value="使用" onclick="ajax_order_price();" class="BonusButton" type="button">
您的可用积分<em>0</em>
</label>
</li>
</ul>
</ul>
</ul>
</div>
</section>
</section>
</foreach>
</section>
</section>
<section class="order-info dn">
<div class="order-list">
<div class="content ptop0">
<div class="panel panel-default info-box">
<div class="orderInfo ">
<h4 class="seller-name"><img src="__STATIC__/images/flow/dingdan.png" width="28"> 其他选项 </h4>
</div>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="checkgoods">
<tr>
<td colspan=4 class="tdother2" style="border-top:none;">
<div class="checkout_other">
<div class="jmbag" href="javascript:void(0);" onClick="showCheckoutOther(this);"><span class="right_arrow_flow"></span>开发票和缺货处理
</div>
<div class="subbox_other" width="100%">
<table id='normal_invoice_tbody' width="100%">
<tr>
<td align=right style="vertical-align:top" width="84">发票抬头:</td>
<td colspan="2">
<input class="txt1" style='vertical-align:middle' type="text" name="invoice_title" placeholder="XXX单位 或 XX个人" />
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
<div style="height:10px; line-height:10px; clear:both;"></div>
</div>
</div>
</div>
</section>
<section class="order-info">
<div class="order-list">
<div class="content ptop0">
<div class="panel panel-default info-box">
<div class="con-ct fo-con">
<ul class="ct-list order_total_ul" id="ECS_ORDERTOTAL">
<li>
可用1000积分
<span class="txt_right">1000积分</span>
<p class="clear"></p>
</li>
<li>
商品金额
<span class="txt_right">¥0.01</span>
<p class="clear"></p>
</li>
<li>
配送费用
<span class="txt_right">¥0.00</span>
<p class="clear"></p>
</li>
</ul>
</div>
<div class="confirm">
<span class="confirm_text">合计:<span class="cr font18">1000</span> 积分 + <span class="cr">¥<em class="font18">0.01</em></span></span>
<span class="confirm_btn" onclick="submit_order()">提交订单</span>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</section>
</form>
</div>
<!--弹窗-->
<div id="layeraddr" class="layermbox layermbox0_1 dn">
<div class="laymshade"></div>
<div class="layermmain">
<div class="section">
<div class="layermchild layermanim">
<p class="addTit">选择收货地址</p>
<div class="closed" style="top:8px"></div>
<p class="clear"></p>
<div class="layermcont">
<!--------------添加编辑优惠券------------->
<ul id="popaddressmone" class="addressmone dn">
<form id="addrform">
<input id="popseleaddid" name="address_id" type="hidden" value=""/>
<li style="padding-top: 0;">
<span>收货人</span>
<input name="consignee" id="consignee" type="text" value="" maxlength="12"
placeholder="收货人姓名"/>
</li>
<li>
<span>手机</span>
<input type="text" name="mobile" value="" id="mobile"
onpaste="this.value=this.value.replace(/[^\d-]/g,'')"
onKeyUp="this.value=this.value.replace(/[^\d-]/g,'')" maxlength="15"
placeholder="手机号码"/>
</li>
<li onclick="show_addsele()">
<span>所在地区</span>
<input type="text" value="" id="showaddrQ" readonly
placeholder="所在地区"/>
<input name='country' value='1' type="hidden">
<input id='inp_province' name='province' value='' type="hidden">
<input id='inp_city' name='city' value='' type="hidden">
<input id='inp_district' name='district' value='' type="hidden">
<input id='inp_twon' name='twon' value='' type="hidden">
</li>
<li>
<span>详细地址</span> <input type="text" name="address" id="address" placeholder="详细地址"
maxlength="100" value="{$address.address}"/>
</li>
<li>
<span>邮政编码</span> <input id="zipcode" type="text" name="zipcode"
value="{$address.zipcode}"
onpaste="this.value=this.value.replace(/[^\d]/g,'')"
onKeyUp="this.value=this.value.replace(/[^\d]/g,'')"
maxlength="10" placeholder="邮政编码"/>
</li>
<li id="addrdelli" style="text-align: center;" onclick="deladdr()">
<a class="delAdd">删除地址</a>
</li>
</form>
</ul>
<!--------------地址列表------------->
<div id="popadddiv">
<ul id="popaddlist" class="addList">
<foreach name="addlist" item="v">
<li aid="{$v.address_id}" <eq name="$v.is_default" value="1">isel="1"</eq> onclick='selectto(this)'>
<div class="address_add">
<h2>
<eq name="$v.is_default" value="1">
<img src="__STATIC__/images/right.png">
<else/>
<img src="__STATIC__/images/flow/c_checkbox_off.png">
</eq>
</h2>
<dl class='popdata'>
<dt><font class="popconsignee">{$v.consignee}</font>,手机:<font class="popmobile">{$v.mobile}</font></dt>
<dd>收货地址:
<font class="popaddstr">{$v.addrstr} {$v.address}</font>
</dd>
</dl>
<img id="amend" onclick="editAddress(this,event)" src="__STATIC__/images/amend.png" />
</div>
</li>
</foreach>
</ul>
<div class="addmone" onclick="addaddr(0)">
<div class="jia"></div>
<span class="addTxt">新增收货地址</span>
<img src="__STATIC__/images/flow/shop_arrow.png" class="shop_arrow" />
<p class="clear"></p>
</div>
</div>
<!--------------优惠券使用------------->
<!--<div id="popquanlist">-->
<!--<ul id="popaddlistul" class="addList" style=" max-height:200px"></ul>-->
<!--</div>-->
<div id="addbtn" class="twoBtn dn">
<div class="btnRed" style="width: 100%;margin-top: 20px;" onclick="updateaddr()">确定</div>
<!--<div class="btnWhile">取消</div>-->
</div>
<div id="quanbtn" class="twoBtn dn">
<div class="btnRed" style="width: 100%;margin-top: 20px;" onclick="selequanbtn()">确定</div>
<!--<div class="btnWhile">取消</div>-->
</div>
</div>
</div>
</div>
</div>
</div>
<section class="f_mask" style="display: none;"></section>
<include file="public/footer"/>
<include file="public/addrsele"/>
<script type="text/javascript">
var getstoid = "<?php echo I('stoid')?>";
var exptype = "0";
var addtype = 0;
var popquanid = "";
var popseleedid = "";
var maxyuer=0;
$(document).ready(function () {
ajax_order_price(); // 计算订单价钱
//配送方式
$(".nav li").click(function () {
var type = $(this).attr("pty");
if (type == "0") {
$("#fexp").fadeIn(3);
exptype = "0";
} else {
$("#fexp").fadeOut(3);
exptype = "1";
}
$(".nav .c_checkbox_t").removeClass("c_checkbox_on");
$(this).find(".c_checkbox_t").addClass("c_checkbox_on");
ajax_order_price();
});
//获取输入焦点时
$(".addressmone input").focus(function () {
$(".addressmone li").css("border-color", "#eee");
$(this).parents("li").css("border-color", "#C4182E");
});
});
/*--------------------------地址管理----------------------------*/
//关闭弹窗
$(".closed").click(function () {
$("#layeraddr").addClass("dn");
$("body").css("overflow", "auto");
if ($(".addTit").text() == "编辑收货地址") {
addressList();
}
});
//地址列表
function addressList() {
$("#layeraddr").removeClass("dn");
$("body").css("overflow", "hidden");
$(".addTit").text("选择收货地址");
$("#popadddiv").removeClass("dn");
$(".addressmone").addClass("dn");
$(".twoBtn").addClass("dn");
$(".subbox_other").addClass("dn");
$("#popquanlist").addClass('dn');
}
//编辑地址
function editAddress(ob, e) {
forminit();
window.event ? window.event.cancelBubble = true : e.stopPropagation();
$("#layeraddr").removeClass("dn");
$("body").css("overflow", "hidden");
$(".addTit").text("编辑收货地址");
$("#popadddiv").addClass("dn");
$(".addressmone").removeClass("dn");
$("#quanbtn").addClass("dn");
$("#addbtn").removeClass("dn");
$(".subbox_other").addClass("dn");
var aid = $(ob).parent().parent().attr("aid");
var mi = layer.open({type: 2});
$.ajax({
type: "get",
url: '/index.php?m=Mobile&c=Cart&a=get_area&stoid=' + getstoid + "&aid=" + aid,
//data: $('#addrform').serialize(),
dataType: "json",
success: function (data) {
layer.close(mi);
if (data.code == 1) {
$("#popseleaddid").val(aid);
/*编辑ID*/
$("#consignee").val(data.data2.consignee);
$("#mobile").val(data.data2.mobile);
$("#address").val(data.data2.address);
$("#zipcode").val(data.data2.zipcode);
var htm = "<option value='0'>请选择</option>";
var proobj = data.data.province;
for (var key in proobj) {
if (proobj[key].id == data.data2.province) {
htm += "<option value='" + proobj[key].id + "' selected>" + proobj[key].name + "</option>";
} else {
htm += "<option value='" + proobj[key].id + "'>" + proobj[key].name + "</option>";
}
}
$("#province").html(htm);
htm = "<option value='0'>请选择</option>";
var cityobj = data.data.city;
for (var key in cityobj) {
if (cityobj[key].id == data.data2.city) {
htm += "<option value='" + cityobj[key].id + "' selected>" + cityobj[key].name + "</option>";
} else {
htm += "<option value='" + cityobj[key].id + "'>" + cityobj[key].name + "</option>";
}
}
$("#city").html(htm);
htm = "<option value='0'>请选择</option>";
var districtobj = data.data.district;
for (var key in districtobj) {
if (districtobj[key].id == data.data2.district) {
htm += "<option value='" + districtobj[key].id + "' selected>" + districtobj[key].name + "</option>";
} else {
htm += "<option value='" + districtobj[key].id + "'>" + districtobj[key].name + "</option>";
}
}
$("#district").html(htm);
$("#district").css("display", "inline-block");
htm = "<option value='0'>请选择</option>";
var townobj = data.data.twon;
if (townobj != undefined) {
for (var key in townobj) {
if (townobj[key].id == data.data2.twon) {
htm += "<option value='" + townobj[key].id + "' selected>" + townobj[key].name + "</option>";
} else {
htm += "<option value='" + townobj[key].id + "'>" + townobj[key].name + "</option>";
}
}
$("#twon").html(htm);
$("#twon").css("display", "inline-block");
}
$("#addrdelli").fadeIn(3);
} else {
layer.open({content: "未找到该地址", time: 2});
}
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
}
//增加收货地址
function addaddr(ty) {
addtype = ty;
$("#layeraddr").removeClass("dn");
$("body").css("overflow", "hidden");
$(".addTit").text("新增收货地址");
$("#popadddiv").addClass("dn");
$(".addressmone").removeClass("dn");
$("#quanbtn").addClass("dn");
$("#addbtn").removeClass("dn");
$(".subbox_other").addClass("dn");
$("#addrdelli").fadeOut(3);
$("#popquanlist").addClass("dn");
forminit();
}
/*---表单初始化---*/
function forminit() {
$("#popseleaddid").val("");
$("#consignee").val("");
$("#mobile").val("");
$("#province").val("0");
$("#city").html("<option value='0'>请选择</option>");
$('#district').html("<option value='0'>请选择</option>");
$("#twon").css("display", "none");
$("#address").val("");
$("#zipcode").val("");
}
//新增,编辑收货地址提交
function updateaddr() {
var consignee = $("#consignee").val();
if (consignee == "") {
layer.open({content: "请输入收货人名字", time: 1});
return;
}
var mobile = $("#mobile").val();
if (mobile == "") {
layer.open({content: "请输入手机", time: 1});
return;
}
if (!checkMobile(mobile)) {
layer.open({content: "请输入正确的手机", time: 1});
return;
}
var province = $("#province").val();
if (province == "" || province == "0") {
layer.open({content: "请选择省份", time: 1});
return;
}
var city = $("#city").val();
if (city == "" || city == "0") {
layer.open({content: "请选择城市", time: 1});
return;
}
var district = $("#district").val();
if (district == "" || district == "0") {
layer.open({content: "请选择县,区", time: 1});
return;
}
var address = $("#address").val();
if (address == "") {
layer.open({content: "请输入详细地址", time: 1});
return;
}
var zipcode = $("#zipcode").val();
if (zipcode == "") {
layer.open({content: "请输入邮编", time: 1});
return;
}
var id = $("#address_id").val();
var mi = layer.open({type: 2});
$.ajax({
type: "get",
url: '/index.php?m=Mobile&c=Cart&a=add_address&stoid=' + getstoid + "&seleid=" + id,
data: $('#addrform').serialize(),
dataType: "json",
success: function (data) {
layer.close(mi);
if (data.code == 1) {
$("#popaddlist").html(data.data);
if (data.fir == 0) {
$("#layeraddr").addClass("dn");
$("body").css("overflow", "auto");
var addr1=$("#showaddrQ").val();
var htm = "<div id='faddrshow' class='address-info'><p class='address-name'>收货人:" + consignee + "</p><p class='address-phone'>手机:" + mobile + "</p></div><div class='address-details'>收货地址:" + addr1 + " " + address + "</div><input id='address_id' type='hidden' value='" + data.id + "' name='address_id'/>";
$("#newadd").html(htm);
$("#newadd").removeClass("dn");
$("#faddmone").addClass("dn");
} else {
addressList();
/*---编辑OK之后,主页上的地址也要修改--*/
if ($("#address_id").val() == $("#popseleaddid").val()) {
var addr1=$("#showaddrQ").val();
var htm = "<div id='faddrshow' class='address-info'><p class='address-name'>收货人:" + consignee + "</p><p class='address-phone'>手机:" + mobile + "</p></div><div class='address-details'>收货地址:" + addr1 + " " + address + "</div><input id='address_id' type='hidden' value='" + data.id + "' name='address_id'/>";
$("#newadd").html(htm);
}
}
}
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
}
/*------设置要使用的地址------*/
function selectto(ob) {
var id = $(ob).attr("aid");
var consignee = $(ob).find(".address_add").find(".popdata").find(".popconsignee").text();
var mobile = $(ob).find(".address_add").find(".popdata").find(".popmobile").text();
var addrstr = $(ob).find(".address_add").find(".popdata").find(".popaddstr").text();
/*--列表中的勾选修改--*/
$(ob).parent().find('li').each(function () {
var aid = $(this).attr("aid");
if (id != aid) {
$(this).find(".address_add").find("h2").find("img").attr("src", "__STATIC__/images/flow/c_checkbox_off.png");
}
});
$(ob).find(".address_add").find("h2").find("img").attr("src", "__STATIC__/images/right.png");
var htm = "<div id='faddrshow' class='address-info'><p class='address-name'>收货人:" + consignee + "</p><p class='address-phone'>手机:" + mobile + "</p></div><div class='address-details'>收货地址:" + addrstr + "</div><input id='address_id' type='hidden' value='" + id + "' name='address_id'/>"
/*--填充--*/
$("#newadd").html(htm);
/*--关闭弹窗--*/
$("#layeraddr").addClass("dn");
$("body").css("overflow", "auto");
}
/*--删除收货地址--*/
function deladdr() {
var id = $("#address_id").val();
var i = layer.open({
content: '确定要删除吗?!',
btn: ['确定', '取消'],
yes: function () {
layer.close(i);
var mm = layer.open({
type: 2
});
$.ajax({
type: "POST",
url: '/index.php?m=Mobile&c=Cart&a=del_address&stoid=' + getstoid + '&id=' + $("#popseleaddid").val() + "&seleid=" + id,
dataType: "json",
success: function (data) {
layer.close(mm);
if (data.code == 1) {
$("#popaddlist").html(data.data);
if (data.address2 != undefined && data.address2 != "") {
if ($("#address_id").val() == $("#popseleaddid").val()) {
var row = data.address2;
var htm = "<div id='faddrshow' class='address-info'><p class='address-name'>收货人:" + row.consignee + "</p><p class='address-phone'>手机:" + row.mobile + "</p></div><div class='address-details'>收货地址:" + row.addrstr + "</div><input id='address_id' type='hidden' value='" + row.id + "' name='address_id'/>";
$("#newadd").html(htm);
}
addressList();
} else {
$("#layeraddr").addClass("dn");
$("body").css("overflow", "auto");
$("#faddmone").removeClass("dn");
$("#newadd").addClass("dn");
$("#newadd").html("");
}
} else {
layer.open({content: "删除失败", time: 2});
}
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
}, no: function () {
}
});
}
/*---订单应付对象---*/
var orderyglist = null;
/*----------------------------------------------------------------------------------*/
// 获取订单价格
function ajax_order_price() {
return;
var mm = layer.open({
type: 2
});
$.ajax({
type: "POST",
url: '/index.php?m=Mobile&c=Cart&a=cart3&act=order_price&stoid=' + getstoid + '&t=' + Math.random() + "&exptype=" + exptype,
data: $('#cart2_form').serialize(),
dataType: "json",
success: function (data) {
layer.close(mm);
if (data.status != 1) {
layer.open({
content: data.msg,time:2
});
// 登录超时
if (data.status == -100)
location.href = "{:U('Mobile/User/login',array('stoid'=>$Think.request.stoid))}";
return false;
}
// console.log(data);
$("#postFee").text(data.result.postFee); // 物流费
$("#couponFee").text(data.result.couponFee); // 优惠券
$("#balance").text(data.result.balance); // 余额
$("#pointsFee").text(data.result.pointsFee); // 积分支付
$("#payables").text(data.result.payables); // 应付
$("#order_prom_amount").text(data.result.order_prom_amount); // 订单 优惠活动
$("#balance").text(data.result.balance); // 使用余额
$("#integral").text(data.result.pointsFee);//使用积分
maxyuer = data.result.payables1; //应付,没余额的那一部分
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
}
// 提交订单
ajax_return_status = 1; // 标识ajax 请求是否已经回来 可以进行下一次请求
function submit_order() {
/*--确保收货人有--*/
if (exptype == "0") {
var setadd = $("#setadd").val();
if (setadd == "1") {
var name = $("#consignee").val();
if (name == "") {
layer.open({content: '请输入收货人姓名', time: 1});
return;
}
name = $("#mobile").val();
if (name == "") {
layer.open({content: '请输入收货人手机', time: 1});
return;
}
if (!checkMobile(name)) {
layer.open({content: '请输入正确格式的手机号码', time: 1});
return;
}
name = $("#province").val();
if (name == "" || name == "0") {
layer.open({content: '请选择省份', time: 1});
return;
}
name = $("#city").val();
if (name == "" || name == "0") {
layer.open({content: '请选择城市', time: 1});
return;
}
name = $("#district").val();
if (name == "" || name == "0") {
layer.open({content: '请选择区、县', time: 1});
return;
}
name = $("#address").val();
if (name == "") {
layer.open({content: '请填写详细地址', time: 1});
return;
}
} else {
var addid = $("input[name='address_id']").val()
if (addid == "" || addid == undefined || addid == null) {
layer.open({content: '未找到收货人', time: 1});
return;
}
}
}
var mon = parseFloat($("#user_money").val());
if (mon > maxyuer) {
layer.open({content: "您的余额不足", time: 2});
return;
}
//选择物流的判断
var wubool = true;
$(".fwuliu").each(function () {
if ($(this).val() == "" && exptype == "0") {
wubool = false;
return;
}
});
if (!wubool) {
layer.open({
content: '请选择物流',
time: 2
});
return;
}
if (ajax_return_status == 0)
return false;
ajax_return_status = 0;
//alert($('#cart2_form').serialize() + "&act=submit_order");
var ii = layer.open({
type: 2,
content: '提交中'
});
$.ajax({
type: "POST",
url: "{:U('Mobile/Cart/cart3',array('stoid'=>$Think.request.stoid))}", //+tab,
data: $('#cart2_form').serialize() + "&act=submit_order&exptype=" + exptype, // 你的formid
dataType: "json",
success: function (data) {
layer.close(ii);
if (data.status != '1') {
layer.open({content: data.msg,time: 2}); //执行有误
// 登录超时
if (data.status == -100)
location.href = "{:U('Mobile/User/login',array('stoid'=>$Think.request.stoid))}";
ajax_return_status = 1; // 上一次ajax 已经返回, 可以进行下一次 ajax请求
return false;
}
// console.log(data);
$("#postFee").text(data.result.postFee); // 物流费
$("#couponFee").text(data.result.couponFee); // 优惠券
$("#balance").text(data.result.balance); // 余额
$("#pointsFee").text(data.result.pointsFee); // 积分支付
$("#payables").text(data.result.payables); // 应付
$("#order_prom_amount").text(data.result.order_prom_amount); // 订单 优惠活动
$("#balance").text(data.result.balance); // 使用余额
$("#integral").text(data.result.pointsFee);//使用积分
//alert(data.payables);
if (data.payables == "0" || data.payables == 0) {
layer.open({
content: "支付成功",
time: 2
});
setTimeout(function () {
location.href = "/Mobile/User/index/stoid/" + getstoid;
}, 1000)
} else {
layer.open({
content: "提交订单成功",
time: 2
});
setTimeout(function () {
//location.href = "/Mobile/Cart/cart4/orderno/" + data.result + "/stoid/" + getstoid;
location.href = '/Mobile/Payment/getCode.html?orderno=' + data.result + '&stoid=' + getstoid;
}, 1000)
}
}
});
}
function use_yuer(ob) {
var mon = parseFloat($("#user_money").val());
if (mon > maxyuer) {
layer.open({content: "您的余额使用不能订单总额", time: 2});
return;
}
var uumon=$("#u_money").val();
if (mon > maxyuer) {
layer.open({content: "您的余额不足", time: 2});
return;
}
ajax_order_price();
}
</script>
</body>
</html>