order.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  4. :up="upOption">
  5. <card :list="list" @timeup='timeup'></card>
  6. </mescroll-body>
  7. <toast ref="toast" ></toast>
  8. </view>
  9. </template>
  10. <script>
  11. import card from "./comps/card.vue"
  12. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  13. export default {
  14. components:{
  15. card
  16. },
  17. mixins: [MescrollMixin],
  18. data() {
  19. return {
  20. list: [],
  21. downOption:{
  22. auto:false
  23. },
  24. }
  25. },
  26. onShow() {
  27. if (this.canReset) {
  28. this.mescroll.resetUpScroll()
  29. }
  30. this.canReset=true
  31. },
  32. methods: {
  33. timeup(item){
  34. return
  35. let order = this.$u.deepClone(item)
  36. order.payStatus = '取消付款'
  37. order.orderStatus = '取消付款'
  38. this.$api.goodsbills.submit(order).then(res => {
  39. if (res.success) {
  40. this.mescroll.resetUpScroll()
  41. }
  42. })
  43. },
  44. //上拉回调
  45. upCallback(mescroll) {
  46. let params={
  47. payId:this.vuex_userId,
  48. current:mescroll.num,
  49. size:mescroll.size
  50. }
  51. try{
  52. this.$api.goodsbills.list(params).then(res=>{
  53. let data=res.data.records
  54. let length=data.length
  55. let total=res.data.total
  56. mescroll.endBySize(length, total);
  57. if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  58. this.list=this.list.concat(data); //追加新数据
  59. })
  60. }catch(e){
  61. mescroll.endErr();
  62. }
  63. },
  64. //下拉回调
  65. downCallback(mescroll) {
  66. setTimeout(()=>{
  67. this.$refs.toast.info('刷新成功')
  68. this.mescroll.resetUpScroll()
  69. },500)
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. </style>