import Api from "../../../../model/api"; import {getDataSet, getEventParam, throttle, toast} from "../../../../utils/utils"; Component({ properties: { show: { type: Boolean, value: false }, scoreInfos: Array, item: Object, }, data: { radio: null, }, methods: { onClickHide(e) { this.setData({ show: false }) }, onChange(e) { this.setData({ radio: getEventParam(e), }); }, onClick(e) { const name = getDataSet(e, "name"); this.setData({ radio: name, }); }, pay: throttle(async function (e) { if (this.data.radio == null) { toast("请选择使用其中一个项目积分进行兑换") return; } const res = await Api.useScore({ educationStuId: this.data.scoreInfos[this.data.radio].stuId, integralCourseId: this.data.item.id }, true) toast(res.msg) this.setData({ show: false }) this.triggerEvent("pay") }) } });