index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  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?'/static/images/detault_head.jpg':user.avatar" mode="aspectFill"></image>
  11. </view>
  12. <view class="name-phone">
  13. <view class="name">{{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">
  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(1)">
  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(2)">
  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 class="log-out">退出登录</view> -->
  147. </view>
  148. <view style="padding-bottom: 20rpx; padding:20rpx" v-if="isLogin">
  149. <view @tap="loginOUt" class="log-out x-c" >退出登录</view>
  150. </view>
  151. <!-- <view class="banner">
  152. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  153. <view class="tel_btn" @click="callService()"></view>
  154. </view> -->
  155. <view class="like-product">
  156. <likeProduct ref="product" />
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </template>
  162. <script>
  163. import {getOrderCount} from '@/api/storeOrder'
  164. import {getUserInfo} from '@/api/user'
  165. import likeProduct from '@/components/likeProduct.vue'
  166. export default {
  167. components: {
  168. likeProduct
  169. },
  170. data() {
  171. return {
  172. count0:0,
  173. count1:0,
  174. count2:0,
  175. afterSalesCount:0,
  176. user:{
  177. isPromoter:0,
  178. isWeixinAuth:0,
  179. phone:"",
  180. nickname:"请登录",
  181. avatarUrl:"/static/images/detault_head.png"
  182. },
  183. // 状态栏的高度
  184. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  185. // 消息数量
  186. msgNum: 0,
  187. isLogin: false
  188. };
  189. },
  190. onLoad() {
  191. console.log("onload")
  192. },
  193. onShow() {
  194. console.log("onshow")
  195. var that=this;
  196. this.utils.isLogin().then(res => {
  197. this.isLogin = res
  198. if(res) {
  199. that.getUserInfo();
  200. that.getOrderCount();
  201. }
  202. })
  203. },
  204. onReachBottom() {
  205. console.log("onReachBottom")
  206. this.$refs.product.getGoodsProducts();
  207. },
  208. methods: {
  209. loginOUt(){
  210. this.utils.loginOut();
  211. this.getUserInfo();
  212. },
  213. openPersonInfo(){
  214. this.utils.isLogin().then(res => {
  215. uni.navigateTo({
  216. url:"/pages_user/user/personInfo"
  217. })
  218. })
  219. },
  220. callService(){
  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. openH5(type){
  257. var requestPath = uni.getStorageSync('requestPath');
  258. // uni.setStorageSync('url',requestPath+url);
  259. uni.navigateTo({
  260. url: '../home/h5?type='+type
  261. })
  262. },
  263. getUserInfo(){
  264. getUserInfo().then(
  265. res => {
  266. if(res.code==200){
  267. if(res.user!=null){
  268. this.user=res.user;
  269. }
  270. else{
  271. this.utils.loginOut();
  272. }
  273. }else{
  274. uni.showToast({
  275. icon:'none',
  276. title: "请求失败",
  277. });
  278. }
  279. },
  280. rej => {}
  281. );
  282. },
  283. // 跳转页面
  284. navgetTo(url) {
  285. this.utils.isLogin().then(res => {
  286. if(res){
  287. uni.navigateTo({
  288. url: url
  289. })
  290. }
  291. })
  292. },
  293. // 查看订单
  294. showOrder(status) {
  295. uni.navigateTo({
  296. url: '/pages_user/user/storeOrder?status=' + status
  297. })
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss">
  303. .top-cont{
  304. width: 100%;
  305. height: 494upx;
  306. position: relative;
  307. background-image: url(../../static/images/personl_top_bg.png);
  308. background-repeat: repeat-x;
  309. background-size: 40upx 100%;
  310. .top-inner{
  311. width: 100%;
  312. height: 100%;
  313. position: absolute;
  314. top: 0;
  315. left: 0;
  316. z-index: 2;
  317. .user-info{
  318. padding: 88upx 30upx 0 30upx;
  319. display: flex;
  320. align-items: center;
  321. justify-content: space-between;
  322. .left{
  323. position: relative;
  324. display: flex;
  325. .head-img{
  326. width: 120upx;
  327. height: 120upx;
  328. border-radius: 50%;
  329. overflow: hidden;
  330. margin-right: 30upx;
  331. border: 4upx solid #FFFFFF;
  332. box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  333. image{
  334. width: 100%;
  335. height: 100%;
  336. }
  337. }
  338. .name-phone{
  339. padding-top: 15upx;
  340. .name{
  341. font-size: 40upx;
  342. font-family: PingFang SC;
  343. font-weight: bold;
  344. color: #111111;
  345. line-height: 1;
  346. }
  347. .phone{
  348. font-size: 28upx;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. color: #666666;
  352. line-height: 1;
  353. margin-top: 30upx;
  354. }
  355. }
  356. }
  357. .right{
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. .msg-box{
  362. margin-left: 10upx;
  363. width: 44upx;
  364. height: 44upx;
  365. image{
  366. width: 100%;
  367. height: 100%;
  368. }
  369. }
  370. .set{
  371. width: 44upx;
  372. height: 44upx;
  373. image{
  374. width: 100%;
  375. height: 100%;
  376. }
  377. }
  378. }
  379. }
  380. .my-order{
  381. padding: 50upx 20upx 0;
  382. .inner{
  383. box-sizing: border-box;
  384. height: 245upx;
  385. background: #FFFFFF;
  386. border-radius: 16upx;
  387. padding: 40upx 30upx;
  388. display: flex;
  389. flex-direction: column;
  390. justify-content: space-between;
  391. .title-box{
  392. display: flex;
  393. align-items: center;
  394. justify-content: space-between;
  395. .title{
  396. font-size: 34upx;
  397. font-family: PingFang SC;
  398. font-weight: bold;
  399. color: #222222;
  400. line-height: 1;
  401. }
  402. .all-order{
  403. display: flex;
  404. align-items: center;
  405. .text{
  406. font-size: 26upx;
  407. font-family: PingFang SC;
  408. font-weight: 500;
  409. color: #999999;
  410. line-height: 1;
  411. margin-right: 8upx;
  412. }
  413. image{
  414. width: 14upx;
  415. height: 24upx;
  416. }
  417. }
  418. }
  419. .status-box{
  420. display: flex;
  421. align-items: center;
  422. justify-content: space-between;
  423. padding: 0 10upx;
  424. .item{
  425. display: flex;
  426. flex-direction: column;
  427. align-items: center;
  428. justify-content: center;
  429. image{
  430. width: 40upx;
  431. height: 40upx;
  432. margin-bottom: 18upx;
  433. }
  434. .text{
  435. font-size: 26upx;
  436. font-family: PingFang SC;
  437. font-weight: 500;
  438. color: #111111;
  439. line-height: 1;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. }
  446. }
  447. .content{
  448. margin-top: 20upx;
  449. padding: 0 20upx;
  450. display: flex;
  451. align-items: center;
  452. justify-content: center;
  453. .used-tools{
  454. box-sizing: border-box;
  455. background: #FFFFFF;
  456. border-radius: 16upx;
  457. padding: 40upx 30upx;
  458. .title{
  459. font-size: 34upx;
  460. font-family: PingFang SC;
  461. font-weight: bold;
  462. color: #222222;
  463. line-height: 1;
  464. }
  465. .tools-list{
  466. margin-top: 50upx;
  467. display: flex;
  468. flex-wrap: wrap;
  469. width: 100%;
  470. .item{
  471. box-sizing: border-box;
  472. width: 25%;
  473. display: flex;
  474. flex-direction: column;
  475. align-items: center;
  476. justify-content: center;
  477. margin-bottom: 50upx;
  478. position: relative;
  479. image{
  480. width: 44upx;
  481. height: 44upx;
  482. }
  483. .text{
  484. font-size: 24upx;
  485. font-family: PingFang SC;
  486. font-weight: 500;
  487. color: #111111;
  488. line-height: 1;
  489. margin-top: 20upx;
  490. }
  491. .contact-btn{
  492. display: inline-block;
  493. position: absolute;
  494. top: 0;
  495. left: 0;
  496. width: 100%;
  497. height: 100%;
  498. opacity: 0;
  499. }
  500. }
  501. }
  502. }
  503. }
  504. .sub-btn{
  505. position: absolute;
  506. width: 100%;
  507. height: 100%;
  508. opacity: 0;
  509. }
  510. .like-product{
  511. padding: 0 20rpx;
  512. }
  513. .banner{
  514. padding: 20rpx 20rpx 0rpx 20rpx;
  515. height: 200rpx;
  516. position: relative;
  517. display: flex;
  518. align-items: center;
  519. justify-content: center;
  520. image{
  521. width:100%;
  522. height: 100%;
  523. }
  524. .tel_btn{
  525. width: 100%;
  526. height: 100%;
  527. top:0upx;
  528. position: absolute;
  529. opacity:0.0;
  530. }
  531. }
  532. .log-out{
  533. height: 80upx;
  534. line-height: 80upx;
  535. text-align: center;
  536. font-size: 26upx;
  537. font-family: PingFang SC;
  538. font-weight: 500;
  539. color: #666666;
  540. background: #FFFFFF;
  541. border-radius: 16upx;
  542. margin-top: 20upx;
  543. }
  544. </style>