user.vue 14 KB

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