my-userinfo.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="home-page">
  3. <view class="head">
  4. <image src="/static/home/BG.jpg" class="bgImg"></image>
  5. <view class="top-info">
  6. <view class="avatar">
  7. <image :src="getAvatarUrl()"></image>
  8. </view>
  9. <view class="user-info" style="transform: translateX(-20%)">
  10. <view class="username">{{ getUserName() }}</view>
  11. <view class="vip-info">4月会员特权已到期,去续费</view>
  12. </view>
  13. <view class="setting" @click="navigateToSettingPage">
  14. <!-- <image src="/static/setting.png"></image>-->
  15. <van-icon name="setting-o" size="25"></van-icon>
  16. </view>
  17. </view>
  18. <view class="first-panel">
  19. <view class="panel-item">
  20. <van-icon name="star-o" size="25"></van-icon>
  21. <text>收藏</text>
  22. </view>
  23. <view class="panel-item">
  24. <van-icon name="balance-o" size="25"></van-icon>
  25. <text>红包</text>
  26. </view>
  27. <view class="panel-item">
  28. <van-icon name="paid" size="25"></van-icon>
  29. <text>卡券</text>
  30. </view>
  31. <view class="panel-item">
  32. <van-icon name="cash-o" size="25"></van-icon>
  33. <text>余额</text>
  34. </view>
  35. </view>
  36. </view>
  37. \ <view class="panel-list" style="margin-top: 20px ;transform: translateY(68%)">
  38. <!-- 第2个面板 -->
  39. <view class="panel">
  40. <view class="panel-title" style="font-family: 'Montserrat', sans-serif;font-weight: bolder">我的订单</view>
  41. <view class="panel-body">
  42. <view class="panel-item" @click="toOrders(StaticState().ORDER.ALL)">
  43. <van-icon name="gold-coin-o" size="28"/>
  44. <text>代付款</text>
  45. </view><view class="panel-item" @click="toOrders(StaticState().ORDER.UNRECEIVE)">
  46. <van-icon name="gift-card-o" class="icon" size="30"/>
  47. <text>代收货</text>
  48. </view><view class="panel-item" @click="toOrders(StaticState().ORDER.REFUND)">
  49. <van-icon name="cash-back-record-o" class="icon" size="29"/>
  50. <text>退款/退货</text>
  51. </view><view class="panel-item" @click="toOrders(StaticState().ORDER.UNCOMMENT)">
  52. <van-icon name="records-o" class="icon" size="26"/>
  53. <text>待评价</text>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 第3个面板 -->
  58. <view class="panel">
  59. <view class="panel-list-item">
  60. <text>收货地址</text>
  61. <van-icon type="arrowright" size="15"></van-icon>
  62. </view>
  63. <view class="panel-list-item">
  64. <text>联系客服</text>
  65. <van-icon type="arrowright" size="15"></van-icon>
  66. </view>
  67. <view class="panel-list-item" @click="logout">
  68. <text>退出登录</text>
  69. <van-icon type="arrowright" size="15"></van-icon>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {mapState,mapMutations,mapGetters} from 'vuex'
  77. import {StaticState} from "@/store/StaticState";
  78. export default {
  79. name: "my-userinfo",
  80. data() {
  81. return {
  82. };
  83. },
  84. computed: {
  85. },
  86. methods: {
  87. StaticState,
  88. navigateToSettingPage() {
  89. uni.navigateTo({
  90. url: '/subpkg/setting/setting'
  91. })
  92. },
  93. ...mapGetters('m_user', ['getUserName','getAvatarUrl']),
  94. ...mapMutations('m_user', ['updateUserInfo','updateToken']),
  95. test() {
  96. console.log(1, "test");
  97. },
  98. beforeMount() {
  99. console.log(1, "beforeMount");
  100. },
  101. toOrders(pagetype) {
  102. // console.log('----------------------')
  103. // console.log(this.StaticState)
  104. // console.log(this.StaticState.ORDER)
  105. // console.log('toLogin')
  106. let self =this
  107. console.log(pagetype,"这是我传参的参数")
  108. uni.navigateTo({
  109. url: '/subpkg/order/order?pagetype=' + pagetype ,// 跳转至 subpkg 中的 selShop 页面
  110. success() {
  111. console.log('url跳转成功')
  112. setTimeout(() => {
  113. }, 500); // 延迟 1000 毫秒(即 1 秒)后调用 getToken() 函数
  114. },
  115. fail() {
  116. console.log('url跳转失败')
  117. }
  118. });
  119. },
  120. logout() {
  121. uni.showModal({
  122. title: '提示',
  123. content: '是否要退出登录',
  124. success: (res) => {
  125. if (res.confirm) {
  126. uni.removeStorageSync('token');
  127. this.updateToken('')
  128. //下一帧执行
  129. uni.reLaunch({
  130. url: '/pages/home/home'
  131. })
  132. }
  133. }
  134. })
  135. }
  136. }
  137. };
  138. </script>
  139. <style lang="scss">
  140. .bgImg{
  141. position: absolute;
  142. width: 100%;
  143. //left: 2.5%;
  144. //top: 1%;
  145. }
  146. .panel-list{
  147. padding: 0 10px;
  148. position: relative;
  149. top: -10px;
  150. .panel{
  151. background-color: white;
  152. border-radius: 10px;
  153. margin-bottom: 8px;
  154. .panel-title{
  155. line-height: 40px;
  156. padding-left: 10px;
  157. font-size: 15px;
  158. border-bottom: 1px solid #f4f4f4;
  159. }
  160. .panel-body{
  161. display: flex;
  162. justify-content: space-around;
  163. .panel-item{
  164. display: flex;
  165. flex-direction: column;
  166. align-items: center;
  167. justify-content: space-around;
  168. padding: 10px 0;
  169. font-size: 13px;
  170. .icon{
  171. width: 35px;
  172. height: 35px;
  173. }
  174. }
  175. }
  176. }
  177. //.panel:nth-child(1){
  178. // margin-top: 10px;
  179. // border-radius: 10px;
  180. //}
  181. }
  182. .panel-list-item{
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. font-size: 15px;
  187. padding: 0 10px;
  188. line-height: 45px;
  189. }
  190. .home-page {
  191. .head {
  192. position: relative;
  193. .bgImg {
  194. top: 0;
  195. width: 100%;
  196. height: 400rpx;
  197. }
  198. .top-info {
  199. position: absolute;
  200. top: 60rpx;
  201. left: 30rpx;
  202. right: 30rpx;
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. .avatar {
  207. image {
  208. width: 120rpx;
  209. height: 120rpx;
  210. border-radius: 50%;
  211. }
  212. }
  213. .user-info {
  214. .username {
  215. font-size: 36rpx;
  216. font-weight: bold;
  217. }
  218. .vip-info {
  219. font-size: 24rpx;
  220. color: #999;
  221. }
  222. }
  223. .setting {
  224. image {
  225. width: 50rpx;
  226. height: 50rpx;
  227. }
  228. }
  229. }
  230. .first-panel {
  231. position: absolute;
  232. bottom: -350rpx;
  233. left: 50%;
  234. transform: translateX(-50%);
  235. //transform: translateY(50%);
  236. display: flex;
  237. justify-content: space-around;
  238. width: 95%;
  239. background-color: #fff;
  240. border-radius: 20rpx;
  241. padding: 20rpx 0;
  242. box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
  243. .panel-item {
  244. display: flex;
  245. flex-direction: column;
  246. align-items: center;
  247. font-size: 24rpx;
  248. image {
  249. width: 50rpx;
  250. height: 50rpx;
  251. }
  252. text {
  253. margin-top: 10rpx;
  254. }
  255. }
  256. }
  257. }
  258. }
  259. </style>