| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <view class="">
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
- :up="upOption">
- <card @deleteItem="deleteItem" :list="list" @cancel="cancel"></card>
- </mescroll-body>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
- import card from "./card.vue"
- export default {
- mixins: [MescrollMixin], // 使用mixin
- name: '',
- components: {
- card
- },
- data() {
- return {
- list: [],
- page: {
- current: 1,
- size: 30,
- },
- };
- },
- methods: {
- /**
- * @param {Object} item 删除订单
- */
- deleteItem(item) {
- this.$dialog.showModal('确定要删除该工单').then(_=>{
- //删除状态
- item.isDeleted = 1
- this.$http.addEstateRepair(item).then(res => {
- if (res.data.add_result == true) {
- this.$u.toast('删除成功')
- this.mescroll.resetUpScroll()
- } else {
- app.globalData.oneFailHint(res.data.add_result);
- }
-
- });
- })
- },
- /**
- * 取消订单
- * @param {Object} item 订单实体
- */
- cancel(item) {
- this.$dialog.showModal('确定要取消该工单').then(_ => {
- item.handleStatus = 3
- this.$http.addEstateRepair(item).then(res => {
- if (res.data.success) {
- this.$u.toast('取消成功')
- this.mescroll.resetUpScroll()
- } else {
- getApp().globalData.oneFailHint(res.data.add_result);
- }
- });
- })
- },
- downCallback(mescroll) {
- setTimeout(() => {
- this.mescroll.resetUpScroll()
- }, 200)
- },
- upCallback(mescroll) {
- let data = {
- "page": {
- current: mescroll.num,
- size: mescroll.size,
- },
- memberId: this.vuex_member.id,
- }
- try {
- this.$http.estateRepairList(data).then(res => {
- let data = res.data.data
- let records = data.records
- let length = records.length
- mescroll.endBySize(length, data.total);
- if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
- this.list = this.list.concat(records); //追加新数据
- });
- } catch (e) {
- mescroll.endErr();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|