🌈 style(eslint): 修复eslint的报错❌
This commit is contained in:
parent
d93b66e7d5
commit
639112c038
3
global.d.ts
vendored
3
global.d.ts
vendored
@ -20,3 +20,6 @@ declare namespace NodeJS {
|
|||||||
declare const CURRENT_VERSION: string
|
declare const CURRENT_VERSION: string
|
||||||
declare const CURRENT_GITHASH: string
|
declare const CURRENT_GITHASH: string
|
||||||
declare const CURRENT_ENV: string
|
declare const CURRENT_ENV: string
|
||||||
|
declare const CURRENT_BASE_URL: string
|
||||||
|
declare const CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: string
|
||||||
|
declare const CURRENT_PAY_H5_CODE_URL: string
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
|
import Taro, { onAppShow, useDidShow } from '@tarojs/taro'
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import configStore from './store'
|
import configStore from './store'
|
||||||
|
import { shareShop } from './common/util'
|
||||||
import ContextBlueTooth from '@/use/contextBlueTooth'
|
import ContextBlueTooth from '@/use/contextBlueTooth'
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
import Taro, { onAppShow, useDidShow } from '@tarojs/taro'
|
|
||||||
import { shareShop } from './common/util'
|
|
||||||
|
|
||||||
const store = configStore()
|
const store = configStore()
|
||||||
const App: FC = (params) => {
|
const App: FC = (params: { children?: React.ReactNode }) => {
|
||||||
Taro.showShareMenu({
|
Taro.showShareMenu({
|
||||||
withShareTicket: true,
|
withShareTicket: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,21 +1,6 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import Qs from 'qs'
|
import Qs from 'qs'
|
||||||
|
|
||||||
/**
|
|
||||||
* 跳转
|
|
||||||
* @param path
|
|
||||||
* @param params
|
|
||||||
* @param type false 跳转普通页面,true 跳转tabbar页面
|
|
||||||
*/
|
|
||||||
type ParamLink = 'navigateTo' | 'switchTab' | 'reLaunch' | 'redirectTo'
|
|
||||||
export const goLink = (path = '', params: object | null = null, way: ParamLink = 'navigateTo') => {
|
|
||||||
if (path) {
|
|
||||||
// let params_str = Qs_.stringify(params || {}, { encode: false })
|
|
||||||
// path = params_str ? path + '?' + params_str : path
|
|
||||||
path = setUrlQuery({ url: path, query: params })
|
|
||||||
Taro[way]({ url: path })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const setUrlQuery = (options: { url: string; query: object | null }) => {
|
const setUrlQuery = (options: { url: string; query: object | null }) => {
|
||||||
let { url, query } = options
|
let { url, query } = options
|
||||||
if (!url) { return '' }
|
if (!url) { return '' }
|
||||||
@ -35,6 +20,21 @@ const setUrlQuery = (options: { url: string; query: object | null }) => {
|
|||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 跳转
|
||||||
|
* @param path
|
||||||
|
* @param params
|
||||||
|
* @param type false 跳转普通页面,true 跳转tabbar页面
|
||||||
|
*/
|
||||||
|
type ParamLink = 'navigateTo' | 'switchTab' | 'reLaunch' | 'redirectTo'
|
||||||
|
export const goLink = (path = '', params: object | null = null, way: ParamLink = 'navigateTo') => {
|
||||||
|
if (path) {
|
||||||
|
// let params_str = Qs_.stringify(params || {}, { encode: false })
|
||||||
|
// path = params_str ? path + '?' + params_str : path
|
||||||
|
path = setUrlQuery({ url: path, query: params })
|
||||||
|
Taro[way]({ url: path })
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 判断对象为空
|
* 判断对象为空
|
||||||
* @param object
|
* @param object
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export const BASE_URL = CURRENT_BASE_URL
|
// export const BASE_URL = CURRENT_BASE_URL
|
||||||
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
||||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||||
@ -13,7 +13,7 @@ export const BASE_URL = CURRENT_BASE_URL
|
|||||||
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
||||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
||||||
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||||
// export const BASE_URL = `http://192.168.1.28:50002/lymarket` // 婷
|
export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷
|
||||||
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
@ -27,7 +27,29 @@ export const formatHashTag = (code = '', name = '', mode = 'both') => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Digit = 10 * 10
|
const Digit = 10 * 10
|
||||||
|
/**
|
||||||
|
* 精度
|
||||||
|
* @param {*} num
|
||||||
|
* @param {*} precision
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const strip = (num, precision = 12) => {
|
||||||
|
return +parseFloat(num.toPrecision(precision))
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {千位分割付} number
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const numberWithCommas = ({ number = 0, digit = 2 }) => {
|
||||||
|
if (!Number.isNaN(Number(number))) {
|
||||||
|
// return parseFloat(number).toFixed(digit).replace(/^\B(?<!\.\d*)(?=(\d{3})+(?!\d))$/g, ",");
|
||||||
|
return parseFloat(number).toLocaleString('zh', { minimumFractionDigits: digit })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 重量 进退位 单位
|
* 重量 进退位 单位
|
||||||
*/
|
*/
|
||||||
@ -96,26 +118,6 @@ export const formatDateTime = (val, fmt = 'YYYY-MM-DD HH:mm:ss') => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 精度
|
|
||||||
* @param {*} num
|
|
||||||
* @param {*} precision
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const strip = (num, precision = 12) => {
|
|
||||||
return +parseFloat(num.toPrecision(precision))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换金额单位
|
|
||||||
* @param {*} num 金额 / 数值
|
|
||||||
* @param {*} digit 转换单位
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const formatMillionYuan = (num, digit = 10000) => {
|
|
||||||
return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数值保留两位小数
|
* 数值保留两位小数
|
||||||
* @param {*} x
|
* @param {*} x
|
||||||
@ -123,7 +125,7 @@ export const formatMillionYuan = (num, digit = 10000) => {
|
|||||||
*/
|
*/
|
||||||
export const toDecimal2 = (x) => {
|
export const toDecimal2 = (x) => {
|
||||||
let f = parseFloat(x)
|
let f = parseFloat(x)
|
||||||
if (isNaN(f)) {
|
if (Number.isNaN(f)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
f = `${f}`
|
f = `${f}`
|
||||||
@ -139,7 +141,15 @@ export const toDecimal2 = (x) => {
|
|||||||
}
|
}
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 转换金额单位
|
||||||
|
* @param {*} num 金额 / 数值
|
||||||
|
* @param {*} digit 转换单位
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const formatMillionYuan = (num, digit = 10000) => {
|
||||||
|
return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false }
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 格式化图片路径
|
* 格式化图片路径
|
||||||
* @param {*} url
|
* @param {*} url
|
||||||
@ -173,18 +183,3 @@ export const isLabImage = (imgurl, rgb, suffix = '!w200') => {
|
|||||||
return { status: 3, value: `${IMG_CND_Prefix}/mall/no_img.png` }
|
return { status: 3, value: `${IMG_CND_Prefix}/mall/no_img.png` }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {千位分割付} number
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const numberWithCommas = ({ number = 0, digit = 2 }) => {
|
|
||||||
if (!isNaN(Number(number))) {
|
|
||||||
// return parseFloat(number).toFixed(digit).replace(/^\B(?<!\.\d*)(?=(\d{3})+(?!\d))$/g, ",");
|
|
||||||
return parseFloat(number).toLocaleString('zh', { minimumFractionDigits: digit })
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export const getFilterData = (val = {}, arr: string[] = []) => {
|
|||||||
for (const key in val) {
|
for (const key in val) {
|
||||||
if (val[key] !== undefined && val[key] !== null && val[key] !== '' && !arr.includes(key)) {
|
if (val[key] !== undefined && val[key] !== null && val[key] !== '' && !arr.includes(key)) {
|
||||||
if (typeof val[key] == 'number') {
|
if (typeof val[key] == 'number') {
|
||||||
if (!isNaN(val[key])) {
|
if (!Number.isNaN(val[key])) {
|
||||||
res[key] = val[key]
|
res[key] = val[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ export const copyObject = (object) => {
|
|||||||
if (object.constructor == Object) {
|
if (object.constructor == Object) {
|
||||||
const keys = Object.keys(object)
|
const keys = Object.keys(object)
|
||||||
const newObject = {}
|
const newObject = {}
|
||||||
keys.map((key) => {
|
keys.forEach((key) => {
|
||||||
newObject[key] = copyObject(object[key])
|
newObject[key] = copyObject(object[key])
|
||||||
})
|
})
|
||||||
return newObject
|
return newObject
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
||||||
|
import Taro, { showModal } from '@tarojs/taro'
|
||||||
import { memo, useEffect, useState } from 'react'
|
import { memo, useEffect, useState } from 'react'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { addressDeleteApi, addressListApi } from '@/api/addressManager'
|
import { addressDeleteApi, addressListApi } from '@/api/addressManager'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import Taro, { showModal } from '@tarojs/taro'
|
|
||||||
|
|
||||||
interface Params{
|
interface Params{
|
||||||
refresherEnabled?: boolean// 是否开启刷新
|
refresherEnabled?: boolean// 是否开启刷新
|
||||||
@ -15,9 +15,12 @@ interface Params{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 地址列表
|
// 地址列表
|
||||||
const AddressList = memo((props: Params) => {
|
const AddressList = (props: Params) => {
|
||||||
const { addButtonEnabled = true, focusBorderEnabled = false } = props
|
const { addButtonEnabled = true, focusBorderEnabled = false } = props
|
||||||
const { fetchData, state } = addressListApi()
|
const { fetchData, state } = addressListApi()
|
||||||
|
|
||||||
|
// 焦点
|
||||||
|
const [focusId, setFocusId] = useState()
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const result = await fetchData()
|
const result = await fetchData()
|
||||||
@ -50,8 +53,6 @@ const AddressList = memo((props: Params) => {
|
|||||||
setRefreshState(false)
|
setRefreshState(false)
|
||||||
}
|
}
|
||||||
const data = Array.from({ length: 15 })
|
const data = Array.from({ length: 15 })
|
||||||
// 焦点
|
|
||||||
const [focusId, setFocusId] = useState()
|
|
||||||
// 列表选择
|
// 列表选择
|
||||||
const handleSelect = (item: any, index: number) => {
|
const handleSelect = (item: any, index: number) => {
|
||||||
props.onSelect && props.onSelect(item, index)
|
props.onSelect && props.onSelect(item, index)
|
||||||
@ -90,7 +91,7 @@ const AddressList = memo((props: Params) => {
|
|||||||
// data.length>0?
|
// data.length>0?
|
||||||
// data.map((item,index)=>{
|
// data.map((item,index)=>{
|
||||||
return (
|
return (
|
||||||
<View onLongPress={() => handleDelete(item)} onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
<View key={item.id} onLongPress={() => handleDelete(item)} onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
||||||
<View className="address-user">
|
<View className="address-user">
|
||||||
{item.name}
|
{item.name}
|
||||||
{
|
{
|
||||||
@ -122,6 +123,6 @@ const AddressList = memo((props: Params) => {
|
|||||||
{addButtonEnabled && <Navigator url="/pages/addressAdd/index?type=add" hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
{addButtonEnabled && <Navigator url="/pages/addressAdd/index?type=add" hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default AddressList
|
export default memo(AddressList)
|
||||||
|
|||||||
@ -16,9 +16,7 @@ interface ListParams {
|
|||||||
contentStyle?: object
|
contentStyle?: object
|
||||||
required?: boolean
|
required?: boolean
|
||||||
}
|
}
|
||||||
|
const FromList = (props: ListParams) => {
|
||||||
// 表单列表
|
|
||||||
const FromList = memo((props: ListParams) => {
|
|
||||||
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false } = props
|
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -65,7 +63,6 @@ const FromList = memo((props: ListParams) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
const A = () => {}
|
export default memo(FromList)
|
||||||
export default FromList
|
|
||||||
|
|||||||
@ -16,9 +16,7 @@ interface ListParams {
|
|||||||
required?: boolean
|
required?: boolean
|
||||||
showIcon?: boolean // 是否显示右边的箭头,type=select
|
showIcon?: boolean // 是否显示右边的箭头,type=select
|
||||||
}
|
}
|
||||||
|
const FromListCertification = (props: ListParams) => {
|
||||||
// 表单列表
|
|
||||||
const FromList = memo((props: ListParams) => {
|
|
||||||
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false, showIcon = true } = props
|
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false, showIcon = true } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -62,7 +60,6 @@ const FromList = memo((props: ListParams) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
const A = () => {}
|
export default memo(FromListCertification)
|
||||||
export default FromList
|
|
||||||
|
|||||||
@ -10,20 +10,22 @@ interface Params {
|
|||||||
fetchData: (data: object) => any
|
fetchData: (data: object) => any
|
||||||
change?: (data: any) => void
|
change?: (data: any) => void
|
||||||
}
|
}
|
||||||
|
const InfiniteScrollPaging = (props: Params) => {
|
||||||
export default (props: Params) => {
|
|
||||||
const { query = {} } = props
|
const { query = {} } = props
|
||||||
useEffect(() => {
|
const refreshDataRef = useRef({})
|
||||||
refreshDataRef.current = refreshData
|
// 渲染(数据)
|
||||||
dataRef.current = data
|
const [data, setData] = useState({
|
||||||
getData({ moreStatus: true }, { moreStatus: true })
|
list: [],
|
||||||
}, [])
|
total: 0,
|
||||||
useEffect(() => {
|
})
|
||||||
if (!isEmptyObject(query)) {
|
// 加载刷新数据
|
||||||
setData({ list: [], total: 0 })
|
const [refreshData, setRefreshData] = useState({
|
||||||
getData({ moreStatus: true }, { moreStatus: true })
|
refreshStatus: false,
|
||||||
}
|
moreStatus: false,
|
||||||
}, [query])
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
loading: false,
|
||||||
|
})
|
||||||
const getData = async(startStatus, endStatus) => {
|
const getData = async(startStatus, endStatus) => {
|
||||||
const tRefreshDataRef = refreshDataRef.current as any
|
const tRefreshDataRef = refreshDataRef.current as any
|
||||||
setRefreshData({
|
setRefreshData({
|
||||||
@ -70,20 +72,7 @@ export default (props: Params) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 加载刷新数据
|
|
||||||
const [refreshData, setRefreshData] = useState({
|
|
||||||
refreshStatus: false,
|
|
||||||
moreStatus: false,
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
|
||||||
loading: false,
|
|
||||||
})
|
|
||||||
const refreshDataRef = useRef({})
|
|
||||||
// 渲染(数据)
|
|
||||||
const [data, setData] = useState({
|
|
||||||
list: [],
|
|
||||||
total: 0,
|
|
||||||
})
|
|
||||||
const dataRef = useRef({})
|
const dataRef = useRef({})
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
const handleRefresh = async() => {
|
const handleRefresh = async() => {
|
||||||
@ -119,7 +108,17 @@ export default (props: Params) => {
|
|||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: data.list, total: data.total, status: refreshData.loading })
|
return dataLoadingStatus({ list: data.list, total: data.total, status: refreshData.loading })
|
||||||
}, [refreshData.loading])
|
}, [refreshData.loading])
|
||||||
|
useEffect(() => {
|
||||||
|
refreshDataRef.current = refreshData
|
||||||
|
dataRef.current = data
|
||||||
|
getData({ moreStatus: true }, { moreStatus: true })
|
||||||
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isEmptyObject(query)) {
|
||||||
|
setData({ list: [], total: 0 })
|
||||||
|
getData({ moreStatus: true }, { moreStatus: true })
|
||||||
|
}
|
||||||
|
}, [query])
|
||||||
return (
|
return (
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
refresherEnabled
|
refresherEnabled
|
||||||
@ -133,3 +132,5 @@ export default (props: Params) => {
|
|||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default InfiniteScrollPaging
|
||||||
|
|||||||
@ -18,7 +18,7 @@ interface Param {
|
|||||||
round?: boolean
|
round?: boolean
|
||||||
name?: string
|
name?: string
|
||||||
}
|
}
|
||||||
export default memo(({ value, onClick, showStatus = false, round = false, name = '' }: Param) => {
|
const LabAndImg = ({ value, onClick, showStatus = false, round = false, name = '' }: Param) => {
|
||||||
const [imgs, setImgs] = useState<string>('')
|
const [imgs, setImgs] = useState<string>('')
|
||||||
|
|
||||||
// lab是否都是0
|
// lab是否都是0
|
||||||
@ -76,4 +76,5 @@ export default memo(({ value, onClick, showStatus = false, round = false, name =
|
|||||||
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LabAndImg)
|
||||||
|
|||||||
@ -15,13 +15,7 @@ export interface colorParams {
|
|||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
showNumber?: number // 图片显示张数,0不限制
|
showNumber?: number // 图片显示张数,0不限制
|
||||||
}
|
}
|
||||||
export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) => {
|
const LabAndImgShow = ({ value, show = false, onClose, showNumber = 1 }: colorParams) => {
|
||||||
useEffect(() => {
|
|
||||||
if (show && rgbStyle) { setLabShow(() => true) }
|
|
||||||
if (show && value?.texture_url) { onShowImage() }
|
|
||||||
if (!show) { setLabShow(() => false) }
|
|
||||||
}, [show])
|
|
||||||
|
|
||||||
// 显示颜色
|
// 显示颜色
|
||||||
const [labShow, setLabShow] = useState(false)
|
const [labShow, setLabShow] = useState(false)
|
||||||
// lab是否都是0
|
// lab是否都是0
|
||||||
@ -49,7 +43,11 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
|
|||||||
urls: n_res,
|
urls: n_res,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (show && rgbStyle) { setLabShow(() => true) }
|
||||||
|
if (show && value?.texture_url) { onShowImage() }
|
||||||
|
if (!show) { setLabShow(() => false) }
|
||||||
|
}, [show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{labShow && (
|
{labShow && (
|
||||||
@ -63,3 +61,5 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default LabAndImgShow
|
||||||
|
|||||||
@ -8,12 +8,12 @@ interface Params{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 消息提示
|
// 消息提示
|
||||||
const Message = memo((props: Params) => {
|
const Message = (props: Params) => {
|
||||||
return (
|
return (
|
||||||
<View className="message-custom-tips">
|
<View className="message-custom-tips">
|
||||||
<Text className="iconfont icon-zhuyi"></Text> {props.text}
|
<Text className="iconfont icon-zhuyi"></Text> {props.text}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default Message
|
export default memo(Message)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ interface ReasonInfoParam {
|
|||||||
onClose?: () => void // 关闭
|
onClose?: () => void // 关闭
|
||||||
onAdd?: (val: any) => void
|
onAdd?: (val: any) => void
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, onAdd }: ReasonInfoParam) => {
|
const AddCollection = ({ show = false, onClose, onAdd }: ReasonInfoParam) => {
|
||||||
// 获取列表
|
// 获取列表
|
||||||
const [list, setList] = useState([])
|
const [list, setList] = useState([])
|
||||||
const { fetchData: fetchDataList } = FavoriteListApi()
|
const { fetchData: fetchDataList } = FavoriteListApi()
|
||||||
@ -42,8 +42,8 @@ export default memo(({ show = false, onClose, onAdd }: ReasonInfoParam) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<ScrollView scrollY className={styles.scrollView}>
|
<ScrollView scrollY className={styles.scrollView}>
|
||||||
{list?.map((item: any) => (
|
{list?.map((item: any, index) => (
|
||||||
<View onClick={() => onAdd?.(item)} className={styles.collection_item}>
|
<View key={index} onClick={() => onAdd?.(item)} className={styles.collection_item}>
|
||||||
<View className={styles.name}>
|
<View className={styles.name}>
|
||||||
{item.name}
|
{item.name}
|
||||||
<Text>({item.product_color_list?.length || 0})</Text>
|
<Text>({item.product_color_list?.length || 0})</Text>
|
||||||
@ -55,4 +55,5 @@ export default memo(({ show = false, onClose, onAdd }: ReasonInfoParam) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AddCollection)
|
||||||
|
|||||||
@ -27,8 +27,7 @@ interface AddresParam {
|
|||||||
parent_id?: number
|
parent_id?: number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const Address = ({
|
||||||
export default memo(({
|
|
||||||
addressOnSelect,
|
addressOnSelect,
|
||||||
addressOnChange,
|
addressOnChange,
|
||||||
addressOnClose,
|
addressOnClose,
|
||||||
@ -64,52 +63,22 @@ export default memo(({
|
|||||||
|
|
||||||
// 获取地址
|
// 获取地址
|
||||||
const { fetchData } = GetAddressListApi()
|
const { fetchData } = GetAddressListApi()
|
||||||
useEffect(() => {
|
|
||||||
getProvince()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 选中内容
|
// 获取省市区宽度
|
||||||
const selectItem = (item) => {
|
const getDomDes = (id) => {
|
||||||
setSelectId(item.id)
|
setTimeout(() => {
|
||||||
if (selectIndex == 0) {
|
const query = Taro.createSelectorQuery()
|
||||||
setSelectArr([{ name: item.name, id: item.id, level: item.level }])
|
query.select(id).boundingClientRect((rect) => {
|
||||||
getCity(item.id)
|
const left = rect.left
|
||||||
setAreaStatus(false)
|
const clientWidth = rect.width
|
||||||
setCityStatus(false)
|
console.log(clientWidth)
|
||||||
}
|
setBottomStyle({
|
||||||
else if (selectIndex == 1) {
|
width: `${clientWidth}px`,
|
||||||
setSelectArr([selectArr[0], { name: item.name, id: item.id, level: item.level }])
|
left: `${left}px`,
|
||||||
area(item.id)
|
})
|
||||||
}
|
}).exec()
|
||||||
else {
|
}, 100)
|
||||||
setSelectArr([selectArr[0], selectArr[1], { name: item.name, id: item.id, level: item.level }])
|
|
||||||
getDomDes('#address_tab_2')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 地址数据
|
|
||||||
useEffect(() => {
|
|
||||||
if (selectArr && selectArr.length > 0) { addressOnChange?.(selectArr) }
|
|
||||||
}, [selectArr])
|
|
||||||
|
|
||||||
// 选中标题
|
|
||||||
const onSelectIndex = (index) => {
|
|
||||||
setSelectIndex(index)
|
|
||||||
const selectid = selectArr[index] ? selectArr[index].id : 0
|
|
||||||
setSelectId(selectid as number)
|
|
||||||
if (index == 0) {
|
|
||||||
getProvince()
|
|
||||||
}
|
|
||||||
else if (index == 1) {
|
|
||||||
const id = selectArr[0]?.id
|
|
||||||
getCity(id)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const id = selectArr[1]?.id
|
|
||||||
area(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取省
|
// 获取省
|
||||||
const getProvince = async() => {
|
const getProvince = async() => {
|
||||||
const res = await fetchData({ parent_id: 1 })
|
const res = await fetchData({ parent_id: 1 })
|
||||||
@ -160,28 +129,54 @@ export default memo(({
|
|||||||
addressOnClose?.()
|
addressOnClose?.()
|
||||||
addressOnSelect?.(selectArr)
|
addressOnSelect?.(selectArr)
|
||||||
}
|
}
|
||||||
|
// 选中标题
|
||||||
// 获取省市区宽度
|
const onSelectIndex = (index) => {
|
||||||
const getDomDes = (id) => {
|
setSelectIndex(index)
|
||||||
setTimeout(() => {
|
const selectid = selectArr[index] ? selectArr[index].id : 0
|
||||||
const query = Taro.createSelectorQuery()
|
setSelectId(selectid as number)
|
||||||
query.select(id).boundingClientRect((rect) => {
|
if (index == 0) {
|
||||||
const left = rect.left
|
getProvince()
|
||||||
const clientWidth = rect.width
|
}
|
||||||
console.log(clientWidth)
|
else if (index == 1) {
|
||||||
setBottomStyle({
|
const id = selectArr[0]?.id
|
||||||
width: `${clientWidth}px`,
|
getCity(id)
|
||||||
left: `${left}px`,
|
}
|
||||||
})
|
else {
|
||||||
}).exec()
|
const id = selectArr[1]?.id
|
||||||
}, 100)
|
area(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击标题栏
|
// 点击标题栏
|
||||||
const selectTab = (index) => {
|
const selectTab = (index) => {
|
||||||
onSelectIndex(index)
|
onSelectIndex(index)
|
||||||
getDomDes(`#address_tab_${index}`)
|
getDomDes(`#address_tab_${index}`)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getProvince()
|
||||||
|
}, [])
|
||||||
|
// 选中内容
|
||||||
|
const selectItem = (item) => {
|
||||||
|
setSelectId(item.id)
|
||||||
|
if (selectIndex == 0) {
|
||||||
|
setSelectArr([{ name: item.name, id: item.id, level: item.level }])
|
||||||
|
getCity(item.id)
|
||||||
|
setAreaStatus(false)
|
||||||
|
setCityStatus(false)
|
||||||
|
}
|
||||||
|
else if (selectIndex == 1) {
|
||||||
|
setSelectArr([selectArr[0], { name: item.name, id: item.id, level: item.level }])
|
||||||
|
area(item.id)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setSelectArr([selectArr[0], selectArr[1], { name: item.name, id: item.id, level: item.level }])
|
||||||
|
getDomDes('#address_tab_2')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 地址数据
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectArr && selectArr.length > 0) { addressOnChange?.(selectArr) }
|
||||||
|
}, [selectArr])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -200,9 +195,9 @@ export default memo(({
|
|||||||
<View className={styles.address_list}>
|
<View className={styles.address_list}>
|
||||||
<ScrollView scrollY className={styles.address_scroll}>
|
<ScrollView scrollY className={styles.address_scroll}>
|
||||||
<View className={styles.address_scroll_list}>
|
<View className={styles.address_scroll_list}>
|
||||||
{list.map((item) => {
|
{list.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View onClick={() => selectItem(item)} className={classnames(styles.address_list_item, { [styles.addresst_select]: (selectId == item.id) })}>
|
<View key={index} onClick={() => selectItem(item)} className={classnames(styles.address_list_item, { [styles.addresst_select]: (selectId == item.id) })}>
|
||||||
<View className={styles.address_list_item_name}>{item.name}</View>
|
<View className={styles.address_list_item_name}>{item.name}</View>
|
||||||
{(selectArr[selectIndex]?.id == item.id) && <View className={`iconfont icon-tick ${styles.address_iconfont}`}></View>}
|
{(selectArr[selectIndex]?.id == item.id) && <View className={`iconfont icon-tick ${styles.address_iconfont}`}></View>}
|
||||||
</View>
|
</View>
|
||||||
@ -215,4 +210,5 @@ export default memo(({
|
|||||||
</Drawer>
|
</Drawer>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Address)
|
||||||
|
|||||||
@ -19,8 +19,7 @@ interface Param {
|
|||||||
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
||||||
fixedBottom?: true | false // 是否固定在底部
|
fixedBottom?: true | false // 是否固定在底部
|
||||||
}
|
}
|
||||||
|
const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
||||||
export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|
||||||
// 售后订单状态
|
// 售后订单状态
|
||||||
const { ReturnStageApplying, ReturnStageWaitCheck, ReturnStageReturned, ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund }
|
const { ReturnStageApplying, ReturnStageWaitCheck, ReturnStageReturned, ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund }
|
||||||
= AFTER_ORDER_STATUS
|
= AFTER_ORDER_STATUS
|
||||||
@ -90,19 +89,6 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
})
|
})
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
// 点击按钮操作
|
|
||||||
const submitBtns = throttle((val, index) => {
|
|
||||||
if (val == 1) {
|
|
||||||
cancelOrder({ title: '要取消退货吗?', val })
|
|
||||||
}
|
|
||||||
else if (val == 6) {
|
|
||||||
cancelOrder({ title: '要取消退款吗?', val })
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
onClick?.(val)
|
|
||||||
}
|
|
||||||
}, 600)
|
|
||||||
|
|
||||||
// 取消退货/退款
|
// 取消退货/退款
|
||||||
const { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
|
const { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
|
||||||
const cancelOrder = ({ title = '', val }) => {
|
const cancelOrder = ({ title = '', val }) => {
|
||||||
@ -125,7 +111,18 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 点击按钮操作
|
||||||
|
const submitBtns = throttle((val, index) => {
|
||||||
|
if (val == 1) {
|
||||||
|
cancelOrder({ title: '要取消退货吗?', val })
|
||||||
|
}
|
||||||
|
else if (val == 6) {
|
||||||
|
cancelOrder({ title: '要取消退款吗?', val })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onClick?.(val)
|
||||||
|
}
|
||||||
|
}, 600)
|
||||||
// 显示更多按钮
|
// 显示更多按钮
|
||||||
const [showMore, setShowMore] = useState(false)
|
const [showMore, setShowMore] = useState(false)
|
||||||
const styleTop = useMemo(() => {
|
const styleTop = useMemo(() => {
|
||||||
@ -174,4 +171,5 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AfterOrderBtns)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Param {
|
|||||||
number: number // 数字
|
number: number // 数字
|
||||||
status: 0|1|2 // 0 小型,1中型,2大
|
status: 0|1|2 // 0 小型,1中型,2大
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, status = 1 }: Param) => {
|
const AmountShow = ({ number = 0, status = 1 }: Param) => {
|
||||||
const priceDom = useCallback(() => {
|
const priceDom = useCallback(() => {
|
||||||
const res = number.toFixed(2).split('.')
|
const res = number.toFixed(2).split('.')
|
||||||
const int_num = `${parseInt(res[0])}`
|
const int_num = `${parseInt(res[0])}`
|
||||||
@ -26,4 +26,5 @@ export default memo(({ number = 0, status = 1 }: Param) => {
|
|||||||
{priceDom()}
|
{priceDom()}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AmountShow)
|
||||||
|
|||||||
@ -12,16 +12,12 @@ interface params {
|
|||||||
swiperOnClick?: (val: item) => void
|
swiperOnClick?: (val: item) => void
|
||||||
style?: Object
|
style?: Object
|
||||||
}
|
}
|
||||||
export default (props: params) => {
|
const Banner = (props: params) => {
|
||||||
const { swiperOnClick, style = {} } = props
|
const { swiperOnClick, style = {} } = props
|
||||||
|
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
const { fetchData, state } = GetBannerList()
|
const { fetchData, state } = GetBannerList()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
setList(res.data?.list)
|
setList(res.data?.list)
|
||||||
@ -39,7 +35,9 @@ export default (props: params) => {
|
|||||||
const showDot = useMemo(() => {
|
const showDot = useMemo(() => {
|
||||||
return list.length > 1
|
return list.length > 1
|
||||||
}, [list])
|
}, [list])
|
||||||
|
useEffect(() => {
|
||||||
|
getData()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<View className={styles.swiper_con} style={style}>
|
<View className={styles.swiper_con} style={style}>
|
||||||
<Swiper className={styles.xswiper} indicatorColor="#ccc" indicatorActiveColor="#fff" circular indicatorDots={showDot} autoplay>
|
<Swiper className={styles.xswiper} indicatorColor="#ccc" indicatorActiveColor="#fff" circular indicatorDots={showDot} autoplay>
|
||||||
@ -56,3 +54,5 @@ export default (props: params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Banner
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface params {
|
|||||||
show?: true|false
|
show?: true|false
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
}
|
}
|
||||||
export default ({ show, onClose }: params) => {
|
const BindSalesmanPopup = ({ show, onClose }: params) => {
|
||||||
const onCustomer = async() => {
|
const onCustomer = async() => {
|
||||||
const res = await Taro.showModal({
|
const res = await Taro.showModal({
|
||||||
title: '是否拨打服务热线',
|
title: '是否拨打服务热线',
|
||||||
@ -48,3 +48,5 @@ export default ({ show, onClose }: params) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default BindSalesmanPopup
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import SearchInput from '@/components/searchInput'
|
|||||||
import Popup from '@/components/bluetooth/Popup'
|
import Popup from '@/components/bluetooth/Popup'
|
||||||
import useCheckAuthorize from '@/use/useCheckAuthorize'
|
import useCheckAuthorize from '@/use/useCheckAuthorize'
|
||||||
|
|
||||||
export default memo(() => {
|
const LinkBlueTooth = () => {
|
||||||
const { state, init, startScan, connect, disconnect } = useBluetooth()
|
const { state, init, startScan, connect, disconnect } = useBluetooth()
|
||||||
|
|
||||||
const { check } = useCheckAuthorize({ scope: 'scope.bluetooth', msg: '请开启小程序蓝牙权限' })
|
const { check } = useCheckAuthorize({ scope: 'scope.bluetooth', msg: '请开启小程序蓝牙权限' })
|
||||||
@ -40,6 +40,9 @@ export default memo(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [popupShow, setPopupShow] = useState(false)
|
const [popupShow, setPopupShow] = useState(false)
|
||||||
|
const onFindEven = () => {
|
||||||
|
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
||||||
|
}
|
||||||
// 显示设备列表
|
// 显示设备列表
|
||||||
const onFindDevice = () => {
|
const onFindDevice = () => {
|
||||||
check().then((res) => {
|
check().then((res) => {
|
||||||
@ -55,9 +58,6 @@ export default memo(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const onFindEven = () => {
|
|
||||||
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
|
||||||
}
|
|
||||||
|
|
||||||
// 断开链接
|
// 断开链接
|
||||||
const onDisconnect = () => {
|
const onDisconnect = () => {
|
||||||
@ -72,9 +72,11 @@ export default memo(() => {
|
|||||||
<View className={styles.bluetooth_link} onClick={onFindDevice}>
|
<View className={styles.bluetooth_link} onClick={onFindDevice}>
|
||||||
<View className={classnames(styles.link_status, linkStatus == 3 && styles.link_statused, linkStatus == 2 && styles.link_statused_no)}></View>
|
<View className={classnames(styles.link_status, linkStatus == 3 && styles.link_statused, linkStatus == 2 && styles.link_statused_no)}></View>
|
||||||
{
|
{
|
||||||
linkStatus == 1 && <View className={classnames(styles.link_name, styles.link_name_no)}>请开启蓝牙</View>
|
linkStatus == 1
|
||||||
|| linkStatus == 2 && <View className={classnames(styles.link_name, styles.link_name_no_link)}>未连接设备</View>
|
? <View className={classnames(styles.link_name, styles.link_name_no)}>请开启蓝牙</View>
|
||||||
|| linkStatus == 3 && <View className={classnames(styles.link_name)}>{linkName}</View>
|
: linkStatus == 2
|
||||||
|
? <View className={classnames(styles.link_name, styles.link_name_no_link)}>未连接设备</View>
|
||||||
|
: linkStatus == 3 ? <View className={classnames(styles.link_name)}>{linkName}</View> : null
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</SearchInput>
|
</SearchInput>
|
||||||
@ -90,4 +92,5 @@ export default memo(() => {
|
|||||||
</>
|
</>
|
||||||
|
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LinkBlueTooth)
|
||||||
|
|||||||
@ -12,8 +12,7 @@ interface params {
|
|||||||
onOff: () => void
|
onOff: () => void
|
||||||
onFind: () => void
|
onFind: () => void
|
||||||
}
|
}
|
||||||
|
const Bluetooth = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
||||||
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
|
||||||
const [popupShow, setPopupShow] = useState(show)
|
const [popupShow, setPopupShow] = useState(show)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPopupShow(show)
|
setPopupShow(show)
|
||||||
@ -31,38 +30,46 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
<View className={style.list}>
|
<View className={style.list}>
|
||||||
<ScrollView scrollY className={style.scroll}>
|
<ScrollView scrollY className={style.scroll}>
|
||||||
{
|
{
|
||||||
(state.devices && state.devices.length > 0) && state?.devices.map((item) => {
|
(state.devices && state.devices.length > 0)
|
||||||
return (
|
? state?.devices.map((item, key) => {
|
||||||
<View className={style.item} onClick={() => onLink(item)}>
|
return (
|
||||||
<View>{item.name}</View>
|
<View key={key} className={style.item} onClick={() => onLink(item)}>
|
||||||
{
|
<View>{item.name}</View>
|
||||||
(!state.connecting && !state.connected) && <View >链接</View>
|
{
|
||||||
|| (state.connecting && item.deviceId == state.connecting.deviceId) && <View className={style.link_ing}>正在链接...</View>
|
(!state.connecting && !state.connected)
|
||||||
|| (state.connected && item.deviceId == state.connected.deviceId) && <View className={style.link_success}>链接成功</View>
|
? <View >链接</View>
|
||||||
}
|
: (state.connecting && item.deviceId == state.connecting.deviceId)
|
||||||
</View>
|
? <View className={style.link_ing}>正在链接...</View>
|
||||||
)
|
: (state.connected && item.deviceId == state.connected.deviceId)
|
||||||
})
|
? <View className={style.link_success}>链接成功</View>
|
||||||
|| <View className={style.noDevice}>
|
: null
|
||||||
{
|
}
|
||||||
(!state.discovering) && <>
|
</View>
|
||||||
<View>暂无设备,请按以下条件检查</View>
|
)
|
||||||
<View className={style.n_item}>1.请确保取色仪处于激活状态</View>
|
})
|
||||||
<View className={style.n_item}>2.请确保取色仪没有链接其他设备</View>
|
: <View className={style.noDevice}>
|
||||||
<View className={style.n_item}>3.请打开手机定位</View>
|
{
|
||||||
</>
|
(!state.discovering)
|
||||||
|| <View>设备搜索中</View>
|
? <>
|
||||||
}
|
<View>暂无设备,请按以下条件检查</View>
|
||||||
|
<View className={style.n_item}>1.请确保取色仪处于激活状态</View>
|
||||||
|
<View className={style.n_item}>2.请确保取色仪没有链接其他设备</View>
|
||||||
|
<View className={style.n_item}>3.请打开手机定位</View>
|
||||||
|
</>
|
||||||
|
: <View>设备搜索中</View>
|
||||||
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
}
|
}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
state.connected && <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}>断开链接</View>
|
state.connected
|
||||||
|| (!state.connected && state.discovering) && <View className={`${style.footer} ${style.finding}`}>搜索中<Loading width={30} color="orange" /></View>
|
? <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}>断开链接</View>
|
||||||
|| <View className={style.footer} onClick={onFind}>重新搜索</View>
|
: (!state.connected && state.discovering)
|
||||||
|
? <View className={`${style.footer} ${style.finding}`}>搜索中<Loading width={30} color="orange" /></View>
|
||||||
|
: <View className={style.footer} onClick={onFind}>重新搜索</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View className={style.mask} onClick={onCloseListener}></View>
|
<View className={style.mask} onClick={onCloseListener}></View>
|
||||||
@ -70,4 +77,5 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Bluetooth)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ interface params {
|
|||||||
status?: false | true // 是否选中
|
status?: false | true // 是否选中
|
||||||
disabled?: false | true // 是否禁用
|
disabled?: false | true // 是否禁用
|
||||||
}
|
}
|
||||||
export default forwardRef(({ onSelect, onClose, status = false, disabled = false }: params, ref) => {
|
const Checkbox = ({ onSelect, onClose, status = false, disabled = false }: params, ref) => {
|
||||||
const [selected, SetSelected] = useState(false)
|
const [selected, SetSelected] = useState(false)
|
||||||
const onSelectEven = () => {
|
const onSelectEven = () => {
|
||||||
if (disabled) { return false }
|
if (disabled) { return false }
|
||||||
@ -37,4 +37,5 @@ export default forwardRef(({ onSelect, onClose, status = false, disabled = false
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(Checkbox)
|
||||||
|
|||||||
@ -6,8 +6,7 @@ interface Params {
|
|||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
styleObj?: Object
|
styleObj?: Object
|
||||||
}
|
}
|
||||||
|
const CloseBtn = ({ onClose, styleObj = {} }: Params) => {
|
||||||
export default memo(({ onClose, styleObj = {} }: Params) => {
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={styleObj}
|
style={styleObj}
|
||||||
@ -17,4 +16,5 @@ export default memo(({ onClose, styleObj = {} }: Params) => {
|
|||||||
<Text className={`iconfont icon-qingkong ${style.icon_a_btn}`}></Text>
|
<Text className={`iconfont icon-qingkong ${style.icon_a_btn}`}></Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(CloseBtn)
|
||||||
|
|||||||
@ -16,11 +16,8 @@ interface params {
|
|||||||
disabled?: true | false // 是否禁用
|
disabled?: true | false // 是否禁用
|
||||||
returnZero?: true | false // 少于最小值时是否归0
|
returnZero?: true | false // 少于最小值时是否归0
|
||||||
}
|
}
|
||||||
export default memo((props: params) => {
|
|
||||||
return <Counter {...props}></Counter>
|
|
||||||
})
|
|
||||||
|
|
||||||
const Counter = memo((props: params) => {
|
const CounterDisplayName = (props: params) => {
|
||||||
const {
|
const {
|
||||||
minNum = 0,
|
minNum = 0,
|
||||||
maxNum = 10000,
|
maxNum = 10000,
|
||||||
@ -35,6 +32,22 @@ const Counter = memo((props: params) => {
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
} = props
|
} = props
|
||||||
const [value, setValue] = useState<any>({ count: defaultNum })
|
const [value, setValue] = useState<any>({ count: defaultNum })
|
||||||
|
// 保留小数
|
||||||
|
const formatDigits = (num) => {
|
||||||
|
num = `${num}`
|
||||||
|
if (num.includes('.')) {
|
||||||
|
const res = num.split('.')
|
||||||
|
if (digits > 0) {
|
||||||
|
const last_num = res[1].substr(0, digits)
|
||||||
|
return `${res[0]}.${last_num}`
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return res[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseFloat(num)
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue({ count: defaultNum })
|
setValue({ count: defaultNum })
|
||||||
}, [defaultNum])
|
}, [defaultNum])
|
||||||
@ -63,23 +76,6 @@ const Counter = memo((props: params) => {
|
|||||||
onClickBtn?.(parseFloat(num_res))
|
onClickBtn?.(parseFloat(num_res))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保留小数
|
|
||||||
const formatDigits = (num) => {
|
|
||||||
num = `${num}`
|
|
||||||
if (num.includes('.')) {
|
|
||||||
const res = num.split('.')
|
|
||||||
if (digits > 0) {
|
|
||||||
const last_num = res[1].substr(0, digits)
|
|
||||||
return `${res[0]}.${last_num}`
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return res[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseFloat(num)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查数据
|
// 检查数据
|
||||||
const checkData = (val) => {
|
const checkData = (val) => {
|
||||||
const num = parseFloat(val)
|
const num = parseFloat(val)
|
||||||
@ -93,14 +89,14 @@ const Counter = memo((props: params) => {
|
|||||||
if (res === '') {
|
if (res === '') {
|
||||||
onChange?.(minNum)
|
onChange?.(minNum)
|
||||||
}
|
}
|
||||||
else if (!isNaN(Number(res))) {
|
else if (!Number.isNaN(Number(res))) {
|
||||||
let count = formatDigits(res)
|
let count = formatDigits(res)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
onChange?.(parseFloat(count as string))
|
onChange?.(parseFloat(count as string))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const num = parseFloat(res)
|
const num = parseFloat(res)
|
||||||
if (!isNaN(num)) {
|
if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
onChange?.(count as number)
|
onChange?.(count as number)
|
||||||
@ -117,7 +113,7 @@ const Counter = memo((props: params) => {
|
|||||||
onBlue?.(minNum)
|
onBlue?.(minNum)
|
||||||
setValue({ count: minNum })
|
setValue({ count: minNum })
|
||||||
}
|
}
|
||||||
else if (!isNaN(num)) {
|
else if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue({ count })
|
setValue({ count })
|
||||||
@ -142,4 +138,9 @@ const Counter = memo((props: params) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
const Counter = memo(CounterDisplayName)
|
||||||
|
const CounterWithMemo = (props: params) => {
|
||||||
|
return <Counter {...props}></Counter>
|
||||||
|
}
|
||||||
|
export default memo(CounterWithMemo)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { View } from '@tarojs/components'
|
|||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export default memo(() => {
|
const DotLoading = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.load_box}>
|
<View className={styles.load_box}>
|
||||||
@ -14,4 +14,5 @@ export default memo(() => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(DotLoading)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ interface Param {
|
|||||||
messageShow?: true|false
|
messageShow?: true|false
|
||||||
numberFormat?: 'number'|'text' // 数字还是字符串
|
numberFormat?: 'number'|'text' // 数字还是字符串
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false, numberFormat = 'number' }: Param) => {
|
const EstimeatedAmount = ({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false, numberFormat = 'number' }: Param) => {
|
||||||
const [show, setShow] = useState(messageShow)
|
const [show, setShow] = useState(messageShow)
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setShow(false)
|
setShow(false)
|
||||||
@ -28,14 +28,6 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
|
|
||||||
const [style, setStyle] = useState<{ top: string }>()
|
const [style, setStyle] = useState<{ top: string }>()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (show) {
|
|
||||||
getDomDes('#message')
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setStyle(() => ({ top: '0' }))
|
|
||||||
}
|
|
||||||
}, [show])
|
|
||||||
// 设置弹出层高度
|
// 设置弹出层高度
|
||||||
const getDomDes = (id) => {
|
const getDomDes = (id) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -46,6 +38,14 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
}).exec()
|
}).exec()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (show) {
|
||||||
|
getDomDes('#message')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setStyle(() => ({ top: '0' }))
|
||||||
|
}
|
||||||
|
}, [show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.order_price}>
|
<View className={styles.order_price}>
|
||||||
@ -62,4 +62,5 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(EstimeatedAmount)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ type params = {
|
|||||||
onFiltr?: (val: object) => void // 确定搜索
|
onFiltr?: (val: object) => void // 确定搜索
|
||||||
onRest?: (val: Object) => void // 重置
|
onRest?: (val: Object) => void // 重置
|
||||||
} & PopuParams
|
} & PopuParams
|
||||||
export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
|
const Filter = ({ onClose, onFiltr, show = false, onRest }: params) => {
|
||||||
// 搜索条件
|
// 搜索条件
|
||||||
const [filterObj, setFilterObj] = useState({
|
const [filterObj, setFilterObj] = useState({
|
||||||
seriesName: '',
|
seriesName: '',
|
||||||
@ -145,4 +145,5 @@ export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Filter)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { GetProductKindListApi } from '@/api/material'
|
|||||||
type params = {
|
type params = {
|
||||||
onFiltr?: (val: object) => void
|
onFiltr?: (val: object) => void
|
||||||
} & PopuParams
|
} & PopuParams
|
||||||
export default ({ onClose, onFiltr, show = false }: params) => {
|
const FilterV2 = ({ onClose, onFiltr, show = false }: params) => {
|
||||||
// 搜索条件
|
// 搜索条件
|
||||||
const [filterObj, setFilterObj] = useState({
|
const [filterObj, setFilterObj] = useState({
|
||||||
seriesId: '',
|
seriesId: '',
|
||||||
@ -64,7 +64,7 @@ export default ({ onClose, onFiltr, show = false }: params) => {
|
|||||||
const setNumber = (e, field) => {
|
const setNumber = (e, field) => {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
const num = parseFloat(e.detail.value)
|
const num = parseFloat(e.detail.value)
|
||||||
if (isNaN(num)) {
|
if (Number.isNaN(num)) {
|
||||||
filterObj[field] = null
|
filterObj[field] = null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -167,3 +167,5 @@ export default ({ onClose, onFiltr, show = false }: params) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default FilterV2
|
||||||
|
|||||||
@ -25,7 +25,7 @@ interface Params {
|
|||||||
refresherTriggered?: true|false
|
refresherTriggered?: true|false
|
||||||
refresherEnabled?: true|false
|
refresherEnabled?: true|false
|
||||||
}
|
}
|
||||||
export default memo(({
|
const InfiniteScroll = ({
|
||||||
styleObj,
|
styleObj,
|
||||||
selfonScrollToLower,
|
selfonScrollToLower,
|
||||||
selfOnScrollToUpper,
|
selfOnScrollToUpper,
|
||||||
@ -91,28 +91,31 @@ export default memo(({
|
|||||||
refresherBackground="#F8F8F8"
|
refresherBackground="#F8F8F8"
|
||||||
scrollTop={scrollTop}
|
scrollTop={scrollTop}
|
||||||
>
|
>
|
||||||
{!moreStatus && <>
|
{!moreStatus
|
||||||
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
? <>
|
||||||
{children}
|
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
||||||
</View>
|
{children}
|
||||||
</>
|
</View>
|
||||||
|| <>
|
</>
|
||||||
{(statusMore == 2 || statusMore == 3) && <View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
: <>
|
||||||
{children}
|
{(statusMore == 2 || statusMore == 3) && <View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
||||||
<View className={style.infinite_scroll}>
|
{children}
|
||||||
{
|
<View className={style.infinite_scroll}>
|
||||||
(statusMore == 2) && <View className={style.loading_more}>加载中<DotLoading /></View>
|
{
|
||||||
|| <View className={style.noMore}>没有更多数据了</View>
|
(statusMore == 2)
|
||||||
}
|
? <View className={style.loading_more}>加载中<DotLoading /></View>
|
||||||
</View>
|
: <View className={style.noMore}>没有更多数据了</View>
|
||||||
</View>
|
}
|
||||||
}
|
</View>
|
||||||
{(statusMore == 0) && <LoadingCard />}
|
</View>
|
||||||
{(statusMore == 1) && <LoadingCard loadingIcon={false} title="暂无数据" />}
|
}
|
||||||
</>}
|
{(statusMore == 0) && <LoadingCard />}
|
||||||
|
{(statusMore == 1) && <LoadingCard loadingIcon={false} title="暂无数据" />}
|
||||||
|
</>}
|
||||||
|
|
||||||
<View className="common_safe_area_y"></View>
|
<View className="common_safe_area_y"></View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(InfiniteScroll)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { View } from '@tarojs/components'
|
|||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
import style from './index.module.scss'
|
import style from './index.module.scss'
|
||||||
|
|
||||||
export default memo(({ width = 60, color = '#6190e8' }: { width?: number; color?: string }) => {
|
const Loading = ({ width = 60, color = '#6190e8' }: { width?: number; color?: string }) => {
|
||||||
const styleObj = useMemo(() => {
|
const styleObj = useMemo(() => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
||||||
@ -19,4 +19,5 @@ export default memo(({ width = 60, color = '#6190e8' }: { width?: number; color?
|
|||||||
<View style={styleObj} className={style.loading__ring}></View>
|
<View style={styleObj} className={style.loading__ring}></View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Loading)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Params {
|
|||||||
title?: string
|
title?: string
|
||||||
loadingIcon?: false|true
|
loadingIcon?: false|true
|
||||||
}
|
}
|
||||||
export default memo(({
|
const LoadingCard = ({
|
||||||
styleLoading = {},
|
styleLoading = {},
|
||||||
title = '加载中...', // 显示的文字
|
title = '加载中...', // 显示的文字
|
||||||
loadingIcon = true, // 是否显示加载图标
|
loadingIcon = true, // 是否显示加载图标
|
||||||
@ -22,4 +22,5 @@ export default memo(({
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LoadingCard)
|
||||||
|
|||||||
@ -12,7 +12,7 @@ interface param {
|
|||||||
children?: ReactElement | null
|
children?: ReactElement | null
|
||||||
onClick?: () => void
|
onClick?: () => void
|
||||||
}
|
}
|
||||||
export default ({ children = null, onClick }: param) => {
|
const MoveBtn = ({ children = null, onClick }: param) => {
|
||||||
// 获取购物车数据数量
|
// 获取购物车数据数量
|
||||||
const { getShopCount, commonData } = useCommonData()
|
const { getShopCount, commonData } = useCommonData()
|
||||||
|
|
||||||
@ -53,3 +53,5 @@ export default ({ children = null, onClick }: param) => {
|
|||||||
</MovableArea>
|
</MovableArea>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default MoveBtn
|
||||||
|
|||||||
@ -25,8 +25,7 @@ interface Param {
|
|||||||
showStatus?: 'detail' | 'list' // 订单详情,订单列表
|
showStatus?: 'detail' | 'list' // 订单详情,订单列表
|
||||||
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
||||||
}
|
}
|
||||||
|
const OrderBtns = ({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
||||||
export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|
||||||
// 订单状态枚举
|
// 订单状态枚举
|
||||||
const {
|
const {
|
||||||
SaleOrderStatusBooking,
|
SaleOrderStatusBooking,
|
||||||
@ -161,28 +160,6 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
const { ApplyGoods } = SUBSCRIPTION_MESSAGE_SCENE
|
const { ApplyGoods } = SUBSCRIPTION_MESSAGE_SCENE
|
||||||
const { openSubscriptionMessage } = UseSubscriptionMessage()
|
const { openSubscriptionMessage } = UseSubscriptionMessage()
|
||||||
|
|
||||||
// 点击按钮操作
|
|
||||||
const submitBtns = throttle(async(val, index) => {
|
|
||||||
if (val == 1) {
|
|
||||||
cancelOrder()
|
|
||||||
}
|
|
||||||
else if (val == 6) {
|
|
||||||
receiveOrder()
|
|
||||||
}
|
|
||||||
else if (val == 5) {
|
|
||||||
applyProduct()
|
|
||||||
}
|
|
||||||
else if (val == 3) {
|
|
||||||
bigApplyRefurn()
|
|
||||||
}
|
|
||||||
else if (val == 8) {
|
|
||||||
applyRefund()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
onClick?.(val)
|
|
||||||
}
|
|
||||||
}, 800)
|
|
||||||
|
|
||||||
// 大货申请退款
|
// 大货申请退款
|
||||||
const bigApplyRefurn = () => {
|
const bigApplyRefurn = () => {
|
||||||
Taro.showModal({
|
Taro.showModal({
|
||||||
@ -285,7 +262,27 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
const styleTop = useMemo(() => {
|
const styleTop = useMemo(() => {
|
||||||
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
|
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
|
||||||
}, [orderBtnsShowList])
|
}, [orderBtnsShowList])
|
||||||
|
// 点击按钮操作
|
||||||
|
const submitBtns = throttle(async(val, index) => {
|
||||||
|
if (val == 1) {
|
||||||
|
cancelOrder()
|
||||||
|
}
|
||||||
|
else if (val == 6) {
|
||||||
|
receiveOrder()
|
||||||
|
}
|
||||||
|
else if (val == 5) {
|
||||||
|
applyProduct()
|
||||||
|
}
|
||||||
|
else if (val == 3) {
|
||||||
|
bigApplyRefurn()
|
||||||
|
}
|
||||||
|
else if (val == 8) {
|
||||||
|
applyRefund()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onClick?.(val)
|
||||||
|
}
|
||||||
|
}, 800)
|
||||||
return (
|
return (
|
||||||
<View className={styles.btns_list}>
|
<View className={styles.btns_list}>
|
||||||
{orderBtnsShowList.length > 3 && (
|
{orderBtnsShowList.length > 3 && (
|
||||||
@ -321,4 +318,5 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderBtns)
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export interface Params {
|
|||||||
position?: 'bottom'|'top'|'right' // 弹出位置
|
position?: 'bottom'|'top'|'right' // 弹出位置
|
||||||
animationEnd?: () => void // 弹出动画结束
|
animationEnd?: () => void // 弹出动画结束
|
||||||
}
|
}
|
||||||
export default memo((
|
const Popup = (
|
||||||
{
|
{
|
||||||
title = '标题',
|
title = '标题',
|
||||||
show = false,
|
show = false,
|
||||||
@ -72,4 +72,5 @@ export default memo((
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Popup)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ interface Params {
|
|||||||
desStatus?: true | false
|
desStatus?: true | false
|
||||||
productList?: any[]
|
productList?: any[]
|
||||||
}
|
}
|
||||||
export default ({ desStatus = true, productList = [] }: Params) => {
|
const Product = ({ desStatus = true, productList = [] }: Params) => {
|
||||||
const labAndImgObj = useCallback(
|
const labAndImgObj = useCallback(
|
||||||
(item) => {
|
(item) => {
|
||||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||||
@ -21,7 +21,7 @@ export default ({ desStatus = true, productList = [] }: Params) => {
|
|||||||
<View className={styles.products_list}>
|
<View className={styles.products_list}>
|
||||||
{productList?.map((item) => {
|
{productList?.map((item) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_item} onClick={() => goLink(`/pages/details/index?id=${item.id}`)}>
|
<View key={item.id} className={styles.products_item} onClick={() => goLink(`/pages/details/index?id=${item.id}`)}>
|
||||||
<View className={styles.item_img}>
|
<View className={styles.item_img}>
|
||||||
<LabAndImg value={labAndImgObj(item)} />
|
<LabAndImg value={labAndImgObj(item)} />
|
||||||
<View className={styles.num}>{item.product_color_count}色</View>
|
<View className={styles.num}>{item.product_color_count}色</View>
|
||||||
@ -44,3 +44,5 @@ export default ({ desStatus = true, productList = [] }: Params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Product
|
||||||
|
|||||||
@ -20,99 +20,95 @@ interface Params {
|
|||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
borderRadius?: string
|
borderRadius?: string
|
||||||
}
|
}
|
||||||
|
const Search = (
|
||||||
|
{
|
||||||
|
clickOnSearch, // 点击筛选按钮触发
|
||||||
|
changeOnSearch, // 输入文字触发
|
||||||
|
disabled = false, // 是否禁用
|
||||||
|
placeholder = '输入搜索内容',
|
||||||
|
showIcon = true, // 是否显示关闭图标
|
||||||
|
showBtn = false, // 是否显示搜索按钮
|
||||||
|
btnStyle = {},
|
||||||
|
placeIcon = 'inner', // 搜索图标位置:inner在里面,out在外面
|
||||||
|
btnTitle = '搜索', // 搜索文字
|
||||||
|
debounceTime = 0, // 防抖时间,不设默认为零
|
||||||
|
defaultValue = '', // 默认值
|
||||||
|
borderRadius = '50rpx',
|
||||||
|
}: Params,
|
||||||
|
ref,
|
||||||
|
) => {
|
||||||
|
const [inputCon, setInputCon] = useState('')
|
||||||
|
const debounceTimeRef = useRef(0)
|
||||||
|
useEffect(() => {
|
||||||
|
setInputCon(defaultValue)
|
||||||
|
}, [defaultValue])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
debounceTimeRef.current = debounceTime
|
||||||
|
}, [debounceTime])
|
||||||
|
|
||||||
|
const clearInput = () => {
|
||||||
|
setInputCon('')
|
||||||
|
changeOnSearch?.('')
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeData = debounce((value) => {
|
||||||
|
setInputCon(value)
|
||||||
|
changeOnSearch?.(value)
|
||||||
|
}, debounceTimeRef.current)
|
||||||
|
const onInputEven = (e) => {
|
||||||
|
const value = e.detail.value
|
||||||
|
changeData(value)
|
||||||
|
}
|
||||||
|
const onSearch = () => {
|
||||||
|
clickOnSearch?.(inputCon)
|
||||||
|
}
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
clearInput,
|
||||||
|
}))
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<View className={styles.search_main}>
|
||||||
|
<View className={styles.search_con}>
|
||||||
|
{showIcon && (
|
||||||
|
<View
|
||||||
|
className={classnames(
|
||||||
|
'iconfont',
|
||||||
|
'icon-sousuo',
|
||||||
|
styles.icon_a_sousuo1_self,
|
||||||
|
placeIcon == 'inner' ? styles.icon_inner : styles.icon_out,
|
||||||
|
)}
|
||||||
|
></View>
|
||||||
|
)}
|
||||||
|
<Input
|
||||||
|
style={{ borderRadius }}
|
||||||
|
alwaysEmbed
|
||||||
|
cursorSpacing={150}
|
||||||
|
placeholderStyle="color:#ABABAB; font-size:26rpx"
|
||||||
|
onConfirm={onSearch}
|
||||||
|
className={classnames(placeIcon == 'out' && styles.input_out)}
|
||||||
|
disabled={disabled}
|
||||||
|
value={inputCon}
|
||||||
|
placeholder={placeholder}
|
||||||
|
onInput={e => onInputEven(e)}
|
||||||
|
></Input>
|
||||||
|
{!!inputCon && (
|
||||||
|
<View className={styles.search_closeBtn}>
|
||||||
|
<CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
{showBtn && (
|
||||||
|
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
|
||||||
|
{btnTitle}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
export default memo(
|
export default memo(
|
||||||
forwardRef(
|
forwardRef(
|
||||||
(
|
Search,
|
||||||
{
|
|
||||||
clickOnSearch, // 点击筛选按钮触发
|
|
||||||
changeOnSearch, // 输入文字触发
|
|
||||||
disabled = false, // 是否禁用
|
|
||||||
placeholder = '输入搜索内容',
|
|
||||||
showIcon = true, // 是否显示关闭图标
|
|
||||||
showBtn = false, // 是否显示搜索按钮
|
|
||||||
btnStyle = {},
|
|
||||||
placeIcon = 'inner', // 搜索图标位置:inner在里面,out在外面
|
|
||||||
btnTitle = '搜索', // 搜索文字
|
|
||||||
debounceTime = 0, // 防抖时间,不设默认为零
|
|
||||||
defaultValue = '', // 默认值
|
|
||||||
borderRadius = '50rpx',
|
|
||||||
}: Params,
|
|
||||||
ref,
|
|
||||||
) => {
|
|
||||||
const [inputCon, setInputCon] = useState('')
|
|
||||||
const debounceTimeRef = useRef(0)
|
|
||||||
useEffect(() => {
|
|
||||||
setInputCon(defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
debounceTimeRef.current = debounceTime
|
|
||||||
}, [debounceTime])
|
|
||||||
|
|
||||||
const onInputEven = (e) => {
|
|
||||||
const value = e.detail.value
|
|
||||||
changeData(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
|
||||||
clearInput,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const clearInput = () => {
|
|
||||||
setInputCon('')
|
|
||||||
changeOnSearch?.('')
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeData = debounce((value) => {
|
|
||||||
setInputCon(value)
|
|
||||||
changeOnSearch?.(value)
|
|
||||||
}, debounceTimeRef.current)
|
|
||||||
|
|
||||||
const onSearch = () => {
|
|
||||||
clickOnSearch?.(inputCon)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View className={styles.search_main}>
|
|
||||||
<View className={styles.search_con}>
|
|
||||||
{showIcon && (
|
|
||||||
<View
|
|
||||||
className={classnames(
|
|
||||||
'iconfont',
|
|
||||||
'icon-sousuo',
|
|
||||||
styles.icon_a_sousuo1_self,
|
|
||||||
placeIcon == 'inner' ? styles.icon_inner : styles.icon_out,
|
|
||||||
)}
|
|
||||||
></View>
|
|
||||||
)}
|
|
||||||
<Input
|
|
||||||
style={{ borderRadius }}
|
|
||||||
alwaysEmbed
|
|
||||||
cursorSpacing={150}
|
|
||||||
placeholderStyle="color:#ABABAB; font-size:26rpx"
|
|
||||||
onConfirm={onSearch}
|
|
||||||
className={classnames(placeIcon == 'out' && styles.input_out)}
|
|
||||||
disabled={disabled}
|
|
||||||
value={inputCon}
|
|
||||||
placeholder={placeholder}
|
|
||||||
onInput={e => onInputEven(e)}
|
|
||||||
></Input>
|
|
||||||
{!!inputCon && (
|
|
||||||
<View className={styles.search_closeBtn}>
|
|
||||||
<CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
{showBtn && (
|
|
||||||
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
|
|
||||||
{btnTitle}
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -17,8 +17,7 @@ interface Params {
|
|||||||
titleStyle?: Object
|
titleStyle?: Object
|
||||||
styleObj?: Object
|
styleObj?: Object
|
||||||
}
|
}
|
||||||
|
const SearchInput = (props: Params) => {
|
||||||
export default memo((props: Params) => {
|
|
||||||
const {
|
const {
|
||||||
showTitle = true,
|
showTitle = true,
|
||||||
title = '标题',
|
title = '标题',
|
||||||
@ -60,4 +59,5 @@ export default memo((props: Params) => {
|
|||||||
{showIcon && <View className={`iconfont icon-jiantou ${styles.icon_more_self}`}></View>}
|
{showIcon && <View className={`iconfont icon-jiantou ${styles.icon_more_self}`}></View>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(SearchInput)
|
||||||
|
|||||||
@ -15,8 +15,7 @@ interface param {
|
|||||||
onChangeCount: (val: any) => any
|
onChangeCount: (val: any) => any
|
||||||
item: any
|
item: any
|
||||||
}
|
}
|
||||||
|
const ProductItem = (props: param) => {
|
||||||
export default memo((props: param) => {
|
|
||||||
const { onChangeCount, onChangeSelect, item, sale_model } = props
|
const { onChangeCount, onChangeSelect, item, sale_model } = props
|
||||||
|
|
||||||
const selectCallBack = useCallback(() => {
|
const selectCallBack = useCallback(() => {
|
||||||
@ -99,4 +98,5 @@ export default memo((props: param) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ProductItem)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ interface param {
|
|||||||
intoStatus?: 'again' | 'shop'
|
intoStatus?: 'again' | 'shop'
|
||||||
default_sale_mode?: number // 面料类型(0:大货, 1:剪版,2:散剪
|
default_sale_mode?: number // 面料类型(0:大货, 1:剪版,2:散剪
|
||||||
}
|
}
|
||||||
export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
const ShowCartCopy = ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
||||||
const selectList = [
|
const selectList = [
|
||||||
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
||||||
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
||||||
@ -416,3 +416,5 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ShowCartCopy
|
||||||
|
|||||||
@ -38,7 +38,7 @@ interface modelClassType {
|
|||||||
defaultNum: number
|
defaultNum: number
|
||||||
eunit: string
|
eunit: string
|
||||||
}
|
}
|
||||||
export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
||||||
const selectList: modelClassType[] = [
|
const selectList: modelClassType[] = [
|
||||||
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
||||||
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
||||||
@ -58,13 +58,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
}
|
}
|
||||||
}, [default_sale_mode])
|
}, [default_sale_mode])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
startTransition(() => {
|
|
||||||
resetList()
|
|
||||||
setSelectStatus(true)
|
|
||||||
})
|
|
||||||
}, [selectIndex])
|
|
||||||
|
|
||||||
// 获取购物车数据数量
|
// 获取购物车数据数量
|
||||||
const { getShopCount } = useCommonData()
|
const { getShopCount } = useCommonData()
|
||||||
|
|
||||||
@ -72,12 +65,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
const [list, setList] = useState<Record<number, any>>({})
|
const [list, setList] = useState<Record<number, any>>({})
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const { fetchData: getShoppingFetchData } = GetShoppingCartApi()
|
const { fetchData: getShoppingFetchData } = GetShoppingCartApi()
|
||||||
const getShoppingCart = async() => {
|
|
||||||
const { data } = await getShoppingFetchData()
|
|
||||||
const color_list = data.color_list || []
|
|
||||||
initList(color_list)
|
|
||||||
setLoading(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新单条数据
|
// 更新单条数据
|
||||||
const getShoppingCartInfo = async(item) => {
|
const getShoppingCartInfo = async(item) => {
|
||||||
@ -106,7 +93,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
// 初始化全部数据默认勾选
|
// 初始化全部数据默认勾选
|
||||||
const initList = (color_list) => {
|
const initList = (color_list) => {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
color_list?.map((item) => {
|
color_list?.forEach((item) => {
|
||||||
item.selected = selectIndex == item.sale_mode
|
item.selected = selectIndex == item.sale_mode
|
||||||
const { unit, eunit, step, digits, minNum, maxNum } = selectList[item.sale_mode]
|
const { unit, eunit, step, digits, minNum, maxNum } = selectList[item.sale_mode]
|
||||||
item = { ...item, unit, eunit, step, digits, minNum, maxNum }
|
item = { ...item, unit, eunit, step, digits, minNum, maxNum }
|
||||||
@ -114,10 +101,15 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})
|
})
|
||||||
setList(() => ({ ...obj }))
|
setList(() => ({ ...obj }))
|
||||||
}
|
}
|
||||||
|
const getShoppingCart = async() => {
|
||||||
|
const { data } = await getShoppingFetchData()
|
||||||
|
const color_list = data.color_list || []
|
||||||
|
initList(color_list)
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
// 重置勾选数据
|
// 重置勾选数据
|
||||||
const resetList = () => {
|
const resetList = () => {
|
||||||
Object.values(list)?.map((item) => {
|
Object.values(list)?.forEach((item) => {
|
||||||
if (selectIndex == item.sale_mode) {
|
if (selectIndex == item.sale_mode) {
|
||||||
item.selected = true
|
item.selected = true
|
||||||
}
|
}
|
||||||
@ -129,6 +121,8 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
setList(() => ({ ...list }))
|
setList(() => ({ ...list }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 绑定业务员和电话号码
|
||||||
|
const [showBindSalesman, setShowBindSalesman] = useState(false)
|
||||||
// 显示时展示数据
|
// 显示时展示数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!show) {
|
if (!show) {
|
||||||
@ -150,7 +144,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
// 全选反选
|
// 全选反选
|
||||||
const [selectStatus, setSelectStatus] = useState(false)
|
const [selectStatus, setSelectStatus] = useState(false)
|
||||||
const selectAll = () => {
|
const selectAll = () => {
|
||||||
Object.values(list)?.map((item) => {
|
Object.values(list)?.forEach((item) => {
|
||||||
if (selectIndex == item.sale_mode) {
|
if (selectIndex == item.sale_mode) {
|
||||||
item.selected = !selectStatus
|
item.selected = !selectStatus
|
||||||
list[item.id] = { ...item }
|
list[item.id] = { ...item }
|
||||||
@ -164,7 +158,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let list_count = 0
|
let list_count = 0
|
||||||
let select_count = 0
|
let select_count = 0
|
||||||
Object.values(list)?.map((item) => {
|
Object.values(list)?.forEach((item) => {
|
||||||
if (selectIndex == item.sale_mode) {
|
if (selectIndex == item.sale_mode) {
|
||||||
list_count++
|
list_count++
|
||||||
if (item.selected) { select_count++ }
|
if (item.selected) { select_count++ }
|
||||||
@ -172,7 +166,18 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})
|
})
|
||||||
setSelectStatus(select_count == list_count)
|
setSelectStatus(select_count == list_count)
|
||||||
}, [list])
|
}, [list])
|
||||||
|
// 计数组件-当后端修改完成才修改前端显示
|
||||||
|
const { fetchData: fetchDataUpdateShoppingCart } = UpdateShoppingCartApi()
|
||||||
|
const getInputValue = debounce(async(item) => {
|
||||||
|
const res = await fetchDataUpdateShoppingCart({ id: item.id, roll: item.roll, length: item.length })
|
||||||
|
if (res.success) {
|
||||||
|
console.log('item修改::', item)
|
||||||
|
getShoppingCartInfo(item)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setList(e => ({ ...e }))
|
||||||
|
}
|
||||||
|
}, 300)
|
||||||
// 修改数量
|
// 修改数量
|
||||||
const onChangeCount = useCallback((item) => {
|
const onChangeCount = useCallback((item) => {
|
||||||
getInputValue(item)
|
getInputValue(item)
|
||||||
@ -188,7 +193,16 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
onClose?.()
|
onClose?.()
|
||||||
setShowPopup(false)
|
setShowPopup(false)
|
||||||
}
|
}
|
||||||
|
// 获取面料选中的id
|
||||||
|
const selectIds = useRef<number[]>([])
|
||||||
|
const getSelectId = () => {
|
||||||
|
selectIds.current = []
|
||||||
|
Object.values(list)?.forEach((item) => {
|
||||||
|
if (selectIndex == item.sale_mode) {
|
||||||
|
item.selected && selectIds.current.push(item.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
// 删除购物车内容
|
// 删除购物车内容
|
||||||
const { fetchData: delShopFetchData } = DelShoppingCartApi()
|
const { fetchData: delShopFetchData } = DelShoppingCartApi()
|
||||||
const delSelect = () => {
|
const delSelect = () => {
|
||||||
@ -221,24 +235,13 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取面料选中的id
|
|
||||||
const selectIds = useRef<number[]>([])
|
|
||||||
const getSelectId = () => {
|
|
||||||
selectIds.current = []
|
|
||||||
Object.values(list)?.map((item) => {
|
|
||||||
if (selectIndex == item.sale_mode) {
|
|
||||||
item.selected && selectIds.current.push(item.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 预估金额和总条数
|
// 预估金额和总条数
|
||||||
const estimatePrice = useMemo(() => {
|
const estimatePrice = useMemo(() => {
|
||||||
let estimate_amount = 0
|
let estimate_amount = 0
|
||||||
const product_list = new Set() // 面料
|
const product_list = new Set() // 面料
|
||||||
let color_count = 0 // 颜色数量
|
let color_count = 0 // 颜色数量
|
||||||
let all_count = 0 // 总数量
|
let all_count = 0 // 总数量
|
||||||
Object.values(list)?.map((item) => {
|
Object.values(list)?.forEach((item) => {
|
||||||
if (item.selected) {
|
if (item.selected) {
|
||||||
estimate_amount += item.estimate_amount
|
estimate_amount += item.estimate_amount
|
||||||
product_list.add(item.product_id)
|
product_list.add(item.product_id)
|
||||||
@ -256,10 +259,10 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
}, [list])
|
}, [list])
|
||||||
|
|
||||||
// 去结算
|
// 去结算
|
||||||
const { fetchData: useFetchData } = GetAdminUserInfoApi()
|
const { fetchData: FetchData } = GetAdminUserInfoApi()
|
||||||
const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi()
|
const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi()
|
||||||
const orderDetail = throttle(async() => {
|
const orderDetail = throttle(async() => {
|
||||||
const res = await useFetchData()
|
const res = await FetchData()
|
||||||
if (res.data.order_access_status !== 3) {
|
if (res.data.order_access_status !== 3) {
|
||||||
if (res.data.order_access_status == 1) { applyOrderAccessFetchData() }
|
if (res.data.order_access_status == 1) { applyOrderAccessFetchData() }
|
||||||
setShowBindSalesman(() => true)
|
setShowBindSalesman(() => true)
|
||||||
@ -283,22 +286,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
// 计数组件-当后端修改完成才修改前端显示
|
|
||||||
const { fetchData: fetchDataUpdateShoppingCart } = UpdateShoppingCartApi()
|
|
||||||
const getInputValue = debounce(async(item) => {
|
|
||||||
const res = await fetchDataUpdateShoppingCart({ id: item.id, roll: item.roll, length: item.length })
|
|
||||||
if (res.success) {
|
|
||||||
console.log('item修改::', item)
|
|
||||||
getShoppingCartInfo(item)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setList(e => ({ ...e }))
|
|
||||||
}
|
|
||||||
}, 300)
|
|
||||||
|
|
||||||
// 绑定业务员和电话号码
|
|
||||||
const [showBindSalesman, setShowBindSalesman] = useState(false)
|
|
||||||
|
|
||||||
// 显示图片弹窗
|
// 显示图片弹窗
|
||||||
const [showLabImage, setShowLabImage] = useState(false)
|
const [showLabImage, setShowLabImage] = useState(false)
|
||||||
const [labImageValue, setLabImageValue] = useState()
|
const [labImageValue, setLabImageValue] = useState()
|
||||||
@ -314,7 +301,12 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
onClose?.()
|
onClose?.()
|
||||||
goLink('/pages/index/index', null, 'switchTab')
|
goLink('/pages/index/index', null, 'switchTab')
|
||||||
}, [])
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
startTransition(() => {
|
||||||
|
resetList()
|
||||||
|
setSelectStatus(true)
|
||||||
|
})
|
||||||
|
}, [selectIndex])
|
||||||
return (
|
return (
|
||||||
<View className={styles.shop_cart_main}>
|
<View className={styles.shop_cart_main}>
|
||||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
|
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
|
||||||
@ -346,7 +338,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
<InfiniteScroll moreStatus={false}>
|
<InfiniteScroll moreStatus={false}>
|
||||||
<View className={styles.product_list}>
|
<View className={styles.product_list}>
|
||||||
{listData?.map((item) => {
|
{listData?.map((item) => {
|
||||||
return <ProductItem sale_model={selectIndex} onChangeCount={onChangeCount} onChangeSelect={onChangeSelect} item={item} />
|
return <ProductItem key={item.id} sale_model={selectIndex} onChangeCount={onChangeCount} onChangeSelect={onChangeSelect} item={item} />
|
||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
@ -388,3 +380,4 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default ShopCart
|
||||||
|
|||||||
@ -24,136 +24,133 @@ interface Params {
|
|||||||
statusMore?: StatusParam
|
statusMore?: StatusParam
|
||||||
selectClass?: (val: number) => void
|
selectClass?: (val: number) => void
|
||||||
}
|
}
|
||||||
|
const SideBar = ({
|
||||||
|
list = [],
|
||||||
|
defaultValue = 0,
|
||||||
|
height = '100vh',
|
||||||
|
sideBarOnClick,
|
||||||
|
children,
|
||||||
|
heightItem = 108,
|
||||||
|
refresherTriggered = false,
|
||||||
|
selfOnRefresherRefresh,
|
||||||
|
selfOnScrolltolower,
|
||||||
|
hasMore = true,
|
||||||
|
statusMore = 0,
|
||||||
|
selectClass,
|
||||||
|
}: Params) => {
|
||||||
|
const num_half = useRef(0)
|
||||||
|
|
||||||
export default memo(
|
const [selected, setSelected] = useState(defaultValue)
|
||||||
({
|
const [tabId, setTabId] = useState('')
|
||||||
list = [],
|
|
||||||
defaultValue = 0,
|
|
||||||
height = '100vh',
|
|
||||||
sideBarOnClick,
|
|
||||||
children,
|
|
||||||
heightItem = 108,
|
|
||||||
refresherTriggered = false,
|
|
||||||
selfOnRefresherRefresh,
|
|
||||||
selfOnScrolltolower,
|
|
||||||
hasMore = true,
|
|
||||||
statusMore = 0,
|
|
||||||
selectClass,
|
|
||||||
}: Params) => {
|
|
||||||
const num_half = useRef(0)
|
|
||||||
|
|
||||||
const [selected, setSelected] = useState(defaultValue)
|
const computeSelectTab = (index) => {
|
||||||
const [tabId, setTabId] = useState('')
|
if (index + 1 > num_half.current) {
|
||||||
|
const num = index + 1 - num_half.current
|
||||||
useEffect(() => {
|
setTabId(list[num].id.toString())
|
||||||
setSelected(defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
const index = list?.findIndex((item) => {
|
|
||||||
return item.id == defaultValue
|
|
||||||
})
|
|
||||||
if (index !== -1) {
|
|
||||||
computeSelectTab(index)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
setTabId(list[0].id.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const clickEvent = ({ item, index }: { item; index: number }) => {
|
// 二级面料系列分类
|
||||||
setSelected(item.id)
|
const [openClass, setOpenClass] = useState(false)
|
||||||
sideBarOnClick?.(item)
|
const [classList, setClassList] = useState([])
|
||||||
|
const [classId, setClassId] = useState(-1)
|
||||||
|
const { fetchData } = GetClassList()
|
||||||
|
const getClassData = async(id) => {
|
||||||
|
const res = await fetchData({ id })
|
||||||
|
if (res.success) {
|
||||||
|
if (res.data?.list.length > 0) {
|
||||||
|
res.data.list = [{ id: -1, name: '全部' }, ...res.data.list]
|
||||||
|
}
|
||||||
|
setClassList(() => res.data?.list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (selected) { getClassData(selected) }
|
||||||
|
}, [selected])
|
||||||
|
|
||||||
|
const getSelectClass = (id) => {
|
||||||
|
selectClass?.(id)
|
||||||
|
setClassId(() => id)
|
||||||
|
}
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
const index = list?.findIndex((item) => {
|
||||||
|
return item.id == defaultValue
|
||||||
|
})
|
||||||
|
if (index !== -1) {
|
||||||
computeSelectTab(index)
|
computeSelectTab(index)
|
||||||
setClassId(-1)
|
|
||||||
selectClass?.(-1)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const computeSelectTab = (index) => {
|
const clickEvent = ({ item, index }: { item; index: number }) => {
|
||||||
if (index + 1 > num_half.current) {
|
setSelected(item.id)
|
||||||
const num = index + 1 - num_half.current
|
sideBarOnClick?.(item)
|
||||||
setTabId(list[num].id.toString())
|
computeSelectTab(index)
|
||||||
}
|
setClassId(-1)
|
||||||
else {
|
selectClass?.(-1)
|
||||||
setTabId(list[0].id.toString())
|
}
|
||||||
}
|
useEffect(() => {
|
||||||
}
|
setSelected(defaultValue)
|
||||||
|
}, [defaultValue])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Taro.nextTick(() => {
|
Taro.nextTick(() => {
|
||||||
const query = Taro.createSelectorQuery()
|
const query = Taro.createSelectorQuery()
|
||||||
query
|
query
|
||||||
.select('.side_bar_select')
|
.select('.side_bar_select')
|
||||||
.boundingClientRect((rect) => {
|
.boundingClientRect((rect) => {
|
||||||
console.log('rect::', rect)
|
console.log('rect::', rect)
|
||||||
const clientHeight = rect.height
|
const clientHeight = rect.height
|
||||||
const clientWidth = rect.width
|
const clientWidth = rect.width
|
||||||
const ratio = 750 / clientWidth
|
const ratio = 750 / clientWidth
|
||||||
const height = clientHeight * ratio
|
const height = clientHeight * ratio
|
||||||
num_half.current = Math.ceil(height / 2 / heightItem)
|
num_half.current = Math.ceil(height / 2 / heightItem)
|
||||||
console.log('num_half::', num_half)
|
console.log('num_half::', num_half)
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
.exec()
|
.exec()
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
return (
|
||||||
// 二级面料系列分类
|
<>
|
||||||
const [openClass, setOpenClass] = useState(false)
|
<View className={classnames(styles.sideBar_main, 'side_bar_select')}>
|
||||||
const [classList, setClassList] = useState([])
|
<ScrollView scrollWithAnimation style={{ height }} className={styles.sideBar_select} scrollY scrollIntoView={`tab_${tabId}`}>
|
||||||
const [classId, setClassId] = useState(-1)
|
{list?.map((item, index) => {
|
||||||
const { fetchData } = GetClassList()
|
return (
|
||||||
const getClassData = async(id) => {
|
<View className={styles.sideBar_select_title} id={`tab_${item.id}`} key={item.id} style={{ height: `${heightItem}rpx` }}>
|
||||||
const res = await fetchData({ id })
|
<View
|
||||||
if (res.success) {
|
className={classnames(styles.sideBar_select_title_item, { [styles.sideBar_select_title_select]: selected == item.id })}
|
||||||
if (res.data?.list.length > 0) {
|
onClick={() => clickEvent({ item, index })}
|
||||||
res.data.list = [{ id: -1, name: '全部' }, ...res.data.list]
|
>
|
||||||
}
|
<View className={styles.title_con}>{item.name}</View>
|
||||||
setClassList(() => res.data?.list)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
useEffect(() => {
|
|
||||||
if (selected) { getClassData(selected) }
|
|
||||||
}, [selected])
|
|
||||||
|
|
||||||
const getSelectClass = (id) => {
|
|
||||||
selectClass?.(id)
|
|
||||||
setClassId(() => id)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View className={classnames(styles.sideBar_main, 'side_bar_select')}>
|
|
||||||
<ScrollView scrollWithAnimation style={{ height }} className={styles.sideBar_select} scrollY scrollIntoView={`tab_${tabId}`}>
|
|
||||||
{list?.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.sideBar_select_title} id={`tab_${item.id}`} key={item.id} style={{ height: `${heightItem}rpx` }}>
|
|
||||||
<View
|
|
||||||
className={classnames(styles.sideBar_select_title_item, { [styles.sideBar_select_title_select]: selected == item.id })}
|
|
||||||
onClick={() => clickEvent({ item, index })}
|
|
||||||
>
|
|
||||||
<View className={styles.title_con}>{item.name}</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
|
||||||
})}
|
|
||||||
</ScrollView>
|
|
||||||
<View className={styles.sideBar_con} style={{ paddingTop: classList.length > 0 ? '90rpx' : '20rpx' }}>
|
|
||||||
{classList.length > 0 && (
|
|
||||||
<View className={styles.product_class} style={{ height: openClass ? '100%' : '' }}>
|
|
||||||
<ProductClass list={classList} open={openClass} onOpenClick={val => setOpenClass(val)} onSelect={getSelectClass} defaultSelectId={classId} />
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)
|
||||||
<InfiniteScroll
|
})}
|
||||||
statusMore={statusMore}
|
</ScrollView>
|
||||||
hasMore={hasMore}
|
<View className={styles.sideBar_con} style={{ paddingTop: classList.length > 0 ? '90rpx' : '20rpx' }}>
|
||||||
selfonScrollToLower={() => selfOnScrolltolower?.()}
|
{classList.length > 0 && (
|
||||||
refresherTriggered={refresherTriggered}
|
<View className={styles.product_class} style={{ height: openClass ? '100%' : '' }}>
|
||||||
refresherEnabled
|
<ProductClass list={classList} open={openClass} onOpenClick={val => setOpenClass(val)} onSelect={getSelectClass} defaultSelectId={classId} />
|
||||||
selfOnRefresherRefresh={() => selfOnRefresherRefresh?.()}
|
</View>
|
||||||
>
|
)}
|
||||||
{children}
|
<InfiniteScroll
|
||||||
</InfiniteScroll>
|
statusMore={statusMore}
|
||||||
</View>
|
hasMore={hasMore}
|
||||||
|
selfonScrollToLower={() => selfOnScrolltolower?.()}
|
||||||
|
refresherTriggered={refresherTriggered}
|
||||||
|
refresherEnabled
|
||||||
|
selfOnRefresherRefresh={() => selfOnRefresherRefresh?.()}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</InfiniteScroll>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</View>
|
||||||
)
|
</>
|
||||||
},
|
)
|
||||||
|
}
|
||||||
|
export default memo(
|
||||||
|
SideBar,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ interface params {
|
|||||||
sortValue?: { desc: string; asc: string } // 排序规则,后端制定
|
sortValue?: { desc: string; asc: string } // 排序规则,后端制定
|
||||||
}
|
}
|
||||||
type sortParam = 'none'|'top'|'bottom'
|
type sortParam = 'none'|'top'|'bottom'
|
||||||
export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref) => {
|
const SortBtn = ({ status = 'none', onChange, sortValue }: params, ref) => {
|
||||||
const [sortStatus, setSortStatus] = useState<sortParam>()
|
const [sortStatus, setSortStatus] = useState<sortParam>()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSortStatus(() => status)
|
setSortStatus(() => status)
|
||||||
@ -19,11 +19,11 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
|
|||||||
let value = ''
|
let value = ''
|
||||||
if (sortStatus == 'none') {
|
if (sortStatus == 'none') {
|
||||||
status = 'top'
|
status = 'top'
|
||||||
value = sortValue?.asc!
|
value = sortValue?.asc as string
|
||||||
}
|
}
|
||||||
if (sortStatus == 'top') {
|
if (sortStatus == 'top') {
|
||||||
status = 'bottom'
|
status = 'bottom'
|
||||||
value = sortValue?.desc!
|
value = sortValue?.desc as string
|
||||||
}
|
}
|
||||||
if (sortStatus == 'bottom') { status = 'none' }
|
if (sortStatus == 'bottom') { status = 'none' }
|
||||||
setSortStatus(() => status)
|
setSortStatus(() => status)
|
||||||
@ -42,4 +42,5 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(SortBtn)
|
||||||
|
|||||||
@ -17,8 +17,7 @@ interface Params {
|
|||||||
style?: Object
|
style?: Object
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const Tabs = ({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
|
||||||
export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
|
|
||||||
const [selected, setSelected] = useState(defaultValue)
|
const [selected, setSelected] = useState(defaultValue)
|
||||||
const [tabId, setTabId] = useState('')
|
const [tabId, setTabId] = useState('')
|
||||||
|
|
||||||
@ -57,4 +56,5 @@ export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: P
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Tabs)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ interface Param {
|
|||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
onlyRead?: false|true
|
onlyRead?: false|true
|
||||||
}
|
}
|
||||||
export default memo(({ onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false }: Param) => {
|
const TextareaEnhance = ({ onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false }: Param) => {
|
||||||
const [descData, setDescData] = useState({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
@ -38,11 +38,13 @@ export default memo(({ onChange, title = '', placeholder = '请输入', defaultV
|
|||||||
<View className={styles.other_desc}>
|
<View className={styles.other_desc}>
|
||||||
<View className={styles.title}>{title}</View>
|
<View className={styles.title}>{title}</View>
|
||||||
<View className={styles.textarea}>
|
<View className={styles.textarea}>
|
||||||
{(descData.show && !onlyRead) && <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e.detail.value)}></Textarea>
|
{(descData.show && !onlyRead)
|
||||||
|| <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
|
? <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e.detail.value)}></Textarea>
|
||||||
|
: <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
|
||||||
}
|
}
|
||||||
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(TextareaEnhance)
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
import { Button, ScrollView, Text, View } from '@tarojs/components'
|
import { View } from '@tarojs/components'
|
||||||
import { stopPullDownRefresh, usePullDownRefresh } from '@tarojs/taro'
|
|
||||||
import { useState } from 'react'
|
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
import AddressList from '@/components/AddressList'
|
import AddressList from '@/components/AddressList'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
export default () => {
|
const AddressManager = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
return (
|
return (
|
||||||
<View className="address-manager">
|
<View className="address-manager">
|
||||||
@ -14,3 +12,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default AddressManager
|
||||||
|
|||||||
@ -23,7 +23,7 @@ interface Param {
|
|||||||
onSelectChange?: (val: { color_id: number; length: number; status: true|false; sale_order_detail_id: number }) => void
|
onSelectChange?: (val: { color_id: number; length: number; status: true|false; sale_order_detail_id: number }) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const kindeList: FC<Param> = memo(({ order, onSelectChange }) => {
|
const KindeList: FC<Param> = ({ order, onSelectChange }) => {
|
||||||
// checkbox选中回调
|
// checkbox选中回调
|
||||||
const selectCallBack = (colorItem) => {
|
const selectCallBack = (colorItem) => {
|
||||||
onSelectChange?.({ color_id: colorItem.product_color_id, length: colorItem.length, sale_order_detail_id: colorItem.sale_order_detail_id, status: true })
|
onSelectChange?.({ color_id: colorItem.product_color_id, length: colorItem.length, sale_order_detail_id: colorItem.sale_order_detail_id, status: true })
|
||||||
@ -36,13 +36,13 @@ const kindeList: FC<Param> = memo(({ order, onSelectChange }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.apply_after_sales_list}>
|
<View className={styles.apply_after_sales_list}>
|
||||||
{order?.av_return_product?.map(item => <View className={styles.apply_after_sales_item} >
|
{order?.av_return_product?.map((item, index) => <View className={styles.apply_after_sales_item} key={index}>
|
||||||
<View className={styles.apply_after_sales_title}>
|
<View className={styles.apply_after_sales_title}>
|
||||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||||
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.color_list}>
|
<View className={styles.color_list}>
|
||||||
{item?.av_product_color?.map(colorItem => <View className={styles.color_item}>
|
{item?.av_product_color?.map((colorItem, key) => <View className={styles.color_item} key={key}>
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')} /></View>
|
<View className={styles.image}><Image src={formatImgUrl('')} /></View>
|
||||||
<View className={styles.name_and_number}><Text>{`${colorItem.product_color_code} ${colorItem.product_color_name}`}</Text><Text>x {colorItem.length / 100} m</Text></View>
|
<View className={styles.name_and_number}><Text>{`${colorItem.product_color_code} ${colorItem.product_color_name}`}</Text><Text>x {colorItem.length / 100} m</Text></View>
|
||||||
<MCheckbox status={item.select} onSelect={() => selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)} />
|
<MCheckbox status={item.select} onSelect={() => selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)} />
|
||||||
@ -51,6 +51,6 @@ const kindeList: FC<Param> = memo(({ order, onSelectChange }) => {
|
|||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default kindeList
|
export default memo(KindeList)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ interface Param {
|
|||||||
onNumChange?: (val: any) => void
|
onNumChange?: (val: any) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const kindeList: FC<Param> = memo(({ order, onNumChange }) => {
|
const KindeList: FC<Param> = ({ order, onNumChange }) => {
|
||||||
// 计步器返回值
|
// 计步器返回值
|
||||||
const getCounterChange = useCallback((colorItem) => {
|
const getCounterChange = useCallback((colorItem) => {
|
||||||
return (number) => {
|
return (number) => {
|
||||||
@ -33,13 +33,13 @@ const kindeList: FC<Param> = memo(({ order, onNumChange }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.apply_after_sales_list}>
|
<View className={styles.apply_after_sales_list}>
|
||||||
{order?.av_return_product?.map(item => <View className={styles.apply_after_sales_item}>
|
{order?.av_return_product?.map((item, index) => <View className={styles.apply_after_sales_item} key={index}>
|
||||||
<View className={styles.apply_after_sales_title}>
|
<View className={styles.apply_after_sales_title}>
|
||||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||||
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.color_list}>
|
<View className={styles.color_list}>
|
||||||
{item?.av_product_color?.map(colorItem => <View className={styles.color_item}>
|
{item?.av_product_color?.map((colorItem, key) => <View className={styles.color_item} key={key}>
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')} /></View>
|
<View className={styles.image}><Image src={formatImgUrl('')} /></View>
|
||||||
<View className={styles.name_and_number}><Text>{`${colorItem.product_color_code} ${colorItem.product_color_name}`}</Text><Text>x {colorItem.roll}</Text></View>
|
<View className={styles.name_and_number}><Text>{`${colorItem.product_color_code} ${colorItem.product_color_name}`}</Text><Text>x {colorItem.roll}</Text></View>
|
||||||
<View className={styles.btn_count}>
|
<View className={styles.btn_count}>
|
||||||
@ -50,6 +50,6 @@ const kindeList: FC<Param> = memo(({ order, onNumChange }) => {
|
|||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default kindeList
|
export default memo(KindeList)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import styles from './index.module.scss'
|
|||||||
interface Param {
|
interface Param {
|
||||||
onChange: (val: string) => void
|
onChange: (val: string) => void
|
||||||
}
|
}
|
||||||
export default memo(({ onChange }: Param) => {
|
const OtherReason = ({ onChange }: Param) => {
|
||||||
const [descData, setDescData] = useState({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
@ -31,11 +31,13 @@ export default memo(({ onChange }: Param) => {
|
|||||||
<View className={styles.other_desc}>
|
<View className={styles.other_desc}>
|
||||||
<View className={styles.title}>其他说明</View>
|
<View className={styles.title}>其他说明</View>
|
||||||
<View className={styles.textarea}>
|
<View className={styles.textarea}>
|
||||||
{descData.show && <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e)}></Textarea>
|
{descData.show
|
||||||
|| <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || '一般情况下选填,当退货说明=“其它问题”时,必填'}</View>
|
? <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e)}></Textarea>
|
||||||
|
: <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || '一般情况下选填,当退货说明=“其它问题”时,必填'}</View>
|
||||||
}
|
}
|
||||||
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OtherReason)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ interface ReasonInfoParam {
|
|||||||
defaultValue?: number // 默认选中
|
defaultValue?: number // 默认选中
|
||||||
dataLength?: number // 可显示的数据列数
|
dataLength?: number // 可显示的数据列数
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, title = '', list = [], onSelect, onHeaderSelect, defaultValue, dataLength = 1 }: ReasonInfoParam) => {
|
const ReasonPopup = ({ show = false, onClose, title = '', list = [], onSelect, onHeaderSelect, defaultValue, dataLength = 1 }: ReasonInfoParam) => {
|
||||||
const [initList, setInitList] = useState<typeof list>([])
|
const [initList, setInitList] = useState<typeof list>([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -59,4 +59,5 @@ export default memo(({ show = false, onClose, title = '', list = [], onSelect, o
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ReasonPopup)
|
||||||
|
|||||||
@ -19,11 +19,8 @@ enum returnStatus {
|
|||||||
goods_status = 2, // 状况
|
goods_status = 2, // 状况
|
||||||
return_explain = 3, // 说明
|
return_explain = 3, // 说明
|
||||||
}
|
}
|
||||||
export default () => {
|
const ApplyAfterSales = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
useDidShow(() => {
|
|
||||||
getSaleOrderPreView()
|
|
||||||
})
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const orderId = useRef<number>(Number(router.params.id))
|
const orderId = useRef<number>(Number(router.params.id))
|
||||||
@ -50,13 +47,9 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听获取到的数据
|
useDidShow(() => {
|
||||||
useEffect(() => {
|
getSaleOrderPreView()
|
||||||
if (orderDetail) {
|
})
|
||||||
formatData()
|
|
||||||
}
|
|
||||||
}, [orderDetail])
|
|
||||||
|
|
||||||
// 格式化数据格式
|
// 格式化数据格式
|
||||||
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() // 格式化后的数据
|
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() // 格式化后的数据
|
||||||
const formatData = () => {
|
const formatData = () => {
|
||||||
@ -88,7 +81,12 @@ export default () => {
|
|||||||
}
|
}
|
||||||
setSubmitData(e => ({ ...e, roll_list: Object.values(roll_list.current) }))
|
setSubmitData(e => ({ ...e, roll_list: Object.values(roll_list.current) }))
|
||||||
}, [])
|
}, [])
|
||||||
|
// 监听获取到的数据
|
||||||
|
useEffect(() => {
|
||||||
|
if (orderDetail) {
|
||||||
|
formatData()
|
||||||
|
}
|
||||||
|
}, [orderDetail])
|
||||||
// 散剪和剪板
|
// 散剪和剪板
|
||||||
const getSelectChange = useCallback((val) => {
|
const getSelectChange = useCallback((val) => {
|
||||||
if (val.status) {
|
if (val.status) {
|
||||||
@ -144,9 +142,6 @@ export default () => {
|
|||||||
const onShowReason = () => {
|
const onShowReason = () => {
|
||||||
setShowReason(true)
|
setShowReason(true)
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
|
||||||
getReturnReason()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 请求获取到的数据
|
// 请求获取到的数据
|
||||||
const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
|
const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
|
||||||
@ -157,6 +152,9 @@ export default () => {
|
|||||||
const res = await fetchDataReturnReason()
|
const res = await fetchDataReturnReason()
|
||||||
setReturnGoodsInfo(e => res.data?.list)
|
setReturnGoodsInfo(e => res.data?.list)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getReturnReason()
|
||||||
|
}, [])
|
||||||
// 售后退货说明
|
// 售后退货说明
|
||||||
const { fetchData: fetchDataReturnExplain } = ReturnExplainApi()
|
const { fetchData: fetchDataReturnExplain } = ReturnExplainApi()
|
||||||
const getReturnExplain = async(id) => {
|
const getReturnExplain = async(id) => {
|
||||||
@ -273,3 +271,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ApplyAfterSales
|
||||||
|
|||||||
@ -11,7 +11,7 @@ interface params {
|
|||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
saleMan?: string
|
saleMan?: string
|
||||||
}
|
}
|
||||||
export default ({ show = false, saleMan = '', onClose }: params) => {
|
const SuccessBind = ({ show = false, saleMan = '', onClose }: params) => {
|
||||||
const onClick = async() => {
|
const onClick = async() => {
|
||||||
onClose?.()
|
onClose?.()
|
||||||
goLink('/pages/index/index', {}, 'switchTab')
|
goLink('/pages/index/index', {}, 'switchTab')
|
||||||
@ -37,3 +37,5 @@ export default ({ show = false, saleMan = '', onClose }: params) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default SuccessBind
|
||||||
|
|||||||
@ -11,13 +11,9 @@ import CloseBtn from '@/components/closeBtn'
|
|||||||
import { BindInvitationInfoApi, GetInvitationInfoApi } from '@/api/user'
|
import { BindInvitationInfoApi, GetInvitationInfoApi } from '@/api/user'
|
||||||
import { debounce, getFilterData, throttle } from '@/common/util'
|
import { debounce, getFilterData, throttle } from '@/common/util'
|
||||||
|
|
||||||
export default () => {
|
const BindSalesman = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
onClipboardData()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const [submitData, setSubmitData] = useState({
|
const [submitData, setSubmitData] = useState({
|
||||||
invitation_code: '',
|
invitation_code: '',
|
||||||
})
|
})
|
||||||
@ -71,7 +67,9 @@ export default () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
onClipboardData()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<View className={styles.bindSalesmanPage_main}>
|
<View className={styles.bindSalesmanPage_main}>
|
||||||
<View className={styles.header_image}>
|
<View className={styles.header_image}>
|
||||||
@ -113,3 +111,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default BindSalesman
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
import { Text, View } from '@tarojs/components'
|
import { Text, View } from '@tarojs/components'
|
||||||
|
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import './SelectEnterpriseType.scss'
|
import './SelectEnterpriseType.scss'
|
||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'
|
|
||||||
import { certificationTypeListApi } from '@/api/certification'
|
import { certificationTypeListApi } from '@/api/certification'
|
||||||
|
|
||||||
interface Params{
|
interface Params{
|
||||||
confirm?: (selected: any) => void // 确定
|
confirm?: (selected: any) => void // 确定
|
||||||
}
|
}
|
||||||
|
const SelectEnterpriseType = (props: Params, ref) => {
|
||||||
export default forwardRef((props: Params, ref) => {
|
|
||||||
const [modalShow, setModalShow] = useState(false)
|
const [modalShow, setModalShow] = useState(false)
|
||||||
// 获取认证信息
|
// 获取认证信息
|
||||||
const { fetchData, state } = certificationTypeListApi()
|
const { fetchData, state } = certificationTypeListApi()
|
||||||
@ -53,4 +52,5 @@ export default forwardRef((props: Params, ref) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(SelectEnterpriseType)
|
||||||
|
|||||||
@ -13,22 +13,9 @@ import { IMG_CND_Prefix } from '@/common/constant'
|
|||||||
import { useSelector } from '@/reducers/hooks'
|
import { useSelector } from '@/reducers/hooks'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const Certification = () => {
|
||||||
const { getAdminUserInfo } = useLogin()
|
const { getAdminUserInfo } = useLogin()
|
||||||
const { adminUserInfo } = useSelector(state => state.userInfo)
|
const { adminUserInfo } = useSelector(state => state.userInfo)
|
||||||
useEffect(() => {
|
|
||||||
initalFormData()
|
|
||||||
}, [])
|
|
||||||
// 获取认证信息
|
|
||||||
const { fetchData: getFromData } = certificationDetailApi()
|
|
||||||
const initalFormData = async() => {
|
|
||||||
const detail = await getFromData()
|
|
||||||
setFormData({
|
|
||||||
...detail.data ?? {},
|
|
||||||
legal_person_identity_url: detail?.data?.legal_person_identity_url ?? [],
|
|
||||||
// business_license_url: "https://test.cdn.zzfzyc.com/mall/827082e888860dd9da10f0fbb0ac3cf023081456.png"
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
// 保存
|
// 保存
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
authentication_type: 0,
|
authentication_type: 0,
|
||||||
@ -40,6 +27,20 @@ export default () => {
|
|||||||
legal_person_identity_url: [],
|
legal_person_identity_url: [],
|
||||||
name: '',
|
name: '',
|
||||||
})
|
})
|
||||||
|
// 获取认证信息
|
||||||
|
const { fetchData: getFromData } = certificationDetailApi()
|
||||||
|
const initalFormData = async() => {
|
||||||
|
const detail = await getFromData()
|
||||||
|
setFormData({
|
||||||
|
...detail.data ?? {},
|
||||||
|
legal_person_identity_url: detail?.data?.legal_person_identity_url ?? [],
|
||||||
|
// business_license_url: "https://test.cdn.zzfzyc.com/mall/827082e888860dd9da10f0fbb0ac3cf023081456.png"
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
initalFormData()
|
||||||
|
}, [])
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
// authentication_type: [{
|
// authentication_type: [{
|
||||||
// message: "请选择认证类型"
|
// message: "请选择认证类型"
|
||||||
@ -201,3 +202,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Certification
|
||||||
|
|||||||
@ -11,12 +11,15 @@ import { DelFavoriteProductApi, DetailFavoriteProductApi, MoveFavoriteProductApi
|
|||||||
import MCheckbox from '@/components/checkbox'
|
import MCheckbox from '@/components/checkbox'
|
||||||
import AddCollection from '@/components/addCollection'
|
import AddCollection from '@/components/addCollection'
|
||||||
|
|
||||||
export default () => {
|
const CollectionClass = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
// 获取收藏夹面料
|
// 获取收藏夹面料
|
||||||
const { fetchData: fetchDataDetailFavoriteProduct } = DetailFavoriteProductApi()
|
const { fetchData: fetchDataDetailFavoriteProduct } = DetailFavoriteProductApi()
|
||||||
const [colorInfo, setColorInfo] = useState<any>({})
|
const [colorInfo, setColorInfo] = useState<any>({})
|
||||||
|
|
||||||
|
// 获取搜索数据
|
||||||
|
const [searchData, setSearchData] = useState({ id: 0, code_or_name: '' })
|
||||||
const getFavoriteInfo = async() => {
|
const getFavoriteInfo = async() => {
|
||||||
const res = await fetchDataDetailFavoriteProduct(searchData)
|
const res = await fetchDataDetailFavoriteProduct(searchData)
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
@ -27,8 +30,6 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取搜索数据
|
|
||||||
const [searchData, setSearchData] = useState({ id: 0, code_or_name: '' })
|
|
||||||
const onSearch = useCallback((e) => {
|
const onSearch = useCallback((e) => {
|
||||||
setSearchData(val => ({ ...val, code_or_name: e }))
|
setSearchData(val => ({ ...val, code_or_name: e }))
|
||||||
}, [])
|
}, [])
|
||||||
@ -53,15 +54,6 @@ export default () => {
|
|||||||
|
|
||||||
// 全选反选
|
// 全选反选
|
||||||
const [allSelectStatus, setAllSelectStatus] = useState(false)
|
const [allSelectStatus, setAllSelectStatus] = useState(false)
|
||||||
const selectCallBack = useCallback(() => {
|
|
||||||
setAllSelectStatus(() => true)
|
|
||||||
setSelectStatus(1)
|
|
||||||
}, [])
|
|
||||||
const colseCallBack = useCallback(() => {
|
|
||||||
setAllSelectStatus(() => false)
|
|
||||||
setSelectStatus(3)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const [selectStatus, setSelectStatus] = useState<1 | 2 | 3>(3)
|
const [selectStatus, setSelectStatus] = useState<1 | 2 | 3>(3)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (colorInfo.product_color_list?.length) {
|
if (colorInfo.product_color_list?.length) {
|
||||||
@ -84,7 +76,14 @@ export default () => {
|
|||||||
const closeCollection = useCallback(() => {
|
const closeCollection = useCallback(() => {
|
||||||
setCollectionShow(false)
|
setCollectionShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
const selectCallBack = useCallback(() => {
|
||||||
|
setAllSelectStatus(() => true)
|
||||||
|
setSelectStatus(1)
|
||||||
|
}, [])
|
||||||
|
const colseCallBack = useCallback(() => {
|
||||||
|
setAllSelectStatus(() => false)
|
||||||
|
setSelectStatus(3)
|
||||||
|
}, [])
|
||||||
// 移动面料
|
// 移动面料
|
||||||
const { fetchData: fetchDataMoveFavoriteProduct } = MoveFavoriteProductApi()
|
const { fetchData: fetchDataMoveFavoriteProduct } = MoveFavoriteProductApi()
|
||||||
const onAdd = async(val) => {
|
const onAdd = async(val) => {
|
||||||
@ -145,3 +144,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default CollectionClass
|
||||||
|
|||||||
@ -17,7 +17,7 @@ interface ReasonInfoParam {
|
|||||||
name: string
|
name: string
|
||||||
} // 默认数据
|
} // 默认数据
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, onSuccess, defaultValue }: ReasonInfoParam) => {
|
const CreatePopup = ({ show = false, onClose, onSuccess, defaultValue }: ReasonInfoParam) => {
|
||||||
const submitData = useRef({
|
const submitData = useRef({
|
||||||
name: '',
|
name: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
@ -36,7 +36,7 @@ export default memo(({ show = false, onClose, onSuccess, defaultValue }: ReasonI
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
submitData.current = { name: defaultValue?.name!, remark: defaultValue?.remark! }
|
submitData.current = { name: defaultValue?.name as string, remark: defaultValue?.remark as string }
|
||||||
}, [defaultValue])
|
}, [defaultValue])
|
||||||
return (
|
return (
|
||||||
<Popup show={show} title="新建收藏夹" onClose={onClose}>
|
<Popup show={show} title="新建收藏夹" onClose={onClose}>
|
||||||
@ -71,4 +71,5 @@ export default memo(({ show = false, onClose, onSuccess, defaultValue }: ReasonI
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(CreatePopup)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ interface Params {
|
|||||||
selectStatus?: 1|2|3 // 1全选,2不做处理,3全清空
|
selectStatus?: 1|2|3 // 1全选,2不做处理,3全清空
|
||||||
openCheckBox?: true|false // 是否开启选择
|
openCheckBox?: true|false // 是否开启选择
|
||||||
}
|
}
|
||||||
export default ({ productList, onSelectIds, selectStatus = 2, openCheckBox = false }: Params) => {
|
const Product = ({ productList, onSelectIds, selectStatus = 2, openCheckBox = false }: Params) => {
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setList(() => productList || [])
|
setList(() => productList || [])
|
||||||
@ -21,22 +21,12 @@ export default ({ productList, onSelectIds, selectStatus = 2, openCheckBox = fal
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (list.length && selectStatus != 2) {
|
if (list.length && selectStatus != 2) {
|
||||||
list.map((item) => {
|
list.forEach((item) => {
|
||||||
item.check = (selectStatus == 1)
|
item.check = (selectStatus == 1)
|
||||||
})
|
})
|
||||||
setList(() => [...list])
|
setList(() => [...list])
|
||||||
}
|
}
|
||||||
}, [selectStatus])
|
}, [selectStatus])
|
||||||
|
|
||||||
const onChangeSelect = (item) => {
|
|
||||||
if (item.check) {
|
|
||||||
onClose(item)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
onSelect(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 选中和取消选中
|
// 选中和取消选中
|
||||||
const onSelect = (item) => {
|
const onSelect = (item) => {
|
||||||
item.check = true
|
item.check = true
|
||||||
@ -46,11 +36,19 @@ export default ({ productList, onSelectIds, selectStatus = 2, openCheckBox = fal
|
|||||||
item.check = false
|
item.check = false
|
||||||
setList(() => ([...list]))
|
setList(() => ([...list]))
|
||||||
}
|
}
|
||||||
|
const onChangeSelect = (item) => {
|
||||||
|
if (item.check) {
|
||||||
|
onClose(item)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onSelect(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 监听数据变化
|
// 监听数据变化
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const ids: number[] = []
|
const ids: number[] = []
|
||||||
list.map((item) => {
|
list.forEach((item) => {
|
||||||
if (item.check) { ids.push(item.product_id) }
|
if (item.check) { ids.push(item.product_id) }
|
||||||
})
|
})
|
||||||
onSelectIds?.(ids)
|
onSelectIds?.(ids)
|
||||||
@ -58,8 +56,8 @@ export default ({ productList, onSelectIds, selectStatus = 2, openCheckBox = fal
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_list}>
|
<View className={styles.products_list}>
|
||||||
{list?.map((item) => {
|
{list?.map((item, index) => {
|
||||||
return <View className={styles.products_item} onClick={() => openCheckBox ? onChangeSelect(item) : goLink(`/pages/details/index?id=${item.product_id}`)}>
|
return <View key={index} className={styles.products_item} onClick={() => openCheckBox ? onChangeSelect(item) : goLink(`/pages/details/index?id=${item.product_id}`)}>
|
||||||
{openCheckBox && <View className={styles.checkbox} onClick={e => e.stopPropagation()}>
|
{openCheckBox && <View className={styles.checkbox} onClick={e => e.stopPropagation()}>
|
||||||
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)} />
|
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)} />
|
||||||
</View>}
|
</View>}
|
||||||
@ -81,3 +79,5 @@ export default ({ productList, onSelectIds, selectStatus = 2, openCheckBox = fal
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Product
|
||||||
|
|||||||
@ -16,7 +16,7 @@ interface ReasonInfoParam {
|
|||||||
onDelete?: () => void // 删除
|
onDelete?: () => void // 删除
|
||||||
|
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, onUpdate, onBatchManagement, onDelete }: ReasonInfoParam) => {
|
const UpdatePopup = ({ show = false, onClose, onUpdate, onBatchManagement, onDelete }: ReasonInfoParam) => {
|
||||||
const onClickEven = (val) => {
|
const onClickEven = (val) => {
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
onUpdate?.()
|
onUpdate?.()
|
||||||
@ -46,4 +46,5 @@ export default memo(({ show = false, onClose, onUpdate, onBatchManagement, onDel
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(UpdatePopup)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import Taro, { useDidHide, useDidShow } from '@tarojs/taro'
|
import Taro, { useDidHide, useDidShow } from '@tarojs/taro'
|
||||||
|
import { Text, View } from '@tarojs/components'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import Product from './components/product'
|
import Product from './components/product'
|
||||||
@ -10,25 +11,15 @@ import { getFilterData } from '@/common/util'
|
|||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from '@/api/favorite'
|
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from '@/api/favorite'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
import { View, Text } from '@tarojs/components'
|
|
||||||
|
|
||||||
export default () => {
|
const Collection = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const changeOpenCon = (item) => {
|
|
||||||
item.openStatus = !item.openStatus
|
|
||||||
setList(e => [...e])
|
|
||||||
}
|
|
||||||
useDidShow(() => {
|
|
||||||
getFavoriteList()
|
|
||||||
})
|
|
||||||
// 获取搜索数据
|
// 获取搜索数据
|
||||||
const [searchData, setSearchData] = useState('')
|
const [searchData, setSearchData] = useState('')
|
||||||
const onSearch = useCallback((e) => {
|
const onSearch = useCallback((e) => {
|
||||||
setSearchData(() => e)
|
setSearchData(() => e)
|
||||||
}, [])
|
}, [])
|
||||||
useEffect(() => {
|
|
||||||
getFavoriteList()
|
|
||||||
}, [searchData])
|
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
const [list, setList] = useState([])
|
const [list, setList] = useState([])
|
||||||
@ -37,18 +28,32 @@ export default () => {
|
|||||||
const res = await fetchDataList(getFilterData({ name: searchData }))
|
const res = await fetchDataList(getFilterData({ name: searchData }))
|
||||||
setList(() => res.data.list)
|
setList(() => res.data.list)
|
||||||
}
|
}
|
||||||
|
const changeOpenCon = (item) => {
|
||||||
|
item.openStatus = !item.openStatus
|
||||||
|
setList(e => [...e])
|
||||||
|
}
|
||||||
|
useDidShow(() => {
|
||||||
|
getFavoriteList()
|
||||||
|
})
|
||||||
// 创建收藏夹
|
// 创建收藏夹
|
||||||
const [collectioinShow, setCollectioinShow] = useState(false)
|
const [collectioinShow, setCollectioinShow] = useState(false)
|
||||||
const closeCollection = useCallback(() => {
|
const closeCollection = useCallback(() => {
|
||||||
setCollectioinShow(false)
|
setCollectioinShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// 更多编辑
|
||||||
|
const [initData, setInitData] = useState({
|
||||||
|
remark: '',
|
||||||
|
name: '',
|
||||||
|
id: 0,
|
||||||
|
})
|
||||||
const creatShow = () => {
|
const creatShow = () => {
|
||||||
setCollectioinShow(true)
|
setCollectioinShow(true)
|
||||||
setInitData(() => ({ remark: '', name: '', id: 0 }))
|
setInitData(() => ({ remark: '', name: '', id: 0 }))
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getFavoriteList()
|
||||||
|
}, [searchData])
|
||||||
// 新增
|
// 新增
|
||||||
const { fetchData } = CreateFavoriteApi()
|
const { fetchData } = CreateFavoriteApi()
|
||||||
const onCreate = async(submitData) => {
|
const onCreate = async(submitData) => {
|
||||||
@ -63,12 +68,6 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更多编辑
|
|
||||||
const [initData, setInitData] = useState({
|
|
||||||
remark: '',
|
|
||||||
name: '',
|
|
||||||
id: 0,
|
|
||||||
})
|
|
||||||
const selectInfo = useRef<any>(null)
|
const selectInfo = useRef<any>(null)
|
||||||
const [updateShow, setUpdateShow] = useState(false)
|
const [updateShow, setUpdateShow] = useState(false)
|
||||||
const closeUpdate = useCallback(() => {
|
const closeUpdate = useCallback(() => {
|
||||||
@ -149,7 +148,7 @@ export default () => {
|
|||||||
<View className={styles.miconfont_con} onClick={creatShow}><Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text></View>
|
<View className={styles.miconfont_con} onClick={creatShow}><Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text></View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.class_list}>
|
<View className={styles.class_list}>
|
||||||
{list?.map((item: any) => <View className={styles.class_item}>
|
{list?.map((item: any, key) => <View className={styles.class_item} key={key}>
|
||||||
<View key={item.id} className={styles.class_title} onClick={() => changeOpenCon(item)}>
|
<View key={item.id} className={styles.class_title} onClick={() => changeOpenCon(item)}>
|
||||||
<Text className={classnames(styles.miconfont_left, 'iconfont icon-a-moreback', item.openStatus ? styles.miconfont_open : styles.miconfont_close)}></Text>
|
<Text className={classnames(styles.miconfont_left, 'iconfont icon-a-moreback', item.openStatus ? styles.miconfont_open : styles.miconfont_close)}></Text>
|
||||||
<View className={styles.title}>{item.name}
|
<View className={styles.title}>{item.name}
|
||||||
@ -167,3 +166,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Collection
|
||||||
|
|||||||
@ -9,26 +9,12 @@ import { companyDetailApi, companyUpdateApi } from '@/api/company'
|
|||||||
import './index.scss'
|
import './index.scss'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const Company = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const [showSiteModal, setShowSiteModal] = useState(false)
|
const [showSiteModal, setShowSiteModal] = useState(false)
|
||||||
const handleSelectSite = () => {
|
const handleSelectSite = () => {
|
||||||
setShowSiteModal(true)
|
setShowSiteModal(true)
|
||||||
}
|
}
|
||||||
// 获取公司信息
|
|
||||||
const { fetchData: getFromData } = companyDetailApi()
|
|
||||||
const getData = async() => {
|
|
||||||
const result = await getFromData()
|
|
||||||
console.log(result.data, '===')
|
|
||||||
|
|
||||||
setFormData({
|
|
||||||
...result.data,
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
useEffect(() => {
|
|
||||||
getData()
|
|
||||||
}, [])
|
|
||||||
// 保存
|
// 保存
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
address_detail: '',
|
address_detail: '',
|
||||||
@ -46,6 +32,21 @@ export default () => {
|
|||||||
site: '',
|
site: '',
|
||||||
siteArray: [],
|
siteArray: [],
|
||||||
})
|
})
|
||||||
|
// 获取公司信息
|
||||||
|
const { fetchData: getFromData } = companyDetailApi()
|
||||||
|
const getData = async() => {
|
||||||
|
const result = await getFromData()
|
||||||
|
console.log(result.data, '===')
|
||||||
|
|
||||||
|
setFormData({
|
||||||
|
...result.data,
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getData()
|
||||||
|
}, [])
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
company_name: [{
|
company_name: [{
|
||||||
message: '请输入公司名称',
|
message: '请输入公司名称',
|
||||||
@ -145,7 +146,9 @@ export default () => {
|
|||||||
|
|
||||||
<Button style={{ background: hozon ? '#007aff' : '' }} hoverClass="none" className="save-button" onClick={handleSave}>保存</Button>
|
<Button style={{ background: hozon ? '#007aff' : '' }} hoverClass="none" className="save-button" onClick={handleSave}>保存</Button>
|
||||||
{/* <Address addressOnClose={()=>setShowSiteModal(false)} show={showSiteModal}/> */}
|
{/* <Address addressOnClose={()=>setShowSiteModal(false)} show={showSiteModal}/> */}
|
||||||
<Address addressOnSelect={handleSetSite} defaultValue={[{ name: '广东省', id: 193, level: 2 }, { name: '佛山市', id: 202, level: 3 }, { name: '高明区', id: 204, level: 4 }]} addressOnClose={() => setShowSiteModal(false)} show={showSiteModal} />
|
<Address addressOnSelect={handleSetSite} defaultValue={[{ name: '广东省', id: 193, level: 2 }, { name: '佛山市', id: 202, level: 3 }, { name: '高明区', id: 204, level: 4 }]} addressOnClose={() => setShowSiteModal(false)} show={showSiteModal} />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Company
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { Button, Canvas, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
import { Button, Canvas, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import Taro, { useReady } from '@tarojs/taro'
|
import Taro, { useReady } from '@tarojs/taro'
|
||||||
import { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import AddressList from '@/components/AddressList'
|
import AddressList from '@/components/AddressList'
|
||||||
import { creditInfoApi } from '@/api/creditLine'
|
import { creditInfoApi } from '@/api/creditLine'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
@ -10,12 +10,109 @@ import { formatDateTime, formatPriceDiv } from '@/common/fotmat'
|
|||||||
import Message from '@/components/Message'
|
import Message from '@/components/Message'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
interface ProgressType {
|
||||||
|
progress: number
|
||||||
|
style: Record<string, any>
|
||||||
|
}
|
||||||
|
const Progress = (props: ProgressType) => {
|
||||||
|
const getCanvas = () => {
|
||||||
|
// const percentage = props.progress??0;
|
||||||
|
const percentage = props.progress || 0
|
||||||
|
const query = Taro.createSelectorQuery()
|
||||||
|
query.select('#myCanvas').fields({ node: true, size: true }).exec((res) => {
|
||||||
|
const canvas = res[0]?.node
|
||||||
|
if (canvas) {
|
||||||
|
const ctx = canvas.getContext('2d')
|
||||||
|
const { windowHeight, windowWidth } = Taro.getSystemInfoSync()
|
||||||
|
const dpr = 750 / windowWidth
|
||||||
|
canvas.width = res[0].width * dpr
|
||||||
|
canvas.height = res[0].height * dpr
|
||||||
|
const r = canvas.width / 2
|
||||||
|
ctx.translate(r, r)
|
||||||
|
|
||||||
|
// 白色大圆
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.fillStyle = 'white'
|
||||||
|
ctx.shadowBlur = 20
|
||||||
|
ctx.shadowColor = '#cde5ff'
|
||||||
|
ctx.arc(0, 0, 100, 0, 2 * Math.PI, false)
|
||||||
|
ctx.fill()
|
||||||
|
|
||||||
|
// 刻度
|
||||||
|
const my_minute = Math.PI * 2 / 60
|
||||||
|
const my_second = Math.PI * 2 / 60
|
||||||
|
ctx.strokeStyle = '#F59F5D'
|
||||||
|
ctx.lineWidth = 2
|
||||||
|
ctx.beginPath()
|
||||||
|
for (let i = 0; i < 15; i++) {
|
||||||
|
ctx.save()
|
||||||
|
ctx.rotate(i * 4 * my_minute)
|
||||||
|
ctx.moveTo(r - 45, 0)
|
||||||
|
ctx.lineTo(r - 40, 0)
|
||||||
|
ctx.stroke()
|
||||||
|
ctx.restore()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 白色小圆
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.fillStyle = 'white'
|
||||||
|
ctx.shadowBlur = 20
|
||||||
|
ctx.shadowColor = 'rgba(204,204,204,0.50)'
|
||||||
|
ctx.arc(0, 0, 74, 0, 2 * Math.PI, false)
|
||||||
|
ctx.fill()
|
||||||
|
|
||||||
|
// 文字
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.restore()
|
||||||
|
|
||||||
|
ctx.fillStyle = props.style?.cir?.color// "#007aff";
|
||||||
|
ctx.font = '42px Cambria, Cambria-Bold'
|
||||||
|
ctx.textAlign = 'center'
|
||||||
|
ctx.textBaseline = 'middle'
|
||||||
|
ctx.fillText(`${percentage}%`, 0, 0)
|
||||||
|
|
||||||
|
// 蓝色的圆
|
||||||
|
if (percentage > 0) {
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.lineWidth = 25
|
||||||
|
ctx.lineCap = 'round'
|
||||||
|
const gad = ctx.createLinearGradient(100, 0, 0, 100)
|
||||||
|
gad.addColorStop(0, props.style?.cir?.background?.start[0])
|
||||||
|
gad.addColorStop(1, props.style?.cir?.background?.start[1])
|
||||||
|
ctx.strokeStyle = gad
|
||||||
|
ctx.arc(0, 0, 104, -Math.PI * 0.5, 2 * Math.PI / 100 * ((percentage < 50 ? percentage : 50) - 25), false)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (percentage > 50) {
|
||||||
|
ctx.beginPath()
|
||||||
|
const gad2 = ctx.createLinearGradient(0, -100, 0, 0)
|
||||||
|
gad2.addColorStop(0, props.style?.cir?.background?.end[0])
|
||||||
|
gad2.addColorStop(1, props.style?.cir?.background?.start[1])
|
||||||
|
ctx.strokeStyle = gad2
|
||||||
|
ctx.arc(0, 0, 104, Math.PI * 0.4, 2 * Math.PI / 100 * (percentage - 25), false)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getCanvas()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
useReady(() => {
|
||||||
|
getCanvas()
|
||||||
|
})
|
||||||
|
useEffect(() => {
|
||||||
|
if (props.progress != 0) {
|
||||||
|
getCanvas()
|
||||||
|
}
|
||||||
|
}, [props.progress])
|
||||||
|
return <Canvas type="2d" id="myCanvas" />
|
||||||
|
}
|
||||||
|
const CreditLine = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const userInfo = useSelector(state => state.userInfo)
|
const userInfo = useSelector(state => state.userInfo)
|
||||||
useEffect(() => {
|
|
||||||
getData()
|
|
||||||
}, [])
|
|
||||||
const { fetchData, state } = creditInfoApi()
|
const { fetchData, state } = creditInfoApi()
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
credit_quota_used_line: [0, '00'],
|
credit_quota_used_line: [0, '00'],
|
||||||
@ -39,6 +136,11 @@ export default () => {
|
|||||||
})
|
})
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
|
const convertPrice = (data) => {
|
||||||
|
const t = data.toString().split('.')
|
||||||
|
t[1] = t[1] ? t[1].padEnd(2, 0) : '00'
|
||||||
|
return t
|
||||||
|
}
|
||||||
const result = await fetchData()
|
const result = await fetchData()
|
||||||
const credit_quota_used_line = convertPrice(formatPriceDiv(result.data.credit_quota_used_line))
|
const credit_quota_used_line = convertPrice(formatPriceDiv(result.data.credit_quota_used_line))
|
||||||
const credit_quota_line = convertPrice(formatPriceDiv(result.data.credit_quota_line))
|
const credit_quota_line = convertPrice(formatPriceDiv(result.data.credit_quota_line))
|
||||||
@ -113,12 +215,10 @@ export default () => {
|
|||||||
credit_quota_end_time: formatDateTime(result.data?.credit_quota_end_time, 'YYYY-MM-DD'),
|
credit_quota_end_time: formatDateTime(result.data?.credit_quota_end_time, 'YYYY-MM-DD'),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const convertPrice = (data) => {
|
|
||||||
const t = data.toString().split('.')
|
|
||||||
t[1] = t[1] ? t[1].padEnd(2, 0) : '00'
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<View className="credit-line">
|
<View className="credit-line">
|
||||||
<Message text="暂不支持线上申请授权,请联系平台客服。" />
|
<Message text="暂不支持线上申请授权,请联系平台客服。" />
|
||||||
@ -154,98 +254,4 @@ export default () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Progress = (props) => {
|
export default CreditLine
|
||||||
useEffect(() => {
|
|
||||||
if (props.progress != 0) {
|
|
||||||
getCanvas()
|
|
||||||
}
|
|
||||||
}, [props.progress])
|
|
||||||
const getCanvas = () => {
|
|
||||||
// const percentage = props.progress??0;
|
|
||||||
const percentage = props.progress || 0
|
|
||||||
const query = Taro.createSelectorQuery()
|
|
||||||
query.select('#myCanvas').fields({ node: true, size: true }).exec((res) => {
|
|
||||||
const canvas = res[0]?.node
|
|
||||||
if (canvas) {
|
|
||||||
const ctx = canvas.getContext('2d')
|
|
||||||
const { windowHeight, windowWidth } = Taro.getSystemInfoSync()
|
|
||||||
const dpr = 750 / windowWidth
|
|
||||||
canvas.width = res[0].width * dpr
|
|
||||||
canvas.height = res[0].height * dpr
|
|
||||||
const r = canvas.width / 2
|
|
||||||
ctx.translate(r, r)
|
|
||||||
|
|
||||||
// 白色大圆
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.fillStyle = 'white'
|
|
||||||
ctx.shadowBlur = 20
|
|
||||||
ctx.shadowColor = '#cde5ff'
|
|
||||||
ctx.arc(0, 0, 100, 0, 2 * Math.PI, false)
|
|
||||||
ctx.fill()
|
|
||||||
|
|
||||||
// 刻度
|
|
||||||
const my_minute = Math.PI * 2 / 60
|
|
||||||
const my_second = Math.PI * 2 / 60
|
|
||||||
ctx.strokeStyle = '#F59F5D'
|
|
||||||
ctx.lineWidth = 2
|
|
||||||
ctx.beginPath()
|
|
||||||
for (let i = 0; i < 15; i++) {
|
|
||||||
ctx.save()
|
|
||||||
ctx.rotate(i * 4 * my_minute)
|
|
||||||
ctx.moveTo(r - 45, 0)
|
|
||||||
ctx.lineTo(r - 40, 0)
|
|
||||||
ctx.stroke()
|
|
||||||
ctx.restore()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 白色小圆
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.fillStyle = 'white'
|
|
||||||
ctx.shadowBlur = 20
|
|
||||||
ctx.shadowColor = 'rgba(204,204,204,0.50)'
|
|
||||||
ctx.arc(0, 0, 74, 0, 2 * Math.PI, false)
|
|
||||||
ctx.fill()
|
|
||||||
|
|
||||||
// 文字
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.restore()
|
|
||||||
|
|
||||||
ctx.fillStyle = props.style?.cir?.color// "#007aff";
|
|
||||||
ctx.font = '42px Cambria, Cambria-Bold'
|
|
||||||
ctx.textAlign = 'center'
|
|
||||||
ctx.textBaseline = 'middle'
|
|
||||||
ctx.fillText(`${percentage}%`, 0, 0)
|
|
||||||
|
|
||||||
// 蓝色的圆
|
|
||||||
if (percentage > 0) {
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.lineWidth = 25
|
|
||||||
ctx.lineCap = 'round'
|
|
||||||
const gad = ctx.createLinearGradient(100, 0, 0, 100)
|
|
||||||
gad.addColorStop(0, props.style?.cir?.background?.start[0])
|
|
||||||
gad.addColorStop(1, props.style?.cir?.background?.start[1])
|
|
||||||
ctx.strokeStyle = gad
|
|
||||||
ctx.arc(0, 0, 104, -Math.PI * 0.5, 2 * Math.PI / 100 * ((percentage < 50 ? percentage : 50) - 25), false)
|
|
||||||
ctx.stroke()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (percentage > 50) {
|
|
||||||
ctx.beginPath()
|
|
||||||
const gad2 = ctx.createLinearGradient(0, -100, 0, 0)
|
|
||||||
gad2.addColorStop(0, props.style?.cir?.background?.end[0])
|
|
||||||
gad2.addColorStop(1, props.style?.cir?.background?.start[1])
|
|
||||||
ctx.strokeStyle = gad2
|
|
||||||
ctx.arc(0, 0, 104, Math.PI * 0.4, 2 * Math.PI / 100 * (percentage - 25), false)
|
|
||||||
ctx.stroke()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
getCanvas()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
useReady(() => {
|
|
||||||
getCanvas()
|
|
||||||
})
|
|
||||||
return <Canvas type="2d" id="myCanvas" />
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import InfiniteScrollPaging from '@/components/InfiniteScrollPaging'
|
|
||||||
import { Button, Canvas, ScrollView, Text, View } from '@tarojs/components'
|
import { Button, Canvas, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import Taro, { useReady } from '@tarojs/taro'
|
import Taro, { useReady } from '@tarojs/taro'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { creditListApi } from '@/api/creditLine'
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import { creditListApi } from '@/api/creditLine'
|
||||||
|
import InfiniteScrollPaging from '@/components/InfiniteScrollPaging'
|
||||||
import { formatDateTime, formatPriceDiv, toDecimal2 } from '@/common/fotmat'
|
import { formatDateTime, formatPriceDiv, toDecimal2 } from '@/common/fotmat'
|
||||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const CreditUsed = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const { fetchData, state } = creditListApi()
|
const { fetchData, state } = creditListApi()
|
||||||
// 渲染(数据)
|
// 渲染(数据)
|
||||||
@ -172,3 +172,5 @@ export default () => {
|
|||||||
// </View>
|
// </View>
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
export default CreditUsed
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { formatPriceDiv, toDecimal2 } from '@/common/fotmat'
|
|||||||
import Message from '@/components/Message'
|
import Message from '@/components/Message'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const DepositBeforehand = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const { fetchData, state } = depositInfoApi()
|
const { fetchData, state } = depositInfoApi()
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
@ -65,3 +65,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default DepositBeforehand
|
||||||
|
|||||||
@ -8,7 +8,35 @@ import { creditListApi } from '@/api/creditLine'
|
|||||||
import './index.scss'
|
import './index.scss'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const TimeLine = () => {
|
||||||
|
return (
|
||||||
|
<View className="deposit-timeline">
|
||||||
|
<View className="deposit-timeline-item">
|
||||||
|
<View className="deposit-timeline-item-left"></View>
|
||||||
|
<View className="deposit-timeline-item-right">
|
||||||
|
<View className="deposit-timeline-item-title">申请提交</View>
|
||||||
|
<View className="deposit-timeline-item-date">2022-04-24 16:10:11</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className="deposit-timeline-item">
|
||||||
|
<View className="deposit-timeline-item-left"></View>
|
||||||
|
<View className="deposit-timeline-item-right">
|
||||||
|
<View className="deposit-timeline-item-title">申请提交</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className="deposit-timeline-item">
|
||||||
|
<View className="deposit-timeline-item-success">
|
||||||
|
<Text className="iconfont icon-tick" />
|
||||||
|
</View>
|
||||||
|
<View className="deposit-timeline-item-right">
|
||||||
|
<View className="deposit-timeline-item-title">申请提交</View>
|
||||||
|
<View className="deposit-timeline-item-date">2022-04-24 16:10:11</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>)
|
||||||
|
}
|
||||||
|
|
||||||
|
const DepositBeforehandDetail = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
return (
|
return (
|
||||||
<View className="deposit-detail">
|
<View className="deposit-detail">
|
||||||
@ -58,30 +86,4 @@ export default () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const TimeLine = () => {
|
export default DepositBeforehandDetail
|
||||||
return (
|
|
||||||
<View className="deposit-timeline">
|
|
||||||
<View className="deposit-timeline-item">
|
|
||||||
<View className="deposit-timeline-item-left"></View>
|
|
||||||
<View className="deposit-timeline-item-right">
|
|
||||||
<View className="deposit-timeline-item-title">申请提交</View>
|
|
||||||
<View className="deposit-timeline-item-date">2022-04-24 16:10:11</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className="deposit-timeline-item">
|
|
||||||
<View className="deposit-timeline-item-left"></View>
|
|
||||||
<View className="deposit-timeline-item-right">
|
|
||||||
<View className="deposit-timeline-item-title">申请提交</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className="deposit-timeline-item">
|
|
||||||
<View className="deposit-timeline-item-success">
|
|
||||||
<Text className="iconfont icon-tick" />
|
|
||||||
</View>
|
|
||||||
<View className="deposit-timeline-item-right">
|
|
||||||
<View className="deposit-timeline-item-title">申请提交</View>
|
|
||||||
<View className="deposit-timeline-item-date">2022-04-24 16:10:11</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import './index.scss'
|
|||||||
import { formatDateTime, formatPriceDiv } from '@/common/fotmat'
|
import { formatDateTime, formatPriceDiv } from '@/common/fotmat'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const DepositList = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const { fetchData, state } = depositListApi()
|
const { fetchData, state } = depositListApi()
|
||||||
// 渲染(数据)
|
// 渲染(数据)
|
||||||
@ -56,3 +56,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default DepositList
|
||||||
|
|||||||
@ -15,9 +15,19 @@ interface params {
|
|||||||
unit?: string
|
unit?: string
|
||||||
otherData?: any
|
otherData?: any
|
||||||
}
|
}
|
||||||
export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = '', otherData }: params) => {
|
const Counter = ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = '', otherData }: params) => {
|
||||||
const [value, setValue] = useState<any>({ count: defaultNum })
|
const [value, setValue] = useState<any>({ count: defaultNum })
|
||||||
|
// 保留小数
|
||||||
|
const formatDigits = (num) => {
|
||||||
|
num = `${num}`
|
||||||
|
if (num.includes('.') && digits > 0) {
|
||||||
|
console.log('num::', num.includes('.'))
|
||||||
|
const res = num.split('.')
|
||||||
|
const last_num = res[1].substr(0, digits)
|
||||||
|
return `${res[0]}.${last_num}`
|
||||||
|
}
|
||||||
|
return parseFloat(num)
|
||||||
|
}
|
||||||
const onPlus = () => {
|
const onPlus = () => {
|
||||||
const { count } = value
|
const { count } = value
|
||||||
let num_res = Big(count).add(step).toNumber()
|
let num_res = Big(count).add(step).toNumber()
|
||||||
@ -36,18 +46,6 @@ export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0
|
|||||||
onClickBtn?.(parseFloat(num_res), otherData)
|
onClickBtn?.(parseFloat(num_res), otherData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保留小数
|
|
||||||
const formatDigits = (num) => {
|
|
||||||
num = `${num}`
|
|
||||||
if (num.includes('.') && digits > 0) {
|
|
||||||
console.log('num::', num.includes('.'))
|
|
||||||
const res = num.split('.')
|
|
||||||
const last_num = res[1].substr(0, digits)
|
|
||||||
return `${res[0]}.${last_num}`
|
|
||||||
}
|
|
||||||
return parseFloat(num)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查数据
|
// 检查数据
|
||||||
const checkData = (val) => {
|
const checkData = (val) => {
|
||||||
const num = parseFloat(val)
|
const num = parseFloat(val)
|
||||||
@ -62,7 +60,7 @@ export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0
|
|||||||
setValue({ ...value, count: minNum })
|
setValue({ ...value, count: minNum })
|
||||||
onChange?.(minNum, otherData)
|
onChange?.(minNum, otherData)
|
||||||
}
|
}
|
||||||
else if (!isNaN(Number(res))) {
|
else if (!Number.isNaN(Number(res))) {
|
||||||
let count = formatDigits(res)
|
let count = formatDigits(res)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue({ ...value, count })
|
setValue({ ...value, count })
|
||||||
@ -70,7 +68,7 @@ export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const num = parseFloat(res)
|
const num = parseFloat(res)
|
||||||
if (!isNaN(num)) {
|
if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue({ ...value, count })
|
setValue({ ...value, count })
|
||||||
@ -85,7 +83,7 @@ export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0
|
|||||||
|
|
||||||
const onBluerEven = () => {
|
const onBluerEven = () => {
|
||||||
const num = parseFloat(value.count)
|
const num = parseFloat(value.count)
|
||||||
if (!isNaN(num)) {
|
if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue({ ...value, count })
|
setValue({ ...value, count })
|
||||||
@ -111,3 +109,5 @@ export default ({ minNum = 0, maxNum = 100, step = 1, digits = 0, defaultNum = 0
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Counter
|
||||||
|
|||||||
@ -25,7 +25,7 @@ interface param {
|
|||||||
title?: string
|
title?: string
|
||||||
productId?: number
|
productId?: number
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, title = '', productId = 0 }: param) => {
|
const OrderCount = ({ show = false, onClose, title = '', productId = 0 }: param) => {
|
||||||
const { adminUserInfo } = useSelector(state => state.userInfo)
|
const { adminUserInfo } = useSelector(state => state.userInfo)
|
||||||
|
|
||||||
const [selectList, _] = useState([
|
const [selectList, _] = useState([
|
||||||
@ -46,39 +46,11 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
const [selectIndex, setSelectIndex] = useState(0)
|
const [selectIndex, setSelectIndex] = useState(0)
|
||||||
const selectProduct = (index: number) => {
|
|
||||||
condition.current.code_or_name = null
|
|
||||||
getColorList()
|
|
||||||
setSelectIndex(() => index)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重置数据
|
|
||||||
useEffect(() => {
|
|
||||||
setSearchShow(false)
|
|
||||||
}, [selectIndex])
|
|
||||||
|
|
||||||
// 获取面料颜色列表
|
// 获取面料颜色列表
|
||||||
const { fetchData: colorFetchData, state: colorState } = GetColorList()
|
const { fetchData: colorFetchData, state: colorState } = GetColorList()
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
const condition = useRef({ physical_warehouse: adminUserInfo?.physical_warehouse, sale_mode: selectIndex, product_id: 0, code_or_name: null })
|
const condition = useRef({ physical_warehouse: adminUserInfo?.physical_warehouse, sale_mode: selectIndex, product_id: 0, code_or_name: null })
|
||||||
const getColorList = async() => {
|
|
||||||
const { data } = await colorFetchData(getFilterData(condition.current))
|
|
||||||
const lists = initList(data.list)
|
|
||||||
setList(() => [...lists])
|
|
||||||
}
|
|
||||||
const [showPopup, setShowPopup] = useState(false)
|
|
||||||
|
|
||||||
// 显示获取
|
|
||||||
useEffect(() => {
|
|
||||||
if (show) {
|
|
||||||
setSelectIndex(0)
|
|
||||||
condition.current.code_or_name = null
|
|
||||||
setSearchShow(false)
|
|
||||||
condition.current.product_id = productId
|
|
||||||
getColorList()
|
|
||||||
}
|
|
||||||
setShowPopup(show)
|
|
||||||
}, [show])
|
|
||||||
|
|
||||||
// 初始化列表数据
|
// 初始化列表数据
|
||||||
const initList = useCallback((list) => {
|
const initList = useCallback((list) => {
|
||||||
@ -89,6 +61,18 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
})
|
})
|
||||||
return newList
|
return newList
|
||||||
}, [])
|
}, [])
|
||||||
|
const getColorList = async() => {
|
||||||
|
const { data } = await colorFetchData(getFilterData(condition.current))
|
||||||
|
const lists = initList(data.list)
|
||||||
|
setList(() => [...lists])
|
||||||
|
}
|
||||||
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
|
|
||||||
|
const selectProduct = (index: number) => {
|
||||||
|
condition.current.code_or_name = null
|
||||||
|
getColorList()
|
||||||
|
setSelectIndex(() => index)
|
||||||
|
}
|
||||||
|
|
||||||
// 卸载数据
|
// 卸载数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -115,7 +99,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
let kindCount = 0
|
let kindCount = 0
|
||||||
const color_list: any[] = []
|
const color_list: any[] = []
|
||||||
let color_list_info = {}
|
let color_list_info = {}
|
||||||
list.map((item) => {
|
list.forEach((item) => {
|
||||||
if (item.count > 0) {
|
if (item.count > 0) {
|
||||||
sumCount = Big(sumCount).add(item.count).toNumber()
|
sumCount = Big(sumCount).add(item.count).toNumber()
|
||||||
kindCount++
|
kindCount++
|
||||||
@ -147,7 +131,21 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
const changeSearchShow = () => {
|
const changeSearchShow = () => {
|
||||||
setSearchShow(true)
|
setSearchShow(true)
|
||||||
}
|
}
|
||||||
|
// 显示获取
|
||||||
|
useEffect(() => {
|
||||||
|
if (show) {
|
||||||
|
setSelectIndex(0)
|
||||||
|
condition.current.code_or_name = null
|
||||||
|
setSearchShow(false)
|
||||||
|
condition.current.product_id = productId
|
||||||
|
getColorList()
|
||||||
|
}
|
||||||
|
setShowPopup(show)
|
||||||
|
}, [show])
|
||||||
|
// 重置数据
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchShow(false)
|
||||||
|
}, [selectIndex])
|
||||||
// 添加购物车
|
// 添加购物车
|
||||||
const { getShopCount } = useCommonData()
|
const { getShopCount } = useCommonData()
|
||||||
const { getSelfUserInfo } = UseLogin()
|
const { getSelfUserInfo } = UseLogin()
|
||||||
@ -228,9 +226,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
const closeLabImgShow = useCallback(() => {
|
const closeLabImgShow = useCallback(() => {
|
||||||
setShowLabImage(() => false)
|
setShowLabImage(() => false)
|
||||||
}, [])
|
}, [])
|
||||||
|
const Rows = ({ id, index, style, data }: any) => {
|
||||||
// 虚拟滚动
|
|
||||||
const Rows = memo(({ id, index, style, data }: any) => {
|
|
||||||
const item = data[index]
|
const item = data[index]
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -269,7 +265,9 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
)) || <View className={styles.item}></View>}
|
)) || <View className={styles.item}></View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
// 虚拟滚动
|
||||||
|
const RowsWithMemo = memo(Rows)
|
||||||
|
|
||||||
const [virtualHeight, setVirtualheight] = useState(400)
|
const [virtualHeight, setVirtualheight] = useState(400)
|
||||||
const getHeight = () => {
|
const getHeight = () => {
|
||||||
@ -341,7 +339,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
itemSize={100} /* 列表单项的高度 */
|
itemSize={100} /* 列表单项的高度 */
|
||||||
overscanCount={1}
|
overscanCount={1}
|
||||||
>
|
>
|
||||||
{Rows}
|
{RowsWithMemo}
|
||||||
</VirtualList>
|
</VirtualList>
|
||||||
<View className="common_safe_area_y"></View>
|
<View className="common_safe_area_y"></View>
|
||||||
</View>
|
</View>
|
||||||
@ -367,4 +365,5 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderCount)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export interface colorParams {
|
|||||||
show?: false|true
|
show?: false|true
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
}
|
}
|
||||||
export default ({ value, show = false, onClose }: colorParams) => {
|
const Preview = ({ value, show = false, onClose }: colorParams) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{show && <View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
{show && <View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
||||||
@ -19,3 +19,5 @@ export default ({ value, show = false, onClose }: colorParams) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Preview
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { memo } from 'react'
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import LabAndImg from '@/components/LabAndImg'
|
import LabAndImg from '@/components/LabAndImg'
|
||||||
|
|
||||||
export default memo(() => {
|
const ProductItem = () => {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View className={styles.item} key={item.id}>
|
<View className={styles.item} key={item.id}>
|
||||||
@ -43,4 +43,5 @@ export default memo(() => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ProductItem)
|
||||||
|
|||||||
@ -8,8 +8,7 @@ interface item { title: string; img: string; url: string; id: number }
|
|||||||
interface params {
|
interface params {
|
||||||
list?: item[]
|
list?: item[]
|
||||||
}
|
}
|
||||||
|
const SwiperComp = ({ list = [] }: params) => {
|
||||||
export default ({ list = [] }: params) => {
|
|
||||||
const [pageIndex, setPageIndex] = useState(1)
|
const [pageIndex, setPageIndex] = useState(1)
|
||||||
const pageRef = useRef<any>(null)
|
const pageRef = useRef<any>(null)
|
||||||
|
|
||||||
@ -36,9 +35,9 @@ export default ({ list = [] }: params) => {
|
|||||||
<View className={styles.swiper}>
|
<View className={styles.swiper}>
|
||||||
{list.length > 0 && (
|
{list.length > 0 && (
|
||||||
<Swiper className={styles.swiper_item} circular onAnimationFinish={e => swiperChange(e)}>
|
<Swiper className={styles.swiper_item} circular onAnimationFinish={e => swiperChange(e)}>
|
||||||
{list?.map((item) => {
|
{list?.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<SwiperItem>
|
<SwiperItem key={key}>
|
||||||
<View className={styles.image_item} onClick={onShowImage}>
|
<View className={styles.image_item} onClick={onShowImage}>
|
||||||
<Image mode="aspectFill" src={formatImgUrl(item, '!w400')}></Image>
|
<Image mode="aspectFill" src={formatImgUrl(item, '!w400')}></Image>
|
||||||
</View>
|
</View>
|
||||||
@ -55,3 +54,5 @@ export default ({ list = [] }: params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default SwiperComp
|
||||||
|
|||||||
@ -26,13 +26,19 @@ interface Params {
|
|||||||
swiperOnClick?: (val: item) => void
|
swiperOnClick?: (val: item) => void
|
||||||
style?: Object
|
style?: Object
|
||||||
}
|
}
|
||||||
export default (props: Params) => {
|
const Details = (props: Params) => {
|
||||||
const { getPhoneNumber, userInfo } = useLogin()
|
const { getPhoneNumber, userInfo } = useLogin()
|
||||||
|
|
||||||
// 获取参数(有两种参数:1.商品id, 2.页面分享)
|
// 获取参数(有两种参数:1.商品id, 2.页面分享)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [params, setParams] = useState({ id: '', share: null })
|
const [params, setParams] = useState({ id: '', share: null })
|
||||||
|
|
||||||
|
// 解析短码参数
|
||||||
|
const { fetchData: fetchDataAnalysisShortCode } = AnalysisShortCodeApi()
|
||||||
|
const analysisShortCode = async() => {
|
||||||
|
const res = await fetchDataAnalysisShortCode({ md5_key: router.params.share })
|
||||||
|
setParams({ id: res.data.product_id, share: res.data })
|
||||||
|
}
|
||||||
// 判断是否是分享过来的参数
|
// 判断是否是分享过来的参数
|
||||||
const judgeParam = async() => {
|
const judgeParam = async() => {
|
||||||
if (router.params.id) {
|
if (router.params.id) {
|
||||||
@ -42,29 +48,9 @@ export default (props: Params) => {
|
|||||||
analysisShortCode()
|
analysisShortCode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析短码参数
|
|
||||||
const { fetchData: fetchDataAnalysisShortCode } = AnalysisShortCodeApi()
|
|
||||||
const analysisShortCode = async() => {
|
|
||||||
const res = await fetchDataAnalysisShortCode({ md5_key: router.params.share })
|
|
||||||
setParams({ id: res.data.product_id, share: res.data })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取购物车数据数量
|
// 获取购物车数据数量
|
||||||
const { getShopCount, commonData } = useCommonData()
|
const { getShopCount, commonData } = useCommonData()
|
||||||
|
|
||||||
useDidShow(() => {
|
|
||||||
judgeParam()
|
|
||||||
setShowCart(false)
|
|
||||||
getShopCount()
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (params.id) {
|
|
||||||
getProductDetail()
|
|
||||||
}
|
|
||||||
}, [params])
|
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const [productInfo, setProductInfo] = useState<any>({})
|
const [productInfo, setProductInfo] = useState<any>({})
|
||||||
const { fetchData } = GetProductDetailApi()
|
const { fetchData } = GetProductDetailApi()
|
||||||
@ -74,13 +60,6 @@ export default (props: Params) => {
|
|||||||
Taro.stopPullDownRefresh()
|
Taro.stopPullDownRefresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (productInfo.code) {
|
|
||||||
getShortCode()
|
|
||||||
setCollectStatus(() => productInfo.is_favorite)
|
|
||||||
}
|
|
||||||
}, [productInfo])
|
|
||||||
|
|
||||||
// 面料名称
|
// 面料名称
|
||||||
const productName = useMemo(() => {
|
const productName = useMemo(() => {
|
||||||
return formatHashTag(productInfo.code, productInfo.name)
|
return formatHashTag(productInfo.code, productInfo.name)
|
||||||
@ -112,7 +91,17 @@ export default (props: Params) => {
|
|||||||
const img = formatImgUrl(shareImg, '!w400')
|
const img = formatImgUrl(shareImg, '!w400')
|
||||||
setSortCode({ ...userObj.sort_code, shareShortDetail: { title: productName as string, code: resDetail.md5_key, img } })
|
setSortCode({ ...userObj.sort_code, shareShortDetail: { title: productName as string, code: resDetail.md5_key, img } })
|
||||||
}
|
}
|
||||||
|
useDidShow(() => {
|
||||||
|
judgeParam()
|
||||||
|
setShowCart(false)
|
||||||
|
getShopCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (params.id) {
|
||||||
|
getProductDetail()
|
||||||
|
}
|
||||||
|
}, [params])
|
||||||
// 授权手机号和下单
|
// 授权手机号和下单
|
||||||
const placeOrder = async(status = 'to_phone', e: any = {}) => {
|
const placeOrder = async(status = 'to_phone', e: any = {}) => {
|
||||||
if (!productInfo.id) { return false }
|
if (!productInfo.id) { return false }
|
||||||
@ -136,14 +125,7 @@ export default (props: Params) => {
|
|||||||
const [collectStatus, setCollectStatus] = useState(false)
|
const [collectStatus, setCollectStatus] = useState(false)
|
||||||
const [collectionShow, setCollectionShow] = useState(false)
|
const [collectionShow, setCollectionShow] = useState(false)
|
||||||
const { fetchData: addFavoritefetchData } = AddFavoriteApi()
|
const { fetchData: addFavoritefetchData } = AddFavoriteApi()
|
||||||
const openCollection = () => {
|
|
||||||
if (productInfo.is_favorite) {
|
|
||||||
delFavoriteProduct()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setCollectionShow(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const onAdd = useCallback(
|
const onAdd = useCallback(
|
||||||
async(val) => {
|
async(val) => {
|
||||||
const res = await addFavoritefetchData({ favorite_id: val.id, product_id: Number(params.id) })
|
const res = await addFavoritefetchData({ favorite_id: val.id, product_id: Number(params.id) })
|
||||||
@ -160,6 +142,13 @@ export default (props: Params) => {
|
|||||||
},
|
},
|
||||||
[params],
|
[params],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (productInfo.code) {
|
||||||
|
getShortCode()
|
||||||
|
setCollectStatus(() => productInfo.is_favorite)
|
||||||
|
}
|
||||||
|
}, [productInfo])
|
||||||
const closeCollection = useCallback(() => {
|
const closeCollection = useCallback(() => {
|
||||||
setCollectionShow(false)
|
setCollectionShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
@ -173,7 +162,14 @@ export default (props: Params) => {
|
|||||||
alert.none('已取消收藏')
|
alert.none('已取消收藏')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const openCollection = () => {
|
||||||
|
if (productInfo.is_favorite) {
|
||||||
|
delFavoriteProduct()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setCollectionShow(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
// 页面下拉刷新
|
// 页面下拉刷新
|
||||||
usePullDownRefresh(() => {
|
usePullDownRefresh(() => {
|
||||||
getProductDetail()
|
getProductDetail()
|
||||||
@ -288,3 +284,5 @@ export default (props: Params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Details
|
||||||
|
|||||||
@ -7,7 +7,7 @@ interface Param {
|
|||||||
onSelect?: (val: number) => void
|
onSelect?: (val: number) => void
|
||||||
defaultValue?: 0|1|2
|
defaultValue?: 0|1|2
|
||||||
}
|
}
|
||||||
export default memo(({ onSelect, defaultValue = 0 }: Param) => {
|
const ShipmentMode = ({ onSelect, defaultValue = 0 }: Param) => {
|
||||||
// 收货方法 0:没选择, 1:自提,2:物流
|
// 收货方法 0:没选择, 1:自提,2:物流
|
||||||
const shipmentMode = useRef([
|
const shipmentMode = useRef([
|
||||||
{ value: 1, label: '上门自提', selected: false },
|
{ value: 1, label: '上门自提', selected: false },
|
||||||
@ -24,9 +24,10 @@ export default memo(({ onSelect, defaultValue = 0 }: Param) => {
|
|||||||
return (
|
return (
|
||||||
<View className={styles.order_title}>
|
<View className={styles.order_title}>
|
||||||
<Text>收货方式</Text>
|
<Text>收货方式</Text>
|
||||||
{shipmentMode.current.map((item) => {
|
{shipmentMode.current.map((item, key) => {
|
||||||
return <View className={classnames(styles.order_status, (selectValue == item.value) && styles.order_status_selected)} onClick={() => selectShipmentMode(item.value)}>{item.label}</View>
|
return <View key={key} className={classnames(styles.order_status, (selectValue == item.value) && styles.order_status_selected)} onClick={() => selectShipmentMode(item.value)}>{item.label}</View>
|
||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ShipmentMode)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { getParam } from '@/common/system'
|
|||||||
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from '@/api/order'
|
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from '@/api/order'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
|
|
||||||
export default () => {
|
const EditOrder = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
// 获取临时传递的数据
|
// 获取临时传递的数据
|
||||||
const params = getParam()
|
const params = getParam()
|
||||||
@ -91,3 +91,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default EditOrder
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { Image, View } from '@tarojs/components'
|
import { Image, View } from '@tarojs/components'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export default () => {
|
const Product = () => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_list}>
|
<View className={styles.products_list}>
|
||||||
{new Array(10).fill('').map((item) => {
|
{new Array(10).fill('').map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_item}>
|
<View key={index} className={styles.products_item}>
|
||||||
<View className={styles.item_img}>
|
<View className={styles.item_img}>
|
||||||
<Image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp01%2F1ZZQ214233446-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1651827249&t=b2fc2a3672dc8ced9e0f37ce7e2ff901" />
|
<Image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp01%2F1ZZQ214233446-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1651827249&t=b2fc2a3672dc8ced9e0f37ce7e2ff901" />
|
||||||
<View className={styles.num}>230色</View>
|
<View className={styles.num}>230色</View>
|
||||||
@ -28,3 +28,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Product
|
||||||
|
|||||||
@ -13,7 +13,7 @@ interface Param {
|
|||||||
|
|
||||||
type ParamProduct = Omit<Param, 'open'>
|
type ParamProduct = Omit<Param, 'open'>
|
||||||
|
|
||||||
export default (option: Param) => {
|
const ProductClass = (option: Param) => {
|
||||||
const { open = false, onOpenClick, onSelect, list, defaultSelectId } = option
|
const { open = false, onOpenClick, onSelect, list, defaultSelectId } = option
|
||||||
const getSelect = useCallback((id) => {
|
const getSelect = useCallback((id) => {
|
||||||
onSelect?.(id)
|
onSelect?.(id)
|
||||||
@ -100,8 +100,9 @@ const ProductClassBlock = (option: ParamProduct & { open: boolean }) => {
|
|||||||
<View className={styles.product_class_block_con}>
|
<View className={styles.product_class_block_con}>
|
||||||
<ScrollView scrollY className={styles.product_class_scroll}>
|
<ScrollView scrollY className={styles.product_class_scroll}>
|
||||||
<View className={styles.product_class_list}>
|
<View className={styles.product_class_list}>
|
||||||
{list?.map(item => (
|
{list?.map((item, index) => (
|
||||||
<View
|
<View
|
||||||
|
key={index}
|
||||||
className={classnames(styles.product_class_item, item.id == selectInfo ? styles.product_class_item_selected : '')}
|
className={classnames(styles.product_class_item, item.id == selectInfo ? styles.product_class_item_selected : '')}
|
||||||
onClick={() => clickEvent(item)}
|
onClick={() => clickEvent(item)}
|
||||||
>
|
>
|
||||||
@ -119,3 +120,5 @@ const ProductClassBlock = (option: ParamProduct & { open: boolean }) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ProductClass
|
||||||
|
|||||||
@ -14,23 +14,8 @@ import { GetProductKindListApi, GetProductListApi } from '@/api/material'
|
|||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
import { dataLoadingStatus } from '@/common/util'
|
import { dataLoadingStatus } from '@/common/util'
|
||||||
|
|
||||||
export default () => {
|
const Index = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
useEffect(() => {
|
|
||||||
categoryList()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 获取面料种类
|
|
||||||
const [kindData, setKindData] = useState<any>({ list: [], defaultId: 0 })
|
|
||||||
const { fetchData } = GetProductKindListApi()
|
|
||||||
const categoryList = async() => {
|
|
||||||
const res = await fetchData()
|
|
||||||
if (res.data?.list) {
|
|
||||||
setKindData({ ...kindData, list: res.data.list, defaultId: res.data.list[0].id })
|
|
||||||
setFiltrate({ ...filtrate, product_kind_id: res.data.list[0].id })
|
|
||||||
product_kind_id_ref.current = res.data.list[0].id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取面料列表
|
// 获取面料列表
|
||||||
const product_kind_id_ref = useRef(0)
|
const product_kind_id_ref = useRef(0)
|
||||||
@ -39,16 +24,6 @@ export default () => {
|
|||||||
const [filtrate, setFiltrate] = useState({ product_kind_id: 0, size: 5, page: 1 })
|
const [filtrate, setFiltrate] = useState({ product_kind_id: 0, size: 5, page: 1 })
|
||||||
const pageNum = useRef({ size: filtrate.size, page: filtrate.page })
|
const pageNum = useRef({ size: filtrate.size, page: filtrate.page })
|
||||||
const { fetchData: productFetchData, state: productState } = GetProductListApi()
|
const { fetchData: productFetchData, state: productState } = GetProductListApi()
|
||||||
// 获取数据方法
|
|
||||||
const getProductList = async() => {
|
|
||||||
const { data, total } = await productFetchData(filtrate)
|
|
||||||
setProductData({ ...productData, list: data.list, total })
|
|
||||||
setRefresherTriggeredStatus(() => false)
|
|
||||||
}
|
|
||||||
// 监听查询条件
|
|
||||||
useEffect(() => {
|
|
||||||
if (filtrate.product_kind_id) { getProductList() }
|
|
||||||
}, [filtrate])
|
|
||||||
|
|
||||||
// 点击面料类型
|
// 点击面料类型
|
||||||
const getProductKindId = useCallback((e) => {
|
const getProductKindId = useCallback((e) => {
|
||||||
@ -95,7 +70,30 @@ export default () => {
|
|||||||
product_kind_id_next_ref.current = id
|
product_kind_id_next_ref.current = id
|
||||||
setFiltrate(list => ({ ...list, size: 5, product_kind_id: kind_id }))
|
setFiltrate(list => ({ ...list, size: 5, product_kind_id: kind_id }))
|
||||||
}, [])
|
}, [])
|
||||||
|
// 获取面料种类
|
||||||
|
const [kindData, setKindData] = useState<any>({ list: [], defaultId: 0 })
|
||||||
|
const { fetchData } = GetProductKindListApi()
|
||||||
|
const categoryList = async() => {
|
||||||
|
const res = await fetchData()
|
||||||
|
if (res.data?.list) {
|
||||||
|
setKindData({ ...kindData, list: res.data.list, defaultId: res.data.list[0].id })
|
||||||
|
setFiltrate({ ...filtrate, product_kind_id: res.data.list[0].id })
|
||||||
|
product_kind_id_ref.current = res.data.list[0].id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取数据方法
|
||||||
|
const getProductList = async() => {
|
||||||
|
const { data, total } = await productFetchData(filtrate)
|
||||||
|
setProductData({ ...productData, list: data.list, total })
|
||||||
|
setRefresherTriggeredStatus(() => false)
|
||||||
|
}
|
||||||
|
// 监听查询条件
|
||||||
|
useEffect(() => {
|
||||||
|
if (filtrate.product_kind_id) { getProductList() }
|
||||||
|
}, [filtrate])
|
||||||
|
useEffect(() => {
|
||||||
|
categoryList()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
@ -130,3 +128,5 @@ export default () => {
|
|||||||
</MoveBtn>
|
</MoveBtn>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Index
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import { SUBSCRIPTION_MESSAGE_SCENE } from '@/common/enum'
|
|||||||
import { UseSubscriptionMessage } from '@/use/useCommon'
|
import { UseSubscriptionMessage } from '@/use/useCommon'
|
||||||
import { throttle } from '@/common/util'
|
import { throttle } from '@/common/util'
|
||||||
|
|
||||||
export default () => {
|
const Comfirm = () => {
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
// 下单信息
|
// 下单信息
|
||||||
interface OrderParams { address_id?: number; remark?: string; sale_mode?: number; shipment_mode?: number; list?: any[] }
|
interface OrderParams { address_id?: number; remark?: string; sale_mode?: number; shipment_mode?: number; list?: any[] }
|
||||||
@ -30,6 +30,15 @@ export default () => {
|
|||||||
}
|
}
|
||||||
const param = getParam()
|
const param = getParam()
|
||||||
const idsAndSaleModel = useRef<orderPreParam>({ shopping_cart_product_color_list: [], sale_mode: 0 })
|
const idsAndSaleModel = useRef<orderPreParam>({ shopping_cart_product_color_list: [], sale_mode: 0 })
|
||||||
|
// 获取销售预览订单
|
||||||
|
const [preViewOrder, setPreViewOrder] = useState<any>() // 获取到的原始数据
|
||||||
|
const { fetchData } = SaleOrderPreViewApi()
|
||||||
|
const getSaleOrderPreView = async() => {
|
||||||
|
if (idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) {
|
||||||
|
const res = await fetchData(idsAndSaleModel.current)
|
||||||
|
setPreViewOrder(res.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
useDidShow(async() => {
|
useDidShow(async() => {
|
||||||
idsAndSaleModel.current = { shopping_cart_product_color_list: [], sale_mode: 0 } // 初始化
|
idsAndSaleModel.current = { shopping_cart_product_color_list: [], sale_mode: 0 } // 初始化
|
||||||
idsAndSaleModel.current.sale_mode = Number(param?.sale_mode)
|
idsAndSaleModel.current.sale_mode = Number(param?.sale_mode)
|
||||||
@ -42,29 +51,6 @@ export default () => {
|
|||||||
setSubmitOrderData(val => ({ ...val, sale_mode: param?.sale_mode }))
|
setSubmitOrderData(val => ({ ...val, sale_mode: param?.sale_mode }))
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取销售预览订单
|
|
||||||
const [preViewOrder, setPreViewOrder] = useState<any>() // 获取到的原始数据
|
|
||||||
const { fetchData } = SaleOrderPreViewApi()
|
|
||||||
const getSaleOrderPreView = async() => {
|
|
||||||
if (idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) {
|
|
||||||
const res = await fetchData(idsAndSaleModel.current)
|
|
||||||
setPreViewOrder(res.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 监听获取到的数据
|
|
||||||
useEffect(() => {
|
|
||||||
if (preViewOrder) {
|
|
||||||
formatData()
|
|
||||||
getDataList()
|
|
||||||
setSubmitOrderData(val => ({
|
|
||||||
...val,
|
|
||||||
address_id: preViewOrder.default_address.id,
|
|
||||||
shipment_mode: preViewOrder.shipment_mode || 2,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}, [preViewOrder])
|
|
||||||
|
|
||||||
// 格式化数据格式
|
// 格式化数据格式
|
||||||
const [formatPreViewOrder, setFormatPreViewOrder] = useState<any>() // 格式化后的数据
|
const [formatPreViewOrder, setFormatPreViewOrder] = useState<any>() // 格式化后的数据
|
||||||
const formatData = () => {
|
const formatData = () => {
|
||||||
@ -105,8 +91,8 @@ export default () => {
|
|||||||
// 获取提交格式数据列表
|
// 获取提交格式数据列表
|
||||||
const getDataList = () => {
|
const getDataList = () => {
|
||||||
const list: { shopping_cart_product_color_id: number }[] = []
|
const list: { shopping_cart_product_color_id: number }[] = []
|
||||||
preViewOrder.product_list?.map((item) => {
|
preViewOrder.product_list?.forEach((item) => {
|
||||||
item.product_colors?.map((colorItem) => {
|
item.product_colors?.forEach((colorItem) => {
|
||||||
list.push({ shopping_cart_product_color_id: colorItem.id })
|
list.push({ shopping_cart_product_color_id: colorItem.id })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -178,7 +164,18 @@ export default () => {
|
|||||||
usePullDownRefresh(() => {
|
usePullDownRefresh(() => {
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
})
|
})
|
||||||
|
// 监听获取到的数据
|
||||||
|
useEffect(() => {
|
||||||
|
if (preViewOrder) {
|
||||||
|
formatData()
|
||||||
|
getDataList()
|
||||||
|
setSubmitOrderData(val => ({
|
||||||
|
...val,
|
||||||
|
address_id: preViewOrder.default_address.id,
|
||||||
|
shipment_mode: preViewOrder.shipment_mode || 2,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}, [preViewOrder])
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1} />
|
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1} />
|
||||||
@ -208,3 +205,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Comfirm
|
||||||
|
|||||||
@ -19,14 +19,9 @@ interface Param {
|
|||||||
defaultValue?: AddressInfoParam|null // 默认值
|
defaultValue?: AddressInfoParam|null // 默认值
|
||||||
disabled?: false|true // true禁用后只用于展示
|
disabled?: false|true // true禁用后只用于展示
|
||||||
}
|
}
|
||||||
|
const AddressInfo = ({ onSelect, defaultValue = null, disabled = false }: Param) => {
|
||||||
export default memo(({ onSelect, defaultValue = null, disabled = false }: Param) => {
|
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
const [showAddressList, setShowAddressList] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUserInfo(() => defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
// 选择地址
|
// 选择地址
|
||||||
const [userInfo, setUserInfo] = useState<any>()
|
const [userInfo, setUserInfo] = useState<any>()
|
||||||
const getAddress = useCallback((val) => {
|
const getAddress = useCallback((val) => {
|
||||||
@ -43,25 +38,28 @@ export default memo(({ onSelect, defaultValue = null, disabled = false }: Param)
|
|||||||
const changeShow = () => {
|
const changeShow = () => {
|
||||||
if (!disabled) { setShowAddressList(() => true) }
|
if (!disabled) { setShowAddressList(() => true) }
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
setUserInfo(() => defaultValue)
|
||||||
|
}, [defaultValue])
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
<View className={styles.order_address} onClick={() => changeShow()}>
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont icon-daohang')}></View>
|
<View className={classnames(styles.order_address_icon, 'iconfont icon-daohang')}></View>
|
||||||
{!userInfo
|
{!userInfo
|
||||||
&& <>
|
? <>
|
||||||
<View className={styles.order_address_text_no}>请选择收货地址及信息</View>
|
<View className={styles.order_address_text_no}>请选择收货地址及信息</View>
|
||||||
<View className={classnames(styles.order_address_more_icon, 'iconfont icon-a-moreback')}></View>
|
<View className={classnames(styles.order_address_more_icon, 'iconfont icon-a-moreback')}></View>
|
||||||
</>
|
</>
|
||||||
|| <>
|
: <>
|
||||||
<View className={styles.order_address_text_con}>
|
<View className={styles.order_address_text_con}>
|
||||||
<View className={styles.order_address_text_name}>
|
<View className={styles.order_address_text_name}>
|
||||||
<Text>{userInfo?.name}</Text>
|
<Text>{userInfo?.name}</Text>
|
||||||
<Text>{userInfo?.phone}</Text>
|
<Text>{userInfo?.phone}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_address_text_title}>{formatAddress}</View>
|
<View className={styles.order_address_text_title}>{formatAddress}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.updateBtn}>修改</View>
|
<View className={styles.updateBtn}>修改</View>
|
||||||
</>}
|
</>}
|
||||||
</View>
|
</View>
|
||||||
{!disabled && <Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
{!disabled && <Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
||||||
<View className={styles.order_address_list}>
|
<View className={styles.order_address_list}>
|
||||||
@ -71,4 +69,5 @@ export default memo(({ onSelect, defaultValue = null, disabled = false }: Param)
|
|||||||
</Popup>}
|
</Popup>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AddressInfo)
|
||||||
|
|||||||
@ -46,194 +46,190 @@ const {
|
|||||||
SaleOrderStatusRefund,
|
SaleOrderStatusRefund,
|
||||||
SaleOrderStatusCancel,
|
SaleOrderStatusCancel,
|
||||||
} = ORDER_STATUS
|
} = ORDER_STATUS
|
||||||
|
const AddressInfoDetail = ({ onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics }: Param, ref) => {
|
||||||
|
const [addressInfo, setAddressInfo] = useState<any>()
|
||||||
|
const { fetchData: addressFetchData } = EditSaleOrderAddressApi()
|
||||||
|
|
||||||
export default memo(
|
// 打开地址列表
|
||||||
forwardRef(({ onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics }: Param, ref) => {
|
const [showAddressList, setShowAddressList] = useState(false)
|
||||||
const [addressInfo, setAddressInfo] = useState<any>()
|
|
||||||
useEffect(() => {
|
|
||||||
if (orderInfo) {
|
|
||||||
setReceivingStatus(() => orderInfo.shipment_mode || 2)
|
|
||||||
setAddressInfo(() => orderInfo)
|
|
||||||
}
|
|
||||||
}, [orderInfo])
|
|
||||||
|
|
||||||
// 打开地址列表
|
// 收货方法,1:自提,2物流
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
const [receivingStatus, setReceivingStatus] = useState(2)
|
||||||
const changeShow = () => {
|
|
||||||
if (receivingStatus == 2 && !logisticsShow && limitEdit()) { setShowAddressList(() => true) }
|
// 当没有地址时获取地址列表中的第一个数据
|
||||||
|
const { fetchData: addressListFetchData } = addressListApi()
|
||||||
|
const getAddressListOne = async() => {
|
||||||
|
if (orderInfo?.address_detail) { return true }
|
||||||
|
const res = await addressListFetchData()
|
||||||
|
if (res.data.list && res.data.list?.length > 0) {
|
||||||
|
const info = res.data.list[0]
|
||||||
|
await addressFetchData({ id: orderInfo?.id, address_id: info.id })
|
||||||
|
setAddressInfo(e => ({ ...e, ...info, target_user_name: info.name, target_user_phone: info.phone }))
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
// 把内部方法提供给外部
|
Taro.showModal({
|
||||||
useImperativeHandle(ref, () => ({
|
content: '您还没有地址,请前去新增地址',
|
||||||
changeShow,
|
success(res) {
|
||||||
}))
|
if (res.confirm) {
|
||||||
|
goLink('/pages/addressManager/index')
|
||||||
// 收货方法,1:自提,2物流
|
}
|
||||||
const [receivingStatus, setReceivingStatus] = useState(2)
|
else if (res.cancel) {
|
||||||
const { fetchData: shipmentModeFetchData } = EditSaleOrderShipmentModeApi()
|
console.log('用户点击取消')
|
||||||
const onReceivingStatus = async(value, e) => {
|
}
|
||||||
e.stopPropagation()
|
},
|
||||||
if (limitEdit()) { changeReceivingStatus(value) }
|
})
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const { fetchData: shipmentModeFetchData } = EditSaleOrderShipmentModeApi()
|
||||||
|
|
||||||
// 当没有地址时获取地址列表中的第一个数据
|
const changeReceivingStatus = debounce(async(value) => {
|
||||||
const { fetchData: addressListFetchData } = addressListApi()
|
if (!orderInfo || value == receivingStatus) { return false }
|
||||||
const getAddressListOne = async() => {
|
if (status == 1) {
|
||||||
if (orderInfo?.address_detail) { return true }
|
onChangeShipmentMode?.(value)
|
||||||
const res = await addressListFetchData()
|
setReceivingStatus(value)
|
||||||
if (res.data.list && res.data.list?.length > 0) {
|
return false
|
||||||
const info = res.data.list[0]
|
|
||||||
await addressFetchData({ id: orderInfo?.id, address_id: info.id })
|
|
||||||
setAddressInfo(e => ({ ...e, ...info, target_user_name: info.name, target_user_phone: info.phone }))
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Taro.showModal({
|
|
||||||
content: '您还没有地址,请前去新增地址',
|
|
||||||
success(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
goLink('/pages/addressManager/index')
|
|
||||||
}
|
|
||||||
else if (res.cancel) {
|
|
||||||
console.log('用户点击取消')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (value == 2) {
|
||||||
const changeReceivingStatus = debounce(async(value) => {
|
const res = await getAddressListOne()
|
||||||
if (!orderInfo || value == receivingStatus) { return false }
|
if (!res) { return false }
|
||||||
if (status == 1) {
|
|
||||||
onChangeShipmentMode?.(value)
|
|
||||||
setReceivingStatus(value)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (value == 2) {
|
|
||||||
const res = await getAddressListOne()
|
|
||||||
if (!res) { return false }
|
|
||||||
}
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await shipmentModeFetchData({ id: orderInfo.id, shipment_mode: value })
|
|
||||||
if (res.success) {
|
|
||||||
alert.success('收货方式修改成功')
|
|
||||||
onChangeShipmentMode?.(value)
|
|
||||||
setReceivingStatus(() => value)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}, 300)
|
|
||||||
|
|
||||||
// 修改地址
|
|
||||||
const [addressId, setAddressId] = useState(0)
|
|
||||||
const { fetchData: addressFetchData } = EditSaleOrderAddressApi()
|
|
||||||
const getAddress = async(value) => {
|
|
||||||
if (!orderInfo) { return false }
|
|
||||||
if (status == 1) {
|
|
||||||
setShowAddressList(() => false)
|
|
||||||
setAddressId(value.id)
|
|
||||||
setAddressInfo(e => ({ ...e, ...value, target_user_name: value.name, target_user_phone: value.phone }))
|
|
||||||
onSelect?.(value)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await addressFetchData({ id: orderInfo.id, address_id: value.id })
|
|
||||||
if (res.success) {
|
|
||||||
alert.success('地址修改成功')
|
|
||||||
onSelect?.(value)
|
|
||||||
setShowAddressList(() => false)
|
|
||||||
setAddressId(value.id)
|
|
||||||
setAddressInfo(e => ({ ...e, ...value, target_user_name: value.name, target_user_phone: value.phone }))
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
alert.loading('正在修改')
|
||||||
// 根据订单状态判断是否可修改
|
const res = await shipmentModeFetchData({ id: orderInfo.id, shipment_mode: value })
|
||||||
const limitEdit = () => {
|
if (res.success) {
|
||||||
const res = [
|
alert.success('收货方式修改成功')
|
||||||
SaleorderstatusWaitingPrePayment.value,
|
onChangeShipmentMode?.(value)
|
||||||
SaleOrderStatusBooking.value,
|
setReceivingStatus(() => value)
|
||||||
SaleOrderStatusArranging.value,
|
|
||||||
SaleOrderStatusArranged.value,
|
|
||||||
SaleOrderStatusWaitingPayment.value,
|
|
||||||
].includes(orderInfo?.status as number)
|
|
||||||
if (!res && status != 1) { alert.none('该订单状态不能修改地址!') }
|
|
||||||
return status == 1 ? true : res
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
alert.none(res.msg)
|
||||||
|
}
|
||||||
|
}, 300)
|
||||||
|
|
||||||
// 根据订单状态判断是否显示物流
|
// 修改地址
|
||||||
const logisticsShowList = [
|
const [addressId, setAddressId] = useState(0)
|
||||||
SaleOrderStatusWaitingReceipt.value,
|
const getAddress = async(value) => {
|
||||||
SaleOrderStatusAlreadyReceipt.value,
|
if (!orderInfo) { return false }
|
||||||
SaleOrderStatusComplete.value,
|
if (status == 1) {
|
||||||
SaleOrderStatusRefund.value,
|
setShowAddressList(() => false)
|
||||||
]
|
setAddressId(value.id)
|
||||||
const logisticsShow = useMemo(() => {
|
setAddressInfo(e => ({ ...e, ...value, target_user_name: value.name, target_user_phone: value.phone }))
|
||||||
return logisticsShowList.includes(orderInfo?.status as number)
|
onSelect?.(value)
|
||||||
}, [orderInfo])
|
return false
|
||||||
|
}
|
||||||
|
alert.loading('正在修改')
|
||||||
|
const res = await addressFetchData({ id: orderInfo.id, address_id: value.id })
|
||||||
|
if (res.success) {
|
||||||
|
alert.success('地址修改成功')
|
||||||
|
onSelect?.(value)
|
||||||
|
setShowAddressList(() => false)
|
||||||
|
setAddressId(value.id)
|
||||||
|
setAddressInfo(e => ({ ...e, ...value, target_user_name: value.name, target_user_phone: value.phone }))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert.none(res.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 地址格式
|
// 根据订单状态判断是否可修改
|
||||||
const formatAddress = useMemo(() => {
|
const limitEdit = () => {
|
||||||
if (receivingStatus == 2) {
|
const res = [
|
||||||
return addressInfo?.address_detail ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
SaleorderstatusWaitingPrePayment.value,
|
||||||
}
|
SaleOrderStatusBooking.value,
|
||||||
else {
|
SaleOrderStatusArranging.value,
|
||||||
return addressInfo?.take_goods_address
|
SaleOrderStatusArranged.value,
|
||||||
}
|
SaleOrderStatusWaitingPayment.value,
|
||||||
}, [receivingStatus, addressInfo])
|
].includes(orderInfo?.status as number)
|
||||||
|
if (!res && status != 1) { alert.none('该订单状态不能修改地址!') }
|
||||||
return (
|
return status == 1 ? true : res
|
||||||
<View>
|
}
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
const onReceivingStatus = async(value, e) => {
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2 ? 'icon-daohang' : 'icon-fahuo')}></View>
|
e.stopPropagation()
|
||||||
<View className={styles.order_address_text_con}>
|
if (limitEdit()) { changeReceivingStatus(value) }
|
||||||
<View className={styles.order_address_text_title}>
|
}
|
||||||
<Text className={classnames(styles.address_text, styles.address_text_no)}>{formatAddress || '请选择收货地址及信息'}</Text>
|
// 根据订单状态判断是否显示物流
|
||||||
{receivingStatus == 2 && !logisticsShow && <Text className={classnames(styles.moreIconfont, 'iconfont icon-a-moreback')}></Text>}
|
const logisticsShowList = [
|
||||||
</View>
|
SaleOrderStatusWaitingReceipt.value,
|
||||||
<View className={styles.order_address_text_name}>
|
SaleOrderStatusAlreadyReceipt.value,
|
||||||
<Text>{receivingStatus == 1 ? '谭先生' : addressInfo?.target_user_name}</Text>
|
SaleOrderStatusComplete.value,
|
||||||
<Text>{receivingStatus == 1 ? addressInfo?.take_goods_phone : addressInfo?.target_user_phone}</Text>
|
SaleOrderStatusRefund.value,
|
||||||
</View>
|
]
|
||||||
|
const logisticsShow = useMemo(() => {
|
||||||
|
return logisticsShowList.includes(orderInfo?.status as number)
|
||||||
|
}, [orderInfo])
|
||||||
|
const changeShow = () => {
|
||||||
|
if (receivingStatus == 2 && !logisticsShow && limitEdit()) { setShowAddressList(() => true) }
|
||||||
|
}
|
||||||
|
// 地址格式
|
||||||
|
const formatAddress = useMemo(() => {
|
||||||
|
if (receivingStatus == 2) {
|
||||||
|
return addressInfo?.address_detail ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return addressInfo?.take_goods_address
|
||||||
|
}
|
||||||
|
}, [receivingStatus, addressInfo])
|
||||||
|
useEffect(() => {
|
||||||
|
if (orderInfo) {
|
||||||
|
setReceivingStatus(() => orderInfo.shipment_mode || 2)
|
||||||
|
setAddressInfo(() => orderInfo)
|
||||||
|
}
|
||||||
|
}, [orderInfo])
|
||||||
|
// 把内部方法提供给外部
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
changeShow,
|
||||||
|
}))
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<View className={styles.order_address} onClick={() => changeShow()}>
|
||||||
|
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2 ? 'icon-daohang' : 'icon-fahuo')}></View>
|
||||||
|
<View className={styles.order_address_text_con}>
|
||||||
|
<View className={styles.order_address_text_title}>
|
||||||
|
<Text className={classnames(styles.address_text, styles.address_text_no)}>{formatAddress || '请选择收货地址及信息'}</Text>
|
||||||
|
{receivingStatus == 2 && !logisticsShow && <Text className={classnames(styles.moreIconfont, 'iconfont icon-a-moreback')}></Text>}
|
||||||
</View>
|
</View>
|
||||||
{(!logisticsShow && (
|
<View className={styles.order_address_text_name}>
|
||||||
<View className={styles.updateBtn}>
|
<Text>{receivingStatus == 1 ? '谭先生' : addressInfo?.target_user_name}</Text>
|
||||||
<View className={styles.updateBtn_list}>
|
<Text>{receivingStatus == 1 ? addressInfo?.take_goods_phone : addressInfo?.target_user_phone}</Text>
|
||||||
<View
|
</View>
|
||||||
className={classnames(styles.updateBtn_item, receivingStatus == 1 && styles.updateBtn_item_select)}
|
</View>
|
||||||
onClick={e => onReceivingStatus(1, e)}
|
{(!logisticsShow && (
|
||||||
>
|
<View className={styles.updateBtn}>
|
||||||
|
<View className={styles.updateBtn_list}>
|
||||||
|
<View
|
||||||
|
className={classnames(styles.updateBtn_item, receivingStatus == 1 && styles.updateBtn_item_select)}
|
||||||
|
onClick={e => onReceivingStatus(1, e)}
|
||||||
|
>
|
||||||
自提
|
自提
|
||||||
</View>
|
|
||||||
<View
|
|
||||||
className={classnames(styles.updateBtn_item, receivingStatus == 2 && styles.updateBtn_item_select)}
|
|
||||||
onClick={e => onReceivingStatus(2, e)}
|
|
||||||
>
|
|
||||||
物流
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
<View style={{ transform: receivingStatus == 1 ? 'translateX(0)' : 'translateX(100%)' }} className={classnames(styles.updateBtn_select)}></View>
|
<View
|
||||||
|
className={classnames(styles.updateBtn_item, receivingStatus == 2 && styles.updateBtn_item_select)}
|
||||||
|
onClick={e => onReceivingStatus(2, e)}
|
||||||
|
>
|
||||||
|
物流
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
))
|
<View style={{ transform: receivingStatus == 1 ? 'translateX(0)' : 'translateX(100%)' }} className={classnames(styles.updateBtn_select)}></View>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|| (orderInfo?.status != SaleOrderStatusRefund.value && (
|
|| (orderInfo?.status != SaleOrderStatusRefund.value && (
|
||||||
<View className={styles.logisticsBtn} onClick={onLogistics}>
|
<View className={styles.logisticsBtn} onClick={onLogistics}>
|
||||||
查看物流
|
查看物流
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</View>
|
|
||||||
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
|
||||||
<View className={styles.order_address_list}>
|
|
||||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
|
||||||
<View className={styles.addressList_con}>
|
|
||||||
<AddressList onSelect={getAddress} id={addressId} />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Popup>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
||||||
}),
|
<View className={styles.order_address_list}>
|
||||||
|
<View className={styles.order_address_title}>请选择收货地址</View>
|
||||||
|
<View className={styles.addressList_con}>
|
||||||
|
<AddressList onSelect={getAddress} id={addressId} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default memo(
|
||||||
|
forwardRef(AddressInfoDetail),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -23,8 +23,7 @@ interface Param {
|
|||||||
status: number // 订单状态
|
status: number // 订单状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const AdvanceOrderState = ({ orderInfo, onRefresh }: Param) => {
|
||||||
export default memo(({ orderInfo, onRefresh }: Param) => {
|
|
||||||
const { showTime, onStart, timeStatus } = useTimeCountDown()
|
const { showTime, onStart, timeStatus } = useTimeCountDown()
|
||||||
|
|
||||||
// 订单状态枚举
|
// 订单状态枚举
|
||||||
@ -68,4 +67,5 @@ export default memo(({ orderInfo, onRefresh }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AdvanceOrderState)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ interface Param {
|
|||||||
number: number // 数字
|
number: number // 数字
|
||||||
status: 0|1|2 // 0 小型,1中型,2大
|
status: 0|1|2 // 0 小型,1中型,2大
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, status = 1 }: Param) => {
|
const AmountShow = ({ number = 0, status = 1 }: Param) => {
|
||||||
const priceDom = useCallback(() => {
|
const priceDom = useCallback(() => {
|
||||||
const res = number.toFixed(2).split('.')
|
const res = number.toFixed(2).split('.')
|
||||||
const int_num = `${parseInt(res[0])}`
|
const int_num = `${parseInt(res[0])}`
|
||||||
@ -25,4 +25,5 @@ export default memo(({ number = 0, status = 1 }: Param) => {
|
|||||||
{priceDom()}
|
{priceDom()}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AmountShow)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ interface Param {
|
|||||||
orderId?: number
|
orderId?: number
|
||||||
onSuccess?: () => void
|
onSuccess?: () => void
|
||||||
}
|
}
|
||||||
export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
const ApplyRefund = ({ show, onClose, orderId, onSuccess }: Param) => {
|
||||||
// 提交的数据
|
// 提交的数据
|
||||||
const submitData = useRef({
|
const submitData = useRef({
|
||||||
return_explain: 0,
|
return_explain: 0,
|
||||||
@ -22,13 +22,6 @@ export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
|||||||
reason_describe: '',
|
reason_describe: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (show && orderId) {
|
|
||||||
submitData.current.sale_order_id = orderId
|
|
||||||
refundExplain()
|
|
||||||
}
|
|
||||||
}, [orderId, show])
|
|
||||||
|
|
||||||
// 申请退款
|
// 申请退款
|
||||||
const { fetchData } = ApplyRefundApi()
|
const { fetchData } = ApplyRefundApi()
|
||||||
const getApplyRefund = async() => {
|
const getApplyRefund = async() => {
|
||||||
@ -51,12 +44,6 @@ export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
|||||||
const res = await refundExplainFetchdata()
|
const res = await refundExplainFetchdata()
|
||||||
setList(() => res.data.list)
|
setList(() => res.data.list)
|
||||||
}
|
}
|
||||||
const [reason, setReason] = useState({ id: 0, name: '' })
|
|
||||||
const reasonSelect = useCallback((e) => {
|
|
||||||
setReason({ ...reason, name: e.name, id: e.id })
|
|
||||||
submitData.current.return_explain = e.id
|
|
||||||
closeReason()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 备注
|
// 备注
|
||||||
const getOtherReason = useCallback((val) => {
|
const getOtherReason = useCallback((val) => {
|
||||||
@ -68,7 +55,12 @@ export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
|||||||
const closeReason = useCallback(() => {
|
const closeReason = useCallback(() => {
|
||||||
setShowReason(false)
|
setShowReason(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
const [reason, setReason] = useState({ id: 0, name: '' })
|
||||||
|
const reasonSelect = useCallback((e) => {
|
||||||
|
setReason({ ...reason, name: e.name, id: e.id })
|
||||||
|
submitData.current.return_explain = e.id
|
||||||
|
closeReason()
|
||||||
|
}, [])
|
||||||
// 提交
|
// 提交
|
||||||
const onSubmit = (val) => {
|
const onSubmit = (val) => {
|
||||||
if (val == 2) {
|
if (val == 2) {
|
||||||
@ -83,7 +75,12 @@ export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (show && orderId) {
|
||||||
|
submitData.current.sale_order_id = orderId
|
||||||
|
refundExplain()
|
||||||
|
}
|
||||||
|
}, [orderId, show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup show={show} title="申请退款" onClose={onClose}>
|
<Popup show={show} title="申请退款" onClose={onClose}>
|
||||||
@ -111,4 +108,5 @@ export default memo(({ show, onClose, orderId, onSuccess }: Param) => {
|
|||||||
<ReasonPopup defaultValue={reason.id} show={showReason} onClose={closeReason} list={list} title="退款说明" onSelect={reasonSelect} />
|
<ReasonPopup defaultValue={reason.id} show={showReason} onClose={closeReason} list={list} title="退款说明" onSelect={reasonSelect} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ApplyRefund)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ interface Param {
|
|||||||
messageWidth?: number
|
messageWidth?: number
|
||||||
messageShow?: true|false
|
messageShow?: true|false
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageHeight = 70, messageWidth = 430, messageShow = false }: Param) => {
|
const EstimatedAmount = ({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageHeight = 70, messageWidth = 430, messageShow = false }: Param) => {
|
||||||
const [show, setShow] = useState(messageShow)
|
const [show, setShow] = useState(messageShow)
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setShow(false)
|
setShow(false)
|
||||||
@ -28,14 +28,6 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
|
|
||||||
const [style, setStyle] = useState<{ top: string }>()
|
const [style, setStyle] = useState<{ top: string }>()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (show) {
|
|
||||||
getDomDes('#message')
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setStyle(() => ({ top: '0' }))
|
|
||||||
}
|
|
||||||
}, [show])
|
|
||||||
// 设置弹出层高度
|
// 设置弹出层高度
|
||||||
const getDomDes = (id) => {
|
const getDomDes = (id) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -46,6 +38,14 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
}).exec()
|
}).exec()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (show) {
|
||||||
|
getDomDes('#message')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setStyle(() => ({ top: '0' }))
|
||||||
|
}
|
||||||
|
}, [show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.order_price}>
|
<View className={styles.order_price}>
|
||||||
@ -61,4 +61,5 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(EstimatedAmount)
|
||||||
|
|||||||
@ -28,8 +28,7 @@ interface Param {
|
|||||||
order: OrderParam
|
order: OrderParam
|
||||||
comfirm?: boolean // 是否是确认订单页面使用
|
comfirm?: boolean // 是否是确认订单页面使用
|
||||||
}
|
}
|
||||||
|
const KindList = ({ order, comfirm = false }: Param) => {
|
||||||
export default memo(({ order, comfirm = false }: Param) => {
|
|
||||||
const {
|
const {
|
||||||
SaleOrderStatusBooking, // 待接单
|
SaleOrderStatusBooking, // 待接单
|
||||||
SaleOrderStatusArranging, // 配布中
|
SaleOrderStatusArranging, // 配布中
|
||||||
@ -239,4 +238,5 @@ export default memo(({ order, comfirm = false }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(KindList)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ interface param {
|
|||||||
children?: ReactElement | null
|
children?: ReactElement | null
|
||||||
orderInfo?: any
|
orderInfo?: any
|
||||||
}
|
}
|
||||||
export default ({ children = null, orderInfo }: param) => {
|
const MovableAreaBtn = ({ children = null, orderInfo }: param) => {
|
||||||
const [screenHeight, setScreenHeight] = useState(0)
|
const [screenHeight, setScreenHeight] = useState(0)
|
||||||
const screenWidthRef = useRef(0)
|
const screenWidthRef = useRef(0)
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
@ -38,3 +38,5 @@ export default ({ children = null, orderInfo }: param) => {
|
|||||||
</MovableArea>
|
</MovableArea>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default MovableAreaBtn
|
||||||
|
|||||||
@ -17,7 +17,7 @@ interface Param {
|
|||||||
transfer_remittance_account: string
|
transfer_remittance_account: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, offlineInfo }: Param) => {
|
const OfflinePay = ({ show = true, onClose, offlineInfo }: Param) => {
|
||||||
// 复制功能
|
// 复制功能
|
||||||
const clipboardData = () => {
|
const clipboardData = () => {
|
||||||
Taro.setClipboardData({
|
Taro.setClipboardData({
|
||||||
@ -53,4 +53,5 @@ export default memo(({ show = true, onClose, offlineInfo }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OfflinePay)
|
||||||
|
|||||||
@ -24,8 +24,7 @@ interface Param {
|
|||||||
account_period_time?: string // 还款日期
|
account_period_time?: string // 还款日期
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const OrderState = ({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||||
export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('orderInfo33::', orderInfo)
|
console.log('orderInfo33::', orderInfo)
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
@ -51,7 +50,7 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
|||||||
<>
|
<>
|
||||||
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
||||||
<View className={classnames(styles.order_status_list, showMore && styles.order_status_list_show)}>
|
<View className={classnames(styles.order_status_list, showMore && styles.order_status_list_show)}>
|
||||||
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
{dataList.map((item, index) => <View className={styles.order_status_item} key={index}>
|
||||||
{(dataList.length > 1) && <View className={classnames(styles.order_status_tail, (index == 0) && styles.order_status_tail_end)}></View>}
|
{(dataList.length > 1) && <View className={classnames(styles.order_status_tail, (index == 0) && styles.order_status_tail_end)}></View>}
|
||||||
{(dataList.length != (index + 1)) && <View className={styles.order_status_line}></View>}
|
{(dataList.length != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||||
<View className={styles.order_status_content}>
|
<View className={styles.order_status_content}>
|
||||||
@ -62,7 +61,7 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
|||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
||||||
<Text>{showMore && '收起详情' || '点击查看详情'}</Text>
|
<Text>{showMore ? '收起详情' : '点击查看详情'}</Text>
|
||||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore && styles.open_miconfonts)}></Text>
|
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore && styles.open_miconfonts)}></Text>
|
||||||
</View>}
|
</View>}
|
||||||
<View className={styles.image_tag}>
|
<View className={styles.image_tag}>
|
||||||
@ -76,4 +75,5 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
|||||||
</View>}
|
</View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderState)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { REFUND_STATUS_ORDER } from '@/common/enum'
|
|||||||
interface Param {
|
interface Param {
|
||||||
status?: number
|
status?: number
|
||||||
}
|
}
|
||||||
export default memo(({ status = 0 }: Param) => {
|
const OrderStatusTag = ({ status = 0 }: Param) => {
|
||||||
const {
|
const {
|
||||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||||
@ -21,4 +21,5 @@ export default memo(({ status = 0 }: Param) => {
|
|||||||
</View>}
|
</View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderStatusTag)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ interface OrderInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PayStatus = 1 | 2 | 3 | 4 | 5 | null // 1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
type PayStatus = 1 | 2 | 3 | 4 | 5 | null // 1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
|
||||||
export default memo(({ show = false, onClose, orderInfo, onSubmitSuccess }: Param) => {
|
const Payment = ({ show = false, onClose, orderInfo, onSubmitSuccess }: Param) => {
|
||||||
// 支付方式枚举
|
// 支付方式枚举
|
||||||
const { PaymentMethodPreDeposit, PaymentMethodAccountPeriod, PaymentMethodCashOnDelivery } = PAYMENT_METHOD
|
const { PaymentMethodPreDeposit, PaymentMethodAccountPeriod, PaymentMethodCashOnDelivery } = PAYMENT_METHOD
|
||||||
// 订单状态枚举
|
// 订单状态枚举
|
||||||
@ -264,4 +264,5 @@ export default memo(({ show = false, onClose, orderInfo, onSubmitSuccess }: Para
|
|||||||
<ScanPay orderInfo={onlinePayData} show={scanPayShow} onClose={() => setScanPayShow(false)} />
|
<ScanPay orderInfo={onlinePayData} show={scanPayShow} onClose={() => setScanPayShow(false)} />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Payment)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ interface ReasonInfoParam {
|
|||||||
onSelect?: (val: object) => void // 选择
|
onSelect?: (val: object) => void // 选择
|
||||||
defaultValue?: number // 默认选中
|
defaultValue?: number // 默认选中
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, title = '', list = [], onSelect, defaultValue }: ReasonInfoParam) => {
|
const ReasonPopup = ({ show = false, onClose, title = '', list = [], onSelect, defaultValue }: ReasonInfoParam) => {
|
||||||
return (
|
return (
|
||||||
<Popup showIconButton={false} show={show} title={title} onClose={onClose} >
|
<Popup showIconButton={false} show={show} title={title} onClose={onClose} >
|
||||||
<View className={styles.reason_return_con}>
|
<View className={styles.reason_return_con}>
|
||||||
@ -26,4 +26,5 @@ export default memo(({ show = false, onClose, title = '', list = [], onSelect, d
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ReasonPopup)
|
||||||
|
|||||||
@ -8,17 +8,13 @@ interface Param {
|
|||||||
onSave?: (val: string) => void
|
onSave?: (val: string) => void
|
||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
}
|
}
|
||||||
export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
const Remark = ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||||
const [descData, setDescData] = useState({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
count: 200,
|
count: 200,
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getDesc(defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
const getDesc = (value) => {
|
const getDesc = (value) => {
|
||||||
let res = value
|
let res = value
|
||||||
if (value.length > descData.count) {
|
if (value.length > descData.count) {
|
||||||
@ -30,6 +26,9 @@ export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
|||||||
const setSave = () => {
|
const setSave = () => {
|
||||||
onSave?.(descData.value)
|
onSave?.(descData.value)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getDesc(defaultValue)
|
||||||
|
}, [defaultValue])
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_popup}>
|
<View className={styles.order_popup}>
|
||||||
<View className={styles.order_popup_title}>编辑备注</View>
|
<View className={styles.order_popup_title}>编辑备注</View>
|
||||||
@ -41,3 +40,4 @@ export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default Remark
|
||||||
|
|||||||
@ -19,7 +19,7 @@ interface Param {
|
|||||||
onSubmit?: () => void
|
onSubmit?: () => void
|
||||||
id?: number
|
id?: number
|
||||||
}
|
}
|
||||||
export default memo(({ show, onClose, onSubmit, id }: Param) => {
|
const ReturnRecord = ({ show, onClose, onSubmit, id }: Param) => {
|
||||||
// 搜索参数
|
// 搜索参数
|
||||||
const searchField = useRef({
|
const searchField = useRef({
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -27,13 +27,6 @@ export default memo(({ show, onClose, onSubmit, id }: Param) => {
|
|||||||
sale_order_id: 0,
|
sale_order_id: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (show && id) {
|
|
||||||
searchField.current.sale_order_id = id
|
|
||||||
getOrderList()
|
|
||||||
}
|
|
||||||
}, [show, id])
|
|
||||||
|
|
||||||
const userInfo = useSelector(state => state.userInfo)
|
const userInfo = useSelector(state => state.userInfo)
|
||||||
|
|
||||||
// 获取售后订单列表
|
// 获取售后订单列表
|
||||||
@ -88,7 +81,12 @@ export default memo(({ show, onClose, onSubmit, id }: Param) => {
|
|||||||
setScrollStatus(false)
|
setScrollStatus(false)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
if (show && id) {
|
||||||
|
searchField.current.sale_order_id = id
|
||||||
|
getOrderList()
|
||||||
|
}
|
||||||
|
}, [show, id])
|
||||||
// 数据加载状态
|
// 数据加载状态
|
||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading })
|
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading })
|
||||||
@ -162,4 +160,5 @@ export default memo(({ show, onClose, onSubmit, id }: Param) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ReturnRecord)
|
||||||
|
|||||||
@ -30,14 +30,32 @@ interface ListParam {
|
|||||||
total_price: string
|
total_price: string
|
||||||
weight_error: string
|
weight_error: string
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
const ScanPay = ({ show = true, onClose, company, orderInfo }: Param) => {
|
||||||
const [detail, setDetail] = useState<any>()
|
const [detail, setDetail] = useState<any>()
|
||||||
|
// 收货地址
|
||||||
|
const address = (addressInfo) => {
|
||||||
|
if (addressInfo?.shipment_mode == 2) {
|
||||||
|
return addressInfo?.province_name ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return addressInfo?.take_goods_address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收件人
|
||||||
|
const userName = (addressInfo) => {
|
||||||
|
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_name : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
const userPhone = (addressInfo) => {
|
||||||
|
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (orderInfo) {
|
if (orderInfo) {
|
||||||
const lists: ListParam[] = []
|
const lists: ListParam[] = []
|
||||||
orderInfo.product_list?.map((pitem) => {
|
orderInfo.product_list?.forEach((pitem) => {
|
||||||
pitem?.product_colors?.map((citem) => {
|
pitem?.product_colors?.forEach((citem) => {
|
||||||
lists.push({
|
lists.push({
|
||||||
product_code: formatRemoveHashTag(pitem.code),
|
product_code: formatRemoveHashTag(pitem.code),
|
||||||
product_name: pitem.name,
|
product_name: pitem.name,
|
||||||
@ -96,26 +114,6 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
}
|
}
|
||||||
}, [orderInfo, show])
|
}, [orderInfo, show])
|
||||||
|
|
||||||
// 收货地址
|
|
||||||
const address = (addressInfo) => {
|
|
||||||
if (addressInfo?.shipment_mode == 2) {
|
|
||||||
return addressInfo?.province_name ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return addressInfo?.take_goods_address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收件人
|
|
||||||
const userName = (addressInfo) => {
|
|
||||||
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_name : ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// 手机号
|
|
||||||
const userPhone = (addressInfo) => {
|
|
||||||
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取支付二维码
|
// 获取支付二维码
|
||||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
||||||
const fileData = useRef({
|
const fileData = useRef({
|
||||||
@ -148,10 +146,6 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
scope: 'scope.writePhotosAlbum',
|
scope: 'scope.writePhotosAlbum',
|
||||||
msg: '您没授权,无法保存图片',
|
msg: '您没授权,无法保存图片',
|
||||||
})
|
})
|
||||||
const saveImageCheck = async() => {
|
|
||||||
const res = await check()
|
|
||||||
res && saveImage()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存图片
|
// 保存图片
|
||||||
const saveImage = () => {
|
const saveImage = () => {
|
||||||
@ -166,7 +160,10 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const saveImageCheck = async() => {
|
||||||
|
const res = await check()
|
||||||
|
res && saveImage()
|
||||||
|
}
|
||||||
// 预览图片
|
// 预览图片
|
||||||
const showImage = () => {
|
const showImage = () => {
|
||||||
console.log('fileData.current.filePath::', fileData.current.filePath)
|
console.log('fileData.current.filePath::', fileData.current.filePath)
|
||||||
@ -201,4 +198,5 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ScanPay)
|
||||||
|
|||||||
@ -29,9 +29,80 @@ interface ListParam {
|
|||||||
total_price: string
|
total_price: string
|
||||||
weight_error: string
|
weight_error: string
|
||||||
}
|
}
|
||||||
export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
const ScanPayCheck = ({ show = true, onClose, company, orderInfo }: Param) => {
|
||||||
const [detail, setDetail] = useState<any>()
|
const [detail, setDetail] = useState<any>()
|
||||||
|
|
||||||
|
// 收货地址
|
||||||
|
const address = (addressInfo) => {
|
||||||
|
if (addressInfo?.shipment_mode == 2) {
|
||||||
|
return addressInfo?.province_name ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return addressInfo?.take_goods_address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收件人
|
||||||
|
const userName = (addressInfo) => {
|
||||||
|
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_name : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
const userPhone = (addressInfo) => {
|
||||||
|
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取支付二维码
|
||||||
|
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
||||||
|
const fileData = useRef({
|
||||||
|
filePath: '',
|
||||||
|
base64: '',
|
||||||
|
})
|
||||||
|
const { fetchData, state } = GetPayCode()
|
||||||
|
const getCore = async() => {
|
||||||
|
const res = await fetchData(detail)
|
||||||
|
const base64 = res.data.base64
|
||||||
|
setPayCodeImage(() => base64)
|
||||||
|
const time = new Date().valueOf()
|
||||||
|
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []
|
||||||
|
const filePath = `${Taro.env.USER_DATA_PATH}/img${time}.${format}`
|
||||||
|
fileData.current.filePath = filePath
|
||||||
|
fileData.current.base64 = bodyData
|
||||||
|
const save = Taro.getFileSystemManager()
|
||||||
|
save.writeFile({
|
||||||
|
filePath: fileData.current.filePath,
|
||||||
|
data: fileData.current.base64,
|
||||||
|
encoding: 'base64',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存图片
|
||||||
|
const saveImage = () => {
|
||||||
|
alert.loading('正在保存图片')
|
||||||
|
Taro.saveImageToPhotosAlbum({
|
||||||
|
filePath: fileData.current.filePath,
|
||||||
|
success() {
|
||||||
|
alert.success('图片保存成功')
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log('err::', err)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 检查是否开启保存图片权限
|
||||||
|
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||||
|
const saveImageCheck = async() => {
|
||||||
|
const res = await check()
|
||||||
|
res && saveImage()
|
||||||
|
}
|
||||||
|
// 预览图片
|
||||||
|
const showImage = () => {
|
||||||
|
console.log('fileData.current.filePath::', fileData.current.filePath)
|
||||||
|
Taro.previewImage({
|
||||||
|
current: fileData.current.filePath, // 当前显示
|
||||||
|
urls: [fileData.current.filePath], // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (show) {
|
if (show) {
|
||||||
getCore()
|
getCore()
|
||||||
@ -41,8 +112,8 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (orderInfo) {
|
if (orderInfo) {
|
||||||
const lists: ListParam[] = []
|
const lists: ListParam[] = []
|
||||||
orderInfo.product_list?.map((pitem) => {
|
orderInfo.product_list?.forEach((pitem) => {
|
||||||
pitem?.product_colors?.map((citem) => {
|
pitem?.product_colors?.forEach((citem) => {
|
||||||
lists.push({
|
lists.push({
|
||||||
product_code: formatRemoveHashTag(pitem.code),
|
product_code: formatRemoveHashTag(pitem.code),
|
||||||
product_name: pitem.name,
|
product_name: pitem.name,
|
||||||
@ -98,81 +169,6 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
// 收货地址
|
|
||||||
const address = (addressInfo) => {
|
|
||||||
if (addressInfo?.shipment_mode == 2) {
|
|
||||||
return addressInfo?.province_name ? addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail : ''
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return addressInfo?.take_goods_address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收件人
|
|
||||||
const userName = (addressInfo) => {
|
|
||||||
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_name : ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// 手机号
|
|
||||||
const userPhone = (addressInfo) => {
|
|
||||||
return addressInfo?.shipment_mode == 2 ? orderInfo.target_user_phone : orderInfo.take_goods_phone
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取支付二维码
|
|
||||||
const [payCodeImage, setPayCodeImage] = useState<string>('')
|
|
||||||
const fileData = useRef({
|
|
||||||
filePath: '',
|
|
||||||
base64: '',
|
|
||||||
})
|
|
||||||
const { fetchData, state } = GetPayCode()
|
|
||||||
const getCore = async() => {
|
|
||||||
const res = await fetchData(detail)
|
|
||||||
const base64 = res.data.base64
|
|
||||||
setPayCodeImage(() => base64)
|
|
||||||
const time = new Date().valueOf()
|
|
||||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []
|
|
||||||
const filePath = `${Taro.env.USER_DATA_PATH}/img${time}.${format}`
|
|
||||||
fileData.current.filePath = filePath
|
|
||||||
fileData.current.base64 = bodyData
|
|
||||||
const save = Taro.getFileSystemManager()
|
|
||||||
save.writeFile({
|
|
||||||
filePath: fileData.current.filePath,
|
|
||||||
data: fileData.current.base64,
|
|
||||||
encoding: 'base64',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否开启保存图片权限
|
|
||||||
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
|
||||||
const saveImageCheck = async() => {
|
|
||||||
const res = await check()
|
|
||||||
res && saveImage()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存图片
|
|
||||||
const saveImage = () => {
|
|
||||||
alert.loading('正在保存图片')
|
|
||||||
Taro.saveImageToPhotosAlbum({
|
|
||||||
filePath: fileData.current.filePath,
|
|
||||||
success() {
|
|
||||||
alert.success('图片保存成功')
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
console.log('err::', err)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 预览图片
|
|
||||||
const showImage = () => {
|
|
||||||
console.log('fileData.current.filePath::', fileData.current.filePath)
|
|
||||||
Taro.previewImage({
|
|
||||||
current: fileData.current.filePath, // 当前显示
|
|
||||||
urls: [fileData.current.filePath], // 需要预览的图片http链接列表
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 复制功能
|
// 复制功能
|
||||||
return (
|
return (
|
||||||
<View className={styles.scanPay_main}>
|
<View className={styles.scanPay_main}>
|
||||||
@ -194,4 +190,5 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ScanPayCheck)
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import styles from './index.module.scss'
|
|||||||
interface Param {
|
interface Param {
|
||||||
onSelect?: (val: number) => void
|
onSelect?: (val: number) => void
|
||||||
}
|
}
|
||||||
export default memo(({ onSelect }: Param) => {
|
const ShipmentMode = ({ onSelect }: Param) => {
|
||||||
// 收货方法 1:自提,2:物流
|
// 收货方法 1:自提,2:物流
|
||||||
const shipmentMode = useRef([
|
const shipmentMode = useRef([
|
||||||
{ value: 1, label: '上门自提', selected: false },
|
{ value: 1, label: '上门自提', selected: false },
|
||||||
@ -20,9 +20,10 @@ export default memo(({ onSelect }: Param) => {
|
|||||||
return (
|
return (
|
||||||
<View className={styles.order_title}>
|
<View className={styles.order_title}>
|
||||||
<Text>收货方式</Text>
|
<Text>收货方式</Text>
|
||||||
{shipmentMode.current.map((item) => {
|
{shipmentMode.current.map((item, key) => {
|
||||||
return <View className={classnames(styles.order_status, (selectValue == item.value) && styles.order_status_selected)} onClick={() => selectShipmentMode(item.value)}>{item.label}</View>
|
return <View key={key} className={classnames(styles.order_status, (selectValue == item.value) && styles.order_status_selected)} onClick={() => selectShipmentMode(item.value)}>{item.label}</View>
|
||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ShipmentMode)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ interface Param {
|
|||||||
priceTitle: string // 描述
|
priceTitle: string // 描述
|
||||||
|
|
||||||
}
|
}
|
||||||
export default memo(({ style, number = 0, priceTitle = '' }: Param) => {
|
const SubmitOrderBtn = ({ style, number = 0, priceTitle = '' }: Param) => {
|
||||||
const priceDom = useCallback(() => {
|
const priceDom = useCallback(() => {
|
||||||
const res = number.toFixed(2).split('.')
|
const res = number.toFixed(2).split('.')
|
||||||
const int_num = `${parseInt(res[0])}`
|
const int_num = `${parseInt(res[0])}`
|
||||||
@ -36,4 +36,5 @@ export default memo(({ style, number = 0, priceTitle = '' }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(SubmitOrderBtn)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Param {
|
|||||||
onCheck?: () => void
|
onCheck?: () => void
|
||||||
onCustom?: () => void
|
onCustom?: () => void
|
||||||
}
|
}
|
||||||
export default memo(({ onCheck, onCustom }: Param) => {
|
const WeightMemo = ({ onCheck, onCustom }: Param) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.weight_memo}>
|
<View className={styles.weight_memo}>
|
||||||
<View className={styles.weight_memo_item} onClick={() => onCheck?.()}>
|
<View className={styles.weight_memo_item} onClick={() => onCheck?.()}>
|
||||||
@ -33,4 +33,5 @@ export default memo(({ onCheck, onCustom }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(WeightMemo)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import useLogin from '@/use/useLogin'
|
|
||||||
import { MovableArea, Text, View } from '@tarojs/components'
|
import { MovableArea, Text, View } from '@tarojs/components'
|
||||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
|
import Taro, { useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
@ -14,6 +13,7 @@ import Remark from './components/remark'
|
|||||||
import ReturnRecord from './components/returnRecord'
|
import ReturnRecord from './components/returnRecord'
|
||||||
import ScanPayCheck from './components/scanPayCheck'
|
import ScanPayCheck from './components/scanPayCheck'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
import useLogin from '@/use/useLogin'
|
||||||
import ShopCart from '@/components/shopCart'
|
import ShopCart from '@/components/shopCart'
|
||||||
import SearchInput from '@/components/searchInput'
|
import SearchInput from '@/components/searchInput'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
@ -25,14 +25,11 @@ import { SubscriptionMessageApi } from '@/api/user'
|
|||||||
import { AddShoppingCartApi } from '@/api/shopCart'
|
import { AddShoppingCartApi } from '@/api/shopCart'
|
||||||
import { EditSaleOrderRemarkApi, GetSaleOrderDetailApi } from '@/api/order'
|
import { EditSaleOrderRemarkApi, GetSaleOrderDetailApi } from '@/api/order'
|
||||||
|
|
||||||
export default () => {
|
const Order = () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const orderId = useRef<number>(Number(router.params.id))
|
const orderId = useRef<number>(Number(router.params.id))
|
||||||
useDidShow(() => {
|
|
||||||
getSaleOrderPreView()
|
|
||||||
})
|
|
||||||
|
|
||||||
// 订单状态枚举
|
// 订单状态枚举
|
||||||
const {
|
const {
|
||||||
@ -50,6 +47,13 @@ export default () => {
|
|||||||
const firstOpen = useRef(true)
|
const firstOpen = useRef(true)
|
||||||
const [orderDetail, setOrderDetail] = useState<any>() // 获取到的原始数据
|
const [orderDetail, setOrderDetail] = useState<any>() // 获取到的原始数据
|
||||||
const { fetchData: getOrderFetchData } = GetSaleOrderDetailApi()
|
const { fetchData: getOrderFetchData } = GetSaleOrderDetailApi()
|
||||||
|
const [orderRemark, setOrderRemark] = useState('')
|
||||||
|
|
||||||
|
// 去付款
|
||||||
|
const [payMentShow, setPayMentShow] = useState(false)
|
||||||
|
const toPay = () => {
|
||||||
|
setPayMentShow(true)
|
||||||
|
}
|
||||||
const getSaleOrderPreView = async() => {
|
const getSaleOrderPreView = async() => {
|
||||||
if (orderId.current) {
|
if (orderId.current) {
|
||||||
const res = await getOrderFetchData({ id: orderId.current })
|
const res = await getOrderFetchData({ id: orderId.current })
|
||||||
@ -65,11 +69,6 @@ export default () => {
|
|||||||
// Taro.hideToast()
|
// Taro.hideToast()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听获取到的数据
|
|
||||||
useEffect(() => {
|
|
||||||
if (orderDetail) { formatData() }
|
|
||||||
}, [orderDetail])
|
|
||||||
|
|
||||||
// 格式化数据格式
|
// 格式化数据格式
|
||||||
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() // 格式化后的数据
|
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() // 格式化后的数据
|
||||||
const formatData = () => {
|
const formatData = () => {
|
||||||
@ -116,7 +115,6 @@ export default () => {
|
|||||||
|
|
||||||
// 订单备注
|
// 订单备注
|
||||||
const { fetchData: remarkFetchData } = EditSaleOrderRemarkApi()
|
const { fetchData: remarkFetchData } = EditSaleOrderRemarkApi()
|
||||||
const [orderRemark, setOrderRemark] = useState('')
|
|
||||||
const getRemark = useCallback(async(e) => {
|
const getRemark = useCallback(async(e) => {
|
||||||
setOrderRemark(() => e)
|
setOrderRemark(() => e)
|
||||||
const res = await remarkFetchData({ remark: e, id: orderId.current })
|
const res = await remarkFetchData({ remark: e, id: orderId.current })
|
||||||
@ -143,12 +141,6 @@ export default () => {
|
|||||||
setShowDesc(() => true)
|
setShowDesc(() => true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去付款
|
|
||||||
const [payMentShow, setPayMentShow] = useState(false)
|
|
||||||
const toPay = () => {
|
|
||||||
setPayMentShow(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打开地址修改
|
// 打开地址修改
|
||||||
const addressRef = useRef<any>(null)
|
const addressRef = useRef<any>(null)
|
||||||
|
|
||||||
@ -162,53 +154,24 @@ export default () => {
|
|||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
|
|
||||||
// 获取底部按钮点击, 获取按钮状态
|
|
||||||
const orderStateClick = useCallback(
|
|
||||||
(val) => {
|
|
||||||
if (val == 1 || val == 6 || val == 8) {
|
|
||||||
getSaleOrderPreView()
|
|
||||||
}
|
|
||||||
else if (val == 2) {
|
|
||||||
// 待付款
|
|
||||||
toPay()
|
|
||||||
}
|
|
||||||
else if (val == 3) {
|
|
||||||
// 申请退款
|
|
||||||
if (!orderDetail?.av_return_roll) { return alert.none('该订单已申请过退款') }
|
|
||||||
setRefundShow(true)
|
|
||||||
}
|
|
||||||
else if (val == 7) {
|
|
||||||
// 再购
|
|
||||||
addShopCart()
|
|
||||||
}
|
|
||||||
else if (val == 9) {
|
|
||||||
// 售后记录
|
|
||||||
onReturnRecordShow()
|
|
||||||
}
|
|
||||||
else if (val == 10) {
|
|
||||||
setShowScanPayCheck(true)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[orderDetail],
|
|
||||||
)
|
|
||||||
|
|
||||||
// 页面下拉刷新
|
// 页面下拉刷新
|
||||||
usePullDownRefresh(() => {
|
usePullDownRefresh(() => {
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useDidShow(() => {
|
||||||
|
getSaleOrderPreView()
|
||||||
|
})
|
||||||
|
// 关闭支付弹窗
|
||||||
|
const closePayShow = useCallback(() => {
|
||||||
|
setPayMentShow(() => false)
|
||||||
|
}, [orderDetail])
|
||||||
// 支付成功
|
// 支付成功
|
||||||
const onPaySuccess = useCallback(() => {
|
const onPaySuccess = useCallback(() => {
|
||||||
alert.success('支付成功')
|
alert.success('支付成功')
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
closePayShow()
|
closePayShow()
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
|
|
||||||
// 关闭支付弹窗
|
|
||||||
const closePayShow = useCallback(() => {
|
|
||||||
setPayMentShow(() => false)
|
|
||||||
}, [orderDetail])
|
|
||||||
|
|
||||||
// 按钮所需数据
|
// 按钮所需数据
|
||||||
const orderInfo = useMemo(() => {
|
const orderInfo = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
@ -251,7 +214,7 @@ export default () => {
|
|||||||
const { fetchData: addFetchData } = AddShoppingCartApi()
|
const { fetchData: addFetchData } = AddShoppingCartApi()
|
||||||
const addShopCart = async() => {
|
const addShopCart = async() => {
|
||||||
const color_list: { product_color_id: number; roll?: number; length?: number }[] = []
|
const color_list: { product_color_id: number; roll?: number; length?: number }[] = []
|
||||||
orderDetail?.product_list.map((pitem) => {
|
orderDetail?.product_list.forEach((pitem) => {
|
||||||
pitem?.product_colors.map((citem) => {
|
pitem?.product_colors.map((citem) => {
|
||||||
if (orderDetail?.sale_mode == 0) {
|
if (orderDetail?.sale_mode == 0) {
|
||||||
return color_list.push({ product_color_id: citem.id, roll: citem.roll })
|
return color_list.push({ product_color_id: citem.id, roll: citem.roll })
|
||||||
@ -278,7 +241,10 @@ export default () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 监听获取到的数据
|
||||||
|
useEffect(() => {
|
||||||
|
if (orderDetail) { formatData() }
|
||||||
|
}, [orderDetail])
|
||||||
// 显示售后记录
|
// 显示售后记录
|
||||||
const [returnRecordShow, setReturnRecordShow] = useState(false)
|
const [returnRecordShow, setReturnRecordShow] = useState(false)
|
||||||
const onReturnRecordShow = useCallback(() => {
|
const onReturnRecordShow = useCallback(() => {
|
||||||
@ -290,7 +256,35 @@ export default () => {
|
|||||||
|
|
||||||
// 显示
|
// 显示
|
||||||
const [showScanPayCheck, setShowScanPayCheck] = useState(false)
|
const [showScanPayCheck, setShowScanPayCheck] = useState(false)
|
||||||
|
// 获取底部按钮点击, 获取按钮状态
|
||||||
|
const orderStateClick = useCallback(
|
||||||
|
(val) => {
|
||||||
|
if (val == 1 || val == 6 || val == 8) {
|
||||||
|
getSaleOrderPreView()
|
||||||
|
}
|
||||||
|
else if (val == 2) {
|
||||||
|
// 待付款
|
||||||
|
toPay()
|
||||||
|
}
|
||||||
|
else if (val == 3) {
|
||||||
|
// 申请退款
|
||||||
|
if (!orderDetail?.av_return_roll) { return alert.none('该订单已申请过退款') }
|
||||||
|
setRefundShow(true)
|
||||||
|
}
|
||||||
|
else if (val == 7) {
|
||||||
|
// 再购
|
||||||
|
addShopCart()
|
||||||
|
}
|
||||||
|
else if (val == 9) {
|
||||||
|
// 售后记录
|
||||||
|
onReturnRecordShow()
|
||||||
|
}
|
||||||
|
else if (val == 10) {
|
||||||
|
setShowScanPayCheck(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[orderDetail],
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
<MovableAreaBtn orderInfo={orderDetail}>
|
<MovableAreaBtn orderInfo={orderDetail}>
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
@ -352,3 +346,4 @@ export default () => {
|
|||||||
</MovableAreaBtn>
|
</MovableAreaBtn>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default Order
|
||||||
|
|||||||
@ -39,7 +39,7 @@ interface Param {
|
|||||||
}
|
}
|
||||||
onClickBtn?: (val: { status: number; orderInfo: Param['value'] }) => void
|
onClickBtn?: (val: { status: number; orderInfo: Param['value'] }) => void
|
||||||
}
|
}
|
||||||
export default memo(({ value, onClickBtn }: Param) => {
|
const Order = ({ value, onClickBtn }: Param) => {
|
||||||
const userInfo = useSelector(state => state.userInfo)
|
const userInfo = useSelector(state => state.userInfo)
|
||||||
// 对应数量
|
// 对应数量
|
||||||
const formatCount = useCallback(
|
const formatCount = useCallback(
|
||||||
@ -161,4 +161,5 @@ export default memo(({ value, onClickBtn }: Param) => {
|
|||||||
<OrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} showStatus="list" />
|
<OrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} showStatus="list" />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Order)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Param {
|
|||||||
defaultId?: number
|
defaultId?: number
|
||||||
onSelect?: (val: number) => void
|
onSelect?: (val: number) => void
|
||||||
}
|
}
|
||||||
export default memo(({ list = [], defaultId = -1, onSelect }: Param) => {
|
const OrderStatusList = ({ list = [], defaultId = -1, onSelect }: Param) => {
|
||||||
const [selectInfo, setSelectInfo] = useState({
|
const [selectInfo, setSelectInfo] = useState({
|
||||||
selected: -1, // 当前选中的id
|
selected: -1, // 当前选中的id
|
||||||
tabId: '', // 需要滚动到的id
|
tabId: '', // 需要滚动到的id
|
||||||
@ -49,4 +49,5 @@ export default memo(({ list = [], defaultId = -1, onSelect }: Param) => {
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderStatusList)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user