user.vue 15 KB

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