order.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. let order = this.$u.deepClone(item)
  35. order.payStatus = '取消付款'
  36. order.orderStatus = '取消付款'
  37. this.$api.goodsbills.submit(order).then(res => {
  38. if (res.success) {
  39. this.mescroll.resetUpScroll()
  40. }
  41. })
  42. },
  43. //上拉回调
  44. upCallback(mescroll) {
  45. let params={
  46. payId:this.vuex_userId,
  47. current:mescroll.num,
  48. size:mescroll.size
  49. }
  50. try{
  51. this.$api.goodsbills.list(params).then(res=>{
  52. let data=res.data.records
  53. let length=data.length
  54. let total=res.data.total
  55. mescroll.endBySize(length, total);
  56. if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  57. this.list=this.list.concat(data); //追加新数据
  58. })
  59. }catch(e){
  60. mescroll.endErr();
  61. }
  62. },
  63. //下拉回调
  64. downCallback(mescroll) {
  65. setTimeout(()=>{
  66. this.$refs.toast.info('刷新成功')
  67. this.mescroll.resetUpScroll()
  68. },500)
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. </style>