user.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view>
  3. <view :class="'mine' + (skinNotColor ? ' not-color' : '')">
  4. <image src="/static/images/wdbg.png" class="wdbg"
  5. ></image>
  6. <view class="minec">
  7. <image :src="userInfos.avatar ? userInfos.avatar : '/static/images/userimg.png'" mode="aspectFit"
  8. class="user" ></image>
  9. <view class="mines" v-if="isLogin">
  10. <view class="ddflex">{{userInfos.nickName?userInfos.nickName:userInfos.username?userInfos.username:''}}
  11. </view>
  12. <text class="edu" v-if="userInfos.mobile">{{userInfos.mobile}}</text>
  13. </view>
  14. <view class="flex" v-else>
  15. <text class="login-btn" @click="jumpUrl('')">点击登录</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="yichang-box ddflex">
  20. <view class="yichang-item fflex" @click="jumpUrl('warning/abnormalAlarm/abnormalAlarm')">
  21. <view class="yichang-title">异常告警</view>
  22. <view class="yichang-data">{{alarmCount}}<text class="symbol">条</text></view>
  23. <view class="yichang-btn">去查看</view>
  24. <image src="../../static/images/ycjg.png"></image>
  25. </view>
  26. <view class="yichang-item fflex" style="margin-left: 26rpx;" @click="jumpUrl('warning/orderAlarm/orderAlarm')">
  27. <view class="yichang-title">异常处理</view>
  28. <view class="yichang-data">{{exceptionOrderCount}}<text class="symbol">个</text></view>
  29. <view class="yichang-btn">去处理</view>
  30. <image src="../../static/images/yccl.png"></image>
  31. </view>
  32. </view>
  33. <view class="order">
  34. <view class="tits dflex">
  35. <view class="flex">我的服务</view>
  36. </view>
  37. <view class="list2 dflex">
  38. <navigator url="" hover-class="none" class="li" @click="jumpUrlS('/pages/order/order')">
  39. <image src="../../static/pages/images/user_service1.png"></image>
  40. <text>我的订单</text>
  41. </navigator>
  42. <navigator v-if="isLogin&&!userInfos.storeId" url="" hover-class="none" class="li" @click="jumpUrl('pages/myStore/myStore')">
  43. <image src="../../static/pages/images/user_service2.png"></image>
  44. <text>我的商家</text>
  45. </navigator>
  46. <navigator v-if="isLogin&&!userInfos.storeId" url="" hover-class="none" class="li" @click="jumpUrl('pages/myMerchant/myMerchant')">
  47. <image src="../../static/pages/images/user_service3.png"></image>
  48. <text>我的门店</text>
  49. </navigator>
  50. <navigator url="" hover-class="none" class="li" @click="jumpUrl('pages/operationData/operationData')">
  51. <image src="../../static/pages/images/user_service4.png"></image>
  52. <text>运营数据</text>
  53. </navigator>
  54. <view class="li">
  55. <contact-button img-url="../../static/pages/images/user_service5.png" img-style='width: 74rpx;height: 74rpx;margin: 0 auto 12rpx;' button-text="官方客服" styles="line-height:initial;"></contact-button>
  56. </view>
  57. <navigator url="/pages/about/about" hover-class="none" class="li">
  58. <image src="../../static/pages/images/user_service6.png"></image>
  59. <text>关于我们</text>
  60. </navigator>
  61. <navigator url="/mine/feedback/feedback" hover-class="none" class="li">
  62. <image src="../../static/pages/images/user_service7.png"></image>
  63. <text>建议反馈</text>
  64. </navigator>
  65. <navigator v-if="isLogin" url="" hover-class="none" class="li" @click="logout">
  66. <image src="../../static/pages/images/user_service8.png"></image>
  67. <text>退出登录</text>
  68. </navigator>
  69. </view>
  70. </view>
  71. <!-- <footer-copyright></footer-copyright> -->
  72. <foot channel="user" :isUpdate="isUpdate"></foot>
  73. </view>
  74. </template>
  75. <script>
  76. // pages/user/user.js
  77. const app = getApp();
  78. const req = require("../../utils/request.js");
  79. const route = require("../../utils/route");
  80. import foot from "../../components/nav-bar/index";
  81. import footerCopyright from "../../components/footer-copyright/footer-copyright";
  82. export default {
  83. data() {
  84. return {
  85. skinNotColor: req.public.skinNotColor,
  86. picUrlss: req.public.picUrls,
  87. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  88. // merchantId: '',
  89. iconSrc: req.public.iconSrc,
  90. isLogin:false,
  91. userInfos: null,
  92. alarmCount:0,
  93. exceptionOrderCount:0
  94. };
  95. },
  96. components: {
  97. foot,
  98. footerCopyright
  99. },
  100. props: {},
  101. onLoad(options) {
  102. this.userInfos = req.getStorage('userInfo');
  103. if(this.userInfos){
  104. this.isLogin = true
  105. }else{
  106. this.isLogin = false
  107. }
  108. },
  109. onShow: function() {
  110. this.setData({
  111. isUpdate: !this.isUpdate
  112. });
  113. this.userInfos = req.getStorage('userInfo');
  114. if(this.userInfos){
  115. this.isLogin = true
  116. this.getUserInfo()
  117. this.getWarningData()
  118. }else{
  119. this.isLogin = false
  120. this.userInfos = null
  121. this.alarmCount = 0
  122. this.exceptionOrderCount = 0
  123. }
  124. },
  125. methods: {
  126. jumpUrlS(url){
  127. if (!req.isLogins(true)) return false;
  128. uni.switchTab({
  129. url:url
  130. })
  131. },
  132. jumpUrl(url) {
  133. if (!req.isLogins(true)) return false;
  134. app.globalData.navigateTo(url);
  135. },
  136. getUserInfo(){
  137. req.getRequest('/admin/v2/userInfo',{},res=>{
  138. })
  139. },
  140. getWarningData(){
  141. req.getRequest('/admin/v2/alarm/alarmCount',{},res=>{
  142. this.alarmCount = res.alarmCount?res.alarmCount:0
  143. this.exceptionOrderCount = res.exceptionOrderCount?res.exceptionOrderCount:0
  144. })
  145. },
  146. logout(){
  147. uni.showModal({
  148. title:'提示',
  149. content:'确定退出登陆?',
  150. success: (res) => {
  151. if(res.confirm){
  152. req.removeStorage('userInfo')
  153. req.removeStorage('AUTH_TOKEN')
  154. this.userInfos = null
  155. this.isLogin = false
  156. req.isLogins(true)
  157. }
  158. }
  159. })
  160. }
  161. }
  162. };
  163. </script>
  164. <style>
  165. @import "./user.css";
  166. </style>