index.vue 12 KB

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