addindex.html 44.7 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
   <include file="public/layout" />
<style>
    .btn {
        color: #999;
        cursor: pointer !important;
    }
    .prom_table {
        width: auto;
        margin: 30px 0;
        line-height: 30px;
        margin-left: 70px;
    }
    .w10 {
        line-height: 20px;width: 120px;
        text-align: center;
    }
    .w15 {
        line-height: 20px; width: 180px;
        text-align: center;
    }
    .w20 {
        line-height: 20px; width: 220px;
        text-align: center;
    }
    .w30 {
        line-height: 20px;width: 300px;
        text-align: center;
    }

    #send_good_list td div.gname{ overflow: hidden; text-overflow: ellipsis;white-space: nowrap; width: 180px;}

</style>
<script src="__PUBLIC__/static/js/layer/laydate/laydate.js"></script>

   <!--以下是在线编辑器 代码 -->
   <script type="text/javascript">
       /*
        * 在线编辑器相 关配置 js
        *  参考 地址 http://fex.baidu.com/ueditor/
        */
       window.UEDITOR_Admin_URL = "/public/plugins/Ueditor/";
       var URL_upload = "{$URL_upload}";
       var URL_fileUp = "{$URL_fileUp}";
       var URL_scrawlUp = "{$URL_scrawlUp}";
       var URL_getRemoteImage = "{$URL_getRemoteImage}";
       var URL_imageManager = "{$URL_imageManager}";
       var URL_imageUp = "{$URL_imageUp}";
       var URL_getMovie = "{$URL_getMovie}";
       var URL_home = "{$URL_home}";
   </script>
   <script src="__PUBLIC__/static/js/layer/laydate/laydate.js"></script>
   <script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.config.js?v=__CSSVERSION__"></script>
   <script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.all.js"></script>
   <script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
   <script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/lang/en/en.js"></script>


   <script type="text/javascript">
       var url = "{:url('Ueditor/index',array('savepath'=>'marketinglibao'))}";
       var editor;
       $(function () {
           //具体参数配置在  editor_config.js  中
           var options = {
               zIndex: 999,
               initialFrameWidth: "95%", //初化宽度
               initialFrameHeight: 400, //初化高度
               focus: false, //初始化时,是否让编辑器获得焦点true或false
               maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
               , //允许的最大字符数 'fullscreen',
               pasteplain: false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
               autoHeightEnabled: true
               , serverUrl: url
           };
           editor = new UE.ui.Editor(options);
           editor.render("lbintro");  //  指定 textarea 的  id 为 goods_content
       });
   </script>

<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="fixed-bar">
                <div class="item-title">
                    <a class="back" href="javascript:window.history.back()" title="返回列表">
                        <i class="fa fa-arrow-circle-o-left"></i>
                    </a>
                    <div class="subject">
                        <h3>添加礼包</h3>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <form method="post" id="addlbform" action="{:U('Admin/Marketinglibao/addMarketinglibaohand')}">
        <input type="hidden" id="oldurl" name="oldurl" value="{$oldurl}" class="input-txt">
        <!--通用信息-->
        <div class="ncap-form-default tab_div_1">
            <dl class="row">
                <dt class="tit">
                    <label for="lbtitle">礼包标题</label>
                </dt>
                <dd class="opt">
                    <input id="lbtitle" type="text" value="{$deatillp.lbtitle}"

                           onkeydown="strkeydown(event, this, 'sumbbtn')"
                           name="lbtitle" style="width: 300px;"/>    排序:  <input type="text" value="<if condition='$md'>$md<else/>{$deatillp.sort_order|default=0}</if>" class="t_mane" name="sort_order"
                                                                             onkeydown="strkeydown(event, this, 'sumbbtn')"
                                                                             onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" /><label><input class="checkbox" name="is_show" id="is_show" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="1"  type="checkbox" <if condition="$deatillp[isshow] eq 1 ">checked</if>>启用</label>
                    <span class="err cr" id="err_goods_name" ></span>
                </dd>
            </dl>


            <dl class="row">
                <dt class="tit">礼包类型</dt>
                <dd class="opt">
                    <label>
                       <input class="checkbox lblx_radio" name="is_act"  value="1" onkeydown="strkeydown(event, this, 'sumbitbtn')"
                            type="radio" <if condition="$deatillp[is_act] eq 1">checked</if>>营销活动使用</label>
                       <input class="checkbox lblx_radio" name="is_act"  value="0" onkeydown="strkeydown(event, this, 'sumbitbtn')"
                           type="radio" <if condition="!$deatillp[is_act]">checked</if>>礼包购买兑换</label>
                    <!--<span class="notic red">(勾选后,该礼包仅用于营销活动使用)</span>-->
                </dd>
            </dl>

            <dl class="row <if condition="$deatillp[is_act] eq 1">dn</if>" id="stare_time">
                <dt class="tit">
                    <label for="startime">开始时间</label>
                </dt>
                <dd class="opt">
                    <input type="text" id="startime" name="startime" value="{$deatillp.startime}" style="width: 150px;" ><input type="text" id="endtime" name="endtime" value="{$deatillp.endtime}" style="width: 150px;">
                    <input type="hidden" id="hidendtime"  value="{$deatillp.endtime}">
                </dd>
            </dl>

            <dl class="show1 row">
                <dt class="tit">
                    <label for="exchange_day">兑换时间</label>
                </dt>
                <dd class="opt">
                    <select name="exchange_type" id="exchange_type" onchange="getexchange_type(this);">
                        <option value="1" <if condition="$deatillp.exchange_type eq 1">selected</if>>固定天数</option>
                        <option value="2" <if condition="$deatillp.exchange_type eq 2">selected</if>>固定时间</option>
                    </select>



                    <span id="exchange_type_1"  <if condition="$deatillp.exchange_type eq 2">class="dn"</if>>

                    领取后 <input id="exchange_day" type="text" value="{$deatillp.exchange_day}"
                               onkeydown="strkeydown(event, this, 'sumbbtn')"
                               name="exchange_day" class="" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')"
                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" />天内兑换</span>
                    <span id="exchange_type_2" <if condition="$deatillp.exchange_type eq 1">class="dn"</if>>

                    <input type="text" id="exchange_starttime" name="exchange_starttime" value="{$deatillp.exchange_starttime}" style="width: 150px;"><input type="text" id="exchange_endtime" name="exchange_endtime" value="{$deatillp.exchange_endtime}" style="width: 150px;">
                        </span>

                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">礼品类型</dt>
                <dd class="opt">
                    <label onclick="checkbox_click(1)"><input class="checkbox libao_tpey" name="lb_type1" id="lb_type1" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="1"  type="checkbox" <if condition="stripos($deatillp[lb_type],',1,') nheq false || empty($deatillp[lb_type])">checked</if>>礼品</label>
                    <label onclick="checkbox_click(2)"><input class="checkbox libao_tpey" name="lb_type2"  id="lb_type2" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="2" type="checkbox"  <if condition="stripos($deatillp[lb_type],'2,') nheq false">checked</if>>优惠券</label>
                    <label onclick="checkbox_click(3)"><input class="checkbox libao_tpey"  name="lb_type3" id="lb_type3" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="3"  type="checkbox"  <if condition="stripos($deatillp[lb_type],'3,') nheq false">checked</if>>服务项目</label>
                    <label onclick="checkbox_click(4)"><input class="checkbox libao_tpey"  name="lb_type4" id="lb_type4" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="4"  type="checkbox"  <if condition="stripos($deatillp[lb_type],',4,') nheq false">checked</if>>积分</label>
                    <label onclick="checkbox_click(5)"><input class="checkbox libao_tpey"  name="lb_type5" id="lb_type5" onkeydown="strkeydown(event, this, 'sumbitbtn')" value="5"  type="checkbox"  <if condition="stripos($deatillp[lb_type],',5,') nheq false">checked</if>>成长值</label>
                </dd>
            </dl>


            <if condition="$isBool">
                <dl class="row userqy <if condition="$deatillp[is_act] eq 1">dn</if>">
                <dt class="tit">会员权益等级</dt>
                <dd class="opt">
                    <volist name="grade_list" id="grade_list" key="k">
                    <label><input class="checkbox userqy_cb" name="grade_state{$k}"  onkeydown="strkeydown(event, this, 'sumbitbtn')"  type="checkbox"
                        <if condition="stripos($deatillp[grade],$grade_list[Id]) nheq false">checked</if>>{$grade_list['GradeName']}
                        <input type="hidden"  name="grade_str[]" value="{$grade_list.Id}" />
                    </label>
                    </volist>
                </dd>
            </dl>
            </if>

           <if condition="$rank_switch">
               <dl class="row user_plus <if condition="$deatillp[is_act] eq 1">dn</if>">
                 <dt class="tit">PLUS专享</dt>
                 <dd class="opt">
                    <volist name="plus_list" id="plus_list" key="kk">
                        <label><input class="checkbox plus_cb" name="plustype_state{$kk}" id="plustype{$plus_list.CardId}" onkeydown="strkeydown(event, this, 'sumbitbtn')" type="checkbox"
                            <if condition="$deatillp[plustype] && stripos($deatillp[plustype],$plus_list[CardId]) nheq false ">checked</if> >{$plus_list['CardName']}
                            <input type="hidden"  name="plustype_str[]" value="{$plus_list.CardId}" /></label>
                    </volist>
                </dd>
            </dl>
           </if>

            <dl class="row <if condition="$deatillp[is_act] eq 1">dn</if>" id="user_type">
                <dt class="tit">领取用户</dt>
                <dd class="opt">
           <input id="usertype0" type="radio" name="usertype" value="1"
            <if condition="$deatillp.usertype eq 1"> checked</if>>
            <label for="usertype0">新会员</label>
            <input id="usertype1" type="radio" name="usertype" value="0"
            <if condition="$deatillp.usertype eq 0"> checked</if>>
            <label for="usertype1">不限</label>
                </dd>
            </dl>

            <dl id="lb_pic" class="row">
                <dt class="tit"><label for="lburl2">礼包图片</label></dt>
                <dd class="opt">

                    <div class="ncsc-goods-default-pic">
                        <div class="goodspic-uplaod">
                            <div style="">
                                <img id="lburl2" src="{:getImg($deatillp.lburl,NOIMG)}"  onerror="this.src='__PUBLIC__/images/default_goods_image_240.gif'"   style="width: 240px; border:#eee solid 1px" onmouseover="layer.tips('<img src={$deatillp.lburl}>',this, {tips: [1, '#fff']});" onmouseout="layer.closeAll();">
                            </div>
                            <input type="hidden" id="img_url" name="lburl"
                                   onkeydown="strkeydown(event, this, 'submitbtn')"
                                   value="{$deatillp.lburl}" class="type-file-text">
                            <p class="hint">请上传图片格式文件,<Font color="red">大小建议为:750*510像素。</Font> </p>
                            <div class="handle">
                                <div class="ncsc-upload-btn">
                                    <a  onClick="GetUploadify_new(1,'lburl2','libao','{$erpid}','libao_form','id','lburl','{$deatillp.id}','img_call_back')">
                                        <p><i class="icon-upload-alt"></i>图片上传</p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>

                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                       <label for="oldprice">礼包原价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$deatillp.oldprice}" name="oldprice" id="oldprice"
                           onkeydown="strkeydown(event, this, 'sumbbtn')"
                           class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
                           onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />   <span class="<if condition="$deatillp[is_act] eq 1">dn</if>" id="lb_price_set"> 礼包价格:  <input type="text" value="{$deatillp.lbprice}" name="lbprice" id="lbprice"
                                                                                                    onkeydown="strkeydown(event, this, 'sumbbtn')"
                                                                                                    class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
                                                                                                    onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />   兑换积分: <input id="exchangeintegral" type="text" value="{$deatillp.exchangeintegral}"
                                                                                                                                                                            maxlength="180"
                                                                                                                                                                            onkeydown="strkeydown(event, this, 'sumbbtn')"
                                                                                                                                                                            name="exchangeintegral" class="" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')"
                                                                                                                                                                            onpaste="this.value=this.value.replace(/[^\d]/g,'')" />  </span>

                </dd>
            </dl>

            <dl id="lb_all" class="row <if condition="$deatillp[is_act] eq 1">dn</if>">
                <dt class="tit">
                    <label for="num">礼包总数</label>
                </dt>
                <dd class="opt">
                    <input id="lbnum" type="text" value="{$deatillp.lbnum|default=0}"
                           onkeydown="strkeydown(event, this, 'sumbbtn')"
                           name="lbnum" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
                           onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />&nbsp; &nbsp; &nbsp;限购:  <input type="text" value="{$deatillp.limitnum|default=0}" class="t_mane" name="limitnum" id="limitnum"
                                                                                                  onkeydown="strkeydown(event, this, 'sumbbtn')"
                                                                                                  onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" /><font style="color: red">(0表示不限)</font> &nbsp; &nbsp;
                    &nbsp;虚拟销量:  <input type="text" value="{$deatillp.virtualsales|default=0}" class="t_mane" name="virtualsales" id="virtualsales"
                                onkeydown="strkeydown(event, this, 'sumbbtn')"
                                onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />

                </dd>
            </dl>



            <dl class="row show4 dn " id="send_jf"  <if condition="stripos($deatillp[lb_type],',4,')">style="display:block"</if>>
                <dt class="tit" style="font-weight: bold">
                    <label for="lbintegral ">积分</label>
                </dt>
                <dd class="opt">
                    <input id="lbintegral" type="text" value="{$deatillp.lbintegral}"
                           maxlength="11"
                           onkeydown="strkeydown(event, this, 'sumbbtn')"
                           name="lbintegral" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
                           onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                </dd>
            </dl>

            <dl class="row show5 dn" id="send_czz"  <if condition="stripos($deatillp[lb_type],',5,')">style="display:block"</if> >
        <dt class="tit" style="font-weight: bold">
                    <label for="lbintegral">成长值</label>
                </dt>
                <dd class="opt">
                    <input id="lbgrowthvalue" type="text" value="{$deatillp.lbgrowthvalue}"
                           maxlength="11"
                           onkeydown="strkeydown(event, this, 'sumbbtn')"
                           name="lbgrowthvalue" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
                           onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                </dd>
            </dl>

            <!--   赠送礼品  -->
            <dl class="show1 row  liping_set <if condition="stripos($deatillp[lb_type],',1,')===false && $deatillp" >dn</if>" >
                <dt class="tit">
                    <label><em>*</em><b>礼包礼品</b></label>
                </dt>
                <dd class="opt">
                    <a onclick="search_goods()" class="ncap-btn"><i class="fa fa-search"></i>选择礼品</a>
                </dd>
            </dl>
            <!--   赠送礼品  -->
            <table class="prom_table liping_set <if condition="stripos($deatillp[lb_type],',1,')===false && $deatillp" >dn</if>" >
                <thead>
                    <tr class="show1" style="font-weight: bold">
                        <td class="w15">商品编号</td>
                        <td class="w15">商品名称</td>
                        <td class="w15">商品条码</td>
                        <td class="w15">零售价</td>
                        <td class="w15">数量</td>
                        <td class="w15">操作</td>
                    </tr>
                </thead>
                <!-- 送礼品的列表 -->
                <tbody id="send_good_list" >
                    <volist name="deatillp_list1" id="gg" >
                        <tr>
                            <td style="text-align: center">{$gg.goods_sn}</td>
                            <td style="text-align: center"><div class="gname">{$gg.goods_name}</div></td>
                            <td style="text-align: center">{$gg.goods_code}</td>
                            <td style="text-align: center">{$gg.pos_price}</td>

                            <td style="text-align: center">
                                <input type="text" name="num[]" class="price" style="width: 60px" value="{$gg.num}"
                                       onkeyup="this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')" autocomplete="off">

                            </td>
                            <td class="dn">
                                <input type="hidden" name="fw_name[]" value="">
                                <input type="hidden" name="lbtype[]" value="1">
                                <input type="hidden" name="fw_no[]" value="">
                                <input type="hidden" name="fromid[]" value="{$gg.fromid}">
                            </td>
                            <td style="text-align: center">
                                <a class="btn red" onclick="delpro(this)" data-id="{$gg.fromid}"><i class="fa fa-trash-o"></i>删除</a>
                            </td>
                        </tr>
                   </volist>
                </tbody>
            </table>
            <div style="clear: both"></div>

            <!--  赠送券  -->
            <dl class="show2 row quan_set <if condition="stripos($deatillp[lb_type],',2,')===false">dn</if>">
                <dt class="tit">
                    <label><em>*</em><b>礼包礼券</b></label>
                </dt>
                <dd class="opt">
                    <a onclick="search_quan()" class="ncap-btn"><i class="fa fa-search"></i>选择礼券</a>
                </dd>
            </dl>
            <!--  赠送券  -->
            <table class="prom_table quan_set <if condition="stripos($deatillp[lb_type],',2,')===false">dn</if>">
                <thead>
                    <tr class="show2 " style="font-weight: bold">
                        <td class="w15">礼券名称</td>
                        <td class="w10">礼券类型</td>
                        <td class="w30" style=" text-align: center;">使用有效期</td>
                        <td class="w10">面值</td>
                        <td class="w10">使用满金额</td>
                        <td class="w10">数量</td>
                        <td class="w10">操作</td>
                   </tr>
                </thead>
                <!-- 送券的列表 -->
                 <tbody id="send_quan_list" >
                     <volist name="deatillp_list2" id="gq" >
                         <tr>
                     <td style="text-align: center">{$gq.name}</td>
                     <td style="text-align: center">{$gq.type}</td>
                     <td style="text-align: center">
                         <if condition="strpos($gq.use_start_time,'1970')!==false">
                             不限
                             <else/>
                             {$gq.use_start_time}
                         </if>
                         <if condition="strpos($gq.use_end_time,'1970')!==false">
                             - 不限
                          <else/>
                             - {$gq.use_end_time}
                         </if>

                     </td>
                     <td style="text-align: center">{$gq.money}</td>
                     <td style="text-align: center">{$gq.condition}</td>
                     <td style="text-align: center">
                         <input type="text" name="num[]"  class="price" style="width: 60px;text-align: center" value="{$gq.num|default=1}"
                                onkeyup="this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')" autocomplete="off">
                     </td>
                     <td class="dn">
                         <input type="hidden" name="fromid[]" value="{$gq.fromid}">
                         <input type="hidden" name="lbtype[]" value="2">
                         <input type="hidden" name="fw_name[]" value="">
                         <input type="hidden" name="fw_no[]" value="">

                     </td>
                     <td style="text-align: center">
                         <a class="btn red" onclick="delpro(this)" data-id="{$gq.fromid}"><i
                                 class="fa fa-trash-o"></i>删除</a>
                     </td>
                 </tr>
                     </volist>
                 </tbody>
            </table>

            <div style="clear: both"></div>


            <!--  赠送服务  -->
            <dl class="show2 row fuwu_set <if condition="stripos($deatillp[lb_type],',3,')===false">dn</if>"  >
            <dt class="tit">
                <label><em>*</em><b>服务项目</b></label>
            </dt>
            <dd class="opt">
                <a onclick="search_fuwu()" class="ncap-btn"><i class="fa fa-search"></i>选择服务</a>
            </dd>
            </dl>

            <!--  赠送服务  -->
            <table class="prom_table fuwu_set <if condition="stripos($deatillp[lb_type],',3,')===false">dn</if>" >
            <thead>
            <tr class="show2 " style="font-weight: bold">
                <td class="w15">服务编号</td>
                <td class="w15">服务名称</td>
                <td class="w15">数量</td>
                <td class="w10">操作</td>
            </tr>
            </thead>
            <!-- 送服务的列表 -->
            <tbody id="send_fw_list" >
            <volist name="deatillp_list3" id="gf" >
                <tr>
                    <td style="text-align: center">{$gf.fw_no}</td>
                    <td style="text-align: center">{$gf.fw_name}</td>
                    <td style="text-align: center">
                        <input type="text" name="num[]"  class="price" style="width: 60px;text-align: center" value="{$gf.num|default=1}"
                               onkeyup="this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')" autocomplete="off">
                    </td>
                    <td class="dn">
                        <input type="hidden" name="fromid[]" value="{$gf.fromid}">
                        <input type="hidden" name="lbtype[]" value="3">
                        <input type="hidden" name="fw_name[]" value="{$gf.fw_name}">
                        <input type="hidden" name="fw_no[]" value="{$gf.fw_no}">
                    </td>
                    <td style="text-align: center">
                        <a class="btn red" onclick="delpro(this)" data-id="{$gf.id}"><i
                                class="fa fa-trash-o"></i>删除</a>
                    </td>
                </tr>
            </volist>
            </tbody>
            </table>


            <dl id="lb_remark" class="row <if condition="$deatillp[is_act] eq 1">dn</if>">
            <dt class="tit">
                <label for="lbintro">礼包说明</label>
            </dt>
            <dd class="opt">
                <textarea class="span12 ckeditor" id="lbintro" name="lbintro" title="">{$deatillp.lbintro}</textarea>

            </dd>
            </dl>


            <if condition="$islook eq 0">
                <div class="bot">
                    <a onclick="submit()" class="ncap-btn-big ncap-btn-green">确认提交</a>
                </div>
            </if>
        </div>

        <!--  如果是修改的时候 -->
        <if condition="$deatillp">
            <input id="id" name="id" value="{$deatillp.id}" type="hidden">
        </if>
   </form>
    <!--表单数据-->
    <input type="hidden" id="qclurl" value="{$qclurl}">

</div>
<script type="text/javascript">
    var condition = false;
    var msg = '请输入正确的值';
    var key = '';//关键字
    var seardata = '';//接口返回数据
    var count = '';//接口返回的个数


    <if condition='$is_stime eq 1'>
    $("input").attr("disabled","disabled");
    $("select").attr("disabled","disabled");
    //$(".btn").hide();

    $("#endtime").attr("disabled",false);
    </if>

    //---  input文本框失去焦点事件 ---
    $('input[type="text"]').blur(function () {
        if ($(this).val() != '') {
            $(this).nextAll('.cr').addClass('dn');
        }
    });

    //兑换类型
    function getexchange_type(obj)
    {
        var gettype=$(obj).val();
        if (gettype==1)
        {
            $("#exchange_type_1").show();
            $("#exchange_type_2").hide();
        }
        else
        {
            $("#exchange_type_2").show();
            $("#exchange_type_1").hide();
        }
    }

    $(document).ready(function(){
        $('#startime').layDate();
        $('#endtime').layDate();

        $('#exchange_starttime').layDate();
        $('#exchange_endtime').layDate();
    })

    //选择礼包礼品
    function search_goods() {
        var url = "/index.php/admin/Marketinglibao/search/is_ajax/1";
        var url2 = "/index.php/admin/Marketinglibao/search";
        layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '200px', time: 0});
        $.ajax({
            type: "get",
            url: url,
            dataType: 'json',
            error: function () {
                layer.closeAll();
                layer.msg("服务器繁忙, 请联系管理员!", {icon: 2, time: 1000});
            },
            success: function (data) {
                layer.closeAll();
                if (data == "") {
                    layer.msg(data.msg, {icon: 2, time: 1000});
                    return false;
                }

                if (data.code == "1" || data.code == 1) {
                    if (data.count == undefined || data.count == 0) {
                        layer.msg("未找到商品", {icon: 2, time: 1000});
                        return false;
                    }
                    seardata = data.data;
                    count = data.count;

                    if (seardata.length == 1) {
                        m_call_back(seardata[0]);
                    } else {
                        layer.open({
                            type: 2,
                            title: '选择商品',
                            shadeClose: true,
                            shade: 0.2,
                            area: ['96%', '70%'],
                            content: url2
                        });
                    }
                } else {
                    layer.msg(data.msg, {icon: 2, time: 1000});
                }
            }
        });
    }
    //选择礼包礼券
    function search_quan() {
        var url = "/index.php/admin/Marketinglibao/SelectCp/";
        var url2 = "/index.php/admin/Marketinglibao/getCp";
        layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '200px', time: 0});
        $.ajax({
            type: "get",
            url: url,
            dataType: 'json',
            error: function () {
                layer.closeAll();
                layer.msg("服务器繁忙, 请联系管理员!", {icon: 2, time: 1000});
            },
            success: function (data) {
                layer.closeAll();
                if (data == "") {
                    layer.msg(data.msg, {icon: 2, time: 1000});
                    return false;
                }
                if (data.code == "1" || data.code == 1) {
                    if (data.count == undefined || data.count == 0) {
                        layer.msg("未找到优惠券", {icon: 2, time: 1000});
                        return false;
                    }
                    seardata = data.data;
                    count = data.count;
                    if (seardata.length == 1) {
                        cp_call_back(seardata[0]);
                    } else {
                        layer.open({
                            type: 2,
                            title: '选择优惠券',
                            shadeClose: true,
                            shade: 0.2,
                            area: ['96%', '70%'],
                            content: url2
                        });
                    }
                } else {
                    layer.msg(data.msg, {icon: 2, time: 1000});
                }
            }
        });
    }

    //选择服务项目
    function search_fuwu() {
        var url = "/index.php/admin/Marketinglibao/smitemlist";
        layer.open({
            type: 2,
            title: '选择服务项目',
            shadeClose: true,
            shade: 0.2,
            area: ['96%', '70%'],
            content: url
        });
    }

    //商品搜索页面
    function getSearDate() {
        return seardata;
        console.log(seardate);
    }
    function getCount() {
        return count;
    }
    function getSearKey() {
        return key;
    }

    //-- 选择商品的回调 --
    function m_call_back(data) {
        var html="";
        html="<tr> <td style=\"text-align: center\">"+data.WareNo+"</td> <td style=\"text-align: center\"><div class='gname'>"+data.WareName+"</div></td> <td style=\"text-align: center\">"+data.BarCode+"</td> <td style=\"text-align: center\">"+data.PosPrice+"</td> <td style=\"text-align: center\"> <input type=\"text\" style=\"width:60px\" name=\"num[]\" class=\"price\"  value=\"1\" onkeyup=\"this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')\" autocomplete=\"off\"></td> <td style=\"text-align: center\" onclick=\"delpro(this);\"><a class=\"btn red\" onclick=\"delpro(this)\" data-id=\"\"><i class=\"fa fa-trash-o\"></i>删除</a></td>";
        html+="<td class='\"dn\"'><input type='hidden' value='"+data.Id+"' name='fromid[]'/><input type=\"hidden\" name=\"fw_name[]\" value=\"\"><input type=\"hidden\" name=\"fw_no[]\" value=\"\"><input type='hidden' value='1' name='lbtype[]'/></td>";
        html+="</tr>";
        $("#send_good_list").append(html);
        layer.closeAll('iframe');

    }
    //--- 优惠券 ---
    function cp_call_back(data) {

        if(data.use_start_time.indexOf("1970-01-01") != -1){
            data.use_start_time="不限"
        }
        if(data.use_end_time.indexOf("1970-01-01") != -1){
            data.use_end_time="不限"
        }
        var html="";
        html="<tr> <td style=\"text-align: center\">"+data.name+"</td> <td style=\"text-align: center\">"+data.type+"</td><td style=\"text-align: center\">"+data.use_start_time+"\n"+data.use_end_time+"</td> <td style=\"text-align: center\">"+data.money+"</td> <td style=\"text-align: center\">"+data.condition+"</td> <td style=\"text-align: center\"> <input type=\"text\" style=\"width:60px\" name=\"num[]\" class=\"price\"  value=\"1\" onkeyup=\"this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')\" autocomplete=\"off\">张 </td> <td style=\"text-align: center\" onclick=\"delpro(this);\"><a class=\"btn red\" onclick=\"delpro(this)\" data-id=\"\"><i class=\"fa fa-trash-o\"></i>删除</a></td>";
        html+="<td class='\"dn\"'><input type='hidden' value='"+data.id+"' name='fromid[]'/> <input type=\"hidden\" name=\"fw_name[]\" value=\"\"><input type=\"hidden\" name=\"fw_no[]\" value=\"\"> <input type='hidden' value='2' name='lbtype[]'/></td>";
        html+="</tr>";
        $("#send_quan_list").append(html);
        layer.closeAll('iframe');
    }
    
    function SMcall_back(classid,classno,classname) {
        var html="";
        html="<tr><td style=\"text-align: center\">"+classno+"</td><td style=\"text-align: center\">"+classname+"</td><td style=\"text-align: center\"> <input type=\"text\"  style=\"width: 60px;text-align: center\"  name=\"num[]\" class=\"price\"  value=\"1\" onkeyup=\"this.value = this.value.replace(/^(d+).(d{3})/,'')\" autocomplete=\"off\"> </td> <td style=\"text-align: center\" onclick=\"delpro(this);\"><a class=\"btn red\" onclick=\"delpro(this)\" data-id=\"\"><i class=\"fa fa-trash-o\"></i>删除</a></td>";
        html+="<td class='\"dn\"'><input type='hidden' value='"+classid+"' name='fromid[]'/><input type='hidden' value='3' name='lbtype[]'/><input type='hidden' value='"+classname+"' name='fw_name[]'/>   <input type='hidden' value='"+classno+"' name='fw_no[]'/></td>";
        html+="</tr>";
        $("#send_fw_list").append(html);
        layer.closeAll('iframe');
    }

    //删除选择商品
    function  delpro(obj) {
        layer.open({
            content:'是否确认删除?'
            ,btn:['确认','取消'],
            btn1:function (index) {
                $(obj).parents('tr').remove();
                layer.closeAll();
            }
        })

    }

    // 选择礼包类型
    $("#lbtype").change(function(){
        console.log($(this).val());
        if($(this).val().toString()=="1")
        {
            $(".show1").show();
            $(".show2").hide();
        }
        else
        {
            $(".show1").hide();
            $(".show2").show();
        }
        $("#goods_list").html("");
    })

    //--- 上传图片回调  ---
    function img_call_back(fileurl_tmp) {
        var getqclurl = $("#qclurl").val();
        $("#img_url").val(fileurl_tmp);
        $("#lburl2").attr('src', getqclurl + fileurl_tmp);
    }

    //------  确认保存  ------
    function submit() {
        console.log( "有进来吗");

        /*判断礼包类型是不是空*/
        var arr_plus = [];
        $(".libao_tpey").each(function(index,obj){
            var checked=$(obj).is(":checked");
            var data={};
            data=checked;
            arr_plus.push(data);

        })

        var result= arr_plus.indexOf(true)
        if(result==-1){
            layer.msg('请选择礼包类型', {icon: 2, time: 2000});
            return false;
        }


        if( $.trim($('#lbtitle').val()) == '') {
            layer.msg('请输入礼包名称', {icon: 2, time: 2000});
            return false;
        }



        //--- 兑换时间的判断 --
        var exchange_type =$("#exchange_type").val();
        /*console.log(exchange_type,"兑换时间的类型");*/
        if(exchange_type==1){
            /*console.log($('#exchange_day').val() ,"兑换时间天数");*/
            if ($('#exchange_day').val() == '' ||  parseFloat($('#exchange_day').val())<=0 ) {
             /*   console.log( "兑换时间天数2333");*/
                layer.msg('固定天数必须大于0', {icon: 2, time: 2000});
                return false;
            }
        }else{
            if ($('#exchange_startime').val() == '') {
                layer.msg('请输入兑换开始时间', {icon: 2, time: 2000});
                return false;
            }
            /*---时间---*/
            if($('#exchange_endtime').val()==""){
                layer.msg('请输入兑换结束时间', {icon: 2, time: 2000});
                return false;
            }

            var exchange_startime = new Date($('#exchange_starttime').val().replace(/-/g, "/"));
              var exchange_endtime = new Date($('#exchange_endtime').val().replace(/-/g, "/"));

            if (exchange_endtime <= exchange_startime) {
                $('#endtime').next().removeClass('dn');
                layer.msg('结束时间必须大于开始时间', {icon: 2, time: 2000});
                return false;
            }
        }

        if ($('#oldprice').val() == '') {
            layer.msg('请输入礼包原价', {icon: 2, time: 2000});
            return false;
        }
        if(parseFloat($('#oldprice').val())<=0){
            layer.msg('礼包原价必须大于0', {icon: 2, time: 2000}); return false;
        }

        //没有启用仅限活动
        //var is_act=$("#is_act").is(':checked');
        var is_act=$("input[name='is_act']:checked").val();
        if(!is_act){
             if(($('#lbprice').val() == '' ||  parseFloat($('#lbprice').val())<=0) && ($('#lbintegral').val() == '' ||  parseFloat($('#lbintegral').val())<=0))
             {
                layer.msg('礼包价格和礼包积分不允许全为空或0', {icon: 2, time: 2000});
                return false;
             }
            if ($('#lbnum').val() == '' ||  parseFloat($('#lbnum').val())<=0) {
                layer.msg('礼包总数必须大于0', {icon: 2, time: 2000});
                return false;
            }

            /*---时间---*/
            if($('#startime').val()==""){
                layer.msg('请输入活动的开始时间', {icon: 2, time: 2000});
                return false;
            }
            if($('#endtime').val()==""){
                layer.msg('请输入活动的结束时间', {icon: 2, time: 2000});
                return false;
            }
            var startdate = new Date($('#startime').val().replace(/-/g, "/"));
            var enddate = new Date($('#endtime').val().replace(/-/g, "/"));
            if (enddate <= startdate) {
                $('#endtime').next().removeClass('dn');
                layer.msg('结束时间必须大于开始时间', {icon: 2, time: 2000});
                return false;
            }

        <if condition="$is_stime eq 1">
                if ($("#endtime").val()<$("#hidendtime").val())
                {
                    layer.msg('结束时间不能小于'+$("#hidendtime").val(), {icon: 2, time: 2000});
                    return false;
                }
        </if>
        }


        if($("#lbtype").val()==1 && ($('#expday').val() == '' || $('#expday').val() == '0'))
        {
            layer.msg('礼包有效天数必须大于0', {icon: 2, time: 2000});
            return false;
        }
        if ($('#limitnum').val() == '') {
            layer.msg('限购数量不能为空', {icon: 2, time: 2000});
            return false;
        }

        //if(!is_act){
            if ($('#img_url').val() == '') {
                layer.msg('请选择礼包图片', {icon: 2, time: 2000});
                return false;
            }
         //}

        //--- 如果积分的被选中 ---
        if($("#lb_type4").is(':checked')){
            var jf= $.trim($("#lbintegral").val());
            if(jf==""){ layer.msg('请填写积分', {icon: 2, time: 2000});return false; }
            if(parseFloat(jf)<0){ layer.msg('请填写积分', {icon: 2, time: 2000});return false; }
        }

        //--- 如果成长值的被选中 ---
        if($("#lb_type5").is(':checked')){
            var cz= $.trim($("#lbgrowthvalue").val());
            if(cz==""){ layer.msg('请填写成长值', {icon: 2, time: 2000});return false; }
            if(parseFloat(cz)<0){ layer.msg('请填写成长值', {icon: 2, time: 2000});return false; }
        }

        //--- 如果礼品的被选中 ---
        if($("#lb_type1").is(':checked')){
            if($("#send_good_list tr").length<1)
            {
                layer.msg("请选择礼品", {icon: 2, time: 2000});
                return false;
            }
        }
        //--- 如果券的被选中 ---
        if($("#lb_type2").is(':checked')){
            if($("#send_quan_list tr").length<1)
            {
                layer.msg('请选择礼券', {icon: 2, time: 2000});
                return false;
            }
        }
        //--- 如果服务项目的被选中 ---
        if($("#lb_type3").is(':checked')){
            if($("#send_fw_list tr").length<1)
            {
                layer.msg('请选择服务项目', {icon: 2, time: 2000});
                return false;
            }
        }
        $("input").attr("disabled",false);
        $("select").attr("disabled",false);


       layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '10px', time: 100000});
        $('#addlbform').submit();
        
    }

    //--- 点击礼包类型的事件 ----
    function checkbox_click(ind) {
        //--- 判断是不是有点击 ---
        if($("#lb_type"+ind).is(':checked')){
            switch(ind){
                case 1: $(".liping_set").show(); break;
                case 2: $(".quan_set").show(); break;
                case 3: $(".fuwu_set").show();break;
                case 4: $("#send_jf").show(); break;
                case 5: $("#send_czz").show(); break;
            }
        }else{
            switch(ind){
                case 1: $(".liping_set").hide(); break;
                case 2: $(".quan_set").hide(); break;
                case 3: $(".fuwu_set").hide();break;
                case 4 :$("#send_jf").hide();break;
                case 5: $("#send_czz").hide(); break;
            }
        }
    }

    //仅限活动使用的点击事件
    $(".lblx_radio").click(function () {
        var is_act=$("input[name='is_act']:checked").val();

        if(is_act=="1") {
            $(".userqy").hide();$(".user_plus").hide(); $("#lb_price_set").hide();
            $("#lb_remark").hide();
            //$("#lb_pic").hide();
            $("#lb_all").hide();
            $("#user_type").hide();
            $("#stare_time").hide();

            $(".userqy_cb").attr("checked", false);
            $(".plus_cb").attr("checked", false);
            $("#lbprice").val(0);
            $("#exchangeintegral").val(0);
            $("#is_act").val(1);

        }else{
            $(".userqy").show();$(".user_plus").show();$("#lb_price_set").show();
            $("#lb_remark").show();
            //$("#lb_pic").show();
            $("#lb_all").show();
            $("#is_act").val(0);

            $("#user_type").show();
            $("#stare_time").show();
        }
    })


    function set_num(ob) {
        var value=$(ob).val();
        value=value.replace(/[^\d]/g,'')
        $(ob).val(value);
    }


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