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. switch (index) {
  284. case 1:
  285. //商城订单
  286. url="/pagesM/pages/mine_order_list"
  287. break;
  288. case 2:
  289. //购物车
  290. uni.showToast({
  291. title:"暂未开发",
  292. icon:"none"
  293. })
  294. break;
  295. case 3:
  296. // 报修业务
  297. // url="/pages/services/property/list/list"
  298. uni.showToast({
  299. title:"暂未开发",
  300. icon:"none"
  301. })
  302. break;
  303. case 4:
  304. // 联系物业
  305. this.makePhoneCall("19124812874");
  306. break;
  307. case 5:
  308. //消息通知
  309. this.buttonMethod(2)
  310. break;
  311. case 6:
  312. // 住户认证
  313. this.buttonMethod(1)
  314. break;
  315. case 7:
  316. // 通行人脸
  317. url="/pages/uploadFace/uploadFace"
  318. break;
  319. case 8:
  320. // 身份信息
  321. uni.showToast({
  322. title:"暂未开发",
  323. icon:"none"
  324. })
  325. break;
  326. case 9:
  327. // 收货地址
  328. url= '/pagesM/pages/address_list'
  329. break;
  330. case 10:
  331. // 问题反馈
  332. url="./feedback/feedback"
  333. break;
  334. case 11:
  335. // 帮助中心
  336. url="direction/direction"
  337. break;
  338. case 12:
  339. // 设置
  340. url="/pagesM/pages/mine_setting"
  341. break;
  342. default:
  343. break;
  344. }
  345. if (url != '') {
  346. uni.navigateTo({
  347. url: url,
  348. });
  349. }
  350. },
  351. async getMyBaseDatas() {
  352. let resp = await this.$api.getMyBaseDatas({
  353. _isReject: true,
  354. _isPull: this.isPull,
  355. memberId: this.memberId
  356. });
  357. console.log(resp)
  358. this.$auth.getMineBase(resp);
  359. this.dataDetail = resp;
  360. this.orderStatusNum = resp.orderStatusNum || {};
  361. this.userDetail = resp.user || {};
  362. },
  363. onLoadPage() {
  364. this.isFirst=true
  365. this.login()
  366. // this.memberId = this.$auth.getMemberId();
  367. // this.getMyBaseDatas();
  368. },
  369. // 社区 begin
  370. login(){
  371. var that = this; //从全局变量中获取用户信息
  372. if (app.globalData.userInfo == null) {
  373. uni.login({
  374. success: function () {
  375. uni.getUserInfo({
  376. success: function (res) {
  377. console.log(res);
  378. that.isLogin=true
  379. app.globalData.userInfo = res.userInfo;
  380. that.setData({
  381. userInfo: res.userInfo
  382. });
  383. }
  384. });
  385. }
  386. });
  387. } else {
  388. that.isLogin=true
  389. that.setData({
  390. userInfo: app.globalData.userInfo
  391. });
  392. }
  393. if (app.globalData.member) {
  394. that.setData({
  395. state: app.globalData.member.state,
  396. anyHousePass: app.globalData.anyHousePass
  397. });
  398. }
  399. },
  400. //用户认证信息
  401. buttonMethod: function (type) {
  402. console.log("住户认证");
  403. var that = this; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  404. var member = app.globalData.member;
  405. var anyHousePass = app.globalData.anyHousePass;
  406. if (member == null) {
  407. //未注册
  408. uni.navigateTo({
  409. url:"../empty/empty"
  410. })
  411. return;
  412. } else if (member.state == 0 && !anyHousePass) {
  413. //2未认证
  414. uni.navigateTo({
  415. url:"../empty/empty?type=2"
  416. })
  417. return;
  418. } else if (member.state == 1 && !anyHousePass) {
  419. //待审核
  420. that.pending();
  421. return;
  422. } else if (member.state == 2 || anyHousePass) {
  423. //已认证
  424. if (type == 1) {
  425. uni.navigateTo({
  426. url: 'myInfo/myInfo'
  427. });
  428. } else if (type == 2) {
  429. uni.navigateTo({
  430. url: '/pages/wode/news/news'
  431. });
  432. }
  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. },
  503. onPullDownRefresh() {
  504. this.onPullDownRefreshPage();
  505. }
  506. };
  507. </script>
  508. <style lang="scss" scoped>
  509. //todo
  510. .pageBg {
  511. background-color: #FFFFFF;
  512. }
  513. button::after {
  514. border: none;
  515. }
  516. .header {
  517. // border-bottom-left-radius: 20rpx;
  518. border-bottom-right-radius: 60rpx;
  519. //todo
  520. background-image: url(http://139.9.103.171:1888/miniofile/app/bg.png);
  521. height: 480upx;
  522. background-repeat: no-repeat;
  523. background-size: 100% 100%;
  524. .member_head_img {
  525. margin-right: 30upx;
  526. image {
  527. //todo
  528. width: 110upx;
  529. height:110upx;
  530. border-radius: 59rpx;
  531. }
  532. .avatar-wrap {
  533. display: inline-flex;
  534. border: 0;
  535. background-color: transparent;
  536. }
  537. }
  538. .no_login {
  539. display: flex;
  540. flex-direction: column;
  541. .no_login_btn {
  542. border-radius: 25px;
  543. //todo
  544. font-size: 32upx;
  545. color: #fff;
  546. width: fit-content;
  547. padding: 0 15upx;
  548. height: 60upx;
  549. line-height: 60upx;
  550. background: transparent;
  551. }
  552. }
  553. .member_info {
  554. display: flex;
  555. flex-direction: column;
  556. .member_name_box {
  557. display: flex;
  558. flex-direction: row;
  559. align-items: center;
  560. .member_name {
  561. font-size: 40upx;
  562. color: #fff;
  563. font-weight: bold;
  564. }
  565. .member_level {
  566. background: #ffc600;
  567. color: #fff;
  568. font-size: 22upx;
  569. border-radius: 4upx;
  570. padding: 5upx 10upx;
  571. margin-left: 10upx;
  572. }
  573. }
  574. .member_phone_box {
  575. display: flex;
  576. flex-direction: row;
  577. align-items: center;
  578. .member_phone {
  579. font-size: 24upx;
  580. color: #FFFFFF;
  581. }
  582. image {
  583. width: 19upx;
  584. height: 19upx;
  585. padding: 20upx;
  586. }
  587. }
  588. }
  589. .member_benefits {
  590. background: #fff;
  591. width: 180upx;
  592. display: flex;
  593. flex-direction: row;
  594. align-items: center;
  595. text-align: center;
  596. border-radius: 27upx 0px 0px 27upx;
  597. height: 54upx;
  598. text-align: center;
  599. position: absolute;
  600. right: 0;
  601. image {
  602. width: 26upx;
  603. height: 23upx;
  604. padding: 0 10upx 0 30upx;
  605. }
  606. .member_benefits_text {
  607. font-size: 24upx;
  608. color: $dt-color-primary;
  609. letter-spacing: 2upx;
  610. }
  611. }
  612. button::after {
  613. border: none;
  614. }
  615. }
  616. .coupon_point {
  617. display: flex;
  618. flex-direction: row;
  619. align-items: center;
  620. height: 110upx;
  621. background: #fff;
  622. justify-content: space-around;
  623. .item {
  624. display: flex;
  625. flex-direction: column;
  626. align-items: center;
  627. width: 50%;
  628. .item_box {
  629. display: flex;
  630. flex-direction: row;
  631. align-items: center;
  632. letter-spacing: 2upx;
  633. .item_content {
  634. color: $dt-color-primary;
  635. font-size: 34upx;
  636. }
  637. .item_unit {
  638. color: $dt-color-primary;
  639. font-size: 22upx;
  640. margin-top: 6upx;
  641. }
  642. }
  643. .item_text {
  644. color: #333333;
  645. font-size: 22upx;
  646. }
  647. }
  648. .line {
  649. width: 1upx;
  650. height: 50upx;
  651. background: #e5e5e5;
  652. }
  653. }
  654. .mine_order_statue {
  655. //todo
  656. box-shadow: 0 10rpx #e7f1fd ;
  657. margin: -100upx 20upx 0;
  658. background: #fff;
  659. padding: 10upx 20upx;
  660. border-radius: 20rpx;
  661. .order_wrap {
  662. display: flex;
  663. flex-direction: row;
  664. align-items: center;
  665. justify-content: space-between;
  666. box-sizing: border-box;
  667. .mine_order_text {
  668. font-size: 28upx;
  669. font-weight: bold;
  670. color: #333333;
  671. }
  672. .jump_all_order {
  673. display: flex;
  674. flex-direction: row;
  675. align-items: center;
  676. text {
  677. color: #999999;
  678. font-size: 22upx;
  679. margin-right: 10upx;
  680. }
  681. image {
  682. width: 10upx;
  683. height: 18upx;
  684. }
  685. }
  686. }
  687. .order_statue_list {
  688. display: flex;
  689. flex-direction: row;
  690. align-items: center;
  691. justify-content: space-between;
  692. .order_statue_item {
  693. display: flex;
  694. flex-direction: column;
  695. align-items: center;
  696. position: relative;
  697. margin-top: 32upx;
  698. image {
  699. width: 40upx;
  700. height: 40upx;
  701. }
  702. text {
  703. font-size: 24rpx;
  704. color: #333333;
  705. letter-spacing: 1upx;
  706. margin-top: 10upx;
  707. }
  708. .tip_count {
  709. position: absolute;
  710. right: 0upx;
  711. top: -6rpx;
  712. width: 24upx;
  713. height: 24upx;
  714. border-radius: 50%;
  715. background-color: #ff3b30;
  716. color: #fff;
  717. font-size: 18upx;
  718. text-align: center;
  719. line-height: 24upx;
  720. }
  721. }
  722. }
  723. }
  724. .item_list {
  725. display: flex;
  726. flex-direction: column;
  727. background: #fff;
  728. margin-top: 20upx;
  729. margin-left: 20rpx;
  730. margin-right: 20rpx;
  731. border-radius: 20rpx;
  732. .item {
  733. display: flex;
  734. flex-direction: row;
  735. align-items: center;
  736. justify-content: space-between;
  737. padding: 0 30upx;
  738. height: 90upx;
  739. border-bottom: 1upx solid #f1f1f1;
  740. .item_content {
  741. display: flex;
  742. flex-direction: row;
  743. align-items: center;
  744. image {
  745. width: 42upx;
  746. height: 42upx;
  747. }
  748. text {
  749. font-size: 28upx;
  750. color: #333333;
  751. margin-left: 20upx;
  752. }
  753. }
  754. image {
  755. width: 10upx;
  756. height: 18upx;
  757. }
  758. }
  759. .item:first-child{
  760. border: none;
  761. }
  762. .item:last-child {
  763. border: none;
  764. }
  765. }
  766. </style>