index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <div>
  3. <div class="com-mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>个人中心
  6. <span @click="showLogout = true">退出</span>
  7. </p>
  8. </div>
  9. <div class="mobile-user mobile-fix-content">
  10. <div class="line img-line">
  11. <div class="img-wrap">
  12. <img src="/images/component/default.png" alt="">
  13. </div>
  14. <span>{{user.data.userName}}</span>
  15. </div>
  16. <div class="line" @click="showLogin=true">
  17. <div class="img-wrap">
  18. <img src="/images/mobile/user/icon_01.png" alt="">
  19. </div>
  20. <span>公司</span>
  21. <i class="iconfont icon-xiangyou"></i>
  22. <span class="l-right">{{user.data.enterprise.enName}}</span>
  23. </div>
  24. <div class="line" @click="go('/mobile/user/storeinfo')">
  25. <div class="img-wrap">
  26. <img src="/images/mobile/user/icon_02.png" alt="">
  27. </div>
  28. <span>店铺信息</span>
  29. <i class="iconfont icon-xiangyou"></i>
  30. </div>
  31. <div class="line block-line" @click="go('/mobile/user/enterpriseinfo')">
  32. <div class="img-wrap">
  33. <img src="/images/mobile/user/icon_03.png" alt="">
  34. </div>
  35. <span>企业信息</span>
  36. <i class="iconfont icon-xiangyou"></i>
  37. <div class="border-line"></div>
  38. </div>
  39. <nuxt-link to="/mobile/user/info/personal" tag="div" class="line block-line">
  40. <div class="img-wrap">
  41. <img src="/images/mobile/user/icon_04.png" alt="">
  42. </div>
  43. <span>个人信息</span>
  44. <i class="iconfont icon-xiangyou"></i>
  45. <div class="border-line"></div>
  46. </nuxt-link>
  47. <div @click="go('/mobile/user/info/admin')" class="line block-line">
  48. <div class="img-wrap">
  49. <img src="/images/mobile/user/icon_05.png" alt="">
  50. </div>
  51. <span>管理员信息</span>
  52. <i class="iconfont icon-xiangyou"></i>
  53. <div class="border-line"></div>
  54. </div>
  55. <div class="deleteKuang" v-if="showLogout">
  56. <div class="kuangContent">
  57. <div class="title">系统提示</div>
  58. <div class="titleinfo">是否退出登录</div>
  59. <!--<div class="info" v-show="isUploadpro">*存在已上架信息</div>-->
  60. <div class="K_btn">
  61. <div class="cancelBtn" @click="showLogout = false">取消</div>
  62. <div class="answerBtn" @click="logout()">确定</div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="mobile-modal" v-if="showLogin" @click="showLogin=false">
  67. <div class="modal-content" @click="stopPro($event)">
  68. <p>公司选择 <i class="iconfont icon-guanbi1" @click="showLogin=false"></i></p>
  69. <ul>
  70. <li class="active" @click="switchEnterprise(user.data.enterprise)">
  71. <a>{{ user.data.enterprise.enName }}</a>
  72. <i class="iconfont icon-xuanzhong"></i>
  73. </li>
  74. <li
  75. v-for="en in sortEnterprises"
  76. v-if="en.uu != user.data.enterprise.uu"
  77. v-bind:key="en.uu"
  78. @click="switchEnterprise(en)">
  79. <a>{{ en.enName }}</a>
  80. </li>
  81. <li v-if="user.data.enterprise.uu" @click="switchEnterprise({uu: 0})">
  82. <a><span v-text="user.data.userName"></span>(个人账户)</a>
  83. </li>
  84. </ul>
  85. </div>
  86. </div>
  87. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. import { RemindBox } from '~components/mobile/common'
  93. export default {
  94. layout: 'mobileNoHeader',
  95. middleware: 'authenticated',
  96. data () {
  97. return {
  98. showLogout: false,
  99. showLogin: false,
  100. timeoutCount: 0,
  101. collectResult: ''
  102. }
  103. },
  104. components: {
  105. RemindBox
  106. },
  107. methods: {
  108. switchEnterprise(en) {
  109. this.$http.get(`/user/authentication/${en.uu || 0}`).then(() => {
  110. this.$store.dispatch('loadUserInfo').then(() => {
  111. this.showLogin = false
  112. })
  113. })
  114. },
  115. logout () {
  116. this.$http.get('/logout/crossBefore', {params: {returnUrl: window.location.protocol + '//' + window.location.host}}).then(response => {
  117. if (response.data) {
  118. window.location.href = response.data.logoutUrl + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  119. }
  120. })
  121. },
  122. stopPro (e) {
  123. if (e) {
  124. e.stopPropagation()
  125. }
  126. },
  127. go: function (url) {
  128. if (url === '/mobile/user/storeinfo') {
  129. this.$http.get('/store-service/stores', {params: {op: 'check'}}).then(res => {
  130. if (res.data.uuid) {
  131. this.$router.push(url)
  132. } else {
  133. this.setRemindText('请先前往pc端申请开店')
  134. }
  135. }, err => {
  136. console.log(err)
  137. this.setRemindText('请先前往pc端申请开店')
  138. })
  139. } else if (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313) {
  140. this.setRemindText('请先前往pc端完善企业信息')
  141. } else {
  142. this.$router.push(url)
  143. }
  144. },
  145. setRemindText: function (str) {
  146. this.collectResult = str
  147. this.timeoutCount++
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .mobile-user {
  154. background: #f1f3f6;
  155. .line {
  156. height: 1.17rem;
  157. background: #fff;
  158. line-height: 1.17rem;
  159. font-size: .28rem;
  160. padding: 0 .24rem 0 .26rem;
  161. width: 7.1rem;
  162. margin: .3rem auto 0;
  163. .img-wrap {
  164. width: .8rem;
  165. margin: 0 .26rem 0 0;
  166. display: inline-block;
  167. img {
  168. max-width: .8rem;
  169. max-height: .8rem;
  170. }
  171. }
  172. .l-right {
  173. color: #666;
  174. float: right;
  175. margin-right: .35rem;
  176. max-width: 4.2rem;
  177. text-align: right;
  178. overflow: hidden;
  179. text-overflow: ellipsis;
  180. white-space: nowrap;
  181. }
  182. i {
  183. float: right;
  184. color: #c1c1c6;
  185. font-size: .28rem;
  186. }
  187. &.img-line {
  188. padding-left: .16rem;
  189. .img-wrap {
  190. width: .9rem;
  191. margin: 0 .16rem 0 0;
  192. img {
  193. max-width: .9rem;
  194. max-height: .9rem;
  195. border-radius: 100%;
  196. border: 1px solid #acc;
  197. }
  198. }
  199. }
  200. &.block-line {
  201. margin-top: 0;
  202. position: relative;
  203. .border-line {
  204. width: 6.62rem;
  205. position: absolute;
  206. top: 0;
  207. height: 1px;
  208. background: #d9d9d9;
  209. }
  210. }
  211. }
  212. }
  213. .deleteKuang {
  214. position: fixed;
  215. background: rgba(0,0,0,0.5);
  216. top: 0;
  217. left: 0;
  218. right: 0;
  219. bottom: 0;
  220. z-index: 9999;
  221. .kuangContent {
  222. border-radius: 5px;
  223. background: #fff;
  224. width: 5rem;
  225. position: absolute;
  226. left: 50%;
  227. top: 50%;
  228. transform: translate3d(-50%, -50%, 0);
  229. overflow: hidden;
  230. .titleinfo {
  231. font-size: .3rem;
  232. color: #666;
  233. text-align: center;
  234. margin-top: 0.5rem;
  235. margin-bottom: 0.1rem;
  236. }
  237. .title {
  238. background: #5078cb;
  239. height: .7rem;
  240. line-height: .7rem;
  241. font-size: .3rem;
  242. color: #fff;
  243. text-align: center;
  244. }
  245. .info {
  246. color: #f00;
  247. text-align: center;
  248. }
  249. .K_btn {
  250. margin-top: 0.4rem;
  251. line-height: 0.7rem;
  252. height: 0.7rem;
  253. &::after{
  254. clear: both;
  255. display: block;
  256. content: ' ';
  257. visibility: hidden;
  258. zoom: 1;
  259. }
  260. div {
  261. float: left;
  262. width: 50%;
  263. font-size: 0.3rem;
  264. text-align: center;
  265. &.cancelBtn {
  266. background: #b4b5b9;
  267. color: #333;
  268. }
  269. &.answerBtn {
  270. background: #5078cb;
  271. color: #fff;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. .modal-content {
  278. position: absolute;
  279. height: 5.32rem;
  280. bottom: 0;
  281. left: 0;
  282. background: #fff;
  283. width: 100%;
  284. border-radius: 0;
  285. box-shadow: 0 -9px 9px rgba(0,0,0,.5);
  286. p {
  287. height: .88rem;
  288. line-height: .88rem;
  289. text-align: center;
  290. font-size: .3rem;
  291. background: #f6f5f5;
  292. i {
  293. position: absolute;
  294. right: 0;
  295. color: #bebebe;
  296. font-size: .24rem;
  297. margin-right: .35rem;
  298. }
  299. }
  300. ul {
  301. height: 4.4rem;
  302. overflow-y: auto;
  303. li {
  304. height: 1rem;
  305. line-height: 1rem;
  306. padding: 0 .23rem 0 .4rem;
  307. border-bottom: 1px solid #e5e6eb;
  308. overflow: hidden;
  309. text-overflow: ellipsis;
  310. white-space: nowrap;
  311. a {
  312. display: inline-block;
  313. color: #666;
  314. font-size: .28rem;
  315. }
  316. i {
  317. color: #3f84f6;
  318. float: right;
  319. font-size: .24rem;
  320. }
  321. &.active {
  322. a {
  323. color: #3f84f6;
  324. border-bottom: 1px solid #3f84f6;
  325. }
  326. }
  327. }
  328. }
  329. }
  330. </style>