From fcf65c73528367acb4d2a3406501812a5392fe4b Mon Sep 17 00:00:00 2001 From: Ankkaya Date: Wed, 19 Jun 2024 18:15:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=86=E5=8F=91=E7=A7=AF=E5=88=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/point/share.vue | 37 +++++++++++++++++++------------------ peach/api/pay/point.js | 4 ++++ 2 files changed, 23 insertions(+), 18 deletions(-) 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) {}