my.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="page" :style="{height:height}">
  3. <!-- #ifdef H5-->
  4. <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
  5. title="个人中心" />
  6. <!-- #endif -->
  7. <view class="flex-row use">
  8. <view class="avatar" @click="goUserInfo">
  9. <image :src="userInfo.imgUrl || '/static/ud4.png'"></image>
  10. </view>
  11. <view class="flex-col justify-evenly useMsg">
  12. <view class="flex-row">
  13. <text class="name">{{userInfo.name}}</text>
  14. <!-- <view class="tag">{{userInfo.isManager === 1? '拓客经理': userInfo.roleTag == '0' ? '拓客专员': userInfo.roleTag == '1' ? '合作伙伴':'推广人员'}}-->
  15. <!-- </view>-->
  16. </view>
  17. <view>
  18. <text class="phone">电话:{{userInfo.phone}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="statistics flex-col">
  23. <view class="flex-row justify-around" v-if="userInfo.isManager == '1'">
  24. <view class="flex-row justify-center out ">
  25. <view class="flex-col statisticsItem "
  26. @click="navigateTo('/pages/specialistsList/specialistsList')">
  27. <view>
  28. <image src="/static/my/fuwuNmber.png" class="statisticsImg"></image>
  29. </view>
  30. <text class="statisticsKey">我的专员(人)</text>
  31. <text class="statisticsValue">{{statistics.myAttache}}</text>
  32. </view>
  33. </view>
  34. <view class="flex-row justify-center out leftBorder">
  35. <view class="flex-col statisticsItem " @click="navigateTo('/pages/cooperation/cooperation')">
  36. <view>
  37. <image src="/static/my/hezuohuoban.png" class="statisticsImg"></image>
  38. </view>
  39. <text class="statisticsKey">合作伙伴(人)</text>
  40. <text class="statisticsValue">{{statistics.myPartner}}</text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="flex-row justify-around " v-else>
  45. <view class="flex-row justify-center out ">
  46. <view class="flex-col statisticsItem "
  47. @click="navigateTo('/pages/directPromotionList/directPromotionList')">
  48. <!-- <view>-->
  49. <!-- <image src="/static/my/fuwuTimeLong.png" class="statisticsImg"></image>-->
  50. <!-- </view>-->
  51. <text class="statisticsKey">我的直推(人)</text>
  52. <text class="statisticsValue">{{statistics.myMember}}</text>
  53. </view>
  54. </view>
  55. <view class="flex-row justify-center out leftBorder" v-if="userInfo.roleTag == '0'">
  56. <view class="flex-col statisticsItem " @click="navigateTo('/pages/earningsList/earningsList')">
  57. <!-- <view>-->
  58. <!-- <image src="/static/my/benyuerenwu.png" class="statisticsImg"></image>-->
  59. <!-- </view>-->
  60. <text class="statisticsKey">推广收益(人)</text>
  61. <text class="statisticsValue">{{statistics.myEarning}}</text>
  62. <view v-if="isCanWithdraw" @click.stop="navigateTo('/pages/withdraw/withdraw')">
  63. <text class="txbtn">去提现></text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="flex-col justify-start list">
  70. <uni-list :border="false">
  71. <uni-list-item v-if="userInfo.isManager == 1" :clickable="true" title="我的分组" to="/pages/myGroup/myGroup"
  72. showArrow thumb="/static/my/fenzu.png" thumb-size="sm" />
  73. <uni-list-item v-if="userInfo.isExtensionWorker == 1" :clickable="true" title="推广码" showArrow
  74. thumb="/static/my/qr.png" thumb-size="sm" @click="openQrCord" />
  75. <uni-list-item v-if="userInfo.roleTag == 1" :clickable="true" title="购买优惠券"
  76. to="/pages/purchaseCoupon/purchaseCoupon" showArrow thumb="/static/my/coupon.png" thumb-size="sm" />
  77. <uni-list-item v-if="userInfo.isManager == 1" :clickable="true" title="拓客排行榜" to="/pages/spreadRankingList/spreadRankingList"
  78. showArrow thumb="/static/my/ranking.png" thumb-size="sm"/>
  79. </uni-list>
  80. </view>
  81. <!-- <button @click="anniu">按钮</button>-->
  82. <uni-popup ref="qrCodePopup" type="center" @change="qrCodePopupChange">
  83. <view class="flex-col qrCodePopupView">
  84. <view class="flex-row justify-center">
  85. <!-- 标题不要了-->
  86. <text class="popupTitle">&nbsp;</text>
  87. </view>
  88. <view class="xoIcon" @click="closePopup">
  89. <u-icon name="close-circle" color="#666" size="24"></u-icon>
  90. </view>
  91. <view class="flex-row justify-center">
  92. <uv-qrcode ref="qrcode" size="440rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  93. </view>
  94. <view class="flex-row justify-center qrCreateTime">
  95. <text>生成时间:{{qrCreateTime}}</text>
  96. </view>
  97. </view>
  98. </uni-popup>
  99. </view>
  100. </template>
  101. <script>
  102. import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
  103. import commonUtils from "../../common/js/utils/commonUtils";
  104. export default {
  105. components: {
  106. UniPopup
  107. },
  108. data() {
  109. return {
  110. qrcodeUrl: this.$xcxUrl + '?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}&type=',
  111. options: {
  112. // 指定二维码前景,一般可在中间放logo
  113. foregroundImagePadding: 2,
  114. foregroundImageBorderRadius: 5,
  115. foregroundImageSrc: '/static/logo.png'
  116. },
  117. qrCreateTime: '',
  118. isWxBrowser: false,
  119. isCanWithdraw: true,
  120. staticsData: {},
  121. userInfo: {},
  122. height: '',
  123. statistics: {},
  124. }
  125. },
  126. onLoad() {
  127. let sysInfo = uni.getSystemInfoSync()
  128. this.height = sysInfo.windowHeight + 'px'
  129. this.isWxBrowser = getApp().globalData.isWxBrowser
  130. },
  131. onShow() {
  132. this.userInfo = uni.getStorageSync('spreadUserInfo')
  133. this.getImgUrlByOssId(this.userInfo.img)
  134. this.exStatistics()
  135. // this.canWithdraw()
  136. },
  137. methods: {
  138. anniu() {
  139. uni.navigateTo({
  140. url: '/pages/register/register?roleId=1772472312711086081&parentId=1772471873559068674&timestamp=2032242661103'
  141. })
  142. },
  143. closePopup() {
  144. this.$refs.qrCodePopup.close()
  145. },
  146. formatDate() {
  147. this.qrCreateTime = commonUtils.formatDate(new Date())
  148. },
  149. openQrCord() {
  150. console.log(11111111111111111)
  151. this.$api.service.getExtensionId().then(res => {
  152. let data = {
  153. ruleId: res.data.data,
  154. expandUserId: this.userInfo.id,
  155. timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
  156. };
  157. for (let key in data) {
  158. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  159. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  160. }
  161. if (this.userInfo.isManager == '1') {
  162. this.qrcodeUrl = this.qrcodeUrl + '4' + '&expand1=4'
  163. } else {
  164. this.qrcodeUrl = this.qrcodeUrl + '3' + '&expand1=3'
  165. }
  166. this.formatDate()
  167. console.log('生成的链接', this.qrcodeUrl)
  168. this.$refs.qrCodePopup.open()
  169. })
  170. },
  171. qrCodePopupChange(e) {
  172. console.log(e)
  173. if (!e.show) {
  174. this.qrcodeUrl = this.$xcxUrl +
  175. '?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}&type='
  176. }
  177. },
  178. canWithdraw() {
  179. this.$api.service.canWithdraw().then(res => {
  180. console.log(res)
  181. this.isCanWithdraw = res.data.data
  182. })
  183. },
  184. exStatistics() {
  185. this.$api.service.exStatistics().then(res => {
  186. this.statistics = res.data.data
  187. })
  188. },
  189. navigateTo(url) {
  190. uni.navigateTo({
  191. url: url
  192. })
  193. },
  194. getImgUrlByOssId(Id) {
  195. if (Id) {
  196. this.$api.service.getImage(Id).then(res => {
  197. this.userInfo.imgUrl = res.data.data[0].url.replace(/^http:/, "https:")
  198. uni.setStorageSync('spreadUserInfo', this.userInfo)
  199. this.$set(this.userInfo)
  200. });
  201. }
  202. },
  203. navigateTo(url) {
  204. uni.navigateTo({
  205. url: url
  206. })
  207. },
  208. goUserInfo() {
  209. uni.navigateTo({
  210. url: '/pages/userInfo/userInfo'
  211. })
  212. },
  213. }
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. @import './index.rpx.css';
  218. </style>