<template>
	<view v-if="isShowView">
		<!--pages/subOrder/subOrder.wxml-->
		<view class="pdlr20 pd">
			<view class="peisong r10">
				<view class="pstit">
					<view class="psfs">配送方式</view>
				</view>
				<view class="ztaddr" v-if="isZiti || orderType == 2">
					<view class="mdinfo dflex user">
						<view class="dflex username">
							提货人：
							<input class placeholder="请填写姓名" type="text" @input="getusername" :value="realName" />
						</view>
						<view class="dflex">
							提货电话：
							<input v-if="show" class placeholder="请填写提货电话" type="text" @input="getphone" maxlength="11" :value="phone" />
							<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="mobile" v-else>填写手机号</button>
						</view>
					</view>

					<view class="ztaddrs dflex">
						<view class="info">
							<view class="name" @tap="updateShop">自提点：{{ merchant.title ? merchant.title : '请选择门店' }}</view>
							<view class="area" @tap="checkMap">
								<image src="/static/pages/images/dzico.png" class="dzico"></image>
								<text class="address">{{ merchant.address }}</text>
							</view>
						</view>
						<view class="rbox" @tap="updateShop"><image src="/static/pages/images/more.png" class="rico"></image></view>
					</view>

					<image src="/static/pages/images/dzbg.png" class="dzbg"></image>
				</view>
				<view class=" psaddr" v-else>
					<view class="addr " @tap="addOrUpdateAddress">
						<image src="/static/pages/images/dzico.png" class="dzico"></image>
						<view class="flex" v-if="address.address || address.house">
							<view class="name">{{ address.address }}{{ address.house }}</view>
							<view class="text" v-if="address.name">
								{{ address.name }}
								<text>{{ address.phone }}</text>
							</view>
						</view>
						<view class="flex" v-else>请添加收货地址</view>
						<image src="/static/pages/images/more.png" class="rico"></image>
					</view>

					<view class="addr " @tap="updateShop" v-if="merchant">
						<image src="/static/pages/images/dzico.png" class="dzico"></image>
						<view class="flex">
							<view class="name">{{ isJs && merchant.isDefault != 1 ? '配送点：' : '服务点：' }}{{ merchant.title ? merchant.title : '请选择门店' }}</view>
							<view class="text" v-if="address.name">{{ merchant.address }}</view>
						</view>
						<image src="/static/pages/images/more.png" class="rico"></image>
					</view>

					<image src="/static/pages/images/dzbg.png" class="dzbg"></image>
				</view>
			</view>
			<!-- 送达时间 -->
			<view class="sendtime dflex" @tap="serviceTime" v-if="isJs && !isZiti && !activity" style="display: none;">
				<text>送达时间</text>
				<view class="flex">{{ sendTimes ? sendTimes : '请选择时间' }}</view>
				<image src="/static/pages/images/more.png" class="rico"></image>
			</view>
			<view class="list mt20">
				<view class="li">
					<view class="cimgs">
						<image :src="mergeProduct.pic" mode="aspectFit" class="cimg"></image>
					</view>
					<view class="zhinfo">
						<view class="zhtit">{{ mergeProduct.title }}</view>
						<view class="guigecontent">
							规格：<text class="guige" decode="true">{{ mergeProductPrice.title }}</text>
						</view>
						<view class="jiage">
							<view class="zhjia">
								<text>￥</text>
								{{ mergeProductPrice.salePrice }}
							</view>
							<view class="num">
								<text class="nums">×{{ query.mergeQuantity }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 海外购 -->
			<view class="overseasPurchase" v-if="orderType == 10 || isHwg">
				<view class="li">
					<text>购买人：</text>
					<view class="item"><input name="hwgName" placeholder="必填" :value="hwgName" @input="gethwgName" /></view>
					<image src="/product/static/product/image/bi.png" class="bi"></image>
				</view>
				<view class="li">
					<text>身份证号：</text>
					<view class="item"><input name="cardNo" placeholder="必填" :value="cardNo" @input="getcardNo" /></view>
					<image src="/product/static/product/image/bi.png" class="bi"></image>
				</view>
				<view class="dflex info">
					<image src="/product/static/product/image/hwg.png" class="hwg"></image>
					<text>海关规定，购买跨境商品需验证支付人身份证信息，否则将 导致无法清关，请确认您的身份证信息。</text>
				</view>
			</view>
			<view class="ddinfo">
				<view class="li">
					<text>商品数量</text>
					<view>共{{ count >= 0 ? count : '0' }}件</view>
				</view>
				<view class="li">
					<text>订单金额</text>
					<view>￥{{ money > 0 ? money : '0' }}</view>
				</view>
				<view class="li" v-if="orderType == 11">
					<text>使用积分</text>
					<view>{{ integral }}</view>
				</view>
				<view class="li" v-if="!isZiti && feeMoney">
					<text>邮费</text>
					<view>￥{{ feeMoney }}</view>
				</view>
				<navigator url="/product/coupon/coupon?isChoose=true" hover-class="none" class="li" v-if="couponList && couponList.length > 0">
					<text>优惠券</text>
					<view class="quan" v-if="couponter.length > 0">
						{{ isUseCoupon && coupon ? '-￥' : '不使用优惠券' }}<block v-if="isUseCoupon&&coupon">{{ couponList[couponIndex].couponAmount ? couponList[couponIndex].couponAmount : '' }}</block>
					</view>
					<view class="quan" v-else>暂无可用优惠券</view>
					<image src="/static/pages/images/more.png" class="rico"></image>
				</navigator>

				<view class="li" v-if="(is_open_wallet.isOpenWallet == 1&&balanceMoney>0) || (isOfflinePayment&&kybalanceMoney>0)" @tap="balanceShow">
					<text>余额</text>
					<view class="quan">
						{{ (balance && checked) || (kybalances && kychecked) ? '-￥' : '不使用余额'
						}}{{ balance && checked ? balanceMoney : kybalances && kychecked ? kybalanceMoney : '' }}
					</view>
					<image src="/static/pages/images/more.png" class="rico"></image>
				</view>
			</view>
			<view class="ddinfo">
				<view class="li">
					<text>备注：</text>
					<input name="node" placeholder="给卖家留言..." placeholder-class="placeholder" class="flex" @input="noteInput" />
				</view>
			</view>
		</view>

		<view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 120) + 'rpx'"></view>
		<view class="bot" :style="'padding-bottom:' + bottomBlankHeight + 'rpx'">
			<view class="heji" v-if="orderType != 11">
				￥
				<text>{{ payMoney > 0 ? payMoney : '0' }}</text>
			</view>
			<view v-if="orderType == 11" class="integral zong">
				<text class="intnum">{{ integral }}积分</text>
				<text class="money">+￥{{ payMoney }}</text>
			</view>
			<view class="jiesuan" @tap="isBusiness ? tab() : ''">提交订单</view>
		</view>
		<view class="chufangy" v-if="!isRx">订单中包含处方药，需咨询医生开具处方购买</view>

		<!-- 选择送达时间 -->
		<view class="ceng" :hidden="isTimeShow" @tap="closeTime"></view>
		<view class="time-pop" :hidden="isTimeShow">
			<image src="/static/pages/images/close.png" class="close" @tap="closeTime"></image>
			<view class="pop-tit">选择送达时间</view>
			<view class="pop-tits">选择送达时间</view>
			<view class="pop-con dflex">
				<view class="pop-left">
					<view v-for="(item, index) in aWeek" :key="index" :class="'li ' + (dateIndex == index ? 'active' : '')" @tap="dateDay" :data-index="index" v-if="index < 7">
						{{ item.newday }}{{ item.day }}
					</view>
					<view class="li" @tap="moreDate">更多日期</view>
				</view>
				<view class="pop-right">
					<view v-for="(item, index) in timeList" :key="index" :class="'li ' + (timeIndex == index ? 'active' : '')" @tap="dataTime" :data-index="index">
						{{ item }}
						<image src="/static/pages/images/sjgou.png" class="gou"></image>
					</view>
				</view>
			</view>
			<view class="pop-btn" @tap="timeConfirm">确定</view>
		</view>
		<!-- 更多送达日期 -->
		<view class="time-pop" :hidden="isMoreTimeShow">
			<view class="backtime dflex" @tap="closeMoreTime">
				<image src="/static/pages/images/back.png"></image>
				返回
			</view>
			<image src="/static/pages/images/close.png" class="close" @tap="closeMoreTime"></image>
			<view class="pop-tit">选择送达时间</view>
			<view class="pop-list">
				<picker-view indicator-style="height:40px;" :value="value" @change="bindChange">
					<picker-view-column>
						<view v-for="(item, index) in aWeek" :key="index" class="li">{{ item.newday }}{{ item.day }}</view>
					</picker-view-column>
					<picker-view-column>
						<view v-for="(item, index) in timeList" :key="index" class="li">{{ item }}</view>
					</picker-view-column>
				</picker-view>
			</view>
			<view class="pop-btn" @tap="timeConfirm">确定</view>
		</view>

		<view class="ceng" :hidden="isBalanceShow" @tap="closeBalance"></view>
		<view class="time-pop" :hidden="isBalanceShow">
			<view class="balance-tit">余额</view>
			<view class="balances">
				<view class="dflex balance">
					<view>
						账户余额
						<text>￥{{ userMoney }}</text>
					</view>
					<view class="dflex reduced">
						本单
						<text>已减￥{{ balanceMoney ? balanceMoney : '0' }}</text>
						<radio-group @change="radioChange"><radio :value="balanceMoney" :checked="checked" class="radios" color="#EF4A37" @tap="checkedFun"></radio></radio-group>
					</view>
				</view>
				<view class="dflex balance" v-if="isOfflinePayment && kybalance > 0">
					<view>
						线下余额
						<text>￥{{ kybalance }}</text>
					</view>
					<view class="dflex reduced">
						本单
						<text>已减￥{{ kybalanceMoney ? kybalanceMoney : '0' }}</text>
						<radio-group @change="radioChangeKy">
							<radio :value="kybalanceMoney" :checked="kychecked" class="radios" color="#EF4A37" @tap="checkedFunKy"></radio>
						</radio-group>
					</view>
				</view>
			</view>
			<view class="pop-btn" @tap="balanceConfirm">确定</view>
		</view>
	</view>
</template>

<script>
// pages/subOrder/subOrder.js
const app = getApp();
const req = require('../../utils/request.js');
var QQMapWX = require('../../utils/qqmap.js');
const requsetmessage = require('../../utils/requestmessage.js');
const util = require('../../utils/util.js');
const route = require('../../utils/route');

export default {
	data() {
		return {
			isShowView: false,
			bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
			isJs: false,
			isZiti: false,
			merchant: {},
			address: {},
			ids: '',
			pageList: [],
			count: 0,
			money: 0,
			note: '',
			couponIndex: 0,
			couponList: [],
			couponter: [],
			isRx: true,
			phone: '',
			coupon: true,
			show: false,
			isTimeShow: true,
			//送达时间
			isMoreTimeShow: true,
			//更多送达时间
			dateIndex: 0,
			//当前选择送达日期
			aWeek: [],
			//未来七天
			timeList: [
				'9:00-10:00',
				'10:00-11:00',
				'11:00-12:00',
				'12:00-13:00',
				'13:00-14:00',
				'14:00-15:00',
				'15:00-16:00',
				'16:00-17:00',
				'17:00-18:00',
				'18:00-19:00',
				'19:00-20:00',
				'20:00-21:00',
				'21:00-22:00',
				'22:00-23:00',
				'23:00-24:00'
			],
			//时间段
			timeIndex: 0,
			//当前选择时间
			checked: false,
			isBalanceShow: true,
			orderType: '',
			is_customer_pick_up: '',
			query: '',
			userInfo: '',
			realName: '',
			userMoney: '',
			ziti: false,
			youji: false,
			deliver_way: '',
			is_open_wallet: '',
			// fee: "",
			// free: "",
			onlyPeisong: '',
			Is_Store_Price_Stock: '',
			is_open_shop: '',
			cardNo: '',
			hwgName: '',
			isGys: false,
			feeMoney: '',
			balance: false,
			balanceMoney: '',
			payMoney: '',
			integral: '',
			sendTimes: '',
			userIntegral: '',
			overTime: true,
			isHwg: false,
			isBusiness: true,
			User_Limit_Store: '',
			about: {},
			kychecked: false,
			kybalance: 0, //线下余额
			kybalances: false,
			kybalanceMoney: '',
			isOfflinePayment: false ,//是否开启线下支付
			isUseCoupon: true,//是否使用优惠券
			isUpdateMoney: false,//是否重新计算金额
			mergeProduct: {},//套餐详情
			mergeProductPrice: {},//套餐详情
		};
	},

	components: {},
	props: {},
	onLoad: function(options) {
		console.log('参数' + JSON.stringify(options));
		this.query = options;

		QQMapWX.initMap(req.public.mapLBSKEY);
		this.getMy();
		this.init();
		app.globalData.getCheckSessoin(json => {
			this.sessionKey = json.session_key;
		});
	},

	onShow() {
		this.mergeProductPrice = req.getStorage('mergeProduct');
		this.getMerchant();
		// console.log(this.merchant); // let merchant = req.getStorage("MERCHANT");
		// this.setData({ merchant: merchant });
		//重新计算价格

		// this.CalculationMoney();
		if(this.isUpdateMoney){
			this.CalculationMoney();
		}
		this.getFreightMoney();//重新获取运费（用于切换收货地址）
		let userInfo = req.getStorage('userInfo');
		this.setData({
			userInfo: userInfo
		});

		if (userInfo.realName) {
			this.setData({
				realName: req.excludeSpecial(userInfo.realName)
			});
		} else if (userInfo.nickName) {
			this.setData({
				realName: req.excludeSpecial(userInfo.nickName)
			});
		} //*****************/改动

		this.setData({
			phone: userInfo.mobile
		});

		var arr = [];

		for (let i = 0; i < 30; i++) {
			arr.push(this.dealTime(i));
		}

		arr[0].day = '（今天）';
		arr[1].day = '（明天）';
		arr[2].day = '（后天）';
		let myDate = new Date();
		let hour = myDate.getHours();
		let timeList = this.timeList;
		arr.map((item, index) => {
			if (index == 0) {
				item.timeList = timeList.slice(hour - 8);
			} else {
				item.timeList = timeList;
			}

			return item;
		});
		this.setData({
			aWeek: arr,
			timeList: timeList.slice(hour - 8)
		});
	},

	methods: {
		checkRequire(formItemList){//判断是否存在实物产品
		console.log('formItemList==',formItemList)
			for(var i = 0; i < formItemList.length; i++){
				if(formItemList[i].product.productForm == 1){
					return false;
				} 
			}
			return true;
		},
		loadProudct() {
			let that = this;
			let form = {
				id: that.query.id
			};
			let isShowLoading = false;
			if (!isShowLoading) {
				req.loadIng('加载中');
				isShowLoading = true;
			}
			req.getRequest('/api/v3/merge/detail', form, data => {
				// productForm=1 实物, 2 线下服务, 3 虚拟物
				that.isShowView = true;
				that.mergeProduct = data;
				let nodeList = data.nodeList;
				this.isZiti = this.checkRequire(nodeList);
				console.log('是否存在实物==',this.checkRequire(nodeList))
				that.getFreightMoney();
				that.loadCoupon();
				that.CalculationMoney();
				if (isShowLoading) {
					uni.hideLoading();
					isShowLoading = false;
				}
			})
		},
		async init() {
			await this.getUserAddress();
			await this.getConfig();
			await this.loadProudct();
			// await this.getList();
			await this.getuserMoney();
			if (this.isOfflinePayment) {
				await this.getUserInformation();
			}
		},
		getUserInformation() {
			let _ts = this;
			req.postRequest('/api/order/userInformation', {}, res => {
				if (res) {
					_ts.kybalance = res.kybalance;
					if (_ts.userMoney == 0 && res.kybalance > 0) {
						_ts.kychecked = true;
						_ts.CalculationMoney();
					}
				}
			});
		},

		// 余额查询
		getuserMoney() {
			let _ts = this;
			let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
			if (is_open_wallet) {
				if (JSON.parse(is_open_wallet).isOpenWallet == 1 || this.is_open_wallet.isOpenWallet == 1) {
					route.extendNew({}, res => {
						if (res) {
							this.setData({
								userMoney: parseFloat(res.all).toFixed(2)
							});
							if (res.all > 0) {
								_ts.checked = true;
								_ts.CalculationMoney();
							}
						}
					});
				}
			}
		},

		getMerchant() {
			if (!this.query.merchantId || this.about.Many_Store == 0) {
				// 总店
				let defaultMerchant = req.getStorage('defaultMerchant');
				this.setData({
					merchant: defaultMerchant
				});
				// let merchant = req.getStorage('MERCHANT')
				// this.setData({ merchant: merchant })
			} else {
				let from = {};

				if (this.query.shopId != null && this.query.shopId != undefined && this.query.shopId != '') {
					from.id = this.query.shopId;
				} else {
					from.id = this.query.merchantId;
				}
				req.getRequest('/api/merchant/detail', from, res => {
					if (!res.id) {
						if (this.Is_Store_Price_Stock == 1) {
							this.isBusiness = false;
							return req.msg('该门店不存在' + (this.User_Limit_Store != 1 ? '，因各门店价格不同，请重新下单' : ''));
						} else {
							return req.msg('该门店不存在' + (this.User_Limit_Store != 1 ? '，请切换门店' : ''));
						}
					} else {
						var timestamp = Date.parse(new Date());
						if (!res.isBusiness) {
							if (this.Is_Store_Price_Stock == 1) {
								this.isBusiness = false;
								return req.msg('该门店暂未营业' + (this.User_Limit_Store != 1 ? '，因各门店价格不同，请重新下单' : ''));
							} else {
								return req.msg('该门店暂未营业' + (this.User_Limit_Store != 1 ? '，请切换门店' : ''));
							}
						} else {
							if (!res.isGoods && res.type != 5) {
								if (this.Is_Store_Price_Stock == 1) {
									this.isBusiness = false;
									return req.msg('该门店暂不发货' + (this.User_Limit_Store != 1 ? '，因各门店价格不同，请重新下单' : ''));
								} else {
									return req.msg('该门店暂不发货' + (this.User_Limit_Store != 1 ? '，请切换门店' : ''));
								}
							}
							if (res.type == 5 && !res.isDistance) {
								if (this.Is_Store_Price_Stock == 1) {
									this.isBusiness = false;
									return req.msg('该门店暂不发货' + (this.User_Limit_Store != 1 ? '，因各门店价格不同，请重新下单' : ''));
								} else {
									return req.msg('该门店暂不发货' + (this.User_Limit_Store != 1 ? '，请切换门店' : ''));
								}
							}
							if (res.isDefault == 1 && this.query.orderType != '2') {
								// this.setData({ isZiti: false, youji: true })
							} else if (res.type == 5) {
								res.time = timestamp + 60 * 60 * 1000;
								res.merchantDTO.time = timestamp + 60 * 60 * 1000;
								req.setStorage('smallShop', res);
								// req.setStorage('MERCHANT', res.merchantDTO);
								req.getRequest(
									'/api/params/value',
									{
										type: 'shop_config'
									},
									res => {
										// JSON.parse(res)
										// console.log(res)

										if (!res || !res.deliverWay) {
											this.setData({
												isZiti: true,
												ziti: true
											});
										} else {
											let deliver_way = res.deliverWay;

											if (deliver_way.length >= 2) {
												if ((deliver_way[0] == '2' && deliver_way[1] == '3') || (deliver_way[0] == '3' && deliver_way[1] == '2')) {
													this.setData({
														isZiti: false,
														youji: true
													});
												}
											} else if (deliver_way.length == 1) {
												deliver_way.forEach(it => {
													if (it == 1) {
														this.setData({
															isZiti: true,
															ziti: true
														});
													}

													if (it == 2 || it == 3) {
														this.setData({
															isZiti: false,
															youji: true
														});
													}
												});
											}

											this.setData({
												deliver_way: res.deliverWay
											});
										}
									}
								);
							} else {
								// this.setData({ isZiti: true })
								res.time = timestamp + 60 * 60 * 1000;
								// req.setStorage('MERCHANT', res);
								req.removeStorage('smallShop');
							}

							this.setData({
								merchant: res
							});
						}
					}
				});
			}
		},

		selZiti() {
			if (this.isZiti == false && this.isGys) {
				req.msg('您选择的部分商品，不提供自提服务');
				return false;
			}

			if (this.isZiti == false && this.merchant.isGoods == 0) {
				req.msg('该门店，不提供自提服务');
				return false;
			}

			this.setData({
				isZiti: !this.isZiti
			});
			this.CalculationMoney();

			if (this.isZiti == true && this.isJs) {
				req.msg('您选择的是门店自提，不享受及时达服务');
			}
		},

		// 选择余额
		balanceShow() {
			this.setData({
				isBalanceShow: false
			});
		},

		closeBalance() {
			this.setData({
				isBalanceShow: true
			});
			this.CalculationMoney();
		},

		checkedFun() {
			this.setData({
				checked: !this.checked,
				kychecked: false
			});
		},
		checkedFunKy() {
			this.setData({
				checked: false,
				kychecked: !this.kychecked
			});
		},

		balanceConfirm() {
			this.setData({
				isBalanceShow: true
			});
			this.CalculationMoney();
		},

		getConfig() {
			var _this = this;

			return new Promise((resolve, reject) => {
				req.getRequest('/api/config', {}, function(res) {
					if (res.is_open_wallet) {
						let is_open_wallet = JSON.parse(res.is_open_wallet);
						_this.is_open_wallet = is_open_wallet;

						_this.setData({
							is_open_wallet: is_open_wallet
						});
					}

					_this.setData({
						// fee: res.Express_Fee,  //zxb 12.20日屏蔽，调用邮费模板
						// free: res.Free_Shipping,//zxb 12.20日屏蔽，调用邮费模板
						onlyPeisong: res.is_customer_pick_up == 1 ? true : false,
						isOfflinePayment: res.is_open_OfflinePayment == 1 ? true : false,
						Is_Store_Price_Stock: res.Is_Store_Price_Stock,
						is_open_shop: res.is_open_shop,
						User_Limit_Store: res.User_Limit_Store,
						about: res
					});

					resolve();
				});
			});
		},

		// 获取身份证号
		getcardNo(e) {
			this.setData({
				cardNo: e.detail.value
			});
		},

		// 获取购买人姓名
		gethwgName(e) {
			this.setData({
				hwgName: e.detail.value
			});
		},

		checkMap() {
			let url = 'product/map/map';
			app.globalData.openPage(url);
		},

		updateShop() {
			if (!this.isBusiness) {
			} else {
				if (this.Is_Store_Price_Stock == 1 && this.merchant.id && !this.query.activityId) {
					uni.navigateTo({
						url: '/pages/nearbyDetails/nearbyDetails?id=' + this.merchant.id
					});
				} else {
					let url = 'merchant/nearby/nearby?isChoose=true';
					app.globalData.openPage(url);
				}
			}
		},

		getList() {
			let that = this;
			req.getRequest(
				'/api/purchase/list',
				{
					ids: this.ids // merchantId: this.data.merchant.id
				},
				data => {
					if (!data || data.length == 0) return req.msg('数据不存在');
					data = data.map(it => {
						if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
						return it;
					});

					that.setData({
						pageList: data
					});
					this.getFreightMoney();
					this.pageList.forEach(res => {
						if (res.isOtc == '1') {
							this.setData({
								isRx: false
							});
						}

						if (res.isOtc == '5') {
							if (!this.activityId && that.query.orderType != 20) {
								this.setData({
									orderType: 10,
									youji: true,
									isZiti: false
								});
							} else {
								this.youji = true;
								this.isZiti = false;
								this.isHwg = true;
							}
						}

						if (res.isTimely == '2') {
							this.setData({
								isGys: true
							});
						}

						if (JSON.parse(res.deliverWay) && res.isOtc != '5' && that.query.orderType != 2) {
							// 判断有发货方式有几种
							let deliverWay = JSON.parse(res.deliverWay).find((value, index, arr) => {
								return value >= 2;
							});
							// 发货方式大于2，并且没有1  就是只有邮寄
							if (deliverWay && JSON.parse(res.deliverWay).indexOf(1) == -1) {
								that.setData({
									youji: true,
									isZiti: false
								});
							}
							// 发货方式只有1中，并且是1 就是只有自提
							if (JSON.parse(res.deliverWay).indexOf(1) != -1 && JSON.parse(res.deliverWay).length == 1) {
								that.setData({
									ziti: true,
									isZiti: true
								});
							}
							// 发货方式中有3,或者4 并且不是社区团购订单，并且没有活动id 就是极速达
							if ((JSON.parse(res.deliverWay).indexOf(3) != -1 || JSON.parse(res.deliverWay).indexOf(4) != -1) && this.orderType != 2) {
								that.setData({
									isJs: true
									// orderType: 5
								});
								if (JSON.parse(res.deliverWay).indexOf(2) == -1 && JSON.parse(res.deliverWay).indexOf(1) == -1) {
									that.setData({
										onelyJsd: true
									});
								}
								if (JSON.parse(res.deliverWay).indexOf(2) != -1) {
									that.setData({
										Jsdyouji: true
									});
								}
								if (JSON.parse(res.deliverWay).indexOf(1) != -1) {
									that.setData({
										Jsdziti: true
									});
								}
							}
						}
					});
					if(!that.pageList[0].activityType){
						that.loadCoupon();
					}
					that.CalculationMoney(); // let count = 0;
					// let money = 0;
					// data.forEach(dt => {
					//   count += dt.quantity;
					//   money += dt.quantity * dt.price;
					// })
					// that.setData({
					//   pageList: data,
					//   count: count,
					//   money: money,
					//   payMoney: payMoney
					// })
					this.isShowView = true;
				}
			);
		},

		adjustmentQuantity(id, quantity, skuId, success) {
			req.postRequest(
				'/api/purchase/quantity',
				{
					id: id,
					skuId: skuId,
					quantity: quantity
				},
				() => {
					success.call(this);
				}
			);
		},

		jianQuantity(event) {
			const index = event.currentTarget.dataset.index;
			const page = this.pageList[index];
			if (page.quantity <= 1) return false;
			const q = page.quantity - 1;
			let that = this;
			this.adjustmentQuantity(page.id, q, page.skuId, () => {
				let d = {};
				d['pageList[' + index + '].quantity'] = q;
				that.setData(d);
				that.CalculationMoney();
			});
		},

		jiaQuantity(event) {
			const index = event.currentTarget.dataset.index;
			const page = this.pageList[index];
			const q = page.quantity + 1;
			let that = this;
			this.adjustmentQuantity(page.id, q, page.skuId, () => {
				let d = {};
				d['pageList[' + index + '].quantity'] = q;
				that.setData(d);
				that.CalculationMoney();
			});
		},

		//调用接口获取邮费
		getFreightMoney() {
			if (this.pageList && this.pageList.length > 0 && this.address && this.address.id) {
				this.feeMoney='';
				this.CalculationMoney();
				req.getRequest(
					'/api/purchase/freight',
					{
						ids: this.pageList.map(it => it.id).join(','), //购物车id
						addressId: this.address.id //收货地址ID
					},
					res => {
						console.log('快递运费>>>>=====' + res);
						this.feeMoney=res;
						this.CalculationMoney();
					}
				);
			}
		},

		CalculationM() {
			//计算商品总价格
			let count = this.query.mergeQuantity;
			let money = this.mergeProductPrice.salePrice * count;

			let payMoney = 0;

			if (this.isZiti) {
				payMoney = money;
				this.setData({
					feeMoney: '0'
				});
			} else {
				money = parseFloat(money).toFixed(2);
				// zxb 12.20屏蔽  使用了运费模板，故老的逻辑屏蔽
				// let fee = 0;
				// if (this.free > 0) fee = Number(money) - Number(this.free);
				// else fee = Number(money);

				// this.setData({
				// 	feeMoney: fee >= 0 ? 0 : this.fee
				// });
				if (this.feeMoney > 0) payMoney = Number(money) + Number(this.feeMoney);
				else payMoney = Number(money);
			}
			if(this.isUseCoupon){
				//获取优惠券价格
				if (this.couponList.length > 0 && this.couponter.length > 0) {
					const coupon = this.couponList[this.couponIndex];
				
					if (coupon == undefined) {
						(payMoney = payMoney),
							this.setData({
								coupon: false
							});
					} else {
						if (payMoney >= coupon.couponFull) {
							(payMoney = payMoney - parseFloat(coupon.couponAmount)),
								this.setData({
									coupon: true
								});
						} else {
							payMoney = payMoney;
							this.coupon = false;
						};
					}
				}
			}else{
				payMoney = money;
			}
			this.setData({
				count: count,
				money: parseFloat(money).toFixed(2),
				// payMoney: parseFloat(payMoney).toFixed(2),
			});
			return payMoney;
		},
		CalculationMoney() {
			let _ts = this;
			let payMoney = _ts.CalculationM();
			//获取余额
			if (_ts.checked) {
				if (_ts.userMoney > 0) {
					const coupon = _ts.userMoney;
					if (payMoney >= coupon) {
						(payMoney = payMoney - parseFloat(coupon)),
							_ts.setData({
								balance: true,
								balanceMoney: coupon
							});
					} else {
						if (payMoney <= 0) {
							_ts.setData({
								balance: true,
								balanceMoney: '0'
							});
						} else {
							console.log('额度',parseFloat(Number(coupon) + (payMoney - Number(coupon))))
							let balanceMoney = parseFloat(Number(coupon) + (payMoney - Number(coupon))).toFixed(2);
							payMoney = payMoney - parseFloat(Number(coupon) + (payMoney - Number(coupon))).toFixed(2);
							_ts.setData({
								balance: true,
								balanceMoney: balanceMoney
							});
						}
					} // payMoney = payMoney - parseFloat(coupon), this.setData({ balance: true })
				} else {
					(payMoney = payMoney),
						_ts.setData({
							balance: false,
							balanceMoney: 0
						});
				}
			}
			if (_ts.kychecked) {
				//获取线下余额
				if (_ts.kybalance > 0) {
					const coupon = _ts.kybalance;
					if (payMoney >= coupon) {
						(payMoney = payMoney - parseFloat(coupon)),
							_ts.setData({
								kybalances: true,
								kybalanceMoney: coupon
							});
					} else {
						if (payMoney <= 0) {
							_ts.setData({
								kybalances: true,
								kybalanceMoney: '0'
							});
						} else {
							let kybalanceMoney = parseFloat(parseFloat(coupon) + (payMoney - parseFloat(coupon))).toFixed(2);
							payMoney = payMoney - parseFloat(parseFloat(coupon) + (payMoney - parseFloat(coupon))).toFixed(2);
							_ts.setData({
								kybalances: true,
								kybalanceMoney: kybalanceMoney
							});
						}
					} // payMoney = payMoney - parseFloat(coupon), this.setData({ balance: true })
				} else {
					(payMoney = payMoney),
						_ts.setData({
							kybalances: false,
							kybalanceMoney: 0
						});
				}
			}
			_ts.setData({
				payMoney: parseFloat(payMoney).toFixed(2)
			});
		},

		noteInput(event) {
			this.note = event.detail.value;
		},

		// 选择余额
		radioChange(e) {
			// console.log('radio发生change事件，携带value值为：', e.detail.value);
		},
		// 选择线下支付
		radioChangeKy(e) {
			// console.log('radio发生change事件，携带value值为：', e.detail.value);
		},
		async loadCoupon() {
			let _ts = this;
			req.getRequest(
				'/api/v3/coupon/use',
				{
					ids: _ts.ids
				},
				data => {
					_ts.couponter = data;
					if(data&&data.length>0){
						let coupon = data.filter(it=>{return it.isUse});
						console.log('coupon',coupon)
						_ts.setData({
							couponList: coupon
						});
					}
					if (data&&data.length > 0) _ts.CalculationMoney();
				}
			);
		},

		async loadCoupons() {
			let _ts = this;

			req.getRequest(
				'/api/coupon/user',
				{
					page: 1,
					limit: 100,
					couponState: 1
				},
				res => {
					let contunt = res;
					if (_ts.query.activityId || _ts.query.aprId || _ts.query.orderType == 11) return false;
					req.getRequest(
						'/api/coupon/use',
						{
							ids: _ts.ids
						},
						data => {
							_ts.couponter = data;
							let couponObj = [];
							contunt.forEach((it, index) => {
								data.forEach(el => {
									if (it.id == el.id) {
										it.acitve = true;
									}
								});
							});
							var objectArraySort = function(keyName) {
								return function(objectN, objectM) {
									var valueN = objectN[keyName];
									var valueM = objectM[keyName];
									if (valueN < valueM) return 1;
									else if (valueN > valueM) return -1;
									else return 0;
								};
							};
							contunt.sort(objectArraySort('couponAmount'));
							contunt.forEach((it, index) => {
								if (it.acitve && couponObj.length <= 0) {
									_ts.couponIndex = index;
									couponObj.push(index);
								}
							});
							_ts.setData({
								couponList: contunt
							});
							if (data.length > 0) _ts.CalculationMoney();
						}
					);
				}
			);
		},

		getUserAddress() {
			// req.g('/api/address/default', data => {
			req.g('/api/address/get/default', data => {
				this.setData({
					address: data
				});
				this.getFreightMoney();
			});
		},

		addOrUpdateAddress() {
			let url = 'mine/addAddress/addAddress?isChoose=true&orderType=' + this.orderType;

			if (this.address && this.address.id) {
				url = 'mine/address/address?isChoose=true&orderType=' + this.orderType + '&addressId=' + this.address.id;
			}

			app.globalData.openPage(url);
		},

		getMy() {
			let that = this;
			req.getRequest('/api/user/my', {}, data => {
				that.setData({
					userInfo: req.getStorage('userInfo'),
					// realName: req.getStorage('userInfo').realName,
					phone: data.mobile
				});

				let _userinfo = req.getStorage('userInfo');

				if (_userinfo.mobile) {
					this.setData({
						show: true
					});
				}

				_userinfo.mobile = data.mobile;
				req.setStorage('userInfo', _userinfo);
			});
		},

		getphonenumber(event) {
			const detail = event.detail;

			const _ts = this;
			if (!detail || !detail.encryptedData || !detail.iv) return false;
			req.postRequest(
				'/api/weixin/mobile',
				{
					encryptedData: detail.encryptedData,
					iv: detail.iv,
					sessionKey: _ts.sessionKey
				},
				res => {
					_ts.setData({
						phone: res.mobile,
						show: true
					});
					let userInfo = req.getStorage('userInfo');
					if(!userInfo.mobile){
						userInfo.mobile = res.mobile;
						req.setStorage('userInfo',userInfo);
					}
					_ts.getMy();
				}
			);
		},

		payOrder(res) {
			// this.setData({ btn: 1 })
			req.payOrder(res, success => {
				if (success) {
					//支付成功
					if (!this.isRx) {
						app.globalData.redirectTab('product/pay/pay?isSuccess=true&&orderId=' + this.orderId + '&isRx=1');
					} else if (this.orderType == 4) {
						//拼团订单，
						if (this.pay == 1) {
							uni.navigateBack();
						} else {
							//支付成功之后跳入到拼团页面
							app.globalData.redirectTab('activity/group/ptDetail/ptDetail?acid=' + this.activityId + '&id=' + this.aprId + '&merchantId=' + this.query.merchantId);
						}
					} else {
						app.globalData.redirectTab('product/pay/pay?isSuccess=true');
					}
				} else {
					app.globalData.redirectTab('product/pay/pay?money=' + this.money + '&id=' + res);
				}
			});
		},

		tab: util.throttle(async function() {
			let _ts = this;
			let tipMsg = ''
			if(this.isZiti){
				let merchant = req.getStorage('MERCHANT');
				console.log('merchant.range',merchant.range)
				if(merchant.range && merchant.range!=50000){
					tipMsg = '当前下单门店为'+ merchant.title + '，距离您' + (merchant.mDistance < 1000 ? merchant.mDistance+'m' : merchant.range+'km') + '，下单后如需修改门店，请联系客服'
				}else{
					tipMsg = '当前下单门店为' + merchant.title +'，下单后如需修改门店，请联系客服'
				}
				req.msgConfirm(tipMsg,async res=>{
					this.confirmOrder()
				})
			}else{
				this.confirmOrder()
			}
		}, 3000),
		async confirmOrder(){
			let mode = this.isZiti ? 1 : 2;
			if (!this.isZiti && this.isJs) {
				mode = 3;
			}
			
			if (!this.isRx) {
				await requsetmessage.recipel(mode).then(res => {});
			} else if (mode == 1) {
				await requsetmessage.selfRaising().then(res => {
					// console.log("自提", res);
				});
			} else if (mode == 2) {
				await requsetmessage.distribution().then(res => {
					// console.log("配送", res);
				});
			} else {
				await requsetmessage.jisda().then(res => {
					// console.log("及时达", res);
				});
			}
			this.createOrder();
		},

		async createOrder() {
			let _ts = this;
			await this.submitOrder(data => {
				if (_ts.orderId) {
					_ts.payOrder(_ts.orderId);
					return false;
				}
				let isShowLoading = false;
				if (!isShowLoading) {
					req.loadIng('加载中');
					isShowLoading = true;
				}

				req.postRequest('/api/v3/merge/buy', data, res => {
					_ts.orderId = res;
					// if (!this.isRx) {
					// 	console.log("13545541565");
					// 	// uni.redirectTo({
					// 	// 	url: '/prescription/Consultation/index?orderId=' + this.orderId
					// 	// });
					// 	_ts.payOrder(_ts.orderId);
					// } else {
					_ts.payOrder(_ts.orderId);
					if (isShowLoading) {
						uni.hideLoading();
						isShowLoading = false;
					}
					// } // })
				});
			});
		},

		// 获取身份证号
		getcardNo(e) {
			this.setData({
				cardNo: e.detail.value
			});
		},

		// 获取购买人姓名
		gethwgName(e) {
			this.setData({
				hwgName: e.detail.value
			});
		},

		//获取用户输入的名字  改动
		getusername(event) {
			// console.log(event.detail.value)
			this.setData({
				realName: req.excludeSpecial(event.detail.value)
			});
		},

		//获取用户输入的电话 改动
		getphone(event) {
			this.setData({
				phone: event.detail.value
			});
		},

		// 选择送达时间
		serviceTime() {
			this.setData({
				isTimeShow: false
			});
		},

		closeTime() {
			this.setData({
				isTimeShow: true,
				isMoreTimeShow: true
			});
		},

		moreDate() {
			this.setData({
				isMoreTimeShow: false
			});
		},

		closeMoreTime() {
			this.setData({
				isMoreTimeShow: true
			});
		},

		//处理未来七天的函数
		dealTime: function(num) {
			// num：未来天数
			var time = new Date(); // 获取当前时间日期

			var date = new Date(time.setDate(time.getDate() + num)).getDate(); //这里先获取日期，在按需求设置日期，最后获取需要的

			var year = time.getFullYear(); // 获取年份

			var month = time.getMonth() + 1; // 获取月份

			var day = time.getDay(); //  获取星期

			switch (day) {
				//  格式化
				case 0:
					day = '（周日）';
					break;

				case 1:
					day = '（周一）';
					break;

				case 2:
					day = '（周二）';
					break;

				case 3:
					day = '（周三）';
					break;

				case 4:
					day = '（周四）';
					break;

				case 5:
					day = '（周五）';
					break;

				case 6:
					day = '（周六）';
					break;
			}

			var obj = {
				date: date,
				year: year,
				day: day,
				month: month,
				newday: month + '-' + date
			};
			return obj; // 返回对象
		},

		dateDay(event) {
			//选择送达日期
			let index = event.currentTarget.dataset.index;
			let aWeek = this.aWeek[index];
			if (index == 7) return false;
			this.sendDate = aWeek.newday;
			this.setData({
				dateIndex: index,
				timeList: aWeek.timeList
			});
		},

		dataTime(event) {
			//选择送达时间
			let index = event.currentTarget.dataset.index;
			let sendTime = this.timeList[index];
			this.sendTime = sendTime;
			this.setData({
				timeIndex: index
			});
		},

		timeConfirm() {
			//确定送达时间
			if (!this.sendDate) {
				this.sendDate = this.aWeek[0].newday;
			}

			if (!this.sendTime) {
				this.sendTime = this.aWeek[0].timeList[0];
			}

			this.setData({
				isTimeShow: true,
				isMoreTimeShow: true,
				sendTimes: this.sendDate + ' ' + this.sendTime
			});
		},

		bindChange(e) {
			//更多时间确定
			const val = e.detail.value;
			let aWeek = this.aWeek[val[0]];
			this.setData({
				timeList: aWeek.timeList
			});
			this.sendDate = this.aWeek[val[0]].newday;
			this.sendTime = this.timeList[val[1]];
		},

		// 用户积分余额查询
		getUserintegral() {
			req.getRequest('/api/integral/returnIntegral', {}, data => {
				this.setData({
					userIntegral: data
				});
			});
		},

		//
		submitOrder(success) {
			let that = this;
			let mode = this.isZiti ? 1:2
			let pidCode = req.getStorage('pidCode');
			let data = {
				ids: [0],
				mergePriceId: this.mergeProductPrice.id,
				mode: mode,
				node: this.note,
				phone: this.phone,
				userName: req.excludeSpecial(this.realName),
				scene: req.getStorage('scene'),
				quantity: this.count
			};

			if (this.is_open_wallet && this.is_open_wallet.isOpenWallet == 1 && this.checked) {
				//this.balance
				data.balancePayMoney = this.balanceMoney;
			}

			if (this.kychecked) {
				//线下余额支付
				data.offlinePaymentMoney = this.kybalanceMoney;
			}

			if (this.merchant && this.merchant.type == 5) {
				data.shopId = this.merchant.id;
				data.merchantId = this.merchant.merchantDTO.id;
			} else {
				data.merchantId = this.merchant.id;
			}
			// 获取推荐人
			if (pidCode && req.getStorage('userInfo').id != pidCode) {
				data.pid = pidCode;
			}
			this.setData({
				phone: data.phone,
				realName: req.excludeSpecial(data.userName)
			}); //添加电话正则
			let myreg = /^1[3456789]\d{9}$/; // 真实姓名正则
			let reg = /^[\u4E00-\u9FA5A-Za-z0-9]{1,20}$/; // 海外购真实姓名正则
			let hwgreg = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/; // 身份证正则
			let sfz = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
			if (this.couponList && this.couponList.length > 0 && this.couponter.length > 0) {
				if (this.coupon&&this.isUseCoupon) data.couponId = this.couponList[this.couponIndex].id;
			}
			// 获取营业时间
			var time = [];
			var start;
			var end;
			var current;
			// if (this.merchant && mode != 2) {
			// 	if (this.merchant.businessTime) {
			// 		time = this.merchant.businessTime.split('-');
			// 		if (time.length == 2) {
			// 			this.overTime = true;
			// 			var myDate = new Date();
			// 			var hours = myDate.getHours(); //获取当前小时
			// 			var minutes = myDate.getMinutes(); //获取当前分钟
			// 			var timeState;
			// 			var timeEnd;
			// 			if (time[0].indexOf(':') != '-1') {
			// 				timeState = time[0].split(':');
			// 			}
			// 			if (time[1].indexOf(':') != '-1') {
			// 				timeEnd = time[1].split(':');
			// 			}
			// 			if (time[0].indexOf('：') != '-1') {
			// 				timeState = time[0].split('：');
			// 			}
			// 			if (time[1].indexOf('：') != '-1') {
			// 				timeEnd = time[1].split('：');
			// 			}

			// 			start = +timeState[0] * (60000 * 60) + +timeState[1] * 60000; //营业开始时间转毫秒
			// 			end = +timeEnd[0] * (60000 * 60) + +timeEnd[1] * 60000; //营业结束时间转毫秒
			// 			current = +hours * (60000 * 60) + +minutes * 60000; //当前时间转毫秒
			// 		}
			// 	}
			// }
			if (this.isZiti) {
				//自提
				//*******************************
				if (!data.merchantId) return req.msg('请选择提货门店');
				if (!this.realName || !this.phone) return req.msg('请填写提货人和提货电话'); //判断电话是否正确

				if (!myreg.test(this.phone)) {
					return req.msg('请填写正确的手机号码！');
				} //判断名字是否正确

				// if (!reg.test(data.userName)) return req.msg('请输入正确提货人姓名');
				data.addressId = this.merchant.id;
				if (current < start) {
					uni.showModal({
						content: '本店暂末营业，请于' + this.merchant.businessTime + '期间提货！',
						confirmText: '同意',
						cancelText: '不同意',
						success(res) {
							if (res.confirm) {
								success.call(that, data);
							}
						}
					});
				} else if (current > end) {
					uni.showModal({
						content: '本店已歇业，请于次日' + this.merchant.businessTime + '期间提货！',
						confirmText: '同意',
						cancelText: '不同意',
						success(res) {
							if (res.confirm) {
								success.call(that, data);
							}
						}
					});
				} else {
					success.call(this, data);
				}
			} else {
				if (!data.merchantId) return req.msg('请选择发货门店');
				if (!that.address || !that.address.id) return req.msg('请选择收货地址');

				if (data.orderType == 10 || this.isHwg) {
					if (data.userName == '' || data.userName == undefined || data.userName == null) {
						return req.msg('请填写购买人');
					} else {
						if (!hwgreg.test(this.hwgName)) return req.msg('请输入正确真实姓名（至少2位汉字）');
					}

					if (data.idcard == '' || data.idcard == undefined || data.idcard == null) {
						return req.msg('请填写身份证号码');
					} else {
						if (!sfz.test(data.idcard)) return req.msg('请输入正确的身份证');
					}
				}

				let address = that.address;
				data.addressId = address.id;
				let merchant = this.merchant; //只有及时达的订单才需要校验地址范围
				// if (this.data.orderType == 5) {
				//   if (data.jsonDate == "" || data.jsonDate == undefined) return req.msg("请选择送达时间")
				// }
				if (!this.isZiti) {//data.mode == 3
					if (!address.lat || !address.lng) return req.msg('收货地址未解析，请重新选择收货地址');
					let formAddress = {
						latitude: merchant.lat,
						longitude: merchant.lng
					}; //判断用户收货地址是否在门店发货距离之内

					QQMapWX.calculateDistance(
						formAddress,
						[
							{
								latitude: address.lat,
								longitude: address.lng
							}
						],
						res => {
							//超出了订单范围，并且是及时达订单
							if (merchant.isDistans == 1 && res.elements[0].distance / 1000 > merchant.distance) {
								console.log('超过距离')
								// console.log("发货距离", res.elements[0].distance / 1000, "门店范围距离", merchant
								// 	.distance); // return req.msg('非常抱歉，您的配送地址超出我们的配送服务范围');
								let content = '';
								// if (!this.onelyJsd) {
								// 	if (this.Jsdyouji) {
								// 		content = '您的及时达订单超过了配送服务范围，是否同意转为邮寄发货？';
								// 	} else if (this.Jsdziti && !this.Jsdyouji) {
								// 		content = '您的及时达订单超过了配送服务范围，是否同意转为自提？';
								// 	}
								// } else {
								content = '您的订单超过了配送服务范围！暂不提供服务';
								// }
								uni.showModal({
									content: content,
									confirmText: '同意',
									success(res) {
										if (res.confirm) {
											if (that.Jsdyouji && !that.onelyJsd) {
												// if(that.query.orderType==20){
												// 	data.orderType = 20;
												// }else{
												// 	data.orderType = 1; //设置为普通订单
												// }
												data.mode = 2; //方式为邮寄
												that.setData({
													isJs: false
												});
												success.call(that, data);
											} else if (that.Jsdziti && !that.Jsdyouji && !that.onelyJsd && !that.onlyPeisong) {
												// if(that.query.orderType==20){
												// 	data.orderType = 20;
												// }else{
												// 	data.orderType = 1; //设置为普通订单
												// }
												data.mode = 1; //方式为自提
												that.setData({
													isJs: true,
													isZiti: true
												});
												// success.call(that, data);
											} else if (that.onelyJsd) {
												return false;
											}
										} else if (res.cancel) {
										}
									}
								});
							} else {
								if (current < start) {
									console.log('未上班')
									uni.showModal({
										content: '对不起，工作人员末上班，您的订单将于' + time[0] + '后进行配送！',
										confirmText: '同意',
										cancelText: '不同意',
										success(res) {
											if (res.confirm) {
												success.call(that, data);
											} else if (res.cancel) {
											}
										}
									});
								} else if (current > end) {
									console.log('歇业')
									uni.showModal({
										content: '本店已歇业，您的订单将于次日' + time[0] + '后进行配送！',
										confirmText: '同意',
										cancelText: '不同意',
										success(res) {
											if (res.confirm) {
												success.call(that, data);
											} else if (res.cancel) {
											}
										}
									});
								} else {
									success.call(that, data);
								}
								// success.call(this, data);
							}
						}
					);
				} else {
					success.call(this, data);
				}
			}
		}
	}
};
</script>
<style>
@import './subOrder.css';
</style>
