index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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.$router.push('/mobile/store')
  155. // this.setRemindText('请先前往pc端申请开店')
  156. }
  157. } else if (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313) {
  158. this.setRemindText('请先前往pc端完善企业信息')
  159. } else {
  160. this.$router.push(url)
  161. }
  162. },
  163. setRemindText: function (str) {
  164. this.collectResult = str
  165. this.timeoutCount++
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .mobile-user {
  172. background: #f1f3f6;
  173. .line {
  174. height: 1.17rem;
  175. background: #fff;
  176. line-height: 1.17rem;
  177. font-size: .28rem;
  178. padding: 0 .24rem 0 .26rem;
  179. width: 7.1rem;
  180. margin: .3rem auto 0;
  181. .img-wrap {
  182. width: .8rem;
  183. margin: 0 .26rem 0 0;
  184. display: inline-block;
  185. img {
  186. max-width: .8rem;
  187. max-height: .8rem;
  188. }
  189. img.photo {
  190. width: 1.27rem;
  191. height: 1.27rem;
  192. }
  193. }
  194. span.edit img{
  195. float: right;
  196. margin-top: .43rem;
  197. width: .3rem;
  198. height: .3rem;
  199. }
  200. span.tel{
  201. margin-left: .2rem;
  202. }
  203. .l-right {
  204. color: #666;
  205. margin-right: .35rem;
  206. max-width: 4.8rem;
  207. text-align: right;
  208. overflow: hidden;
  209. text-overflow: ellipsis;
  210. white-space: nowrap;
  211. }
  212. i {
  213. float: right;
  214. color: #c1c1c6;
  215. font-size: .28rem;
  216. }
  217. &.img-line {
  218. padding-left: .16rem;
  219. .img-wrap {
  220. width: .9rem;
  221. margin: 0 .16rem 0 0;
  222. img {
  223. max-width: .9rem;
  224. max-height: .9rem;
  225. border-radius: 100%;
  226. border: 1px solid #acc;
  227. }
  228. }
  229. }
  230. &.block-line {
  231. margin-top: 0;
  232. position: relative;
  233. .border-line {
  234. width: 6.62rem;
  235. position: absolute;
  236. top: 0;
  237. height: 1px;
  238. background: #d9d9d9;
  239. }
  240. }
  241. }
  242. }
  243. .deleteKuang {
  244. position: fixed;
  245. background: rgba(0,0,0,0.5);
  246. top: 0;
  247. left: 0;
  248. right: 0;
  249. bottom: 0;
  250. z-index: 9999;
  251. .kuangContent {
  252. border-radius: 5px;
  253. background: #fff;
  254. width: 5rem;
  255. position: absolute;
  256. left: 50%;
  257. top: 50%;
  258. transform: translate3d(-50%, -50%, 0);
  259. overflow: hidden;
  260. .titleinfo {
  261. font-size: .3rem;
  262. color: #666;
  263. text-align: center;
  264. margin-top: 0.5rem;
  265. margin-bottom: 0.1rem;
  266. }
  267. .title {
  268. background: #5078cb;
  269. height: .7rem;
  270. line-height: .7rem;
  271. font-size: .3rem;
  272. color: #fff;
  273. text-align: center;
  274. }
  275. .info {
  276. color: #f00;
  277. text-align: center;
  278. }
  279. .K_btn {
  280. margin-top: 0.4rem;
  281. line-height: 0.7rem;
  282. height: 0.7rem;
  283. &::after{
  284. clear: both;
  285. display: block;
  286. content: ' ';
  287. visibility: hidden;
  288. zoom: 1;
  289. }
  290. div {
  291. float: left;
  292. width: 50%;
  293. font-size: 0.3rem;
  294. text-align: center;
  295. &.cancelBtn {
  296. background: #b4b5b9;
  297. color: #333;
  298. }
  299. &.answerBtn {
  300. background: #5078cb;
  301. color: #fff;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. .modal-content {
  308. position: absolute;
  309. height: 5.32rem;
  310. bottom: .98rem;
  311. left: 0;
  312. background: #fff;
  313. width: 100%;
  314. border-radius: 0;
  315. box-shadow: 0 -9px 9px rgba(0,0,0,.5);
  316. p {
  317. height: .88rem;
  318. line-height: .88rem;
  319. text-align: center;
  320. font-size: .3rem;
  321. background: #f6f5f5;
  322. i {
  323. position: absolute;
  324. right: 0;
  325. color: #bebebe;
  326. font-size: .24rem;
  327. margin-right: .35rem;
  328. }
  329. }
  330. ul {
  331. height: 4.4rem;
  332. overflow-y: auto;
  333. li {
  334. height: 1rem;
  335. line-height: 1rem;
  336. padding: 0 .23rem 0 .4rem;
  337. border-bottom: 1px solid #e5e6eb;
  338. overflow: hidden;
  339. text-overflow: ellipsis;
  340. white-space: nowrap;
  341. &:hover, &:active, &:focus {
  342. background: #f7f7f7;
  343. }
  344. a {
  345. display: inline-block;
  346. color: #666;
  347. font-size: .28rem;
  348. }
  349. i {
  350. color: #3f84f6;
  351. float: right;
  352. font-size: .24rem;
  353. }
  354. &.active {
  355. a {
  356. color: #3f84f6;
  357. border-bottom: 1px solid #3f84f6;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. </style>