index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <!-- 首页 -->
  3. <view class="card_index_bgc">
  4. <view class="company_name" v-if="userInfo.dept">{{userInfo.dept.name || ''}}</view>
  5. <x-statistics :userType="homeUserType" :orderStatistics="orderStatistics"></x-statistics>
  6. <view class="card_operate">
  7. <view class="btn_item_tab" v-for="(item,index) in tableList" :key="index" @click="getOperate(item)">
  8. <view class="card_image center_in" :style="{backgroundColor:item.color}">
  9. <span class="iconfont icon_image" :class="item.icon"></span>
  10. </view>
  11. <view class="item_title_tab">{{item.title}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. token: {
  20. type: String,
  21. default: () => '',
  22. },
  23. userInfo: {
  24. type: Object,
  25. default: () => {},
  26. },
  27. orderStatistics: {
  28. type: Object,
  29. default: () => {},
  30. }
  31. },
  32. data() {
  33. return {
  34. homeUserType: 1,
  35. tableList: [],
  36. partitionList: [{
  37. id: 'detailsil',
  38. title: '车辆信息',
  39. icon: 'icon-cheliangxinxi',
  40. color: '#4bc7fc',
  41. }, {
  42. id: 'truck',
  43. title: '扫码装车',
  44. icon: 'icon-fankudengji',
  45. color: '#fece56',
  46. },
  47. // {
  48. // id: 'unload',
  49. // title: '扫码下车',
  50. // icon: 'icon-chukudan',
  51. // color: '#fe880e',
  52. // },
  53. {
  54. id: 'signfor',
  55. title: '扫码签收',
  56. icon: 'icon-yidaoda',
  57. color: '#9ddd54',
  58. }, {
  59. id: 'add',
  60. title: '添加运单',
  61. icon: 'icon-tianjiadingdan',
  62. color: '#1cc723',
  63. }
  64. ],
  65. warehouseList: [{
  66. id: 'details',
  67. title: '仓库信息',
  68. icon: 'icon-lenglianku',
  69. color: '#4bc7fc',
  70. }, {
  71. id: 'put',
  72. title: '扫码入库',
  73. icon: 'icon-fankudengji',
  74. color: '#9ddd54',
  75. },
  76. // {
  77. // id: 'out',
  78. // title: '扫码出库',
  79. // icon: 'icon-chukudan',
  80. // color: '#fece56',
  81. // },
  82. {
  83. id: 'add',
  84. title: '添加运单',
  85. icon: 'icon-tianjiadingdan',
  86. color: '#1cc723',
  87. }
  88. ],
  89. userList: [{
  90. id: 'add',
  91. title: '添加运单',
  92. icon: 'icon-tianjiadingdan',
  93. color: '#1cc723',
  94. }],
  95. }
  96. },
  97. created() {
  98. if (this.userInfo.userType == 'sys') {
  99. if (this.userInfo.type == 2) {
  100. this.homeUserType = 1
  101. // 仓管
  102. this.tableList = this.warehouseList
  103. } else if (this.userInfo.type == 3) {
  104. // 司机
  105. this.homeUserType = 2
  106. this.tableList = this.partitionList
  107. }
  108. } else {
  109. this.homeUserType = 3
  110. this.tableList = this.userList
  111. }
  112. },
  113. methods: {
  114. getOperate(value) {
  115. if (this.token) {
  116. if (['truck', 'unload', 'signfor', 'put', 'out'].includes(value.id)) {
  117. uni.navigateTo({
  118. url: '/pages/order/delivery?id=' + value.id + '&title=' + value.title
  119. });
  120. } else if (value.id == 'add') {
  121. uni.navigateTo({
  122. url: '/pages/order/addWaybill'
  123. });
  124. } else if (value.id == 'details') {
  125. uni.navigateTo({
  126. url: '/pages/home/particulars?title=true'
  127. });
  128. } else if (value.id == 'detailsil') {
  129. uni.navigateTo({
  130. url: '/pages/home/particulars?title=false'
  131. });
  132. }
  133. } else {
  134. uni.$u.toast('请先登录')
  135. }
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. .card_index_bgc {
  142. padding-top: constant(safe-area-inset-top);
  143. padding-top: env(safe-area-inset-top);
  144. background-image: linear-gradient(#a9e3f1, #f3f4f6);
  145. }
  146. .company_name {
  147. font-size: 36rpx;
  148. padding: 50rpx 30rpx 20rpx 30rpx;
  149. font-weight: 600;
  150. }
  151. .card_swiper {
  152. padding: 20rpx 20rpx 0rpx 20rpx;
  153. }
  154. .card_operate {
  155. display: flex;
  156. flex-wrap: wrap;
  157. justify-content: flex-start;
  158. background-color: #fff;
  159. padding: 20rpx 0rpx;
  160. margin: 20rpx;
  161. border-radius: 20rpx;
  162. }
  163. .btn_item_tab {
  164. width: 25%;
  165. display: flex;
  166. align-items: center;
  167. flex-direction: column;
  168. margin: 10rpx 0rpx;
  169. }
  170. .card_image {
  171. width: 90rpx;
  172. height: 90rpx;
  173. border-radius: 30rpx;
  174. margin-bottom: 10rpx;
  175. }
  176. .icon_image {
  177. font-size: 50rpx;
  178. color: #fff;
  179. }
  180. .item_title_tab {
  181. font-size: 26rpx;
  182. color: #606266;
  183. }
  184. </style>