my.vue 7.8 KB

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