index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view class="fittings_management_page">
  3. <view class="fittings_management_bg"></view>
  4. <view class="fittings_management_scroll">
  5. <scroll-view
  6. scroll-y="true"
  7. :style="{
  8. height: '100vh'
  9. }"
  10. :refresher-enabled="true"
  11. :refresher-triggered="refresherTriggered"
  12. @refresherrefresh="refresherrefresh"
  13. refresher-background="#6DA7FF"
  14. >
  15. <view class="page_scroll_view">
  16. <view class="fittings_management_statistical">
  17. <block v-for="(item, index) in fittingsStatisticals" :key="index">
  18. <view class="fittings_statistical_view">
  19. <view class="fittings_statistical_a">
  20. <text class="fittings_statistical_num">{{ item.num }}</text>
  21. <text class="fittings_statistical_title">{{ item.title }}</text>
  22. </view>
  23. </view>
  24. </block>
  25. </view>
  26. <view class="fittings_management_module">
  27. <block v-for="(item, index) in fittingsModules" :key="index">
  28. <view @tap.stop="toUrl(item)" class="fittings_module_a">
  29. <image :src="`/static/images/fittingsManagement/module_${item.src}.png`" mode="aspectFill"></image>
  30. <text>
  31. {{ item.name }}
  32. </text>
  33. </view>
  34. </block>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import { getStorage } from '@/common/utils/storage.js'
  43. export default {
  44. data() {
  45. return {
  46. refresherTriggered: false,
  47. fittingsStatisticals: [
  48. {
  49. num: 0,
  50. title: '新件库存'
  51. },
  52. {
  53. num: 0,
  54. title: '新件待返还'
  55. },
  56. {
  57. num: 0,
  58. title: '新件返还金额'
  59. },
  60. {
  61. num: 0,
  62. title: '旧件库存'
  63. },
  64. {
  65. num: 0,
  66. title: '旧件待返还'
  67. },
  68. {
  69. num: 0,
  70. title: '旧件返还金额'
  71. }
  72. ],
  73. fittingsModules: [
  74. // {
  75. // src: 0,
  76. // name: "配件申请"
  77. // },
  78. {
  79. src: 1,
  80. name: '配件库存',
  81. url: '/packageAttachment/pages/sparePartsInventory/index'
  82. },
  83. {
  84. src: 2,
  85. name: '新件返还',
  86. url: '/packageAttachment/pages/returnOfNewParts/index'
  87. },
  88. {
  89. src: 3,
  90. name: '旧件返还',
  91. url: '/packageAttachment/pages/returnOfOldParts/index'
  92. },
  93. {
  94. src: 4,
  95. name: '转销售单',
  96. url: '/packageAttachment/pages/forwardSaleOrder/index'
  97. },
  98. {
  99. src: 4,
  100. name: '配件申请',
  101. url: '/packageAttachment/pages/applicationParts/index'
  102. },
  103. {
  104. src: 4,
  105. name: '配件申请记录',
  106. url: '/packageAttachment/pages/orderOfSales/index'
  107. },
  108. {
  109. src: 4,
  110. name: '保外转销售',
  111. url: '/packageAttachment/pages/beyondInsuranceTransferToSale/index'
  112. }
  113. ],
  114. info: {}
  115. }
  116. },
  117. computed: {
  118. userInfo() {
  119. return getStorage('user')
  120. },
  121. idcard() {
  122. return this.userInfo.idCard
  123. }
  124. },
  125. onLoad() {
  126. uni.$on('DataStatisticsOfParts', () => {
  127. this.getInfo()
  128. })
  129. },
  130. onUnload() {
  131. uni.$off('DataStatisticsOfParts')
  132. },
  133. mounted() {
  134. this.getInfo()
  135. },
  136. methods: {
  137. refresherrefresh() {
  138. this.refresherTriggered = true
  139. this.getInfo(() => {
  140. this.refresherTriggered = false
  141. })
  142. },
  143. getInfo(cbk) {
  144. this.$api
  145. .get('/app/parts/stock/query/worker-stock', {
  146. identity: this.idcard,
  147. websiteNumber: uni.getStorageSync('websit_number')
  148. })
  149. .then(res => {
  150. ;['newQty', 'newRefundQty', 'newRefundAmount', 'oldQty', 'oldRefundQty', 'oldRefundAmount'].forEach(
  151. (key, index) => {
  152. this.fittingsStatisticals[index].num = res.data[key] || 0
  153. }
  154. )
  155. cbk && cbk()
  156. })
  157. .catch(err => {
  158. console.log(err)
  159. })
  160. },
  161. toUrl({ src, name, url }) {
  162. if (url) {
  163. this.$navToPage({
  164. url
  165. })
  166. }
  167. }
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .fittings_management_page {
  173. width: 100%;
  174. height: 100%;
  175. position: relative;
  176. .fittings_management_bg {
  177. width: 100%;
  178. height: 100rpx;
  179. background: #6da7ff;
  180. }
  181. .fittings_management_scroll {
  182. width: 100%;
  183. height: 100%;
  184. position: absolute;
  185. top: 0;
  186. bottom: 0;
  187. left: 0;
  188. right: 0;
  189. }
  190. .page_scroll_view {
  191. width: 100%;
  192. box-sizing: border-box;
  193. padding: 48rpx 30rpx;
  194. .fittings_management_statistical {
  195. width: 100%;
  196. height: auto;
  197. background: #ffffff;
  198. border-radius: 20rpx;
  199. overflow: hidden;
  200. display: flex;
  201. flex-wrap: wrap;
  202. margin-bottom: 20rpx;
  203. .fittings_statistical_view {
  204. width: 33.333%;
  205. height: 140rpx;
  206. box-sizing: border-box;
  207. padding: 28rpx;
  208. &:not(:nth-child(3n + 3)) {
  209. border-right: 1rpx solid #f7f7f7;
  210. }
  211. &:nth-child(1),
  212. &:nth-child(2),
  213. &:nth-child(3) {
  214. border-bottom: 1rpx solid #f7f7f7;
  215. }
  216. .fittings_statistical_a {
  217. width: 100%;
  218. height: 100%;
  219. display: flex;
  220. flex-direction: column;
  221. justify-content: space-between;
  222. .fittings_statistical_num {
  223. font-size: 36rpx;
  224. font-family: PingFang SC, PingFang SC-Heavy;
  225. font-weight: 800;
  226. text-align: left;
  227. color: #e95505;
  228. }
  229. .fittings_statistical_title {
  230. font-size: 26rpx;
  231. font-family: PingFang SC, PingFang SC-Medium;
  232. font-weight: 500;
  233. text-align: left;
  234. color: #333333;
  235. }
  236. }
  237. }
  238. }
  239. .fittings_management_module {
  240. width: 100%;
  241. height: auto;
  242. background: #ffffff;
  243. border-radius: 20rpx;
  244. box-sizing: border-box;
  245. padding: 60rpx 0 0;
  246. display: flex;
  247. flex-direction: row;
  248. flex-wrap: wrap;
  249. .fittings_module_a {
  250. width: 33.333%;
  251. height: auto;
  252. display: flex;
  253. flex-direction: column;
  254. justify-content: center;
  255. align-items: center;
  256. margin-bottom: 60rpx;
  257. image {
  258. width: 64rpx;
  259. height: 64rpx;
  260. margin-bottom: 20rpx;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. </style>