user.vue 14 KB

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