index.vue 15 KB

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