index.vue 9.8 KB

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