user.vue 14 KB

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