index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. id: 'transfer',
  67. title: '中转箱',
  68. icon: 'icon-transit',
  69. color: '#c77c1c',
  70. }],
  71. warehouseList: [{
  72. id: 'details',
  73. title: '仓库信息',
  74. icon: 'icon-lenglianku',
  75. color: '#4bc7fc',
  76. }, {
  77. id: 'put',
  78. title: '扫码入库',
  79. icon: 'icon-fankudengji',
  80. color: '#9ddd54',
  81. }, {
  82. id: 'encasement',
  83. title: '扫码装箱',
  84. icon: 'icon-chukudan',
  85. color: '#fece56',
  86. }, {
  87. id: 'signfor',
  88. title: '扫码签收',
  89. icon: 'icon-yidaoda',
  90. color: '#9ddd54',
  91. }, {
  92. id: 'add',
  93. title: '添加运单',
  94. icon: 'icon-tianjiadingdan',
  95. color: '#1cc723',
  96. }, {
  97. id: 'transfer',
  98. title: '中转箱',
  99. icon: 'icon-transit',
  100. color: '#c77c1c',
  101. }],
  102. userList: [{
  103. id: 'add',
  104. title: '添加运单',
  105. icon: 'icon-tianjiadingdan',
  106. color: '#1cc723',
  107. }],
  108. }
  109. },
  110. created() {
  111. if (this.userInfo.userType == 'sys') {
  112. if (this.userInfo.type == 2) {
  113. this.homeUserType = 1
  114. // 仓管
  115. this.tableList = this.warehouseList
  116. } else if (this.userInfo.type == 3) {
  117. // 司机
  118. this.homeUserType = 2
  119. this.tableList = this.partitionList
  120. }
  121. } else {
  122. this.homeUserType = 3
  123. this.tableList = this.userList
  124. }
  125. },
  126. methods: {
  127. getOperate(value) {
  128. if (this.token) {
  129. if (['truck', 'unload', 'signfor', 'put', 'out', 'encasement'].includes(value.id)) {
  130. uni.navigateTo({
  131. url: '/pages/order/delivery?id=' + value.id + '&title=' + value.title
  132. });
  133. } else if (value.id == 'add') {
  134. uni.navigateTo({
  135. url: '/pages/order/addWaybill?title=添加订单&type=1'
  136. });
  137. } else if (value.id == 'details') {
  138. uni.navigateTo({
  139. url: '/pages/home/particulars?title=true'
  140. });
  141. } else if (value.id == 'detailsil') {
  142. uni.navigateTo({
  143. url: '/pages/home/particulars?title=false'
  144. });
  145. } else if (value.id == 'transfer') {
  146. console.log('中转箱')
  147. uni.navigateTo({
  148. url: '/pages/home/transferBox'
  149. });
  150. }
  151. } else {
  152. uni.$u.toast('请先登录')
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss">
  159. .card_index_bgc {
  160. // padding-top: constant(safe-area-inset-top);
  161. // padding-top: env(safe-area-inset-top);
  162. background-image: linear-gradient(#a9e3f1, #f3f4f6);
  163. }
  164. .company_name {
  165. font-size: 36rpx;
  166. padding: 30rpx 30rpx 20rpx 30rpx;
  167. font-weight: 600;
  168. }
  169. .card_swiper {
  170. padding: 20rpx 20rpx 0rpx 20rpx;
  171. }
  172. .card_operate {
  173. display: flex;
  174. flex-wrap: wrap;
  175. justify-content: flex-start;
  176. background-color: #fff;
  177. padding: 20rpx 0rpx;
  178. margin: 20rpx;
  179. border-radius: 20rpx;
  180. }
  181. .btn_item_tab {
  182. width: 25%;
  183. display: flex;
  184. align-items: center;
  185. flex-direction: column;
  186. margin: 10rpx 0rpx;
  187. }
  188. .card_image {
  189. width: 90rpx;
  190. height: 90rpx;
  191. border-radius: 30rpx;
  192. margin-bottom: 10rpx;
  193. }
  194. .icon_image {
  195. font-size: 50rpx;
  196. color: #fff;
  197. }
  198. .item_title_tab {
  199. font-size: 26rpx;
  200. color: #606266;
  201. }
  202. </style>