| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067 |
- <template>
- <view class="page">
- <!-- <view class="flex-row periodDate">-->
- <!-- <view class="flex-row">-->
- <!-- <text>服务日期:</text>-->
- <!-- </view>-->
- <!-- <picker @change="bindPickerChange" mode='selector' range-key="label" :value="periodDateIndex" :range="periodDateList">-->
- <!-- <view class="flex-row justify-between" :style="{width:'550rpx'}">-->
- <!-- <text>{{periodDate.label || '请选择服务日期' }}</text>-->
- <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
- <!-- </view>-->
- <!-- </picker>-->
- <!-- </view>-->
- <view class="dateTabs">
- <u-tabs :list="periodDateList" lineColor="#FFE05C" lineWidth="40" lineHeight="4" :activeStyle="{
- color: '#FFE05C',
- fontWeight: 'bold',
- transform: 'scale(1.05)'
- }" @click="clickPeriodDateList"></u-tabs>
- </view>
- <view class="store-wrap">
- <view class="store-info">
- <view class="logo">
- <image src="../../static/index/u55.png" mode=""></image>
- </view>
- <view @click="gotoStoreChoose()" class="store-content">
- <view class="h-row">
- <view class="store-desc">
- <view class="store-name">
- <view class="">{{ storeInfo.storeName }}</view>
- </view>
- </view>
- <view class="arrow-right">
- <view class="change-store">更换门店</view>
- <u-icon name="arrow-right" color="#333" size="16"></u-icon>
- </view>
- </view>
- <view class="h-row">
- <text class="address">地址:{{ storeInfo.address }}</text>
- <text class="address1">{{storeInfo.distanceDesc}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="flex-col group">
- <view class="serob"><text>服务对象</text></view>
- <u-grid :border="false" col="4">
- <u-grid-item v-for="(item,index) in serviceObjectList" :key="index">
- <view class="serobItem flex-col" >
- <view class="serobImgView" @click="selectServiceObject(item)">
- <image class="serobImg" mode="aspectFill" :src="item.facePhotoUrl || '/static/me/ud4.png'"></image>
- </view>
- <text class="serobName">{{item.nickName || '未填写'}}</text>
- <view class="serobV" v-if="item.select === true">
- <image class="serobVicon" src="/static/order/ud20.png"></image>
- </view>
- </view>
- </u-grid-item>
- </u-grid>
- <!-- <view class="serobReminder">-->
- <!-- <text>请注意,一人一号</text>-->
- <!-- </view>-->
- </view>
- <view class="flex-col group " v-for="(item, index) in orderParam.childService">
- <view class="flex-row " v-if="serviceObjectList.length>1">
- <image class="selectSerobImg" mode="aspectFill" :src="item.facePhotoUrl || '/static/me/ud4.png'"></image>
- <text class="selectSerobName">{{item.nickName || '未填写'}}</text>
- </view>
- <view class="serob">
- <text>服务人员以及预约费用</text>
- </view>
- <view>
- <u-grid col="4">
- <u-grid-item v-for="(item1,index1) in item.serviceTeacherList" :key="index1">
- <view class="serobItem flex-col" @click="selectServiceTeach(item.serviceTeacherList,index,index1)">
- <view class="serobImgView">
- <image class="serobImg" mode="aspectFill" :src="item1.facePhotoUrl || '/static/me/ud4.png'"></image>
- </view>
- <text class="serobName ">{{item1.personName || '未填写'}}</text>
- <view class="flex-row justify-center ">
- <!-- <u-icon name="rmb-circle" size="14"></u-icon>-->
- <text class="teachPrice">{{item1.fee}}</text>
- </view>
- <view class="serobV " v-if="item1.select">
- <image class="serobVicon" src="/static/order/ud20.png"></image>
- </view>
- </view>
- </u-grid-item>
- </u-grid>
- </view>
- <view class="serob" :style="{'marginTop':'32rpx'}">
- <text>服务时段</text>
- </view>
- <view v-if="!item.serviceStartTime" class="noTime flex-row justify-center">
- <text>暂无可用的服务时段</text>
- </view>
- <view v-else>
- <u-grid :border="false" col="5">
- <u-grid-item v-if="item2.total > 0" v-for="(item2,index2) in item.serviceTimeList" :key="index2">
- <view class="timeItemView">
- <view class="flex-col justify-center timeItem " :class="{selectBack: item2.select}" @click="selectServiceTime(item.serviceTimeList,index,index2)">
- <view class="flex-row justify-center">
- <text class="time">{{item2.label}}</text>
- </view>
- <!-- <view class="flex-row justify-center">-->
- <!-- <text class="price">¥{{item2.price}}</text>-->
- <!-- </view>-->
- </view>
- </view>
- </u-grid-item>
- </u-grid>
- </view>
- </view>
- <view class="flex-col group ">
- <view class="groupItemKey">
- <text>取号规则</text>
- </view>
- <view class="textareaView ">
- <view v-for=" (item,index) in takeNumberRules " class="serobReminder">
- <text>{{index+1}}.{{item.dictValue}}。</text>
- </view>
- <!-- <textarea v-model="orderParam.remark" placeholder-style="color:#999999;fontSize:28rpx"-->
- <!-- placeholder="如有其它特殊需求,请在此输入您的需求" />-->
- <!-- <view class="serobReminder">-->
- <!-- <text>1.预约需要一人一号。</text>-->
- <!-- </view>-->
- <!-- <view class="serobReminder">-->
- <!-- <text>2.目前支付费用为时段预约占位费。</text>-->
- <!-- </view>-->
- <!-- <view class="serobReminder">-->
- <!-- <text>3.服务费用到店享受相应服务以后在另行收取。</text>-->
- <!-- </view>-->
- <!-- <view class="serobReminder">-->
- <!-- <text>4.到门店先签到,过时没有签到占位时段失效。</text>-->
- <!-- </view>-->
- </view>
- </view>
- <view v-if="recommendActivity" class="flex-row justify-center" style="background: #ffffff;margin-top: 20rpx;padding: 10rpx 32rpx">
- <image style="width: 686rpx" :src="activityImg" mode="widthFix" @click="goDetail(recommendActivity)"></image>
- </view>
- <view :style="{'height':'236rpx'}"></view>
- <view class="flex-col group2 ">
- <!-- <view v-if="recommendActivity" class="btnTitle1 flex-row justify-between">-->
- <!-- <view>-->
- <!-- <text>推荐活动:{{recommendActivity.title}}</text>-->
- <!-- <text style="margin-left: 10rpx;color: #999999" >({{recommendActivity.description}})</text>-->
- <!-- </view>-->
- <!-- <view class="btnRight1" @click="goDetail(recommendActivity)">购买({{recommendActivity.salePrice}})</view>-->
- <!-- </view>-->
- <view class="btnTitle flex-row">
- <u-icon v-if="selectIcon" name="checkmark-circle-fill" color="#FFE52C" size="18"
- @click="selectChange"></u-icon>
- <u-icon v-else name="/static/order/ud9.png" color="#FFE52C" size="18" @click="selectChange"></u-icon>
- <text :style="{'margin-left':'10rpx'}">请阅读并同意</text>
- <text :style="{'color':'red'}" @click="goTermsOfService">《预约需知》</text>
- </view>
- <view class="btn flex-row justify-between">
- <view>
- <text class="title">待支付</text>
- <text class="num">{{price}}</text>
- </view>
- <view class="btnRight" @click="openSetting">
- <text>提交</text>
- </view>
- </view>
- </view>
- <myPay ref="myPay" :selectBlPay="userInfo.balance *1 >= price *1" :balance="userInfo.balance" :totalAmount="price" :storeId="store.storeId"
- :orderNo="subOrderNo" @payResult="payResult" @improperClose="improperClose"></myPay>
- <uni-popup ref="reservationQueuePopup">
- <uni-popup-dialog :type="msgType" cancelText="不再提示" confirmText="已知晓" title="提示" :content="configContent" @confirm="dialogConfirm"
- @close="dialogClose"></uni-popup-dialog>
- </uni-popup>
- <uni-popup ref="showExpireEquityCard">
- <view class="flex-col justify-start expirePopup" >
- <view class="flex-row justify-center">
- <text class="popupTitle">到期提醒</text>
- </view>
- <scroll-view scroll-y class="flex-col justify-start" :class="[ expireEquityCard.length > 1 ? 'scroll-y1':'scroll-y']" >
- <view class="flex-row listView" v-for="(item,index) in expireEquityCard">
- <view class="h-text flex-col justify-center ">
- <view class="money">
- <text>{{ item.faceValue }}</text>
- </view>
- </view>
- <view class="h-center-content flex-col justify-around">
- <view class="h-value">
- <text>{{ item.title }}</text>
- </view>
- <view class="title1">
- 服务对象:{{ item.serviceObjectName || '' }}
- </view>
- <view class="title1">
- 适用门店:{{ item.useStoreDesc || '' }} {{ item.use_store_desc || '' }} {{ item.useStoreDesc || '' }} {{ item.useStoreDesc || '' }}
- </view>
- <view class="title1">
- 到期时间:{{ item.effectiveEndTime.slice(0,10) }}
- </view>
- </view>
- <view class="h-right-content flex-col justify-center ">
- <view class="btn1" @click="navigateTo(item)">
- <text>续费</text>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import myPay from '../../components/pay/pay';
- export default {
- components: {
- myPay
- },
- data() {
- return {
- recommendActivity:null,
- msgType:null,
- configContent:'',
- timeoutId:null,
- templateId:[],
- //服务对象列表
- serviceObjectList:[],
- //服务人员列表
- serviceTeacherList:[],
- userInfo: {},
- //服务门店
- store: {},
- //服务日期列表
- periodDateList:[],
- //当前选择的服务日期
- periodDate: {},
- //当前选择的日期下标
- periodDateIndex:0,
- //预约费用
- price: '0',
- //订单编号
- subOrderNo:'',
- selectIcon: true,
- orderParam:{
- orderType: 1,
- serviceAttribute: 2,
- serviceStoreId: '',
- remark: '',
- serviceDate:'',
- childService:[
- // {
- // serviceObjectId: '',
- // facePhotoUrl:'', //回显需要,不做参数
- // nickName:'', //回显需要,不做参数
- // serviceUserId: '',
- // personName:'',//回显需要,不做参数
- // fee:'',//回显需要,不做参数
- // serviceStartTime: '',
- // serviceTeacherList:[],//服务人员列表,回显需要,不做参数
- // serviceTimeList:[]//服务时段列表,回显需要,不做参数
- // }
- ]
- },
- takeNumberData:{
- pageNum:1,
- pageSize:10,
- dictType:'tomorrow_make_rule'
- },
- takeNumberRules:[],
- storeInfo: {},
- expireEquityCard:[], //过期的权益卡
- activityImg:'',
- }
- },
- onLoad() {
- this.store = uni.getStorageSync('storeInfo')
- this.orderParam.serviceStoreId = this.store.storeId
- this.timeoutId = setTimeout(()=>{
- uni.showModal({
- title:'温馨提示',
- content:'您在下单页面停留太久,请重新进入!',
- showCancel:false,
- success:res=>{
- if (res.confirm){
- uni.switchTab({
- url: '/pages/index/index',
- })
- }
- }
- })
- },1000*60*5)
- this.getExpireEquityCard();
- this.getRecommendActivity();
- },
- onShow() {
- this.getActivityImg()
- //获取弹窗设置
- let reservationQueueContent = uni.getStorageSync('reservation_queue_content');
- if (!reservationQueueContent){
- this.getConfigKey('reservation_queue_content')
- }
- this.userInfo = uni.getStorageSync('userInfo')
- // 查询门店信息
- const data = uni.getStorageSync('storeInfo');
- this.store = uni.getStorageSync('storeInfo')
- if (!data) {
- // 获取位置信息查询门店列表数据
- this.getLocation();
- } else {
- this.storeInfo = data;
- }
- this.orderParam.childService = []
- this.price = 0
- //获取排班日期
- this.selectDate()
- this.getTemplateList()
- this.getSelectionRules(this.takeNumberData)
- },
- onUnload(){
- clearTimeout(this.timeoutId);
- },
- methods: {
- getActivityImg(){
- this.$api.getSelectionRules({
- dictType:'recommended_images'
- }).then(res => {
- if (res.data.rows.length > 0){
- let url = this.$activityImgUrl
- this.activityImg = url + res.data.rows[0].dictValue
- console.log("++++++++++this.activityImg++++++++++",this.activityImg)
- }
- })
- },
- goDetail(e){
- uni.navigateTo({
- url:'/orderPages/activityDetail/activityDetail?id=' + e.id
- })
- },
- getRecommendActivity(){
- this.$api.getRecommendActivity().then(res=>{
- this.recommendActivity = res.data.data
- })
- },
- navigateTo(item){
- if(item.activityId){
- let list = item.activityId.split(',')
- if (list.length == 1){
- uni.navigateTo({
- url:'/orderPages/activityDetail/activityDetail?id=' + item.activityId +'&renewServiceObjectId=' + item.serviceObjectId
- })
- }else {
- uni.navigateTo({
- url:'/orderPages/activityList/activityList?renewServiceObjectId=' + item.serviceObjectId + '&equityCardId=' + item.equityCardId
- })
- }
- }else{
- uni.navigateTo({
- url:'/orderPages/activityList/activityList'
- })
- }
- },
- getExpireEquityCard(){
- this.$api.getExpireEquityCard({
- serviceObjectId:0
- }).then((res)=>{
- this.expireEquityCard = res.data.data;
- // if (this.expireEquityCard.length > 0){
- // uni.showModal({
- // title:'温馨提示',
- // content:'您有' + this.expireEquityCard.length + '张权益卡即将到期',
- // confirmText:'立即续费',
- // success:(res)=>{
- // if (res.confirm) {
- // console.log('用户点击确定');
- // uni.navigateTo({
- // url:'/storePages/myRights/index'
- // })
- // } else if (res.cancel) {
- // console.log('用户点击取消');
- // }
- // }
- // })
- // }
- if (this.expireEquityCard.length > 0){
- this.$refs.showExpireEquityCard.open()
- }
- })
- },
- dialogConfirm(){
- this.configContent = '';
- },
- dialogClose(){
- uni.setStorageSync('reservation_queue_content',true);
- this.configContent = '';
- },
- getConfigKey(key){
- this.$api.getConfigKey({key:key}).then(res=>{
- console.log('获取到的配置信息',res.data.msg)
- if (res.data.msg){
- //打开弹窗
- this.configContent = res.data.msg
- this.$refs.reservationQueuePopup.open()
- }
- })
- },
- // 获取门店列表数据
- getStoreListData(data) {
- let that = this;
- // 用户绑定门店
- this.$api.storeList(data).then((res) => {
- that.storeInfo = res.data.data[0]
- // 更新用户选择的门店信息
- uni.setStorageSync('storeInfo', res.data.data[0])
- })
- },
- // 获取经纬度信息
- getLocation() {
- let that = this
- uni.getLocation({
- type: 'gcj02',
- success: function (res) {
- let latitude = res.latitude; // 纬度
- let longitude = res.longitude; // 经度
- let speed = res.speed; // 速度
- let accuracy = res.accuracy; // 精确度
- // 在这里可以对位置信息进行处理
- console.log("纬度:" + latitude + ";经度" + longitude)
- that.reqParm.latitude = latitude
- that.reqParm.longitude = longitude
- uni.setStorageSync('location', that.reqParm)
- that.getStoreListData(that.reqParm)
- },
- fail:function (fail) {
- that.getStoreListData(that.reqParm)
- },
- complete:function (complete) {
- console.log('获取用户地址失败or成功==》',complete)
- }
- });
- },
- // 去选择门店
- gotoStoreChoose() {
- uni.setStorageSync('router','2')
- uni.navigateTo({
- url: '/storePages/store/store-choose?type=1',
- })
- },
- back(){
- uni.switchTab({
- url: '/pages/index/index',
- })
- },
- clickPeriodDateList(e){
- this.periodDateIndex = e.index
- this.periodDate = e
- this.orderParam.serviceDate=this.periodDate.label
- //对所有子订单的服务人员及服务时段重新赋值
- this.getServicePerson(this.periodDate.label,true)
- },
- openSetting(){
- if (!this.userInfo.phone){
- uni.showModal({
- title:'温馨提示',
- content:'预约叫号是通过手机尾号进行查询,是否确认绑定手机号',
- success:res=>{
- if (res.confirm){
- uni.navigateTo({
- url: '/myPages/setting/setting-telphone',
- })
- }
- }
- })
- return
- }
- let flag = false
- this.orderParam.childService.forEach(i=>{
- if (!i.serviceStartTime || i.serviceStartTime == ''){
- uni.$u.toast('有服务对象没有选择服务时段')
- flag=true
- return
- }
- })
- if (flag){
- return;
- }
- uni.requestSubscribeMessage({
- tmplIds: this.templateId,
- success: (res) =>{
- let {errMsg,...param} = res
- this.$api.updateSubscribe(param).then(res=>{
- console.log('+++++++++++++updateSubscribe+++++++++++++',res)
- })
- },
- fail:(err)=>{
- console.log('+++++++++++++fail+++++++++++++',err)
- },
- complete:(complete)=>{
- this.commitOrder()
- }
- })
- },
- getTemplateList(){
- this.$api.getTemplateList({
- type:1
- }).then(res=>{
- this.templateId=res.data.data.data.map(item=>{
- return item.priTmplId
- })
- })
- },
- improperClose(){
- uni.switchTab({
- url: '/pages/order/index'
- })
- },
- bindPickerChange(e){
- if (e.detail.value == this.periodDateIndex){
- return
- }
- this.periodDateIndex = e.detail.value
- this.periodDate = this.periodDateList[e.detail.value]
- this.orderParam.serviceDate=this.periodDate.label
- //对所有子订单的服务人员及服务时段重新赋值
- this.getServicePerson(this.periodDate.label,true)
- },
- //获取排班日期
- selectDate() {
- this.$api.selectDate({
- organization: this.store.storeId
- }).then(res => {
- this.periodDate = res.data.data[0]
- this.periodDateList = res.data.data
- for (const argument of this.periodDateList) {
- let month = argument.label.substring(5,6) == 0 ? argument.label.substring(6,7) : argument.label.substring(5,7)
- let day = argument.label.substring(8,9) == 0 ? argument.label.substring(9,10) : argument.label.substring(8,10)
- argument.name =month + '月' + day +'日'
- }
- this.orderParam.serviceDate=this.periodDate.label
- this.getServicePerson(this.periodDate.label,false)
- })
- },
- // 查询服务工作人员列表
- getServicePerson(date,bindPickerChange) {
- this.$api.getServicePerson({
- storeId:this.store.storeId,
- date:date
- }).then((res) => {
- this.serviceTeacherList = res.data.data;
- if (this.serviceTeacherList.length > 0){
- this.serviceTeacherList[0].select = true
- this.getServicePersonUrl(this.serviceTeacherList);
- }
- if (bindPickerChange){
- if (this.orderParam.childService.length === 0){
- // this.selectServiceObject(this.serviceObjectList[0])
- }else {
- this.serviceObjectList.forEach(i=>{
- if (i.select){
- this.orderParam.childService=[]
- i.select = false
- this.selectServiceObject(i)
- }
- })
- }
- }else {
- this.listServiceObject()
- }
- })
- },
- getServicePersonUrl(items){
- for (let i = 0; i < items.length; i++) {
- if (items[i].facePhoto) {
- this.$api.getImgUrlByOssId({
- ossId: items[i].facePhoto
- }).then(res => {
- items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
- this.$set(this.serviceTeacherList, i, items[i])
- })
- }
- }
- },
- // 查询服务对象信息列表
- listServiceObject() {
- this.$api.listServiceObject(this.reqParm).then((res) => {
- this.serviceObjectList = res.data.data
- this.getServiceObjectUrl(this.serviceObjectList);
- })
- },
- // 获取图片
- getServiceObjectUrl(items) {
- for (let i = 0; i < items.length; i++) {
- if (items[i].facePhoto) {
- this.$api.getImgUrlByOssId({
- ossId: items[i].facePhoto
- }).then(res => {
- items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
- this.$set(this.serviceObjectList, i, items[i])
- })
- }
- if (i === 0){
- // this.selectServiceObject(items[i])
- }
- }
- },
- selectServiceObject(item) {
- if (!this.serviceTeacherList || this.serviceTeacherList.length==0){
- uni.showToast({
- icon: 'none',
- duration: 2000,
- title: '暂无可预约排班'
- });
- return
- }
- if (item.select) {
- this.orderParam.childService = this.orderParam.childService.filter(selectServiceObject =>
- selectServiceObject.serviceObjectId !== item.id)
- item.select = !item.select
- this.price = 0
- for (let childService of this.orderParam.childService) {
- this.price = this.price * 1 + childService.fee * 1
- this.price = this.price.toFixed(2)
- }
- } else {
- uni.showModal({
- title:"温馨提示",
- content:"当前默认门店为" + this.storeInfo.storeName + "是否需要更换",
- showCancel:false,
- confirmText:"知道了"
- })
- this.$api.getServicePersonTime({
- personId: this.serviceTeacherList[0].personId,
- date: this.periodDate.label,
- storeId:this.store.storeId
- }).then(res => {
- item.select = !item.select
- let selectServiceObjectList = this.orderParam.childService
- let periodTimeList = res.data.data
- if (!res.data.data || res.data.data.length==0){
- //这里只为了断开技师列表的应用关系
- let serviceTeacherListStr = JSON.stringify(this.serviceTeacherList)
- let serviceTeacherList = JSON.parse(serviceTeacherListStr)
- let childService ={
- serviceObjectId: item.id,
- facePhotoUrl:item.facePhotoUrl, //回显需要,不做参数
- nickName:item.nickName, //回显需要,不做参数
- serviceUserId: serviceTeacherList[0].personId,
- levelId: serviceTeacherList[0].levelId,
- fee:0,//回显需要,不做参数
- serviceStartTime: '',
- serviceTeacherList:serviceTeacherList,//服务人员列表,回显需要,不做参数
- serviceTimeList:periodTimeList//服务时段列表,回显需要,不做参数
- }
- this.orderParam.childService.push(childService)
- this.price = 0
- for (let childService of this.orderParam.childService) {
- this.price = this.price * 1 + childService.fee * 1
- this.price = this.price.toFixed(2)
- }
- return
- }
- //选择服务对象时,获取的排班时间为全部技师的排班时间,所以只要某个时段被选过,那么这个时段的数量-1
- selectServiceObjectList.forEach(selectServiceObject =>{
- periodTimeList.forEach(periodTime =>{
- if (selectServiceObject.serviceStartTime == periodTime.label ){
- periodTime.total = periodTime.total - 1
- }
- })
- })
- let date = null //系统为当前服务对象分配的时间
- for (const time of periodTimeList) {
- if (time.total>0){
- time.select = true
- date = time
- //为当前服务对象分配时间段成功时,需要将以前的服务对象的可选择的时间段的total -1
- selectServiceObjectList.forEach(selectServiceObject =>{
- if (selectServiceObject.serviceUserId === -1){
- //如果子订单没有指定技师,则对应的时段-1
- selectServiceObject.serviceTimeList.forEach(t=>{
- if (t.label == date.label){
- t.total = t.total -1
- }
- })
- }else {
- selectServiceObject.serviceTimeList.forEach(t=>{
- //如果子订单指定技师,且该技师的服务时段未被选中,则对应的时段-1
- if (t.label == date.label && !t.select){
- t.total = t.total -1
- }
- })
- }
- })
- break
- }
- }
- //这里只为了断开技师列表的应用关系
- let serviceTeacherListStr = JSON.stringify(this.serviceTeacherList)
- let serviceTeacherList = JSON.parse(serviceTeacherListStr)
- //创建子订单项
- let childService ={
- serviceObjectId: item.id,
- facePhotoUrl:item.facePhotoUrl, //回显需要,不做参数
- nickName:item.nickName, //回显需要,不做参数
- serviceUserId: serviceTeacherList[0].personId,
- levelId: serviceTeacherList[0].levelId,
- fee:serviceTeacherList[0].fee,//回显需要,不做参数
- serviceStartTime: date.label,
- serviceTeacherList:serviceTeacherList,//服务人员列表,回显需要,不做参数
- serviceTimeList:periodTimeList//服务时段列表,回显需要,不做参数
- }
- this.orderParam.childService.push(childService)
- this.price = 0
- for (let childService of this.orderParam.childService) {
- this.price = this.price * 1 + childService.fee * 1
- this.price = this.price.toFixed(2)
- }
- })
- }
- },
- selectServiceTeach(items,index,index1){
- items.forEach(e=>{
- e.select=false
- })
- items[index1].select =true
- this.orderParam.childService[index].fee = items[index1].fee
- this.orderParam.childService[index].serviceUserId = items[index1].personId
- this.orderParam.childService[index].levelId = items[index1].levelId
- this.$api.getServicePersonTime({
- personId: items[index1].personId,
- date: this.periodDate.label,
- storeId:this.store.storeId
- }).then(res => {
- let serviceTimeList = res.data.data
- if (!serviceTimeList || serviceTimeList.length == 0){
- this.orderParam.childService[index].serviceStartTime = ''
- this.orderParam.childService[index].periodTimeList = []
- this.orderParam.childService[index].fee = 0
- this.price = 0
- for (let childService of this.orderParam.childService) {
- this.price = this.price * 1 + childService.fee * 1
- this.price = this.price.toFixed(2)
- }
- this.$forceUpdate()
- }else {
- let selectServiceObjectList = this.orderParam.childService.filter(selectServiceObject =>
- (selectServiceObject.serviceUserId === items[index1].personId
- && selectServiceObject.serviceObjectId !== this.orderParam.childService[index].serviceObjectId)
- || selectServiceObject.serviceUserId === -1
- )
- selectServiceObjectList.forEach(selectServiceObject =>{
- serviceTimeList.forEach(periodTime =>{
- if (selectServiceObject.serviceStartTime === periodTime.label ){
- if (selectServiceObject.serviceUserId === -1){
- selectServiceObject.serviceTimeList.forEach(t=>{
- if (t.label == periodTime.label && t.total === 1){
- periodTime.total = periodTime.total - 1
- }
- })
- }else {
- periodTime.total = periodTime.total - 1
- }
- }
- })
- })
- for (const time of serviceTimeList) {
- if (time.total>0){
- time.select = true
- break
- }
- }
- serviceTimeList[0].select = true
- this.orderParam.childService[index].serviceStartTime= serviceTimeList[0].label,
- this.orderParam.childService[index].serviceTimeList= serviceTimeList
- }
- })
- this.price = 0
- for (let childService of this.orderParam.childService) {
- this.price = this.price * 1 + childService.fee * 1
- this.price = this.price.toFixed(2)
- }
- this.$forceUpdate()
- },
- selectServiceTime(items,index,index2){
- items.forEach(e=>{
- e.select=false
- })
- items[index2].select =true // 新选中的时间
- // let selectServiceObject = this.orderParam.childService[index] //旧的时间
- // this.orderParam.childService.forEach(i=>{
- // if (selectServiceObject.serviceUserId === -1){
- // i.serviceTimeList.forEach(t=>{
- // if (t.label == selectServiceObject.serviceStartTime && !t.select ){
- // console.log('-1----------加1')
- // t.total +=1
- // }
- // if (t.label == items[index2].serviceStartTime && i.serviceObjectId != selectServiceObject.serviceObjectId){
- // console.log('-1----------减1')
- // t.total -=1
- // }
- // })
- // }else {
- // if (selectServiceObject.serviceUserId == i.serviceUserId){
- // i.serviceTimeList.forEach(t=>{
- // if (t.label == selectServiceObject.serviceStartTime && !t.select ){
- // t.total +=1
- // }
- // if (t.label == items[index2].serviceStartTime && i.serviceObjectId != selectServiceObject.serviceObjectId){
- // t.total -=1
- // }
- // })
- // }
- // }
- // })
- this.orderParam.childService[index].serviceStartTime = items[index2].label
- this.$forceUpdate()
- },
- selectChange() {
- this.selectIcon = !this.selectIcon
- },
- goTermsOfService() {
- uni.navigateTo({
- url: '/myPages/TermsOfService/index?name=' + '预约需知' + '&type=' + 5
- })
- },
- //支付组件回调
- payResult(e){
- console.log(e)
- if(e.payResult){
- uni.showToast({
- title: '支付成功!'
- });
- }else {
- uni.showToast({
- title: e.res.data.msg,
- icon: 'error'
- });
- }
- setTimeout(()=>{
- uni.switchTab({
- url: '/pages/order/index'
- })
- },1000)
- },
- //提交订单
- commitOrder() {
- if (this.subOrderNo){
- this.$refs.myPay.openPopup()
- }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
- uni.showLoading({
- title: '加载中'
- });
- this.$api.commonGeneralOrder(this.orderParam).then(res => {
- console.log('++++++++++++++++++订单提交+++++++++++', res)
- if (res.data.data.subOrderNo) {
- uni.hideLoading();
- this.subOrderNo = res.data.data.subOrderNo
- this.$refs.myPay.openPopup()
- } else {
- uni.hideLoading();
- uni.$u.toast('预约成功')
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/order/index'
- })
- }, 500)
- }
- this.requestStatus = false
- }).catch(err => {
- this.requestStatus = false
- })
- }
- },
- getSelectionRules(data){
- this.$api.getSelectionRules(data).then(res=>{
- this.takeNumberRules = res.data.rows
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import './index.rpx.scss';
- .store-wrap {
- margin-top: 10rpx;
- background-color: white;
- .store-info {
- display: flex;
- .logo {
- width: 10%;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- image {
- width: 30px;
- height: 30px;
- }
- }
- .store-content {
- width: 90%;
- padding-bottom: 13px;
- .h-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .store-desc {
- width: 90%;
- display: flex;
- line-height: 30px;
- font-size: 14px;
- .store-name {
- }
- }
- .arrow-right {
- text-align: right;
- margin: 0 auto;
- cursor: pointer;
- padding-top: 3px;
- width: 100px;
- display: flex;
- font-size: 14px;
- .change-store {
- text-align: right;
- color: #666;
- }
- image {
- width: 18px;
- height: 18px;
- }
- }
- .address {
- color: #999999;
- width: 450rpx;
- font-size: 24rpx;
- }
- .address1 {
- color: #999999;
- font-size: 24rpx;
- padding-right: 40rpx;
- }
- }
- }
- }
- .adress {
- font-size: 22rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- padding-left: 80rpx;
- color: #666;
- }
- }
- </style>
|