index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="share-index">
  3. <view class="head-box">
  4. <view class="user-info dir-left-nowrap">
  5. <view class="head-img">
  6. <image :src="userInfo.avatar" alt="" />
  7. </view>
  8. <view class="base-info dir-top-wrap main-center">
  9. <view class="nickname">{{ userInfo.nickname }}</view>
  10. <view class="parent">推荐人: {{ userInfo.parent ? userInfo.parent.nickname : '' }}</view>
  11. </view>
  12. </view>
  13. <view class="withdraw-box main-between cross-center">
  14. <view class="withdraw-item dir-top-wrap main-center" @click="$u.route('/pages/share/withdraw')">
  15. <view class="static-txt main-left cross-center">
  16. 可提现佣金
  17. <view class="badge">提现</view>
  18. </view>
  19. <view class="price main-left cross-center">
  20. {{ userInfo.income }}
  21. <view class="unit">元</view>
  22. </view>
  23. </view>
  24. <view class="withdraw-item dir-top-wrap main-center">
  25. <view class="static-txt">
  26. 已提现佣金
  27. </view>
  28. <view class="price main-left cross-center">
  29. {{ parseFloat(userInfo.total_income - userInfo.income).toFixed(2) }}
  30. <view class="unit">元</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <!--菜单-->
  36. <view class="menu-group">
  37. <button
  38. v-for="(menu,index) in menus"
  39. :key="index"
  40. class="menu-item main-between cross-center"
  41. :open-type="menu.type ? menu.type : ''"
  42. @bindcontact="handleMenu"
  43. @click="handleMenu(menu)"
  44. >
  45. <view class="left-box dir-left-nowrap cross-center">
  46. <view class="icon">
  47. <image :src="menu.icon" />
  48. </view>
  49. <text>{{ menu.name }}</text>
  50. </view>
  51. <u-icon name="arrow-right" :color="$colors.infoColor" bold />
  52. </button>
  53. </view>
  54. <!-- QRCODE 弹窗 -->
  55. <qrcode :show.sync="qrcodeModal.show" />
  56. </view>
  57. </template>
  58. <script>
  59. import { mapState } from 'vuex'
  60. import Qrcode from './components/Qrcode'
  61. export default {
  62. components: { Qrcode },
  63. data() {
  64. return {
  65. menus: [
  66. { icon: '/static/image/my-page/share.png', name: '分享好友', type: 'share' },
  67. { icon: '/static/image/share/income.png', name: '分享佣金', href: '/pages/share/income' },
  68. { icon: '/static/image/share/order.png', name: '分享订单', href: '/pages/share/order' },
  69. { icon: '/static/image/share/detail.png', name: '提现明细', href: '/pages/share/withdrawDetail' },
  70. { icon: '/static/image/share/team.png', name: '我的团队', href: '/pages/share/team' },
  71. // #ifdef MP-TOUTIAO | MP-WEIXIN
  72. { icon: '/static/image/share/qrcode.png', name: '分享二维码', type: 'share_qrcode' }
  73. // #endif
  74. ],
  75. qrcodeModal: {
  76. show: false
  77. }
  78. }
  79. },
  80. computed: {
  81. ...mapState({
  82. userInfo: seate => seate.user.info
  83. })
  84. },
  85. methods: {
  86. handleMenu(menu) {
  87. // #ifdef MP-KUAISHOU
  88. if (menu.type === 'contact') {
  89. ks.makePhoneCall({
  90. phoneNumber: this.config.contact,
  91. success(res) {
  92. console.log('-->success', res)
  93. },
  94. fail(err) {
  95. console.log('-->error', err)
  96. }
  97. })
  98. }
  99. // #endif
  100. if (menu.type === 'share_qrcode') {
  101. this.handleGenerateQrcode()
  102. }
  103. if (menu.href) {
  104. this.$u.route(menu.href)
  105. }
  106. },
  107. handleGenerateQrcode() {
  108. if (this.userInfo.share_qrcode) {
  109. this.qrcodeModal.show = true
  110. return
  111. }
  112. this.$loading()
  113. this.$api.share.generateQrcode().then(res => {
  114. this.$hideLoading()
  115. // 获取用户信息
  116. this.$api.user.info().then(res => {
  117. this.$store.dispatch('user/info', res.data)
  118. this.qrcodeModal.show = true
  119. })
  120. }).catch(() => {
  121. this.$hideLoading()
  122. })
  123. }
  124. },
  125. onShareAppMessage() {
  126. return this.$util.shareMessage(this.userInfo)
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .share-index {
  132. color: #6eebe8;
  133. font-size: 32rpx;
  134. padding: 40rpx 30rpx 80rpx;
  135. .head-box{
  136. background: $bg-op-color;
  137. border-radius: 20rpx;
  138. padding: 40rpx 0;
  139. margin-bottom: 50rpx;
  140. .user-info{
  141. padding: 0 30rpx 40rpx;
  142. border-bottom: 1rpx $border-op-color solid;
  143. .head-img{
  144. width: 120rpx;
  145. height: 120rpx;
  146. border-radius: 50%;
  147. overflow: hidden;
  148. image{
  149. width: 100%;
  150. height: 100%;
  151. }
  152. }
  153. .base-info{
  154. margin-left: 30rpx;
  155. .parent{
  156. font-size: 26rpx;
  157. }
  158. }
  159. }
  160. .withdraw-box{
  161. padding: 40rpx 0 0;
  162. .withdraw-item{
  163. flex: 1;
  164. position: relative;
  165. padding: 0 40rpx;
  166. &:first-child{
  167. &:after{
  168. content: "";
  169. position: absolute;
  170. background: $border-op-color;
  171. right: 0;
  172. top: 50%;
  173. height: 60%;
  174. width: 1rpx;
  175. transform: translateY(-50%);
  176. }
  177. }
  178. .static-txt{
  179. font-size: 26rpx;
  180. .badge{
  181. font-size: 18rpx;
  182. border: 1rpx solid #6eebe8;
  183. border-radius: 30rpx;
  184. padding: 2rpx 20rpx;
  185. margin-left: 30rpx;
  186. }
  187. }
  188. .price{
  189. margin-top: 10rpx;
  190. font-size: 48rpx;
  191. .unit{
  192. font-size: 34rpx;
  193. margin-left: 4rpx;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. .menu-group{
  200. .menu-item{
  201. padding: 20rpx 0;
  202. background: transparent;
  203. border: none;
  204. text-align: unset;
  205. width: 100%;
  206. line-height: initial;
  207. font-size: initial;
  208. justify-content: space-between;
  209. border-bottom: 1rpx solid $border-op-color;
  210. border-radius: 0;
  211. &:after{
  212. content: unset;
  213. }
  214. .left-box{
  215. flex: 1;
  216. .icon{
  217. transform: translateY(4rpx);
  218. image{
  219. width: 55rpx;
  220. height: 55rpx;
  221. }
  222. }
  223. text{
  224. color: #fff;
  225. margin-left: 10rpx;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>