mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-14 17:41:45 +08:00
Merge branch 'master-darengtang-purchase-ordermerge'
This commit is contained in:
@@ -3,7 +3,7 @@ import React, { useCallback, useState, useEffect, useRef } from 'react'
|
||||
import { View, Text, Image, RootPortal } from '@tarojs/components'
|
||||
import { SpPrivacyModal, SpPage, SpLogin, SpModal, SpCheckbox, SpImage } from '@/components'
|
||||
import { AtButton, AtIcon } from 'taro-ui'
|
||||
import { showToast, normalizeQuerys, getCurrentPageRouteParams, VERSION_IN_PURCHASE } from '@/utils'
|
||||
import { showToast, normalizeQuerys, getCurrentPageRouteParams, VERSION_IN_PURCHASE, getDistributorId } from '@/utils'
|
||||
import { useLogin, useModal, useSyncCallback } from '@/hooks'
|
||||
import { SG_ROUTER_PARAMS } from '@/consts/localstorage'
|
||||
import S from '@/spx'
|
||||
@@ -159,6 +159,17 @@ function PurchaseAuth() {
|
||||
setChecked(true)
|
||||
if (!isNewUser) {
|
||||
await login()
|
||||
if(VERSION_IN_PURCHASE){
|
||||
// 纯内购如果有企业则进入选身份页面
|
||||
const data = await api.purchase.getUserEnterprises({disabled: 0,distributor_id: getDistributorId()})
|
||||
const validIdentityLen = data.filter(item => item.disabled == 0).length
|
||||
if(validIdentityLen){
|
||||
Taro.reLaunch({
|
||||
url:'/subpages/purchase/select-identity?is_redirt=1'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ function PurchaseActivityList() {
|
||||
useEffect(() => {
|
||||
if (!S.getAuthToken()) {
|
||||
Taro.redirectTo({
|
||||
url: '/subpages/purchase/member?from=purchase_home'
|
||||
url: '/pages/purchase/auth'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react'
|
||||
import Taro, { getCurrentInstance, useDidShow, useRouter, useShareAppMessage, useShareTimeline } from '@tarojs/taro'
|
||||
import React, { useEffect, useState, useCallback, useMemo, useRef } from 'react'
|
||||
import Taro, {
|
||||
getCurrentInstance,
|
||||
useDidShow,
|
||||
useRouter,
|
||||
useShareAppMessage,
|
||||
useShareTimeline
|
||||
} from '@tarojs/taro'
|
||||
import { View, Image, ScrollView, Button } from '@tarojs/components'
|
||||
import { useSelector, useDispatch } from 'react-redux'
|
||||
import {
|
||||
@@ -110,6 +116,11 @@ function Home() {
|
||||
checkPolicyChange()
|
||||
})
|
||||
|
||||
//是否可以分享亲友
|
||||
const isPurchaseShare = useMemo(() => {
|
||||
return !!(activityInfo?.is_employee && activityInfo?.if_relative_join)
|
||||
}, [activityInfo])
|
||||
|
||||
const init = async () => {
|
||||
await fetchWgts()
|
||||
await fetchActivity()
|
||||
@@ -145,24 +156,25 @@ function Home() {
|
||||
const fetchActivity = async () => {
|
||||
const activity_id = router.params?.activity_id || purchase_share_info?.activity_id
|
||||
const enterprise_id = router.params?.enterprise_id || purchase_share_info?.enterprise_id
|
||||
const data = await api.purchase.getEmployeeActivitydata({activity_id,enterprise_id})
|
||||
setState(draft=>{
|
||||
draft.activityInfo = data
|
||||
const data = await api.purchase.getEmployeeActivitydata({ activity_id, enterprise_id })
|
||||
setState((draft) => {
|
||||
draft.activityInfo = data
|
||||
})
|
||||
}
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
return new Promise(async function (resolve,reject) {
|
||||
return reject()
|
||||
const activity_id = router.params?.activity_id || purchase_share_info?.activity_id
|
||||
const enterprise_id = router.params?.enterprise_id || purchase_share_info?.enterprise_id
|
||||
const data = await api.purchase.getEmployeeInviteCode({ enterprise_id, activity_id })
|
||||
log.debug(`/pages/purchase/auth?code=${data.invite_code}`)
|
||||
resolve({
|
||||
title: activityInfo.name,
|
||||
imageUrl: activityInfo.share_pic,
|
||||
path: `/pages/purchase/auth?code=${data.invite_code}&enterprise_id=${enterprise_id}&activity_id=${activity_id}`
|
||||
})
|
||||
return new Promise(async function (resolve, reject) {
|
||||
if (isPurchaseShare) {
|
||||
const activity_id = router.params?.activity_id || purchase_share_info?.activity_id
|
||||
const enterprise_id = router.params?.enterprise_id || purchase_share_info?.enterprise_id
|
||||
const data = await api.purchase.getEmployeeInviteCode({ enterprise_id, activity_id })
|
||||
log.debug(`/pages/purchase/auth?code=${data.invite_code}`)
|
||||
resolve({
|
||||
title: activityInfo.name,
|
||||
imageUrl: activityInfo.share_pic,
|
||||
path: `/pages/purchase/auth?code=${data.invite_code}&enterprise_id=${enterprise_id}&activity_id=${activity_id}`
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -227,11 +239,13 @@ function Home() {
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
setState((draft) => {
|
||||
draft.isOpened = true
|
||||
})
|
||||
}
|
||||
// else {
|
||||
// //选择分享海报还是卡片
|
||||
// setState((draft) => {
|
||||
// draft.isOpened = true
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
const onCreatePoster = () => {
|
||||
@@ -251,10 +265,11 @@ function Home() {
|
||||
pageConfig={pageData?.base}
|
||||
renderFooter={<CompTabbar />}
|
||||
renderFloat={
|
||||
false && (
|
||||
<View className='float-share' onClick={showInfo}>
|
||||
false &&
|
||||
isPurchaseShare && (
|
||||
<Button open-type='share' size='mini' className='float-share' onClick={showInfo}>
|
||||
<SpImage src='share.png' className='share-btn' mode='aspectFit'></SpImage>
|
||||
</View>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
loading={loading}
|
||||
@@ -316,7 +331,7 @@ function Home() {
|
||||
}}
|
||||
></SharePurchase>
|
||||
|
||||
{/* 海报 */}
|
||||
{/* 海报组件 */}
|
||||
{posterModalOpen && (
|
||||
<SpPoster
|
||||
info={purchase_share_info}
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 112px;
|
||||
// height: 112px;
|
||||
.share-btn {
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
}
|
||||
}
|
||||
.shareBtn {
|
||||
border: transparent;
|
||||
background: none;
|
||||
outline: none;
|
||||
@@ -22,7 +15,11 @@
|
||||
margin: 0;
|
||||
box-shadow: 0px 8px 15px 0px #FAC2D0;
|
||||
border-radius: 50%;
|
||||
|
||||
margin-bottom: 12px;
|
||||
// height: 112px;
|
||||
.share-btn {
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user