user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="user-set flex">
  5. <view class="set-logo">
  6. <image src="../../static/icon/uset.png" mode=""></image>
  7. </view>
  8. <view class="xx-logo">
  9. <image src="../../static/icon/uset.png" mode=""></image>
  10. </view>
  11. </view>
  12. <view class="user-wrap">
  13. <view class="user-info">
  14. <view class="info-left">
  15. <image src="../../static/error/missing-face.png" mode=""></image>
  16. <view class="user-name">
  17. <view class="name">
  18. </view>
  19. <view class="phone">
  20. </view>
  21. </view>
  22. <view class="kpi">
  23. 今日KPI:1063
  24. </view>
  25. </view>
  26. <view class="info-right">
  27. </view>
  28. </view>
  29. </view>
  30. <uni-list class="tool-list">
  31. <uni-list-item title="收款信息" @click="navTo('/pages/collection/collection')" thumb="/static/icon/skxx.png">
  32. </uni-list-item>
  33. <uni-list-item title="实名认证" @click="navTo('/pages/user/approve')" thumb="/static/icon/bdsj.png">
  34. </uni-list-item>
  35. <uni-list-item title="收货地址" @click="navTo('/pages/set/address')" thumb="/static/icon/shdz.png">
  36. </uni-list-item>
  37. <uni-list-item title="客服" @click="openKf()" thumb="/static/icon/kf.png">
  38. </uni-list-item>
  39. <uni-list-item title="设置" @click="navTo('/pages/set/set')" thumb="/static/icon/uset.png">
  40. </uni-list-item>
  41. </uni-list-item>
  42. </uni-list>
  43. <uni-popup ref="popupkf" type="center">
  44. <view class="popup-box">
  45. <view class="img">
  46. <image src="../../static/img/img009.png" mode=""></image>
  47. </view>
  48. <view class="mian">
  49. <view class="delivery">
  50. <view class="title">已经为您定制专属客服</view>
  51. <image src="../../static/img/img010.png" mode=""></image>
  52. </view>
  53. <view class="nocancel">客服VX:{{ text }}</view>
  54. <view class="comfirm-box">
  55. <view class="cancel" @click="cancel">取消</view>
  56. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  57. </view>
  58. </view>
  59. </view>
  60. </uni-popup>
  61. <uni-popup ref="popupqd" type="center">
  62. <view class="popup">
  63. <view class="popup-dox">
  64. <image class="popup-logo" src="../../static/img/sign-popup.png"></image>
  65. </view>
  66. <view class="popup-title">
  67. 获得
  68. <text>{{ today_integral }}</text>
  69. {{today_type}}
  70. </view>
  71. <view class="popup-tip">
  72. 明天签到可得
  73. <text>{{ tom_integral }}</text>
  74. {{tom_type}}
  75. </view>
  76. <view class="popup-btn" @click="closeQd">知道了</view>
  77. </view>
  78. <!-- <view class="close_icon" @click="close">
  79. <image src="../../static/img/Close.png"></image>
  80. </view> -->
  81. </uni-popup>
  82. </view>
  83. </template>
  84. <script>
  85. import { tabbar1 } from '@/utils/tabbar.js';
  86. import {
  87. mapState,
  88. mapMutations
  89. } from 'vuex';
  90. import uniList from '@/components/uni-list/uni-list.vue';
  91. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  92. import {
  93. orderData,
  94. getUserInfo
  95. } from '@/api/user.js';
  96. import {
  97. saveUrl,
  98. interceptor
  99. } from '@/utils/loginUtils.js';
  100. let startY = 0,
  101. moveY = 0,
  102. pageAtTop = true;
  103. export default {
  104. components: {
  105. uniList,
  106. uniListItem
  107. },
  108. data() {
  109. return {
  110. current: 4,
  111. tabbar: tabbar1,
  112. qded: false, //是否已签到
  113. text:'',//客服微信
  114. today_integral:'',//签到获得的数值
  115. today_type:'',//签到获得的数值单位
  116. tom_integral: '',//明天签到获得的数值
  117. tom_type: '',//签到获得的数值单位
  118. userDowm: 0, //卡片升级专属高度
  119. userMaxDowm: 0, //卡片最高高度
  120. toolList: [{
  121. id: 't1',
  122. name: '新人通道',
  123. width: '56rpx',
  124. heigt: '54rpx',
  125. img: '../../static/icon/tool-1.png',
  126. path: '/pages/user/xrtd'
  127. },
  128. {
  129. id: 't2',
  130. name: '邀请好友',
  131. width: '56rpx',
  132. heigt: '57rpx',
  133. img: '../../static/icon/tool-2.png',
  134. path: '/pages/user/shareQrCode'
  135. },
  136. {
  137. id: 't3',
  138. name: '我的粉丝',
  139. width: '68rpx',
  140. heigt: '53rpx',
  141. img: '../../static/icon/tool-3.png',
  142. path: '/pages/user/myfans'
  143. },
  144. {
  145. id: 't4',
  146. name: '我的订单',
  147. width: '55rpx',
  148. heigt: '54rpx',
  149. img: '../../static/icon/tool-4.png',
  150. path: '/pages/order/order'
  151. },
  152. {
  153. id: 't5',
  154. name: '我的商品',
  155. width: '50rpx',
  156. heigt: '58rpx',
  157. img: '../../static/icon/tool-5.png',
  158. path: '/pages/order/order'
  159. },
  160. {
  161. id: 't6',
  162. name: '馆长申请',
  163. width: '59rpx',
  164. heigt: '56rpx',
  165. img: '../../static/icon/tool-6.png',
  166. path: '/pages/user/gzsq'
  167. }
  168. ]
  169. };
  170. },
  171. onShow() {
  172. // 判断是否已经登录
  173. if (this.hasLogin) {
  174. this.loadBaseData();
  175. }
  176. },
  177. onReady() {
  178. // 初始化获取页面宽度
  179. uni.createSelectorQuery()
  180. .select('.container')
  181. .fields({
  182. size: true
  183. },
  184. data => {
  185. // 计算最多下拉的高度
  186. this.userDowm = Math.floor((data.width / 750) * 185);
  187. // 计算最大触发修改高度事件
  188. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  189. }
  190. )
  191. .exec();
  192. },
  193. // #ifndef MP
  194. // onNavigationBarButtonTap(e) {
  195. // const index = e.index;
  196. // if (index === 0) {
  197. // this.navTo('/pages/set/set');
  198. // } else if (index === 1) {
  199. // // #ifdef APP-PLUS
  200. // const pages = getCurrentPages();
  201. // const page = pages[pages.length - 1];
  202. // const currentWebview = page.$getAppWebview();
  203. // currentWebview.hideTitleNViewButtonRedDot({
  204. // index
  205. // });
  206. // // #endif
  207. // uni.navigateTo({
  208. // url: '/pages/user/notice'
  209. // });
  210. // }
  211. // },
  212. // #endif
  213. computed: {
  214. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  215. },
  216. methods: {
  217. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  218. // 加载初始数据
  219. loadBaseData() {
  220. getUserInfo({})
  221. .then(({
  222. data
  223. }) => {
  224. this.setUserInfo(data);
  225. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  226. orderData({})
  227. .then(({
  228. data
  229. }) => {
  230. this.setOrderInfo(data);
  231. })
  232. .catch(e => {
  233. this.setOrderInfo({
  234. complete_count: 0, //完成
  235. received_count: 0, //待收货
  236. unshipped_count: 0, //待发货
  237. order_count: 0, //订单总数
  238. unpaid_count: 0 //待付款
  239. });
  240. });
  241. })
  242. .catch(e => {
  243. console.log(e);
  244. });
  245. },
  246. /**
  247. * 统一跳转接口,拦截未登录路由
  248. * navigator标签现在默认没有转场动画,所以用view
  249. */
  250. navTo(url) {
  251. // if (!this.hasLogin) {
  252. // // 保存地址
  253. // saveUrl();
  254. // // 登录拦截
  255. // interceptor();
  256. // } else {
  257. uni.navigateTo({
  258. url
  259. });
  260. // }
  261. },
  262. useTool(e) {
  263. this.navTo(e.path)
  264. },
  265. // 签到弹窗
  266. goQd() {
  267. this.$refs.popupqd.open()
  268. this.qded = true
  269. },
  270. // 关闭签到弹窗
  271. closeQd() {
  272. this.$refs.popupqd.close()
  273. },
  274. // 打开客服
  275. openKf() {
  276. this.$refs.popupkf.open()
  277. },
  278. // 关闭客服
  279. cancel() {
  280. this.$refs.popupkf.close()
  281. },
  282. }
  283. };
  284. </script>
  285. <style lang="scss">
  286. %flex-center {
  287. display: flex;
  288. flex-direction: column;
  289. justify-content: center;
  290. align-items: center;
  291. }
  292. %section {
  293. display: flex;
  294. justify-content: space-around;
  295. align-content: center;
  296. background: #fff;
  297. border-radius: 10rpx;
  298. }
  299. .container,page {
  300. min-height: 100%;
  301. height: auto;
  302. background-color: $page-color-base;
  303. }
  304. .vheigh {
  305. height: var(--status-bar-height);
  306. background-color: $base-color;
  307. }
  308. .tool-list {
  309. width: 690rpx;
  310. margin: auto;
  311. background: #FFFFFF;
  312. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  313. border-radius: 20rpx;
  314. }
  315. .popup-box {
  316. width: 522rpx;
  317. height: 605rpx;
  318. background-color: #ffffff;
  319. border-radius: 20rpx;
  320. position: relative;
  321. .img {
  322. position: relative;
  323. top: -56rpx;
  324. left: 0;
  325. width: 522rpx;
  326. height: 132rpx;
  327. display: flex;
  328. justify-content: center;
  329. image {
  330. border-radius: 20rpx 20rpx 0 0;
  331. width: 450rpx;
  332. height: 132rpx;
  333. }
  334. }
  335. .mian {
  336. margin-top: -44rpx;
  337. display: flex;
  338. flex-direction: column;
  339. align-items: center;
  340. // padding: 32rpx 32rpx;
  341. background-color: #ffffff;
  342. border-radius: 0 0 20rpx 20rpx;
  343. text-align: center;
  344. .delivery {
  345. font-size: 40rpx;
  346. color: #333333;
  347. display: flex;
  348. align-items: center;
  349. flex-direction: column;
  350. .title {}
  351. image {
  352. margin-top: 48rpx;
  353. width: 172rpx;
  354. height: 160rpx;
  355. }
  356. }
  357. .nocancel {
  358. font-size: 32rpx;
  359. color: #333333;
  360. margin-top: 14rpx;
  361. }
  362. .comfirm-box {
  363. margin-top: 52rpx;
  364. display: flex;
  365. // margin-bottom: 32rpx;
  366. // justify-content: space-around;
  367. .cancel {
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. width: 197rpx;
  372. height: 74rpx;
  373. border: 1px solid #dcc786;
  374. border-radius: 38rpx;
  375. font-size: 32rpx;
  376. color: #605128;
  377. }
  378. .comfirm {
  379. margin-left: 32rpx;
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. width: 197rpx;
  384. height: 74rpx;
  385. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  386. border-radius: 38px;
  387. font-size: 32rpx;
  388. color: #605128;
  389. }
  390. }
  391. }
  392. }
  393. .popup {
  394. width: 560rpx;
  395. padding-bottom: 45rpx;
  396. background-color: #ffffff;
  397. border-radius: 15rpx;
  398. text-align: center;
  399. line-height: 1;
  400. .popup-dox {
  401. position: relative;
  402. .popup-logo {
  403. margin: -160rpx auto 0;
  404. width: 400rpx;
  405. height: 200rpx;
  406. }
  407. }
  408. .popup-title {
  409. margin-top: 85rpx;
  410. font-size: 40rpx;
  411. font-family: PingFang SC;
  412. font-weight: bold;
  413. color: #2a2a2a;
  414. text {
  415. font-size: 56rpx;
  416. color: #e83f30;
  417. }
  418. }
  419. .popup-tip {
  420. margin-top: 20rpx;
  421. font-size: 28rpx;
  422. font-family: PingFang SC;
  423. font-weight: 500;
  424. color: #8c8c8c;
  425. text {
  426. color: #e83f30;
  427. }
  428. }
  429. .popup-btn {
  430. margin: 58rpx auto 0;
  431. width: 270rpx;
  432. height: 66rpx;
  433. background: #f0c838;
  434. border-radius: 34rpx;
  435. text-align: center;
  436. line-height: 66rpx;
  437. font-size: 36rpx;
  438. font-family: Source Han Sans CN;
  439. font-weight: 500;
  440. color: #ffffff;
  441. }
  442. }
  443. .user-wrap {
  444. width: 690rpx;
  445. height: 283rpx;
  446. background: #FFFFFF;
  447. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  448. border-radius: 20rpx;
  449. margin: auto;
  450. .user-info {
  451. image {
  452. width: 120rpx;
  453. height: 120rpx;
  454. }
  455. .info-left {
  456. .kpi {
  457. text-align: center
  458. 202
  459. 00;
  460. width: 241rpx;
  461. line-height: 61rpx;
  462. background: #F5EEDE;
  463. border-radius: 30rpx 0px 0px 30rpx;
  464. }
  465. }
  466. }
  467. }
  468. .user-set {
  469. view {
  470. flex-shrink: 0;
  471. }
  472. padding: 30rpx;
  473. image {
  474. height: 40rpx;
  475. width: 40rpx;
  476. }
  477. }
  478. </style>