时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
4.9 KiB

  1. <template>
  2. <view>
  3. <view class="flex lf-p-30">
  4. <view>
  5. <image :src="info.avatar" style="height: 120rpx;width: 120rpx;border-radius: 50%;" mode="aspectFill"></image>
  6. </view>
  7. <view class="flex flex-direction lf-p-l-20 justify-center">
  8. <view class="lf-font-32 lf-m-b-10 text-black1 lf-line-2">{{info.nickname}}</view>
  9. <view class="lf-font-28 lf-color-gray" v-if="!info.isTalnet">会员未开通</view>
  10. <view class="lf-font-28 lf-color-gray" v-else>会员已开通</view>
  11. </view>
  12. </view>
  13. <self-line/>
  14. <view>
  15. <view class="lf-p-t-30 lf-p-l-32 lf-flex-wrap">
  16. <view class="paynum" style="overflow: hidden;">
  17. <view class="lf-color-white flex justify-center" style="background-color: #F93A3A;border-radius: 0 0 10rpx 0;width: 168rpx;height: 46rpx;">
  18. <text class="lf-font-24" style="padding: 6rpx 12rpx;">成为分销达人</text>
  19. </view>
  20. <view class="lf-m-t-28 text-black lf-font-24 lf-m-l-20">
  21. 需要支付
  22. </view>
  23. <view class="lf-m-l-20 lf-m-t-16"><text class="lf-font-60 lf-font-bold">9.9</text></view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="lf-p-l-32 lf-m-t-40 lf-font-32 text-black1 solid-bottom lf-p-b-20">
  28. 支付方式
  29. </view>
  30. <view class="flex justify-between align-center text-center lf-p-l-32 lf-p-r-32 lf-p-t-30 lf-p-b-30 solid-bottom">
  31. <view class="flex justify-around align-center text-center">
  32. <view class="lf-row-center">
  33. <text class="lf-iconfont lf-icon-weixinzhifu lf-font-48" style="color: #09BB07;"></text>
  34. </view>
  35. <view class="lf-font-36 lf-m-l-20 lf-w-100 text-black1">微信支付</view>
  36. </view>
  37. <view>
  38. <view>
  39. <checkbox-group @change="checkboxChangepay" style="display: inline-block;">
  40. <checkbox class="lf-text-vertical" style="" :checked="checkedpay"></checkbox>
  41. </checkbox-group>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="btn-bottom" style="bottom: 60rpx;">
  46. <view class="padding-lr-lg lf-m-b-18">
  47. <checkbox-group @change="checkboxChange" style="display: inline-block;">
  48. <checkbox class="lf-text-vertical" style="" :checked="checked"></checkbox>
  49. </checkbox-group>
  50. <view class="lf-m-l-10 lf-font-24 lf-color-gray" style="display: inline-block;">
  51. <text>已阅读并同意</text>
  52. <text @click="enterAgree" class="text-orange">{{agreement.title}}</text>
  53. </view>
  54. </view>
  55. <view class="padding-lr-lg">
  56. <button class="cu-btn block bg-orange lg" style="border-radius: 42rpx;" @tap="subimitApply()">
  57. <text class="lf-font-32 text-white">购买并支付¥9.9</text>
  58. </button>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. checked: false, // 是否勾选协议
  68. info: {},
  69. ifPay: true,
  70. checkedpay: true,
  71. agreement: ''
  72. }
  73. },
  74. methods: {
  75. // 勾选协议发生变化
  76. checkboxChange(event){
  77. this.checked = event.detail.value.length > 0;
  78. },
  79. //勾选支付方式
  80. checkboxChangepay(event){
  81. this.checkedpay = event.detail.value.length > 0;
  82. },
  83. getAgree(){
  84. this.$http(this.API.API_WXLOGIN_VIEW,{type: 'vip'}).then(res => {
  85. this.agreement = res.data.agreement;
  86. })
  87. },
  88. // 进入查看协议
  89. enterAgree(){
  90. this.$url('/pages/agreement/agreement?id='+ this.agreement.article_id);
  91. },
  92. getData(){
  93. this.$http(this.API.API_USER_CENTER).then(res => {
  94. this.info = res.data;
  95. })
  96. },
  97. subimitApply() {
  98. if(!this.checkedpay) {
  99. this.$msg('请选择付款方式!')
  100. return
  101. }
  102. if(!this.checked) {
  103. this.$msg('请认真阅读并同意协议!')
  104. return
  105. }
  106. if(!this.ifPay) return;
  107. this.ifPay = false;
  108. this.$http(this.API.API_PRPAID, {
  109. goods_id: 0,
  110. goods_specs_id: 0,
  111. number: 1,
  112. payment_desc: 3,
  113. share_one: this.info.id
  114. }).then(res => {
  115. this.order_id = res.data.order_id
  116. uni.requestPayment({
  117. orderInfo: res.data.order_num,
  118. timeStamp: res.data.timeStamp,
  119. nonceStr: res.data.nonceStr,
  120. package: res.data.package,
  121. signType: res.data.signType,
  122. paySign: res.data.paySign,
  123. success: (res) => {
  124. this.ifPay = true
  125. this.$url('/pages/order/pay-success?ifSuccess=1&type=3&order_id='+this.order_id,{type: 'redirect'})
  126. },
  127. fail: (err) => {
  128. this.ifPay = true
  129. this.$url('/pages/order/pay-success?ifSuccess=2&type=3&order_id='+this.order_id,{type: 'redirect'})
  130. },
  131. })
  132. }).catch(err => {
  133. this.ifPay = true
  134. if(err.code == 9997) {
  135. uni.showModal({
  136. title: '提示',
  137. content: '是否同意前往手机授权?',
  138. success: e => {
  139. if (!e.confirm) return;
  140. this.$routerGo('/pages/login/index?type=phone')
  141. }
  142. });
  143. }
  144. });
  145. }
  146. },
  147. onLoad() {
  148. this.getData()
  149. this.getAgree()
  150. }
  151. }
  152. </script>
  153. <style>
  154. .paynum {
  155. width: 280rpx;
  156. height: 280rpx;
  157. border: 1px solid #FE9903;
  158. background-color: #FFF4E4;
  159. border-radius: 10rpx;
  160. }
  161. </style>