index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="clear">
  3. <!-- #ifndef H5 -->
  4. <navbar :iSimmersive="true" :isPrev="false" :placeholder="false"></navbar>
  5. <!-- #endif -->
  6. <view class="header">
  7. <view class="header-warp">
  8. <view class="info">
  9. <view class="avatar">
  10. <image v-if="avatar" :src="avatar"></image>
  11. <image v-if="avatar==''" :src="static+'avatar.png'"></image>
  12. </view>
  13. <view @click="login">{{username||"点击登录"}}</view>
  14. </view>
  15. <view class="amount">
  16. <view @click="jump('ucenter/wallet')">
  17. <text>¥{{amount||"0.00"}}</text>
  18. <text>我的余额</text>
  19. </view>
  20. <view @click="jump('ucenter/coupon')">
  21. <text>{{coupon||0}}</text>
  22. <text>优惠券</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="content">
  28. <view class="content-box">
  29. <view class="title">我的订单</view>
  30. <view class="list-box">
  31. <view class="box" @click="jump('order/list',{ id: 1 })">
  32. <view>
  33. <text class="iconfont ucenter-icon">&#xe625;</text>
  34. <text class="num" v-if="order_count.a">{{order_count.a}}</text>
  35. </view>
  36. <view>待付款</view>
  37. </view>
  38. <view class="box" @click="jump('order/list',{ id: 2 })">
  39. <view>
  40. <text class="iconfont ucenter-icon">&#xe624;</text>
  41. <text class="num" v-if="order_count.b">{{order_count.b}}</text>
  42. </view>
  43. <view>待发货</view>
  44. </view>
  45. <view class="box" @click="jump('order/list',{ id: 3 })">
  46. <view>
  47. <text class="iconfont ucenter-icon">&#xe61d;</text>
  48. <text class="num" v-if="order_count.c">{{order_count.c}}</text>
  49. </view>
  50. <view>待收货</view>
  51. </view>
  52. <view class="box" @click="jump('order/list',{ id: 4 })">
  53. <view>
  54. <text class="iconfont ucenter-icon">&#xe622;</text>
  55. <text class="num" v-if="order_count.d">{{order_count.d}}</text>
  56. </view>
  57. <view>待评价</view>
  58. </view>
  59. <view class="box" @click="jump('order/service')">
  60. <view><text class="iconfont ucenter-icon">&#xe627;</text></view>
  61. <view>退换货</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="content-box">
  66. <view class="title">我的服务</view>
  67. <view class="list-box service-box">
  68. <view class="box" @click="jump('ucenter/wallet')">
  69. <view><text class="iconfont ucenter-icon">&#xe625;</text></view>
  70. <view>我的钱包</view>
  71. </view>
  72. <view class="box" @click="jump('ucenter/collect')">
  73. <view><text class="iconfont ucenter-icon">&#xe621;</text></view>
  74. <view>我的收藏</view>
  75. </view>
  76. <view class="box" @click="jump('ucenter/address')">
  77. <view><text class="iconfont ucenter-icon">&#xe61e;</text></view>
  78. <view>收货地址</view>
  79. </view>
  80. <view class="box" @click="jump('ucenter/coupon')">
  81. <view><text class="iconfont ucenter-icon">&#xe60b;</text></view>
  82. <view>优惠券</view>
  83. </view>
  84. <view class="box" @click="jump('ucenter/point')">
  85. <view><text class="iconfont ucenter-icon">&#xe620;</text></view>
  86. <view>我的积分</view>
  87. </view>
  88. <view class="box" @click="jump('ucenter/setting')">
  89. <view><text class="iconfont ucenter-icon">&#xe626;</text></view>
  90. <view>会员设置</view>
  91. </view>
  92. <view class="box" @click="jump('ucenter/help')">
  93. <view><text class="iconfont ucenter-icon">&#xe628;</text></view>
  94. <view>帮助中心</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="copyright-logo"><image src="/static/images/logo.png"></image></view>
  100. <authorize v-model="isAuthShow"></authorize>
  101. </view>
  102. </template>
  103. <script>
  104. import authorize from "@/components/authorize/authorize";
  105. export default {
  106. components: {
  107. authorize
  108. },
  109. data() {
  110. return {
  111. isShop: 0,
  112. isAuthShow: false,
  113. static: '',
  114. username:'',
  115. amount:0.00,
  116. coupon:0,
  117. avatar: "",
  118. order_count: {}
  119. };
  120. },
  121. onLoad() {
  122. this.static = this.$static;
  123. },
  124. onShow() {
  125. this.$store.dispatch("usersStatus").then(()=>{
  126. this.isAuthShow = false;
  127. let users = this.$storage.getJson("users");
  128. this.username = users.nickname || users.username || users.mobile;
  129. this.amount = users.amount;
  130. this.coupon = users.coupon_count;
  131. this.avatar = users.avatar;
  132. this.$http.getUcenter().then((res)=>{
  133. if(res.status){
  134. this.username = res.data.nickname || res.data.username || res.data.mobile;
  135. this.amount = users.amount = res.data.amount;
  136. this.coupon = users.coupon_count = res.data.coupon_count;
  137. this.avatar = users.avatar = res.data.avatar;
  138. this.isShop = users.shop = res.data.shop;
  139. this.order_count = res.data.order_count;
  140. this.$store.commit("UPDATEUSERS",users);
  141. }
  142. });
  143. }).catch(()=>{
  144. this.isAuthShow = true;
  145. });
  146. },
  147. methods: {
  148. login(){
  149. this.$store.dispatch("usersStatus").then(()=>{
  150. this.isAuthShow = false;
  151. }).catch(()=>{
  152. this.isAuthShow = true;
  153. });
  154. },
  155. jump(value,param){
  156. let params = param || "";
  157. this.$store.dispatch("usersStatus").then(()=>{
  158. this.isAuthShow = false;
  159. if(params == ""){
  160. this.$utils.navigateTo(value);
  161. }else{
  162. this.$utils.navigateTo(value,params);
  163. }
  164. }).catch(()=>{
  165. this.isAuthShow = true;
  166. });
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .header{
  173. width: 100%;
  174. height: 560rpx;
  175. position: relative;
  176. z-index: 1;
  177. background-image: url(~@/static/images/my.png);
  178. background-repeat: no-repeat;
  179. background-size: 100%;
  180. .header-warp {
  181. position: absolute;
  182. top:10rpx;
  183. /* #ifdef APP-PLUS */
  184. top:40rpx;
  185. /* #endif */
  186. left: 0;
  187. width: 100%;
  188. height: 510rpx;
  189. z-index: 2; }
  190. .info{
  191. position: absolute;
  192. top: 70rpx;
  193. left: 40rpx;
  194. view {
  195. float: left;
  196. image { width: 140rpx; height: 140rpx; display: block; border-radius: 50%; }
  197. &:last-child {
  198. height: 140rpx; line-height: 140rpx; padding-left: 24rpx; font-size: 36rpx; color: #fff;
  199. }
  200. }
  201. }
  202. .amount{
  203. position: absolute;
  204. top: 230rpx;
  205. width: 100%;
  206. view {
  207. width: 50%; float: left;
  208. text { display: block; color: #fff; text-align: center }
  209. text:first-child { font-size: 34rpx; }
  210. text:last-child { font-size: 26rpx; padding-top: 10rpx; }
  211. }
  212. }
  213. }
  214. .content {
  215. margin: -160rpx 40rpx 0 40rpx;
  216. position: relative; z-index: 100;
  217. .content-box{
  218. width: 100%;
  219. float: left;
  220. border-radius: 10rpx;
  221. background-color: #fff;
  222. &:last-child { margin-top: 30rpx; margin-bottom: 30rpx; }
  223. .title{
  224. font-size: 32rpx;
  225. color: #666;
  226. width: 100%;
  227. float: left;
  228. border-bottom: 2rpx solid #ebebeb;
  229. height: 100rpx;
  230. line-height: 100rpx;
  231. text-indent: 30rpx;
  232. }
  233. .list-box{
  234. width: 100%;
  235. display: flex;
  236. flex-wrap: wrap;
  237. flex-direction: row;
  238. .box{
  239. width: 20%;
  240. padding: 20rpx 0;
  241. view {
  242. display: block; text-align: center; font-size: 26rpx; color: #666;
  243. &:first-child {
  244. position: relative;
  245. .num {
  246. position: absolute;
  247. top: 10rpx;
  248. right: 38rpx;
  249. box-sizing: border-box;
  250. min-width: 32rpx;
  251. padding: 0 6rpx;
  252. color: #fff;
  253. font-weight: 500;
  254. font-size: 24rpx;
  255. line-height: 28rpx;
  256. text-align: center;
  257. background-color: #ee0a24;
  258. border: 1px solid #fff;
  259. border-radius: 32rpx;
  260. transform: translate(50%,-50%);
  261. transform-origin: 100%;
  262. }
  263. }
  264. }
  265. .ucenter-icon {
  266. font-size: 50rpx;
  267. }
  268. }
  269. }
  270. .service-box{
  271. .box{
  272. width: 25%;
  273. padding: 20rpx 0;
  274. view { display: block; text-align: center; font-size: 26rpx; color: #666; }
  275. }
  276. }
  277. }
  278. }
  279. .copyright-logo {
  280. image {
  281. width: 150rpx; height: 50rpx; margin: 54rpx auto; display: block;
  282. }
  283. }
  284. </style>