<template>
	<view class="container">
		<up-navbar :title="navTitle" @leftClick="onback" placeholder></up-navbar>
		<view class="headStatus">
			<view class="status">
				<up-icon v-if="
            listinfo.status == 'done' ||
            listinfo.status == 'unpaid' ||
            !listinfo.id
          " name="checkmark-circle-fill" color="#03C061" size="23"></up-icon>
				<view class="statusName" v-if="listinfo.status == 'unpaid' || !listinfo.id">待支付</view>
				<view class="statusName" v-if="listinfo.status == 'done'">已完成</view>
				<view class="statusName" v-if="listinfo.status == 'refund'">退单</view>
				<view class="statusName" v-if="listinfo.status == 'part-refund'">部分退单</view>
				<view class="statusName" v-if="listinfo.status == 'cancelled'">取消订单</view>
			</view>
			<view class="time" v-if="listinfo.createTime">下单时间：{{ listinfo.createTime }}</view>
			<view class="time" v-if="
          listinfo.paidTime &&
          (listinfo.status != 'cancelled' || listinfo.status != 'unpaid')
        ">付款时间：{{ listinfo.paidTime }}</view>
		</view>

		<view class="order-msg-list" v-if="listinfo.status=='done'">
			<view class="item" v-for="item in orderMsgList" :key="item.id">
				<msg-list-item :content="item.content" :title="item.title"
					:create-time="item.createTime"></msg-list-item>
			</view>
		</view>

		<view class="wxQrcode" v-if="shopQrcode">
			<view class="left">
				<text class="title">扫码加好友，优惠多多</text>
				<text>优惠活动多</text>
				<text>充值有好礼</text>
				<text>会员享低价</text>
				<text>长按保存，微信内扫一扫加好友</text>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<u-image width="152" height="152" radius="16" :src="shopQrcode"></u-image>
			<!-- #endif -->
			<!-- #ifdef MP-ALIPAY -->
			<image style="height: 150rpx; width: 150rpx" :src="shopQrcode" @longpress="saveImage(shopQrcode)"
				mode="aspectFill"></image>
			<!-- #endif -->
		</view>

		<!--  {{cartStore.orderCostSummary}} -->

		<!-- 详情 -->
		<orderInfo :useVipPrice="cartStore.useVipPrice" :packfee="packfee" :shifu="shifu" :nowCarts="cartStore.carts"
			ref="orderInfoAfterRef" :freeCheck="freeCheck" :listinfo="listinfo" :orderVIP="orderVIP"
			:ordershopUserInfo="ordershopUserInfo" @istype="istype" :isBwc="isBwc"></orderInfo>
		<!-- 订单备注 -->
		<view class="orderInfo" v-if="listinfo.status!='done'">
			<view class="">
				<view class="t">订单备注：</view>
				<view class="u-m-t-18 textarea">
					<up-textarea border="none" placeholder="请填写口味、偏好等要求" type="textarea" v-model="orderRemarker"
						:clearable="true" />
				</view>
			</view>
		</view>
		<!-- 霸王餐 -->
		<rechargeFree :freeDineConfig="orderVIP.freeDineConfig" :payAmount="listinfo.totalPrices"
			v-if="showFreeDine && (listinfo.status == 'unpaid' || !listinfo.id)" @changeFree="changeFree">
		</rechargeFree>

		<!-- 支付方式 -->
		<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
			:disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod"
			v-if="listinfo.status == 'unpaid' || !listinfo.id">
			<template #bottom>
				<!-- 充值享优惠 -->
				<view v-if="
            !showFreeDine &&
            (listinfo.status == 'unpaid' || !listinfo.id) &&
            cartStore.orderCostSummary.finalPayAmount > 0
          ">
					<ChargeVue @updateChargeSel="(e) => updateChargeSel(e)" @updateRechargeId="updateRechargeId"
						@updateIsShow="updateIsShow" v-if="listinfo.status == 'unpaid' || !listinfo.id"></ChargeVue>
				</view>
			</template>
		</paymentMethodes>
		<view class="fixedview">
			<view class="flex-between" v-if="listinfo.status == 'unpaid' || !listinfo.id">
				<view class="fixedview_one flex-start">
					<view class="fixedview_oneone">实付金额</view>
					<view class="fixedview_onetow" v-if="rechargeItem.id">
						<text>¥</text>
						{{ rechargeItem.amount }}
					</view>
					<view class="fixedview_onetow" v-else>
						<text>¥</text>
						{{ cartStore.orderCostSummary.finalPayAmount }}
					</view>
				</view>
				<view class="flex-colum-end u-flex u-flex-y-center">
					<view class="u-m-r-30 u-flex u-flex-y-center">
						<template v-if="ordershopUserInfo.registerType == 'before'">
							<up-button shape="circle" v-if="!listinfo.id" @click="toJiacai" plain
								:custom-style="customStyle">
								<view class="u-flex u-flex-y-center">
									<image style="width: 40rpx; height: 40rpx" src="@/static/icon/add-goods.png"
										mode=""></image>
									<text class="u-font-32 color-main u-m-l-16">加菜</text>
								</view>
							</up-button>
							<up-button shape="circle" v-if="listinfo.id && listinfo.status == 'unpaid'" plain
								@tap="cancelOrder()" :custom-style="customStyle">
								<view class="u-flex u-flex-y-center">
									<text class="u-font-32 color-main u-m-l-16">取消订单</text>
								</view>
							</up-button>
						</template>
						<template v-else>
							<up-button v-if="!cartStore.isEmpty" shape="circle" @click="onlyCreateOrder" plain
								:custom-style="customStyle">
								<view class="u-flex u-flex-y-center">
									<!-- <image style="width: 40rpx;height: 40rpx;" src="@/static/icon/add-goods.png" mode=""></image> -->
									<text class="u-font-32 color-main">仅下单</text>
								</view>
							</up-button>
							<up-button v-else shape="circle" @click="toJiacai" plain :custom-style="customStyle">
								<view class="u-flex u-flex-y-center">
									<image style="width: 40rpx; height: 40rpx" src="@/static/icon/add-goods.png"
										mode=""></image>
									<text class="u-font-32 color-main u-m-l-16">加菜</text>
								</view>
							</up-button>
						</template>
					</view>
					<view class="fixedview_tow" @tap="$u.debounce(istoricalorders, 1000)">
						{{ paymentmethod ? paymentmethod.name : "" }}
					</view>
					<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
						取消订单
					</view> -->
				</view>
			</view>
		</view>
		<view style="width: 100%; height: 200rpx; color: #fff; color: #fff"></view>
		<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="(e) => accountPayevent(e)"
			@close="pwdClose" />
		<!-- 私域引流配置 -->
		<OrderFinshModal v-model="showDrainage"></OrderFinshModal>
	</view>
</template>
<script setup>
	import {
		back
	} from "@/utils/uniapp.js";
	import * as limitTimeDiscountapi from '@/common/api/market/limitTimeDiscount.js';
	import {
		onLoad,
		onUnload
	} from "@dcloudio/uni-app";
	import ChargeVue from "./components/charge.vue";
	import {
		pay
	} from "@/utils/pay.js";
	import OrderFinshModal from "@/components/order-finish-modal.vue";
	import _ from "lodash";
	import * as pointsApi from '@/common/api/market/points.js'
	// import yskUtils from '@/lib/index'
	import yskUtils from 'ysk-utils'
	import {
		ref,
		reactive,
		computed,
		onMounted,
		onUnmounted,
		nextTick,
		watch,
		onBeforeMount,
		onBeforeUnmount,
		provide,
	} from "vue";
	provide("shopUserInfo", ref(uni.cache.get("shopUserInfo")));
	provide("shopInfo", ref(uni.cache.get("shopInfo")));
	import {
		getTableInfo
	} from "@/common/api/shop/index.js";
	import {
		APIgetOrderById,
		APIputuserorder,
		APIhistoryOrder,
		rechargePayOrder,
		APIcancelOrder,
	} from "@/common/api/order/index.js";
	import {
		APIusershopInfodetail,
		APIshopUserInfo
	} from "@/common/api/member.js";
	import {
		APImemberPointsmyPoints,
		APImemberPointscalcUsablePoints,
	} from "@/common/api/shop/index.js";
	import {
		useCartsStore
	} from "@/stores/carts.js";
	import {
		useWebSocket
	} from "@/stores/carts-websocket.js";
	import * as chatApi from "@/http/php/chat";

	import MsgListItem from '@/components/msg-list-item/msg-list-item.vue'

	function pwdClose() {
		ispws.value = false;
		pay_unlock();
	}

	onUnload(() => {
		console.log("onUnload");
		closeSocket();
	});
	onBackPress(() => {
		console.log("返回拦截");
		closeSocket();
	});

	function onback() {
		closeSocket();
		console.log("返回");
		back();
	}
	const customStyle = {
		width: "180rpx",
		height: "70rpx",
		background: "FFFFFF",
		"border-radius": "106rpx",
		border: "2rpx solid #E8AD7B",
	};

	const cartStore = useCartsStore();

	//充值相关start
	//充值和余额支付是否可用
	const isCanUseCharge = ref(true);

	function updateIsShow(e) {
		isCanUseCharge.value = e;
	}
	const rechargeItem = ref({
		id: "",
	});
	const rechargeId = ref(null);

	function updateRechargeId(e) {
		rechargeId.value = e;
	}

	function updateChargeSel(newval) {
		rechargeItem.value = newval;
		console.log("updateChargeSel", newval);
	}
	//充值相关end

	async function onMessage(Message) {
		cartStore.onMessage(Message, cartsSocket);
		listinfo.totalPrices = historyTotalPrices * 1 + cartStore.totalPrice * 1;
		if (Message.operate_type == "init") {
			youhuiReset();
		}
		if (Message.operate_type == "cleanup") {
			youhuiReset();
			if (listinfo.id || options.tableCode) {
				let res = listinfo.id ?
					await APIgetOrderById({
						orderId: listinfo.id,
					}) :
					await APIhistoryOrder({
						tableCode: options.tableCode || "",
					});

				console.log("onMessage:APIgetOrderById", res);
				Object.assign(listinfo, res);
				if (res) {
					orderRemarker.value = res.remark;
					cartStore.setOldOrder(res);
				}
				if (noPayStatus[res.status]) {
					uni.showToast({
						title: noPayStatus[res.status],
						icon: "none",
					});
					setTimeout(() => {
						uni.navigateBack();
					}, 1000);
					return;
				}
			}
		}
		if (Message.operate_type == "del") {
			youhuiReset();
		}
		if (Message.operate_type == "edit") {
			youhuiReset();
		}
		if (Message.operate_type == "clearOrder") {
			youhuiReset();
		}
		if (
			Message.type == "product" &&
			Message.data_type == "product_update" &&
			Message.operate_type == "product_update"
		) {
			youhuiReset();
		}
		if (Message.operate_type == 'bulk_edit') {}
		return Message;
	}

	function toDiancai() {
		uni.navigateBack()
	}

	let cartsSocket = null;
	cartStore.goodsInit();
	const socketInitPar = reactive({
		type: "shopping",
		operate_type: "init",
		table_code: uni.cache.get("tableCode"),
		shop_id: uni.cache.get("shopId"),
		time_dis_info: null
	});
	
	

	function socketInit() {
		cartsSocket = useWebSocket();
		cartStore.socketSendMsg = (data) => {
			cartsSocket.sendMessage({
				...data,
				table_code: uni.cache.get("tableCode"),
				shop_id: uni.cache.get("shopId"),
			})

		}

		cartsSocket.connect(socketInitPar, onMessage);
	}
	const noPayStatus = {
		cancelled: "订单已取消",
		done: "订单已关闭",
	};

	function youhuiReset() {
		listinfo.pointsNum = 0;
		listinfo.Productroll = 0;
		try {
			orderInfoAfterRef.value?.IntegralInputclose();
		} catch {}
	}

	// 结账管理
	import {
		Memberpay
	} from "@/stores/pay.js";

	const storeMemberpay = Memberpay();

	import {
		productStore
	} from "@/stores/user.js";
	const storeuser = productStore();

	import payPassword from "@/components/payPassword.vue";
	import orderInfo from "./components/orderInfo.vue";
	// import orderInfoBefore from '../components/orderInfoBefore.vue'
	import rechargeFree from "./components/rechargeFree.vue";
	import paymentMethodes from "@/components/paymentMethod.vue"; //支付方式
	import {
		onShow,
		onBackPress
	} from "@dcloudio/uni-app";
	import {
		onHide
	} from "@dcloudio/uni-app";
	import {
		getMsgByOrderIdReq
	} from "../../common/api/account/message";
	// 输入支付密码
	const ispws = ref(false);
	let userInfo = uni.cache.get("userInfo");

	// 会员信息
	const orderVIP = ref(uni.cache.get("orderVIP"));
	// 商品订单关联的店铺信息
	const ordershopUserInfo = ref(uni.cache.get("shopInfo"));

	cartStore.updateData("orderVIP", orderVIP.value);
	cartStore.updateData("shopInfo", ordershopUserInfo.value);
	// 是否显示商家二维码信息
	const shopQrcode = ref(ordershopUserInfo.shopInfo || false);

	// 霸王餐
	const isBwc = ref(false);
	//是否显示霸王餐
	const showFreeDine = ref(false);

	//订单备注
	const orderRemarker = ref("");
	// 订单详情
	const listinfo = reactive({
		combinedArray: [],
		Productroll: 0,
		coupondiscountAmount: 0,
		pointsDiscountAmount: 0,
		packFeess: 0,
		totalPrices: 0,
		Seatcharge: 0,
		id: null,
	});

	//判断是否是打包商品
	const is_type = ref(0);
	//打包商品切换
	const istype = (newValue) => {
		is_type.value = newValue;
	};
	//积分

	const freeCheck = ref(false);
	let backtimer = null;
	let historyTotalPrices = 0;
	// * 获取订单详情接口
	const orderorderInfo = async (isNpwGetOrderDetail = false) => {

		if (!listinfo.id && !options.tableCode) {
			return;
		}
		if (!isNpwGetOrderDetail) {
			if (isPayBefor() && !listinfo.id) {
				return;
			}
		}

		let res = listinfo.id ?
			await APIgetOrderById({
				orderId: listinfo.id,
			}) :
			await APIhistoryOrder({
				tableCode: options.tableCode || "",
			});
		orderRemarker.value = res.remark;
		Object.assign(listinfo, res);
		if (res && res.tableCode) {
			socketInitPar.table_code = res.tableCode;
			let tableRes = await getTableInfo({
				tableCode: options.tableCode || "",
			});
			console.log("tableRes", tableRes);
			listinfo.tableName = tableRes.name;
		} else {
			if (options.tableCode) {
				socketInitPar.table_code = options.tableCode;
				let tableRes = await getTableInfo({
					tableCode: options.tableCode || "",
				});
				console.log("tableRes", tableRes);
				listinfo.tableName = tableRes.name;
			}
		}
		cartStore.setOldOrder(res);
		socketInit();
		console.log(res);
		console.log(res);

		getOrderInfoAfterCalcInit(res);

		if (listinfo.status == 'done') {
			getOrderMsgInfo()
		}
	};

	const orderMsgList = ref([])

	// 获取订单消息
	const getOrderMsgInfo = async () => {
		orderMsgList.value = []
		let res = await getMsgByOrderIdReq(listinfo.id)

		if (res) {
			orderMsgList.value = res
		}
	}

	//拿到订单数据后续初始化处理
	function getOrderInfoAfterCalcInit(res) {
		console.log("getOrderInfoAfterCalcInit", res);
		if (res && res.id) {
			Object.assign(listinfo, res);
			// 历史订单
			if (listinfo.detailMap) {
				let combinedArray = [];
				for (const key in listinfo.detailMap) {
					if (listinfo.detailMap.hasOwnProperty(key)) {
						let subArray = listinfo.detailMap[key];
						combinedArray = [...combinedArray, ...subArray];
					}
				}
				listinfo.combinedArray = combinedArray;
				listinfo.packFeess = cartStore.getTotalPackFee(listinfo.combinedArray);
				// 计算购物车商品费用
				historyTotalPrices =
					cartStore.getTotalTotalPrices(listinfo.combinedArray, isBwc.value) * 1;

				listinfo.totalPrices = historyTotalPrices + cartStore.totalPrice * 1;
				// 餐位费listinfo.seatNum
				listinfo.Seatcharge = cartStore.getTotalSeatcharge(listinfo.seatNum);
			}
			if (listinfo.discountInfo) {
				const discountObj = JSON.parse(listinfo.discountInfo);
				const tempArray = [];
				for (const [key, value] of Object.entries(discountObj)) {
					tempArray.push({
						name: key,
						amount: value,
					});
				}
				listinfo.discountInfo = tempArray;
			}
			// console.log(listinfo)
		} else {
			listinfo.totalPrices = cartStore.totalPrice * 1;
		}

		// uni.showToast({
		// 	title:'订单已取消或已付款',
		// 	icon:'none'
		// })
		// backtimer=setTimeout(()=>{
		// 	const arr=getCurrentPages()
		// 	if(arr.length<=1){
		// 		toJiacai()
		// 	}else{
		// 		uni.navigateBack({delta:1})
		// 	}
		// },1000)
	}

	const changeFree = (e) => {
		if (JSON.stringify(e) == "{}") {
			return;
		}
		isBwc.value = e;
		console.log("changeFree", e);

		// 支付方式切换
		// #ifdef MP-WEIXIN
		// #endif
		// #ifdef MP-ALIPAY
		// #endif
	};

	const saveImage = (url) => {
		uni.saveImage({
			url: url,
			success: () => {
				uni.showToast({
					title: "保存成功",
					icon: "none",
				});
			},
		});
	};

	//
	const paymentMethodref = ref(null);
	const paymentmethod = ref({});
	// 支付方式
	// #ifdef MP-WEIXIN
	paymentmethod.value = {
		name: "微信支付",
		type: 2,
		url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
		payType: "wechatPay",
	};
	// #endif
	// #ifdef MP-ALIPAY
	paymentmethod.value = {
		name: "支付宝支付",
		type: 3,
		url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
		payType: "aliPay",
	};
	// #endif

	const groupChange = async (e) => {
		if (e == 5) {
			return;
		}
		paymentmethod.value = e;
	};

	// 操作下单时候
	const orderInfoAfterRef = ref(null);

	//取消订单
	const cancelOrder = async () => {
		uni.showModal({
			title: "取消订单",
			content: "是否取消订单？",
			showCancel: true,
			success: async (res) => {
				if (res.confirm) {
					await APIcancelOrder({
						shopId: listinfo.shopId,
						orderId: listinfo.id,
					});
					uni.showToast({
						title: "取消订单成功",
						icon: "none",
					});
					setTimeout(() => {
						uni.pro.switchTab("order/index");
					}, 1000);
				}
			},
		});
	};

	// 删除订单
	const APIputuserorderclick = async () => {
		await APIputuserorder(listinfo.id);
		uni.showToast({
			title: "删除成功",
			icon: "none",
		});
		uni.pro.switchTab("order/index");
	};
	async function onlyCreateOrder() {
		await createOrder();
		orderorderInfo();
	}
	// 生成订单
	const createOrder = async () => {
		// cartStore.carts = [];
		const res = await storeMemberpay.actionscreateOrder({
			dineMode: is_type.value == 0 ? "dine-in" : "take-out", //堂食 dine-in 外带 take-out 外卖 take-away
			seatNum: uni.cache.get("dinersNum") ? uni.cache.get("dinersNum") : "", //用餐人数
			// packFee: packFee.value, //打包费
			packFee: packfee.value, //打包费
			originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额（包含打包费） 不含折扣价格 不含餐位费
			remark: orderRemarker.value, //备注
			placeNum: listinfo.id ? listinfo.placeNum * 1 + 1 : 1, //当前订单下单次数
			waitCall: "", //是否等叫 0 否 1 等叫
			orderId: listinfo.id || "",
			tableCode: options.tableCode || "",
			userId: uni.cache.get("userInfo").id || "", //
			limitRate: cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id ? {
				id: cartStore.limitTimeDiscount.id,
				discountRate: cartStore.limitTimeDiscount.discountRate,
				discountPriority: cartStore.limitTimeDiscount.discountPriority,
				foodType: cartStore.limitTimeDiscount.foodType,
				foods: cartStore.limitTimeDiscount.foods,
			} : null,
		});
		// 清空购物车
		if (res) {
			Object.assign(listinfo, res);
			// cartStore.setOldOrder(res)
			getOrderInfoAfterCalcInit(res);

			cartsSocket.sendMessage({
				type: "shopping",
				table_code: uni.cache.get("tableCode"),
				shop_id: uni.cache.get("shopId"),
				operate_type: "cleanup",
			});
			return res;
		} else {
			uni.showToast({
				title: "生成订单失败",
			});
		}
	};

	function isPayBefor() {
		return ordershopUserInfo.value.registerType == "before" ? true : false;
	}

	function pay_lock() {
		cartsSocket.sendMessage({
			...socketInitPar,
			operate_type: "pay_lock",
		});
	}

	function pay_unlock() {
		console.log("pay_unlock");
		clearInterval(payStatusTimer);
		cartsSocket.sendMessage({
			...socketInitPar,
			operate_type: "pay_unlock",
		});
	}
	async function search_pay_lock() {
		cartsSocket.sendMessage({
			...socketInitPar,
			operate_type: "search_pay_lock",
		});
		return new Promise((relove, reject) => {
			cartsSocket.socketTask.onMessage((res) => {
				relove(JSON.parse(res.data));
			});
		});
	}
	let payStatusTimer = null;
	let orderIsLock = true;

	function returnPayParams() {
		const checkOrderPay = {
			orderId: "",
			vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
			userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
			seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
			originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额（不包含打包费+餐位费）
			discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数)   写死1
			discountAmount: 0, //手动优惠金额  写死0
			productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
			otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额
			couponList: cartStore.backendCoupons.map((v) => v.id), //用户使用的卡券
			orderAmount: isBwc.value ?
				cartStore.orderCostSummary.orderOriginFinalPayAmount : cartStore.orderCostSummary
				.finalPayAmount, // 最终订单金额
			roundAmount: 0, //抹零金额 减免多少钱
			pointsDiscountAmount: cartStore.orderCostSummary.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
			pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
			newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
			newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ?
				cartStore.consumeDiscount.id : "",
			remark: orderRemarker.value, //用户备注
			discountActAmount: cartStore.orderCostSummary.fullReduction.actualAmount, //满减抵扣金额
			discountActId: cartStore.orderCostSummary.fullReduction.usedActivity ?
				cartStore.orderCostSummary.fullReduction.usedActivity.id : null,
			userId: uni.cache.get("userInfo").id || "", //
			limitRate: cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id ? {
				id: cartStore.limitTimeDiscount.id,
				discountRate: cartStore.limitTimeDiscount.discountRate,
				discountPriority: cartStore.limitTimeDiscount.discountPriority,
				foodType: cartStore.limitTimeDiscount.foodType,
				foods: cartStore.limitTimeDiscount.foods,
			} : null,
			vipDiscountAmount: cartStore.orderCostSummary.vipDiscountAmount, //会员折扣减免金额
		};
		return {
			isBwc: isBwc.value,
			checkOrderPay,
			payType: paymentmethod.value.payType,
			buyerRemark: "",
			returnUrl: "",
			rechargeId: rechargeId.value,
			rechargeDetailId: rechargeItem.value.id,
			shopUserId: orderVIP.value.id,
			shopId: orderVIP.value.shopId,
			pwd: "",
			userId: uni.cache.get("userInfo").id || "", //
			discountActld: cartStore.orderCostSummary.fullReduction.usedActivity ?
				cartStore.orderCostSummary.fullReduction.usedActivity.id : "", //满减活动id
		};
	}

	const istoricalorders = async () => {
		const payParams = returnPayParams();

		console.log("istoricalorders:payParams", payParams);
		//先付
		if (isPayBefor()) {
			// 购物车有数据
			if (!cartStore.isEmpty) {
				const res = await createOrder();
				//历史订单数据
				const res1 = await APIgetOrderById({
					orderId: res.id,
				});
				Object.assign(listinfo, res1);
				orderRemarker.value = res1.remark;
				cartStore.setOldOrder(res1);
			}
			goToPay(payParams);
			// goToPay()
		} else {
			//后付

			// 购物车有数据
			if (!cartStore.isEmpty) {
				const res = await createOrder();
				//历史订单数据
				const res1 = await APIgetOrderById({
					orderId: res.id,
				});
				Object.assign(listinfo, res1);

				orderRemarker.value = res1.remark;
				cartStore.setOldOrder(res1);
				goToPay(payParams);
				return;
			}
			// 先调用历史订单
			let APIhistoryOrderres = await APIhistoryOrder({
				tableCode: listinfo.tableCode,
			});
			// 判断是否有历史订单
			if (APIhistoryOrderres.detailMap) {
				let combinedArray = [];
				for (const key in APIhistoryOrderres.detailMap) {
					if (APIhistoryOrderres.detailMap.hasOwnProperty(key)) {
						let subArray = APIhistoryOrderres.detailMap[key];
						combinedArray = [...combinedArray, ...subArray];
					}
				}

				console.log('combinedArray', combinedArray)
				console.log('listinfo.combinedArray', listinfo.combinedArray)
				// 判断支付之前是是否还有新加订单
				if (listinfo.combinedArray.length === combinedArray.length) {
					goToPay(payParams);
				} else {
					uni.showToast({
						title: "你的订单已更新！",
						icon: "none",
					});
					orderorderInfo();
				}
			} else {
				uni.showToast({
					title: "你的小伙伴已提交订单~",
					icon: "none",
				});
				setTimeout(() => {
					orderorderInfo();
				}, 1000);
			}
		}
	};

	//开始锁单
	function start_lock_order() {
		clearInterval(payStatusTimer);
		pay_lock();
		payStatusTimer = setInterval(() => {
			pay_lock();
		}, 1000);
	}

	// * 去支付
	const goToPay = async (payParams) => {
		console.log("goToPay:payParams", payParams);

		const canPayRes = await search_pay_lock();
		const canPay = canPayRes.status == 1 ? true : false;
		if (!canPay) {
			uni.showToast({
				title: "有人正在付款中！",
				icon: "none",
			});
			const shopUserInfo = uni.cache.get("shopUserInfo");
			console.log("shopUserInfo", shopUserInfo);
			console.log("listinfo", listinfo);
			if (shopUserInfo) {
				if (shopUserInfo.userId == listinfo.userId) {
					pay_unlock();
				}
			}
			return;
		}

		// 余额支付
		if (payParams.payType == "accountPay") {
			console.log("orderVIP.value", orderVIP.value);
			if (orderVIP.value.payPwd == "" && userInfo.usePayPwd) {
				uni.showModal({
					title: "提示",
					content: "您还未设置支付密码，是否去设置？",
					success: (res) => {
						if (res.confirm) {
							uni.pro.navigateTo("user/member/setPassword", {
								shopId: orderVIP.value.shopId,
								type: "detail",
							});
						} else if (res.cancel) {
							console.log("用户点击取消");
						}
					},
				});
				return;
			}
			start_lock_order();
			if (userInfo.usePayPwd) {
				ispws.value = true;
				return;
			}
			accountPayevent();
			return;
		}
		console.log("canPay:goToPay:payParams", payParams);

		start_lock_order();

		console.log("霸王餐前payParams", payParams);
		if (payParams.isBwc) {
			payParams.checkOrderPay.orderId = listinfo.id;
			console.log("霸王餐支付参数：", payParams);
			try {
				const isPaySuccess = await storeMemberpay.actionspayltPayVip({
					...payParams,
					shopId: orderVIP.value.shopId,
					shopUserId: orderVIP.value.id,
					orderId: listinfo.id,
					userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
					amount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
					orderAmount: cartStore.orderCostSummary.orderOriginFinalPayAmount, // 最终订单原金额
					originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额（不包含打包费+餐位费）

					returnUrl: "", //跳转地址
					buyerRemark: "",
					seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
				});
				if (isPaySuccess) {
					paySucessCallback();
					orderorderInfo();
					pay_unlock();
				}
			} catch (error) {
				console.log("error", error);
				pay_unlock();
			}

			return false;
		} else {
			payParams.checkOrderPay.orderId = listinfo.id;
			try {
				if (rechargeItem.value.id && rechargeId.value) {
					//充值并且支付
					const payRes = await rechargePayOrder(payParams);
					const isPaySuccess = await pay(payRes);
					if (isPaySuccess) {
						paySucessCallback();
					}
					pay_unlock();
				} else {
					console.log("微信支付");
					const isPaySuccess = await storeMemberpay.actionsltPayOrder(payParams);
					if (isPaySuccess) {
						paySucessCallback();
					}
				}
			} catch (error) {
				console.log("error", error);
				pay_unlock();
				//TODO handle the exception
			}
		}
		pay_unlock();
	};



	const payPasswordref = ref(null);
	// 余额支付
	const accountPayevent = async (pwd) => {
		console.log("账户支付", pwd);
		if (JSON.stringify(pwd) === "{}") {
			return;
		}
		const payParams = returnPayParams();
		ispws.value = false;
		payParams.checkOrderPay.userId = uni.cache.get("userInfo").id;
		payParams.checkOrderPay.orderId = listinfo.id;
		payParams.pwd = pwd;
		try {
			const isPaySuccess = await storeMemberpay.balancePayOrder(payParams);
			if (isPaySuccess) {
				uni.showToast({
					title: "支付成功",
					icon: "none",
				});
				pay_unlock();

				paySucessCallback();
			}
		} catch (error) {
			//TODO handle the exception
			pay_unlock();
		}
	};

	onBeforeUnmount(() => {
		clearTimeout(backtimer);
		clearInterval(payStatusTimer);
		closeSocket();
	});
	onHide(() => {
		closeSocket();
		clearInterval(payStatusTimer);
	});

	function closeSocket() {
		// cartsSocket.closeExistingConnection()
	}

	onShow(() => {
		userInfo = uni.cache.get("userInfo");
		if (cartsSocket) {
			cartsSocket.connect();
		}
		try {
			// 更新数据
			if (orderVIP.value) {
				orderVIP.value = uni.cache.get("orderVIP");
				paymentMethodref.value.orderVIPfun(uni.cache.get("orderVIP"));
				if (listinfo.id && ordershopUserInfo.value.registerType != "before") {
					orderorderInfo();
				}
			}
		} catch (error) {
			//TODO handle the exception
		}

		orderorderInfo();
		uni.$off("selCoupon");
		uni.$on("selCoupon", function(data) {
			console.log("selCoupon", data);
			cartStore.setCoupons(_.cloneDeep(data));
		});
	});
	let options = {};

	// 跳转到加菜页面
	function toJiacai() {
		console.log("跳转到加菜页面");
		const arr= getCurrentPages()
		console.log(arr);
		if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
			back();
		}else{
			uni.cache.set('tableCode',listinfo.tableCode)
			uni.cache.set('shopId',listinfo.shopId)
			uni.redirectTo({
				url:'/pages/product/index?noJump=1'
			})
		}
	}
	const packfee = computed(() => {
		return cartStore.orderCostSummary.packFee;
	});
	//不计算各种折扣前的实付金额
	const shifu = computed(() => {
		const payAmount = listinfo.payAmount ? listinfo.payAmount * 1 : 0;
		return payAmount + cartStore.totalPrice * 1 + packfee.value * 1;
	});
	//减去各种折扣后的金额
	const lastPayMoney = computed(() => {
		return shifu.value * 1;
	});

	const payStatus = {
		unpaid: "待支付",
		done: "已完成",
		refund: "已退款",
		"part-refund": "部分退款",
		cancelled: "已取消",
	};
	const navTitle = computed(() => {
		if (!listinfo.id && !cartStore.isEmpty) {
			return "待确认";
		}
		if (cartStore.isEmpty && listinfo.id) {
			return payStatus[listinfo.status] || "待确认";
		} else {
			return "待确认";
		}
	});

	//支付成功后的处理
	async function paySucessCallback() {
		console.log("paySucessCallback");
		uni.$emit('updateProductIndex')
		cartStore.clearDiscount()
		orderorderInfo(true);
		cartsSocket.closeSocket();
		showDrainage.value = true;
		// const groupinfo=await chatApi.groupShopinfo({shop_id:cartStore.shopInfo.id})
		// if(groupinfo&&groupinfo[0]){
		// 	console.log('groupinfo',groupinfo[0].id);
		// 	chatApi.groupJoin({
		// 		group_id:groupinfo[0].id
		// })
		// }
	}

	//私域引流配置
	const drainageConfig = ref({});
	//私域引流弹窗
	const showDrainage = ref(false);

	function setOrder(res) {
		uni.cache.set("tableCode", res.tableCode);
		uni.cache.set("dinersNum", res.seatNum);
		options.tableCode = res.tableCode || "";
		cartStore.setSeatFeeConfig("personCount", res.seatNum);
		cartStore.setDinnerType(res.dineMode || "dine-in");
		cartStore.setOldOrder(res);
		if (res.limitRate) {
			cartStore.limitTimeDiscount = res.limitRate;
		}
		orderRemarker.value = res.remark;
		Object.assign(listinfo, res);
		getOrderInfoAfterCalcInit(res);
	}

	const limitTimeDiscountRes = ref(null)
	async function init(opt) {
		await storeuser.actionsproductqueryProduct();

		console.log("init");
		cartStore.clearOrderConfig();
		Object.assign(options, opt);
		listinfo.id = options.orderId;
		console.log("options", options);
		if (options.shopId) {
			// 每次进来全局更新shopId
			// uni.cache.set("shopId", options.shopId, 30);
			uni.cache.set("shopId", options.shopId);
		}
		//如果已经生成订单，根据历史订信息设置相关配置
		if (options.orderId) {
			let res = await APIgetOrderById({
				orderId: listinfo.id,
			});
			if (res && typeof res == "object") {
				setOrder(res);
			}
		} else {
			const limitRes = await limitTimeDiscountapi.getConfig({
				shopId: uni.cache.get('shopId')
			});
			if (limitRes && typeof limitRes == 'object') {
				limitTimeDiscountRes.value = limitRes;

			} else {
				limitTimeDiscountRes.value = null;

			}
		}
		
		//获取台桌信息
		let tableRes = await getTableInfo({
			tableCode: options.tableCode || "",
		});
		console.log("tableRes", tableRes);
		listinfo.tableName = tableRes?tableRes.name:'';
		
		//获取店铺信息
		const shopInfoRes = await APIusershopInfodetail({
			shopId: options.shopId,
		});
		//获取积分配置
		pointsApi.pointsConfig().then(res => {
			cartStore.setPointDeductionRule(res);
		})
		if (!isPayBefor() && options.tableCode) {
			const res = await APIhistoryOrder({
				tableCode: options.tableCode || "",
			});
			if (res && typeof res == "object") {
				setOrder(res);
			} else {

			}
		}
		if (shopInfoRes) {
			cartStore.shopInfo = shopInfoRes.shopInfo;
		}
		await cartStore.goodsInit();
		// * 获取会员信息
		await nextTick();

		orderVIP.value = uni.cache.get("orderVIP");
		cartStore.freeDineConfig = orderVIP.value.freeDineConfig;
		const shopUserInfo = uni.cache.get("shopUserInfo");
		cartStore.shopUserInfo = shopUserInfo;
		if (options.tableCode) {
			socketInitPar.table_code = options.tableCode;
			socketInit();
		} else {
			orderorderInfo();
		}
	}
	onLoad((opt) => {
		init(opt);
	});

	watch(
		() => cartStore.orderCostSummary.orderOriginFinalPayAmount,
		(newval) => {
			console.log(
				"cartStore.orderCostSummary.orderOriginFinalPayAmount",
				orderVIP.value
			);
			if (JSON.stringify(orderVIP.value) == "{}") {
				return;
			}
			if (!orderVIP.value) {
				return;
			}
			if (
				!orderVIP.value.freeDineConfig ||
				!orderVIP.value.freeDineConfig.enable
			) {
				//未开始霸王餐后面代码不执行
				isBwc.value = false;
				showFreeDine.value = false;
				return;
			}

			const bwc_fullaniunt_money =
				newval + cartStore.orderCostSummary.fullReduction.actualAmount;
			if (
				bwc_fullaniunt_money <= 0 ||
				bwc_fullaniunt_money < orderVIP.value.freeDineConfig.rechargeThreshold
			) {
				isBwc.value = false;
				showFreeDine.value = false;
				return;
			}

			if (
				(listinfo.status == "unpaid" || !listinfo.id) &&
				orderVIP.value.freeDineConfig.enable &&
				bwc_fullaniunt_money >= orderVIP.value.freeDineConfig.rechargeThreshold
			) {
				showFreeDine.value = true;
			}
		}, {
			immediate: true,
		}
	);

	watch(
		() => isBwc.value,
		(newval) => {
			cartStore.isFreeDine = newval;
		}
	);

	const disablePayType = computed(() => {
		const arr = new Set([]);
		if (isBwc.value) {
			if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
				arr.add("微信支付");
			} else {
				arr.add("余额支付");
			}
		}
		if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
			arr.add("微信支付");
		}

		//充值并付款时只能微信支付
		if (rechargeItem.value.id) {
			arr.add("余额支付");
		}
		if (!orderVIP.value || !orderVIP.value.amount) {
			arr.add("余额支付");
		}
		if (orderVIP.value) {
			if (
				orderVIP.value.amount <
				cartStore.orderCostSummary.orderOriginFinalPayAmount
			) {
				arr.add("余额支付");
			}
		}

		// if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
		//   arr.add("微信支付");
		// }
		if (!isCanUseCharge.value) {
			arr.add("余额支付");
		}

		return Array.from(arr);
	});

	watch(() => cartStore.limitTimeDiscount, (newval, oldval) => {

	})
	
	watch(()=>cartStore.limitTimeDiscount,(newval)=>{
		socketInitPar.time_dis_info=newval
	},{
		deep:true,
		immediate:true
	})

	/**
	 * 更新购物车和历史订单数据
	 */
	function updateCartAndHistory() {
		let newData = {
			history: [],
			cart: [],
		};

		// 扁平化历史订单商品
		const oldOrderGoods = listinfo.combinedArray
		for (let cart of oldOrderGoods) {
			const canUseLimitTimeDiscount = yskUtils.limitUtils.canUseLimitTimeDiscount(
					cart,
					cartStore.limitTimeDiscount,
					cartStore.shopInfo,
					cartStore.shopUserInfo,
					"productId"
				) ?
				1 :
				0;
			const is_time_discount = cart.isTimeDiscount || cart.is_time_discount
			if (canUseLimitTimeDiscount != is_time_discount) {
				newData.history.push({
					id: cart.id,
					is_time_discount: canUseLimitTimeDiscount,
				});
			}
		}

		for (let cart of carts.value) {
			const canUseLimitTimeDiscount = yskUtils.limitUtils.canUseLimitTimeDiscount(
					cart,
					cartStore.limitTimeDiscount,
					cartStore.shopInfo,
					cartStore.shopUserInfo,
					"productId"
				) ?
				1 :
				0;

			const is_time_discount = cart.isTimeDiscount || cart.is_time_discount
			if (canUseLimitTimeDiscount != is_time_discount) {
				newData.cart.push({
					id: cart.id,
					is_time_discount: canUseLimitTimeDiscount,
				});
			}
		}

		if (newData.history.length <= 0 && newData.cart.length <= 0) {
			return;
		}

		console.log('bulk_edit', {
			...socketInitPar,
			operate_type: "bulk_edit",
			data: newData,
		});
		cartsSocket.sendMessage({
			...socketInitPar,
			operate_type: "bulk_edit",
			data: newData,
		});
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 32rpx 28rpx 32rpx 28rpx;
		background-color: #f7f7f7;
	}

	.headStatus {
		display: flex;
		flex-direction: column;
		margin-bottom: 32rpx;
		align-items: center;

		.status {
			display: flex;
			align-items: center;
			justify-content: center;
			font-weight: bold;
			font-size: 36rpx;
			color: #333333;

			.statusName {
				margin-left: 16rpx;
			}
		}

		.time {
			font-weight: 400;
			font-size: 24rpx;
			color: #999999;
			margin-top: 18rpx;
		}
	}

	.wxQrcode {
		background: #ffffff;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
		padding: 32rpx 24rpx;
		font-weight: 400;
		font-size: 24rpx;
		color: #999999;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 32rpx;

		.left {
			display: flex;
			flex-direction: column;
		}

		.title {
			font-weight: bold;
			font-size: 28rpx;
			color: #333333;
			margin-bottom: 16rpx;
		}
	}

	.card_box {
		background-color: #fff;
		// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
		position: relative;
		width: 100%;
		height: 100%;
		// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87, 86, 86, 0.35);
		border-radius: 18rpx;

		.card_head_box {
			width: 100%;
			display: flex;
			justify-content: space-between;
			position: absolute;
			top: -22.5rpx;
			padding: 0 44rpx;

			.card_head_item {
				width: 45rpx;
				height: 45rpx;
				background-color: #f9f9f9;
				border-radius: 50%;
				box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
			}
		}
	}

	.card {
		// background-color: #fff;
		border-radius: 20upx;
		margin-bottom: 28upx;
		position: relative;

		.head {
			display: flex;
			justify-content: space-between;
			padding: 50rpx 0 32rpx 0;
			border-bottom: 2rpx dashed #e3e3e3;

			.head_left {
				.shopName {
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;
				}

				.tableName {
					font-weight: 400;
					font-size: 28rpx;
					color: #333333;
				}
			}

			.status {
				text {
					font-weight: 500;
					font-size: 28rpx;
					color: #333333;
				}
			}
		}

		.number-wrap {
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 32rpx;

			.t {
				font-weight: 400;
				font-size: 28rpx;
				color: #333333;
			}

			.number {
				font-weight: bold;
				font-size: 56rpx;
				color: #333333;
			}
		}

		.price {
			.i {
				font-size: 20upx;
			}

			.num {
				font-size: 38upx;
			}
		}

		.shop-box {
			padding: 36rpx 34rpx 30rpx 34rpx;
			border-bottom: 2rpx dashed #e3e3e3;

			.shop-head {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.shop-head-left {
					display: flex;
					align-items: center;

					.tag-wrap {
						width: 80rpx;
						height: 48rpx;
						background: #ffffff;
						border-radius: 10rpx 10rpx 10rpx 10rpx;
						border: 2rpx solid #e3ad7f;
						margin-right: 18rpx;
						display: flex;
						align-items: center;
						justify-content: center;

						.tag {
							font-weight: 400;
							font-size: 24rpx;
							color: #e3ad7f;
						}
					}

					.title {
						font-weight: bold;
						font-size: 28rpx;
						color: #333333;
					}
				}
			}

			.shop-info {
				margin-top: 32rpx;

				.item:nth-child(1) {
					margin-top: 0;
				}

				.item {
					padding: 32rpx 0 !important;
					display: flex;

					.cover {}

					.info {
						flex: 1;
						display: flex;
						flex-direction: column;
						padding-left: 16upx;

						.productName {
							font-weight: bold;
							font-size: 28rpx;
							color: #333333;
							margin-top: 20rpx;
						}

						.productSkuName {
							font-weight: 400;
							font-size: 24rpx;
							color: #999999;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							-webkit-line-clamp: 3;
							overflow: hidden;
							text-overflow: ellipsis;
						}

						.n {
							font-size: 24upx;
							color: #999;
						}
					}

					.price {
						display: flex;
						flex-direction: column;
						align-items: flex-end;
						padding-left: 68rpx;

						.priceAmount {
							font-weight: 500;
							font-size: 28rpx;
							color: #333333;
							margin-top: 26rpx;
						}

						.num {
							font-weight: 400;
							font-size: 24rpx;
							color: #999999;
							margin-top: 22rpx;
						}
					}
				}
			}

			.total-wrap {
				width: 100%;
				display: flex;
				justify-content: space-between;
				font-weight: 500;
				font-size: 28rpx;

				.price {
					font-weight: bold;
					font-size: 32rpx;
				}
			}
		}

		.order_footer {
			display: flex;
			flex-direction: column;
			padding: 34rpx;
			position: relative;

			.order_footer_icon {
				width: 100%;
				position: absolute;
				top: -22.5rpx;
				left: 0;
				display: flex;
				justify-content: space-between;

				.order_footer_left_icon {
					width: 45rpx;
					height: 45rpx;
					margin-left: -22.5rpx;
					background-color: #f9f9f9;
					border-radius: 50%;
					box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
				}

				.order_footer_right_icon {
					width: 45rpx;
					height: 45rpx;
					margin-right: -22.5rpx;
					background-color: #f9f9f9;
					border-radius: 50%;
					box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
				}
			}

			.title {
				font-weight: bold;
				font-size: 28rpx;
				color: #333333;
			}

			.order-info {
				.row {
					display: flex;
					justify-content: space-between;
					padding-top: 32upx;

					.t {
						font-weight: normal;
						font-size: 28rpx;
						color: #333333;
					}

					.info {
						font-weight: 400;
						font-size: 24rpx;
						color: #666666;
					}
				}
			}
		}
	}

	.pay-info-wrap {
		padding: 0;
		box-sizing: border-box;

		.info-wrap {
			padding: 64rpx 30rpx 30rpx 30rpx;
			box-sizing: border-box;

			.title {
				align-self: center;
				font-size: 32rpx;
				color: #333;
				font-weight: bold;
			}
		}

		.info-content {
			.pay-title {
				display: flex;
				align-items: flex-end;
				justify-content: center;
				font-weight: bold;
				width: 100%;
				font-size: 48rpx;
				color: #333;
				margin-top: 48rpx;

				text {
					font-size: 60rpx;
					color: #333;
				}
			}

			.pay-password {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 64rpx;

				.list {
					width: 88rpx;
					height: 88rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border: 2rpx solid #999;
					border-radius: 8rpx;

					text {
						font-size: 32rpx;
					}
				}
			}

			.hint {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 100%;
				height: 100rpx;

				text {
					font-size: 28rpx;
					color: #ccc;
				}
			}
		}
	}

	.fixedview {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		z-index: 999;

		// height: 80rpx;
		.flex-between {
			width: 100%;
			padding: 36rpx 36rpx 70rpx 36rpx;
			background: #ffffff;

			.fixedview_one {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				//   align-items: flex-end;

				.fixedview_oneone {
					font-weight: 400;
					font-size: 28rpx;
					color: #666666;
				}

				.fixedview_onetow {
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;

					text {
						font-size: 24rpx;
					}
				}
			}

			.flex-colum-end {
				.fixedview_tow {
					background: #e3ad7f;
					border-radius: 36rpx;
					font-weight: 400;
					font-size: 32rpx;
					color: #ffffff;
					padding: 14rpx 44rpx;
				}

				.fixedview_tows {
					margin-top: 10rpx;
					background: #c3c3c3;
					border-radius: 36rpx;
					font-weight: 400;
					font-size: 32rpx;
					color: #ffffff;
					padding: 14rpx 44rpx;
				}
			}
		}
	}

	.orderInfo {
		background: #ffffff;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
		margin-top: 32rpx;
		padding: 32rpx 34rpx;

		.t {
			font-weight: bold;
			font-size: 28rpx;
			color: #333333;
			flex-shrink: 0;
		}

		.info {
			font-weight: 400;
			font-size: 28rpx;
			color: #666666;
		}
	}

	.order-msg-list {
		margin-bottom: 30rpx;
	}

	.textarea {
		background-color: #F5F5F5;
		border-radius: 10rpx;
		overflow: hidden;
	}

	:deep(.u-textarea) {
		background-color: #F5F5F5 !important;
	}
</style>