diff --git a/pages/user/point/share.vue b/pages/user/point/share.vue index 942a0c3..7b09fc8 100644 --- a/pages/user/point/share.vue +++ b/pages/user/point/share.vue @@ -111,33 +111,36 @@ function inputUserFunc() { } async function confirmShare() { - if (!state.value.pointParams.memberId) { - peach.$helper.toast('请选择要赠送的用户') - return - } - if (!state.value.pointParams.point) { + let user = state.value.userList.find((item) => item.point) + + if (!user) { peach.$helper.toast('请输入要赠送的积分') return } + + state.value.pointParams.memberId = user.id + state.value.pointParams.point = user.point + await PointApi.sendPoint(state.value.pointParams) - uni.showToast({ - title: '赠送成功', - icon: 'none', - success: () => { - state.value.inputData = '' - getUserList() - }, - }) + state.value.inputData = '' + state.value.userList = [] + state.value.pointParams = { + memberId: '', + point: '', + } } function inputPointFunc(data) { state.value.userList.forEach((item) => { - if (data.id !== item.id) item.point = '' + console.log(data.id !== item.id) + if (data.id !== item.id) { + item.point = '' + } }) - state.value.pointParams.memberId = data.id - state.value.pointParams.point = data.point + // state.value.pointParams.memberId = data.id + // state.value.pointParams.point = data.point } async function getUserList() { @@ -162,8 +165,6 @@ async function getUserList() { }) state.value.userList = data.list } - -function onProtocol(title) {}