mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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')">
  60. <text>{{userInfo.point || 0}}</text>
  61. 我的积分
  62. </view>
  63. <view class="item" @click="jump('/pages/mine/my-balance/my-balance')">
  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/icon/zhongguo.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="jump(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. this.login()
  155. },
  156. methods: {
  157. init(){
  158. this.fetchUserInfo()
  159. this.judgeAgenterType()
  160. },
  161. judgeAgenterType(){
  162. let params={
  163. userId:this.vuex_userId,
  164. enabled:1
  165. }
  166. this.$api.agenter.list(params).then(res=>{
  167. if (!this.$isEmpty(res.data.records)) {
  168. let item=res.data.records[0]
  169. let type=this.$isEmpty(item.agenterTypeId)?1:2
  170. this.$u.vuex('vuex_agenter_type',type)
  171. }
  172. })
  173. },
  174. fetchUserInfo(){
  175. let params={
  176. id:this.vuex_userId
  177. }
  178. this.$api.loginUser.detail(params).then(res=>{
  179. this.userInfo=res.data
  180. })
  181. },
  182. // 登录 begin
  183. showLogin(){
  184. this.$refs.login.show()
  185. },
  186. showPhoneModal(){
  187. this.$refs.login.showPhoneModal()
  188. },
  189. signIn(resp){
  190. if (!this.vuex_phone) {
  191. this.showPhoneModal()
  192. }
  193. this.init()
  194. },
  195. login(e){
  196. if (this.$isEmpty(this.vuex_userId)) {
  197. this.showLogin()
  198. return
  199. }
  200. this.init()
  201. if (this.$isEmpty(this.vuex_phone)) {
  202. this.showPhoneModal()
  203. }
  204. },
  205. // 登录 end
  206. scanCode(){
  207. const _this = this;
  208. // this.jump('/pages/checkstand/index')
  209. uni.scanCode({
  210. success: function (res) {
  211. console.log(res,1236456);
  212. _this.jump('/pages/checkstand/index')
  213. },
  214. fail: (res) => {
  215. if(res.errMsg!='scanCode:fail cancel'){
  216. this.scanNotify = {scan: true,scanMessage: res.errMsg};
  217. }
  218. }
  219. });
  220. },
  221. jump(url,type){
  222. if (type==1) {
  223. uni.switchTab({
  224. url
  225. })
  226. return
  227. }
  228. if (this.$isEmpty(this.vuex_userId)) {
  229. this.login()
  230. return
  231. }
  232. uni.navigateTo({
  233. url
  234. })
  235. },
  236. fetchStatic(){
  237. this.menuList=[
  238. {
  239. icon:'/static/icon/scan.png',
  240. name:'扫一扫',
  241. path:'/pages/checkstand/index'
  242. },
  243. {
  244. icon:'/static/icon/pay.png',
  245. name:'付款码',
  246. path:'/pages/checkstand/pay-qrcode'
  247. },
  248. {
  249. icon:'/static/icon/card.png',
  250. name:'卡包',
  251. path:'/pages/mine/card/card'
  252. }
  253. ]
  254. this.gainList=[
  255. {
  256. icon:'/static/icon/daili.png',
  257. name:'成为代理',
  258. path:'/pages/mine/card/card'
  259. },
  260. {
  261. icon:'/static/icon/xianfeng.png',
  262. name:'音乐先锋榜',
  263. path:'/pages/mine/card/card'
  264. },
  265. {
  266. icon:'/static/icon/xianfeng.png',
  267. name:'音乐先锋榜',
  268. path:'/pages/mine/card/card'
  269. },
  270. ]
  271. this.pointsList=[
  272. {
  273. icon:'/static/icon/life.png',
  274. name:'生活服务',
  275. path:''
  276. },
  277. {
  278. icon:'/static/icon/jiaotong.png',
  279. name:'交通出行',
  280. path:''
  281. },
  282. {
  283. icon:'/static/icon/shop.png',
  284. name:'购物',
  285. path:''
  286. },
  287. {
  288. icon:'/static/icon/yiyao.png',
  289. name:'医疗',
  290. path:''
  291. },
  292. ]
  293. }
  294. }
  295. }
  296. </script>
  297. <style lang="scss" scoped>
  298. .bg-tag{
  299. color: #FFFFFF;
  300. background-color: #EA3723;
  301. }
  302. .shuiyin{
  303. overflow: hidden;
  304. width: 260rpx;
  305. height: 280rpx;
  306. position: absolute;
  307. right: 10rpx;
  308. top: 30rpx;
  309. }
  310. .bg-img{
  311. width: 100vw;
  312. height: 420rpx;
  313. }
  314. .navbar-top{
  315. position: fixed;
  316. width: 100%;
  317. top: 0;
  318. z-index:99999;
  319. padding-top:var(--status-bar-height);
  320. transition: top .25s;
  321. .title{
  322. padding: 18.18rpx 0;
  323. }
  324. }
  325. .card{
  326. position: relative;
  327. margin: -240rpx 20rpx 0;
  328. border-radius: 20rpx;
  329. background-color: #FFFFFF;
  330. .info{
  331. padding: 20rpx 20rpx 0;
  332. display: flex;
  333. justify-content: space-between;
  334. .avatar{
  335. width: 100rpx;
  336. height: 100rpx;
  337. border-radius: 50%;
  338. }
  339. .nickname{
  340. font-weight: 800;
  341. color: #222222;
  342. font-size: 30rpx;
  343. margin-left: 20rpx;
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. }
  348. }
  349. }
  350. .account{
  351. padding: 20rpx;
  352. color: #222222;
  353. margin: 20rpx;
  354. border-radius: 20rpx;
  355. background-color: #FFFFFF;
  356. .title{
  357. padding-left: 30rpx;
  358. font-weight: 800;
  359. }
  360. .menu{
  361. display: flex;
  362. justify-content: space-around;
  363. view{
  364. padding-top: 20rpx;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: center;
  368. align-items: center;
  369. text:first-child{
  370. font-weight: 800;
  371. padding-bottom: 10rpx;
  372. font-size: 32rpx;
  373. color: #FF9447;
  374. }
  375. text:last-child{
  376. }
  377. }
  378. }
  379. }
  380. .exchange{
  381. border-radius: 20rpx;
  382. background-color: #FFFFFF;
  383. padding: 10rpx 10rpx 30rpx;
  384. margin: 20rpx;
  385. .top{
  386. text:first-child{
  387. font-size: 34rpx;
  388. font-weight: 800;
  389. color: #26272F;
  390. }
  391. text:last-child{
  392. padding-top: 10rpx;
  393. font-size: 26rpx;
  394. color: #999999;
  395. }
  396. }
  397. .menu-list{
  398. display: flex;
  399. justify-content: space-around;
  400. .item{
  401. margin-top: 20rpx;
  402. width: 31%;
  403. padding: 15rpx 0;
  404. border-radius: 16rpx;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. flex-direction: column;
  409. .title{
  410. font-weight: 800;
  411. margin-bottom: 10rpx;
  412. }
  413. image{
  414. margin-bottom: 10rpx;
  415. border-radius: 50%;
  416. padding: 15rpx;
  417. background-color: #FFFFFF;
  418. width: 70rpx;
  419. height: 70rpx;
  420. }
  421. }
  422. .item1{
  423. background-image: linear-gradient(to right,#F7F0E7,#E9CEB9);
  424. view{
  425. font-size: 26rpx;
  426. padding: 10rpx 50rpx;
  427. background-color: #FF9447;
  428. color: #FFFFFF;
  429. }
  430. }
  431. .item2{
  432. background-image: linear-gradient(to right,#E8F2FC,#C3D5ED);
  433. view{
  434. font-size: 26rpx;
  435. padding: 10rpx 20rpx;
  436. background-color: #4AB0FF;
  437. color: #FFFFFF;
  438. }
  439. }
  440. .item3{
  441. background-image: linear-gradient(to right,#F7E9E9,#EAC4C3);
  442. view{
  443. font-size: 26rpx;
  444. padding: 10rpx 20rpx;
  445. background-color: #CF4948;
  446. color: #FFFFFF;
  447. }
  448. }
  449. }
  450. }
  451. .consume{
  452. border-radius: 20rpx;
  453. background-color: #FFFFFF;
  454. padding: 10rpx 10rpx 30rpx;
  455. margin: 20rpx;
  456. .top{
  457. text:first-child{
  458. font-size: 34rpx;
  459. font-weight: 800;
  460. color: #26272F;
  461. }
  462. text:last-child{
  463. padding-top: 10rpx;
  464. font-size: 26rpx;
  465. color: #999999;
  466. }
  467. }
  468. }
  469. .top{
  470. display: flex;
  471. justify-content: space-between;
  472. }
  473. </style>