index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <view class="top-inner">
  5. <!-- 这里是状态栏 -->
  6. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  7. <view class="user-info">
  8. <view class="left">
  9. <view class="head-img">
  10. <image
  11. :src="user.avatar==null?'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/detault_head.jpg':user.avatar"
  12. mode="aspectFill"></image>
  13. </view>
  14. <view class="name-phone" v-if="UserInfo">
  15. <view class="name">{{user.nickname}}
  16. <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1">会员</text>
  17. <text class="fs24 ml12 mb20 " style="color: #666;" v-else>非会员</text>
  18. </view>
  19. <view class="phone">{{utils.parsePhone(user.phone)}}</view>
  20. </view>
  21. <view class="fs40 bold name-phone center " @click='getOrderCount()' v-else>立即登录</view>
  22. </view>
  23. <view class="right">
  24. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  25. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  26. <image
  27. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/icon-set.png"
  28. mode=""></image>
  29. </view>
  30. </uni-badge>
  31. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  32. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  33. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/icon-msg.png" mode=""></image>
  34. </view>
  35. </uni-badge> -->
  36. </view>
  37. </view>
  38. <!-- 我的订单 -->
  39. <view class="my-order" v-if="user.isShow==1">
  40. <view class="inner">
  41. <view class="title-box">
  42. <text class="title">我的订单</text>
  43. <view class="all-order" @click="showOrder('')">
  44. <text class="text">全部订单</text>
  45. <image
  46. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/arrow4.png"
  47. mode=""></image>
  48. </view>
  49. </view>
  50. <view class="status-box">
  51. <uni-badge size="small" :text=count0 absolute="rightTop" type="error">
  52. <view class="item" @click="showOrder('0')">
  53. <image
  54. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/payment.png"
  55. mode=""></image>
  56. <text class="text">待付款</text>
  57. </view>
  58. </uni-badge>
  59. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  60. <view class="item" @click="showOrder('1')">
  61. <image
  62. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/send_goods.png"
  63. mode=""></image>
  64. <text class="text">待发货</text>
  65. </view>
  66. </uni-badge>
  67. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  68. <view class="item" @click="showOrder('2')">
  69. <image
  70. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sou_goods.png"
  71. mode=""></image>
  72. <text class="text">待收货</text>
  73. </view>
  74. </uni-badge>
  75. <view class="item" @click="showOrder('3')">
  76. <image
  77. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/completed.png"
  78. mode=""></image>
  79. <text class="text">已完成</text>
  80. </view>
  81. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  82. <view class="item" @click="navgetTo('/pages_user/user/refundOrderList')">
  83. <image
  84. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/after_sales.png"
  85. mode=""></image>
  86. <text class="text">售后/退款</text>
  87. </view>
  88. </uni-badge>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="content">
  93. <!-- 常用工具 -->
  94. <view class="used-tools">
  95. <view class="title">常用工具</view>
  96. <view class="tools-list">
  97. <view class="item" @click="navgetTo('/pages_user/user/address')" v-if="user.isShow==1">
  98. <image
  99. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/address.png"
  100. mode=""></image>
  101. <text class="text">收货地址</text>
  102. </view>
  103. <!-- <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integral')">
  104. <image
  105. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  106. mode=""></image>
  107. <text class="text">积分管理</text>
  108. </view> -->
  109. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/shopping/myCoupon')">
  110. <image
  111. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/mycoupon.png"
  112. mode=""></image>
  113. <text class="text">优惠券</text>
  114. </view>
  115. <view class="item no-marin-bottom"
  116. @click="navgetTo('/pages_user/user/storeProductRelation')">
  117. <image
  118. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/footprint.png"
  119. mode=""></image>
  120. <text class="text">我的足迹</text>
  121. </view>
  122. <view class="item no-marin-bottom">
  123. <image
  124. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/customer1.png"
  125. mode=""></image>
  126. <text class="text">专属客服</text>
  127. <button class="contact-btn" open-type="contact"></button>
  128. </view>
  129. <!-- <view v-if="user.isPromoter==0" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTuiAdd')">
  130. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/my_promotion.png" mode=""></image>
  131. <text class="text">申请百域大使</text>
  132. </view> -->
  133. <!-- <view v-if="user.isPromoter==1" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTui')">
  134. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/my_promotion.png" mode=""></image>
  135. <text class="text">我的推广</text>
  136. </view> -->
  137. <!-- <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  138. <image
  139. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/qualification.png"
  140. mode=""></image>
  141. <text class="text">资质证书</text>
  142. </view> -->
  143. <!-- v-if="user.bindCompanyUserId" -->
  144. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/live/order')">
  145. <image
  146. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/live.png"
  147. mode=""></image>
  148. <text class="text">直播订单</text>
  149. </view>
  150. <!-- 销售可见 -->
  151. <!-- <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="toManager()">
  152. <image
  153. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/products_icon.png"
  154. mode=""></image>
  155. <text class="text">制单管理</text>
  156. </view>
  157. <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="toManagerCourse()">
  158. <image
  159. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sale_file.png"
  160. mode=""></image>
  161. <text class="text">销售管理</text>
  162. </view> -->
  163. <!-- <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="openH5('/store/h5/userAgreement')">
  164. <image
  165. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/service_file.png"
  166. mode=""></image>
  167. <text class="text">用户协议</text>
  168. </view>
  169. <view v-if="user.bindCompanyUserId" class="item no-marin-bottom align-top" @click="openH5('/store/h5/privacyPolicy')">
  170. <image
  171. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/advice.png"
  172. mode=""></image>
  173. <text class="text">隐私保护</text>
  174. </view> -->
  175. <!-- 测试用下面的 -->
  176. <view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
  177. <image
  178. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  179. mode=""></image>
  180. <text class="text">直播</text>
  181. </view>
  182. <view class="item no-marin-bottom" @click="toManager()">
  183. <image
  184. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/products_icon.png"
  185. mode=""></image>
  186. <text class="text">制单管理</text>
  187. </view>
  188. <view class="item no-marin-bottom" @click="toManagerCourse()">
  189. <image
  190. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sale_file.png"
  191. mode=""></image>
  192. <text class="text">销售管理</text>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. <!-- <view class="banner">
  198. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  199. <view class="tel_btn" @click="callService()"></view>
  200. </view> -->
  201. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  202. <view @tap="loginOUt" class="log-out x-c">退出登录</view>
  203. </view>
  204. <view class="like-product">
  205. <likeProduct ref="product" />
  206. </view>
  207. <!-- 退出登录按钮 -->
  208. </view>
  209. <Server />
  210. </view>
  211. </view>
  212. </template>
  213. <script>
  214. import {
  215. getOrderCount
  216. } from '@/api/storeOrder'
  217. import {
  218. getUserInfo
  219. } from '@/api/user'
  220. import likeProduct from '@/components/likeProduct.vue'
  221. import Server from '@/components/Server.vue'
  222. export default {
  223. components: {
  224. likeProduct,
  225. Server
  226. },
  227. data() {
  228. return {
  229. count0: 0,
  230. count1: 0,
  231. count2: 0,
  232. afterSalesCount: 0,
  233. user: {
  234. isPromoter: 0,
  235. isWeixinAuth: 0,
  236. phone: "",
  237. nickname: "用户昵称",
  238. avatarUrl: "https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/detault_head.png"
  239. },
  240. // 状态栏的高度
  241. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  242. // 消息数量
  243. msgNum: 0,
  244. UserInfo: uni.getStorageSync('AppToken')
  245. };
  246. },
  247. watch: {
  248. UserInfo() {
  249. return uni.getStorageSync('AppToken')
  250. }
  251. },
  252. onLoad() {
  253. console.log("onload")
  254. },
  255. onShow() {
  256. console.log("onshow")
  257. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  258. if (this.UserInfo) {
  259. this.getUserInfo()
  260. } else {
  261. // this.isuser=true
  262. }
  263. // this.getUserInfo();
  264. // this.getOrderCount();
  265. },
  266. onReachBottom() {
  267. console.log("onReachBottom")
  268. this.$refs.product.getGoodsProducts();
  269. },
  270. computed: {
  271. imgPath() {
  272. return this.$store.state.imgpath
  273. },
  274. },
  275. methods: {
  276. callService() {
  277. let orderKey = '5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  278. uni.navigateTo({
  279. url: '/pages_company/order/confirmOrder?orderKey=' + orderKey
  280. })
  281. return;
  282. uni.makePhoneCall({
  283. phoneNumber: "4000717770",
  284. success: function() {
  285. console.log('拨打电话成功');
  286. },
  287. fail() {
  288. console.log('打电话失败了');
  289. }
  290. })
  291. },
  292. getOrderCount() {
  293. getOrderCount().then(
  294. res => {
  295. if (res.code == 200) {
  296. this.count0 = res.count0;
  297. this.count1 = res.count1;
  298. this.count2 = res.count2;
  299. this.afterSalesCount = res.afterSalesCount;
  300. }
  301. },
  302. rej => {}
  303. );
  304. },
  305. toManager() {
  306. if (this.utils.checkCompanyUserLoginState()) {
  307. uni.navigateTo({
  308. url: '/pages_company/index'
  309. })
  310. } else {
  311. uni.navigateTo({
  312. url: '/pages_company/auth/login'
  313. })
  314. }
  315. },
  316. toManagerCourse() {
  317. if (uni.getStorageSync('ManageToken')) {
  318. uni.navigateTo({
  319. url: '/pages_manage/index'
  320. })
  321. } else {
  322. uni.navigateTo({
  323. url: '/pages_manage/login'
  324. })
  325. }
  326. },
  327. openH5(url) {
  328. var requestPath = uni.getStorageSync('requestPath');
  329. uni.setStorageSync('url', requestPath + url);
  330. uni.navigateTo({
  331. url: '../home/h5'
  332. })
  333. },
  334. getUserInfo() {
  335. getUserInfo().then(
  336. res => {
  337. if (res.code == 200) {
  338. if (res.user != null) {
  339. this.user = res.user;
  340. } else {
  341. this.utils.loginOut();
  342. }
  343. } else {
  344. uni.showToast({
  345. icon: 'none',
  346. title: "请求失败",
  347. });
  348. }
  349. },
  350. rej => {}
  351. );
  352. },
  353. // 跳转页面
  354. navgetTo(url) {
  355. this.utils.isLogin().then(res => {
  356. if (res) {
  357. uni.navigateTo({
  358. url: url
  359. })
  360. }
  361. })
  362. },
  363. // 查看订单
  364. showOrder(status) {
  365. uni.navigateTo({
  366. url: '/pages_user/user/storeOrder?status=' + status
  367. })
  368. },
  369. loginOUt() {
  370. this.utils.loginOut();
  371. uni.navigateTo({
  372. url: '/pages/auth/login'
  373. })
  374. // this.getUserInfo();
  375. }
  376. }
  377. }
  378. </script>
  379. <style lang="scss" scoped>
  380. .top-cont {
  381. width: 100%;
  382. height: 494upx;
  383. position: relative;
  384. background-image: url(https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/personl_top_bg.png);
  385. background-repeat: repeat-x;
  386. background-size: 40upx 100%;
  387. .top-inner {
  388. width: 100%;
  389. height: 100%;
  390. position: absolute;
  391. top: 0;
  392. left: 0;
  393. z-index: 2;
  394. .user-info {
  395. padding: 88upx 30upx 0 30upx;
  396. display: flex;
  397. align-items: center;
  398. justify-content: space-between;
  399. .left {
  400. position: relative;
  401. display: flex;
  402. .head-img {
  403. width: 120upx;
  404. height: 120upx;
  405. border-radius: 50%;
  406. overflow: hidden;
  407. margin-right: 30upx;
  408. border: 4upx solid #FFFFFF;
  409. box-shadow: 0px 5px 15px 2px rgba(0, 0, 0, 0.1);
  410. image {
  411. width: 100%;
  412. height: 100%;
  413. }
  414. }
  415. .name-phone {
  416. padding-top: 15upx;
  417. .name {
  418. font-size: 40upx;
  419. font-family: PingFang SC;
  420. font-weight: bold;
  421. color: #111111;
  422. line-height: 1;
  423. }
  424. .phone {
  425. font-size: 28upx;
  426. font-family: PingFang SC;
  427. font-weight: 500;
  428. color: #666666;
  429. line-height: 1;
  430. margin-top: 30upx;
  431. }
  432. }
  433. }
  434. .right {
  435. display: flex;
  436. align-items: center;
  437. justify-content: center;
  438. .msg-box {
  439. margin-left: 10upx;
  440. width: 44upx;
  441. height: 44upx;
  442. image {
  443. width: 100%;
  444. height: 100%;
  445. }
  446. }
  447. .set {
  448. width: 44upx;
  449. height: 44upx;
  450. image {
  451. width: 100%;
  452. height: 100%;
  453. }
  454. }
  455. }
  456. }
  457. .my-order {
  458. padding: 50upx 20upx 0;
  459. .inner {
  460. box-sizing: border-box;
  461. height: 245upx;
  462. // height: 105upx;
  463. background: #FFFFFF;
  464. border-radius: 16upx;
  465. padding: 40upx 30upx;
  466. display: flex;
  467. flex-direction: column;
  468. justify-content: space-between;
  469. .title-box {
  470. display: flex;
  471. align-items: center;
  472. justify-content: space-between;
  473. .title {
  474. font-size: 34upx;
  475. font-family: PingFang SC;
  476. font-weight: bold;
  477. color: #222222;
  478. line-height: 1;
  479. }
  480. .all-order {
  481. display: flex;
  482. align-items: center;
  483. .text {
  484. font-size: 26upx;
  485. font-family: PingFang SC;
  486. font-weight: 500;
  487. color: #999999;
  488. line-height: 1;
  489. margin-right: 8upx;
  490. }
  491. image {
  492. width: 14upx;
  493. height: 24upx;
  494. }
  495. }
  496. }
  497. .status-box {
  498. display: flex;
  499. align-items: center;
  500. justify-content: space-between;
  501. padding: 0 10upx;
  502. .item {
  503. display: flex;
  504. flex-direction: column;
  505. align-items: center;
  506. justify-content: center;
  507. image {
  508. width: 40upx;
  509. height: 40upx;
  510. margin-bottom: 18upx;
  511. }
  512. .text {
  513. font-size: 26upx;
  514. font-family: PingFang SC;
  515. font-weight: 500;
  516. color: #111111;
  517. line-height: 1;
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. }
  525. .content {
  526. margin-top: 20upx;
  527. padding: 0 20upx;
  528. display: flex;
  529. align-items: center;
  530. justify-content: center;
  531. .used-tools {
  532. width: 100%;
  533. box-sizing: border-box;
  534. background: #FFFFFF;
  535. border-radius: 16upx;
  536. padding: 40upx 30upx;
  537. .title {
  538. font-size: 34upx;
  539. font-family: PingFang SC;
  540. font-weight: bold;
  541. color: #222222;
  542. line-height: 1;
  543. }
  544. .tools-list {
  545. margin-top: 50upx;
  546. display: flex;
  547. flex-wrap: wrap;
  548. width: 100%;
  549. .item {
  550. box-sizing: border-box;
  551. width: 25%;
  552. display: flex;
  553. flex-direction: column;
  554. align-items: center;
  555. justify-content: center;
  556. margin-bottom: 50upx;
  557. position: relative;
  558. image {
  559. width: 44upx;
  560. height: 44upx;
  561. }
  562. .text {
  563. font-size: 24upx;
  564. font-family: PingFang SC;
  565. font-weight: 500;
  566. color: #111111;
  567. line-height: 1;
  568. margin-top: 20upx;
  569. }
  570. .contact-btn {
  571. display: inline-block;
  572. position: absolute;
  573. top: 0;
  574. left: 0;
  575. width: 100%;
  576. height: 100%;
  577. opacity: 0;
  578. }
  579. }
  580. }
  581. }
  582. }
  583. .log-out {
  584. height: 80upx;
  585. line-height: 80upx;
  586. text-align: center;
  587. font-size: 26upx;
  588. font-family: PingFang SC;
  589. font-weight: 500;
  590. color: #666666;
  591. background: #FFFFFF;
  592. border-radius: 16upx;
  593. margin-top: 20upx;
  594. }
  595. .sub-btn {
  596. position: absolute;
  597. width: 100%;
  598. height: 100%;
  599. opacity: 0;
  600. }
  601. .like-product {
  602. padding: 0 20rpx;
  603. }
  604. .banner {
  605. padding: 20rpx 20rpx 0rpx 20rpx;
  606. height: 200rpx;
  607. position: relative;
  608. display: flex;
  609. align-items: center;
  610. justify-content: center;
  611. image {
  612. width: 100%;
  613. height: 100%;
  614. }
  615. .tel_btn {
  616. width: 100%;
  617. height: 100%;
  618. top: 0upx;
  619. position: absolute;
  620. opacity: 0.0;
  621. }
  622. }
  623. .log-out {
  624. height: 100rpx;
  625. line-height: 100rpx;
  626. margin: 10px;
  627. border-radius: 20rpx;
  628. }
  629. </style>