seam 7 yıl önce
ebeveyn
işleme
9ab1cf6d9f

+ 68 - 9
www/webapp/housekeeping/src/components/management/edit.vue

@@ -5,8 +5,7 @@
       <div class="my-order-body">
         <div><span class="title">创建日期:</span>{{order.time}}</div>
         <div><span class="title">用户姓名:</span>{{order.user_name}}</div>
-        <div><span class="title">用户手机:</span><a id='tel' href="tel:13764567708">移动WEB页面JS一键拨打号码咨询功能</a></div>
-        <div><span class="title">用户手机:</span>{{order.mobile}}</div>
+        <div><span class="title">用户手机:</span><a id='tel' v-bind:href='`tel:${order.mobile}`'>{{order.mobile}}</a></div>
         <div><span class="title">服务地址:</span>{{order.address}}</div>
         <div><span class="title">服务类型:</span>{{order.type_str}}</div>
 
@@ -20,6 +19,8 @@
         <div v-if='order.type - 1 == 1'><span class="title">预产期:</span>{{order.yc_time}}</div>
         <div v-if='order.type -1 == 2'><span class="title">孩子年龄:</span>{{order.age}}岁</div>
         <div><span class="title">预约状态:</span>{{order.contract_str}}</div>
+        <div><span class="title">预约日期:</span><span class="appointment-date" @click='appointmentDate'>{{order.status_time}}</span>
+        </div>
         <div><span class="title">预约日期:</span>{{order.status_time}}</div>
         <div><span class="title">家政员:</span><span v-if="order.tech == ''">暂未分配家政员</span>{{order.tech}}</div>
         <div><span class="title">备注:</span>{{order.desc}}</div>
@@ -36,12 +37,13 @@
     data() {
       return {
         type: {0: '钟点工', 1: '月嫂', 2: '育婴师', 3: '护理老人', 4: '全套家务'},
-        order: null
+        order: null,
+        eAppointmentDate: false
       }
     },
     created() {
       if (_.oldOrderInfo === undefined) {
-        this.$router.push({path: '/order'})
+        this.$router.push({path: '/managementList'})
       }
       this.order = _.oldOrderInfo;
       // 转化时间格式
@@ -52,19 +54,76 @@
       this.order.server_end_time = _.timetrans(this.order.server_end_time);
       this.order.server_end_time = this.order.server_end_time.substring(11, 16);
       this.order.status_time = _.timetrans(this.order.status_time);
+      if (this.order.status - 1 == 0) {
+        this.eAppointmentDate = true
+      }
+    },
+    methods: {
+      appointmentDate() {
+        if (this.eAppointmentDate) {
+          let that = this;
+          let currentDate = new Date() // Sat Jun 24 2017 10:09:18 GMT+0800 (中国标准时间)
+          let currentYear = currentDate.getFullYear()  // 当前年 2017
+          let currentMonth = currentDate.getMonth() + 1 // 当前月 6
+          let currentDay = currentDate.getDate() // 当前日 24
+          let now = new Date().getHours() // 当前时 10
+          let min = new Date().getMinutes() // 当前 分
+          // 往后 6个月
+          let monthArr = [];
+          for (let i = 1; i < 7; i++) {
+            monthArr.push({
+              label: m(i),
+              value: i - 1
+            })
+          }
+
+          function m(i) {
+            let d = new Date();
+            // 因为getMonth()获取的月份的值只能在0~11之间所以我们在进行setMonth()之前先给其减一
+            d.setMonth((d.getMonth() - 1) + i);
+            let m = d.getMonth() + 1;
+            return m
+          }
+
+          console.log(monthArr);
+
+          weui.picker([currentYear], [monthArr], {
+            onChange: function (result) {
+              console.log(result);
+            },
+            onConfirm: function (result) {
+              console.log(result);
+            },
+            id: 'multiPickerBtn'
+          });
+
+          weui.datePicker({
+            start: new Date(), // 从今天开始
+            end: currentYear + 20,
+            defaultValue: [currentYear, currentMonth, currentDay, now, min],
+            onChange: function (result) {
+              //            console.log(result);
+            },
+            onConfirm: function (result) {
+              that.time = result[0].label + result[1].label + result[2].label
+              that.resTime = ycTime(`${result[0].value}-${result[1].value}-${result[2].value}`);
+            },
+            id: 'datePicker'
+          });
+
+
+        }
+      }
     },
-    watch:{
+    watch: {
       order: function (val, oldVal) {
-        if(val == undefined){
+        if (val == undefined) {
           this.$router.push({path: '/order'})
         }
       }
     }
   }
-  function telF(n) {
-    let $tel = document.getElementById('tel');
 
-  }
 </script>
 <style scoped lang="less">
   title {

+ 33 - 0
www/webapp/housekeeping/src/config/format.js

@@ -0,0 +1,33 @@
+module.exports = function format(date, fmt = 'YYYY-MM-DD HH:mm:ss') {
+  var o = {
+    'M+': date.getMonth() + 1,
+    'D+': date.getDate(),
+    'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
+    'H+': date.getHours(),
+    'm+': date.getMinutes(),
+    's+': date.getSeconds(),
+    'q+': Math.floor((date.getMonth() + 3) / 3),
+    'S': date.getMilliseconds()
+  }
+  var week = {
+    '0': '\u65e5',
+    '1': '\u4e00',
+    '2': '\u4e8c',
+    '3': '\u4e09',
+    '4': '\u56db',
+    '5': '\u4e94',
+    '6': '\u516d'
+  }
+  if (/(Y+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
+  }
+  if (/(E+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[date.getDay() + ''])
+  }
+  for (var k in o) {
+    if (new RegExp('(' + k + ')').test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
+    }
+  }
+  return fmt
+}