index1111.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view>
  3. <view class='user'>
  4. <view class='header bg-color acea-row row-between-wrapper'>
  5. <view class='picTxt acea-row row-between-wrapper'>
  6. <view class='pictrue' @click='goPages("/pages/users/user_info/index")'>
  7. <image :src='userInfo.avatar' v-if="userInfo.avatar"></image>
  8. <image src='../../static/images/f.png' v-else></image>
  9. </view>
  10. <view class='text'>
  11. <view class='acea-row row-middle'>
  12. <view class='name line1' @click='goPages("/pages/users/user_info/index")'>{{userInfo.uid ? userInfo.nickname : '请点击授权'}}</view>
  13. <view class='member acea-row row-middle' v-if="userInfo.vip" @click='goPages("/pages/user_vip/index")'>
  14. <image :src='userInfo.vip_icon'></image>{{userInfo.vip_name}}</view>
  15. </view>
  16. <view class='id' @click='goPages("/pages/users/user_info/index")' v-if="userInfo.phone">ID:{{userInfo.uid || 0}}<text class='iconfont icon-bianji1'></text></view>
  17. <view v-else @click='goPages("/pages/users/user_phone/index")'><text class="binding">绑定手机号</text></view>
  18. </view>
  19. </view>
  20. <!-- #ifdef MP-->
  21. <text class='iconfont icon-shezhi' @click='Setting'></text>
  22. <!-- #endif -->
  23. <!-- #ifndef MP -->
  24. <navigator url="/pages/users/user_info/index" class='iconfont icon-shezhi'></navigator>
  25. <!-- #endif -->
  26. </view>
  27. <view class='wrapper'>
  28. <view class='nav acea-row row-middle'>
  29. <view class='item' @click='goPages("/pages/users/user_money/index")'>
  30. <view>我的余额</view>
  31. <view class='num'>{{userInfo.now_money || 0}}</view>
  32. </view>
  33. <view class='item' v-if="userInfo.is_promoter || userInfo.statu==2" @click='goPages("/pages/users/user_spread_user/index")'>
  34. <view>当前佣金</view>
  35. <view class='num'>{{userInfo.brokerage_price || 0}}</view>
  36. </view>
  37. <view class='item' v-else @click='goPages("/pages/users/user_integral/index")'>
  38. <view>当前积分</view>
  39. <view class='num'>{{userInfo.integral || 0}}</view>
  40. </view>
  41. <view class='item' @click='goPages("/pages/users/user_coupon/index")'>
  42. <view>优惠券</view>
  43. <view class='num'>{{userInfo.couponCount || 0}}</view>
  44. </view>
  45. </view>
  46. <view class='myOrder'>
  47. <view class='title acea-row row-between-wrapper'>
  48. <view>我的订单</view>
  49. <view class='allOrder' @click='goPages("/pages/users/order_list/index")'>全部订单<text class='iconfont icon-jiantou'></text></view>
  50. </view>
  51. <view class='orderState acea-row row-middle'>
  52. <view class='item' @click='goPages("/pages/users/order_list/index?status=0")'>
  53. <view class='pictrue'>
  54. <image src='../../static/images/dfk.png'></image>
  55. <text class="order-status-num" v-if="orderStatusNum.unpaid_count > 0">{{ orderStatusNum.unpaid_count }}</text>
  56. </view>
  57. <view>待付款</view>
  58. </view>
  59. <view class='item' @click='goPages("/pages/users/order_list/index?status=1")'>
  60. <view class='pictrue'>
  61. <image src='../../static/images/dfh.png'></image>
  62. <text class="order-status-num" v-if="orderStatusNum.unshipped_count > 0">{{ orderStatusNum.unshipped_count }}</text>
  63. </view>
  64. <view>待发货</view>
  65. </view>
  66. <view class='item' @click='goPages("/pages/users/order_list/index?status=2")'>
  67. <view class='pictrue'>
  68. <image src='../../static/images/dsh.png'></image>
  69. <text class="order-status-num" v-if="orderStatusNum.received_count > 0">{{ orderStatusNum.received_count }}</text>
  70. </view>
  71. <view>待收货</view>
  72. </view>
  73. <view class='item' @click='goPages("/pages/users/order_list/index?status=3")'>
  74. <view class='pictrue'>
  75. <image src='../../static/images/dpj.png'></image>
  76. <text class="order-status-num" v-if="orderStatusNum.evaluated_count > 0">{{ orderStatusNum.evaluated_count }}</text>
  77. </view>
  78. <view>待评价</view>
  79. </view>
  80. <view class='item' @click='goPages("/pages/users/user_return_list/index")'>
  81. <view class='pictrue'>
  82. <image src='../../static/images/sh.png'></image>
  83. <text class="order-status-num" v-if="orderStatusNum.refund_count > 0">{{ orderStatusNum.refund_count }}</text>
  84. </view>
  85. <view>售后/退款</view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class='myService'>
  90. <view class='title acea-row row-middle'>我的服务</view>
  91. <view class='serviceList acea-row row-middle'>
  92. <view class='item' v-for="(item,index) in MyMenus" :key="index" @click='goPages(item.url)' v-if="item.url!='#' && item.url!='/pages/admin/index' && item.url!='/pages/service/index'">
  93. <view class='pictrue'><image :src='item.pic'></image></view>
  94. <view>{{item.name}}</view>
  95. </view>
  96. <!-- #ifdef MP -->
  97. <button class='item' open-type='contact' hover-class='none'>
  98. <view class='pictrue'><image src='../../static/images/customer.png'></image></view>
  99. <view>联系客服</view>
  100. </button>
  101. <!-- #endif -->
  102. </view>
  103. </view>
  104. </view>
  105. <image src='../../static/images/support.png' class='support'></image>
  106. </view>
  107. <!-- #ifdef MP -->
  108. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse" ></authorize>
  109. <!-- #endif -->
  110. </view>
  111. </template>
  112. <script>
  113. import { getMenuList, getUserInfo} from '@/api/user.js';
  114. import { switchH5Login } from '@/api/api.js';
  115. import { toLogin } from '@/libs/login.js';
  116. import {mapGetters} from "vuex";
  117. // #ifdef MP
  118. import authorize from '@/components/Authorize';
  119. // #endif
  120. const app = getApp();
  121. export default {
  122. components: {
  123. // #ifdef MP
  124. authorize
  125. // #endif
  126. },
  127. data() {
  128. return {
  129. userInfo:{},
  130. MyMenus:[],
  131. isAuto: false, //没有授权的不会自动授权
  132. isShowAuth: false, //是否隐藏授权
  133. orderStatusNum:{}
  134. };
  135. },
  136. computed: mapGetters(['isLogin']),
  137. /**
  138. * 生命周期函数--监听页面加载
  139. */
  140. onLoad: function (options) {
  141. let that = this;
  142. that.$set(that,'MyMenus',app.globalData.MyMenus);
  143. // #ifdef H5 || APP-PLUS
  144. if (that.isLogin == false){
  145. toLogin();
  146. }
  147. // #endif
  148. },
  149. onShow:function(){
  150. let that = this;
  151. if (that.isLogin){
  152. this.getUserInfo();
  153. this.getMyMenus();
  154. }
  155. },
  156. methods: {
  157. onLoadFun(){
  158. this.getUserInfo();
  159. this.getMyMenus();
  160. },
  161. Setting: function () {
  162. uni.openSetting({
  163. success: function (res) {
  164. console.log(res.authSetting)
  165. }
  166. });
  167. },
  168. // 授权关闭
  169. authColse:function(e){
  170. this.isShowAuth = e
  171. },
  172. /**
  173. *
  174. * 获取个人中心图标
  175. */
  176. getMyMenus: function () {
  177. let that = this;
  178. if (this.MyMenus.length) return;
  179. getMenuList().then(res=>{
  180. that.$set(that,'MyMenus',res.data.routine_my_menus);
  181. });
  182. },
  183. /**
  184. * 获取个人用户信息
  185. */
  186. getUserInfo:function(){
  187. let that=this;
  188. getUserInfo().then(res=>{
  189. that.$set(that,'userInfo',res.data);
  190. that.$set(that,'orderStatusNum',res.data.orderStatusNum);
  191. });
  192. },
  193. // 添加字符串
  194. insertStr(soure, start, newStr){
  195. return soure.slice(0, start) + newStr + soure.slice(start);
  196. },
  197. /**
  198. * 页面跳转
  199. */
  200. goPages:function(url){
  201. // let data = url
  202. // let urls = this.insertStr(data,6,'/users')
  203. // console.log(urls,'urls')
  204. if(this.isLogin){
  205. if (url == '/pages/users/user_spread_user/index' && this.userInfo.statu==1) {
  206. if (!this.userInfo.is_promoter) return this.$util.Tips({ title: '您还没有推广权限!!' });
  207. }
  208. uni.navigateTo({
  209. url: url
  210. })
  211. }else{
  212. this.isAuto = true;
  213. this.$set(this,'isShowAuth',true);
  214. }
  215. },
  216. }
  217. }
  218. </script>
  219. <style scoped lang="scss">
  220. .user .header{padding:0 30rpx;height:190rpx;position:relative;}
  221. .user .header:after { position: absolute;left: 0;right: 0;bottom: -98rpx;z-index: -1;
  222. content:'';height:100rpx;width: 100%;border-radius: 0 0 50% 50%;background-color: #e93323;}
  223. .user .header .picTxt .pictrue{width:120rpx;height:120rpx;}
  224. .user .header .picTxt .pictrue image{width:100%;height:100%;border-radius:50%;border:2px solid #f5f5f5;}
  225. .user .header .picTxt .text{width:434rpx;color:rgba(255,255,255,1);margin-left:35rpx;}
  226. .user .header .picTxt .text .name{font-size:32rpx;max-width:270rpx;}
  227. .user .header .picTxt .text .member{padding:0 10rpx;height:36rpx;background-color:rgba(0, 0, 0, 0.2);font-size:20rpx;border-radius:30rpx;margin-left:17rpx;}
  228. .user .header .picTxt .text .member image{width:28rpx;height:28rpx;font-size:20rpx;margin-right:8rpx;}
  229. .user .header .picTxt .text .id{color:rgba(255,255,255,0.6);font-size:26rpx;margin-top:15rpx;}
  230. .user .header .picTxt .text .id .iconfont{font-size:30rpx;margin-left:12rpx;}
  231. .user .header .icon-shezhi{font-size:36rpx;color:#fff;margin-top:-52rpx;}
  232. .user .wrapper{padding:0 20rpx;}
  233. .user .wrapper .nav{background-color:#fff;border-radius:6rpx;height:140rpx;}
  234. .user .wrapper .nav .item{flex:1;text-align:center;font-size:26rpx;color:#aaa;}
  235. .user .wrapper .nav .item~.item{border-left:1px solid #eee;}
  236. .user .wrapper .nav .item .num{margin-top:10rpx;font-size:36rpx;color:#282828;}
  237. .user .wrapper .myOrder{background-color:#fff;border-radius:10rpx;margin-top:15rpx;}
  238. .user .wrapper .myOrder .title,.user .wrapper .myService .title{height:88rpx;padding:0 30rpx;border-bottom:1px dashed #ddd;font-size:30rpx;color:#282828;}
  239. .user .wrapper .myOrder .title .allOrder{font-size:26rpx;color:#666;}
  240. .user .wrapper .myOrder .title .allOrder .iconfont{font-size:30rpx;margin-left:7rpx;}
  241. .user .wrapper .myOrder .orderState{height:160rpx;}
  242. .user .wrapper .myOrder .orderState .item{font-size:26rpx;color:#454545;flex:1;text-align:center;}
  243. .user .wrapper .myOrder .orderState .item .pictrue{width:49rpx;height:42rpx;margin:0 auto 18rpx auto;position: relative;}
  244. .user .wrapper .myOrder .orderState .item .pictrue image{width:100%;height:100%;}
  245. .user .wrapper .myService{background-color:#fff;margin-top:15rpx;border-radius:10rpx;}
  246. .user .wrapper .myService .serviceList{padding:8rpx 0 27rpx 0;}
  247. .user .wrapper .myService .serviceList .item{width:25%;text-align:center;font-size:26rpx;color:#333;margin-top:30rpx;}
  248. .user .wrapper .myService .serviceList .item .pictrue{width:52rpx;height:52rpx;margin:0 auto 16rpx auto;}
  249. .user .wrapper .myService .serviceList .item .pictrue image{width:100%;height:100%;}
  250. .user .support{width:219rpx;height:74rpx;margin:54rpx auto;display:block;}
  251. .switchWindow{width:560rpx;border-radius:20rpx;background-color:#fff;position:fixed;top:50%;left:50%;margin-left:-280rpx;margin-top:-300rpx;z-index:99;padding:50rpx 30rpx 40rpx 30rpx;text-align:center;box-sizing:border-box;transition:all 0.3s ease-in-out 0s;opacity:0;transform: scale(0);}
  252. .switchWindow.on{opacity:1;transform: scale(1);}
  253. .switchWindow .pictrue{width:236rpx;height:236rpx;margin:0 auto;}
  254. .switchWindow .pictrue image{width:100%;height:100%;}
  255. .switchWindow .info{font-size:32rpx;color:#282828;margin-top:44rpx;font-weight:bold;}
  256. .switchWindow .switchBnt{font-size:32rpx;color:#fff;width:360rpx;height:82rpx;border-radius:41rpx;margin:57rpx auto 0 auto;background-image: linear-gradient(to right,#f67a38 0%,#f11b09 100%);line-height:82rpx;}
  257. .switchWindow .switchBnt.cancelBnt{background-color:#fff;color:#999;background-image:none;margin-top:10rpx;}
  258. .order-status-num {min-width: 24rpx;background-color: #fff;color: #ee5a52;border-radius: 15rpx;position: absolute;right: -5rpx;top: -16rpx;font-size: 23rpx;padding: 0 5rpx; border: 1rpx solid #ee5a52;}
  259. .user .binding{padding: 2rpx 18rpx; background-color: #ca1f10; border-radius: 50px;font-size: 22rpx;border: 1px solid #e8695e;color: #ffffff;}
  260. </style>