|
|
@@ -54,7 +54,7 @@
|
|
|
<view class="groupItemKey">
|
|
|
<text>服务人员</text>
|
|
|
</view>
|
|
|
- <view class="flex-row justify-between groupItemContent" @click="chooseServiceTeacher(index)">
|
|
|
+ <view class="flex-row justify-between groupItemContent" @click="chooseServiceTeacher(index,item.serviceUserId)">
|
|
|
<text>{{ item.personName || '请选择服务人员' }}</text>
|
|
|
<u-icon name="arrow-right" color="#666" size="18"></u-icon>
|
|
|
</view>
|
|
|
@@ -103,8 +103,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<chooseServiceTeacher ref="chooseServiceTeacher" :storeId="store.storeId" :date="date" @getWorkPerson="getWorkPerson"></chooseServiceTeacher>
|
|
|
- <chooseServiceTime ref="chooseServiceTime" :personId="personId" :date="date" @getPeriodDate="getPeriodDate"></chooseServiceTime>
|
|
|
- <myPay ref="myPay" :blPay="false"></myPay>
|
|
|
+ <chooseServiceTime ref="chooseServiceTime" @getPeriodDate="getPeriodDate"></chooseServiceTime>
|
|
|
+ <myPay ref="myPay" :blPay="false" :orderNo="subOrderNo"></myPay>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -120,6 +120,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ selectIndex:0,
|
|
|
requestStatus:false,
|
|
|
personId:'',
|
|
|
date:'',
|
|
|
@@ -144,18 +145,18 @@
|
|
|
serviceAttribute: 2,
|
|
|
serviceStoreId: '',
|
|
|
remark: '',
|
|
|
+ serviceDate:'',
|
|
|
childService:[
|
|
|
{
|
|
|
periodDate:'',//回显需要,不做参数
|
|
|
- serviceObjectId: '',
|
|
|
- facePhotoUrl:'', //回显需要,不做参数
|
|
|
- nickName:'', //回显需要,不做参数
|
|
|
- serviceUserId: '',
|
|
|
- personName:'',//回显需要,不做参数
|
|
|
- fee:'',//回显需要,不做参数
|
|
|
- serviceStartTime: '',
|
|
|
- timeRangeId: ''
|
|
|
- }
|
|
|
+ serviceObjectId: '',
|
|
|
+ facePhotoUrl:'', //回显需要,不做参数
|
|
|
+ nickName:'', //回显需要,不做参数
|
|
|
+ serviceUserId: '',
|
|
|
+ personName:'',//回显需要,不做参数
|
|
|
+ fee:'',//回显需要,不做参数
|
|
|
+ serviceStartTime: ''
|
|
|
+ }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
@@ -185,6 +186,7 @@
|
|
|
}).then(res => {
|
|
|
this.periodDate = res.data.data[0]
|
|
|
this.date=this.periodDate.label
|
|
|
+ this.orderParam.serviceDate=this.periodDate.label
|
|
|
|
|
|
if (this.orderParam.childService.length === 1) {
|
|
|
this.orderParam.childService[0].periodDate = this.periodDate.label
|
|
|
@@ -220,41 +222,62 @@
|
|
|
//获取门店排班时段
|
|
|
getServiceTime(date,personId) {
|
|
|
this.$api.getServicePersonTime({
|
|
|
- personId: personId === -1 ? '' : personId,
|
|
|
+ personId: personId,
|
|
|
date: date,
|
|
|
+ storeId:this.store.storeId
|
|
|
}).then(res => {
|
|
|
this.periodTime = res.data.data[0]
|
|
|
if (this.orderParam.childService.length === 1) {
|
|
|
this.orderParam.childService[0].serviceStartTime = res.data.data[0].label
|
|
|
- this.orderParam.childService[0].timeRangeId = res.data.data[0].id
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
selectServiceObject(item) {
|
|
|
+ this.subOrderNo=''
|
|
|
console.log(item)
|
|
|
if (item.select) {
|
|
|
this.orderParam.childService = this.orderParam.childService.filter(selectServiceObject =>
|
|
|
selectServiceObject.serviceObjectId !== item.id)
|
|
|
} else {
|
|
|
- let childService ={
|
|
|
- periodDate: this.periodDate.label,
|
|
|
- serviceObjectId: item.id,
|
|
|
- facePhotoUrl:item.facePhotoUrl, //回显需要,不做参数
|
|
|
- nickName:item.nickName, //回显需要,不做参数
|
|
|
- serviceUserId: this.serviceTeacher.personId ,
|
|
|
- personName:this.serviceTeacher.personName ,//回显需要,不做参数
|
|
|
- fee:this.serviceTeacher.fee ,//回显需要,不做参数
|
|
|
- serviceStartTime: this.periodTime.label ,
|
|
|
- timeRangeId: this.periodTime.id
|
|
|
- }
|
|
|
- this.orderParam.childService.push(childService)
|
|
|
- for (let childService of this.orderParam.childService) {
|
|
|
- this.price = 0
|
|
|
- this.price = this.price * 1 + childService.fee * 1
|
|
|
- }
|
|
|
+ this.$api.getServicePersonTime({
|
|
|
+ personId: this.serviceTeacher.personId,
|
|
|
+ date: this.periodDate.label,
|
|
|
+ storeId:this.store.storeId
|
|
|
+ }).then(res => {
|
|
|
+ let periodTimeList = res.data.data
|
|
|
+
|
|
|
+ let selectServiceObjectList = this.orderParam.childService
|
|
|
+
|
|
|
+ selectServiceObjectList.forEach(selectServiceObject =>{
|
|
|
+ periodTimeList.forEach(periodTime =>{
|
|
|
+ if (selectServiceObject.serviceStartTime === periodTime.label ){
|
|
|
+ periodTime.total = periodTime.total - 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ periodTimeList = periodTimeList.filter(periodTime=> periodTime.total>0)
|
|
|
+ console.log(periodTimeList)
|
|
|
+ let childService ={
|
|
|
+ periodDate: this.periodDate.label,
|
|
|
+ serviceObjectId: item.id,
|
|
|
+ facePhotoUrl:item.facePhotoUrl, //回显需要,不做参数
|
|
|
+ nickName:item.nickName, //回显需要,不做参数
|
|
|
+ serviceUserId: this.serviceTeacher.personId ,
|
|
|
+ personName:this.serviceTeacher.personName ,//回显需要,不做参数
|
|
|
+ fee:this.serviceTeacher.fee ,//回显需要,不做参数
|
|
|
+ serviceStartTime: periodTimeList[0].label ,
|
|
|
+ }
|
|
|
+ this.orderParam.childService.push(childService)
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
item.select = !item.select
|
|
|
+ this.price = 0
|
|
|
+ for (let childService of this.orderParam.childService) {
|
|
|
+ this.price = this.price * 1 + childService.fee * 1
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 查询服务对接信息列表
|
|
|
@@ -308,33 +331,60 @@
|
|
|
|
|
|
|
|
|
//选择服务人员
|
|
|
- chooseServiceTeacher(index) {
|
|
|
+ chooseServiceTeacher(index,serviceUserId) {
|
|
|
this.selectIndex = index
|
|
|
- this.$refs.chooseServiceTeacher.openPopup()
|
|
|
+ this.$refs.chooseServiceTeacher.openPopup(serviceUserId)
|
|
|
},
|
|
|
|
|
|
//选择服务人员
|
|
|
getWorkPerson(e) {
|
|
|
- this.orderParam.childService[this.selectIndex].serviceUserId = e.personId
|
|
|
- this.orderParam.childService[this.selectIndex].personName = e.personName
|
|
|
- this.orderParam.childService[this.selectIndex].fee = e.fee
|
|
|
|
|
|
- for (let childService of this.orderParam.childService) {
|
|
|
- this.price = 0
|
|
|
- this.price = this.price * 1 + childService.fee * 1
|
|
|
+ if (e.personId !== this.orderParam.childService[this.selectIndex].serviceUserId){
|
|
|
+ this.subOrderNo=''
|
|
|
+ this.$api.getServicePersonTime({
|
|
|
+ personId: e.personId,
|
|
|
+ date: this.periodDate.label,
|
|
|
+ storeId: this.store.storeId
|
|
|
+ }).then(res => {
|
|
|
+ this.orderParam.childService[this.selectIndex].serviceUserId = e.personId
|
|
|
+ this.orderParam.childService[this.selectIndex].personName = e.personName
|
|
|
+ this.orderParam.childService[this.selectIndex].fee = e.fee
|
|
|
+ this.orderParam.childService[this.selectIndex].serviceStartTime = ''
|
|
|
+ let periodTimeList = res.data.data
|
|
|
+ let selectServiceObjectList = this.orderParam.childService.filter(selectServiceObject =>
|
|
|
+ selectServiceObject.serviceUserId === e.personId
|
|
|
+ || selectServiceObject.serviceUserId === -1
|
|
|
+ )
|
|
|
+ selectServiceObjectList.forEach(selectServiceObject =>{
|
|
|
+ periodTimeList.forEach(periodTime =>{
|
|
|
+ if (selectServiceObject.serviceStartTime === periodTime.label){
|
|
|
+ periodTime.total = periodTime.total - 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ periodTimeList = periodTimeList.filter(periodTime=> periodTime.total>0)
|
|
|
+ this.orderParam.childService[this.selectIndex].serviceStartTime = periodTimeList[0].label
|
|
|
+ this.price = 0
|
|
|
+ for (let childService of this.orderParam.childService) {
|
|
|
+ this.price = this.price * 1 + childService.fee * 1
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
|
|
|
//选择服务时段
|
|
|
chooseServiceTime(index) {
|
|
|
this.selectIndex = index
|
|
|
- this.$refs.chooseServiceTime.openPopup()
|
|
|
+ this.$refs.chooseServiceTime.openPopup(this.orderParam.childService[index].serviceUserId,
|
|
|
+ this.periodDate.label,this.store.storeId,this.orderParam.childService,index,this.orderParam.childService[index].serviceStartTime)
|
|
|
},
|
|
|
//选择服务时段
|
|
|
getPeriodDate(e) {
|
|
|
- this.orderParam.childService[this.selectIndex].serviceStartTime = e.label
|
|
|
- this.orderParam.childService[this.selectIndex].timeRangeId = e.id
|
|
|
+ if (this.orderParam.childService[this.selectIndex].serviceStartTime !== e.label){
|
|
|
+ this.subOrderNo=''
|
|
|
+ this.orderParam.childService[this.selectIndex].serviceStartTime = e.label
|
|
|
+ this.$set(this.orderParam)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
selectChange() {
|
|
|
@@ -353,30 +403,43 @@
|
|
|
|
|
|
//提交订单
|
|
|
commitOrder() {
|
|
|
- if(!this.selectIcon){
|
|
|
- uni.$u.toast('请阅读并同意《预约需知》')
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.orderParam.childService.length === 0) {
|
|
|
- uni.$u.toast('请选择服务对象')
|
|
|
- return;
|
|
|
- }
|
|
|
- if(this.requestStatus){
|
|
|
- return;
|
|
|
- }
|
|
|
- this.requestStatus=true
|
|
|
-
|
|
|
- this.$api.commonGeneralOrder(this.orderParam).then(res=>{
|
|
|
- console.log('++++++++++++++++++订单提交+++++++++++',res)
|
|
|
- this.orderNo = res.data.data.orderNo
|
|
|
- this.subOrderNo = res.data.data.subOrderNo
|
|
|
+ if (this.subOrderNo){
|
|
|
this.$refs.myPay.openPopup()
|
|
|
- this.requestStatus=false
|
|
|
- }).catch(err =>{
|
|
|
- this.requestStatus=false
|
|
|
- })
|
|
|
|
|
|
+ }else {
|
|
|
+ if (!this.selectIcon) {
|
|
|
+ uni.$u.toast('请阅读并同意《预约需知》')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.orderParam.childService.length === 0) {
|
|
|
+ uni.$u.toast('请选择服务对象')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.requestStatus) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.requestStatus = true
|
|
|
+
|
|
|
+ this.$api.commonGeneralOrder(this.orderParam).then(res => {
|
|
|
+ console.log('++++++++++++++++++订单提交+++++++++++', res)
|
|
|
+ if (res.data.data.subOrderNo) {
|
|
|
+ this.orderNo = res.data.data.orderNo
|
|
|
+ this.subOrderNo = res.data.data.subOrderNo
|
|
|
+ this.$refs.myPay.openPopup()
|
|
|
+ } else {
|
|
|
+ uni.$u.toast('预约成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ this.requestStatus = false
|
|
|
+ }).catch(err => {
|
|
|
+ this.requestStatus = false
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
|