index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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>
  10. <text style="margin-left: 10%;">{{userName}}</text>
  11. <text style="margin-left: 10%;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. this.switchUserStatus(getApp().globalData.user_status)
  97. },
  98. onShow() {
  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.cashOutList = res.data.msg
  142. }
  143. }
  144. });
  145. },
  146. goTeamDetail(){
  147. if(getApp().globalData.isAuth){
  148. uni.navigateTo({
  149. url: '/pages/selfCenter/recommendTeam/index',
  150. success: res => {},
  151. fail: () => {},
  152. complete: () => {}
  153. });
  154. }else {
  155. this.goAuth()
  156. }
  157. },
  158. goRecommend(){
  159. uni.switchTab({
  160. url:'/pages/index/index'
  161. })
  162. },
  163. goAward(){
  164. if(getApp().globalData.isAuth){
  165. uni.navigateTo({
  166. url: '/pages/selfCenter/awardPage/index',
  167. success: res => {},
  168. fail: () => {},
  169. complete: () => {}
  170. });
  171. }else {
  172. this.goAuth()
  173. }
  174. },
  175. goCashOut(){
  176. if(getApp().globalData.isAuth){
  177. uni.navigateTo({
  178. url: '/pages/selfCenter/cashoutPage/index',
  179. success: res => {},
  180. fail: () => {},
  181. complete: () => {}
  182. });
  183. }else {
  184. this.goAuth()
  185. }
  186. },
  187. goHelpPage(){
  188. uni.navigateTo({
  189. url: '/pages/selfCenter/helpPage/index',
  190. success: res => {},
  191. fail: () => {},
  192. complete: () => {}
  193. });
  194. },
  195. applyPower(){
  196. let that = this;
  197. if(that.userStatus === '点击申请'){
  198. uni.request({
  199. url: getApp().globalData.shareUrl, //需要设置为全局
  200. method: 'POST',
  201. header: {
  202. 'content-type': 'application/x-www-form-urlencoded'
  203. },
  204. data: {
  205. method: 'zigeapply',
  206. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  207. uid:getApp().globalData.user_id,
  208. sign: md5('zigeapply' + getApp().globalData.globalTimestamp)
  209. },
  210. success: res => {
  211. if (res.data.code === 200) {
  212. console.log(res.data.msg)
  213. this.$refs.showtip.open()
  214. //that.cashOutList = res.data.msg
  215. }
  216. }
  217. });
  218. }else{
  219. return false
  220. }
  221. },
  222. cancel(type) {
  223. this.$refs.showtip.close()
  224. },
  225. change(e) {
  226. console.log('是否打开:' + e.show)
  227. },
  228. goAuth(){
  229. uni.navigateTo({
  230. url: '/pages/auth/index',
  231. success: res => {},
  232. fail: () => {},
  233. complete: () => {}
  234. });
  235. },
  236. getPhoneNumber(e){
  237. let that = this;
  238. console.log(e)
  239. if (e.detail.errMsg == 'getPhoneNumber:ok') { //允许授权执行跳转
  240. console.log(e.detail.iv)
  241. that.phoneRequest(e.detail.iv, e.detail.encryptedData, getApp().globalData.session_key)
  242. }
  243. else {
  244. that.isNeedPhone = false;
  245. }
  246. },
  247. phoneRequest(myIv,myEncryptedData,sKey){
  248. console.log(11111)
  249. let that = this;
  250. uni.request({
  251. url:getApp().globalData.shareUrl, //需要设置为全局
  252. method: 'POST',
  253. header: {
  254. 'content-type': 'application/x-www-form-urlencoded'
  255. },
  256. data: {
  257. method: 'getPhoneNumber',
  258. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  259. uid:getApp().globalData.user_id,
  260. sign: md5('getPhoneNumber' + getApp().globalData.globalTimestamp),
  261. iv:myIv,
  262. sessionKey:sKey,
  263. encryptedData:myEncryptedData,
  264. },
  265. success: res => {
  266. if(res.data.code === 200){
  267. getApp().globalData.user_phone = res.data.msg.phoneNumber;
  268. }
  269. }
  270. });
  271. },
  272. }
  273. }
  274. </script>
  275. <style>
  276. .content {
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. justify-content: center;
  281. }
  282. .selfInfo-box {
  283. width: 100%;
  284. height: 320rpx;
  285. background: #1fa1fb;
  286. padding-top: 5%;
  287. color: #fff;
  288. }
  289. .self-auth {
  290. display: flex;
  291. align-items: center;
  292. }
  293. .self-auth image {
  294. margin-left: 5%;
  295. height: 120rpx;
  296. width: 120rpx;
  297. border-radius: 50%;
  298. }
  299. .self-auth view {
  300. display: flex;
  301. flex-direction: column;
  302. align-items: center;
  303. }
  304. .self-content {
  305. margin-top: 10%;
  306. display: flex;
  307. justify-content: space-around;
  308. align-items: center;
  309. }
  310. .self-content view {
  311. display: flex;
  312. flex-direction: column;
  313. align-items: center;
  314. }
  315. .function-box {
  316. display: flex;
  317. justify-content: space-around;
  318. align-items: center;
  319. background: #fff;
  320. width: 100%;
  321. height: 240rpx;
  322. }
  323. .function-content {
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: space-around;
  327. align-items: center;
  328. background: #ff685a;
  329. width: 200rpx;
  330. height: 180rpx;
  331. border-radius: 10rpx;
  332. font-size: 30rpx;
  333. color: #fff;
  334. }
  335. .function-content image {
  336. width: 75rpx;
  337. height: 75rpx;
  338. margin-top: 5%;
  339. }
  340. .function-content text {
  341. margin-bottom: 5%;
  342. }
  343. .list-box {
  344. width: 100%;
  345. margin-top: 3%;
  346. font-size: 30rpx;
  347. }
  348. .list-content {
  349. background: #fff;
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. height: 100rpx;
  354. border-bottom: 1px solid #dbdbdb;
  355. }
  356. .apply-box {
  357. display: flex;
  358. align-items: center;
  359. width: 200rpx;
  360. }
  361. .apply-box image {
  362. width: 50rpx;
  363. height: 50rpx;
  364. margin-right: 5%;
  365. }
  366. .margin-left5 {
  367. margin-left: 5%;
  368. }
  369. .authUser {
  370. width: 70%;
  371. font-size: 14px;
  372. background-color: #fff!important;
  373. color: #1fa1fb!important;
  374. }
  375. .authPhone {
  376. font-size: 12px;
  377. margin-left: ;
  378. margin-left: 10px;
  379. margin-top: 5px;
  380. background-color: #fff!important;
  381. color: #1fa1fb!important;
  382. }
  383. /* 提示窗口 */
  384. .uni-tip {
  385. padding: 15px;
  386. background: #fff;
  387. box-sizing: border-box;
  388. border-radius: 10px;
  389. }
  390. .uni-tip-title {
  391. text-align: center;
  392. /* font-weight: bold; */
  393. font-size: 28upx;
  394. color: #333;
  395. }
  396. .uni-tip-content {
  397. font-size: 14px;
  398. color: #666;
  399. }
  400. .uni-tip-group-button {
  401. margin-top: 10px;
  402. display: flex;
  403. }
  404. .uni-tip-button {
  405. width: 100%;
  406. text-align: center;
  407. font-size: 14px;
  408. color: #3b4144;
  409. }
  410. </style>