<template>
	<!-- 订单详情 -->
	<view class="page1">
		<view style="height:100%" v-if="pintuan">
			<view class="title1">
				<view class="title-sreach1">
					<view class="back-btn1" @tap="back" :style="{'top': menuButtonInfo.top +'px'}">
						<uni-icons type="left" size="28"></uni-icons>
					</view>
				</view>
			</view>
			<view class="box11">
				<view class="ziqu-xuanfu1" v-if="orderDetail.deliveryType == 1">
					外卖配送
				</view>
				<view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;">
					{{orderDetail.shopName}}
				</view>
				<view style="display: flex;padding: 20rpx 0;background: rgba(247, 248, 248, 0.6);border-radius: 20rpx;">
					<view class="goods-img1">
						<img src="/static/images/img/shangpintu.png" alt="">
					</view>
					<view class="goods-content1" v-for="(item1,index1) in orderDetail.goodsList" :key="index1"
						v-if="orderDetail.goodsList != null && orderDetail.goodsList.length > 0">
						<view class="goods-name1">
							{{item1.productName}}
						</view>
						<view class="goods-content-center1">
							<view>
								{{item1.specs | delNode}}
							</view>
						</view>
						<view class="goods-content-bottom1" style="display: flex;margin-top: 15px;">
							<view style="flex: 1;">
								X{{item1.quantity}}
							</view>
							<view class="pintuan-left-price1">
								<view
									style="background: rgba(255, 57, 57, 0.2);padding: 0px 12rpx;border-radius: 20rpx;margin-left: 20rpx;">
									<text>拼团</text>
									<text style="color: red;">￥{{item1.price}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="box11" style="position: absolute;top: 800rpx;left: 2.5%;">
				<view class="kaituan11">
					<view class="kaituan1-title1">
						差{{orderDetail.groupInfo.targetMembers - orderDetail.groupInfo.currentMembers}}人即可成团
						<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/21b403bd13414ce79ad73cf1c8e3de98.png"
							alt="" style="width: 120rpx;height: 22rpx;position: absolute;bottom: 0;right: 30rpx;" />
					</view>
					<view class="kaituan1-title11">
						快呼唤小伙伴参加吧！
					</view>
				</view>
				<view class="kaituan21">
					<view class="kaituan221">
						<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/801c569079da4540990c1cc634186fdd.png"
							alt=""
							style="width: 90rpx;height: 90rpx;border-radius: 90rpx;margin: 0 auto;display: block;" />
					</view>
					<view class="kaituan221">
						<view class="weipincheng1"
							v-for="(item1,index1) in (orderDetail.groupInfo.targetMembers - orderDetail.groupInfo.currentMembers)"
							:key="index1">
							+
						</view>
					</view>
				</view>
				<view class="kaituan41">
					<button open-type="share" class="share-btn"
						style="background:transparent;border:none;color:inherit;font-size:inherit;display:inline-flex;align-items:center;">
						分享至微信 <uni-icons type="weixin" size="15"></uni-icons>
					</button>
				</view>
				<view class="kaituan41" v-if="orderStatus(orderDetail)" @tap="returnPopupProp(orderDetail)">
					取消订单 <uni-icons type="weixin" size="15"></uni-icons>
				</view>
				<view class="kaituan41" v-if="orderStatusBuy(orderDetail)" @tap="returnPopupPropBuy(orderDetail)">
					取消拼团转直接购买 <uni-icons type="weixin" size="15"></uni-icons>
				</view>
				<view class="kaituan41" @tap="refreah(orderDetail)">
					刷新 <uni-icons type="weixin" size="15"></uni-icons>
				</view>
				<view class="kaituan51">
					<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/c1f1b45c98fa4db1a1e5f98b3a0573c2.png"
						alt="" style="width: 520rpx;height: 150rpx;margin: 0 auto;display: block;" />
				</view>
			</view>
		</view>
		<view class="" v-else>
			<view class="title">
				<view class="title-sreach">
					<view class="back-btn" @tap="back" :style="{'top': menuButtonInfo.top +'px'}">
						<uni-icons type="left" size="28"></uni-icons>
					</view>
				</view>
			</view>
			<view class="content">
				<view class="box1" style="display: flex;min-height: 160rpx;">
					<view class="status-img">
						<img v-if="orderDetail.status == 0 || (orderDetail.status == 3 && orderDetail.deliveryType == 2)"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6cf6fff020614ebebb34f7c371e11331.png"
							alt="" />
						<img v-if="orderDetail.status == 2"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/35ff6276eb3a4e58b8baa724ca44d5dc.png"
							alt="" />
						<img v-if="orderDetail.status == 5 || orderDetail.status == 8 || orderDetail.status == 12"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/dbfa6dc934e2414c912c67430d5f802c.png"
							alt="" />
						<img v-if="orderDetail.status == 6"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/03d7e8d5914e4b9ca04728113900d1fe.png"
							alt="" />
						<img v-if="orderDetail.status == 7 || orderDetail.status == 11"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/35ff6276eb3a4e58b8baa724ca44d5dc.png"
							alt="" />
						<img v-if="(orderDetail.status == 3 && orderDetail.deliveryType == 1) || (orderDetail.status == 4 && orderDetail.deliveryType == 1)"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/0ab87a35cbca473997c679a023337df6.png"
							alt="" />
						<!-- 
							待支付  https://jewel-shop.oss-cn-beijing.aliyuncs.com/6cf6fff020614ebebb34f7c371e11331.png
							订单取消  https://jewel-shop.oss-cn-beijing.aliyuncs.com/03d7e8d5914e4b9ca04728113900d1fe.png
							等待商家接单、等待配送员接单、等待商家同意  https://jewel-shop.oss-cn-beijing.aliyuncs.com/35ff6276eb3a4e58b8baa724ca44d5dc.png
							配送中、配送员已接单、配送员已到店、等待配送员接单  https://jewel-shop.oss-cn-beijing.aliyuncs.com/0ab87a35cbca473997c679a023337df6.png
							订单完成  https://jewel-shop.oss-cn-beijing.aliyuncs.com/dbfa6dc934e2414c912c67430d5f802c.png
						 -->
					</view>
					<view class="status-text">
						<view class="status-zhu">
							<text v-if="orderDetail.status == 0">待支付</text>
							<text v-if="orderDetail.status == 2">等待配送员接单</text>
							<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 1">配送员已接单</text>
							<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 2">待消费</text>
							<text v-if="orderDetail.status == 4 && orderDetail.deliveryType == 1">配送员已取货</text>
							<text v-if="orderDetail.status == 5">订单已完成</text>
							<text v-if="orderDetail.status == 7">等待同意退款</text>
							<text v-if="orderDetail.status == 6">订单已取消</text>
							<text v-if="orderDetail.status == 8">订单已退款</text>
							<text v-if="orderDetail.status == 11">售后中</text>
							<text v-if="orderDetail.status == 12">订单已售后</text>
						</view>
						<view class="status-fu" v-if="orderDetail.deliveryInfo">
							<view class="">
								预计<text style="color:red;font-weight: 700;">{{orderDetail.deliveryInfo.mustFinishTime | formatHourMinute }}</text>送达</view>
							<!-- <view class="">超过15分钟未支付，订单自动取消</view>
							<view class="">您申请了取消订单，请等待商家同意</view>
							<view class="">商家已同意取消订单，订单金额将原路返回</view>
							<view class="">商家已拒绝取消订单，将会继续为您配送</view> -->
						</view>
						<view class="status-address" v-if="orderDetail.deliveryInfo">
							送至 <text>{{orderDetail.deliveryInfo.receiverAddress}}</text>
						</view>
						<view class="status-btn" style="top: 0;" v-if="orderStatus(orderDetail)"
							@tap="returnPopupProp(orderDetail)">
							取消订单
						</view>
						<view class="status-btn" style="top: 0;" v-if="orderDetail.status == 5 && hasRefund == false"
							@tap="returnProducts(orderDetail)">
							申请售后
						</view>
						<view class="status-btn" style="top: 70rpx;" @tap="refreah(orderDetail)">
							刷新
						</view>
						<!-- <view class="status-btn">
							去评价
						</view> -->
					</view>
				</view>
				<view class="order-flow">
					<view class="flow-item active">
						<view class="flow-dot"></view>
						<view class="flow-name">已下单</view>
					</view>
					<view class="flow-line" :class="{'active': orderDetail.status >= 3 || orderDetail.status == 5}"></view>
					<view class="flow-item" :class="{'active': orderDetail.status >= 3 || orderDetail.status == 5}">
						<view class="flow-dot"></view>
						<view class="flow-name">{{orderDetail.deliveryType == 1 ? '已接单' : '待消费'}}</view>
					</view>
					<view class="flow-line" :class="{'active': orderDetail.status >= 4 || orderDetail.status == 5}"></view>
					<view class="flow-item" :class="{'active': orderDetail.status >= 4 || orderDetail.status == 5}">
						<view class="flow-dot"></view>
						<view class="flow-name">{{orderDetail.deliveryType == 1 ? '配送中' : '核销中'}}</view>
					</view>
					<view class="flow-line" :class="{'active': orderDetail.status == 5 || orderDetail.status == 8 || orderDetail.status == 12}"></view>
					<view class="flow-item" :class="{'active': orderDetail.status == 5 || orderDetail.status == 8 || orderDetail.status == 12}">
						<view class="flow-dot"></view>
						<view class="flow-name">已完成</view>
					</view>
				</view>
				<view class="btn-box">
					<view class="btn"
						v-if="orderDetail.status == 3 && orderDetail.deliveryType == 2 &&orderDetail.userRequireMake == null"
						@tap="openCode">
						核销取餐码
					</view>
					<view class="btn"
						v-if="orderDetail.status == 3 && orderDetail.deliveryType == 2 &&orderDetail.userRequireMake == null"
						@tap="makeMeal" style="background: rgba(0, 35, 28, 1);color:rgba(166, 255, 234, 1);">
						立即备餐
					</view>
					<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2" @tap="openAddFeePopup">
						增加配送佣金
					</view>
					<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2" @tap="goAssignWorker">
						改派配送员
					</view>
					<!-- <view class="btn">
						再来一单
					</view>
					<view class="btn">
						￥5 去支付
					</view>
					<view class="btn">
						增加配送佣金
					</view>
					<view class="btn">
						取消申请
					</view> -->
				</view>
				<view class="box1"
					v-if="orderDetail.mallRefundRecord != null && orderDetail.mallRefundRecord.length > 0">
					<view style="width: 100%;line-height: 70rpx;font-size: 30rpx;font-weight: 700;">
						退款/售后
					</view>
					<view style="display: flex;margin-top:10px;padding: 20rpx;background: rgba(247, 248, 248, 0.6);border-radius: 20rpx;"
						v-for="(item2,index2) in orderDetail.mallRefundRecord" :key="index2">

						<view style="width: 100%;">
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									申请时间
								</view>
								<view style="color: #000;font-weight:700;">
									{{item2.createTime | formatTime}}
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									金额
								</view>
								<view style="color: #000;font-weight:700;">
									￥{{item2.refundAmount}}
								</view>
							</view>
							<view v-for="(item3,index3) in item2.items" :key="index3"
								v-if="item2.items != null && item2.items.length > 0"
								style="display: flex;padding: 20rpx;background: rgba(247, 248, 248, 0.6);border-radius: 20rpx;">
								<view class="goods-img">
									<img :src="item3.productPicture" alt="" style="border-radius: 20rpx;">
								</view>
								<view class="goods-content">
									<view class="goods-name">
										{{item3.productName}}
									</view>
									<view class="goods-content-center">
										{{item3.specs | delNode}}
									</view>
									<view class="goods-content-bottom">
										<view style="width: 50%;">
											X{{item3.quantity}}
										</view>
										<view class="pintuan-left-price">
											￥{{item3.price}}
										</view>
									</view>
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									原因
								</view>
								<view style="color: #000;font-weight:700;">
									{{item2.reason != null ? item2.reason : ''}}
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									图片
								</view>
								<view style="color: #000;font-weight:700;">
									<image v-if="item2.pictures != null" :src="item2.pictures"></image>
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									退款/售后类型
								</view>
								<view style="color: #000;font-weight:700;">
									{{item2.refundType == 1 ? '退商品 ' : item2.refundType == 2 ? '退配送费 ' : '全额退款 ' }}
									<text v-if="item2.refundTypeStatus != null">
										| {{item2.refundTypeStatus == 1 ? '商家原因' : item2.refundTypeStatus == 2 ? '配送员原因' : item2.refundTypeStatus == 3 ? '商家/配送员都有原因' : '平台退款' }}
									</text>
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;">
								<view style="flex: 1;color: #777;font-weight: 700;">
									退款/售后状态
								</view>
								<view style="color: #000;font-weight:700;">
									{{item2.status == 0 ? '处理退款中' : item2.status == 1 ? '同意退款' : item2.status == 2 ? '拒绝退款' : item2.status == 3 ? '处理售后中' : item2.status == 4 ? '同意售后' : '拒绝售后' }}
								</view>
							</view>
							<view style="height: 80rpx;line-height: 80rpx;display: flex;"
								v-if="item2.successTime != null">
								<view style="flex: 1;color: #777;font-weight: 700;">
									处理退款/售后时间
								</view>
								<view style="color: #000;font-weight:700;">
									{{item2.successTime | formatTime}}
								</view>
							</view>
						</view>
					</view>

				</view>

				<view class="box1">
					<view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;display: flex;"
						v-if="orderDetail.shopName != null">
						<text style="flex:1">{{orderDetail.shopName}}</text>
						<img @tap="makeCall(orderDetail.shopPhone)"
							src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
							alt="" style="width: 40rpx;height: 40rpx;margin-top: 14rpx;" />
					</view>

					<view v-for="(item1,index1) in orderDetail.goodsList" :key="index1"
						v-if="orderDetail.goodsList != null && orderDetail.goodsList.length > 0"
						style="display: flex;padding: 20rpx;background: rgba(247, 248, 248, 0.6);border-radius: 20rpx;">
						<view class="goods-img">
							<img :src="item1.productPicture" alt="">
						</view>
						<view class="goods-content">
							<view class="goods-name">
								{{item1.productName}}
							</view>
							<view class="goods-content-center">
								{{item1.specs | delNode}}
							</view>
							<view class="goods-content-bottom">
								<view style="width: 50%;">
									X{{item1.quantity}}
								</view>
								<view class="pintuan-left-price">
									￥{{item1.price}}
								</view>
							</view>
						</view>
					</view>
					<view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.packageFee != null && orderDetail.packageFee > 0">
							<view style="flex: 1;color: #777;font-weight: 700;">
								打包费
							</view>
							<view style="color: #000;font-weight:700;">
								￥{{orderDetail.packageFee == undefined ? '' : orderDetail.packageFee}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryType == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								配送费
							</view>
							<view style="color: #000;font-weight:700;">
								￥{{orderDetail.deliveryFee == undefined ? '' : orderDetail.deliveryFee}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.userCouponNum > 0">
							<view style="flex: 1;color: #777;font-weight: 700;">
								优惠券
							</view>
							<view style="color: #000;font-weight:700;">
								-￥{{orderDetail.userCouponNum == undefined ? '' : orderDetail.userCouponNum}}
							</view>
						</view>
					</view>
					<view
						style="display: flex;height: 80rpx;line-height: 100rpx;border-top: 1px solid #eee;font-size: 32rpx;font-weight: 700;">
						<view style="flex: 1;">
							实付
						</view>
						<view class="">
							￥{{orderDetail.totalAmount == undefined ? '' : orderDetail.totalAmount}}
						</view>
					</view>
				</view>

				<view class="box1">
					<view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.otherOrder == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								取件地址
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.shopAddress == undefined ? '' : orderDetail.shopAddress}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.otherOrder == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								收件地址
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.receiverAddress == undefined ? '' : orderDetail.receiverAddress}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.otherOrder == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								件数
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.deliveryInfo.allCount == undefined ? '' : orderDetail.deliveryInfo.allCount}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.otherOrder == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								服务类型
							</view>
							<view style="color: #000;font-weight: 700;">
								快递/跑腿
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.numberCode != null">
							<view style="flex: 1;color: #777;font-weight: 700;">
								订单号
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.numberCode == undefined ? '' : orderDetail.numberCode}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;">
							<view style="flex: 1;color: #777;font-weight: 700;">
								下单时间
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.createTime | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryType == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								配送员
							</view>
							<view style="color: #000;font-weight: 700;display: flex;"
								v-if="orderDetail.deliveryInfo && orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
								{{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}}
								<img @tap="makeCall(orderDetail.deliveryInfo.workerPhone)"
									src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
									alt="" style="width: 40rpx;height: 40rpx;margin: 20rpx 0 0 20rpx;" />
							</view>
							<view style="color: #000;font-weight: 700;" v-else>
								未指定等待接单中
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId">
							<view style="flex: 1;color: #777;font-weight: 700;">
								配送员接单时间
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.deliveryInfo.acceptTime | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryType == 1 && orderDetail.otherOrder == null">
							<view style="flex: 1;color: #777;font-weight: 700;">
								商家出餐时间
							</view>
							<view style="color: #000;font-weight: 700;"
								v-if="orderDetail.deliveryInfo && orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
								{{orderDetail.shopMakeTime ? orderDetail.shopMakeTime : ''  | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != '' && orderDetail.otherOrder == null">
							<view style="flex: 1;color: #777;font-weight: 700;">
								配送员到店时间
							</view>
							<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo">
								{{orderDetail.deliveryInfo.arriveTime ? orderDetail.deliveryInfo.arriveTime : ''  | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
							<view style="flex: 1;color: #777;font-weight: 700;">
								配送员取货时间
							</view>
							<view style="color: #000;font-weight: 700;">
								{{orderDetail.deliveryInfo.getTime ? orderDetail.deliveryInfo.getTime : ''  | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							v-if="orderDetail.deliveryType == 1">
							<view style="flex: 1;color: #777;font-weight: 700;">
								送达时间
							</view>
							<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo">
								{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达'  | formatTime}}
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;"
							>
							<view style="flex: 1;color: #777;font-weight: 700;">
								我的评价
							</view>
							<view style="color: #000;font-weight: 700;" @tap="checkEvaluate">
								查看评价 >
							</view>
						</view>
						<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="hasRefund">
							<view style="flex: 1;color: #777;font-weight: 700;">
								申请平台介入
							</view>
							<view style="color: #000;font-weight: 700;" @tap="checkEvaluate">
								<img @tap="makeCall('15533910775')"
									src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
									alt="" style="width: 40rpx;height: 40rpx;margin: 20rpx 0 0 20rpx;" />
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 评价弹出层 -->
		<uni-popup ref="evaluatePopup" background-color="#fff">
			<view class="evaluate-content" @tap="$refs.evaluatePopup.close()">
				<view class="evaluate-list" v-for="(item,index) in orderDetail.comments" :key="index">
					<view class="eval-title">
						<view class="eval-icon">
							<img :src="item.createByIcon" alt="" />
						</view>
						<view class="eval-name">
							<view class="name1">
								{{item.createByName}}
							</view>
							<view class="eval-time">
								{{item.createTime}}
							</view>
						</view>
					</view>
					<view class="eval-content">
						<view style="display: flex;height: 50rpx;line-height: 50rpx;font-size: 24rpx;">
							商品
							<view style="padding: 12rpx 0 0 10rpx;">
								<uni-rate v-model="item.score" size="12" />
							</view>
						</view>
						<view class="eval-text">
							{{item.remark}}
						</view>
						<view class="eval-img">
							<img @tap="largeImg" :src="item.picture" alt="">
						</view>
						<view class="reply-card" :class="{'expanded': isExpanded}"
							v-for="(item1,index1) in item.comments" :key="index1">
							<!-- 标题行：商家回复 + 展开/收起按钮 -->
							<view class="reply-header">
								<!-- 回复内容区域（动态类控制展开/折叠） -->
								<view class="reply-content" :class="{ collapsed: !isExpanded, expanded: isExpanded }">
									<text>{{item1.createByName}} : {{ item1.remark }}</text>
								</view>
								<view class="reply-expand-btn" @click="toggleReply">
									<text v-if="!isExpanded">展开</text>
									<text v-else>收起</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 核销二维码弹出层 -->
		<uni-popup ref="imgPopup" background-color="#fff">
			<view class="img-popup-content" @tap="$refs.imgPopup.close()">
				<uqrcode :hide='true' ref="uqrcode" size="160" sizeUnit="rpx" canvas-id="qrcode"
					:value="orderDetail.id + '@@'+ orderDetail.shopId">
				</uqrcode>
				<img :src="newQRList" alt=""
					style="width: 330rpx;height: 330rpx;margin: 282rpx 0 0 136rpx;border: 20rpx solid rgba(222, 255, 248, 1);border-radius: 20rpx;">
			</view>
		</uni-popup>

		<uni-popup ref="returnPopup" background-color="#fff">
			<view class="car-content" style="height: auto;padding: 20rpx 20rpx 0;" v-if="orderDetail.status != 10">
				<view class="car-title" style="padding: 0 20rpx;">
					选择退款原因
				</view>
				<view class="" style="padding: 0 20rpx;">
					<view style="height:80rpx;" v-if="orderDetail.otherOrder != 1">
						<radio :checked="sellTime==2" name="sellTime" @click="checkSellTime(2)" />
						全额退款（商家原因）
					</view>
					<view style="height:80rpx;" v-if="payData.deliveryType ==1">
						<radio :checked="sellTime==3" name="sellTime" @click="checkSellTime(3)" />
						全额退款（配送员原因）
					</view>
					<view style="height:80rpx;" v-if="payData.deliveryType ==1 && orderDetail.otherOrder != 1">
						<radio :checked="sellTime==4" name="sellTime" @click="checkSellTime(4)" />
						全额退款（商家+配送员原因）
					</view>
					<view style="height:80rpx;">
						<radio :checked="sellTime==5" name="sellTime" @click="checkSellTime(5)" />
						其他
					</view>
				</view>
				<view class="guize-list">
					<view style="border-bottom: 10rpx solid #eee;border-top: 10rpx solid #eee;padding: 20rpx 0;">
						<view style="flex: 1;color: #777;font-weight: 700;">
							申请说明
						</view>
						<view style="">
							<textarea name="" id="" cols="30" rows="10" placeholder="请填写备注" v-model="returnData.reason"
								style="width: 100%;height: 100rpx;padding: 10rpx;margin-top: 20rpx;"></textarea>
							<view
								style="width: 120rpx;height: 120rpx;border: 1px solid #eee;text-align: center;line-height: 60px;">
								<view class="upload-img" @tap="pictureAdd" style="">
									<uni-icons type="camera" size="28" color="#777"></uni-icons>
								</view>
								<view v-if="returnData.pictures !=''" style="">
									<img :src="returnData.pictures" alt="" class="upload-img">
								</view>
							</view>
						</view>
					</view>

					<view
						style="margin-top: 20rpx; color: #ff5722; font-size: 24rpx; background: #fff5f5; padding: 10rpx 20rpx; border-radius: 10rpx;">
						<uni-icons type="info" size="14" color="#ff5722"></uni-icons>
						<text
							v-if="(((payData.orderType == 2 || payData.orderType == 3) && payData.status == 2) || ((payData.orderType == 2 || payData.orderType == 3) && payData.status == 3)  || (payData.deliveryType == 1 && payData.status == 3) || payData.status == 4) && payData.otherOrder == null">
							取消订单需要商家同意
						</text>
						<text v-else>请选择退款原因</text>
						<view v-if="(payData.status == 3 && payData.deliveryType ==1) || payData.status == 4"
							style="line-height: 50rpx;margin-top: 16rpx;">
							<view v-if="payData.shopMakeTime == null && payData.otherOrder == null"
								style="text-align: right;">
								<uni-icons type="info" size="14" color="#ff5722"></uni-icons>
								<text style="display:inline-block;padding-left:5px;">
									商家还未出餐
								</text>
							</view>
							<view v-if="payData.shopMakeTime == null && payData.otherOrder == null">
								<view style="color: #ff5722;">
									<uni-icons type="info" size="14" color="#ff5722"></uni-icons>

									<text style="display:inline-block;padding-left:5px;">
										配送员到店时间：{{shopTime}}
									</text>
								</view>
							</view>
							<view v-if="payData.shopMakeTime != null && payData.otherOrder == null">
								<view style="color: #ff5722;">
									<uni-icons type="info" size="14" color="#ff5722"></uni-icons>
									<text style="display:inline-block;padding-left:5px;">
										本单商家备餐时长：{{shopTime}}
									</text>
								</view>
							</view>
							<view v-if="payData.shopMakeTime != null && payData.otherOrder == null">
								<view style="color: #ff5722;">
									<uni-icons type="info" size="14" color="#ff5722"></uni-icons>
									<text style="display:inline-block;padding-left:5px;">
										配送员配送时长：{{peisongTime}}
									</text>
								</view>
							</view>
						</view>
					</view>
					<view class="btn" @tap="returnOrder()" style="margin-top: 20px;">
						确认取消
					</view>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="returnPopupBuy" background-color="#fff" style="height: 1600rpx !important;">

			<view class="guize-list">
				<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
					确定要取消拼团吗
				</view>
				<view class="btn" @tap="returnOrderBuy()">
					确认取消
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="addFeePopup" background-color="#fff" style="height: 1600rpx !important;">
			<view class="guize-list">
				<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
					增加配送佣金
				</view>
				<view style="padding: 20rpx 40rpx;">
					<view style="font-size: 28rpx;color: #777;margin-bottom: 20rpx;">请输入要增加的佣金金额（元）</view>
					<input type="digit" v-model="additionalFee" placeholder="请输入金额"
						style="border: 1px solid #ccc;border-radius: 16rpx;height: 80rpx;line-height: 80rpx;padding: 0 20rpx;font-size: 32rpx;text-align: center;" />
				</view>
				<view class="btn" @tap="submitAddFee()">
					去支付
				</view>
			</view>
		</uni-popup>

		<!-- 增加佣金支付弹出层 -->
		<uni-popup ref="addFeePayPopup" background-color="#fff">
			<view class="pay-popup" style="height: 580rpx;background: #fff;border-radius: 40rpx 40rpx 0 0;">
				<view class="content" style="height: 100%;margin-top:0">
					<view class="box1">
						<view style="height: 70rpx;line-height: 70rpx;text-align: center;">
							增加配送佣金
						</view>
						<view
							style="height: 90rpx;line-height: 90rpx;text-align: center;font-weight: 700;font-size: 30rpx;">
							￥<text style="font-size: 60rpx;">{{additionalFee || '0.00'}}</text>
						</view>
					</view>
					<view class="btn"
						style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));width: 90%;height: 100rpx;border-radius: 100rpx;text-align: center;font-size: 28rpx;font-weight: 700;line-height: 100rpx;margin: 40rpx auto;"
						@tap="addFeeWxPayment">
						确认付款
					</view>
					<view class="box1" style="display: flex;padding: 40rpx;">
						<view style="flex: 1;">
							<view style="height: 42rpx;line-height: 42rpx;display: flex;">
								<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4c8e0cc311db4d38ab43e019673c4b8c.png"
									alt="" style="width: 42rpx;height: 42rpx;margin-right: 20rpx;" />
								<text style="font-size: 30rpx;font-weight: 700;">微信支付</text>
							</view>
							<view style="text-align: right;margin-left: 60rpx;color: #777;width: 146rpx;">
								使用微信支付
							</view>
						</view>
						<view style="width: 36rpx;padding-top: 20rpx;">
							<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/02bff7edc4e04caaa1868955ff684f1f.png"
								alt="" style="width: 36rpx;height: 36rpx;" />
						</view>
					</view>

				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newQRList: '',
				pintuan: false,
				sellTime: 2,
				menuButtonInfo: {},
				refundType: 3,
				refundTypeStatus: 1,
				shopTime: '',
				hasRefund: false,
				peisongTime: '',
				shopItem: {},
				orderId: '',
				payData: {},
				orderDetail: {
					userCouponNum: 0
				},
				codeImg: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3a4e68eb14d7417cbb4f15fa85907c64.jpg',
				additionalFee: '',
				addFeeTradeNo: ''
			}
		},
		components: {

		},
		filters: {
			formatHourMinute(value) {
				if (!value) return '';

				const date = new Date(value);

				// 获取日 (getDate)，并补齐0
				const day = String(date.getDate()).padStart(2, '0');

				// 获取小时 (getHours)，并补齐0
				const hour = String(date.getHours()).padStart(2, '0');

				// 获取分钟 (getMinutes)，并补齐0
				const minute = String(date.getMinutes()).padStart(2, '0');

				// 拼接格式：日-日-时:分
				return `${day}日${hour}:${minute}`;
			},
			formatTime(value) {
				if (!value) return '';
				if (value == '尽快送达') return '尽快送达';
				const date = new Date(value);

				// 获取年份
				const year = date.getFullYear();

				// 获取月份 (getMonth 返回 0-11，所以需要 +1)，并补齐0
				const month = String(date.getMonth() + 1).padStart(2, '0');

				// 获取日 (getDate)，并补齐0
				const day = String(date.getDate()).padStart(2, '0');

				// 获取小时 (getHours)，并补齐0
				const hour = String(date.getHours()).padStart(2, '0');

				// 获取分钟 (getMinutes)，并补齐0
				const minute = String(date.getMinutes()).padStart(2, '0');

				// 获取秒 (getSeconds)，并补齐0
				const second = String(date.getSeconds()).padStart(2, '0');

				// 拼接格式：年-月-日 时:分:秒
				return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
			},
			delNode(data) {
				// 1. 统一转为字符串
				let str;
				if (typeof data === 'object' && data !== null) {
					// 对象或数组 → JSON 字符串
					str = JSON.stringify(data);
				} else if (typeof data === 'string') {
					str = data;
				} else {
					// 其他类型（数字、布尔等）先转字符串
					str = String(data);
				}

				// 2. 删除所有大括号 { } 和双引号 "
				const result = str.replace(/[{}"]/g, '');
				return result;
			}
		},
		onLoad(option) {
			if (option.id) {
				this.orderId = option.id
				this.getOrderDetail(this.orderId)
			}
			// 监听配送员选择事件（在onLoad中注册一次，确保事件不会丢失）
			uni.$on('updateDeliveryWorker', (worker) => {
				this.handleWorkerSelected(worker);
			});
		},
		onShow() {
			this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			// 备用方案：检查缓存中是否有待处理的配送员选择
			let pendingWorker = uni.getStorageSync('pendingAssignWorker');
			if (pendingWorker) {
				uni.removeStorageSync('pendingAssignWorker');
				this.handleWorkerSelected(pendingWorker);
			}
		},
		onShareAppMessage(res) {
			let that = this
			let groupId = that.orderDetail.groupInfo.id;
			let targetMembers = that.orderDetail.groupInfo.targetMembers;
			let shopItemStr = encodeURIComponent(JSON.stringify(that.shopItem));
			let isFTF = that.orderDetail.orderType == 3 ? 1 : 0;
			let path =
				`/package1/group/groupBuySingle?type=shop&item=${shopItemStr}&groupId=${groupId}&targetMembers=${targetMembers}&isFaceToFace=${isFTF}`;

			return {
				title: '快来一起拼单吧！',
				path: path,
				imageUrl: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/62c9aa038b2541ad9c400a76ddae7ef8.png'
			}
		},
		onUnload() {
			uni.$off('updateDeliveryWorker');
		},

		methods: {
			openCode() {
				let that = this
				this.$refs.imgPopup.open()
				this.$refs.uqrcode.toTempFilePath({
					success: res => {
						console.log(res)
						that.newQRList = res.tempFilePath
					},
					fail: err => {
						console.log(err)
					}
				});
			},
			pictureAdd(id, huan) {
				let that = this
				uni.chooseMedia({
					count: 9,
					mediaType: ['image'],
					sourceType: ['album', 'camera'],
					success(res) {
						uni.showLoading({
							title: '加载中...',
							mask: true
						})
						for (let i = 0; i < res.tempFiles.length; i++) {
							that.upLoadFile(res.tempFiles[i].tempFilePath)
						}
					}
				})
			},
			async upLoadFile(path) {
				let that = this;
				let hiver_token = uni.getStorageSync("hiver_token")
				await uni.uploadFile({
					url: that.tui.interfaceUrl() + '/upload/file',
					filePath: path,
					name: 'file',
					header: {
						"content-type": "multipart/form-data",
						'accessToken': hiver_token
					},
					formData: {},
					success: (uploadFileRes) => {
						let pathData = JSON.parse(uploadFileRes.data)
						that.returnData.pictures = pathData.result
						that.$forceUpdate()
					},
					fail: (err) => {
						uni.hideLoading();
						uni.showToast({
							title: JSON.stringify(err),
							icon: 'none'
						})
					}
				});
				await setTimeout(res => {
					uni.hideLoading();
				}, 1000)
			},
			//立即备餐
			makeMeal() {
				let that = this;
				uni.showModal({
					title: '提示',
					content: "是否立刻通知商家备餐？",
					success: function(res) {
						if (res.confirm) {
							that.tui.request("/mall/order/userRequireMake", "POST", {
								orderId: that.orderDetail.id,
							}, false, true).then((res) => {
								if (res.code == 200) {
									that.tui.toast('通知成功！');
									that.getOrderDetail(that.orderId)
								} else {
									that.tui.toast(res.message);
									return;
								}
								uni.hideLoading();
							}).catch((res) => {});
						}
					}
				});
			},
			checkSellTime(type) {
				this.sellTime = type;
				if (this.sellTime == 2) {
					//this.returnData.refundAmount = this.orderDetail.totalAmount
					this.refundType = 3
					this.refundTypeStatus = 1
				} else if (this.sellTime == 3) {
					//this.returnData.refundAmount = this.orderDetail.totalAmount
					this.refundType = 3
					this.refundTypeStatus = 2
				} else {
					//this.returnData.refundAmount = this.orderDetail.totalAmount
					this.refundType = 3
					this.refundTypeStatus = 3
				}
			},
			makeCall(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				});
			},
			checkEvaluate() {
				console.log(this.orderDetail)
				if (this.orderDetail.comments != null && this.orderDetail.comments.length > 0) {
					this.$refs.evaluatePopup.open()
				} else {
					this.tui.toast("暂无评价");
				}
			},
			orderStatus(item) {
				if (item.status == 0 || item.status == 10 || item.status == 2 || (item.status == 3 && item.deliveryType ==
						1) || (item.status == 3 && item.deliveryType == 2) || item.status == 4) {
					return true;
				}
				return false;
			},
			orderStatusBuy(item) {
				if (item.status == 10) {
					return true;
				}
				return false;
			},
			returnPopupProp(item) {
				this.payData = item;

				if (this.payData.otherOrder == 1) {
					this.refundType = 3
					this.refundTypeStatus = 2
				}
				if (this.payData.shopMakeTime != null) {
					const date1 = new Date(this.payData.deliveryInfo.acceptTime);
					const date2 = new Date(this.payData.shopMakeTime);

					// 2. 计算毫秒差值 (取绝对值，防止结果为负数)
					let diffMs = Math.abs(date2 - date1);

					// 3. 数学换算
					// 1秒 = 1000毫秒
					// 1分 = 60秒
					// 1时 = 60分
					const seconds = Math.floor((diffMs / 1000) % 60);
					const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
					const hours = Math.floor(diffMs / (1000 * 60 * 60));

					// 4. 格式化输出 (可选：补零操作，例如 9秒 -> 09秒)
					const fmt = (num) => num.toString().padStart(2, '0');

					this.shopTime = `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`;

					const date3 = new Date();

					// 2. 计算毫秒差值 (取绝对值，防止结果为负数)
					let diffMs1 = Math.abs(date3 - date2);

					// 3. 数学换算
					// 1秒 = 1000毫秒
					// 1分 = 60秒
					// 1时 = 60分
					const seconds1 = Math.floor((diffMs1 / 1000) % 60);
					const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60);
					const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60));

					this.peisongTime = `${fmt(hours1)}时${fmt(minutes1)}分${fmt(seconds1)}秒`;
				}
				this.$refs.returnPopup.open('bottom');
			},
			returnPopupPropBuy(item) {
				this.payData = item;
				if (this.payData.shopMakeTime != null) {
					const date1 = new Date(this.payData.deliveryInfo.acceptTime);
					const date2 = new Date(this.payData.shopMakeTime);

					// 2. 计算毫秒差值 (取绝对值，防止结果为负数)
					let diffMs = Math.abs(date2 - date1);

					// 3. 数学换算
					// 1秒 = 1000毫秒
					// 1分 = 60秒
					// 1时 = 60分
					const seconds = Math.floor((diffMs / 1000) % 60);
					const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
					const hours = Math.floor(diffMs / (1000 * 60 * 60));

					// 4. 格式化输出 (可选：补零操作，例如 9秒 -> 09秒)
					const fmt = (num) => num.toString().padStart(2, '0');

					this.shopTime = `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`;

					const date3 = new Date();

					// 2. 计算毫秒差值 (取绝对值，防止结果为负数)
					let diffMs1 = Math.abs(date3 - date2);

					// 3. 数学换算
					// 1秒 = 1000毫秒
					// 1分 = 60秒
					// 1时 = 60分
					const seconds1 = Math.floor((diffMs1 / 1000) % 60);
					const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60);
					const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60));

					this.peisongTime = `${fmt(hours1)}时${fmt(minutes1)}分${fmt(seconds1)}秒`;
				}
				this.$refs.returnPopupBuy.open('bottom');
			},
			returnOrder() {
				/* if(this.sellTime == 5 && this.remark == ""){
					that.tui.toast("请填写备注");
					return
				} */
				this.$refs.returnPopup.close();
				let item = this.payData
				let that = this
				that.tui.request("/mall/order/cancel", "POST", {
					refundType: this.refundType,
					refundTypeStatus: this.refundTypeStatus,
					orderId: item.id,
					userId: uni.getStorageSync('id')
				}, false, true).then((res) => {
					if (res.code == 200) {
						that.tui.toast("取消订单成功");
						that.getOrderDetail(item.id)
						that.$forceUpdate();
					} else {
						that.tui.toast(res.message);
						return;
					}
					uni.hideLoading();
				}).catch((res) => {});
			},
			returnOrderBuy() {
				this.$refs.returnPopupBuy.close();
				let item = this.payData
				let that = this
				that.tui.request("/mall/order/cancel", "POST", {
					refundType: 3,
					refundTypeStatus: 4,
					orderId: item.id,
					userId: uni.getStorageSync('id')
				}, false, true).then((res) => {
					if (res.code == 200) {
						that.tui.request("/app/shop/getShopInfoById", "POST", {
							id: that.payData.shopId,
							regionId: JSON.parse(uni.getStorageSync('area')).id
						}, false, true).then((res1) => {
							if (res1.code == 200) {
								uni.hideLoading();
								// 类似普通订单结算逻辑
								let cartItems = [];
								for (let i = 0; i < that.payData.goodsList.length; i++) {
									let productPrice = that.payData.goodsList[i].price
									for (let a = 0; a < res1.result.products.length; a++) {
										if (res1.result.products[a].id == that.payData.goodsList[i]
											.productId) {
											let priceToUse = 0;
											if (res1.result.products[a].attributeListPrice) {
												try {
													let pObj = typeof res1.result.products[a]
														.attributeListPrice === 'string' ? JSON.parse(res1
															.result.products[a].attributeListPrice) :
														res1.result.products[a].attributeListPrice;
													if (Array.isArray(pObj) && pObj.length > 0) {
														priceToUse = parseFloat(pObj[0].specPrice);
													} else {
														for (let k in pObj) {
															priceToUse = parseFloat(pObj[k].specPrice);
															break;
														}
													}
												} catch (e) {}
											}
											productPrice = priceToUse
										}
									}
									that.payData.goodsList[i].id = that.payData.goodsList[i].productId
									let specStr = that.payData.goodsList[i].specs;
									let cartId = that.payData.goodsList[i].productId + '_' + specStr;
									cartItems.push({
										cartId: cartId,
										item: that.payData.goodsList[i],
										specs: JSON.parse(that.payData.goodsList[i].specs),
										quantity: that.payData.goodsList[i].quantity,
										price: productPrice.toFixed(2)
									});
								}
								uni.navigateTo({
									url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(
											JSON.stringify(cartItems)) +
										'&shopItem=' + encodeURIComponent(JSON.stringify(res1
											.result.shop)) + '&packageFee=' +
										that.payData.packageFee
								});
							} else {
								that.tui.toast(res.message);
								return;
							}
							uni.hideLoading();
						}).catch((res1) => {});
					} else {
						that.tui.toast(res.message);
						return;
					}
					uni.hideLoading();
				}).catch((res) => {});
			},
			refreah(item) {
				this.getOrderDetail(item.id)
				this.$forceUpdate();
			},
			returnProducts(item) {
				uni.redirectTo({
					url: '/package1/order/returnOrder?order=' + encodeURIComponent(JSON.stringify(item))
				});
			},
			getOrderDetail(id) {
				this.pintuan = false;
				let that = this
				that.tui.request("/mall/order/detail/" + id, "GET", {}, false, true).then((res) => {
					if (res.code == 200) {
						that.orderDetail = res.result;
						if (that.orderDetail.mallRefundRecord != null && that.orderDetail.mallRefundRecord.length >
							0) {
							for (let i = 0; i < that.orderDetail.mallRefundRecord.length; i++) {
								if (that.orderDetail.mallRefundRecord[i].status >= 3) {
									that.hasRefund = true
								}
							}
						}
						if (that.orderDetail.groupInfo) {
							//还没有拼团成功拼团状态 0:拼团中 1:拼团成功 2:拼团失败 3:面对面团(不公开)
							if (that.orderDetail.groupInfo.status != 1 && that.orderDetail.groupInfo.status != 2) {
								that.pintuan = true;
								that.tui.request("/app/shop/getShopInfoById", "POST", {
									id: that.orderDetail.shopId,
									regionId: JSON.parse(uni.getStorageSync('area')).id
								}, false, true).then((res1) => {
									if (res1.code == 200) {
										that.shopItem = res1.result.shop
									} else {
										that.tui.toast(res1.message);
										return;
									}

								}).catch((res1) => {});
							}
						}
						that.orderDetail.userCouponNum = 0
						if (that.orderDetail.userCoupon.length > 0) {
							for (let i = 0; i < that.orderDetail.userCoupon.length; i++) {
								that.orderDetail.userCouponNum += Number(that.orderDetail.userCoupon[i]
									.discountAmount)
							}
						}
						that.$forceUpdate();
					} else {
						that.tui.toast(res.message)
						return
					}
				}).catch((res) => {})
				uni.hideLoading();
			},
			goAssignWorker() {
				let shopAreaId = this.orderDetail.getAreaId || '';
				let putAreaId = this.orderDetail.putAreaId || '';
				uni.navigateTo({
					url: `/package1/index/deliveryPersonList?shopAreaId=${shopAreaId}&putAreaId=${putAreaId}`
				});
			},
			handleWorkerSelected(worker) {
				let that = this;
				uni.showModal({
					title: '指派配送员',
					content: `是否选取配送员「${worker.workerName || '未知'}」？`,
					success: function(res) {
						if (res.confirm) {
							that.reassignWorker(worker);
						}
					}
				});
			},
			reassignWorker(worker) {
				let that = this;
				let deliveryId = '';
				if (that.orderDetail.deliveryInfo && that.orderDetail.deliveryInfo.id) {
					deliveryId = that.orderDetail.deliveryInfo.id;
				}
				that.tui.request("/mall/delivery/reassignWorker", "POST", {
					deliveryId: deliveryId,
					newWorkerId: worker.workerId,
					newWorkerName: worker.workerName,
					newWorkerPhone: worker.mobile
				}, false, true).then((res) => {
					if (res.code == 200) {
						that.tui.toast("指派配送员成功");
						that.getOrderDetail(that.orderId);
						that.$forceUpdate();
					} else {
						that.tui.toast(res.message || '指派配送员失败');
					}
				}).catch((err) => {
					that.tui.toast('请求失败，请重试');
				});
			},
			openAddFeePopup() {
				this.additionalFee = '';
				this.$refs.addFeePopup.open('bottom');
			},
			submitAddFee() {
				let fee = parseFloat(this.additionalFee);
				if (isNaN(fee) || fee <= 0) {
					this.tui.toast('请输入有效的金额');
					return;
				}
				// 关闭输入弹窗，生成随机订单号，打开支付弹窗
				this.$refs.addFeePopup.close();
				const now = Date.now(); // 获取当前时间戳 (13位)
				const randomPart = Math.floor(Math.random() * 1000000); // 6位随机数
				//this.addFeeTradeNo = `${now}${randomPart.toString().padStart(6, '0')}`;
				setTimeout(() => {
					this.$refs.addFeePayPopup.open('bottom');
				}, 300);
			},
			addFeeWxPayment() {
				let that = this;
				let fee = parseFloat(this.additionalFee);
				if (!fee || fee <= 0) return;
				let amountInCents = Math.round(fee * 100);

				this.tui.request("/api/wechat/pay/unified-order", "POST", {
					openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',
					amount: amountInCents,
					description: '增加配送佣金',
					outTradeNo: that.orderDetail.id
				}, false, false).then((res) => {
					if (res.code == 200) {
						uni.requestPayment({
							provider: 'wxpay',
							timeStamp: res.timeStamp,
							nonceStr: res.nonceStr,
							package: res.package,
							signType: res.signType,
							paySign: res.paySign,
							success: function(res2) {
								that.$refs.addFeePayPopup.close();
								that.getOrderDetail(that.orderId);
								that.$forceUpdate();
							},
							fail: function(err) {
								that.tui.toast('支付失败取消');
							}
						});
					} else {
						// 模拟支付成功(用于测试环境)
						if (res.code == 404 || res.code == 500 || res.code == 400 || !res.code) {
							that.$refs.addFeePayPopup.close();
							uni.showToast({
								title: '支付成功(模拟)',
								icon: 'none'
							});
							setTimeout(() => {
								that.callAddFeeApi();
							}, 1500);
						} else {
							that.tui.toast(res.message);
						}
					}
				});
			},
			callAddFeeApi() {
				let that = this;
				let fee = parseFloat(this.additionalFee);
				let deliveryId = '';
				if (that.orderDetail.deliveryInfo && that.orderDetail.deliveryInfo.id) {
					deliveryId = that.orderDetail.deliveryInfo.id;
				}
				that.tui.request("/mall/delivery/addFee", "POST", {
					deliveryId: deliveryId,
					additionalFee: fee,
					orderId: that.orderDetail.id,
					olditionalFee: that.orderDetail.deliveryFee ? that.orderDetail.deliveryFee : 0
				}, false, true).then((res) => {
					if (res.code == 200) {
						that.tui.toast("增加佣金成功");
						that.getOrderDetail(that.orderId);
						that.$forceUpdate();
					} else {
						that.tui.toast(res.message || '增加佣金失败');
					}
				}).catch((err) => {
					that.tui.toast('请求失败，请重试');
				});
			},
			back() {
				uni.navigateBack()
			}
		}

	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100%;
		font-size: 24rpx;
		background: linear-gradient(180deg, #ecfff7 0%, #f7fbf6 38%, #f9faf7 100%);
		color: #00231C;
	}

	.page1 {
		width: 100%;
		min-height: 100%;
		font-size: 24rpx;
		position: relative;
		background:
			radial-gradient(circle at 12% 8%, rgba(166, 255, 234, 0.48) 0, rgba(166, 255, 234, 0) 260rpx),
			radial-gradient(circle at 92% 18%, rgba(255, 221, 176, 0.26) 0, rgba(255, 221, 176, 0) 300rpx);
	}

	.title {
		background:
			linear-gradient(135deg, rgba(166, 255, 234, 0.86) 0%, rgba(245, 255, 249, 0.94) 52%, rgba(255, 246, 225, 0.9) 100%);
		width: 100%;
		height: 360rpx;
		border-bottom-left-radius: 46rpx;
		border-bottom-right-radius: 46rpx;
		box-shadow: 0 18rpx 44rpx rgba(0, 35, 28, 0.06);
	}

	.content {
		position: absolute;
		top: 150rpx;
		width: 100%;
		padding-bottom: 60rpx;
	}

	.title-sreach {
		width: 100%;
		display: flex;
		height: 260rpx;
		position: relative;
	}

	.back-btn {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 64rpx;
		height: 64rpx;
		margin-left: 14rpx;
		border-radius: 50%;
		background: rgba(255, 255, 255, 0.64);
		box-shadow: 0 10rpx 24rpx rgba(0, 35, 28, 0.08);
		text-align: center;
		line-height: 64rpx;
	}

	.box1 {
		width: 95%;
		margin: 0 auto 22rpx;
		background: rgba(255, 255, 255, 0.94);
		border: 1px solid rgba(255, 255, 255, 0.86);
		border-radius: 32rpx;
		padding: 24rpx;
		box-shadow: 0 18rpx 42rpx rgba(0, 35, 28, 0.07);
		box-sizing: border-box;
		overflow: hidden;
	}

	.content > .box1:first-child {
		background:
			radial-gradient(circle at 94% 4%, rgba(255, 221, 176, 0.2) 0, rgba(255, 221, 176, 0) 170rpx),
			linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 255, 251, 0.96) 100%);
		border-radius: 36rpx;
	}

	.goods-img {
		width: 160rpx;
		height: 160rpx;
		position: relative;
		border-radius: 24rpx;
		overflow: hidden;
		box-shadow: 0 12rpx 24rpx rgba(0, 35, 28, 0.08);

		img {
			width: 100%;
			background-size: 100%;
			height: 100%;
			border-radius: 24rpx;
		}
	}

	.goods-content {
		flex: 1;
		padding-left: 20rpx;
	}

	.goods-name {
		font-size: 32rpx;
		font-weight: 900;
		color: #243f38;
	}

	.goods-content-center {
		display: flex;
		margin: 16rpx 0;
		color: #7b8883;
	}

	.goods-content-bottom {
		display: flex;
		line-height: 56rpx;
		color: #6b7773;
	}

	.pintuan-left-price {
		width: 50%;
		text-align: right;
		font-weight: 700;
		color: #00231C;
	}

	.status-img {
		width: 96rpx;
		height: 96rpx;
		border-radius: 50%;
		background: linear-gradient(135deg, rgba(166, 255, 234, 0.72), rgba(255, 247, 215, 0.78));
		box-shadow: 0 12rpx 26rpx rgba(0, 35, 28, 0.08);
		display: flex;
		align-items: center;
		justify-content: center;

		img {
			width: 72rpx;
			height: 72rpx;
			background-size: 100%;
		}
	}

	.status-text {
		flex: 1;
		position: relative;
		padding-left: 20rpx;
	}

	.status-zhu {
		font-size: 36rpx;
		font-weight: 900;
		color: #243f38;
	}

	.status-fu {
		height: 50rpx;
		line-height: 50rpx;
		color: #52625d;
	}

	.status-address {
		font-weight: 700;
		color: #243f38;
	}

	.status-btn {
		position: absolute;
		top: 20rpx;
		right: 0;
		background: rgba(255, 255, 255, 0.72);
		width: 136rpx;
		height: 54rpx;
		text-align: center;
		line-height: 54rpx;
		border-radius: 999rpx;
		color: #60706c;
		border: 1px solid rgba(0, 35, 28, 0.1);
		font-size: 20rpx;
		font-weight: 800;
		box-shadow: 0 8rpx 18rpx rgba(0, 35, 28, 0.05);
	}

	.order-flow {
		width: 95%;
		margin: -4rpx auto 22rpx;
		padding: 22rpx 20rpx;
		border-radius: 30rpx;
		background: rgba(255, 255, 255, 0.78);
		box-shadow: 0 14rpx 34rpx rgba(0, 35, 28, 0.05);
		display: flex;
		align-items: center;
		box-sizing: border-box;
	}

	.flow-item {
		width: 92rpx;
		text-align: center;
		color: #9aa6a2;
		font-size: 20rpx;
		font-weight: 800;
	}

	.flow-dot {
		width: 24rpx;
		height: 24rpx;
		margin: 0 auto 8rpx;
		border-radius: 50%;
		background: #dfe7e3;
		box-shadow: inset 0 0 0 4rpx #fff;
	}

	.flow-item.active {
		color: #125e50;
	}

	.flow-item.active .flow-dot {
		background: linear-gradient(135deg, #a6ffea, #ffdf75);
		box-shadow: 0 6rpx 14rpx rgba(0, 191, 160, 0.18);
	}

	.flow-line {
		flex: 1;
		height: 6rpx;
		border-radius: 999rpx;
		background: #e5ece9;
		margin: 0 4rpx 34rpx;
	}

	.flow-line.active {
		background: linear-gradient(90deg, #a6ffea, #ffdf75);
	}

	.btn-box {
		height: auto;
		display: flex;
		width: 95%;
		margin: 0 auto 20rpx;
		gap: 18rpx;
		flex-wrap: wrap;
	}

	.btn {
		flex: 1;
		min-width: 260rpx;
		height: 92rpx;
		line-height: 92rpx;
		background: linear-gradient(135deg, #fff7d7 0%, #a6ffea 100%);
		font-size: 30rpx;
		border-radius: 999rpx;
		text-align: center;
		margin: 0;
		font-weight: 900;
		box-shadow: 0 14rpx 28rpx rgba(0, 191, 160, 0.12);
	}

	.box1 > view[style*="rgba(247, 248, 248"] {
		background: linear-gradient(180deg, rgba(250, 255, 252, 0.96) 0%, rgba(255, 255, 255, 0.9) 100%) !important;
		border: 1px solid rgba(166, 255, 234, 0.34);
		box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
	}

	.box1 > view[style*="line-height: 70rpx"] {
		color: #243f38;
	}

	.box1 > view[style*="height: 80rpx"] {
		border-bottom: 1px solid rgba(0, 35, 28, 0.045);
	}

	.box1 > view[style*="height: 80rpx"]:last-child {
		border-bottom: 0;
	}

	.box1 view[style*="color: #777"] {
		color: #87938f !important;
	}

	.box1 view[style*="color: #000"] {
		color: #243f38 !important;
	}

	.box1 view[style*="border-top: 1px solid #eee"] {
		border-top: 1px solid rgba(0, 35, 28, 0.08) !important;
	}

	.box1 view[style*="font-size: 32rpx"][style*="font-weight: 700"] {
		color: #0d4d42;
	}

	.box1 image,
	.box1 img {
		object-fit: cover;
	}

	.evaluate-content,
	.car-content,
	.guize-list,
	.pay-popup {
		border-radius: 36rpx 36rpx 0 0 !important;
		box-shadow: 0 -18rpx 44rpx rgba(0, 35, 28, 0.12);
	}

	.evaluate-content {
		background: linear-gradient(180deg, #ffffff 0%, #f7fffb 100%);
	}

	.evaluate-list {
		padding: 20rpx;
		border-radius: 28rpx;
		background: rgba(247, 255, 251, 0.8);
	}

	.img-popup-content {
		width: 600rpx;
		height: 800rpx;
		background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/73e684e3319c468d9252461ba3c9e95b.png') no-repeat;
		background-size: 100%;
	}

	.evaluate-content {
		width: 600rpx;
		height: 800rpx;
		background: #fff;
		border-radius: 20rpx;
		padding: 20rpx;
	}

	.title1 {
		background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/69c894452e924bedbb5a24bf978f47c7.png') no-repeat;
		width: 100%;
		height: 30%;
		background-size: 100%;
	}

	.title-sreach1 {
		width: 100%;
		display: flex;
		height: 200rpx;
		position: relative;
	}

	.back-btn1 {
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.box11 {
		width: 95%;
		margin: 0 auto 20rpx;
		background: #fff;
		border-radius: 20rpx;
		padding: 20rpx;
		position: absolute;
		top: 450rpx;
		left: 2.5%;
	}

	.goods-img1 {
		width: 160rpx;
		height: 160rpx;
		position: relative;

		img {
			width: 100%;
			background-size: 100%;
			height: 100%;
		}
	}

	.goods-content1 {
		flex: 1;
		padding-left: 20rpx;
	}

	.goods-name1 {
		font-size: 32rpx;
		font-weight: 900;
	}

	.goods-content-center1 {
		display: flex;
		margin: 16rpx 0;
		color: #777;
	}

	.pintuan-left-price1 {
		text-align: right;
		font-weight: 700;
		color: #000;
		display: flex;
		padding-right: 10px;
	}

	.goods-content-bottom {
		display: flex;
		line-height: 56rpx;
		color: #777;
	}

	.ziqu-xuanfu1 {
		position: absolute;
		top: 0;
		right: 0;
		background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
		border-top-right-radius: 20rpx;
		border-bottom-left-radius: 20rpx;
		font-weight: 700;
		font-size: 20rpx;
		height: 56rpx;
		width: 120rpx;
		text-align: center;
		line-height: 56rpx;
	}

	.weipincheng1 {
		width: 90rpx;
		height: 90rpx;
		background: #a6ffea;
		border-radius: 90rpx;
		text-align: center;
		font-size: 60rpx;
		font-weight: 700;
		margin-left: -6rpx;
		z-index: 97;
		color: #02fbdd;
		border: 1px solid #a6ffea;
		line-height: 80rpx;
		margin: 0 auto;
	}

	.kaituan11 {
		display: flex;
		height: 70rpx;
		font-size: 44rpx;
		font-weight: 700;
		margin-top: 20rpx;
	}

	.kaituan1-title1 {
		position: relative;
		margin-left: 20rpx;
	}

	.kaituan1-title11 {
		font-size: 24rpx;
		background: rgba(224, 255, 222, 0.65);
		border: 1px solid rgba(166, 255, 234, 1);
		border-radius: 20rpx;
		height: 44rpx;
		line-height: 38rpx;
		width: 280rpx;
		text-align: center;
		margin: 10rpx 0 0 20rpx;
	}

	.kaituan21 {
		display: flex;
		width: 90%;
		margin: 40rpx auto;
	}

	.kaituan221 {
		flex: 1;
	}

	.kaituan31 {
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		color: #777;
	}

	.kaituan41 {
		width: 95%;
		height: 100rpx;
		background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
		border-radius: 100rpx;
		text-align: center;
		line-height: 100rpx;
		font-size: 30rpx;
		font-weight: 700;
		margin: 20rpx auto;
	}

	.kaituan51 {
		margin: 80rpx 0 40rpx;
	}

	.evaluate-list {
		margin-top: 40rpx;
	}

	.eval-title {
		width: 100%;
		height: 80rpx;
		display: flex;
	}

	.eval-icon {
		height: 80rpx;
		width: 80rpx;

		img {
			width: 100%;
			height: 100%;
			background-size: 100%;
		}
	}

	.eval-name {
		margin-left: 20rpx;
	}

	.name1 {
		font-size: 28rpx;
		line-height: 50rpx;
		font-weight: 700;
	}

	.eval-rate {
		display: flex;
		margin: 20rpx 0 0 100rpx;
		height: 48rpx;
		line-height: 40rpx;
	}

	.eval-content {
		margin-left: 100rpx;
		font-size: 28rpx;
		color: #777;
		line-height: 48rpx;
	}

	.eval-img {
		display: flex;
		width: 100%;
		overflow-x: scroll;
		margin-top: 20rpx;

		img {
			width: 100rpx;
			height: 100rpx;
			background-size: 100%;
			margin-right: 20rpx;
		}
	}

	.car-close {
		width: 60rpx;
		height: 60rpx;
		position: absolute;
		top: -80rpx;
		right: 20rpx;
	}

	.car-title {
		height: 96rpx;
		line-height: 60rpx;
		margin: 0 auto;
		font-size: 28rpx;
		font-weight: 700;
	}

	.share-btn::after {
		border: 0;
	}
</style>