index.vue 4.2 KB

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