瀏覽代碼

预约时间

DengTao 8 年之前
父節點
當前提交
6e75e3257b

+ 3 - 0
www/protected/modules/moonclub/models/Reserve.php

@@ -13,6 +13,7 @@ class Reserve extends MongoAr{
     public $homeType;
     public $num;
     public $sex;
+    public $booking_time;//预约时间
     public $type;//咨询类型
     public $tech_content;//服务内容
     public $status;//0 待处理 1 已处理
@@ -63,6 +64,8 @@ class Reserve extends MongoAr{
         $newRow['status'] = CommonFn::get_val_if_isset($row,'status');
         $newRow['time'] = CommonFn::get_val_if_isset($row,'time','');
         $newRow['type'] = CommonFn::get_val_if_isset($row,'type','');
+        $newRow['booking_time'] = CommonFn::get_val_if_isset($row,'booking_time',0);
+        $newRow['booking_time_str'] = date('Y年n月d日 H:i',$newRow['booking_time']);;
         if(APPLICATION=='admin'){
             $newRow['action_user'] = CommonFn::get_val_if_isset($row,'action_user',"");
             $newRow['action_time'] = CommonFn::get_val_if_isset($row,'action_time',"");

+ 72 - 16
www/protected/modules/moonclub/views/reserve/index.php

@@ -25,7 +25,7 @@
         </div>
     </div>
     <div id="acc_container" class="accordion" region="center">
-        <div region="center" title="充值卡" data-options="iconCls:'icon-save',selected:true">
+        <div region="center" title="详细信息" data-options="iconCls:'icon-save',selected:true">
             <div class="easyui-layout detail_layout">
                 <div data-options="region:'center'" class="detail_center">
                     <div class="detail_main">
@@ -89,6 +89,17 @@
                                         </div>
                                     </div>
                                 </li>
+                                <li class="f_item">
+                                    <div class="box">
+                                        <div class="f_label">
+                                            <span>预约时间: </span>
+                                        </div>
+                                        <div class="box_flex f_content">
+                                            <input id="booking_time" type="text" >
+                                            <input type="hidden" name="booking_time" id="booking_time_str"  />
+                                        </div>
+                                    </div>
+                                </li>
                                 <li class="f_item">
                                     <div class="box">
                                         <div class="f_label">
@@ -170,6 +181,45 @@
 
             }
         });
+        jq_filter_status.combobox({
+            width: 100,
+            data: status_data,
+            editable: false,
+            onSelect: function(){
+                search_content();
+            }
+        });
+
+        var buttons = $.extend([], $.fn.datebox.defaults.buttons);
+        buttons[0].text = '确定';
+        buttons[0].handler=function(){
+            var vals = $('#booking_time').datetimebox('spinner').spinner('getValue').split(':');
+            $('#booking_time_str').val(  parseInt($('#booking_time_str').val())-(parseInt($('#booking_time_str').val())+8*3600)%86400 +vals[0]*3600+vals[1]*60);
+
+            var d=new Date(parseInt($('#booking_time_str').val())*1000);
+            $('#booking_time').datetimebox('setText',formatDate(d));
+            $('#booking_time').datetimebox('hidePanel');
+        };
+
+        $('#booking_time').datetimebox({
+            required: false,
+            showSeconds:false,
+            buttons:buttons,
+            onSelect: function(date){
+                var currentDate = new Date();
+                //console.log(date);
+                // if(currentDate>=date){
+                //     $.messager.show({
+                //         title: '提示',
+                //         msg: '必须选择现在之后的日期',
+                //         timeout: 3500,
+                //         showType: 'slide'
+                //     });
+                // }else{
+                $('#booking_time_str').val(date.getTime()/1000);
+                // }
+            }
+        });
 
 
 
@@ -188,7 +238,6 @@
                 var status_data_temp = new Array();
                 $.extend(status_data_temp, status_data);
                 status_data_temp.shift();
-
                 return status_data_temp;
             })()
         });
@@ -267,7 +316,7 @@
                     var   hour = now.getHours();
                     return   month+"月"+date+"日"+hour+":00";
                 }
-                },
+                }
             ]],
 
             onSelect: function(index, row){
@@ -283,6 +332,7 @@
                 $('#user_name').html(data.user_name);
                 $('#tech_content').html(data.tech_content);
                 jq_content_form.form('load', data);
+                $('#booking_time').datetimebox('setValue', parse_time(data,'booking_time'));
                 $('#admins_edit_info').html('');
                 if (data['action_user'] != ''){
                     jq_action_info.html('信息已被编辑: ' + data['action_user'] + ' ' + data['action_time']);
@@ -290,22 +340,12 @@
                     jq_action_info.html('');
                 }
 
+            },
+            onLoadSuccess : function () {
+                $('#booking_time_str').val('');
             }
 
         });
-
-        jq_filter_status.combobox({
-            width: 100,
-            data: status_data,
-            editable: false,
-            onSelect: function(){
-                search_content();
-            }
-        });
-
-
-
-
         jq_content_form.form({
             url: module_router + '/edit',
             onSubmit: function(param){
@@ -388,6 +428,22 @@
         $.messager.progress();
         jq_content_form.submit();
     }
+    function parse_time(data,attr){
+        if(data[attr]){
+            var d=new Date(data[attr]*1000);
+            return formatDate(d);
+        }else{
+            return '';
+        }
+    }
+    function   formatDate(now){
+        var   year=now.getFullYear();
+        var   month=now.getMonth()+1;
+        var   date=now.getDate();
+        var  hour = now.getHours();
+        var  minute = now.getMinutes();
+        return   year+"-"+month+"-"+date+" "+hour+":"+minute;
+    }
     function search_content(){
 
         var filter_status = jq_filter_status.combobox('getValue');