user.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <view class="bg"><image class="imgBg" src="../../static/img/user-bg.png" mode=""></image></view>
  5. <view class="user">
  6. <view class="avtor"><image class="portrait" :src="userInfo.avatar || '/static/img/missing-face.png'"></image></view>
  7. <view class="name">{{ userInfo.nickname || '游客' }}</view>
  8. </view>
  9. </view>
  10. <view class="main">
  11. <view class="title">我的工具</view>
  12. <view class="tt">
  13. <view class="tt-box" @click="nav('/pages/assets/myPing')">
  14. <image src="../../static/img/pinggou.png" class="tt-icon1" mode=""></image>
  15. <view class="tt-txt">我的拼购</view>
  16. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  17. </view>
  18. <view class="tt-box" @click="nav('/pages/user/extension')">
  19. <image src="../../static/img/myTeam.png" class="tt-icon2" mode=""></image>
  20. <view class="tt-txt">我的团队</view>
  21. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  22. </view>
  23. <view class="tt-box" @click="nav('/pages/user/shareQrCode')">
  24. <image src="../../static/img/share.png" class="tt-icon3" mode=""></image>
  25. <view class="tt-txt">团队邀请</view>
  26. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  27. </view>
  28. <view class="tt-box" @click="nav('/pages/money/payment')">
  29. <image src="../../static/img/zfpwd.png" class="tt-icon4" mode=""></image>
  30. <view class="tt-txt">支付密码</view>
  31. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  32. </view>
  33. <view class="tt-box" @click="nav('/pages/public/forget')">
  34. <image src="../../static/img/pwd.png" class="tt-icon1" mode=""></image>
  35. <view class="tt-txt">登录密码</view>
  36. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  37. </view>
  38. <view class="tt-box" @click="server()">
  39. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  40. <view class="tt-txt">联系客服</view>
  41. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  42. </view>
  43. <view class="tt-box" @click="nav('/pages/set/userinfo')">
  44. <image src="../../static/img/set.png" class="tt-icon5" mode=""></image>
  45. <view class="tt-txt">设置</view>
  46. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 申请退款弹窗 -->
  51. <uni-popup ref="popup" type="center">
  52. <view class="popup">
  53. <view class="popup-dox">
  54. <image class="popup-logo" src="../../static/img/lianxi.png"></image>
  55. <view class="pop-title">已为您定制专属客服</view>
  56. <image class="popup-text" src=""></image>
  57. <view class="pop-tip flex"><view class="weixin"><image src="../../static/img/weixin.png" mode=""></image></view><view>长按识别咨询客服</view></view>
  58. </view>
  59. </view>
  60. <view class="close_icon" @click="close"><image src="../../static/img/Close.png"></image></view>
  61. </uni-popup>
  62. </view>
  63. </template>
  64. <script>
  65. import { mapState, mapMutations } from 'vuex';
  66. import uniList from '@/components/uni-list/uni-list.vue';
  67. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  68. import { orderData, getUserInfo } from '@/api/user.js';
  69. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  70. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  71. export default {
  72. components: {
  73. uniList,
  74. uniListItem,
  75. uniPopup
  76. },
  77. data() {
  78. return {};
  79. },
  80. onShow() {
  81. //判断是否已经登录
  82. if (this.hasLogin) {
  83. this.loadBaseData();
  84. }else{
  85. uni.showModal({
  86. title: '登录',
  87. content: '您未登录,是否马上登陆?',
  88. success: e => {
  89. if (e.confirm) {
  90. interceptor();
  91. }
  92. },
  93. fail: e => {
  94. console.log(e);
  95. }
  96. });
  97. }
  98. },
  99. computed: {
  100. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  101. },
  102. methods: {
  103. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  104. loadBaseData() {
  105. getUserInfo({}).then(({
  106. data
  107. }) => {
  108. this.setUserInfo(data);
  109. });
  110. },
  111. server(){
  112. this.$refs.popup.open();
  113. },
  114. close(){
  115. this.$refs.popup.close();
  116. },
  117. nav(url) {
  118. // 判断是否已经登录
  119. // if (this.hasLogin) {
  120. console.log(url)
  121. uni.navigateTo({
  122. url: url,
  123. fail() {
  124. uni.switchTab({
  125. url:url
  126. })
  127. }
  128. })
  129. // }else {
  130. // uni.showModal({
  131. // title: '登录',
  132. // content: '您未登录,是否马上登陆?',
  133. // success: e => {
  134. // if (e.confirm) {
  135. // interceptor();
  136. // }
  137. // },
  138. // fail: e => {
  139. // console.log(e);
  140. // }
  141. // });
  142. // }
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="scss">
  148. page {
  149. height: 100%;
  150. background: #ffffff;
  151. }
  152. .container {
  153. height: 100%;
  154. background: #ffffff;
  155. }
  156. .top {
  157. width: 100%;
  158. height: 320rpx;
  159. position: relative;
  160. .bg {
  161. position: absolute;
  162. width: 100%;
  163. height: 320rpx;
  164. left: 0;
  165. top: 0;
  166. right: 0;
  167. image {
  168. width: 100%;
  169. height: 100%;
  170. }
  171. }
  172. .user {
  173. position: relative;
  174. padding-top: 98rpx;
  175. padding-left: 34rpx;
  176. display: flex;
  177. justify-content: flex-start;
  178. align-items: center;
  179. z-index: 10;
  180. .avtor {
  181. width: 102rpx;
  182. height: 102rpx;
  183. border-radius: 50%;
  184. .portrait {
  185. width: 100%;
  186. height: 100%;
  187. border-radius: 50%;
  188. }
  189. }
  190. .name {
  191. margin-left: 30rpx;
  192. font-size: 36rpx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #ffffff;
  196. }
  197. }
  198. }
  199. .main {
  200. position: relative;
  201. z-index: 11;
  202. width: 100%;
  203. height: 100%;
  204. background: #ffffff;
  205. margin-top: -70rpx;
  206. border-top-left-radius: 60rpx;
  207. border-top-right-radius: 60rpx;
  208. .title {
  209. padding-top: 65rpx;
  210. padding-left: 36rpx;
  211. font-size: 36rpx;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: #333333;
  215. }
  216. .tt {
  217. margin: 0 auto;
  218. width: 750rpx;
  219. padding: 40rpx 70rpx;
  220. border-radius: 10rpx;
  221. background-color: #ffffff;
  222. .tt-box {
  223. height: 100rpx;
  224. display: flex;
  225. align-items: center;
  226. border-bottom: 1px solid #f0f0f0;
  227. .tt-icon1 {
  228. width: 42rpx;
  229. height: 42rpx;
  230. }
  231. .tt-icon2 {
  232. width: 49rpx;
  233. height: 38rpx;
  234. }
  235. .tt-icon3 {
  236. width: 46rpx;
  237. height: 40rpx;
  238. }
  239. .tt-icon4 {
  240. width: 40rpx;
  241. height: 42rpx;
  242. }
  243. .tt-icon5 {
  244. width: 44rpx;
  245. height: 40rpx;
  246. }
  247. .tt-txt {
  248. margin-left: 36rpx;
  249. font-size: 32rpx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #333333;
  253. flex: 1;
  254. }
  255. .next-icon {
  256. width: 16rpx;
  257. height: 25rpx;
  258. }
  259. }
  260. .border-b {
  261. border-bottom: 1px solid #f1f1f1;
  262. }
  263. }
  264. }
  265. .popup {
  266. width: 640rpx;
  267. background-color: #FFFFFF;
  268. border-radius: 15rpx;
  269. text-align: center;
  270. .popup-dox{
  271. position: relative;
  272. top: -60rpx;
  273. .popup-logo {
  274. width: 460rpx;
  275. height: 132rpx;
  276. }
  277. .pop-title{
  278. font-size: 40rpx;
  279. font-weight: bold;
  280. color: #333333;
  281. padding: 25rpx 0rpx;
  282. margin-bottom: 50rpx;
  283. }
  284. .popup-text{
  285. width: 400rpx;
  286. height: 400rpx;
  287. margin-bottom: 50rpx;
  288. }
  289. .pop-tip{
  290. font-size: 30rpx;
  291. font-weight: 500;
  292. color: #333333;
  293. justify-content: center;
  294. .weixin {
  295. width: 48rpx;
  296. height: 40rpx;
  297. margin-right: 14rpx;
  298. image{
  299. width: 48rpx;
  300. height: 40rpx;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. .close_icon {
  307. width: 60rpx;
  308. height: 60rpx;
  309. margin: 88rpx auto 0;
  310. image {
  311. width: 100%;
  312. height: 100%;
  313. }
  314. }
  315. </style>