mine.vue 12 KB

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