record.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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="pageMain">
  7. <uni-swipe-action class="item-action-box">
  8. <uni-card padding="10px 0" margin="5px 0" v-for="item in items" :key="item.memberId">
  9. <uni-swipe-action-item class="item-action" :auto-close="true" >
  10. <template v-slot:right>
  11. <view class="slot-button">
  12. <view class="bt detail" @click="handle('detail',item)"><text class="slot-button-text">详情</text></view>
  13. <view class="bt edit" @click="handle('edit',item)"><text class="slot-button-text">编辑</text></view>
  14. <view class="bt del" @click="handle('del',item)"><text class="slot-button-text">删除</text></view>
  15. </view>
  16. </template>
  17. <view class="item">
  18. <view class="title">
  19. <view class="name">{{item.accountName}}</view>
  20. <view class="num">
  21. <uni-tag :text="item.qty" custom-style="background-color: #ecf5ff; border-color: #d9ecff; color: #409eff;"></uni-tag>
  22. </view>
  23. </view>
  24. <view class="tagbox">
  25. <uni-tag :text="item.goodsCatTitle" custom-style="background-color: #ecf5ff; border-color: #d9ecff; color: #409eff;"></uni-tag>
  26. </view>
  27. <view class="bottom">
  28. <view class="time">{{item.time}}</view>
  29. </view>
  30. </view>
  31. </uni-swipe-action-item>
  32. </uni-card>
  33. </uni-swipe-action>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import goodsApi from '@/api/goods.js'
  39. export default {
  40. data() {
  41. return {
  42. tabIdx:0,
  43. tabs:['入库记录','出库记录'],
  44. items:[],
  45. goodsType:undefined,
  46. page:1,
  47. size:10,
  48. total:0,
  49. keywords:""
  50. }
  51. },
  52. onLoad({type}) {
  53. this.goodsType=type
  54. this.getData()
  55. },
  56. methods: {
  57. changeTab({currentIndex}){
  58. if (this.tabIdx !== currentIndex) {
  59. this.tabIdx = currentIndex
  60. this.page = 1
  61. this.size = 10
  62. this.total = 0
  63. this.getData()
  64. }
  65. },
  66. getData(){
  67. const getByPage=this.tabIdx===0?goodsApi.getInboundByPage:goodsApi.getOutboundByPage
  68. getByPage({
  69. page:this.page,
  70. size:this.size,
  71. goodsType:this.goodsType
  72. }).then((res)=>{
  73. this.items=res.data.map((item)=>{
  74. return{
  75. ...item,
  76. time:this.tabIdx===0?item.inboundTime:item.outboundTime,
  77. }
  78. })
  79. this.total=res.total
  80. })
  81. },
  82. handle(type,item){
  83. }
  84. },
  85. onReachBottom() {
  86. if(this.total>this.size*this.page){
  87. this.page++
  88. this.getData()
  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. .pageMain{
  100. margin-top: 20rpx;
  101. background-color: #f5f5f5;
  102. padding-bottom: 50rpx;
  103. .item{
  104. .title{
  105. display: flex;
  106. justify-content: space-between;
  107. align-items: center;
  108. .name{
  109. font-size: 36rpx;
  110. color: #222222;
  111. font-weight: 500;
  112. }
  113. .num{
  114. font-size: 32rpx;
  115. color: #424242;
  116. }
  117. }
  118. .tagbox{
  119. font-size: 24rpx;
  120. color: #666666;
  121. padding: 14rpx 0;
  122. }
  123. .bottom{
  124. .time{
  125. font-size: 24rpx;
  126. color: #666666;
  127. }
  128. }
  129. }
  130. .slot-button{
  131. width: 400rpx;
  132. height: 100%;
  133. display: flex;
  134. flex-direction: row;
  135. justify-content: center;
  136. align-items: center;
  137. color: #fff;
  138. padding-left: 10px;
  139. .bt{
  140. width: 50%;
  141. height: 100%;
  142. font-size: 30rpx;
  143. box-sizing: border-box;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. &.edit{
  148. background-color:#007aff;
  149. }
  150. &.del{
  151. background-color:#F56C6C;
  152. }
  153. &.detail{
  154. background-color: #e6a23c;
  155. }
  156. }
  157. }
  158. }
  159. }
  160. </style>