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