userindex.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <view class="top-inner">
  5. <!-- 这里是状态栏 -->
  6. <view class="user-info">
  7. <view class="left">
  8. <view class="head-img">
  9. <image :src="user.avatar==null?'https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/detault_head.jpg':user.avatar" mode="aspectFill"></image>
  10. </view>
  11. <view class="name-phone" v-if="UserInfo">
  12. <view class="name">{{user.nickname}}
  13. <!-- <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1"
  14. >会员</text>
  15. <text class="fs24 ml12 mb20 " style="color: #666;" v-else
  16. >非会员</text> -->
  17. </view>
  18. <view class="phone" v-if="user.phone!=''">{{$parsePhone(user.phone)}}</view>
  19. </view>
  20. <view class="fs40 bold name-phone center " @click='getOrderCount()'
  21. v-else>立即登录</view>
  22. </view>
  23. <view class="right">
  24. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  25. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  26. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/icon-set.png" mode=""></image>
  27. </view>
  28. </uni-badge> -->
  29. </view>
  30. </view>
  31. <!-- 我的订单 -->
  32. <view class="my-order" >
  33. <view class="inner">
  34. <view class="title-box">
  35. <text class="title">我的订单</text>
  36. <view class="all-order" @click="showOrder('')">
  37. <text class="text">全部订单</text>
  38. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/arrow4.png" mode=""></image>
  39. </view>
  40. </view>
  41. <view class="status-box">
  42. <uni-badge size="small" :text=count0 absolute="rightTop" type="error">
  43. <view class="item" @click="showOrder('0')">
  44. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/payment.png" mode=""></image>
  45. <text class="text">待付款</text>
  46. </view>
  47. </uni-badge>
  48. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  49. <view class="item" @click="showOrder('1')">
  50. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/send_goods.png" mode=""></image>
  51. <text class="text">待发货</text>
  52. </view>
  53. </uni-badge>
  54. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  55. <view class="item" @click="showOrder('2')">
  56. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/sou_goods.png" mode=""></image>
  57. <text class="text">待收货</text>
  58. </view>
  59. </uni-badge>
  60. <view class="item" @click="showOrder('3')">
  61. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/completed.png" mode=""></image>
  62. <text class="text">已完成</text>
  63. </view>
  64. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  65. <view class="item" @click="navgetTo('/pages_shopping/order/refundOrderList')">
  66. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/after_sales.png" mode=""></image>
  67. <text class="text">售后/退款</text>
  68. </view>
  69. </uni-badge>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="content">
  74. <!-- 常用工具 -->
  75. <view class="used-tools">
  76. <view class="title">常用工具</view>
  77. <view class="tools-list">
  78. <view class="item" @click="navgetTo('/pages_user/address')">
  79. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/address.png" mode=""></image>
  80. <text class="text">收货地址</text>
  81. </view>
  82. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/order/myCoupon')">
  83. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/mycoupon.png" mode=""></image>
  84. <text class="text">优惠券</text>
  85. </view>
  86. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/order/storeProductRelation')">
  87. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/footprint.png" mode=""></image>
  88. <text class="text">我的足迹</text>
  89. </view>
  90. <view class="item no-marin-bottom" @click="toManager()">
  91. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/products_icon.png" mode=""></image>
  92. <text class="text">制单管理</text>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 退出登录按钮 -->
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import {getOrderCount} from '@/api/storeOrder'
  104. import {getUserInfo} from '@/api/user'
  105. export default {
  106. data() {
  107. return {
  108. count0:0,
  109. count1:0,
  110. count2:0,
  111. afterSalesCount:0,
  112. user:{
  113. isPromoter:0,
  114. isWeixinAuth:0,
  115. phone:"",
  116. nickname:"用户昵称",
  117. avatarUrl:"https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/detault_head.png"
  118. },
  119. // 状态栏的高度
  120. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  121. // 消息数量
  122. msgNum: 0,
  123. UserInfo:uni.getStorageSync('AppToken')
  124. };
  125. },
  126. watch: {
  127. UserInfo() {
  128. return uni.getStorageSync('AppToken')
  129. }
  130. },
  131. onLoad() {
  132. console.log("onload")
  133. },
  134. onShow() {
  135. console.log("onshow")
  136. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  137. if(this.UserInfo){
  138. this.getUserInfo()
  139. }else{
  140. // this.isuser=true
  141. }
  142. // this.getUserInfo();
  143. // this.getOrderCount();
  144. },
  145. methods: {
  146. getOrderCount(){
  147. getOrderCount().then(
  148. res => {
  149. if(res.code==200){
  150. this.count0=res.count0;
  151. this.count1=res.count1;
  152. this.count2=res.count2;
  153. this.afterSalesCount=res.afterSalesCount;
  154. }
  155. },
  156. rej => {}
  157. );
  158. },
  159. toManager(){
  160. this.$isLogin().then(
  161. res => {
  162. console.log(res)
  163. if(res){
  164. console.log('111',uni.getStorageSync('CompanyUserToken'))
  165. var token = uni.getStorageSync('CompanyUserToken');
  166. if (token ) {
  167. uni.navigateTo({
  168. url: '/pages_shopping/company/index'
  169. })
  170. } else {
  171. uni.navigateTo({
  172. url: '/pages_shopping/auth/login'
  173. })
  174. }
  175. }
  176. else{
  177. uni.navigateTo({
  178. url:'/pages/auth/login'
  179. })
  180. }
  181. }
  182. );
  183. },
  184. toManagerCourse(){
  185. if(uni.getStorageSync('ManageToken')){
  186. uni.navigateTo({
  187. url: '/pages_manage/index'
  188. })
  189. }
  190. else{
  191. uni.navigateTo({
  192. url: '/pages_manage/login'
  193. })
  194. }
  195. },
  196. getUserInfo(){
  197. getUserInfo().then(
  198. res => {
  199. if(res.code==200){
  200. if(res.user!=null){
  201. this.user=res.user;
  202. }
  203. else{
  204. this.utils.loginOut();
  205. }
  206. }else{
  207. uni.showToast({
  208. icon:'none',
  209. title: "请求失败",
  210. });
  211. }
  212. },
  213. rej => {}
  214. );
  215. },
  216. // 跳转页面
  217. navgetTo(url) {
  218. this.$isLogin().then(res => {
  219. if(res){
  220. uni.navigateTo({
  221. url: url
  222. })
  223. }
  224. })
  225. },
  226. // 查看订单
  227. showOrder(status) {
  228. uni.navigateTo({
  229. url: '/pages_shopping/order/storeOrder?status=' + status
  230. })
  231. },
  232. }
  233. }
  234. </script>
  235. <style lang="scss" scoped>
  236. .top-cont{
  237. width: 100%;
  238. height: 494upx;
  239. position: relative;
  240. background-image: url(https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/shop/images/personl_top_bg.png);
  241. background-repeat: repeat-x;
  242. background-size: 40upx 100%;
  243. .top-inner{
  244. width: 100%;
  245. height: 100%;
  246. position: absolute;
  247. top: 0;
  248. left: 0;
  249. z-index: 2;
  250. .user-info{
  251. padding: 30upx 30upx 0 30upx;
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. .left{
  256. position: relative;
  257. display: flex;
  258. .head-img{
  259. width: 120upx;
  260. height: 120upx;
  261. border-radius: 50%;
  262. overflow: hidden;
  263. margin-right: 30upx;
  264. border: 4upx solid #FFFFFF;
  265. box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  266. image{
  267. width: 100%;
  268. height: 100%;
  269. }
  270. }
  271. .name-phone{
  272. padding-top: 15upx;
  273. fs
  274. .name{
  275. font-size: 40upx;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. color: #111111;
  279. line-height: 1;
  280. }
  281. .phone{
  282. font-size: 28upx;
  283. font-family: PingFang SC;
  284. font-weight: 500;
  285. color: #666666;
  286. line-height: 1;
  287. margin-top: 30upx;
  288. }
  289. }
  290. }
  291. .right{
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. .msg-box{
  296. margin-left: 10upx;
  297. width: 44upx;
  298. height: 44upx;
  299. image{
  300. width: 100%;
  301. height: 100%;
  302. }
  303. }
  304. .set{
  305. width: 44upx;
  306. height: 44upx;
  307. image{
  308. width: 100%;
  309. height: 100%;
  310. }
  311. }
  312. }
  313. }
  314. .my-order{
  315. padding: 50upx 20upx 0;
  316. .inner{
  317. box-sizing: border-box;
  318. height: 245upx;
  319. // height: 105upx;
  320. background: #FFFFFF;
  321. border-radius: 16upx;
  322. padding: 40upx 30upx;
  323. display: flex;
  324. flex-direction: column;
  325. justify-content: space-between;
  326. .title-box{
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. .title{
  331. font-size: 34upx;
  332. font-family: PingFang SC;
  333. font-weight: bold;
  334. color: #222222;
  335. line-height: 1;
  336. }
  337. .all-order{
  338. display: flex;
  339. align-items: center;
  340. .text{
  341. font-size: 26upx;
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. color: #999999;
  345. line-height: 1;
  346. margin-right: 8upx;
  347. }
  348. image{
  349. width: 14upx;
  350. height: 24upx;
  351. }
  352. }
  353. }
  354. .status-box{
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. padding: 0 10upx;
  359. .item{
  360. display: flex;
  361. flex-direction: column;
  362. align-items: center;
  363. justify-content: center;
  364. image{
  365. width: 40upx;
  366. height: 40upx;
  367. margin-bottom: 18upx;
  368. }
  369. .text{
  370. font-size: 26upx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #111111;
  374. line-height: 1;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. .content{
  383. margin-top: 20upx;
  384. padding: 0 20upx;
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. .used-tools{
  389. box-sizing: border-box;
  390. background: #FFFFFF;
  391. border-radius: 16upx;
  392. padding: 40upx 30upx;
  393. width: 100%;
  394. .title{
  395. font-size: 34upx;
  396. font-family: PingFang SC;
  397. font-weight: bold;
  398. color: #222222;
  399. line-height: 1;
  400. }
  401. .tools-list{
  402. margin-top: 50upx;
  403. display: flex;
  404. flex-wrap: wrap;
  405. width: 100%;
  406. .item{
  407. box-sizing: border-box;
  408. width: 25%;
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. justify-content: center;
  413. margin-bottom: 50upx;
  414. position: relative;
  415. image{
  416. width: 44upx;
  417. height: 44upx;
  418. }
  419. .text{
  420. font-size: 24upx;
  421. font-family: PingFang SC;
  422. font-weight: 500;
  423. color: #111111;
  424. line-height: 1;
  425. margin-top: 20upx;
  426. }
  427. .contact-btn{
  428. display: inline-block;
  429. position: absolute;
  430. top: 0;
  431. left: 0;
  432. width: 100%;
  433. height: 100%;
  434. opacity: 0;
  435. }
  436. }
  437. }
  438. }
  439. }
  440. .log-out{
  441. height: 80upx;
  442. line-height: 80upx;
  443. text-align: center;
  444. font-size: 26upx;
  445. font-family: PingFang SC;
  446. font-weight: 500;
  447. color: #666666;
  448. background: #FFFFFF;
  449. border-radius: 16upx;
  450. margin-top: 20upx;
  451. }
  452. .sub-btn{
  453. position: absolute;
  454. width: 100%;
  455. height: 100%;
  456. opacity: 0;
  457. }
  458. .banner{
  459. padding: 20rpx 20rpx 0rpx 20rpx;
  460. height: 200rpx;
  461. position: relative;
  462. display: flex;
  463. align-items: center;
  464. justify-content: center;
  465. image{
  466. width:100%;
  467. height: 100%;
  468. }
  469. .tel_btn{
  470. width: 100%;
  471. height: 100%;
  472. top:0upx;
  473. position: absolute;
  474. opacity:0.0;
  475. }
  476. }
  477. .log-out{
  478. height: 100rpx;line-height: 100rpx;
  479. margin: 10px;
  480. border-radius: 20rpx;
  481. }
  482. </style>