user.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <view class="container user clearfix">
  3. <cm-custom :navbar-data="nvabarData"></cm-custom>
  4. <view class="user-section">
  5. <view
  6. class="header"
  7. :style="{
  8. height: CustomBar + 90 - StatusBar + 'px',
  9. paddingTop: CustomBar + 'px',
  10. background: 'url(' + bgImgUrl + ')',
  11. backgroundSize: 'cover'
  12. }"
  13. >
  14. <view class="header-main" v-if="hasLogin">
  15. <view class="header-icon" @click="TestZHIboFn()">
  16. <image :src="staticUrl + 'icon_default_seller@2x.png'" mode=""></image>
  17. </view>
  18. <view class="header-text">
  19. <view class="user-item"
  20. ><text class="user-item-none">{{ name | nameFilters }}</text></view
  21. >
  22. </view>
  23. </view>
  24. <!-- 订单 -->
  25. <view class="user-order">
  26. <view class="tab-title" @click="navigator('/pages/seller/order/order-list?listType=0')">
  27. <text class="cell-tit">我的订单</text> <text class="cell-more">全部订单</text>
  28. <text class="iconfont icon-xiangyou"></text>
  29. </view>
  30. <view class="order-section">
  31. <view
  32. class="order-item"
  33. @click="navigator('/pages/seller/order/order-list?listType=1')"
  34. hover-class="common-hover"
  35. :hover-stay-time="50"
  36. >
  37. <view class="order-icon">
  38. <image :src="staticUrl + 'icon_order_1@2x.png'" mode=""></image>
  39. <text
  40. v-if="beforeConfirmCount > 0"
  41. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  42. :class="[beforeConfirmCount < 10 ? 'goleft' : '']"
  43. >
  44. {{ beforeConfirmCount >= 99 ? '99+' : beforeConfirmCount }}
  45. </text>
  46. </view>
  47. <text class="order-t">待确认</text>
  48. </view>
  49. <view
  50. class="order-item"
  51. @click="navigator('/pages/seller/order/order-list?listType=2')"
  52. hover-class="common-hover"
  53. :hover-stay-time="50"
  54. >
  55. <view class="order-icon">
  56. <image :src="staticUrl + 'icon_order_2@2x.png'" mode=""></image>
  57. <text
  58. v-if="beforePayCount > 0"
  59. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  60. :class="[beforePayCount < 10 ? 'goleft' : '']"
  61. >
  62. {{ beforePayCount >= 99 ? '99+' : beforePayCount }}
  63. </text>
  64. </view>
  65. <text class="order-t">待付款</text>
  66. </view>
  67. <view
  68. class="order-item"
  69. @click="navigator('/pages/seller/order/order-list?listType=3')"
  70. hover-class="common-hover"
  71. :hover-stay-time="50"
  72. >
  73. <view class="order-icon">
  74. <image :src="staticUrl + 'icon_order_3@2x.png'" mode=""></image>
  75. <text
  76. v-if="beforeShipCount > 0"
  77. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  78. :class="[beforeShipCount < 10 ? 'goleft' : '']"
  79. >
  80. {{ beforeShipCount >= 99 ? '99+' : beforeShipCount }}
  81. </text>
  82. </view>
  83. <text class="order-t">待发货</text>
  84. </view>
  85. <view
  86. class="order-item"
  87. @click="navigator('/pages/seller/order/order-list?listType=4')"
  88. hover-class="common-hover"
  89. :hover-stay-time="50"
  90. >
  91. <view class="order-icon">
  92. <image :src="staticUrl + 'icon_order_4@2x.png'" mode=""></image>
  93. <text
  94. v-if="shippedCount > 0"
  95. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  96. :class="[shippedCount < 10 ? 'goleft' : '']"
  97. >
  98. {{ shippedCount >= 99 ? '99+' : shippedCount }}
  99. </text>
  100. </view>
  101. <text class="order-t">已发货</text>
  102. </view>
  103. <view
  104. class="order-item"
  105. @click="navigator('/pages/seller/order/order-list?listType=5')"
  106. hover-class="common-hover"
  107. :hover-stay-time="50"
  108. >
  109. <view class="order-icon">
  110. <image :src="staticUrl + 'icon_order_5@2x.png'" mode=""></image>
  111. <text
  112. v-if="refundsCount > 0"
  113. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  114. :class="[refundsCount < 10 ? 'goleft' : '']"
  115. >
  116. {{ refundsCount >= 99 ? '99+' : refundsCount }}
  117. </text>
  118. </view>
  119. <text class="order-t">退货/款</text>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 底部跳转 -->
  125. <view class="foot-list">
  126. <view class="list-cell-item">
  127. <view
  128. class="list-cell"
  129. v-for="(item, index) in twoList"
  130. :key="index"
  131. @click="navigator(item.path)"
  132. hover-class="cell-hover"
  133. :hover-stay-time="50"
  134. >
  135. <view class="cell-icon">
  136. <image class="cell-icon-image" :src="staticUrl + item.icon" mode=""></image>
  137. </view>
  138. <text class="cell-tit">{{ item.name }}</text>
  139. <text class="cell-more iconfont icon-xiangyou"></text>
  140. </view>
  141. <!-- #ifdef MP-WEIXIN -->
  142. <button class="list-cell" open-type="contact" @bindcontact="handleContact">
  143. <view class="cell-icon">
  144. <image class="cell-icon-image" :src="staticUrl + 'icon_club_5@2x.png'" mode=""></image>
  145. </view>
  146. <text class="cell-tit"> 官方客服 </text> <text class="cell-more iconfont icon-xiangyou"></text>
  147. </button>
  148. <!-- #endif -->
  149. </view>
  150. </view>
  151. </view>
  152. <!-- 技术支持 -->
  153. <view class="copyright">
  154. <image class="image" :src="staticUrl + 'icon_caimei@2x.png'"></image>
  155. <view class="text">由采美365网提供技术服务</view>
  156. </view>
  157. </view>
  158. </template>
  159. <script>
  160. import authorize from '@/common/config/authorize.js'
  161. import { mapState, mapMutations } from 'vuex'
  162. export default {
  163. data() {
  164. return {
  165. nvabarData: {
  166. //顶部自定义导航
  167. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  168. showSearch: 0,
  169. title: '账户中心', // 导航栏 中间的标题
  170. haveBack: false,
  171. textLeft: this.$store.state.isIphone,
  172. textColor: '#FFFFFF',
  173. bgColor: ''
  174. },
  175. staticUrl: this.global.staticUrl,
  176. CustomBar: this.CustomBar, // 顶部导航栏高度
  177. StatusBar: this.StatusBar,
  178. bgImgUrl: 'https://static.caimei365.com/app/mini-mcare/icon/icon_header@2x.png',
  179. name: '',
  180. userId: '',
  181. orderNum: 0, //未查看订单数量
  182. beforeConfirmCount: 0, //待确认角标
  183. beforePayCount: 0, //待付款角标
  184. beforeShipCount: 0, //待发货角标
  185. shippedCount: 0, //已发货角标
  186. refundsCount: '', //退货/款角标
  187. institutionsCont: 120,
  188. twoList: [
  189. {
  190. name: '帮机构采购',
  191. path: '/pages/seller/club/club-list',
  192. icon: 'icon_club_7@2x.png'
  193. }
  194. ]
  195. }
  196. },
  197. filters: {
  198. nameFilters(value) {
  199. if(value && value.length>15){
  200. return value.substring(0,15)+"..."
  201. }else{
  202. return value
  203. }
  204. }
  205. },
  206. created() {
  207. this.initData()
  208. },
  209. computed: {
  210. ...mapState(['hasLogin', 'userInfo'])
  211. },
  212. methods: {
  213. ...mapMutations(['login', 'logout']),
  214. async initData() {
  215. const user = await this.$api.getStorage()
  216. this.userId = user.userId
  217. this.name = user.userName //协销名称
  218. this.getUserSellerHome()
  219. },
  220. async getUserSellerHome() {
  221. try{
  222. const res = await this.SellerService.GetSellerHome({ userId: this.userId })
  223. const data = res.data
  224. this.getOrderCount(data.serviceProviderId)
  225. }catch(error){
  226. this.$util.msg(error.msg, 2000)
  227. }
  228. },
  229. async getOrderCount(serviceProviderId) {
  230. try{
  231. const res = await this.SellerService.GetOrderCount({ serviceProviderId: serviceProviderId })
  232. const data = res.data
  233. this.beforeConfirmCount = this.showBadge(data.confirmedCount) //待确认
  234. this.beforePayCount = this.showBadge(data.paymentCount) //待付款
  235. this.beforeShipCount = this.showBadge(data.waitShipmentsCount) //待发货
  236. this.shippedCount = this.showBadge(data.shipmentsCount) //已发货
  237. this.refundsCount = this.showBadge(data.salesReturnCount) //退货/款
  238. this.orderNum = this.showBadge(data.uncheckedOrderCount) //未查看订单数量
  239. }catch(error){
  240. console.log(error)
  241. }
  242. },
  243. navigator(url) {
  244. this.$api.navigateTo(url)
  245. },
  246. showBadge(n) {
  247. let num = ''
  248. if (n > 100) {
  249. num = 99
  250. } else {
  251. num = n
  252. }
  253. return num
  254. },
  255. onPullDownRefresh() {
  256. //下拉刷新
  257. this.initData()
  258. uni.stopPullDownRefresh()
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss">
  264. @import '@/uni.scss';
  265. page {
  266. background-color: #f7f7f7;
  267. }
  268. .user {
  269. width: 100%;
  270. height: 100%;
  271. position: relative;
  272. background: rgba(247, 247, 247, 1);
  273. }
  274. .header {
  275. width: 100%;
  276. position: relative;
  277. background-size: cover;
  278. }
  279. .header-main {
  280. width: 702rpx;
  281. height: 130rpx;
  282. padding: 12rpx 24rpx;
  283. display: flex;
  284. .header-text {
  285. flex: 8;
  286. display: flex;
  287. flex-direction: column;
  288. .user-item {
  289. flex: 1;
  290. height: 64rpx;
  291. line-height: 64rpx;
  292. .user-item-none{
  293. font-size: $font-size-32;
  294. line-height: 120rpx;
  295. color: #ffffff;
  296. text-align: left;
  297. display: inline-block;
  298. }
  299. }
  300. }
  301. .header-icon {
  302. flex: 2;
  303. margin-right: 20rpx;
  304. image {
  305. float: right;
  306. width: 128rpx;
  307. height: 128rpx;
  308. border-radius: 100%;
  309. border: 2rpx solid #ffffff;
  310. }
  311. }
  312. }
  313. .header-main-none {
  314. width: 702rpx;
  315. height: 152rpx;
  316. padding: 0 24rpx;
  317. display: flex;
  318. .header-text {
  319. flex: 8;
  320. display: flex;
  321. flex-direction: column;
  322. .user-item {
  323. flex: 1;
  324. height: 50rpx;
  325. line-height: 50rpx;
  326. .line {
  327. margin: 0 10rpx;
  328. }
  329. .u-h1 {
  330. float: left;
  331. font-size: $font-size-36;
  332. color: #ffffff;
  333. text-align: left;
  334. -o-text-overflow: ellipsis;
  335. text-overflow: ellipsis;
  336. display: -webkit-box;
  337. word-break: break-all;
  338. -webkit-box-orient: vertical;
  339. -webkit-line-clamp: 1;
  340. overflow: hidden;
  341. }
  342. .u-p {
  343. font-size: $font-size-24;
  344. line-height: 50rpx;
  345. color: #efefef;
  346. text-align: left;
  347. }
  348. .u-btn {
  349. width: 160rpx;
  350. height: 40rpx;
  351. background: rgba(255, 255, 255, 0.5);
  352. border-radius: 5rpx;
  353. line-height: 40rpx;
  354. text-align: center;
  355. font-size: $font-size-24;
  356. color: #ffffff;
  357. display: block;
  358. margin-top: 5rpx;
  359. padding-left: 6rpx;
  360. .icon-xiangyouhuabeifen {
  361. font-size: $font-size-24;
  362. }
  363. }
  364. }
  365. }
  366. .header-icon {
  367. flex: 2;
  368. display: flex;
  369. margin-right: 20rpx;
  370. align-items: center;
  371. justify-content: center;
  372. image {
  373. float: right;
  374. width: 128rpx;
  375. height: 128rpx;
  376. border-radius: 100%;
  377. border: 2rpx solid #ffffff;
  378. }
  379. }
  380. }
  381. .user-order {
  382. width: 654rpx;
  383. height: auto;
  384. padding: 0 24rpx;
  385. background-color: $bg-color;
  386. margin-bottom: 24rpx;
  387. position: absolute;
  388. bottom: -170rpx;
  389. left: 24rpx;
  390. border-radius: 20rpx;
  391. }
  392. .tab-title {
  393. font-size: $font-size-28;
  394. line-height: 80rpx;
  395. color: #333333;
  396. text-align: left;
  397. border-bottom: 1px solid #f8f8f8;
  398. position: relative;
  399. .cell-tit {
  400. font-size: $font-size-28;
  401. color: $text-color;
  402. }
  403. .cell-more {
  404. float: right;
  405. line-height: 80rpx;
  406. font-size: $font-size-24;
  407. color: #666666;
  408. padding-right: 30rpx;
  409. }
  410. .iconfont {
  411. width: 30rpx;
  412. height: 80rpx;
  413. line-height: 80rpx;
  414. text-align: center;
  415. position: absolute;
  416. right: 0;
  417. top: 0;
  418. display: block;
  419. font-size: $font-size-28;
  420. }
  421. }
  422. .order-section {
  423. display: flex;
  424. justify-content: space-around;
  425. align-items: center;
  426. flex-wrap: wrap;
  427. height: 99rpx;
  428. padding: 24rpx 0;
  429. }
  430. .order-item {
  431. flex: 1;
  432. display: flex;
  433. flex-direction: column;
  434. align-items: center;
  435. position: relative;
  436. &:last-child {
  437. margin-right: 0;
  438. }
  439. .order-icon {
  440. width: 52rpx;
  441. height: 52rpx;
  442. position: relative;
  443. image {
  444. width: 52rpx;
  445. height: 52rpx;
  446. }
  447. .icon-num {
  448. position: absolute;
  449. right: -24rpx;
  450. top: -9rpx;
  451. }
  452. .icon-num.goleft {
  453. right: -12rpx;
  454. }
  455. }
  456. .order-t {
  457. line-height: 50rpx;
  458. font-size: $font-size-24;
  459. color: $text-color;
  460. }
  461. }
  462. .foot-list {
  463. width: 702rpx;
  464. padding: 0 24rpx;
  465. padding-top: 168rpx;
  466. }
  467. .list-cell-image {
  468. width: 100%;
  469. height: 168rpx;
  470. background: url(https://static.caimei365.com/app/meibohui/app/activity-small-banner@2x.png);
  471. background-size: cover;
  472. box-sizing: border-box;
  473. margin-bottom: 24rpx;
  474. .text {
  475. width: 100%;
  476. height: 100%;
  477. box-sizing: border-box;
  478. padding: 38rpx 56rpx;
  479. .h1 {
  480. line-height: 50rpx;
  481. font-size: $font-size-36;
  482. color: #ffffff;
  483. }
  484. .p {
  485. line-height: 34rpx;
  486. font-size: $font-size-30;
  487. color: #ffffff;
  488. }
  489. }
  490. }
  491. .list-cell-item {
  492. width: 654rpx;
  493. height: auto;
  494. margin-bottom: 24rpx;
  495. padding: 0 24rpx;
  496. background: $bg-color;
  497. border-radius: 20rpx;
  498. }
  499. .list-cell {
  500. width: 100%;
  501. line-height: 100rpx;
  502. position: relative;
  503. background: $bg-color;
  504. border-bottom: 1px solid #ebebeb;
  505. height: 100rpx;
  506. &:last-child {
  507. border-bottom: none;
  508. }
  509. &.cell-hover {
  510. background: #fafafa;
  511. }
  512. .cell-icon {
  513. width: 60rpx;
  514. height: 100rpx;
  515. text-align: center;
  516. box-sizing: border-box;
  517. padding: 32rpx 12rpx;
  518. float: left;
  519. .cell-icon-image {
  520. width: 36rpx;
  521. height: 36rpx;
  522. display: block;
  523. }
  524. }
  525. .cell-more {
  526. width: 60rpx;
  527. height: 100rpx;
  528. line-height: 100rpx;
  529. text-align: right;
  530. position: absolute;
  531. right: 0;
  532. top: 0;
  533. font-size: $font-size-28;
  534. color: #666666;
  535. .txt {
  536. color: #fb4343;
  537. padding-right: 10rpx;
  538. }
  539. }
  540. .cell-tit {
  541. width: 465rpx;
  542. display: block;
  543. float: left;
  544. font-size: $font-size-28;
  545. color: #666666;
  546. margin-right: 10rpx;
  547. text-align: left;
  548. }
  549. .cell-tip {
  550. font-size: $font-size-28;
  551. color: $text-color;
  552. }
  553. }
  554. .list-cell.last {
  555. border-bottom: none;
  556. }
  557. .uni-badge--small {
  558. -webkit-transform: scale(0.8);
  559. -ms-transform: scale(0.8);
  560. transform: scale(0.8);
  561. -webkit-transform-origin: center center;
  562. -ms-transform-origin: center center;
  563. transform-origin: center center;
  564. }
  565. .uni-badge {
  566. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  567. -webkit-box-sizing: border-box;
  568. box-sizing: border-box;
  569. font-size: 12px;
  570. line-height: 1;
  571. display: inline-block;
  572. padding: 3px 6px;
  573. color: #333;
  574. border-radius: 100px;
  575. background-color: #f1f1f1;
  576. }
  577. .uni-badge-error {
  578. color: #fff;
  579. background-color: #dd524d;
  580. }
  581. .copyright {
  582. width: 100%;
  583. position: absolute;
  584. bottom: 40rpx;
  585. display: flex;
  586. flex-direction: column;
  587. align-items: center;
  588. image {
  589. width: 180rpx;
  590. height: 60rpx;
  591. }
  592. .text {
  593. font-size: 20rpx;
  594. color: #cccccc;
  595. }
  596. }
  597. </style>