index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. data () {
  96. return {
  97. showLogout: false,
  98. showLogin: false,
  99. timeoutCount: 0,
  100. collectResult: ''
  101. }
  102. },
  103. components: {
  104. RemindBox
  105. },
  106. methods: {
  107. switchEnterprise(en) {
  108. this.$http.get(`/user/authentication/${en.uu || 0}`).then(() => {
  109. this.$store.dispatch('loadUserInfo').then(() => {
  110. this.showLogin = false
  111. })
  112. })
  113. },
  114. logout () {
  115. this.$http.get('/logout/crossBefore', {params: {returnUrl: window.location.protocol + '//' + window.location.host}}).then(response => {
  116. if (response.data) {
  117. window.location.href = response.data.logoutUrl + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  118. }
  119. })
  120. },
  121. stopPro (e) {
  122. if (e) {
  123. e.stopPropagation()
  124. }
  125. },
  126. go: function (url) {
  127. if (url === '/mobile/user/storeinfo') {
  128. this.$http.get('/store-service/stores', {params: {op: 'check'}}).then(res => {
  129. if (res.data.uuid) {
  130. this.$router.push(url)
  131. } else {
  132. this.setRemindText('请先前往pc端申请开店')
  133. }
  134. }, err => {
  135. console.log(err)
  136. this.setRemindText('请先前往pc端申请开店')
  137. })
  138. } else if (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313) {
  139. this.setRemindText('请先前往pc端完善企业信息')
  140. } else {
  141. this.$router.push(url)
  142. }
  143. },
  144. setRemindText: function (str) {
  145. this.collectResult = str
  146. this.timeoutCount++
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .mobile-user {
  153. background: #f1f3f6;
  154. .line {
  155. height: 1.17rem;
  156. background: #fff;
  157. line-height: 1.17rem;
  158. font-size: .28rem;
  159. padding: 0 .24rem 0 .26rem;
  160. width: 7.1rem;
  161. margin: .3rem auto 0;
  162. .img-wrap {
  163. width: .8rem;
  164. margin: 0 .26rem 0 0;
  165. display: inline-block;
  166. img {
  167. max-width: .8rem;
  168. max-height: .8rem;
  169. }
  170. }
  171. .l-right {
  172. color: #666;
  173. float: right;
  174. margin-right: .35rem;
  175. max-width: 4.2rem;
  176. text-align: right;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. white-space: nowrap;
  180. }
  181. i {
  182. float: right;
  183. color: #c1c1c6;
  184. font-size: .28rem;
  185. }
  186. &.img-line {
  187. padding-left: .16rem;
  188. .img-wrap {
  189. width: .9rem;
  190. margin: 0 .16rem 0 0;
  191. img {
  192. max-width: .9rem;
  193. max-height: .9rem;
  194. border-radius: 100%;
  195. border: 1px solid #acc;
  196. }
  197. }
  198. }
  199. &.block-line {
  200. margin-top: 0;
  201. position: relative;
  202. .border-line {
  203. width: 6.62rem;
  204. position: absolute;
  205. top: 0;
  206. height: 1px;
  207. background: #d3d3d3;
  208. }
  209. }
  210. }
  211. }
  212. .deleteKuang {
  213. position: fixed;
  214. background: rgba(0,0,0,0.5);
  215. top: 0;
  216. left: 0;
  217. right: 0;
  218. bottom: 0;
  219. z-index: 9999;
  220. .kuangContent {
  221. border-radius: 5px;
  222. background: #fff;
  223. width: 5rem;
  224. position: absolute;
  225. left: 50%;
  226. top: 50%;
  227. transform: translate3d(-50%, -50%, 0);
  228. overflow: hidden;
  229. .titleinfo {
  230. font-size: .3rem;
  231. color: #666;
  232. text-align: center;
  233. margin-top: 0.5rem;
  234. margin-bottom: 0.1rem;
  235. }
  236. .title {
  237. background: #5078cb;
  238. height: .7rem;
  239. line-height: .7rem;
  240. font-size: .3rem;
  241. color: #fff;
  242. text-align: center;
  243. }
  244. .info {
  245. color: #f00;
  246. text-align: center;
  247. }
  248. .K_btn {
  249. margin-top: 0.4rem;
  250. line-height: 0.7rem;
  251. height: 0.7rem;
  252. &::after{
  253. clear: both;
  254. display: block;
  255. content: ' ';
  256. visibility: hidden;
  257. zoom: 1;
  258. }
  259. div {
  260. float: left;
  261. width: 50%;
  262. font-size: 0.3rem;
  263. text-align: center;
  264. &.cancelBtn {
  265. background: #b4b5b9;
  266. color: #333;
  267. }
  268. &.answerBtn {
  269. background: #5078cb;
  270. color: #fff;
  271. }
  272. }
  273. }
  274. }
  275. }
  276. .modal-content {
  277. position: absolute;
  278. height: 5.32rem;
  279. bottom: .98rem;
  280. left: 0;
  281. background: #fff;
  282. width: 100%;
  283. border-radius: 0;
  284. box-shadow: 0 -9px 9px rgba(0,0,0,.5);
  285. p {
  286. height: .88rem;
  287. line-height: .88rem;
  288. text-align: center;
  289. font-size: .3rem;
  290. background: #f6f5f5;
  291. i {
  292. float: right;
  293. color: #bebebe;
  294. font-size: .24rem;
  295. margin-right: .35rem;
  296. }
  297. }
  298. ul {
  299. height: 4.4rem;
  300. overflow-y: auto;
  301. li {
  302. height: 1rem;
  303. line-height: 1rem;
  304. padding: 0 .23rem 0 .4rem;
  305. border-bottom: 1px solid #e5e6eb;
  306. a {
  307. display: inline-block;
  308. color: #666;
  309. font-size: .28rem;
  310. }
  311. i {
  312. color: #3f84f6;
  313. float: right;
  314. font-size: .24rem;
  315. }
  316. &.active {
  317. a {
  318. color: #3f84f6;
  319. border-bottom: 1px solid #3f84f6;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. </style>