时空网前端
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.

175 lines
5.1 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">{{prcie}}</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">购买并支付¥{{prcie}}</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. prcie: ''
  73. }
  74. },
  75. methods: {
  76. getPrice(){
  77. this.$http(this.API.API_MEMBERPRICE).then(res => {
  78. this.prcie = res.data.price || 0
  79. })
  80. },
  81. // 勾选协议发生变化
  82. checkboxChange(event){
  83. this.checked = event.detail.value.length > 0;
  84. },
  85. //勾选支付方式
  86. checkboxChangepay(event){
  87. this.checkedpay = event.detail.value.length > 0;
  88. },
  89. getAgree(){
  90. this.$http(this.API.API_WXLOGIN_VIEW,{type: 'vip'}).then(res => {
  91. this.agreement = res.data.agreement;
  92. })
  93. },
  94. // 进入查看协议
  95. enterAgree(){
  96. this.$url('/pages/agreement/agreement?id='+ this.agreement.article_id);
  97. },
  98. getData(){
  99. this.$http(this.API.API_USER_CENTER).then(res => {
  100. this.info = res.data;
  101. })
  102. },
  103. subimitApply() {
  104. if(!this.checkedpay) {
  105. this.$msg('请选择付款方式!')
  106. return
  107. }
  108. if(!this.checked) {
  109. this.$msg('请认真阅读并同意协议!')
  110. return
  111. }
  112. if(!this.ifPay) return;
  113. this.ifPay = false;
  114. this.$http(this.API.API_PRPAID, {
  115. goods_id: 0,
  116. goods_specs_id: 0,
  117. number: 1,
  118. payment_desc: 3,
  119. share_one: this.info.id
  120. }).then(res => {
  121. this.order_id = res.data.order_id
  122. uni.requestPayment({
  123. orderInfo: res.data.order_num,
  124. timeStamp: res.data.timeStamp,
  125. nonceStr: res.data.nonceStr,
  126. package: res.data.package,
  127. signType: res.data.signType,
  128. paySign: res.data.paySign,
  129. success: (res) => {
  130. this.ifPay = true
  131. this.$url('/pages/order/pay-success?ifSuccess=1&type=3&order_id='+this.order_id,{type: 'redirect'})
  132. },
  133. fail: (err) => {
  134. this.ifPay = true
  135. this.$url('/pages/order/pay-success?ifSuccess=2&type=3&order_id='+this.order_id,{type: 'redirect'})
  136. },
  137. })
  138. }).catch(err => {
  139. this.ifPay = true
  140. if(err.code == 9997) {
  141. uni.showModal({
  142. title: '提示',
  143. content: '是否同意前往手机授权?',
  144. success: e => {
  145. if (!e.confirm) return;
  146. this.$routerGo('/pages/login/index?type=phone')
  147. }
  148. });
  149. }
  150. });
  151. }
  152. },
  153. onLoad() {
  154. this.getData()
  155. this.getAgree()
  156. this.getPrice()
  157. }
  158. }
  159. </script>
  160. <style>
  161. .paynum {
  162. width: 280rpx;
  163. height: 280rpx;
  164. border: 1px solid #FE9903;
  165. background-color: #FFF4E4;
  166. border-radius: 10rpx;
  167. }
  168. </style>