|
|
|
@ -33,10 +33,9 @@ export default function UserExchangeModal({ isOpen, setIsOpen }: Props) { |
|
|
|
|
|
|
|
|
|
//唤起扫码
|
|
|
|
|
const handleScanCode = () => { |
|
|
|
|
console.log('唤起扫码') |
|
|
|
|
Taro.scanCode({ |
|
|
|
|
success: (res: any) => { |
|
|
|
|
console.log(res.path.slice(-8)) |
|
|
|
|
console.log('唤起扫码:',res,res.path) |
|
|
|
|
if(!Taro.getStorageSync('UserToken')){ |
|
|
|
|
setisLoginOpen(true) |
|
|
|
|
setuserScene(res.path.slice(-8)) |
|
|
|
@ -89,12 +88,13 @@ export default function UserExchangeModal({ isOpen, setIsOpen }: Props) { |
|
|
|
|
change_code: inputValue |
|
|
|
|
}, |
|
|
|
|
success: (res: any) => { |
|
|
|
|
console.log('兑换成功=>', res.data) |
|
|
|
|
if(res.data.state === '200'){ |
|
|
|
|
const list = res.data.data.Subscribed |
|
|
|
|
console.log('兑换成功=>', list) |
|
|
|
|
setPrdtNames(list.map((e: any) => e.PrdtTitle).join(';')) |
|
|
|
|
setPrdtList(list) |
|
|
|
|
setIsOpen(false) |
|
|
|
|
setisUserExchangeSuccessModalOpen(true) |
|
|
|
|
}else if(res.data.state === '207'){ |
|
|
|
|
Taro.showToast({ |
|
|
|
|
title: '兑换码已使用', |
|
|
|
@ -115,50 +115,51 @@ export default function UserExchangeModal({ isOpen, setIsOpen }: Props) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!isOpen){ |
|
|
|
|
return null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<View |
|
|
|
|
className='exchange_mask' |
|
|
|
|
onClick={() => setIsOpen(false)} |
|
|
|
|
></View> |
|
|
|
|
<View className='exchange_modal'> |
|
|
|
|
<View className='exchange_header'> |
|
|
|
|
<View className='exchange_title'>兑换码</View> |
|
|
|
|
{ |
|
|
|
|
isOpen && ( |
|
|
|
|
<View> |
|
|
|
|
<View |
|
|
|
|
className='exchange_close' |
|
|
|
|
className='exchange_mask' |
|
|
|
|
onClick={() => setIsOpen(false)} |
|
|
|
|
></View> |
|
|
|
|
<View className='exchange_modal'> |
|
|
|
|
<View className='exchange_header'> |
|
|
|
|
<View className='exchange_title'>兑换码</View> |
|
|
|
|
<View |
|
|
|
|
className='exchange_close' |
|
|
|
|
onClick={() => setIsOpen(false)} |
|
|
|
|
></View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
className='exchange_scan' |
|
|
|
|
onClick={handleScanCode} |
|
|
|
|
></View> |
|
|
|
|
<Input |
|
|
|
|
className='exchange_input' |
|
|
|
|
placeholder='请输入兑换码兑换商品' |
|
|
|
|
value={inputValue} |
|
|
|
|
onInput={(e) => setinputValue(e.detail.value)} |
|
|
|
|
></Input> |
|
|
|
|
<View |
|
|
|
|
className='exchange_exchange' |
|
|
|
|
onClick={handleExchange} |
|
|
|
|
> |
|
|
|
|
<Text className='exchange_exchange_text'>兑换</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
<GetPhoneNumber |
|
|
|
|
onClose={setisGetUsePhone} |
|
|
|
|
scene={userScene} |
|
|
|
|
modalVisible={isLoginOpen} |
|
|
|
|
onModalClose={() => setisLoginOpen(false)} |
|
|
|
|
></GetPhoneNumber> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
className='exchange_scan' |
|
|
|
|
onClick={handleScanCode} |
|
|
|
|
></View> |
|
|
|
|
<Input |
|
|
|
|
className='exchange_input' |
|
|
|
|
placeholder='请输入兑换码兑换商品' |
|
|
|
|
value={inputValue} |
|
|
|
|
onInput={(e) => setinputValue(e.detail.value)} |
|
|
|
|
></Input> |
|
|
|
|
<View |
|
|
|
|
className='exchange_exchange' |
|
|
|
|
onClick={handleExchange} |
|
|
|
|
> |
|
|
|
|
<Text className='exchange_exchange_text'>兑换</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<UserExchangeSuccessModal prdtList={prdtList} prdtNames={prdtNames} isOpen={isUserExchangeSuccessModalOpen} setIsOpen={setisUserExchangeSuccessModalOpen}></UserExchangeSuccessModal> |
|
|
|
|
|
|
|
|
|
<GetPhoneNumber |
|
|
|
|
onClose={setisGetUsePhone} |
|
|
|
|
scene={userScene} |
|
|
|
|
modalVisible={isLoginOpen} |
|
|
|
|
onModalClose={() => setisLoginOpen(false)} |
|
|
|
|
></GetPhoneNumber> |
|
|
|
|
</> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|