cart2.html 60.6 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 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301
<!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">
    <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?v=__CSSVERSION__"></script>
    <script src="__STATIC__/js/common.js"></script>
    <link rel="stylesheet" href="__STATIC__/css/login.css">
    <style type="text/css">
    	.addList li{border-bottom: 1px solid #ccc;}
    	.address_add{border:0;padding: 0;padding-bottom:10px ;}
    	.address_add dl{border: 0;padding-left: 35px;}
    	.address_add dl dd{width: 80%;}
    	.addmone{padding: 0 10px 10px;}
        .fu.close {
            background: rgba(0, 0, 0, 0) url("__STATIC__/images/flow/close.png") no-repeat scroll center center / 20px 20px;
            cursor: pointer; height: 20px;  position: absolute; right: 10px; top: 10px;width: 30px;
        }
        #addrform li{ height:60px; line-height: 60px; padding-left:10px; border-bottom:1px solid #eeeeee; position: relative}
		.grd{background: #e18b96}
			
    </style>
</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: 22px; height: 20px;"/>
                                                    <span class="text">配送方式</span>
                                                </div>
                                                <if condition="$expty eq 0"><!--可选-->
                                                   <ul id="fcheckbox_type" class="nav nav-list-sidenav">
                                                     <!--pty 0 为快递  1为自提-->
                                                       <li pty="1"><span class="c_checkbox_t c_checkbox_on"></span>门店自提</li>
                                                       <li pty="0"><span class="c_checkbox_t"></span>快递邮寄</li>
                                                   </ul>
                                                </if>
                                                <if condition="$expty eq 1"><!--自提-->
                                                    <ul id="fcheckbox_type" class="nav nav-list-sidenav">
                                                        <li pty="1"><span class="c_checkbox_t c_checkbox_on"></span>门店自提</li>
                                                    </ul>
                                                </if>
                                                <if condition="$expty eq 2"><!--物流-->
                                                    <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>
                                                    </ul>
                                                </if>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </section>

                            <!---当不是自提的时候--->
                            <if condition="$expty neq 1">
                            <div id="fexp" class="dn">
                            <div id="faddmone" class="addmone <eq name='setadd'  value='0'>dn</eq>"
                                  onclick="addaddr(0)">
                                <div class="jia"></div>
                                <span class="addTxt">新增收货地址</span>
                                <img src="__STATIC__/images/category/leftTip.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}&nbsp;&nbsp;{$address.address}</div>
                                <input id="address_id" type="hidden" value="{$address.address_id}" name="address_id"/>
                            </section>
                            </div>
                            </if>


                            <!--商品详细情况-->
                            <section class="order " id="order4">
                                <div class="order-info" style="margin-top:0;">
                                    <!--<h4 class="seller-name" > <img src="__STATIC__/images/flow/dingdan.png" width="28">
                                      订单详情 <a class="modify" href="{:U('Cart/cart')}">修改</a></h4>-->
                                </div>
                                <section class="order-info" style=" margin-top:0px;">
                                    <foreach name="slist" item="v">
                                        <div class="order-list">
                                            <div class="goods-list-title">{$v.pickup_name}</div>
                                            <ul class="order-list-info">
                                                <foreach name="$v.goods" item="v1" key="k1">
                                                        <li class="item">
                                                            <div class="itemPay list-price-nums" id="itemPay17">
                                                                <p class="price">¥{$v1.member_goods_price}</p>
                                                                <p class="nums">x{$v1.goods_num}</p>
                                                            </div>
                                                            <div class="itemInfo list-info" id="itemInfo12">
                                                                <div class="list-img">
                                                                    <a href="{:U('Mobile/Goods/goodsInfo',array('stoid'=>$Think.request.stoid,'id'=>$v1[goods_id]))}">
                                                                        <img src="{:getimg($v1['original_img'],NOIMG,0,1)}"></a>
                                                                </div>
                                                                <div class="list-cont">
                                                                    <h5 class="goods-title">{$v1.goods_name} </h5>
                                                                    <p class="godds-specification">
                                                                        {$v1.guige}</p>
                                                                </div>
                                                            </div>
                                                        </li>

                                                </foreach>
                                                <if condition="count($v['couponList']) neq 0">
                                                    <li class="flow_youhui_no">
                                                        <div class="checkout_other">
                                                            <div class="jmbag" href="javascript:void(0);"
                                                                 onClick="changeVoucher(this);"><span
                                                                    class="right_arrow_flow"></span>使用优惠券
                                                                <input type="hidden" name="coupon_id[{$v.pickup_id}]"
                                                                       readonly value=""/>
                                                                <span class="namespan"
                                                                      style="float: right; text-align: right; color:#333"></span>
                                                            </div>

                                                            <ul class="quanlistul" id="coupon_id_{$v.pickup_id}"
                                                                style="display: none">


                                                                <li val="" onclick="setquansele(this)" name="不使用">
                        		<span class="left">
                        			<p class="num">不用使用</p>
                        		</span>
                                <span class="right">
                        			<img src="__STATIC__/images/flow/c_checkbox_off.png"/>
                        		</span>
                                                                </li>

                                                                <foreach name="$v['couponList']" item="vv" key="k">
                                                                    <li val="{$vv['CashRepNo']}"
                                                                        onclick="setquansele(this)"
                                                                        name="{$vv['Sum']}元优惠券">
                        		<span class="left">
                        			<p class="num">{$vv['Sum']}元</p>
                                    <if condition="$vv['BuySum'] gt 0">
                                       <p>订单满{$vv['BuySum']}元使用</p>
                                    </if>
                        			<p class="gray">使用期限&nbsp;&nbsp;{$vv['BillDate']}至{$vv['ValidDate']}</p>
                        		</span>
                                                                        <span class="right">
                        			<img src="__STATIC__/images/flow/c_checkbox_off.png"/>
                        		</span>
                                                                    </li>

                                                                </foreach>
                                                            </ul>


                                                        </div>
                                                    </li>
                                                </if>


                                                <!---当不是自提的时候--->
                                                <if condition="$expty neq 1">
                                                <li class="flow_youhui_no fexp dn">
                                                    <label>
                                                        选择物流:
                                                        <select onChange="ajax_order_price();" class="vam ou-no fwuliu"
                                                                name="shipping_code[{$v.pickup_id}]">
                                                            <option value="">请选择物流</option>
                                                            <foreach name="shippingList" item="v4" key="k4">
                                                                <if condition="$v4['store_id'] eq $v['store_id']">
                                                                    <option value="{$v4.shipping_code}">
                                                                        {$v4.shipping_name}
                                                                    </option>
                                                                </if>
                                                            </foreach>
                                                        </select>
                                                    </label>
                                                </li>
                                                </if>

                                                <li class="flow_youhui_no">
                                                    <label>
                                                        给卖家留言:
                                                        <input type="text" placeholder="给卖家留言"
                                                               name="user_note[{$v.pickup_id}]"
                                                               style="vertical-align:middle" class="txt1">
                                                    </label>
                                                </li>
                                                <!--<li class="flow_youhui_no">
                                                	合计<span class="price">¥<strong class="price_total" id="payables">0</strong></span>
                                                	<p class="clear"></p>
                                                </li>-->
                                                <ul>
                                    </foreach>
                                    <ul class="order-list-info" style="margin-top: 10px">
                                        <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" type="text" placeholder="输入积分"
                                                       onpaste="this.value=this.value.replace(/[^\d]/g,'')"
                                                       onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" class="txt1"
                                                       style="width:100px;"/>
                                                <input name="validate_bonus" type="button" value="使用"
                                                       onClick="ajax_order_price();" class="BonusButton"/>
                                                您的可用积分<em>{$user['pay_points']}</em>
                                            </label>
                                        </li>
                                    </ul>
                        </div>
                        </foreach>
        </section>

        <section class="order-info">
            <ul class="order-list-info" style="margin-top: 10px">
                <li class="flow_youhui_no">
                    <label  class="nav-list-sidenav" onclick="fuseryuer(this)">
                        <span class="c_checkbox_t"></span>
                        使用余额:
<font id="fumoney">{$u_money}</font>
                        <input type="hidden" name="user_money"  id="user_money"  value=""/>
                    </label>
                </li>
            </ul>
        </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 class="order_total_li">-->
                                <!--*该订单完成后,您将获得 <span class="price">相应的</span> 积分<br/>-->
                                <!--</li>-->
                                <!--删除 20170525-->
                                <!--<li>
                                    <div class="subtotal">
                                        <span class="total-text">商品总额:</span><em
                                            class="price">¥{$total_price.total_fee}</em><br/>
                                        <span class="total-text">配送费用:</span>¥<em class="price" id="postFee">{$total_price.shipping_price}</em>元<br/>
                                        <span class="total-text">使用优惠券:</span>-&nbsp;¥&nbsp;<em class="price"
                                                                                                id="couponFee">0</em><br/>-->

                                <!--<span class="total-text">使用余额:</span>-&nbsp;¥&nbsp;<em class="price"-->
                                <!--id="balance">0</em><br/>-->
                                <!--<span class="total-text">优惠活动:</span>-&nbsp;¥&nbsp;<em class="price"
                                                                                       id="order_prom_amount">0</em><br/>
                                <span class="total-text">应付金额:</span>¥<strong class="price_total" id="payables">0</strong>
                                <span class="total-text" style=""></span>
                            </div>
                        </li>-->
                                <li>
                                    商品总额
                                    <span class="txt_right"><em class="price" id="goodsFee"></em></span>
                                    <p class="clear"></p>
                                </li>
                                <li>
                                    配送费用
                                    <span class="txt_right"><em class="price" id="postFee">{$total_price.shipping_price}</em></span>
                                    <p class="clear"></p>
                                </li>
                                <li>
                                    使用优惠券
                                    <span class="txt_right">-&nbsp;¥&nbsp;<em class="price" id="couponFee">0</em></span>
                                    <p class="clear"></p>
                                </li>
                                <li>
                                    优惠活动
                                    <span class="txt_right">-&nbsp;¥&nbsp;<em class="price"
                                                                              id="order_prom_amount">0</em></span>
                                    <p class="clear"></p>
                                </li>
                                <li>
                                    使用余额
                                    <span class="txt_right">-&nbsp;¥&nbsp;<em class="price" id="balance">0</em></span>
                                    <p class="clear"></p>
                                </li>
                                <li>
                                    使用积分
                                    <span class="txt_right">-&nbsp;¥&nbsp;<em class="price" id="integral"></em></span>
                                    <p class="clear"></p>
                                </li>
                            </ul>
                        </div>
                        <div class="confirm">
                            <span class="confirm_text">合计:<span class="price"><strong class="price_total"
                                                                                       id="payables">0</strong></span></span>
                            <span id="fsub_btn" class="confirm_btn" onclick="submit_order()">提交订单</span>
                            <span id="fsubing" class="confirm_btn dn" >提交中..</span>
                        </div>
                        <!--<div class="panel panel-default info-box">
                            <div class="pay-btn">
                                <input onClick="submit_order();" type="button" class="sub-btn btnRadius" value="提交订单"/>
                            </div>
                        </div>-->
                    </div>
                </div>
            </div>
        </section>
</div>
</div>
</div>
</div>
</section>
</form>
<input id="back_ordno" value="" type="hidden">
</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="tel" 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="tel" 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}&nbsp;&nbsp;{$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/category/leftTip.png" class="shop_arrow"/>
                            <p class="clear"></p>
                        </div>
                    </div>

                    <!--------------优惠券使用------------->
                    <div id="popquanlist">
                        <ul id="popaddlistul" class="couponList" style=" max-height:200px;overflow: auto;"></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>


<!--弹窗,电话注册-->
<div id="fzhuce" class="layermbox layermbox0_1" style="display: none">
    <div class="laymshade"></div>
    <div class="layermmain">
        <div class="section">
            <div class="layermchild  layermanim" style="border-radius:0 ">
                <p class="addTit" style="text-align:left; margin-left:10px ">手机绑定</p>
                <span class="fu close" onclick="close_fzhuce()"></span>
                <p class="clear"></p>
                    <div class="field phone">
                        <img class="phonePic" src="/template/mobile/new/static/images/user/tel.png">
                        <input id="b_mobile" maxlength="11" placeholder="手机号" class="c-form-txt-normal" type="tel" style="color: #adadad">
                        <div class="tips">
                            <span id="mobile_phone_notice"></span>
                        </div>
                    </div>
                    <div class="yanzheng" style=" margin-top:0px;">
                        <div class="codeTxt">
                            <img class="yzmPic" src="/template/mobile/new/static/images/user/code.png">
                            <input id="checkno" maxlength="4" name="mobile_code" placeholder="验证码" type="tel" style="color: #adadad">
                        </div>
                        <div class="codePhoto">
                            <input id="zphone" rel="mobile" value="发送验证码" onclick="sendcode(this)" class="zphone" style=" color:#FFF;margin-right:5px"  type="button" >
                        </div>
                    </div>
                    <div  id="btn_set" style="width: 100%;background:red; height: 40px; font-size: 16px; text-align: center;
                    line-height: 40px;color:#fff" onclick="save_mobile(this)">绑定并支付</div>
            </div>
        </div>
    </div>
</div>


<section class="f_mask" style="display: none;"></section>
<include file="public/footer"/>
<include file="public/addrsele"/>
<input id="fexpty" type="hidden" value="{$expty}"/>
<script type="text/javascript">
    var getstoid = "<?php echo I('stoid')?>";
    var exptype = "1";
    var addtype = 0;
    var popquanid = "";   //弹出层的券列表ID
    var popseleedid = ""; //弹出层的券列表已经选择的id
    var maxyuer=0;
    var mobile="{$user['mobile']}";

    $(document).ready(function () {
        var tty=$("#fexpty").val();
        if(tty=="0"){
            exptype=1;
        }
        else if(tty=="2"){
            exptype=0;
        }
        else{
            exptype=1;
        }
        ajax_order_price(); // 计算订单价钱
        //配送方式
        $(".nav li").click(function () {
            var type = $(this).attr("pty");
            if (type == "0") {          
                $("#fexp").fadeIn(3);             
                exptype = "0";
                $(".flow_youhui_no.fexp").fadeIn(0);
            } else {
                $("#fexp").fadeOut(3);
                exptype = "1";
                $(".flow_youhui_no.fexp").fadeOut(0);
            }
            $(".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");
        });
       
    });

    /*-----------选择优惠券弹出框-----------------*/
    function changeVoucher(ob) {
        /*--界面调整--*/
        $("#layeraddr").removeClass("dn");
        $("body").css("overflow", "hidden");
        $(".addTit").text("选择优惠券");
        $("#popadddiv").addClass("dn");
        $(".addressmone").addClass("dn");
        $("#addbtn").addClass("dn");
        $("#popquanlist").removeClass("dn");
        $("#quanbtn").removeClass("dn");
        $(".subbox_other").removeClass("dn");

     	var obj=$(ob).parent().find(".quanlistul");
    	popquanid=obj.attr("id");
        popseleedid=obj.attr("obsele");
    	var htm=obj.html();

  	    var num=0;
        obj.find("li").each(function () {
          if($(this).css("display")!="none"){
              num++;
          }
        });
        if(num==0){
          htm="<p style='width: 100%; margin:20px 0;'>暂无可选择的优惠券</p>";
        }
        $("#popaddlistul").html(htm);

    }
    /*-------选择动画-------*/
    function setquansele(ob) {
        $(ob).parent().find("li").each(function () {
            $(this).find(".right").find("img").attr("src", "__STATIC__/images/flow/c_checkbox_off.png");
            $(this).attr("msele", "0");
        });
        $(ob).find(".right").find("img").attr("src", "__STATIC__/images/right.png");
        $(ob).attr("msele", "1");
    }
    /*-------选择券-------*/
    function selequanbtn() {
        var seleid = "";
        var selename = "";

        $("#popaddlistul").find("li").each(function () {
            var msele = $(this).attr("msele");
            if (msele == "1") {
                seleid = $(this).attr("val");
                selename = $(this).attr("name");
            }
        });
        if (seleid == "") {
            //layer.open({content: "请选择优惠券", time: 2});
            //return;
        }

        //如果弹出层的选择id不为空
        if (popseleedid != undefined) {
            //如果弹出层的选择id不等于当前选择
            if (seleid != popseleedid) {
                $(".quanlistul").each(function () {
                    var id2 = $(this).attr('id');
                    //其他的优惠券列表
                    if (popquanid != id2) {
                        $(this).find("li").each(function () {
                            var val = $(this).attr("val");
                            //把它显示
                            if (val == popseleedid) {
                                $(this).show();
                            }
                        });
                    }
                });
            }
        }

        $(".quanlistul").each(function () {
            var id2 = $(this).attr('id')
            if (popquanid != id2) {
                $(this).find("li").each(function () {
                    var val = $(this).attr("val");
                    //把它隐藏
                    if (val == seleid) {
                        $(this).hide();
                    }
                });
            }
        });

        $(".quanlistul").each(function () {
            var id2 = $(this).attr('id')
            if (popquanid == id2) {
                $(this).attr("obsele", seleid);
                $(this).parent().find(".jmbag").find("input").val(seleid);
                $(this).parent().find(".jmbag").find(".namespan").text(selename);
                $(this).html($("#popaddlistul").html());
            }
        });

        $("#layeraddr").addClass("dn");
        $("body").css("overflow", "auto");
        ajax_order_price();
    }

    /*--------------------------地址管理----------------------------*/
    //关闭弹窗
    $(".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);
                    $("#showaddrQ").val(data.data2.addname);

                    $("#inp_province").val(data.data2.province);
                    $("#inp_city").val(data.data2.city);
                    $("#inp_district").val(data.data2.district);
                    $("#inp_twon").val(data.data2.twon);

                    set_getarea(data.data,data.data2);

                    $("#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();

        $("#showaddrQ").val("");
        $("#inp_province").val("");
        $("#inp_city").val("");
        $("#inp_district").val("");
        $("#inp_twon").val("");


    }
    /*---表单初始化---*/
    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,shadeClose: false});
        $.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 + "&nbsp;&nbsp;" + address + "</div><input id='address_id' type='hidden' value='" + data.id + "' name='address_id'/>";
                        $("#newadd").html(htm);
                        $("#newadd").removeClass("dn");
                        $("#faddmone").addClass("dn");

                        ajax_order_price();

                    } 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 + "&nbsp;&nbsp;" + address + "</div><input id='address_id' type='hidden' value='" + data.id + "' name='address_id'/>";

                            $("#newadd").html(htm);
                            ajax_order_price();
                        }
                    }
                }
            },
            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");

        ajax_order_price();
    }

    /*--删除收货地址--*/
    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("");
                            }
                            ajax_order_price();
                        } else {
                            layer.open({content: "删除失败", time: 2});
                        }
                    },
                    error: function () {
                        layer.open({
                            content: '网络异常',
                            time: 2
                        });
                    }
                });
            }, no: function () {

            }
        });
    }

    /*---订单应付对象---*/
    var orderyglist = null;
    /*----------------------------------------------------------------------------------*/
    // 获取订单价格
    function ajax_order_price() {
        var mm = layer.open({
            type: 2,
            shadeClose: false,
        });
        $.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);//使用积分
                $("#goodsFee").text(data.result.goodsFee); //商品总额
                maxyuer = data.result.payables1;  //应付,没余额的那一部分
            },
            error: function () {
                layer.open({
                    content: '网络异常',
                    time: 2
                });
            }
        });
    }
    // 提交订单
    var ajax_return_status = 1; // 标识ajax 请求是否已经回来 可以进行下一次请求
    function submit_order() {
        if(mobile==""){
            $("#fzhuce").fadeIn(3);
            return;
        }

        $("#fsub_btn").fadeOut(3);
        $("#fsubing").fadeIn(3);

        var ordno=$("#back_ordno").val();
        if($.trim(ordno)!=""){
            location.href = '/Mobile/Payment/getCode.html?orderno=' + data.result + '&stoid=' + getstoid;
            return;
        }
        /*--确保收货人有--*/
        if (exptype == "0") {
            var setadd = $("#setadd").val();
            if (setadd == "1") {
                var name = $("#consignee").val();
                if (name == "") {
                    layer.open({content: '请输入收货人姓名', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }

                name = $("#mobile").val();
                if (name == "") {
                    layer.open({content: '请输入收货人手机', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }
                if (!checkMobile(name)) {
                    layer.open({content: '请输入正确格式的手机号码', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }

                name = $("#province").val();
                if (name == "" || name == "0") {
                    layer.open({content: '请选择省份', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }
                name = $("#city").val();
                if (name == "" || name == "0") {
                    layer.open({content: '请选择城市', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }

                /*---
                name = $("#district").val();
                if (name == "" || name == "0") {
                    layer.open({content: '请选择区、县', time: 1});
                    return;
                }
                ----*/
                name = $("#address").val();
                if (name == "") {
                    layer.open({content: '请填写详细地址', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    return;
                }

            } else {
                var addid = $("input[name='address_id']").val()
                if (addid == "" || addid == undefined || addid == null) {
                    layer.open({content: '未找到收货人', time: 1});
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    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
            });
            $("#fsub_btn").fadeIn(3);
            $("#fsubing").fadeOut(3);
            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: '提交中',
            shadeClose: false
        });
        $.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请求
                    $("#fsub_btn").fadeIn(3);
                    $("#fsubing").fadeOut(3);
                    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;
                        location.href="/mobile/payment/payment_success/stoid/"+ getstoid;
                    }, 1000)
                } else {
                    layer.open({
                        content: "提交订单成功",
                        time: 2
                    });

                    $("#back_ordno").val(data.result);
                    setTimeout(function () {
                        location.href = '/Mobile/Payment/getCode.html?orderno=' + data.result + '&stoid=' + getstoid;
                    }, 1000)
                }
            }
        });
    }

    function fuseryuer(ob) {
        if($(ob).find(".c_checkbox_t").hasClass("c_checkbox_on")){
            $(ob).find(".c_checkbox_t").removeClass("c_checkbox_on");
            $("#user_money").val("");
        }else{
            $(ob).find(".c_checkbox_t").addClass("c_checkbox_on");
            $mon=$("#fumoney").text();
            $("#user_money").val($mon);
        }
        ajax_order_price();
    }
    
    
    function close_fzhuce() {
         $("#fzhuce").fadeOut(3);
    }

    /*--发送验证码--*/
    var sendtag=true;
    function sendcode(ob) {
         if(!sendtag) return;
         var txt=$(ob).val();
         if(txt=="发送中.."){return;}
         var mobile=$("#b_mobile").val();
         if($.trim(mobile)==""){
             layer.open({content: "请输入手机号",time: 2});
             return;
         }
         $(ob).val("发送中..");
		 $(ob).addClass('grd');
         var t1=layer.open({shadeClose: false,type: 2 ,content: '加载中'});
         $.ajax({
                url:  '/index.php?m=Home&c=Api&a=send_validate_code&t='+Math.random() ,
                type:'post',
                dataType:'json',
                data:{stoid:'{$Request.param.stoid}',type:"mobile",send:mobile,scene:1},
                success:function(res){
                    layer.close(t1);
                    if(res.status==1){
                         sendtag=false;
                         layer.open({content: res.msg,time: 1});
                         countdown(ob);
                    }else{
                        layer.open({content: res.msg,time: 1});
                        layer.close(t1);
                    }
                },error:function () {
                    layer.close(t1);
                    $(ob).val('发送验证码');
					$(ob).addClass('red');
                }
         })

    }
    var wait = 60;
    function countdown(obj, msg) {
        obj = $(obj);
        if (wait == 0) {
            obj.removeAttr("disabled");
            obj.val("发送验证码");
			$(obj).removeClass('grd');
            wait = 60;
            sendtag=true;
        } else {
            if (msg == undefined || msg == null) {
                msg = obj.val();
            }
            obj.attr("disabled", "disabled");
            obj.val(wait + "秒后重新获取");
            wait--;
            setTimeout(function() {
                countdown(obj, msg)
            }, 1000)
        }
    }

    /*--会员注册--*/
    function save_mobile(ob) {
        var txt=$(ob).text();
        if(txt=="提交中.."){return;}
        var mob0=$("#b_mobile").val();
        if($.trim(mob0)==""){
            layer.open({content: "请输入手机号",time: 2});
            return;
        }
        var code=$("#checkno").val();
        if($.trim(code)==""){
            layer.open({content: "验证码",time: 2});
            return;
        }
        $(ob).text("提交中..")
        var t1=layer.open({shadeClose: false,type: 2 ,content: '加载中'});
        $.ajax({
            url:  '/index.php?m=mobile&c=cart&a=reg_user&t='+Math.random() ,
            type:'post',
            dataType:'json',
            data:{stoid:'{$Request.param.stoid}',mob:mob0,co:code},
            success:function(res){
                layer.close(t1);
                if(res.status==1){
                    mobile=mob0;
                    $("#fzhuce").fadeOut(3);
                    submit_order();
                }else{
                    layer.open({content: res.msg,time: 2});
                    $(ob).text('确定');
                }
            },error:function () {
                layer.close(t1);
                $(ob).text('确定');
            }
        })
    }

</script>
</body>
</html>