pay.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view>
  3. <view class="text-center" style="margin-top: 120upx;">
  4. <view class="text-gray text-df padding">待支付</view>
  5. <view class="theme-color ">
  6. <text style="font-size: 48upx;">¥</text>
  7. <text style="font-size: 72upx;">{{detail.cost}}</text>
  8. </view>
  9. <view class="text-black text-lg margin-top">渠道合伙人-保证金</view>
  10. </view>
  11. <view class="container">
  12. <view style="padding: 40upx 0 30upx 30upx;font-size: 30upx;font-weight: bold;">支付方式</view>
  13. <block v-for="(item, index) in ways" :key="index">
  14. <view class="flex align-center justify-between padding" @click="change(index)">
  15. <view class="flex align-center">
  16. <image class="margin-right" :src="item.icon" style="width: 50upx;height: 50upx;"></image>
  17. <view>{{item.name}}</view>
  18. </view>
  19. <view :class="current == index ? 'theme-color cuIcon-roundcheckfill' : 'cuIcon-round'" style="font-size: 40upx;"></view>
  20. </view>
  21. </block>
  22. </view>
  23. <view class="bottom-bar safe-area-inset-bottom " style="margin-top: 120rpx;">
  24. <view @click="pay" class="bg-gradual-base cu-btn round" style="width: 100%;padding: 46rpx;">
  25. 确认支付
  26. </view>
  27. </view>
  28. <u-popup v-model="successShow" mode="center" :mask-close-able="false" width="550" height="500" border-radius="30">
  29. <view class="text-center padding">
  30. <image src="/static/agent/pic_agent.png" style="width: 109upx;height: 122upx;"></image>
  31. <view style="font-size: 34upx;color: #FF9447;font-weight: bold;padding: 30upx 0 10upx 0;">恭喜您成为代理</view>
  32. <view style="font-size: 28upx;color: #999999;padding-bottom: 60upx;">专享代理专属权益</view>
  33. <view @click="confirm" class="cu-btn bg-gradual-base round" style="width: 90%;padding: 40rpx;">
  34. 确认
  35. </view>
  36. </view>
  37. </u-popup>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. successShow: false,
  45. ways: [
  46. {name: '微信支付', icon: '/static/agent/icon_weixin.png'}
  47. ],
  48. current: 0,
  49. detail:{}
  50. }
  51. },
  52. onLoad() {
  53. this.fetchDetail()
  54. },
  55. methods: {
  56. fetchDetail(){
  57. this.$api.agenterType.detail({settingKey:this.$global.agenterTypeId}).then(res=>{
  58. this.detail=JSON.parse(res.data.settingValue)
  59. })
  60. },
  61. change(index) {
  62. this.current = index;
  63. },
  64. async pay() {
  65. let exTime= this.$dateTime.getExpireTime(5)
  66. let billRecord={
  67. appid:this.$global.wxParams.APPID,
  68. openid:this.$cache.get('userInfo').openId,
  69. payId:this.vuex_userId,
  70. price:this.detail.cost,
  71. channel: this.$global.paymentType.YEE_PAY,
  72. payway: this.$global.paymentScene.MINI_PROGRAM,
  73. cost:this.detail.cost,
  74. discount: 1.00,
  75. type:this.$global.orderType.AGENT_CHARGE,
  76. // payAmount:this.detail.cost,
  77. title:'渠道合伙人充值',
  78. exTime
  79. }
  80. let resp=await this.$api.billRecord.addAgentOrder(billRecord)
  81. if (!resp.success) {
  82. return
  83. }
  84. let params={
  85. orderType:this.$global.orderType.AGENT_CHARGE,
  86. orderId: resp.data.id,
  87. payStatus:this.$global.payStatus.IS_WAIT
  88. }
  89. let res=await this.$api.pay.payOrder(params)
  90. let prePayTn= JSON.parse(res.data.prePayTn)
  91. this.$mpi.requestPayment(prePayTn).then(()=>{
  92. this.successShow = true;
  93. })
  94. },
  95. confirm() {
  96. this.successShow = false
  97. this.$u.vuex('vuex_agenter_type',this.$global.userType.CHANNEL)
  98. uni.reLaunch({
  99. url:"../gain/gain?current=1",
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .container {
  107. background-color: #ffffff;
  108. margin: 30upx;
  109. border-radius: 20upx;
  110. }
  111. </style>