ourPayment.vue 21.9 KB
Newer Older
潘永坪's avatar
潘永坪 committed
1 2 3 4 5 6 7
<template>
	<view class="bigBox">
		<view class="top">
			<view class="topName">
				<text class="topIcon">
					<text class="iconfont icon-tubiaolunkuo-"></text>
				</text>
8
				<text>{{name}}</text>
潘永坪's avatar
潘永坪 committed
9 10
			</view>
			<view class="topMoney">
潘永坪's avatar
潘永坪 committed
11
				<text class="moneyText">金额</text>
潘永坪's avatar
潘永坪 committed
12 13 14 15 16 17
				<view class="moneyNumber">
					<text class="iconfont icon-fl-renminbi" style="font-size: 56rpx;"></text>
					<text>{{buyMoney}}</text>
					<text></text>
				</view>
			</view>
潘永坪's avatar
潘永坪 committed
18
			<!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- -->
潘永坪's avatar
潘永坪 committed
19
			<view class="topCoupon" v-if="couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&chooseCouponObj==''" @click="showCoupon()">
潘永坪's avatar
潘永坪 committed
20 21
			    <view class="couponLeft">
					<text></text>
潘永坪's avatar
潘永坪 committed
22
					<text>{{couponData.masterSlaveCouponList[0].couponName}}</text>
潘永坪's avatar
潘永坪 committed
23 24 25 26 27 28
				</view>
				
				<view class="couponRight">
					<text>未选优惠券</text>
					<text class="iconfont icon-you" style="font-size:32rpx;"></text>
				</view>
潘永坪's avatar
潘永坪 committed
29
			</view>
潘永坪's avatar
潘永坪 committed
30
			<!-- -----------------------------有可用优惠券----------------------------------------------------- -->
潘永坪's avatar
潘永坪 committed
31
			<view class="topCoupon" v-if="chooseCouponObj!=''&&savedMoney>0" @click="showCoupon()">
32 33
				<view class="couponLeft">
					<text></text>
潘永坪's avatar
潘永坪 committed
34
					<text>{{chooseCouponObj.couponName}}</text>
35
				</view>
潘永坪's avatar
潘永坪 committed
36
				
37 38
				<view class="couponRight">
					<text>-</text>
潘永坪's avatar
潘永坪 committed
39
					<text>{{parseFloat(savedMoney.toFixed(2))}}</text>
潘永坪's avatar
潘永坪 committed
40 41
					<text class="iconfont icon-you" style="font-size:32rpx;"></text>
				</view>
潘永坪's avatar
潘永坪 committed
42
			</view>
潘永坪's avatar
潘永坪 committed
43
			<!-- -----------------------------------------------可用优惠券条件--------------------------------------- -->
潘永坪's avatar
潘永坪 committed
44
			<view class="topCoupon" v-if="ableConpon!=''" @click="showCoupon()">
潘永坪's avatar
潘永坪 committed
45 46 47 48 49 50 51
				<view class="couponLeft">
					<text></text>
					<text>{{ableConpon.couponName}}</text>
				</view>
				
				<view class="couponRight">
					<text>{{ableConpon.couponRule}}</text>
52 53
					<text class="iconfont icon-you" style="font-size:32rpx;"></text>
				</view>
潘永坪's avatar
潘永坪 committed
54 55 56 57 58 59 60 61 62
			</view>
		</view>
		
		<view class="middle">
			友情提示:请核对以上付款金额、付款商户等信息与交易一致。经您确认支付的金额,商家不会退回亦无赔偿义务。
		</view>
		
		<view class="bottom">
			<view class="botLeft">
潘永坪's avatar
潘永坪 committed
63 64
				<view v-for="(item,index) of leftList" :key="index">
					<text @click="clickNum(items.text,index,a)" v-for="(items,a) of item.child" :key="a" :style="{'background':items.background}">{{items.text}}</text>
潘永坪's avatar
潘永坪 committed
65 66 67 68
				</view>
			</view>
			
			<view class="botRight">
潘永坪's avatar
潘永坪 committed
69
				<view class="rightOne" @click="clickEnter()" :style="{'background':spaceBackground}">
潘永坪's avatar
潘永坪 committed
70 71
					<text class="iconfont icon-im_huige" style="font-size:70rpx;"></text>
				</view>
潘永坪's avatar
潘永坪 committed
72
				<view class="rightTwo" ref="pay" @click="clickPay()" :style="{'background':payBackground}">
潘永坪's avatar
潘永坪 committed
73 74 75 76 77
					<view>立即</view>
					<view>支付</view>
				</view>
			</view>
		</view>
潘永坪's avatar
潘永坪 committed
78
		<!-------------------------------------------券弹窗------------------------------>
潘永坪's avatar
潘永坪 committed
79
		 <orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon>
潘永坪's avatar
潘永坪 committed
80
		 
潘永坪's avatar
潘永坪 committed
81
	</view>
潘永坪's avatar
潘永坪 committed
82
	
潘永坪's avatar
潘永坪 committed
83 84 85
</template>

<script>
潘永坪's avatar
潘永坪 committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
import orderCoupon from '@/components/orderCoupon.vue'
export default {
  components:{
    orderCoupon
  },
  data() {
    return {
      enterUrl:'',//进入页面路由
      buyMoney:'', //输入金额
      companyId: '', //公司Id
      merchantId: '', //商户Id
      name: '', //商家名称
      payType:'',//支付类型,微信小程序42,支付宝小程序33
      paySign: '', //签名
      signType: '', //签名方式
      timeStamp: '', //时间戳
      nonceStr: '', //随机字符串
      package: '', //订单详情扩展字符串
      orderInfo:'',//支付宝订单号
      flag: '', //setTimeout函数
      couponData: '', //所有劵数据
      chooseCouponObj: '', //默认选中最优价格优惠券
      savedMoney:0,//优惠金额
      ableConpon: '', //没有可用优惠券时,达到一定条件可用,显示达到的条件
      orderSource:8,//1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口、7平台快捷买单、8扫码支付
      background:'',//普通按钮背景颜色
      spaceBackground:'',//回格按钮背景颜色
      payBackground:'#1dce2e',//支付背景颜色
      leftList:[//左侧按钮数据
        {
          child:[
            {text:1,background:''},
            {text:2,background:''},
            {text:3,background:''}
          ]
        },
        {
          child:[
            {text:4,background:''},
            {text:5,background:''},
            {text:6,background:''},
          ]
        },
        {
          child:[
            {text:7,background:''},
            {text:8,background:''},
            {text:9,background:''},
          ]
        },
        {
          child:[
            {text:0,background:''},
            {text:'.',background:''},
          ]
        }
      ],
      orderId:'',//订单Id
      paydJumpUrl:'',//页面跳转路径
      companyAttribute:'',//等于5时为出租车
      timer:null,//定时器
      extendInfo:''//额外信息
    }
  },
  onLoad(option) {
    //#ifdef MP-WEIXIN
    this.enterUrl=option.q
    this.payType = 42
    //#endif
155
			
潘永坪's avatar
潘永坪 committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
    //#ifdef MP-ALIPAY
    this.enterUrl=uni.getStorageSync('alipayQrCode')
    uni.removeStorageSync('alipayQrCode')//临时解决出租车扫码之后跳转到组合票时,参数会有问题,有时间再根本解决
    this.payType = 33
    //#endif
    if(this.enterUrl){//扫普通二维码进入
      this.merchantId=this.getUrlKey('merchantId')
      this.companyId=this.getUrlKey('companyId')
      this.extendInfo=this.getUrlKey('extendInfo')
    }else{//扫小程序二维码进入
      this.merchantId=option.merchantId
      this.companyId=option.companyId
      this.extendInfo=option.extendInfo
    }
    if(uni.getStorageSync('openid')){
      this.openid=uni.getStorageSync('openid')
      this.getUserBrowse()
      if (this.merchantId) { //大商家的有merchantId
174
				  this.init()
潘永坪's avatar
潘永坪 committed
175
      } else { //小商家没有merchantId
176
				  this.initTwo()
潘永坪's avatar
潘永坪 committed
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
      }
      this.initCoupon()
    }else{
      this.login()
    }
  },
  // 一般页面用onUnload
  // tabbar页面用onHide
  onUnload() {
    if(this.timer) {  
      clearTimeout(this.timer)
      this.timer = null
    }  
  },
  methods: {
    getUserBrowse(){//---获取浏览记录
潘永坪's avatar
潘永坪 committed
193 194
			  let queryUrl=this.$commonjs.getCurrentPageUrl()
			  let data={
潘永坪's avatar
潘永坪 committed
195 196
			    openid:uni.getStorageSync('openid') ,//用户Id
			    userName:'',//用户昵称
潘永坪's avatar
潘永坪 committed
197 198
			    pageType:4,//页面类型(0首页,1商户页,2产品页,3售票页,4付款页,5付款完成页,6行记页,7评论页,8咨询页,9劵中心页,11订单页,12订单详情页,13IC卡出行页,14电子门票页,15常用信息页,16其他页)
			    queryUrl,//页面全地址
潘永坪's avatar
潘永坪 committed
199
			    merchantType:''//商户类型1景区,2酒店,3餐饮,4特产
潘永坪's avatar
潘永坪 committed
200
			  }
潘永坪's avatar
潘永坪 committed
201
			  this.$request('wechatUser/wxUser/saveUserBrowse',data).then((res)=>{
潘永坪's avatar
潘永坪 committed
202 203
			
			  })
潘永坪's avatar
潘永坪 committed
204 205 206 207 208 209 210
    },
    login(){//---登录
      let _this=this
      uni.getProvider({
        service: 'oauth',
        success(proRes){
          uni.login({
211 212
						  provider:proRes.provider[0],
						  success: function (res) {
潘永坪's avatar
潘永坪 committed
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
              if(res.code){
                let source=''
                if(proRes.provider[0]=='weixin'){
                  source=3
                }else if(proRes.provider[0]=='alipay'){
                  source=4
                }
                let data={
                  code:res.code,
                  source,//微信小程序3,支付宝小程序4
                  appid:uni.getStorageSync('appid')||''
                }
                if(uni.getStorageSync('enterOptions').query){
									  data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
                }
                _this.$request('wechat/wx/getUserInfoByCode',data).then(res => {
                  if(res.code=='00'){
                    _this.openid=res.data.openid
                    uni.setStorageSync('openid',_this.openid)
                    _this.getUserBrowse()
                    if (_this.merchantId) { //大商家的有merchantId
234
											  _this.init()
潘永坪's avatar
潘永坪 committed
235
                    } else { //小商家没有merchantId
236
											  _this.initTwo()
潘永坪's avatar
潘永坪 committed
237 238 239 240 241 242 243 244 245 246 247 248 249 250
                    }
                    _this.initCoupon()
                    //用于获取token等信息
                    let userId=res.data.userId||''
                    let openid=res.data.openid||''
                    let datas={openid,source,userId}
                    _this.$request('wechatUser/login/findWxUserAndLogin',datas).then((res)=>{
											  if(res.code=='00'){
											    let token=res.data.token||''
                        uni.setStorageSync('token',token)
											    let createUserId=res.data.personId||''
                        uni.setStorageSync('createUserId',createUserId)
											    let userId=res.data.userId||''
                        uni.setStorageSync('userId',userId)
潘永坪's avatar
潘永坪 committed
251 252 253
											  }else{
											    uni.showToast({
											    	title:res.message,
潘永坪's avatar
潘永坪 committed
254
											    	icon:'none'
潘永坪's avatar
潘永坪 committed
255 256
											    })
											  }
潘永坪's avatar
潘永坪 committed
257
                    }).catch((err)=>{
潘永坪's avatar
潘永坪 committed
258
											  uni.showToast({
潘永坪's avatar
潘永坪 committed
259 260
											  	title:'登录失败',
											  	icon:'none'
潘永坪's avatar
潘永坪 committed
261
											  })
潘永坪's avatar
潘永坪 committed
262
                      _this.timer = setTimeout(() => {
潘永坪's avatar
潘永坪 committed
263
												  _this.login()
潘永坪's avatar
潘永坪 committed
264 265 266 267 268 269 270 271 272
                      }, 2000)
                    })
                  }else{
                    uni.showToast({
                      title:res.message,
                      icon:'none'
                    })
                  }
                }).catch((err)=>{
潘永坪's avatar
潘永坪 committed
273
										  uni.showToast({
潘永坪's avatar
潘永坪 committed
274 275
										  	title:'登录失败',
										  	icon:'none'
潘永坪's avatar
潘永坪 committed
276
										  })
潘永坪's avatar
潘永坪 committed
277
                  _this.timer = setTimeout(() => {
潘永坪's avatar
潘永坪 committed
278
											  _this.login()
潘永坪's avatar
潘永坪 committed
279 280 281
                  }, 2000)
                })
              }
282
						   }
潘永坪's avatar
潘永坪 committed
283 284 285 286 287 288 289 290
          })
        }
      })
    },
    getUrlKey(name){//---获取url
			  return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || ''
    },
    clickNum(i,index,a) {//---输入数字
潘永坪's avatar
潘永坪 committed
291 292 293 294
      //不超过14位数
      if(this.buyMoney.length>13){
        return
      }
潘永坪's avatar
潘永坪 committed
295
			  this.buyMoney += i
潘永坪's avatar
潘永坪 committed
296
			  this.leftList[index].child[a].background='#dddddd'
297
			  setTimeout(()=>{
潘永坪's avatar
潘永坪 committed
298
        this.leftList[index].child[a].background=''
299
			  },200)
潘永坪's avatar
潘永坪 committed
300 301 302 303
			  clearTimeout(this.flag)
			  this.flag = setTimeout(()=>{
			    this.initCoupon()
			  }, 1500)
潘永坪's avatar
潘永坪 committed
304 305 306 307 308 309 310 311 312
    },
    clickEnter(){//---退格
      this.buyMoney = this.buyMoney.substr(0, this.buyMoney.length - 1)
      this.spaceBackground='#dddddd'
      setTimeout(()=>{
        this.spaceBackground=''
      },200)
      clearTimeout(this.flag)
      this.flag = setTimeout(()=>{
潘永坪's avatar
潘永坪 committed
313
				  this.initCoupon()
潘永坪's avatar
潘永坪 committed
314 315 316 317 318 319 320 321 322 323
      }, 1500)
    },
    couponChoose(data) { //---子组件券选择之后触发的事件
      if(data){
        this.chooseCouponObj = data
        this.savedMoney=this.chooseCouponObj.savedMoney||0
      }else{
        this.chooseCouponObj = ''
        this.savedMoney=0
      }
潘永坪's avatar
潘永坪 committed
324
			  
潘永坪's avatar
潘永坪 committed
325 326
    },
    showCoupon() { //---展示券列表
潘永坪's avatar
潘永坪 committed
327
			  this.$refs.orderCoupon.showCoupon()
潘永坪's avatar
潘永坪 committed
328 329
    },
    init() { //---初始化获取商家名称,大商家
330
			  let data = {
潘永坪's avatar
潘永坪 committed
331 332
			    'merchantId': this.merchantId,
			    'companyId': this.companyId,
333
			  }
334
			  uni.showLoading({title: '加载中',mask:true})
潘永坪's avatar
潘永坪 committed
335
			  this.$request('scenic/order/findCodePayInfo',data).then((res) => {
336
				  uni.hideLoading()
潘永坪's avatar
潘永坪 committed
337
			    if (res.code =='00') {
338 339 340 341
			      this.name = res.data.name
			    } else {
			        uni.showToast({
					  title:res.message,
潘永坪's avatar
潘永坪 committed
342
					  icon:'none'
343 344
				    })
			    }
345 346
			  }).catch((err)=>{
				  uni.hideLoading()
347
			  })
潘永坪's avatar
潘永坪 committed
348 349
    },
    initTwo() { //---初始化获取商家名称,没有merchantId的小商家
350
			  let data = {
潘永坪's avatar
潘永坪 committed
351
			    'id': this.companyId,
352
			  }
353
			  uni.showLoading({title: '加载中',mask:true})
潘永坪's avatar
潘永坪 committed
354
			  this.$request('user/company/detail', data).then((res) => {
355
				  uni.hideLoading()
潘永坪's avatar
潘永坪 committed
356
			    if (res.code=='00'){
357
				  this.companyAttribute=res.data.companyVo.companyAttribute
潘永坪's avatar
潘永坪 committed
358
				  this.paydJumpUrl=res.data.paydJumpUrl
潘永坪's avatar
潘永坪 committed
359 360 361 362 363
				  if(this.companyAttribute==5){//出租车显示联系人姓名,其他显示公司名称
				  	this.name = res.data.companyVo.contactName 			  
				  }else{
				  	this.name = res.data.companyVo.companyName 
				  }
364 365 366
			    } else {
			        uni.showToast({
					  title:res.message,
潘永坪's avatar
潘永坪 committed
367 368
					  icon:'none'
          })
369
			    }
370 371
			  }).catch((err)=>{
				  uni.hideLoading()
372
			  })
潘永坪's avatar
潘永坪 committed
373 374
    },
    initCoupon() { //---加载优惠券
375
			  let savedMoneyList = []
潘永坪's avatar
潘永坪 committed
376 377
			  this.chooseCouponObj = ''
			  this.ableConpon = ''
378 379 380 381 382
			  let data = {
			    money:parseFloat(this.buyMoney)||0, //订单总价,不算券,和现金红包
			    merchantId:this.merchantId, //商户Id
			    companyId:this.companyId,//公司Id
			    orderSource:this.orderSource,//订单来源 8扫码支付
383
			    openid:this.openid
384
			  }
潘永坪's avatar
潘永坪 committed
385 386
			  this.$request('wechatUser/myPage/usableCouponList',data).then((res) =>{
			    if (res.code == '00') {
387 388
			      this.couponData = res.data
			      let masterSlaveCouponList=res.data.masterSlaveCouponList
389
			      if (masterSlaveCouponList&&masterSlaveCouponList.length>0) {
潘永坪's avatar
潘永坪 committed
390 391 392 393
			        masterSlaveCouponList.forEach((item) => { //获取最优券
			          savedMoneyList.push(item.savedMoney)
			        })
			        let maxMoney = Math.max.apply(null, savedMoneyList)
潘永坪's avatar
潘永坪 committed
394 395
			        let arr=masterSlaveCouponList.filter((item)=>{//找到最大值的数组
			          return item.savedMoney==maxMoney
潘永坪's avatar
潘永坪 committed
396
			        })
潘永坪's avatar
潘永坪 committed
397 398
			        if(arr.length==1){
			          this.chooseCouponObj=arr[0]
潘永坪's avatar
潘永坪 committed
399
			        }else{
潘永坪's avatar
潘永坪 committed
400
              //如果数组有多个时
潘永坪's avatar
潘永坪 committed
401 402 403 404 405 406 407 408
			          let index=arr.findIndex((item)=>{//如果有多个,找到是否有平台券,平台劵优先
			            return item.createSource==1
			          })
			          if(index>-1){
			            this.chooseCouponObj=arr[index]
			          }else{
			            this.chooseCouponObj=arr[0]
			          }
潘永坪's avatar
潘永坪 committed
409
			        }
潘永坪's avatar
潘永坪 committed
410
			        this.savedMoney=this.chooseCouponObj.savedMoney
潘永坪's avatar
潘永坪 committed
411
			      } else {
412 413
			        if (res.data.unusableCouponList.length > 0) {
			          res.data.unusableCouponList.forEach((item, i) => { //没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
潘永坪's avatar
潘永坪 committed
414 415 416 417 418 419
			            if (item.isProduct == 1) {
			              this.ableConpon = item
			            }
			          })
			        }
			      }
420 421
			    }
			  })
潘永坪's avatar
潘永坪 committed
422 423 424 425 426 427 428 429 430 431 432
    },
    clickPay(){//---点击立即支付,获取支付需要的参数
      if (!parseFloat(this.buyMoney)) {
        uni.showToast({
          title:'请输入正确金额',
          icon:'none'
        })
        return
      }
      let couponList = []
      if (this.chooseCouponObj != '') {
潘永坪's avatar
潘永坪 committed
433 434 435
				  if(this.chooseCouponObj.slaveList.length>0){//有从卷取值从卷,没有从卷取值主劵
				    couponList=[//券列表
				    	{
潘永坪's avatar
潘永坪 committed
436 437 438
				    		couponId:this.chooseCouponObj.slaveCouponId,//券id
				    		isMerchant:this.chooseCouponObj.slaveCreateSource,//是否是商户的券
				    		myCouponId:this.chooseCouponObj.slaveId,//领取人编号
潘永坪's avatar
潘永坪 committed
439 440 441
              couponType:this.chooseCouponObj.couponType,//券类型
              couponPrice:this.chooseCouponObj.savedMoney,//券价格
              couponCompanyId:this.chooseCouponObj.companyId,//公司Id
潘永坪's avatar
潘永坪 committed
442 443 444 445 446
				    	}
				    ]
				  }else{
				  	couponList=[
				  		{
潘永坪's avatar
潘永坪 committed
447 448 449
              couponId:this.chooseCouponObj.couponId,//券id
              isMerchant:this.chooseCouponObj.createSource,//是否是商户的券
              myCouponId:this.chooseCouponObj.id,//领取人编号
潘永坪's avatar
潘永坪 committed
450 451
				  	    couponType:this.chooseCouponObj.couponType,//券类型
				        couponPrice:this.chooseCouponObj.savedMoney,//券价格
潘永坪's avatar
潘永坪 committed
452
              couponCompanyId:this.chooseCouponObj.companyId,//公司Id
潘永坪's avatar
潘永坪 committed
453 454 455
				  		}
				  	]
				  }
潘永坪's avatar
潘永坪 committed
456 457
      }
      let data = {
潘永坪's avatar
潘永坪 committed
458 459
				   companyId: this.companyId,
				   merchantId: this.merchantId,
460
				   userId:this.openid,
潘永坪's avatar
潘永坪 committed
461 462 463 464
				   orderMoney: parseFloat(this.buyMoney),
				   payType: this.payType, //支付类型,
				   orderSource:this.orderSource,//订单来源 8扫码支付
				   couponList,//券列表
潘永坪's avatar
潘永坪 committed
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
					 extendInfo:this.extendInfo,//额外信息
      }
      this.payBackground='#cccccc'
      //重新加载优惠券
      this.initCoupon()
      this.$request('orderc/order/codePay', data).then((res) => {
        setTimeout(() => {
          this.payBackground='#1dce2e'
        },1000)
        if(res.code=='00') {
          if (res.data.errorMessage) {
            uni.showToast({
              title:res.data.errorMessage,
              icon:'none'
            })
            return
          }
          this.orderId=res.data.id
          //微信入参
          this.signType = res.data.signType
          this.paySign = res.data.sign
          this.timeStamp = res.data.timestamp
          this.nonceStr = res.data.noncestr
          this.package = res.data.package
          //支付宝入参
          this.orderInfo = res.data.payInfo || ''
          this.goPay()
        } else {
          uni.showToast({
            title:res.message,
            icon:'none'
          })
        }
      }).catch((err) => {
				  this.payBackground='#1dce2e'
      })
    },
    goPay(){//---去支付
      let _this=this
      // #ifdef MP-WEIXIN
      uni.requestPayment({
潘永坪's avatar
潘永坪 committed
506 507 508 509 510 511 512
				    provider: 'wxpay',
				    timeStamp:this.timeStamp,
				    nonceStr:this.nonceStr,
				    package:this.package,
				    signType:this.signType,
				    paySign:this.paySign,
				    success: function (res) {
潘永坪's avatar
潘永坪 committed
513 514
          if(_this.companyAttribute==5){//出租车跳转分销组合票页面
            uni.navigateTo({
潘永坪's avatar
潘永坪 committed
515
							    url:_this.paydJumpUrl
潘永坪's avatar
潘永坪 committed
516 517 518 519 520 521
            })
          }else{
            uni.navigateTo({
							    url:'/pages/payment/paySuccess/paySuccess?orderId='+_this.orderId
            })
          }
潘永坪's avatar
潘永坪 committed
522 523 524
				    },
				    fail: function (err) {
				        uni.showToast({
潘永坪's avatar
潘永坪 committed
525 526 527
            title:err.errMsg,
            icon:'none'
          })
潘永坪's avatar
潘永坪 committed
528
				    }
潘永坪's avatar
潘永坪 committed
529 530
      })
      //#endif
潘永坪's avatar
潘永坪 committed
531
				
潘永坪's avatar
潘永坪 committed
532 533 534 535 536 537 538
      // #ifdef MP-ALIPAY
      uni.requestPayment({
        provider: 'alipay', // 服务提供商 支付宝支付: alipay   微信支付: wxpay
        orderInfo: this.orderInfo, // 支付宝订单号
        success: function (res) {
          if(_this.companyAttribute==5){//出租车跳转分销组合票页面
            uni.navigateTo({
潘永坪's avatar
潘永坪 committed
539
							    url:_this.paydJumpUrl
潘永坪's avatar
潘永坪 committed
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
            })
          }else{
            uni.navigateTo({
							    url:'/pages/payment/paySuccess/paySuccess?orderId='+_this.orderId
            })
          }
        },
        fail: function (err) {
          uni.showToast({
            title:err.errMsg,
            icon:'none'
          })
        }
      })
      // #endif
    }
  },
  watch: {
潘永坪's avatar
潘永坪 committed
558
		  buyMoney(val, oldVal) {
潘永坪's avatar
潘永坪 committed
559 560
		    if (val == '.' && oldVal == '') { //首位数是小数点自动加上0
		      this.buyMoney = 0 + '.'
潘永坪's avatar
潘永坪 committed
561
		    }
潘永坪's avatar
潘永坪 committed
562 563
		    if (val == '0' && oldVal == '') { //首位数是0自动加上小数点
		      this.buyMoney = 0 + '.'
潘永坪's avatar
潘永坪 committed
564
		    }
潘永坪's avatar
潘永坪 committed
565 566
      if (val.length == 2) { //防止回退之后出现01,02等状况
			  if (val.substr(0, 1) == 0 && val.substr(1, 2) != '.') {
潘永坪's avatar
潘永坪 committed
567 568
			    this.buyMoney = val.substr(1, 2)
			  }
潘永坪's avatar
潘永坪 committed
569 570
      }
		    if (isNaN(val) && val != '.') { //出现非数字,输入无效
潘永坪's avatar
潘永坪 committed
571 572
		      this.buyMoney = oldVal
		    }
潘永坪's avatar
潘永坪 committed
573 574
		    var x = String(this.buyMoney).indexOf('.') + 1 //小数点的位置
		    var y = String(this.buyMoney).length - x //小数的位数
潘永坪's avatar
潘永坪 committed
575 576 577
		    if (y > 2 && x > 0) {
		      this.buyMoney = oldVal
		    }
潘永坪's avatar
潘永坪 committed
578 579 580 581 582
      if (parseFloat(this.buyMoney)) {
        this.payBackground='#1dce2e'
      } else {
        this.payBackground='#cccccc'
      }
潘永坪's avatar
潘永坪 committed
583
		  }
潘永坪's avatar
潘永坪 committed
584 585
  }
}
潘永坪's avatar
潘永坪 committed
586 587
</script>

588
<style lang="scss">
潘永坪's avatar
潘永坪 committed
589
	.bigBox{background:#f5f5f5;height: 100%;}
590
	/*上部分*/
潘永坪's avatar
潘永坪 committed
591
	.top{background: #FFFFFF;}
潘永坪's avatar
潘永坪 committed
592
	.topName{font-size:30rpx;font-weight: bold;padding: 50rpx 24rpx 0 24rpx;display: flex;align-items: center;justify-content: center;}
潘永坪's avatar
潘永坪 committed
593 594
	.topIcon{display:inline-flex;margin-right:10rpx;width:50rpx;height:50rpx;border-radius:50%;background:#FF8B57;align-items:center;justify-content:center;}
	.icon-tubiaolunkuo-{font-size:36rpx;color: #FFFFFF;font-weight: 400;}
潘永坪's avatar
潘永坪 committed
595
	.topMoney{padding:80rpx 24rpx 24rpx 24rpx;display: flex;justify-content:space-between;align-items: center;}
潘永坪's avatar
潘永坪 committed
596
	.moneyText{color: #FF3C00;font-size:32rpx;font-weight: bold;}
潘永坪's avatar
潘永坪 committed
597
	.moneyNumber text:nth-child(2){font-size:62rpx;font-weight: bold;position: relative;left: -6rpx;}
潘永坪's avatar
潘永坪 committed
598
	.moneyNumber text:last-child{animation: dis 1.5s infinite;transition: 1s;width: 1px;height:56rpx;display: inline-block;background: #333333;position: relative;top:8rpx;}
潘永坪's avatar
潘永坪 committed
599
	.topCoupon{display: flex;height: 90rpx;border-top:1px solid $divider;align-items:center;padding:0 24rpx;justify-content: space-between;}
600 601 602 603 604 605
	.couponLeft{font-size:24rpx;}
	.couponLeft text:first-child{margin-right:10rpx;display: inline-block;width:30rpx;height:30rpx;background: #f9690e;color: #FFFFFF;text-align: center;line-height:28rpx;border-radius:4rpx;}
	.couponRight{position:relative;left:8rpx;}
	.couponRight text:first-child{font-size:32rpx;color:#f9690e;}
	.couponRight text:nth-child(2){font-size: 32rpx;color: #F9690E;font-weight:bold;}
	/*中间部分*/
潘永坪's avatar
潘永坪 committed
606
	.middle{padding:50rpx 24rpx 0 24rpx;font-size: 24rpx;color: #999999;line-height: 40rpx;}	
607
	/*下部分*/
潘永坪's avatar
潘永坪 committed
608 609 610 611
	.bottom{position:absolute;bottom:0;height:40%;background: #FFFFFF;width:100%;display: flex;border-top:1px solid #dddddd;font-size:50rpx;}
	.botLeft{width:75%;}
	.botLeft view{height:25%;display: flex;border-bottom:1px solid #dddddd;}
	.botLeft view:last-child{border:none;}
潘永坪's avatar
潘永坪 committed
612 613
	.botLeft view:last-child text:first-child{width:66.7%;}
	.botLeft view:last-child text:last-child{width: 33.3%;}
潘永坪's avatar
潘永坪 committed
614 615 616 617
	.botLeft view text{flex:1;height:100%;display:inline-flex;align-items: center;justify-content: center;border-right:1px solid #dddddd;}
	.botLeft view:last-child text{flex:initial;}
	.botRight{width:25%;}
	.rightOne{height: 25%;display: flex;align-items:center;justify-content: center;border-bottom:1px solid #dddddd;}
潘永坪's avatar
潘永坪 committed
618
	.rightTwo{height: 75%;border:none;color: #FFFFFF;display: flex;flex-direction:column;align-items:center;justify-content: center;}	
潘永坪's avatar
潘永坪 committed
619 620 621 622 623 624 625 626 627
	@keyframes dis{
	  from{
	    opacity: 0;
	  }
	  to{
	    opacity: 1;
	  }
	}
</style>