pay.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view>
  3. <view class="text-center" style="margin-top: 120upx;">
  4. <u-icon name="clock-fill" color="#FF9447" size="140"></u-icon>
  5. <view class="text-gray text-df padding-20">待支付</view>
  6. <view class="theme-color ">
  7. <text style="font-size: 60upx;" class="price">{{agent.league}}</text>
  8. </view>
  9. </view>
  10. <view class="container" style="padding: 20rpx 30rpx;">
  11. <u-form :label-style="{'fontWeight':800,'fontSize':'30rpx'}" :border-bottom="false" :model="form" ref="uForm" label-width="150">
  12. <u-form-item label="代理级别"><u-input v-model="agent.level" type="select" @click="levelsShow=true" :select-open="levelsShow"/></u-form-item>
  13. </u-form>
  14. </view>
  15. <view class="bottom-bar safe-area-inset-bottom " style="margin-top: 120rpx;">
  16. <view @click="pay" class="bg-gradual-base cu-btn round" style="width: 100%;padding: 46rpx;">
  17. 确认支付
  18. </view>
  19. </view>
  20. <u-popup v-model="successShow" mode="center" :mask-close-able="false" width="550" height="500"
  21. border-radius="30">
  22. <view class="text-center padding">
  23. <image src="/pagesB/static/pic_agent.png" style="width: 109upx;height: 122upx;"></image>
  24. <view style="font-size: 34upx;color: #FF9447;font-weight: bold;padding: 30upx 0 10upx 0;">恭喜您成为代理</view>
  25. <view style="font-size: 28upx;color: #999999;padding-bottom: 60upx;">专享代理专属权益</view>
  26. <view @click="confirm" class="cu-btn bg-gradual-base round" style="width: 90%;padding: 40rpx;">
  27. 确认
  28. </view>
  29. </view>
  30. </u-popup>
  31. <u-picker mode="selector" @confirm="levelConfirm" v-model="levelsShow" :range="levels" range-key="level" :default-selector="[0]"></u-picker>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. successShow: false,
  39. levelsShow:false,
  40. levels: [],
  41. agent:{},
  42. }
  43. },
  44. onLoad() {
  45. if (this.$isEmpty(this.vuex_userId)) {
  46. this.$dialog.showModal('系统错误', false).then(res => {
  47. uni.reLaunch({
  48. url: "/pages/gain/gain?current=1"
  49. })
  50. })
  51. return
  52. }
  53. this.fetchAgentLevelList()
  54. },
  55. methods: {
  56. levelConfirm(e){
  57. this.agent=this.levels[e[0]]
  58. },
  59. fetchAgentLevelList(){
  60. this.$api.agenter.agentLevelList().then(res=>{
  61. this.levels=res.data.records
  62. this.agent=this.levels[0]
  63. })
  64. },
  65. async pay() {
  66. let agentLeague={
  67. userId:this.vuex_userId,
  68. agentId:this.agent.id,
  69. league:this.agent.league,
  70. payStatus:'待付款',
  71. appid: this.$global.wxParams.APPID,
  72. openid: this.$cache.get('userInfo').openId,
  73. }
  74. let resp = await this.$api.agenter.addAgentOrder(agentLeague)
  75. if (!resp.success) {
  76. return
  77. }
  78. let params = {
  79. orderType: this.$global.orderType.AGENT_CHARGE,
  80. orderId: resp.data.tradeNo,
  81. payStatus: this.$global.payStatus.IS_WAIT
  82. }
  83. let res = await this.$api.pay.payOrder(params)
  84. let prePayTn = JSON.parse(res.data.prePayTn)
  85. this.$mpi.requestPayment(prePayTn).then(() => {
  86. this.successShow = true;
  87. })
  88. },
  89. confirm() {
  90. this.successShow = false
  91. this.$u.vuex('vuex_agenter_type', this.$global.userType.CHANNEL)
  92. uni.reLaunch({
  93. url: "../../../pages/gain/gain?current=1",
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .container {
  101. background-color: #ffffff;
  102. margin: 30upx;
  103. border-radius: 20upx;
  104. }
  105. </style>