user.vue 17 KB

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