<template>
	<page-meta :page-style="'overflow:'+(ifShowPageMeta?'hidden':'visible')"></page-meta>
	<view>
		<!-- 顶部操作条 -->
		<cu-custom :bgColor="'bg-main-color'" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">服务订单详情</block>
		</cu-custom>
		<!-- 任务进度跟踪 -->
		<view v-if="servDetail.orderStatus === 3" class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm">
			<uni-collapse v-model="value">
				<uni-collapse-item :open="true">
					<template v-slot:title>
						<view class="cu-bar">
							<view class="action bar-first-action">
								<text class="cuIcon-titles text-main-color"></text> 任务进度跟踪
							</view>
						</view>
					</template>
					<view class="cu-timeline">
						<view class="cu-item text-main-color" v-for="(item, index) in servDetail.taskTraceLine">
							<view class="content shadow-blur" :class="index === 0 ? 'bg-main-color light' : 'bg-gray'">
								<text class="margin-right">{{item.time}}</text>
								<text>{{item.action}}</text>
							</view>
						</view>
					</view>
				</uni-collapse-item>
			</uni-collapse>
		</view>
		<!-- 服务单概况 -->
		<view class="bg-white margin-lr-sm margin-top-sm padding">
			<view class="flex align-center">
				<text class="text-xl margin-right">{{servDetail.goodsName}}</text>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 5">已完成</view>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 4">确认中</view>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 3">服务中</view>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 2">待上门</view>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 1">未约/未排</view>
			</view>
			<!-- <view class="margin-top-sm">
				<view v-for="(item, index) in servDetail.mainServOrder.orderTag" class='cu-tag radius margin-right-sm'>
					{{item}}</view>
			</view> -->
			<view class="margin-top-sm">
				<text class="cuIcon-location text-main-color margin-right-xs"></text>
				<text>服务地址：{{servDetail.address}}</text>
			</view>
			<view class="margin-top-sm">
				<text class="cuIcon-people text-main-color margin-right-xs"></text>
				<text class="margin-right-sm">客户：{{servDetail.customerName}}</text>
				<text>{{servDetail.customerPhone.substring(0, 3) + "****" + servDetail.customerPhone.substring(7)}}</text>
				<button class="cu-btn line-main-color sm" @click="makeCustomerPhoneCall(servDetail)">拨打</button>
			</view>
			<view class="margin-top-sm" v-if="servDetail.orderDetailId">
				<text class="cuIcon-friendfamous text-main-color margin-right-xs"></text>
				<text class="margin-right-sm">派单公司：{{servDetail.masterCompanyName}}</text>
				<text class="margin-right-xs">{{servDetail.masterWorkerPhone}}</text>
				<button class="cu-btn line-main-color sm" @click="makePhoneCall(servDetail.masterWorkerPhone)">拨打</button>
			</view>
			<view class="margin-top-sm">
				<text class="cuIcon-time text-main-color margin-right-xs"></text>
				<text v-if="servDetail.expectTimeEndFront">预约时间：{{servDetail.expectTimeStartFront + '~' + servDetail.expectTimeEndFront}}</text>
				<text v-else>预约时间：{{servDetail.expectTimeStartFront}}</text>
			</view>
			<!-- <view class="margin-top-sm">
				<text class="cuIcon-time text-main-color margin-right-xs"></text>
				<text>排单时间：{{servDetail.mainServOrder.boodTime}}</text>
			</view> -->
			<view class="margin-top-sm" v-if="servDetail.orderDetailId != null && servDetail.orderStatus >= 3">
				<text class="cuIcon-time text-main-color margin-right-xs"></text>
				<text>上门时间：{{servDetail.workBeginTime}}</text>
			</view>
			<view class="margin-top-sm" v-if="servDetail.orderDetailId == null && servDetail.orderMode == '02'">
				<text class="cuIcon-moneybag text-main-color margin-right-xs"></text>
				<text>订单金额：</text>
				<text class="text-price">{{servDetail.totalMoney}}</text>
			</view>
			<view class="margin-top-sm" v-if="servDetail.customerRemark">
				<text class="cuIcon-message text-main-color margin-right-xs"></text>
				<text>备注：{{servDetail.customerRemark}}</text>
			</view>
			<view class="margin-top-sm">
				<text class="cuIcon-moneybag text-main-color margin-right-xs"></text>
				<text>服务金额：</text>
				<text class="text-price" v-if="servDetail.orderDetailId != null">{{servDetail.payMoney}}</text>
				<text class="text-price" v-else>{{servDetail.serverMoney}}</text>
			</view>
			<view class="text-sm text-gray margin-left-lg" 
				v-if="servDetail.orderDetailId != null && servDetail.timeout == 1">
				<text>加减费用：<text class="text-price margin-top-xs">-3</text>
				[
				<text v-if="servDetail.orderStatus === 0">接单</text>
				<text v-else-if="servDetail.orderStatus === 1">预约</text>
				<text v-else-if="servDetail.orderStatus === 2">上门</text>
				<text v-else-if="servDetail.orderStatus === 3">完单</text>
				超时]
				</text>
			</view>
			<view class="text-sm text-gray margin-left-lg" v-if="servDetail.orderDetailId != null && servDetail.financialChangeRecords != null"
				v-for="(item, index) in servDetail.financialChangeRecords">
				<text v-if="item.payStatus === 1">加减费用：<text class="text-price margin-top-xs">+{{item.changeMoney}}</text>[订单加价]</text>
			</view>
		</view>
		<!-- 待服务列 -->
		<view class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> 商品信息
				</view>
			</view>
			<view class="margin-top-sm">
				<product-picked :product="servDetail" :pickedList="servDetail.standardList" :columnTitleArr="servingColumnHeaders" :valFieldArr="servingValFields"></product-picked>
			</view>
		</view>
		<!-- 加价记录 子单详情展示 -->
		<view v-if="servDetail.orderDetailId != null && servDetail.financialChangeRecords && servDetail.financialChangeRecords.length > 0" class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> 加价记录
				</view>
			</view>
			<view class="padding-tb-sm" v-for="(changeRecord, changeRecordIndex) in servDetail.financialChangeRecords">
				<view>
					<text>加价金额：</text>
					<text>{{changeRecord.changeMoney}}</text>
				</view>
				<view>
					<text>加价备注：</text>
					<text v-if="changeRecord.remark">{{changeRecord.remark}}</text>
				</view>
			</view>
		</view>
		<!-- 完工图片 子单详情展示 -->
		<view v-if="servDetail.orderDetailId != null && servDetail.orderStatus > 3 && servDetail.finishImgList && servDetail.finishImgList.length" class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> 完工图片
				</view>
			</view>
			<view class="grid col-3 grid-square flex-sub margin-top-sm">
				<view class="bg-img" v-for="(imgUrl, index) in servDetail.finishImgList" :key="index">
					<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
				</view>
			</view>
			<view>
				<text>备注：{{servDetail.workerRemark}}</text>
			</view>
		</view>
		<view class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm" v-if="servDetail.orderDetailId != null && servDetail.afterServiceRecordList && servDetail.afterServiceRecordList.length > 0">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> 售后记录
				</view>
			</view>
			<view v-for="(afterServiceRecord, afterServiceRecordIndex) in servDetail.afterServiceRecordList">
				<view v-if="afterServiceRecord.createBy == 1" class="padding-tb-sm solid-top">
					<view class='cu-tag bg-main-color radius light'>售后发起中</view>
					<view v-if="afterServiceRecord.operType === 1">
						<view class="text-gray text-sm margin-bottom-xs">退单退款已提交至商家，其最大时限24小时内需完成操作！</view>
						<view class="flex justify-start align-end">
							<text>退款申请：</text>
							<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
								:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).day"
								:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).hour"
								:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).min"
								:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).seconds">
							</uni-countdown>
						</view>
						<view>
							<text>退款金额：</text>
							<text>{{afterServiceRecord.refund}}</text>
						</view>
						<view>
							<text>退款原因：</text>
							<text v-if="afterServiceRecord.customerReasonType === 1">上门/服务不守时</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 2">态度不友好，无法继续</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 3">服务效果差，未达到合格</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 4">技能水平问题，未妥善完成</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 5">要求加费用，费用不合理</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 6">订单拖太久了</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 7">超了些服务内容，师傅不接受</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 8">客户/我时间不方便了</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 9">客户/我已让别的师傅服务了</text>
						</view>
						<view>
							<text>具体原因：</text>
							<text v-if="afterServiceRecord.customerReason">{{afterServiceRecord.customerReason}}</text>
						</view>
						<view class="grid col-3 grid-square flex-sub margin-top-sm">
							<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
								:key="imgIndex" v-if="imgObj.imgUploadBy === 1">
								<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
									:data-url="imgObj.imgUrl" mode="aspectFill"></image>
							</view>
						</view>
						<view>
							<text class="text-red" v-if="!item.isOnlyServ && item.payMoney < afterServiceRecord.refund">警报：退单金额大于该师傅接单金额，但客户发起的退款金额有效，您需介入处理，如让接单师傅系统上操作同意退款，系统最大按该单派单额退回客户，其余需人工处理！如属于师傅责任引起的退单，建议重做，重做后让客户撤消退单！</text>
						</view>
					</view>
					<view v-else-if="afterServiceRecord.operType === 2">
						<view class="text-gray text-sm margin-bottom-xs">售后已提交至商家，其最大时限24小时内需完成操作！</view>
						<view class="flex justify-start align-end">
							<text>待处理售后：</text>
							<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
								:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).day"
								:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).hour"
								:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).min"
								:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).seconds">
							</uni-countdown>
						</view>
						<view>
							<text>售后原因：</text>
							<text v-if="afterServiceRecord.customerReasonType === 1">上门/服务不守时</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 2">态度不友好，无法继续</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 3">服务效果差，未达到合格</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 4">技能水平问题，未妥善完成</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 5">要求加费用，费用不合理</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 6">订单拖太久了</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 7">超了些服务内容，师傅不接受</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 8">客户/我时间不方便了</text>
							<text v-else-if="afterServiceRecord.customerReasonType === 9">客户/我已让别的师傅服务了</text>
						</view>
						<view>
							<text>具体原因：</text>
							<text v-if="afterServiceRecord.customerReason">{{afterServiceRecord.customerReason}}</text>
						</view>
						<view class="grid col-3 grid-square flex-sub margin-top-sm">
							<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
								:key="imgIndex" v-if="imgObj.imgUploadBy === 1">
								<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
									:data-url="imgObj.imgUrl" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
				<view v-if="afterServiceRecord.updateBy == 2" class="padding-tb-sm solid-top">
					<view class='cu-tag bg-main-color radius light'>师傅反馈</view>
					<view v-if="afterServiceRecord.operType === 1">
						<view class="margin-top-xs">
							<text>师傅反馈结果：</text>
							<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
							<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
							<text v-else-if="afterServiceRecord.workerFeedbackResult === 2">重新上门</text>
						</view>
						<view v-if="afterServiceRecord.workerFeedbackResult === 1">
							<text>同意退款金额：</text>
							<text>{{afterServiceRecord.agreedRefund ? afterServiceRecord.agreedRefund : afterServiceRecord.refund}}</text>
						</view>
						<view v-if="afterServiceRecord.workerFeedbackResult !== 2">
							<text>师傅反馈：</text>
							<text v-if="afterServiceRecord.workerFeedbackReasonType === 1">客户原因</text>
							<text v-else-if="afterServiceRecord.workerFeedbackReasonType === 2">师傅原因</text>
							<text v-else>其他</text>
							<text
								v-if="afterServiceRecord.workerFeedbackReason">{{"，" + afterServiceRecord.workerFeedbackReason}}</text>
						</view>
						<view class="grid col-3 grid-square flex-sub margin-top-sm">
							<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
								:key="imgIndex" v-if="imgObj.imgUploadBy === 2">
								<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
									:data-url="imgObj.imgUrl" mode="aspectFill"></image>
							</view>
						</view>
					</view>
					<view v-else-if="afterServiceRecord.operType === 2">
						<view class="margin-top-xs">
							<text>师傅反馈结果：</text>
							<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
							<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
							<text v-else-if="afterServiceRecord.workerFeedbackResult === 2">重新上门</text>
						</view>
						<view v-if="afterServiceRecord.workerFeedbackResult !== 2">
							<text>师傅反馈：</text>
							<text v-if="afterServiceRecord.workerFeedbackReasonType === 1">客户原因</text>
							<text v-else-if="afterServiceRecord.workerFeedbackReasonType === 2">师傅原因</text>
							<text v-else>其他</text>
							<text
								v-if="afterServiceRecord.workerFeedbackReason">{{"，" + afterServiceRecord.workerFeedbackReason}}</text>
						</view>
						<view class="grid col-3 grid-square flex-sub margin-top-sm">
							<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
								:key="imgIndex" v-if="imgObj.imgUploadBy === 2">
								<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
									:data-url="imgObj.imgUrl" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
				<view v-if="afterServiceRecord.customerFinalCheck != null" class="padding-tb-sm solid-top">
					<view class='cu-tag bg-main-color radius light'>客户最终确认</view>
					<view class="margin-top-xs">{{afterServiceRecord.customerFinalCheck === 1 ? '同意' : '不同意'}}
					</view>
					<view class="text-red" v-if="afterServiceRecord.customerFinalCheck === 0">订单交由平台协商处理</view>
					<view v-else-if="afterServiceRecord.customerFinalCheck === 1">
						<view v-if="afterServiceRecord.originalRefund > 0">
							<view>
								<text>本单退款，系统已发起按客户支付的帐户原路退回</text>
								<text class="text-red">{{afterServiceRecord.originalRefund}}</text>
								<text>元，银行按工作日退款，节假日顺延到帐。遇客户问询，请其耐心等待，到账时会在客户端”客户最终确认“处有到账时间。</text>
							</view>
							<view>退款支付到账：{{afterServiceRecord.refundApplyTime}}</view>
						</view>
						<view v-else-if="afterServiceRecord.originalRefund == 0 && servDetail.payStatus == 0">
							<text>本单未支付，实际退回0.00元</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 完成记录 主单详情展示 -->
		<view v-if="servDetail.orderDetailId == null" class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm" v-for="(item, index) in servDetail.orderStandardDetailList">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> 服务记录
				</view>
				<view>
					<view class="cu-btn sm bg-main-color margin-right-sm shadow-blur" v-if="[0,1,2,3].indexOf(item.orderStatus) >= 0" @click="rejectDetailOrder(item)">撤单</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 5">已完成</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 4">待确认</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 3">服务中</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 2">待上门</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 1">未约/未排</view>
					<view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus === 0">待接单</view>
				</view>
				<!-- <view class='cu-tag bg-purple radius light margin-right-sm' v-if="item.orderStatus > 3">{{item.workFinishTime}}</view> -->
			</view>
			<view class="margin-top-sm">
				<view class="float-left" v-for="(afterServiceRecord, afterServiceRecordIndex) in item.afterServiceRecordList">
					<view v-if="afterServiceRecord.createBy && !afterServiceRecord.updateBy" class='cu-tag margin-right-xs radius line-red margin-top-xs'>售后发起中</view>
					<view v-if="afterServiceRecord.workerFeedbackResult == 1 && afterServiceRecord.customerFinalCheck == null" class='cu-tag margin-right-xs radius line-main-color margin-top-xs'>售后已同意</view>
					<view v-if="afterServiceRecord.workerFeedbackResult == 0 && afterServiceRecord.customerFinalCheck == null" class='cu-tag margin-right-xs radius line-red margin-top-xs'>售后已拒绝</view>
					<view v-if="afterServiceRecord.customerFinalCheck == 0" class='cu-tag margin-right-xs radius line-red margin-top-xs'>售后纠纷中</view>
					<view v-if="afterServiceRecord.customerFinalCheck == 1" class='cu-tag margin-right-xs radius line-main-color margin-top-xs'>售后已完成</view>
				</view>
				<view v-if="item.timeout == 1" class="float-left">
					<view v-if="item.orderStatus === 0" class='cu-tag margin-right-xs radius line-red margin-top-xs'>超时未接单</view>
					<view v-else-if="item.orderStatus === 1" class='cu-tag margin-right-xs radius line-red margin-top-xs'>超时未预约</view>
					<view v-else-if="item.orderStatus === 2" class='cu-tag margin-right-xs radius line-red margin-top-xs'>超时未上门</view>
					<view v-else-if="item.orderStatus === 3" class='cu-tag margin-right-xs radius line-red margin-top-xs'>超时未完单</view>
				</view>
			</view>
			<view class="float-clear"></view>
			<view class="margin-top-sm">师傅：{{item.workerName}}</view>
			<view class="margin-top-sm">
				<text class="margin-right-xs">联系方式：{{item.workerPhone}}</text>
				<button class="cu-btn line-main-color sm" @click="makePhoneCall(item.workerPhone)">拨打</button>
			</view>
			<view class="margin-top-sm">
				服务金额：
				<text class="text-price">{{item.payMoney}}</text>
			</view>
			<view class="margin-top-sm" v-if="item.expectTimeEndFront">预约时间：{{item.expectTimeStartFront + '~' + item.expectTimeEndFront}}</view>
			<view class="margin-top-sm" v-else>预约时间：{{item.expectTimeStartFront}}</view>
			<view class="margin-top-sm" v-if="item.orderStatus >= 3">上门时间：{{item.workBeginTime}}</view>
			<view class="margin-top-sm" v-if="item.orderStatus >= 4">完成时间：{{item.workFinishTime}}</view>
			<view class="margin-top-sm">
				<product-picked :pickedList="item.orderStandardList" :columnTitleArr="servedColumnHeaders" :valFieldArr="servedValFields"></product-picked>
			</view>
			<view v-if="item.financialChangeRecord && item.financialChangeRecord.length > 0" class="bg-white">
				<view class="cu-bar solid-bottom">
					<view class="action bar-first-action">
						<text class="cuIcon-title text-main-color"></text> 加价记录
					</view>
				</view>
				<view class="padding-tb-sm" v-for="(changeRecord, changeRecordIndex) in item.financialChangeRecord">
					<view>
						<text>加价金额：</text>
						<text>{{changeRecord.changeMoney}}</text>
					</view>
					<view>
						<text>加价备注：</text>
						<text v-if="changeRecord.remark">{{changeRecord.remark}}</text>
					</view>
				</view>
			</view>
			<view v-if="servDetail.orderStatus > 3 && item.finishImgList && item.finishImgList.length" class="bg-white">
				<view class="cu-bar solid-bottom">
					<view class="action bar-first-action">
						<text class="cuIcon-title text-main-color"></text> 完工图片
					</view>
				</view>
				<view class="grid col-3 grid-square flex-sub margin-top-sm">
					<view class="bg-img" v-for="(imgUrl, index) in item.finishImgList" :key="index">
						<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill">
						</image>
					</view>
				</view>
				<view>
					<text>备注：{{item.remark}}</text>
				</view>
			</view>
			<view v-if="item.afterServiceRecordList && item.afterServiceRecordList.length" class="bg-white">
				<view class="cu-bar">
					<view class="action bar-first-action">
						<text class="cuIcon-title text-main-color"></text>
						{{item.afterServiceRecordList[0].operType === 1 ? '退款记录' : '售后记录'}}
					</view>
				</view>
				<view v-for="(afterServiceRecord, afterServiceRecordIndex) in item.afterServiceRecordList">
					<view v-if="afterServiceRecord.createBy == 1" class="padding-tb-sm solid-top">
						<view class='cu-tag bg-main-color radius light'>售后发起中</view>
						<view v-if="afterServiceRecord.operType === 1">
							<view class="text-gray text-sm margin-bottom-xs">退单退款已提交至商家，其最大时限24小时内需完成操作！</view>
							<view class="flex justify-start align-end">
								<text>退款申请：</text>
								<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
									:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).day"
									:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).hour"
									:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).min"
									:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).seconds">
								</uni-countdown>
							</view>
							<view>
								<text>退款金额：</text>
								<text>{{afterServiceRecord.refund}}</text>
							</view>
							<view>
								<text>退款原因：</text>
								<text v-if="afterServiceRecord.customerReasonType === 1">上门/服务不守时</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 2">态度不友好，无法继续</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 3">服务效果差，未达到合格</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 4">技能水平问题，未妥善完成</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 5">要求加费用，费用不合理</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 6">订单拖太久了</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 7">超了些服务内容，师傅不接受</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 8">客户/我时间不方便了</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 9">客户/我已让别的师傅服务了</text>
							</view>
							<view>
								<text>具体原因：</text>
								<text v-if="afterServiceRecord.customerReason">{{afterServiceRecord.customerReason}}</text>
							</view>
							<view class="grid col-3 grid-square flex-sub margin-top-sm">
								<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
									:key="imgIndex" v-if="imgObj.imgUploadBy === 1">
									<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
										:data-url="imgObj.imgUrl" mode="aspectFill"></image>
								</view>
							</view>
							<view>
								<text class="text-red" v-if="!item.isOnlyServ && item.payMoney < afterServiceRecord.refund">警报：退单金额大于该师傅接单金额，但客户发起的退款金额有效，您需介入处理，如让接单师傅系统上操作同意退款，系统最大按该单派单额退回客户，其余需人工处理！如属于师傅责任引起的退单，建议重做，重做后让客户撤消退单！</text>
							</view>
						</view>
						<view v-else-if="afterServiceRecord.operType === 2">
							<view class="text-gray text-sm margin-bottom-xs">售后已提交至商家，其最大时限24小时内需完成操作！</view>
							<view class="flex justify-start align-end">
								<text>待处理售后：</text>
								<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
									:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).day"
									:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).hour"
									:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).min"
									:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.createTime, 24)).seconds">
								</uni-countdown>
							</view>
							<view>
								<text>售后原因：</text>
								<text v-if="afterServiceRecord.customerReasonType === 1">上门/服务不守时</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 2">态度不友好，无法继续</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 3">服务效果差，未达到合格</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 4">技能水平问题，未妥善完成</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 5">要求加费用，费用不合理</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 6">订单拖太久了</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 7">超了些服务内容，师傅不接受</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 8">客户/我时间不方便了</text>
								<text v-else-if="afterServiceRecord.customerReasonType === 9">客户/我已让别的师傅服务了</text>
							</view>
							<view>
								<text>具体原因：</text>
								<text v-if="afterServiceRecord.customerReason">{{afterServiceRecord.customerReason}}</text>
							</view>
							<view class="grid col-3 grid-square flex-sub margin-top-sm">
								<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
									:key="imgIndex" v-if="imgObj.imgUploadBy === 1">
									<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
										:data-url="imgObj.imgUrl" mode="aspectFill"></image>
								</view>
							</view>
						</view>
					</view>
					<view v-if="afterServiceRecord.updateBy == 2" class="padding-tb-sm solid-top">
						<view class='cu-tag bg-main-color radius light'>师傅反馈</view>
						<view v-if="afterServiceRecord.operType === 1">
							<view class="margin-top-xs">
								<text>师傅反馈结果：</text>
								<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 2">重新上门</text>
							</view>
							<view v-if="afterServiceRecord.workerFeedbackResult === 1">
								<text>同意退款金额：</text>
								<text>{{afterServiceRecord.agreedRefund ? afterServiceRecord.agreedRefund : afterServiceRecord.refund}}</text>
							</view>
							<view v-if="afterServiceRecord.workerFeedbackResult !== 2">
								<text>师傅反馈：</text>
								<text v-if="afterServiceRecord.workerFeedbackReasonType === 1">客户原因</text>
								<text v-else-if="afterServiceRecord.workerFeedbackReasonType === 2">师傅原因</text>
								<text v-else>其他</text>
								<text
									v-if="afterServiceRecord.workerFeedbackReason">{{"，" + afterServiceRecord.workerFeedbackReason}}</text>
							</view>
							<view class="grid col-3 grid-square flex-sub margin-top-sm">
								<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
									:key="imgIndex" v-if="imgObj.imgUploadBy === 2">
									<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
										:data-url="imgObj.imgUrl" mode="aspectFill"></image>
								</view>
							</view>
						</view>
						<view v-else-if="afterServiceRecord.operType === 2">
							<view class="margin-top-xs">
								<text>师傅反馈结果：</text>
								<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 2">重新上门</text>
							</view>
							<view v-if="afterServiceRecord.workerFeedbackResult !== 2">
								<text>师傅反馈：</text>
								<text v-if="afterServiceRecord.workerFeedbackReasonType === 1">客户原因</text>
								<text v-else-if="afterServiceRecord.workerFeedbackReasonType === 2">师傅原因</text>
								<text v-else>其他</text>
								<text
									v-if="afterServiceRecord.workerFeedbackReason">{{"，" + afterServiceRecord.workerFeedbackReason}}</text>
							</view>
							<view class="grid col-3 grid-square flex-sub margin-top-sm">
								<view class="bg-img" v-for="(imgObj, imgIndex) in afterServiceRecord.imgsList"
									:key="imgIndex" v-if="imgObj.imgUploadBy === 2">
									<image :src="imgObj.imgUrl" @tap="viewImage($event, [imgObj.imgUrl])"
										:data-url="imgObj.imgUrl" mode="aspectFill"></image>
								</view>
							</view>
						</view>
					</view>
					<view v-if="afterServiceRecord.customerFinalCheck != null" class="padding-tb-sm solid-top">
						<view class='cu-tag bg-main-color radius light'>客户最终确认</view>
						<view class="margin-top-xs">{{afterServiceRecord.customerFinalCheck === 1 ? '同意' : '不同意'}}
						</view>
						<view class="text-red" v-if="afterServiceRecord.customerFinalCheck === 0">订单交由平台协商处理</view>
						<view v-else-if="afterServiceRecord.customerFinalCheck === 1">
							<view v-if="afterServiceRecord.originalRefund > 0">
								<view>
									<text>本单退款，系统已发起按客户支付的帐户原路退回</text>
									<text class="text-red">{{afterServiceRecord.originalRefund}}</text>
									<text>元，银行按工作日退款，节假日顺延到帐。遇客户问询，请其耐心等待，到账时会在客户端”客户最终确认“处有到账时间。</text>
								</view>
								<view>退款支付到账：{{afterServiceRecord.refundApplyTime}}</view>
							</view>
							<view v-else-if="afterServiceRecord.originalRefund == 0 && servDetail.payStatus == 0">
								<text>本单未支付，实际退回0.00元</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 订单编码和时间 -->
		<view class="bg-white margin-top-sm padding margin-lr-sm margin-bottom-with-bar">
			<view v-if="servDetail.orderDetailCode != null">订单编码：{{servDetail.orderDetailCode}}</view>
			<view v-else>订单编码：{{servDetail.orderMasterCode}}</view>
			<view class="margin-top-xs">订单时间：{{servDetail.createTime}}</view>
		</view>
		<!-- 底部操作栏 -->
		<view class="cu-bar bg-white tabbar border fixed-bottom-bar" v-if="servDetail.orderDetailId != null && servDetail.orderStatus === 2">
			<!-- <view class="action" data-popup="orderManage" @click="togglePopup">
				<view class="cuIcon-list"></view> 订单管理
			</view>
			<view class="action" data-modal="sendUrgentMsgModal" @click="showModal">
				<view class="cuIcon-mail">
					<view class="cu-tag badge" v-if="servDetail.talkMsgNum > 0">{{servDetail.talkMsgNum}}</view>
				</view>
				发送急报
			</view> -->
			<view class="action" data-popup="orderManage">
			</view>
			<view class="action" data-modal="sendUrgentMsgModal">
			</view>
			<view v-if="servDetail.orderStatus === 2" class="bg-main-color submit" @click="workBegin">立即上门</view>
		</view>
		<uni-popup ref="orderManage" type="bottom" @change="changePopupState">
			<view class="bg-white text-center">
				<view v-for="(menu,index) in orderManageMenu" class="padding solid-bottom" :data-action="menu.action" @click="clickOrderManageMenu">
					{{menu.name}}
				</view>
			</view>
			<!-- 底部占位 -->
			<view class="cu-bar bg-white fixed-bottom-bar"></view>
		</uni-popup>
		<!-- 模态框 -->
		<urgent-msg :show="sendUrgentMsgModal" @hideModal="hideModal"></urgent-msg>
	</view>
</template>

<script>
	import productPicked from '@/components/goods-card/product-picked.vue';
	import urgentMsg from '@/pages/order-manage/modal/urgent-msg.vue';
	
	export default {
		components: {
			productPicked,
			urgentMsg
		},
		data() {
			return {
				value: ['0'],
				order: {},
				servDetail: {},
				finishRecord4Show: [],
				servingColumnHeaders: ['购买型号', '购买量', '待服务'],
				servedColumnHeaders: ['购买型号', '购买量', '已服务'],
				servingValFields: ['standardName', 'standardNum', 'waitServerNum'],
				servedValFields: ['standardName', 'standardNum', 'serverNum'],
				ifShowPageMeta: false,
				orderManageMenu: [{
					name: '申请配件',
					action: 'applyFittings'
				}, {
					name: '申请附加费',
					action: ''
				}, {
					name: '拍照回单',
					action: ''
				}, {
					name: '指派/撤回订单',
					action: ''
				}, {
					name: '申请退单',
					action: 'applyCancelOrder'
				}],
				sendUrgentMsgModal: false,
				overtimeRecords: null
			}
		},
		onLoad(options) {
			if (options && options.order) {
				this.order = JSON.parse(decodeURIComponent(options.order));
			}
			this.loadData();
		},
		methods: {
			async loadData() {
				let orderId = null;
				let funName = null;
				if (this.order.orderDetailId == null) {
					// 展示主单信息
					orderId = this.order.orderMasterId;
					funName = "getOrderMasterDetail";
				} else {
					// 展示子单信息
					orderId = this.order.orderDetailId;
					funName = "getOrderDetail";
				}
				let servDetailRes = await this.$request[funName]({
					id: orderId
				});
				this.servDetail = servDetailRes.data;
			},
			changePopupState(e) {
				this.ifShowPageMeta = e.show;
			},
			togglePopup(e) {
				if (this.ifShowPageMeta) {
					this.$refs[e.currentTarget.dataset.popup].close();
				} else {
					this.$refs[e.currentTarget.dataset.popup].open();
				}
			},
			clickOrderManageMenu(e) {
				this[e.currentTarget.dataset.action]();
			},
			applyFittings() {
				console.log("申请配件")
			},
			applyCancelOrder() {
				let params = {
					orderInfo: this.servDetail.mainServOrder
				}
				console.log(params)
				uni.navigateTo({
					url: '/pages/order-manage/cancel-order?params=' + encodeURIComponent(JSON.stringify(params))
				})
			},
			async workBegin() {
				let curDate = new Date();
				let formatCurDate = curDate.getFullYear() + '-' + (curDate.getMonth() + 1) + '-' + curDate.getDate()
					+ ' ' + curDate.getHours() + ':' + curDate.getMinutes() + ':' + curDate.getSeconds();
				let params = {
					id: this.servDetail.orderDetailId,
					orderStatus: 3,
					workBeginTime: formatCurDate
				}
				let res = await this.$request.updateDetailOrder(params);
				if (res && res.code === 0) {
					this.loadData(this.servDetail.orderDetailId);
					uni.showToast({
						icon: 'success'
					})
				}
			},
			showModal(e) {
				this[e.currentTarget.dataset.modal] = true;
			},
			hideModal(e) {
				this[e.currentTarget.dataset.modal] = false;
			},
			viewImage(e, imgList) {
				uni.previewImage({
					urls: imgList,
					current: e.currentTarget.dataset.url
				});
			},
			async makeCustomerPhoneCall(order) {
				uni.makePhoneCall({
					phoneNumber: order.customerPhone
				})
				if (order.orderDetailId == null) {
					let res = await this.$request.callCustomer({
						id: order.orderMasterId,
						isCall: '02'
					});
				} else {
					this.$request.callDetailCustomer({
						id: order.orderDetailId,
						isCall: '02'
					});
				}
				this.loadData();
			},
			makePhoneCall(phoneNum) {
				uni.makePhoneCall({
					phoneNumber: phoneNum
				})
			},
			async rejectDetailOrder(order) {
				let res = await this.$request.rejectDetailOrder({
					id: order.orderDetailId
				});
				if (res && res.code === 0) {
					this.loadData();
					uni.showToast({
						icon: 'none',
						title: '操作成功',
						duration: 1000
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '操作失败'
					})
				}
			},
		}
	}
</script>

<style scoped>
	.bar-first-action {
		margin-left: unset !important;
		font-size: 30rpx !important;
	}
</style>
