index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. this.init()
  59. },
  60. methods: {
  61. changeTab({currentIndex}){
  62. if (this.tabIdx !== currentIndex) {
  63. this.tabIdx = currentIndex
  64. this.getData()
  65. }
  66. },
  67. init(){
  68. if(!uni.getStorageSync('goodsCats')){
  69. goodsApi.getCatByList().then((res)=>{
  70. uni.setStorageSync('goodsCats',res.data)
  71. })
  72. }
  73. },
  74. getData(){
  75. goodsApi.counterByCat({goodsType:this.tabIdx+1}).then((res)=>{
  76. this.items=res.data
  77. })
  78. },
  79. onInbound(){
  80. this.$refs.inbound.show()
  81. },
  82. onOutbound(){
  83. this.$refs.outbound.show()
  84. },
  85. linkToRecord(){
  86. uni.navigateTo({
  87. url:`/pages/goods/record?type=${this.tabIdx+1}`
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .page-wrap{
  95. padding:0 20rpx;
  96. .pageTabs{
  97. background-color: #fff;
  98. }
  99. .head{
  100. margin-top: 20rpx;
  101. .handle{
  102. display: inline-block;
  103. background-color: #007aff;
  104. color: #fff;
  105. text-align: center;
  106. padding:16rpx 20rpx;
  107. border-radius: 6rpx;
  108. border: 1px solid #007aff;
  109. font-size: 28rpx;
  110. box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  111. }
  112. .addbt{
  113. width: 100rpx;
  114. height: 100rpx;
  115. border-radius: 50%;
  116. color: #fff;
  117. background-color: rgba(64,158,255,0.75);
  118. box-shadow:0 0 10rpx rgba(0,0,0,0.6);
  119. position: fixed;
  120. right: 10rpx;
  121. bottom: 20%;
  122. z-index: 99;
  123. text-align: center;
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. .word{
  128. width: 80rpx;
  129. height: 80rpx;
  130. border-radius: 50%;
  131. margin: 5rpx auto;
  132. font-size: 28rpx;
  133. letter-spacing: 2px;
  134. }
  135. }
  136. }
  137. .pageMain{
  138. margin-top: 20rpx;
  139. background-color: #f5f5f5;
  140. padding-bottom: 50rpx;
  141. .title{
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. padding-top: 16rpx;
  146. }
  147. .bottom{
  148. display: flex;
  149. justify-content: space-between;
  150. align-items: center;
  151. .handle{
  152. padding: 10px 0 10px 20px;
  153. }
  154. }
  155. }
  156. }
  157. </style>