<style>
	.jz_SureOrder {
  position: relative;
}
.jz_SureTop {
  width: 100%;
  box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
  background-color: #fff;
  border-bottom-left-radius: 60rpx;
  border-bottom-right-radius: 60rpx;
  padding: 40rpx;
}
.jz_SureDfk {
  color: #111111;
  font-size: 40rpx;
  font-weight: bold;
  margin-left: 26rpx;
}
.jz_SureContent {
  width: 90%;
  margin: auto;
  min-height: 100px;
}
.jz_SureCommodity {
  padding: 30rpx 0;
  display: flex;
  border-bottom: 1px solid #e6e6e6;
}
.jzSureMoney {
  color: #333333;
  font-weight: bold;
  font-size: 20rpx;
}
.jz_SuOrder_img {
  width: 100rpx;
  height: 100rpx;
  border-radius: 20rpx;
  overflow: hidden;
  flex-shrink: 0;
}
.jz_SuOrder_img img {
  width: 100%;
  height: 100%;
}
.jz_OrderNum {
  color: #8f8f90;
  font-size: 24rpx;
  margin-right: 50rpx;
}
.jz_GoodName {
  color: #333333;
  font-size: 28rpx;
  width: 70%;
  margin-left: 15px;
  font-weight: bold;
}
.jz_OrderBold {
  color: #08090e;
  font-weight: bold;
}
.jz_PayDiv {
  position: absolute;
  width: 90%;
  margin: auto;
  bottom: 30rpx;
  display: flex;
  justify-content: space-between;
}
.jz_CancleBtn {
  width: 310rpx;
  height: 80rpx;
  border: 1px solid #111111;
  border-radius: 16rpx;
  color: #111111;
  font-weight: bold;
  text-align: center;
  line-height: 80rpx;
  font-size: 28rpx;
}

.jz_Reserve {
  padding-bottom: 120rpx;
}
.jz_ReserTop {
  width: 100%;
  min-height: 300rpx;
  box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
  background-color: #fff;
  border-bottom-left-radius: 60rpx;
  border-bottom-right-radius: 60rpx;
  padding: 40rpx;
}

.jz_ReserTitle {
  color: #111111;
  font-weight: 600;
  font-size: 36rpx;
}

.jz_ReserIn {
  color: #111;
  font-size: 24rpx;
  font-weight: 500;
}

.jz_ReseQue {
  color: #dfbe6e;
  font-size: 24rpx;
  padding-top: 30rpx;
  border-top: 1px solid #e7e7e7;
  margin-top: 20px;
}

.jz_ReseQue img {
  width: 16px;
  height: 14px;
  position: relative;
  top: 2px;
  margin-right: 5px;
}

.jz_ReseOrder {
  padding: 40rpx;
}

.jz_ReDix {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.jz_RedixTitle {
  width: 90px;
  flex-shrink: 0;
}

/* .jz_OrderDiv {
			position: fixed;
			width: 90%;
			height: 100rpx;
			background-color: #fff;
			margin: auto;
			bottom: 20px;
			padding: 20rpx;
			left: 40rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-shadow: 0px 10px 30px 0px rgba(36, 36, 36, 0.2);
			border-radius: 16px;
			z-index: 999;
		} */
.jz_orderbox {
  position: fixed;
  background-color: #fff;
  bottom: 0;
  width: 100vw;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0px 0rpx 50rpx 0px rgba(76, 76, 76, 0.13);
  z-index: 99;
  justify-content: flex-end;
  padding: 20rpx 30rpx;
}
.jz_OrderDiv {
  width: 90%;
  height: 100rpx;
  background-color: #fff;
  margin: auto;
  padding: 20rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0px 10rpx 30rpx 0px rgba(36, 36, 36, 0.2);
  border-radius: 16px;
  z-index: 999;
}

.jz_OrderReNow {
  width: 170rpx;
  height: 80rpx;
  background-color: #111111;
  text-align: center;
  line-height: 80rpx;
  color: #fff;
  font-weight: 600;
  font-size: 28rpx;
  border-radius: 16rpx;
}
.jz_form {
  margin-top: 60rpx;
  padding: 0 45rpx;
}
.jz_form .form-items {
  margin-bottom: 30rpx;
  display: flex;
  align-items: center;
  padding-bottom: 30rpx;
  border-bottom: 1px solid #f5f5f5;
  font-size: 28px;
  font-weight: 500;
}
.jz_form .form-items .label {
  font-size: 28rpx;
  font-weight: 600;
  margin-right: 60rpx;
  flex-shrink: 0;
  width: 115rpx;
}
.jz_form .form-items .val {
  flex: 1;
}
.jz_ReserTop .o-timer {
  height: 100rpx;
  background: #ecf1f4;
  border-radius: 20rpx;
  padding: 0 40rpx;
  margin-bottom: 30rpx;
}
.jz_ReserTop .o-timer .time-item {
  font-size: 32rpx;
  font-weight: 800;
}
/* 	.jz_ReserTop .o-timer .time-item:last-child{
			text-align: right;
		} */
.jz_ReserTop .o-timer .time-split {
  font-size: 24rpx;
  font-weight: 400;
  text-align: center;
  margin: 0 20rpx;
}
.jz_ReserTop .o-timer .update {
  font-size: 24rpx;
  font-weight: 400;
  text-align: right;

  color: #000;
  display: flex;
  align-items: center;
}
.jz_Reserve .flex {
  display: flex;
  align-items: center;
}
.jz_Reserve .big-title {
  position: relative;
}

.jz_Reserve .big-title::before {
  display: block;
  width: 71rpx;
  height: 12rpx;
  background: #dfbe6e;
  border-radius: 4rpx;
  content: " ";

  position: absolute;
  left: 0;
  bottom: 6rpx;
  z-index: 1;
}
.jz_Reserve .big-title text {
  font-size: 34rpx;
  font-weight: bold;
  color: #1f1f1f;
  position: relative;
  z-index: 2;
}
.jz_Reserve .empty-block {
  height: 20rpx;
  background: #ecf1f4;
}
.jz_form .form-items .val text {
  border: none;
  padding: 0;
  margin: 0;
  outline: none;
  height: 38rpx;
  line-height: 38rpx;
  font-size: 28rpx;
  font-weight: 500;
  width: 100%;
}
.jz_Reserve .grey {
  color: #6e6e6e !important;
}
.jz_Reserve .f12 {
  font-size: 24rpx !important;
}
.jz_Reserve .f11 {
  font-size: 22rpx !important;
}
.jz_Reserve .f14 {
  font-size: 28rpx !important;
}
.jz_Reserve .regular {
  font-weight: 500 !important;
}
.jz_Reserve .sheshi {
  margin-top: 50rpx;
}
.jz_Reserve .sheshi .she-title {
  font-size: 28rpx;
  font-weight: 800;
}
.jz_Reserve .sheshi .she-content {
  margin-top: 24rpx;
}
.jz_Reserve .sheshi .she-content text {
  font-size: 24rpx;
  font-weight: 500;
  color: #4a4a4a;
  line-height: 40rpx;
  margin-right: 24rpx;
}
.jz_Reserve .jz_SureVal {
  flex: 1;
  font-size: 28rpx;
  font-weight: 500;
  width: 100%;
}
.jz_MyGuestList .label {
  width: 115rpx;
}
.jz_MyGuestList {
  margin-top: 40rpx;
}
</style>
<template>
	<view class="jz_Reserve" v-if="orderData">
		<view class="jz_ReserTop">
			<view class="flex" style="margin-bottom: 30rpx">
				<u-icon customPrefix="iconfont" name="icondaizhifu-" size="52" color="#DFBE6E" v-if="orderStatus.code == 0"></u-icon>
				<u-icon customPrefix="iconfont" name="iconquxiao" size="52" color="#f26c6c" v-if="orderStatus.code == -1"></u-icon>
				<u-icon customPrefix="iconfont" name="iconshenhezhong" size="52" color="#86d9a5" v-if="orderStatus.code == -2"></u-icon>
				<u-icon customPrefix="iconfont" name="iconzhengchang" size="52" color="#111" v-if="orderStatus.code == 1"></u-icon>
				<text style="
            margin-left: 26rpx;
            font-size: 40rpx;
            font-weight: 600;
            color: #111;
          ">
					{{ orderStatus.text }}
				</text>
			</view>
			<view style="margin-bottom: 30rpx" v-if="
          orderData.OrderModel.RejectRemark && orderData.OrderModel.RejectRemark != ''
        ">
				<u-alert-tips type="error" title="订单取消失败" :description="orderData.OrderModel.RejectRemark"></u-alert-tips>
			</view>
			<view class="o-timer flex">
				<view class="time-item">
					{{ orderData.OrderModel.EnterCountryTime }} 
				</view>
				<view class="time-split">
					<view> 出境</view>
				</view>
				<view class="time-item" style="font-size: 26rpx; font-weight: 500; flex: 1">
					<text v-if="orderData.OrderModel.PeopleNum > 0">{{ orderData.OrderModel.PeopleNum }}人</text>
				</view>
				<view class="update">
					<!-- <text style="margin-right: 8rpx;">修改</text>
					<u-icon name="arrow" size="20" /> -->
				</view>
			</view>
			<view class="jz_ReserTitle" @click="goDetail">
				{{ orderData.ProductModel.Name }}
			</view>
			<view class="jz_ReserIn" style="margin: 33rpx 0 18rpx 0">
				<!-- {{currentPriceInfo.startCityName}}出发 {{currentPriceInfo.startDate}} -->
			<text v-if="orderData.ProductModel.SendCityName" style="margin-right: 35rpx;">
				<text>送签地：</text>
				<text>{{ orderData.ProductModel.SendCityName }} </text> 
			</text> 
			<text v-if="orderData.ProductModel.VisaValidity">
				<text>有效期： </text>
				<text>{{ orderData.ProductModel.VisaValidity }}</text>
			</text>
			</view>
			<view class="big-title" v-if="orderData.OrderModel.StartCityName">
				<text>{{ orderData.OrderModel.StartCityName }}出发</text>
			</view>
			<view class="jz_ReseQue">
				<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png" />即时确认：本产品付款后可快速确认，放心期待您的办理
			</view>
		</view>

		<view class="jz_form">
			<view class="form-items">
				<view class="label">订单编号</view>
				<view class="jz_SureVal">
					{{ orderData.OrderModel.Id }}
				</view>
			</view>
			<view class="form-items">
				<view class="label">下单日期</view>
				<view class="jz_SureVal">
					{{ orderData.OrderModel.CreateTime.replace("T", " ") }}
				</view>
			</view>
			<view class="form-items" v-if="orderData.OrderModel.VisaOrderRelation.RelationName||orderData.OrderModel.VisaOrderRelation.RelationPhone">
				<view class="label">联系人</view>
				<view class="jz_SureVal">
					<template v-if="orderData.OrderModel.VisaOrderRelation.RelationName">
						{{ orderData.OrderModel.VisaOrderRelation.RelationName }}
					</template>
					<template v-if="orderData.OrderModel.VisaOrderRelation.RelationName&&orderData.OrderModel.VisaOrderRelation.RelationPhone">
						/
					</template>
					<template v-if="orderData.OrderModel.VisaOrderRelation.RelationPhone">
						{{ orderData.OrderModel.VisaOrderRelation.RelationPhone }}
					</template>

				</view>
			</view>
			<!-- <view class="form-items">
				<view class="label">下单日期</view>
				<view class="jz_SureVal">
					{{ orderData.OrderModel.CreateDate.replace("T", " ") }}
				</view>
			</view> -->
		</view>
		<view class="empty-block"></view>
		<view class="jz_form jz_MyGuestList" v-for="(subItem, subIndex) in orderData.OrderModel.GuestList" :key="subIndex">
			<view style="margin: 10rpx 0 20rpx 0"> 游客{{ subIndex + 1 }} </view>
			<view class="form-items">
				<view class="label">游客姓名</view>
				<view class="jz_SureVal">{{ subItem.SurName }}{{ subItem.Name }}</view>
			</view>
			<view class="form-items">
				<view class="label">联系电话</view>
				<view class="jz_SureVal">{{ subItem.MobilePhone }}</view>
			</view>
			<view class="form-items">
				<view class="label">身份证</view>
				<view class="jz_SureVal">{{ subItem.IdCard }}</view>
			</view>
			<view class="form-items">
				<view class="label">学生</view>
				<view class="jz_SureVal">
					{{ subItem.IsHightSchool == 1 ? "是" : "否" }}
				</view>
			</view>
		</view>
		<view class="empty-block"></view>
		<view class="jz_form" v-if="orderData.OrderModel.Remark">
			<view class="form-items" style="border-bottom: 0">
				<view class="label">备注</view>
				<view class="jz_SureVal">{{ orderData.OrderModel.Remark }}</view>
			</view>
		</view>
		<view class="empty-block"></view>
		<view style="padding: 50rpx 40rpx">
			<view class="big-title">
				<text>费用明细</text>
			</view>
			<view class="jz_form" style="margin: 40rpx 0; padding: 0">
				<view class="form-items">
					<view class="label"> 总金额 </view>
					<view class="val f14 regular" style="text-align: right">
						<text style="margin-right: 30rpx">{{ orderData.OrderModel.PeopleNum }}人</text>
						<text class="red">￥
						<template v-if="orderData.OrderModel.DiscountMoney&&orderData.OrderModel.DiscountMoney>0">
						{{ Number(orderData.OrderModel.TotalPrice) -Number(orderData.OrderModel.DiscountMoney) }}
						</template>
						<template v-else>
							{{ Number(orderData.OrderModel.TotalPrice) }}
						</template>
						</text>
					</view>
				</view>
				<view class="form-items" style="border-bottom: none">
					<view class="label"> 明细 </view>
				</view>
				<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
					<view style="flex: 1">
						<text style="margin-right: 30rpx">人数</text>
					</view>
					<view style="text-align: right">
					{{ orderData.OrderModel.PeopleNum }}人 × ¥{{
					$utils.getretailer()?orderData.ProductModel.VisaPrice:orderData.ProductModel.VisaB2CPrice
					}}
					</view>
				</view>

				<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.OrderModel.DiscountMoney&&orderData.OrderModel.DiscountMoney>0">
					<view style="flex: 1">
						<text style="margin-right: 30rpx">优惠金额</text>
					</view>
					<view style="text-align: right">
						{{ orderData.OrderModel.DiscountMoney}} </view>
				</view>
			</view>
		</view>
		<view class="empty-block"></view>
		<view style="padding: 50rpx 40rpx" v-if="Refund > 0 && orderStatus.code == -1">
			<view class="big-title">
				<text>取消订单</text>
			</view>
			<view class="jz_form" style="margin: 40rpx 0; padding: 0">
				<view class="form-items">
					<view class="label"> 已退款总额 </view>
					<view class="val f14 regular" style="text-align: right">
						<text style="margin-right: 30rpx">{{ orderData.OrderModel.PeopleNum }}人</text>
						<text class="red">￥{{ $utils.getretailer()?orderData.ProductModel.VisaPrice:orderData.ProductModel.VisaB2CPrice }}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="jz_orderbox flex" v-if="showPayBtn">
			<view style="display: flex">
				<!-- #ifdef MP-DI -->
				<button class="jz_OrderReNow" @click="goCancelZK" 
					style="background: #fff; color: #111; border: 1px solid #111"
					:disabled="submitCancel"
					:loading="submitCancel">
						取消
					</button>
					<button class="jz_OrderReNow" 
					style="margin-left: 20rpx;" 
					@click="submitGetCodeByOrderNo" :disabled="submit" :loading="submit">
						立即支付
					</button> 
				<!-- #endif -->
				<!-- #ifdef MP-AG -->
					<button class="jz_OrderReNow" @click="goCancel" 
					style="background: #fff; color: #111; border: 1px solid #111"
					:disabled="submitCancel"
					:loading="submitCancel">
						取消
						<!-- <text v-if="!submitCancel"></text>
						<u-loading v-if="submitCancel" size="32" color="#111"></u-loading> -->
					</button>
				<!-- #endif -->
				<!-- 返回上一页 -->
				<!-- <view
          class="jz_OrderReNow"
          @click="goback"
          style="background: #fff; color: #111; border: 1px solid #111"
          v-if="!showPayBtn"
          >关闭
        </view> -->
			</view>
			<view style="display: flex; margin-left: 30rpx">
				<!-- #ifdef MP-WEIXIN -->
				<!-- 	<button class="jz_OrderReNow" @click="goFukuan" v-if="showPayBtn" :disabled="submit">
					立即支付
				</button> -->
				<!-- #endif -->
				<!-- #ifdef MP-ALIPAY -->
				<!-- 		<button class="jz_OrderReNow" @click="goZhifuAli" v-if="showPayBtn" :disabled="submit">
					立即支付
				</button> -->
				<!-- #endif -->
			</view>
		</view>
		<!-- #ifdef MP-ALIPAY -->
		<subscribe-msg />
		<!-- #endif -->
	</view>
</template>

<script>
</script>

<script>
	export default {
		components: {},
		data() {
			return {
				pageTitle: "订单详情",
				msg: {
					pageIndex: 1,
					pageSize: 15,
					MiniAppUserId: 0,
				},
				orderData: null,
				orderStatus: {},
				submit: false,
				submitCancel: false,
				showPayBtn: true,
				Refund: 0,
				orderInfo:null,
				orderId: 0,
				OrderTypeStr: 0,
				OrderNo: '',
			};
		},
		created() {},
		onLoad(option) {
			if (option.orderData) {
				this.orderData = JSON.parse(decodeURIComponent(option.orderData));
			} else if (option.orderId&&!option.OrderTypeStr) {
				this.initOrderInfo(option.orderId);
			} else if(option.OrderNo||(option.orderId&&option.OrderTypeStr)){
				if(option.OrderTypeStr){
					this.OrderTypeStr = option.OrderTypeStr
				}
				if(option.orderId){
					this.orderId = option.orderId
				}
				if(option.orderId){
					this.OrderNo = option.OrderNo
				}
				this.getOrderInfoHandler()
			}
		},
		methods: {
			submitGetCodeByOrderNo() {
				if (this.submit || this.submitCancel) return;
				this.submit = true
				this.apipost("GetCodeByOrderNo_post", {
					OrderNo: this.OrderNo,
					MallBaseId: uni.getStorageSync("mall_UserInfo").MallBaseId
				}, (res) => {
					if (res.resultCode == 1) {
						this.orderInfo =JSON.parse(res.data.sPayInfo)
						this.goPayHandler();
					} else {
						uni.showToast({
							title:res.message,
							icon:'none',
							duration:3000
						})
						this.submit = false;
					}
				});
			},
			goPayHandler() {
				let that = this;
				uni.requestPayment({
					provider: "wxpay",
					timeStamp: this.orderInfo.timeStamp,
					nonceStr: this.orderInfo.nonceStr,
					package: this.orderInfo.package,
					signType: this.orderInfo.signType,
					paySign: this.orderInfo.sign,
					success: function(res) {
						console.log("success", res);
						that.submit = false;
						uni.showToast({
							title: "支付成功",
						});
						setTimeout(() => {
							uni.redirectTo({
								url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
								that.price +
									"&isFrom=3",
							});
						}, 100);
					},
					fail: function(err) {
						console.log("fail:", err);
						that.submit = false;
						uni.showToast({
							title: "支付失败",
							icon: "none",
						});
					},
				});
			}, 
			getOrderInfoHandler(){
				this.apipost("GetDetailsByErpOrderId_post",{
					OrderNo: this.OrderNo, 
					ErpOrderId: this.orderId,
					OrderTypeStr: this.OrderTypeStr,
				},res=>{
					if(res.resultCode==1){
						this.orderData = {
							...res.data
						}
						this.initOrderInfo(res.data.ErpOrderId);
						this.formatStatus(
							res.data.OrderStatus,
							null,
							null,
							null
						);
					}else{
						
					}
				})
			},
			goDetail() {
				uni.navigateTo({
					url: "/pages/visa/visaDetail?id="+this.orderData.ProductModel.Id
				})
			},
			goback() {
				uni.navigateBack({
					delta: 1,
				});
			},
			goCancel() {
				if (this.submit || this.submitCancel) return;
				//未付款-调用后台取消
				if (this.orderData.OrderModel.VisaOrderStatus!=2&&
				(this.orderData.OrderModel.VisaOrderStatus==1&&this.orderData.OrderModel.Income==0)
				||(this.orderData.OrderModel.VisaOrderStatus==3)) {
					this.submitCancel = true
					let that = this
					wx.showModal({
						title: '提示',
						content: '确定取消订单？',
						success: (tip) => {
							if (tip.confirm) {
								uni.showLoading()
								that.apipost(
									"b2c_get_SetB2BOrderCancel", {
										OrderId: this.orderData.OrderModel.Id,
										OrderSource: 5
									},
									(res) => {
										if (res.resultCode == 1) {
											uni.showToast({
												title: "操作成功",
												icon: "success",
											});
											uni.navigateTo({
												url: "/pages/visa/visa_MyOrder",
											});
										}
										uni.hideLoading()
										this.submitCancel = false
									},
									(err) => {
										uni.hideLoading()
									}
								);
							}else this.submitCancel = false
						}
					})
				}
			},
			goCancelZK() {
				if (this.submit || this.submitCancel) return;
				this.submitCancel = true;
				if (this.orderData.OrderStatus == 1) {
					
					this.apipost(
						"GetCancelOrder_post", {
							OrderNo: this.OrderNo
						},
						(res) => {
							if (res.resultCode == 1) {
								uni.showToast({
									title: "操作成功",
									icon: "success",
								});
								uni.navigateTo({
									url: "/pages/visa/visa_MyOrder",
								}); 
							}
							this.submitCancel = false
						},
						(err) => {
							this.submitCancel = false
						}
					);
				}
			},
			getWeek(date) {
				var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
				var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
				return "周" + week;
			},
			getDate(date) {
				if (date) {
					let arr = date.split("-");
					return arr[1] + "月" + arr[2] + "日";
				}
			},
			initOrderInfo(orderId) {
				let msg = {
					Id: orderId,
				};
				this.apipost(
					"b2c_get_GetB2CVisaOrderInfo",
					msg,
					(res) => {
						if (res.resultCode == 1) {
							this.orderData = {
								...this.orderData,
								OrderModel:{ 
									...res.data.OrderModel
								},
								ProductModel:{ 
									...res.data.ProductModel
								}
							}
							// #ifdef MP-AG
								this.formatStatus(
									this.orderData.OrderModel.VisaOrderStatus,
									this.orderData.OrderModel.Income,
									this.orderData.OrderModel.TotalPrice,
									this.orderData.OrderModel.PlatformTax
								);
							// #endif
							
						} else {
							this.orderData = {
								result: -1,
							};
						}
					},
					(e) => {}
				);
			},
			formatStatus(status,Income,TotalPrice,PlatformTax) {
				// #ifdef MP-DI
					if(status==1){
						this.orderStatus.code = 0;
						this.orderStatus.text = "待付款";
						this.showPayBtn = true;
					}else if(status==2){
						this.orderStatus.code = 1;
						this.orderStatus.text = "已付款";
						this.showPayBtn = false;	
					}else if(status==3){
						this.orderStatus.code = 1;
						this.orderStatus.text = "已完成";
						this.showPayBtn = false;	
					}else if(status==4){
						this.orderStatus.code = -1;
						this.orderStatus.text = "已取消";
						this.showPayBtn = false;	
					}
				// #endif
				// #ifdef MP-AG
					if (status == 2) {
						this.orderStatus.code = -1;
						this.orderStatus.text = "已取消";
						this.showPayBtn = false;
					} else if (status == 3) {
						this.orderStatus.code = 0;
						this.orderStatus.text = "待付款";
						this.showPayBtn = true;
					} else if (status == 1&&(Income+PlatformTax)<TotalPrice) {
						this.orderStatus.code = -2;
						this.orderStatus.text = "正常";
						this.showPayBtn = false;
					} else if (status == 1&&(Income+PlatformTax)==TotalPrice) {
						this.orderStatus.code = 1;
						this.orderStatus.text = "已付款";
						this.showPayBtn = false;
					}
				// #endif
			},
			// #ifdef MP-WEIXIN
			goFukuan() {
				if (this.submit || this.submitCancel) return;
				var that = this;
				var tempData = uni.getStorageSync("basedata");
				var tempObj = [];
				if (tempData && tempData.mall && tempData.mall.wechatmessage) {
					tempObj = tempData.mall.wechatmessage;
				}
				var tmplIds = [];
				if (tempObj && tempObj.length > 0) {
					tempObj.forEach((x) => {
						if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
							tmplIds.push(x.MessageId);
						}
					});
				}
				uni.requestSubscribeMessage({
					tmplIds: tmplIds,
					complete(res) {
						that.goZhifu();
					},
				});
			},
			//支付
			goZhifu() {
				this.submit = true;
				let url = "/api/WeChatPay/GetTravlePayInfo";
				let GoodsName = this.orderData.OrderModel.Title;
				GoodsName = GoodsName.slice(0, 10);
				this.request2({
						url: url,
						data: {
							OrderId: this.orderData.OrderModel.Id,
							GoodsName: GoodsName,
							OrderPayType: 1,
							OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
						},
					},
					(res) => {
						try {
							let orderInfo = JSON.parse(res.data);
							console.log(orderInfo);
							this.goPay(orderInfo);
						} catch (e) {
							uni.showToast({
								title: '无法正常拉取微信支付，你可以稍后重试或联系销售人员线下转款',
								icon: 'none'
							})
							setTimeout(() => {
								this.submit = false;
							}, 2000);
						}

					}
				);
			},
			goPay(orderInfo) {
				let that = this;
				uni.requestPayment({
					provider: "wxpay",
					timeStamp: orderInfo.timeStamp,
					nonceStr: orderInfo.nonceStr,
					package: orderInfo.package,
					signType: orderInfo.signType,
					paySign: orderInfo.sign,
					success: function(res) {
						console.log("success", res);
						uni.showToast({
							title: "支付成功",
						});
						that.submit = false;
						//todo
						that.initOrderInfo(that.orderData.OrderModel.Id);
					},
					fail: function(err) {
						console.log("fail:", err);
						that.submit = false;
						uni.showToast({
							title: "支付失败",
							icon: "none",
						});
						that.initOrderInfo(that.orderData.OrderModel.Id);
					},
				});
			},
			// #endif
			// #ifdef MP-ALIPAY
			//支付宝支付
			goZhifuAli() {
				this.submit = true;
				let that = this;
				uni.showLoading({
					title: "支付中",
				});
				let url = "/api/WeChatPay/GetTravlePayInfo";
				let GoodsName = this.orderData.OrderModel.Title;
				this.request2({
						url: url,
						data: {
							OrderId: this.orderData.OrderModel.Id,
							GoodsName: GoodsName,
							OrderPayType: 2,
							OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
						},
					},
					(res) => {
						if (res.data) {
							this.$utils.SubscribeMsgAli(() => {
								that.goPayAli(res.data);
							});
						} else {
							uni.hideLoading();
							uni.showToast({
								title: "获取交易号失败",
								duration: 2000,
							});
						}
					}
				);
			},
			goPayAli(tradeNO) {
				let that = this;
				my.tradePay({
					tradeNO: tradeNO,
					success: function(res) {
						console.log("success", res);
						const list = ["9000"];
						if (list.includes(res.resultCode)) {
							let obj = {
								TradeNo: tradeNO,
								OrderNo: that.orderData.OrderModel.OrderNo,
								OrderId: that.orderData.OrderModel.Id,
								preferPrice: that.orderData.OrderModel.PreferPrice,
							};
							that.payAliCallback(obj);
						} else {
							uni.hideLoading();
							uni.showToast({
								title: "支付失败",
								icon: "none",
							});
						}
					},
					fail: function(err) {
						console.log("fail:", err);
						uni.hideLoading();
						uni.showToast({
							title: "支付失败",
							icon: "none",
						});
						that.submit = false;
						that.initOrderInfo(that.orderData.OrderModel.Id);
					},
				});
			},
			payAliCallback(obj) {
				let that = this;
				this.request2({
						url: "/api/AliPay/ALiPayCallBackDmcNotify",
						data: {
							OrderNo: obj.OrderNo,
							OrderId: obj.OrderId,
							UserId: uni.getStorageSync("mall_UserInfo").UserId,
							TradeNo: obj.TradeNo,
							ProjectType: 2,
							PreferPrice: obj.preferPrice,
						},
					},
					(res) => {
						that.submit = false;
						uni.redirectTo({
							url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
								obj.preferPrice +
								"&isFrom=1",
						});
						uni.hideLoading();
					},
					(err) => {
						console.log("err", err);
						that.submit = false;
						uni.hideLoading();
						uni.showToast({
							title: "支付失败",
							icon: "none",
						});
						that.initOrderInfo(that.orderData.OrderModel.Id);
					}
				);
			},
			// #endif
		},
	};
</script>
