<template>
	<view class="page">
		
		<view class="oinfo">
			
			<!-- 地址信息 -->
			<view class="yycon">
				<view class="acon">
					<view class="aleft" @click="getAddr">
						<view class="aname" v-if="info.address">
							{{info.username?info.username:''}}
							{{info.tel?info.tel:''}}
						</view>
						<view v-else class="aname">
							请选择收货地址
						</view>
						<view class="atxt" v-if="info.address">
							{{info.address?info.address:''}}
						</view>
						<view v-else class="atxt">
							下单前请选择您的收货地址
						</view>
					</view>
					<view class="aright"  @click="getAddr">
						<uni-icons type="arrowright" size="18" color="#a9a9a9"></uni-icons>
					</view>
					
					<view class="aline"></view>
				</view>
			</view>
			
			<!-- 商品信息 -->
			<view class="yycon">
				<view class="olist">
					<view class="oscon">
						<view class="osimg imgload">
							<image class="osimg" v-if="info.icon" :src="info.icon" mode="aspectFit"></image>
						</view>
						<view class="osrcon">
							<view class="osname">
								{{info.pname?info.pname:''}}
							</view>
							<view class="oscell">
								套餐：{{info.sets}}
							</view>
							<view class="oscell">
								数量：{{info.nums}}
							</view>
							<view class="oscell">
								租期：{{info.rentcyclename}}
							</view>
						</view>
					</view>
				</view>
				<view class="tcon">
					<view class="tcell">
						<image class="ticon" src="../../static/image/time.png"></image>
						<view class="tlist">
							<view class="tname">预计起租日</view>
							<view class="tvalue">{{info.date1}}</view>
						</view>
					</view>
					<view class="tcell">
						<image class="ticon" src="../../static/image/time.png"></image>
						<view class="tlist">
							<view class="tname">归还日</view>
							<view class="tvalue">{{info.date2}}</view>
						</view>
					</view>
				</view>
				<view class="tip">
					<uni-icons type="info" size="20" color="#89965f"></uni-icons> 
					<text style="margin-left: 10rpx;">提示:快递运输期间不算租期，实际起租日为快递签收当天</text>
				</view>
			</view>
			
			<!-- 订单信息 -->
			<view class="yycon odrcell">
				<!-- <view class="atitle">
					<view>
						首期租金付款
					</view>
					<view class="price">
						￥<uni-easyinput type="digit" @blur="blurDo" v-model="order.price_sqk" placeholder="请输入首期租金" />
					</view>
				</view> -->
				<view class="atitle">
					<view>
						首期租金付款
					</view>
					<view class="sqprice">
						￥{{order.price_sqk}}
					</view>
				</view>
				<view class="sqcon" v-if="info.price_spbz>0">
					<!-- <view class="sqlist">
						<view>服务包</view>
						<view>￥{{info.price_fwbjg}}</view>
					</view> -->
					<view class="sqlist" v-if="info.price_spbz>0">
						<view>碎屏保障</view>
						<view>￥{{info.price_spbz}}</view>
					</view>
				</view>
				<view class="atip">
					注:该首月租金仅作为展示最终以风控评估结果为准
				</view>
				<!-- <view class="olist">
					<view class="ocell">
						<text>
							剩余租金
						</text>
						<text class="red">￥{{( (parseFloat(info.price)- order.price_sqk)/info.last).toFixed(2)}}*{{info.last}}期</text>
					</view>
				</view> -->
				<view class="olist">
					<view class="ocell">
						<text>
							总期数
						</text>
						<text class="red">{{info.rentcycle}}期</text>
					</view>
				</view>
				<view class="olist">
					<view class="ocell">
						<text>
							总租金
						</text>
						<text class="red">￥{{ parseFloat(info.price).toFixed(2)}}</text>
					</view>
				</view>
				<view class="olist">
					<view class="ocell">
						<text>
							配送方式
						</text>
						<text>{{info.delivery}}</text>
					</view>
				</view>
				<!-- <view class="olist">
					<view class="ocell">
						<text>
							完结还需支付
						</text>
						<text>￥{{ (parseFloat(info.price)-order.price_sqk).toFixed(2) }}</text>
					</view>
				</view> -->
				
			</view>
			
			<!-- 上传身份证信息 -->
			<view class="yycon" v-if="!isauth">
				<view class="realcon">
					<view class="rleft">
						<view class="tip1">
							上传身份证照片
						</view>
						<view class="tip2">
							完善实名信息，加快审核速度
						</view>
					</view>
					<view class="rright" @click="gotoindenty">
						去上传
					</view>
				</view>
			</view>
			
			<!-- 下单备注 -->
			<view class="yycon odrcell">
				<view class="olist">
					<view class="ocell">
						<text style="margin-right: 12rpx;">
							下单备注:
						</text>
						<uni-easyinput v-model="order.message" maxlength="200" placeholder="请输入您的备注信息" />
					</view>
				</view>
			</view>

		</view>
		
		<!-- 提交订单 -->
		<view class="submitcon" v-if="info">
			<view class="xycon">
				<radio-group @change="radioChange">
					<view class="sitem">
						<view class="selbtn">
							<label>
								<radio value="1" :checked="isChecked"/>
							</label>
						</view>
						<view class="conright">
							<view class="sname">
								我已阅读并同意
							</view>
							<view class="adress" @click="gotoxy">
								《租赁服务协议及相关》
							</view>
						</view>
					</view>
				</radio-group>
			</view>
			<view class="ocon">
				<!-- <view class="pcon">
					<text class="hj">共{{info.nums}}件,首期实付</text>
					<text class="rmb">￥</text>
					<text class="zs">{{ parseFloat(order.price_sqk).toFixed(2) }}</text>
				</view> -->
				<button type="primary" v-if="!isxy||ifsubmit" class="sbtn">{{btntxt}}</button>
				<button type="primary" v-if="isxy && !ifsubmit" class="btn" @click="gotoOrder">立享免押租</button>
			</view>
			
		</view>
		
		<!-- 支付弹框 -->
		<uni-popup ref="paypup" type="share">
			<view class="allcon">
				<view class="hcon">
					<view class="htitle">请在2小时内支付</view>
					<view class="rclose" @tap="_hide">
						<uni-icons type="closeempty" size="24" color="#999999"></uni-icons>
					</view>
				</view>
				<view class="mcon" v-if="info">
					￥ <text class="mcost">{{info.cost}}</text>
				</view>
				<view class="selcon">
					<radio-group class="checklist-group" @change="change">
						<view class="sitem" v-for="(item,index) in paylist" :key="index">
							<view class="simg">
								<image class="img" :src="item.icon"></image>
							</view>
							<view class="conright">
								<view class="sname">
									{{item.name}}
								</view>
							</view>
							<view class="selbtn">
								<radio :value="item.id" :checked="item.isChecked" />
							</view>
						</view>
					</radio-group>
				</view>
				<button type="primary" class="paybtn" @click="paydo()">确认支付</button>
			</view>
		</uni-popup>
		
		<!-- 地址选择弹框 -->
		<uni-popup ref="adrpup" type="share">
			<view class="allcon">
				<view class="hcon">
					<view class="htitle">请点击选择收件地址</view>
					<view class="rclose" @tap="_adrhide">
						<uni-icons type="closeempty" size="24" color="#999999"></uni-icons>
					</view>
				</view> 
				<view class="selcon">
					<radio-group class="checklist-group" @change="adrchange">
						<view v-for="(item, index) in myaddresslist" :key="index" class="adrsitem">
							<view class="lcon">
								<view class="sname">
									<text>{{item.contact}}</text>
									<text style="margin-left: 10rpx;margin-right: 10rpx;">{{item.phone}}</text>
									<view v-if="item.sortid==1" class="adrtip">默认</view>
								</view>
								<view class="sinfo">
									{{item.province+item.city+item.area+item.address}}
								</view>
							</view>
							<view class="opecon"> 
								<radio :value="index.toString()" :checked="item.isChecked" />
							</view>
						</view>
					</radio-group>
				</view>
			</view>
		</uni-popup>
		
		<!-- 是否登录 -->
		<openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin>
		
	</view>
</template>

<script>
	import { myCache,getNowDate,getMondate} from '../../utils/utils.js';
	import openlogin from "../components/openlogin.vue";
	export default {
		components: {
			openlogin
		},
		data() {
			return {
				openId:"",
				phone:"",
				userid:"",
				isauth: 0,//是否实名
				promoterid:0,//是否绑定推广员
				id:"",
				ifsubmit:false,
				isxy:false,
				btntxt:"立享免押租",
				info:{
					icon:"../../static/image/product/sp1.jpg",
					username:"",
					tel:"",
					address:"",//"江苏省扬州市江都市地址信息1地址信息2地址信息3地址信息4地址信息5",
					pname:"测试",
					sets:"租完6个月可买断 测试 测试",
					nums:1,
					rentcyclename:'6个月套餐',
					rentcycle:6,
					last:5,
					price:1.01,
					delivery:"自提",
					date1:"2023-03-15",
					date2:"2023-03-25"
				},
				order:{
					buyerid:"",// 买家ID
					pro_id:"",// 商品ID
					zuqi:"",// 租期
					pro_type:"",// 商品类型 1：全新  2：二手
					pro_color:"",// 颜色选择
					pro_nc:"",// 内存选择
					message:'',// 用户留言
					price_sqk:0,// 首期款金额(用户填写，必填项)
					price_year:1.00,// 年租金(必填项)
					sh_state:1,// 是否自提  0:否  1：自提（默认）
					// idcard_pic:"",// 身份证正面
					// idcard_pic1:"",// 身份证反面
					sh_name:"",// 收货人姓名
					sh_phone:"",// 收货人电话
					sh_province:"",// 收货省份
					sh_city:"",// 收货城市
					sh_area:"",// 收货区
					sh_address:""// 收货详细地址
				},
				paylist:[
					{
						id:"2",
						name:"支付宝支付",
						icon:"../../static/image/pt2.png",
						isChecked:true
					}
				],
				payType:"2" ,// 2支付宝支付
				product:null,
				productall:null,
				specs:null,
				myaddresslist:[],
				isChecked:false
			};
		},
		onLoad(options) {
			if(options.type=='buy')
			{
				this.getinfo();
			}
			else{
				uni.showModal({
					title: '提示',
					content: '订单提交异常，请返回..',
					cancelText: '取消',
					confirmText: '确定',
					success: ress => {
						// 返回
						uni.navigateBack({
							delta: 1
						});
					}
				});
			}
		},
		onShow(){
			console.log("onRead")
			this.iflogin();
		},
		methods: {
			async gotoOrder(){
				// 订单提交
				if(this.isauth==0){
					uni.showModal({
						title: '提示',
						content: '请先进行实名认证，即将跳转去认证！',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
							if (ress.confirm) {
								// 缓存订单界面认证界面
								myCache("signtype",'2');
								// 跳转去实名认证
								uni.navigateTo({
									url: `/pages/setting/certificationone`
								});
							}
						}
					});
					return false;
				} 
				// 绑定推广员
				if(this.promoterid==0){
					uni.showModal({
						title: '提示',
						content: '请先扫码绑定推广员再下单，即将跳转绑定推广员！',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
							if (ress.confirm) {
								// 跳转去扫码绑定推广员
								uni.switchTab({
									url: '/pages/user/user'
								});
							}
						}
					});
					return false;
				} 
				
				if(!this.order.buyerid){
					uni.showModal({
						title: '提示',
						content: '请重新登录后提交订单..',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
						}
					});
					return false;
				}
				if(!this.order.pro_id){
					uni.showModal({
						title: '提示',
						content: '提交订单商品异常..',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
						}
					});
					return false;
				}
				// if(this.order.sh_state==0&&!this.order.sh_address){
				if(!this.order.sh_address){
					uni.showModal({
						title: '提示',
						content: '请选择收货地址..',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
						}
					});
					return false;
				} 
				// if(!this.order.price_sqk){
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: '请输入首期付款金额..',
				// 		cancelText: '取消',
				// 		confirmText: '确定',
				// 		success: ress => {
				// 		}
				// 	});
				// 	return false;
				// }
				
				// if(this.order.sh_state==1){
				// 	this.order.sh_name="";// 收货人姓名
				// 	this.order.sh_phone="";// 收货人电话
				// 	this.order.sh_province="";// 收货省份
				// 	this.order.sh_city="";// 收货城市
				// 	this.order.sh_area="";// 收货区
				// 	this.order.sh_address="";// 收货详细地址
				// }
				
				// 订单提交中
				this.ifsubmit=true;
				try {
					uni.showLoading({
						title: '订单提交中...'
					});
					var params = {
						para: JSON.stringify(this.order)
					};
					const {data: res} = await uni.$http.post('/alipay/insertOrder',params);
					if (res) {
						// 
						this.ifsubmit=false;
						uni.showModal({
							title: '提示',
							content: '订单已提交！',
							showCancel: false,
							confirmText: '确定',
							success: ress => {
								var id=res;
								console.log(id,'id');
								myCache("gobackorderlist",1);
								uni.redirectTo({
									url: `/pages/order/orderinfo?type=1&id=${id}`
								});
								
								
								// 跳转到订单详情待审核
								// uni.redirectTo({
								// 	url: `/pages/order/orderinfo?id=${id}`
								// });
							}
						});
						// 清除缓存
						myCache('cartproduct','');
						myCache('cartproductnow','');
						myCache('cartproductsels','');
					}
					else{
						this.ifsubmit=false;
						uni.showToast({
							title: res.msg? res.msg:'下单提交失败！',
							icon: 'error',
							duration: 2000
						});
					}
				}
				catch (err) {
					this.ifsubmit=false;
					uni.showToast({
						title: err.msg? err.msg:'下单提交失败！',
						icon: 'error',
						duration: 2000
					});
				}
			},
			async getinfo() {
				var _this=this;
				// 获取地址信息,地址默认
				this.myaddresslist=myCache("myaddresslist");
				
				// 获取订单数据
				this.productall=myCache('cartproduct');
				this.product=myCache('cartproductnow');
				console.log(this.product)
				this.specs=myCache('cartproductsels');
				if(!this.productall||!this.product||!this.specs){
					uni.showModal({
						title: '提示',
						content: '订单提交异常，请返回..',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
							// 返回
							uni.navigateBack({
								delta: 1
							});
						}
					});
				}
				else{
					//订单填充
					this.order.pro_id=this.productall.id;//商品ID
					this.order.pro_type=this.productall.pro_type?this.productall.pro_type:1;
					if(this.specs.length>1&&this.specs[1].list[this.specs[1].sels].id){
						// 颜色
						this.order.pro_color=this.specs[1].list[this.specs[1].sels].id;
						this.info.sets=this.specs[0].list[this.specs[0].sels].name+ " "+this.specs[1].list[this.specs[1].sels].name+ " "
						+this.specs[3].list[this.specs[3].sels].name; // 规格选择1
						
						this.info.rentcyclename= this.specs[2].list[this.specs[2].sels].name;
						this.info.rentcycle= parseInt(this.specs[2].list[this.specs[2].sels].id);
						// 租期
						this.order.zuqi=this.info.rentcycle;
						this.info.last=this.info.rentcycle-1;
						 
					}
					
					if(this.specs.length>1&&this.specs[3].list[this.specs[3].sels].id){
						// 版本 pro_nc
						this.order.pro_nc=this.specs[3].list[this.specs[3].sels].id;
					}
					
					// 界面填充
					this.info.icon=this.product.img1;//第一图
					this.info.pname=this.product.name; // 商品名称
					var prices=this.product.price?this.product.price.split(','):[];
					var zqsel=this.info.rentcycle?this.info.rentcycle:6;// 默认6
					var rate=1;
					if(zqsel==6){
						rate=parseFloat(this.product.rate6);
					}
					else if(zqsel==9){
						rate=parseFloat(this.product.rate9);
					} 
					else if(zqsel==12){
						rate=parseFloat(this.product.rate12);
					}
					var price=Math.floor(parseFloat(prices[this.specs[3].sels]?prices[this.specs[3].sels]:0)*rate-(this.product.price_lgj?parseFloat(this.product.price_lgj):0)).toFixed(0);
					this.info.price=price; //this.product.price;// 总价格
					// this.order.price_sqk= Math.round(100*(parseFloat(this.info.price)/parseFloat(this.info.rentcycle)))/100;
					this.info.price_fwbjg=parseFloat(this.product.fwbjg);
					this.info.price_spbz=parseFloat(this.product.price_spbz);
					this.order.price_fwbjg=this.info.price_fwbjg;
					this.order.price_spbz=this.info.price_spbz;
					this.order.price_sqk=this.info.price_fwbjg+this.info.price_spbz;
					this.order.price_year=parseFloat(this.info.price);
					this.info.date1=getNowDate();
					this.info.date2=getMondate(this.info.rentcycle);
				}
				this.$forceUpdate();
				this.getprom();
			},
			async getprom() {
				// 分类
				this.userid = myCache('userid');
				const {data: res} = await uni.$http.post('/platform/isBindPromoter',{id:this.userid});
				console.log(res)
				if (res) {
					this.promoterid=res;
					this.$forceUpdate();
				}
			},
		    iflogin(){
				this.openId = myCache('openId');
				this.phone = myCache('phone');
				this.userid = myCache('userid');
				if(this.userid==""||this.userid=="0"){
					// 跳转去登录
					uni.navigateTo({
						url: `/pages/login/login`
					});
				}
				else{
					this.order.buyerid=this.userid;
					//实名
					var res=myCache('userInfo');
					if(res){
						this.isauth = res.isauth ? res.isauth: 0;
						// this.promoterid=res.promoterid ? res.promoterid: 0;
						// idcard	身份证号
						// this.order.idcard_pic=res.buyer_idcardpic;//身份证正面
						// this.order.idcard_pic1=res.buyer_idcardpic1;//身份证反面
					}
				}
			},
			shselDo(type){
				this.order.sh_state=type;
				if(type==1){
					this.info.delivery="自提";
					this.order.sh_name="";// 收货人姓名
					this.order.sh_phone="";// 收货人电话
					this.order.sh_province="";// 收货省份
					this.order.sh_city="";// 收货城市
					this.order.sh_area="";// 收货区
					this.order.sh_address="";// 收货详细地址
				}
				else{
					this.info.delivery="快递发货";
					if(this.myaddresslist&&this.myaddresslist.length>0){
						this.myaddresslist.forEach((cell,idx)=>{
							if(cell.isdefault){
								// 收货信息
								_this.info.address=cell.address;
								_this.info.username=cell.fullname;
								_this.info.tel=cell.mobilePhone;
								// 订单收货信息
								_this.order.sh_name=cell.fullname;// 收货人姓名
								_this.order.sh_phone=cell.mobilePhone;// 收货人电话
								_this.order.sh_province=cell.prov;// 收货省份
								_this.order.sh_city=cell.city;// 收货城市
								_this.order.sh_area=cell.area;// 收货区 
								_this.order.sh_address=(cell.address).replace(cell.prov,'').replace(cell.city,'').replace(cell.area,'').replace(/-/g, '');// 收货详细地址
							}
						});
					}
				}
				this.$forceUpdate();
			},
			getAddr() {
				console.log("getAddr")
				var  _this=this;
				// uni.showLoading({
				// 	title: '加载中...'
				// });
				// const {data: res} = await uni.$http.post('/Appiso/getAddressByBuyerid' , {buyerid:this.userid});
				var res=myCache("myaddresslist");
				console.log(res)
				if(res&&res.length>0){
					res.forEach((cell)=>{
						res["isChecked"]=false;
					});
					this.myaddresslist=res;
					this._adrshow();
					this.$forceUpdate();
				}
				else{
					uni.showModal({
						title: '提示',
						content: '暂无收件地址，去添加？',
						cancelText: '取消',
						confirmText: '确定',
						success: ress => {
							if (ress.confirm) {
								uni.navigateTo({
									url: `/pages/address/add?type=add`
								});
							}
						}
					});
				}
			},
			radioChange(e){ 
				//协议
			    console.log(e);
				if(e.detail.value==1){
					this.isxy=true;
				}
				else{
					this.isxy=false;
				}
				this.$forceUpdate();
			},
			blurDo(e){
				// 首期付款金额输入验证
				console.log(e);
				if(e.detail.value){
					if(parseFloat(e.detail.value)<=0){
						uni.showToast({
							title: '首期付款金额大于0元！',
							icon: 'error',
							duration: 2000
						});
						// 默认平均首期
						this.order.price_sqk= Math.round(100*(parseFloat(this.info.price)/parseFloat(this.info.rentcycle)))/100;
					}
					else if(parseFloat(e.detail.value)>parseFloat(this.info.price)){
						uni.showToast({
							title: '首期付款金额不大于总金额！',
							icon: 'error',
							duration: 2000
						});
						// 默认平均首期
						this.order.price_sqk= Math.round(100*parseFloat(this.info.price))/100;
					}
					else{
						this.order.price_sqk= Math.round(100*parseFloat(e.detail.value))/100;
					}
				}
				else{
					console.log('blurDo')
					// 默认平均首期
					this.order.price_sqk=Math.round(100*(parseFloat(this.info.price)/parseFloat(this.info.rentcycle)))/100;
				}
				this.$forceUpdate();
			},
			gotoxy(){
				//跳转协议
				uni.navigateTo({
					url: `/pages/user/protocol?id=1`
				});
			},
			adrchange(e){
				console.log(e);
				if(e.detail.value||e.detail.value=='0'){
					var data= this.myaddresslist[ parseInt(e.detail.value)];
					// 收货信息
					this.order.sh_name=data.contact?data.contact:'';// 收货人姓名
					this.order.sh_phone=data.phone?data.phone:'';// 收货人电话
					this.order.sh_province=data.province?data.province:'';// 收货省份
					this.order.sh_city=data.city?data.city:'';// 收货城市
					this.order.sh_area=data.area?data.area:'';// 收货区
					this.order.sh_address= data.address?data.address:'';
					// 订单收货信息
					this.info.address=this.order.sh_province+this.order.sh_city+this.order.sh_area+this.order.sh_address;
					this.info.username=this.order.sh_name;
					this.info.tel=this.order.sh_phone;
					console.log(this.info,this.order);
					this.$forceUpdate();
					this._adrhide();
				}
			},
			change(e){
				console.log(e);
				if(e.detail.value){
					this.payType=e.detail.value;
				}
			},
			_show() {
				this.$refs.paypup.open();
			},
			_hide() {
				this.$refs.paypup.close();
				// 关闭弹出层
				setTimeout(() => {
					uni.hideLoading();
				}, 1000);
			},
			_adrshow() {
				this.$refs.adrpup.open();
			},
			_adrhide() {
				this.$refs.adrpup.close();
				// 关闭弹出层
				setTimeout(() => {
					uni.hideLoading();
				}, 1000);
			},
			getPhoneNumber(e){
				if(e.phone){
					this.phone = e.phone
				}
				if(e.userid){
					this.userid = e.userid
				}
			},
			goback(){
				uni.navigateBack({
					delta: 1
				});
			},
			// 去购买
			gotopay(){
				this._show();
			},
			paydo(){
				// 去支付
				// 是否登录
				if(!this.iflogin()){
					return false;
				}
				
				// #ifdef MP-ALIPAY
				console.log("MP-ALIPAY");
				this.alipaydo();
				// #endif
				
			},
			async zfbpayFailDo(){
				// 支付失败
				uni.hideLoading(); 
				var that=this;
				uni.showModal({
					title: '提示',
					content: '支付订单失败！请重新再试！',
					showCancel: false,
					confirmText: '确定',
					success: ress => {
						if (ress.confirm) {
							// 提示
						}
					}
				});
			},
			async alipaydo(){
				var that = this;
				uni.showLoading({
					title: '正在支付....'
				});
				console.log("alipaydo");
				// 支付宝调起支付
				var that=this;
				console.log("支付宝发起支付");
				//申请支付 
				var param={
					"userid": myCache('userid'),
					"userId": myCache('openId'),
					"orderId": that.info.id,
				};
				// 申请支付
				uni.showLoading({
					title: '正在支付....'
				});
				const {data: ress} = await uni.$http.post("/api/alipay/trade/create", param);
				if(ress.msg=="successed"){
					console.log(ress.data);
					var orderInfo =ress.data;
					// 调起支付
					uni.getProvider({
					    service: 'payment',
					    success: function (res) {
					        console.log(res.provider,"uni.getProvider");
							
					        if (~res.provider.indexOf('alipay')) {
					            uni.requestPayment({
					                "provider": "alipay",  //固定值为"alipay"
									"orderInfo": orderInfo.TradeNo,// 交易单号
					                success: function (resr) {
										console.log("支付宝调起支付成功",resr);
										if (resr && resr.resultCode === '9000') {
											// 支付成功 执行想要的操作
											uni.showLoading({
												title: '订单支付成功！'
											});
											// 回调改订单状态
											that.wxpaySuccessDo();
										}
										else{
											uni.showModal({
												title: '提示',
												content: '请求支付失败!请重试!',
												showCancel: false,
												confirmText: '确定',
												success: ress => {
												}
											});
										}
					                },
					                fail: function (err) {
										console.log("支付宝调起支付失败",err)
					                    console.log('支付失败:' + JSON.stringify(err));
										that.zfbpayFailDo();
					                }
					            });
					        }
					    }
					});
					
				}
				else{
					// 请求支付订单失败,
					uni.showModal({
						title: '提示',
						content: '请求支付失败!订单已经关闭或异常!请返回订单重试!',
						showCancel: false,
						confirmText: '确定',
						success: ress => {
							// 返回订单全部列表
							uni.redirectTo({
								url: `/pages/order/orderlist?id=0`
							});
						}
					});
				}
				
			},
			gotoindenty(){
				// 缓存订单界面认证界面
				myCache("signtype",'2');
				uni.navigateTo({
					url: `/pages/setting/certificationone`
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page{
		padding: 0;
		position: relative;
	}
	.submitcon{
		position: fixed;
		display: flex;
		flex-direction: column;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 200rpx;
		background-color: #FFFFFF;
		.xycon{
			padding: 0 20rpx 0 20rpx;
			position: relative;
			display: block;
			width: 100%;
			.sitem {
				position: relative;
				display: flex;
				flex-direction: row;
				flex: 1;
				align-items: center;
				.selbtn{
					width: 80rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					position: absolute;
					top:16rpx;
					left: 0;
				}
				.conright{
					flex: 1;
					display: flex;
					align-items: center;
					flex-direction: row;
					width: 100%;
					justify-content:flex-start;
					margin-left: 70rpx;
				}
				.sname{
					display: flex;
					justify-content: flex-start;
					align-items: center;
					font-size: 28rpx;
					color: #999;
					padding: 22rpx 10rpx 0 0;
				}
				.adress{
					display: flex;
					justify-content: flex-start;
					align-items: center;
					padding: 22rpx 10rpx 0 0;
					font-size: 26rpx;
					color:#4A7DF2;
				}
			}
		}
		.ocon{
			display: flex;
			flex-direction: row;
		}
		.pcon{
			margin-left: 20rpx;
			margin-top: 20rpx;
			height: 50rpx;
			display: flex;
			flex:1;
			justify-content: flex-start;
			align-items: baseline;
			.hj{
				color:#303133;
				font-size: 30rpx;
			}
			.rmb{
				font-size: 30rpx;
				font-family: smallYuan;
				color:#ff3d0e ;
				margin-left: 10rpx;
			}
			.zs{
				font-size: 48rpx;
				font-weight: 600;
				color:#ff3d0e ;
			}
			.xs{
				font-size: 28rpx;
				font-weight: 600;
				color:#89965f ;
			}
		}
		.sbtn{
			margin: 20rpx 45rpx 20rpx;
			width: 660rpx;
			height: 76rpx;
			line-height: 76rpx;
			background: #A0A0A0;
			border:none;
			box-shadow: 0rpx 12rpx 44rpx 2rpx rgba(186,186,188,0.4);
			border-radius: 10rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FCFCFD;
			text-align: center;
			&::after{
				border:none;
			}
		}
		.sbtn::after{
			border:0 !important;
		}
		.btn{
			margin: 20rpx 45rpx 54rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FCFCFD;
			width: 660rpx;
			height: 76rpx;
			line-height: 76rpx;
			background: #89965f;
			box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(67,110,255,0.4);
			border-radius: 10rpx;
			opacity: 1;
			&::after{
				border:none;
			}
		}
		.btn::after{
			border:0 !important;
		}
		.pjbtn{
			background-color: #FFFFFF !important;
			margin: 30rpx 20rpx 0 0;
			border-radius: 50rpx;
			height: 60rpx;
			line-height: 60rpx;
			width:170rpx;
			font-size: 26rpx;
			border:1rpx solid #ff3d0e;
			color:#ff3d0e;
		}
		.pjbtn::after{
			border:0 !important;
		}
	}
	.oscon{
		border-radius: 16rpx;
		padding:20rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		.osimg{
			width: 150rpx;
			height: 180rpx;
			border-radius: 10rpx;
			margin-left: 20rpx;
		}
		.osrcon{
			display: flex;
			flex-direction: column;
			flex: 1;
			justify-content: flex-start;
			margin-left: 50rpx;
		}
		.osname{
			line-height: 48rpx;
			font-size:30rpx;
			color:#303133;
		}
		.oscell{
			font-size: 26rpx;
			color:#747474;
			line-height: 44rpx;
		}
	}
	
	.tcon{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		padding: 20rpx;
		.tcell{
			width: 46%;
			margin: 0 2%;
			background-color: #F5F6FC;
			padding: 20rpx;
			border-radius: 10rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			.ticon{
				width: 36rpx;
				height: 36rpx;
				margin-right: 20rpx;
				margin-right: 20rpx;
			}
			.tlist{
				display: flex;
				flex:1;
				flex-direction: column;
				.tname{
					color: #303133;
					font-weight: 600;
					font-size: 28rpx;
				}
				.tvalue{
					color: #656E87;
					font-size: 24rpx;
					margin-top: 10rpx;
				}
			}
		}
	
	}
	
	.tip{
		background: #E1F2FF;
		padding: 20rpx;
		font-size: 24rpx;
		color: #303133;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.odrcell{
		border-radius: 12rpx;
		padding: 20rpx 40rpx;
	}
	.oinfo{
		padding:0;
		position: relative;
		display: block;
		margin-bottom: 240rpx;
		.yycon{
			display: flex;
			flex-direction: column;
			justify-content: center;
			background-color: #FFFFFF;
			margin-top: 20rpx;
			position: relative;
			.realcon{
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				position: relative;
				padding: 30rpx;
				background: #E1F2FF;
				.rleft{
					display: flex;
					flex-direction: column;
					.tip1{
						font-weight: 600;
						font-size: 32rpx;
						color: #333333;
					}
					.tip2{
						margin-top: 12rpx;
						font-weight: 400;
						font-size: 26rpx;
						color: #78839A;
					}
				}
				.rright{
					width: 180rpx;
					height: 60rpx;
					line-height: 60rpx;
					text-align: center;
					background: #89965f;
					border-radius: 40rpx 40rpx 40rpx 40rpx;
					font-weight: 400;
					font-size: 28rpx;
					color: #FFFFFF;
				}
			}
			.shsel{
				width: 100%;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: center;
				height: 80rpx;
				background-color: #F5F5F5;
				.shsel1{
					border-radius: 20rpx 20rpx  0 0;
					background-color: #E1F2FF;
					font-size: 26rpx;
					color:#666;
					width: 50%;
					height: 80rpx;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
				}
				.shsel1.current{
					border-radius: 20rpx 20rpx 0 0;
					background-color: #FFF;
					color:#303133;
					font-weight: 600;
					font-size: 28rpx;
				}
				.shsel2{
					border-radius: 20rpx 20rpx  0 0;
					background-color: #E1F2FF;
					font-size: 26rpx;
					color:#666;
					width: 50%;
					height: 80rpx;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
				}
				.shsel2.current{
					border-radius: 20rpx 20rpx  0 0;
					background-color: #FFF;
					font-size: 28rpx;
					color:#303133;
					font-weight: 600;
				}
			}
			.acon{
				display: flex;
				flex-direction: row;
				align-items: center;
				position: relative;
				padding: 30rpx 0;
				width: 100%;
				.aleft{
					display: flex;
					flex: 1;
					flex-direction: column;
					justify-content: flex-start;
					margin-left: 40rpx;
					.aname{
						padding: 5rpx 0 10rpx;
						color:#303133;
						font-size: 32rpx;
						font-weight: 600;
					}
					.atxt{
						font-size: 26rpx;
						color:#747474;
						padding: 5rpx 0;
					}
				}
				.aright{
					width: 60rpx;
					display: flex;
					align-items: center;
					justify-content: flex-end;
					margin-right: 40rpx;
				}
				.aline{
					position: absolute;
					bottom: 0;
					width: 100%;
					height: 10rpx;
				}
			}
			.atitle{
				padding: 10rpx 0 20rpx;
				color:#303133;
				font-size: 30rpx;
				font-weight: 600;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
				position: relative;
				.sqprice{
					font-size: 36rpx;
					display: flex;
					flex-direction: row;
					align-items: right;
				}
				.price{
					font-size: 36rpx;
					display: flex;
					flex-direction: row;
					width: 280rpx;
					align-items: center;
				}
			}
			.sqcon{
				padding: 20rpx;
				margin: 20rpx 0;
				background-color: #f5f5f5;
				display: flex;
				flex-direction: column;
				border-radius: 10rpx;
				.sqlist{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					color: #333333;
					font-size: 26rpx;
					line-height: 50rpx;
				}
			}
			.atip{
				color:#000;
				font-size: 26rpx;
				margin-bottom: 20rpx;
			}
			.olist{
				display: flex;
				flex-direction: column;
				.ocell{
					font-size: 26rpx;
					color:#747474;
					padding: 10rpx 0;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					.red{
						color:#ff3d0e;
					}
				}
			}
		}
	}
	
	::v-deep .uni-easyinput__content-input{
		font-size: 36rpx !important;
	}
	
	::v-deep.uni-radio-input-checked{
		background-color: #89965f !important;
		border-color: #89965f !important;
		background-clip: content-box!important;
		box-sizing: border-box;
	}
	::v-deep.uni-radio-input-checked::before{
		display: none!important;
	}
	.allcon{
		height: 600rpx;
		overflow: hidden;
		background-color: #FFFFFF;
		padding-top: 40rpx;
	}
	.mtxt{
		display: flex;
		flex-direction: row;
		align-items: baseline;
		justify-content: center;
		padding: 20rpx;
		font-size: 30rpx;
		border-top:1rpx solid #eee;
	}
	.mref{
		margin: 0 20rpx;
	}
	.mcon{
		display: flex;
		flex-direction: row;
		align-items: baseline;
		justify-content: center;
		width:100%;
		padding: 20rpx 0;
		font-size: 40rpx;
		font-weight:600; 
		.mcost{
			font-size: 60rpx;
		}
	}
	.hcon{
		display: flex;
		flex-direction: row;
		padding: 20rpx;
		.htitle{
			flex:1;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 32rpx;
			font-weight: 600;
			text-indent: 50rpx;
		}
		.rclose{
			width: 50rpx;
			display: flex;
			justify-content: flex-start;
		}
	}
	.checklist-group{
		width: 100%;
	}
	.paybtn{
		background-color: #89965f  !important;
		margin: 20rpx 20rpx;
		border-radius: 50rpx;
		height: 75rpx;
		line-height: 75rpx;
		font-size: 30rpx;
	}
	.selcon{
		padding: 20rpx;
		position: relative;
		display: block;
		overflow-y: auto;
		.adrsitem {
			display: flex;
			flex-direction: row;
			align-items: center;
			background-color: #FFFFFF;
			margin-bottom: 20rpx;
			border-radius: 16rpx;
			border-top: 1rpx solid #f0f0f0;
			.lcon{
				display: flex;
				flex: 1;
				flex-direction: column;
			}
			.opecon{
				width: 80rpx;
				display: flex;
				align-items: center;
			}
			.sname{
				font-size: 30rpx;
				font-weight: 600;
				color: rgb(29, 29, 29);
				padding: 24rpx;
				justify-content: flex-start;
				align-items: center;
				display: flex;
				.adrtip{
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
					width: 80rpx;
					height: 48rpx;
					text-align: center;
					line-height: 50rpx;
					background: #89965f;
					border-radius: 24rpx;
					margin-left: 10rpx;
				}
			}
			.sinfo{
				padding: 0 24rpx 24rpx;
				font-size: 26rpx;
				color:rgb(116, 116, 116);
				line-height: 40rpx;
			}
		}
		.sitem {
			display: flex;
			flex-direction: row;
			flex: 1;
			background-color: #FFFFFF;
			border-top: 1rpx solid #f0f0f0;
			padding:16rpx 0;
			.conright{
				flex: 1;
				display: flex;
				flex-direction: row;
				width: 100%;
				justify-content:flex-start;
				align-items: center;
			}
			.rinfo{
				width: 100rpx;
				display: flex;
				flex-direction: column;
				justify-items: center;
				align-self: center;
				margin-right: 10rpx;
				text-align: center;
				.btn{
					padding: 0 12rpx;
					background-color: #89965f ;
					border-radius: 24rpx;
					font-size: 26rpx;
					color: #fff;
				}
			}
			.selbtn{
				width: 80rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			.simg{
				width: 50rpx;
				height: 46rpx;
				padding: 10rpx;
				.img{
					width: 100%;
					height: 100%;
					border-radius: 6rpx;
				}
			}
			.sname{
				display: flex;
				flex: 1;
				justify-content: flex-start;
				font-size: 28rpx;
				font-weight: 600;
				color: rgb(29, 29, 29);
				padding: 0 10rpx 0 20rpx;
			}
		}
	}
	
</style>
