index.vue 15 KB

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