<template>
	<view :class="theme_view" class="container">
		<block v-if="detail != null">
			<view class="padding-horizontal-main padding-top-main">
				<!-- 地址 -->
				<view class="address-wrap" v-if="(detail.address_data || null) != null">
					<view class="top-tips">收货地址</view>
					<view class="address-info">
						<view class="info-wrap">
							<image class="icon" src="/static/icon_address.svg" mode="aspectFit"></image>
							<view class="info">
								<view class="base base1"> {{ detail.address_data.province_name || '' }}{{ detail.address_data.city_name || '' }}{{ detail.address_data.county_name || '' }}{{ detail.address_data.address || '' }} </view>
								<view class="base base2">
									<text v-if="detail.address_data.alias">{{ detail.address_data.alias }}</text>
									<text>{{ detail.address_data.name }}</text>
									<text>{{ detail.address_data.tel }}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- <view v-if="(detail.address_data || null) != null" class="address bg-white padding-horizontal-main padding-top-main border-radius-main spacing-mb">
                    <view class="address-base padding-top-xs padding-bottom oh">
                        <text v-if="(detail.address_data.alias || null) != null" class="address-alias round br-main cr-main bg-white margin-right-sm">{{ detail.address_data.alias }}</text>
                        <text>{{ detail.address_data.name }}</text>
                        <text class="fr">{{ detail.address_data.tel }}</text>
                    </view>
                    <view class="address-detail oh margin-bottom-main">
                        <image class="icon fl" :src="common_static_url + 'map-icon.png'" mode="widthFix"></image>
                        <view class="text fr">
                            <text>{{ detail.address_data.province_name }}{{ detail.address_data.city_name }}{{ detail.address_data.county_name }}{{ detail.address_data.address }}</text>
                            <text v-if="(detail.address_data.lng || 0) != 0 && (detail.address_data.lat || 0) != 0" class="address-map-submit cr-base br round bg-white margin-left-sm text-size-xs" @tap="address_map_event">{{$t('user-order-detail.user-order-detail.7lp6gw')}}</text>
                        </view>
                    </view>
                    <view v-if="(detail.address_data.extraction_contact_name || null) != null || (detail.address_data.extraction_contact_tel || null) != null || (detail.address_data.appoint_time || null) != null" class="padding-vertical-main br-t-dashed">
                        <view>
                            <text v-if="(detail.address_data.extraction_contact_name || null) != null" class="margin-right-xxl">{{detail.address_data.extraction_contact_name}}</text>
                            <text v-if="(detail.address_data.extraction_contact_tel || null) != null">{{detail.address_data.extraction_contact_tel}}</text>
                        </view>
                        <view v-if="(detail.address_data.tel || null) != null" class="cr-red">{{detail.address_data.appoint_time}}</view>
                    </view>
                    <view class="address-divider spacing-mb"></view>
                </view> -->

				<!-- 商品列表 -->
				<view class="goods bg-white padding-main" style="border-radius: 8px 8px 0 0">
					<view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.7f8p26') }}</view>
					<view v-for="(item, index) in detail.items" :key="index" class="goods-item br-b-dashed oh padding-main">
						<view :data-value="item.goods_url" @tap="url_event" class="cp">
							<image class="goods-image fl radius" :src="item.images" mode="aspectFill"></image>
							<view class="goods-base pr">
								<view class="multi-text">{{ item.title }}</view>
								<view v-if="item.spec != null" class="margin-top-sm">
									<block v-for="(sv, si) in item.spec" :key="si">
										<text v-if="si > 0" class="cr-grey padding-left-xs padding-right-xs">;</text>
										<text class="cr-grey">{{ sv.value }}</text>
									</block>
								</view>
								<view class="margin-top-sm">
									<text class="fw-b" v-if="detail && detail.currency_data">{{ detail.currency_data.currency_symbol }}{{ item.price }}</text>
									<text class="margin-left-sm">x{{ item.buy_number }}</text>
								</view>
								<view v-if="detail.is_can_launch_aftersale == 1 && (item.orderaftersale_btn_text || null) != null" class="orderaftersale-btn-text cr-blue pa bg-white" @tap.stop="orderaftersale_event" :data-oid="detail.id" :data-did="item.id">{{ item.orderaftersale_btn_text }}</view>
							</view>
						</view>
					</view>
					<!-- <view class="padding-top-main tr cr-base text-size">
						<text>
							{{ $t('user-order-detail.user-order-detail.423rmr') }}
							<text class="fw-b">
								{{ detail.buy_number_count }}
							</text>
							{{ $t('user-order-detail.user-order-detail.41ty94') }}
							<text class="sales-price margin-right-xs">
								{{ detail.currency_data.currency_symbol }}
								{{ detail.total_price }}
							</text>
						</text>
					</view> -->
				</view>

				<!-- 服务信息 -->
				<view v-if="(detail.service_data || null) != null" class="service-data panel-item padding-main border-radius-main bg-white spacing-mb">
					<view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.567ygf') }}</view>
					<view class="panel-content oh padding-top-main">
						<view class="item br-b-dashed oh padding-vertical-main">
							<view class="title fl padding-right-main cr-grey">{{ $t('user-order-detail.user-order-detail.gsfw4d') }}</view>
							<view class="content fl br-l padding-left-main">{{ detail.service_data.service_name }}</view>
						</view>
						<view class="item br-b-dashed oh padding-vertical-main">
							<view class="title fl padding-right-main cr-grey">{{ $t('user-order-detail.user-order-detail.6ygfew') }}</view>
							<view class="content fl br-l padding-left-main" :data-value="detail.service_data.service_mobile" @tap="text_copy_event">
								<text>{{ detail.service_data.service_mobile }}</text>
								<text class="bg-white br-green cr-green round padding-horizontal-sm text-size-xs margin-left-sm">{{ $t('common.copy') }}</text>
							</view>
						</view>
						<view v-if="(detail.service_data.service_duration_minute_text || null) != null" class="item br-b-dashed oh padding-vertical-main">
							<view class="title fl padding-right-main cr-grey">{{ $t('user-order-detail.user-order-detail.67ujfr') }}</view>
							<view class="content fl br-l padding-left-main">{{ detail.service_data.service_duration_minute_text }}</view>
						</view>
						<view class="item br-b-dashed oh padding-vertical-main">
							<view class="title fl padding-right-main cr-grey">{{ $t('common.service_time') }}</view>
							<view class="content fl br-l padding-left-main">
								<view v-if="(detail.service_data.service_start_time || null) != null">{{ detail.service_data.service_start_time }}</view>
								<view v-if="(detail.service_data.service_end_time || null) != null">{{ detail.service_data.service_end_time }}</view>
							</view>
						</view>
					</view>
				</view>

				<!-- 虚拟销售数据 -->
				<view v-if="(site_fictitious || null) != null" class="site-fictitious panel-item padding-horizontal-main padding-top-main bg-white">
					<view class="br-b padding-bottom-main fw-b text-size">{{ site_fictitious.title || $t('user-order-detail.user-order-detail.y9woor') }}</view>
					<view class="panel-content oh padding-top-main br-b">
						<view v-if="(site_fictitious.tips || null) != null" class="tips-value radius padding-main margin-bottom-main">
							<mp-html :content="site_fictitious.tips" />
						</view>
						<view v-for="(item, index) in detail.items" :key="index" style="display: flex">
							<image class="left-image br fl radius" :src="item.images" mode="aspectFill" style="flex-shrink: 0"></image>
							<view class="right-value" style="padding: 0 10px">
								<view v-if="(item.spec_text || null) != null" class="text-base fw-b margin-bottom-sm text-size-xs">{{ item.spec_text }}</view>
								<mp-html v-if="(item.fictitious_goods_value || null) != null" :content="item.fictitious_goods_value" />
								<text v-else class="cr-grey text-size-xs">{{ $t('user-order-detail.user-order-detail.7xtnjt') }}</text>
							</view>
							<view class="copy" v-if="!item.account" :data-value="item.fictitious_goods_value_str" @tap="text_copy_event">复制</view>
						</view>
					</view>
				</view>

				<!-- 自提信息 -->
				<view v-if="(detail.extraction_data || null) != null" class="site-extraction panel-item padding-main bg-white">
					<view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.7dikfm') }}</view>
					<view class="panel-content oh padding-top-main">
						<image v-if="(detail.extraction_data.images || null) != null" class="qrcode br radius margin-bottom-sm" :src="detail.extraction_data.images" mode="aspectFill"></image>
						<view>
							<text>{{ $t('user-order-detail.user-order-detail.o38952') }}</text>
							<text class="radius bg-green cr-white padding-left-sm padding-right-sm">{{ detail.extraction_data.code || $t('user-order-detail.user-order-detail.hpq62x') }}</text>
						</view>
					</view>
				</view>

				<!-- 订单基础数据 -->
				<view v-if="detail_list.length > 0" class="panel-item padding-main bg-white order-wrap" :class="{ all: isCheckOrderAll }">
					<!-- <view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.0f26j2') }}</view> -->
					<!-- <view class="order-no-wrap">
						<text class="left">配送服务:</text>
						<view class="right">
							<text>复制</text>
						</view>
					</view> -->
					<view class="order-no-wrap">
						<text class="left">订单编号:</text>
						<view class="right" :data-value="detail.order_no" @tap="text_copy_event">
							<text class="t">{{ detail.order_no }}</text>
							<text class="t">|</text>
							<text>复制</text>
						</view>
					</view>
					<view class="panel-content oh">
						<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
							<view class="title fl padding-right-main cr-grey">{{ item.name }}</view>
							<view v-if="(item.is_copy || 0) == 1" class="content fl br-l padding-left-main" :data-value="item.value" @tap="text_copy_event">
								<text>{{ item.value }}</text>
								<text class="bg-white br-green cr-green round padding-horizontal-sm text-size-xs margin-left-sm">{{ $t('common.copy') }}</text>
							</view>
							<view v-else class="content fl br-l padding-left-main">{{ item.value }}</view>
						</view>
					</view>
				</view>
				<view class="order-check spacing-mb" @click="isCheckOrderAll = !isCheckOrderAll">
					<text class="t">{{ !isCheckOrderAll ? '查看全部' : '收起信息' }}</text>
					<image class="icon" :class="{ active: isCheckOrderAll }" src="/static/icon_down_arrow.svg" mode="aspectFit"></image>
				</view>

				<!-- 支付账户填错后重新提交模块 -->
				<view class="content-textarea-container padding-main border-radius-main bg-white spacing-mb" v-if="detail && detail.is_account">
					<view class="content">
						<input type="text" class="input" placeholder="请输入充值账户" placeholder-class="input_placeholder" v-model="account" />
					</view>
					<view class="btn-wrap">
						<view class="btn" @click="replayAccountHandle"> 重新提交充值账户 </view>
					</view>
				</view>

				<!-- 支付选择 -->
				<view class="payment-list border-radius-main bg-white oh padding-main spacing-mb" v-if="detail && detail.status == 1">
					<view v-for="(item, index) in payment_list" :key="index">
						<view class="item flex-row jc-sb align-c" :data-value="item.id" :data-index="index" @tap="payment_event">
							<view class="item-content pr flex-1 flex-width">
								<image v-if="(item.logo || null) != null" class="icon margin-right-sm va-m radius" :src="item.logo" mode="widthFix"></image>
								<text class="va-m">{{ item.name }}</text>
								<text v-if="(item.tips || null) !== null" class="pay-tips">{{ item.tips }}</text>
							</view>
							<view>
								<iconfont :name="payment_id == item.id ? 'icon-zhifu-yixuan cr-red' : 'icon-zhifu-weixuan'" size="40rpx"></iconfont>
							</view>
						</view>
					</view>
				</view>

				<!-- 快递信息 -->
				<view v-if="(detail.express_data || null) != null && detail.express_data.length > 0" class="express-data panel-item padding-main border-radius-main bg-white spacing-mb">
					<view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.0876xf') }}</view>
					<view class="panel-content">
						<view v-for="(item, index) in detail.express_data" :key="index" class="item br-b-dashed oh padding-vertical-main">
							<view class="item oh padding-vertical-main">
								<view class="title fl padding-right-main cr-grey">{{ $t('user-order-detail.user-order-detail.12d445') }}</view>
								<view class="content fl br-l padding-left-main" :data-value="item.express_name" @tap="text_copy_event">{{ item.express_name }}</view>
							</view>
							<view class="item oh padding-vertical-main">
								<view class="title fl padding-right-main cr-grey">{{ $t('user-order-detail.user-order-detail.2byl8l') }}</view>
								<view class="content fl br-l padding-left-main" :data-value="item.express_number" @tap="text_copy_event">
									<text>{{ item.express_number }}</text>
									<text class="bg-white br-green cr-green round padding-horizontal-sm text-size-xs margin-left-sm">{{ $t('common.copy') }}</text>
								</view>
							</view>
							<view v-if="(item.note || null) != null" class="item oh padding-vertical-main">
								<view class="title fl padding-right-main cr-grey">{{ $t('common.note') }}:</view>
								<view class="content fl br-l padding-left-main" :data-value="item.note" @tap="text_copy_event">{{ item.note }}</view>
							</view>
						</view>
					</view>
				</view>

				<!-- 扩展数据 -->
				<view v-if="extension_data.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
					<view class="br-b padding-bottom-main fw-b text-size">{{ $t('user-order-detail.user-order-detail.ct34n5') }}</view>
					<view class="panel-content oh">
						<view v-for="(item, index) in extension_data" :key="index" class="item br-b-dashed oh padding-vertical-main cr-base">
							<text>{{ item.name }}</text>
							<text v-if="(item.tips || null) != null">：{{ item.tips }}</text>
						</view>
					</view>
				</view>
			</view>

			<!-- 结尾 -->
			<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
		</block>
		<block v-else>
			<!-- 提示信息 -->
			<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
		</block>

		<!-- 支付组件 -->
		<component-payment r ef="payment" :propCurrencySymbol="payment_currency_symbol" :propPayUrl="pay_url" :propQrcodeUrl="qrcode_url" :propPaymentList="payment_list" propPayDataKey="ids" :propPaymentId="payment_id" :propDefaultPaymentId="default_payment_id" :propTempPayValue="temp_pay_value" :propTempPayIndex="temp_pay_index" :propPayPrice="pay_price" :propIsShowPayment="is_show_payment_popup" @close-payment-popup="payment_popup_event_close" @pay-success="order_item_pay_success_handle"> </component-payment>

		<!-- 公共 -->
		<component-common ref="common"></component-common>

		<!-- 底部支付 -->
		<view class="footer-wrap" v-if="detail && detail.status == 1">
			<view class="footer-cont">
				<view class="contact">
					<!-- 客服 -->
					<component-online-service :propIsGoods="true" :propIsNav="true" :propCard="true" :propTitle="detail.title" :propImg="detail.images" :propPath="'/pages/goods-detail/goods-detail?id=' + detail.id" :propChatUrl="''"></component-online-service>
				</view>
				<view class="right">
					<div class="info">
						<text class="num" v-if="detail && detail.buy_number_count">共{{ detail.buy_number_count }}件</text>
						<text class="t">合计:</text>
						<text class="symbol" v-if="detail && detail.currency_data">{{ detail.currency_data.currency_symbol }}</text>
						<text class="p" v-if="detail && detail.total_price">{{ detail.total_price }}</text>
					</div>
					<view class="btn" @click="pay_event">
						<text class="text">继续付款</text>
						<text class="time">剩余：{{ remainingTime }}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	const app = getApp();
	import dayjs from 'dayjs';
	import componentCommon from '@/components/common/common';
	import componentNoData from '@/components/no-data/no-data';
	import componentBottomLine from '@/components/bottom-line/bottom-line';
	import componentPayment from '@/components/payment/payment';
	import componentOnlineService from '@/components/online-service/online-service';
	var common_static_url = app.globalData.get_static_url('common');
	export default {
		data() {
			return {
				theme_view: app.globalData.get_theme_value_view(),
				common_static_url: common_static_url,
				params: null,
				data_list_loding_status: 1,
				data_list_loding_msg: '',
				data_bottom_line_status: false,
				detail: null,
				detail_list: [],
				extension_data: [],
				site_fictitious: null,
				isCheckOrderAll: false,
				payment_list: [],
				payment_currency_symbol: app.globalData.currency_symbol(),
				pay_url: '',
				qrcode_url: '',
				payment_list: [],
				default_payment_id: '',
				payment_id: '',
				plugins_coin_payment_id: '',
				pay_price: '',
				is_show_payment_popup: false,
				order_select_ids: '',
				temp_pay_value: '',
				temp_pay_index: 0,
				remainingTime: '',
				intervalId: null,
				account: '',
			};
		},

		components: {
			componentCommon,
			componentNoData,
			componentBottomLine,
			componentPayment,
			componentOnlineService,
		},

		onLoad(params) {
			// 调用公共事件方法
			app.globalData.page_event_onload_handle(params);

			// 设置参数
			this.setData({
				params: params,
			});
		},

		onShow() {
			// 调用公共事件方法
			app.globalData.page_event_onshow_handle();

			// 数据加载
			this.init();

			// 公共onshow事件
			if ((this.$refs.common || null) != null) {
				this.$refs.common.on_show();
			}

			// 分享菜单处理
			app.globalData.page_share_handle();
		},

		// 下拉刷新
		onPullDownRefresh() {
			this.init();
		},

		methods: {
			// 重新提交虚拟账户
			replayAccountHandle() {
				if (!this.account) {
					app.globalData.showToast('请输入您要充值的账户');
					return false;
				}

				uni.showLoading({
					title: '提交中...',
					mask: true,
				});

				uni.request({
					url: app.globalData.get_request_url('resetaccount', 'order'),
					method: 'POST',
					data: {
						order_id: this.detail.id,
						account: this.account,
					},
					dataType: 'json',
					success: (res) => {
						console.log('getShowAccount===', res);
						uni.hideLoading();
						if (res.data.code == 0) {
							this.detail.is_account = 0;
							app.globalData.showToast('提交成功');
							this.init();
						} else {
							this.setData({
								data_list_loding_status: 2,
								data_list_loding_msg: res.data.msg,
							});
						}
					},
					fail: (err) => {
						uni.hideLoading();
					},
				});
			},
			// 获取剩余支付时间
			updateRemainingTime() {
				const now = dayjs();
				const due = dayjs.unix(this.detail.end_time);
				const remaining = due.diff(now, 'millisecond');

				if (remaining > 0) {
					let seconds = Math.floor(remaining / 1000) % 60;
					let minutes = Math.floor(remaining / (1000 * 60)) % 60;
					let hours = Math.floor(remaining / (1000 * 60 * 60));

					// 将时、分、秒格式化为两位数
					seconds = String(seconds).padStart(2, '0');
					minutes = String(minutes).padStart(2, '0');
					hours = String(hours).padStart(2, '0');

					this.remainingTime = `${hours}:${minutes}:${seconds}`;
				} else {
					clearInterval(this.intervalId);
					this.remainingTime = '支付已过期';
					uni.request({
						url: app.globalData.get_request_url('orderclose', 'crontab'),
						method: 'GET',
						data: {},
						dataType: 'json',
						success: (res) => {
							this.init();
						},
					});
				}
			},
			// 设置支付参数
			pay_event() {
				this.temp_pay_value = this.detail.id;
				this.is_show_payment_popup = true;
			},
			// 支付成功数据设置
			// 订单完成回调
			order_item_pay_success_handle(data) {
				// var order_ids_arr = data.order_id.toString().split(',');
				// var temp_data_list = this.data_list;
				// for (var i in temp_data_list) {
				//     if (order_ids_arr.indexOf(temp_data_list[i]['id'].toString()) != -1) {
				//         temp_data_list[i]['operate_data']['is_pay'] = 0;
				//         temp_data_list[i]['operate_data']['is_cancel'] = 0;
				//         switch (parseInt(temp_data_list[i]['order_model'])) {
				//             // 销售,同城模式
				//             case 0:
				//             case 1:
				//                 temp_data_list[i]['status'] = 2;
				//                 temp_data_list[i]['status_name'] = this.$t('user.user.66714e');
				//                 break;
				//             // 自提模式
				//             case 2:
				//                 temp_data_list[i]['status'] = 2;
				//                 temp_data_list[i]['status_name'] = this.$t('user-order.user-order.hp123x');
				//                 break;
				//             // 虚拟模式
				//             case 3:
				//                 temp_data_list[i]['status'] = 3;
				//                 temp_data_list[i]['status_name'] = this.$t('order.order.q820hx');
				//                 break;
				//         }
				//     }
				// }
				// this.setData({
				//     data_list: temp_data_list,
				// });
				this.init();
			},
			// 支付弹窗关闭
			payment_popup_event_close(e) {
				this.setData({
					is_show_payment_popup: false,
				});
			},
			// 支付方式选择
			payment_event(e) {
				var value = e.currentTarget.dataset.value;
				this.setData({
					payment_id: this.payment_id == value,
					plugins_coin_payment_id: 0,
				});
			},
			// 获取数据
			init() {
				this.setData({
					data_list_loding_status: 1,
					pay_url: app.globalData.get_request_url('getpayment', 'xo'),
					qrcode_url: app.globalData.get_request_url('paycheck', 'order'),
				});

				// 获取支付列表数据
				uni.request({
					url: app.globalData.get_request_url('index', 'order'),
					method: 'POST',
					data: {
						page: 1,
						keywords: '',
						status: 1,
						is_more: 1,
					},
					dataType: 'json',
					success: (res) => {
						var default_payment_id = parseInt(res.data.data.payment_list[0].id);
						this.original_payment_list = res.data.data.payment_list || [];
						this.payment_list = res.data.data.payment_list || [];
						this.payment_id = default_payment_id;
					},
				});

				uni.request({
					url: app.globalData.get_request_url('detail', 'order'),
					method: 'POST',
					data: {
						id: this.params.id,
					},
					dataType: 'json',
					success: (res) => {
						uni.stopPullDownRefresh();
						if (res.data.code == 0) {
							var data = res.data.data;

							this.setData({
								detail: data.data,
								pay_price: data.data.total_price,
								order_select_ids: data.data.id,
								detail_list: [
									// { name: this.$t('user-order-detail.user-order-detail.n18sd2'), value: data.data.order_no || '', is_copy: 1 },
									{ name: this.$t('user-order-detail.user-order-detail.yxwu8n'), value: data.data.status_name || '' },
									{ name: this.$t('user-order-detail.user-order-detail.346376'), value: data.data.warehouse_name || '' },
									{ name: this.$t('user-order-detail.user-order-detail.io6p5k'), value: data.data.order_model_name || '' },
									{ name: this.$t('user-order-detail.user-order-detail.23qj7m'), value: data.data.pay_status_name || '' },
									{ name: this.$t('user-order-detail.user-order-detail.vg4jb1'), value: data.data.price || '' },
									{ name: this.$t('user-order-detail.user-order-detail.2y7l13'), value: data.data.total_price || '' },
									{ name: this.$t('user-order-detail.user-order-detail.6ub2j0'), value: data.data.preferential_price || '' },
									{ name: this.$t('user-order-detail.user-order-detail.8b18q8'), value: data.data.increase_price || '' },
									{ name: this.$t('user-order-detail.user-order-detail.516tlr'), value: data.data.pay_price || '' },
									{ name: this.$t('user-order-detail.user-order-detail.0e1sfs'), value: (data.data.payment_name || '') + ((data.data.is_under_line_text || null) == null || (data.data.payment_name || null) == null ? '' : '（' + data.data.is_under_line_text + '）') },
									{ name: this.$t('user-order-detail.user-order-detail.2b5fc8'), value: data.data.user_note || '' },
									{ name: this.$t('user-order-detail.user-order-detail.h2c78h'), value: data.data.add_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.9vivhl'), value: data.data.confirm_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.wn83rn'), value: data.data.pay_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.1674dc'), value: data.data.delivery_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.0i938r'), value: data.data.collect_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.1jpv4n'), value: data.data.cancel_time || '' },
									{ name: this.$t('user-order-detail.user-order-detail.8o2of3'), value: data.data.close_time || '' },
								],
								extension_data: data.data.extension_data || [],
								site_fictitious: data.site_fictitious || null,
								data_list_loding_status: 3,
								data_bottom_line_status: true,
								data_list_loding_msg: '',
							});
							if (this.detail.order_model == 3 && this.detail.items[0].account) {
								this.detail_list.unshift({
									name: '充值账户',
									value: this.detail.items[0].account,
								});
							}
							if (this.detail.status == 1) {
								this.updateRemainingTime();
								this.intervalId = setInterval(this.updateRemainingTime, 1000);
							}
						} else {
							this.setData({
								data_list_loding_status: 2,
								data_bottom_line_status: false,
								data_list_loding_msg: res.data.msg,
							});
							if (app.globalData.is_login_check(res.data, this, 'init')) {
								app.globalData.showToast(res.data.msg);
							}
						}
					},
					fail: () => {
						uni.stopPullDownRefresh();
						self.setData({
							data_list_loding_status: 2,
							data_bottom_line_status: false,
							data_list_loding_msg: this.$t('common.internet_error_tips'),
						});
						app.globalData.showToast(this.$t('common.internet_error_tips'));
					},
				});
			},

			// 售后订单事件
			orderaftersale_event(e) {
				var oid = e.currentTarget.dataset.oid || 0;
				var did = e.currentTarget.dataset.did || 0;
				if (oid == 0 || did == 0) {
					app.globalData.showToast(this.$t('user-order-detail.user-order-detail.5k6k56'));
					return false;
				}

				// 进入售后页面
				app.globalData.url_open('/pages/user-orderaftersale-detail/user-orderaftersale-detail?oid=' + oid + '&did=' + did);
			},

			// 地图查看
			address_map_event(e) {
				if ((this.detail.address_data || null) == null) {
					app.globalData.showToast(this.$t('user-order-detail.user-order-detail.i876o3'));
					return false;
				}

				// 打开地图
				var data = this.detail.address_data;
				var name = data.alias || data.name || '';
				var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
				app.globalData.open_location(data.lng, data.lat, name, address);
			},

			// url事件
			url_event(e) {
				app.globalData.url_event(e);
			},

			// 文本复制
			text_copy_event(e) {
				if ((e.currentTarget.dataset.value || null) != null) {
					app.globalData.text_copy_event(e);
				}
			},
		},
	};
</script>
<style>
	@import '@/pages/buy/buy.css';
	@import './user-order-detail.css';
</style>

<style scoped lang="scss">
	$color: #ff723b;
	.address-wrap {
		background-color: $color;
		padding: 0 2px 2px;
		border-radius: 6px;
		margin-bottom: 12px;
		.top-tips {
			color: #fff;
			padding: 4px;
		}
		.address-info {
			padding: 10px;
			background-color: #fff;
			border-radius: 4px;
			.info-wrap {
				display: flex;
				align-items: center;
				.icon {
					$size: 60upx;
					width: $size;
					height: $size;
				}
				.info {
					flex: 1;
					display: flex;
					flex-direction: column;
					padding: 0 10px;
					.base1 {
						font-size: 32upx;
						font-weight: bold;
						color: #000;
					}
					.base2 {
						padding-top: 8px;
						color: #999;
						display: flex;
						gap: 6px;
					}
				}
				.edit-btn {
					padding: 4px 10px;
					border: 1upx solid $color;
					color: $color;
					border-radius: 100px;
				}
			}
			.no-info {
				display: flex;
				align-items: center;
				justify-content: space-between;
				.left {
					display: flex;
					align-items: center;
					.icon {
						$size: 60upx;
						width: $size;
						height: $size;
						margin-right: 6px;
					}
					.t1 {
						font-size: 32upx;
						color: #000;
						font-weight: bold;
					}
				}
				.arrow {
					$size: 26upx;
					width: $size;
					height: $size;
				}
			}
		}
	}

	.order-wrap {
		height: 20px;
		overflow: hidden;
		&.all {
			height: auto;
		}
		.order-no-wrap {
			display: flex;
			justify-content: space-between;
			border-bottom: 1upx solid #ececec;
			padding-bottom: 12px;
			color: #000;
			.right {
				display: flex;
				gap: 10px;
				.t {
					color: #999;
				}
			}
		}
	}
	.order-check {
		background-color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 12px 0;
		border-radius: 0 0 8px 8px;
		.t {
			color: #999;
		}
		.icon {
			$size: 24upx;
			width: $size;
			height: $size;
			margin-left: 6px;
			&.active {
				transform: rotate(-180deg);
			}
		}
	}
	.footer-wrap {
		box-sizing: border-box;
		width: 100%;
		padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
		background-color: #fff;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 99;
		.footer-cont {
			display: flex;
			justify-content: space-between;
			.contact {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				.icon {
					$size: 40upx;
					width: $size;
					height: $size;
				}
				.t {
					font-size: 20upx;
				}
			}
			.right {
				display: flex;
				align-items: center;
				.info {
					display: flex;
					align-items: center;
					padding-top: 2px;
					.num {
						font-size: 24upx;
						color: #999;
					}
					.t {
						font-size: 24upx;
						color: #000;
						font-weight: bold;
						margin-left: 4px;
					}
					.symbol {
						font-size: 20upx;
						color: $color;
						position: relative;
						top: 1px;
					}
					.p {
						font-size: 38upx;
						font-weight: bold;
						color: $color;
						position: relative;
						top: -2px;
					}
				}
				.btn {
					margin-left: 10px;
					padding: 4px 24px;
					color: #fff;
					border-radius: 100px;
					background: linear-gradient(to right, #ffb726, $color);
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					font-size: 24upx;
					&:active {
						opacity: 0.8;
					}
					.text {
						font-weight: bold;
					}
					.time {
						font-size: 20upx;
						margin-top: -2px;
						opacity: 0.8;
					}
				}
			}
		}
	}
	.container {
		padding-bottom: calc(132upx + env(safe-area-inset-bottom));
	}
	.btn-wrap {
		.btn {
			margin-left: 10px;
			padding: 10px 24px;
			color: #fff;
			border-radius: 100px;
			background: linear-gradient(to right, #ffb726, $color);
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-size: 24upx;
			&:active {
				opacity: 0.8;
			}
			.text {
				font-weight: bold;
			}
			.time {
				font-size: 20upx;
				margin-top: -2px;
				opacity: 0.8;
			}
		}
	}
	.input {
		font-size: 14px;
		border-bottom: 1px solid #ececec;
		padding: 10px 0;
	}
	.input_placeholder {
		color: #999;
	}
	.copy {
		padding-left: 12px;
		white-space: nowrap;
		display: flex;
		justify-content: center;
		position: relative;
		&:before {
			content: '';
			height: 16px;
			border-left: 1px solid #999;
			position: absolute;
			left: 0;
			top: 3px;
		}
	}
</style>
