seam há 7 anos atrás
pai
commit
a17182b874
1 ficheiros alterados com 56 adições e 11 exclusões
  1. 56 11
      www/webapp/housekeeping/src/components/management/edit.vue

+ 56 - 11
www/webapp/housekeeping/src/components/management/edit.vue

@@ -21,16 +21,21 @@
         <div><span class="title">预约状态:</span>{{order.contract_str}}</div>
         <div>
           <!--选择时间-->
-          <datetime v-model="bookingTime"  format="YYYY-MM-DD HH:00"
-                    @on-change="change" :title="('预约日期')" year-row="{value}年" month-row="{value}月" day-row="{value}日"
+          <datetime v-model="bookingTime" format="YYYY-MM-DD HH:00"
+                    @on-change="change" :title="('预约日期:')" year-row="{value}年" month-row="{value}月" day-row="{value}日"
                     hour-row="{value}点" minute-row="{value}分" confirm-text="完成" cancel-text="取消"
                     :start-date='startDate'
                     placeholder="请选择日期"
                     :end-date='endDate' :min-hour=9 :max-hour=18></datetime>
         </div>
-        <div><span class="title">家政员:</span><span v-if="order.tech == ''">暂未分配家政员</span>{{order.tech}}</div>
+        <div>
+          <span class="title">家政员:</span><span><input v-model="tech" class="tech" type="text"
+                                                      placeholder='请输入家政员'></span>
+        </div>
         <div><span class="title">备注:</span>{{order.desc}}</div>
-
+      </div>
+      <div class="m-btn">
+        <x-button type="primary" @click.native='btnSubmint'>提交</x-button>
       </div>
     </div>
   </scroller>
@@ -38,7 +43,8 @@
 <script>
   import _ from '@/config'
   import selectTime from '@/config/selectTime'
-  import {Group, DatetimeRange, TransferDom, Datetime} from 'vux'
+  import axios from 'axios'
+  import {Group, Datetime, XButton} from 'vux'
 
   export default {
     name: 'orderInfo',
@@ -52,6 +58,7 @@
         value: ['2017-06-24', '03', '05'], // 设定日期格式
         startDate: selectTime.startDate, // 限定最小日期
         endDate: '', // 限定最大日期
+        tech: ''
       }
     },
     created() {
@@ -74,15 +81,36 @@
     },
     components: {
       Group,
-      DatetimeRange,
-      TransferDom,
       Datetime,
+      XButton
     },
     methods: {
-      appointmentDate() {
+      btnSubmint() {
+        let that = this;
+        if (that.bookingTime.length == 0) {
+          weui.alert('请选择预约日期');
+          return
+        }
+        if (that.tech.length == 0) {
+          weui.alert('请输入家政人员');
+          return
+        }
+        // 字符串拼接
+        let stitching = `&id=${_.oldOrderInfo.id}&status=2&status_time=${ycTime(this.bookingTime)}&tech=${this.tech}`;
+        axios.post(_.apiPath + 'j/HouseKeeping/Edit' + stitching).then(res => {
+          if (res.data.success) {
+            weui.alert('提交成功',function () {
+              that.$router.push({path:'/managementList'})
+            });
+            return
+          } else {
+            weui.alert('提交失败');
+            return
+          }
+        })
       },
       change(val) {
-        console.log(val)
+        this.bookingTime = val;
       },
     },
     watch: {
@@ -94,6 +122,13 @@
     }
   }
 
+  // 日期转时间戳 2014-07-10
+  function ycTime(t) {
+    let stringTime = t + ':00';
+    let timestamp = Date.parse(new Date(stringTime));
+    timestamp = timestamp / 1000;
+    return timestamp;
+  }
 </script>
 <style scoped lang="less">
   .weui-cell {
@@ -128,8 +163,18 @@
     }
   }
 
+  .tech, .tech:focus {
+    border: 0;
+    outline: none
+  }
+
+  .m-btn {
+    width: 80%;
+    margin: 10% auto 0;
+  }
+
   p {
-    color: #2c3e50!important;
-    font-size: 15px!important;
+    color: #2c3e50 !important;
+    font-size: 15px !important;
   }
 </style>