user.vue 9.6 KB

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