index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <view class="container">
  3. <!-- 机构信息区域 -->
  4. <template v-if="isRequest">
  5. <view class="ws-header">
  6. <!-- 用户信息 -->
  7. <view class="user-info">
  8. <image class="user_default" v-if="!hasLogin && isRequest" :src="StaticUrl+'icon-default-avatar.png'" mode="widthFix"></image>
  9. <image class="user_default" v-else :src="UserInfo.headImgUrl" mode="widthFix"></image>
  10. <view class="user-login" v-if="!hasLogin && isRequest" @click="navigator('/pages/login/login')">登录</view>
  11. <view class="user-text" v-else>
  12. {{ UserInfo.userIdentity == 1 ? UserInfo.nickName : UserInfo.name }}
  13. </view>
  14. </view>
  15. <!-- 背景图 -->
  16. <image class="user-bg" :src="StaticUrl+'icon-user-bg@2x.png'" mode="widthFix"></image>
  17. </view>
  18. <!-- 机构信息END -->
  19. <!-- 订单状态区域 -->
  20. <view class="order-wrap">
  21. <view class="more">
  22. <text class="title">我的订单</text>
  23. <view @click="OrderNavigator(0)">
  24. <text class="more-right">全部订单</text>
  25. <text class="iconfont icon-chakangengduo"></text>
  26. </view>
  27. </view>
  28. <view class="line"></view>
  29. <!-- 菜单选项 -->
  30. <view class="order-nav">
  31. <view
  32. class="order-nav-item"
  33. @click="OrderNavigator(1)"
  34. >
  35. <image :src="StaticUrl+'icon-order-1@2x.png'" mode="widthFix"></image>
  36. <text>待付款</text>
  37. <view class="tui-badge tui-badge-box" v-if="hasLogin && paymentCount > 0">
  38. <tui-badge :scaleRatio="0.8" type="danger">{{
  39. paymentCount | countNum
  40. }}</tui-badge>
  41. </view>
  42. </view>
  43. <view
  44. class="order-nav-item"
  45. @click="OrderNavigator(2)"
  46. >
  47. <image :src="StaticUrl+'icon-order-2@2x.png'" mode="widthFix"></image>
  48. <text>待发货</text>
  49. <view class="tui-badge tui-badge-box" v-if="hasLogin && waitShipmentsCount > 0">
  50. <tui-badge :scaleRatio="0.8" type="danger">{{
  51. waitShipmentsCount | countNum
  52. }}</tui-badge>
  53. </view>
  54. </view>
  55. <view
  56. class="order-nav-item"
  57. @click="OrderNavigator(3)"
  58. >
  59. <image :src="StaticUrl+'icon-order-3@2x.png'" mode="widthFix"></image>
  60. <text>已发货</text>
  61. <view class="tui-badge tui-badge-box" v-if="hasLogin && shipmentsCount > 0">
  62. <tui-badge :scaleRatio="0.8" type="danger">{{
  63. shipmentsCount | countNum
  64. }}</tui-badge>
  65. </view>
  66. </view>
  67. <view
  68. class="order-nav-item"
  69. @click="OrderNavigator(3)"
  70. >
  71. <image :src="StaticUrl+'icon-order-4@2x.png'" mode="widthFix"></image>
  72. <text>退货/款</text>
  73. <view class="tui-badge tui-badge-box" v-if="hasLogin && salesReturnCount > 0">
  74. <tui-badge :scaleRatio="0.8" type="danger">{{
  75. salesReturnCount | countNum
  76. }}</tui-badge>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 订单状态区域END -->
  82. <!-- 菜单导航区域 -->
  83. <view class="place-menu-conten clearfix">
  84. <view class="place-menu-cell" @click="navigator('/pages/user/activity/activity-list')" v-if="UserInfo.userIdentity == 2">
  85. <view class="place-left">
  86. <image class="place-menu-icon" :src="StaticUrl+'icon-user-h@2x.png'" mode=""></image>
  87. <text class="place-menu-title">活动专区</text>
  88. </view>
  89. <text class="iconfont icon-chakangengduo"></text>
  90. </view>
  91. <view class="place-menu-cell" @click="navigator('/pages/user/address/address')">
  92. <view class="place-left">
  93. <image class="place-menu-icon" :src="StaticUrl+'icon-user-d@2x.png'" mode=""></image>
  94. <text class="place-menu-title">收货地址</text>
  95. </view>
  96. <text class="iconfont icon-chakangengduo"></text>
  97. </view>
  98. <button class="place-menu-cell last" open-type="contact" @bindcontact="handleContact">
  99. <view class="place-left">
  100. <image class="place-menu-icon" :src="StaticUrl+'icon-user-c@2x.png'" mode=""></image>
  101. <text class="place-menu-title">在线客服</text>
  102. </view>
  103. <text class="iconfont icon-chakangengduo"></text>
  104. </button>
  105. </view>
  106. <!-- 菜单导航区域END -->
  107. <!-- 底部 -->
  108. <view class="user-support" :class="UserInfo.userIdentity == 2 ? 'top' : ''">
  109. <image class="user-support-image" :src="StaticUrl+'icon-logo@1x.png'" mode=""></image>
  110. <view class="user-support-text">采美365网提供商品技术服务</view>
  111. </view>
  112. </template>
  113. </view>
  114. </template>
  115. <script>
  116. import nutBadge from '@/components/thorui/tui-badge/tui-badge.vue'
  117. import { mapState, mapMutations } from 'vuex'
  118. import authorize from '@/common/config/authorize.js'
  119. import wxLogin from '@/services/wxLogin.js'
  120. export default {
  121. components: {
  122. nutBadge
  123. },
  124. data() {
  125. return {
  126. StaticUrl:this.$Static,
  127. CustomBar: this.CustomBar, // 顶部导航栏高度
  128. UserInfo: {}, //用户信息
  129. isRequest: true,
  130. paymentCount: 0, //待付款角标
  131. waitShipmentsCount: 0, //待收货角标
  132. shipmentsCount: 0, //已发货角标
  133. salesReturnCount: 0, //退货/款角标
  134. userId:0
  135. }
  136. },
  137. onLoad() {
  138. },
  139. computed: {
  140. ...mapState(['hasLogin', 'userInfo', 'isWxAuthorize'])
  141. },
  142. filters: {
  143. countNum(value) {
  144. return value > 99 ? '99+' : value
  145. }
  146. },
  147. onPullDownRefresh() {
  148. //下拉刷新
  149. if (this.hasLogin) {
  150. this.GetUserInfo()
  151. setTimeout(()=>{
  152. uni.stopPullDownRefresh()
  153. },2000)
  154. }else{
  155. uni.stopPullDownRefresh()
  156. }
  157. },
  158. methods: {
  159. ...mapMutations(['login', 'logout']),
  160. GetUserInfo(){
  161. this.UserInfo = uni.getStorageSync('userInfo')
  162. this.$api.getStorage().then((resolve) => {
  163. this.userId = resolve.userId ? resolve.userId : '';
  164. this.GetUserInfoPersonal()
  165. })
  166. },
  167. //初始化个人中心数据
  168. GetUserInfoPersonal() {
  169. this.UserService.GetUserOrderTotal(
  170. {
  171. userId: this.userId
  172. }
  173. )
  174. .then(response => {
  175. const data = response.data
  176. this.paymentCount = data.paymentCount //待付款
  177. this.waitShipmentsCount = data.waitShipmentsCount //待收货
  178. this.shipmentsCount = data.shipmentsCount //已发货
  179. this.salesReturnCount = data.salesReturnCount //退货/款
  180. })
  181. .catch(error => {
  182. this.$util.msg(error.msg, 2000)
  183. })
  184. },
  185. handleContact(e) {//客服
  186. console.log(e.detail.path)
  187. console.log(e.detail.query)
  188. },
  189. OrderNavigator(state){// 栏目跳转
  190. if(this.hasLogin){
  191. if(this.UserInfo.userIdentity == 2){
  192. this.$api.navigateTo(`/pages/user/order/order-list-retail?state=${state}`)
  193. }else{
  194. this.$api.navigateTo(`/pages/user/order/order-list?state=${state}`)
  195. }
  196. }else{
  197. this.$api.navigateTo('/pages/login/login')
  198. }
  199. },
  200. navigator(url) {
  201. if(this.hasLogin){
  202. this.$api.navigateTo(url)
  203. }else{
  204. this.$api.navigateTo('/pages/login/login')
  205. }
  206. },
  207. },
  208. onShow() {
  209. if(this.hasLogin){
  210. this.GetUserInfo()
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss">
  216. @import '@/uni.scss';
  217. .container {
  218. box-sizing: border-box;
  219. background: #f7f7f7;
  220. }
  221. // 用户登录信息区域
  222. .ws-title {
  223. width: 100%;
  224. position: fixed;
  225. top: 0;
  226. left: 0;
  227. font-size: 34rpx;
  228. text-align: center;
  229. }
  230. .ws-header {
  231. position: relative;
  232. height: 280rpx;
  233. .user-info {
  234. position: absolute;
  235. z-index: 10;
  236. width: 750rpx;
  237. height: 280rpx;
  238. display: flex;
  239. flex-direction: column;
  240. align-items: center;
  241. justify-content: center;
  242. .user_default {
  243. display: block;
  244. width: 120rpx;
  245. height: 120rpx;
  246. border-radius: 50%;
  247. }
  248. }
  249. // 登录按钮
  250. .user-login {
  251. width: 184rpx;
  252. height: 56rpx;
  253. margin-top: 25rpx;
  254. border-radius: 28rpx;
  255. background: #ffffff;
  256. line-height: 56rpx;
  257. text-align: center;
  258. color: $color-system;
  259. font-size: $font-size-28;
  260. }
  261. // 公司名
  262. .user-text {
  263. width: 446rpx;
  264. margin-top: 25rpx;
  265. color: #fff;
  266. font-size: 28rpx;
  267. line-height: 40rpx;
  268. text-align: center;
  269. white-space: nowrap;
  270. overflow: hidden;
  271. text-overflow: ellipsis;
  272. }
  273. .user-bg {
  274. width: 100%;
  275. }
  276. }
  277. .more {
  278. width: 750rpx;
  279. display: flex;
  280. justify-content: space-between;
  281. align-items: center;
  282. padding: 23rpx 25rpx;
  283. box-sizing: border-box;
  284. background: #fff;
  285. .more-right {
  286. font-size: 26rpx;
  287. line-height: 37rpx;
  288. margin-right: 10rpx;
  289. }
  290. .title {
  291. font-size: 32rpx;
  292. line-height: 45rpx;
  293. color: #333333;
  294. }
  295. .iconfont {
  296. font-size: 20rpx;
  297. vertical-align: middle;
  298. }
  299. }
  300. .order-wrap {
  301. background: #fff;
  302. .line {
  303. width: 702rpx;
  304. height: 1px;
  305. margin: 0 auto;
  306. background: #f0f0f0;
  307. }
  308. .order-nav {
  309. display: flex;
  310. justify-content: space-evenly;
  311. align-items: center;
  312. padding: 40rpx 0;
  313. .order-nav-item {
  314. position: relative;
  315. display: flex;
  316. align-items: center;
  317. flex-direction: column;
  318. image {
  319. width: 64rpx;
  320. height: 64rpx;
  321. }
  322. text {
  323. font-size: 26rpx;
  324. line-height: 37rpx;
  325. margin-top: 8rpx;
  326. }
  327. .tui-badge {
  328. position: absolute;
  329. top: -15rpx;
  330. right: -25rpx;
  331. z-index: 999;
  332. }
  333. }
  334. }
  335. }
  336. .place-menu-conten{
  337. margin-top: 20rpx;
  338. width: 100%;
  339. height: auto;
  340. box-sizing: border-box;
  341. padding: 0 24rpx;
  342. background-color: #FFFFFF;
  343. .place-menu-cell{
  344. width: 100%;
  345. height: 110rpx;
  346. box-sizing: border-box;
  347. padding: 36rpx 0;
  348. text-align: left;
  349. float: left;
  350. border-bottom: 1px solid #E1E1E1;
  351. position: relative;
  352. &.last{
  353. border-bottom: none;
  354. }
  355. .place-left{
  356. width: 600rpx;
  357. height: 100%;
  358. .place-menu-icon{
  359. width: 36rpx;
  360. height: 36rpx;
  361. display: block;
  362. float: left;
  363. }
  364. .place-menu-title{
  365. width: 540rpx;
  366. margin-left: 16rpx;
  367. float: left;
  368. height: 36rpx;
  369. line-height: 36rpx;
  370. font-size: $font-size-28;
  371. color: #333333;
  372. }
  373. }
  374. .iconfont{
  375. width: 36rpx;
  376. height: 36rpx;
  377. display: block;
  378. line-height: 36rpx;
  379. text-align: center;
  380. font-size: $font-size-30;
  381. color: #cccccc;
  382. position: absolute;
  383. right: 0;
  384. top: 36rpx;
  385. }
  386. }
  387. }
  388. .user-support{
  389. width: 100%;
  390. float: left;
  391. margin-top: 340rpx;
  392. display: flex;
  393. flex-direction: column;
  394. align-items: center;
  395. justify-content: center;
  396. &.top{
  397. margin-top: 240rpx;
  398. }
  399. .user-support-image{
  400. width: 54rpx;
  401. height: 46rpx;
  402. display: block;
  403. margin-bottom: 5rpx;
  404. }
  405. .user-support-text{
  406. font-size: 20rpx;
  407. line-height: 30rpx;
  408. color: #cccccc;
  409. }
  410. }
  411. </style>