<template>
	<page-meta :page-style="'overflow:'+(ifShowPageMeta?'hidden':'visible')"></page-meta>
	<view style="overflow: hidden;">
		<!-- 顶部操作条 -->
		<cu-custom :bgColor="'bg-main-color'" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">{{order.orderType === 1 ? '商品订单详情' : '服务订单详情'}}</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" :key="index">
							<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 === 3">
					{{order.orderType === 1 ? '待收货' : '服务中'}}
				</view>
				<view class='cu-tag bg-purple radius light margin-right-sm' v-if="servDetail.orderStatus === 2">
					{{order.orderType === 1 ? '待发货' : '待服务'}}
				</view>
				<view class='cu-tag bg-grey radius light margin-right-sm' v-if="servDetail.orderStatus === 6">已取消</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.provinceName + servDetail.cityName + servDetail.countryName + servDetail.streetName + servDetail.address}}</text>
				<text class="margin-left-sm text-xl text-main-color" @click="showAddress2Choose"><text class="cuIcon-edit"></text></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}}</text>
				<text class="margin-left-sm text-xl text-main-color" @click="makePhoneCall(servDetail.customerPhone)"><text class="cuIcon-phone"></text></text>
			</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"><text class="labels">派单公司：</text>{{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.orderStatus === 3">
				<text class="cuIcon-time text-main-color margin-right-xs"></text>
				<text>上门时间：{{servDetail.workBeginTime}}</text>
			</view> -->
			<view class="margin-top-sm">
				<text class="cuIcon-moneybag text-main-color margin-right-xs"></text>
				<text>订单金额：</text>
				<text class="text-price">{{servDetail.payMoney}}</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="grid col-3 grid-square flex-sub margin-top-sm" v-if="servDetail.orderImages">
				<view class="bg-img" v-for="(imgUrl, index) in servDetail.orderImages.split(',')" :key="index">
					<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill">
					</image>
				</view>
			</view>
			<!-- <view class="margin-top-xs text-sm text-gray"
				v-for="(item, index) in servDetail.mainServOrder.gratuityRecord">
				追加费用：<text class="text-price">{{item.price}}</text>[{{item.type}}]
			</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">
				<simple-product-picked :product="servDetail" :pickedList="servDetail.standardList"
					:columnTitleArr="servingColumnHeaders" :valFieldArr="servingValFields"></simple-product-picked>
			</view>
		</view>
		
		<view class="bg-white margin-lr-sm padding-lr margin-top-sm padding" v-if="servDetail.serviceShop">
			<template v-if="servDetail.serviceCancelled != 1">
				<view class="text-black text-bold flex justify-between">
					<text>安装/服务/施工门店</text>
					<!-- <text @click="goChooseShop">更多></text> -->
				</view>
				<view class="flex-sub flex margin-top-sm" @click="openShopLocation(servDetail.serviceShop)">
					<view style="width: 150rpx;height: 150rpx;margin-right:10px;">
						<image style="width: 100%;height: 100%;" :src="servDetail.serviceShop.imageUrl" mode="aspectFill"></image>
					</view>
					<view class="flex-sub">
						<view class="text-bold" style="text-overflow: ellipsis;overflow: hidden;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;">
						现已选中: {{servDetail.serviceShop.shopName}}
						</view>
						<view class="padding-tb-xs" style="position: relative;">
							<view class="margin-lr-sm" style="display: inline-block;" v-if="servDetail.serviceShop.distance">
								<view class="cu-tag bg-red" style="padding: 0 2px;height: auto;">距离您</view>
								<text class="text-gray" style="vertical-align: middle;">{{servDetail.serviceShop.distance}}</text>
							</view>
							<image src="/static/navigation.png" style="width: 50rpx;height: 50rpx;display: inline-block;position: absolute;top: 5px;right: -10px;"></image>
						</view>
						<view>{{servDetail.serviceShop.provinceName + servDetail.serviceShop.cityName + servDetail.serviceShop.countryName + servDetail.serviceShop.streetName + servDetail.serviceShop.address}}</view>
						<view class="flex justify-between align-center margin-bottom-xs padding-top">
							<view>
								<text class="text-bold text-lg margin-lr-xs">店长：{{servDetail.serviceShop.phone}}</text>
							</view>
							<button class="cu-btn line-main-color" @click.stop="makePhoneCall(servDetail.serviceShop.phone)">拨打</button>
						</view>
					</view>
				</view>
			</template>
		</view>
		<view class="bg-white margin-lr-sm padding-lr margin-top-sm padding" v-else-if="servDetail.shop">
			<view class="text-black text-bold flex justify-between">
				<text>安装/服务/施工门店</text>
				<!-- <text @click="goChooseShop">更多></text> -->
			</view>
			<view class="flex-sub flex margin-top-sm" @click="openShopLocation(servDetail.shop)">
				<view style="width: 150rpx;height: 150rpx;margin-right:10px;">
					<image style="width: 100%;height: 100%;" :src="servDetail.shop.imageUrl" mode="aspectFill"></image>
				</view>
				<view class="flex-sub">
					<view class="text-bold" style="text-overflow: ellipsis;overflow: hidden;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;">
					现已选中: {{servDetail.shop.shopName}}
					</view>
					<view class="padding-tb-xs" style="position: relative;">
						<view class="margin-lr-sm" style="display: inline-block;" v-if="servDetail.shop.distance">
							<view class="cu-tag bg-red" style="padding: 0 2px;height: auto;">距离您</view>
							<text class="text-gray" style="vertical-align: middle;">{{servDetail.shop.distance}}</text>
						</view>
						<image src="/static/navigation.png" style="width: 50rpx;height: 50rpx;display: inline-block;position: absolute;top: 5px;right: -10px;"></image>
					</view>
					<view>{{servDetail.shop.provinceName + servDetail.shop.cityName + servDetail.shop.countryName + servDetail.shop.streetName + servDetail.shop.address}}</view>
					<view class="flex justify-between align-center margin-bottom-xs padding-top">
						<view>
							<text class="text-bold text-lg margin-lr-xs">店长：{{servDetail.shop.phone}}</text>
						</view>
						<button class="cu-btn line-main-color" @click.stop="makePhoneCall(servDetail.shop.phone)">拨打</button>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 子单完成记录 -->
		<view class="bg-white margin-lr-sm padding-lr padding-bottom margin-top-sm"
			v-for="(item, index) in servDetail.orderStandardDetailList" :key="index">
			<view class="cu-bar solid-bottom">
				<view class="action bar-first-action">
					<text class="cuIcon-titles text-main-color"></text> {{ order.orderType === 1 ? '发货记录' : '服务记录'}}
				</view>
				<view class='cu-tag bg-gray radius light' v-if="item.orderStatus == 6">已取消</view>
				<view class='cu-tag bg-purple radius light margin-right-sm'>编码:{{item.orderDetailCode}}</view>
			</view>
			<view class="margin-top-sm">
				<view>{{order.orderType == 1 ? '商家' : '师傅'}}：{{item.workerName}}</view>
				<view class="margin-top-sm">联系方式：{{item.workerPhone}}<text class="margin-left-sm text-xl text-main-color" @click="makePhoneCall(item.workerPhone)"><text class="cuIcon-phone"></text></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>
				<template v-if="order.orderType === 0">
					<view class="margin-top-sm" v-if="servDetail.orderStatus >= 3">上门时间：{{item.workBeginTime}}</view>
					<view class="margin-top-sm" v-if="servDetail.orderStatus >= 4">完成时间：{{item.workFinishTime}}</view>
				</template>
				<template v-else>
					<view class="margin-top-sm" v-if="servDetail.orderStatus >= 3">发货时间：{{item.workBeginTime}}</view>
				</template>
				<simple-product-picked :pickedList="item.orderStandardList" :columnTitleArr="servedColumnHeaders"
					:valFieldArr="servedValFields"></simple-product-picked>
			</view>
			<view v-if="item.financialChangeRecord && item.financialChangeRecord.length > 0" class="bg-white" v-for="addRecord in item.financialChangeRecord" :key="addRecord.id">
				<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 add-price">
					<view>
						<text>加价金额：</text>
						<text>{{addRecord.changeMoney + (addRecord.attachmentMoney || 0)}}</text>
					</view>
					<!-- <view v-if="addRecord.reason && addRecord.reason.indexOf('含') > -1">
						<text>{{addRecord.reason.split('含')[1]}}：</text>
						<text>{{addRecord.changeMoney}}</text>
					</view> -->
					<view>
						<text>加价备注：</text>
						<text>{{addRecord.remark || ''}}</text>
					</view>
					<!-- <view v-if="addRecord.urls">
						<view class="grid col-3 grid-square flex-sub margin-top-sm">
							<view class="bg-img" v-for="imgUrl in addRecord.urls.split(',')" :key="imgUrl">
								<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill">
								</image>
							</view>
						</view>
					</view> -->
					<view class="text-main-color" @click="changeOrderPrice(item.orderDetailId)" v-if="addRecord.payStatus === 0">清空加价</view>
				</view>
				
			</view>
			
			<view class="bg-white margin-top-sm" v-if="item.deliveryType">
				<view v-if="item.deliveryType">
					发货方式：
					<text v-if="item.deliveryType == 1">发快递/物流</text>
					<text v-if="item.deliveryType == 2">送货上门</text>
					<text v-if="item.deliveryType == 3">客户自提</text>
				</view>
				<view class="margin-top-xs" v-if="item.deliveryImages">
					<view class="grid col-3 grid-square flex-sub">
						<view class="bg-img" v-for="imgUrl in item.deliveryImages.split(',')" :key="imgUrl">
							<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill">
							</image>
						</view>
					</view>
				</view>
				<view class="margin-top-xs" v-if="item.deliveryRemark"><text>发货备注：{{item.deliveryRemark}}</text></view>
				<view class="margin-top-xs" v-if="item.trackingNumber">
					<text>快递单号：{{item.trackingNumber}}</text>
					<text class="text-main-color margin-left-sm" @click="getDeliveryFlow(item.trackingNumber)">查询</text>
				</view>
			</view>
			
			<!-- 交货记录 -->
			<view class="bg-white margin-top-sm" v-if="item.handoverRemark || item.handoverImages">
				<view>交货记录</view>
				<view class="margin-top-xs" v-if="item.handoverImages">
					<view class="grid col-3 grid-square flex-sub">
						<view class="bg-img" v-for="imgUrl in item.handoverImages.split(',')" :key="imgUrl">
							<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill">
							</image>
						</view>
					</view>
				</view>
				<view class="margin-top-xs" v-if="item.deliveryRemark"><text>交货备注：{{item.handoverRemark}}</text></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" :key="afterServiceRecordIndex">
					<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" v-if="order.orderType === 1">等待商家操作，24小时未操作将自动同意！</view>
							<view class="text-gray text-sm margin-bottom-xs" v-else>待师傅操作反馈，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 v-if="order.orderType === 1">
								<text>售后类型：</text>
								<text v-if="afterServiceRecord.afterServiceType === 1">未收到货，我要退单退款！</text>
								<text v-else-if="afterServiceRecord.afterServiceType === 2">未收到货（发货在途），我要退款！</text>
								<text v-else-if="afterServiceRecord.afterServiceType === 3">已收到货，我要退款退货！</text>
							</view>
							<view>
								<text>退款原因：</text>
								<template v-if="order.orderType === 1">
									<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>
									<text v-else-if="afterServiceRecord.customerReasonType === 10">未按承诺时间发货</text>
									<text v-else-if="afterServiceRecord.customerReasonType === 11">未见快递/物流有信息</text>
									<text v-else-if="afterServiceRecord.customerReasonType === 12">其它原因</text>
								</template>
								<template v-else>
									<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>
								</template>
							</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 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 v-if="order.orderType === 1">
								<text>售后类型：</text>
								<text v-if="afterServiceRecord.afterServiceType === 1">未收到货，我要退单退款！</text>
								<text v-else-if="afterServiceRecord.afterServiceType === 2">未收到货（发货在途），我要退款！</text>
								<text v-else-if="afterServiceRecord.afterServiceType === 3">已收到货，我要退款退货！</text>
							</view>
							<view>
								<text>退款原因：</text>
								<template v-if="order.orderType === 1">
									<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>
									<text v-else-if="afterServiceRecord.customerReasonType === 10">未按承诺时间发货</text>
									<text v-else-if="afterServiceRecord.customerReasonType === 11">未见快递/物流有信息</text>
									<text v-else-if="afterServiceRecord.customerReasonType === 12">其它原因</text>
								</template>
								<template v-else>
									<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>
								</template>
							</view>
							<view>
								<text>具体原因：</text>
								<text v-if="afterServiceRecord.customerReason">{{afterServiceRecord.customerReason}}</text>
							</view>
							<view>
								<text>完成操作：点击“处理完成”提交由客服回访！</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 class="flex justify-end align-end margin-tb-sm" v-if="item.afterPlatformServiceStatus === 0 || item.afterPlatformServiceStatus == 1">
							<button class="cu-btn sm bg-yellow margin-left" v-show="afterServiceRecord.customerFinalCheck !== 1"
								@click="cancelAfterService(afterServiceRecord)">撤销</button>
						</view>
					</view>
					<view v-if="afterServiceRecord.updateBy != 1 && afterServiceRecord.workerFeedbackResult !== null" class="padding-tb-sm solid-top">
						<view class='cu-tag bg-main-color radius light'>{{order.orderType == 1 ? '商家' : '师傅'}}反馈</view>
						<view v-if="afterServiceRecord.operType === 1">
							<view class="margin-top-xs">
								<text>{{order.orderType == 1 ? '商家' : '师傅'}}反馈结果：</text>
								<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3">{{order.orderType == 1 ? '重发/补发商品' : '上门重做/补做'}}</text>
							</view>
							<view v-if="(afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && afterServiceRecord.workerResendPlan">
								<text v-if="afterServiceRecord.workerResendPlan == 1">重发/补发，您无需退货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 2">重发/补发前，您需先退货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 3">请您退回商品，给你换货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 4">请退回商品，为您售后换货</text>
							</view>
							<view v-if="afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3">{{order.orderType == 1 ? '客户同意则本次退款金额为0元' : '同意重做/补做，退款金额0'}}</view>
							<!-- <view v-if="afterServiceRecord.workerFeedbackResult === 1">
								<text>同意退款金额：</text>
								<text>{{afterServiceRecord.agreedRefund ? afterServiceRecord.agreedRefund : afterServiceRecord.refund}}</text>
							</view> -->
							<template v-if="afterServiceRecord.workerFeedbackResult === 1">
								<view>
									<text>同意退款金额：</text>
									<text>{{afterServiceRecord.agreedRefund ? afterServiceRecord.agreedRefund : afterServiceRecord.refund}}</text>
								</view>
								<view v-if="afterServiceRecord.workerReceiveStatus">
									<text>收货状态：</text>
									<text v-if="afterServiceRecord.workerReceiveStatus == 1">未发货</text>
									<text v-else-if="afterServiceRecord.workerReceiveStatus == 2">已发货在途</text>
									<text v-else-if="afterServiceRecord.workerReceiveStatus == 3">已收货</text>
									<text v-else-if="afterServiceRecord.workerReceiveStatus == 4">售后保障期</text>
								</view>
								<view v-if="afterServiceRecord.workerAgreeType">
									<text>同意选项：</text>
									<text v-if="afterServiceRecord.workerAgreeType == 1">同意即时退单退款</text>
									<text v-else-if="afterServiceRecord.workerAgreeType == 2">同意货物拦截后退单退款</text>
									<text v-else-if="afterServiceRecord.workerAgreeType == 3">同意快递返回货物后退单退款</text>
									<text v-else-if="afterServiceRecord.workerAgreeType == 4">同意您退回货物后退单退款</text>
								</view>
							</template>
							<view v-if="afterServiceRecord.workerFeedbackResult !== 2 && afterServiceRecord.workerFeedbackResult !== 3">
								<text>{{order.orderType == 1 ? '商家' : '师傅'}}反馈：</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" v-if="afterServiceRecord.workerFeedbackImages">
								<view class="bg-img" v-for="(imgUrl, imgIndex) in afterServiceRecord.workerFeedbackImages.split(',')" :key="imgIndex">
									<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
								</view>
							</view>
						</view>
						<view v-else-if="afterServiceRecord.operType === 2">
							<view class="margin-top-xs">
								<text>{{order.orderType == 1 ? '商家' : '师傅'}}反馈结果：</text>
								<text v-if="afterServiceRecord.workerFeedbackResult === 0">拒绝</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 1">同意</text>
								<text v-else-if="afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3">{{order.orderType == 1 ? '重发/补发商品' : '上门重做/补做'}}</text>
							</view>
							<view v-if="(afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && afterServiceRecord.workerResendPlan">
								<text v-if="afterServiceRecord.workerResendPlan == 1">重发/补发，您无需退货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 2">重发/补发前，您需先退货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 3">请您退回商品，给你换货</text>
								<text v-if="afterServiceRecord.workerResendPlan == 4">请退回商品，为您售后换货</text>
							</view>
							<view  style="padding-left: 196upx;" v-if="afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3">{{order.orderType == 1 ? '客户同意则本次退款金额为0元' : '同意重做/补做，退款金额0'}}</view>
							<view v-if="afterServiceRecord.workerFeedbackResult !== 2 && afterServiceRecord.workerFeedbackResult !== 3">
								<text>{{order.orderType == 1 ? '商家' : '师傅'}}反馈：</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" v-if="afterServiceRecord.workerFeedbackImages">
								<view class="bg-img" v-for="(imgUrl, imgIndex) in afterServiceRecord.workerFeedbackImages.split(',')" :key="imgIndex">
									<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
								</view>
							</view>
						</view>
						<view class="text-right margin-top-sm margin-bottom-sm">
							<view class='cu-tag bg-yellow radius light' v-if="afterServiceRecord.customerAgreeRedo === 1">
								<text v-if="(afterServiceRecord.workerFeedbackResult === 1 && (afterServiceRecord.workerAgreeType == 2 || afterServiceRecord.workerAgreeType == 3 || afterServiceRecord.workerAgreeType == 4)) || ((afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && (afterServiceRecord.workerResendPlan === 2 || afterServiceRecord.workerResendPlan === 3 || afterServiceRecord.workerResendPlan === 4))">等待商家收货/验货</text>
								<text v-else>已同意方案</text>
							</view>
							<template v-if="afterServiceRecord.returnStatus > 3 && order.orderType == 1">
								<view class='cu-tag bg-yellow radius light' v-if="afterServiceRecord.returnStatus == 3">等待商家收货</view>
								<view class='cu-tag bg-yellow radius light' v-if="afterServiceRecord.returnStatus == 4">商家已收货</view>
							</template>
						</view>
						<template v-if="afterServiceRecord.returnType">
							<view class="margin-top-xs">
								<text>客户已退货：</text>
							</view>
							<view class="flex justify-between align-center">
								<text>发货方式：{{afterServiceRecord.returnType == 1 ? '发快递/物流': (afterServiceRecord.returnType == 2 ? '送货上门' : '客户自提')}}</text>
								<text v-if="afterServiceRecord.returnType == 1" @click="copyData(afterServiceRecord.returnTrackingNumber)">{{afterServiceRecord.returnTrackingNumber}}<text class="cuIcon-copy"></text></text>
							</view>
							<view class="grid col-3 grid-square flex-sub margin-top-sm" v-if="afterServiceRecord.returnImages">
								<view class="bg-img" v-for="(imgUrl, imgIndex) in afterServiceRecord.returnImages.split(',')" :key="imgIndex">
									<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
								</view>
							</view>
							<view class="margin-bottom-xs" v-if="afterServiceRecord.returnRemark">
								<text>发货备注：{{afterServiceRecord.returnRemark}}</text>
							</view>
						</template>
						<template v-if="afterServiceRecord.workerFeedbackResult === 3">
							<template v-if="order.orderType == 1">
								<template v-if="afterServiceRecord.workerResendType">
									<view class="margin-top-xs">
										<text>商家重发/补发提交：</text>
									</view>
									<view class="flex justify-between align-center">
										<text>发货方式：{{afterServiceRecord.workerResendType == 1 ? '发快递/物流': (afterServiceRecord.workerResendType == 2 ? '送货上门' : '客户自提')}}</text>
										<text v-if="afterServiceRecord.workerResendType == 1" @click="copyData(afterServiceRecord.workerResendTrackingNumber)">{{afterServiceRecord.workerResendTrackingNumber}}<text class="cuIcon-copy"></text><text class="text-main-color margin-left-sm" @click.stop="getDeliveryFlow(afterServiceRecord.workerResendTrackingNumber)">查询</text></text>
									</view>
									<view class="grid col-3 grid-square flex-sub margin-top-sm" v-if="afterServiceRecord.workerResendImages">
										<view class="bg-img" v-for="(imgUrl, imgIndex) in afterServiceRecord.workerResendImages.split(',')" :key="imgIndex">
											<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
										</view>
									</view>
									<view class="margin-bottom-xs" v-if="afterServiceRecord.workerResendRemark">
										<text>发货备注：{{afterServiceRecord.workerResendRemark}}</text>
									</view>
									<view style="border-top: 1px solid gainsboro;padding-top: 10upx;" v-if="afterServiceRecord.customerFinalCheck == null && afterServiceRecord.workerResendType">
										<view v-if="afterServiceRecord.workerResendType == 1">
											<text class="text-gray" style="font-size: 20upx;">您需验收或审核，4天内未操作将自动完成本次售后！</text>
											<view class="flex align-center margin-top-sm">
												<text>操作时限：</text>
												<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
													:day="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.workerResendTime, 4)).day" 
													:hour="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.workerResendTime, 4)).hour" 
													:minute="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.workerResendTime, 4)).min" 
													:second="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.workerResendTime, 4)).seconds">
												</uni-countdown>
											</view>
										</view>
										<view v-else>
											<text class="text-gray" style="font-size: 20upx;">您需验收或审核，24小时未操作将自动完成本售后！</text>
											<view class="flex align-center margin-top-sm">
												<text>操作时限：</text>
												<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
													:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendTime, 24)).day" 
													:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendTime, 24)).hour" 
													:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendTime, 24)).min" 
													:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendTime, 24)).seconds">
												</uni-countdown>
											</view>
										</view>
									</view>
								</template>
							</template>
							<template v-else>
								<view class="margin-top-xs">
									<text>师傅重做/补做提交：</text>
								</view>
								<view class="grid col-3 grid-square flex-sub margin-top-sm" v-if="afterServiceRecord.redoCompleteImages">
									<view class="bg-img" v-for="(imgUrl, imgIndex) in afterServiceRecord.redoCompleteImages.split(',')" :key="imgIndex">
										<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
									</view>
								</view>
								<view class="margin-bottom-xs">
									<text>{{afterServiceRecord.redoCompleteRemark}}</text>
								</view>
							</template>
							
						</template>
						<!-- <view v-if="afterServiceRecord.workerFeedbackResult === 3 && order.orderType === 1">
							<text class="text-gray" style="font-size: 20upx;">您需验收或审核，4天内未操作将自动完成本次售后！</text>
							<view class="flex align-center margin-top-sm">
								<text>工单时限：</text>
								<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
									:day="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).day" 
									:hour="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).hour" 
									:minute="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).min" 
									:second="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).seconds">
								</uni-countdown>
							</view>
						</view> -->
						<view style="border-top: 1px solid gainsboro;padding-top: 10upx;" v-if="afterServiceRecord.customerFinalCheck == null && (afterServiceRecord.workerFeedbackResult === 0 || afterServiceRecord.workerFeedbackResult === 1 || afterServiceRecord.workerFeedbackResult === 3 || (afterServiceRecord.workerFeedbackResult === 2 && (afterServiceRecord.workerResendPlan === 2 || afterServiceRecord.workerResendPlan === 3)))">
							<template v-if="afterServiceRecord.workerFeedbackResult === 1 && afterServiceRecord.customerOperationTime">
								<text class="text-gray" style="font-size: 20upx;">商家收货验货后退款，未操作的6天内自动完成！</text>
								<view class="flex align-center margin-top-sm">
									<text>工单时限：</text>
									<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
										:day="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).day" 
										:hour="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).hour" 
										:minute="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).min" 
										:second="$dateUtil.countDownDiff($dateUtil.addDays(afterServiceRecord.customerOperationTime, 6)).seconds">
									</uni-countdown>
								</view>
							</template>
							<template v-if="afterServiceRecord.workerFeedbackResult === 2 && afterServiceRecord.workerResendPlanTime">
								<text class="text-gray" style="font-size: 20upx;">请按下方按键操作，36小时未操作将自动取消本售后！</text>
								<view class="flex align-center margin-top-sm">
									<text>工单时限：</text>
									<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
										:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendPlanTime, 36)).day" 
										:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendPlanTime, 36)).hour" 
										:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendPlanTime, 36)).min" 
										:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.workerResendPlanTime, 36)).seconds">
									</uni-countdown>
								</view>
							</template>
							<template v-else-if="afterServiceRecord.redoCompleteTime">
								<text class="text-gray" style="font-size: 20upx;">{{afterServiceRecord.workerFeedbackResult === 3 ? '您需验收或审核，36小时未操作自动完成' : '请按下方按键操作，36小时未操作将自动取消本售后！'}}</text>
								<view class="flex align-center margin-top-sm">
									<text>工单时限：</text>
									<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
										:day="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.redoCompleteTime, 36)).day" 
										:hour="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.redoCompleteTime, 36)).hour" 
										:minute="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.redoCompleteTime, 36)).min" 
										:second="$dateUtil.countDownDiff($dateUtil.addHours(afterServiceRecord.redoCompleteTime, 36)).seconds">
									</uni-countdown>
								</view>
							</template>
						</view>
						<view class="flex justify-end align-end margin-tb-sm" v-if="order.orderType === 1">
							<template v-if="afterServiceRecord.customerFinalCheck == null && afterServiceRecord.returnStatus <= 3">
								<template v-if="afterServiceRecord.customerFinalCheck != 1">
									<template v-if="afterServiceRecord.returnStatus < 3">
										<button v-if="(afterServiceRecord.workerResendPlan != null && afterServiceRecord.workerResendPlan != 1) || (afterServiceRecord.workerAgreeType == 2 || afterServiceRecord.workerAgreeType == 3 || afterServiceRecord.workerAgreeType == 4)" class="cu-btn sm bg-yellow margin-right-sm" @click="showDeliverGoods = true;currentChooseAfterService = afterServiceRecord;">去退货</button>
									</template>
									<template v-if="(afterServiceRecord.workerFeedbackResult === 2 || (afterServiceRecord.workerFeedbackResult === 1 && afterServiceRecord.workerAgreeType !== 1))">
										<button class="cu-btn sm bg-yellow margin-right-sm" v-if="(afterServiceRecord.customerAgreeRedo === 0 || afterServiceRecord.customerAgreeRedo === null )" @click="afterServiceAgreeRedo(afterServiceRecord.id, 1)">{{(afterServiceRecord.workerFeedbackResult === 1 && (afterServiceRecord.workerAgreeType == 2 || afterServiceRecord.workerAgreeType == 3 || afterServiceRecord.workerAgreeType == 4)) || ((afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && (afterServiceRecord.workerResendPlan != null && afterServiceRecord.workerResendPlan != 1))  ? '未收货，货在途' : '同意方案'}}</button>
										<button class="cu-btn sm bg-yellow margin-right-sm" v-if="afterServiceRecord.customerFinalCheck == null"
											@click="tapToShowRejectPlan(afterServiceRecord.id)">不同意</button>
									</template>
									<template v-else-if="afterServiceRecord.workerFeedbackResult !== 2 || (afterServiceRecord.workerFeedbackResult === 1 && afterServiceRecord.workerAgreeType === 1)">
										<button class="cu-btn sm bg-yellow margin-right-sm"  @click="showNotice(item, afterServiceRecord)">同意</button>
										<button class="cu-btn sm bg-yellow margin-right-sm" v-if="afterServiceRecord.customerFinalCheck == null"
											@click="tapToShowRejectPlan(afterServiceRecord.id)">不同意</button>
									</template>
								</template>
								
							</template>
							
							<template v-if="afterServiceRecord.returnStatus == 4">
								<button class="cu-btn sm bg-yellow margin-right-sm"  @click="finishAfterService(afterServiceRecord.id)">货已收到，结单</button>
							</template>
							<template v-else-if="(afterServiceRecord.customerFinalCheck == 0) && (item.afterPlatformServiceStatus === 0 || item.afterPlatformServiceStatus == 1)">	
								<template v-if="afterServiceRecord.customerFinalCheck === 0">
								<button class="cu-btn sm bg-yellow margin-right-sm" @click="showNotice(item, afterServiceRecord)" v-if="(afterServiceRecord.workerFeedbackResult === 3 || afterServiceRecord.workerFeedbackResult === 0) && afterServiceRecord.workerResendPlan !== 1 && afterServiceRecord.returnShipTime">同意</button>
									<button v-if="(afterServiceRecord.workerResendPlan != null && afterServiceRecord.workerResendPlan != 1) || (afterServiceRecord.workerAgreeType == 2 || afterServiceRecord.workerAgreeType == 3 || afterServiceRecord.workerAgreeType == 4)" class="cu-btn sm bg-yellow margin-right-sm" @click="showDeliverGoods = true;currentChooseAfterService = afterServiceRecord;">去退货</button>
									<button v-else-if="afterServiceRecord.workerFeedbackResult !== 2" class="cu-btn sm bg-yellow margin-right-sm" @click="showNotice(item, afterServiceRecord)">同意</button>
									<template v-if="(afterServiceRecord.workerFeedbackResult === 1 && (afterServiceRecord.workerAgreeType == 2 || afterServiceRecord.workerAgreeType == 3 || afterServiceRecord.workerAgreeType == 4)) || ((afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && (afterServiceRecord.workerResendPlan != null)) && (afterServiceRecord.customerAgreeRedo === null || afterServiceRecord.customerAgreeRedo === 0)">
										<button class="cu-btn sm bg-yellow margin-right-sm" @click="afterServiceAgreeRedo(afterServiceRecord.id, 1)">{{afterServiceRecord.workerResendPlan != 1 ? '未收货，货在途' : '同意方案'}}</button>
									</template>
									<button class="cu-btn sm bg-yellow margin-right-sm text-white">已申请平台介入</button>
								</template>
							</template>
						</view>
						
						<view class="flex justify-end align-end margin-tb-sm" v-else>
							<template v-if="afterServiceRecord.customerFinalCheck == null">
								<template v-if="afterServiceRecord.customerFinalCheck != 1">
									<template v-if="afterServiceRecord.workerFeedbackResult === 2">
										<button class="cu-btn sm bg-yellow margin-right-sm" @click="afterServiceAgreeRedo(afterServiceRecord.id, 1)" v-if="afterServiceRecord.customerAgreeRedo === 0 || afterServiceRecord.customerAgreeRedo === null">同意方案</button>
										<button class="cu-btn sm bg-yellow margin-right-sm" v-if="afterServiceRecord.customerFinalCheck == null"
											@click="tapToShowRejectPlan(afterServiceRecord.id)">不同意</button>
									</template>
									<template v-else-if="afterServiceRecord.workerFeedbackResult !== 2">
										<button class="cu-btn sm bg-yellow margin-right-sm"  @click="showNotice(item, afterServiceRecord)">同意</button>
										<button class="cu-btn sm bg-yellow margin-right-sm" v-if="afterServiceRecord.customerFinalCheck == null"
											@click="tapToShowRejectPlan(afterServiceRecord.id)">不同意</button>
									</template>
								</template>
							</template>
							<template v-else-if="afterServiceRecord.customerFinalCheck == 0 && (item.afterPlatformServiceStatus === 0 || item.afterPlatformServiceStatus == 1)">	
								<template v-if="(afterServiceRecord.workerFeedbackResult === 2 || afterServiceRecord.workerFeedbackResult === 3) && (afterServiceRecord.customerAgreeRedo === null || afterServiceRecord.customerAgreeRedo === 0)">
									<button class="cu-btn sm bg-yellow margin-right-sm" @click="afterServiceAgreeRedo(afterServiceRecord.id, 1)">同意方案</button>
								</template>
								<button class="cu-btn sm bg-yellow margin-right-sm" @click="showNotice(item, afterServiceRecord)" v-if="afterServiceRecord.workerFeedbackResult !== 2">同意</button>
								<button class="cu-btn sm bg-yellow margin-right-sm text-white" v-if="afterServiceRecord.customerFinalCheck === 0">已申请平台介入</button>
							</template>
						</view>
					</view>
					<view v-if="afterServiceRecord.customerFinalCheck != null" class="padding-tb-sm solid-top">
						<template v-if="item.afterPlatformServiceStatus === 0 || item.afterPlatformServiceStatus == 1">
							<view class='cu-tag bg-main-color radius light'>{{afterServiceRecord.workerReceiveConfirm === 1 ? '商家确认' : '客户最终确认'}}</view>
							<view class="margin-top-xs" v-if="afterServiceRecord.workerReceiveConfirm === 1">
								<view>已收货，结单</view>
								<view>本单已退货并结束售后！</view>
							</view>
							<template v-else>
								<view class="margin-top-xs" v-if="afterServiceRecord.customerFinalCheck === 2">
									取消
									<text v-if="afterServiceRecord.isAutoProcessed == 1">（超时系统自动取消）</text>
								</view>
								<view class="margin-top-xs" v-else>
									{{afterServiceRecord.customerFinalCheck === 1 ? '同意' : '不同意'}}
									<text v-if="afterServiceRecord.isAutoProcessed == 1 && afterServiceRecord.customerFinalCheck === 1">（超时系统自动同意）</text>
								</view>
							</template>
							
							<view v-if="afterServiceRecord.customerFinalCheck === 0">
								<view class="grid col-3 grid-square flex-sub margin-top-sm" v-if="afterServiceRecord.customerDisagreeImages">
									<view class="bg-img" v-for="imgUrl in afterServiceRecord.customerDisagreeImages.split(',')" :key="imgUrl">
										<image :src="imgUrl" @tap="viewImage($event, [imgUrl])" :data-url="imgUrl" mode="aspectFill"></image>
									</view>
								</view>
								<view class="margin-bottom-xs" v-if="afterServiceRecord.customerDisagreeReason">
									<text>不同意理由：{{afterServiceRecord.customerDisagreeReason}}</text>
								</view>
								<view class="text-red" v-if="afterServiceRecord.customerFinalCheck === 0">订单交由平台协商处理</view>
							</view>
							<view v-else-if="afterServiceRecord.customerFinalCheck === 1">
								<template v-if="afterServiceRecord.workerFeedbackResult !== 0">
									<view v-if="(afterServiceRecord.agreedRefund > 0 || afterServiceRecord.originalRefund > 0) && order.refundPayStatus == 1">
										<view>
											<text>本单退款，系统已发起原路退回</text>
											<text class="text-red">{{afterServiceRecord.originalRefund || afterServiceRecord.agreedRefund}}</text>
											<text>元，有其余部分的以双方沟通操作为准（注：银行按工作日到帐，节假日顺延到账）。</text>
										</view>
										<view>支付时间：{{afterServiceRecord.refundApplyTime}}</view>
									</view>
									<view v-else-if="order.refundPayStatus == 0">
										<text v-if="afterServiceRecord.workerFeedbackResult === 3">本次售后已重新补做并验收完成（退款额为0）。</text>
										<text v-else>本单已退款<text class="text-red">{{afterServiceRecord.originalRefund || afterServiceRecord.agreedRefund || 0}}</text>元，因未实际支付，实退为0元。未退部分继续完成订单及正常支付！</text>
									</view>
								</template>
								<view v-else>
									<text>本次售后已操作完毕，售后申请已结束！</text>
								</view>
							</view>
						</template>
						<template v-else-if="item.afterPlatformServiceStatus === 2 || item.afterPlatformServiceStatus === 3">
							<view class='cu-tag bg-main-color radius light'>客户最终确认</view>
							<view class="margin-top-xs">
								{{item.afterPlatformServiceStatus === 2 ? '同意' : '取消售后'}}
								（平台操作）
							</view>
							<view v-if="afterServiceRecord.platformHandleReason">
								<text>平台意见：{{afterServiceRecord.platformHandleReason}}</text>
							</view>
							<view v-if="item.afterPlatformServiceStatus === 3">
								<text>本次售后已操作完毕，售后申请已结束!</text>
							</view>
							<template v-else>
								<view v-if="(afterServiceRecord.platformRefund || afterServiceRecord.agreedRefund) && order.refundPayStatus == 1">
									<view>
										<text>本单退款，系统已发起原路退回</text>
										<text class="text-red">{{afterServiceRecord.platformRefund || afterServiceRecord.agreedRefund}}</text>
										<text>元，有其余部分的以双方沟通操作为准（注：银行按工作日到帐，节假日顺延到账）。</text>
									</view>
									<view>支付时间：{{afterServiceRecord.refundApplyTime}}</view>
								</view>
								<view v-else-if="order.refundPayStatus == 0">
									<text>本单已退款<text class="text-red">{{afterServiceRecord.platformRefund || afterServiceRecord.agreedRefund || 0}}</text>元，因未实际支付，实退为0元。未退部分继续完成订单及正常支付！</text>
								</view>
							</template>
						</template>
					</view>
					<!-- <view v-if="afterServiceRecord.afterServiceStatus == 2">
						<view>售后已撤销</view>
						<view style="color: red;font-size: 20upx;">由于您最终未做出同意与不同意的操作，系统默认撤消此单，如您需要可另行申请！</view>
					</view> -->
				</view>
			</view>
		</view>
		<!-- 订单编码和时间 -->
		<view class="bg-white margin-top-sm padding margin-lr-sm margin-bottom-with-bar">
			<view>订单编码：{{servDetail.orderMasterCode}}</view>
			<view class="margin-top-xs">订单时间：{{servDetail.createTime}}</view>
		</view>
		<!-- 底部操作栏 -->
		<view class="cu-bar tabbar margin-bottom-xl bg-white fixed-bottom-bar">
			<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="bg-main-color submit">立即上门</view> -->
		</view>
		<uni-popup ref="orderManage" type="bottom" @change="changePopupState">
			<view class="bg-white text-center tabbar" style="z-index: 99;">
				<view v-if="servDetail.orderStatus < 2" class="padding solid-bottom" @click="decideIfCancelOrder" style="z-index: 99;">
					取消订单
				</view>
				<view v-if="servDetail.orderStatus < 3" class="padding solid-bottom" @click="applyAfterService" style="z-index: 99;">
					发起投诉
				</view>
				<view v-if="servDetail.orderStatus >= 3" class="padding solid-bottom" @click="applyAfterService" style="z-index: 99;">
					发起投诉/售后
				</view>
				<view v-if="servDetail.orderStatus >= 2 || servDetail.orderStatus < 5" class="padding solid-bottom" style="z-index: 99;"
					@click="applyForRefund">
					退单退款
				</view>
				<view v-if="[0,1,2,3].includes(servDetail.orderStatus) && servDetail.workerPhone" class="padding solid-bottom" style="z-index: 99;" @click="sendUrgeOrderModal = true">
					催单约单
				</view>
			</view>
			<view class="fixed-bottom-bar cu-bar bg-white" style="z-index: 98;"></view>
		</uni-popup>
		<!-- 模态框 -->
		<urgent-msg :show="sendUrgentMsgModal" @hideModal="hideModal"></urgent-msg>
		<urge-order :show="sendUrgeOrderModal" @hideModal="hideModal" @confirm="urgeOrderOpration"></urge-order>
		<confirm-modal ref="confirmModal" :content="'是否确定取消订单？'" @confirm="cancelOrder"></confirm-modal>
		<apply-after-service ref="applyAfterService" :data="servDetail"
			@confirmFeedback="loadData(servDetail.orderMasterId)" @cancel="blurCurOrder"></apply-after-service>
		<apply-after-service-goods ref="applyAfterServiceGoods" :data="servDetail" @confirmFeedback="loadData(servDetail.orderMasterId)" @cancel="blurCurOrder"></apply-after-service-goods>
		<confirm-modal ref="notice" :content="'银联实时动态：本单已划款，师傅/服务人员已到帐或即将到帐。双方达成退款的，请对方线下支付后点“对方已退款”。'" :confirmMsg="'对方已退款'" @confirm="afterServiceFinalCheck(curDetailOrder.afterServiceRecordList[0].id, 1)" @cancel="noticeCancel"></confirm-modal>
		
		<afterserviceDisagree v-if="showAfterserviceDisagree" :show="showAfterserviceDisagree" :orderAfterId="orderAfterId" @close="showAfterserviceDisagree = false"  @confirmFeedback="showAfterserviceDisagree = false;loadData(servDetail.orderMasterId);"></afterserviceDisagree>
		<deliverGoods v-if="showDeliverGoods" :show="showDeliverGoods" :data="currentChooseAfterService" @close="showDeliverGoods = false;currentChooseAfterService = null;"  @confirmFeedback="showDeliverGoods = false;currentChooseAfterService = null;loadData(servDetail.orderMasterId)"></deliverGoods>
		
		<deliveryFlowDetail :show="showDeliveryFlow" :trackingNumber="showDeliveryFlowTrackingNumber" @close="showDeliveryFlow = false"></deliveryFlowDetail>
	</view>
</template>

<script>
	import simpleProductPicked from '@/components/goods-card/simple-product-picked.vue';
	import urgentMsg from '@/pages/my/components/modal/urgent-msg.vue';
	import urgeOrder from '@/pages/my/components/modal/urge_order.vue';
	import applyAfterService from '@/pages/my/components/modal/apply-after-service.vue';
	import applyAfterServiceGoods from '@/pages/my/components/modal/apply-after-service-goods.vue';
	import afterserviceDisagree from '@/pages/my/components/modal/afterservice-disagree.vue';
	import deliverGoods from '@/pages/my/components/modal/deliver-goods.vue';
	import deliveryFlowDetail from '@/pages/my/components/modal/delivery_flow_detail.vue';

	export default {
		components: {
			simpleProductPicked,
			urgentMsg,
			applyAfterService,
			urgeOrder,
			afterserviceDisagree,
			applyAfterServiceGoods,
			deliverGoods,
			deliveryFlowDetail
		},
		data() {
			return {
				value: ['0'],
				order: {},
				servDetail: {},
				finishRecord4Show: [],
				servingColumnHeaders: ['购买型号', '购买量', '待服务'],
				servedColumnHeaders: ['购买型号', '派单量', '已服务'],
				servingValFields: ['standardName', 'standardNum', 'waitServerNum'],
				servedValFields: ['standardName', 'standardNum', 'serverNum'],
				process: '',
				ifShowPageMeta: false,
				sendUrgentMsgModal: false,
				sendUrgeOrderModal: false,
				curDetailOrder: null,
				showAfterserviceDisagree: false,
				orderAfterId: null,
				showDeliverGoods: false,
				showDeliveryFlow: false,
				showDeliveryFlowTrackingNumber: '',
				currentChooseAfterService: null
			}
		},
		onLoad(options) {
			if (options && options.order) {
				this.order = JSON.parse(decodeURIComponent(options.order));
			}
			this.loadData(this.order.orderMasterId);
			this.bindEvent();
			if(this.order.orderType === 1) {
				this.servingColumnHeaders = ['购买型号', '购买量', '待发货']
				this.servedColumnHeaders = ['购买型号', '购买量', '已发货']
			}
		},
		onUnload() {
			this.offBindEvent();
		},
		methods: {
			openShopLocation(item) {
				// const gcj02Coord = wgs84ToGcj02(item.shop.longitude, item.shop.latitude)
				// const gcj02Coord = wgs84ToGcj02(102.80154676649306, 24.969456922743056)
				// const gcj02Coord = [102.82868680950929, 24.864792838337802]
				const gcj02Coord = [item.longitude, item.latitude]
				wx.openLocation({
				  latitude: gcj02Coord[1],
				  longitude: gcj02Coord[0],
				  scale: 18,
				  name: item.shopName,
				  address: `${item.provinceName}${item.cityName}${item.countryName}${item.streetName}${item.address}`
				})
			},
			bindEvent() {
				uni.$on(this.$globalFun.CHOOSE_ADDRESS, this.editAddress);
			},
			offBindEvent() {
				uni.$off(this.$globalFun.CHOOSE_ADDRESS);
			},
			async loadData(orderMasterId) {
				// this.servDetail = await this.$api.data('servDetail');
				// this.finishList4Show = this.servDetail.finishRecord;
				// for (let i = 0; i < this.finishList4Show.length; i++) {
				// 	let finishList = this.finishList4Show[i].finishList;
				// 	for (let j = 0; j < finishList.length; j++) {
				// 		finishList[j].secondColumnNum = finishList[j].servedNum;
				// 	}
				// 	this.finishList4Show[i].finishList = finishList;
				// }
				let servDetailRes = await this.$request.getOrderMasterDetail({
					id: orderMasterId
				});
				servDetailRes.data.orderType = this.order.orderType
				this.servDetail = servDetailRes.data;
			},
			copyData(data) {
				uni.setClipboardData({
					data: data,
					success() {
						uni.showToast({
							title: '复制成功'
						})
					}
				});
			},
			changePopupState(e) {
				this.ifShowPageMeta = e.show;
			},
			togglePopup(e) {
				let targetPopup = null;
				if (typeof e === 'string') {
					targetPopup = e;
				} else {
					targetPopup = e.currentTarget.dataset.popup;
				}
				if (this.ifShowPageMeta) {
					this.$refs[targetPopup].close();
				} else {
					this.$refs[targetPopup].open();
				}
			},
			showModal(e) {
				this[e.currentTarget.dataset.modal] = true;
			},
			hideModal(e) {
				this[e.currentTarget.dataset.modal] = false;
			},
			decideIfCancelOrder() {
				this.$refs.confirmModal.showModal();
			},
			viewImage(e, imgList) {
				uni.previewImage({
					urls: imgList,
					current: e.currentTarget.dataset.url
				});
			},
			async cancelOrder(e) {
				let res = await this.$request.cancelMasterOrder({
					orderMasterId: this.servDetail.orderMasterId
				});
				if (res && res.code === 0) {
					this.togglePopup('orderManage');
					this.loadData(this.servDetail.orderMasterId);
					uni.showToast({
						title: '取消成功',
						icon: 'success',
						duration: 2000
					})
				} else {
					uni.showToast({
						title: '取消失败',
						icon: 'error'
					})
				}
			},
			async urgeOrderOpration(params) {
				const res = await this.$request.addWarnRecord({
					orderId: this.servDetail.orderMasterId,
					orderType: '01',
					...params
				})
				if (res.code != 0) return
				uni.showToast({
					title: params.type == 2 ? '约单成功' : '催单成功',
					icon: 'success',
					duration: 2000
				})
				
				this.sendUrgeOrderModal = false
				this.togglePopup('orderManage');
			},
			async afterServiceFinalCheck(id, agreeStatus) {
				let res = await this.$request.editAfterServiceRecord({
					id: id,
					customerFinalCheck: agreeStatus
				});
				if (res && res.code === 0) {
					this.loadData(this.servDetail.orderMasterId);
					if (agreeStatus == 1) {
						uni.showToast({
							icon: 'none',
							duration: 3000,
							title: '涉及退款部分将按付款原路退回，请留意'
						})
					}
					return;
				}
				if (res && res.msg){
					uni.showToast({
						icon: 'none',
						duration: 3000,
						title: res.msg
					})
				} else {
					uni.showToast({
						icon: 'error',
						duration: 1000
					})
				}
			},
			async afterServiceAgreeRedo(id, customerAgreeRedo) {
				let res
				if(this.order.orderType === 1) {
					res = await this.$request.editAfterServiceGoodsRecord({
						id: id,
						customerAgreeRedo
					});
				} else {
					res = await this.$request.editAfterServiceRecord({
						id: id,
						customerAgreeRedo
					});
				}
				
				if (res && res.code === 0) {
					this.loadData(this.servDetail.orderMasterId);
				}
				if (res && res.msg){
					uni.showToast({
						icon: 'none',
						duration: 3000,
						title: res.msg
					})
				}
			},
			tapToShowRejectPlan(id) {
				this.orderAfterId = id;
				this.showAfterserviceDisagree = true;
			},
			applyAfterService() {
				this.showModalByRef(this.order.orderType === 1 ? 'applyAfterServiceGoods' : 'applyAfterService', this.servDetail, {
					afterServiceType: 2,
					toUpdateStatus: false
				})
			},
			applyForRefund() {
				this.showModalByRef(this.order.orderType === 1 ? 'applyAfterServiceGoods' : 'applyAfterService', this.servDetail, {
					afterServiceType: 1,
					toUpdateStatus: false
				})
			},
			showModalByRef(refName, curOrder, params) {
				this.$refs[refName].showModal(curOrder, params);
			},
			async cancelAfterService(afterServiceRecord) {
				if(afterServiceRecord.workerFeedbackResult == 3 && this.order.orderType == 1) {
					uni.showToast({
						icon: 'none',
						title: '重发/补发中，不能撤消售后单！',
						duration: 1000
					})
					return
				}
				let res = await this.$request.delAfterServiceRecord(afterServiceRecord.id);
				if (res && res.code === 0) {
					this.loadData(this.servDetail.orderMasterId);
					uni.showToast({
						icon: 'success',
						title: '撤销成功',
						duration: 1000
					})
				} else {
					uni.showToast({
						icon: 'error',
						title: '撤销失败',
						duration: 1000
					})
				}
			},
			showAddress2Choose() {
				const {provinceId,provinceName,cityId,cityName,countryId,countryName,address,name,streetId,streetName,phone} = this.servDetail
				let newAddr = address
				if(newAddr.indexOf(provinceName) > -1) {
					newAddr = newAddr.replace(provinceName, "")
				}
				if(newAddr.indexOf(cityName) > -1) {
					newAddr = newAddr.replace(cityName, "")
				}
				if(newAddr.indexOf(countryName) > -1) {
					newAddr = newAddr.replace(countryName, "")
				}
				if(newAddr.indexOf(streetName) > -1) {
					newAddr = newAddr.replace(streetName, "")
				}
				const addressInfo = {
					provinceId,
					provinceName,
					cityId,
					cityName,
					countryId,
					countryName,
					address: newAddr,
					streetId,
					streetName,
					phone,
					name
				}
				uni.navigateTo({
					url: '/pages/my/edit-service-address?params=' + encodeURIComponent(JSON.stringify(addressInfo))
				})
			},
			async editAddress(addressInfo) {
				console.log(addressInfo)
				const {provinceId,provinceName,cityId,cityName,countryId,countryName,address,name,streetId,streetName,phone} = addressInfo
				let res = await this.$request.updateMasterAddress({
					id: this.servDetail.orderMasterId,
					provinceId,
					provinceName,
					cityId,
					cityName,
					countryId,
					countryName,
					address,
					streetId,
					streetName,
					phone,
					name
				});
				if (res && res.code === 0) {
					this.loadData(this.order.orderMasterId);
					setTimeout(() => {
						uni.showToast({
							icon: 'success',
							title: '修改成功'
						})
					}, 1000)
				}
			},
			makePhoneCall(phoneNum) {
				uni.makePhoneCall({
					phoneNumber: phoneNum
				})
			},
			showNotice(detailOrder, afterServiceRecord) {
				if (detailOrder.drawCashStatus != null && detailOrder.drawCashStatus >= 1) {
					this.curDetailOrder = detailOrder;
					this.$refs.notice.showModal();
				} else {
					if(this.order.orderType === 1 && afterServiceRecord.workerFeedbackResult != 0) {
						let notificationContent = '建议收到货后再确认同意！';
						if(afterServiceRecord.workerFeedbackResult === 1 && afterServiceRecord.operType === 1) {
							notificationContent = '同意后结束售后，商家同意退款的将发起退款！'
						}
						uni.showModal({
							title: '提示',
							content: notificationContent,
							confirmText: '仍然同意',
							success: (res) => {
								if(res.confirm) {
									this.afterServiceFinalCheck(afterServiceRecord.id, 1)
								}
							}
						})
					} else {
						this.afterServiceFinalCheck(afterServiceRecord.id, 1)
					}
				}
			},
			noticeCancel() {
				this.curDetailOrder = null;
			},
			async changeOrderPrice(orderDetailId) {
				await this.$request.deleteAttachPrice({
					orderDetailId: orderDetailId
				})
				let res = await this.$request.changeOrderPrice({
					orderDetailId: orderDetailId,
					changeMoney: 0,
					type: 1,
					remark: '客户清空加价'
				});
				if (res && res.code === 0) {
					uni.showToast({
						icon: 'success',
						title: '操作成功'
					})
					setTimeout(() => {
						this.loadData(this.servDetail.orderMasterId);
					}, 1500);
				}
			},
			async finishAfterService(id) {
				let res = await this.$request.workerConfirmReceive({
					id: id
				});
				if (res && res.code === 0) {
					uni.showToast({
						icon: 'success',
						title: '操作成功'
					})
					setTimeout(() => {
						this.loadData(this.servDetail.orderMasterId);
					}, 1500);
				}
			},
			// 获取物流信息
			getDeliveryFlow(numerStr) {
				this.showDeliveryFlowTrackingNumber = numerStr;
				this.$nextTick(() => {
					this.showDeliveryFlow = true;
				})
			}
			
		}
	}
</script>

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

	.cu-bar.tabbar .action {
		font-size: 22rpx;
		position: relative;
		flex: 1;
		text-align: center;
		padding: 0;
		display: block;
		height: auto;
		line-height: 1;
		margin: 0;
		background-color: inherit;
		overflow: initial;
		z-index: 99;
	}
	
	.add-price {
		position: relative;
	}
	
	.add-price .text-main-color {
		position: absolute;
		top: 20rpx;
		right: 10rpx;
	}
	
	
</style>
