wode.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. <template>
  2. <view class="">
  3. <view class="pageBg">
  4. <view class="header">
  5. <DtCustomBar title="我的"></DtCustomBar>
  6. <view @tap="tapToWhich('/pagesM/pages/mine_info')" style="display: flex;align-items: center;margin: 0 30upx;">
  7. <view class="member_head_img">
  8. <block v-if="isLogin">
  9. <image v-if="userInfo.avatarUrl" :src="userInfo.avatarUrl" mode="scaleToFill"></image>
  10. <button v-else class="avatar-wrap" open-type="getUserInfo" @getuserinfo="tapGetUserInfo" @tap.stop="() => false">
  11. <!-- todo -->
  12. <image style="background-color: #FFFFFF;" src="http://139.9.103.171:8888/group1/M00/00/01/iwlnq1_AYZqAb30pAAAQNvkj3Wk302.png"></image>
  13. </button>
  14. </block>
  15. <!-- todo -->
  16. <image v-else style="background-color: #FFFFFF;" src="http://139.9.103.171:8888/group1/M00/00/01/iwlnq1_AYZqAb30pAAAQNvkj3Wk302.png"></image>
  17. </view>
  18. <view v-if="isLogin" class="member_info">
  19. <view class="member_name_box" style="margin-bottom: 20rpx;">
  20. <view class="member_name">{{ userInfo.nickName }}</view>
  21. </view>
  22. <view class="member_phone_box" >
  23. <view class="member_phone">19124812874</view>
  24. </view>
  25. </view>
  26. <view v-else class="no_login"><button class="no_login_btn">游客(未登录)</button></view>
  27. <view style="flex:1"></view>
  28. </view>
  29. <view style="display: flex;margin: 22upx 64upx 0;justify-content: space-between;">
  30. <view @tap="tapHeadMenu(0)" style="text-align: center;">
  31. <view style="font-size: 28upx;color: #fff;">{{dataDetail.couponNum?dataDetail.couponNum:0}}</view>
  32. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">我的优惠券</view>
  33. </view>
  34. <view @tap="tapHeadMenu(1)" style="text-align: center;">
  35. <view style="font-size: 28upx;color: #fff;">{{dataDetail.favoriteNum?dataDetail.favoriteNum:0}}</view>
  36. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">收藏商品</view>
  37. </view>
  38. <view @tap="tapHeadMenu(2)" style="text-align: center;">
  39. <view style="font-size: 28upx;color: #fff;">{{dataDetail.browseNum?dataDetail.browseNum:0}}</view>
  40. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">浏览记录</view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- todo -->
  45. <view class="mine_order_statue">
  46. <view class="cu-list grid col-5 no-border margin-top-sm" >
  47. <view class="cu-item" @click="tapToMenu(item.index)" v-for="(item,index) in gridList" :key="index">
  48. <view class="grid-icon ">
  49. <image style="width: 56rpx;height: 56rpx;" :src="item.icon"/>
  50. </view>
  51. <view class="cu-tag bg-orange badge" v-if="item.badge>0">{{item.badge}}</view>
  52. <text style="font-size: 22rpx;font-family:Sans-serif">{{item.title}}</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="item_list" >
  57. <view class="item">
  58. <text style="font-size: 32rpx;">个人设置</text>
  59. </view>
  60. <view class="item" v-for="(item, index) in mineItemList" :key="index" @tap="tapToMenu(item.index)">
  61. <view class="item_content">
  62. <image :src="item.itemIcon"></image>
  63. <text>{{ item.itemName }}</text>
  64. </view>
  65. <view class="">
  66. <text v-if="index==0" style="padding-right: 16rpx;font-size: 26rpx;" class="text-red">{{authStatus}}</text>
  67. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="item_list" >
  72. <view class="item">
  73. <text style="font-size: 32rpx;">系统设置</text>
  74. </view>
  75. <view class="item" v-for="(item, index) in systemItemList" :key="index" @tap="tapToMenu(item.index)">
  76. <view class="item_content">
  77. <image :src="item.itemIcon"></image>
  78. <text>{{ item.itemName }}</text>
  79. </view>
  80. <view class="">
  81. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="bg-white" style="height: 80rpx;">
  86. </view>
  87. <!-- 微信客服 -->
  88. <DtService />
  89. <DtLogin ref="dialogLogin" @signIn="onSignIn" />
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. var app=getApp()
  95. import DtLogin from '../../comps/dt_login.vue';
  96. import DtService from '../../comps/dt_service.vue';
  97. import DtCustomBar from '../../comps/dt_custom_bar.vue'
  98. export default {
  99. components: {
  100. DtLogin,
  101. DtService,
  102. DtCustomBar
  103. },
  104. data() {
  105. return {
  106. //todo
  107. gridList:[
  108. {
  109. icon:'../../static/index/blue/order.png',
  110. title:"商城订单",
  111. badge:0,
  112. index:1
  113. },
  114. {
  115. icon:'../../static/index/blue/cart.png',
  116. title:"购物车",
  117. badge:0,
  118. index:2
  119. },
  120. {
  121. icon:'../../static/index/blue/wuye.png',
  122. title:"报修业务",
  123. badge:0,
  124. index:3
  125. },
  126. {
  127. icon:'../../static/index/blue/contact.png',
  128. title:"联系物业",
  129. badge:0,
  130. index:4
  131. },
  132. {
  133. icon:'../../static/index/blue/msg.png',
  134. title:"消息通知",
  135. badge:0,
  136. index:5
  137. },
  138. ],
  139. isFirst:false,
  140. //社区 begin
  141. userInfo: null,
  142. //微信用户信息
  143. state: null,
  144. anyHousePass: false,
  145. //社区end
  146. mineItemList: [
  147. {
  148. itemName: '住户认证',
  149. itemIcon: '/static/index/blue/renzheng.png',
  150. index:6
  151. },
  152. {
  153. itemName: '通行人脸',
  154. itemIcon: '/static/index/blue/face.png',
  155. index:7
  156. },
  157. {
  158. itemName: '身份信息',
  159. itemIcon: '/static/index/blue/shenfen.png',
  160. index:8
  161. },
  162. {
  163. itemName: '收货地址',
  164. itemIcon: '/static/index/blue/address.png',
  165. index:9
  166. },
  167. ],
  168. systemItemList:[
  169. {
  170. itemName: '问题反馈',
  171. itemIcon: '/static/index/blue/fankui.png',
  172. index:10
  173. },
  174. {
  175. itemName: '帮助中心',
  176. itemIcon: '/static/index/blue/shuoming.png',
  177. index:11
  178. },
  179. {
  180. itemName: '设置',
  181. itemIcon: '/static/index/blue/setting.png',
  182. index:12
  183. }
  184. ],
  185. memberId: '',
  186. dataDetail: {},
  187. orderStatusNum: {},
  188. userDetail: {},
  189. isLogin: false,
  190. };
  191. },
  192. onShow() {
  193. if(this.isFirst){
  194. this.isFirst=false
  195. }else{
  196. this.login()
  197. }
  198. },
  199. computed: {
  200. orderState() {
  201. return this.$global.orderState;
  202. },
  203. //社区begin
  204. authStatus:{
  205. get(){
  206. if(this.state==0 && this.anyHousePass==false){
  207. return "未认证"
  208. }else if(this.state==1&&this.anyHousePass==false){
  209. return "待审核"
  210. }else if(this.state==2 ||this.anyHousePass==true){
  211. return "已认证"
  212. }else{
  213. return "未注册"
  214. }
  215. }
  216. },
  217. //社区 end
  218. },
  219. methods: {
  220. async tapGetUserInfo(e) {
  221. return
  222. console.log(158, e);
  223. if (e.detail.errMsg == 'getUserInfo:ok') {
  224. let userInfo = e.detail.userInfo;
  225. let resp = await this.$api.updateIcon({
  226. _isShowLoading: true,
  227. userId: this.memberId,
  228. avatar: userInfo.avatarUrl
  229. });
  230. this.userDetail.avatar = userInfo.avatarUrl;
  231. }
  232. },
  233. showLogin() {
  234. this.$refs.dialogLogin.show();
  235. },
  236. // 登录成功响应事件
  237. onSignIn(resp) {
  238. console.log(143, resp);
  239. this.$util.refreshPage(['pages/home', 'pages/shop_car']);
  240. this.onPullDownRefreshPage();
  241. },
  242. tapToWhich(aimUrl) {
  243. return
  244. if (!this.$auth.isAuth) {
  245. this.showLogin();
  246. return;
  247. }
  248. uni.navigateTo({
  249. url: aimUrl
  250. });
  251. },
  252. tapToOrder(state) {
  253. return
  254. if (!this.$auth.isAuth) {
  255. this.showLogin();
  256. return;
  257. }
  258. uni.navigateTo({
  259. url: '/pagesM/pages/mine_order_list?state=' + state
  260. });
  261. },
  262. onShareAppMessage: function(e) {
  263. return {
  264. path: '/pagesM/pages/home'
  265. }
  266. },
  267. tapHeadMenu(index){
  268. return
  269. let url;
  270. if(index==0){
  271. url = '/pagesM/pages/coupon_list'
  272. }else if(index==1){
  273. url = '/pagesM/pages/mine_collection'
  274. }else if(index==2){
  275. url = '/pagesM/pages/browse_records'
  276. }
  277. uni.navigateTo({
  278. url: url
  279. });
  280. },
  281. tapToMenu(index) {
  282. let url=''
  283. let flag=this.buttonMethod()
  284. switch (index) {
  285. case 1:
  286. //商城订单
  287. url="/pagesM/pages/mine_order_list"
  288. break;
  289. case 2:
  290. //购物车
  291. uni.showToast({
  292. title:"暂未开发",
  293. icon:"none"
  294. })
  295. break;
  296. case 3:
  297. // 报修业务
  298. if (flag) {
  299. uni.navigateTo({
  300. url: '../services/property/list/list'
  301. })
  302. }
  303. break;
  304. case 4:
  305. // 联系物业
  306. this.makePhoneCall("19124812874");
  307. break;
  308. case 5:
  309. //消息通知
  310. if (flag) {
  311. uni.navigateTo({
  312. url: '/pages/wode/news/news'
  313. })
  314. }
  315. break;
  316. case 6:
  317. //住户认证
  318. if (flag) {
  319. uni.navigateTo({
  320. url:"myInfo/myInfo"
  321. })
  322. }
  323. break;
  324. case 7:
  325. // 通行人脸
  326. url="/pages/uploadFace/uploadFace"
  327. break;
  328. case 8:
  329. // 身份信息
  330. uni.showToast({
  331. title:"暂未开发",
  332. icon:"none"
  333. })
  334. break;
  335. case 9:
  336. // 收货地址
  337. url= '/pagesM/pages/address_list'
  338. break;
  339. case 10:
  340. // 问题反馈
  341. url="./feedback/feedback"
  342. break;
  343. case 11:
  344. // 帮助中心
  345. url="direction/direction"
  346. break;
  347. case 12:
  348. // 设置
  349. url="/pagesM/pages/mine_setting"
  350. break;
  351. default:
  352. break;
  353. }
  354. if (url != '') {
  355. uni.navigateTo({
  356. url: url,
  357. });
  358. }
  359. },
  360. async getMyBaseDatas() {
  361. let resp = await this.$api.getMyBaseDatas({
  362. _isReject: true,
  363. _isPull: this.isPull,
  364. memberId: this.memberId
  365. });
  366. console.log(resp)
  367. this.$auth.getMineBase(resp);
  368. this.dataDetail = resp;
  369. this.orderStatusNum = resp.orderStatusNum || {};
  370. this.userDetail = resp.user || {};
  371. },
  372. onLoadPage() {
  373. this.isFirst=true
  374. // this.memberId = this.$auth.getMemberId();
  375. // this.getMyBaseDatas();
  376. },
  377. // 社区 begin
  378. login(){
  379. var that = this; //从全局变量中获取用户信息
  380. if (app.globalData.userInfo == null) {
  381. uni.login({
  382. success: function () {
  383. uni.getUserInfo({
  384. success: function (res) {
  385. console.log(res);
  386. that.isLogin=true
  387. app.globalData.userInfo = res.userInfo;
  388. that.setData({
  389. userInfo: res.userInfo
  390. });
  391. }
  392. });
  393. }
  394. });
  395. } else {
  396. that.isLogin=true
  397. that.setData({
  398. userInfo: app.globalData.userInfo
  399. });
  400. }
  401. if (app.globalData.member) {
  402. that.setData({
  403. state: app.globalData.member.state,
  404. anyHousePass: app.globalData.anyHousePass
  405. });
  406. }
  407. },
  408. //用户认证信息
  409. buttonMethod: function () {
  410. var that = this; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  411. var member = app.globalData.member;
  412. var anyHousePass = app.globalData.anyHousePass;
  413. if (member == null) {
  414. //未注册
  415. uni.navigateTo({
  416. url:"../empty/empty"
  417. })
  418. return false;
  419. } else if (member.state == 0 && !anyHousePass) {
  420. //2未认证
  421. uni.navigateTo({
  422. url:"../empty/empty?type=2"
  423. })
  424. return false;
  425. } else if (member.state == 1 && !anyHousePass) {
  426. //待审核
  427. that.pending();
  428. return false;
  429. } else if (member.state == 2 || anyHousePass) {
  430. return true
  431. }else{
  432. return false
  433. }
  434. },
  435. //提示用户身份注册
  436. footaddmore: function () {
  437. uni.showModal({
  438. title: '提示',
  439. content: ' 请先完成注册',
  440. //cancelText:'去绑定',
  441. cancelText: '取消',
  442. confirmText: '去注册',
  443. success: function (res) {
  444. if (res.confirm) {
  445. console.log('用户点击了确认-去认证'); //跳转到认证页面
  446. uni.navigateTo({
  447. url: '../register/register'
  448. });
  449. } else {//res.cancel
  450. //绑定界面--暂时不用
  451. // wx.navigateTo({
  452. // url: '/pages/binding/binding',
  453. // })
  454. }
  455. }
  456. });
  457. },
  458. //用户信息待审核中
  459. pending: function () {
  460. let that = this;
  461. var openid = uni.getStorageSync("openid");
  462. let params = {};
  463. params['openid'] = openid;
  464. let operation = 'miniprogram/getMemberByOpenid';
  465. app.globalData.postRequest(params, operation, function (res) {
  466. //获取成功
  467. if (res.data.result_code == 1) {
  468. let member = res.data.member; //待审核
  469. if (member.state == 1 && !res.data.anyHousePass) {
  470. app.globalData.oneFailHint('亲,你的信息正在审核,请耐心等待');
  471. } else if (member.state == 2) {
  472. app.globalData.oneFailHint('亲,你的信息已审核通过', function () {
  473. that.setData({
  474. state: member.state
  475. });
  476. });
  477. }
  478. app.globalData.member = member;
  479. app.globalData.anyHousePass = res.data.anyHousePass;
  480. } else {
  481. app.globalData.oneFailHint(res.data.result_msg);
  482. }
  483. });
  484. },
  485. // 社区 end
  486. },
  487. onLoad() {
  488. wx.showShareMenu({
  489. withShareTicket: true
  490. })
  491. },
  492. onReady() {
  493. // if (!this.$auth.isAuth) {
  494. // this.showLogin();
  495. // return;
  496. // } else {
  497. // this.$refs.dialogLogin.hide();
  498. // }
  499. },
  500. onShow() {
  501. this.onShowPage();
  502. this.login()
  503. },
  504. onPullDownRefresh() {
  505. this.onPullDownRefreshPage();
  506. }
  507. };
  508. </script>
  509. <style lang="scss" scoped>
  510. //todo
  511. .pageBg {
  512. background-color: #FFFFFF;
  513. }
  514. button::after {
  515. border: none;
  516. }
  517. .header {
  518. // border-bottom-left-radius: 20rpx;
  519. border-bottom-right-radius: 60rpx;
  520. //todo
  521. background-image: url(http://139.9.103.171:1888/miniofile/app/bg.png);
  522. height: 480upx;
  523. background-repeat: no-repeat;
  524. background-size: 100% 100%;
  525. .member_head_img {
  526. margin-right: 30upx;
  527. image {
  528. //todo
  529. width: 110upx;
  530. height:110upx;
  531. border-radius: 59rpx;
  532. }
  533. .avatar-wrap {
  534. display: inline-flex;
  535. border: 0;
  536. background-color: transparent;
  537. }
  538. }
  539. .no_login {
  540. display: flex;
  541. flex-direction: column;
  542. .no_login_btn {
  543. border-radius: 25px;
  544. //todo
  545. font-size: 32upx;
  546. color: #fff;
  547. width: fit-content;
  548. padding: 0 15upx;
  549. height: 60upx;
  550. line-height: 60upx;
  551. background: transparent;
  552. }
  553. }
  554. .member_info {
  555. display: flex;
  556. flex-direction: column;
  557. .member_name_box {
  558. display: flex;
  559. flex-direction: row;
  560. align-items: center;
  561. .member_name {
  562. font-size: 40upx;
  563. color: #fff;
  564. font-weight: bold;
  565. }
  566. .member_level {
  567. background: #ffc600;
  568. color: #fff;
  569. font-size: 22upx;
  570. border-radius: 4upx;
  571. padding: 5upx 10upx;
  572. margin-left: 10upx;
  573. }
  574. }
  575. .member_phone_box {
  576. display: flex;
  577. flex-direction: row;
  578. align-items: center;
  579. .member_phone {
  580. font-size: 24upx;
  581. color: #FFFFFF;
  582. }
  583. image {
  584. width: 19upx;
  585. height: 19upx;
  586. padding: 20upx;
  587. }
  588. }
  589. }
  590. .member_benefits {
  591. background: #fff;
  592. width: 180upx;
  593. display: flex;
  594. flex-direction: row;
  595. align-items: center;
  596. text-align: center;
  597. border-radius: 27upx 0px 0px 27upx;
  598. height: 54upx;
  599. text-align: center;
  600. position: absolute;
  601. right: 0;
  602. image {
  603. width: 26upx;
  604. height: 23upx;
  605. padding: 0 10upx 0 30upx;
  606. }
  607. .member_benefits_text {
  608. font-size: 24upx;
  609. color: $dt-color-primary;
  610. letter-spacing: 2upx;
  611. }
  612. }
  613. button::after {
  614. border: none;
  615. }
  616. }
  617. .coupon_point {
  618. display: flex;
  619. flex-direction: row;
  620. align-items: center;
  621. height: 110upx;
  622. background: #fff;
  623. justify-content: space-around;
  624. .item {
  625. display: flex;
  626. flex-direction: column;
  627. align-items: center;
  628. width: 50%;
  629. .item_box {
  630. display: flex;
  631. flex-direction: row;
  632. align-items: center;
  633. letter-spacing: 2upx;
  634. .item_content {
  635. color: $dt-color-primary;
  636. font-size: 34upx;
  637. }
  638. .item_unit {
  639. color: $dt-color-primary;
  640. font-size: 22upx;
  641. margin-top: 6upx;
  642. }
  643. }
  644. .item_text {
  645. color: #333333;
  646. font-size: 22upx;
  647. }
  648. }
  649. .line {
  650. width: 1upx;
  651. height: 50upx;
  652. background: #e5e5e5;
  653. }
  654. }
  655. .mine_order_statue {
  656. //todo
  657. box-shadow: 0 10rpx #e7f1fd ;
  658. margin: -100upx 20upx 0;
  659. background: #fff;
  660. padding: 10upx 20upx;
  661. border-radius: 20rpx;
  662. .order_wrap {
  663. display: flex;
  664. flex-direction: row;
  665. align-items: center;
  666. justify-content: space-between;
  667. box-sizing: border-box;
  668. .mine_order_text {
  669. font-size: 28upx;
  670. font-weight: bold;
  671. color: #333333;
  672. }
  673. .jump_all_order {
  674. display: flex;
  675. flex-direction: row;
  676. align-items: center;
  677. text {
  678. color: #999999;
  679. font-size: 22upx;
  680. margin-right: 10upx;
  681. }
  682. image {
  683. width: 10upx;
  684. height: 18upx;
  685. }
  686. }
  687. }
  688. .order_statue_list {
  689. display: flex;
  690. flex-direction: row;
  691. align-items: center;
  692. justify-content: space-between;
  693. .order_statue_item {
  694. display: flex;
  695. flex-direction: column;
  696. align-items: center;
  697. position: relative;
  698. margin-top: 32upx;
  699. image {
  700. width: 40upx;
  701. height: 40upx;
  702. }
  703. text {
  704. font-size: 24rpx;
  705. color: #333333;
  706. letter-spacing: 1upx;
  707. margin-top: 10upx;
  708. }
  709. .tip_count {
  710. position: absolute;
  711. right: 0upx;
  712. top: -6rpx;
  713. width: 24upx;
  714. height: 24upx;
  715. border-radius: 50%;
  716. background-color: #ff3b30;
  717. color: #fff;
  718. font-size: 18upx;
  719. text-align: center;
  720. line-height: 24upx;
  721. }
  722. }
  723. }
  724. }
  725. .item_list {
  726. display: flex;
  727. flex-direction: column;
  728. background: #fff;
  729. margin-top: 20upx;
  730. margin-left: 20rpx;
  731. margin-right: 20rpx;
  732. border-radius: 20rpx;
  733. .item {
  734. display: flex;
  735. flex-direction: row;
  736. align-items: center;
  737. justify-content: space-between;
  738. padding: 0 30upx;
  739. height: 90upx;
  740. border-bottom: 1upx solid #f1f1f1;
  741. .item_content {
  742. display: flex;
  743. flex-direction: row;
  744. align-items: center;
  745. image {
  746. width: 42upx;
  747. height: 42upx;
  748. }
  749. text {
  750. font-size: 28upx;
  751. color: #333333;
  752. margin-left: 20upx;
  753. }
  754. }
  755. image {
  756. width: 10upx;
  757. height: 18upx;
  758. }
  759. }
  760. .item:first-child{
  761. border: none;
  762. }
  763. .item:last-child {
  764. border: none;
  765. }
  766. }
  767. </style>