index.vue 16 KB

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