| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { Component } from 'react'; |
| | | import { View, Text,Image } from '@tarojs/components'; |
| | | import { Component,useState, useEffect } from 'react'; |
| | | import { View, Text, Image } from '@tarojs/components'; |
| | | import './index.less'; |
| | | import { createPage } from '../../../utils/page'; |
| | | import { checkOtp } from '../../../utils/tools'; |
| | | import { CDN } from '../../../constants/api'; |
| | | import icon from '../../assets/Subtract.png' |
| | | import close from '../../assets/close.png' |
| | | |
| | | // @ts-ignore |
| | | @createPage() |
| | | export default class Toolbox extends Component { |
| | | $app: any = Taro.getApp().$app; |
| | | state={ |
| | | couponStatus: [{label:'全部',value:'1'},{label:'未使用',value:'2'},{label:'已使用',value:'3'},{label:'已失效',value:'4'}], |
| | | activeStatus:'1', |
| | | couponList:[{ |
| | | id:'1', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'2', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'3', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'4', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'5', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'6', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | },{ |
| | | id:'7', |
| | | name:'优惠券名称', |
| | | time:'2026-03-04 12:12:01', |
| | | price:'20' |
| | | }] |
| | | state = { |
| | | couponStatus: [{ label: '全部', value: '1' }, { label: '未使用', value: '2' }, { label: '已使用', value: '3' }, { label: '已失效', value: '4' }], |
| | | activeStatus: '1', |
| | | couponList: [ |
| | | { |
| | | id: '1', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '2', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '3', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '4', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '5', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '6', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }, { |
| | | id: '7', |
| | | name: '优惠券名称', |
| | | time: '2026-03-04 12:12:01', |
| | | price: '20' |
| | | }], |
| | | animationData: null, |
| | | visible: false |
| | | } |
| | | |
| | | |
| | | componentDidShow() { |
| | | this.$app.xpReportShow(); |
| | |
| | | componentDidHide() { |
| | | this.$app.xpReportHide(); |
| | | } |
| | | changeStatus(value){ |
| | | console.log('111111111',value) |
| | | changeStatus(value) { |
| | | console.log('111111111', value) |
| | | this.setState({ |
| | | activeStatus:value |
| | | activeStatus: value |
| | | }) |
| | | } |
| | | openPopup(){ |
| | | const animation = Taro.createAnimation({ |
| | | duration: 300, |
| | | timingFunction: 'ease-out' |
| | | }); |
| | | animation.translateY(0).step(); |
| | | this.setState({ |
| | | animationData: animation.export(), |
| | | visible:true |
| | | }) |
| | | } |
| | | closePopup(){ |
| | | const animation = Taro.createAnimation({ |
| | | duration: 300, |
| | | timingFunction: 'ease-in' |
| | | }); |
| | | animation.translateY(500).step(); |
| | | this.setState({ |
| | | animationData: animation.export(), |
| | | visible:false |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const {couponStatus,activeStatus,couponList} = this.state; |
| | | const { couponStatus, activeStatus, couponList,animationData,visible } = this.state; |
| | | return ( |
| | | <View className='coupon-page'> |
| | | <View className='tab-card'> |
| | | {couponStatus.map((item,index)=>{ |
| | | return <View className={`tab-item ${activeStatus === item.value ? 'active-status' : ''}`} key={item.value || index} onClick={()=>this.changeStatus(item.value)}>{item.label}</View> |
| | | {couponStatus.map((item, index) => { |
| | | return <View className={`tab-item ${activeStatus === item.value ? 'active-status' : ''}`} key={item.value || index} onClick={() => this.changeStatus(item.value)}>{item.label}</View> |
| | | })} |
| | | </View> |
| | | <View className='coupon-card'> |
| | | {couponList.map((item,index)=>{ |
| | | return <View className='coupon-item' key={item.id||index}> |
| | | {couponList.map((item, index) => { |
| | | return <View className='coupon-item' key={item.id || index}> |
| | | |
| | | <View className='coupon-price'> |
| | | <Text className='price'>{item.price}</Text> |
| | |
| | | <View className='coupon-info'> |
| | | <Text className='name'>{item.name}</Text> |
| | | <Text className='time'>{item.time}到期</Text> |
| | | <View className='more'> |
| | | <View className='more' onClick={()=>this.openPopup(item)}> |
| | | <Text className='more-detail'>查看详情</Text> |
| | | <Image className='more-img' src={icon}></Image> |
| | | </View> |
| | |
| | | </View> |
| | | })} |
| | | </View> |
| | | |
| | | {/* 优惠券说明 */} |
| | | {visible && <View className='privacy-popup' catchMove> |
| | | <View className='privacy-mask'></View> |
| | | <View className='privacy-content' animation={animationData}> |
| | | {/* 头部:标题 + 关闭*/} |
| | | <View className='privacy-header'> |
| | | <Text className='title'>优惠券说明</Text> |
| | | <Image className='close' src={close} onClick={()=>this.closePopup()}></Image> |
| | | </View> |
| | | {/* 内容文案 */} |
| | | <View className='remark-card'> |
| | | <Text className='remark-label'>有效时间</Text> |
| | | <Text className='remark-value'>2025-12-16 失效</Text> |
| | | </View> |
| | | <View className='remark-card'> |
| | | <Text className='remark-label'>使用时段</Text> |
| | | <Text className='remark-value'>运营时间内可用</Text> |
| | | </View> |
| | | <View className='remark-card'> |
| | | <Text className='remark-label'>使用地区</Text> |
| | | <Text className='remark-value'> 广州、武汉</Text> |
| | | </View> |
| | | <View className='remark-card'> |
| | | <Text className='remark-label'>使用说明</Text> |
| | | <Text className='remark-value'>小鹏Robotaxi用户专享,领取后7天有效 适用于小鹏Robotaxi设定运营区内使用 如有疑问请联系:400-xxx-xxxxxx</Text> |
| | | </View> |
| | | |
| | | </View> |
| | | </View> |
| | | } |
| | | |
| | | </View> |
| | | )} |
| | | ) |
| | | } |
| | | } |