user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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:false,
  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.modal = data.constraint === "0" ? true : false
  308. this.skeletonShow = false
  309. })
  310. .catch(error => {
  311. this.$util.msg(error.msg, 2000)
  312. })
  313. })
  314. },
  315. getPhone() {
  316. this.CommonService.QueryAfterSale()
  317. .then(response => {
  318. this.contactNumber = response.data.contactNumber
  319. })
  320. .catch(error => {
  321. this.$util.msg(error.msg, 2000)
  322. })
  323. },
  324. toPhone() {
  325. uni.makePhoneCall({
  326. phoneNumber: this.contactNumber //仅为示例
  327. })
  328. },
  329. navigator(url) {
  330. this.$api.navigateTo(url)
  331. },
  332. handleClick(){
  333. this.modal = false
  334. },
  335. hideMobel(){
  336. this.modal = false
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss">
  342. @import '@/uni.scss';
  343. page {
  344. background-color: #f7f7f7;
  345. }
  346. .user {
  347. width: 100%;
  348. height: 100%;
  349. position: relative;
  350. background: rgba(247, 247, 247, 1);
  351. }
  352. .header {
  353. width: 100%;
  354. position: relative;
  355. background-size: cover;
  356. }
  357. .header-main {
  358. width: 702rpx;
  359. height: 130rpx;
  360. padding: 12rpx 24rpx;
  361. display: flex;
  362. .header-text {
  363. flex: 8;
  364. display: flex;
  365. flex-direction: column;
  366. padding: 15rpx 0;
  367. .user-item {
  368. flex: 1;
  369. height: 50rpx;
  370. line-height: 50rpx;
  371. .u-tips {
  372. display: inline-block;
  373. float: left;
  374. width: 98rpx;
  375. height: 30rpx;
  376. background: #ffffff;
  377. border-radius: 16rpx;
  378. line-height: 30rpx;
  379. font-size: $font-size-20;
  380. text-align: center;
  381. color: $color-system;
  382. margin-left: 10rpx;
  383. margin-top: 12rpx;
  384. }
  385. .icon-jinrudianpu {
  386. font-size: $font-size-26;
  387. line-height: 50rpx;
  388. color: #ffffff;
  389. text-align: left;
  390. margin-left: 12rpx;
  391. }
  392. .u-shop {
  393. font-size: $font-size-28;
  394. line-height: 50rpx;
  395. color: #ffffff;
  396. text-align: left;
  397. }
  398. .u-viptips {
  399. display: inline-block;
  400. float: left;
  401. width: 98rpx;
  402. height: 30rpx;
  403. border: 1px solid #ffe600;
  404. background: linear-gradient(128deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
  405. border-radius: 16rpx;
  406. line-height: 30rpx;
  407. font-size: $font-size-20;
  408. text-align: center;
  409. color: #ffe600;
  410. margin-left: 10rpx;
  411. margin-top: 17rpx;
  412. }
  413. .u-h1 {
  414. float: left;
  415. font-size: $font-size-30;
  416. color: #ffffff;
  417. text-align: left;
  418. -o-text-overflow: ellipsis;
  419. text-overflow: ellipsis;
  420. display: -webkit-box;
  421. word-break: break-all;
  422. -webkit-box-orient: vertical;
  423. -webkit-line-clamp: 1;
  424. overflow: hidden;
  425. }
  426. .u-p {
  427. font-size: $font-size-24;
  428. line-height: 50rpx;
  429. color: #ffffff;
  430. text-align: left;
  431. }
  432. }
  433. }
  434. .header-icon {
  435. flex: 2;
  436. margin-right: 20rpx;
  437. image {
  438. float: right;
  439. width: 128rpx;
  440. height: 128rpx;
  441. border-radius: 100%;
  442. border: 2rpx solid #ffffff;
  443. }
  444. }
  445. }
  446. .header-main-none {
  447. width: 702rpx;
  448. height: 152rpx;
  449. padding: 0 24rpx;
  450. display: flex;
  451. .header-text {
  452. flex: 8;
  453. display: flex;
  454. flex-direction: column;
  455. .user-item {
  456. flex: 1;
  457. height: 50rpx;
  458. line-height: 50rpx;
  459. .line {
  460. margin: 0 10rpx;
  461. }
  462. .u-h1 {
  463. float: left;
  464. font-size: $font-size-36;
  465. color: #ffffff;
  466. text-align: left;
  467. -o-text-overflow: ellipsis;
  468. text-overflow: ellipsis;
  469. display: -webkit-box;
  470. word-break: break-all;
  471. -webkit-box-orient: vertical;
  472. -webkit-line-clamp: 1;
  473. overflow: hidden;
  474. }
  475. .u-p {
  476. font-size: $font-size-24;
  477. line-height: 50rpx;
  478. color: #efefef;
  479. text-align: left;
  480. }
  481. .u-btn {
  482. width: 160rpx;
  483. height: 40rpx;
  484. background: rgba(255, 255, 255, 0.5);
  485. border-radius: 5rpx;
  486. line-height: 40rpx;
  487. text-align: center;
  488. font-size: $font-size-24;
  489. color: #ffffff;
  490. display: block;
  491. margin-top: 5rpx;
  492. padding-left: 6rpx;
  493. .icon-xiangyouhuabeifen {
  494. font-size: $font-size-24;
  495. }
  496. }
  497. }
  498. }
  499. .header-icon {
  500. flex: 2;
  501. display: flex;
  502. margin-right: 20rpx;
  503. align-items: center;
  504. justify-content: center;
  505. image {
  506. float: right;
  507. width: 128rpx;
  508. height: 128rpx;
  509. border-radius: 100%;
  510. border: 2rpx solid #ffffff;
  511. }
  512. }
  513. }
  514. .user-order {
  515. width: 654rpx;
  516. height: auto;
  517. padding: 0 24rpx;
  518. background-color: $bg-color;
  519. margin-bottom: 24rpx;
  520. position: absolute;
  521. bottom: -170rpx;
  522. left: 24rpx;
  523. border-radius: 16rpx;
  524. }
  525. .tab-title {
  526. font-size: $font-size-30;
  527. line-height: 80rpx;
  528. color: #333333;
  529. text-align: left;
  530. position: relative;
  531. .cell-tit {
  532. font-size: $font-size-30;
  533. color: $text-color;
  534. }
  535. }
  536. .order-section {
  537. display: flex;
  538. justify-content: space-around;
  539. align-items: center;
  540. flex-wrap: wrap;
  541. height: 99rpx;
  542. padding: 24rpx 0;
  543. }
  544. .order-item {
  545. flex: 1;
  546. display: flex;
  547. flex-direction: column;
  548. align-items: center;
  549. position: relative;
  550. .order-icon {
  551. width: 52rpx;
  552. height: 52rpx;
  553. position: relative;
  554. .iconfont {
  555. line-height: 52rpx;
  556. font-size: $font-size-48;
  557. color: #ff7a51;
  558. }
  559. .icon-num {
  560. position: absolute;
  561. right: -24rpx;
  562. top: -9rpx;
  563. }
  564. .icon-num.goleft {
  565. right: -12rpx;
  566. }
  567. }
  568. .order-t {
  569. line-height: 50rpx;
  570. font-size: $font-size-24;
  571. color: $text-color;
  572. }
  573. }
  574. .foot-list {
  575. width: 702rpx;
  576. padding: 0 24rpx;
  577. padding-top: 168rpx;
  578. }
  579. .list-cell-item {
  580. width: 654rpx;
  581. height: auto;
  582. margin-bottom: 24rpx;
  583. padding: 0 24rpx;
  584. background: $bg-color;
  585. border-radius: 20rpx;
  586. }
  587. .list-cell {
  588. width: 100%;
  589. line-height: 100rpx;
  590. position: relative;
  591. background: $bg-color;
  592. border-bottom: 1px solid #ebebeb;
  593. height: 100rpx;
  594. &:last-child {
  595. border-bottom: none;
  596. }
  597. &.cell-hover {
  598. background: #fafafa;
  599. }
  600. .cell-icon {
  601. width: 60rpx;
  602. height: 100rpx;
  603. text-align: center;
  604. box-sizing: border-box;
  605. padding: 32rpx 12rpx;
  606. float: left;
  607. .cell-icon-image {
  608. width: 36rpx;
  609. height: 36rpx;
  610. display: block;
  611. }
  612. }
  613. .cell-more {
  614. width: 60rpx;
  615. height: 100rpx;
  616. line-height: 100rpx;
  617. text-align: right;
  618. position: absolute;
  619. right: 0;
  620. top: 0;
  621. font-size: $font-size-28;
  622. color: #666666;
  623. &.cont {
  624. width: 250rpx;
  625. }
  626. .txt {
  627. color: #fb4343;
  628. padding-right: 10rpx;
  629. }
  630. }
  631. .cell-tit {
  632. width: 465rpx;
  633. display: block;
  634. float: left;
  635. font-size: $font-size-28;
  636. color: #666666;
  637. margin-right: 10rpx;
  638. &.cont {
  639. width: 300rpx;
  640. }
  641. }
  642. .cell-tip {
  643. font-size: $font-size-28;
  644. color: $text-color;
  645. }
  646. }
  647. .list-cell.last {
  648. border-bottom: none;
  649. }
  650. .uni-badge--small {
  651. -webkit-transform: scale(0.8);
  652. -ms-transform: scale(0.8);
  653. transform: scale(0.8);
  654. -webkit-transform-origin: center center;
  655. -ms-transform-origin: center center;
  656. transform-origin: center center;
  657. }
  658. .uni-badge {
  659. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  660. -webkit-box-sizing: border-box;
  661. box-sizing: border-box;
  662. font-size: 12px;
  663. line-height: 1;
  664. display: inline-block;
  665. padding: 3px 6px;
  666. color: #333;
  667. border-radius: 100px;
  668. background-color: #f1f1f1;
  669. }
  670. .uni-badge-error {
  671. color: #fff;
  672. background-color: #dd524d;
  673. }
  674. </style>