user.vue 14 KB

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