<template>
	<u-popup :show="payshow" @close="payclose" @open="payopen" round="12" :closeable="true">
		<view :class="[AppTheme]" class="app">
			<view class="price-box">
				<text>支付金额</text>
				<text class="price text-neutral">{{params.money}}</text>
			</view>
			<view class="pay-type-list">
				<radio-group>
					<view v-if="weixinpay2" class="type-item b-b" @click="changepaytype(1)">
						<u-icon name="weixin-fill" color="#62b900" size="30"></u-icon>
						<view class="con">
							<text class="tit">微信支付</text>
							<text style="padding-top: 10rpx;">推荐使用微信支付</text>
						</view>
						<label class="radio">
							<radio value="1" :color="primary" :checked='params.paytype == 1' />
							</radio>
						</label>
					</view>
					<!-- #ifdef APP-PLUS || H5 -->
					<view v-if="alipay2" class="type-item" @click="changepaytype(3)">
						<u-icon name="zhifubao" color="rgb(85, 170, 255)" size="30"></u-icon>
						<view class="con">
							<text class="tit">支付宝支付</text>
						</view>
						<label class="radio">
							<radio value="3" :color="primary" :checked='params.paytype == 3' />
							</radio>
						</label>
					</view>
					<!-- #endif -->
					<view v-if="zhtpay" class="type-item" @click="changepaytype(2)">
						<u-icon name="red-packet-fill" color="rgb(224, 116, 114)" size="30"></u-icon>
						<view class="con">
							<text class="tit">余额支付</text>
							<text style="padding-top: 10rpx;">可用余额 ¥{{balance}}</text>
						</view>
						<label class="radio">
							<radio value="2" :color="primary" :checked='params.paytype == 2' />
							</radio>
						</label>
					</view>
					<view v-if="ncb" class="type-item" @click="changepaytype(4)">
						<u-icon name="bag-fill" color="rgb(224, 116, 114)" size="30"></u-icon>
						<view class="con">
							<text class="tit">农场币</text>
							<text style="padding-top: 10rpx;">可用余额 ¥{{farm_coin}}</text>
						</view>
						<label class="radio">
							<radio value="2" :color="primary" :checked='params.paytype == 4' />
							</radio>
						</label>
					</view>
				</radio-group>
			</view>

			<text class="mix-btn bg-linear-gradient" @click="confirm">确认支付</text>
			<u-keyboard ref="uKeyboard" mode="number" :tooltip="false" :safeAreaInsetBottom="true" :overlay="true"
				:closeOnClickOverlay="true" :dotDisabled="false" @change="onChange" @backspace="onBackspace"
				:show="show">
				<view>
					<view class="u-text-center u-padding-20 money">
						<view class="text-neutral">
							<text>{{params.money}}</text>
							<text class="u-font-20 u-padding-left-10">元</text>
						</view>
						<view class="u-padding-10 close" data-flag="false" @tap="showPop(false)">
							<u-icon name="close" color="#333333" size="28"></u-icon>
						</view>
					</view>
					<view class="u-flex u-row-center codeinput" style="margin: 20rpx 0; padding: auto;100%;">
						<u-code-input :color="primary" :borderColor="primary" :space="20" size="40" mode="box"
							:maxlength="6" :dot="true" v-model="password" :disabledKeyboard="true" @finish="finish">
						</u-code-input>
					</view>
				</view>
			</u-keyboard>
		</view>
	</u-popup>
</template>

<script>
	// #ifdef H5
	var wx = require('jweixin-module');
	// #endif
	import wallApi from '@/api/wall/index.js';
	import cart from '@/api/cart/index.js';
	import api from '@/api/mall/index.js';
	import adoptApi from '@/api/home/index.js';
	import {
		allKeys
	} from '../../js/underscore';
	export default {
		name: "payment",
		props: ["channel", "weixinpay", "alipay", "zhtpay","ncb"], //1:（商品，砍价 ，拼团），2：认养，,3:充值,4：租地，5：活动，6：保证金
		data() {
			return {
				farm_coin: 0,
				primary: this.$theme.primary,
				settingFile: getApp().globalData.siteinfo,
				payshow: false,
				show: false,
				password: '',
				balance: 0,
				params: {
					// 支付方式
					paytype: 1, //1：微信，2：余额,3:支付宝
					systype: '', //h5 或 app 或 mpweixin
					money: 0
				},
				weixinpay2: true,
				alipay2: false,
			};
		},
		created() {
			let that = this;
			wallApi.income({}).then(res => {
				if (res.status == 200) {
					that.balance = res.data.money; //余额
					that.farm_coin = res.data.farm_coin
				}
			});
			let config = that.$init_config(1, function(res) {
				console.log(res,'res');
				if (res && res.app) {
					// that.weixinpay2 = res.app.pay.wx.isopen;
					// that.alipay2 = res.app.pay.ali.isopen;
				}
			});
		},
		methods: {
			init(data) {
				let that = this;
				if (data) {
					that.params = data;
					that.params.money = parseFloat(that.params.money).toFixed(2);
					// #ifdef APP-PLUS
					that.params.systype = 'app'
					// #endif
					// #ifdef H5
					that.params.systype = 'h5'
					// #endif
					// #ifdef MP-WEIXIN
					that.params.systype = 'mpweixin'
					// #endif
				}
			},
			payopen(data) {
				let that = this;
				that.init(data);
				that.payshow = true;
			},
			payclose() {
				let that = this;
				that.payshow = false;
			},
			changepaytype(type) {
				let that = this;
				that.params.paytype = type;
			},
			confirm() {
				let that = this;
				if (that.params.paytype == 1) {
					that.paywx();
				} else if (that.params.paytype == 2) {
					if (that.channel != 3) {
						that.show = true;
						that.password = ''
					} else {
						uni.showToast({
							title: '请选择正确的支付方式',
							icon: 'none'
						})
						return;
					}
				} else if (that.params.paytype == 3) {
					that.payali();
				} else if(that.params.paytype == 4) {
					if (that.channel != 3) {
						that.show = true;
						that.password = ''
					} else {
						uni.showToast({
							title: '请选择正确的支付方式',
							icon: 'none'
						})
						return;
					}
				} else {
					uni.showToast({
						title: '请选择正确的支付方式',
						icon: 'none'
					})
					return;
				}

			},
			onChange(val) {
				let that = this;
				if (that.password.length < 6) {
					that.password += val;
				}
				if (that.password.length >= 6) {
					if (that.params.paytype == 1) {
						that.paywx();
					} else if (that.params.paytype == 2) {
						that.paybalance();
					} else if(that.params.paytype == 4) {
						that.paybalance();
						console.log(that.channel);
					}
				}
			},
			payNcb() {
				
			},
			onBackspace(e) {
				let that = this;
				if (that.password.length > 0) {
					that.password = that.password.substring(0, that.password.length - 1);
				}
			},
			paywx() {
				let that = this;
				console.log(this.channel,'channel',that.params);
				if (that.channel == 1) {
					that.$paycenter.paygood(that.params).then(res => {
						console.log(res,'支付回调');
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 2) {
					that.$paycenter.payrenyang(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 3) {
					that.$paycenter.paycz(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 4) {
					that.$paycenter.payland(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 5) {
					that.$paycenter.payactivity(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 6) {
					that.$paycenter.renewal(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 7) {
					that.$paycenter.seedpay(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 8) {
					that.$paycenter.payserve(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 9) {
					that.$paycenter.operator(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				} else if (that.channel == 10) {
					that.$paycenter.paybond(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.wxPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.wxPayH5(res.data)
							// #endif
							// #ifdef MP-WEIXIN
							that.wxPayWEIXIN(res.data)
							// #endif
						}
					})
				}
			},

			payali() {
				let that = this;
				if (that.channel == 1) {
					that.$paycenter.paygood(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 2) {
					that.$paycenter.payrenyang(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 3) {
					that.$paycenter.paycz(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 4) {
					that.$paycenter.payland(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 5) {
					that.$paycenter.payactivity(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 6) {
					that.$paycenter.renewal(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 7) {
					that.$paycenter.seedpay(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 8) {
					that.$paycenter.payserve(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 9) {
					that.$paycenter.operator(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				} else if (that.channel == 10) {
					that.$paycenter.paybond(that.params).then(res => {
						if (res.status === 0 || res.code === 0) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						} else {
							// #ifdef APP-PLUS
							that.aliPayAPPPLUS(res.data)
							// #endif
							// #ifdef H5
							that.aliPayH5(res.data)
							// #endif
						}
					})
				}
			},

			paybalance() {
				let that = this;
				if (that.channel == 1) {
					that.paybalance1()
				} else if (that.channel == 2) {
					that.paybalance2()
				} else if (that.channel == 4) {
					that.paybalance4()
				} else if (that.channel == 5) {
					that.paybalance5()
				} else if (that.channel == 6) {
					that.paybalance6()
				} else if (that.channel == 7) {
					that.paybalance7()
				} else if (that.channel == 8) {
					that.paybalance8()
				} else if (that.channel == 9) {
					that.paybalance9()
				} else if (that.channel == 10) {
					that.paybalance10()
				}
			},

			wxPayWEIXIN(paydata) {
				let that = this;
				uni.requestPayment({
					provider: 'wxpay',
					timeStamp: paydata.timeStamp,
					nonceStr: paydata.nonceStr,
					package: paydata.package,
					signType: paydata.signType,
					paySign: paydata.paySign,
					success: function(res) {

						uni.showToast({
							title: '支付成功',
							icon: 'success',
							duration: 1500
						});
						that.payfinish()
					},
					fail: function(err) {
						console.log('err', err)
					}
				});
			},

			wxPayH5(paydata) {
				let that = this;
				console.log(paydata,'paydata.appid');
				wx.config({
					debug: false,
					appId: paydata.appId, // 必填，公众号的唯一标识
					timestamp: paydata.timeStamp, // 必填，生成签名的时间戳
					nonceStr: paydata.nonceStr, // 必填，生成签名的随机串
					signature: paydata.paySign,
					jsApiList: ['chooseWXPay']
				});
				wx.ready(function() {
					wx.chooseWXPay({
						timestamp: paydata.timeStamp,
						nonceStr: paydata.nonceStr, // 支付签名随机串，不长于 32 位
						package: paydata.package,
						signType: 'MD5', // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
						paySign: paydata.paySign, // 支付签名
						success(res) {
							that.payfinish()
						},
						fail(err) {
							console.log('fail', err)
							uni.showToast({
								icon: 'none',
								title: '未完成支付！'
							})
						}
					});
				});
			},

			wxPayAPPPLUS(paydata) {
				let that = this;
				console.log('paydata',paydata)
				uni.requestPayment({
					provider: 'wxpay',
					orderInfo: paydata,
					success: function(res) {
						uni.showToast({
							title: '支付成功',
							icon: 'success',
							duration: 1500
						});
						that.payfinish()
					},
					fail: function(err) {
						console.log('fail', err)
						uni.showToast({
							title: err.errMsg,
							icon: 'none'
						})
					}
				});
			},

			aliPayH5(paydata) {
				let that = this;
				uni.showToast({
					icon: 'none',
					title: '暂未开放！'
				})
				wx.config({
					debug: false,
					appId: paydata.appid, // 必填，公众号的唯一标识
					timestamp: paydata.timeStamp, // 必填，生成签名的时间戳
					nonceStr: paydata.nonceStr, // 必填，生成签名的随机串
					signature: paydata.paySign,
					jsApiList: ['chooseWXPay']
				});
				wx.ready(function() {
					wx.chooseWXPay({
						timestamp: paydata.timeStamp,
						nonceStr: paydata.nonceStr, // 支付签名随机串，不长于 32 位
						package: paydata.package,
						signType: 'MD5', // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
						paySign: paydata.paySign, // 支付签名
						success(res) {
							that.payfinish()
						},
						fail(err) {
							console.log('fail', err)
							uni.showToast({
								icon: 'none',
								title: '未完成支付！'
							})
						}
					});
				});
			},

			aliPayAPPPLUS(paydata) {
				let that = this;
				console.log('paydata', paydata)
				uni.requestPayment({
					provider: 'alipay',
					orderInfo: paydata,
					success: function(res) {
						uni.showToast({
							title: '支付成功',
							icon: 'success',
							duration: 1500
						});
						that.payfinish()
					},
					fail: function(err) {
						console.log('fail', err)
						uni.showToast({
							title: err.errMsg,
							icon: 'none'
						})
					}
				});
			},

			//余额支付
			paybalance1() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						var pdata = {
							orderid: that.params.orderid,
							djqid: that.params.djqid,
							type: that.params.paytype == 1 ? 'wxpay' : (that.params.paytype == 4? 'farmCoin': 'money'),
							paypass: that.password
						};
						api.pay(pdata)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									that.payfinish()
								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付
			paybalance2() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						var pdata = {
							orderid: that.params.orderid,
							djqid: that.params.djqid,
							type: that.params.paytype == 1 ? 'wxpay' : 'money',
							paypass: that.password
						};
						adoptApi.payNew(pdata)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									that.payfinish()
								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})


			},
			//余额支付
			paybalance4() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						let pdata = {
							order_info: JSON.stringify(that.params)
						};
						that.$paycenter.pay_soil_money(pdata)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									that.payfinish()
								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})


			},
			//余额支付
			paybalance5() {
				let that = this;

				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_ac_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									that.payfinish()
								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付 
			paybalance6() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_renewal_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									uni.showToast({
										title: res.msg,
										icon: "none"
									});
									setTimeout(() => {
										uni.navigateTo({
											url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
												that.params.orderid
										})
									}, 2000)

								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付
			paybalance7() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_seed_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									uni.showToast({
										title: res.msg,
										icon: "none"
									});
									setTimeout(() => {
										uni.navigateTo({
											url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
												that.params.orderid
										})
									}, 2000)

								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付
			paybalance8() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_serve_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									uni.showToast({
										title: res.msg,
										icon: "none"
									});
									setTimeout(() => {
										uni.navigateTo({
											url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
												that.params.orderid
										})
									}, 2000)

								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付
			paybalance9() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_operator_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									uni.showToast({
										title: res.msg,
										icon: "none"
									});
									console.log(that.params.type, 'that.params.type')
									if (that.params.type == 2) {
										setTimeout(() => {
											uni.navigateTo({
												url: '/pagesE/pages/seedlist/decoration/decoration?id=' +
													that.params.order_id
											})
										}, 2000)
									} else {
										setTimeout(() => {
											uni.navigateTo({
												url: '/pagesE/pages/seedlist/crop?id=' + that
													.params.seed_id
											})
										}, 2000)
									}


								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			//余额支付
			paybalance10() {
				let that = this;
				cart.checkPayPassword({
					password: that.password
				}).then(res => {

					uni.hideLoading();
					if (res.status == 200) {
						that.$paycenter.pay_bond_money(that.params)
							.then(res => {
								uni.showToast({
									title: res.msg,
									icon: "none"
								});
								if (res.status == 200) {
									uni.showToast({
										title: res.msg,
										icon: "none"
									});
									setTimeout(() => {
										uni.navigateTo({
											url: '/pagesC/pages/merchantdetails/bond'
										})
									}, 1000)
								}
							});

					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						});
						if (res.msg === '未设置支付密码，现在进行设置!') {
							setTimeout(() => {
								uni.navigateTo({
									url: '/pagesD/pages/set/changemima/changemima'
								})
							}, 1000)
						}
					}
				})
			},
			showPop(flag = true) {
				let that = this;
				that.password = '';
				that.show = flag;
			},
			finish() {

			},
			payfinish() {
				let that = this;
				if (that.channel == 3) {
					that.payclose();
					//1:（商品，砍价 ，拼团），2：认养，,3:充值,4：租地，5：活动
					uni.navigateBack(-1);
				} else if (that.channel == 10) {
					that.payclose();
					uni.navigateTo({
						url: '/pagesC/pages/merchantdetails/bond'
					});
				} else {
					setTimeout(function() {
						//1:（商品，砍价 ，拼团），2：认养，,3:充值,4：租地，5：活动
						uni.navigateTo({
							url: '/pagesE/pages/common/paySuccess?channel=' + that.channel
						});
					}, 1000)
				}
			}
		}
	}
</script>


<style lang='scss'>
	.codeinput {
		justify-content: space-evenly;
		display: flex;
	}

	.app {
		width: 100%;
	}

	.money {
		font-size: 80rpx;
		position: relative;
		text-align: center;

		.close {
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			line-height: 28rpx;
			font-size: 28rpx;
		}
	}

	.tips {
		color: $u-tips-color;
		text-align: center;
	}

	.price-box {
		background-color: #fff;
		height: 160rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		font-size: 28upx;
		color: #909399;

		.price {
			font-size: 50upx;
			margin-top: 12upx;

			&:before {
				content: '￥';
				font-size: 40upx;
			}
		}
	}

	.pay-type-list {
		/* margin-top: 20upx; */
		background-color: #fff;
		padding-left: 60upx;

		.type-item {
			height: 120upx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-right: 60upx;
			font-size: 30upx;
			position: relative;

			.con {
				margin-left: 20rpx;
			}
		}

		.icon {
			width: 100upx;
			font-size: 52upx;
		}

		.icon-erjiye-yucunkuan {
			color: #fe8e2e;
		}

		.icon-weixinzhifu {
			color: #36cb59;
		}

		.icon-alipay {
			color: #01aaef;
		}

		.tit {
			font-size: $font-lg;
			color: $font-color-dark;
			margin-bottom: 4upx;
		}

		.con {
			flex: 1;
			display: flex;
			flex-direction: column;
			font-size: $font-sm;
			color: $font-color-light;
		}
	}

	.mix-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 630upx;
		height: 80upx;
		margin: 80upx auto 30upx;
		font-size: $font-lg;
		color: #fff;
		border-radius: 10upx;
	}
</style>
