index.vue 8.0 KB

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