index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. <template>
  2. <div class="my">
  3. <!-- <van-nav-bar title="我的" class="van-nav-bar-my-fixed" fixed /> -->
  4. <!-- right-text="登出"
  5. -->
  6. <div class="mine-resume">
  7. <div class="bgImg">
  8. <img src="@/assets/images/my/personal/bgImg.png" alt="" />
  9. </div>
  10. <div class="my-info">
  11. <img src="@/assets/images/my/personal/my-info.png" alt="" />
  12. <div class="mine-resume-main">
  13. <ul class="clear headerBox">
  14. <div class="headerImg">
  15. <img :src="header" alt="" />
  16. <div class="header-info">
  17. <p>欢迎您!</p>
  18. <span>尊敬的金卡用户</span>
  19. </div>
  20. </div>
  21. <div class="headerDesc">
  22. <li v-if="userData === null">
  23. <p class="title"><span>登录</span></p>
  24. </li>
  25. <li v-else class="usable">
  26. <span>有效期至{{ userData.expiretime }}</span>
  27. </li>
  28. <li class="header-username">
  29. <span>NO:{{ username }}</span>
  30. </li>
  31. </div>
  32. </ul>
  33. </div>
  34. </div>
  35. <div class="top">
  36. <!-- 我的页面下待收,待发、售后盒子 -->
  37. <p>我的订单</p>
  38. <ul class="cell-vip">
  39. <li
  40. v-for="(item, index) in cellVip"
  41. :key="item.name + index"
  42. class="vip-item"
  43. @click="showT(index)"
  44. >
  45. <img class="cell-my-img" :src="item.id" alt="" />
  46. <span class="vip-title">{{ item.name }}</span>
  47. </li>
  48. </ul>
  49. </div>
  50. <div class="bottom">
  51. <p class="common">常用功能</p>
  52. <div class="cell-list">
  53. <div
  54. class="box-detaile"
  55. is-link
  56. v-for="(item, index) in cellList"
  57. :key="item.name + index"
  58. @click="goto(item.anchor, item.name)"
  59. >
  60. <div class="detaile-box">
  61. <div class="cell-my-img">
  62. <img :src="item.id" alt="" />
  63. </div>
  64. <div class="custom-title">
  65. {{ item.name }}
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="my-btn-main">
  71. <!-- <van-button
  72. class="my-button"
  73. block
  74. type="info"
  75. @click.native="logout()"
  76. >
  77. 退出登录
  78. </van-button> -->
  79. <div class="footer">
  80. <img src="@/assets/images/my/footer.png" />
  81. </div>
  82. <div style="height: 50px"></div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. import asyncRequest from "@/apis/my/index";
  90. import resToken from "@/mixins/resToken";
  91. import { Dialog } from "vant";
  92. export default {
  93. mixins: [resToken],
  94. data() {
  95. return {
  96. header: require("@/assets/images/my/header.png"), //用户头像
  97. userData: null,
  98. active: require("@/assets/images/my/menu.png"),
  99. ad: require("@/assets/images/my/ad.png"), //地理定位
  100. order: require("@/assets/images/my/my-order.png"), //用户订单
  101. unshipped: require("@/assets/images/my/unshipped.png"), //待发货
  102. shipped: require("@/assets/images/my/shipped.png"), //待收货
  103. service: require("@/assets/images/my/service.png"), //客户服务
  104. vip_bg: require("@/assets/images/my/vip_bg.png"), //vip盒子背景图
  105. vip_text: require("@/assets/images/my/vip_text.png"), //vip
  106. saleAfter: require("@/assets/images/my/saleAfter.png"), //售后服务
  107. loading: false,
  108. cellList: [],
  109. cellVip: [],
  110. canStockBag: "",
  111. canStockBox: "",
  112. username: "",
  113. };
  114. },
  115. async created() {
  116. this.cellList = [
  117. {
  118. anchor: "/address",
  119. id: this.ad,
  120. name: "我的地址",
  121. },
  122. {
  123. anchor: "/order",
  124. id: this.order,
  125. name: "历史订单",
  126. },
  127. {
  128. anchor: "/referMenu",
  129. id: this.active,
  130. name: "推荐菜谱",
  131. },
  132. {
  133. anchor: "/aboutUs",
  134. id: this.service,
  135. name: "联系我们",
  136. },
  137. ];
  138. // await this.getUserInfor();
  139. this.cellVip = [
  140. {
  141. anchor: "/address",
  142. id: this.unshipped,
  143. name: "待发货",
  144. },
  145. {
  146. anchor: "/order",
  147. id: this.shipped,
  148. name: "待收货",
  149. },
  150. {
  151. anchor: "/referMenu",
  152. id: this.saleAfter,
  153. name: "售后",
  154. },
  155. ];
  156. },
  157. mounted() {
  158. this.getStock();
  159. },
  160. methods: {
  161. goto(url, name) {
  162. window.vm.$router.push({
  163. path: url,
  164. query: {
  165. type: name,
  166. },
  167. });
  168. },
  169. async getStock() {
  170. if (!this.loading) {
  171. let res = await asyncRequest.detail({});
  172. if (res && res.code == 0) {
  173. this.userData = res.data;
  174. this.username = res.data.username;
  175. } else if (res && res.code >= 100 && res.code <= 104) {
  176. await this.logout();
  177. } else {
  178. this.show_title(res.msg);
  179. }
  180. }
  181. },
  182. showT(index) {
  183. console.log(index);
  184. if (index === 2) {
  185. // Dialog.alert({
  186. // message: "敬请期待!",
  187. // }).then(async () => {});
  188. window.vm.$router.push({
  189. path: "/referMenu",
  190. query: {
  191. type: "售后",
  192. },
  193. });
  194. } else {
  195. window.vm.$router.push({
  196. path: "/order",
  197. query: {
  198. type: index + 1 + "",
  199. },
  200. });
  201. }
  202. },
  203. },
  204. };
  205. </script>
  206. <style lang="scss" scoped>
  207. .my {
  208. position: relative;
  209. width: 100%;
  210. height: 100%;
  211. .mine-resume {
  212. padding-top: 46px;
  213. position: relative;
  214. box-sizing: border-box;
  215. width: 100%;
  216. height: 100vh;
  217. background: #e6e6dc;
  218. .mine-resume-main {
  219. // background:linear-gradient(0deg, rgba(255,255,255,.1) 0%, #fff 80%);;
  220. // background-color: #fff;
  221. padding: 0 0;
  222. // margin: -19vh 0 0 0;
  223. left: 10px;
  224. top: 20px;
  225. position: absolute;
  226. ul {
  227. background: transparent;
  228. li {
  229. float: left;
  230. &:first-child {
  231. width: calc(100% - 60px);
  232. p {
  233. width: 188px;
  234. padding: 0 16px 0 0;
  235. margin: 0;
  236. color: #daad70;
  237. // color: #1a1a1a;
  238. font-size: 12px;
  239. line-height: 16px;
  240. color: #999999;
  241. &.title {
  242. color: #daad70;
  243. // color: #1a1a1a;
  244. font-weight: bolder;
  245. font-size: 16px;
  246. height: 100px;
  247. line-height: 21px;
  248. padding: 0 16px 0 0;
  249. }
  250. }
  251. }
  252. &:last-child {
  253. // width: 60px;
  254. text-align: center;
  255. margin: 0 0 0 0;
  256. }
  257. }
  258. }
  259. .headerBox {
  260. width: 80vw;
  261. margin: 0px auto;
  262. }
  263. .headerImg {
  264. width: 47.5px;
  265. height: 47.5px;
  266. border-radius: 50%;
  267. // position: absolute;
  268. // left: 35px;
  269. // top: 20px;
  270. img {
  271. width: 100%;
  272. border-radius: 50%;
  273. }
  274. .header-info {
  275. width: 86px;
  276. height: 29.5px;
  277. float: left;
  278. margin: -43px 0 0 60px;
  279. // position: absolute;
  280. // left: 55px;
  281. // top: 7px;
  282. p {
  283. margin: 0;
  284. // width: 74px;
  285. height: 15px;
  286. font-size: 15px;
  287. font-family: Source Han Sans CN;
  288. font-weight: 500;
  289. color: #5c3501;
  290. line-height: 15px;
  291. opacity: 0.8;
  292. }
  293. span {
  294. color: #5c3501;
  295. }
  296. }
  297. }
  298. .headerDesc {
  299. width: 90vw;
  300. overflow: hidden;
  301. display: flex;
  302. height: 19px;
  303. margin: 0 0 0 -10px;
  304. .usable {
  305. // width: 188px;
  306. // height: 19px;
  307. margin: 0 5px 0 0;
  308. width: 52vw;
  309. font-size: 0.5rem;
  310. font-family: Source Han Sans CN;
  311. font-weight: 400;
  312. color: #5c3501;
  313. line-height: 10px;
  314. height: 13px;
  315. // position: absolute;
  316. overflow: hidden;
  317. left: 30px;
  318. top: 110px;
  319. }
  320. .header-username {
  321. margin: 0 0px 0 10px;
  322. font-size: 0.5rem;
  323. font-family: Source Han Sans CN;
  324. font-weight: 500;
  325. color: #5c3501;
  326. line-height: 10px;
  327. height: 10px;
  328. // position: absolute;
  329. left: 235px;
  330. top: 110px;
  331. }
  332. }
  333. }
  334. /**vip开通框 */
  335. .vip-box {
  336. width: 100%;
  337. height: 50px;
  338. position: relative;
  339. .vip-bg {
  340. border-top-left-radius: 13px;
  341. border-top-right-radius: 13px;
  342. width: 80%;
  343. height: 49px;
  344. position: absolute;
  345. left: 50%;
  346. transform: translateX(-50%);
  347. background-color: #292f46;
  348. img {
  349. width: 44px;
  350. height: 19px;
  351. display: block;
  352. position: absolute;
  353. left: 26px;
  354. top: 18px;
  355. }
  356. }
  357. .vip-text {
  358. width: 100px;
  359. img {
  360. width: 100%;
  361. }
  362. }
  363. }
  364. .my-btn-main {
  365. width: 321.5px;
  366. margin: 40px auto 0;
  367. box-sizing: border-box;
  368. // .my-button {
  369. // box-sizing: border-box;
  370. // display: inline-block;
  371. // border-radius: 20px;
  372. // background: #dbdbdb;
  373. // border: 0;
  374. // }
  375. .footer {
  376. width: 321.5px;
  377. height: 95px;
  378. img {
  379. width: 100%;
  380. }
  381. }
  382. }
  383. // <!-- 我的页面下待收,待发、售后盒子 -->
  384. .top {
  385. width: 100%;
  386. padding: 0 20px;
  387. box-sizing: border-box;
  388. background: #e6e6dc;
  389. margin: 0vh 0 0 0;
  390. // height:140px;
  391. p {
  392. width: 64.5px;
  393. height: 15px;
  394. font-size: 16px;
  395. font-family: Source Han Sans CN;
  396. font-weight: 400;
  397. color: #242424;
  398. line-height: 13px;
  399. }
  400. .vip-box {
  401. height: 70px;
  402. background-color: #292f46;
  403. border-radius: 15px;
  404. border-bottom-left-radius: 0;
  405. border-bottom-right-radius: 0;
  406. padding: 13px 13px;
  407. box-sizing: border-box;
  408. img {
  409. display: inline-block;
  410. height: 23px;
  411. }
  412. .open-btn {
  413. background: linear-gradient(90deg, #dfa460 0%, #f0d0a1 100%);
  414. border-radius: 10px;
  415. float: right;
  416. color: #fff;
  417. line-height: 18px;
  418. padding: 3px 8px;
  419. }
  420. }
  421. }
  422. /**vip服务区域样式 */
  423. .cell-vip {
  424. // width: 331px;
  425. height: 81px;
  426. background: #fcfcf0;
  427. border-radius: 16px;
  428. padding: 10px 0px 20px 0;
  429. height: 50px;
  430. display: flex;
  431. margin: 0 0 0 0px;
  432. .cell-my-img {
  433. display: block;
  434. width: 45px;
  435. height: 45px;
  436. }
  437. .vip-title {
  438. display: inline-block;
  439. height: 10px;
  440. line-height: 20px;
  441. font-family: Source Han Sans CN;
  442. font-weight: 400;
  443. color: #8a8a8a;
  444. }
  445. .vip-item {
  446. height: 45px;
  447. display: inline-block;
  448. flex: 1;
  449. text-align: center;
  450. font-size: 12px;
  451. color: #4d4d4d;
  452. line-height: 6px;
  453. text-align: center;
  454. img {
  455. width: 45px;
  456. height: 45px;
  457. display: inline-block;
  458. }
  459. span {
  460. height: 16px;
  461. display: block;
  462. }
  463. }
  464. }
  465. }
  466. .common {
  467. margin: 10px;
  468. width: 110px;
  469. height: 26px;
  470. font-size: 14px;
  471. font-weight: 600;
  472. color: #333333;
  473. line-height: 26px;
  474. position: relative;
  475. top: 0;
  476. left: 0;
  477. padding: 8px 0px 8px 15px;
  478. }
  479. .bottom {
  480. width: 100vw;
  481. box-sizing: border-box;
  482. background: #e6e6dc;
  483. margin: 0 0 0 0;
  484. p {
  485. margin: 0;
  486. }
  487. /**地址栏收获样式 */
  488. .cell-list {
  489. padding: 0 20px;
  490. height: 81px;
  491. background: #fcfcf0;
  492. border-radius: 16px;
  493. padding: 10px 0px;
  494. height: 50px;
  495. display: -webkit-box;
  496. display: -ms-flexbox;
  497. display: flex;
  498. margin: 0 20px;
  499. .van-cell__title {
  500. width: 200px;
  501. position: relative;
  502. left: 0;
  503. top: 0;
  504. text-align: center;
  505. img {
  506. margin: 0 40px;
  507. }
  508. }
  509. .box-detaile {
  510. flex: 1;
  511. text-align: center;
  512. .detaile-box {
  513. width: 20vw;
  514. margin: 0 auto;
  515. text-align: center;
  516. .cell-my-img {
  517. height: 25px;
  518. width: 100%;
  519. overflow: hidden;
  520. img {
  521. display: inline-block;
  522. height: 25px;
  523. width: auto;
  524. margin: 0 auto;
  525. }
  526. }
  527. .custom-title {
  528. margin-top: 8px;
  529. }
  530. }
  531. }
  532. }
  533. }
  534. //常用功能下的按钮
  535. // 改
  536. .bgImg {
  537. width: 100%;
  538. height: 246px;
  539. position: absolute;
  540. top: 0px;
  541. img {
  542. width: 100%;
  543. }
  544. }
  545. .my-info {
  546. width: 90vw;
  547. // float: left;
  548. position: relative;
  549. left: 0;
  550. top: 0;
  551. margin: 15vh auto 0;
  552. img {
  553. position: relative;
  554. width: 100%;
  555. }
  556. }
  557. @media screen and (min-width: 320px) {
  558. .mine-resume .mine-resume-main .headerDesc {
  559. margin-top: 27px;
  560. }
  561. }
  562. @media screen and (min-width: 375px) {
  563. .mine-resume .mine-resume-main .headerDesc {
  564. margin-top: 53px;
  565. margin: 53px 0 0 5px;
  566. }
  567. }
  568. @media screen and (min-width: 414px) {
  569. .mine-resume .mine-resume-main .headerDesc {
  570. margin-top: 53px;
  571. margin: 66px 0 0 5px;
  572. }
  573. }
  574. }
  575. </style>