index.vue 10 KB

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