index.html 16 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
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <title>预约服务 -{$tpshop_config['shop_info_store_title']}</title>
    <link rel="stylesheet" href="__STATIC__/css/reservation.css"/>
    <link rel="stylesheet" href="__STATIC__/css/kwj-m-lib.min.css"/>
    <link rel="stylesheet" href="__STATIC__/css/script.css"/>
    <link rel="stylesheet" href="__STATIC__/css/LCalendar.min.css"/>
    <!--<link rel="stylesheet" href="__STATIC__/css/time_common.css"/>-->
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/jquery.scroller-1.0.2.min.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/layer.css"/>
    <script type="text/javascript" src="__STATIC__/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="__STATIC__/js/rem_JScript.js"></script>
    <script type="text/javascript" src="__STATIC__/js/layer.js"></script>
    <script type="text/javascript" src="__STATIC__/js/LCalendar.js"></script>

    <!--<script type="text/javascript" src="__STATIC__/js/time_date.js"></script>-->
    <!--<script type="text/javascript" src="__STATIC__/js/time_iscroll.js"></script>-->
    <style type="text/css">
        body{ background-color: #fff}
        select {
            /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/
            border: 0;
            /*很关键:将默认的select选择框样式清除*/
            appearance: none;
            -moz-appearance: none;
            -webkit-appearance: none;
            /*为下拉小箭头留出一点位置,避免被文字覆盖*/
            padding-right: .2rem;
            background-color: #fff;
        }

        .tran80 {
            position: fixed;
            left: 0;
            top: 0;
            z-index: 100;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.6);
        }
    </style>
    <link rel="stylesheet" href="../static/css/reservation.css">
</head>

<body>
<if condition="$state eq add">
    <div class="main state_add">
        <div class="inner f0">
            <ul>
                <li>
                    <div class="sel_box disfx">
							<span class="fxall">
                		<img class="re1" src="__STATIC__/images/reservation/re1.png"/>
                		<span class="dis_vm"></span>
							</span>

                        <span class="fxfive">
                		<select name="" class="res_select" id="project" onchange="resernum();getstore()">
                             <option value="0" selected>请选择预约项目</option>
                             <if condition="$project">
									 <foreach $project as $vo>
                                       <option value="{$vo.WareId}">{$vo.WareName}</option>
                                     </foreach>
                             </if>
                		</select>
                	</span>
                    </div>
                </li>
                <li>
                    <div class="sel_box disfx">
							<span class="fxall">
                		<img class="re2" src="__STATIC__/images/reservation/re2.png"/>
                		<span class="dis_vm"></span>
							</span>

                        <span class="fxfive">
                		<select name="" class="res_select" id="stores" onchange="resernum()">
                			<option value="0" selected>请选择预约门店</option>


                                       <!--<option value="{$vo.Id}" address="{$vo.Address}">{$vo.StorageName}</option>-->


                		</select>
                	</span>
                    </div>
                </li>
                <li>
                    <div class="sel_box disfx">
							<span class="fxall">
                		<img class="re3" src="__STATIC__/images/reservation/re3.png"/>
                		<span class="dis_vm"></span>
							</span>
                        <span class="fxfive">
<input id="demo2" type="text" class="kbtn" name="restime" readonly="" placeholder="请选择预约时间" value=""
       data-lcalendar="{$thistime.open},{$thistime.end}"/>

                	</span>
                    </div>
                </li>
                <li>
                    <div class="sel_box disfx">
							<span class="fxall">
                		<img class="re4" src="__STATIC__/images/reservation/re4.png"/>
                		<span class="dis_vm"></span>
							</span>
                        <span class="fxfive">
                		<input type="tel" name="" id="peoplenum" onkeyup="this.value=this.value.replace(/\D/g,'')"
                               onafterpaste="this.value=this.value.replace(/\D/g,'')" value="" placeholder="到店人数"/>
                            <input type="hidden" id="maxpeopnum1" class="maxpeopnum" name="maxpeopnum" />
                            <input type="hidden" id="shoppers" class="shoppers" name="shoppers" />
                	</span>
                    </div>
                </li>
            </ul>
            <div class="remark_box">
                <textarea id="remark" class="remark mb20" placeholder="请输入备注"></textarea>
                <div class="btn_big moz_b4 moz_t4" onclick="reserbtn(this)">确认预约</div>
            </div>
        </div>
    </div>
    <div id="tran80" class="tran80 dn"></div>
    <else/>
    <div class="main state_see">
        <input type="hidden" id="VIPID" name="VIPID" value="{$see_data.VIPNo}">
        <input type="hidden" id="orderid" name="ID" value="{$see_data.Id}">
        <div class="inner f0">
            <ul>
                <li>
                    <b>预约号:</b>
                    <span class="res_pro cut f28" style="width: 4.5rem">{$see_data.number}</span>
                </li>
                <li>
                    <img class="re1 re" src="__STATIC__/images/reservation/re1.png"/>预约服务
                    <span class="res_pro cut">{$see_data.WareName}</span>
                </li>
                <li>
                    <img class="re2 re" src="__STATIC__/images/reservation/re2.png"/>预约门店
                    <span class="res_pro cut">{$see_data.StorageName}</span>
                </li>
                <li>
                    <img class="re3 re" src="__STATIC__/images/reservation/re3.png"/>预约日期
                    <span class="res_pro cut">
                        {:date("Y-m-d H:i:s",strtotime($see_data['RSDate']))}
                    </span>
                </li>
                <li>
                    <img class="re4 re" src="__STATIC__/images/reservation/re4.png"/>到店人数
                    <span class="res_pro cut">{$see_data.PeopleQty}</span>
                </li>
            </ul>
            <div class="remark_see">
                <div class="remark_pro">
                    {$see_data.Remrak}
                </div>
                <div class="btn_big moz_b4 moz_t4" onclick="cancelbtn(this)">取消预约</div>
            </div>
        </div>
    </div>

</if>
</body>

</html>
<script type="text/javascript">
    var getstoid = {$Think.request.stoid
    }
    ;
    //    时间选择器
    var calendardatetime = new LCalendar();
    calendardatetime.init({
        'trigger': '#demo2',
        'type': 'datetime'
    });
    $("#demo2").click(function () {
        $("#tran80").removeClass("dn");

    });
    //关闭遮罩
    function closetran80() {
        $("#tran80").addClass("dn");
    }
    $(function () {
        //页面一打开执行加载动画
        layer.open({
            type: 2,
            shadeClose: false
        });
        //页面加载完成后关闭加载动画
        window.onload = function () {
            layer.closeAll();
        };
        $('#demo2').bind('input propertychange', function () {
            resernum();
        });
    });
    //判断预约人数
    function resernum() {
        var WareId = $("#project").val();//预约项目ID
        var StorageId = $("#stores").val();//预约门店ID
        var RSDate = $("#demo2").val();//预约时间
        var PeopleQty = $("#peoplenum").val();//预约人数
        if (WareId != '' && WareId != 0 && StorageId != '' && StorageId != 0 && RSDate != '') {
            layer.open({type: 2, shadeClose: false});
            $.ajax({
                type: "post",
                url: '/index.php?m=Mobile&c=Reservation&a=resernum&stoid=' + getstoid + '',
                data: {
                    WareId: WareId,
                    StorageId: StorageId,
                    PeopleQty: PeopleQty,
                    RSDate: RSDate,
                },
                dataType: 'json',
                success: function (data) {
                    if (data['code'] == 1) {
                        var peopledate = data.peopledata.PeopleQty;//最大可预约人数
                        var shoppers = data.peopledata.VipId;//导购ID
                        $("#peoplenum").attr("placeholder", "剩余可预约人数:" + peopledate + "人");
                        $("#maxpeopnum1").attr("value",peopledate);
                        $("#shoppers").attr("value",shoppers);
                        layer.closeAll();
                    }else {
                        layer.closeAll();
                        layer.open({content: "加载失败,请重试", time: 3});
                    }
                },
                error: function () {
                    layer.closeAll();
                    layer.open({content: "加载失败,请重试", time: 3});
                }
            })
        }
    }

    //获取门店
    function  getstore() {
        var WareId = $("#project").val();//预约项目ID
        if (WareId=="")
        {
            layer.closeAll();
            layer.open({content: "请选择预约项目", time: 3});
        }
        layer.open({type: 2, shadeClose: false});
        $.ajax({
            type: "post",
            url: '/index.php?m=Mobile&c=Reservation&a=storelist&stoid=' + getstoid + '',
            data: {
                WareId: WareId,
            },
            dataType: 'json',
            success: function (data) {
                if (data['code'] == 1) {
                    var obj=data['data'];
                    $('#stores').empty();
                    $('#stores').append("<option value='0'>请选择预约门店</option>");
                    for (var i = 0; i < obj.length; i++) {
                        var getmoreaddress="";
                        if (obj[i].Address!=null && obj[i].Address!="null")
                        {
                            getmoreaddress=obj[i].Address;
                        }
                        if (obj[i].EditAddress!=null && obj[i].EditAddress!="null")
                        {
                            getmoreaddress+=obj[i].EditAddress;
                        }
                        $('#stores').append('<option value='+obj[i].Id+' address='+getmoreaddress+'>'+obj[i].StorageName+'</option>')
                    }

                    layer.closeAll();
                }else {
                    layer.closeAll();
                    layer.open({content: "加载失败,请重试", time: 3});
                }
            },
            error: function () {
                layer.closeAll();
                layer.open({content: "加载失败,请重试", time: 3});
            }
        })

    }

    //取消预约
    function cancelbtn(obj) {
        //询问框
        layer.open({
            content: '您确定要取消预约吗?'
            , btn: ['是', '否']
            , yes: function (index) {
                layer.open({type: 2, shadeClose: false});
                var ID = $("#orderid").val();
                $.ajax({
                    type: "post",
                    url: '/index.php?m=Mobile&c=Reservation&a=cancel&stoid=' + getstoid + '',
                    data: {
                        ID: ID
                    },
                    dataType: 'json',
                    success: function (data) {
                        if (data['code'] == 1) {
                            layer.closeAll();
                            layer.open({content: data['msg'], time: 2});
                            location.href = location.href;
                            location.href = '/mobile/Reservation/index/stoid/' + getstoid + '';
                        } else {
                            layer.closeAll();
                            layer.open({content: "操作失败,请重试", time: 1});
                        }
                    },
                    error: function () {
                        layer.closeAll();
                        layer.open({content: "加载失败,请重试", time: 1});
                    }
                })
            }
        });
    }
    //确认预约
    function reserbtn(obj) {
        var shoppers = $("#shoppers").val();//导购ID
        var WareId = $("#project").val();//预约项目ID
        var StorageId = $("#stores").val();//预约门店ID
        var RSDate = $("#demo2").val();//预约时间
        var WareName = $("#project").find("option:selected").text();//预约项目Name
        var StorageName = $("#stores").find("option:selected").text();//预约门店Name
        var StorageAddress = $("#stores").find("option:selected").attr("address");
        var Remrak = $("#remark").val();//预约说明
        var maxpeopnum = $("#maxpeopnum1").val();//当前可预约人数
        var PeopleQty = $("#peoplenum").val();//预约人数
//        alert("当前可预约人数"+parseInt(maxpeopnum));
//        alert("预约人数"+parseInt(PeopleQty));
        if (parseInt(PeopleQty) >parseInt(maxpeopnum)) {
            layer.closeAll();
            layer.open({content: "预约人数超过可预约人数", time: 1});
            return false;
        }
        if (WareId == '' || WareId == 0) {
            layer.closeAll();
            layer.open({content: "请选择预约项目", time: 1});
            return false;
        }
        if (StorageId == '' || StorageId == 0) {
            layer.closeAll();
            layer.open({content: "请选择预约门店", time: 1});
            return false;
        }
        if (PeopleQty == ''|| PeopleQty==0) {
            layer.closeAll();
            layer.open({content: "请填写预约人数", time: 1});
            return false;
        }
        if (RSDate == '') {
            layer.closeAll();
            layer.open({content: "请选择预约时间", time: 1});
            return false;
        }
        var d = new Date(Date.parse(RSDate.replace(/-/g, "/")));
        var curDate = new Date();
        if (d <= curDate) {
            layer.open({content: "请选择大于当前时间", time: 1});
            return false;
        }
        layer.open({type: 2, shadeClose: false});
        $.ajax({
            type: "post",
            url: '/index.php?m=Mobile&c=Reservation&a=makeinfo&stoid=' + getstoid + '',
            data: {
                WareId: WareId,
                WareName: WareName,
                StorageId: StorageId,
                StorageName: StorageName,
                StorageAddress: StorageAddress,
                PeopleQty: PeopleQty,
                RSDate: RSDate,
                Remrak: Remrak,
                shoppers:shoppers,
            },
            dataType: 'json',
            success: function (data) {
                if (data['code'] == 1) {
                    layer.closeAll();
                    layer.open({content: data['msg'], time: 2});
                    location.href = '/mobile/Reservation/index/stoid/' + getstoid + '';
                }else if (data['code'] == -2){
                    layer.closeAll();
                    layer.open({content: data['msg'], time: 2});
                    $("#peoplenum").attr("placeholder", "剩余可预约人数:" + data['data'] + "人");
                }else {
                    layer.closeAll();
                    layer.open({content: data['msg'], time: 2});
                }
            },
            error: function () {
                layer.closeAll();
                layer.open({content: "加载失败,请重试", time: 1});
            }
        })
    }
</script>