无关风月
3 天以前 d2b9ce5ceb7059dfa06e9281661c8c9516686dd0
cloud-server-management/src/main/webapp/static/modular/system/tHuiminCard/tHuiminCard2.js
@@ -3,43 +3,49 @@
    data() {
        return {
            query: {
                name: '',
                type: '',
                huiMinName: '',
                huiMinType: '',
                dateRange: [],
                status: ''
                status: '',
                huiMinStatus: '',
            },
            loading: false,
            currentPage: 1,
            pageSize: 10,
            total: 800,
            ids: [],
            tableData: [
            ]
            tableData: []
        }
    },
    methods: {
        handleSearch() {
            console.log('搜索条件:', this.query)
            // 修复方案:使用箭头函数 + 字段校验
            this.loading = true;
            const vm = this; // 保留Vue实例引用
            let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/list",
                (data) => { // 改用箭头函数
                    console.log('原始数据:', data);
                    if(data.rows && Array.isArray(data.rows)){
                    this.loading = false;
                    if (data.rows && Array.isArray(data.rows)) {
                        vm.tableData = data.rows;
                        vm.total = data.total;
                    }else{
                    } else {
                        vm.tableData = [];
                        vm.total = 0;
                    }
                },
                (data) => {
                    this.loading = false;
                    Feng.error("搜索失败: " + (data.responseJSON?.message || '服务器异常')); // 错误提示优化
                });
            console.log('请求参数222:', this.query.dateRange)
            // 添加请求参数
            ajax.set({
                pageNum: this.currentPage,
                pageSize: this.pageSize,
                current: this.currentPage,
                size: this.pageSize,
                startTime: this.query.dateRange != null && this.query.dateRange.length > 0 ? this.query.dateRange[0] : null,
                endTime: this.query.dateRange != null && this.query.dateRange.length > 0 ? this.query.dateRange[1] : null,
                ...this.query
            });
            ajax.start();
@@ -49,11 +55,11 @@
            THuiminCard.openAddTHuiminCard();
        },
        handleEdit(id) {
            if (this.ids.length === 0){
            if (this.ids.length === 0) {
                Feng.info('请选择要操作的数据')
                return
            }
            if (this.ids.length > 1){
            if (this.ids.length > 1) {
                Feng.info('请选择一条数据')
                return
            }
@@ -62,27 +68,28 @@
        handleDelete() {
            // 删除逻辑
            console.log(this.ids)
            if (this.ids.length === 0){
            if (this.ids.length === 0) {
                Feng.info('请选择要操作的数据')
                return
            }
            const mv = this
            this.ids.forEach(id => {
                const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/delete", function (data) {
                    Feng.success("操作成功!");
                    mv.handleSearch();
                }, function (data) {
                    Feng.error("操作失败!" + data.responseJSON.message + "!");
                });
                ajax.set("ids",mv.ids.join(","));
                ajax.start();
            })
            Feng.confirm("确定要删除该玩湃惠民卡吗?", () => {
                this.ids.forEach(id => {
                    const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/delete", function (data) {
                        Feng.success("操作成功!");
                        mv.handleSearch();
                    }, function (data) {
                        Feng.error("操作失败!" + data.responseJSON.message + "!");
                    });
                    ajax.set("ids",mv.ids.join(","));
                    ajax.start();
                })
            });
        },
        handleShelves(status) {
            // 上架逻辑
            console.log(this.ids)
            if (this.ids.length === 0){
            if (this.ids.length === 0) {
                Feng.info('请选择要操作的数据')
                return
            }
@@ -95,8 +102,8 @@
                }, function (data) {
                    Feng.error("操作失败!" + data.responseJSON.message + "!");
                });
                ajax.set("id",id);
                ajax.set("status",status);
                ajax.set("id", id);
                ajax.set("status", status);
                ajax.start();
@@ -108,9 +115,11 @@
        },
        handleSizeChange(val) {
            this.pageSize = val
            this.handleSearch()
        },
        handleCurrentChange(val) {
            this.currentPage = val
            this.handleSearch()
        },
        handleSelectionChange(selection) {
            // 多选处理
@@ -118,26 +127,116 @@
            this.ids = selection.map(item => item.id)
        },
        handleViewDetail(row) {
            if (this.ids.length === 0 && !row){
            if (this.ids.length === 0 && !row) {
                Feng.info('请选择要操作的数据')
                return
            }
            if (this.ids.length > 1 && !row){
            if (this.ids.length > 1 && !row) {
                Feng.info('请选择一条数据')
                return
            }
            // 查看详情
            let id;
            if (row){
            if (row) {
                id = row.id
            }else {
            } else {
                id = this.ids[0]
            }
            THuiminCard.openTHuiminCardDetail(id,'detail')
            THuiminCard.openTHuiminCardDetail(id, 'detail')
        },
        addOrder() {
            THuiminCard.addOrder()
        }
    },
    created() {
        // 初始化逻辑
        this.handleSearch()
    }
});
});
var THuiminCardInfo = {
    goodsPicArray: [],
    tCarInfoData: {},
    validateFields: {}
};
THuiminCardInfo.close = function () {
    parent.layer.close(window.parent.THuiminCard.layerIndex);
}
THuiminCardInfo.checkUser = function (e) {
    console.log("用户手机号")
    console.log(e)
    var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/checkUser", function (data) {
        if (data == 500) {
            $("#userList").empty()
            Feng.error("操作失败,当前用户未注册")
            return;
        } else if (data == 501) {
            $("#userList").empty()
            Feng.error("操作失败,当前用户未添加人员信息")
            return;
        } else {
            var content = '<option value="">选择人员</option>';
            $.each(data, function (k, v) {
                content += "<option value='" + v.id + "'>" + v.name + "</option>";
            });
            $("#userList").empty().append(content);
            $("#shopId").empty();
            $("#cards").empty();
        }
    });
    ajax.set("phone", phone);
    ajax.start();
}
THuiminCardInfo.getStores = function (e) {
    var operatorId = $(e).val();
    var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/getStores", function (data) {
        if (data != null) {
            var content = '<option value="">选择门店</option>';
            $.each(data, function (k, v) {
                content += "<option value='" + v.id + "'>" + v.name + "</option>";
            });
            $("#shopId").empty().append(content);
            $("#cards").empty()
        }
    });
    ajax.set("operatorId", operatorId);
    ajax.start();
}
THuiminCardInfo.getCards = function (e) {
    var operatorId = $(e).val();
    var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/getCards", function (data) {
        if (data != null) {
            var content = '<option value="">选择玩湃惠民卡</option>';
            $.each(data, function (k, v) {
                content += "<option value='" + v.id + "'>" + v.name + "</option>";
            });
            $("#cards").empty().append(content);
        }
    });
    ajax.set("storeId", operatorId);
    ajax.start();
}
THuiminCardInfo.addSubmit = function () {
    let cardId = $("#cards").val()
    if (cardId == "") {
        Feng.info("请选择惠民卡")
        return;
    }
    let user = $("#user").val()
    if (user == "") {
        Feng.info("请选择绑定人员信息")
        return;
    }
    var operatorId = $(e).val();
    var ajax = new $ax(Feng.ctxPath + "/tHuiminCard/addPayHuiMing", function (data) {
        if (data != null) {
            var content = '<option value="">选择玩湃惠民卡</option>';
            $.each(data, function (k, v) {
                content += "<option value='" + v.id + "'>" + v.name + "</option>";
            });
            $("#cards").empty().append(content);
        }
    });
    ajax.set("studentId", user);
    ajax.set("cardId", cardId);
    ajax.start();
}