index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/avatar.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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/footprint.png" mode=""></image>
  101. <text class="text">我的足迹</text>
  102. </view>
  103. <view class="item no-marin-bottom" @click="openH5(1)">
  104. <image src="https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/service_file.png" mode=""></image>
  105. <text class="text">用户协议</text>
  106. </view>
  107. <view class="item no-marin-bottom align-top" @click="openH5(2)">
  108. <image src="https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/advice.png" mode=""></image>
  109. <text class="text">隐私保护</text>
  110. </view>
  111. <view class="item no-marin-bottom">
  112. <image src="https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/qualification.png" mode=""></image>
  126. <text class="text">资质证书</text>
  127. </view>
  128. <view class="item no-marin-bottom" @click="toManager()">
  129. <image src="https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/integral.png" mode=""></image>
  130. <text class="text">制单管理</text>
  131. </view>
  132. <view class="item no-marin-bottom" @click="toManagerCourse()">
  133. <image src="https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/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: '/pages/home/h5?val='+url
  264. })
  265. },
  266. getUserInfo(){
  267. const data={
  268. appId:wx.getAccountInfoSync().miniProgram.appId,
  269. }
  270. console.log(data)
  271. getUserInfo(data).then(
  272. res => {
  273. if(res.code==200){
  274. if(res.user!=null){
  275. this.user=res.user;
  276. }
  277. else{
  278. this.utils.loginOut();
  279. }
  280. }else{
  281. uni.showToast({
  282. icon:'none',
  283. title: "请求失败",
  284. });
  285. }
  286. },
  287. rej => {}
  288. );
  289. },
  290. // 跳转页面
  291. navgetTo(url) {
  292. this.utils.isLogin().then(res => {
  293. if(res){
  294. uni.navigateTo({
  295. url: url
  296. })
  297. }
  298. })
  299. },
  300. // 查看订单
  301. showOrder(status) {
  302. uni.navigateTo({
  303. url: '/pages_user/user/storeOrder?status=' + status
  304. })
  305. },
  306. loginOUt(){
  307. this.utils.loginOut();
  308. this.getUserInfo();
  309. }
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .top-cont{
  315. width: 100%;
  316. height: 494upx;
  317. position: relative;
  318. // background-color: #111111;
  319. // background-image: url(https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/personl_top_bg.png);
  320. background-image: url('https://czwh.obs.cn-southwest-2.myhuaweicloud.com/app/orangeShop/personl_top_bg.png');
  321. background-repeat: no-repeat;
  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: #fff;
  365. line-height: 1;
  366. margin-top: 30upx;
  367. background: linear-gradient( 90deg, #F26F00 0%, #FF9D1F 100%);
  368. border-radius: 24rpx;
  369. padding: 8rpx 16rpx;
  370. }
  371. }
  372. }
  373. .right{
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. .msg-box{
  378. margin-left: 10upx;
  379. width: 44upx;
  380. height: 44upx;
  381. image{
  382. width: 100%;
  383. height: 100%;
  384. }
  385. }
  386. .set{
  387. width: 44upx;
  388. height: 44upx;
  389. image{
  390. width: 100%;
  391. height: 100%;
  392. }
  393. }
  394. }
  395. }
  396. .my-order{
  397. padding: 50upx 20upx 0;
  398. .inner{
  399. box-sizing: border-box;
  400. height: 245upx;
  401. // height: 105upx;
  402. background: #FFFFFF;
  403. border-radius: 16upx;
  404. padding: 40upx 30upx;
  405. display: flex;
  406. flex-direction: column;
  407. justify-content: space-between;
  408. .title-box{
  409. display: flex;
  410. align-items: center;
  411. justify-content: space-between;
  412. .title{
  413. font-size: 34upx;
  414. font-family: PingFang SC;
  415. font-weight: bold;
  416. color: #222222;
  417. line-height: 1;
  418. }
  419. .all-order{
  420. display: flex;
  421. align-items: center;
  422. .text{
  423. font-size: 26upx;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #999999;
  427. line-height: 1;
  428. margin-right: 8upx;
  429. }
  430. image{
  431. width: 14upx;
  432. height: 24upx;
  433. }
  434. }
  435. }
  436. .status-box{
  437. display: flex;
  438. align-items: center;
  439. justify-content: space-between;
  440. padding: 0 10upx;
  441. .item{
  442. display: flex;
  443. flex-direction: column;
  444. align-items: center;
  445. justify-content: center;
  446. image{
  447. width: 40upx;
  448. height: 40upx;
  449. margin-bottom: 18upx;
  450. }
  451. .text{
  452. font-size: 26upx;
  453. font-family: PingFang SC;
  454. font-weight: 500;
  455. color: #111111;
  456. line-height: 1;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. }
  464. .content{
  465. margin-top: 20upx;
  466. padding: 0 20upx;
  467. display: flex;
  468. align-items: center;
  469. justify-content: center;
  470. .used-tools{
  471. box-sizing: border-box;
  472. background: #FFFFFF;
  473. border-radius: 16upx;
  474. padding: 40upx 30upx;
  475. .title{
  476. font-size: 34upx;
  477. font-family: PingFang SC;
  478. font-weight: bold;
  479. color: #222222;
  480. line-height: 1;
  481. }
  482. .tools-list{
  483. margin-top: 50upx;
  484. display: flex;
  485. flex-wrap: wrap;
  486. width: 100%;
  487. .item{
  488. box-sizing: border-box;
  489. width: 25%;
  490. display: flex;
  491. flex-direction: column;
  492. align-items: center;
  493. justify-content: center;
  494. margin-bottom: 50upx;
  495. position: relative;
  496. image{
  497. width: 44upx;
  498. height: 44upx;
  499. }
  500. .text{
  501. font-size: 24upx;
  502. font-family: PingFang SC;
  503. font-weight: 500;
  504. color: #111111;
  505. line-height: 1;
  506. margin-top: 20upx;
  507. }
  508. .contact-btn{
  509. display: inline-block;
  510. position: absolute;
  511. top: 0;
  512. left: 0;
  513. width: 100%;
  514. height: 100%;
  515. opacity: 0;
  516. }
  517. }
  518. }
  519. }
  520. }
  521. .log-out{
  522. height: 80upx;
  523. line-height: 80upx;
  524. text-align: center;
  525. font-size: 26upx;
  526. font-family: PingFang SC;
  527. font-weight: 500;
  528. color: #666666;
  529. background: #FFFFFF;
  530. border-radius: 16upx;
  531. margin-top: 20upx;
  532. }
  533. .sub-btn{
  534. position: absolute;
  535. width: 100%;
  536. height: 100%;
  537. opacity: 0;
  538. }
  539. .like-product{
  540. padding: 0 20rpx;
  541. }
  542. .banner{
  543. padding: 20rpx 20rpx 0rpx 20rpx;
  544. height: 200rpx;
  545. position: relative;
  546. display: flex;
  547. align-items: center;
  548. justify-content: center;
  549. image{
  550. width:100%;
  551. height: 100%;
  552. }
  553. .tel_btn{
  554. width: 100%;
  555. height: 100%;
  556. top:0upx;
  557. position: absolute;
  558. opacity:0.0;
  559. }
  560. }
  561. .log-out{
  562. height: 100rpx;line-height: 100rpx;
  563. margin: 10px;
  564. border-radius: 20rpx;
  565. }
  566. </style>