purchaseIn.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!-- 采购入库 -->
  2. <template>
  3. <view class="home bg-f9">
  4. <header-bar addUrl="/inOrOut/purchaseInAdd" title="采购入库"></header-bar>
  5. <uni-search-bar v-model="req.keyword" placeholder="输入关键词" @confirm="search" @cancel="cancel" bgColor="#fff"
  6. cancel-text="取消">
  7. </uni-search-bar>
  8. <common-list :config="config" @listClick="toDtl" :data="dataList"></common-list>
  9. <button type="default" @click="getList()" style="margin-top:10rpx">
  10. {{status == 'more' ? '点击加载更多' : status == 'noMore' ? '已经到底了' : '加载中..'}}
  11. </button>
  12. </view>
  13. </template>
  14. <script>
  15. import headerBar from '../../../components/header-bar/index.vue'
  16. import commonList from '../../../components/common-list/common-list.vue'
  17. import {formateObjToParamStr} from '../../../util/uitl.js'
  18. import Vue from 'vue'
  19. export default {
  20. components: {
  21. headerBar,
  22. commonList
  23. },
  24. data() {
  25. return {
  26. status: 'more',
  27. config: [{
  28. label: "采购单号",
  29. key: 'typeName',
  30. },
  31. {
  32. label: "物品名称",
  33. key: 'name',
  34. },
  35. {
  36. label: "待入库",
  37. key: 'unit',
  38. }
  39. ],
  40. dataList: [],
  41. req: {
  42. pageNum: 1,
  43. pageSize: 10,
  44. keyword: null,
  45. },
  46. }
  47. },
  48. onLoad() {
  49. this.search()
  50. },
  51. onShow() {
  52. if(this.needRefresh) this.search();
  53. },
  54. methods: {
  55. toDtl(i){
  56. console.log(i)
  57. uni.navigateTo({
  58. url: '/pages/supplyChain/inOrOut/purchaseInAdd?' + formateObjToParamStr(i)
  59. })
  60. },
  61. cancel() {
  62. this.req.keyword = null
  63. },
  64. search() {
  65. this.req.pageNum = 1
  66. this.status = 'more'
  67. this.dataList = []
  68. this.getList()
  69. },
  70. getList() {
  71. const v = this
  72. if (v.status === 'more') {
  73. v.status = 'loading'
  74. } else {
  75. return
  76. }
  77. v.$post('/api/basics/product/page', v.req).then(res => {
  78. res.data.records.map(items => {
  79. items.typeName = (items.type === 0) ? '半成品' : '成品'
  80. })
  81. v.dataList = [...v.dataList, ...res.data.records]
  82. if (res.data.pages === v.req.pageNum || res.data.pages === 0) {
  83. v.status = 'noMore'
  84. } else {
  85. v.status = 'more'
  86. v.req.pageNum++
  87. }
  88. })
  89. },
  90. },
  91. }
  92. </script>
  93. <style lang="less">
  94. </style>