index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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
  11. :src="user.avatar==null?'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/detault_head.jpg':user.avatar"
  12. mode="aspectFill"></image>
  13. </view>
  14. <view class="name-phone" v-if="UserInfo">
  15. <view class="name">{{user.nickname}}
  16. <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1">会员</text>
  17. <text class="fs24 ml12 mb20 " style="color: #666;" v-else>非会员</text>
  18. </view>
  19. <view class="phone">{{utils.parsePhone(user.phone)}}</view>
  20. </view>
  21. <view class="fs40 bold name-phone center " @click='getOrderCount()' 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
  27. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/icon-set.png"
  28. mode=""></image>
  29. </view>
  30. </uni-badge>
  31. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  32. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  33. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/icon-msg.png" mode=""></image>
  34. </view>
  35. </uni-badge> -->
  36. </view>
  37. </view>
  38. <!-- 我的订单 -->
  39. <view class="my-order" v-if="user.isShow==1">
  40. <view class="inner">
  41. <view class="title-box">
  42. <text class="title">我的订单</text>
  43. <view class="all-order" @click="showOrder('')">
  44. <text class="text">全部订单</text>
  45. <image
  46. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/arrow4.png"
  47. 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
  54. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/payment.png"
  55. mode=""></image>
  56. <text class="text">待付款</text>
  57. </view>
  58. </uni-badge>
  59. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  60. <view class="item" @click="showOrder('1')">
  61. <image
  62. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/send_goods.png"
  63. mode=""></image>
  64. <text class="text">待发货</text>
  65. </view>
  66. </uni-badge>
  67. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  68. <view class="item" @click="showOrder('2')">
  69. <image
  70. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sou_goods.png"
  71. mode=""></image>
  72. <text class="text">待收货</text>
  73. </view>
  74. </uni-badge>
  75. <view class="item" @click="showOrder('3')">
  76. <image
  77. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/completed.png"
  78. mode=""></image>
  79. <text class="text">已完成</text>
  80. </view>
  81. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  82. <view class="item" @click="navgetTo('/pages_user/user/refundOrderList')">
  83. <image
  84. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/after_sales.png"
  85. mode=""></image>
  86. <text class="text">售后/退款</text>
  87. </view>
  88. </uni-badge>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="content">
  93. <!-- 常用工具 -->
  94. <view class="used-tools">
  95. <view class="title">常用工具</view>
  96. <view class="tools-list">
  97. <view class="item" @click="navgetTo('/pages_user/user/address')" v-if="user.isShow==1">
  98. <image
  99. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/address.png"
  100. mode=""></image>
  101. <text class="text">收货地址</text>
  102. </view>
  103. <!-- <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integral')">
  104. <image
  105. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  106. mode=""></image>
  107. <text class="text">积分管理</text>
  108. </view> -->
  109. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integralGoodsList')">
  110. <image
  111. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  112. mode=""></image>
  113. <text class="text">积分商城</text>
  114. </view>
  115. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/shopping/myCoupon')">
  116. <image
  117. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/mycoupon.png"
  118. mode=""></image>
  119. <text class="text">优惠券</text>
  120. </view>
  121. <view class="item no-marin-bottom"
  122. @click="navgetTo('/pages_user/user/storeProductRelation')">
  123. <image
  124. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/footprint.png"
  125. mode=""></image>
  126. <text class="text">我的足迹</text>
  127. </view>
  128. <view class="item no-marin-bottom">
  129. <image
  130. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/customer1.png"
  131. mode=""></image>
  132. <text class="text">专属客服</text>
  133. <button class="contact-btn" open-type="contact"></button>
  134. </view>
  135. <!-- <view v-if="user.isPromoter==0" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTuiAdd')">
  136. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/my_promotion.png" mode=""></image>
  137. <text class="text">申请百域大使</text>
  138. </view> -->
  139. <!-- <view v-if="user.isPromoter==1" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTui')">
  140. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/my_promotion.png" mode=""></image>
  141. <text class="text">我的推广</text>
  142. </view> -->
  143. <!-- <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  144. <image
  145. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/qualification.png"
  146. mode=""></image>
  147. <text class="text">资质证书</text>
  148. </view> -->
  149. <!-- v-if="user.bindCompanyUserId" -->
  150. <!-- <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/live/order')">
  151. <image
  152. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/live.png"
  153. mode=""></image>
  154. <text class="text">直播订单</text>
  155. </view> -->
  156. <!-- 销售可见 -->
  157. <!-- <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="toManager()">
  158. <image
  159. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/products_icon.png"
  160. mode=""></image>
  161. <text class="text">制单管理</text>
  162. </view>
  163. <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="toManagerCourse()">
  164. <image
  165. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sale_file.png"
  166. mode=""></image>
  167. <text class="text">销售管理</text>
  168. </view> -->
  169. <!-- <view v-if="user.bindCompanyUserId" class="item no-marin-bottom" @click="openH5('/store/h5/userAgreement')">
  170. <image
  171. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/service_file.png"
  172. mode=""></image>
  173. <text class="text">用户协议</text>
  174. </view>
  175. <view v-if="user.bindCompanyUserId" class="item no-marin-bottom align-top" @click="openH5('/store/h5/privacyPolicy')">
  176. <image
  177. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/advice.png"
  178. mode=""></image>
  179. <text class="text">隐私保护</text>
  180. </view> -->
  181. <!-- 测试用下面的 -->
  182. <view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
  183. <image
  184. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
  185. mode=""></image>
  186. <text class="text">直播</text>
  187. </view>
  188. <view class="item no-marin-bottom" @click="toManager()">
  189. <image
  190. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/products_icon.png"
  191. mode=""></image>
  192. <text class="text">制单管理</text>
  193. </view>
  194. <view class="item no-marin-bottom" @click="toManagerCourse()">
  195. <image
  196. src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/sale_file.png"
  197. mode=""></image>
  198. <text class="text">销售管理</text>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. <!-- <view class="banner">
  204. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  205. <view class="tel_btn" @click="callService()"></view>
  206. </view> -->
  207. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  208. <view @tap="loginOUt" class="log-out x-c">退出登录</view>
  209. </view>
  210. <view class="like-product">
  211. <likeProduct ref="product" />
  212. </view>
  213. <!-- 退出登录按钮 -->
  214. </view>
  215. <Server />
  216. </view>
  217. </view>
  218. </template>
  219. <script>
  220. import {
  221. getOrderCount
  222. } from '@/api/storeOrder'
  223. import {
  224. getUserInfo
  225. } from '@/api/user'
  226. import likeProduct from '@/components/likeProduct.vue'
  227. import Server from '@/components/Server.vue'
  228. export default {
  229. components: {
  230. likeProduct,
  231. Server
  232. },
  233. data() {
  234. return {
  235. count0: 0,
  236. count1: 0,
  237. count2: 0,
  238. afterSalesCount: 0,
  239. user: {
  240. isPromoter: 0,
  241. isWeixinAuth: 0,
  242. phone: "",
  243. nickname: "用户昵称",
  244. avatarUrl: "https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/detault_head.png"
  245. },
  246. // 状态栏的高度
  247. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  248. // 消息数量
  249. msgNum: 0,
  250. UserInfo: uni.getStorageSync('AppToken')
  251. };
  252. },
  253. watch: {
  254. UserInfo() {
  255. return uni.getStorageSync('AppToken')
  256. }
  257. },
  258. onLoad() {
  259. console.log("onload")
  260. },
  261. onShow() {
  262. console.log("onshow")
  263. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  264. if (this.UserInfo) {
  265. this.getUserInfo()
  266. } else {
  267. // this.isuser=true
  268. }
  269. // this.getUserInfo();
  270. // this.getOrderCount();
  271. },
  272. onReachBottom() {
  273. console.log("onReachBottom")
  274. this.$refs.product.getGoodsProducts();
  275. },
  276. computed: {
  277. imgPath() {
  278. return this.$store.state.imgpath
  279. },
  280. },
  281. methods: {
  282. callService() {
  283. let orderKey = '5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  284. uni.navigateTo({
  285. url: '/pages_company/order/confirmOrder?orderKey=' + orderKey
  286. })
  287. return;
  288. uni.makePhoneCall({
  289. phoneNumber: "4000717770",
  290. success: function() {
  291. console.log('拨打电话成功');
  292. },
  293. fail() {
  294. console.log('打电话失败了');
  295. }
  296. })
  297. },
  298. getOrderCount() {
  299. getOrderCount().then(
  300. res => {
  301. if (res.code == 200) {
  302. this.count0 = res.count0;
  303. this.count1 = res.count1;
  304. this.count2 = res.count2;
  305. this.afterSalesCount = res.afterSalesCount;
  306. }
  307. },
  308. rej => {}
  309. );
  310. },
  311. toManager() {
  312. if (this.utils.checkCompanyUserLoginState()) {
  313. uni.navigateTo({
  314. url: '/pages_company/index'
  315. })
  316. } else {
  317. uni.navigateTo({
  318. url: '/pages_company/auth/login'
  319. })
  320. }
  321. },
  322. toManagerCourse() {
  323. if (uni.getStorageSync('ManageToken')) {
  324. uni.navigateTo({
  325. url: '/pages_manage/index'
  326. })
  327. } else {
  328. uni.navigateTo({
  329. url: '/pages_manage/login'
  330. })
  331. }
  332. },
  333. openH5(url) {
  334. var requestPath = uni.getStorageSync('requestPath');
  335. uni.setStorageSync('url', requestPath + url);
  336. uni.navigateTo({
  337. url: '../home/h5'
  338. })
  339. },
  340. getUserInfo() {
  341. getUserInfo().then(
  342. res => {
  343. if (res.code == 200) {
  344. if (res.user != null) {
  345. this.user = res.user;
  346. } else {
  347. this.utils.loginOut();
  348. }
  349. } else {
  350. uni.showToast({
  351. icon: 'none',
  352. title: "请求失败",
  353. });
  354. }
  355. },
  356. rej => {}
  357. );
  358. },
  359. // 跳转页面
  360. navgetTo(url) {
  361. this.utils.isLogin().then(res => {
  362. if (res) {
  363. uni.navigateTo({
  364. url: url
  365. })
  366. }
  367. })
  368. },
  369. // 查看订单
  370. showOrder(status) {
  371. uni.navigateTo({
  372. url: '/pages_user/user/storeOrder?status=' + status
  373. })
  374. },
  375. loginOUt() {
  376. this.utils.loginOut();
  377. uni.navigateTo({
  378. url: '/pages/auth/login'
  379. })
  380. // this.getUserInfo();
  381. }
  382. }
  383. }
  384. </script>
  385. <style lang="scss" scoped>
  386. .top-cont {
  387. width: 100%;
  388. height: 494upx;
  389. position: relative;
  390. background-image: url(https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/personl_top_bg.png);
  391. background-repeat: repeat-x;
  392. background-size: 40upx 100%;
  393. .top-inner {
  394. width: 100%;
  395. height: 100%;
  396. position: absolute;
  397. top: 0;
  398. left: 0;
  399. z-index: 2;
  400. .user-info {
  401. padding: 88upx 30upx 0 30upx;
  402. display: flex;
  403. align-items: center;
  404. justify-content: space-between;
  405. .left {
  406. position: relative;
  407. display: flex;
  408. .head-img {
  409. width: 120upx;
  410. height: 120upx;
  411. border-radius: 50%;
  412. overflow: hidden;
  413. margin-right: 30upx;
  414. border: 4upx solid #FFFFFF;
  415. box-shadow: 0px 5px 15px 2px rgba(0, 0, 0, 0.1);
  416. image {
  417. width: 100%;
  418. height: 100%;
  419. }
  420. }
  421. .name-phone {
  422. padding-top: 15upx;
  423. .name {
  424. font-size: 40upx;
  425. font-family: PingFang SC;
  426. font-weight: bold;
  427. color: #111111;
  428. line-height: 1;
  429. }
  430. .phone {
  431. font-size: 28upx;
  432. font-family: PingFang SC;
  433. font-weight: 500;
  434. color: #666666;
  435. line-height: 1;
  436. margin-top: 30upx;
  437. }
  438. }
  439. }
  440. .right {
  441. display: flex;
  442. align-items: center;
  443. justify-content: center;
  444. .msg-box {
  445. margin-left: 10upx;
  446. width: 44upx;
  447. height: 44upx;
  448. image {
  449. width: 100%;
  450. height: 100%;
  451. }
  452. }
  453. .set {
  454. width: 44upx;
  455. height: 44upx;
  456. image {
  457. width: 100%;
  458. height: 100%;
  459. }
  460. }
  461. }
  462. }
  463. .my-order {
  464. padding: 50upx 20upx 0;
  465. .inner {
  466. box-sizing: border-box;
  467. height: 245upx;
  468. // height: 105upx;
  469. background: #FFFFFF;
  470. border-radius: 16upx;
  471. padding: 40upx 30upx;
  472. display: flex;
  473. flex-direction: column;
  474. justify-content: space-between;
  475. .title-box {
  476. display: flex;
  477. align-items: center;
  478. justify-content: space-between;
  479. .title {
  480. font-size: 34upx;
  481. font-family: PingFang SC;
  482. font-weight: bold;
  483. color: #222222;
  484. line-height: 1;
  485. }
  486. .all-order {
  487. display: flex;
  488. align-items: center;
  489. .text {
  490. font-size: 26upx;
  491. font-family: PingFang SC;
  492. font-weight: 500;
  493. color: #999999;
  494. line-height: 1;
  495. margin-right: 8upx;
  496. }
  497. image {
  498. width: 14upx;
  499. height: 24upx;
  500. }
  501. }
  502. }
  503. .status-box {
  504. display: flex;
  505. align-items: center;
  506. justify-content: space-between;
  507. padding: 0 10upx;
  508. .item {
  509. display: flex;
  510. flex-direction: column;
  511. align-items: center;
  512. justify-content: center;
  513. image {
  514. width: 40upx;
  515. height: 40upx;
  516. margin-bottom: 18upx;
  517. }
  518. .text {
  519. font-size: 26upx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #111111;
  523. line-height: 1;
  524. }
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .content {
  532. margin-top: 20upx;
  533. padding: 0 20upx;
  534. display: flex;
  535. align-items: center;
  536. justify-content: center;
  537. .used-tools {
  538. width: 100%;
  539. box-sizing: border-box;
  540. background: #FFFFFF;
  541. border-radius: 16upx;
  542. padding: 40upx 30upx;
  543. .title {
  544. font-size: 34upx;
  545. font-family: PingFang SC;
  546. font-weight: bold;
  547. color: #222222;
  548. line-height: 1;
  549. }
  550. .tools-list {
  551. margin-top: 50upx;
  552. display: flex;
  553. flex-wrap: wrap;
  554. width: 100%;
  555. .item {
  556. box-sizing: border-box;
  557. width: 25%;
  558. display: flex;
  559. flex-direction: column;
  560. align-items: center;
  561. justify-content: center;
  562. margin-bottom: 50upx;
  563. position: relative;
  564. image {
  565. width: 44upx;
  566. height: 44upx;
  567. }
  568. .text {
  569. font-size: 24upx;
  570. font-family: PingFang SC;
  571. font-weight: 500;
  572. color: #111111;
  573. line-height: 1;
  574. margin-top: 20upx;
  575. }
  576. .contact-btn {
  577. display: inline-block;
  578. position: absolute;
  579. top: 0;
  580. left: 0;
  581. width: 100%;
  582. height: 100%;
  583. opacity: 0;
  584. }
  585. }
  586. }
  587. }
  588. }
  589. .log-out {
  590. height: 80upx;
  591. line-height: 80upx;
  592. text-align: center;
  593. font-size: 26upx;
  594. font-family: PingFang SC;
  595. font-weight: 500;
  596. color: #666666;
  597. background: #FFFFFF;
  598. border-radius: 16upx;
  599. margin-top: 20upx;
  600. }
  601. .sub-btn {
  602. position: absolute;
  603. width: 100%;
  604. height: 100%;
  605. opacity: 0;
  606. }
  607. .like-product {
  608. padding: 0 20rpx;
  609. }
  610. .banner {
  611. padding: 20rpx 20rpx 0rpx 20rpx;
  612. height: 200rpx;
  613. position: relative;
  614. display: flex;
  615. align-items: center;
  616. justify-content: center;
  617. image {
  618. width: 100%;
  619. height: 100%;
  620. }
  621. .tel_btn {
  622. width: 100%;
  623. height: 100%;
  624. top: 0upx;
  625. position: absolute;
  626. opacity: 0.0;
  627. }
  628. }
  629. .log-out {
  630. height: 100rpx;
  631. line-height: 100rpx;
  632. margin: 10px;
  633. border-radius: 20rpx;
  634. }
  635. </style>