user.vue 14 KB

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