index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.com/shop/images/footprint.png" mode=""></image>
  98. <text class="text">我的足迹</text>
  99. </view>
  100. <view class="item no-marin-bottom" @click="openH5('userRegister')">
  101. <image src="https://kntobs.jnmyunl.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('userPrivacy')">
  105. <image src="https://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.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://kntobs.jnmyunl.com/shop/images/qualification.png" mode=""></image>
  123. <text class="text">资质证书</text>
  124. </view>
  125. <!-- <view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
  126. <image
  127. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  128. mode=""></image>
  129. <text class="text">直播</text>
  130. </view>
  131. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/live/order')">
  132. <image
  133. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/live.png"
  134. mode=""></image>
  135. <text class="text">直播订单</text>
  136. </view> -->
  137. <view class="item no-marin-bottom" @click="toManager()">
  138. <image src="https://kntobs.jnmyunl.com/shop/images/products_icon.png" mode=""></image>
  139. <text class="text">制单管理</text>
  140. </view>
  141. <!-- <view class="item no-marin-bottom" @click="toManagerCourse()">
  142. <image src="https://kntobs.jnmyunl.com/shop/images/sale_file.png" mode=""></image>
  143. <text class="text">销售管理</text>
  144. </view> -->
  145. </view>
  146. </view>
  147. </view>
  148. <!-- <view class="banner">
  149. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  150. <view class="tel_btn" @click="callService()"></view>
  151. </view> -->
  152. <!-- 退出登录按钮 -->
  153. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  154. <view @tap="loginOUt" class="log-out x-c" >退出登录</view>
  155. </view>
  156. <view class="like-product">
  157. <likeProduct ref="product" />
  158. </view>
  159. </view>
  160. </view>
  161. <floating-customer-service></floating-customer-service>
  162. </view>
  163. </template>
  164. <script>
  165. import {getOrderCount} from '@/api/storeOrder'
  166. import {getUserInfo} from '@/api/user'
  167. import likeProduct from '@/components/likeProduct.vue'
  168. import FloatingCustomerService from "@/components/FloatingCustomerService/index.vue"
  169. export default {
  170. components: {
  171. likeProduct,
  172. FloatingCustomerService
  173. },
  174. data() {
  175. return {
  176. count0:0,
  177. count1:0,
  178. count2:0,
  179. afterSalesCount:0,
  180. user:{
  181. isPromoter:0,
  182. isWeixinAuth:0,
  183. phone:"",
  184. nickname:"用户昵称",
  185. avatarUrl:"https://kntobs.jnmyunl.com/shop/images/detault_head.png"
  186. },
  187. // 状态栏的高度
  188. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  189. // 消息数量
  190. msgNum: 0,
  191. UserInfo:uni.getStorageSync('AppToken')
  192. };
  193. },
  194. watch: {
  195. UserInfo() {
  196. return uni.getStorageSync('AppToken')
  197. }
  198. },
  199. onLoad() {
  200. console.log("onload")
  201. },
  202. onShow() {
  203. console.log("onshow")
  204. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  205. if(this.UserInfo){
  206. this.getUserInfo()
  207. }else{
  208. // this.isuser=true
  209. }
  210. // this.getUserInfo();
  211. // this.getOrderCount();
  212. },
  213. onReachBottom() {
  214. console.log("onReachBottom")
  215. this.$refs.product.getGoodsProducts();
  216. },
  217. methods: {
  218. callService(){
  219. let orderKey='5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  220. uni.navigateTo({
  221. url: '/pages_company/order/confirmOrder?orderKey='+orderKey
  222. })
  223. return;
  224. uni.makePhoneCall({
  225. phoneNumber:"4000717770",
  226. success:function(){
  227. console.log('拨打电话成功');
  228. },
  229. fail() {
  230. console.log('打电话失败了');
  231. }
  232. })
  233. },
  234. getOrderCount(){
  235. getOrderCount().then(
  236. res => {
  237. if(res.code==200){
  238. this.count0=res.count0;
  239. this.count1=res.count1;
  240. this.count2=res.count2;
  241. this.afterSalesCount=res.afterSalesCount;
  242. }
  243. },
  244. rej => {}
  245. );
  246. },
  247. toManager(){
  248. if(this.utils.checkCompanyUserLoginState()){
  249. uni.navigateTo({
  250. url: '/pages_company/index'
  251. })
  252. }
  253. else{
  254. uni.navigateTo({
  255. url: '/pages_company/auth/login'
  256. })
  257. }
  258. },
  259. toManagerCourse(){
  260. if(uni.getStorageSync('ManageToken')){
  261. uni.navigateTo({
  262. url: '/pages_manage/index'
  263. })
  264. }
  265. else{
  266. uni.navigateTo({
  267. url: '/pages_manage/login'
  268. })
  269. }
  270. },
  271. openH5(url){
  272. var requestPath = uni.getStorageSync('requestPath');
  273. uni.setStorageSync('url',requestPath+url);
  274. uni.navigateTo({
  275. url: '../home/h5?name='+url
  276. })
  277. },
  278. getUserInfo(){
  279. getUserInfo().then(
  280. res => {
  281. if(res.code==200){
  282. if(res.user!=null){
  283. this.user=res.user;
  284. }
  285. else{
  286. this.utils.loginOut();
  287. }
  288. }else{
  289. uni.showToast({
  290. icon:'none',
  291. title: "请求失败",
  292. });
  293. }
  294. },
  295. rej => {}
  296. );
  297. },
  298. // 跳转页面
  299. navgetTo(url) {
  300. this.utils.isLogin().then(res => {
  301. if(res){
  302. uni.navigateTo({
  303. url: url
  304. })
  305. }
  306. })
  307. },
  308. // 查看订单
  309. showOrder(status) {
  310. uni.navigateTo({
  311. url: '/pages_user/user/storeOrder?status=' + status
  312. })
  313. },
  314. loginOUt(){
  315. this.utils.loginOut();
  316. this.getUserInfo();
  317. }
  318. }
  319. }
  320. </script>
  321. <style lang="scss" scoped>
  322. .top-cont{
  323. width: 100%;
  324. height: 494upx;
  325. position: relative;
  326. background-image: url(https://kntobs.jnmyunl.com/shop/images/personl_top_bg.png);
  327. background-repeat: repeat-x;
  328. background-size: 40upx 100%;
  329. .top-inner{
  330. width: 100%;
  331. height: 100%;
  332. position: absolute;
  333. top: 0;
  334. left: 0;
  335. z-index: 2;
  336. .user-info{
  337. padding: 88upx 30upx 0 30upx;
  338. display: flex;
  339. align-items: center;
  340. justify-content: space-between;
  341. .left{
  342. position: relative;
  343. display: flex;
  344. .head-img{
  345. width: 120upx;
  346. height: 120upx;
  347. border-radius: 50%;
  348. overflow: hidden;
  349. margin-right: 30upx;
  350. border: 4upx solid #FFFFFF;
  351. box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  352. image{
  353. width: 100%;
  354. height: 100%;
  355. }
  356. }
  357. .name-phone{
  358. padding-top: 15upx;
  359. .name{
  360. font-size: 40upx;
  361. font-family: PingFang SC;
  362. font-weight: bold;
  363. color: #111111;
  364. line-height: 1;
  365. }
  366. .phone{
  367. font-size: 28upx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #666666;
  371. line-height: 1;
  372. margin-top: 30upx;
  373. }
  374. }
  375. }
  376. .right{
  377. display: flex;
  378. align-items: center;
  379. justify-content: center;
  380. .msg-box{
  381. margin-left: 10upx;
  382. width: 44upx;
  383. height: 44upx;
  384. image{
  385. width: 100%;
  386. height: 100%;
  387. }
  388. }
  389. .set{
  390. width: 44upx;
  391. height: 44upx;
  392. image{
  393. width: 100%;
  394. height: 100%;
  395. }
  396. }
  397. }
  398. }
  399. .my-order{
  400. padding: 50upx 20upx 0;
  401. .inner{
  402. box-sizing: border-box;
  403. height: 245upx;
  404. // height: 105upx;
  405. background: #FFFFFF;
  406. border-radius: 16upx;
  407. padding: 40upx 30upx;
  408. display: flex;
  409. flex-direction: column;
  410. justify-content: space-between;
  411. .title-box{
  412. display: flex;
  413. align-items: center;
  414. justify-content: space-between;
  415. .title{
  416. font-size: 34upx;
  417. font-family: PingFang SC;
  418. font-weight: bold;
  419. color: #222222;
  420. line-height: 1;
  421. }
  422. .all-order{
  423. display: flex;
  424. align-items: center;
  425. .text{
  426. font-size: 26upx;
  427. font-family: PingFang SC;
  428. font-weight: 500;
  429. color: #999999;
  430. line-height: 1;
  431. margin-right: 8upx;
  432. }
  433. image{
  434. width: 14upx;
  435. height: 24upx;
  436. }
  437. }
  438. }
  439. .status-box{
  440. display: flex;
  441. align-items: center;
  442. justify-content: space-between;
  443. padding: 0 10upx;
  444. .item{
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. justify-content: center;
  449. image{
  450. width: 40upx;
  451. height: 40upx;
  452. margin-bottom: 18upx;
  453. }
  454. .text{
  455. font-size: 26upx;
  456. font-family: PingFang SC;
  457. font-weight: 500;
  458. color: #111111;
  459. line-height: 1;
  460. }
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. .content{
  468. margin-top: 20upx;
  469. padding: 0 20upx;
  470. display: flex;
  471. align-items: center;
  472. justify-content: center;
  473. .used-tools{
  474. box-sizing: border-box;
  475. background: #FFFFFF;
  476. border-radius: 16upx;
  477. padding: 40upx 30upx;
  478. .title{
  479. font-size: 34upx;
  480. font-family: PingFang SC;
  481. font-weight: bold;
  482. color: #222222;
  483. line-height: 1;
  484. }
  485. .tools-list{
  486. margin-top: 50upx;
  487. display: flex;
  488. flex-wrap: wrap;
  489. width: 100%;
  490. .item{
  491. box-sizing: border-box;
  492. width: 25%;
  493. display: flex;
  494. flex-direction: column;
  495. align-items: center;
  496. justify-content: center;
  497. margin-bottom: 50upx;
  498. position: relative;
  499. image{
  500. width: 44upx;
  501. height: 44upx;
  502. }
  503. .text{
  504. font-size: 24upx;
  505. font-family: PingFang SC;
  506. font-weight: 500;
  507. color: #111111;
  508. line-height: 1;
  509. margin-top: 20upx;
  510. }
  511. .contact-btn{
  512. display: inline-block;
  513. position: absolute;
  514. top: 0;
  515. left: 0;
  516. width: 100%;
  517. height: 100%;
  518. opacity: 0;
  519. }
  520. }
  521. }
  522. }
  523. }
  524. .log-out{
  525. height: 80upx;
  526. line-height: 80upx;
  527. text-align: center;
  528. font-size: 26upx;
  529. font-family: PingFang SC;
  530. font-weight: 500;
  531. color: #666666;
  532. background: #FFFFFF;
  533. border-radius: 16upx;
  534. margin-top: 20upx;
  535. }
  536. .sub-btn{
  537. position: absolute;
  538. width: 100%;
  539. height: 100%;
  540. opacity: 0;
  541. }
  542. .like-product{
  543. padding: 0 20rpx;
  544. }
  545. .banner{
  546. padding: 20rpx 20rpx 0rpx 20rpx;
  547. height: 200rpx;
  548. position: relative;
  549. display: flex;
  550. align-items: center;
  551. justify-content: center;
  552. image{
  553. width:100%;
  554. height: 100%;
  555. }
  556. .tel_btn{
  557. width: 100%;
  558. height: 100%;
  559. top:0upx;
  560. position: absolute;
  561. opacity:0.0;
  562. }
  563. }
  564. .log-out{
  565. height: 100rpx;line-height: 100rpx;
  566. margin: 10px;
  567. border-radius: 20rpx;
  568. }
  569. </style>