user-center.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="user-center" >
  3. <div class="content flex-box">
  4. <!-- 侧栏 -->
  5. <div :class="['side-nav',this.$store.state.locale == 'en'?'side-nav-en':'side-nav-zh']">
  6. <div class="item">
  7. <div class="tit">{{$t('userCenter.orderManagement')}}</div>
  8. <a
  9. href="javascript:void(0)"
  10. @click="switchPage('order')"
  11. :class="['item-a',currentPage=='order'?'active':'']"
  12. >{{$t('userCenter.myOrders')}}</a>
  13. <a
  14. href="javascript:void(0)"
  15. @click="switchPage('collection')"
  16. :class="['item-a',currentPage=='collection'?'active':'']"
  17. >{{$t('userCenter.myCollection')}}</a>
  18. <a
  19. href="javascript:void(0)"
  20. @click="switchPage('footprint')"
  21. :class="['item-a',currentPage=='footprint'?'active':'']"
  22. >{{$t('history.history')}}</a>
  23. <a
  24. href="javascript:void(0)"
  25. @click="switchPage('comments')"
  26. :class="['item-a',currentPage=='comments'?'active':'']"
  27. >{{$t('userCenter.evaluationList')}}</a>
  28. </div>
  29. <div class="item">
  30. <div class="tit">{{$t('userCenter.customerService')}}</div>
  31. <!-- <a
  32. href="javascript:void(0)"
  33. @click="switchPage('contactCustomerService')"
  34. :class="['item-a',currentPage=='return'?'active':'']"
  35. >{{$t('userCenter.contactCustomerService')}}</a> -->
  36. <!-- 联系平台客服 -->
  37. <a @click="toChat" href="javascript:void(0)" class="item-a message-chat" target="view_window">
  38. {{$t('prodDetail.contactCustomerService')}}
  39. <i class="message-radio" v-if="message"></i>
  40. </a>
  41. <a
  42. href="javascript:void(0)"
  43. @click="switchPage('return')"
  44. :class="['item-a',currentPage=='return'?'active':'']"
  45. >{{$t('userCenter.refunds')}}</a>
  46. <!-- 免费开店 -->
  47. <!-- <a
  48. href="javascript:void(0)"
  49. @click="switchPage('freeshop')"
  50. v-if="shopAuditStatus!=1"
  51. :class="['item-a',currentPage=='freeshop'?'active':'']"
  52. >{{$t('userCenter.freeStoreOpening')}}</a> -->
  53. <!-- 我的店铺 -->
  54. <!-- <a
  55. href="javascript:void(0)"
  56. @click="switchPage('myshop')"
  57. data-shopid="shopId"
  58. v-if="shopAuditStatus == 1"
  59. :class="['item-a']"
  60. >{{$t('userCenter.myStore')}}</a> -->
  61. <!-- 设置店铺账号 -->
  62. <!-- <a
  63. href="javascript:void(0)"
  64. @click="switchPage('shopaccount')"
  65. v-if="shopAuditStatus == 1 && isSetPassword == false"
  66. :class="['item-a',currentPage=='shopaccount'?'active':'']"
  67. >{{$t('userCenter.setStoreAccount')}}</a> -->
  68. <!-- 修改店铺密码 -->
  69. <!-- <a
  70. href="javascript:void(0)"
  71. @click="switchPage('shopaccount')"
  72. v-if="shopAuditStatus == 1 && isSetPassword == true"
  73. :class="['item-a',currentPage=='shopaccount'?'active':'']"
  74. >{{$t('userCenter.changeStorePassword')}}</a> -->
  75. </div>
  76. <div class="item">
  77. <div class="tit">{{$t('userCenter.assetCenter')}}</div>
  78. <a
  79. href="javascript:void(0)"
  80. @click="switchPage('balance')"
  81. :class="['item-a',currentPage=='balance'?'active':'']"
  82. >{{$t('userCenter.myBalance')}}</a>
  83. <a
  84. href="javascript:void(0)"
  85. @click="switchPage('integral')"
  86. :class="['item-a',currentPage=='integral'?'active':'']"
  87. >{{$t('userCenter.myPoints')}}</a>
  88. <a href="javascript:void(0)" @click="switchPage('member-center')" :class="['item-a']">{{$t('userCenter.memberCenter')}}</a>
  89. <a
  90. href="javascript:void(0)"
  91. @click="switchPage('coupons-center')"
  92. :class="['item-a']"
  93. >{{$t('userCenter.couponCenter')}}</a>
  94. <a
  95. href="javascript:void(0)"
  96. @click="switchPage('coupons')"
  97. :class="['item-a',currentPage=='coupons'?'active':'']"
  98. >{{$t('userCenter.myCoupons')}}</a>
  99. </div>
  100. <div class="item">
  101. <div class="tit">{{$t('userCenter.accountManagement')}}</div>
  102. <a
  103. href="javascript:void(0)"
  104. @click="switchPage('account')"
  105. :class="['item-a',currentPage=='account'?'active':'']"
  106. >{{$t('userCenter.accountInformation')}}</a>
  107. <a
  108. href="javascript:void(0)"
  109. @click="switchPage('address')"
  110. :class="['item-a',currentPage=='address'?'active':'']"
  111. >{{$t('userCenter.receivingAddress')}}</a>
  112. <a
  113. href="javascript:void(0)"
  114. @click="switchPage('password')"
  115. :class="['item-a',currentPage=='password'?'active':'']"
  116. >{{$t('userCenter.changePassword')}}</a>
  117. </div>
  118. </div>
  119. <!-- /侧栏 -->
  120. <nuxt-child @userCenterInfo="getUserCenterInfo()" />
  121. </div>
  122. </div>
  123. </template>
  124. <script>
  125. export default {
  126. data () {
  127. return {
  128. unUseCount: 0,
  129. currentPage: '',
  130. shopAuditStatus: null, //店铺状态:0 未审核 1已通过 -1未通过 null 未开店
  131. shopId: 0, //店铺id,
  132. isSetPassword: null,
  133. }
  134. },
  135. mounted () {
  136. this.getCouponCount()
  137. this.getUserCenterInfo() //获取个人中心信息
  138. this.currentPage = this.$route.query.currentPage || this.$route.path.substring(this.$route.path.lastIndexOf("-") + 1)
  139. },
  140. computed: {
  141. message() {
  142. return this.$store.state.websocket.messageValue;
  143. }
  144. },
  145. watch:{
  146. $route(to,from){
  147. if (to.path === '/user-center/uc-integral') {
  148. this.currentPage = 'integral'
  149. }
  150. }
  151. },
  152. updated() {
  153. this.currentPage = this.$route.query.currentPage || this.$route.path.substring(this.$route.path.lastIndexOf("-") + 1)
  154. },
  155. methods: {
  156. /**
  157. * 跳转客服
  158. */
  159. toChat() {
  160. this.$store.commit('websocket/changeMessage', 0)
  161. let routeUrl = this.$router.resolve({
  162. path: '/chat?shopId=1&chatType=1'
  163. });
  164. window.open(routeUrl.href, 'view_window');
  165. },
  166. switchPage (page) {
  167. if (page == 'coupons-center') {
  168. this.$router.push({ path: '/coupons' })
  169. } else if (page == 'member-center') {
  170. this.$router.push({ path: '/member-center/member-center' })
  171. } else if (page == 'comments') {
  172. this.$router.push({ path: '/user-center/uc-comments' })
  173. } else if (page == 'balance') {
  174. this.$router.push({ path: '/user-center/uc-balance' })
  175. } else if (page == "myshop") {
  176. if (this.shopAuditStatus==1) {
  177. this.$router.push({ path: `/shopIndex?sid=${this.shopId}` })
  178. } else {
  179. this.$message({
  180. type: 'warning',
  181. message: this.shopAuditStatus == 0 ? this.$i18n.t('userCenter.storeProgress') : this.shopAuditStatus == -1 ? this.$i18n.t('userCenter.theAuditNotPass') : this.$i18n.t('userCenter.theStoreOffline')
  182. })
  183. }
  184. // this.$router.push({ path: '/shopIndex?sid=' + this.shopId })
  185. } else if (page == 'shopaccount') {
  186. this.$router.push({ path: '/user-center/uc-shopaccount', query: { isSetPassword: this.isSetPassword } })
  187. } else if (page == 'freeshop') {
  188. this.$router.push({ path: '/user-center/uc-freeshop', query: { shopAuditStatus: this.shopAuditStatus } })
  189. } else {
  190. this.$router.push({ path: '/user-center/uc-' + page })
  191. }
  192. this.currentPage = page
  193. },
  194. /**
  195. * 请求个人中心信息(店铺审核状态)
  196. */
  197. getUserCenterInfo () {
  198. this.$axios.get('/p/user/centerInfo', {
  199. }).then(({ data }) => {
  200. this.isSetPassword = data.isSetPassword //是否已经设置过支付密码
  201. this.orderCountData = data.orderCountData //订单状态信息
  202. this.shopAuditStatus = data.shopAuditStatus //审核状态:0 未审核 1已通过 -1未通过 null 未开店
  203. this.shopId = data.shopId //店铺id
  204. })
  205. },
  206. /**
  207. * 获取各分类数量
  208. */
  209. getCouponCount () {
  210. this.$axios.get('/p/myCoupon/getMyCouponsStatusCount', {
  211. }).then(({ data }) => {
  212. this.unUseCount = data.unUseCount
  213. })
  214. },
  215. },
  216. }
  217. </script>
  218. <style scoped src='~/assets/css/user-center.css'></style>