index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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.GetWxAuthorize()
  151. }else{
  152. uni.stopPullDownRefresh()
  153. }
  154. },
  155. methods: {
  156. ...mapMutations(['login', 'logout']),
  157. GetUserInfo(){
  158. this.UserInfo = uni.getStorageSync('userInfo')
  159. this.$api.getStorage().then((resolve) => {
  160. this.userId = resolve.userId ? resolve.userId : '';
  161. this.GetUserInfoPersonal()
  162. })
  163. },
  164. //初始化个人中心数据
  165. GetUserInfoPersonal() {
  166. this.UserService.GetUserOrderTotal(
  167. {
  168. userId: this.userId
  169. }
  170. )
  171. .then(response => {
  172. const data = response.data
  173. this.paymentCount = data.paymentCount //待付款
  174. this.waitShipmentsCount = data.waitShipmentsCount //待收货
  175. this.shipmentsCount = data.shipmentsCount //已发货
  176. this.salesReturnCount = data.salesReturnCount //退货/款
  177. })
  178. .catch(error => {
  179. this.$util.msg(error.msg, 2000)
  180. })
  181. },
  182. handleContact(e) {//客服
  183. console.log(e.detail.path)
  184. console.log(e.detail.query)
  185. },
  186. OrderNavigator(state){// 栏目跳转
  187. if(this.hasLogin){
  188. if(this.UserInfo.userIdentity == 2){
  189. this.$api.navigateTo(`/pages/user/order/order-list-retail?state=${state}`)
  190. }else{
  191. this.$api.navigateTo(`/pages/user/order/order-list?state=${state}`)
  192. }
  193. }else{
  194. this.$api.navigateTo('/pages/login/login')
  195. }
  196. },
  197. navigator(url) {
  198. if(this.hasLogin){
  199. this.$api.navigateTo(url)
  200. }else{
  201. this.$api.navigateTo('/pages/login/login')
  202. }
  203. },
  204. },
  205. onShow() {
  206. if(this.hasLogin){
  207. this.GetUserInfo()
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss">
  213. @import '@/uni.scss';
  214. .container {
  215. box-sizing: border-box;
  216. background: #f7f7f7;
  217. }
  218. // 用户登录信息区域
  219. .ws-title {
  220. width: 100%;
  221. position: fixed;
  222. top: 0;
  223. left: 0;
  224. font-size: 34rpx;
  225. text-align: center;
  226. }
  227. .ws-header {
  228. position: relative;
  229. height: 280rpx;
  230. .user-info {
  231. position: absolute;
  232. z-index: 10;
  233. width: 750rpx;
  234. height: 280rpx;
  235. display: flex;
  236. flex-direction: column;
  237. align-items: center;
  238. justify-content: center;
  239. .user_default {
  240. display: block;
  241. width: 120rpx;
  242. height: 120rpx;
  243. border-radius: 50%;
  244. }
  245. }
  246. // 登录按钮
  247. .user-login {
  248. width: 184rpx;
  249. height: 56rpx;
  250. margin-top: 25rpx;
  251. border-radius: 28rpx;
  252. background: #ffffff;
  253. line-height: 56rpx;
  254. text-align: center;
  255. color: $color-system;
  256. font-size: $font-size-28;
  257. }
  258. // 公司名
  259. .user-text {
  260. width: 446rpx;
  261. margin-top: 25rpx;
  262. color: #fff;
  263. font-size: 28rpx;
  264. line-height: 40rpx;
  265. text-align: center;
  266. white-space: nowrap;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. }
  270. .user-bg {
  271. width: 100%;
  272. }
  273. }
  274. .more {
  275. width: 750rpx;
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. padding: 23rpx 25rpx;
  280. box-sizing: border-box;
  281. background: #fff;
  282. .more-right {
  283. font-size: 26rpx;
  284. line-height: 37rpx;
  285. margin-right: 10rpx;
  286. }
  287. .title {
  288. font-size: 32rpx;
  289. line-height: 45rpx;
  290. color: #333333;
  291. }
  292. .iconfont {
  293. font-size: 20rpx;
  294. vertical-align: middle;
  295. }
  296. }
  297. .order-wrap {
  298. background: #fff;
  299. .line {
  300. width: 702rpx;
  301. height: 1px;
  302. margin: 0 auto;
  303. background: #f0f0f0;
  304. }
  305. .order-nav {
  306. display: flex;
  307. justify-content: space-evenly;
  308. align-items: center;
  309. padding: 40rpx 0;
  310. .order-nav-item {
  311. position: relative;
  312. display: flex;
  313. align-items: center;
  314. flex-direction: column;
  315. image {
  316. width: 64rpx;
  317. height: 64rpx;
  318. }
  319. text {
  320. font-size: 26rpx;
  321. line-height: 37rpx;
  322. margin-top: 8rpx;
  323. }
  324. .tui-badge {
  325. position: absolute;
  326. top: -15rpx;
  327. right: -25rpx;
  328. z-index: 999;
  329. }
  330. }
  331. }
  332. }
  333. .place-menu-conten{
  334. margin-top: 20rpx;
  335. width: 100%;
  336. height: auto;
  337. box-sizing: border-box;
  338. padding: 0 24rpx;
  339. background-color: #FFFFFF;
  340. .place-menu-cell{
  341. width: 100%;
  342. height: 110rpx;
  343. box-sizing: border-box;
  344. padding: 36rpx 0;
  345. text-align: left;
  346. float: left;
  347. border-bottom: 1px solid #E1E1E1;
  348. position: relative;
  349. &.last{
  350. border-bottom: none;
  351. }
  352. .place-left{
  353. width: 600rpx;
  354. height: 100%;
  355. .place-menu-icon{
  356. width: 36rpx;
  357. height: 36rpx;
  358. display: block;
  359. float: left;
  360. }
  361. .place-menu-title{
  362. width: 540rpx;
  363. margin-left: 16rpx;
  364. float: left;
  365. height: 36rpx;
  366. line-height: 36rpx;
  367. font-size: $font-size-28;
  368. color: #333333;
  369. }
  370. }
  371. .iconfont{
  372. width: 36rpx;
  373. height: 36rpx;
  374. display: block;
  375. line-height: 36rpx;
  376. text-align: center;
  377. font-size: $font-size-30;
  378. color: #cccccc;
  379. position: absolute;
  380. right: 0;
  381. top: 36rpx;
  382. }
  383. }
  384. }
  385. .user-support{
  386. width: 100%;
  387. float: left;
  388. margin-top: 340rpx;
  389. display: flex;
  390. flex-direction: column;
  391. align-items: center;
  392. justify-content: center;
  393. &.top{
  394. margin-top: 240rpx;
  395. }
  396. .user-support-image{
  397. width: 54rpx;
  398. height: 46rpx;
  399. display: block;
  400. margin-bottom: 5rpx;
  401. }
  402. .user-support-text{
  403. font-size: 20rpx;
  404. line-height: 30rpx;
  405. color: #cccccc;
  406. }
  407. }
  408. </style>