mine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <view >
  3. <!-- 扫一扫错误回调 -->
  4. <u-modal title="扫描异常" confirm-color="#dc9b21" v-model="scanNotify.scan" :content="scanNotify.scanMessage"></u-modal>
  5. <view style="position: relative;">
  6. <image src="@/static/icon/bg.png" class="bg-img"></image>
  7. <image src="@/static/icon/bg-yin.png" class="shuiyin" mode=""></image>
  8. <view class="card">
  9. <view class="info" v-if="vuex_userId">
  10. <view class="flex">
  11. <image class="avatar" :src="userInfo.avatar"></image>
  12. <view class="nickname">
  13. <block style="display: flex;">
  14. <text >{{userInfo.nickName}}</text>
  15. <view v-if="vuex_agenter_type!=0" class="cu-tag bg-tag sm round margin-left-20">
  16. <text v-if="vuex_agenter_type==1">独家代理</text>
  17. <text v-if="vuex_agenter_type==2">渠道合伙人</text>
  18. </view>
  19. </block>
  20. </view>
  21. </view>
  22. <!-- <view class="center padding-right-20">
  23. <image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
  24. </view> -->
  25. </view>
  26. <view class="info" v-else>
  27. <view class="flex">
  28. <image class="avatar" src="/static/icon/avatar.png"></image>
  29. <view class="nickname">
  30. <block style="display: flex;">
  31. <text >用户未登录</text>
  32. <view @click="showLogin" class="cu-tag bg-tag sm round margin-left-20">
  33. 点击登录
  34. </view>
  35. </block>
  36. </view>
  37. </view>
  38. <view class="center padding-right-20" @click="jump()">
  39. <image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
  40. </view>
  41. </view>
  42. <view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
  43. <view class="cu-item" @click="item.name=='扫一扫'? scanCode() :jump(item.path)" v-for="(item,index) in menuList" :key="index">
  44. <view class="grid-icon" >
  45. <image style="width: 66rpx;height: 66rpx;" :src="item.icon"/>
  46. </view>
  47. <text style="color: #242424;font-size: 26rpx;" >{{item.name}}</text>
  48. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="navbar-top" :style="{ 'background': 'rgba(255, 139, 47,'+toumindu+')'}">
  54. <view class="text-center text-white title ">联兑通</view>
  55. </view>
  56. <view class="account">
  57. <text class="title">我的账户</text>
  58. <view class="menu">
  59. <view class="item" @click="jump('/pages/mine/my-points/my-points?point='+userInfo.point)">
  60. <text>{{userInfo.point || 0}}</text>
  61. 我的积分
  62. </view>
  63. <view class="item" @click="jump('/pages/mine/my-balance/my-balance?pointValue='+userInfo.pointValue)">
  64. <text>{{userInfo.pointValue || 0}}</text>
  65. 余额
  66. </view>
  67. </view>
  68. </view>
  69. <view class="exchange">
  70. <view class="top" style="padding: 20rpx 30rpx 10rpx;">
  71. <text>积分通兑</text>
  72. <text @click="jump('/pages/mine/my-points/exchange')">更多 ></text>
  73. </view>
  74. <view class="menu-list">
  75. <view class="item item1">
  76. <image src="@/static/icon/jiayou.png" mode=""></image>
  77. <text class="title" style="color: #F6532A;">积分加油站</text>
  78. <view class="cu-btn round sm" >
  79. 去充值
  80. </view>
  81. </view>
  82. <view class="item item2">
  83. <image src="@/static/icon/yidong.png" mode=""></image>
  84. <text class="title" style="color: #4AB0FF;">中国移动</text>
  85. <view class="cu-btn round sm" >
  86. 120:100兑入
  87. </view>
  88. </view>
  89. <view class="item item3">
  90. <image src="../../static/bank/BOC.png" mode=""></image>
  91. <text class="title" style="color: #CF4948;">中国银行</text>
  92. <view class="cu-btn round sm">
  93. 530:100兑入
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="consume" v-if="false">
  99. <view class="top" style="padding: 20rpx 30rpx 10rpx;">
  100. <text>赚积分</text>
  101. <text>更多 ></text>
  102. </view>
  103. <view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
  104. <view class="cu-item" @click="jump(item.path)" v-for="(item,index) in gainList" :key="index">
  105. <view class="grid-icon" >
  106. <image style="width: 160rpx;height: 160rpx;border-radius: 16rpx;" :src="item.icon"/>
  107. </view>
  108. <text style="color: #222222;font-size: 26rpx;" >{{item.name}}</text>
  109. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="consume" @click="jump('/pages/gain/gain',1)">
  114. <view class="top" style="padding: 20rpx 30rpx 10rpx;">
  115. <text>去花积分</text>
  116. <text>更多 ></text>
  117. </view>
  118. <view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
  119. <view class="cu-item" @click.stop="jumpMiniProgram(item.path)" v-for="(item,index) in pointsList" :key="index">
  120. <view class="grid-icon" >
  121. <image style="width: 88rpx;height: 88rpx;" :src="item.icon"/>
  122. </view>
  123. <text style="color: #222222;font-size: 26rpx;" >{{item.name}}</text>
  124. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  125. </view>
  126. </view>
  127. </view>
  128. <login ref="login" @signIn="signIn"></login>
  129. </view>
  130. </template>
  131. <script>
  132. import login from "@/components/login.vue"
  133. export default {
  134. components:{
  135. login
  136. },
  137. data() {
  138. return {
  139. scanNotify:{scan: false,scanMessage:'扫描错误,请稍后重试!' },
  140. toumindu: 0.00,
  141. //功能列表
  142. menuList:[],
  143. gainList:[],
  144. pointsList:[],
  145. //用户信息
  146. userInfo:{}
  147. }
  148. },
  149. onPageScroll(obj){
  150. this.toumindu = obj.scrollTop*0.006;
  151. },
  152. onLoad() {
  153. this.fetchStatic()
  154. },
  155. onShow() {
  156. this.login()
  157. },
  158. methods: {
  159. async init(){
  160. await this.fetchUserInfo()
  161. await this.judgeAgenterType()
  162. },
  163. async judgeAgenterType(){
  164. let params={
  165. userId:this.vuex_userId,
  166. enabled:1
  167. }
  168. let res=await this.$api.agenter.list(params)
  169. if (!this.$isEmpty(res.data.records)) {
  170. let item=res.data.records[0]
  171. let type=this.$isEmpty(item.agenterTypeId)?1:2
  172. this.$u.vuex('vuex_agenter_type',type)
  173. }
  174. },
  175. async fetchUserInfo(){
  176. let params={
  177. id:this.vuex_userId
  178. }
  179. let res=await this.$api.loginUser.detail(params)
  180. if (this.$isEmpty(res.data)) {
  181. //清除userId和手机号
  182. this.$u.vuex('vuex_userId',null)
  183. this.$u.vuex('vuex_phone',null)
  184. this.$cache.remove('lifeData')
  185. this.$cache.remove('userInfo')
  186. //刷新当前页
  187. this.login()
  188. }else{
  189. this.userInfo=res.data
  190. }
  191. },
  192. // 登录 begin
  193. showLogin(){
  194. this.$refs.login.show()
  195. },
  196. showPhoneModal(){
  197. this.$refs.login.showPhoneModal()
  198. },
  199. signIn(resp){
  200. //获取手机号
  201. if (this.$isEmpty(this.vuex_phone)) {
  202. this.showPhoneModal()
  203. }else{
  204. this.$u.toast('登录成功')
  205. }
  206. //获取数据
  207. this.init()
  208. },
  209. async login(e){
  210. if (this.$isEmpty(this.vuex_userId)) {
  211. this.showLogin()
  212. return
  213. }
  214. //获取数据
  215. this.init()
  216. //获取手机号
  217. if (this.$isEmpty(this.vuex_phone)) {
  218. this.showPhoneModal()
  219. }
  220. },
  221. // 登录 end
  222. scanCode(){
  223. const _this = this;
  224. uni.scanCode({
  225. success: function (res) {
  226. let result=res.result
  227. let url=result.split("#")[1]
  228. _this.jump(url)
  229. },
  230. fail: (res) => {
  231. if(res.errMsg!='scanCode:fail cancel'){
  232. this.scanNotify = {scan: true,scanMessage: res.errMsg};
  233. }
  234. }
  235. });
  236. },
  237. jump(url,type){
  238. if (type==1) {
  239. uni.switchTab({
  240. url
  241. })
  242. return
  243. }
  244. if (this.$isEmpty(this.vuex_userId)) {
  245. this.login()
  246. return
  247. }
  248. uni.navigateTo({
  249. url
  250. })
  251. },
  252. jumpMiniProgram(appid,path){
  253. this.$mpi.navigateToMiniProgram(appid)
  254. },
  255. fetchStatic(){
  256. this.menuList=[
  257. {
  258. icon:'/static/icon/scan.png',
  259. name:'扫一扫',
  260. path:'/pages/checkstand/index'
  261. },
  262. {
  263. icon:'/static/icon/pay.png',
  264. name:'付款码',
  265. path:'/pages/checkstand/pay-qrcode'
  266. },
  267. {
  268. icon:'/static/icon/setting1.png',
  269. name:'设置',
  270. path:'/pages/mine/setting/setting'
  271. }
  272. ]
  273. this.gainList=[
  274. {
  275. icon:'/static/icon/daili.png',
  276. name:'成为代理',
  277. path:'/pages/mine/card/card'
  278. },
  279. {
  280. icon:'/static/icon/xianfeng.png',
  281. name:'音乐先锋榜',
  282. path:'/pages/mine/card/card'
  283. },
  284. {
  285. icon:'/static/icon/xianfeng.png',
  286. name:'音乐先锋榜',
  287. path:'/pages/mine/card/card'
  288. },
  289. ]
  290. this.pointsList=[
  291. {
  292. icon:'/static/icon/life.png',
  293. name:'生活服务',
  294. path:''
  295. },
  296. {
  297. icon:'/static/icon/jiaotong.png',
  298. name:'交通出行',
  299. path:this.$global.APPID.didi
  300. },
  301. {
  302. icon:'/static/icon/shop.png',
  303. name:'购物',
  304. path:''
  305. },
  306. {
  307. icon:'/static/icon/yiyao.png',
  308. name:'医疗',
  309. path:this.$global.APPID.nanyue
  310. },
  311. ]
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .bg-tag{
  318. color: #FFFFFF;
  319. background-color: #EA3723;
  320. }
  321. .shuiyin{
  322. overflow: hidden;
  323. width: 260rpx;
  324. height: 280rpx;
  325. position: absolute;
  326. right: 10rpx;
  327. top: 30rpx;
  328. }
  329. .bg-img{
  330. width: 100vw;
  331. height: 420rpx;
  332. }
  333. .navbar-top{
  334. position: fixed;
  335. width: 100%;
  336. top: 0;
  337. z-index:99999;
  338. padding-top:var(--status-bar-height);
  339. transition: top .25s;
  340. .title{
  341. padding: 18.18rpx 0;
  342. }
  343. }
  344. .card{
  345. position: relative;
  346. margin: -240rpx 20rpx 0;
  347. border-radius: 20rpx;
  348. background-color: #FFFFFF;
  349. .info{
  350. padding: 20rpx 20rpx 0;
  351. display: flex;
  352. justify-content: space-between;
  353. .avatar{
  354. width: 100rpx;
  355. height: 100rpx;
  356. border-radius: 50%;
  357. }
  358. .nickname{
  359. font-weight: 800;
  360. color: #222222;
  361. font-size: 30rpx;
  362. margin-left: 20rpx;
  363. display: flex;
  364. align-items: center;
  365. justify-content: center;
  366. }
  367. }
  368. }
  369. .account{
  370. padding: 20rpx;
  371. color: #222222;
  372. margin: 20rpx;
  373. border-radius: 20rpx;
  374. background-color: #FFFFFF;
  375. .title{
  376. padding-left: 20rpx;
  377. font-weight: 800;
  378. font-size: 34rpx;
  379. color: #26272F;
  380. }
  381. .menu{
  382. display: flex;
  383. justify-content: space-around;
  384. view{
  385. padding-top: 20rpx;
  386. display: flex;
  387. flex-direction: column;
  388. justify-content: center;
  389. align-items: center;
  390. text:first-child{
  391. font-weight: 800;
  392. padding-bottom: 10rpx;
  393. font-size: 32rpx;
  394. color: #FF9447;
  395. }
  396. text:last-child{
  397. }
  398. }
  399. }
  400. }
  401. .exchange{
  402. border-radius: 20rpx;
  403. background-color: #FFFFFF;
  404. padding: 10rpx 10rpx 30rpx;
  405. margin: 20rpx;
  406. .top{
  407. text:first-child{
  408. font-size: 34rpx;
  409. font-weight: 800;
  410. color: #26272F;
  411. }
  412. text:last-child{
  413. padding-top: 10rpx;
  414. font-size: 26rpx;
  415. color: #999999;
  416. }
  417. }
  418. .menu-list{
  419. display: flex;
  420. justify-content: space-around;
  421. .item{
  422. margin-top: 20rpx;
  423. width: 31%;
  424. padding: 15rpx 0;
  425. border-radius: 16rpx;
  426. display: flex;
  427. justify-content: center;
  428. align-items: center;
  429. flex-direction: column;
  430. .title{
  431. font-weight: 800;
  432. margin-bottom: 10rpx;
  433. }
  434. image{
  435. margin-bottom: 10rpx;
  436. border-radius: 50%;
  437. padding: 15rpx;
  438. background-color: #FFFFFF;
  439. width: 70rpx;
  440. height: 70rpx;
  441. }
  442. }
  443. .item1{
  444. background-image: linear-gradient(to right,#F7F0E7,#E9CEB9);
  445. view{
  446. font-size: 26rpx;
  447. padding: 10rpx 50rpx;
  448. background-color: #FF9447;
  449. color: #FFFFFF;
  450. }
  451. }
  452. .item2{
  453. background-image: linear-gradient(to right,#E8F2FC,#C3D5ED);
  454. view{
  455. font-size: 26rpx;
  456. padding: 10rpx 20rpx;
  457. background-color: #4AB0FF;
  458. color: #FFFFFF;
  459. }
  460. }
  461. .item3{
  462. background-image: linear-gradient(to right,#F7E9E9,#EAC4C3);
  463. view{
  464. font-size: 26rpx;
  465. padding: 10rpx 20rpx;
  466. background-color: #CF4948;
  467. color: #FFFFFF;
  468. }
  469. }
  470. }
  471. }
  472. .consume{
  473. border-radius: 20rpx;
  474. background-color: #FFFFFF;
  475. padding: 10rpx 10rpx 30rpx;
  476. margin: 20rpx;
  477. .top{
  478. text:first-child{
  479. font-size: 34rpx;
  480. font-weight: 800;
  481. color: #26272F;
  482. }
  483. text:last-child{
  484. padding-top: 10rpx;
  485. font-size: 26rpx;
  486. color: #999999;
  487. }
  488. }
  489. }
  490. .top{
  491. display: flex;
  492. justify-content: space-between;
  493. }
  494. </style>