Explorar o código

雇主端-服务标准编辑

una %!s(int64=4) %!d(string=hai) anos
pai
achega
e7acf281c3

+ 3 - 2
client/app.json

@@ -20,8 +20,9 @@
     "pages/servant/servantsettings/servantsettings",
     "pages/servant/servantedit/servantedit",
     "pages/customer/servantsettings/servantsettings",
-    "pages/servant/servantsettings/servantsettings",
-    "pages/customer/reportList/reportList"
+   "pages/customer/servantedit/servantedit",
+    "pages/customer/reportList/reportList",
+    "pages/customer/editDailyTask/editDailyTask"
   ],
   "window": {
     "defaultTitle": "保姆管家",

+ 66 - 0
client/pages/customer/editDailyTask/editDailyTask.acss

@@ -0,0 +1,66 @@
+.daily-servant-page{
+  padding-top:24rpx;
+  padding-bottom: 10rpx;
+}
+.dailyitem{
+  padding:24rpx;
+  margin-bottom: 10rpx;
+}
+.every-week{
+  color: #666;
+  font-weight:normal;
+}
+.name-content{
+  padding-right:30rpx;
+}
+.name-input{
+  text-align: right;
+  width:100%;
+}
+.daily-list{
+  margin-top:24rpx;
+  display: flex;
+  flex-wrap: wrap;
+}
+.daily-item{
+  height: 52rpx;
+  line-height: 52rpx;
+  border:1rpx solid #999;
+  color: #999;
+  margin:0 20rpx 16rpx 0;
+  border-radius:52rpx;
+  text-align: center;
+  padding-left: 20rpx;
+  padding-right: 20rpx;
+}
+.daily-item-selected{
+  background: #E6F7FF;
+  border-color:#09AFFF;
+  color:#09AFFF;
+}
+.picker-wrapper{
+    padding:0 24rpx;
+  height: 102rpx;
+  margin-bottom:18rpx;
+  line-height: 102rpx;
+}
+
+.row{
+  display: flex;
+  align-items: center;
+}
+.row-title{
+  font-weight:bold;
+}
+.row-extra{
+  flex:1;
+  text-align: right;
+}
+.row-arrow{
+  width:12rpx;
+  height: 22rpx;
+  margin:0 0 0 10rpx;
+}
+.dailyitem-buttom{
+  height: 120rpx;
+}

+ 15 - 0
client/pages/customer/editDailyTask/editDailyTask.axml

@@ -0,0 +1,15 @@
+<view class="common-page-padding daily-servant-page">
+  <view a:for="{{allList}}" key="{{index}}">
+    <view class="common-card dailyitem">
+      <view class="cell-title">{{item.categoryName}}</view>
+      <view class="daily-list">
+        <view a:for="{{item.TaskItems}}"  a:for-item="dailyitem" class="daily-item {{dailyitem.checked==true ?'daily-item-selected':''}}" a:for-item="dailyitem" a:for-index='sdddd' key="{{index}}" data-id="{{dailyitem.id}}" data-index="{{dailyitem.categoryId}}" onTap="toggleWashinGandnursing">{{dailyitem.itemName}}</view>
+      </view>
+    </view>
+  </view>
+  <view class="dailyitem-buttom"></view>
+
+ <view class="common-button-wrapper">
+     <button type="primary" class="common-button" hover-class="active-button"  onTap="dailytasksdeit">完成编辑</button>
+  </view>
+</view>

+ 93 - 0
client/pages/customer/editDailyTask/editDailyTask.js

@@ -0,0 +1,93 @@
+import request from '../../../util/http'
+import apiUrl from '../../../util/apiUrl'
+import apiUrl1 from '../../../util/apiUrl1'
+var app = getApp();
+Page({
+  data: {
+    allList: []
+  },
+  onLoad(options) {
+    console.log(options);
+  },
+  onShow() {
+    this.initDailyTaskList();
+  },
+  //数据加载
+  initDailyTaskList() {
+    let params = {
+    }
+    request.httpServiceGet(apiUrl.getDailyTaskList, params).then(data => {
+      if (data.length > 0) {
+        //添加选中的状态列
+        let dailytasklist = data;
+        var that = this;
+        for(let i=0;i<dailytasklist.length;i++){
+          for(let j=0;j<dailytasklist[i].TaskItems.length;j++){
+            dailytasklist[i].TaskItems[j].checked=false;
+          }
+        }
+        this.setData({
+          allList: dailytasklist
+        });
+      } else {
+        this.setData({
+          allList: []
+        });
+      }
+    }).catch(e => {
+      console.log(e);
+    })
+
+  },
+  //点击选中任务
+  toggleWashinGandnursing(e) {
+    let currentIndex= e.target.dataset.index;//类型ID
+    let id = e.target.dataset.id;//选中当前ID
+    let dailytasklist=this.data.allList;
+    for(let i=0;i<dailytasklist.length;i++){
+      if(dailytasklist[i].categoryId==currentIndex){
+        for(let j=0;j<dailytasklist[i].TaskItems.length;j++){
+          if(dailytasklist[i].TaskItems[j].id==id){
+            if(dailytasklist[i].TaskItems[j].checked){
+              dailytasklist[i].TaskItems[j].checked=false;
+            }else{
+              dailytasklist[i].TaskItems[j].checked=true;
+            }
+          }
+        }
+      }
+    }
+    this.setData({
+          allList: dailytasklist
+        });
+
+  },
+  //提交数据
+  dailytasksdeit() {
+  let employRelationNo = app.globalData.employRelationNo;
+  let dailytasklist=[];
+    for(let i=0;i<this.data.allList.length;i++){
+      let itemIds=[];
+      let t=0;
+        for(let j=0;j<this.data.allList[i].TaskItems.length;j++){
+          if(this.data.allList[i].TaskItems[j].checked==true){
+            itemIds[t]=this.data.allList[i].TaskItems[j].id;
+            t++;
+          }
+        }
+        if(itemIds.length>0){
+          dailytasklist.push({categoryId:this.data.allList[i].categoryId,itemIds:itemIds});
+        }
+    }
+    request.httpServicePost(apiUrl1.createDayTaskItem,{employRelationNo:employRelationNo,taskItems:dailytasklist}).then(data=>{
+      my.alert({
+        title: '提示',
+        content: '保存完成',
+        buttonText: '确定',
+        success: () => {
+          my.navigateBack();
+        }
+      } );
+    });
+  },
+});

+ 3 - 0
client/pages/customer/editDailyTask/editDailyTask.json

@@ -0,0 +1,3 @@
+{
+   "defaultTitle": "每日任务"
+}

+ 102 - 0
client/pages/customer/servantedit/servantedit.acss

@@ -0,0 +1,102 @@
+.servant-settings-page{
+  background-color: #F3F3F3;
+}
+.servant-setting-header{
+  height: 62rpx;
+  line-height: 62rpx;
+  background-color: #E6F7FF;
+  color: #09AFFF;
+  padding-left: 35rpx;
+  padding-right: 24rpx;
+  font-size: 22rpx;
+}
+.notice-style{
+  width: 23rpx;
+  height: 22rpx;
+  margin-right: 10rpx;
+  float: left;
+  margin-top: 21rpx;
+}
+.close-stle{
+  width: 17.87rpx;
+  height: 17.87rpx;
+  float: right;
+  margin-top: 20rpx;
+}
+.setting-list{
+  background: #FFFFFF;
+  border-radius: 18px;
+  margin: 25.99rpx 24rpx 20rpx 24rpx;
+}
+.setting-list-title{
+  color: #333333;
+  font-size: 32rpx;
+  font-weight: bold;
+  text-align: center;
+  height: 80rpx;
+  line-height: 80rpx;
+  padding-right: 24rpx; 
+}
+.setting-list-title text{
+  font-size: 26rpx;
+  float: right;
+}
+.setting-list-titlelabel{
+  width: 72prx;
+  height: 80rpx;
+  font-size: 24rpx;
+  font-weight: 400;
+  color: #999999;
+  line-height: 80rpx;
+  display: inline-block;
+  float: left;
+  margin-left: 24rpx;
+}
+.icon-left{
+  width: 9rpx;
+  height: 16rpx;
+  margin-right: 7rpx;
+}
+.setting-list-item{
+  padding-left: 44rpx;
+  padding-top: 37rpx;
+  border-top: 1rpx solid #EEEEEE;
+  padding-bottom: 37rpx;
+}
+.item-title{
+  color: #333333;
+  font-size: 28rpx;
+  height: 28rpx;
+  line-height: 28rpx;
+  margin-bottom: 31rpx;
+  display: inline-block;
+}
+.item-body{
+  margin-bottom: 24rpx;
+  padding-left: 20rpx;
+}
+
+.item-body textarea{
+  background-color: #EEEEEE;
+  border: none;
+  height: 110rpx;
+  margin-left: 40rpx;
+  margin-right: 86rpx;
+  color: #CCCCCC;
+  font-size: 24rpx;
+  padding: 12rpx;
+  width: 80%;
+}
+.checkbox {
+  display: block;
+  margin-bottom: 20rpx;
+}
+
+button + button {
+  margin-top: 32rpx;
+}
+
+.checkbox-text {
+  font-size:34rpx;
+  line-height: 1.2;
+}

+ 42 - 0
client/pages/customer/servantedit/servantedit.axml

@@ -0,0 +1,42 @@
+<view class="servant-settings-page">
+<!--服务设置-->
+  <view class="servant-setting-header" a:if="{{tips}}">
+    <image mode="scaleToFill" src="/image/notice-blue.png" class="notice-style"/>
+    <text onTap="toservantdetail">您可以查看保姆偏好,双向沟通更清晰</text>
+    <image mode="scaleToFill" src="/image/close-blue.png" class="close-stle" onTap="closeTip"/>
+  </view>
+  <!--服务列表-->
+  <view class="setting-list">
+    <view  class="setting-list-title">
+      {{servanteditlist.subjectType}}
+    </view>
+    <view class="setting-list-item" a:for="{{servanteditlist.subjectList}}" a:for-item="subjectitem" key="{{subjectindex}}">
+      <view  a:if="{{subjectitem.isChoose}}" >
+        <text class="item-title">{{subjectitem.subject}}</text>
+          <view a:if="{{subjectitem.chooseType==1}}"> <!---单选-->
+            <checkbox-group onChange="answerselectedSingle"  data-id="{{subjectitem.subjectId}}">
+              <label class="checkbox" a:for="{{subjectitem.answer}}"  a:for-item="answeritem" key="label-{{answerindex}}">
+                <checkbox value="{{answeritem.answer}}" checked="{{answeritem.isChoose}}" color="#09AFFF" />
+                <text class="checkbox-text">{{answeritem.answer}}</text>
+              </label>
+            </checkbox-group>                             
+          </view>
+          <view a:if="{{subjectitem.chooseType==2}}"><!---多选-->
+            <checkbox-group onChange="answerselected"  data-id="{{subjectitem.subjectId}}">
+              <label class="checkbox" a:for="{{subjectitem.answer}}"  a:for-item="answeritem" key="label-{{answerindex}}">
+                <checkbox value="{{answeritem.answer}}" checked="{{answeritem.isChoose}}" color="#09AFFF" />
+                <text class="checkbox-text">{{answeritem.answer}}</text>
+              </label>
+            </checkbox-group>                             
+          </view>
+      </view>
+      <view class="item-body" a:if="{{subjectitem.isCustom==1}}">
+        <textarea placeholder="请输入文字" onBlur="customanswer" data-id="{{subjectitem.subjectId}}">{{subjectitem.customAnswer}}</textarea>
+      </view>
+    </view>
+  <!--提交按钮-->
+  <view  class="common-button-wrapper">
+     <button type="primary"  data-id="{{item.subtypeNo}}" class="common-button" hover-class="active-button" onTap="dailytasksdeit" >提交</button>
+  </view>
+  </view>
+</view>

+ 153 - 0
client/pages/customer/servantedit/servantedit.js

@@ -0,0 +1,153 @@
+import request from '../../../util/http'
+import apiUrl from '../../../util/apiUrl1'
+import util from '../../../util/util'
+import moment from 'moment'
+var app = getApp();
+
+Page({
+  data: {
+    tips:true,
+    servanteditlist:[],
+  },
+  onLoad(subtypeNo) {
+    this.loadpage(subtypeNo);
+  },
+  loadpage(subtypeNo){
+    let employRelationNo = app.globalData.employRelationNo;
+    let params = {employRelationNo:employRelationNo}
+    request.httpServiceGet(apiUrl.getSubjectWhenEdit, params).then(data => {
+      if (data.length > 0) {
+        //加载全部的类别
+        let subjectList={};
+        for(let i=0;i<data.length;i++){
+          if(data[i].subtypeNo==subtypeNo.subtypeNo){
+              subjectList=data[i];
+              console.log(subjectList);
+          }
+        }
+
+        this.setData({
+          servanteditlist: subjectList
+        });
+      } else {
+        this.setData({
+          servanteditlist: []
+        });
+      }
+    }).catch(e => {
+      console.log(e);
+    })
+  },
+  //提交数据
+  dailytasksdeit(){
+    let employRelationNo = app.globalData.employRelationNo;
+    let servantselectedlist=[];
+    for(let j=0;j<this.data.servanteditlist.subjectList.length;j++){
+      let answerstr='';
+        for(let t=0;t<this.data.servanteditlist.subjectList[j].answer.length;t++){
+            if(this.data.servanteditlist.subjectList[j].answer[t].isChoose){
+              answerstr += this.data.servanteditlist.subjectList[j].answer[t].answer +',';
+            }
+        }
+      //console.log(answerstr);
+      if(answerstr.length>0||this.data.servanteditlist.subjectList[j].customAnswer.length>0){
+        answerstr=answerstr.substring(0,answerstr.length - 1);
+        servantselectedlist.push({answer: [answerstr],customAnswer: this.data.servanteditlist.subjectList[j].customAnswer,subjectId: this.data.servanteditlist.subjectList[j].subjectId});
+      }
+    }
+      //console.log(servantselectedlist);
+      request.httpServicePost(apiUrl.updateServantLove,{employRelationNo:employRelationNo,subjectList:servantselectedlist,subjectType:"SN000002"}).then(data=>{
+        my.alert({
+          title: '提示',
+          content: '设置完成',
+          buttonText: '确定',
+          success: () => {
+            my.navigateBack();
+          }
+        } );
+      });
+  },
+  //选择问题 多选
+  answerselected(e){
+    let checkedlist=e.detail.value;
+    let servanteditlist=this.data.servanteditlist;
+    //先做清除
+    for(let j=0;j<servanteditlist.subjectList.length;j++){
+      if(servanteditlist.subjectList[j].subjectId==e.target.dataset.id){
+        for(let t=0;t<servanteditlist.subjectList[j].answer.length;t++){
+            servanteditlist.subjectList[j].answer[t].isChoose=0;
+        }
+      }
+    }
+    //添加选中
+    for(let j=0;j<servanteditlist.subjectList.length;j++){
+      if(servanteditlist.subjectList[j].subjectId==e.target.dataset.id){
+        for(let t=0;t<servanteditlist.subjectList[j].answer.length;t++){
+          for(let u=0;u<checkedlist.length;u++){
+            if(checkedlist[u]==servanteditlist.subjectList[j].answer[t].answer){
+              servanteditlist.subjectList[j].answer[t].isChoose=1;
+            }
+          }
+        }
+      }
+    }
+    this.setData({
+      servanteditlist: servanteditlist
+    })
+  },
+  //问题选择单选
+  answerselectedSingle(e){
+    let checkedlist=e.detail.value;
+    let servanteditlist=this.data.servanteditlist;
+    //先做清除
+    for(let j=0;j<servanteditlist.subjectList.length;j++){
+      if(servanteditlist.subjectList[j].subjectId==e.target.dataset.id){
+        for(let t=0;t<servanteditlist.subjectList[j].answer.length;t++){
+            servanteditlist.subjectList[j].answer[t].isChoose=0;
+        }
+      }
+    }
+    //添加选中
+    for(let j=0;j<servanteditlist.subjectList.length;j++){
+      if(servanteditlist.subjectList[j].subjectId==e.target.dataset.id){
+        for(let t=0;t<servanteditlist.subjectList[j].answer.length;t++){
+          for(let u=0;u<checkedlist.length;u++){
+            if(checkedlist[u]==servanteditlist.subjectList[j].answer[t].answer){
+              servanteditlist.subjectList[j].answer[t].isChoose=1;
+            }
+            else {
+              servanteditlist.subjectList[j].answer[t].isChoose=0;
+            }
+          }
+        }
+      }
+    }
+    this.setData({
+      servanteditlist: servanteditlist
+    })
+  },
+  //自定义问题
+  customanswer(e){
+    console.log(e.target.dataset.id);
+    let servanteditlist=this.data.servanteditlist;
+    for(let j=0;j<servanteditlist.subjectList.length;j++){
+      if(servanteditlist.subjectList[j].subjectId==e.target.dataset.id){
+          servanteditlist.subjectList[j].customAnswer = e.detail.value;
+          break;
+        }
+    }
+    this.setData({
+      servanteditlist: servanteditlist
+    })
+  },
+  closeTip(){
+    this.setData({
+      tips: false
+    })
+  },
+  toservantdetail(){
+    my.navigateTo({
+      url: '../servantdetail/servantdetail'
+    });
+  },
+});

+ 1 - 0
client/pages/customer/servantedit/servantedit.json

@@ -0,0 +1 @@
+{}

+ 2 - 23
client/pages/customer/servantlist/servantlist.axml

@@ -1,28 +1,7 @@
 <view class="common-page-padding servantlistpage">
 <!---服务列表-->
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">打扫类</view>
-     <view class="servantlistitem-right">
-      <image mode="scaleToFill" src="/image/icon-right.png"/>
-     </view>
-  </view>
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">做饭类</view>
-     <view class="servantlistitem-right">
-      <image mode="scaleToFill" src="/image/icon-right.png"/>
-     </view>
-  </view>
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">
-      打扫类
-      <!-- <label class="noset">未设置</label> -->
-     </view>
-     <view class="servantlistitem-right">
-      <image mode="scaleToFill" src="/image/icon-right.png"/>
-     </view>
-  </view>
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">做饭类</view>
+  <view class="servantlistitem" a:for="{{servantlist}}" key="{{index}}" data-id="{{item.subtypeNo}}" onTap="toEditPage">
+     <view class="servantlistitem-left">{{item.subjectType}}</view>
      <view class="servantlistitem-right">
       <image mode="scaleToFill" src="/image/icon-right.png"/>
      </view>

+ 32 - 1
client/pages/customer/servantlist/servantlist.js

@@ -1,4 +1,35 @@
+import request from '../../../util/http'
+import apiUrl from '../../../util/apiUrl1'
+import util from '../../../util/util'
+import moment from 'moment'
+var app = getApp();
 Page({
   data: {},
-  onLoad() {},
+  onLoad() {
+    this.loadpage();
+  },
+  loadpage(){
+    let params = {}
+    request.httpServiceGet(apiUrl.getSubjectWhenEdit, params).then(data => {
+      if (data.length > 0) {
+        //添加选中的状态列
+        let servantlist = data;
+        this.setData({
+          servantlist: servantlist
+        });
+      } else {
+        this.setData({
+          servantlist: []
+        });
+      }
+    }).catch(e => {
+      console.log(e);
+    })
+  },
+  toEditPage(e){
+    let subtypeNo=e.target.dataset.id;
+    my.navigateTo({
+      url: '../servantedit/servantedit?subtypeNo='+subtypeNo
+    });
+  },
 });

+ 1 - 1
client/pages/customer/taskreminder/taskreminder.axml

@@ -39,7 +39,7 @@
     <view class="common-page-padding tasks-list">
       <view class="cell-title">
         <label>任务提醒</label>
-        <!--<view class="tik-right"><image mode="scaleToFill" src="/image/icon-edit.png"/><label>编辑每日任务</label></view> -->
+        <view class="tik-right"  onTap="switchEditTask"><image mode="scaleToFill" src="/image/icon-edit.png"/><label>编辑每日任务</label></view>
       </view>
       <!--有提醒任务-->
       <view a:if="{{isreminds}}" a:for="{{taskList}}" key="{{index}}">

+ 5 - 0
client/pages/customer/taskreminder/taskreminder.js

@@ -50,6 +50,11 @@ Page({
       showcancelbox: true
     });
   },
+  switchEditTask(){
+    my.navigateTo({
+      url: '../editDailyTask/editDailyTask'
+    });
+  },
   hidecnacelbox(){
      this.setData({
       showcancelbox: false