user.vue 14 KB

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