index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <view class="search-box">
  4. <view class="search ddflex">
  5. <image src="../static/images/ssico.png"></image>
  6. <input v-model="search" placeholder="输入核销码" placeholder-class="placeholder" class="fflex" @confirm="confirmSearch" />
  7. </view>
  8. </view>
  9. <view class="list" v-if="pageList&&pageList.length>0">
  10. <navigator :url="'/write/detail/detail?orderId=' + item.id" hover-class="none" class="li" v-for="(item,index) in pageList" :key="index">
  11. <view class="li-t ddflex">
  12. <view class="fflex">{{item.useTime}}</view>
  13. <view class="sta">已核销</view>
  14. </view>
  15. <view class="lis">核销码<text>{{item.code}}</text></view>
  16. <view class="info ddflex">
  17. <image :src="item.productPic" mode="aspectFill"></image>
  18. <view class="fflex">
  19. <view class="pro-tit">{{item.proudctName}}</view>
  20. <text class="pro-count">×{{item.quantity}}</text>
  21. </view>
  22. </view>
  23. </navigator>
  24. </view>
  25. <view class="nodata" v-else>
  26. <image :src="picUrlss+'empty_dd.png'"></image>
  27. <text>没有记录</text>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. const app = getApp();
  33. const req = require("../../utils/request.js");
  34. export default {
  35. data() {
  36. return {
  37. picUrlss: req.public.picUrls,
  38. search: '',
  39. form:{
  40. page: 1,
  41. limit: 10
  42. },
  43. pageList: [],
  44. isLoad: true
  45. };
  46. },
  47. onLoad(options) {
  48. this.getList();
  49. },
  50. onReachBottom() {
  51. this.form.page++;
  52. this.getList();
  53. },
  54. methods: {
  55. confirmSearch(){
  56. this.isLoad = true;
  57. this.form.page = 1;
  58. this.getList();
  59. },
  60. getList(){
  61. if (!this.isLoad) return false;
  62. this.isLoad = false;
  63. let form = this.form;
  64. if (this.search) {
  65. form.search = this.search;
  66. } else {
  67. delete form.search
  68. }
  69. req.getRequest('/api/v3/secondary/card/writeRecord',form,data=>{
  70. if (data.list && data.list.length == 10) this.isLoad = true;
  71. if (this.form.page > 1) data.list = this.pageList.concat(data.list);
  72. this.pageList = data.list;
  73. })
  74. }
  75. }
  76. };
  77. </script>
  78. <style>
  79. @import "./index.css";
  80. </style>