index.vue 19 KB

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