index.vue 9.7 KB

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