user.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="container">
  3. <view class="user-info-box">
  4. <view class="detail flex" @click="navTo('/pages/set/userinfo')">
  5. <view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '../../static/error/missing-face.png'"></image></view>
  6. <view class="info-box">
  7. <view class="username">{{ userInfo.nickname || $t('hea.yk') }}</view>
  8. <view class="font-size-sm">{{ userInfo.mobile || '' }}</view>
  9. </view>
  10. <view class="vip">
  11. <image v-if="isVip == 1" src="../../static/img/usernovip.png" mode=""></image>
  12. <image v-if="isVip == 2" src="../../static/img/uservip.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="config iconfont"><text class="setting iconsetting" @click="navTo('/pages/set/userinfo')"></text></view>
  16. </view>
  17. <!-- <view class="vip-box" @click="navTo('/pages/user/upgrade')"><image src="../../static/img/vip.png" mode=""></image></view> -->
  18. <view class="tt">
  19. <view class="tt-box" @click="navTo('/pages/user/promotion')">
  20. <image src="../../static/img/tuiguang.png" class="tt-icon1" mode=""></image>
  21. <view class="tt-txt">{{$t('hea.wdtg')}}</view>
  22. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  23. </view>
  24. <view class="tt-box" @click="navTo('/pages/user/team')">
  25. <image src="../../static/img/team.png" class="tt-icon1" mode=""></image>
  26. <view class="tt-txt">{{$t('hea.wdtd')}}</view>
  27. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  28. </view>
  29. <view class="tt-box" @click="navTo('/pages/user/shareQrCode')">
  30. <image src="../../static/img/share.png" class="tt-icon1" mode=""></image>
  31. <view class="tt-txt">{{$t('hea.fxhy')}}</view>
  32. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  33. </view>
  34. <view class="tt-box" @click="open()">
  35. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  36. <view class="tt-txt">{{$t('hea.lxkf')}}</view>
  37. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  38. </view>
  39. </view>
  40. <uni-popup ref="popup" type="center">
  41. <view class="popup-box">
  42. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  43. <view class="mian">
  44. <view class="delivery">
  45. <view class="title">已经为您定制专属客服</view>
  46. <image src="../../static/img/img010.png" mode=""></image>
  47. </view>
  48. <view class="nocancel">客服微信: {{ text }}</view>
  49. <view class="comfirm-box">
  50. <view class="cancel" @click="cancel">取消</view>
  51. <view class="comfirm" @click="tocall()">复制微信</view>
  52. </view>
  53. </view>
  54. </view>
  55. </uni-popup>
  56. <u-tabbar :list="tabbar" bg-color='#000' active-color='#FAD6B0' inactive-color='#71614f' change='change'></u-tabbar>
  57. </view>
  58. </template>
  59. <script>
  60. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  61. import uniCopy from '@/utils/uni-copy.js';
  62. import { tabbar } from '@/components/tabbar/tabbar.js'
  63. import { mapState, mapMutations } from 'vuex';
  64. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  65. import { getUserInfo } from '@/api/user.js';
  66. export default {
  67. data() {
  68. return {
  69. text: 'c1729888411',
  70. isVip:1,
  71. tabbar: tabbar,
  72. };
  73. },
  74. components: {
  75. uniPopup
  76. },
  77. computed: {
  78. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  79. },
  80. onShow() {
  81. //判断是否已经登录
  82. if (this.hasLogin) {
  83. this.loadBaseData();
  84. } else {
  85. let obj = this
  86. uni.showModal({
  87. title: obj.$t('hea.login'),
  88. content: obj.$t('hea.logininfo'),
  89. success: e => {
  90. if (e.confirm) {
  91. saveUrl();
  92. interceptor();
  93. }
  94. },
  95. fail: e => {
  96. console.log(e);
  97. }
  98. });
  99. }
  100. },
  101. methods: {
  102. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  103. loadBaseData() {
  104. getUserInfo({})
  105. .then(({ data }) => {
  106. console.log(data, 'UserInfo+++++++++++++++++');
  107. if (data.activity[1].my_join.status == '2') {
  108. this.isVip = 2
  109. }
  110. this.setUserInfo(data);
  111. })
  112. .catch(e => {
  113. console.log(e);
  114. });
  115. },
  116. navTo(url) {
  117. if (!this.hasLogin) {
  118. // 保存地址
  119. saveUrl();
  120. // 登录拦截
  121. interceptor();
  122. } else {
  123. uni.navigateTo({
  124. url
  125. });
  126. }
  127. },
  128. open() {
  129. console.log('点击出现弹窗');
  130. this.$refs.popup.open();
  131. },
  132. // 客服弹窗 - 取消
  133. cancel() {
  134. this.$refs.popup.close();
  135. },
  136. tocall() {
  137. // #ifdef APP-PLUS
  138. uni.setClipboardData({
  139. data: this.text,
  140. success: e => {
  141. uni.showToast({
  142. title: '复制成功!'
  143. });
  144. },
  145. fail(e) {
  146. uni.showToast({
  147. title: '复制失败',
  148. icon: false
  149. });
  150. console.log(e);
  151. }
  152. });
  153. // #endif
  154. }
  155. }
  156. };
  157. </script>
  158. <style lang="scss">
  159. page,
  160. .container {
  161. background: #000;
  162. height: 100%;
  163. }
  164. .user-info-box {
  165. padding: 40rpx 46rpx 0;
  166. height: 180rpx;
  167. color: white;
  168. display: flex;
  169. align-items: center;
  170. justify-content: space-between;
  171. position: relative;
  172. z-index: 1;
  173. .detail {
  174. height: 130rpx;
  175. .portrait-box {
  176. height: 100%;
  177. .portrait {
  178. width: 130rpx;
  179. height: 100%;
  180. border: 5rpx solid #fff;
  181. border-radius: 50%;
  182. }
  183. }
  184. .info-box {
  185. margin-left: 20rpx;
  186. line-height: 1.5;
  187. .username {
  188. font-size: $font-lg + 6rpx;
  189. height: 100%;
  190. }
  191. }
  192. .vip {
  193. margin-left: 20rpx;
  194. width: 122rpx;
  195. height: 36rpx;
  196. image {
  197. width: 100%;
  198. height: 100%;
  199. }
  200. }
  201. }
  202. .config {
  203. font-size: 48rpx;
  204. }
  205. }
  206. .vip-box {
  207. width: 690rpx;
  208. height: 200rpx;
  209. margin: 60rpx auto 0;
  210. image {
  211. width: 100%;
  212. height: 100%;
  213. }
  214. }
  215. .tt {
  216. margin: 0 auto;
  217. width: 750rpx;
  218. padding: 40rpx 70rpx;
  219. background-color: #000;
  220. .tt-box {
  221. padding: 20rpx;
  222. height: 100rpx;
  223. display: flex;
  224. align-items: center;
  225. border-bottom: 1px solid #838383;
  226. .tt-icon1 {
  227. width: 42rpx;
  228. height: 37rpx;
  229. }
  230. .tt-icon2 {
  231. width: 49rpx;
  232. height: 38rpx;
  233. }
  234. .tt-icon3 {
  235. width: 46rpx;
  236. height: 40rpx;
  237. }
  238. .tt-icon4 {
  239. width: 40rpx;
  240. height: 42rpx;
  241. }
  242. .tt-icon5 {
  243. width: 44rpx;
  244. height: 40rpx;
  245. }
  246. .tt-txt {
  247. font-size: 28rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #ffffff;
  251. margin-left: 36rpx;
  252. color: #ffffff;
  253. flex: 1;
  254. }
  255. .next-icon {
  256. width: 16rpx;
  257. height: 25rpx;
  258. }
  259. }
  260. .border-b {
  261. border-bottom: 1px solid #f0f0f0;
  262. }
  263. }
  264. .popup-box {
  265. width: 522rpx;
  266. height: 605rpx;
  267. background-color: #ffffff;
  268. border-radius: 20rpx;
  269. position: relative;
  270. .img {
  271. position: relative;
  272. top: -56rpx;
  273. left: 0;
  274. width: 522rpx;
  275. height: 132rpx;
  276. display: flex;
  277. justify-content: center;
  278. image {
  279. border-radius: 20rpx 20rpx 0 0;
  280. width: 450rpx;
  281. height: 132rpx;
  282. }
  283. }
  284. .mian {
  285. margin-top: -44rpx;
  286. display: flex;
  287. flex-direction: column;
  288. align-items: center;
  289. // padding: 32rpx 32rpx;
  290. background-color: #ffffff;
  291. border-radius: 0 0 20rpx 20rpx;
  292. text-align: center;
  293. .delivery {
  294. font-size: 40rpx;
  295. color: #333333;
  296. display: flex;
  297. align-items: center;
  298. flex-direction: column;
  299. .title {
  300. }
  301. image {
  302. margin-top: 48rpx;
  303. width: 172rpx;
  304. height: 160rpx;
  305. }
  306. }
  307. .nocancel {
  308. font-size: 32rpx;
  309. color: #333333;
  310. margin-top: 14rpx;
  311. }
  312. .comfirm-box {
  313. margin-top: 52rpx;
  314. display: flex;
  315. // margin-bottom: 32rpx;
  316. // justify-content: space-around;
  317. .cancel {
  318. display: flex;
  319. align-items: center;
  320. justify-content: center;
  321. width: 197rpx;
  322. height: 74rpx;
  323. border: 1px solid #dcc786;
  324. border-radius: 38rpx;
  325. font-size: 32rpx;
  326. color: #605128;
  327. }
  328. .comfirm {
  329. margin-left: 32rpx;
  330. display: flex;
  331. align-items: center;
  332. justify-content: center;
  333. width: 197rpx;
  334. height: 74rpx;
  335. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  336. border-radius: 38px;
  337. font-size: 32rpx;
  338. color: #605128;
  339. }
  340. }
  341. }
  342. }
  343. </style>