yujialong 3 weeks ago
parent a2b654185b
commit ced9509552
  1. 9
      src/components/goToMemberModal/index.less
  2. 7
      src/components/goToStoreModal/index.less
  3. 12
      src/pages/Customer/index.tsx
  4. 50
      src/pages/Subscribe/index.tsx
  5. 255
      src/pages/UserHome/UserSubscribe/index.less
  6. 63
      src/pages/UserHome/UserSubscribe/index.tsx
  7. 8
      src/pages/UserHome/index.tsx

@ -8,13 +8,15 @@
border-radius: 1rem;
display: flex;
flex-direction: column;
padding: 0 .5rem .8rem;
padding: 1rem .5rem;
z-index: 1000;
.store_modal_close {
position: absolute;
top: 1rem;
right: 1rem;
width: 1.5rem;
height: 1.5rem;
margin: .5rem 1rem auto auto;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/close.png);
background-repeat: no-repeat;
background-size: cover;
@ -30,11 +32,10 @@
font-size: .875rem;
font-weight: 600;
text-align: center;
margin: .5rem 0 .8rem;
margin: .8rem 0;
}
.store_modal_container {
width: 10rem;
height: 2rem;
display: flex;

@ -8,13 +8,15 @@
border-radius: 1rem;
display: flex;
flex-direction: column;
padding: 0 .5rem .8rem;
padding: 1rem .5rem;
z-index: 1000;
.store_modal_close {
position: absolute;
top: 1rem;
right: 1rem;
width: 1.5rem;
height: 1.5rem;
margin: .5rem 1rem auto auto;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/close.png);
background-repeat: no-repeat;
background-size: cover;
@ -34,7 +36,6 @@
}
.store_modal_container {
width: 10rem;
height: 2rem;
display: flex;

@ -18,24 +18,12 @@ export default function Customer() {
}
})
const handleLongPress = () => {
Taro.scanCode({
success: (res) => {
console.log(44, res)
},
fail: () => {
},
})
}
return (
<Image
src='https://oss.jm-kid.com/wx_5colorflower/icons/customer.svg'
className='pic'
mode='aspectFill'
show-menu-by-longpress
onLongPress={handleLongPress}
></Image>
)
}

@ -6,6 +6,7 @@ import PopupHalfScreen from '../../components/Popup'
import DefaultPage1 from '../../components/defaultPage1'
import GetPhoneNumber from '../../components/getPhoneModal'
import GoToStoreModal from '../../components/goToStoreModal'
import UserExchangeSuccessModal from '../../components/UserExchangeSuccessModal'
import Gift from '../../components/gift'
import './index.less'
@ -369,6 +370,18 @@ export default function Subscribe() {
const [userScene, setuserScene] = useState<any>(null)
// 兑换成功弹窗
const [isUserExchangeSuccessModalOpen, setisUserExchangeSuccessModalOpen] = useState(false)
// 兑换接口返回的state
const [exchangeState, setExchangeState] = useState('')
// 兑换成功的商品名称字符串
const [prdtNames, setPrdtNames] = useState('')
// 兑换成功的商品名称数组
const [prdtList, setPrdtList] = useState([])
//唤起扫码
const handleScanCode = () => {
console.log('唤起扫码')
@ -390,39 +403,22 @@ export default function Subscribe() {
change_code: res.path.slice(-8)
},
success: (s_res: any) => {
console.log('兑换成功=>', s_res.data)
if(s_res.data.state === '200'){
let modalContent = ''
s_res.data.data.Subscribed.forEach(element => {
modalContent += `兑换成功: ${element.PrdtTitle}\n`
})
Taro.showModal({
title: '兑换成功',
content: modalContent,
showCancel: true,
success: (modal_res) => {
if (modal_res.confirm) {
console.log('用户点击确定')
requestUserSubscribe()
} else if (modal_res.cancel) {
console.log('用户点击取消')
}
}
})
}else if(s_res.data.state === '207'){
Taro.showToast({
title: '兑换码已使用',
icon: 'error'
})
const { state, data } = s_res.data
setExchangeState(state)
// 有返回商品名称,则显示;否则只显示提示语
if(data && data.Subscribed){
const list = data.Subscribed
setPrdtNames(list.map((e: any) => e.PrdtTitle).join(';'))
setPrdtList(list)
}
requestUserSubscribe()
setisUserExchangeSuccessModalOpen(true)
},
fail: (err: any) => {
console.log('兑换失败=>', err)
}
})
}
}
})
}
@ -714,6 +710,8 @@ export default function Subscribe() {
type={1}
setmallLink={(link: string) => {}}
></GoToStoreModal>
<UserExchangeSuccessModal exchangeState={exchangeState} prdtList={prdtList} prdtNames={prdtNames} isOpen={isUserExchangeSuccessModalOpen} setIsOpen={setisUserExchangeSuccessModalOpen}></UserExchangeSuccessModal>
</View>
)
}

@ -11,11 +11,11 @@
margin-bottom: 1rem;
.subscribe_header_input {
width: calc(100% - 2.5rem - 2rem);
width: calc(100% - 2.5rem - 4rem);
height: 2.5rem;
background: #f8f8f8;
border-radius: 2.25rem;
padding-left: 1rem;
padding-left: 3rem;
border: .0625rem solid green;
}
@ -90,161 +90,152 @@
}
}
.subscribe_scrollview {
height: 100vh;
background: #fafafa;
.subscribe_item {
display: flex;
padding: .7rem;
flex-direction: column;
background: #ffffff;
border-radius: 1rem;
gap: 1rem;
margin-bottom: 1rem;
.subscribe_item {
width: calc(100% - 2rem);
height: auto;
.item_header {
width: 100%;
height: 1.5rem;
display: flex;
padding: .7rem;
flex-direction: column;
background: #ffffff;
border-radius: 1rem;
gap: 1rem;
margin-bottom: 1rem;
flex-direction: row;
margin: auto;
.item_header {
width: 100%;
.item_header_addtime_icon {
width: 1.5rem;
height: 1.5rem;
margin: auto 0 auto 0;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/subscribeListHeaderIcon.png);
background-repeat: no-repeat;
background-size: cover;
}
.item_header_addtime_text {
width: auto;
font-size: .7rem;
color: rgba(0, 0, 0, .6);
margin: auto auto auto .25rem;
}
.item_header_icon {
width: 3.8rem;
height: 1.6rem;
border-radius: 1.5rem;
display: flex;
flex-direction: row;
margin: auto;
.item_header_addtime_icon {
width: 1.5rem;
height: 1.5rem;
margin: auto 0 auto 0;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/subscribeListHeaderIcon.png);
background-repeat: no-repeat;
background-size: cover;
}
.item_header_addtime_text {
width: auto;
font-size: .7rem;
color: rgba(0, 0, 0, .6);
margin: auto auto auto .25rem;
.item_header_icon_text {
font-size: .875rem;
font-weight: 600;
margin: auto;
text-align: center;
}
}
}
.item_header_icon {
width: 3.8rem;
height: 1.6rem;
border-radius: 1.5rem;
display: flex;
.item_content {
width: 100%;
height: auto;
background: #ffffff;
display: flex;
flex-direction: row;
.item_header_icon_text {
font-size: .875rem;
font-weight: 600;
margin: auto;
text-align: center;
.content_container0 {
width: 7rem;
height: auto;
.aspect_ratio_flex_container0 {
position: relative;
width: 100%; /* 或者任意宽度 */
padding-top: calc((1 / 1) * 100%); /* 计算高度以保持16:9比例 */
.item_content_image0 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; /* 使内容填充整个容器 */
width: 100%;
height: 100%;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/subscribeListHeaderIcon.png);
background-repeat: no-repeat;
background-size: cover;
}
}
}
.item_content {
width: 100%;
.content_container1 {
width: 10.75rem;
height: auto;
background: #ffffff;
display: flex;
flex-direction: row;
.content_container0 {
width: 7rem;
height: auto;
.aspect_ratio_flex_container0 {
position: relative;
width: 100%; /* 或者任意宽度 */
padding-top: calc((1 / 1) * 100%); /* 计算高度以保持16:9比例 */
.item_content_image0 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; /* 使内容填充整个容器 */
width: 100%;
height: 100%;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/subscribeListHeaderIcon.png);
background-repeat: no-repeat;
background-size: cover;
}
}
}
.content_container1 {
width: 10.75rem;
height: auto;
.aspect_ratio_flex_container1 {
position: relative;
width: 100%; /* 或者任意宽度 */
padding-top: calc((9 / 16) * 100%); /* 计算高度以保持16:9比例 */
.shade {
position: absolute;
top: 0;
left: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .4);
z-index: 10;
display: flex;
border-radius: .75rem;
.shade_context {
color: #ffffff;
font-size: 1.125rem;
margin: auto;
}
.aspect_ratio_flex_container1 {
position: relative;
width: 100%; /* 或者任意宽度 */
padding-top: calc((9 / 16) * 100%); /* 计算高度以保持16:9比例 */
.shade {
position: absolute;
top: 0;
left: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .4);
z-index: 10;
display: flex;
border-radius: .75rem;
.shade_context {
color: #ffffff;
font-size: 1.125rem;
margin: auto;
}
}
.item_content_image1 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; /* 使内容填充整个容器 */
width: 100%;
height: 100%;
border-radius: .75rem;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/《屁》.png);
background-repeat: no-repeat;
background-size: cover;
z-index: 9;
}
.item_content_image1 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; /* 使内容填充整个容器 */
width: 100%;
height: 100%;
border-radius: .75rem;
background-image: url(https://oss.jm-kid.com/wx_5colorflower/《屁》.png);
background-repeat: no-repeat;
background-size: cover;
z-index: 9;
}
}
}
.item_content_container {
display: flex;
flex-direction: column;
margin-left: auto;
.item_content_container {
display: flex;
flex-direction: column;
margin-left: auto;
.item_content_title {
width: auto;
font-size: 1rem;
font-weight: 600;
margin: auto auto .25rem 0;
}
.item_content_title {
width: auto;
font-size: 1rem;
font-weight: 600;
margin: auto auto .25rem 0;
}
.item_content_endtime {
width: auto;
font-size: .8rem;
color: rgba(0, 0, 0, .4);
margin: 0 auto auto 0;
}
.item_content_endtime {
width: auto;
font-size: .8rem;
color: rgba(0, 0, 0, .4);
margin: 0 auto auto 0;
}
.item_content_btn {
font-size: .85rem;
color: #3BA366;
}
.item_content_btn {
font-size: .85rem;
color: #3BA366;
}
}
}

@ -3,6 +3,7 @@ import React, { useState, useEffect } from 'react'
import Taro, { useShareAppMessage, useShareTimeline } from '@tarojs/taro'
import DefaultPage2 from '../../../components/defaultPage2'
import PopupHalfScreen from '../../../components/Popup'
import UserExchangeSuccessModal from '../../../components/UserExchangeSuccessModal'
import './index.less'
interface subscribeProps {
@ -45,6 +46,53 @@ export default function UserSubscribe() {
//记录用户筛选状态
const [isFilter, setisFilter] = useState(null)
// 兑换成功弹窗
const [isUserExchangeSuccessModalOpen, setisUserExchangeSuccessModalOpen] = useState(false)
// 兑换接口返回的state
const [exchangeState, setExchangeState] = useState('')
// 兑换成功的商品名称字符串
const [prdtNames, setPrdtNames] = useState('')
// 兑换成功的商品名称数组
const [prdtList, setPrdtList] = useState([])
//唤起扫码
const handleScanCode = () => {
console.log('唤起扫码')
Taro.scanCode({
success: (res: any) => {
Taro.request({
url: 'https://interapi.jm-kid.com/api/product/exchange',
method: 'POST',
header: {
authorization: `bearer ${Taro.getStorageSync('UserToken')}`
},
data: {
timestamp: Date.now(),
change_code: res.path.slice(-8)
},
success: (s_res: any) => {
const { state, data } = s_res.data
setExchangeState(state)
// 有返回商品名称,则显示;否则只显示提示语
if(data && data.Subscribed){
const list = data.Subscribed
setPrdtNames(list.map((e: any) => e.PrdtTitle).join(';'))
setPrdtList(list)
}
setisUserExchangeSuccessModalOpen(true)
getList()
},
fail: (err: any) => {
console.log('兑换失败=>', err)
}
})
}
})
}
const getList = () => {
let data = {
timestamp: Date.now(),
@ -123,6 +171,11 @@ export default function UserSubscribe() {
className='subscribe_header_dressing'
onClick={() => setisPopupOpen(!isPopupOpen)}
></View>
<Image
className='subscribe_header_scanCodeBtn'
src='https://oss.jm-kid.com/wx_5colorflower/scanCodeIcon.svg'
onClick={handleScanCode}
></Image>
</View>
<PopupHalfScreen
@ -132,11 +185,7 @@ export default function UserSubscribe() {
onFilter={setisFilter}
></PopupHalfScreen>
<ScrollView
scrollY
scrollWithAnimation
className='subscribe_scrollview'
>
<View>
{
userSubuscribed && userSubuscribed.length > 0 && userSubuscribed.map((item: any, index: number) => (
<View
@ -195,7 +244,9 @@ export default function UserSubscribe() {
userSubuscribed && userSubuscribed.length === 0 &&
<DefaultPage2></DefaultPage2>
}
</ScrollView>
</View>
<UserExchangeSuccessModal exchangeState={exchangeState} prdtList={prdtList} prdtNames={prdtNames} isOpen={isUserExchangeSuccessModalOpen} setIsOpen={setisUserExchangeSuccessModalOpen}></UserExchangeSuccessModal>
</View>
)
}

@ -127,10 +127,16 @@ export default function UserHome() {
list[1].des = state === -1 ? '已过期' : state === 1 ? '已开通' : '未开通' // -1 已过期 1 已开通 0 未开通
list[6].des = data.Message.UnreadCount || ''
setOperationList([...list])
console.log(44,operationList )
}
},
})
} else {
const list = operationList
list[0].des = ''
list[1].des = ''
list[6].des = ''
setOperationList([...list])
setisLoginOpen(true)
}
})

Loading…
Cancel
Save