update
parent
82a04ee96f
commit
6ae387165b
|
|
@ -58,7 +58,8 @@ export function getUserCardList(params = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function homeCouponList (params = {}) {
|
export function homeCouponList (params = {}) {
|
||||||
return req.get('/getCardList', params)
|
// return req.get('/getCardList', params)
|
||||||
|
return req.get('/getRedeemDiscountCardList', params) //积分兑换优惠券列表
|
||||||
}
|
}
|
||||||
|
|
||||||
export function homeCouponGet (params = {}) {
|
export function homeCouponGet (params = {}) {
|
||||||
|
|
@ -66,7 +67,8 @@ export function homeCouponGet(params = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCardDetail (params = {}) {
|
export function getCardDetail (params = {}) {
|
||||||
return req.get('/user/getCardDetail', params)
|
// return req.get('/user/getCardDetail', params)
|
||||||
|
return req.get('/user/receiveCardByPoint', params) //积分换优惠券操作
|
||||||
}
|
}
|
||||||
|
|
||||||
export function userUsedCard (params = {}) {
|
export function userUsedCard (params = {}) {
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ const config = {
|
||||||
"getLocation",
|
"getLocation",
|
||||||
"chooseAddress"
|
"chooseAddress"
|
||||||
],
|
],
|
||||||
"__usePrivacyCheck__": true
|
// "__usePrivacyCheck__": true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.TARO_ENV == 'weapp') {
|
if (process.env.TARO_ENV == 'weapp') {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export default class AddressChoose extends Component {
|
||||||
{/* <View className='sp-cell__ft-icon iconfont icon-arrowRight'></View> */}
|
{/* <View className='sp-cell__ft-icon iconfont icon-arrowRight'></View> */}
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View className='address-info__bd'>+请选择收货地址</View>
|
<View className='address-info__bd' onClick={this.clickTo.bind(this, 'choose')}>+请选择收货地址</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const initialState = {
|
||||||
isExpanded: false
|
isExpanded: false
|
||||||
}
|
}
|
||||||
function SpCoupon (props) {
|
function SpCoupon (props) {
|
||||||
const { info, children, onClick = () => {} } = props
|
const { info, children, onClick = () => { }, isNew } = props
|
||||||
const [state, setState] = useImmer(initialState)
|
const [state, setState] = useImmer(initialState)
|
||||||
const { isExpanded } = state
|
const { isExpanded } = state
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
|
@ -34,12 +34,37 @@ function SpCoupon(props) {
|
||||||
description,
|
description,
|
||||||
quantity,
|
quantity,
|
||||||
getNum,
|
getNum,
|
||||||
distributorName
|
distributorName,
|
||||||
|
couponStatus,
|
||||||
|
id,
|
||||||
|
fixedTerm,
|
||||||
|
status,
|
||||||
|
valid,
|
||||||
} = info
|
} = info
|
||||||
|
|
||||||
const { tag, invalidBg, bg } = COUPON_TYPE[cardType]
|
const { tag, invalidBg, bg } = COUPON_TYPE[cardType]
|
||||||
const couponTagBg = info.tagClass === 'used' || info.tagClass === 'overdue' || !info.valid ? invalidBg : bg
|
const couponTagBg = info.tagClass === 'used' || info.tagClass === 'overdue' || !info.valid ? invalidBg : bg
|
||||||
|
|
||||||
|
return (<View className="coupons-list-item" key={`coupon-item__${id}`} style={styleNames({
|
||||||
|
background: `url(${process.env.APP_IMAGE_CDN_NEW}/member/${couponStatus ? couponStatus != 1 ? "quan-hui" : "quan-lan" : info.tagClass === 'used' ? 'quan-hui' : 'quan-lan'}.png) no-repeat`,
|
||||||
|
'background-size': '100% 100%'
|
||||||
|
})}>
|
||||||
|
<View className="coupons-list-item-left">
|
||||||
|
<View className='coupons-list-item-money'><Text className='coupons-list-item-unit'>¥</Text><Text className="coupons-list-item-num">{reduceCost || 0}</Text></View>
|
||||||
|
<View className="coupons-list-item-desc">满{leastCost}可用</View>
|
||||||
|
</View>
|
||||||
|
<View className="coupons-list-item-right">
|
||||||
|
<View className="coupons-list-item-right-box">
|
||||||
|
<View className="coupons-list-item-integral">{title}</View>
|
||||||
|
{/* {item.start_time}至{item.end_time} */}
|
||||||
|
{isNew ? <View className="coupons-list-item-desc">有效日期:领取{fixedTerm}天内有效</View> :
|
||||||
|
<View className="coupons-list-item-desc">有效日期:{beginDate}至{endDate}</View>}
|
||||||
|
</View>
|
||||||
|
{!valid || info.tagClass === 'used' || info.tagClass === 'overdue' ? <View className="coupons-list-item-btn">已{info.tagClass === 'used' ? '使用' : '过期'}</View>
|
||||||
|
: <View className="coupons-list-item-btn" onClick={onClick}>立即{isNew ? '兑换' : '使用'}</View>}
|
||||||
|
</View>
|
||||||
|
</View>)
|
||||||
|
|
||||||
const getCouponValue = () => {
|
const getCouponValue = () => {
|
||||||
if (cardType === 'cash') {
|
if (cardType === 'cash') {
|
||||||
return (
|
return (
|
||||||
|
|
@ -92,8 +117,7 @@ function SpCoupon(props) {
|
||||||
>
|
>
|
||||||
{COUPON_TYPE[cardType].tag}
|
{COUPON_TYPE[cardType].tag}
|
||||||
</View>
|
</View>
|
||||||
<View className='title'>{`${
|
<View className='title'>{`${VERSION_PLATFORM && distributorName ? `${distributorName}: ${title}` : title
|
||||||
VERSION_PLATFORM && distributorName ? `${distributorName}: ${title}` : title
|
|
||||||
}`}</View>
|
}`}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='coupon-datetime'>{`有效期: ${beginDate} - ${endDate}`}</View>
|
<View className='coupon-datetime'>{`有效期: ${beginDate} - ${endDate}`}</View>
|
||||||
|
|
|
||||||
|
|
@ -181,3 +181,80 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.coupons-list {
|
||||||
|
&-item {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
// background: #5b5b5b;
|
||||||
|
// margin-bottom: 30px;
|
||||||
|
display: flex;
|
||||||
|
color: #fff;
|
||||||
|
min-height: 175px;
|
||||||
|
align-items: center;
|
||||||
|
// padding: 50px 0;
|
||||||
|
& .active {
|
||||||
|
background: #163586;
|
||||||
|
}
|
||||||
|
&-left {
|
||||||
|
width: 174px;
|
||||||
|
height: 100%;
|
||||||
|
padding: 55px 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
// border-right: 1px dashed #fff;
|
||||||
|
}
|
||||||
|
&-money {
|
||||||
|
display: flex;
|
||||||
|
font-weight: bold;
|
||||||
|
align-items: baseline;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
&-unit {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
&-num {
|
||||||
|
font-size: 60px;
|
||||||
|
}
|
||||||
|
&-desc {
|
||||||
|
opacity: 0.6;
|
||||||
|
color: #f5f5f5;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
&-right {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 50px 30px 50px 40px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
&-box {
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: 65%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-integral {
|
||||||
|
font-size: 26px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
&-btn {
|
||||||
|
padding: 15px 20px;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1;
|
||||||
|
width: 124px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ function SpGoodsCell (props) {
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='labels-block'>
|
{false && <View className='labels-block'>
|
||||||
{!isNaN(memberPrice) && !VERSION_IN_PURCHASE && (
|
{!isNaN(memberPrice) && !VERSION_IN_PURCHASE && (
|
||||||
<View className='goods-type'>
|
<View className='goods-type'>
|
||||||
{vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name}
|
{vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name}
|
||||||
|
|
@ -126,7 +126,7 @@ function SpGoodsCell (props) {
|
||||||
return <View className='goods-type'>{limitTxt}</View>
|
return <View className='goods-type'>{limitTxt}</View>
|
||||||
})}
|
})}
|
||||||
{/* {limitTxt && <View className='goods-type'>{limitTxt}</View>} */}
|
{/* {limitTxt && <View className='goods-type'>{limitTxt}</View>} */}
|
||||||
</View>
|
</View>}
|
||||||
<View className='item-ft'>
|
<View className='item-ft'>
|
||||||
|
|
||||||
{info.num && <Text className='item-num'>数量:{info.num}</Text>}
|
{info.num && <Text className='item-num'>数量:{info.num}</Text>}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ function SpGoodsItem (props) {
|
||||||
<View className={classNames('sp-goods-item')} onClick={handleClick.bind(this)}>
|
<View className={classNames('sp-goods-item')} onClick={handleClick.bind(this)}>
|
||||||
<View className='goods-item__hd'>
|
<View className='goods-item__hd'>
|
||||||
<SpImage lazyLoad src={selColorItem.item_image_url?.[0] || info.spec_images?.[0]?.item_image_url?.[0] || info.pic} height={height} width={width} mode={"scaleToFill"} />
|
<SpImage lazyLoad src={selColorItem.item_image_url?.[0] || info.spec_images?.[0]?.item_image_url?.[0] || info.pic} height={height} width={width} mode={"scaleToFill"} />
|
||||||
{info.tagList.map((item, index) => <View className="new" style={{ borderColor: item.tag_color, color: item.font_color, left: index === 0 ? '20rpx' : index * 30 + 8 + 'rpx' }} key={index + item.item_id}>{item.tag_name}</View>)}
|
{info.tagList?.map((item, index) => <View className="new" style={{ borderColor: item.tag_color, color: item.font_color, left: index === 0 ? '20rpx' : index * 30 + 8 + 'rpx' }} key={index + item.item_id}>{item.tag_name}</View>)}
|
||||||
{/* <View className="new" style={{ left: '120rpx' }}>NEW</View> */}
|
{/* <View className="new" style={{ left: '120rpx' }}>NEW</View> */}
|
||||||
</View>
|
</View>
|
||||||
{/* {renderBrand && <View className='goods-brand-wrap'>{renderBrand}</View>} */}
|
{/* {renderBrand && <View className='goods-brand-wrap'>{renderBrand}</View>} */}
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,9 @@
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: #c1c1c1;
|
color: #c1c1c1;
|
||||||
}
|
}
|
||||||
.sp-price__symbol,
|
// .sp-price__symbol,
|
||||||
.sp-price__int {
|
// .sp-price__int,
|
||||||
font-weight: bold !important;
|
// .sp-price__decimal {
|
||||||
}
|
// font-weight: bold !important;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime, diffInDays } from '@/utils'
|
||||||
|
|
||||||
export const COUPON_ITEM = {
|
export const COUPON_ITEM = {
|
||||||
title: 'title',
|
title: 'title',
|
||||||
|
|
@ -29,7 +29,21 @@ export const COUPON_ITEM = {
|
||||||
} else {
|
} else {
|
||||||
return valid
|
return valid
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
couponStatus: ({ quantity, get_limit, user_get_num, get_num }) => {
|
||||||
|
if (quantity - get_num <= 0) {
|
||||||
|
return 0 // 已领完
|
||||||
|
} else if (get_limit - user_get_num > 0) {
|
||||||
|
return 1 // 立即领取
|
||||||
|
} else if (get_limit - user_get_num <= 0) {
|
||||||
|
return 2 // 已领取
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// fixedTerm: 'fixed_term',
|
||||||
|
fixedTerm: ({ begin_date, end_date }) => diffInDays(begin_date, end_date),
|
||||||
|
sourceType: 'source_type',
|
||||||
|
sourceId: 'source_id',
|
||||||
|
point: ({ point }) => +point,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const COUPON = {
|
export const COUPON = {
|
||||||
|
|
@ -61,8 +75,10 @@ export const COUPON = {
|
||||||
distributorName: ({ distributor_info }) => {
|
distributorName: ({ distributor_info }) => {
|
||||||
return distributor_info?.name
|
return distributor_info?.name
|
||||||
},
|
},
|
||||||
|
fixedTerm: 'fixed_term',
|
||||||
sourceType: 'source_type',
|
sourceType: 'source_type',
|
||||||
sourceId: 'source_id',
|
sourceId: 'source_id',
|
||||||
|
point: ({ point }) => +point,
|
||||||
valid: ({ valid }) => {
|
valid: ({ valid }) => {
|
||||||
if (typeof valid === 'undefined') {
|
if (typeof valid === 'undefined') {
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ function AddressIndex (props) {
|
||||||
)} */}
|
)} */}
|
||||||
|
|
||||||
<View className='member-address-list'>
|
<View className='member-address-list'>
|
||||||
{list?.length && list.map((item, index) => {
|
{list?.length > 0 && list.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
key={item[ADDRESS_ID]}
|
key={item[ADDRESS_ID]}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ function CashierResult(props) {
|
||||||
tradeInfo?.tradeSourceType == 'normal_seckill' ||
|
tradeInfo?.tradeSourceType == 'normal_seckill' ||
|
||||||
tradeInfo?.tradeSourceType == 'normal_groups') && (
|
tradeInfo?.tradeSourceType == 'normal_groups') && (
|
||||||
<View className='btn-wrap'>
|
<View className='btn-wrap'>
|
||||||
<SpButton
|
{/* <SpButton
|
||||||
resetText='首页'
|
resetText='首页'
|
||||||
confirmText='订单详情'
|
confirmText='订单详情'
|
||||||
onReset={() => {
|
onReset={() => {
|
||||||
|
|
@ -114,7 +114,24 @@ function CashierResult(props) {
|
||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
Taro.redirectTo({ url: `/subpage/pages/trade/detail?id=${orderId}` })
|
Taro.redirectTo({ url: `/subpage/pages/trade/detail?id=${orderId}` })
|
||||||
}}
|
}}
|
||||||
></SpButton>
|
></SpButton> */}
|
||||||
|
<AtButton
|
||||||
|
type='plain'
|
||||||
|
customStyle={{ marginBottom: '20px', borderColor: '#000' }}
|
||||||
|
onClick={() => {
|
||||||
|
Taro.redirectTo({ url: '/pages/index' })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
首页
|
||||||
|
</AtButton>
|
||||||
|
<AtButton
|
||||||
|
type='primary'
|
||||||
|
onClick={() => {
|
||||||
|
Taro.redirectTo({ url: `/subpage/pages/trade/detail?id=${orderId}&type=pointitem` })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
订单详情
|
||||||
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -123,7 +140,7 @@ function CashierResult(props) {
|
||||||
tradeInfo?.tradeSourceType == 'normal_pointsmall_pointsmall') && (
|
tradeInfo?.tradeSourceType == 'normal_pointsmall_pointsmall') && (
|
||||||
<View className='btn-wrap'>
|
<View className='btn-wrap'>
|
||||||
<SpButton
|
<SpButton
|
||||||
resetText='首页'
|
resetText='返回'
|
||||||
confirmText='订单详情'
|
confirmText='订单详情'
|
||||||
onReset={() => {
|
onReset={() => {
|
||||||
Taro.redirectTo({ url: '/pages/index' })
|
Taro.redirectTo({ url: '/pages/index' })
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.icon-roundcheckfill {
|
.icon-roundcheckfill {
|
||||||
font-size: 40px;
|
font-size: 80px;
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
.trade-txt {
|
.trade-txt {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
&-bd {
|
&-bd {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
height: 150px;
|
||||||
}
|
}
|
||||||
&-image {
|
&-image {
|
||||||
width: 220px;
|
width: 220px;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export const initialState = {
|
||||||
paramsInfo: {}, // 结算接口参数
|
paramsInfo: {}, // 结算接口参数
|
||||||
discountInfo: [],
|
discountInfo: [],
|
||||||
couponInfo: {}, // 优惠券信息
|
couponInfo: {}, // 优惠券信息
|
||||||
|
couponTotal: 0,
|
||||||
remark: '', // 备注
|
remark: '', // 备注
|
||||||
// 积分相关
|
// 积分相关
|
||||||
isPointOpen: false,
|
isPointOpen: false,
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@ function CartCheckout (props) {
|
||||||
buildingNumber,
|
buildingNumber,
|
||||||
houseNumber, // 房号
|
houseNumber, // 房号
|
||||||
routerParams, // 路由参数
|
routerParams, // 路由参数
|
||||||
orderTtems
|
orderTtems,
|
||||||
|
couponTotal
|
||||||
} = state
|
} = state
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -127,6 +128,7 @@ function CartCheckout (props) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
getTradeSetting()
|
getTradeSetting()
|
||||||
|
getCouponList()
|
||||||
// tode 此处应有埋点
|
// tode 此处应有埋点
|
||||||
return () => {
|
return () => {
|
||||||
dispatch(changeCoupon()) // 清空优惠券信息
|
dispatch(changeCoupon()) // 清空优惠券信息
|
||||||
|
|
@ -161,6 +163,20 @@ function CartCheckout (props) {
|
||||||
}
|
}
|
||||||
}, [isPackageOpend, openCashier, isPointOpenModal])
|
}, [isPackageOpend, openCashier, isPointOpenModal])
|
||||||
|
|
||||||
|
const getCouponList = async () => {
|
||||||
|
const params = {
|
||||||
|
status: '1',
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
card_type: 'cash',
|
||||||
|
scope_type: 'all'
|
||||||
|
}
|
||||||
|
const { total_count } = await api.member.getUserCardList(params)
|
||||||
|
setState((draft) => {
|
||||||
|
draft.couponTotal = total_count
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 是否需要包装
|
// 是否需要包装
|
||||||
const getTradeSetting = async () => {
|
const getTradeSetting = async () => {
|
||||||
let data = await api.trade.tradeSetting()
|
let data = await api.trade.tradeSetting()
|
||||||
|
|
@ -403,7 +419,10 @@ function CartCheckout (props) {
|
||||||
price
|
price
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let url = `/subpages/marketing/coupon-picker?items=${JSON.stringify(
|
|
||||||
|
let url = `/subpages/marketing/coupon-picker`
|
||||||
|
// let url = `/subpages/marketing/coupon`
|
||||||
|
+ `?items=${JSON.stringify(
|
||||||
items
|
items
|
||||||
)}&is_checkout=true&cart_type=${cart_type}&distributor_id=${shop_id || id}&source=${source}`
|
)}&is_checkout=true&cart_type=${cart_type}&distributor_id=${shop_id || id}&source=${source}`
|
||||||
if (couponInfo?.coupon_code) {
|
if (couponInfo?.coupon_code) {
|
||||||
|
|
@ -527,7 +546,7 @@ function CartCheckout (props) {
|
||||||
receiver_district,
|
receiver_district,
|
||||||
item_fee_new,
|
item_fee_new,
|
||||||
market_fee,
|
market_fee,
|
||||||
items_promotion
|
items_promotion,
|
||||||
} = orderRes
|
} = orderRes
|
||||||
|
|
||||||
let subdistrictRes
|
let subdistrictRes
|
||||||
|
|
@ -554,7 +573,8 @@ function CartCheckout (props) {
|
||||||
// }
|
// }
|
||||||
coupon_id: id,
|
coupon_id: id,
|
||||||
coupon_code: coupon_code,
|
coupon_code: coupon_code,
|
||||||
title: info
|
title: info,
|
||||||
|
...coupon_info
|
||||||
}
|
}
|
||||||
setState((draft) => {
|
setState((draft) => {
|
||||||
draft.couponInfo = _info
|
draft.couponInfo = _info
|
||||||
|
|
@ -587,7 +607,7 @@ function CartCheckout (props) {
|
||||||
point_fee, //积分抵扣金额,
|
point_fee, //积分抵扣金额,
|
||||||
item_point,
|
item_point,
|
||||||
freight_type,
|
freight_type,
|
||||||
promotion_discount
|
promotion_discount,
|
||||||
}
|
}
|
||||||
|
|
||||||
const point_info = {
|
const point_info = {
|
||||||
|
|
@ -716,7 +736,7 @@ function CartCheckout (props) {
|
||||||
if (VERSION_PLATFORM) {
|
if (VERSION_PLATFORM) {
|
||||||
delete cus_parmas.isNostores
|
delete cus_parmas.isNostores
|
||||||
}
|
}
|
||||||
console.log(couponInfo)
|
console.log(couponInfo, '优惠券信息')
|
||||||
const _coupon = coupon || couponInfo
|
const _coupon = coupon || couponInfo
|
||||||
if (!isEmpty(_coupon)) {
|
if (!isEmpty(_coupon)) {
|
||||||
const { coupon_id, coupon_code, title } = _coupon
|
const { coupon_id, coupon_code, title } = _coupon
|
||||||
|
|
@ -863,6 +883,14 @@ function CartCheckout (props) {
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
<View className="gap"></View>
|
<View className="gap"></View>
|
||||||
|
<View className='counp-line' onClick={handleCouponsClick}>
|
||||||
|
<Text className='counp-line-left'>优惠券/码</Text>
|
||||||
|
<View className='counp-line-right'>
|
||||||
|
<Text>{couponInfo.rule || (!!couponTotal ? '选择优惠券' : '暂无可用优惠券/码')}</Text>
|
||||||
|
<Text className='iconfont icon-arrowRight'></Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className="gap"></View>
|
||||||
<View className="trade-detail-info-new">
|
<View className="trade-detail-info-new">
|
||||||
<View className='line'>
|
<View className='line'>
|
||||||
<View className='left'>订单金额</View>
|
<View className='left'>订单金额</View>
|
||||||
|
|
@ -876,7 +904,7 @@ function CartCheckout (props) {
|
||||||
<View className='line'>
|
<View className='line'>
|
||||||
<View className='left'>优惠金额</View>
|
<View className='left'>优惠金额</View>
|
||||||
{/* 促销 + 优惠券 */}
|
{/* 促销 + 优惠券 */}
|
||||||
<View className='right'>{`¥${parseFloat(totalInfo.promotion_discount + totalInfo.coupon_discount).toFixed(2)}`}</View>
|
<View className='right'>{`¥ ${parseFloat(totalInfo.promotion_discount + (totalInfo.coupon_discount || 0) / 100).toFixed(2)}`}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='line'>
|
<View className='line'>
|
||||||
<View className='left'>运费</View>
|
<View className='left'>运费</View>
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,21 @@ $margin24: 10px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
|
.counp-line {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26px;
|
||||||
|
padding: 20px 0;
|
||||||
|
&-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: #5b5b5b;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.trade-detail-info-new {
|
.trade-detail-info-new {
|
||||||
padding: 20px 24px;
|
padding: 20px 0px;
|
||||||
.line {
|
.line {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
padding-top: 40px;
|
padding-top: 40px;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
margin-bottom: 36px;
|
margin-bottom: 36px;
|
||||||
|
padding-bottom: 100px;
|
||||||
&-shadow {
|
&-shadow {
|
||||||
// box-shadow: 0px 2px 10px 0px #eae7e0;
|
// box-shadow: 0px 2px 10px 0px #eae7e0;
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +155,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-item-wrap {
|
.cart-item-wrap {
|
||||||
padding: 60px 36px;
|
padding: 60px 36px 100px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ function EspierDetail (props) {
|
||||||
|
|
||||||
const res = await api.member.itemHistory()
|
const res = await api.member.itemHistory()
|
||||||
setState((draft) => {
|
setState((draft) => {
|
||||||
draft.historyList = res.list.filter((item) => item.item_id !== data.itemId).map((item) => ({ ...item.itemData, pic: item.itemData.pics?.[0] || '' }))
|
draft.historyList = res.list.filter((item) => item.item_id !== data.itemId)?.map((item) => ({ ...item.itemData, pic: item.itemData.pics?.[0] || '' })) || []
|
||||||
draft.historyTotal = res.total_count
|
draft.historyTotal = res.total_count
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -585,21 +585,21 @@ function EspierDetail (props) {
|
||||||
|
|
||||||
<View className='goods-info'>
|
<View className='goods-info'>
|
||||||
|
|
||||||
<CompVipGuide
|
{/* <CompVipGuide
|
||||||
info={{
|
info={{
|
||||||
...info.vipgradeGuideTitle,
|
...info.vipgradeGuideTitle,
|
||||||
memberPrice: info.memberPrice
|
memberPrice: info.memberPrice
|
||||||
}}
|
}}
|
||||||
/>
|
/> */}
|
||||||
|
|
||||||
<CompCouponList
|
{/* <CompCouponList
|
||||||
info={
|
info={
|
||||||
info.couponList.list.length > 3
|
info.couponList.list.length > 3
|
||||||
? info.couponList.list.slice(0, 3)
|
? info.couponList.list.slice(0, 3)
|
||||||
: info.couponList.list
|
: info.couponList.list
|
||||||
}
|
}
|
||||||
onClick={handleReceiveCoupon}
|
onClick={handleReceiveCoupon}
|
||||||
/>
|
/> */}
|
||||||
|
|
||||||
<View className='goods-name-wrap'>
|
<View className='goods-name-wrap'>
|
||||||
<View className='goods-name'>
|
<View className='goods-name'>
|
||||||
|
|
@ -779,11 +779,11 @@ function EspierDetail (props) {
|
||||||
isAnimation={false}
|
isAnimation={false}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setState((draft) => {
|
setState((draft) => {
|
||||||
// draft.introList[index].isOpen = !draft.introList[index].isOpen
|
|
||||||
draft.introList = draft.introList.map((v, i) => {
|
draft.introList = draft.introList.map((v, i) => {
|
||||||
v.isOpen = (i === index)
|
v.isOpen = false
|
||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
|
draft.introList[index].isOpen = !item.isOpen
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
|
|
@ -792,11 +792,11 @@ function EspierDetail (props) {
|
||||||
</AtAccordion>
|
</AtAccordion>
|
||||||
<View onClick={() => {
|
<View onClick={() => {
|
||||||
setState((draft) => {
|
setState((draft) => {
|
||||||
// draft.introList[index].isOpen = !draft.introList[index].isOpen
|
|
||||||
draft.introList = draft.introList.map((v, i) => {
|
draft.introList = draft.introList.map((v, i) => {
|
||||||
v.isOpen = (i === index)
|
v.isOpen = false
|
||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
|
draft.introList[index].isOpen = !item.isOpen
|
||||||
})
|
})
|
||||||
}}>
|
}}>
|
||||||
{item.isOpen ? <AtIcon value='subtract' size='16' color='#000' /> :
|
{item.isOpen ? <AtIcon value='subtract' size='16' color='#000' /> :
|
||||||
|
|
@ -804,7 +804,7 @@ function EspierDetail (props) {
|
||||||
{item.isOpen ? <></> : <View className="line"></View>}
|
{item.isOpen ? <></> : <View className="line"></View>}
|
||||||
</View>
|
</View>
|
||||||
</View>) : <View style={{ height: `calc(100% - 380px)` }}></View>}
|
</View>) : <View style={{ height: `calc(100% - 380px)` }}></View>}
|
||||||
{historyList.length && <View className='bottom-box'>
|
{isArray(historyList) ? <View className='bottom-box'>
|
||||||
<View className="bottom-box-tit">浏览历史</View>
|
<View className="bottom-box-tit">浏览历史</View>
|
||||||
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">
|
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">
|
||||||
{historyList.map((item, idx) => (
|
{historyList.map((item, idx) => (
|
||||||
|
|
@ -819,7 +819,7 @@ function EspierDetail (props) {
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>}
|
</View> : <></>}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import React, { Component } from 'react'
|
||||||
import Taro, { getCurrentInstance } from '@tarojs/taro'
|
import Taro, { getCurrentInstance } from '@tarojs/taro'
|
||||||
import { View, Text, Button, Image, ScrollView } from '@tarojs/components'
|
import { View, Text, Button, Image, ScrollView } from '@tarojs/components'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { AtCountdown } from 'taro-ui'
|
import { AtCountdown, AtCurtain } from 'taro-ui'
|
||||||
import { Loading, SpNavBar, FloatMenuMeiQia, SpNewShopItem, SpPage, SpPrice } from '@/components'
|
import { Loading, SpNavBar, FloatMenuMeiQia, SpNewShopItem, SpPage, SpPrice, SpImage } from '@/components'
|
||||||
import {
|
import {
|
||||||
log,
|
log,
|
||||||
pickBy,
|
pickBy,
|
||||||
|
|
@ -84,7 +84,9 @@ export default class TradeDetail extends Component {
|
||||||
cancelData: {},
|
cancelData: {},
|
||||||
tradeInfo: {},
|
tradeInfo: {},
|
||||||
showQRcode: false,
|
showQRcode: false,
|
||||||
distributor: {}
|
distributor: {},
|
||||||
|
showDeliveryModal: false,
|
||||||
|
deliveryList: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,10 +482,27 @@ export default class TradeDetail extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickDelivery = () => {
|
handleClickDelivery = async (flag) => {
|
||||||
Taro.navigateTo({
|
Taro.showLoading({ title: '' })
|
||||||
url: `/subpage/pages/trade/delivery-info?order_type=${this.state.info.order_type}&order_id=${this.state.info.tid}&delivery_code=${this.state.info.delivery_code}&delivery_corp=${this.state.info.delivery_corp}&delivery_name=${this.state.info.delivery_name}`
|
let { delivery_type, delivery_id, order_type, tid: order_id } = this.state.info
|
||||||
|
let list = []
|
||||||
|
if (delivery_type == 'new') {
|
||||||
|
list = await api.trade.deliveryInfoNew({ delivery_id })
|
||||||
|
} else {
|
||||||
|
list = await api.trade.deliveryInfo(order_type, order_id)
|
||||||
|
}
|
||||||
|
const nList = pickBy(list, {
|
||||||
|
title: 'AcceptStation',
|
||||||
|
content: ({ AcceptTime }) => [AcceptTime]
|
||||||
})
|
})
|
||||||
|
this.setState({
|
||||||
|
deliveryList: nList
|
||||||
|
})
|
||||||
|
this.setState({ showDeliveryModal: flag })
|
||||||
|
Taro.hideLoading()
|
||||||
|
// Taro.navigateTo({
|
||||||
|
// url: `/subpage/pages/trade/delivery-info?order_type=${this.state.info.order_type}&order_id=${this.state.info.tid}&delivery_code=${this.state.info.delivery_code}&delivery_corp=${this.state.info.delivery_corp}&delivery_name=${this.state.info.delivery_name}`
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickCopy = (val) => {
|
handleClickCopy = (val) => {
|
||||||
|
|
@ -668,7 +687,8 @@ export default class TradeDetail extends Component {
|
||||||
tradeInfo,
|
tradeInfo,
|
||||||
showQRcode,
|
showQRcode,
|
||||||
pickup_code,
|
pickup_code,
|
||||||
distributor
|
distributor,
|
||||||
|
showDeliveryModal
|
||||||
} = this.state
|
} = this.state
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
|
@ -916,7 +936,7 @@ export default class TradeDetail extends Component {
|
||||||
<>
|
<>
|
||||||
<View className="address-txt info-trade">
|
<View className="address-txt info-trade">
|
||||||
<Text>物流信息</Text>
|
<Text>物流信息</Text>
|
||||||
<Text className='right'>查看详情</Text>
|
<Text className='right' onClick={() => this.handleClickDelivery(true)}>查看详情</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='address-detail' style={{ marginTop: '4rpx' }}>物流单号:{info.receiver_name}</View>
|
<View className='address-detail' style={{ marginTop: '4rpx' }}>物流单号:{info.receiver_name}</View>
|
||||||
<View className='address-detail'>物流公司:{info.receiver_name}</View>
|
<View className='address-detail'>物流公司:{info.receiver_name}</View>
|
||||||
|
|
@ -987,7 +1007,7 @@ export default class TradeDetail extends Component {
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View className='trade-money'>
|
{/* <View className='trade-money'> */}
|
||||||
{/* <View>
|
{/* <View>
|
||||||
总计:
|
总计:
|
||||||
{this.isPointitemGood() ? (
|
{this.isPointitemGood() ? (
|
||||||
|
|
@ -1015,7 +1035,7 @@ export default class TradeDetail extends Component {
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)} */}
|
)} */}
|
||||||
</View>
|
{/* </View> */}
|
||||||
{/* {info.remark && (
|
{/* {info.remark && (
|
||||||
<View className='trade-detail-remark'>
|
<View className='trade-detail-remark'>
|
||||||
<View className='trade-detail-remark__header'>订单备注</View>
|
<View className='trade-detail-remark__header'>订单备注</View>
|
||||||
|
|
@ -1139,7 +1159,7 @@ export default class TradeDetail extends Component {
|
||||||
<View className='left'>物流单号</View>
|
<View className='left'>物流单号</View>
|
||||||
<View className='right'>
|
<View className='right'>
|
||||||
<Text className='info-text'>{info.delivery_code}</Text>
|
<Text className='info-text'>{info.delivery_code}</Text>
|
||||||
<Text className='info-text-btn' onClick={this.handleClickDelivery.bind(this)}>
|
<Text className='info-text-btn' onClick={this.handleClickDelivery.bind(this, true)}>
|
||||||
查看物流
|
查看物流
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
|
|
@ -1281,6 +1301,39 @@ export default class TradeDetail extends Component {
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<AtCurtain
|
||||||
|
className='curtain'
|
||||||
|
isOpened={showDeliveryModal}
|
||||||
|
onClose={() => {
|
||||||
|
this.handleClickDelivery(false)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View className="curtain_content">
|
||||||
|
<View className="curtain_content_title">
|
||||||
|
<SpImage src={`member/logo-black.png`} height={32} mode='heightFix' isNew />
|
||||||
|
<Text className="">物流信息</Text>
|
||||||
|
</View>
|
||||||
|
<View className="receiver_name">
|
||||||
|
{info.receiver_name}:{info.receiver_phone}
|
||||||
|
</View>
|
||||||
|
<ScrollView scrollY
|
||||||
|
scrollWithAnimation className="curtain_content_text" showScrollbar={false} enhanced>
|
||||||
|
亲爱的用户,感谢您使用Birkenstock微信小程序!为了加强对您个人信息的保护,我们根据最新法律的要求制定/更新了
|
||||||
|
,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务
|
||||||
|
<View>
|
||||||
|
本政策旨在向您说明休迪贸易 (上海)有限公司及其在中国大陆境内的线上线下门店如何收集、使用、传输和保护您的个人信息
|
||||||
|
通过《隐私政策》,我们向您主要说明:
|
||||||
|
</View>
|
||||||
|
<View className="">
|
||||||
|
1.您在使用Birkenstock微信小程序时,可以选择浏览模式,也可以选择注册/登录成为Birkenstock微信小程序用户
|
||||||
|
</View>
|
||||||
|
<View className="">
|
||||||
|
2为了向你提供Birkenstock微信小程序的其本服条,我们将基于合法以及正当必要的原则,按照本政策的规定向您提供各项服务
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
</AtCurtain>
|
||||||
</SpPage>
|
</SpPage>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ $paddingBottom: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scroll-view {
|
.scroll-view {
|
||||||
@include page-scroll(var(--nav-height), 140px);
|
@include page-scroll(calc(var(--nav-height) + 16px), 140px);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.has-navbar {
|
&.has-navbar {
|
||||||
|
|
@ -249,7 +249,7 @@ $paddingBottom: 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.trade-detail-goods {
|
.trade-detail-goods {
|
||||||
margin: 14px 22px 0;
|
margin: 0px 22px;
|
||||||
// padding-top: 16px;
|
// padding-top: 16px;
|
||||||
padding: 40px 30px 40px 20px;
|
padding: 40px 30px 40px 20px;
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
|
|
@ -696,4 +696,57 @@ $paddingBottom: 100px;
|
||||||
color: #0091ff;
|
color: #0091ff;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
.curtain {
|
||||||
|
.at-curtain__container {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 30px;
|
||||||
|
}
|
||||||
|
.at-curtain__btn-close--bottom {
|
||||||
|
// display: none;
|
||||||
|
border: none;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
left: auto;
|
||||||
|
&::after,
|
||||||
|
&::before {
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&_content {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 100px 46px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
&_title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 36px;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 80px;
|
||||||
|
color: #000;
|
||||||
|
.sp-image {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.receiver_name {
|
||||||
|
font-size: 26px;
|
||||||
|
color: #000;
|
||||||
|
margin: 80px 0;
|
||||||
|
}
|
||||||
|
&_text {
|
||||||
|
line-height: 1.4;
|
||||||
|
height: 650px;
|
||||||
|
color: #000;
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.no-text {
|
||||||
|
color: #7e7e7e;
|
||||||
|
font-size: 20rpx;
|
||||||
|
margin-top: 28rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ export default class InvoiceList extends Component {
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{!page.isLoading && list?.length && <View className="bottom">
|
{!page.isLoading && list?.length > 0 && <View className="bottom">
|
||||||
<View className="bottom-line">
|
<View className="bottom-line">
|
||||||
<View className="left">已选{1}个订单,共计
|
<View className="left">已选{1}个订单,共计
|
||||||
<SpPrice size={20} className='total-pirce' value={900900 / 100} showSeparator noDecimal />
|
<SpPrice size={20} className='total-pirce' value={900900 / 100} showSeparator noDecimal />
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ export default class TradeList extends Component {
|
||||||
order_status_des: 'order_status_des',
|
order_status_des: 'order_status_des',
|
||||||
status: ({ order_status }) => resolveOrderStatus(order_status),
|
status: ({ order_status }) => resolveOrderStatus(order_status),
|
||||||
totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0),
|
totalItems: ({ items }) => items.reduce((acc, item) => +item.num + acc, 0),
|
||||||
payment: ({ item_fee_new }) => (item_fee_new / 100).toFixed(2),
|
// payment: ({ item_fee_new }) => (item_fee_new / 100).toFixed(2),
|
||||||
|
payment: ({ total_fee }) => (+total_fee / 100).toFixed(2),
|
||||||
total_fee: 'total_fee',
|
total_fee: 'total_fee',
|
||||||
pay_type: 'pay_type',
|
pay_type: 'pay_type',
|
||||||
point: 'point',
|
point: 'point',
|
||||||
|
|
@ -162,7 +163,8 @@ export default class TradeList extends Component {
|
||||||
origincountry_img_url: 'origincountry_img_url',
|
origincountry_img_url: 'origincountry_img_url',
|
||||||
type: 'type',
|
type: 'type',
|
||||||
item_spec_desc: 'item_spec_desc',
|
item_spec_desc: 'item_spec_desc',
|
||||||
price: ({ item_fee_new }) => (item_fee_new / 100).toFixed(2),
|
// price: ({ item_fee_new }) => (item_fee_new / 100).toFixed(2),
|
||||||
|
price: ({ total_fee }) => (+total_fee / 100).toFixed(2),
|
||||||
item_fee: 'item_fee',
|
item_fee: 'item_fee',
|
||||||
point: 'item_point',
|
point: 'item_point',
|
||||||
num: 'num',
|
num: 'num',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect } from 'react'
|
import React, { useEffect, useRef } from 'react'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
import { useImmer } from 'use-immer'
|
import { useImmer } from 'use-immer'
|
||||||
import Taro, { getCurrentInstance } from '@tarojs/taro'
|
import Taro, { getCurrentInstance } from '@tarojs/taro'
|
||||||
|
|
@ -18,6 +18,7 @@ function CouponCenter (props) {
|
||||||
const $instance = getCurrentInstance()
|
const $instance = getCurrentInstance()
|
||||||
const [state, setState] = useImmer(initialState)
|
const [state, setState] = useImmer(initialState)
|
||||||
const { couponList } = state
|
const { couponList } = state
|
||||||
|
const listRef = useRef(null)
|
||||||
|
|
||||||
useEffect(() => { getMypoint() }, [])
|
useEffect(() => { getMypoint() }, [])
|
||||||
|
|
||||||
|
|
@ -54,6 +55,23 @@ function CouponCenter (props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClickCouponItem = async (item, index) => {
|
const handleClickCouponItem = async (item, index) => {
|
||||||
|
if (point <= 0 || point <= item.point) {
|
||||||
|
showToast('积分不足')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const res = await Taro.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `确定要领取该优惠券吗?`,
|
||||||
|
showCancel: true,
|
||||||
|
cancel: '取消',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确定',
|
||||||
|
cancelColor: "#ccc",
|
||||||
|
confirmColor: "#000"
|
||||||
|
})
|
||||||
|
if (!res.confirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (item.couponStatus == 0) {
|
if (item.couponStatus == 0) {
|
||||||
showToast('优惠券已领完')
|
showToast('优惠券已领完')
|
||||||
} else if (item.couponStatus == 1) {
|
} else if (item.couponStatus == 1) {
|
||||||
|
|
@ -80,7 +98,7 @@ function CouponCenter (props) {
|
||||||
getCoupon(item, index)
|
getCoupon(item, index)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast('优惠券领取机会已用完')
|
showToast('优惠券已领取完啦')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,6 +117,7 @@ function CouponCenter (props) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
showToast('优惠券领取成功')
|
showToast('优惠券领取成功')
|
||||||
|
getMypoint()
|
||||||
} else {
|
} else {
|
||||||
showToast('优惠券领取失败')
|
showToast('优惠券领取失败')
|
||||||
}
|
}
|
||||||
|
|
@ -131,19 +150,27 @@ function CouponCenter (props) {
|
||||||
console.log('handleRedeem:', item)
|
console.log('handleRedeem:', item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPoint = async () => {
|
||||||
|
await api.member.depositToPoint({ money: 50000 })
|
||||||
|
showToast('积分+500')
|
||||||
|
setState((draft) => {
|
||||||
|
draft.couponList = []
|
||||||
|
})
|
||||||
|
listRef.current?.reset()
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<SpPage className='page-coupon-center' scrollToTopBtn>
|
<SpPage className='page-coupon-center' scrollToTopBtn>
|
||||||
<View className='pointshop-hd'>
|
<View className='pointshop-hd'>
|
||||||
<View className='point-info'>
|
<View className='point-info'>
|
||||||
<View className='point-total'>
|
<View className='point-total'>
|
||||||
{/* <SpPoint value={point} /> */}
|
{/* <SpPoint value={point} /> */}
|
||||||
<Text className='title'>我的积分</Text>
|
<Text className='title' onClick={getPoint}>我的积分</Text>
|
||||||
<Text className='point'>{(point || 0).toString()}</Text>
|
<Text className='point'>{(point || 0).toString()}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="coupon" onClick={() => Taro.navigateTo({ url: '/subpages/marketing/coupon' })}>我的优惠券</View>
|
<View className="coupon" onClick={() => Taro.navigateTo({ url: '/subpages/marketing/coupon' })}>我的优惠券</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<SpScrollView className='list-scroll' fetch={fetch} renderEmpty={<View className='empty'>
|
<SpScrollView ref={listRef} className='list-scroll' fetch={fetch} renderEmpty={<View className='empty'>
|
||||||
<SpImage src='member/quan-empty.png' width={138} height={138} isNew />
|
<SpImage src='member/quan-empty.png' width={138} height={138} isNew />
|
||||||
<Text className='empty-text'>暂无优惠券~</Text></View>}>
|
<Text className='empty-text'>暂无优惠券~</Text></View>}>
|
||||||
{couponList.map((item, index) => {
|
{couponList.map((item, index) => {
|
||||||
|
|
@ -166,21 +193,22 @@ function CouponCenter (props) {
|
||||||
</SpCoupon>
|
</SpCoupon>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
return <SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item, index)} isNew />
|
||||||
return (<View className="coupons-list-item" key={`coupon-item__${index}`} style={styleNames({
|
return (<View className="coupons-list-item" key={`coupon-item__${index}`} style={styleNames({
|
||||||
background: `url(${process.env.APP_IMAGE_CDN_NEW}/member/${item.type === "quan" ? "quan-hui" : "quan-lan"}.png) no-repeat`,
|
background: `url(${process.env.APP_IMAGE_CDN_NEW}/member/${item.couponStatus != 1 ? "quan-hui" : "quan-lan"}.png) no-repeat`,
|
||||||
'background-size': '100% 100%'
|
'background-size': '100% 100%'
|
||||||
})}>
|
})}>
|
||||||
<View className="coupons-list-item-left">
|
<View className="coupons-list-item-left">
|
||||||
<View className='coupons-list-item-money'><Text className='coupons-list-item-unit'>¥</Text><Text className="coupons-list-item-num">{item.num || 100}</Text></View>
|
<View className='coupons-list-item-money'><Text className='coupons-list-item-unit'>¥</Text><Text className="coupons-list-item-num">{item.reduceCost || 0}</Text></View>
|
||||||
<View className="coupons-list-item-desc">{item.desc || '满100可用'}</View>
|
<View className="coupons-list-item-desc">满{item.leastCost}可用</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="coupons-list-item-right">
|
<View className="coupons-list-item-right">
|
||||||
<View className="coupons-list-item-right-box">
|
<View className="coupons-list-item-right-box">
|
||||||
<View className="coupons-list-item-integral">{item.integral || 500}积分兑换</View>
|
<View className="coupons-list-item-integral">{item.title}</View>
|
||||||
{/* {item.start_time}至{item.end_time} */}
|
{/* {item.start_time}至{item.end_time} */}
|
||||||
<View className="coupons-list-item-desc">有效日期:领取7天内有效</View>
|
<View className="coupons-list-item-desc">有效日期:领取{item.fixedTerm}天内有效</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="coupons-list-item-btn" onClick={() => handleRedeem(item)}>立即兑换</View>
|
<View className="coupons-list-item-btn" onClick={handleClickCouponItem.bind(this, item, index)}>立即兑换</View>
|
||||||
</View>
|
</View>
|
||||||
</View>)
|
</View>)
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.list-scroll {
|
.list-scroll {
|
||||||
padding: 20px;
|
// padding: 20px;
|
||||||
|
padding: 0 50px;
|
||||||
.coupon-item-wrap {
|
.coupon-item-wrap {
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
@ -57,8 +58,8 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #5b5b5b;
|
// background: #5b5b5b;
|
||||||
margin-bottom: 30px;
|
// margin-bottom: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
min-height: 175px;
|
min-height: 175px;
|
||||||
|
|
|
||||||
|
|
@ -103,15 +103,15 @@ function CouponPicker(props) {
|
||||||
<SpScrollView className='list-scroll' fetch={fetch}>
|
<SpScrollView className='list-scroll' fetch={fetch}>
|
||||||
{couponListVaild.map((item, index) => (
|
{couponListVaild.map((item, index) => (
|
||||||
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
||||||
<SpCoupon info={item} />
|
<SpCoupon info={item} onClick={onChangeSelectCoupon.bind(this, item)} />
|
||||||
<SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/>
|
{/* <SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/> */}
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
{couponListInVaild.length > 0 ? <View className='invalid-title'>不可用优惠券</View> : ''}
|
{couponListInVaild.length > 0 ? <View className='invalid-title'>不可用优惠券</View> : ''}
|
||||||
{couponListInVaild.map((item, index) => (
|
{couponListInVaild.map((item, index) => (
|
||||||
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
||||||
<SpCoupon info={item} />
|
<SpCoupon info={item} onClick={onChangeSelectCoupon.bind(this, item)} />
|
||||||
<SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/>
|
{/* <SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/> */}
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</SpScrollView>
|
</SpScrollView>
|
||||||
|
|
|
||||||
|
|
@ -120,38 +120,21 @@ function CouponIndex () {
|
||||||
<SpImage src='member/quan-empty.png' width={138} height={138} isNew />
|
<SpImage src='member/quan-empty.png' width={138} height={138} isNew />
|
||||||
<Text className='empty-text'>暂无优惠券~</Text></View>}>
|
<Text className='empty-text'>暂无优惠券~</Text></View>}>
|
||||||
{couponList.map((item, index) => (
|
{couponList.map((item, index) => (
|
||||||
// <View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
|
||||||
// <SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item)}>
|
<SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item)}>
|
||||||
// {item.cardType != 'new_gift' && <Text>去使用</Text>}
|
{/* {item.cardType != 'new_gift' && <Text>去使用</Text>}
|
||||||
// {item.cardType == 'new_gift' && (
|
{item.cardType == 'new_gift' && (
|
||||||
// <Text>
|
<Text>
|
||||||
// {item?.tagClass == 'notstarted'
|
{item?.tagClass == 'notstarted'
|
||||||
// ? '未开始'
|
? '未开始'
|
||||||
// : {
|
: {
|
||||||
// '1': '去使用',
|
'1': '去使用',
|
||||||
// '10': '待核销'
|
'10': '待核销'
|
||||||
// }[item.status]}
|
}[item.status]}
|
||||||
// </Text>
|
</Text>
|
||||||
// )}
|
)} */}
|
||||||
// </SpCoupon>
|
</SpCoupon>
|
||||||
// </View>
|
|
||||||
(<View className="coupons-list-item" key={`coupon-item__${index}`} style={styleNames({
|
|
||||||
background: `url(${process.env.APP_IMAGE_CDN_NEW}/member/${item.type === "quan" ? "quan-hui" : "quan-lan"}.png) no-repeat`,
|
|
||||||
'background-size': '100% 100%'
|
|
||||||
})}>
|
|
||||||
<View className="coupons-list-item-left">
|
|
||||||
<View className='coupons-list-item-money'><Text className='coupons-list-item-unit'>¥</Text><Text className="coupons-list-item-num">{item.num || 100}</Text></View>
|
|
||||||
<View className="coupons-list-item-desc">{item.desc || '满100可用'}</View>
|
|
||||||
</View>
|
</View>
|
||||||
<View className="coupons-list-item-right">
|
|
||||||
<View className="coupons-list-item-right-box">
|
|
||||||
<View className="coupons-list-item-integral">{item.integral || 500}积分兑换</View>
|
|
||||||
{/* {item.start_time}至{item.end_time} */}
|
|
||||||
<View className="coupons-list-item-desc">有效日期:领取7天内有效</View>
|
|
||||||
</View>
|
|
||||||
<View className="coupons-list-item-btn" onClick={() => handleRedeem(item)}>立即使用</View>
|
|
||||||
</View>
|
|
||||||
</View>)
|
|
||||||
))}
|
))}
|
||||||
</SpScrollView>
|
</SpScrollView>
|
||||||
</SpPage>
|
</SpPage>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
.page-marketing-coupon {
|
.page-marketing-coupon {
|
||||||
.list-scroll {
|
.list-scroll {
|
||||||
padding: 20px 50px;
|
padding: 0px 50px;
|
||||||
.coupon-item-wrap {
|
// .coupon-item-wrap {
|
||||||
&:not(:last-child) {
|
// &:not(:last-child) {
|
||||||
margin-bottom: 20px;
|
// margin-bottom: 20px;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.coupons-list {
|
.coupons-list {
|
||||||
&-item {
|
&-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #5b5b5b;
|
// background: #5b5b5b;
|
||||||
margin-bottom: 30px;
|
// margin-bottom: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
min-height: 175px;
|
min-height: 175px;
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ export function isFunction(val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function uniqueFunc (arr, uniId) {
|
export function uniqueFunc (arr, uniId) {
|
||||||
const res = new Map();
|
const res = new Map()
|
||||||
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1));
|
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNumber (val) {
|
export function isNumber (val) {
|
||||||
|
|
@ -274,6 +274,9 @@ export function resolvePath(baseUrl, params = {}) {
|
||||||
return `${baseUrl}${baseUrl.indexOf('?') >= 0 ? '&' : '?'}${queryStr}`
|
return `${baseUrl}${baseUrl.indexOf('?') >= 0 ? '&' : '?'}${queryStr}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function diffInDays (time1, time2) {
|
||||||
|
return Math.abs(dayjs(time1).diff(dayjs(time2), 'day'))
|
||||||
|
}
|
||||||
export function formatTime (time, formatter = 'YYYY-MM-DD') {
|
export function formatTime (time, formatter = 'YYYY-MM-DD') {
|
||||||
const newTime = time.toString().length < 13 ? time * 1000 : time
|
const newTime = time.toString().length < 13 ? time * 1000 : time
|
||||||
return dayjs(newTime).format(formatter)
|
return dayjs(newTime).format(formatter)
|
||||||
|
|
@ -297,7 +300,7 @@ export function copyText(text, msg = '内容已复制') {
|
||||||
console.log('copyText:text', text)
|
console.log('copyText:text', text)
|
||||||
my.setClipboard({
|
my.setClipboard({
|
||||||
text: text,
|
text: text,
|
||||||
});
|
})
|
||||||
resolve(text)
|
resolve(text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -798,7 +801,7 @@ const alipayAutoLogin = () => {
|
||||||
my.getAuthCode({
|
my.getAuthCode({
|
||||||
scopes: 'auth_base',
|
scopes: 'auth_base',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const code = res.authCode;
|
const code = res.authCode
|
||||||
resolve({ code })
|
resolve({ code })
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
|
|
@ -815,19 +818,19 @@ const requestAlipayminiPayment = (tradeNO) => {
|
||||||
my.tradePay({
|
my.tradePay({
|
||||||
tradeNO: tradeNO,
|
tradeNO: tradeNO,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('支付回调成功res', res);
|
console.log('支付回调成功res', res)
|
||||||
resolve(res)
|
resolve(res)
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
console.log('支付回调失败res', res);
|
console.log('支付回调失败res', res)
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const htmlStringToNodeArray = (htmlString) => {
|
const htmlStringToNodeArray = (htmlString) => {
|
||||||
let nodeArray = null;
|
let nodeArray = null
|
||||||
parse(htmlString, (err, nodes) => {
|
parse(htmlString, (err, nodes) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
nodeArray = nodes
|
nodeArray = nodes
|
||||||
|
|
@ -835,7 +838,7 @@ const htmlStringToNodeArray = (htmlString) => {
|
||||||
log.error('htmlStringToNodeArray error')
|
log.error('htmlStringToNodeArray error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nodeArray;
|
return nodeArray
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCurrentPageRouteParams = () => {
|
const getCurrentPageRouteParams = () => {
|
||||||
|
|
@ -861,7 +864,7 @@ const resolveUrlParamsParse = (url) => {
|
||||||
const itemArr = item.split('=')
|
const itemArr = item.split('=')
|
||||||
const key = itemArr[0]
|
const key = itemArr[0]
|
||||||
const value = itemArr[1]
|
const value = itemArr[1]
|
||||||
res[key] = value;
|
res[key] = value
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue