index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="px-20 mt-24">
  3. <view class="px-24 rd-24rpx bg--w111-fff mb-20" v-for="panel in records">
  4. <view class="h-104 fs-24 flex-y-center b-border">核销时间:{{ panel.time }}</view>
  5. <view class="py-32">
  6. <view class="item flex" v-for="item in panel.list" :key="item.id">
  7. <image :src="item.cartInfo.productInfo.attrInfo?item.cartInfo.productInfo.attrInfo.image:item.cartInfo.productInfo.image" class="w-136 h-136 rd-16rpx"></image>
  8. <view class="flex-1 flex-col flex-between-center ml-20">
  9. <view class="w-full line2 fs-28 lh-40rpx">{{ item.cartInfo.productInfo.store_name }}</view>
  10. <view class="w-full flex-between-center">
  11. <BaseMoney :money="item.cartInfo.productInfo.price" symbolSize="20" integerSize="32" decimalSize="20"></BaseMoney>
  12. <view class="fs-24 text--w111-999">核销{{ item.writeoff_num }}件</view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <emptyPage v-if="!records.length && page" title="暂无核销记录~" src="/statics/images/noOrder.gif"></emptyPage>
  19. </view>
  20. </template>
  21. <script>
  22. import {orderWirteOffRecords,storeWirteOffRecords} from '@/api/admin'
  23. import emptyPage from '@/components/emptyPage.vue'
  24. export default {
  25. components: {
  26. emptyPage
  27. },
  28. data() {
  29. return {
  30. id: '',
  31. page: 1,
  32. limit: 10,
  33. list: [],
  34. records: [],
  35. loadend: false,
  36. loading: false,
  37. storeNum:1
  38. }
  39. },
  40. onLoad(option) {
  41. this.storeNum = parseInt(option.storeNum);
  42. this.id = option.id;
  43. this.orderWirteOffRecords();
  44. },
  45. methods: {
  46. orderWirteOffRecords() {
  47. if (this.loadend || this.loading) {
  48. return;
  49. }
  50. this.loading = true;
  51. let funApi = '';
  52. if(this.storeNum){
  53. funApi = orderWirteOffRecords;
  54. }else{
  55. funApi = storeWirteOffRecords;
  56. }
  57. funApi(this.id, {
  58. product_type: 0,
  59. page: this.page,
  60. limit: this.limit,
  61. }).then(res => {
  62. const list = res.data.list;
  63. let records = [];
  64. this.list = this.list.concat(list);
  65. for (let i = 0; i < this.list.length; i++) {
  66. records.push({
  67. time: this.list[i].time,
  68. list: [this.list[i]],
  69. });
  70. for (let j = i + 1; j < this.list.length; j++) {
  71. if (this.list[i].time == this.list[j].time) {
  72. records[records.length - 1].list.push(this.list[j]);
  73. this.list.splice(j, 1);
  74. j--;
  75. }
  76. }
  77. }
  78. this.records = records;
  79. this.loadend = list.length < this.limit;
  80. this.page = this.page + 1;
  81. this.loading = false;
  82. }).catch(err => {
  83. this.loading = false;
  84. });
  85. },
  86. },
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .b-border{
  91. border-bottom: 1rpx solid #EEEEEE;
  92. }
  93. .item ~ .item{
  94. margin-top: 40rpx;
  95. }
  96. </style>