my.vue 7.0 KB

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