|
|
@ -35,18 +35,15 @@ const Activities = ({ |
|
|
const receive = async (activity) => { |
|
|
const receive = async (activity) => { |
|
|
setReceiving(true); |
|
|
setReceiving(true); |
|
|
try { |
|
|
try { |
|
|
const { code, data, msg } = await post( |
|
|
|
|
|
"/api/ar/v1/applet/CouponReceive", |
|
|
|
|
|
{ |
|
|
|
|
|
activityCode: activity.code, |
|
|
|
|
|
memberID, |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
const { code, msg } = await post("/api/ar/v1/applet/CouponReceive", { |
|
|
|
|
|
activityCode: activity.code, |
|
|
|
|
|
memberID, |
|
|
|
|
|
}); |
|
|
window.weui.toast(msg, { |
|
|
window.weui.toast(msg, { |
|
|
className: "toast", |
|
|
className: "toast", |
|
|
}); |
|
|
}); |
|
|
if (code === 200) { |
|
|
|
|
|
activity.isReceived = true; |
|
|
|
|
|
|
|
|
if (code !== 200) { |
|
|
|
|
|
activity.isAllReceived = true; |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.warn(error); |
|
|
console.warn(error); |
|
|
@ -121,10 +118,10 @@ const Activities = ({ |
|
|
<div className="meta">活动奖励</div> |
|
|
<div className="meta">活动奖励</div> |
|
|
<div |
|
|
<div |
|
|
onClick={() => |
|
|
onClick={() => |
|
|
!activity.isReceived && !receiving && receive(activity) |
|
|
|
|
|
|
|
|
!activity.isAllReceived && !receiving && receive(activity) |
|
|
} |
|
|
} |
|
|
className={`btn ${ |
|
|
className={`btn ${ |
|
|
activity.isReceived || receiving ? "disabled" : "" |
|
|
|
|
|
|
|
|
activity.isAllReceived || receiving ? "disabled" : "" |
|
|
}`}
|
|
|
}`}
|
|
|
> |
|
|
> |
|
|
领取奖励 |
|
|
领取奖励 |
|
|
|