index.vue 11 KB

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