user.vue 7.8 KB

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