index.vue 15 KB

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