my.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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" showArrow thumb="/static/my/fenzu.png" thumb-size="sm" />
  72. <uni-list-item v-if="userInfo.isExtensionWorker == 1" :clickable="true" title="推广码" showArrow thumb="/static/my/qr.png" thumb-size="sm" @click="openQrCord" />
  73. <uni-list-item v-if="userInfo.roleTag == 1" :clickable="true" title="购买优惠券" to="/pages/purchaseCoupon/purchaseCoupon" showArrow thumb="/static/my/coupon.png" thumb-size="sm" />
  74. <uni-list-item v-if="userInfo.isManager == 1" :clickable="true" title="拓客排行榜" to="/pages/spreadRankingList/spreadRankingList" showArrow thumb="/static/my/ranking.png" thumb-size="sm"/>
  75. </uni-list>
  76. </view>
  77. <!-- <button @click="anniu">按钮</button>-->
  78. <uni-popup ref="qrCodePopup" type="center" @change="qrCodePopupChange">
  79. <view class="flex-col qrCodePopupView">
  80. <view class="flex-row justify-center">
  81. <!-- 标题不要了-->
  82. <text class="popupTitle">&nbsp;</text>
  83. </view>
  84. <view class="xoIcon" @click="closePopup">
  85. <u-icon name="close-circle" color="#666" size="24"></u-icon>
  86. </view>
  87. <view class="flex-row justify-center">
  88. <uv-qrcode ref="qrcode" size="440rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  89. </view>
  90. <view class="flex-row justify-center qrCreateTime">
  91. <text>生成时间:{{qrCreateTime}}</text>
  92. </view>
  93. </view>
  94. </uni-popup>
  95. </view>
  96. </template>
  97. <script>
  98. import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
  99. import commonUtils from "../../common/js/utils/commonUtils";
  100. export default {
  101. components: {
  102. UniPopup
  103. },
  104. data() {
  105. return {
  106. qrcodeUrl: this.$xcxUrl + '?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}&type=',
  107. options: {
  108. // 指定二维码前景,一般可在中间放logo
  109. foregroundImagePadding: 2,
  110. foregroundImageBorderRadius: 5,
  111. foregroundImageSrc: '/static/logo.png'
  112. },
  113. qrCreateTime: '',
  114. isWxBrowser: false,
  115. isCanWithdraw: true,
  116. staticsData: {},
  117. userInfo: {},
  118. height: '',
  119. statistics: {},
  120. }
  121. },
  122. onLoad() {
  123. let sysInfo = uni.getSystemInfoSync()
  124. this.height = sysInfo.windowHeight + 'px'
  125. this.isWxBrowser = getApp().globalData.isWxBrowser
  126. },
  127. onShow() {
  128. this.userInfo = uni.getStorageSync('spreadUserInfo')
  129. this.getImgUrlByOssId(this.userInfo.img)
  130. this.exStatistics()
  131. // this.canWithdraw()
  132. },
  133. methods: {
  134. anniu() {
  135. uni.navigateTo({
  136. url: '/pages/register/register?roleId=1772472312711086081&parentId=1772471873559068674&timestamp=2032242661103'
  137. })
  138. },
  139. closePopup() {
  140. this.$refs.qrCodePopup.close()
  141. },
  142. formatDate() {
  143. this.qrCreateTime = commonUtils.formatDate(new Date())
  144. },
  145. openQrCord() {
  146. console.log(11111111111111111)
  147. this.$api.service.getExtensionId().then(res => {
  148. let data = {
  149. ruleId: res.data.data,
  150. expandUserId: this.userInfo.id,
  151. timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
  152. };
  153. for (let key in data) {
  154. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  155. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  156. }
  157. if (this.userInfo.isManager == '1') {
  158. this.qrcodeUrl = this.qrcodeUrl + '4' + '&expand1=4'
  159. } else {
  160. this.qrcodeUrl = this.qrcodeUrl + '3' + '&expand1=3'
  161. }
  162. this.formatDate()
  163. console.log('生成的链接', this.qrcodeUrl)
  164. this.$refs.qrCodePopup.open()
  165. })
  166. },
  167. qrCodePopupChange(e) {
  168. console.log(e)
  169. if (!e.show) {
  170. this.qrcodeUrl = this.$xcxUrl +
  171. '?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}&type='
  172. }
  173. },
  174. canWithdraw() {
  175. this.$api.service.canWithdraw().then(res => {
  176. console.log(res)
  177. this.isCanWithdraw = res.data.data
  178. })
  179. },
  180. exStatistics() {
  181. this.$api.service.exStatistics().then(res => {
  182. this.statistics = res.data.data
  183. })
  184. },
  185. navigateTo(url) {
  186. uni.navigateTo({
  187. url: url
  188. })
  189. },
  190. getImgUrlByOssId(Id) {
  191. if (Id) {
  192. this.$api.service.getImage(Id).then(res => {
  193. this.userInfo.imgUrl = res.data.data[0].url.replace(/^http:/, "https:")
  194. uni.setStorageSync('spreadUserInfo', this.userInfo)
  195. this.$set(this.userInfo)
  196. });
  197. }
  198. },
  199. navigateTo(url) {
  200. uni.navigateTo({
  201. url: url
  202. })
  203. },
  204. goUserInfo() {
  205. uni.navigateTo({
  206. url: '/pages/userInfo/userInfo'
  207. })
  208. },
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. @import './index.rpx.css';
  214. </style>