user.vue 14 KB

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