index.vue 15 KB

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