index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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 inline-block">{{currentEnName}}</span>
  27. </div>
  28. <!--v-if="storeStatus.uuid"-->
  29. <div class="line" @click="go('/mobile/user/storeinfo')" v-if="storeStatus.uuid">
  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. if (res.data.success) {
  138. this.applyStatus = res.data.data ? res.data.data.status : ''
  139. } else {
  140. this.applyStatus = 'error'
  141. }
  142. })
  143. })
  144. })
  145. // 切换帐套用
  146. this.$jsonp(`${process.env.ssoUrl}/sso/login/change/userspace?spaceUU=${en.uu}`, {timeout: 5000, name: 'successCallback'}, (err) => {
  147. console.log(err)
  148. })
  149. },
  150. logout () {
  151. this.$http.get('/logout/crossBefore', {params: {returnUrl: window.location.protocol + '//' + window.location.host}}).then(response => {
  152. if (response.data) {
  153. window.location.href = response.data.logoutUrl + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  154. }
  155. })
  156. },
  157. stopPro (e) {
  158. if (e) {
  159. e.stopPropagation()
  160. }
  161. },
  162. go: function (url) {
  163. if (url === '/mobile/user/storeinfo') {
  164. if (this.storeStatus.uuid) {
  165. this.$router.push(url)
  166. } else {
  167. // this.setRemindText('请前往PC端申请开店')
  168. if (this.applyStatus === 'PREPARE') {
  169. this.setRemindText('您的申请已提交,请耐心等待工作人员审核(2-3个工作日)')
  170. } else {
  171. if (!this.$store.state.option.user.data.enterprise.uu) {
  172. // 进入个人绑定企业页面
  173. this.$router.push('/mobile/store/register')
  174. } else {
  175. this.$router.push('/mobile/store')
  176. }
  177. }
  178. }
  179. } else if (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313) {
  180. this.setRemindText('请点击【开店申请】完善信息')
  181. } else {
  182. this.$router.push(url)
  183. }
  184. },
  185. setRemindText: function (str) {
  186. this.collectResult = str
  187. this.timeoutCount++
  188. }
  189. },
  190. created() {
  191. if (!this.storeStatus) {
  192. this.$http.get('/store-service/applications?status=normal').then(res => {
  193. this.applyStatus = res.data.data ? res.data.data.status : ''
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .mobile-user {
  201. background: #f1f3f6;
  202. .line {
  203. height: 1.17rem;
  204. background: #fff;
  205. line-height: 1.17rem;
  206. font-size: .28rem;
  207. padding: 0 .24rem 0 .26rem;
  208. width: 7.1rem;
  209. margin: .3rem auto 0;
  210. .img-wrap {
  211. width: .8rem;
  212. margin: 0 .26rem 0 0;
  213. display: inline-block;
  214. img {
  215. max-width: .8rem;
  216. max-height: .8rem;
  217. }
  218. img.photo {
  219. width: 1.27rem;
  220. height: 1.27rem;
  221. }
  222. }
  223. span.edit img{
  224. float: right;
  225. margin-top: .43rem;
  226. width: .3rem;
  227. height: .3rem;
  228. }
  229. span.tel{
  230. margin-left: .2rem;
  231. }
  232. .l-right {
  233. color: #666;
  234. margin-right: .35rem;
  235. max-width: 4.8rem;
  236. text-align: right;
  237. overflow: hidden;
  238. text-overflow: ellipsis;
  239. white-space: nowrap;
  240. }
  241. i {
  242. float: right;
  243. color: #c1c1c6;
  244. font-size: .28rem;
  245. }
  246. &.img-line {
  247. padding-left: .16rem;
  248. .img-wrap {
  249. width: .9rem;
  250. margin: 0 .16rem 0 0;
  251. img {
  252. max-width: .9rem;
  253. max-height: .9rem;
  254. border-radius: 100%;
  255. border: 1px solid #acc;
  256. }
  257. }
  258. }
  259. &.block-line {
  260. margin-top: 0;
  261. position: relative;
  262. .border-line {
  263. width: 6.62rem;
  264. position: absolute;
  265. top: 0;
  266. height: 1px;
  267. background: #d9d9d9;
  268. }
  269. }
  270. }
  271. }
  272. .deleteKuang {
  273. position: fixed;
  274. background: rgba(0,0,0,0.5);
  275. top: 0;
  276. left: 0;
  277. right: 0;
  278. bottom: 0;
  279. z-index: 9999;
  280. .kuangContent {
  281. border-radius: 5px;
  282. background: #fff;
  283. width: 5rem;
  284. position: absolute;
  285. left: 50%;
  286. top: 50%;
  287. transform: translate3d(-50%, -50%, 0);
  288. overflow: hidden;
  289. .titleinfo {
  290. font-size: .3rem;
  291. color: #666;
  292. text-align: center;
  293. margin-top: 0.5rem;
  294. margin-bottom: 0.1rem;
  295. }
  296. .title {
  297. background: #5078cb;
  298. height: .7rem;
  299. line-height: .7rem;
  300. font-size: .3rem;
  301. color: #fff;
  302. text-align: center;
  303. }
  304. .info {
  305. color: #f00;
  306. text-align: center;
  307. }
  308. .K_btn {
  309. margin-top: 0.4rem;
  310. line-height: 0.7rem;
  311. height: 0.7rem;
  312. &::after{
  313. clear: both;
  314. display: block;
  315. content: ' ';
  316. visibility: hidden;
  317. zoom: 1;
  318. }
  319. div {
  320. float: left;
  321. width: 50%;
  322. font-size: 0.3rem;
  323. text-align: center;
  324. &.cancelBtn {
  325. background: #b4b5b9;
  326. color: #333;
  327. }
  328. &.answerBtn {
  329. background: #5078cb;
  330. color: #fff;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .modal-content {
  337. position: absolute;
  338. height: 5.32rem;
  339. bottom: .98rem;
  340. left: 0;
  341. background: #fff;
  342. width: 100%;
  343. border-radius: 0;
  344. box-shadow: 0 -9px 9px rgba(0,0,0,.5);
  345. p {
  346. height: .88rem;
  347. line-height: .88rem;
  348. text-align: center;
  349. font-size: .3rem;
  350. background: #f6f5f5;
  351. i {
  352. position: absolute;
  353. right: 0;
  354. color: #bebebe;
  355. font-size: .24rem;
  356. margin-right: .35rem;
  357. }
  358. }
  359. ul {
  360. height: 4.4rem;
  361. overflow-y: auto;
  362. li {
  363. height: 1rem;
  364. line-height: 1rem;
  365. padding: 0 .23rem 0 .4rem;
  366. border-bottom: 1px solid #e5e6eb;
  367. overflow: hidden;
  368. text-overflow: ellipsis;
  369. white-space: nowrap;
  370. &:hover, &:active, &:focus {
  371. background: #f7f7f7;
  372. }
  373. a {
  374. display: inline-block;
  375. color: #666;
  376. font-size: .28rem;
  377. }
  378. i {
  379. color: #3f84f6;
  380. float: right;
  381. font-size: .24rem;
  382. }
  383. &.active {
  384. a {
  385. color: #3f84f6;
  386. border-bottom: 1px solid #3f84f6;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. </style>