main
王文龙 2024-02-02 10:30:05 +08:00
parent 82a04ee96f
commit 6ae387165b
28 changed files with 612 additions and 308 deletions

View File

@ -1,42 +1,42 @@
import req from './req'
import { platformTemplateName, transformPlatformUrl } from '@/utils/platform'
export function memberInfo() {
export function memberInfo () {
return req.get('/member')
}
// 修改用户信息
export function setMemberInfo(params = {}) {
export function setMemberInfo (params = {}) {
return req.put('/member', params)
}
export function updateMemberInfo(params = {}) {
export function updateMemberInfo (params = {}) {
return req.put('/memberinfo', params)
}
// 注销用户
export function deleteMember(params) {
export function deleteMember (params) {
return req.delete('/member', params)
}
// 更新会员手机号
export function setMemberMobile(params = {}) {
export function setMemberMobile (params = {}) {
return req.put('/member/mobile', params)
}
export function pointDetail() {
export function pointDetail () {
return req.get('/member.point.detail')
}
export function favsList(params = {}) {
export function favsList (params = {}) {
return req.get('/member/collect/item', params, null, { showError: false })
}
export function addFav(item_id, params) {
export function addFav (item_id, params) {
return req.post(`/member/collect/item/${item_id}`, params)
}
export function delFav(item_ids, params = {}) {
export function delFav (item_ids, params = {}) {
item_ids = Array.isArray(item_ids) ? item_ids : [item_ids]
const { is_empty = false } = params
return req.delete('/member/collect/item', {
@ -45,51 +45,53 @@ export function delFav(item_ids, params = {}) {
})
}
export function memberAssets() {
export function memberAssets () {
return req.get(`/member/statistical`)
}
export function couponList(params = {}) {
export function couponList (params = {}) {
return req.get('/user/newGetCardList', params)
}
export function getUserCardList(params = {}) {
export function getUserCardList (params = {}) {
return req.get('/user/getUserCardList', params)
}
export function homeCouponList(params = {}) {
return req.get('/getCardList', params)
export function homeCouponList (params = {}) {
// return req.get('/getCardList', params)
return req.get('/getRedeemDiscountCardList', params) //积分兑换优惠券列表
}
export function homeCouponGet(params = {}) {
export function homeCouponGet (params = {}) {
return req.get('/user/receiveCard', params)
}
export function getCardDetail(params = {}) {
return req.get('/user/getCardDetail', params)
export function getCardDetail (params = {}) {
// return req.get('/user/getCardDetail', params)
return req.get('/user/receiveCardByPoint', params) //积分换优惠券操作
}
export function userUsedCard(params = {}) {
export function userUsedCard (params = {}) {
return req.get('/user/usedCard', params)
}
export function addressList(params) {
export function addressList (params) {
return req.get('/member/addresslist', params)
}
export function crmAddressList(params = {}) {
export function crmAddressList (params = {}) {
//获取crm地址
return req.post('/member/crmaddresslist', params)
}
export function addressCreate(params = {}) {
export function addressCreate (params = {}) {
return req.post('/member/address', params)
}
export function addressUpdate(data) {
export function addressUpdate (data) {
return req.put(`/member/address/${data.address_id}`, data)
}
export function addressDelete(address_id) {
export function addressDelete (address_id) {
return req.delete(`/member/address/${address_id}`)
}
@ -97,267 +99,267 @@ export function addressDelete(address_id) {
return req.get('/member/addressarea')
}*/
export function areaList() {
export function areaList () {
return req.get('/espier/address')
}
export function addressCreateOrUpdate(data) {
export function addressCreateOrUpdate (data) {
const fn = data.address_id ? addressUpdate : addressCreate
return fn(data)
}
export function itemHistorySave(item_id) {
export function itemHistorySave (item_id) {
return req.post('/member/browse/history/save', { item_id })
}
export function itemHistory(params) {
export function itemHistory (params) {
return req.get('/member/browse/history/list', params)
}
export function getRechargeNumber() {
export function getRechargeNumber () {
return req.get('/deposit/rechargerules')
}
// 充值
export function rehcargePay(params) {
export function rehcargePay (params) {
return req.post('/deposit/recharge', params)
}
export function qrcodeData() {
export function qrcodeData () {
return req.get('/promoter/qrcode')
}
export function memberCode(params) {
export function memberCode (params) {
return req.get('/barcode', params)
}
export function promoter() {
export function promoter () {
return req.post('/promoter')
}
export function h5_qrcodeData() {
export function h5_qrcodeData () {
return req.get('/brokerage/qrcode')
}
export function pointList(params = {}) {
export function pointList (params = {}) {
return req.get('/member/dh/point/history', params)
}
export function pointTotal() {
export function pointTotal () {
return req.get('/point/member/info')
}
export function depositList(params = {}) {
export function depositList (params = {}) {
return req.get('/deposit/list', params)
}
export function depositTotal() {
export function depositTotal () {
return req.get('/deposit/info')
}
export function depositPay(params = {}) {
export function depositPay (params = {}) {
return req.post('/deposit/recharge_new', params)
}
export function depositPayRule() {
export function depositPayRule () {
return req.get('/deposit/recharge/agreement')
}
export function formId(formid) {
export function formId (formid) {
return req.post('/promotion/formid', { formid })
}
export function recommendUserInfo() {
export function recommendUserInfo () {
return req.get('/promoter/info')
}
export function recommendIndexInfo() {
export function recommendIndexInfo () {
return req.get('/promoter/index')
}
export function recommendMember(params = {}) {
export function recommendMember (params = {}) {
return req.get('/promoter/children', params)
}
export function recommendOrder(params = {}) {
export function recommendOrder (params = {}) {
return req.get('/promoter/brokerages', params)
}
export function depositToPoint(params = {}) {
export function depositToPoint (params = {}) {
return req.post('/deposit/to/point', params)
}
export function pointDraw(params = {}) {
export function pointDraw (params = {}) {
return req.get('/promotion/luckydraw', params)
}
export function pointDrawRule() {
export function pointDrawRule () {
return req.get('/promotion/luckyrules')
}
export function pointDrawSwiper() {
export function pointDrawSwiper () {
return req.get('/promotion/luckydraw_show')
}
export function pointDrawDetail(luckydraw_id) {
export function pointDrawDetail (luckydraw_id) {
return req.get(`/promotion/luckydraw/${luckydraw_id}`)
}
export function pointDrawIntro(item_id) {
export function pointDrawIntro (item_id) {
return req.get(`/goods/itemintro/${item_id}`)
}
export function pointDrawPay(params = {}) {
export function pointDrawPay (params = {}) {
return req.post('/promotion/luckydraworder', params)
}
export function pointDrawPayList(params = {}) {
export function pointDrawPayList (params = {}) {
return req.get('/promotion/luckydraw/joinactivitys', params)
}
export function pointDrawLuck(params = {}) {
export function pointDrawLuck (params = {}) {
return req.get('/promotion/luckydrawmember', params)
}
export function pointOrderDetail(luckydraw_trade_id) {
export function pointOrderDetail (luckydraw_trade_id) {
return req.get(`/promotion/member/luckydraworder/${luckydraw_trade_id}`)
}
export function pointOrderAddress(params = {}) {
export function pointOrderAddress (params = {}) {
return req.post('/promotion/member/luckyaddress', params)
}
export function pointOrderConfirm(params = {}) {
export function pointOrderConfirm (params = {}) {
return req.post('/promotion/member/luckyorderfinish', params)
}
export function pointDrawLuckAll() {
export function pointDrawLuckAll () {
return req.get(`/promotion/luckydrawmember`)
}
export function pointMyOrder(params = {}) {
export function pointMyOrder (params = {}) {
return req.get(`/promotion/luckydrawjoinlist`, params)
}
export function pointAllOrder(luckydraw_id, params = {}) {
export function pointAllOrder (luckydraw_id, params = {}) {
return req.get(`/promotion/luckydraw/alljoinlist/${luckydraw_id}`, params)
}
export function pointCompute(luckydraw_id) {
export function pointCompute (luckydraw_id) {
return req.get(`/promotion/luckydraw/winning/${luckydraw_id}`)
}
export function pointCheckLucky(luckydraw_id) {
export function pointCheckLucky (luckydraw_id) {
return req.get(`/promotion/luckydraw/checkwinning/${luckydraw_id}`)
}
export function pointComputeResult(luckydraw_id) {
export function pointComputeResult (luckydraw_id) {
return req.get(`/promotion/luckydraw/luckylogic/${luckydraw_id}`)
}
export function storeFav(id) {
export function storeFav (id) {
return req.post(`/member/collect/distribution/${id}`)
}
export function storeFavDel(id) {
export function storeFavDel (id) {
return req.delete('/member/collect/distribution', { distributor_id: id })
}
export function storeFavList() {
export function storeFavList () {
return req.get('/member/collect/distribution')
}
export function storeFavCount(params = {}) {
export function storeFavCount (params = {}) {
return req.get('/member/collect/distribution/num', params)
}
export function storeIsFav(id) {
export function storeIsFav (id) {
return req.get('/member/collect/distribution/check', { distributor_id: id })
}
export function receiveVip() {
export function receiveVip () {
return req.get('/promotion/getMemberCard')
}
// 获取导购信息
export function getSalesperson(params = {}) {
export function getSalesperson (params = {}) {
return req.get('/salesperson', params)
}
// 获取导购投诉列表
export function getComplaintsList(params = {}) {
export function getComplaintsList (params = {}) {
return req.get('/salesperson/complaintsList', params)
}
// 导购投诉
export function setComplaints(params = {}) {
export function setComplaints (params = {}) {
return req.post('/salesperson/complaints', params)
}
// 获取导购投诉详情
export function getComplaintsDetail(id, params = {}) {
export function getComplaintsDetail (id, params = {}) {
return req.get(`/salesperson/complaintsDetail/${id}`, params)
}
// 获取导购
export function getUsersalespersonrel(params = {}) {
export function getUsersalespersonrel (params = {}) {
return req.get('/usersalespersonrel', params)
}
// 绑定导购
export function setUsersalespersonrel(params = {}) {
export function setUsersalespersonrel (params = {}) {
return req.post('/usersalespersonrel', params)
}
// 获取积分列表
export function getPointList(params = {}) {
export function getPointList (params = {}) {
return req.get('/member/pointLogList', params)
}
//
export function getSalespersonNologin(params = {}) {
export function getSalespersonNologin (params = {}) {
return req.get('/salesperson/nologin', params)
}
//
export function getUserNewGetCardDetail(params = {}) {
export function getUserNewGetCardDetail (params = {}) {
return req.get('/user/newGetCardDetail', params)
}
// 经销商入驻申请
export function hfpayApplySave(params = {}) {
export function hfpayApplySave (params = {}) {
return req.post('/hfpay/applysave', params)
}
// 经销商入驻详情
export function hfpayUserApply(params = {}) {
export function hfpayUserApply (params = {}) {
return req.get('/hfpay/userapply', params)
}
// 绑定银行卡
export function hfpayBankSave(params = {}) {
export function hfpayBankSave (params = {}) {
return req.post('/hfpay/banksave', params)
}
// 获取绑定银行卡
export function hfpayBankInfo(params = {}) {
export function hfpayBankInfo (params = {}) {
return req.get('/hfpay/bankinfo', params)
}
// 获取获取支付方式
export function getTradePaymentList(params = {}) {
export function getTradePaymentList (params = {}) {
return req.get('/trade/payment/list', params)
}
// 获取新的支付方式
export function getNewTradePaymentList(params = {}) {
export function getNewTradePaymentList (params = {}) {
return req.get('/trade/withdraw/list', params)
}
export function getIsHf(params = {}) {
export function getIsHf (params = {}) {
return req.get('/trade/payment/hfpayversionstatus', params)
}
//获取是否开启获取crm地址
export function getCrmsetting() {
export function getCrmsetting () {
return req.get('/member/crmsetting')
}
// 配置地址
export function getSettingCenter() {
export function getSettingCenter () {
return req.get(transformPlatformUrl('/alipay/pageparams/setting'), {
template_name: platformTemplateName,
version: 'v1.0.1',
@ -366,20 +368,20 @@ export function getSettingCenter() {
}
// 获取核销码
export function getQRcode(params) {
export function getQRcode (params) {
return req.get('/user/exchangeCardInfo', params)
}
// 会员等级
export function getMemberCard() {
export function getMemberCard () {
return req.get('/membercard/grades')
}
// 会员中心分享配置
export function getMemberShareConfig() {
export function getMemberShareConfig () {
return req.get('/memberCenterShare/getInfo')
}
export function is_admin(params) {
export function is_admin (params) {
return req.get('/distributor/bind/checkout', params)
}

View File

@ -373,7 +373,7 @@ const config = {
"getLocation",
"chooseAddress"
],
"__usePrivacyCheck__": true
// "__usePrivacyCheck__": true
}
if (process.env.TARO_ENV == 'weapp') {

View File

@ -72,7 +72,7 @@ export default class AddressChoose extends Component {
{/* <View className='sp-cell__ft-icon iconfont icon-arrowRight'></View> */}
</View>
) : (
<View className='address-info__bd'>+请选择收货地址</View>
<View className='address-info__bd' onClick={this.clickTo.bind(this, 'choose')}>+请选择收货地址</View>
)}
</View>
</View>

View File

@ -12,8 +12,8 @@ import './index.scss'
const initialState = {
isExpanded: false
}
function SpCoupon(props) {
const { info, children, onClick = () => {} } = props
function SpCoupon (props) {
const { info, children, onClick = () => { }, isNew } = props
const [state, setState] = useImmer(initialState)
const { isExpanded } = state
if (!info) {
@ -34,12 +34,37 @@ function SpCoupon(props) {
description,
quantity,
getNum,
distributorName
distributorName,
couponStatus,
id,
fixedTerm,
status,
valid,
} = info
const { tag, invalidBg, bg } = COUPON_TYPE[cardType]
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 = () => {
if (cardType === 'cash') {
return (
@ -79,9 +104,9 @@ function SpCoupon(props) {
<View className='sp-coupon-content'>
<View
className='sp-coupon-hd'
// style={styleNames({
// backgroundImage: `url(${process.env.APP_IMAGE_CDN}${'/coupon_FFF.png'})`
// })}
// style={styleNames({
// backgroundImage: `url(${process.env.APP_IMAGE_CDN}${'/coupon_FFF.png'})`
// })}
>
<View className='couponn-info'>
<View
@ -92,32 +117,31 @@ function SpCoupon(props) {
>
{COUPON_TYPE[cardType].tag}
</View>
<View className='title'>{`${
VERSION_PLATFORM && distributorName ? `${distributorName}: ${title}` : title
}`}</View>
<View className='title'>{`${VERSION_PLATFORM && distributorName ? `${distributorName}: ${title}` : title
}`}</View>
</View>
<View className='coupon-datetime'>{`有效期: ${beginDate} - ${endDate}`}</View>
<View className='coupon-desc'>
{info.valid &&
(
<>
<Text className='coupon-desc-txt'>详细信息</Text>
<SpImage
src={`${isExpanded ? 'coupon_arrow_up.png' : 'coupon_arrow_down.png'}`}
width={24}
height={24}
onClick={() => {
setState((draft) => {
draft.isExpanded = !isExpanded
})
}}
/>
</>
)
}
{!info.valid && (
<View className='invaild-desc'>{info.invalidDesc}</View>
)}
{info.valid &&
(
<>
<Text className='coupon-desc-txt'>详细信息</Text>
<SpImage
src={`${isExpanded ? 'coupon_arrow_up.png' : 'coupon_arrow_down.png'}`}
width={24}
height={24}
onClick={() => {
setState((draft) => {
draft.isExpanded = !isExpanded
})
}}
/>
</>
)
}
{!info.valid && (
<View className='invaild-desc'>{info.invalidDesc}</View>
)}
</View>
</View>
<View

View File

@ -65,7 +65,7 @@
.coupon-desc-txt {
margin-right: 6px;
}
.invaild-desc{
.invaild-desc {
color: red;
font-size: 24px;
}
@ -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;
}
}
}

View File

@ -86,7 +86,7 @@ function SpGoodsCell (props) {
)}
</View>
</View>
<View className='labels-block'>
{false && <View className='labels-block'>
{!isNaN(memberPrice) && !VERSION_IN_PURCHASE && (
<View className='goods-type'>
{vipInfo?.isVip ? vipInfo?.grade_name : userInfo?.gradeInfo?.grade_name}
@ -126,7 +126,7 @@ function SpGoodsCell (props) {
return <View className='goods-type'>{limitTxt}</View>
})}
{/* {limitTxt && <View className='goods-type'>{limitTxt}</View>} */}
</View>
</View>}
<View className='item-ft'>
{info.num && <Text className='item-num'>数量{info.num}</Text>}

View File

@ -134,7 +134,7 @@ function SpGoodsItem (props) {
<View className={classNames('sp-goods-item')} onClick={handleClick.bind(this)}>
<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"} />
{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>
{/* {renderBrand && <View className='goods-brand-wrap'>{renderBrand}</View>} */}

View File

@ -75,8 +75,9 @@
font-size: 20px;
color: #c1c1c1;
}
.sp-price__symbol,
.sp-price__int {
font-weight: bold !important;
}
// .sp-price__symbol,
// .sp-price__int,
// .sp-price__decimal {
// font-weight: bold !important;
// }
}

View File

@ -1,4 +1,4 @@
import { formatTime } from '@/utils'
import { formatTime, diffInDays } from '@/utils'
export const COUPON_ITEM = {
title: 'title',
@ -6,7 +6,7 @@ export const COUPON_ITEM = {
cardId: 'card_id',
cardType: 'card_type',
code: 'code',
invalidDesc:'invalid_desc',
invalidDesc: 'invalid_desc',
beginDate: ({ begin_date }) => begin_date.replace(/-/g, '.'),
endDate: ({ end_date }) => end_date.replace(/-/g, '.'),
tagClass: 'tagClass',
@ -24,12 +24,26 @@ export const COUPON_ITEM = {
status: 'status',
getNum: 'get_num',
valid: ({ valid }) => {
if(typeof valid === 'undefined') {
if (typeof valid === 'undefined') {
return true
} else {
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 = {
@ -49,22 +63,24 @@ export const COUPON = {
description: 'description',
quantity: ({ quantity }) => parseInt(quantity),
getNum: 'get_num',
couponStatus: ({ quantity, get_limit, user_get_num, get_num}) => {
if(quantity - get_num <= 0) {
couponStatus: ({ quantity, get_limit, user_get_num, get_num }) => {
if (quantity - get_num <= 0) {
return 0 // 已领完
} else if(get_limit - user_get_num > 0) {
} else if (get_limit - user_get_num > 0) {
return 1 // 立即领取
} else if(get_limit - user_get_num <= 0) {
} else if (get_limit - user_get_num <= 0) {
return 2 // 已领取
}
},
distributorName: ({ distributor_info }) => {
return distributor_info?.name
},
fixedTerm: 'fixed_term',
sourceType: 'source_type',
sourceId: 'source_id',
point: ({ point }) => +point,
valid: ({ valid }) => {
if(typeof valid === 'undefined') {
if (typeof valid === 'undefined') {
return true
} else {
return valid

View File

@ -214,7 +214,7 @@ function AddressIndex (props) {
)} */}
<View className='member-address-list'>
{list?.length && list.map((item, index) => {
{list?.length > 0 && list.map((item, index) => {
return (
<View
key={item[ADDRESS_ID]}

View File

@ -17,7 +17,7 @@ const initialState = {
czOrder: false
}
function CashierResult(props) {
function CashierResult (props) {
const $instance = getCurrentInstance()
const { cashierPayment } = usePayment()
@ -105,7 +105,7 @@ function CashierResult(props) {
tradeInfo?.tradeSourceType == 'normal_seckill' ||
tradeInfo?.tradeSourceType == 'normal_groups') && (
<View className='btn-wrap'>
<SpButton
{/* <SpButton
resetText='首页'
confirmText='订单详情'
onReset={() => {
@ -114,7 +114,24 @@ function CashierResult(props) {
onConfirm={() => {
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>
)}
@ -123,7 +140,7 @@ function CashierResult(props) {
tradeInfo?.tradeSourceType == 'normal_pointsmall_pointsmall') && (
<View className='btn-wrap'>
<SpButton
resetText='首页'
resetText='返回'
confirmText='订单详情'
onReset={() => {
Taro.redirectTo({ url: '/pages/index' })

View File

@ -8,7 +8,7 @@
flex-direction: column;
}
.icon-roundcheckfill {
font-size: 40px;
font-size: 80px;
color: var(--color-primary);
}
.trade-txt {

View File

@ -9,6 +9,7 @@
&-bd {
flex: 1;
position: relative;
height: 150px;
}
&-image {
width: 220px;

View File

@ -35,6 +35,7 @@ export const initialState = {
paramsInfo: {}, // 结算接口参数
discountInfo: [],
couponInfo: {}, // 优惠券信息
couponTotal: 0,
remark: '', // 备注
// 积分相关
isPointOpen: false,

View File

@ -105,7 +105,8 @@ function CartCheckout (props) {
buildingNumber,
houseNumber, // 房号
routerParams, // 路由参数
orderTtems
orderTtems,
couponTotal
} = state
const {
@ -127,6 +128,7 @@ function CartCheckout (props) {
useEffect(() => {
if (isLogin) {
getTradeSetting()
getCouponList()
// tode 此处应有埋点
return () => {
dispatch(changeCoupon()) // 清空优惠券信息
@ -161,6 +163,20 @@ function CartCheckout (props) {
}
}, [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 () => {
let data = await api.trade.tradeSetting()
@ -403,9 +419,12 @@ function CartCheckout (props) {
price
}
})
let url = `/subpages/marketing/coupon-picker?items=${JSON.stringify(
items
)}&is_checkout=true&cart_type=${cart_type}&distributor_id=${shop_id || id}&source=${source}`
let url = `/subpages/marketing/coupon-picker`
// let url = `/subpages/marketing/coupon`
+ `?items=${JSON.stringify(
items
)}&is_checkout=true&cart_type=${cart_type}&distributor_id=${shop_id || id}&source=${source}`
if (couponInfo?.coupon_code) {
url = `${url}&coupon=${couponInfo?.coupon_code}`
}
@ -527,7 +546,7 @@ function CartCheckout (props) {
receiver_district,
item_fee_new,
market_fee,
items_promotion
items_promotion,
} = orderRes
let subdistrictRes
@ -554,7 +573,8 @@ function CartCheckout (props) {
// }
coupon_id: id,
coupon_code: coupon_code,
title: info
title: info,
...coupon_info
}
setState((draft) => {
draft.couponInfo = _info
@ -587,7 +607,7 @@ function CartCheckout (props) {
point_fee, //积分抵扣金额,
item_point,
freight_type,
promotion_discount
promotion_discount,
}
const point_info = {
@ -716,7 +736,7 @@ function CartCheckout (props) {
if (VERSION_PLATFORM) {
delete cus_parmas.isNostores
}
console.log(couponInfo)
console.log(couponInfo, '优惠券信息')
const _coupon = coupon || couponInfo
if (!isEmpty(_coupon)) {
const { coupon_id, coupon_code, title } = _coupon
@ -863,6 +883,14 @@ function CartCheckout (props) {
))}
</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='line'>
<View className='left'>订单金额</View>
@ -876,13 +904,13 @@ function CartCheckout (props) {
<View className='line'>
<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 className='line'>
<View className='left'>运费</View>
<View className='right'>
{totalInfo.freight_type !== 'point'
? `¥${totalInfo.freight_fee}`
? `¥ ${totalInfo.freight_fee}`
: `${totalInfo.freight_fee * 100}${this.props.pointName}`}
</View>
</View>

View File

@ -219,8 +219,21 @@ $margin24: 10px;
background: #fff;
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 {
padding: 20px 24px;
padding: 20px 0px;
.line {
display: flex;
width: 100%;

View File

@ -37,6 +37,7 @@
padding-top: 40px;
/* #endif */
margin-bottom: 36px;
padding-bottom: 100px;
&-shadow {
// box-shadow: 0px 2px 10px 0px #eae7e0;
}
@ -154,7 +155,7 @@
}
.cart-item-wrap {
padding: 60px 36px;
padding: 60px 36px 100px;
display: flex;
align-items: center;
background: #f7f7f7;

View File

@ -330,7 +330,7 @@ function EspierDetail (props) {
const res = await api.member.itemHistory()
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
})
@ -585,21 +585,21 @@ function EspierDetail (props) {
<View className='goods-info'>
<CompVipGuide
{/* <CompVipGuide
info={{
...info.vipgradeGuideTitle,
memberPrice: info.memberPrice
}}
/>
/> */}
<CompCouponList
{/* <CompCouponList
info={
info.couponList.list.length > 3
? info.couponList.list.slice(0, 3)
: info.couponList.list
}
onClick={handleReceiveCoupon}
/>
/> */}
<View className='goods-name-wrap'>
<View className='goods-name'>
@ -779,11 +779,11 @@ function EspierDetail (props) {
isAnimation={false}
onClick={() => {
setState((draft) => {
// draft.introList[index].isOpen = !draft.introList[index].isOpen
draft.introList = draft.introList.map((v, i) => {
v.isOpen = (i === index)
v.isOpen = false
return v
})
draft.introList[index].isOpen = !item.isOpen
})
}}
title={item.title}
@ -792,11 +792,11 @@ function EspierDetail (props) {
</AtAccordion>
<View onClick={() => {
setState((draft) => {
// draft.introList[index].isOpen = !draft.introList[index].isOpen
draft.introList = draft.introList.map((v, i) => {
v.isOpen = (i === index)
v.isOpen = false
return v
})
draft.introList[index].isOpen = !item.isOpen
})
}}>
{item.isOpen ? <AtIcon value='subtract' size='16' color='#000' /> :
@ -804,7 +804,7 @@ function EspierDetail (props) {
{item.isOpen ? <></> : <View className="line"></View>}
</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>
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">
{historyList.map((item, idx) => (
@ -819,7 +819,7 @@ function EspierDetail (props) {
</View>
))}
</ScrollView>
</View>}
</View> : <></>}
</View>
</ScrollView>
)}

View File

@ -2,8 +2,8 @@ import React, { Component } from 'react'
import Taro, { getCurrentInstance } from '@tarojs/taro'
import { View, Text, Button, Image, ScrollView } from '@tarojs/components'
import { connect } from 'react-redux'
import { AtCountdown } from 'taro-ui'
import { Loading, SpNavBar, FloatMenuMeiQia, SpNewShopItem, SpPage, SpPrice } from '@/components'
import { AtCountdown, AtCurtain } from 'taro-ui'
import { Loading, SpNavBar, FloatMenuMeiQia, SpNewShopItem, SpPage, SpPrice, SpImage } from '@/components'
import {
log,
pickBy,
@ -84,7 +84,9 @@ export default class TradeDetail extends Component {
cancelData: {},
tradeInfo: {},
showQRcode: false,
distributor: {}
distributor: {},
showDeliveryModal: false,
deliveryList: []
}
}
@ -480,10 +482,27 @@ export default class TradeDetail extends Component {
}
}
handleClickDelivery = () => {
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}`
handleClickDelivery = async (flag) => {
Taro.showLoading({ title: '' })
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) => {
@ -668,7 +687,8 @@ export default class TradeDetail extends Component {
tradeInfo,
showQRcode,
pickup_code,
distributor
distributor,
showDeliveryModal
} = this.state
if (!info) {
@ -916,7 +936,7 @@ export default class TradeDetail extends Component {
<>
<View className="address-txt info-trade">
<Text>物流信息</Text>
<Text className='right'>查看详情</Text>
<Text className='right' onClick={() => this.handleClickDelivery(true)}>查看详情</Text>
</View>
<View className='address-detail' style={{ marginTop: '4rpx' }}>物流单号{info.receiver_name}</View>
<View className='address-detail'>物流公司{info.receiver_name}</View>
@ -987,8 +1007,8 @@ export default class TradeDetail extends Component {
</View>
)}
<View className='trade-money'>
{/* <View>
{/* <View className='trade-money'> */}
{/* <View>
总计
{this.isPointitemGood() ? (
<Text className='trade-money__point'>
@ -1002,7 +1022,7 @@ export default class TradeDetail extends Component {
<Text className='trade-money__num'>{info.totalpayment}</Text>
)}
</View> */}
{/* {!info.is_logistics &&
{/* {!info.is_logistics &&
info.can_apply_cancel != 0 &&
(info.status === 'WAIT_BUYER_PAY' ||
(info.status === 'WAIT_SELLER_SEND_GOODS' &&
@ -1015,7 +1035,7 @@ export default class TradeDetail extends Component {
</View>
</View>
)} */}
</View>
{/* </View> */}
{/* {info.remark && (
<View className='trade-detail-remark'>
<View className='trade-detail-remark__header'>订单备注</View>
@ -1139,7 +1159,7 @@ export default class TradeDetail extends Component {
<View className='left'>物流单号</View>
<View className='right'>
<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
@ -1281,6 +1301,39 @@ export default class TradeDetail extends Component {
</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>
)
}

View File

@ -26,7 +26,7 @@ $paddingBottom: 100px;
}
.scroll-view {
@include page-scroll(var(--nav-height), 140px);
@include page-scroll(calc(var(--nav-height) + 16px), 140px);
}
&.has-navbar {
@ -249,7 +249,7 @@ $paddingBottom: 100px;
}
}
.trade-detail-goods {
margin: 14px 22px 0;
margin: 0px 22px;
// padding-top: 16px;
padding: 40px 30px 40px 20px;
min-height: 100px;
@ -696,4 +696,57 @@ $paddingBottom: 100px;
color: #0091ff;
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;
}
}
}

View File

@ -169,7 +169,7 @@ export default class InvoiceList extends Component {
</View>
)
})}
{!page.isLoading && list?.length && <View className="bottom">
{!page.isLoading && list?.length > 0 && <View className="bottom">
<View className="bottom-line">
<View className="left">已选{1}个订单共计
<SpPrice size={20} className='total-pirce' value={900900 / 100} showSeparator noDecimal />

View File

@ -127,7 +127,8 @@ export default class TradeList extends Component {
order_status_des: 'order_status_des',
status: ({ order_status }) => resolveOrderStatus(order_status),
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',
pay_type: 'pay_type',
point: 'point',
@ -162,7 +163,8 @@ export default class TradeList extends Component {
origincountry_img_url: 'origincountry_img_url',
type: 'type',
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',
point: 'item_point',
num: 'num',

View File

@ -1,4 +1,4 @@
import React, { useEffect } from 'react'
import React, { useEffect, useRef } from 'react'
import { useSelector } from 'react-redux'
import { useImmer } from 'use-immer'
import Taro, { getCurrentInstance } from '@tarojs/taro'
@ -18,6 +18,7 @@ function CouponCenter (props) {
const $instance = getCurrentInstance()
const [state, setState] = useImmer(initialState)
const { couponList } = state
const listRef = useRef(null)
useEffect(() => { getMypoint() }, [])
@ -54,6 +55,23 @@ function CouponCenter (props) {
}
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) {
showToast('优惠券已领完')
} else if (item.couponStatus == 1) {
@ -80,7 +98,7 @@ function CouponCenter (props) {
getCoupon(item, index)
}
} else {
showToast('优惠券领取机会已用完')
showToast('优惠券领取完')
}
}
@ -99,6 +117,7 @@ function CouponCenter (props) {
})
}
showToast('优惠券领取成功')
getMypoint()
} else {
showToast('优惠券领取失败')
}
@ -131,19 +150,27 @@ function CouponCenter (props) {
console.log('handleRedeem:', item)
}
const getPoint = async () => {
await api.member.depositToPoint({ money: 50000 })
showToast('积分+500')
setState((draft) => {
draft.couponList = []
})
listRef.current?.reset()
}
return (
<SpPage className='page-coupon-center' scrollToTopBtn>
<View className='pointshop-hd'>
<View className='point-info'>
<View className='point-total'>
{/* <SpPoint value={point} /> */}
<Text className='title'>我的积分</Text>
<Text className='title' onClick={getPoint}>我的积分</Text>
<Text className='point'>{(point || 0).toString()}</Text>
</View>
<View className="coupon" onClick={() => Taro.navigateTo({ url: '/subpages/marketing/coupon' })}>我的优惠券</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 />
<Text className='empty-text'>暂无优惠券</Text></View>}>
{couponList.map((item, index) => {
@ -166,21 +193,22 @@ function CouponCenter (props) {
</SpCoupon>
</View>
}
return <SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item, index)} isNew />
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%'
})}>
<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 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.leastCost}可用</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>
<View className="coupons-list-item-integral">{item.title}</View>
{/* {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 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 File

@ -46,7 +46,8 @@
}
}
.list-scroll {
padding: 20px;
// padding: 20px;
padding: 0 50px;
.coupon-item-wrap {
&:not(:last-child) {
margin-bottom: 20px;
@ -57,8 +58,8 @@
width: 100%;
border-radius: 10px;
overflow: hidden;
background: #5b5b5b;
margin-bottom: 30px;
// background: #5b5b5b;
// margin-bottom: 30px;
display: flex;
color: #fff;
min-height: 175px;

View File

@ -15,10 +15,10 @@ const initialState = {
couponListInVaild: [],
select: null
}
function CouponPicker(props) {
function CouponPicker (props) {
const $instance = getCurrentInstance()
const [state, setState] = useImmer(initialState)
let { couponListVaild,couponListInVaild, select } = state
let { couponListVaild, couponListInVaild, select } = state
const dispatch = useDispatch()
const fetch = async ({ pageIndex, pageSize }) => {
@ -47,12 +47,12 @@ function CouponPicker(props) {
const { list, total_count: total } = await api.cart.coupons(params)
const couponListNewVaul = pickBy(list, doc.coupon.COUPON_ITEM)
couponListVaild = couponListNewVaul.filter(item=>item.valid)
couponListInVaild = couponListNewVaul.filter(item=>!item.valid)
couponListVaild = couponListNewVaul.filter(item => item.valid)
couponListInVaild = couponListNewVaul.filter(item => !item.valid)
setState((draft) => {
draft.couponListVaild = couponListVaild,
draft.couponListInVaild = couponListInVaild,
draft.select = coupon
draft.couponListInVaild = couponListInVaild,
draft.select = coupon
})
return {
total
@ -62,7 +62,7 @@ function CouponPicker(props) {
const onChangeSelectCoupon = (item, e) => {
let payload = null
// 不使用优惠券
if(item) {
if (item) {
const { cardId, code, title } = item
payload = {
coupon_id: cardId,
@ -103,15 +103,15 @@ function CouponPicker(props) {
<SpScrollView className='list-scroll' fetch={fetch}>
{couponListVaild.map((item, index) => (
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
<SpCoupon info={item} />
<SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/>
<SpCoupon info={item} onClick={onChangeSelectCoupon.bind(this, item)} />
{/* <SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/> */}
</View>
))}
{ couponListInVaild.length>0 ? <View className='invalid-title'>不可用优惠券</View> :''}
{couponListInVaild.length > 0 ? <View className='invalid-title'>不可用优惠券</View> : ''}
{couponListInVaild.map((item, index) => (
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
<SpCoupon info={item} />
<SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/>
<SpCoupon info={item} onClick={onChangeSelectCoupon.bind(this, item)} />
{/* <SpCheckboxNew onChange={onChangeSelectCoupon.bind(this, item)} disabled={!item.valid} checked={select == item.code}/> */}
</View>
))}
</SpScrollView>

View File

@ -120,38 +120,21 @@ function CouponIndex () {
<SpImage src='member/quan-empty.png' width={138} height={138} isNew />
<Text className='empty-text'>暂无优惠券</Text></View>}>
{couponList.map((item, index) => (
// <View className='coupon-item-wrap' key={`coupon-item__${index}`}>
// <SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item)}>
// {item.cardType != 'new_gift' && <Text>去使用</Text>}
// {item.cardType == 'new_gift' && (
// <Text>
// {item?.tagClass == 'notstarted'
// ? '未开始'
// : {
// '1': '去使用',
// '10': '待核销'
// }[item.status]}
// </Text>
// )}
// </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 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>)
<View className='coupon-item-wrap' key={`coupon-item__${index}`}>
<SpCoupon info={item} onClick={handleClickCouponItem.bind(this, item)}>
{/* {item.cardType != 'new_gift' && <Text>使</Text>}
{item.cardType == 'new_gift' && (
<Text>
{item?.tagClass == 'notstarted'
? '未开始'
: {
'1': '去使用',
'10': '待核销'
}[item.status]}
</Text>
)} */}
</SpCoupon>
</View>
))}
</SpScrollView>
</SpPage>

View File

@ -1,18 +1,18 @@
.page-marketing-coupon {
.list-scroll {
padding: 20px 50px;
.coupon-item-wrap {
&:not(:last-child) {
margin-bottom: 20px;
}
}
padding: 0px 50px;
// .coupon-item-wrap {
// &:not(:last-child) {
// margin-bottom: 20px;
// }
// }
.coupons-list {
&-item {
width: 100%;
border-radius: 10px;
overflow: hidden;
background: #5b5b5b;
margin-bottom: 30px;
// background: #5b5b5b;
// margin-bottom: 30px;
display: flex;
color: #fff;
min-height: 175px;

View File

@ -30,49 +30,49 @@ export * from './platforms'
const isPrimitiveType = (val, type) => Object.prototype.toString.call(val) === type
export function isFunction(val) {
export function isFunction (val) {
return isPrimitiveType(val, '[object Function]')
}
export function uniqueFunc(arr, uniId) {
const res = new Map();
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1));
export function uniqueFunc (arr, uniId) {
const res = new Map()
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1))
}
export function isNumber(val) {
export function isNumber (val) {
return isPrimitiveType(val, '[object Number]')
}
export function isPointerEvent(val) {
export function isPointerEvent (val) {
return isPrimitiveType(val, '[object PointerEvent]')
}
export function isObject(val) {
export function isObject (val) {
return isPrimitiveType(val, '[object Object]')
}
export function isBoolean(val) {
export function isBoolean (val) {
return isPrimitiveType(val, '[object Boolean]')
}
export function isArray(arr) {
export function isArray (arr) {
return Array.isArray(arr)
}
export function isString(val) {
export function isString (val) {
return typeof val === 'string'
}
export function isEmpty(obj) {
export function isEmpty (obj) {
return _isEmpty(obj)
}
export function removeItemInArray(array, fn) {
export function removeItemInArray (array, fn) {
_remove(array, fn)
// return array
}
export function isObjectsValue(val) {
export function isObjectsValue (val) {
// 判断对象是否有值 true有 false
return val && Object.keys(val).length > 0
}
@ -122,7 +122,7 @@ export const getBrowserEnv = () => {
/** 在H5平台(微信浏览器) */
export const isWxWeb = isWeb && !!getBrowserEnv().weixin
export function isObjectValueEqual(a, b) {
export function isObjectValueEqual (a, b) {
var aProps = Object.getOwnPropertyNames(a)
var bProps = Object.getOwnPropertyNames(b)
if (aProps.length != bProps.length) {
@ -177,7 +177,7 @@ export const isIphoneX = () => {
}
// TODO: 验证方法在h5及边界情况稳定性
export function getCurrentRoute() {
export function getCurrentRoute () {
const router = getCurrentInstance().router
// eslint-disable-next-line
const { $taroTimestamp, ...params } = router.params || {}
@ -192,7 +192,7 @@ export function getCurrentRoute() {
}
// 除以100以后的千分符
export function formatPriceToHundred(price) {
export function formatPriceToHundred (price) {
if (price) {
return (Number(price) / 100)
.toFixed(2)
@ -203,11 +203,11 @@ export function formatPriceToHundred(price) {
}
}
export function thousandthFormat(value) {
export function thousandthFormat (value) {
return (value.toString() + '').replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
}
export async function normalizeQuerys(params = {}) {
export async function normalizeQuerys (params = {}) {
const { scene, ...rest } = params
const queryStr = decodeURIComponent(scene)
const obj = qs.parse(queryStr)
@ -228,7 +228,7 @@ export async function normalizeQuerys(params = {}) {
return ret
}
export function pickBy(arr = [], keyMaps = {}) {
export function pickBy (arr = [], keyMaps = {}) {
const picker = (item) => {
const ret = {}
@ -256,7 +256,7 @@ export function pickBy(arr = [], keyMaps = {}) {
}
}
export function navigateTo(url, isRedirect) {
export function navigateTo (url, isRedirect) {
if (isObject(isRedirect) || isPointerEvent(isRedirect)) {
isRedirect = false
}
@ -268,23 +268,26 @@ export function navigateTo(url, isRedirect) {
return Taro.navigateTo({ url })
}
export function resolvePath(baseUrl, params = {}) {
export function resolvePath (baseUrl, params = {}) {
const queryStr = typeof params === 'string' ? params : qs.stringify(params)
return `${baseUrl}${baseUrl.indexOf('?') >= 0 ? '&' : '?'}${queryStr}`
}
export function formatTime(time, formatter = 'YYYY-MM-DD') {
export function diffInDays (time1, time2) {
return Math.abs(dayjs(time1).diff(dayjs(time2), 'day'))
}
export function formatTime (time, formatter = 'YYYY-MM-DD') {
const newTime = time.toString().length < 13 ? time * 1000 : time
return dayjs(newTime).format(formatter)
}
export function formatDateTime(time, formatter = 'YYYY-MM-DD HH:mm:ss') {
export function formatDateTime (time, formatter = 'YYYY-MM-DD HH:mm:ss') {
const newTime = time.toString().length < 13 ? time * 1000 : time
return dayjs(newTime).format(formatter)
}
export function copyText(text, msg = '内容已复制') {
export function copyText (text, msg = '内容已复制') {
return new Promise((resolve, reject) => {
if (process.env.TARO_ENV === 'weapp') {
Taro.setClipboardData({
@ -297,7 +300,7 @@ export function copyText(text, msg = '内容已复制') {
console.log('copyText:text', text)
my.setClipboard({
text: text,
});
})
resolve(text)
return
}
@ -311,7 +314,7 @@ export function copyText(text, msg = '内容已复制') {
})
}
export function calcTimer(totalSec) {
export function calcTimer (totalSec) {
let remainingSec = totalSec
const dd = Math.floor(totalSec / 24 / 3600)
remainingSec -= dd * 3600 * 24
@ -329,7 +332,7 @@ export function calcTimer(totalSec) {
}
}
export function resolveOrderStatus(status, isBackwards) {
export function resolveOrderStatus (status, isBackwards) {
if (isBackwards) {
return _findKey(STATUS_TYPES_MAP, (o) => o === status)
}
@ -337,7 +340,7 @@ export function resolveOrderStatus(status, isBackwards) {
return STATUS_TYPES_MAP[status]
}
export function goToPage(page) {
export function goToPage (page) {
// eslint-disable-next-line
const loc = location
page = page.replace(/^\//, '')
@ -346,14 +349,14 @@ export function goToPage(page) {
loc.href = url
}
export function maskMobile(mobile) {
export function maskMobile (mobile) {
return mobile.replace(/^(\d{2})(\d+)(\d{2}$)/, '$1******$3')
}
// 不可使用promise/async异步写法
export function authSetting(scope, succFn, errFn) {
export function authSetting (scope, succFn, errFn) {
Taro.getSetting({
success(res) {
success (res) {
const result = res.authSetting[isWeixin ? `scope.${scope}` : `${scope}`]
if (isWeixin) {
if (result === undefined) {
@ -377,13 +380,13 @@ export function authSetting(scope, succFn, errFn) {
}
}
},
fail(res) {
fail (res) {
console.error(res)
}
})
}
export function imgCompression(url) {
export function imgCompression (url) {
const rule = '?imageView2/1/w/80'
return url + rule
}
@ -442,7 +445,7 @@ const getUrl = (url) => {
return `${hrefList[0]}//${hrefList[2]}${url}`
}
export function tokenParseH5(token) {
export function tokenParseH5 (token) {
try {
let base64Url = token.split('.')[1]
return JSON.parse(atob(base64Url))
@ -451,7 +454,7 @@ export function tokenParseH5(token) {
}
}
export function tokenParse(token) {
export function tokenParse (token) {
var base64Url = token.split('.')[1]
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
console.log('Taro.base64ToArrayBuffer', base64)
@ -470,7 +473,7 @@ export function tokenParse(token) {
}
// 解析字符串
function getQueryVariable(herf) {
function getQueryVariable (herf) {
const url = herf.split('?')
let query = {}
if (url[1]) {
@ -485,7 +488,7 @@ function getQueryVariable(herf) {
return query
}
/** 是否是合法的color */
function validColor(color) {
function validColor (color) {
var re1 = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i
var re2 =
/^rgb\(([0-9]|[0-9][0-9]|25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9])\,([0-9]|[0-9][0-9]|25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9])\,([0-9]|[0-9][0-9]|25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9])\)$/i
@ -506,7 +509,7 @@ function validColor(color) {
* }
* } data 新增上报数据
*/
export async function buriedPoint(data) {
export async function buriedPoint (data) {
const params = getCurrentInstance().router.params
let {
gu,
@ -559,7 +562,7 @@ export async function buriedPoint(data) {
*
*/
export function paramsSplice(params) {
export function paramsSplice (params) {
let str = ''
let arr = []
for (var key in params) {
@ -570,7 +573,7 @@ export function paramsSplice(params) {
return str
}
export function resolveFavsList(list, favs) {
export function resolveFavsList (list, favs) {
return list.map((t) => {
const { item_id } = t
return {
@ -581,7 +584,7 @@ export function resolveFavsList(list, favs) {
}
// 判断是否在导购货架
export function isGoodsShelves() {
export function isGoodsShelves () {
const system = Taro.getSystemInfoSync()
log.debug(`this system is: ${JSON.stringify(system)}`)
if (system && system.environment && system.environment === 'wxwork') {
@ -591,7 +594,7 @@ export function isGoodsShelves() {
}
}
export function styleNames(styles) {
export function styleNames (styles) {
if (!styles || typeof styles !== 'object') {
return '""'
}
@ -619,7 +622,7 @@ export function styleNames(styles) {
return `${styleNames}`
}
export function getThemeStyle() {
export function getThemeStyle () {
const result = store.getState()
const { colorPrimary, colorMarketing, colorAccent, rgb } = result.sys
return {
@ -630,13 +633,13 @@ export function getThemeStyle() {
}
}
export function isNavbar() {
export function isNavbar () {
return isWeb && !getBrowserEnv().weixin
}
export const hasNavbar = isWeb && !getBrowserEnv().weixin
export function showToast(title, callback) {
export function showToast (title, callback) {
Taro.showToast({
title,
icon: 'none'
@ -646,7 +649,7 @@ export function showToast(title, callback) {
}, 2000)
}
export function hex2rgb(hex) {
export function hex2rgb (hex) {
if (![4, 7].includes(hex.length)) {
throw new Error('格式错误')
}
@ -663,7 +666,7 @@ export function hex2rgb(hex) {
for (let i = 0, len = result.length; i < len; i += 2) {
rgb[i / 2] = getHexVal(result[i]) * 16 + getHexVal(result[i + 1])
}
function getHexVal(letter) {
function getHexVal (letter) {
let num = -1
switch (letter.toUpperCase()) {
case 'A':
@ -695,12 +698,12 @@ export function hex2rgb(hex) {
return rgb
}
export function exceedLimit({ size: fileSize }) {
export function exceedLimit ({ size: fileSize }) {
const size = fileSize / 1024 / 1024
return size > 15
}
function isBase64(str) {
function isBase64 (str) {
let isStr = str?.url ? str?.url : str
if (isStr.indexOf('data:') != -1 && isStr.indexOf('base64') != -1) {
return true
@ -715,7 +718,7 @@ const isMerchantModule = () => {
return /\/subpages\/merchant/.test(pathname)
}
function isUndefined(val) {
function isUndefined (val) {
return typeof val === 'undefined'
}
@ -725,7 +728,7 @@ const merchantIsvaild = async (parmas) => {
return status
}
export function getExtConfigData() {
export function getExtConfigData () {
const extConfig = Taro.getExtConfigSync ? Taro.getExtConfigSync() : {}
if (_isEmpty(extConfig)) {
return {
@ -798,7 +801,7 @@ const alipayAutoLogin = () => {
my.getAuthCode({
scopes: 'auth_base',
success: (res) => {
const code = res.authCode;
const code = res.authCode
resolve({ code })
},
fail: (res) => {
@ -815,19 +818,19 @@ const requestAlipayminiPayment = (tradeNO) => {
my.tradePay({
tradeNO: tradeNO,
success: (res) => {
console.log('支付回调成功res', res);
console.log('支付回调成功res', res)
resolve(res)
},
fail: (res) => {
console.log('支付回调失败res', res);
console.log('支付回调失败res', res)
reject(res)
}
});
})
})
}
const htmlStringToNodeArray = (htmlString) => {
let nodeArray = null;
let nodeArray = null
parse(htmlString, (err, nodes) => {
if (!err) {
nodeArray = nodes
@ -835,7 +838,7 @@ const htmlStringToNodeArray = (htmlString) => {
log.error('htmlStringToNodeArray error')
}
})
return nodeArray;
return nodeArray
}
const getCurrentPageRouteParams = () => {
@ -861,7 +864,7 @@ const resolveUrlParamsParse = (url) => {
const itemArr = item.split('=')
const key = itemArr[0]
const value = itemArr[1]
res[key] = value;
res[key] = value
})
return res
}