index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. color:#666;
  200. padding: 0 .24rem 0 .26rem;
  201. width: 7.1rem;
  202. margin: .3rem auto 0;
  203. .img-wrap {
  204. width: .8rem;
  205. margin: 0 .26rem 0 0;
  206. display: inline-block;
  207. img {
  208. max-width: .8rem;
  209. max-height: .8rem;
  210. }
  211. img.photo {
  212. width: 1.27rem;
  213. height: 1.27rem;
  214. }
  215. }
  216. span.edit img{
  217. float: right;
  218. margin-top: .43rem;
  219. width: .3rem;
  220. height: .3rem;
  221. }
  222. span.tel{
  223. margin-left: .2rem;
  224. }
  225. .l-right {
  226. color: #666;
  227. margin-right: .35rem;
  228. max-width: 4.8rem;
  229. text-align: right;
  230. overflow: hidden;
  231. text-overflow: ellipsis;
  232. white-space: nowrap;
  233. }
  234. i {
  235. float: right;
  236. color: #c1c1c6;
  237. font-size: .28rem;
  238. }
  239. &.img-line {
  240. padding-left: .16rem;
  241. .img-wrap {
  242. width: .9rem;
  243. margin: 0 .16rem 0 0;
  244. img {
  245. max-width: .9rem;
  246. max-height: .9rem;
  247. border-radius: 100%;
  248. border: 1px solid #acc;
  249. }
  250. }
  251. }
  252. &.block-line {
  253. margin-top: 0;
  254. position: relative;
  255. .border-line {
  256. width: 6.62rem;
  257. position: absolute;
  258. top: 0;
  259. height: 1px;
  260. background: #d9d9d9;
  261. }
  262. }
  263. }
  264. }
  265. .deleteKuang {
  266. position: fixed;
  267. background: rgba(0,0,0,0.5);
  268. top: 0;
  269. left: 0;
  270. right: 0;
  271. bottom: 0;
  272. z-index: 9999;
  273. .kuangContent {
  274. border-radius: 5px;
  275. background: #fff;
  276. width: 5rem;
  277. position: absolute;
  278. left: 50%;
  279. top: 50%;
  280. transform: translate3d(-50%, -50%, 0);
  281. overflow: hidden;
  282. .titleinfo {
  283. font-size: .3rem;
  284. color: #666;
  285. text-align: center;
  286. margin-top: 0.5rem;
  287. margin-bottom: 0.1rem;
  288. }
  289. .title {
  290. background: #5078cb;
  291. height: .7rem;
  292. line-height: .7rem;
  293. font-size: .3rem;
  294. color: #fff;
  295. text-align: center;
  296. }
  297. .info {
  298. color: #f00;
  299. text-align: center;
  300. }
  301. .K_btn {
  302. margin-top: 0.4rem;
  303. line-height: 0.7rem;
  304. height: 0.7rem;
  305. &::after{
  306. clear: both;
  307. display: block;
  308. content: ' ';
  309. visibility: hidden;
  310. zoom: 1;
  311. }
  312. div {
  313. float: left;
  314. width: 50%;
  315. font-size: 0.3rem;
  316. text-align: center;
  317. &.cancelBtn {
  318. background: #b4b5b9;
  319. color: #333;
  320. }
  321. &.answerBtn {
  322. background: #5078cb;
  323. color: #fff;
  324. }
  325. }
  326. }
  327. }
  328. }
  329. .modal-content {
  330. position: absolute;
  331. height: 5.32rem;
  332. bottom: .98rem;
  333. left: 0;
  334. background: #fff;
  335. width: 100%;
  336. border-radius: 0;
  337. box-shadow: 0 -9px 9px rgba(0,0,0,.5);
  338. p {
  339. height: .88rem;
  340. line-height: .88rem;
  341. text-align: center;
  342. font-size: .3rem;
  343. background: #f6f5f5;
  344. i {
  345. position: absolute;
  346. right: 0;
  347. color: #bebebe;
  348. font-size: .24rem;
  349. margin-right: .35rem;
  350. }
  351. }
  352. ul {
  353. height: 4.4rem;
  354. overflow-y: auto;
  355. li {
  356. height: 1rem;
  357. line-height: 1rem;
  358. padding: 0 .23rem 0 .4rem;
  359. border-bottom: 1px solid #e5e6eb;
  360. overflow: hidden;
  361. text-overflow: ellipsis;
  362. white-space: nowrap;
  363. &:hover, &:active, &:focus {
  364. background: #f7f7f7;
  365. }
  366. a {
  367. display: inline-block;
  368. color: #666;
  369. font-size: .28rem;
  370. }
  371. i {
  372. color: #3f84f6;
  373. float: right;
  374. font-size: .24rem;
  375. }
  376. &.active {
  377. a {
  378. color: #3f84f6;
  379. border-bottom: 1px solid #3f84f6;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. </style>