center.vue 7.6 KB

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