Parcourir la source

Merge branch 'master' of http://47.102.110.240:3000/yuxiangpei/jzmall_wx

zhangfufeng il y a 3 mois
Parent
commit
1b3b88de77

+ 1 - 1
config/api.js

@@ -185,7 +185,7 @@ module.exports = {
 	
   getTradeOrderList:WxApiRoot +'customerRerutnApi/getTradeOrderList',//工单详情,传bookDetailId
   getConsoultType:WxApiRoot +'customerRerutnApi/getConsoultType',//企业回访数据
-  saveVisit:WxApiRoot +'customerRerutnApi/saveVisit',//提交企业回访数据
+  saveVisitBatch:WxApiRoot +'customerRerutnApi/saveVisitBatch',//提交企业回访数据
 	getGoodsComment:WxApiRoot +'goods/getGoodsComment',//全部评价
     everyDayTime:WxApiRoot +'orderbook/everyDayTime',//预约时间
     ServiceOrderBookV2: WxApiRoot +'orderbook/bookV2',//预约服务

+ 146 - 71
pages/extra/newRevisit/newRevisit.js

@@ -7,7 +7,8 @@ const app = getApp();
 
 
 Page({
-  data: {
+  data: { 
+		bookServantList:[],
     consultList: [],
     questionList: [],
     imgList: [],
@@ -46,15 +47,26 @@ Page({
         // type:options.type
       });
     }
+		this.getOrderDetail();
   },
   getOrderDetail() {
     util.request(api.getTradeOrderList, {
       bookDetailId: this.data.bookTradeNo
     }, 'GET').then(res => {
       if (res.errno === 0) {
-        console.log(res);
+				console.log(res);
+				let svlist=res.data.bookServantList;
+				svlist.forEach(s=>{
+					s.consultList= [];
+					s.questionList= [];
+					s.imgList= []; 
+					s.satisfy= '';
+					s.detail='';
+					s.remark='';
+				})
         this.setData({
-          tradeOrder: res.data,
+					tradeOrder: res.data,
+					bookServantList:svlist,
           isCanSumit: true,
           qrImg:res.data.qrUrl
         });
@@ -82,9 +94,15 @@ Page({
           item.checked = false;
         });
 
+				let dd=	this.data.bookServantList;
+				dd.forEach(s=>{ 
+					s.consultList=JSON.parse(JSON.stringify(list));;
+				})
+
         this.setData({
-          consultList: list
-        });
+					consultList: list, 
+				});
+				
       } else {
         wx.showToast({
           title: res.errmsg,
@@ -98,52 +116,88 @@ Page({
   },
   questionClick(e) {
     let checked = e.currentTarget.dataset.checked;
-    let index = e.currentTarget.dataset.index;
-    let item = `consultList[${index}].checked`;
-    this.setData({
-      [item]: !checked
-    });
-    let current = this.data.consultList.filter(item => {
-      return item.checked
-    });
-    this.setData({
-      questionList: current
-    });
+		let index = e.currentTarget.dataset.index;
+
+		let bkindex = e.currentTarget.dataset.bkindex;
+		let dd=this.data.bookServantList;
+		dd[bkindex].consultList[index].checked=!checked;
+
+		let current = dd[bkindex].consultList.filter((item) => {
+			return item.checked;
+		});
+		dd[bkindex].questionList=current;
+		this.setData({
+			bookServantList: dd
+	});
+
+    // let item = `consultList[${index}].checked`;
+    // this.setData({
+    //   [item]: !checked
+    // });
+    // let current = this.data.consultList.filter(item => {
+    //   return item.checked
+    // });
+    // this.setData({
+    //   questionList: current
+    // });
   },
   selectSatisfy(e) {
-    let result = e.currentTarget.dataset.satisfy;
+		let result = e.currentTarget.dataset.satisfy;
+		let bkindex=e.currentTarget.dataset.bkindex;
+		let dd=this.data.bookServantList[bkindex];
+		dd.satisfy=result;
     this.setData({
-      satisfy: result
+			// satisfy: result,
+			bookServantList:this.data.bookServantList
     });
   },
   remarkInput(e) {
-    this.setData({
-      remark: e.detail.value
-    });
+		console.log(e);
+			let dd=this.data.bookServantList; 
+			 dd[e.currentTarget.dataset.idx].remark=e.detail.value; 
+			 this.setData({
+			    bookServantList:dd
+			 });
+    // this.setData({
+    //   remark: e.detail.value
+    // });
   },
   detailInput(e) {
-    this.setData({
-      detail: e.detail.value
-    });
+
+		console.log(e);
+		let dd=this.data.bookServantList; 
+		 dd[e.currentTarget.dataset.idx].detail=e.detail.value; 
+		 this.setData({
+				bookServantList:dd
+		 });
+
+    // this.setData({
+    //   detail: e.detail.value
+    // });
   },
   previewImg(e) {
     let img = e.currentTarget.dataset.img;
-    let imgs = this.data.imgList
+    let bkindex = e.currentTarget.dataset.bkindex;
     wx.previewImage({
       current: img, // 当前显示图片的http链接
-      urls: imgs // 需要预览的图片http链接列表
+      urls: this.data.bookServantList[bkindex].imgList // 需要预览的图片http链接列表
     })
   },
   delImg(e) {
-    let imgs = this.data.imgList;
-    let index = e.currentTarget.dataset.index;
-    imgs.splice(index, 1);
+    // let imgs = e.currentTarget.dataset.imglist;
+		let index = e.currentTarget.dataset.index;
+		let bkindex=e.currentTarget.dataset.bkindex;
+		let dd=this.data.bookServantList;
+		dd[bkindex].imgList.splice(index, 1);
     this.setData({
-      imgList: imgs
+      bookServantList: dd
     })
   },
-  uploadImg() {
-    if (this.data.imgList.length >= 9) {
+  uploadImg(e) {
+		let bkindex=e.currentTarget.dataset.bkindex;
+		let dd=this.data.bookServantList;
+		let imgList=	dd[bkindex].imgList;
+    if (imgList >= 9) {
       wx.showToast({
         title: '最多上传9张图片',
         icon: 'none',
@@ -152,7 +206,7 @@ Page({
       return false;
     }
     let that = this;
-    let count = 9 - that.data.imgList.length;
+    let count = 9 - imgList.length;
     wx.chooseImage({
       count: count,
       sizeType: ['original', 'compressed'],
@@ -181,10 +235,11 @@ Page({
           title: '上传中...',
         });
         for (let i = 0; i < tempFilePaths.length; i++) {
-          let imgs = that.data.imgList;
+          let imgs = imgList;
           if (imgs.length >= 9) {
             that.setData({
-              imgList: imgs
+							// imgList: imgs
+							bookServantList:dd
             });
             return false;
           } else {
@@ -200,7 +255,8 @@ Page({
 
                   imgs.push(data.data.url);
                   that.setData({
-                    imgList: imgs
+										// imgList: imgs
+										bookServantList:dd
                   });
                 } else {
                   console.log('上传失败')
@@ -220,7 +276,7 @@ Page({
    */
   onShow: function (options) {
 
-    this.getOrderDetail();
+    // this.getOrderDetail();
     // wx.hideHomeButton({
     //   success(){
 
@@ -230,14 +286,23 @@ Page({
   answerClick(e) {
     let index1 = e.currentTarget.dataset.index1;
     let answer = e.currentTarget.dataset.answer;
-    let id = e.currentTarget.dataset.id;
-    let obj1 = `questionList[${index1}].consultId`;
-    let obj2 = `questionList[${index1}].consultName`;
-    this.setData({
-      [obj1]: id,
-      [obj2]: answer
-    });
-    console.log(this.data.questionList);
+		let id = e.currentTarget.dataset.id;
+		let bkindex=e.currentTarget.dataset.bkindex;
+
+		let dd=this.data.bookServantList;
+		dd[bkindex].questionList[index1].consultId=id;
+		dd[bkindex].questionList[index1].consultName=answer;
+		this.setData({
+			 bookServantList:dd
+		});
+
+    // let obj1 = `questionList[${index1}].consultId`;
+    // let obj2 = `questionList[${index1}].consultName`;
+    // this.setData({
+    //   [obj1]: id,
+    //   [obj2]: answer
+    // });
+    // console.log(this.data.questionList);
 
   },
   maskClick(e) {
@@ -313,19 +378,33 @@ Page({
     })
   },
   sumitRevisit() {
-    let params = {
-
-      bookTime: this.data.tradeOrder.beginDate + ' ' + this.data.tradeOrder.serviceTime,
+		let req=[];
+		let that =this;
+		// this.bookServantList.forEach(sv=>{ 
+		for(let k=0;k<this.data.bookServantList.length;k++){
+				let sv=this.data.bookServantList[k];
+
+    let params = { 
+			detailServantId:sv.detailServantId,
+      bookTime: sv.bookTime,
       bookTradeNo: this.data.tradeOrder.bookTradeNo,
       cusTel: this.data.tradeOrder.cusPhone,
-      degree: this.data.satisfy,
+      degree: sv.satisfy,
       type: this.data.tradeOrder.goodsType,
-      worderNo: this.data.tradeOrder.workerNo,
-      workerName: this.data.tradeOrder.workerName,
+      worderNo: sv.workerNo,
+      workerName: sv.workerName,
 
-    }
-    if (this.data.satisfy == 2) {
-      let isEmpty = this.data.questionList.some(item => {
+		}
+		if(sv.satisfy==''){
+			wx.showToast({
+				title: '辛苦您为每位服务者进行评价~',
+				icon: 'none',
+				duration: 2000
+			}); 
+			return false;
+		}
+    if (sv.satisfy == 2) {
+      let isEmpty = sv.questionList.some(item => {
         return item.consultId == undefined || item.consultId == ''
       });
       if (isEmpty) {
@@ -335,7 +414,7 @@ Page({
           duration: 2000
         });
         return false;
-      } else if (this.data.detail == '') {
+      } else if (sv.detail == '') {
         wx.showToast({
           title: '请输入具体问题描述',
           icon: 'none',
@@ -347,7 +426,7 @@ Page({
         let titleId = [];
         let consultId = [];
         let consultName = [];
-        this.data.questionList.forEach(item => {
+        sv.questionList.forEach(item => {
 
           title.push(item.name);
           titleId.push(item.id);
@@ -359,33 +438,29 @@ Page({
         params.titleId = titleId.join(',');
         params.consultId = consultId.join(',');
         params.consultName = consultName.join(',');
-        params.question = this.data.detail;
-        params.imgSrc = this.data.imgList.join(',');
+        params.question = sv.detail;
+        params.imgSrc = sv.imgList.join(',');
 
       }
-    } else if (this.data.satisfy == 3) {
-      if (this.data.remark == '') {
+    } else if (sv.satisfy == 3) {
+      if (sv.remark == '') {
         wx.showToast({
           title: '请填写建议',
           icon: 'none',
           duration: 2000
         });
         return false;
-      } else {
-
-        params.question = this.data.remark;
-
-      }
-
-
-
-
-    }
+      } else { 
+        params.question = sv.remark; 
+      } 
+		}
+		req.push(params);
+	}
 
     wx.showLoading({
       title: '加载中...',
     });
-    util.request(api.saveVisit, params, 'POST').then(res => {
+    util.request(api.saveVisitBatch, req, 'POST').then(res => {
       wx.hideLoading();
       if (res.errno === 0) {
         console.log(res);

+ 107 - 104
pages/extra/newRevisit/newRevisit.wxml

@@ -25,113 +25,116 @@
         <text>服务时间:</text>
         {{tradeOrder.beginDate}} {{tradeOrder.serviceTime}}
       </view>
-      <view class="item">
+      <!-- <view class="item">
         <text>服务人员:</text>
         {{tradeOrder.workerName}}
-      </view>
-    </view>
-
-  </view>
-  <!-- 是否满意 -->
-  <view class="service-satisfy">
-    <view class="satisfy-title">
-      <view class="dot"></view>
-      <view class="text">您对本次的服务是否满意?</view>
-    </view>
-    <view class="satisfy-select">
-      <view data-satisfy="1" class="{{satisfy=='1'?'yes':''}}" bindtap="selectSatisfy">满意</view>
-      <view data-satisfy="2" class="{{satisfy=='2'?'no':''}}" bindtap="selectSatisfy">不满意</view>
-      <view data-satisfy="3" class="{{satisfy=='3'?'common':''}}" bindtap="selectSatisfy">一般</view>
-
-    </view>
-    <!-- 满意 -->
-    <view class="satisfy-result" wx:if="{{satisfy==1}}">
-      <view>感谢您的认可,您的认可是我们前行的动力!
-        如果有需求,您可以长期购买周期单,可以指定阿姨,价格更优惠!</view>
-
-    </view>
-    <!-- 一般 -->
-    <view class="satisfy-common" wx:if="{{satisfy==3}}">
-      诚邀您对我们提出宝贵意见,我们会积极改进,为您提供更好的服务。
-    </view>
-    <!-- 不满意 -->
-    <view class="satisfy-common" wx:if="{{satisfy==2}}">
-      抱歉给您带来不好的服务体验,我们的工作人员会在第一时间联系您提供后续服务!
-    </view>
-
-  </view>
-  <!-- 一般备注 -->
-  <view class="remark-wrapper" wx:if="{{satisfy==3}}">
-    <view class="tips">1. 请输入您想和我们说的话:</view>
-    <textarea bindinput="remarkInput" placeholder="感谢您的耐心与支持" class="textarea" value="{{remark}}"
-      placeholder-style="color: #E8E8E8;font-size:30rpx;" />
-
-  </view>
-
-
-
-  <!-- 题目 -->
-  <view class="topic-block" wx:if="{{satisfy==2}}">
-
-    <!-- 题目选择 -->
-    <view class="topic-item">
-      <view class="issue">
-        1. 请选择您发现的问题?
-      </view>
-      <view class="answer">
-        <view wx:for="{{consultList}}" wx:key="index"
-          class="{{item.checked?'selected-answer':'common-answer'}} answer-item" data-checked="{{item.checked}}"
-          data-index="{{index}}" bindtap="questionClick">
-          {{item.name}}
-        </view>
-      </view>
-    </view>
-
-
-    <view class="topic-item" wx:for="{{questionList}}" wx:for-item="item1" wx:for-index="index1" wx:key="index1">
-      <view class="issue">
-        <view class="dot"></view>
-        <view>
-          <text>{{item1.name}}</text>
-          <text class="refer">具体问题</text>
-        </view>
-
-      </view>
-      <view class="answer">
-        <view wx:for="{{item1.children}}" wx:for-item="item2" wx:for-index="index2" wx:key="index2"
-          class="{{item1.consultId==item2.id?'selected-answer':'common-answer'}} answer-item" data-id="{{item2.id}}"
-          data-answer="{{item2.name}}" data-index1="{{index1}}" bindtap="answerClick">
-          {{item2.name}}
-        </view>
-      </view>
-    </view>
-
-
-
-
-  </view>
-
-  <view class="remark-wrapper" wx:if="{{satisfy==2}}">
-    <view class="tips">2. 请输入具体问题描述:</view>
-    <textarea bindinput="detailInput" placeholder="感谢您的耐心与支持" class="textarea" value="{{detail}}"
-      placeholder-style="color: #E8E8E8;font-size:30rpx;" />
-    <!-- 图片上传 -->
-    <view class="upload-wrapper">
-
-      <view class="img-item" wx:for="{{imgList}}" wx:key="index">
-        <image mode="aspectFill" src="{{item}}" class="user-upload" bindtap="previewImg" data-img="{{item}}"></image>
-        <image class="close-img" mode="aspectFill" src="/static/images/icon-close.png" bindtap="delImg"
-          data-index="{{index}}">
-        </image>
-      </view>
-      <view class="upload" bindtap="uploadImg">
-        <image mode="aspectFill" src="/static/images/icon-add.png"></image>
-        <view>上传照片</view>
-      </view>
-
-    </view>
-
+      </view> -->
+    </view> 
   </view>
+	<view class="duoren" wx:if="{{bookServantList.length>1}}">
+			<text>本次服务为多人服务,请为每位服务者评价</text>
+		</view>
+		
+		<view wx:for="{{bookServantList}}" wx:for-item="bk" wx:for-index="bkindex" wx:key="bkindex">
+					<!-- 是否满意 -->
+					<view class="service-satisfy">
+						<view class="satisfy-title">
+							<view class="dot"></view>
+							<!-- <view class="text">您对本次的服务是否满意?</view> -->
+							<view class="name">服务者[{{bk.workerName}}]</view>
+						  <view class="skill">服务项目:{{bk.skillName}}</view>
+						  <view class="msg">已对服务者匿名</view>
+						</view>
+						<view class="satisfy-select">
+							<view data-satisfy="1" data-bkindex="{{bkindex}}" class="{{bk.satisfy=='1'?'yes':''}}" bindtap="selectSatisfy">满意</view>
+							<view data-satisfy="2" data-bkindex="{{bkindex}}" class="{{bk.satisfy=='2'?'no':''}}" bindtap="selectSatisfy">不满意</view>
+							<view data-satisfy="3" data-bkindex="{{bkindex}}" class="{{bk.satisfy=='3'?'common':''}}" bindtap="selectSatisfy">一般</view>
+
+						</view>
+						<!-- 满意 -->
+						<view class="satisfy-result" wx:if="{{bk.satisfy==1}}">
+							<view>感谢您的认可,您的认可是我们前行的动力!
+								如果有需求,您可以长期购买周期单,可以指定阿姨,价格更优惠!</view>
+
+						</view>
+						<!-- 一般 -->
+						<view class="satisfy-common" wx:if="{{bk.satisfy==3}}">
+							诚邀您对我们提出宝贵意见,我们会积极改进,为您提供更好的服务。
+						</view>
+						<!-- 不满意 -->
+						<view class="satisfy-common" wx:if="{{bk.satisfy==2}}">
+							抱歉给您带来不好的服务体验,我们的工作人员会在第一时间联系您提供后续服务!
+						</view>
+
+					</view>
+					<!-- 一般备注 -->
+					<view class="remark-wrapper" wx:if="{{bk.satisfy==3}}">
+						<view class="tips">1. 请输入您想和我们说的话:</view>
+						<textarea bindinput="remarkInput" data-idx="{{bkindex}}" placeholder="感谢您的耐心与支持" class="textarea" value="{{bk.remark}}"
+							placeholder-style="color: #E8E8E8;font-size:30rpx;" />
+
+					</view>
+				
+					<!-- 题目 -->
+					<view class="topic-block" wx:if="{{bk.satisfy==2}}">
+
+						<!-- 题目选择 -->
+						<view class="topic-item">
+							<view class="issue">
+								1. 请选择您发现的问题?
+							</view>
+							<view class="answer">
+								<view wx:for="{{bk.consultList}}" wx:key="index"
+									class="{{item.checked?'selected-answer':'common-answer'}} answer-item" data-checked="{{item.checked}}"
+									data-index="{{index}}" data-bkindex="{{bkindex}}" bindtap="questionClick">
+									{{item.name}}
+								</view>
+							</view>
+						</view>
+
+
+						<view class="topic-item" wx:for="{{bk.questionList}}" wx:for-item="item1" wx:for-index="index1" wx:key="index1">
+							<view class="issue">
+								<view class="dot"></view>
+								<view>
+									<text>{{item1.name}}</text>
+									<text class="refer">具体问题</text>
+								</view>
+
+							</view>
+							<view class="answer">
+								<view wx:for="{{item1.children}}" wx:for-item="item2" wx:for-index="index2" wx:key="index2"
+									class="{{item1.consultId==item2.id?'selected-answer':'common-answer'}} answer-item" data-id="{{item2.id}}"
+									data-answer="{{item2.name}}" data-index1="{{index1}}" data-bkindex="{{bkindex}}" bindtap="answerClick">
+									{{item2.name}}
+								</view>
+							</view>
+						</view> 
+
+					</view>
+
+					<view class="remark-wrapper" wx:if="{{bk.satisfy==2}}">
+						<view class="tips">2. 请输入具体问题描述:</view>
+						<textarea bindinput="detailInput"  data-idx="{{bkindex}}" placeholder="感谢您的耐心与支持" class="textarea" value="{{bk.detail}}"
+							placeholder-style="color: #E8E8E8;font-size:30rpx;" />
+						<!-- 图片上传 -->
+						<view class="upload-wrapper">
+
+							<view class="img-item" wx:for="{{bk.imgList}}" wx:key="index">
+								<image mode="aspectFill" src="{{item}}" class="user-upload" bindtap="previewImg" data-bkindex="{{bkindex}}" data-img="{{item}}"></image>
+								<image class="close-img" mode="aspectFill" src="/static/images/icon-close.png" bindtap="delImg"
+									data-index="{{index}}"  data-bkindex="{{bkindex}}">
+								</image>
+							</view>
+							<view class="upload" bindtap="uploadImg" data-bkindex="{{bkindex}}">
+								<image mode="aspectFill" src="/static/images/icon-add.png"></image>
+								<view>上传照片</view>
+							</view>
+
+						</view>
+
+					</view>
+		</view>
 
   <view class="submit-btn" bindtap="sumitRevisit" wx:if="{{!isFinished&&isCanSumit}}">提交</view>
   <view class="submit-btn disable-btn" wx:else>提交</view>

+ 28 - 0
pages/extra/newRevisit/newRevisit.wxss

@@ -56,6 +56,27 @@ margin-right:16rpx;
   font-size: 34rpx;
   line-height: 48rpx;
 }
+.satisfy-title .name {
+	font-size: 36rpx;
+	line-height: 48rpx;
+font-weight: bold;
+}
+.satisfy-title .skill {
+	font-size: 26rpx;
+/*    line-height: 48rpx; */
+margin-left: 20rpx;
+width:300rpx;
+overflow: hidden;
+color:#A9A9A9;
+}
+.satisfy-title .msg {
+	font-size: 26rpx;
+	/* line-height: 48rpx; */
+width:200rpx;
+position: absolute;
+right:0;
+color:#A9A9A9;
+}
 .satisfy-select{
   margin:24rpx 0;
   display: flex;
@@ -357,4 +378,11 @@ font-weight: 400;
 .qrcode {
   width: 393rpx;
   height: 393rpx;
+}
+.duoren{
+	background-color: rgb(215, 229, 250);
+	color: rgb(16, 162, 237);
+	padding-left: 20rpx;
+	margin-top: 8rpx;
+	margin-bottom: 20rpx;
 }