Quellcode durchsuchen

编辑服务者,保姆中心

una vor 4 Jahren
Ursprung
Commit
33db5be50d

+ 2 - 1
client/app.json

@@ -9,7 +9,8 @@
     "pages/servant/servantdetail/servantdetail",
     "pages/customer/customerCenter/customerCenter",
     "pages/common/selectRole/selectRole",
-    "pages/customer/monthReport/monthReport"
+    "pages/customer/monthReport/monthReport",
+    "pages/customer/editServant/editServant"
   ],
   "window": {
     "defaultTitle": "保姆管家"

+ 3 - 1
client/pages/customer/createServant/createServant.json

@@ -1 +1,3 @@
-{}
+{
+   "defaultTitle": "创建服务者"
+}

+ 3 - 0
client/pages/customer/customerCenter/customerCenter.acss

@@ -37,6 +37,9 @@ page{
   height: 16rpx;
   margin:0 8rpx 0 0;
 }
+.switch-text{
+  color:#09AFFF;
+}
 .work-day{
   color: #999;
   font-size: 22rpx;

+ 10 - 8
client/pages/customer/customerCenter/customerCenter.axml

@@ -6,28 +6,30 @@
               <text>王阿姨</text>
               <image mode="aspectFill" src="/image/icon-edit.png" class="edit-btn"/>
            </view>
-           <view class="switch-list">
-          <image mode="aspectFill" src="/image/switch-grey.png" class="switch-btn"/>
-           <text>切换到其他保姆</text>
+           <view class="switch-list"  onTap="switchList">
+          <image mode="aspectFill" src="/image/switch-grey.png" class="switch-btn" a:if="{{isOnlyOne}}"/>
+          <image mode="aspectFill" src="/image/switch-blue.png" class="switch-btn" a:if="{{!isOnlyOne}}"/>
+           <text class="{{isOnlyOne?'':'switch-text'}}">切换到其他保姆</text>
            </view>
+            
        </view>
        <view class="work-day">周一·周二·周三·周四·周五</view>
        <view class="about-detail">
           <view class="about-left">
               <view class="service-model">保姆工种:钟点工</view>
-              <view class="bind-code">
-              <text>关联码:123456789</text>
-              <text class="copy-btn">复制</text>
+              <view class="bind-code" a:if="{{!isBind}}">
+              <text>关联码:{{bindCode}}</text>
+              <text class="copy-btn" onTap="copyCode">复制</text>
               </view>
           </view>
           <view class="about-right">阿姨偏好</view>
        </view>
  </view>
  <!-- 通知 -->
- <view class="notice-bar">
+ <view class="notice-bar" a:if="{{noticeShow}}">
      <view class="notice-main">强提醒内容</view>
      <view class="close-wrapper">
-      <image mode="aspectFill" src="/image/icon-close.png" class="notice-close"/>
+      <image mode="aspectFill" src="/image/icon-close.png" class="notice-close" onTap="closeNotice"/>
      </view>
      
  </view>

+ 28 - 0
client/pages/customer/customerCenter/customerCenter.js

@@ -1,10 +1,38 @@
 Page({
   data: {
     isBind:false,// 是否关联
+    isOnlyOne:false,//切换列表是否只有一个
     noAddTaskShow:false,//未添加任务
     noTaskShow:false,//今天无任务
     taskListShow:true,//任务列表
+    bindCode:'123456789',//关联码
     taskList:['洗衣服','做晚饭','打扫卫生'],
+    noticeShow:true,//通知栏展示
   },
   onLoad() {},
+  switchList(){
+    my.navigateTo({
+      url: '../myServantList/myServantList'
+    });
+  },
+  closeNotice(){
+    this.setData({
+      noticeShow:false
+    });
+  },
+  copyCode(){
+  my.setClipboard({
+      text: this.data.bindCode,
+      success:()=>{
+        my.showToast({
+  content: '复制成功',
+      });
+    },
+    fail:()=>{
+       my.showToast({
+  content: '复制失败',
+      });
+    }
+    });
+  }
 });

+ 60 - 0
client/pages/customer/editServant/editServant.acss

@@ -0,0 +1,60 @@
+.create-servant-page{
+  padding-top:24rpx;
+}
+.work-time{
+  padding:24rpx;
+}
+.every-week{
+  color: #666;
+  font-weight:normal;
+}
+.name-content{
+  padding-right:30rpx;
+}
+.name-input{
+  text-align: right;
+  width:100%;
+}
+.work-list{
+  margin-top:24rpx;
+  display: flex;
+  flex-wrap: wrap;
+}
+.work-item{
+  height: 52rpx;
+  line-height: 52rpx;
+  width:108rpx;
+  border:1rpx solid #999;
+  color: #999;
+  margin:0 20rpx 16rpx 0;
+  border-radius:52rpx;
+  text-align: center
+}
+.work-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;
+}

+ 34 - 0
client/pages/customer/editServant/editServant.axml

@@ -0,0 +1,34 @@
+<view class="common-page-padding create-servant-page">
+  <!-- 创建服务者/编辑服务者 -->
+  <!-- 姓名 -->
+  <view class="common-card line-cell">
+    <view class="cell-title">怎么称呼您的服务者</view>
+    <view class="cell-content name-content">
+    <input class="input name-input" value='{{servantName}}' placeholder="请输入" onInput="bindServantInput" placeholder-class="common-placeholder"  maxlength="10"/>
+    </view>
+  </view>
+  <!-- 工种 -->
+  <view class="common-card picker-wrapper">
+   <!-- <view class="cell-title">选择该服务者的工种</view>
+   <view class="cell-content">{{serviceModelName}}</view> -->
+    <picker onChange="bindPickerChange" value="{{index}}" range="{{serviceModelList}}" class="model-picker">
+      <view class="row">
+        <view class="row-title">选择该服务者的工种</view>
+        <view class="row-extra">{{serviceModelName}}</view>
+        <image class="row-arrow" src="/image/icon-right.png" mode="aspectFill" />
+      </view>
+    </picker>
+  </view>
+  <!-- 工作时间 -->
+  <view class="common-card work-time">
+   <view class="cell-title">选择该服务者的工作时间<text class="every-week">(每周)</text></view>
+   <view class="work-list">
+     <view class="work-item {{workSelectedList.indexOf(item.id)!=-1 ?'work-item-selected':''}}" a:for="{{workInitList}}" key="{{index}}"   onTap="toggleWorkTime" data-id="{{item.id}}">
+     {{item.text}}
+     </view>
+   </view>
+  </view>
+ <view class="common-button-wrapper">
+     <button type="primary" class="common-button" hover-class="active-button"  onTap="createServant">编辑服务者</button>
+  </view>
+</view>

+ 84 - 0
client/pages/customer/editServant/editServant.js

@@ -0,0 +1,84 @@
+Page({
+  data: {
+    servantName:'',
+    index:0,
+    serviceModelList: ['钟点工', '白班保姆', '住家保姆', '月嫂'],
+    serviceModelName:'请选择',
+    workSelectedList:[],
+    workInitList:[
+      {text:'周一',
+      id:'1',
+    },
+     {text:'周二',
+      id:'2',
+    },
+     {text:'周三',
+      id:'3',
+    },
+     {text:'周四',
+      id:'4',
+    },
+     {text:'周五',
+      id:'5',
+    },
+     {text:'周六',
+      id:'6',
+    },
+     {text:'周日',
+      id:'7',
+    },
+    ]
+  },
+  onLoad(options) {
+console.log(options);
+  },
+  bindServantInput(e){
+     this.setData({
+      servantName: e.detail.value,
+    });
+    console.log(this.data.servantName);
+  },
+  bindPickerChange(e) {
+    console.log('picker发送选择改变,携带值为', e.detail.value);
+    let model=(this.data.serviceModelList)[e.detail.value];
+    this.setData({
+      serviceModelName: model,
+    });
+  },
+  toggleWorkTime(e){
+    let id=e.target.dataset.id;
+    if(this.data.workSelectedList.indexOf(id)==-1){
+      let newArr=this.data.workSelectedList;
+      newArr.push(id);
+      this.setData({
+        workSelectedList:newArr
+      })
+    }else{
+      let newArr=this.data.workSelectedList;
+      newArr.splice(newArr.indexOf(id),1);
+      this.setData({
+        workSelectedList:newArr
+      })
+    }
+
+  },
+  createServant(){
+    if(this.data.servantName==''){
+        my.alert({
+      content:'请输入服务者姓名'
+    });
+    }else if(this.data.serviceModelName=='请选择'){
+       my.alert({
+      content:'请选择该服务者的工种'
+    });
+    }else if(this.data.workSelectedList.length==0){
+  my.alert({
+      content:'请选择该服务者的工作时间'
+    });
+    }else{
+      // 创建服务者,提交后台
+    }
+
+  }
+
+});

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

@@ -0,0 +1,3 @@
+{
+   "defaultTitle": "编辑服务者"
+}