index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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 style="font-size: 36rpx;">{{userInfoObj.scorenumber || '0'}}</text>
  19. <text style="font-size: 28rpx;">我的积分</text>
  20. </view>
  21. <view>
  22. <text style="font-size: 36rpx;">{{userInfoObj.num || '0'}}<text style="font-size: 28rpx;">元</text></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" style="width: 90rpx;" mode="aspectFit" ></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="submitApply()">确定</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.getUserInfo();
  99. },
  100. methods: {
  101. switchUserStatus(status){
  102. console.log(status)
  103. let that = this;
  104. switch (status){
  105. case '1':
  106. that.userStatus = '审核中'+'&nbsp;&nbsp;&nbsp;'
  107. break;
  108. case '2':
  109. that.userStatus = '已认证'+'&nbsp;&nbsp;&nbsp;'
  110. break;
  111. case '3':
  112. that.userStatus = '已禁用'+'&nbsp;&nbsp;&nbsp;'
  113. break;
  114. case '4':
  115. that.userStatus = '点击申请'
  116. break;
  117. default:
  118. that.userStatus = '点击申请'
  119. break;
  120. }
  121. },
  122. getUserInfo(){
  123. let that = this;
  124. uni.request({
  125. url: getApp().globalData.shareUrl, //需要设置为全局
  126. method: 'POST',
  127. header: {
  128. 'content-type': 'application/x-www-form-urlencoded'
  129. },
  130. data: {
  131. method: 'getUserInfo',
  132. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  133. uid:getApp().globalData.user_id,
  134. sign: md5('getUserInfo' + getApp().globalData.globalTimestamp)
  135. },
  136. success: res => {
  137. if (res.data.code === 200) {
  138. console.log(res.data.msg)
  139. that.userInfoObj = res.data.msg;
  140. that.isAuth = res.data.msg.auth_status === '1';
  141. that.isAuthPhone = res.data.msg.phone;
  142. that.switchUserStatus(res.data.msg.status)
  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. that.getUserIsApply()
  208. }else{
  209. return false;
  210. }
  211. },
  212. getUserIsApply(){
  213. let that = this;
  214. uni.request({
  215. url: getApp().globalData.shareUrl, //需要设置为全局
  216. method: 'POST',
  217. header: {
  218. 'content-type': 'application/x-www-form-urlencoded'
  219. },
  220. data: {
  221. method: 'getApplyCompetency',
  222. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  223. uid:getApp().globalData.user_id,
  224. sign: md5('getApplyCompetency' + getApp().globalData.globalTimestamp)
  225. },
  226. success: res => {
  227. if (res.data.code === 200) {
  228. if(res.data.msg.status === 1){
  229. that.$refs.showtip.open()
  230. }else {
  231. uni.showToast({
  232. title: '您没有权限申请分销资格',
  233. icon: 'none',
  234. duration:3000
  235. });
  236. }
  237. }else {
  238. uni.showToast({
  239. title: res.data.msg,
  240. icon: 'none',
  241. duration:3000
  242. });
  243. }
  244. }
  245. });
  246. },
  247. submitApply(){
  248. let that = this;
  249. uni.request({
  250. url: getApp().globalData.shareUrl, //需要设置为全局
  251. method: 'POST',
  252. header: {
  253. 'content-type': 'application/x-www-form-urlencoded'
  254. },
  255. data: {
  256. method: 'zigeapply',
  257. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  258. uid:getApp().globalData.user_id,
  259. sign: md5('zigeapply' + getApp().globalData.globalTimestamp)
  260. },
  261. success: res => {
  262. if (res.data.code === 200) {
  263. console.log(res.data.msg)
  264. that.$refs.showtip.close();
  265. that.userStatus = '审核中'+'&nbsp;&nbsp;&nbsp;';
  266. //that.cashOutList = res.data.msg
  267. }
  268. }
  269. });
  270. },
  271. cancel(type) {
  272. // this.userStatus = '审核中'+'&nbsp;&nbsp;&nbsp;'
  273. this.$refs.showtip.close()
  274. },
  275. change(e) {
  276. console.log('是否打开:' + e.show)
  277. },
  278. goAuth(){
  279. uni.navigateTo({
  280. url: '/pages/auth/index',
  281. success: res => {},
  282. fail: () => {},
  283. complete: () => {}
  284. });
  285. },
  286. getPhoneNumber(e){
  287. let that = this;
  288. console.log(e)
  289. if (e.detail.errMsg == 'getPhoneNumber:ok') { //允许授权执行跳转
  290. console.log(e.detail.iv)
  291. that.phoneRequest(e.detail.iv, e.detail.encryptedData, getApp().globalData.session_key)
  292. }
  293. else {
  294. that.isNeedPhone = false;
  295. }
  296. },
  297. phoneRequest(myIv,myEncryptedData,sKey){
  298. console.log(11111)
  299. let that = this;
  300. uni.request({
  301. url:getApp().globalData.shareUrl, //需要设置为全局
  302. method: 'POST',
  303. header: {
  304. 'content-type': 'application/x-www-form-urlencoded'
  305. },
  306. data: {
  307. method: 'getPhoneNumber',
  308. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  309. uid:getApp().globalData.user_id,
  310. sign: md5('getPhoneNumber' + getApp().globalData.globalTimestamp),
  311. iv:myIv,
  312. sessionKey:sKey,
  313. encryptedData:myEncryptedData,
  314. },
  315. success: res => {
  316. if(res.data.code === 200){
  317. getApp().globalData.user_phone = res.data.msg.phoneNumber;
  318. that.userPhone = res.data.msg.phoneNumber;
  319. that.isAuthPhone = res.data.msg.phoneNumber;
  320. }
  321. }
  322. });
  323. },
  324. }
  325. }
  326. </script>
  327. <style>
  328. .content {
  329. display: flex;
  330. flex-direction: column;
  331. align-items: center;
  332. justify-content: center;
  333. }
  334. .selfInfo-box {
  335. width: 100%;
  336. height: 320rpx;
  337. background: #1fa1fb;
  338. padding-top: 5%;
  339. color: #fff;
  340. }
  341. .self-auth {
  342. display: flex;
  343. align-items: center;
  344. }
  345. .self-auth image {
  346. margin-left: 5%;
  347. height: 120rpx;
  348. width: 120rpx;
  349. border-radius: 50%;
  350. }
  351. .self-auth view {
  352. display: flex;
  353. flex-direction: column;
  354. /* align-items: center; */
  355. }
  356. .self-content {
  357. margin-top: 10%;
  358. display: flex;
  359. justify-content: space-around;
  360. align-items: center;
  361. }
  362. .self-content view {
  363. display: flex;
  364. flex-direction: column;
  365. align-items: center;
  366. }
  367. .function-box {
  368. display: flex;
  369. justify-content: space-around;
  370. align-items: center;
  371. background: #fff;
  372. width: 100%;
  373. height: 240rpx;
  374. }
  375. .function-content {
  376. display: flex;
  377. flex-direction: column;
  378. justify-content: space-around;
  379. align-items: center;
  380. background: #ff685a;
  381. width: 200rpx;
  382. height: 180rpx;
  383. border-radius: 10rpx;
  384. font-size: 30rpx;
  385. color: #fff;
  386. }
  387. .function-content image {
  388. width: 75rpx;
  389. height: 75rpx;
  390. margin-top: 5%;
  391. }
  392. .function-content text {
  393. margin-bottom: 5%;
  394. }
  395. .list-box {
  396. width: 100%;
  397. margin-top: 3%;
  398. font-size: 30rpx;
  399. }
  400. .list-content {
  401. background: #fff;
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. height: 100rpx;
  406. border-bottom: 1px solid #dbdbdb;
  407. }
  408. .apply-box {
  409. display: flex;
  410. align-items: center;
  411. width: 200rpx;
  412. }
  413. .apply-box image {
  414. width: 50rpx;
  415. height: 50rpx;
  416. margin-right: 5%;
  417. }
  418. .margin-left5 {
  419. margin-left: 5%;
  420. }
  421. .authUser {
  422. width: 70%;
  423. font-size: 14px;
  424. background-color: #fff!important;
  425. color: #1fa1fb!important;
  426. }
  427. .authPhone {
  428. font-size: 12px;
  429. margin-left: ;
  430. margin-left: 10px;
  431. margin-top: 5px;
  432. background-color: #fff!important;
  433. color: #1fa1fb!important;
  434. }
  435. /* 提示窗口 */
  436. .uni-tip {
  437. padding: 15px;
  438. background: #fff;
  439. box-sizing: border-box;
  440. border-radius: 10px;
  441. }
  442. .uni-tip-title {
  443. text-align: center;
  444. /* font-weight: bold; */
  445. font-size: 28upx;
  446. color: #333;
  447. }
  448. .uni-tip-content {
  449. font-size: 14px;
  450. color: #666;
  451. }
  452. .uni-tip-group-button {
  453. margin-top: 10px;
  454. display: flex;
  455. }
  456. .uni-tip-button {
  457. width: 100%;
  458. text-align: center;
  459. font-size: 14px;
  460. color: #3b4144;
  461. }
  462. </style>