my.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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>
  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. console.log(11111111111111111)
  149. this.$api.service.getExtensionId().then(res => {
  150. let data = {
  151. ruleId: res.data.data,
  152. expandUserId: this.userInfo.id,
  153. timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
  154. };
  155. for (let key in data) {
  156. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  157. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  158. }
  159. if (this.userInfo.isManager == '1') {
  160. this.qrcodeUrl = this.qrcodeUrl + '4' + '&expand1=4'
  161. } else {
  162. this.qrcodeUrl = this.qrcodeUrl + '3' + '&expand1=3'
  163. }
  164. this.formatDate()
  165. console.log('生成的链接', this.qrcodeUrl)
  166. this.$refs.qrCodePopup.open()
  167. })
  168. },
  169. qrCodePopupChange(e) {
  170. console.log(e)
  171. if (!e.show) {
  172. this.qrcodeUrl = this.$xcxUrl +
  173. '?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}&type='
  174. }
  175. },
  176. canWithdraw() {
  177. this.$api.service.canWithdraw().then(res => {
  178. console.log(res)
  179. this.isCanWithdraw = res.data.data
  180. })
  181. },
  182. exStatistics() {
  183. this.$api.service.exStatistics().then(res => {
  184. this.statistics = res.data.data
  185. })
  186. },
  187. navigateTo(url) {
  188. uni.navigateTo({
  189. url: url
  190. })
  191. },
  192. getImgUrlByOssId(Id) {
  193. if (Id) {
  194. this.$api.service.getImage(Id).then(res => {
  195. this.userInfo.imgUrl = res.data.data[0].url.replace(/^http:/, "https:")
  196. uni.setStorageSync('spreadUserInfo', this.userInfo)
  197. this.$set(this.userInfo)
  198. });
  199. }
  200. },
  201. navigateTo(url) {
  202. uni.navigateTo({
  203. url: url
  204. })
  205. },
  206. goUserInfo() {
  207. uni.navigateTo({
  208. url: '/pages/userInfo/userInfo'
  209. })
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. @import './index.rpx.css';
  216. </style>