user.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="top-bg">
  5. <image src="../../static/img/userBg.png" mode=""></image>
  6. </view>
  7. <view class="userInfo">
  8. <view class="avatar">
  9. <image src="../../static/img/avatar.png" mode=""></image>
  10. </view>
  11. <view class="user">
  12. <view class="userbox">
  13. <view class="name">
  14. 海儿
  15. </view>
  16. <view class="post">
  17. 部门管理
  18. </view>
  19. </view>
  20. <view class="phone">
  21. 137****1523
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tz">
  26. <view class="tzimage">
  27. <image src="../../static/img/tong.png" mode=""></image>
  28. </view>
  29. <u-notice-bar class="tz-main" :text="text1" direction="column" :icon="false" bgColor="#ffffff"
  30. color="#000000" fontSize="25rpx"></u-notice-bar>
  31. </view>
  32. </view>
  33. <view class="">
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. mapState,
  40. mapMutations
  41. } from 'vuex';
  42. import {
  43. orderData,
  44. getUserInfo
  45. } from '@/api/user.js';
  46. export default {
  47. data() {
  48. return {
  49. text1: ['123456', '654321'],
  50. list: [{
  51. icon: '../../static/icon/u1.png',
  52. name: '领单',
  53. tip: '领取新订单'
  54. },
  55. {
  56. icon: '../../static/icon/u1.png',
  57. name: '待检验订单',
  58. tip: '检验 | 添加记录'
  59. },
  60. {
  61. icon: '../../static/icon/u1.png',
  62. name: '外发检验订单',
  63. tip: '订单外发处理'
  64. },
  65. {
  66. icon: '../../static/icon/u1.png',
  67. name: '我的订单',
  68. tip: '订单列表 | 提交记录'
  69. },
  70. {
  71. icon: '../../static/icon/u1.png',
  72. name: '工资记录',
  73. tip: '历月工资详情'
  74. },
  75. {
  76. icon: '../../static/icon/u1.png',
  77. name: '打卡记录',
  78. tip: '上班 | 迟到记录'
  79. },
  80. {
  81. icon: '../../static/icon/u1.png',
  82. name: '奖罚记录',
  83. tip: '奖励 | 处罚记录'
  84. },
  85. {
  86. icon: '../../static/icon/u1.png',
  87. name: '订单监管',
  88. tip: '订单详情'
  89. },
  90. {
  91. icon: '../../static/icon/u1.png',
  92. name: '待处理办件',
  93. tip: '处罚 | 报废返工处理'
  94. },
  95. {
  96. icon: '../../static/icon/u1.png',
  97. name: '外发不合格处理',
  98. tip: '订单外发处理'
  99. },
  100. {
  101. icon: '../../static/icon/u1.png',
  102. name: '处罚管理',
  103. tip: '奖励 | 处罚记录'
  104. },
  105. {
  106. icon: '../../static/icon/u1.png',
  107. name: '报废返工处理',
  108. tip: '提交报废返工的数量'
  109. },
  110. {
  111. icon: '../../static/icon/u1.png',
  112. name: '外发订单管理',
  113. tip: '提交检验 | 检验记录'
  114. },
  115. {
  116. icon: '../../static/icon/u1.png',
  117. name: '外发不合格通知',
  118. tip: '外发不合格消息'
  119. },
  120. {
  121. icon: '../../static/icon/u1.png',
  122. name: '订单状态预警',
  123. tip: '订单到期时间预警'
  124. },
  125. {
  126. icon: '../../static/icon/u1.png',
  127. name: '材料未到通知',
  128. tip: '材料未到预警'
  129. },
  130. {
  131. icon: '../../static/icon/u1.png',
  132. name: '外发未到通知',
  133. tip: '外发时间到期预警'
  134. },
  135. {
  136. icon: '../../static/icon/u1.png',
  137. name: '订单外发',
  138. tip: '订单外发给合作公司'
  139. },
  140. {
  141. icon: '../../static/icon/u1.png',
  142. name: '订单抽检',
  143. tip: '订单抽取检验'
  144. },
  145. ]
  146. };
  147. },
  148. computed: {
  149. ...mapState('user', ['hasLogin']),
  150. },
  151. onShow() {
  152. uni.setTabBarStyle({
  153. backgroundColor: '#FFFFFF'
  154. })
  155. // 判断是否已经登录
  156. // this.loadBaseData();
  157. // 判断是否用户页面
  158. if (this.isUserPage && this.hasLogin) {
  159. this.$nextTick(() => {
  160. this.$refs.userPage.getUser();
  161. })
  162. } else if (this.hasLogin) {
  163. this.$nextTick(() => {
  164. this.$refs.shopPage.getInit();
  165. })
  166. }
  167. },
  168. methods: {
  169. toJSON() {
  170. return this;
  171. },
  172. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  173. changeTab(bool) {
  174. if (bool) {
  175. this.$refs.shopPage.getInit();
  176. }
  177. if (!bool) {
  178. this.$refs.userPage.getUser();
  179. }
  180. // 判断 是否切换为商家
  181. this.isUserPage = !bool;
  182. },
  183. // 加载初始数据
  184. loadBaseData() {
  185. getUserInfo({})
  186. .then(({
  187. data
  188. }) => {
  189. this.setUserInfo(data);
  190. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  191. orderData({})
  192. .then(({
  193. data
  194. }) => {
  195. this.setOrderInfo(data);
  196. })
  197. .catch(e => {
  198. this.setOrderInfo({
  199. complete_count: 0, //完成
  200. received_count: 0, //待收货
  201. unshipped_count: 0, //待发货
  202. order_count: 0, //订单总数
  203. unpaid_count: 0 //待付款
  204. });
  205. });
  206. })
  207. .catch(e => {
  208. console.log(e);
  209. });
  210. },
  211. /**
  212. * 统一跳转接口,拦截未登录路由
  213. * navigator标签现在默认没有转场动画,所以用view
  214. */
  215. }
  216. };
  217. </script>
  218. <style lang="scss">
  219. .content,
  220. page {
  221. height: auto;
  222. min-height: 100%;
  223. background: #ffffff;
  224. }
  225. .top {
  226. position: relative;
  227. image {
  228. width: 100%;
  229. height: 100%;
  230. }
  231. .top-bg {
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. right: 0;
  236. width: 750rpx;
  237. height: 490rpx;
  238. }
  239. .userInfo {
  240. display: flex;
  241. align-items: center;
  242. padding: 126rpx 20rpx 0;
  243. .avatar {
  244. width: 126rpx;
  245. height: 126rpx;
  246. border-radius: 50%;
  247. image {
  248. border-radius: 50%;
  249. }
  250. }
  251. .user {
  252. position: relative;
  253. z-index: 2;
  254. padding-left: 10rpx;
  255. line-height: 1;
  256. .userbox {
  257. display: flex;
  258. .name {
  259. font-size: 36rpx;
  260. font-family: PingFang SC;
  261. font-weight: bold;
  262. color: #FFFFFF;
  263. }
  264. .post {
  265. margin-left: 10rpx;
  266. border: 1rpx solid #FFFFFF;
  267. border-radius: 10rpx;
  268. padding: 4rpx 8rpx;
  269. font-size: 24rpx;
  270. font-family: PingFang SC;
  271. font-weight: 500;
  272. color: #FFFFFF;
  273. }
  274. }
  275. .phone {
  276. margin-top: 20rpx;
  277. font-size: 24rpx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #FFFFFF;
  281. }
  282. }
  283. }
  284. .tz {
  285. position: relative;
  286. z-index: 2;
  287. padding: 20rpx 30rpx 0;
  288. display: flex;
  289. align-items: center;
  290. .tzimage {
  291. width: 68rpx;
  292. height: 68rpx;
  293. image {
  294. border-radius: 50%;
  295. }
  296. }
  297. .tz-main {
  298. height: 58rpx;
  299. margin-left: -34rpx;
  300. padding-left: 44rpx;
  301. border-radius: 0px 29rpx 29rpx 0px;
  302. }
  303. }
  304. }
  305. </style>