center.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <view class="page-bg">
  5. <img class="img" :src="staticUrl+'/img/center-index-bg.png'" alt="">
  6. </view>
  7. <view class="base-info page-wrap u-flex u-row-between">
  8. <view class="left u-flex">
  9. <u-avatar :src="avatar||staticUrl+'/img/avatar.png'" size="110rpx"></u-avatar>
  10. <view class="info">
  11. <view class="name ellipsis-1">{{vuex_member_info.name}}</view>
  12. <view class="level u-flex">
  13. <u-icon :name="staticUrl+'/img/level-01.png'" color="#333333" size="30rpx"></u-icon>
  14. <text class="level-name">{{vuex_member_info.levelName}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <u-icon @click="$u.route('/center/memberinfo',{type:'redirectTo'})" name="setting-fill" color="#333333" size="38rpx"></u-icon>
  19. </view>
  20. <view class="property page-wrap u-flex u-row-between">
  21. <view class="property-item" @click="$u.route('/center/paycode')">
  22. <view class="up">
  23. <u-icon :name="staticUrl+'/img/paycode.png'" color="#333333" size="42rpx"></u-icon>
  24. </view>
  25. <view class="down">会员码</view>
  26. </view>
  27. <view class="property-item" @click="$u.route('/center/mybalance')">
  28. <view class="up">{{memberInfo.balance}}</view>
  29. <view class="down">余额</view>
  30. </view>
  31. <view class="property-item" @click="$u.route('/credits/creditslist')">
  32. <view class="up">{{memberInfo.credit}}</view>
  33. <view class="down">积分</view>
  34. </view>
  35. <view class="property-item">
  36. <view class="up">{{memberInfo.couponNum}}</view>
  37. <view class="down">优惠券</view>
  38. </view>
  39. </view>
  40. <view class="order-state">
  41. <view class="title">我的订单</view>
  42. <view class="u-flex u-row-between">
  43. <view class="state" @click="orderClick(item,index)" v-for="(item,index) in orderState" :key="index">
  44. <view class="up">
  45. <u-icon :name="item.ico" color="#333333" size="60rpx"></u-icon>
  46. <u-badge v-if="item.badge" type="error" max="99" :value="orderBadge[item.badge]" :absolute="true" :offset="[0,0]"></u-badge>
  47. </view>
  48. <view class="down">{{item.name}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="tools page-wrap">
  53. <view class="title">常用工具</view>
  54. <view class="u-flex u-row-left">
  55. <view class="tool-item"
  56. v-for="(item,index) in tools"
  57. @click="toolsClick(item)"
  58. :key="index">
  59. <view class="up">
  60. <u-icon :name="item.ico" color="#333333" size="60rpx"></u-icon>
  61. </view>
  62. <view class="down">{{item.name}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- <u-overlay :show="showPayCode" @click="showPayCode = false">
  67. <view class="pay-code-warp u-flex u-row-center">
  68. <view class="rect" @tap.stop>
  69. <u--image :showLoading="true" :src="payCodeImg" width="180px" height="180px"></u--image>
  70. </view>
  71. </view>
  72. </u-overlay> -->
  73. <tabbar :tabbarIndexProps="3" />
  74. </view>
  75. </template>
  76. <script>
  77. import { systemInfo } from "@/mixin.js";
  78. import tabbar from "../components/tabbar.vue"
  79. export default {
  80. components:{
  81. tabbar
  82. },
  83. mixins:[systemInfo],
  84. data() {
  85. return {
  86. staticUrl:this.$commonConfig.staticUrl,
  87. avatar:this.$commonConfig.staticUrl+'/img/avatar.png',
  88. showPayCode:false,
  89. payCodeImg:'https://cdn.uviewui.com/uview/album/1.jpg',
  90. memberInfo:{},
  91. orderState:[
  92. {name:'全部订单',status:'',ico:this.$commonConfig.staticUrl+'/img/orderstateico-all.png'},
  93. {name:'待付款',status:'0',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
  94. // {name:'待发货',status:'1',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
  95. {name:'待收货',status:'2',ico:this.$commonConfig.staticUrl+'/img/orderstateico-02.png',badge:'collectNum'},
  96. {name:'待评价',status:'3',ico:this.$commonConfig.staticUrl+'/img/orderstateico-03.png',badge:'commentNum'},
  97. {name:'退款/售后',status:'7',ico:this.$commonConfig.staticUrl+'/img/orderstateico-04.png',badge:'refundNum'},
  98. ],
  99. orderBadge:{
  100. noPayNum:'0',
  101. deliverNum:'0',
  102. collectNum:'0',
  103. commentNum:'0',
  104. refundNum:'0',
  105. },
  106. tools:[
  107. // {name:'充值中心',url:'/center/recharge',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
  108. {name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
  109. {name:'客服电话',phone:'',ico:this.$commonConfig.staticUrl+'/img/tool-phone.png'},
  110. ]
  111. }
  112. },
  113. onShow() {
  114. this.getMemberInfo();
  115. this.statisticsOrder();
  116. },
  117. onLoad() {
  118. this.getSystemInfo();
  119. },
  120. methods: {
  121. getMemberInfo(){
  122. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  123. this.memberInfo = res.data;
  124. this.avatar = res.data.avatar;
  125. this.$u.vuex('vuex_member_info', res.data);
  126. // console.log('memberInfo',this.memberInfo);
  127. }).catch(err=>{
  128. console.log('memberInfo',err.data);
  129. })
  130. },
  131. toolsClick(item){
  132. let that = this;
  133. console.log('item',item);
  134. if ('phone' in item) {
  135. if(!that.memberInfo.customerMobile){
  136. uni.showToast({
  137. title:'电话号码为空',
  138. icon:"none"
  139. })
  140. return
  141. }
  142. uni.makePhoneCall({
  143. phoneNumber: that.memberInfo.customerMobile,
  144. success() {
  145. console.log('success');
  146. },
  147. fail() {
  148. console.log('fail');
  149. }
  150. });
  151. return
  152. }
  153. uni.$u.route(item.url);
  154. },
  155. orderClick(item,index){
  156. console.log('item',item);
  157. uni.$u.route('/shopping/order', {
  158. // current: index,
  159. status: item.status,
  160. type: 'redirectTo'
  161. });
  162. },
  163. statisticsOrder(){
  164. this.$u.api.statisticsOrder().then(res=>{
  165. let data = res.data || {};
  166. this.orderBadge = Object.assign(this.orderBadge,data)
  167. // console.log('statisticsOrder',res.data);
  168. // console.log('this.orderBadge',this.orderBadge);
  169. }).catch(err=>{
  170. console.log('memberInfo',err.data);
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style>
  177. page{
  178. background-color: #F5F5F5;
  179. padding-top: 0;
  180. }
  181. </style>
  182. <style lang="scss" scoped>
  183. .title{
  184. font-size: 32rpx;
  185. font-weight: 600;
  186. color: #333333;
  187. line-height: 45rpx;
  188. margin-bottom: 30rpx;
  189. }
  190. .base-info{
  191. margin-bottom: 10rpx;
  192. .info{
  193. margin-left: 30rpx;
  194. .name{
  195. font-size: 40rpx;
  196. font-weight: 600;
  197. color: #333333;
  198. line-height: 56rpx;
  199. margin-bottom: 10rpx;
  200. }
  201. .level{
  202. width: fit-content;
  203. background: linear-gradient(131deg, #FFF2DB 0%, #FFD9A5 100%);
  204. border-radius: 2px;
  205. font-size: 22rpx;
  206. font-weight: 400;
  207. color: #333333;
  208. line-height: 30rpx;
  209. padding: 6rpx 16rpx;
  210. .level-name{
  211. margin-left: 10rpx;
  212. }
  213. }
  214. }
  215. }
  216. .property{
  217. text-align: center;
  218. .up{
  219. font-size: 32rpx;
  220. font-weight: 600;
  221. color: #333333;
  222. line-height: 45rpx;
  223. /deep/ .u-icon{
  224. display: block;
  225. }
  226. }
  227. .down{
  228. font-size: 26rpx;
  229. font-weight: 400;
  230. color: #666666;
  231. line-height: 37rpx;
  232. }
  233. }
  234. .order-state{
  235. .title{margin-bottom: 30rpx;}
  236. background-color: #fff;
  237. padding: 30rpx;
  238. margin: 0 20rpx 50rpx;
  239. .state{
  240. text-align: center;
  241. /deep/ .u-icon{
  242. display: block;
  243. }
  244. .up{
  245. position: relative;
  246. }
  247. .down{
  248. font-size: 24rpx;
  249. font-weight: 400;
  250. color: #666666;
  251. line-height: 31rpx;
  252. }
  253. }
  254. }
  255. .tools{
  256. .tool-item{
  257. margin-left: 40rpx;
  258. text-align: center;
  259. /deep/ .u-icon{
  260. display: block;
  261. }
  262. .down{
  263. font-size: 24rpx;
  264. font-weight: 400;
  265. color: #666666;
  266. line-height: 31rpx;
  267. }
  268. }
  269. }
  270. .pay-code-warp{
  271. height: 100vh;
  272. }
  273. </style>