index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="page-wrap">
  3. <view class="pageTabs">
  4. <uni-segmented-control :current="tabIdx" :values="tabs" style-type="text" active-color="#007aff" @clickItem="changeTab" />
  5. </view>
  6. <view class="head">
  7. <uni-section title="物资列表" type="line">
  8. <template v-slot:right>
  9. <view class="handle" @click="linkToRecord">出库/入库记录</view>
  10. </template>
  11. </uni-section>
  12. <view class="addbt" @click="onInbound('in',tabIdx+1)">
  13. <view class="word">物资入库</view>
  14. </view>
  15. </view>
  16. <view class="pageMain">
  17. <uni-card v-for="(item,idx) in items" :key="idx" padding="0">
  18. <template v-slot:title>
  19. <view class="title">
  20. <view class="name">
  21. <uni-tag :text="item.goodsCatTitle" type="primary"></uni-tag>
  22. </view>
  23. <uni-tag :text="item.count" custom-style="background-color: #ecf5ff; border-color: #d9ecff; color: #409eff;"></uni-tag>
  24. </view>
  25. </template>
  26. <view class="bottom">
  27. <view class="groupName">
  28. <uni-tag :text="item.groupName" type="success" :inverted="true"></uni-tag>
  29. </view>
  30. <div class="handle" @click="onOutbound(item)"><uni-tag text="出库" type="warning" size="normal" /></div>
  31. </view>
  32. </uni-card>
  33. </view>
  34. <Inbound ref="inbound"></Inbound>
  35. <Outbound ref="outbound"></Outbound>
  36. </view>
  37. </template>
  38. <script>
  39. import Inbound from './components/Inbound.vue'
  40. import Outbound from './components/Outbound.vue'
  41. import goodsApi from '@/api/goods.js'
  42. export default {
  43. components:{
  44. Inbound,
  45. Outbound
  46. },
  47. data() {
  48. return {
  49. tabIdx:0,
  50. tabs:['行业物质','镇办物资'],
  51. items:[],
  52. goodsType: 1,
  53. keywords: ""
  54. }
  55. },
  56. onShow() {
  57. this.getData()
  58. },
  59. methods: {
  60. changeTab({currentIndex}){
  61. if (this.tabIdx !== currentIndex) {
  62. this.tabIdx = currentIndex
  63. this.getData()
  64. }
  65. },
  66. getData(){
  67. goodsApi.counterByCat({goodsType:this.tabIdx+1}).then((res)=>{
  68. this.items=res.data
  69. })
  70. },
  71. onInbound(){
  72. this.$refs.inbound.show()
  73. },
  74. onOutbound(){
  75. this.$refs.outbound.show()
  76. },
  77. linkToRecord(){
  78. uni.navigateTo({
  79. url:`/pages/goods/record?type=${this.tabIdx+1}`
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .page-wrap{
  87. padding:0 20rpx;
  88. .pageTabs{
  89. background-color: #fff;
  90. }
  91. .head{
  92. margin-top: 20rpx;
  93. .handle{
  94. display: inline-block;
  95. background-color: #007aff;
  96. color: #fff;
  97. text-align: center;
  98. padding:16rpx 20rpx;
  99. border-radius: 6rpx;
  100. border: 1px solid #007aff;
  101. font-size: 28rpx;
  102. box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  103. }
  104. .addbt{
  105. width: 100rpx;
  106. height: 100rpx;
  107. border-radius: 50%;
  108. color: #fff;
  109. background-color: rgba(64,158,255,0.75);
  110. box-shadow:0 0 10rpx rgba(0,0,0,0.6);
  111. position: fixed;
  112. right: 10rpx;
  113. bottom: 20%;
  114. z-index: 99;
  115. text-align: center;
  116. display: flex;
  117. justify-content: center;
  118. align-items: center;
  119. .word{
  120. width: 80rpx;
  121. height: 80rpx;
  122. border-radius: 50%;
  123. margin: 5rpx auto;
  124. font-size: 28rpx;
  125. letter-spacing: 2px;
  126. }
  127. }
  128. }
  129. .pageMain{
  130. margin-top: 20rpx;
  131. background-color: #f5f5f5;
  132. padding-bottom: 50rpx;
  133. .title{
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: center;
  137. padding-top: 16rpx;
  138. }
  139. .bottom{
  140. display: flex;
  141. justify-content: space-between;
  142. align-items: center;
  143. .handle{
  144. padding: 10px 0 10px 20px;
  145. }
  146. }
  147. }
  148. }
  149. </style>