user.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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="">
  8. <view class="name">{{ userInfo.phone || userInfo.email || '游客' }}</view>
  9. <view class="id">uid:{{ userInfo.uid }}</view>
  10. <view class="id-box flex">
  11. <view class="level-box">
  12. <image class="image" src="../../static/img/img28.png"></image>
  13. <view class="level">V{{ userInfo.level }}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="main">
  20. <view class="title">我的工具</view>
  21. <view class="tt">
  22. <view class="tt-box" @click="nav('/pages/assets/myPing')">
  23. <image src="../../static/img/pinggou.png" class="tt-icon1" mode=""></image>
  24. <view class="tt-txt">我的拼购</view>
  25. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  26. </view>
  27. <view class="tt-box" @click="nav('/pages/user/fulilist')">
  28. <image src="../../static/img/gift.png" class="tt-icon1" mode=""></image>
  29. <view class="tt-txt">拼购福利</view>
  30. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  31. </view>
  32. <view class="tt-box" @click="nav('/pages/user/extension')">
  33. <image src="../../static/img/myTeam.png" class="tt-icon2" mode=""></image>
  34. <view class="tt-txt">我的团队</view>
  35. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  36. </view>
  37. <view class="tt-box" @click="nav('/pages/user/shareQrCode')">
  38. <image src="../../static/img/share.png" class="tt-icon3" mode=""></image>
  39. <view class="tt-txt">团队邀请</view>
  40. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  41. </view>
  42. <view class="tt-box" @click="nav('/pages/money/payment')">
  43. <image src="../../static/img/zfpwd.png" class="tt-icon4" mode=""></image>
  44. <view class="tt-txt">交易密码</view>
  45. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  46. </view>
  47. <view class="tt-box" @click="nav('/pages/set/password')">
  48. <image src="../../static/img/pwd.png" class="tt-icon1" mode=""></image>
  49. <view class="tt-txt">登录密码</view>
  50. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  51. </view>
  52. <view class="tt-box" @click="server()">
  53. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  54. <view class="tt-txt">联系客服</view>
  55. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  56. </view>
  57. <view class="tt-box" @click="nav('/pages/set/userinfo')">
  58. <image src="../../static/img/set.png" class="tt-icon5" mode=""></image>
  59. <view class="tt-txt">设置</view>
  60. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  61. </view>
  62. </view>
  63. </view>
  64. <uni-popup ref="popup" type="center">
  65. <view class="popup">
  66. <view class="popup-dox">
  67. <image class="popup-logo" src="../../static/img/lianxi.png"></image>
  68. <view class="pop-title">已为您定制专属客服</view>
  69. <view >{{ weixin }}</view>
  70. <image class="popup-text" @longtap="bc_code" :src="erweima"></image>
  71. <view class="btn" @click="copy(weixin)">复制微信号</view>
  72. <view class="pop-tip flex">
  73. <view class="weixin"><image src="../../static/img/weixin.png" mode=""></image></view>
  74. <view>长按保存二维码</view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="close_icon" @click="close"><image src="../../static/img/Close.png"></image></view>
  79. </uni-popup>
  80. </view>
  81. </template>
  82. <script>
  83. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  84. import { mapState, mapMutations } from 'vuex';
  85. import uniList from '@/components/uni-list/uni-list.vue';
  86. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  87. import { orderData, getUserInfo,service } from '@/api/user.js';
  88. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  89. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  90. export default {
  91. components: {
  92. uniList,
  93. uniListItem,
  94. uniPopup
  95. },
  96. data() {
  97. return {
  98. erweima:'',
  99. weixin:''
  100. };
  101. },
  102. onShow() {
  103. //判断是否已经登录
  104. if (this.hasLogin) {
  105. this.loadBaseData();
  106. } else {
  107. uni.showModal({
  108. title: '登录',
  109. content: '您未登录,是否马上登陆?',
  110. success: e => {
  111. if (e.confirm) {
  112. interceptor();
  113. }
  114. },
  115. fail: e => {
  116. console.log(e);
  117. }
  118. });
  119. }
  120. },
  121. computed: {
  122. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  123. },
  124. methods: {
  125. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  126. loadBaseData() {
  127. console.log(this.userInfo);
  128. getUserInfo({}).then(({ data }) => {
  129. this.setUserInfo(data);
  130. });
  131. service({}).then(({data}) =>{
  132. this.erweima = data.service_qr;
  133. this.weixin = data.service_wechat;
  134. })
  135. },
  136. server() {
  137. this.$refs.popup.open();
  138. },
  139. close() {
  140. this.$refs.popup.close();
  141. },
  142. nav(url) {
  143. // 判断是否已经登录
  144. // if (this.hasLogin) {
  145. console.log(url);
  146. uni.navigateTo({
  147. url: url,
  148. fail() {
  149. uni.switchTab({
  150. url: url
  151. });
  152. }
  153. });
  154. // }else {
  155. // uni.showModal({
  156. // title: '登录',
  157. // content: '您未登录,是否马上登陆?',
  158. // success: e => {
  159. // if (e.confirm) {
  160. // interceptor();
  161. // }
  162. // },
  163. // fail: e => {{}
  164. // console.log(e);
  165. // }
  166. // });
  167. // }
  168. },
  169. bc_code(){
  170. let that = this;
  171. console.log('保存二维码',this.backImg)
  172. uni.downloadFile({ //获得二维码的临时地址
  173. url:this.backImg,
  174. success:(res)=>{
  175. //console.log('获取url',res)
  176. if(res.statusCode == 200){
  177. uni.saveImageToPhotosAlbum({
  178. filePath:res.tempFilePath,//传入临时地址
  179. success() {
  180. that.$api.msg('保存成功')//封装的提示
  181. },
  182. fail() {
  183. that.$api.msg('保存失败')
  184. }
  185. })
  186. }
  187. }
  188. })
  189. },
  190. copy(value) {
  191. let obj = this;
  192. let content = value; //需要复制的内容
  193. console.log('复制的内容:', content);
  194. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  195. const result = uniCopy(content);
  196. if (result === false) {
  197. uni.showToast({
  198. title: '不支持'
  199. });
  200. } else {
  201. uni.showToast({
  202. title: '复制成功',
  203. icon: 'none'
  204. });
  205. }
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss">
  211. page {
  212. height: 100%;
  213. background: #ffffff;
  214. }
  215. .container {
  216. height: 100%;
  217. background: #ffffff;
  218. }
  219. .top {
  220. width: 100%;
  221. height: 340rpx;
  222. position: relative;
  223. .bg {
  224. position: absolute;
  225. width: 100%;
  226. height: 340rpx;
  227. left: 0;
  228. top: 0;
  229. right: 0;
  230. image {
  231. width: 100%;
  232. height: 100%;
  233. }
  234. }
  235. .user {
  236. position: relative;
  237. padding-top: 98rpx;
  238. padding-left: 34rpx;
  239. display: flex;
  240. justify-content: flex-start;
  241. align-items: center;
  242. z-index: 10;
  243. .avtor {
  244. width: 102rpx;
  245. height: 102rpx;
  246. border-radius: 50%;
  247. .portrait {
  248. width: 100%;
  249. height: 100%;
  250. border-radius: 50%;
  251. }
  252. }
  253. .name {
  254. margin-left: 30rpx;
  255. font-size: 36rpx;
  256. font-family: PingFang SC;
  257. font-weight: 500;
  258. color: #ffffff;
  259. }
  260. .id {
  261. margin-left: 30rpx;
  262. font-size: 30rpx;
  263. font-family: PingFang SC;
  264. font-weight: 500;
  265. color: #ffffff;
  266. }
  267. .level-box {
  268. margin-left: 30rpx;
  269. margin-top: 10rpx;
  270. position: relative;
  271. .image {
  272. width: 128rpx;
  273. height: 45rpx;
  274. }
  275. .level {
  276. position: absolute;
  277. top: 0;
  278. left: 62rpx;
  279. height: 44rpx;
  280. line-height: 48rpx;
  281. font-size: 24rpx;
  282. color: #826740;
  283. font-weight: bold;
  284. }
  285. }
  286. }
  287. }
  288. .main {
  289. position: relative;
  290. z-index: 11;
  291. width: 100%;
  292. height: 100%;
  293. background: #ffffff;
  294. margin-top: -70rpx;
  295. border-top-left-radius: 60rpx;
  296. border-top-right-radius: 60rpx;
  297. .title {
  298. padding-top: 65rpx;
  299. padding-left: 36rpx;
  300. font-size: 36rpx;
  301. font-family: PingFang SC;
  302. font-weight: bold;
  303. color: #333333;
  304. }
  305. .tt {
  306. margin: 0 auto;
  307. width: 750rpx;
  308. padding: 40rpx 70rpx;
  309. border-radius: 10rpx;
  310. background-color: #ffffff;
  311. .tt-box {
  312. height: 100rpx;
  313. display: flex;
  314. align-items: center;
  315. border-bottom: 1px solid #f0f0f0;
  316. .tt-icon1 {
  317. width: 42rpx;
  318. height: 42rpx;
  319. }
  320. .tt-icon2 {
  321. width: 49rpx;
  322. height: 38rpx;
  323. }
  324. .tt-icon3 {
  325. width: 46rpx;
  326. height: 40rpx;
  327. }
  328. .tt-icon4 {
  329. width: 40rpx;
  330. height: 42rpx;
  331. }
  332. .tt-icon5 {
  333. width: 44rpx;
  334. height: 40rpx;
  335. }
  336. .tt-txt {
  337. margin-left: 36rpx;
  338. font-size: 32rpx;
  339. font-family: PingFang SC;
  340. font-weight: 500;
  341. color: #333333;
  342. flex: 1;
  343. }
  344. .next-icon {
  345. width: 16rpx;
  346. height: 25rpx;
  347. }
  348. }
  349. .border-b {
  350. border-bottom: 1px solid #f1f1f1;
  351. }
  352. }
  353. }
  354. .popup {
  355. width: 640rpx;
  356. background-color: #ffffff;
  357. border-radius: 15rpx;
  358. text-align: center;
  359. .popup-dox {
  360. position: relative;
  361. top: -60rpx;
  362. .popup-logo {
  363. width: 460rpx;
  364. height: 132rpx;
  365. }
  366. .pop-title {
  367. font-size: 40rpx;
  368. font-weight: bold;
  369. color: #333333;
  370. padding: 25rpx 0rpx;
  371. margin-bottom: 50rpx;
  372. }
  373. .popup-text {
  374. width: 400rpx;
  375. height: 400rpx;
  376. margin-bottom: 50rpx;
  377. }
  378. .btn{
  379. width: 300rpx;
  380. height: 50rpx;
  381. line-height: 50rpx;
  382. background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
  383. margin: 0 auto;
  384. color: #FFFFFF;
  385. border-radius: 25rpx;
  386. }
  387. .pop-tip {
  388. font-size: 30rpx;
  389. font-weight: 500;
  390. color: #333333;
  391. justify-content: center;
  392. margin-top: 20rpx;
  393. .weixin {
  394. width: 48rpx;
  395. height: 40rpx;
  396. margin-right: 14rpx;
  397. image {
  398. width: 48rpx;
  399. height: 40rpx;
  400. }
  401. }
  402. }
  403. }
  404. }
  405. .close_icon {
  406. width: 60rpx;
  407. height: 60rpx;
  408. margin: 88rpx auto 0;
  409. image {
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. </style>