index.vue 9.7 KB

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