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

View File

@ -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') {

View File

@ -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>

View File

@ -12,8 +12,8 @@ import './index.scss'
const initialState = { 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>

View File

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

View File

@ -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>} */}

View File

@ -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;
// }
} }

View File

@ -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',
@ -6,7 +6,7 @@ export const COUPON_ITEM = {
cardId: 'card_id', cardId: 'card_id',
cardType: 'card_type', cardType: 'card_type',
code: 'code', code: 'code',
invalidDesc:'invalid_desc', invalidDesc: 'invalid_desc',
beginDate: ({ begin_date }) => begin_date.replace(/-/g, '.'), beginDate: ({ begin_date }) => begin_date.replace(/-/g, '.'),
endDate: ({ end_date }) => end_date.replace(/-/g, '.'), endDate: ({ end_date }) => end_date.replace(/-/g, '.'),
tagClass: 'tagClass', tagClass: 'tagClass',
@ -24,12 +24,26 @@ export const COUPON_ITEM = {
status: 'status', status: 'status',
getNum: 'get_num', getNum: 'get_num',
valid: ({ valid }) => { valid: ({ valid }) => {
if(typeof valid === 'undefined') { if (typeof valid === 'undefined') {
return true return true
} 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 = {
@ -49,22 +63,24 @@ export const COUPON = {
description: 'description', description: 'description',
quantity: ({ quantity }) => parseInt(quantity), quantity: ({ quantity }) => parseInt(quantity),
getNum: 'get_num', getNum: 'get_num',
couponStatus: ({ quantity, get_limit, user_get_num, get_num}) => { couponStatus: ({ quantity, get_limit, user_get_num, get_num }) => {
if(quantity - get_num <= 0) { if (quantity - get_num <= 0) {
return 0 // 已领完 return 0 // 已领完
} else if(get_limit - user_get_num > 0) { } else if (get_limit - user_get_num > 0) {
return 1 // 立即领取 return 1 // 立即领取
} else if(get_limit - user_get_num <= 0) { } else if (get_limit - user_get_num <= 0) {
return 2 // 已领取 return 2 // 已领取
} }
}, },
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
} else { } else {
return valid return valid

View File

@ -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]}

View File

@ -17,7 +17,7 @@ const initialState = {
czOrder: false czOrder: false
} }
function CashierResult(props) { function CashierResult (props) {
const $instance = getCurrentInstance() const $instance = getCurrentInstance()
const { cashierPayment } = usePayment() const { cashierPayment } = usePayment()
@ -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' })

View File

@ -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 {

View File

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

View File

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

View File

@ -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,13 +904,13 @@ 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>
<View className='right'> <View className='right'>
{totalInfo.freight_type !== 'point' {totalInfo.freight_type !== 'point'
? `¥${totalInfo.freight_fee}` ? `¥ ${totalInfo.freight_fee}`
: `${totalInfo.freight_fee * 100}${this.props.pointName}`} : `${totalInfo.freight_fee * 100}${this.props.pointName}`}
</View> </View>
</View> </View>

View File

@ -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%;

View File

@ -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;

View File

@ -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>
)} )}

View File

@ -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>
) )
} }

View File

@ -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;
}
}
} }

View File

@ -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 />

View File

@ -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',

View File

@ -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>)
})} })}

View File

@ -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;

View File

@ -15,10 +15,10 @@ const initialState = {
couponListInVaild: [], couponListInVaild: [],
select: null select: null
} }
function CouponPicker(props) { function CouponPicker (props) {
const $instance = getCurrentInstance() const $instance = getCurrentInstance()
const [state, setState] = useImmer(initialState) const [state, setState] = useImmer(initialState)
let { couponListVaild,couponListInVaild, select } = state let { couponListVaild, couponListInVaild, select } = state
const dispatch = useDispatch() const dispatch = useDispatch()
const fetch = async ({ pageIndex, pageSize }) => { const fetch = async ({ pageIndex, pageSize }) => {
@ -47,8 +47,8 @@ function CouponPicker(props) {
const { list, total_count: total } = await api.cart.coupons(params) const { list, total_count: total } = await api.cart.coupons(params)
const couponListNewVaul = pickBy(list, doc.coupon.COUPON_ITEM) const couponListNewVaul = pickBy(list, doc.coupon.COUPON_ITEM)
couponListVaild = couponListNewVaul.filter(item=>item.valid) couponListVaild = couponListNewVaul.filter(item => item.valid)
couponListInVaild = couponListNewVaul.filter(item=>!item.valid) couponListInVaild = couponListNewVaul.filter(item => !item.valid)
setState((draft) => { setState((draft) => {
draft.couponListVaild = couponListVaild, draft.couponListVaild = couponListVaild,
draft.couponListInVaild = couponListInVaild, draft.couponListInVaild = couponListInVaild,
@ -62,7 +62,7 @@ function CouponPicker(props) {
const onChangeSelectCoupon = (item, e) => { const onChangeSelectCoupon = (item, e) => {
let payload = null let payload = null
// 不使用优惠券 // 不使用优惠券
if(item) { if (item) {
const { cardId, code, title } = item const { cardId, code, title } = item
payload = { payload = {
coupon_id: cardId, coupon_id: cardId,
@ -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>

View File

@ -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>

View File

@ -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;

View File

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