index.vue 8.4 KB

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