user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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"><image :src="headpic ? headpic : defalutLogo" mode=""></image></view>
  16. <view class="header-text">
  17. <view class="user-item">
  18. <text class="u-h1">{{ name }}</text> <text class="u-tips">供应商</text>
  19. </view>
  20. <view class="user-item" @click="navigator('/pages/supplier/user/my-shop?shopId=' + shopId)">
  21. <text class="u-shop">进入店铺</text><text class="iconfont icon-jinrudianpu"></text>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 订单 -->
  26. <view class="user-order">
  27. <view class="tab-title"> <text class="cell-tit">我的商品</text> </view>
  28. <view class="order-section">
  29. <view
  30. class="order-item"
  31. @click="navigator('/pages/supplier/user/my-product?listType=0')"
  32. hover-class="common-hover"
  33. :hover-stay-time="50"
  34. >
  35. <view class="order-icon">
  36. <text class="iconfont icon-quanbushangpin"></text>
  37. <text
  38. v-if="allNum > 0"
  39. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  40. :class="[allNum < 10 ? 'goleft' : '']"
  41. >
  42. {{ allNum | BadgeType }}
  43. </text>
  44. </view>
  45. <text class="order-t">全部商品</text>
  46. </view>
  47. <view
  48. class="order-item"
  49. @click="navigator('/pages/supplier/user/my-product?listType=1')"
  50. hover-class="common-hover"
  51. :hover-stay-time="50"
  52. >
  53. <view class="order-icon">
  54. <text class="iconfont icon-yishangjia"></text>
  55. <text
  56. v-if="upNum > 0"
  57. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  58. :class="[upNum < 10 ? 'goleft' : '']"
  59. >
  60. {{ upNum | BadgeType }}
  61. </text>
  62. </view>
  63. <text class="order-t">已上架</text>
  64. </view>
  65. <view
  66. class="order-item"
  67. @click="navigator('/pages/supplier/user/my-product?listType=2')"
  68. hover-class="common-hover"
  69. :hover-stay-time="50"
  70. >
  71. <view class="order-icon">
  72. <text class="iconfont icon-yixiajia"></text>
  73. <text
  74. v-if="downNum > 0"
  75. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  76. :class="[downNum < 10 ? 'goleft' : '']"
  77. >
  78. {{ downNum | BadgeType }}
  79. </text>
  80. </view>
  81. <text class="order-t">已下架</text>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 底部跳转 -->
  87. <view class="foot-list">
  88. <view class="list-cell-item">
  89. <view
  90. class="list-cell"
  91. hover-class="cell-hover"
  92. :hover-stay-time="50"
  93. @click="navigator('/pages/supplier/order/order-list')"
  94. >
  95. <view class="cell-icon">
  96. <image
  97. class="cell-icon-image"
  98. src="https://static.caimei365.com/app/img/icon/icon_club_11@2x.png"
  99. mode=""
  100. ></image>
  101. </view>
  102. <text class="cell-tit">我的订单</text> <text class="cell-more iconfont icon-xiayibu"></text>
  103. <text class="cell-more"></text>
  104. </view>
  105. </view>
  106. <view class="list-cell-item">
  107. <view
  108. class="list-cell"
  109. v-for="(item, index) in firstList"
  110. :key="index"
  111. @click="navigator(item.path)"
  112. hover-class="cell-hover"
  113. :hover-stay-time="50"
  114. >
  115. <view class="cell-icon">
  116. <image class="cell-icon-image" :src="item.icon" mode=""></image>
  117. </view>
  118. <text class="cell-tit">{{ item.name }}</text>
  119. <text class="cell-more iconfont icon-xiayibu"></text>
  120. </view>
  121. </view>
  122. <view class="list-cell-item">
  123. <view class="list-cell" hover-class="cell-hover" :hover-stay-time="50">
  124. <view class="cell-icon">
  125. <image
  126. class="cell-icon-image"
  127. src="https://static.caimei365.com/app/img/icon/icon_club_5@2x.png"
  128. mode=""
  129. ></image>
  130. </view>
  131. <text class="cell-tit cont">联系我们</text>
  132. <text class="cell-more cont" @click="toPhone">{{ contactNumber }}</text>
  133. </view>
  134. <view
  135. class="list-cell"
  136. @click="this.$api.navigateTo('/pages/user/about/about')"
  137. hover-class="cell-hover"
  138. :hover-stay-time="50"
  139. >
  140. <view class="cell-icon">
  141. <image
  142. class="cell-icon-image"
  143. src="https://static.caimei365.com/app/img/icon/icon_club_6@2x.png"
  144. mode=""
  145. ></image>
  146. </view>
  147. <text class="cell-tit">关于我们</text> <text class="cell-more iconfont icon-xiayibu"></text>
  148. </view>
  149. <view
  150. class="list-cell last"
  151. @click="this.$api.navigateTo('/pages/h5/article/page?linkType=99')"
  152. hover-class="cell-hover"
  153. :hover-stay-time="50"
  154. >
  155. <view class="cell-icon">
  156. <image
  157. class="cell-icon-image"
  158. src="https://static.caimei365.com/app/img/icon/icon_club_7@2x.png"
  159. mode=""
  160. ></image>
  161. </view>
  162. <text class="cell-tit">帮助中心</text> <text class="cell-more iconfont icon-xiayibu"></text>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. <!-- 弹窗提示 -->
  168. <tui-modal
  169. :show="modal"
  170. @click="handleClick"
  171. @cancel="hideMobel"
  172. :content="contentModalText"
  173. :button="modalButton"
  174. color="#666666"
  175. :padding="'20rpx 20rpx'"
  176. :size="30"
  177. shape="circle"
  178. :maskClosable="false"
  179. >
  180. </tui-modal>
  181. </view>
  182. </template>
  183. <script>
  184. import authorize from '@/common/config/authorize.js'
  185. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  186. import { mapState, mapMutations } from 'vuex'
  187. export default {
  188. components: {
  189. uniBadge
  190. },
  191. data() {
  192. return {
  193. nvabarData: {
  194. //顶部自定义导航
  195. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  196. showSearch: 0,
  197. title: '账户中心', // 导航栏 中间的标题
  198. haveBack: false,
  199. textLeft: this.$store.state.isIphone,
  200. textColor: '#FFFFFF',
  201. bgColor: ''
  202. },
  203. CustomBar: this.CustomBar, // 顶部导航栏高度
  204. StatusBar: this.StatusBar,
  205. defalutLogo: 'https://static.caimei365.com/app/img/icon/logo@3x.png',
  206. bgImgUrl: 'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
  207. name: '这里是供应商的名字',
  208. headpic: '',
  209. userId: '',
  210. shopId: 0,
  211. skeletonShow: true,
  212. contactNumber: 0,
  213. orderNum: 0, //机构自主下单订单数
  214. allNum: 0, //全部商品
  215. upNum: 0, //已上架
  216. downNum: 0, //已下架
  217. firstList: [
  218. {
  219. name: '运营人员管理',
  220. path: '/pages/supplier/user/operator/list',
  221. icon: 'https://static.caimei365.com/app/img/icon/icon_club_1@2x.png'
  222. },
  223. {
  224. name: '我的资料',
  225. path: '/pages/supplier/user/information',
  226. icon: 'https://static.caimei365.com/app/img/icon/icon_club_12@2x.png'
  227. },
  228. {
  229. name: '账户设置',
  230. path: '/pages/supplier/user/setting/setting',
  231. icon: 'https://static.caimei365.com/app/img/icon/icon_club_4@2x.png'
  232. }
  233. ],
  234. modal:true,
  235. contentModalText:'您的供应商账号上架费将于30日后到期,到期后将无法发布和编辑商品,同时也会影响到其他采美提供的支持服务。请联系采美工作人员进行续费,联系电话0755-22907771或15338851365',
  236. modalButton:[
  237. {
  238. text: '确认',
  239. customStyle: {
  240. color: '#fff',
  241. bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
  242. },
  243. plain: false
  244. }
  245. ]
  246. }
  247. },
  248. created() {
  249. this.initData()
  250. },
  251. filters: {
  252. NumFormat: function(text) {
  253. //处理金额
  254. return Number(text).toFixed(2)
  255. },
  256. BadgeType(n) {
  257. let num = ''
  258. if (n > 99) {
  259. num = '99+'
  260. } else {
  261. num = n
  262. }
  263. return num
  264. }
  265. },
  266. computed: {
  267. ...mapState(['hasLogin', 'userInfo'])
  268. },
  269. methods: {
  270. ...mapMutations(['login', 'logout']),
  271. async initData() {
  272. const wechatCode = await authorize.getCode('weixin') // 根据微信的code获取用户登录状态:1已登录过 -1未登录过
  273. const getUserInfo = await authorize.getUserInfo('weixin')
  274. const params = { code: wechatCode, encryptedData: getUserInfo.encryptedData, iv: getUserInfo.iv }
  275. this.UserService.UserLoginAuthApplets(params).then(response => {
  276. if (response.code == 0 || response.code == 4) {
  277. this.isLogin = true
  278. this.userID = response.data.userId
  279. this.userIdentity = response.data.userIdentity
  280. this.clubStatus = response.data.clubStatus
  281. this.$store.commit('updateStatus', response.data)
  282. this.login(response.data)
  283. uni.setStorageSync('token', response.data.token)
  284. uni.setStorageSync('unionId', response.data.unionId)
  285. this.GetHomePageData()
  286. this.getPhone()
  287. } else {
  288. this.isLogin = false
  289. this.logout()
  290. uni.setStorageSync('unionId', response.data.unionId)
  291. this.$store.commit('updateStatus', response.data)
  292. }
  293. })
  294. },
  295. GetHomePageData() {
  296. this.$api.getStorage().then(resolve => {
  297. this.userId = resolve.userId ? resolve.userId : 0
  298. this.ShopService.GetHomePageData({ userId: this.userId })
  299. .then(response => {
  300. let data = response.data
  301. this.name = data.shop.name //协销名称
  302. this.shopId = data.shop.shopId //供应商ID
  303. this.headpic = data.shop.logo //会所头像
  304. this.allNum = data.allNum //全部商品
  305. this.upNum = data.upNum //已上架
  306. this.downNum = data.downNum //已下架
  307. this.skeletonShow = false
  308. })
  309. .catch(error => {
  310. this.$util.msg(error.msg, 2000)
  311. })
  312. })
  313. },
  314. getPhone() {
  315. this.CommonService.QueryAfterSale()
  316. .then(response => {
  317. this.contactNumber = response.data.contactNumber
  318. })
  319. .catch(error => {
  320. this.$util.msg(error.msg, 2000)
  321. })
  322. },
  323. toPhone() {
  324. uni.makePhoneCall({
  325. phoneNumber: this.contactNumber //仅为示例
  326. })
  327. },
  328. navigator(url) {
  329. this.$api.navigateTo(url)
  330. },
  331. handleClick(){
  332. this.modal = false
  333. },
  334. hideMobel(){
  335. this.modal = false
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss">
  341. @import '@/uni.scss';
  342. page {
  343. background-color: #f7f7f7;
  344. }
  345. .user {
  346. width: 100%;
  347. height: 100%;
  348. position: relative;
  349. background: rgba(247, 247, 247, 1);
  350. }
  351. .header {
  352. width: 100%;
  353. position: relative;
  354. background-size: cover;
  355. }
  356. .header-main {
  357. width: 702rpx;
  358. height: 130rpx;
  359. padding: 12rpx 24rpx;
  360. display: flex;
  361. .header-text {
  362. flex: 8;
  363. display: flex;
  364. flex-direction: column;
  365. padding: 15rpx 0;
  366. .user-item {
  367. flex: 1;
  368. height: 50rpx;
  369. line-height: 50rpx;
  370. .u-tips {
  371. display: inline-block;
  372. float: left;
  373. width: 98rpx;
  374. height: 30rpx;
  375. background: #ffffff;
  376. border-radius: 16rpx;
  377. line-height: 30rpx;
  378. font-size: $font-size-20;
  379. text-align: center;
  380. color: $color-system;
  381. margin-left: 10rpx;
  382. margin-top: 12rpx;
  383. }
  384. .icon-jinrudianpu {
  385. font-size: $font-size-26;
  386. line-height: 50rpx;
  387. color: #ffffff;
  388. text-align: left;
  389. margin-left: 12rpx;
  390. }
  391. .u-shop {
  392. font-size: $font-size-28;
  393. line-height: 50rpx;
  394. color: #ffffff;
  395. text-align: left;
  396. }
  397. .u-viptips {
  398. display: inline-block;
  399. float: left;
  400. width: 98rpx;
  401. height: 30rpx;
  402. border: 1px solid #ffe600;
  403. background: linear-gradient(128deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
  404. border-radius: 16rpx;
  405. line-height: 30rpx;
  406. font-size: $font-size-20;
  407. text-align: center;
  408. color: #ffe600;
  409. margin-left: 10rpx;
  410. margin-top: 17rpx;
  411. }
  412. .u-h1 {
  413. float: left;
  414. font-size: $font-size-30;
  415. color: #ffffff;
  416. text-align: left;
  417. -o-text-overflow: ellipsis;
  418. text-overflow: ellipsis;
  419. display: -webkit-box;
  420. word-break: break-all;
  421. -webkit-box-orient: vertical;
  422. -webkit-line-clamp: 1;
  423. overflow: hidden;
  424. }
  425. .u-p {
  426. font-size: $font-size-24;
  427. line-height: 50rpx;
  428. color: #ffffff;
  429. text-align: left;
  430. }
  431. }
  432. }
  433. .header-icon {
  434. flex: 2;
  435. margin-right: 20rpx;
  436. image {
  437. float: right;
  438. width: 128rpx;
  439. height: 128rpx;
  440. border-radius: 100%;
  441. border: 2rpx solid #ffffff;
  442. }
  443. }
  444. }
  445. .header-main-none {
  446. width: 702rpx;
  447. height: 152rpx;
  448. padding: 0 24rpx;
  449. display: flex;
  450. .header-text {
  451. flex: 8;
  452. display: flex;
  453. flex-direction: column;
  454. .user-item {
  455. flex: 1;
  456. height: 50rpx;
  457. line-height: 50rpx;
  458. .line {
  459. margin: 0 10rpx;
  460. }
  461. .u-h1 {
  462. float: left;
  463. font-size: $font-size-36;
  464. color: #ffffff;
  465. text-align: left;
  466. -o-text-overflow: ellipsis;
  467. text-overflow: ellipsis;
  468. display: -webkit-box;
  469. word-break: break-all;
  470. -webkit-box-orient: vertical;
  471. -webkit-line-clamp: 1;
  472. overflow: hidden;
  473. }
  474. .u-p {
  475. font-size: $font-size-24;
  476. line-height: 50rpx;
  477. color: #efefef;
  478. text-align: left;
  479. }
  480. .u-btn {
  481. width: 160rpx;
  482. height: 40rpx;
  483. background: rgba(255, 255, 255, 0.5);
  484. border-radius: 5rpx;
  485. line-height: 40rpx;
  486. text-align: center;
  487. font-size: $font-size-24;
  488. color: #ffffff;
  489. display: block;
  490. margin-top: 5rpx;
  491. padding-left: 6rpx;
  492. .icon-xiangyouhuabeifen {
  493. font-size: $font-size-24;
  494. }
  495. }
  496. }
  497. }
  498. .header-icon {
  499. flex: 2;
  500. display: flex;
  501. margin-right: 20rpx;
  502. align-items: center;
  503. justify-content: center;
  504. image {
  505. float: right;
  506. width: 128rpx;
  507. height: 128rpx;
  508. border-radius: 100%;
  509. border: 2rpx solid #ffffff;
  510. }
  511. }
  512. }
  513. .user-order {
  514. width: 654rpx;
  515. height: auto;
  516. padding: 0 24rpx;
  517. background-color: $bg-color;
  518. margin-bottom: 24rpx;
  519. position: absolute;
  520. bottom: -170rpx;
  521. left: 24rpx;
  522. border-radius: 16rpx;
  523. }
  524. .tab-title {
  525. font-size: $font-size-30;
  526. line-height: 80rpx;
  527. color: #333333;
  528. text-align: left;
  529. position: relative;
  530. .cell-tit {
  531. font-size: $font-size-30;
  532. color: $text-color;
  533. }
  534. }
  535. .order-section {
  536. display: flex;
  537. justify-content: space-around;
  538. align-items: center;
  539. flex-wrap: wrap;
  540. height: 99rpx;
  541. padding: 24rpx 0;
  542. }
  543. .order-item {
  544. flex: 1;
  545. display: flex;
  546. flex-direction: column;
  547. align-items: center;
  548. position: relative;
  549. .order-icon {
  550. width: 52rpx;
  551. height: 52rpx;
  552. position: relative;
  553. .iconfont {
  554. line-height: 52rpx;
  555. font-size: $font-size-48;
  556. color: #ff7a51;
  557. }
  558. .icon-num {
  559. position: absolute;
  560. right: -24rpx;
  561. top: -9rpx;
  562. }
  563. .icon-num.goleft {
  564. right: -12rpx;
  565. }
  566. }
  567. .order-t {
  568. line-height: 50rpx;
  569. font-size: $font-size-24;
  570. color: $text-color;
  571. }
  572. }
  573. .foot-list {
  574. width: 702rpx;
  575. padding: 0 24rpx;
  576. padding-top: 168rpx;
  577. }
  578. .list-cell-item {
  579. width: 654rpx;
  580. height: auto;
  581. margin-bottom: 24rpx;
  582. padding: 0 24rpx;
  583. background: $bg-color;
  584. border-radius: 20rpx;
  585. }
  586. .list-cell {
  587. width: 100%;
  588. line-height: 100rpx;
  589. position: relative;
  590. background: $bg-color;
  591. border-bottom: 1px solid #ebebeb;
  592. height: 100rpx;
  593. &:last-child {
  594. border-bottom: none;
  595. }
  596. &.cell-hover {
  597. background: #fafafa;
  598. }
  599. .cell-icon {
  600. width: 60rpx;
  601. height: 100rpx;
  602. text-align: center;
  603. box-sizing: border-box;
  604. padding: 32rpx 12rpx;
  605. float: left;
  606. .cell-icon-image {
  607. width: 36rpx;
  608. height: 36rpx;
  609. display: block;
  610. }
  611. }
  612. .cell-more {
  613. width: 60rpx;
  614. height: 100rpx;
  615. line-height: 100rpx;
  616. text-align: right;
  617. position: absolute;
  618. right: 0;
  619. top: 0;
  620. font-size: $font-size-28;
  621. color: #666666;
  622. &.cont {
  623. width: 250rpx;
  624. }
  625. .txt {
  626. color: #fb4343;
  627. padding-right: 10rpx;
  628. }
  629. }
  630. .cell-tit {
  631. width: 465rpx;
  632. display: block;
  633. float: left;
  634. font-size: $font-size-28;
  635. color: #666666;
  636. margin-right: 10rpx;
  637. &.cont {
  638. width: 300rpx;
  639. }
  640. }
  641. .cell-tip {
  642. font-size: $font-size-28;
  643. color: $text-color;
  644. }
  645. }
  646. .list-cell.last {
  647. border-bottom: none;
  648. }
  649. .uni-badge--small {
  650. -webkit-transform: scale(0.8);
  651. -ms-transform: scale(0.8);
  652. transform: scale(0.8);
  653. -webkit-transform-origin: center center;
  654. -ms-transform-origin: center center;
  655. transform-origin: center center;
  656. }
  657. .uni-badge {
  658. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  659. -webkit-box-sizing: border-box;
  660. box-sizing: border-box;
  661. font-size: 12px;
  662. line-height: 1;
  663. display: inline-block;
  664. padding: 3px 6px;
  665. color: #333;
  666. border-radius: 100px;
  667. background-color: #f1f1f1;
  668. }
  669. .uni-badge-error {
  670. color: #fff;
  671. background-color: #dd524d;
  672. }
  673. </style>