my.vue 7.2 KB

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