user.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view class="container">
  3. <scroll-view class="content-box" scroll-y="true">
  4. <view class="user-section">
  5. <view class="avatar" @click="navTo('/pages/set/userinfo')">
  6. <image class="image" :src="user.avatar|| urlFile+`/static/error/missing-face.png`" mode="scaleToFill"></image>
  7. </view>
  8. <view class="flex-center phone" >
  9. <template v-if="user.phone">
  10. {{((''+user.phone).split('').splice(3,4,'****')).join('')}}
  11. </template>
  12. </view>
  13. <view class="tj-sction">
  14. <view class="tj-item" @click="navTo('/pages/user_home/award/award')">
  15. <text class="num">{{ user.brokerage_price || '0.00' }}</text>
  16. <text>我的佣金</text>
  17. </view>
  18. <!-- <view class="tj-item" @click="navTo('/pages/user/award/award')">
  19. <text class="num">{{ user.brokerage_price || '0.00' }}</text>
  20. <text>我的推广</text>
  21. </view> -->
  22. <view class="tj-item" @click="navTo('/pages/user_home/money/wallet')">
  23. <text class="num">{{user.now_money || '0.00' }}</text>
  24. <text>我的余额</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="cover-container">
  29. <view class="item-box">
  30. <view class="box-title flex">
  31. <view class="title"><text>我的订单</text></view>
  32. <view class="link flex" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
  33. <text class="margin-r-10">全部</text>
  34. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  35. </view>
  36. </view>
  37. <view class="order-section">
  38. <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
  39. :hover-stay-time="50">
  40. <view class=" icon position-relative">
  41. <image class="icon-img" src="../../static/icon/userorder1.png" mode="aspectFit">
  42. </image>
  43. <view class="corner" v-if="user.unpaid_count > 0">
  44. <text>{{ user.unpaid_count }}</text>
  45. </view>
  46. </view>
  47. <text>待付款</text>
  48. </view>
  49. <view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover"
  50. :hover-stay-time="50">
  51. <view class="icon position-relative">
  52. <image class="icon-img" src="../../static/icon/userorder2.png" mode="aspectFit">
  53. </image>
  54. <view class="corner" v-if="user.received_count > 0">
  55. <text>{{ user.received_count }}</text>
  56. </view>
  57. </view>
  58. <text>待核销</text>
  59. </view>
  60. <view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
  61. :hover-stay-time="50">
  62. <view class=" icon position-relative">
  63. <image class="icon-img" src="../../static/icon/userorder3.png" mode="aspectFit">
  64. </image>
  65. </view>
  66. <text>已完成</text>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="listBox">
  71. <view class="list">
  72. <view class="flex listItem" @click="navTo('/pages/user/model/mymodellist')">
  73. <view class="flex titleBox">
  74. <image class="listIconImg" src="../../static/icon/userreal.png" mode="widthFix"></image>
  75. <text class="title">实名认证</text>
  76. </view>
  77. <view class="right flex">
  78. <text></text>
  79. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  80. </view>
  81. </view>
  82. <button hover-class="none" class="flex listItem" open-type='contact'>
  83. <view class="flex titleBox">
  84. <image class="listIconImg" src="../../static/icon/userkf.png" mode="widthFix"></image>
  85. <text class="title">客服</text>
  86. </view>
  87. <view class="right flex">
  88. <text></text>
  89. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  90. </view>
  91. </button>
  92. <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  93. <view class="flex titleBox">
  94. <image class="listIconImg" src="../../static/icon/usergg.png" mode="widthFix"></image>
  95. <text class="title">邀请好友</text>
  96. </view>
  97. <view class="right flex">
  98. <text></text>
  99. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  100. </view>
  101. </view>
  102. <view class="flex listItem" @click="navTo('/pages/set/set')">
  103. <view class="flex titleBox">
  104. <image class="listIconImg" src="../../static/icon/userset.png" mode="widthFix"></image>
  105. <text class="title">设置</text>
  106. </view>
  107. <view class="right flex">
  108. <text></text>
  109. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </scroll-view>
  116. </view>
  117. </template>
  118. <script>
  119. import {
  120. mapState,
  121. mapMutations
  122. } from 'vuex';
  123. import {
  124. share
  125. } from '@/api/wx';
  126. import {
  127. getUser
  128. } from '@/api/user.js';
  129. import {
  130. articleList,
  131. notify
  132. } from '@/api/index.js';
  133. import {
  134. saveUrl,
  135. interceptor
  136. } from '@/utils/loginUtils.js';
  137. export default {
  138. data() {
  139. return {
  140. user: {
  141. avatar: '', //头像
  142. nickname: '', //昵称
  143. phone:''
  144. },
  145. shareData: {}
  146. };
  147. },
  148. computed: {
  149. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  150. ...mapState(['baseURL', 'urlFile']),
  151. ...mapState(['fx']),
  152. // 总消息条数
  153. notic() {
  154. return this.user.question_sum + this.user.notice_sum;
  155. },
  156. },
  157. // 创建时获取分享信息
  158. onLoad() {
  159. // share().then((res) => {
  160. // this.shareData = res.data.data
  161. // }).catch((res) => {
  162. // console.log(res, '分享加载失败');
  163. // })
  164. },
  165. onShow() {
  166. this.getUser();
  167. },
  168. methods: {
  169. ...mapMutations('user', ['setUserInfo']),
  170. // 跳转卡片页面
  171. navcard() {
  172. // 判断是否已经认证
  173. if (this.user.work_type_id <=0) {
  174. this.navTo('/pages/user/model/modelrz')
  175. } else {
  176. if (this.user.show_template_id) {
  177. this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id+'&look=1')
  178. }else{
  179. this.navTo('/pages/user/model/model')
  180. }
  181. }
  182. },
  183. //#ifdef APP
  184. shareDomApp() {
  185. uni.share({
  186. provider: 'weixin',
  187. type: 0,
  188. title: '母婴界严选',
  189. summary: '',
  190. imageUrl: this.shareData.img,
  191. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  192. })
  193. },
  194. //#endif
  195. // 获取用户数据
  196. getUser() {
  197. console.log('data')
  198. const that = this;
  199. getUser({}).then((e) => {
  200. this.user = e.data;
  201. this.setUserInfo(e.data)
  202. }).catch((e) => {
  203. console.log(e, 'sj');
  204. })
  205. // 系统消息
  206. // articleList({}, 1).then((e) => {
  207. // that.user.question_sum = e.data.count
  208. // console.log(that, 1);
  209. // }).catch((e) => {
  210. // console.log(e);
  211. // })
  212. // 报警消息
  213. // notify().then((e) => {
  214. // that.user.notice_sum = e.data.count
  215. // }).catch((e) => {
  216. // console.log(e);
  217. // })
  218. },
  219. changeTab() {
  220. this.$emit('tab', true)
  221. },
  222. navTo(url) {
  223. console.log(this.hasLogin,'this.hasLogin');
  224. if (!this.hasLogin) {
  225. // 保存地址
  226. saveUrl();
  227. // 登录拦截
  228. interceptor();
  229. } else {
  230. uni.navigateTo({
  231. url,
  232. fail(e) {
  233. console.log(e);
  234. }
  235. });
  236. }
  237. },
  238. }
  239. };
  240. </script>
  241. <style lang="scss">
  242. %section {
  243. display: flex;
  244. justify-content: space-around;
  245. align-content: center;
  246. border-radius: 10rpx;
  247. }
  248. %flex-center {
  249. display: flex;
  250. flex-direction: column;
  251. justify-content: center;
  252. align-items: center;
  253. }
  254. page {
  255. height: 100%;
  256. }
  257. .listBox {
  258. margin-top: 20rpx;
  259. overflow: hidden;
  260. }
  261. .list {
  262. .listItem {
  263. padding: 35rpx 40rpx;
  264. margin-bottom: 15rpx;
  265. background-color: #FFFFFF;
  266. border-radius: 20rpx;
  267. border: none;
  268. line-height: 1;
  269. &::after{
  270. border: none;
  271. }
  272. }
  273. .listIconImg {
  274. width: 36rpx;
  275. height: 36rpx;
  276. }
  277. .right {
  278. .img {
  279. width: 26rpx;
  280. }
  281. }
  282. .titleBox {
  283. .title {
  284. padding-left: 20rpx;
  285. color: $font-color-base;
  286. font-size: $font-base;
  287. }
  288. }
  289. }
  290. .container {
  291. height: 100%;
  292. background-color: $page-color-base;
  293. background-image: url('../../static/image/userbg.png') ;
  294. background-repeat: no-repeat;
  295. background-size: 100% auto;
  296. padding-top: 100rpx;
  297. }
  298. .content-box {
  299. height: 100%;
  300. }
  301. .user-section {
  302. background-color: #FFF;
  303. border-radius: 20rpx;
  304. margin: 0 $page-row-spacing;
  305. padding: 20rpx 0;
  306. padding-top: 50rpx;
  307. .avatar{
  308. width: 130rpx;
  309. height: 130rpx;
  310. margin: 0 auto;
  311. border-radius: 100rpx;
  312. overflow: hidden;
  313. margin-bottom: 30rpx;
  314. .image{
  315. width:100%;
  316. height: 100%;
  317. }
  318. }
  319. .phone{
  320. height:1rem;
  321. margin-bottom: 50rpx;
  322. }
  323. }
  324. .cover-container {
  325. padding: 0 30rpx;
  326. position: relative;
  327. padding-bottom: 20rpx;
  328. }
  329. .tj-sction {
  330. @extend %section;
  331. .tj-item {
  332. @extend %flex-center;
  333. flex-direction: column;
  334. height: 100rpx;
  335. font-size: $font-sm;
  336. color: $font-color-light;
  337. }
  338. .num {
  339. font-size: $font-base;
  340. color: $font-color-dark;
  341. margin-bottom: 8rpx;
  342. font-weight: bold;
  343. }
  344. }
  345. .item-box {
  346. border-radius: 20rpx;
  347. background-color: white;
  348. margin-top: 20rpx;
  349. .box-title {
  350. line-height: 1;
  351. padding: 30rpx 40rpx;
  352. .title {
  353. font-size: $font-lg;
  354. font-weight: bold;
  355. }
  356. .link {
  357. font-size: $font-base - 2rpx;
  358. color: $font-color-light;
  359. .img{
  360. width: 26rpx;
  361. }
  362. }
  363. }
  364. .order-section {
  365. @extend %section;
  366. padding: 28rpx 0;
  367. padding-top: 0;
  368. .order-item {
  369. @extend %flex-center;
  370. width: 120rpx;
  371. height: 120rpx;
  372. border-radius: 10rpx;
  373. font-size: $font-sm;
  374. color: $font-color-dark;
  375. }
  376. .iconfont {
  377. font-size: 48rpx;
  378. margin-bottom: 18rpx;
  379. color: #fa436a;
  380. }
  381. .icon-shouhoutuikuan {
  382. font-size: 44rpx;
  383. }
  384. .icon {
  385. height: 50rpx;
  386. width: 48rpx;
  387. margin-bottom: 18rpx;
  388. background-size: 100%;
  389. background-repeat: no-repeat;
  390. background-position: center;
  391. .icon-img {
  392. width: 100%;
  393. height: 100%;
  394. }
  395. }
  396. }
  397. }
  398. </style>