user.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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.GetHomePageData()
  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. GetHomePageData(){
  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. uni.setStorage({key: 'shopInfo',data: data.shop})
  183. this.skeletonShow = false;
  184. }).catch(error =>{
  185. this.$util.msg(error.msg,2000)
  186. })
  187. })
  188. },
  189. getPhone(){
  190. this.CommonService.QueryAfterSale().then(response =>{
  191. this.contactNumber = response.data.contactNumber
  192. }).catch(error =>{
  193. this.$util.msg(error.msg,2000);
  194. })
  195. },
  196. toPhone(){
  197. uni.makePhoneCall({
  198. phoneNumber:this.contactNumber //仅为示例
  199. });
  200. },
  201. navigator(url){
  202. this.$api.navigateTo(url)
  203. },
  204. onPullDownRefresh() {//下拉刷新
  205. this.initData()
  206. uni.stopPullDownRefresh()
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss">
  212. @import "@/uni.scss";
  213. page{
  214. background-color: #F7F7F7;
  215. }
  216. .user{
  217. width: 100%;
  218. height: 100%;
  219. position:relative;
  220. background: rgba(247, 247, 247, 1);
  221. }
  222. .header{
  223. width: 100%;
  224. position: relative;
  225. background-size: cover;
  226. border-radius: 0 0 100rpx 100rpx;
  227. }
  228. .header-main{
  229. width: 702rpx;
  230. height: 130rpx;
  231. padding: 12rpx 24rpx;
  232. display: flex;
  233. .header-text{
  234. flex: 8;
  235. display: flex;
  236. flex-direction: column;
  237. padding: 15rpx 0;
  238. .user-item{
  239. flex: 1;
  240. height: 50rpx;
  241. line-height: 50rpx;
  242. .u-tips{
  243. display: inline-block;
  244. float: left;
  245. width: 98rpx;
  246. height: 30rpx;
  247. background: #FFFFFF;
  248. border-radius: 16rpx;
  249. line-height: 30rpx;
  250. font-size: $font-size-20;
  251. text-align: center;
  252. color: $color-system;
  253. margin-left: 10rpx;
  254. margin-top: 12rpx;
  255. }
  256. .icon-jinrudianpu{
  257. font-size: $font-size-26;
  258. line-height: 50rpx;
  259. color: #FFFFFF;
  260. text-align: left;
  261. margin-left: 12rpx;
  262. }
  263. .u-shop{
  264. font-size: $font-size-28;
  265. line-height: 50rpx;
  266. color: #FFFFFF;
  267. text-align: left;
  268. }
  269. .u-viptips{
  270. display: inline-block;
  271. float: left;
  272. width: 98rpx;
  273. height: 30rpx;
  274. border: 1px solid #FFE600;
  275. background: linear-gradient(128deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  276. border-radius: 16rpx;
  277. line-height: 30rpx;
  278. font-size: $font-size-20;
  279. text-align: center;
  280. color: #FFE600;
  281. margin-left: 10rpx;
  282. margin-top: 17rpx;
  283. }
  284. .u-h1{
  285. float: left;
  286. font-size: $font-size-30;
  287. color: #FFFFFF;
  288. text-align: left;
  289. -o-text-overflow: ellipsis;
  290. text-overflow: ellipsis;
  291. display: -webkit-box;
  292. word-break: break-all;
  293. -webkit-box-orient: vertical;
  294. -webkit-line-clamp: 1;
  295. overflow: hidden;
  296. }
  297. .u-p{
  298. font-size: $font-size-24;
  299. line-height: 50rpx;
  300. color: #FFFFFF;
  301. text-align: left;
  302. }
  303. }
  304. }
  305. .header-icon{
  306. flex: 2;
  307. margin-right: 20rpx;
  308. image{
  309. float: right;
  310. width: 128rpx;
  311. height: 128rpx;
  312. border-radius: 100%;
  313. border: 2rpx solid #FFFFFF;
  314. }
  315. }
  316. }
  317. .header-main-none{
  318. width: 702rpx;
  319. height: 152rpx;
  320. padding: 0 24rpx;
  321. display: flex;
  322. .header-text{
  323. flex: 8;
  324. display: flex;
  325. flex-direction: column;
  326. .user-item{
  327. flex: 1;
  328. height: 50rpx;
  329. line-height: 50rpx;
  330. .line{
  331. margin: 0 10rpx;
  332. }
  333. .u-h1{
  334. float: left;
  335. font-size: $font-size-36;
  336. color: #FFFFFF;
  337. text-align: left;
  338. -o-text-overflow: ellipsis;
  339. text-overflow: ellipsis;
  340. display: -webkit-box;
  341. word-break: break-all;
  342. -webkit-box-orient: vertical;
  343. -webkit-line-clamp: 1;
  344. overflow: hidden;
  345. }
  346. .u-p{
  347. font-size: $font-size-24;
  348. line-height: 50rpx;
  349. color: #EFEFEF;
  350. text-align: left;
  351. }
  352. .u-btn{
  353. width: 160rpx;
  354. height: 40rpx;
  355. background: rgba(255,255,255,.5);
  356. border-radius: 5rpx;
  357. line-height: 40rpx;
  358. text-align: center;
  359. font-size: $font-size-24;
  360. color: #FFFFFF;
  361. display: block;
  362. margin-top: 5rpx;
  363. padding-left: 6rpx;
  364. .icon-xiangyouhuabeifen{
  365. font-size: $font-size-24;
  366. }
  367. }
  368. }
  369. }
  370. .header-icon{
  371. flex: 2;
  372. display: flex;
  373. margin-right: 20rpx;
  374. align-items: center;
  375. justify-content: center;
  376. image{
  377. float: right;
  378. width: 128rpx;
  379. height: 128rpx;
  380. border-radius: 100%;
  381. border: 2rpx solid #FFFFFF;
  382. }
  383. }
  384. }
  385. .user-order{
  386. width: 654rpx;
  387. height: auto;
  388. padding: 0 24rpx;
  389. background-color: $bg-color;
  390. margin-bottom: 24rpx;
  391. position: absolute;
  392. bottom: -170rpx;
  393. left: 24rpx;
  394. border-radius: 16rpx;
  395. box-shadow:0px 3px 6px rgba(225,86,22,0.07);
  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. box-shadow:0px 3px 6px rgba(225,86,22,0.07);
  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. &.cell-hover{
  470. background:#fafafa;
  471. }
  472. .cell-icon{
  473. width: 60rpx;
  474. height: 100rpx;
  475. line-height: 100rpx;
  476. text-align: center;
  477. .iconfont{
  478. font-size: $font-size-34;
  479. color: #666666;
  480. }
  481. }
  482. .cell-more{
  483. align-self: baseline;
  484. font-size:$font-size-28;
  485. color:#666666;
  486. .txt{
  487. color: #FB4343;
  488. padding-right: 10rpx;
  489. }
  490. }
  491. .cell-tit{
  492. flex: 1;
  493. font-size: $font-size-28;
  494. color: #666666;
  495. margin-right:10rpx;
  496. }
  497. .cell-tip{
  498. font-size: $font-size-28;
  499. color: $text-color;
  500. }
  501. }
  502. .list-cell.last{
  503. border-bottom: none;
  504. }
  505. .uni-badge--small {
  506. -webkit-transform: scale(.8);
  507. -ms-transform: scale(.8);
  508. transform: scale(.8);
  509. -webkit-transform-origin: center center;
  510. -ms-transform-origin: center center;
  511. transform-origin: center center;
  512. }
  513. .uni-badge {
  514. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  515. -webkit-box-sizing: border-box;
  516. box-sizing: border-box;
  517. font-size: 12px;
  518. line-height: 1;
  519. display: inline-block;
  520. padding: 3px 6px;
  521. color: #333;
  522. border-radius: 100px;
  523. background-color: #f1f1f1;
  524. }
  525. .uni-badge-error {
  526. color: #fff;
  527. background-color: #dd524d;
  528. }
  529. </style>