user.vue 14 KB

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