index.vue 13 KB

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