index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <view class="content">
  3. <view class="selfInfo-box">
  4. <view>
  5. <button type="primary" @click.stop="goAuth" v-if="!isAuth" class="authUser">点击授权</button>
  6. </view>
  7. <view class="self-auth" v-if='isAuth'>
  8. <image :src="userHead" mode=""></image>
  9. <view style="margin-left: 3%;">
  10. <text>{{userName}}</text>
  11. <text style="font-size: 28rpx;" v-if="isAuthPhone">{{userPhone}} </text>
  12. <button type="primary" class="authPhone" open-type="getPhoneNumber" style="font-size: 12px;"
  13. @getphonenumber="getPhoneNumber" v-else>手机号码授权</button>
  14. </view>
  15. </view>
  16. <view class="self-content">
  17. <view>
  18. <text>{{userInfoObj.scorenumber || '0'}}</text>
  19. <text style="font-size: 28rpx;">我的积分</text>
  20. </view>
  21. <view>
  22. <text>{{userInfoObj.num || '0'}}元</text>
  23. <text style="font-size: 28rpx;">已提现</text>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="function-box">
  28. <view class="function-content" @click="goRecommend">
  29. <image src="../../static/commend.png" mode=""></image>
  30. <text>推荐分销品</text>
  31. </view>
  32. <view class="function-content" style="background: #33b5fc;" @click="goAward">
  33. <image src="../../static/award.svg" mode=""></image>
  34. <text>奖励记录</text>
  35. </view>
  36. <view class="function-content" style="background:#fcca2f;" @click="goCashOut">
  37. <image src="../../static/cashout.svg" mode=""></image>
  38. <text>提现记录</text>
  39. </view>
  40. </view>
  41. <view class="list-box">
  42. <view class="list-content" @click="applyPower">
  43. <text class="margin-left5">分销资格</text>
  44. <view class="apply-box">
  45. <text style="color: #999;" :style="{'margin-right':userStatus==='点击申请'? '0':'2px'}" decode="true">{{userStatus}}</text>
  46. <image src="../../static/arrow-right2.png" mode=""></image>
  47. </view>
  48. </view>
  49. <view class="list-content" @click="goTeamDetail">
  50. <text class="margin-left5">分销团队</text>
  51. <view class="apply-box">
  52. <text style="color: #999;visibility: hidden;">点击申请</text>
  53. <image src="../../static/arrow-right2.png" mode=""></image>
  54. </view>
  55. </view>
  56. <view class="list-content" style="border-bottom: none;" @click="goHelpPage">
  57. <text class="margin-left5">帮助中心</text>
  58. <view class="apply-box">
  59. <text style="color: #999;visibility: hidden;">点击申请</text>
  60. <image src="../../static/arrow-right2.png" mode=""></image>
  61. </view>
  62. </view>
  63. </view>
  64. <uni-popup ref="showtip" type="center" :mask-click="false" @change="change">
  65. <view class="uni-tip">
  66. <!-- <text class="uni-tip-title">警告</text> -->
  67. <text class="uni-tip-content">您的申请需要后台审核,确定后请耐心等待结果。</text>
  68. <view class="uni-tip-group-button">
  69. <text class="uni-tip-button" @click="cancel()">取消</text>
  70. <text class="uni-tip-button" @click="cancel()">确定</text>
  71. </view>
  72. </view>
  73. </uni-popup>
  74. </view>
  75. </template>
  76. <script>
  77. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  78. var md5 = require('../../common/md5.js')
  79. export default {
  80. components: {
  81. uniPopup,
  82. },
  83. data() {
  84. return {
  85. title: 'selfCenter',
  86. userName:getApp().globalData.user_name,
  87. userHead:getApp().globalData.user_headUrl || '/static/logo.png',
  88. userPhone:getApp().globalData.user_phone || '156****3232',
  89. isAuth:getApp().globalData.isAuth,
  90. isAuthPhone:getApp().globalData.user_phone,
  91. userInfoObj:{},
  92. userStatus:'点击申请',
  93. }
  94. },
  95. onLoad() {
  96. },
  97. onShow() {
  98. this.switchUserStatus(getApp().globalData.user_status)
  99. this.getUserInfo();
  100. },
  101. methods: {
  102. switchUserStatus(status){
  103. console.log(status)
  104. let that = this;
  105. switch (status){
  106. case '1':
  107. that.userStatus = '审核中'+'&nbsp;&nbsp;&nbsp;'
  108. break;
  109. case '2':
  110. that.userStatus = '已认证'+'&nbsp;&nbsp;&nbsp;'
  111. break;
  112. case '3':
  113. that.userStatus = '已禁用'+'&nbsp;&nbsp;&nbsp;'
  114. break;
  115. case '4':
  116. that.userStatus = '点击申请'
  117. break;
  118. default:
  119. that.userStatus = '点击申请'
  120. break;
  121. }
  122. },
  123. getUserInfo(){
  124. let that = this;
  125. uni.request({
  126. url: getApp().globalData.shareUrl, //需要设置为全局
  127. method: 'POST',
  128. header: {
  129. 'content-type': 'application/x-www-form-urlencoded'
  130. },
  131. data: {
  132. method: 'getUserInfo',
  133. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  134. uid:getApp().globalData.user_id,
  135. sign: md5('getUserInfo' + getApp().globalData.globalTimestamp)
  136. },
  137. success: res => {
  138. if (res.data.code === 200) {
  139. console.log(res.data.msg)
  140. that.userInfoObj = res.data.msg;
  141. that.isAuth = res.data.msg.auth_status === '1';
  142. that.isAuthPhone = res.data.msg.phone;
  143. if(that.isAuth){
  144. that.userName = getApp().globalData.user_name;
  145. that.userHead = getApp().globalData.user_headUrl;
  146. }
  147. if(that.isAuthPhone){
  148. that.userPhone = res.data.msg.phone;
  149. }
  150. //that.cashOutList = res.data.msg
  151. }
  152. }
  153. });
  154. },
  155. goTeamDetail(){
  156. if(getApp().globalData.isAuth){
  157. uni.navigateTo({
  158. url: '/pages/selfCenter/recommendTeam/index',
  159. success: res => {},
  160. fail: () => {},
  161. complete: () => {}
  162. });
  163. }else {
  164. this.goAuth()
  165. }
  166. },
  167. goRecommend(){
  168. uni.switchTab({
  169. url:'/pages/index/index'
  170. })
  171. },
  172. goAward(){
  173. if(getApp().globalData.isAuth){
  174. uni.navigateTo({
  175. url: '/pages/selfCenter/awardPage/index',
  176. success: res => {},
  177. fail: () => {},
  178. complete: () => {}
  179. });
  180. }else {
  181. this.goAuth()
  182. }
  183. },
  184. goCashOut(){
  185. if(getApp().globalData.isAuth){
  186. uni.navigateTo({
  187. url: '/pages/selfCenter/cashoutPage/index',
  188. success: res => {},
  189. fail: () => {},
  190. complete: () => {}
  191. });
  192. }else {
  193. this.goAuth()
  194. }
  195. },
  196. goHelpPage(){
  197. uni.navigateTo({
  198. url: '/pages/selfCenter/helpPage/index',
  199. success: res => {},
  200. fail: () => {},
  201. complete: () => {}
  202. });
  203. },
  204. applyPower(){
  205. let that = this;
  206. if(that.userStatus === '点击申请'){
  207. uni.request({
  208. url: getApp().globalData.shareUrl, //需要设置为全局
  209. method: 'POST',
  210. header: {
  211. 'content-type': 'application/x-www-form-urlencoded'
  212. },
  213. data: {
  214. method: 'zigeapply',
  215. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  216. uid:getApp().globalData.user_id,
  217. sign: md5('zigeapply' + getApp().globalData.globalTimestamp)
  218. },
  219. success: res => {
  220. if (res.data.code === 200) {
  221. console.log(res.data.msg)
  222. this.$refs.showtip.open()
  223. //that.cashOutList = res.data.msg
  224. }
  225. }
  226. });
  227. }else{
  228. return false
  229. }
  230. },
  231. cancel(type) {
  232. this.userStatus = '审核中'+'&nbsp;&nbsp;&nbsp;'
  233. this.$refs.showtip.close()
  234. },
  235. change(e) {
  236. console.log('是否打开:' + e.show)
  237. },
  238. goAuth(){
  239. uni.navigateTo({
  240. url: '/pages/auth/index',
  241. success: res => {},
  242. fail: () => {},
  243. complete: () => {}
  244. });
  245. },
  246. getPhoneNumber(e){
  247. let that = this;
  248. console.log(e)
  249. if (e.detail.errMsg == 'getPhoneNumber:ok') { //允许授权执行跳转
  250. console.log(e.detail.iv)
  251. that.phoneRequest(e.detail.iv, e.detail.encryptedData, getApp().globalData.session_key)
  252. }
  253. else {
  254. that.isNeedPhone = false;
  255. }
  256. },
  257. phoneRequest(myIv,myEncryptedData,sKey){
  258. console.log(11111)
  259. let that = this;
  260. uni.request({
  261. url:getApp().globalData.shareUrl, //需要设置为全局
  262. method: 'POST',
  263. header: {
  264. 'content-type': 'application/x-www-form-urlencoded'
  265. },
  266. data: {
  267. method: 'getPhoneNumber',
  268. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  269. uid:getApp().globalData.user_id,
  270. sign: md5('getPhoneNumber' + getApp().globalData.globalTimestamp),
  271. iv:myIv,
  272. sessionKey:sKey,
  273. encryptedData:myEncryptedData,
  274. },
  275. success: res => {
  276. if(res.data.code === 200){
  277. getApp().globalData.user_phone = res.data.msg.phoneNumber;
  278. that.userPhone = res.data.msg.phoneNumber;
  279. that.isAuthPhone = res.data.msg.phoneNumber;
  280. }
  281. }
  282. });
  283. },
  284. }
  285. }
  286. </script>
  287. <style>
  288. .content {
  289. display: flex;
  290. flex-direction: column;
  291. align-items: center;
  292. justify-content: center;
  293. }
  294. .selfInfo-box {
  295. width: 100%;
  296. height: 320rpx;
  297. background: #1fa1fb;
  298. padding-top: 5%;
  299. color: #fff;
  300. }
  301. .self-auth {
  302. display: flex;
  303. align-items: center;
  304. }
  305. .self-auth image {
  306. margin-left: 5%;
  307. height: 120rpx;
  308. width: 120rpx;
  309. border-radius: 50%;
  310. }
  311. .self-auth view {
  312. display: flex;
  313. flex-direction: column;
  314. align-items: center;
  315. }
  316. .self-content {
  317. margin-top: 10%;
  318. display: flex;
  319. justify-content: space-around;
  320. align-items: center;
  321. }
  322. .self-content view {
  323. display: flex;
  324. flex-direction: column;
  325. align-items: center;
  326. }
  327. .function-box {
  328. display: flex;
  329. justify-content: space-around;
  330. align-items: center;
  331. background: #fff;
  332. width: 100%;
  333. height: 240rpx;
  334. }
  335. .function-content {
  336. display: flex;
  337. flex-direction: column;
  338. justify-content: space-around;
  339. align-items: center;
  340. background: #ff685a;
  341. width: 200rpx;
  342. height: 180rpx;
  343. border-radius: 10rpx;
  344. font-size: 30rpx;
  345. color: #fff;
  346. }
  347. .function-content image {
  348. width: 75rpx;
  349. height: 75rpx;
  350. margin-top: 5%;
  351. }
  352. .function-content text {
  353. margin-bottom: 5%;
  354. }
  355. .list-box {
  356. width: 100%;
  357. margin-top: 3%;
  358. font-size: 30rpx;
  359. }
  360. .list-content {
  361. background: #fff;
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. height: 100rpx;
  366. border-bottom: 1px solid #dbdbdb;
  367. }
  368. .apply-box {
  369. display: flex;
  370. align-items: center;
  371. width: 200rpx;
  372. }
  373. .apply-box image {
  374. width: 50rpx;
  375. height: 50rpx;
  376. margin-right: 5%;
  377. }
  378. .margin-left5 {
  379. margin-left: 5%;
  380. }
  381. .authUser {
  382. width: 70%;
  383. font-size: 14px;
  384. background-color: #fff!important;
  385. color: #1fa1fb!important;
  386. }
  387. .authPhone {
  388. font-size: 12px;
  389. margin-left: ;
  390. margin-left: 10px;
  391. margin-top: 5px;
  392. background-color: #fff!important;
  393. color: #1fa1fb!important;
  394. }
  395. /* 提示窗口 */
  396. .uni-tip {
  397. padding: 15px;
  398. background: #fff;
  399. box-sizing: border-box;
  400. border-radius: 10px;
  401. }
  402. .uni-tip-title {
  403. text-align: center;
  404. /* font-weight: bold; */
  405. font-size: 28upx;
  406. color: #333;
  407. }
  408. .uni-tip-content {
  409. font-size: 14px;
  410. color: #666;
  411. }
  412. .uni-tip-group-button {
  413. margin-top: 10px;
  414. display: flex;
  415. }
  416. .uni-tip-button {
  417. width: 100%;
  418. text-align: center;
  419. font-size: 14px;
  420. color: #3b4144;
  421. }
  422. </style>