🐳 chore(eslint): 修正所有文件的eslint 错误❌
This commit is contained in:
@@ -4,11 +4,11 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import Search from '@/components/search'
|
||||
import { mpcashManagementOrderaccount } from '@/api/newCollection'
|
||||
import { MpCashManagementOrderAccount } from '@/api/newCollection'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
|
||||
export default () => {
|
||||
const AccountPage = () => {
|
||||
const [search, setSearch] = useState({
|
||||
search_name: null,
|
||||
page: 1,
|
||||
@@ -16,7 +16,7 @@ export default () => {
|
||||
})
|
||||
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||
|
||||
const { fetchData: clitentFetch, state: orderState } = mpcashManagementOrderaccount()
|
||||
const { fetchData: clitentFetch, state: orderState } = MpCashManagementOrderAccount()
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading! })
|
||||
@@ -27,22 +27,8 @@ export default () => {
|
||||
bankName: '',
|
||||
})
|
||||
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((eq) => {
|
||||
pageNum.current.page = 1
|
||||
setClientlist(() => ({ list: [], total: 0 }))
|
||||
setSearch(e => ({ ...e, search_name: eq, size: 10 }))
|
||||
}, [])
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (search.search_name === '') {
|
||||
setSearch(e => ({ ...e, search_name: null }))
|
||||
}
|
||||
if (search.search_name !== '') { getCuss() }
|
||||
}, [search])
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
const getScrolltolower = useCallback(() => {
|
||||
@@ -54,6 +40,13 @@ export default () => {
|
||||
}
|
||||
}, [clentList])
|
||||
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((eq) => {
|
||||
pageNum.current.page = 1
|
||||
setClientlist(() => ({ list: [], total: 0 }))
|
||||
setSearch(e => ({ ...e, search_name: eq, size: 10 }))
|
||||
}, [])
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async() => {
|
||||
@@ -77,6 +70,12 @@ export default () => {
|
||||
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (search.search_name === '') {
|
||||
setSearch(e => ({ ...e, search_name: null }))
|
||||
}
|
||||
if (search.search_name !== '') { getCuss() }
|
||||
}, [search])
|
||||
// 选择业务员
|
||||
const selectClient = (item) => {
|
||||
clentList.list.map((it) => {
|
||||
@@ -146,3 +145,5 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default AccountPage
|
||||
|
||||
@@ -6,11 +6,10 @@ import styles from './index.module.scss'
|
||||
import FromList from '@/components/FromList'
|
||||
import Address from '@/components/address'
|
||||
import { alert } from '@/common/common'
|
||||
import { mppurchaseraddress, mppurchaseraddressdelect, mppurchaseraddressget, mppurchaseraddressput } from '@/api/addressList'
|
||||
import { getFilterData } from '@/common/util'
|
||||
import { MpPurchaserAddress, MpPurchaserAddressDelete, MpPurchaserAddressGet, MpPurchaserAddressPut } from '@/api/addressList'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
export default () => {
|
||||
const AddAddress = () => {
|
||||
const [itemList, setItemList] = useState<any[]>(
|
||||
[
|
||||
{
|
||||
@@ -54,22 +53,6 @@ export default () => {
|
||||
)
|
||||
|
||||
const [ischecked, setIsChecked] = useState(false)
|
||||
const onChange = (eq) => {
|
||||
setIsChecked(eq.detail.value)
|
||||
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
useDidShow(() => {
|
||||
if (router.params.type === 'add') {
|
||||
setNavigationBarTitle({ title: '新增收货地址' })
|
||||
}
|
||||
else {
|
||||
setFormData(e => ({ ...e, id: router.params.id as any }))
|
||||
getInfo()
|
||||
setNavigationBarTitle({ title: '编辑收货地址' })
|
||||
}
|
||||
})
|
||||
const [formData, setFormData] = useState({
|
||||
name: '',
|
||||
phone: '',
|
||||
@@ -81,8 +64,15 @@ export default () => {
|
||||
id: '',
|
||||
factory: '',
|
||||
})
|
||||
const onChange = (eq) => {
|
||||
setIsChecked(eq.detail.value)
|
||||
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 获取相应id的信息
|
||||
const { fetchData: infoFetch } = mppurchaseraddressget()
|
||||
const { fetchData: infoFetch } = MpPurchaserAddressGet()
|
||||
const [infoObj, setinfoObj] = useState<any>()
|
||||
const getInfo = async() => {
|
||||
const res = await infoFetch({
|
||||
@@ -116,7 +106,7 @@ export default () => {
|
||||
item.value = res.data.phone
|
||||
}
|
||||
if (item.title === '收货地址') {
|
||||
item.value = res.data.province_name, res.data.city_name, res.data.district_name
|
||||
item.value = `${res.data.province_name}${res.data.city_name}${res.data.district_name}`
|
||||
}
|
||||
if (item.title === '详细地址') {
|
||||
item.value = res.data.address_detail
|
||||
@@ -131,13 +121,20 @@ export default () => {
|
||||
}
|
||||
}
|
||||
// `${res.data.province_name} + ${res.data.city_name} + ${res.data.district_name}`
|
||||
|
||||
useDidShow(() => {
|
||||
if (router.params.type === 'add') {
|
||||
setNavigationBarTitle({ title: '新增收货地址' })
|
||||
}
|
||||
else {
|
||||
setFormData(e => ({ ...e, id: router.params.id as any }))
|
||||
getInfo()
|
||||
setNavigationBarTitle({ title: '编辑收货地址' })
|
||||
}
|
||||
})
|
||||
const btnDisabled = useMemo(() => {
|
||||
let canShow = false
|
||||
const obj = itemList.filter((item) => {
|
||||
if (item.require) {
|
||||
return item.value !== ''
|
||||
}
|
||||
return item.require && (item.value !== '')
|
||||
})
|
||||
if (obj.length < 4) {
|
||||
canShow = true
|
||||
@@ -214,7 +211,7 @@ export default () => {
|
||||
})
|
||||
}
|
||||
// 新增地址
|
||||
const { fetchData: addAddressFetch } = mppurchaseraddress()
|
||||
const { fetchData: addAddressFetch } = MpPurchaserAddress()
|
||||
const handAdd = async() => {
|
||||
// if (!btnDisabled) return false
|
||||
const res = await addAddressFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id) })
|
||||
@@ -233,7 +230,7 @@ export default () => {
|
||||
}
|
||||
|
||||
// 编辑地址
|
||||
const { fetchData: putFetch } = mppurchaseraddressput()
|
||||
const { fetchData: putFetch } = MpPurchaserAddressPut()
|
||||
const handEdit = async() => {
|
||||
// if (!btnDisabled) return false
|
||||
const res = await putFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id), id: Number(infoObj?.id) })
|
||||
@@ -251,7 +248,7 @@ export default () => {
|
||||
}
|
||||
}
|
||||
// 删除地址
|
||||
const { fetchData: deleteFetch } = mppurchaseraddressdelect()
|
||||
const { fetchData: deleteFetch } = MpPurchaserAddressDelete()
|
||||
const handleDelete = async() => {
|
||||
Taro.showModal(({
|
||||
title: '提示',
|
||||
@@ -334,3 +331,5 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default AddAddress
|
||||
|
||||
@@ -30,8 +30,7 @@ interface Params {
|
||||
bigMoney?: any // 展示的大写金额,
|
||||
isOpen?: boolean // 是否展开状态
|
||||
}
|
||||
|
||||
export default memo((pros: Params) => {
|
||||
const Form = (pros: Params) => {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
@@ -98,4 +97,5 @@ export default memo((pros: Params) => {
|
||||
}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Form)
|
||||
|
||||
@@ -5,26 +5,17 @@ import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import Form from './components/form'
|
||||
import {
|
||||
mpcashManagementOrderaccount, mpcashManagementOrderpost,
|
||||
mpshouldCollectOrderpurchaser,
|
||||
MpCashManagementOrderAccount, MpCashManagementOrderPost,
|
||||
MpShouldCollectOrderPurchaser,
|
||||
} from '@/api/newCollection'
|
||||
import { alert } from '@/common/common'
|
||||
import smallToBig from '@/common/money'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
export default () => {
|
||||
const AddCollection = () => {
|
||||
// 获取选择的客户
|
||||
const pages = Taro.getCurrentPages()
|
||||
const currPage = pages[pages.length - 1] // 获取当前页面
|
||||
useDidShow(() => {
|
||||
setQuery(e => ({
|
||||
...e,
|
||||
purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : Query.purchaser_id,
|
||||
clientName: currPage.data?.clientName ? currPage.data?.clientName : Query.clientName,
|
||||
bankId: currPage.data?.bankId ? currPage.data?.bankId : Query.bankId,
|
||||
bankName: currPage.data?.bankName ? currPage.data?.bankName : Query.bankName,
|
||||
}))
|
||||
})
|
||||
|
||||
const [Query, setQuery] = useState<any>({})
|
||||
|
||||
@@ -35,12 +26,8 @@ export default () => {
|
||||
setQuery(val => ({ ...val, picList: list }))
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
getCuss()
|
||||
}, [])
|
||||
|
||||
// 获取首个银行账号
|
||||
const { fetchData: clitentFetch } = mpcashManagementOrderaccount()
|
||||
const { fetchData: clitentFetch } = MpCashManagementOrderAccount()
|
||||
const getCuss = async() => {
|
||||
const res = await clitentFetch({ page: 1, size: 10 })
|
||||
if (res.data) {
|
||||
@@ -48,7 +35,7 @@ export default () => {
|
||||
}
|
||||
}
|
||||
|
||||
const { fetchData: scanFetch } = mpshouldCollectOrderpurchaser()
|
||||
const { fetchData: scanFetch } = MpShouldCollectOrderPurchaser()
|
||||
// 扫描
|
||||
const handScan = (e) => {
|
||||
e.stopPropagation()
|
||||
@@ -81,7 +68,18 @@ export default () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
useDidShow(() => {
|
||||
setQuery(e => ({
|
||||
...e,
|
||||
purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : Query.purchaser_id,
|
||||
clientName: currPage.data?.clientName ? currPage.data?.clientName : Query.clientName,
|
||||
bankId: currPage.data?.bankId ? currPage.data?.bankId : Query.bankId,
|
||||
bankName: currPage.data?.bankName ? currPage.data?.bankName : Query.bankName,
|
||||
}))
|
||||
})
|
||||
useEffect(() => {
|
||||
getCuss()
|
||||
}, [])
|
||||
// 判断是否可以提交
|
||||
const isDisabled = useMemo(() => {
|
||||
if (Query.clientName == ''
|
||||
@@ -125,7 +123,7 @@ export default () => {
|
||||
}
|
||||
|
||||
// 确认新建
|
||||
const { fetchData: sureFetch } = mpcashManagementOrderpost()
|
||||
const { fetchData: sureFetch } = MpCashManagementOrderPost()
|
||||
const handSure = () => {
|
||||
const query = {
|
||||
payment_credential_url: picUrl.current,
|
||||
@@ -279,3 +277,5 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default AddCollection
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useState } from 'react'
|
||||
import AddressList from '@/components/AddressList'
|
||||
import './index.scss'
|
||||
|
||||
export default () => {
|
||||
const AddressManager = () => {
|
||||
const router = useRouter()
|
||||
return (
|
||||
<View className="address-manager">
|
||||
@@ -13,3 +13,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
export default AddressManager
|
||||
|
||||
+119
-123
@@ -5,21 +5,99 @@ import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpenumreturnExplain,
|
||||
mpenumreturnOrderreturnReason,
|
||||
mpenumreturngoodsStatus,
|
||||
mpreturnApplyOrder,
|
||||
mpsaleOrder,
|
||||
MpEnumReturnExplain,
|
||||
MpEnumReturnGoodsStatus,
|
||||
MpEnumReturnOrderReturnReason,
|
||||
MpReturnApplyOrder,
|
||||
MpSaleOrder,
|
||||
} from '@/api/order'
|
||||
import Popup from '@/components/popup'
|
||||
import UploadImage from '@/components/uploadImage'
|
||||
|
||||
export default () => {
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
handTui?: (any) => void
|
||||
handCancel?: (any) => void
|
||||
onBlur?: (e: any, obj: any) => void
|
||||
onInputEven?: (e: any, obj: any) => void
|
||||
handReduce?: (any) => void
|
||||
handAdd?: (any) => void
|
||||
}
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||
// const [value, setValue] = useState<any>({ count: 1 })
|
||||
// const onInputEven = (e) => {
|
||||
// let res = Number(e.detail.value)
|
||||
// if (res < 1) {
|
||||
// setValue({ count: 1 })
|
||||
// } else {
|
||||
// setValue({ count: res })
|
||||
// }
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.av_product_color.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
{
|
||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||
<View className={styles.reduce}></View>
|
||||
</View>
|
||||
<View className={styles.inputBig}>
|
||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||
</View>
|
||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||
+
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const ApplyGoods = () => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
const { fetchData: infoFetch } = mpsaleOrder()
|
||||
|
||||
const { fetchData: infoFetch } = MpSaleOrder()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
const [ListArr, setListArr] = useState<any[]>([])
|
||||
// 获取订单详情
|
||||
@@ -31,7 +109,7 @@ export default () => {
|
||||
const res = await infoFetch({ id: router.params.orderId })
|
||||
if (res.data) {
|
||||
res.data.av_return_product.forEach((item) => {
|
||||
item.av_product_color.map((it) => {
|
||||
item.av_product_color.forEach((it) => {
|
||||
it.isTui = false
|
||||
it.nums = 1
|
||||
})
|
||||
@@ -132,16 +210,12 @@ export default () => {
|
||||
// 点击加
|
||||
const handAdd = (val) => {
|
||||
ListArr.forEach((item) => {
|
||||
item.av_product_color.map((it) => {
|
||||
item.av_product_color.forEach((it) => {
|
||||
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
||||
if (it.nums < it.roll) {
|
||||
it.nums++
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
}
|
||||
return it
|
||||
})
|
||||
})
|
||||
setListArr([...ListArr])
|
||||
@@ -159,6 +233,10 @@ export default () => {
|
||||
return arr.length
|
||||
}, [ListArr])
|
||||
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
|
||||
// 获取图片列表
|
||||
const picUrl = useRef([])
|
||||
const getImageList = useCallback((list) => {
|
||||
@@ -168,11 +246,6 @@ export default () => {
|
||||
// 筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
getReason()
|
||||
getReasonTwo()
|
||||
}, [])
|
||||
|
||||
const queryRef = useRef(
|
||||
{
|
||||
return_reason: 1, // 退货原因
|
||||
@@ -210,7 +283,7 @@ export default () => {
|
||||
}, [Query, totalNums])
|
||||
|
||||
/// 获取退货原因
|
||||
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
|
||||
const { fetchData: resonFetch } = MpEnumReturnOrderReturnReason()
|
||||
const [ReasonList, setReasonList] = useState<any[]>([])
|
||||
const getReason = async() => {
|
||||
const res = await resonFetch()
|
||||
@@ -220,7 +293,7 @@ export default () => {
|
||||
}
|
||||
|
||||
// 获取退货原因2
|
||||
const { fetchData: resonTwoFetch } = mpenumreturnExplain()
|
||||
const { fetchData: resonTwoFetch } = MpEnumReturnExplain()
|
||||
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
|
||||
const getReasonTwo = async() => {
|
||||
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
|
||||
@@ -264,7 +337,18 @@ export default () => {
|
||||
|
||||
// queryRef.current.return_explain = item.id
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getReason()
|
||||
getReasonTwo()
|
||||
}, [])
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
// 重置
|
||||
const handReset = () => {
|
||||
queryRef.current.return_reason = 1
|
||||
@@ -279,15 +363,6 @@ export default () => {
|
||||
setReasonListTwo([...arrTwo])
|
||||
}
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
|
||||
// 判断选择原因
|
||||
const selectIsDisabled = useMemo(() => {
|
||||
if (Query.return_explain !== '') {
|
||||
@@ -327,18 +402,18 @@ export default () => {
|
||||
|
||||
// 货物情况
|
||||
const [DescPopup, setDescPopup] = useState(false)
|
||||
const { fetchData: statusFetch } = mpenumreturngoodsStatus()
|
||||
const { fetchData: statusFetch } = MpEnumReturnGoodsStatus()
|
||||
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
|
||||
useEffect(() => {
|
||||
getGoodStatus()
|
||||
}, [])
|
||||
|
||||
const getGoodStatus = async() => {
|
||||
const res = await statusFetch()
|
||||
if (res.data) {
|
||||
setGoodStatusList(res.data.list)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getGoodStatus()
|
||||
}, [])
|
||||
const handStatus = (item) => {
|
||||
GoodStatusList.map((it) => {
|
||||
if (it.id === item.id) {
|
||||
@@ -389,9 +464,10 @@ export default () => {
|
||||
delta: 1,
|
||||
})
|
||||
}
|
||||
|
||||
// 备注信息
|
||||
const [TextareaValue, setTextareaValue] = useState('')
|
||||
// 确认退货
|
||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
||||
const { fetchData: sureFetch } = MpReturnApplyOrder()
|
||||
const handSure = () => {
|
||||
if (Query.reasonNameTwo == '其他问题' && TextareaValue == '') {
|
||||
Taro.showToast({
|
||||
@@ -458,15 +534,13 @@ export default () => {
|
||||
setQuery(Query)
|
||||
}, [Query])
|
||||
|
||||
// 备注信息
|
||||
const [TextareaValue, setTextareaValue] = useState('')
|
||||
const getDesc = (e) => {
|
||||
setTextareaValue(e)
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.bgBox}>
|
||||
<GoodsItem
|
||||
<GoodsItemWithMemo
|
||||
list={ListArr}
|
||||
obj={infoObj}
|
||||
handTui={item => handTui(item)}
|
||||
@@ -475,7 +549,7 @@ export default () => {
|
||||
handReduce={item => handReduce(item)}
|
||||
handAdd={item => handAdd(item)}
|
||||
onInputEven={(e, item) => onInputEven(e, item)}
|
||||
></GoodsItem>
|
||||
></GoodsItemWithMemo>
|
||||
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
||||
</View>
|
||||
<View className={styles.resonBig}>
|
||||
@@ -589,82 +663,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
handTui?: (any) => void
|
||||
handCancel?: (any) => void
|
||||
onBlur?: (e: any, obj: any) => void
|
||||
onInputEven?: (e: any, obj: any) => void
|
||||
handReduce?: (any) => void
|
||||
handAdd?: (any) => void
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||
// const [value, setValue] = useState<any>({ count: 1 })
|
||||
// const onInputEven = (e) => {
|
||||
// let res = Number(e.detail.value)
|
||||
// if (res < 1) {
|
||||
// setValue({ count: 1 })
|
||||
// } else {
|
||||
// setValue({ count: res })
|
||||
// }
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.av_product_color.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
{
|
||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||
<View className={styles.reduce}></View>
|
||||
</View>
|
||||
<View className={styles.inputBig}>
|
||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||
</View>
|
||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||
+
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default ApplyGoods
|
||||
|
||||
+112
-116
@@ -5,19 +5,96 @@ import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpenumrefundExplainone,
|
||||
mpreturnApplyOrder,
|
||||
mpsaleOrder,
|
||||
MpEnumRefundExplainOne,
|
||||
MpReturnApplyOrder,
|
||||
MpSaleOrder,
|
||||
} from '@/api/order'
|
||||
import Popup from '@/components/popup'
|
||||
|
||||
export default () => {
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
getEnum()
|
||||
}, [])
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
handTui?: (any) => void
|
||||
handCancel?: (any) => void
|
||||
onBlur?: (e: any, obj: any) => void
|
||||
onInputEven?: (e: any, obj: any) => void
|
||||
handReduce?: (any) => void
|
||||
handAdd?: (any) => void
|
||||
}
|
||||
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||
// const [value, setValue] = useState<any>({ count: 1 })
|
||||
// const onInputEven = (e) => {
|
||||
// let res = Number(e.detail.value)
|
||||
// if (res < 1) {
|
||||
// setValue({ count: 1 })
|
||||
// } else {
|
||||
// setValue({ count: res })
|
||||
// }
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.av_product_color.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
{
|
||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||
<View className={styles.reduce}></View>
|
||||
</View>
|
||||
<View className={styles.inputBig}>
|
||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||
</View>
|
||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||
+
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const ApplyMoney = () => {
|
||||
const Router = useRouter()
|
||||
const { fetchData: infoFetch } = mpsaleOrder()
|
||||
const { fetchData: infoFetch } = MpSaleOrder()
|
||||
const [ListArr, setListArr] = useState<any[]>([])
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
|
||||
@@ -30,7 +107,7 @@ export default () => {
|
||||
const res = await infoFetch({ id: Router.params.orderId })
|
||||
if (res.data) {
|
||||
res.data.av_return_product.forEach((item) => {
|
||||
item.av_product_color.map((it) => {
|
||||
item.av_product_color.forEach((it) => {
|
||||
it.isTui = false
|
||||
it.nums = 1
|
||||
})
|
||||
@@ -132,16 +209,12 @@ export default () => {
|
||||
// 点击加
|
||||
const handAdd = (val) => {
|
||||
ListArr.forEach((item) => {
|
||||
item.av_product_color.map((it) => {
|
||||
item.av_product_color.forEach((it) => {
|
||||
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
||||
if (it.nums < it.roll) {
|
||||
it.nums++
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
}
|
||||
return it
|
||||
})
|
||||
})
|
||||
setListArr([...ListArr])
|
||||
@@ -149,14 +222,20 @@ export default () => {
|
||||
|
||||
// 获取枚举
|
||||
const [List, setList] = useState<any[]>([])
|
||||
const { fetchData: explanFetch } = mpenumrefundExplainone()
|
||||
const { fetchData: explanFetch } = MpEnumRefundExplainOne()
|
||||
const getEnum = async() => {
|
||||
const res = await explanFetch()
|
||||
if (res.data) {
|
||||
setList(res.data.list)
|
||||
}
|
||||
}
|
||||
|
||||
const queryRef = useRef({
|
||||
reasonName: '请选择',
|
||||
})
|
||||
const [Query, setQuery] = useState<any>({
|
||||
reasonId: '',
|
||||
reasonName: '请选择',
|
||||
})
|
||||
// 选择退货原因
|
||||
const handReasonOne = (item) => {
|
||||
List.map((it) => {
|
||||
@@ -176,14 +255,6 @@ export default () => {
|
||||
// 筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
|
||||
const queryRef = useRef({
|
||||
reasonName: '请选择',
|
||||
})
|
||||
const [Query, setQuery] = useState<any>({
|
||||
reasonId: '',
|
||||
reasonName: '请选择',
|
||||
})
|
||||
|
||||
// 备注信息
|
||||
const [TextareaValue, setTextareaValue] = useState('')
|
||||
const getDesc = (e) => {
|
||||
@@ -214,7 +285,14 @@ export default () => {
|
||||
})
|
||||
return arr.length
|
||||
}, [ListArr])
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
// 重置
|
||||
const handReset = () => {
|
||||
setQuery(({ reasonId: '', reasonName: '请选择' }))
|
||||
@@ -251,17 +329,13 @@ export default () => {
|
||||
return true
|
||||
}
|
||||
}, [Query])
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
getEnum()
|
||||
}, [])
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
// 确认退款
|
||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
||||
const { fetchData: sureFetch } = MpReturnApplyOrder()
|
||||
const handSure = () => {
|
||||
if (queryRef.current.reasonName == '其他问题' && TextareaValue == '') {
|
||||
Taro.showToast({
|
||||
@@ -354,7 +428,7 @@ export default () => {
|
||||
<View className={styles.main}>
|
||||
{
|
||||
showItem && <View className={styles.bgBox}>
|
||||
<GoodsItem
|
||||
<GoodsItemWithMemo
|
||||
list={ListArr}
|
||||
obj={infoObj}
|
||||
handTui={item => handTui(item)}
|
||||
@@ -363,7 +437,7 @@ export default () => {
|
||||
handReduce={item => handReduce(item)}
|
||||
handAdd={item => handAdd(item)}
|
||||
onInputEven={(e, item) => onInputEven(e, item)}
|
||||
></GoodsItem>
|
||||
></GoodsItemWithMemo>
|
||||
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
||||
</View>
|
||||
}
|
||||
@@ -435,82 +509,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
handTui?: (any) => void
|
||||
handCancel?: (any) => void
|
||||
onBlur?: (e: any, obj: any) => void
|
||||
onInputEven?: (e: any, obj: any) => void
|
||||
handReduce?: (any) => void
|
||||
handAdd?: (any) => void
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||
// const [value, setValue] = useState<any>({ count: 1 })
|
||||
// const onInputEven = (e) => {
|
||||
// let res = Number(e.detail.value)
|
||||
// if (res < 1) {
|
||||
// setValue({ count: 1 })
|
||||
// } else {
|
||||
// setValue({ count: res })
|
||||
// }
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.av_product_color.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
{
|
||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||
}
|
||||
{
|
||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||
<View className={styles.reduce}></View>
|
||||
</View>
|
||||
<View className={styles.inputBig}>
|
||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||
</View>
|
||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||
+
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default ApplyMoney
|
||||
|
||||
@@ -29,8 +29,7 @@ interface Params {
|
||||
showSizeFont?: boolean // 展示金额的大写
|
||||
bigMoney?: any // 展示的大写金额
|
||||
}
|
||||
|
||||
export default memo((pros: Params) => {
|
||||
const Form = (pros: Params) => {
|
||||
return (
|
||||
<View className={styles.itemBox}
|
||||
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}
|
||||
@@ -98,4 +97,5 @@ export default memo((pros: Params) => {
|
||||
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Form)
|
||||
|
||||
@@ -11,20 +11,15 @@ import Popup from '@/components/popup'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpcashManagementOrder,
|
||||
MpCashManagementOrder,
|
||||
} from '@/api/newCollection'
|
||||
import TimePicker from '@/components/timePicker'
|
||||
import { alert } from '@/common/common'
|
||||
import smallToBig from '@/common/money'
|
||||
import { IMG_CND_Prefix } from '@/common/constant'
|
||||
|
||||
export default () => {
|
||||
const CollectionDetail = () => {
|
||||
const router = useRouter()
|
||||
const [Query, setQuery] = useState<any>({})
|
||||
const { fetchData: getFetch } = mpcashManagementOrder()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
const { fetchData: getFetch } = MpCashManagementOrder()
|
||||
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等',
|
||||
@@ -50,7 +45,9 @@ export default () => {
|
||||
res = Query.receipt_amount / 100
|
||||
return res
|
||||
}, [Query])
|
||||
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
<View className={styles.topBox}>
|
||||
@@ -152,3 +149,5 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default CollectionDetail
|
||||
|
||||
@@ -7,7 +7,7 @@ import Popup from './Popup'
|
||||
import { useBluetooth } from '@/use/contextBlueTooth'
|
||||
import SearchInput from '@/components/searchInput'
|
||||
|
||||
export default memo(() => {
|
||||
const LinkBlueTooth = () => {
|
||||
const { state, init, startScan, connect, disconnect } = useBluetooth()
|
||||
|
||||
useEffect(() => {
|
||||
@@ -36,7 +36,9 @@ export default memo(() => {
|
||||
const onLinkListen = (item) => {
|
||||
if (!state.connected && !state.connecting) { connect(item) }
|
||||
}
|
||||
|
||||
const onFindEven = () => {
|
||||
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
||||
}
|
||||
const [popupShow, setPopupShow] = useState(false)
|
||||
// 显示设备列表
|
||||
const onFindDevice = () => {
|
||||
@@ -52,9 +54,6 @@ export default memo(() => {
|
||||
onFindEven()
|
||||
}
|
||||
}
|
||||
const onFindEven = () => {
|
||||
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
||||
}
|
||||
|
||||
// 断开链接
|
||||
const onDisconnect = () => {
|
||||
@@ -84,4 +83,5 @@ export default memo(() => {
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(LinkBlueTooth)
|
||||
|
||||
@@ -12,8 +12,7 @@ interface params {
|
||||
onOff: () => void
|
||||
onFind: () => void
|
||||
}
|
||||
|
||||
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
||||
const Popup = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
||||
const [popupShow, setPopupShow] = useState(show)
|
||||
useEffect(() => {
|
||||
setPopupShow(show)
|
||||
@@ -32,9 +31,9 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
||||
<ScrollView scrollY className={style.scroll}>
|
||||
{(state.devices
|
||||
&& state.devices.length > 0
|
||||
&& state?.devices.map((item) => {
|
||||
&& state?.devices.map((item, key) => {
|
||||
return (
|
||||
<View className={style.item} onClick={() => onLink(item)}>
|
||||
<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>)
|
||||
@@ -76,4 +75,5 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
||||
)}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Popup)
|
||||
|
||||
@@ -8,7 +8,7 @@ interface PropsType {
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
const DrawerCenter: FC<PropsType> = memo((props) => {
|
||||
const DrawerCenter: FC<PropsType> = (props) => {
|
||||
const { children, showModal } = props
|
||||
|
||||
const [show, setShow] = useState(false)
|
||||
@@ -29,5 +29,5 @@ const DrawerCenter: FC<PropsType> = memo((props) => {
|
||||
</View>
|
||||
)
|
||||
: null
|
||||
})
|
||||
export default DrawerCenter
|
||||
}
|
||||
export default memo(DrawerCenter)
|
||||
|
||||
@@ -19,7 +19,7 @@ interface HistoryListItem {
|
||||
code: string
|
||||
name: string
|
||||
}
|
||||
const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
||||
const HistoryColor = (props: PropsType, ref) => {
|
||||
const { onColor, showModal, onVisibleChange } = props
|
||||
|
||||
const [visible, setVisible] = usePropsValue({
|
||||
@@ -28,12 +28,6 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
||||
onChange: onVisibleChange,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
getList()
|
||||
}
|
||||
}, [visible])
|
||||
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
() => {
|
||||
@@ -50,6 +44,7 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
||||
console.log('closeEven')
|
||||
setVisible(false)
|
||||
}
|
||||
const [list, setList] = useState<HistoryListItem[]>([])
|
||||
|
||||
// 获取本地列表(无差别存储版本)
|
||||
const getList = () => {
|
||||
@@ -57,8 +52,11 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
||||
console.log('historyColorList==>', historyColorList)
|
||||
setList(historyColorList || [])
|
||||
}
|
||||
|
||||
const [list, setList] = useState<HistoryListItem[]>([])
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
getList()
|
||||
}
|
||||
}, [visible])
|
||||
|
||||
// 保留1位小数
|
||||
const noScale = (val, num = 1) => {
|
||||
@@ -116,5 +114,5 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
export default HistoryColor
|
||||
}
|
||||
export default forwardRef(HistoryColor)
|
||||
|
||||
@@ -68,13 +68,12 @@ const FindColor: FC = () => {
|
||||
})
|
||||
getData(val.lab)
|
||||
}
|
||||
const [showHistory, setShowHistory] = useState(false)
|
||||
|
||||
const handleVisibleChange = (visible) => {
|
||||
setShowHistory(visible)
|
||||
}
|
||||
|
||||
const [showHistory, setShowHistory] = useState(false)
|
||||
|
||||
const ResultContainer = useMemo(() => {
|
||||
if (!colorState.loading && list?.length > 0) {
|
||||
return <RecommendColor customStyle={{ flex: 1 }} list={list} />
|
||||
@@ -94,7 +93,18 @@ const FindColor: FC = () => {
|
||||
const historyShowEven = () => {
|
||||
setShowHistory(true)
|
||||
}
|
||||
|
||||
// 本地存储取色记录(无差别存储版本)
|
||||
const localSave = (lab) => {
|
||||
const historyColorList = Taro.getStorageSync('historyColor') || []
|
||||
const obj = {
|
||||
...product,
|
||||
p_time: +new Date(),
|
||||
lab,
|
||||
}
|
||||
historyColorList.unshift(obj)
|
||||
if (historyColorList.length > 30) { historyColorList.pop() }
|
||||
Taro.setStorageSync('historyColor', historyColorList)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!product) {
|
||||
Taro.showToast({ title: '请选择面料', icon: 'none' })
|
||||
@@ -109,19 +119,6 @@ const FindColor: FC = () => {
|
||||
}
|
||||
}, [bluetoothState.deviceLab])
|
||||
|
||||
// 本地存储取色记录(无差别存储版本)
|
||||
const localSave = (lab) => {
|
||||
const historyColorList = Taro.getStorageSync('historyColor') || []
|
||||
const obj = {
|
||||
...product,
|
||||
p_time: +new Date(),
|
||||
lab,
|
||||
}
|
||||
historyColorList.unshift(obj)
|
||||
if (historyColorList.length > 30) { historyColorList.pop() }
|
||||
Taro.setStorageSync('historyColor', historyColorList)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.findColor_main}>
|
||||
<View className={styles.findColor_main_search}>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { toRgb } from '@/common/bluetooth/color/colorSpace'
|
||||
import { productabsorbcontrast } from '@/api/index'
|
||||
import { alert } from '@/common/common'
|
||||
|
||||
export default () => {
|
||||
const SampleComparison = () => {
|
||||
// 搜索参数
|
||||
const [searchField, setSearchField] = useState({
|
||||
l1: '',
|
||||
@@ -79,15 +79,7 @@ export default () => {
|
||||
}
|
||||
}
|
||||
}, [colorList])
|
||||
const reset = () => {
|
||||
setColorList({})
|
||||
setBlueToothColor('')
|
||||
setBlueToothColorTwo('')
|
||||
setTime('')
|
||||
setTimeTwo('')
|
||||
setData('')
|
||||
setResult('')
|
||||
}
|
||||
|
||||
const [data, setData] = useState('')
|
||||
const [result, setResult] = useState('')
|
||||
const { fetchData } = productabsorbcontrast()
|
||||
@@ -126,6 +118,15 @@ export default () => {
|
||||
}
|
||||
alert.hideLoading()
|
||||
}
|
||||
const reset = () => {
|
||||
setColorList({})
|
||||
setBlueToothColor('')
|
||||
setBlueToothColorTwo('')
|
||||
setTime('')
|
||||
setTimeTwo('')
|
||||
setData('')
|
||||
setResult('')
|
||||
}
|
||||
return (
|
||||
<View className={styles.body}>
|
||||
<View className={styles.topBox}>
|
||||
@@ -186,3 +187,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
export default SampleComparison
|
||||
|
||||
@@ -13,7 +13,7 @@ interface PropsType extends UploadColorEvent {
|
||||
uploadConfirmState: boolean
|
||||
}
|
||||
|
||||
const UploadColor = forwardRef((params: PropsType, ref) => {
|
||||
const UploadColor = (params: PropsType, ref) => {
|
||||
const { onUploadConfirm, uploadConfirmState } = params
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const [filePath, setFilePath] = useState('')
|
||||
@@ -31,13 +31,6 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (uploadConfirmState) {
|
||||
setFilePath('')
|
||||
handleTriggerUploadModal(false)
|
||||
}
|
||||
}, [uploadConfirmState])
|
||||
|
||||
const handleTriggerUploadModal = (bool: boolean) => {
|
||||
setShowModal(bool)
|
||||
}
|
||||
@@ -55,7 +48,12 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
||||
const handleUploadConfirm = () => {
|
||||
onUploadConfirm && onUploadConfirm(file)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (uploadConfirmState) {
|
||||
setFilePath('')
|
||||
handleTriggerUploadModal(false)
|
||||
}
|
||||
}, [uploadConfirmState])
|
||||
return (
|
||||
<View className={styles['upload-container']}>
|
||||
<Popup title="上传纹理" show={showModal} onClose={() => handleTriggerUploadModal(false)}>
|
||||
@@ -75,5 +73,5 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
export default UploadColor
|
||||
}
|
||||
export default forwardRef(UploadColor)
|
||||
|
||||
@@ -23,6 +23,7 @@ const TakeColor: FC = () => {
|
||||
const { measureAndGetLab, state: bluetoothState } = useBluetooth()
|
||||
const [searchValue, setSearchValue] = useState('')
|
||||
const [selectedProduct, setSelectedProduct] = useState<Record<string, any>>({})
|
||||
const [listData, setListData] = useState<Record<string, any>[]>([])
|
||||
|
||||
const selectInput = async(event) => {
|
||||
if (event) {
|
||||
@@ -30,7 +31,7 @@ const TakeColor: FC = () => {
|
||||
setSelectedProduct(event)
|
||||
const res = await fetchData({ id: event.id })
|
||||
if (res.success) {
|
||||
res.data?.list.map((item, index) => {
|
||||
res.data?.list.forEach((item, index) => {
|
||||
item.currnetRgb = item.rgb
|
||||
item.currentLab = item.lab
|
||||
item.sampling = !(item.currentLab?.l == 0 && item.currentLab?.a == 0 && item.currentLab?.b == 0)
|
||||
@@ -53,18 +54,12 @@ const TakeColor: FC = () => {
|
||||
setSearchValue('')
|
||||
}
|
||||
|
||||
const handlePrViewRgb = useCallback((event) => {
|
||||
setLabPreview(event)
|
||||
setShowLabPreview(true)
|
||||
}, [])
|
||||
|
||||
const [currentTakeColorIndex, setCurrentTakeColorIndex] = useState<number | null>(null)
|
||||
|
||||
const handleTakeColor = (index: number) => {
|
||||
setCurrentTakeColorIndex(index)
|
||||
}
|
||||
|
||||
const [listData, setListData] = useState<Record<string, any>[]>([])
|
||||
// const listData = useMemo(() => {
|
||||
// return state.data?.list?.filter(item => {
|
||||
// if (searchValue) {
|
||||
@@ -73,6 +68,7 @@ const TakeColor: FC = () => {
|
||||
// return true
|
||||
// })
|
||||
// }, [state.data?.list, state])
|
||||
const productSelectEl = useRef<any>(null)
|
||||
|
||||
const onSearchInput = (event) => {
|
||||
const current = event.detail.value
|
||||
@@ -149,8 +145,6 @@ const TakeColor: FC = () => {
|
||||
|
||||
const [showLabPreview, setShowLabPreview] = useState(false)
|
||||
|
||||
const productSelectEl = useRef<any>(null)
|
||||
|
||||
const [uploadConfirmState, setUploadConfirmState] = useState(false)
|
||||
|
||||
const handleUploadConfirm = async(file) => {
|
||||
@@ -185,7 +179,10 @@ const TakeColor: FC = () => {
|
||||
alert.none('请选择图片')
|
||||
}
|
||||
}
|
||||
|
||||
const handlePrViewRgb = useCallback((event) => {
|
||||
setLabPreview(event)
|
||||
setShowLabPreview(true)
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
<View className={styles.card}>
|
||||
|
||||
@@ -13,8 +13,7 @@ interface Props {
|
||||
isPhone?: boolean
|
||||
isBorder?: boolean
|
||||
}
|
||||
|
||||
export default memo((props: Props) => {
|
||||
const Form = (props: Props) => {
|
||||
const {
|
||||
isPhone = false,
|
||||
isBorder = true,
|
||||
@@ -35,4 +34,5 @@ export default memo((props: Props) => {
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Form)
|
||||
|
||||
@@ -7,7 +7,7 @@ interface Props {
|
||||
list: any[]
|
||||
handChose?: (any) => void
|
||||
}
|
||||
export default memo((props: Props) => {
|
||||
const Tabs = (props: Props) => {
|
||||
const { list = [], handChose } = props
|
||||
|
||||
return (
|
||||
@@ -29,4 +29,5 @@ export default memo((props: Props) => {
|
||||
}
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Tabs)
|
||||
|
||||
@@ -7,7 +7,7 @@ import { alert, goLink } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
import Popup from '@/components/popup'
|
||||
import { mppurchaserlabeladd, mppurchaserlist } from '@/api/customer'
|
||||
import { MpPurchaserLabelAdd, MpPurchaserList } from '@/api/customer'
|
||||
|
||||
interface Props {
|
||||
showPopup: boolean
|
||||
@@ -15,12 +15,12 @@ interface Props {
|
||||
purchaser_id?: string | number
|
||||
diseShow?: () => void
|
||||
}
|
||||
export default memo(forwardRef((props: Props, ref) => {
|
||||
const TagPopup = (props: Props, ref) => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getList()
|
||||
}, [])
|
||||
const { fetchData } = mppurchaserlist()
|
||||
|
||||
const { fetchData } = MpPurchaserList()
|
||||
// 标签
|
||||
const [modeList, setModeList] = useState<any[]>([])
|
||||
const getList = async() => {
|
||||
const res = await fetchData()
|
||||
if (res.data) {
|
||||
@@ -28,8 +28,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 标签
|
||||
const [modeList, setModeList] = useState<any[]>([])
|
||||
// 选择标签
|
||||
const handCheckMode = (item) => {
|
||||
modeList.map((it) => {
|
||||
@@ -48,7 +46,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
})
|
||||
setModeList([...modeList])
|
||||
}
|
||||
const { fetchData: addFetch } = mppurchaserlabeladd()
|
||||
const { fetchData: addFetch } = MpPurchaserLabelAdd()
|
||||
const handSure = async() => {
|
||||
const arr: any[] = []
|
||||
const fltArr = modeList.filter((item) => { return item.checked })
|
||||
@@ -98,6 +96,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
modeList,
|
||||
setModeList,
|
||||
}))
|
||||
useEffect(() => {
|
||||
getList()
|
||||
}, [])
|
||||
return (
|
||||
<Popup title="选择标签" show={props.showPopup} onClose={() => { props.handClose() }}>
|
||||
<ScrollView scrollY className={styles.scrollView}>
|
||||
@@ -142,4 +143,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
</View>
|
||||
</Popup>
|
||||
)
|
||||
}))
|
||||
}
|
||||
export default memo(forwardRef(TagPopup))
|
||||
|
||||
@@ -11,34 +11,21 @@ import { debounce } from '@/common/util'
|
||||
import { alert, goLink } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import AddressList from '@/components/AddressList'
|
||||
import { mppurchaser } from '@/api/customer'
|
||||
import { MpPurchaser } from '@/api/customer'
|
||||
|
||||
export default () => {
|
||||
const CustomerDetails = () => {
|
||||
const router = useRouter()
|
||||
|
||||
const [status, setstatus] = useState<number>(1)
|
||||
|
||||
useDidShow(() => {
|
||||
getInfo()
|
||||
})
|
||||
const [infoObj, setinfoObj] = useState<any>()
|
||||
const { fetchData: getDesc } = mppurchaser()
|
||||
const getInfo = async() => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await getDesc({ id: router.params.purchaser_id })
|
||||
setinfoObj(res.data)
|
||||
Taro.hideLoading()
|
||||
setshowPopup(false)
|
||||
}
|
||||
const { fetchData: getDesc } = MpPurchaser()
|
||||
|
||||
// 顶部栏
|
||||
const AddressListRef = useRef<any>()
|
||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }])
|
||||
const handChose = (item) => {
|
||||
TarBarList.map((it) => {
|
||||
TarBarList.forEach((it) => {
|
||||
if (it.id === item.id) {
|
||||
it.showBorder = true
|
||||
}
|
||||
@@ -72,6 +59,19 @@ export default () => {
|
||||
TagPopupRef.current.setModeList([...TagPopupRef.current.modeList])
|
||||
setshowPopup(true)
|
||||
}
|
||||
const getInfo = async() => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await getDesc({ id: router.params.purchaser_id })
|
||||
setinfoObj(res.data)
|
||||
Taro.hideLoading()
|
||||
setshowPopup(false)
|
||||
}
|
||||
useDidShow(() => {
|
||||
getInfo()
|
||||
})
|
||||
return (
|
||||
<View className={styles.mainBox}>
|
||||
<View className={styles.mainTop}>
|
||||
@@ -133,3 +133,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
export default CustomerDetails
|
||||
|
||||
@@ -11,14 +11,45 @@ import { debounce } from '@/common/util'
|
||||
import { alert, goLink } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import Address from '@/components/address'
|
||||
import { mppurchaser, mppurchaserpost, mppurchaserput } from '@/api/customer'
|
||||
import { MpPurchaser, MpPurchaserPost, MpPurchaserPut } from '@/api/customer'
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = (props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||
|
||||
interface AddressParms {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const CustomerEditor = () => {
|
||||
const router = useRouter()
|
||||
|
||||
const [infoObj, setinfoObj] = useState<any>()
|
||||
@@ -26,11 +57,6 @@ export default () => {
|
||||
const [formData, setformData] = useState<any>()
|
||||
|
||||
const [addressArr, setaddressArr] = useState<AddressParms[]>([])
|
||||
useEffect(() => {
|
||||
if (router.params.type === 'edit') {
|
||||
getInfo()
|
||||
}
|
||||
}, [])
|
||||
|
||||
// 默认业务员
|
||||
useDidShow(() => {
|
||||
@@ -62,46 +88,7 @@ export default () => {
|
||||
}
|
||||
})
|
||||
|
||||
const { fetchData: getDesc } = mppurchaser()
|
||||
const getInfo = async() => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await getDesc({ id: router.params.id })
|
||||
setinfoObj(res.data)
|
||||
list.map((item) => {
|
||||
if (item.id == res.data.purchaser_type) {
|
||||
item.check = true
|
||||
}
|
||||
else {
|
||||
item.check = false
|
||||
}
|
||||
return item
|
||||
})
|
||||
setlist([...list])
|
||||
setformData({
|
||||
sale_user_id: res.data?.sale_user_id,
|
||||
sale_user_name: res.data?.sale_user_name,
|
||||
name: res.data?.name,
|
||||
short_name: res.data?.short_name,
|
||||
director: res.data?.director,
|
||||
phone: res.data?.phone,
|
||||
addressName: res.data?.province_name + res.data?.city_name + res.data?.district_name,
|
||||
address_detail: res.data?.address_detail,
|
||||
purchaser_type: res.data?.purchaser_type,
|
||||
district_id: res.data?.district_id,
|
||||
})
|
||||
setremarkDesc(res.data?.remark)
|
||||
let arr: any[] = []
|
||||
arr = [
|
||||
{ id: res.data.province_id, name: res.data.province_name },
|
||||
{ id: res.data.city_id, name: res.data.city_name },
|
||||
{ id: res.data.district_id, name: res.data.district_name },
|
||||
]
|
||||
setaddressArr([...arr])
|
||||
Taro.hideLoading()
|
||||
}
|
||||
const { fetchData: getDesc } = MpPurchaser()
|
||||
|
||||
const handTitle = useCallback((e) => {
|
||||
setformData(val => ({ ...val, name: e }))
|
||||
@@ -156,9 +143,48 @@ export default () => {
|
||||
setlist([...list])
|
||||
setformData(val => ({ ...val, purchaser_type: item.id }))
|
||||
}
|
||||
|
||||
// 备注操作
|
||||
const [remarkDesc, setremarkDesc] = useState('')
|
||||
const getInfo = async() => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await getDesc({ id: router.params.id })
|
||||
setinfoObj(res.data)
|
||||
list.map((item) => {
|
||||
if (item.id == res.data.purchaser_type) {
|
||||
item.check = true
|
||||
}
|
||||
else {
|
||||
item.check = false
|
||||
}
|
||||
return item
|
||||
})
|
||||
setlist([...list])
|
||||
setformData({
|
||||
sale_user_id: res.data?.sale_user_id,
|
||||
sale_user_name: res.data?.sale_user_name,
|
||||
name: res.data?.name,
|
||||
short_name: res.data?.short_name,
|
||||
director: res.data?.director,
|
||||
phone: res.data?.phone,
|
||||
addressName: res.data?.province_name + res.data?.city_name + res.data?.district_name,
|
||||
address_detail: res.data?.address_detail,
|
||||
purchaser_type: res.data?.purchaser_type,
|
||||
district_id: res.data?.district_id,
|
||||
})
|
||||
setremarkDesc(res.data?.remark)
|
||||
let arr: any[] = []
|
||||
arr = [
|
||||
{ id: res.data.province_id, name: res.data.province_name },
|
||||
{ id: res.data.city_id, name: res.data.city_name },
|
||||
{ id: res.data.district_id, name: res.data.district_name },
|
||||
]
|
||||
setaddressArr([...arr])
|
||||
Taro.hideLoading()
|
||||
}
|
||||
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
const getRemark = useCallback(async(e) => {
|
||||
setShowDesc(false)
|
||||
@@ -183,12 +209,16 @@ export default () => {
|
||||
const onClose = () => {
|
||||
setShowSiteModal(false)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (router.params.type === 'edit') {
|
||||
getInfo()
|
||||
}
|
||||
}, [])
|
||||
const isDisabled = useMemo(() => {
|
||||
let empty: any = null
|
||||
if (typeof (formData) == 'undefined') { return }
|
||||
for (const key in formData) {
|
||||
if (formData.hasOwnProperty(key)) {
|
||||
if (key in formData) {
|
||||
if (formData[key] !== '' && typeof (formData[key]) !== 'undefined') {
|
||||
empty = false
|
||||
}
|
||||
@@ -218,8 +248,8 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
const { fetchData: postFetch } = mppurchaserpost()
|
||||
const { fetchData: putFetch } = mppurchaserput()
|
||||
const { fetchData: postFetch } = MpPurchaserPost()
|
||||
const { fetchData: putFetch } = MpPurchaserPut()
|
||||
// 提交
|
||||
const handSure = async() => {
|
||||
// if (!isDisabled) return false
|
||||
@@ -284,9 +314,9 @@ export default () => {
|
||||
>
|
||||
<View className={styles.flexBox}>
|
||||
{
|
||||
list.map((item) => {
|
||||
list.map((item, key) => {
|
||||
return (
|
||||
<View className={classnames(item.check ? styles.activeBox : styles.itemBox)} onClick={() => handItem(item)}>{item.name}</View>
|
||||
<View key={key} className={classnames(item.check ? styles.activeBox : styles.itemBox)} onClick={() => handItem(item)}>{item.name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -330,9 +360,9 @@ export default () => {
|
||||
inputValue={formData?.sale_user_name}
|
||||
></Form>
|
||||
</View>
|
||||
<DefaultBox title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||
<DefaultBoxWithMemo title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||
<View className={classnames(remarkDesc === '' ? styles.remarkFontactive : styles.remarkFont)}>{remarkDesc === '' ? '尚未备注信息' : remarkDesc}</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||
<Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} showInput={!!showDesc} />
|
||||
</Popup>
|
||||
@@ -345,35 +375,4 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
export default CustomerEditor
|
||||
|
||||
@@ -15,8 +15,7 @@ interface Props {
|
||||
value?: any
|
||||
onCloseOverlay?: () => void
|
||||
}
|
||||
|
||||
export default memo(forwardRef((props: Props, ref) => {
|
||||
const ChoseCity = (props: Props, ref) => {
|
||||
const DropDownItemRef = useRef<any>()
|
||||
const close = () => {
|
||||
DropDownItemRef.current.closePopup()
|
||||
@@ -35,17 +34,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
|
||||
// 获取地址
|
||||
const { fetchData } = GetAddressListApi()
|
||||
useEffect(() => {
|
||||
getProvince()
|
||||
}, [])
|
||||
|
||||
// 获取省
|
||||
const getProvince = async() => {
|
||||
const res = await fetchData({ parent_id: 1 })
|
||||
if (res.data) {
|
||||
setlist([...res.data.list])
|
||||
}
|
||||
}
|
||||
|
||||
// 已选的集合市
|
||||
// const [choseCityArr, setchoseCityArr] = useState<any[]>([])
|
||||
@@ -55,14 +43,23 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
const [list, setlist] = useState<any[]>([])
|
||||
// 区数组
|
||||
const [cityList, setcityList] = useState<any[]>([])
|
||||
|
||||
// 获取省
|
||||
const getProvince = async() => {
|
||||
const res = await fetchData({ parent_id: 1 })
|
||||
if (res.data) {
|
||||
setlist([...res.data.list])
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
getProvince()
|
||||
}, [])
|
||||
// 区分在哪一栏
|
||||
const [currentValue, setCurrentValue] = useState<number>(1)
|
||||
|
||||
// 顶部栏
|
||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '选择省', showBorder: true }, { id: 2, name: '选择市', showBorder: false }])
|
||||
const handChose = (item) => {
|
||||
TarBarList.map((it) => {
|
||||
TarBarList.forEach((it) => {
|
||||
if (it.id === item.id) {
|
||||
it.showBorder = true
|
||||
}
|
||||
@@ -74,6 +71,23 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取市
|
||||
const getCity = async(id) => {
|
||||
const res = await fetchData({ parent_id: id })
|
||||
if (res.data) {
|
||||
res.data.list.map((item) => {
|
||||
choseCityArr.current.list.forEach((it) => {
|
||||
if (item.id == it.id) {
|
||||
item.check = true
|
||||
}
|
||||
})
|
||||
return item
|
||||
})
|
||||
setcityList([...res.data.list])
|
||||
}
|
||||
const provinceArr = list.filter((next) => { return next.check })
|
||||
props.handCity?.(provinceArr, choseCityArr.current.list)
|
||||
}
|
||||
// 选择省
|
||||
const handProvince = (item) => {
|
||||
list.map((it) => {
|
||||
@@ -98,25 +112,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
})
|
||||
setTarBarList([...TarBarList])
|
||||
}
|
||||
|
||||
// 获取市
|
||||
const getCity = async(id) => {
|
||||
const res = await fetchData({ parent_id: id })
|
||||
if (res.data) {
|
||||
res.data.list.map((item) => {
|
||||
choseCityArr.current.list.forEach((it) => {
|
||||
if (item.id == it.id) {
|
||||
item.check = true
|
||||
}
|
||||
})
|
||||
return item
|
||||
})
|
||||
setcityList([...res.data.list])
|
||||
}
|
||||
const provinceArr = list.filter((next) => { return next.check })
|
||||
props.handCity?.(provinceArr, choseCityArr.current.list)
|
||||
}
|
||||
|
||||
// 选择市
|
||||
const handCity = (item) => {
|
||||
cityList.map((it) => {
|
||||
@@ -197,9 +192,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
{
|
||||
currentValue == 1 && <ScrollView scrollY className={styles.scrollView}>
|
||||
{
|
||||
list.map((item) => {
|
||||
list.map((item, key) => {
|
||||
return (
|
||||
<View className={styles.itemBox} onClick={() => handProvince(item)}>
|
||||
<View key={key} className={styles.itemBox} onClick={() => handProvince(item)}>
|
||||
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
||||
<IconFont name="icon-chakanquanbukehu" size={50} color="#d8d8d8"></IconFont>
|
||||
</View>
|
||||
@@ -211,9 +206,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
{
|
||||
currentValue == 2 && <ScrollView scrollY className={styles.scrollView}>
|
||||
{
|
||||
cityList.map((item) => {
|
||||
cityList.map((item, key) => {
|
||||
return (
|
||||
<View className={styles.itemBox} onClick={() => handCity(item)}>
|
||||
<View key={key} className={styles.itemBox} onClick={() => handCity(item)}>
|
||||
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
||||
{/* <IconFont name={'icon-chakanquanbukehu'} size={50} color={'#d8d8d8'}></IconFont> */}
|
||||
</View>
|
||||
@@ -225,4 +220,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
</View>
|
||||
</DropDownItem>
|
||||
)
|
||||
}))
|
||||
}
|
||||
export default memo(forwardRef(ChoseCity))
|
||||
|
||||
@@ -11,8 +11,7 @@ interface Props {
|
||||
obj: any
|
||||
sortId: number | string
|
||||
}
|
||||
|
||||
export default memo((props: Props) => {
|
||||
const ItemList = (props: Props) => {
|
||||
const handPhone = (e) => {
|
||||
e.stopPropagation()
|
||||
Taro.makePhoneCall({
|
||||
@@ -72,9 +71,9 @@ export default memo((props: Props) => {
|
||||
<View className={styles.item_tagItem}>{props.obj.purchaser_type_name || '暂无'}</View>
|
||||
<View className={styles.item_tagItem}>{props.obj.sale_user_name || '暂无'}</View>
|
||||
{
|
||||
props.obj?.label_list?.map((item) => {
|
||||
props.obj?.label_list?.map((item, key) => {
|
||||
return (
|
||||
<View className={styles.item_tagItem}>{item.label_name}</View>
|
||||
<View key={key} className={styles.item_tagItem}>{item.label_name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -94,4 +93,5 @@ export default memo((props: Props) => {
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(ItemList)
|
||||
|
||||
@@ -18,8 +18,7 @@ interface ListType {
|
||||
id: string
|
||||
checked: boolean
|
||||
}
|
||||
|
||||
export default memo(forwardRef((props: Props, ref) => {
|
||||
const Sort = (props: Props, ref) => {
|
||||
const DropDownItemRef = useRef<any>()
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
@@ -98,11 +97,12 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</DropDownItem>
|
||||
)
|
||||
}))
|
||||
}
|
||||
export default memo(forwardRef(Sort))
|
||||
|
||||
@@ -7,7 +7,7 @@ import { alert } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import { EnumPurchaserType } from '@/api/order'
|
||||
import DropDownItem from '@/components/dropDown-item'
|
||||
import { mppurchaserlist } from '@/api/customer'
|
||||
import { MpPurchaserList } from '@/api/customer'
|
||||
|
||||
interface Props {
|
||||
handType: (any) => void
|
||||
@@ -15,8 +15,7 @@ interface Props {
|
||||
value?: any
|
||||
onCloseOverlay?: () => void
|
||||
}
|
||||
|
||||
export default memo(forwardRef((props: Props, ref) => {
|
||||
const Tag = (props: Props, ref) => {
|
||||
const DropDownItemRef = useRef<any>()
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
@@ -49,11 +48,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
},
|
||||
])
|
||||
|
||||
useEffect(() => {
|
||||
getList()
|
||||
}, [])
|
||||
const { fetchData: fetchPurchaserType } = EnumPurchaserType()
|
||||
const { fetchData } = mppurchaserlist()
|
||||
const { fetchData } = MpPurchaserList()
|
||||
const [taglist, settaglist] = useState<any[]>([])
|
||||
const getList = async() => {
|
||||
const res = await fetchData()
|
||||
const purchaserType = await fetchPurchaserType()
|
||||
@@ -62,8 +59,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
setlist([...purchaserType.data.list])
|
||||
}
|
||||
}
|
||||
|
||||
const [taglist, settaglist] = useState<any[]>([])
|
||||
useEffect(() => {
|
||||
getList()
|
||||
}, [])
|
||||
|
||||
const handItem = (it) => {
|
||||
list.map((item) => {
|
||||
@@ -98,7 +96,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -108,7 +106,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
{
|
||||
taglist.map((item, index) => {
|
||||
return (
|
||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handTag?.(item)}>{item.name}</View>
|
||||
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handTag?.(item)}>{item.name}</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -116,4 +114,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
||||
</View>
|
||||
</DropDownItem>
|
||||
)
|
||||
}))
|
||||
}
|
||||
export default memo(forwardRef(Tag))
|
||||
|
||||
@@ -8,7 +8,7 @@ interface Props {
|
||||
handChose?: (any) => void
|
||||
handReset?: () => void
|
||||
}
|
||||
export default memo((props: Props) => {
|
||||
const Tabs = (props: Props) => {
|
||||
const { list = [], handChose } = props
|
||||
|
||||
return (
|
||||
@@ -34,4 +34,5 @@ export default memo((props: Props) => {
|
||||
<View className={styles.resetBox} onClick={() => props?.handReset?.()}>重置</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Tabs)
|
||||
|
||||
@@ -16,7 +16,7 @@ import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { ClientListApi } from '@/api/order'
|
||||
import SelectGroup from '@/components/SelectGroup'
|
||||
|
||||
export default () => {
|
||||
const CustomerManagement = () => {
|
||||
const [searchField, setSearchField] = useState<
|
||||
{
|
||||
page: number
|
||||
@@ -41,6 +41,9 @@ export default () => {
|
||||
|
||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||
const { fetchData: listFetchData, state: orderState } = ClientListApi()
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getOrderList = async() => {
|
||||
const res = await listFetchData({
|
||||
...getFilterData(searchField),
|
||||
@@ -54,13 +57,6 @@ export default () => {
|
||||
getOrderList()
|
||||
}, [searchField])
|
||||
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
setSearchField(val => ({ ...val, name_phone_or_sale_user: e, size: 10 }))
|
||||
}, [])
|
||||
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading! })
|
||||
@@ -68,6 +64,12 @@ export default () => {
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
setSearchField(val => ({ ...val, name_phone_or_sale_user: e, size: 10 }))
|
||||
}, [])
|
||||
const getScrolltolower = useCallback(() => {
|
||||
if (orderData.list.length < orderData.total) {
|
||||
pageNum.current.page++
|
||||
@@ -76,8 +78,6 @@ export default () => {
|
||||
}
|
||||
}, [orderData])
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.size = 1
|
||||
setRefresherTriggeredStatus(true)
|
||||
@@ -137,7 +137,7 @@ export default () => {
|
||||
<View className={styles.mainBox}>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.search_input}>
|
||||
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
||||
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} />
|
||||
</View>
|
||||
<View className={styles.menuBox} >
|
||||
<SelectGroup>
|
||||
@@ -158,7 +158,7 @@ export default () => {
|
||||
>
|
||||
{orderData?.list?.map((item, index) => {
|
||||
return (
|
||||
<ItemLiist sortId={sortRefRef.current} obj={item}></ItemLiist>
|
||||
<ItemLiist key={index} sortId={sortRefRef.current} obj={item}></ItemLiist>
|
||||
)
|
||||
})}
|
||||
</InfiniteScroll>
|
||||
@@ -169,3 +169,5 @@ export default () => {
|
||||
</View >
|
||||
)
|
||||
}
|
||||
|
||||
export default CustomerManagement
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ClientListApi } from '@/api/order'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
|
||||
export default () => {
|
||||
const CustomerPage = () => {
|
||||
const [search, setSearch] = useState({
|
||||
name_phone_or_sale_user: null,
|
||||
page: 1,
|
||||
@@ -26,7 +26,8 @@ export default () => {
|
||||
clientId: null,
|
||||
clientName: '',
|
||||
})
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((eq) => {
|
||||
pageNum.current.page = 1
|
||||
@@ -36,15 +37,6 @@ export default () => {
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (search.name_phone_or_sale_user === '') {
|
||||
setSearch(e => ({ ...e, name_phone_or_sale_user: null }))
|
||||
}
|
||||
if (search.name_phone_or_sale_user !== '') { getCuss() }
|
||||
}, [search])
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
const getScrolltolower = useCallback(() => {
|
||||
if (clentList.list.length < clentList.total) {
|
||||
pageNum.current.page++
|
||||
@@ -77,7 +69,12 @@ export default () => {
|
||||
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (search.name_phone_or_sale_user === '') {
|
||||
setSearch(e => ({ ...e, name_phone_or_sale_user: null }))
|
||||
}
|
||||
if (search.name_phone_or_sale_user !== '') { getCuss() }
|
||||
}, [search])
|
||||
// 选择客户
|
||||
const selectClient = (item) => {
|
||||
clentList.list.map((it) => {
|
||||
@@ -118,7 +115,7 @@ export default () => {
|
||||
<View className={styles.cussBox}>
|
||||
<View className={styles.searchBox}>
|
||||
<View className={styles.two}>
|
||||
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
||||
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} />
|
||||
</View>
|
||||
|
||||
</View>
|
||||
@@ -147,3 +144,5 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default CustomerPage
|
||||
|
||||
@@ -6,7 +6,7 @@ interface PropsType {
|
||||
onChangeStatus?: (data: { id: number; name: string }) => void
|
||||
}
|
||||
|
||||
const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
const DeliveryStatusList = (props: PropsType) => {
|
||||
const { onChangeStatus } = props
|
||||
const { fetchData } = EnumSaleorderStatus()
|
||||
const [statusList, setStatusList] = useState([
|
||||
@@ -38,5 +38,5 @@ const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
[onChangeStatus],
|
||||
)
|
||||
return <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={statusList[0].id} />
|
||||
})
|
||||
export default DeliveryStatusList
|
||||
}
|
||||
export default memo<PropsType>(DeliveryStatusList)
|
||||
|
||||
@@ -12,6 +12,23 @@ import IconFont from '@/components/iconfont/iconfont'
|
||||
import { EnumDeliveryNoticeTypeList } from '@/api/index'
|
||||
import { getFilterData } from '@/common/util'
|
||||
|
||||
interface ButtonPropsType {
|
||||
isActive: boolean
|
||||
onClick?: Function
|
||||
children?: React.ReactNode
|
||||
customClassName?: string
|
||||
}
|
||||
const FilterButton: FC<ButtonPropsType> = (props) => {
|
||||
const { onClick, children, isActive = false, customClassName } = props
|
||||
const handleClick = () => {
|
||||
onClick?.()
|
||||
}
|
||||
return (
|
||||
<View className={classnames(styles.filterButton, isActive && styles['filterButton--active'], customClassName)} onClick={handleClick}>
|
||||
<View className={classnames(styles['filterButton--text'])}>{children}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
interface SearchFilter {
|
||||
type?: number
|
||||
timeKey?: string
|
||||
@@ -29,13 +46,6 @@ interface DeliveryPropsType {
|
||||
onReset?: () => void
|
||||
}
|
||||
|
||||
interface ButtonPropsType {
|
||||
isActive: boolean
|
||||
onClick?: Function
|
||||
children?: React.ReactNode
|
||||
customClassName?: string
|
||||
}
|
||||
|
||||
export const filterTimeOptions = {
|
||||
0: {
|
||||
name: '不限',
|
||||
@@ -69,7 +79,7 @@ export const filterTimeOptions = {
|
||||
},
|
||||
} as const
|
||||
|
||||
const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
const DeliveryFilter = (props: DeliveryPropsType) => {
|
||||
const { onSearchTime, onConfirm, onCancal, onReset } = props
|
||||
|
||||
const { fetchData, state } = EnumDeliveryNoticeTypeList()
|
||||
@@ -92,17 +102,15 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
return state.data.list
|
||||
}, [state])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!typeList?.length) {
|
||||
getEnumData()
|
||||
console.log('getEnumData')
|
||||
}
|
||||
}, [typeList])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
|
||||
const [customTime, setCustomTime] = useState({
|
||||
date_min: undefined,
|
||||
date_max: undefined,
|
||||
@@ -144,9 +152,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
不限
|
||||
</FilterButton>
|
||||
{!!typeList?.length
|
||||
&& typeList?.map((item) => {
|
||||
&& typeList?.map((item, key) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
<FilterButton key={key} isActive={searchFilter.type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
{item.name}
|
||||
</FilterButton>
|
||||
)
|
||||
@@ -157,9 +165,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
<View className={styles.filterItem}>
|
||||
<View className={styles['filterItem--title']}>查询日期</View>
|
||||
<View className={classnames(styles['filterItem--wrapper'], styles['filter--time'])}>
|
||||
{Object.entries(filterTimeOptions).map(([key, value]) => {
|
||||
{Object.entries(filterTimeOptions).map(([key, value], index) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
<FilterButton key={index} isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
{value.name}
|
||||
</FilterButton>
|
||||
)
|
||||
@@ -179,18 +187,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
||||
const FilterButton: FC<ButtonPropsType> = (props) => {
|
||||
const { onClick, children, isActive = false, customClassName } = props
|
||||
const handleClick = () => {
|
||||
onClick?.()
|
||||
}
|
||||
return (
|
||||
<View className={classnames(styles.filterButton, isActive && styles['filterButton--active'], customClassName)} onClick={handleClick}>
|
||||
<View className={classnames(styles['filterButton--text'])}>{children}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default DeliveryFilter
|
||||
export default memo<DeliveryPropsType>(DeliveryFilter)
|
||||
|
||||
@@ -51,16 +51,6 @@ const Delivery: FC = () => {
|
||||
console.log('searchValue==>', searchValue)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
})
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
|
||||
@@ -173,11 +163,19 @@ const Delivery: FC = () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
})
|
||||
return (
|
||||
<View className={styles.delivery}>
|
||||
<View className={styles.searchBox}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} customRightSlot={scanIcon()}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} customRightSlot={scanIcon()}>
|
||||
<View onClick={onShowFilter} className={styles.icon__filter}>
|
||||
<IconText svg iconName="icon-shaixuan" text="筛选" customClass={styles['icon--filter']} />
|
||||
</View>
|
||||
|
||||
@@ -41,9 +41,9 @@ const DeliveryDetail: FC = () => {
|
||||
const DetailItem = useMemo(() => {
|
||||
const element
|
||||
= !!detailInfo?.weight_list?.length
|
||||
&& detailInfo?.weight_list.map((weightItem) => {
|
||||
&& detailInfo?.weight_list.map((weightItem, index) => {
|
||||
return (
|
||||
<View className={styles.detailInfo}>
|
||||
<View key={index} className={styles.detailInfo}>
|
||||
<Divider direction="horizontal" customClassName={styles.divider}></Divider>
|
||||
<View className={styles.detailInfoItem}>
|
||||
<View className={styles['detailInfoItem--title']}>
|
||||
|
||||
+34
-25
@@ -7,21 +7,23 @@ import SideBar from '@/components/sideBar'
|
||||
import Product from '@/components/product'
|
||||
import ShopCart from '@/components/shoppingCart'
|
||||
import { goLink } from '@/common/common'
|
||||
import { ProductListApi, kindListApi } from '@/api/index'
|
||||
import { KindListApi, ProductListApi } from '@/api/index'
|
||||
// import useLogin from '@/use/useLogin'
|
||||
import { mpproductcolorlist, mpshoppingCartproductColorlist } from '@/api/order'
|
||||
import { MpProductColorList, MpShoppingCartProductColorList } from '@/api/order'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
import { ClientListApi } from '@/api/order'
|
||||
|
||||
export default () => {
|
||||
useEffect(() => {
|
||||
categoryList()
|
||||
getClient()
|
||||
}, [])
|
||||
|
||||
const Index = () => {
|
||||
// 获取客户
|
||||
const [clienList, setclienList] = useState<any[]>([])
|
||||
const { fetchData: listFetchData } = ClientListApi()
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
|
||||
const [clientObj, setclientObj] = useState({
|
||||
clientId: -1,
|
||||
clientName: '',
|
||||
})
|
||||
const getClient = async() => {
|
||||
const res = await listFetchData({
|
||||
page: 1, size: 10,
|
||||
@@ -33,9 +35,10 @@ export default () => {
|
||||
setclienList([...res.data.list])
|
||||
}
|
||||
|
||||
const [filtrate, setFiltrate] = useState({ product_kind_id: 0, size: 5, page: 1 })
|
||||
// 获取面料种类
|
||||
const [kindData, setKindData] = useState<any>({ list: [], defaultId: 0 })
|
||||
const { fetchData } = kindListApi()
|
||||
const { fetchData } = KindListApi()
|
||||
const categoryList = async() => {
|
||||
const res = await fetchData()
|
||||
if (res.data?.list) {
|
||||
@@ -47,7 +50,6 @@ export default () => {
|
||||
// 获取面料列表
|
||||
const [productData, setProductData] = useState({ list: [], total: 0 })
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
const [filtrate, setFiltrate] = useState({ product_kind_id: 0, size: 5, page: 1 })
|
||||
const pageNum = useRef({ size: filtrate.size, page: filtrate.page })
|
||||
const { fetchData: productFetchData, state: productState } = ProductListApi()
|
||||
// 获取数据方法
|
||||
@@ -82,15 +84,16 @@ export default () => {
|
||||
|
||||
const [showShopCart, setShowShopCart] = useState(false)
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.page = 1
|
||||
setFiltrate({ ...filtrate, size: 5 })
|
||||
setHasMore(true)
|
||||
setRefresherTriggeredStatus(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
categoryList()
|
||||
getClient()
|
||||
}, [])
|
||||
const onj = JSON.parse(Taro.getStorageSync('userInfo') || '{}')
|
||||
const [search, setSearchObj] = useState({
|
||||
modeId: 0,
|
||||
@@ -102,6 +105,8 @@ export default () => {
|
||||
|
||||
// 选择的类型
|
||||
const [typeList, setTypeList] = useState<any[]>([{ id: 0, name: '大货', checked: true }, { id: 1, name: '剪版', checked: false }, { id: 2, name: '散剪', checked: false }])
|
||||
|
||||
const [goodList, setGoodlist] = useState<any[]>([])
|
||||
// 选择类型
|
||||
const handCheckMode = (item) => {
|
||||
typeList.map((it) => {
|
||||
@@ -117,8 +122,7 @@ export default () => {
|
||||
setTypeList([...typeList])
|
||||
setGoodlist([])
|
||||
}
|
||||
const [goodList, setGoodlist] = useState<any[]>([])
|
||||
const { fetchData: colorlistFetch } = mpproductcolorlist()
|
||||
const { fetchData: colorlistFetch } = MpProductColorList()
|
||||
const ShopCartRef = useRef<any>(null)
|
||||
|
||||
const [goodObj, setGoodsobj] = useState({})
|
||||
@@ -162,7 +166,7 @@ export default () => {
|
||||
}
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading })
|
||||
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading! })
|
||||
}, [productData, productState.loading])
|
||||
|
||||
// 点击加展示输入框
|
||||
@@ -181,13 +185,22 @@ export default () => {
|
||||
if (item.id === it.id) {
|
||||
item.nums--
|
||||
if (search.modeId == 0) {
|
||||
if (item.nums < 1) { it.showInput = false, it.nums = 1 }
|
||||
if (item.nums < 1) {
|
||||
it.showInput = false
|
||||
it.nums = 1
|
||||
}
|
||||
}
|
||||
if (search.modeId == 1) {
|
||||
if (item.nums < 0.5) { it.showInput = false, it.nums = 0.5 }
|
||||
if (item.nums < 0.5) {
|
||||
it.showInput = false
|
||||
it.nums = 0.5
|
||||
}
|
||||
}
|
||||
if (search.modeId == 2) {
|
||||
if (item.nums < 3) { it.showInput = false, it.nums = 3 }
|
||||
if (item.nums < 3) {
|
||||
it.showInput = false
|
||||
it.nums = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
return item
|
||||
@@ -211,13 +224,8 @@ export default () => {
|
||||
setSearchObj(e => ({ ...e, code_or_name: eq }))
|
||||
}, [])
|
||||
|
||||
const [clientObj, setclientObj] = useState({
|
||||
clientId: -1,
|
||||
clientName: '',
|
||||
})
|
||||
|
||||
// 加入购物车
|
||||
const { fetchData: preViewFetch } = mpshoppingCartproductColorlist()
|
||||
const { fetchData: preViewFetch } = MpShoppingCartProductColorList()
|
||||
const handSure = async() => {
|
||||
const arr = goodList.filter((item) => {
|
||||
return item.showInput
|
||||
@@ -368,4 +376,5 @@ export default () => {
|
||||
// </MoveBtn>
|
||||
)
|
||||
}
|
||||
export default Index
|
||||
// oninputEvent={(e, item) => { oninputEvent(e, item) }}
|
||||
|
||||
+14
-14
@@ -12,6 +12,19 @@ import { LoginApi } from '@/api'
|
||||
import { alert } from '@/common/common'
|
||||
import useUserInfo from '@/use/useUserInfo'
|
||||
|
||||
const QuickLogin: FC = () => {
|
||||
return (
|
||||
<View className={styles['quick-login']}>
|
||||
<Divider direction="horizontal" customClassName={styles['quick-login--divider']}>
|
||||
或通过以下方式登录
|
||||
</Divider>
|
||||
<View className={styles['quick-login--options']}>
|
||||
<IconCard iconName="icon-weixindenglu" title="微信登录" customClass={styles['quick-login--iconCard']}></IconCard>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const QuickLoginWithMemo = memo(QuickLogin)
|
||||
const Login: FC = () => {
|
||||
const [isRemember, setRemember] = useState(false)
|
||||
|
||||
@@ -115,23 +128,10 @@ const Login: FC = () => {
|
||||
<NormalButton circle onClick={handleLogin} customClassName={styles['login-button']} disabled={account === '' || password === ''}>
|
||||
登录
|
||||
</NormalButton>
|
||||
<QuickLogin />
|
||||
<QuickLoginWithMemo />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const QuickLogin: FC = memo(() => {
|
||||
return (
|
||||
<View className={styles['quick-login']}>
|
||||
<Divider direction="horizontal" customClassName={styles['quick-login--divider']}>
|
||||
或通过以下方式登录
|
||||
</Divider>
|
||||
<View className={styles['quick-login--options']}>
|
||||
<IconCard iconName="icon-weixindenglu" title="微信登录" customClass={styles['quick-login--iconCard']}></IconCard>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
export default Login
|
||||
|
||||
@@ -10,8 +10,7 @@ import { formatDateTime, formatPriceDiv } from '@/common/format'
|
||||
interface Params {
|
||||
obj: any
|
||||
}
|
||||
|
||||
export default memo((pros: Params) => {
|
||||
const ItemList = (pros: Params) => {
|
||||
const navTo = () => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/collectionDetail/index?id=${pros.obj.id}`,
|
||||
@@ -51,4 +50,5 @@ export default memo((pros: Params) => {
|
||||
<View className={styles.btnAnd} onClick={() => navTo()}>查看详情</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(ItemList)
|
||||
|
||||
@@ -11,12 +11,12 @@ import Popup from '@/components/popup'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpcashManagementOrderlist,
|
||||
MpCashManagementOrderList,
|
||||
} from '@/api/newCollection'
|
||||
import TimePickerPopup from '@/components/timePickerPopup'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
export default () => {
|
||||
const NewCollection = () => {
|
||||
const myDate = new Date()
|
||||
const [searchField, setSearchField] = useState<
|
||||
{
|
||||
@@ -34,24 +34,18 @@ export default () => {
|
||||
})
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
|
||||
useDidShow(() => {
|
||||
getOrderList()
|
||||
})
|
||||
// 获取订单列表
|
||||
const { fetchData: listFetchData, state: orderState } = MpCashManagementOrderList()
|
||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number; summary?: any }>({ list: [], total: 0, summary: {} })
|
||||
|
||||
// 监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField.size, searchField.search_name])
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
setSearchField(val => ({ ...val, search_name: e, size: 10 }))
|
||||
}, [])
|
||||
|
||||
// 获取订单列表
|
||||
const { fetchData: listFetchData, state: orderState } = mpcashManagementOrderlist()
|
||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number; summary?: any }>({ list: [], total: 0, summary: {} })
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getOrderList = async() => {
|
||||
const res = await listFetchData({
|
||||
...searchField,
|
||||
@@ -60,9 +54,6 @@ export default () => {
|
||||
// setshowPopup(false)
|
||||
setRefresherTriggeredStatus(false)
|
||||
}
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.page = 1
|
||||
// pageNum.current.size = 10
|
||||
@@ -132,6 +123,65 @@ export default () => {
|
||||
],
|
||||
)
|
||||
|
||||
// 弹窗确认选择
|
||||
const handSureSelect = () => {
|
||||
pageNum.current.size = 10
|
||||
setSearchField({ ...searchField, size: 10 })
|
||||
getOrderList()
|
||||
setSelectPopup(false)
|
||||
}
|
||||
|
||||
// 展示时间筛选
|
||||
const [showTime, setShowTime] = useState(false)
|
||||
// 关闭时间筛选
|
||||
const handClose = () => {
|
||||
setShowTime(false)
|
||||
}
|
||||
|
||||
const [start, setStart] = useState<any>(myDate.toLocaleDateString())
|
||||
const [end, setEnd] = useState<any>('')
|
||||
// 选择时间
|
||||
const handTime = (eq) => {
|
||||
// 直接进来点确定的时候做处理
|
||||
if (Object.keys(eq).length === 0) {
|
||||
const obj = {
|
||||
start: '',
|
||||
end: '',
|
||||
}
|
||||
obj.start = `${dayjs(new Date(`${myDate?.toLocaleDateString()} ` + '00:00:00')).format('YYYY-MM-DD')} 00:00:00`
|
||||
obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
eq.value = obj
|
||||
}
|
||||
setSearchField(val => ({ ...val, start_time: eq?.value?.start, end_time: eq?.value?.end }))
|
||||
setStart(eq?.value?.start)
|
||||
setEnd(eq?.value?.end)
|
||||
setShowTime(false)
|
||||
pageNum.current.size = 10
|
||||
}
|
||||
useDidShow(() => {
|
||||
getOrderList()
|
||||
})
|
||||
|
||||
// 监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField.size, searchField.search_name])
|
||||
const timeArea = useMemo(() => {
|
||||
// const res = TimeList.filter(item => {
|
||||
// return item.checked
|
||||
// })
|
||||
// && res.length > 0
|
||||
if (end !== '') {
|
||||
return `${start} ` + '-' + ` ${end}`
|
||||
}
|
||||
else {
|
||||
return '自定义起始时间'
|
||||
}
|
||||
}, [end])
|
||||
|
||||
useEffect(() => {
|
||||
setSearchField(searchField)
|
||||
}, [searchField])
|
||||
// 选择时间item
|
||||
const handSelect = (it) => {
|
||||
TimeList.map((item) => {
|
||||
@@ -171,64 +221,10 @@ export default () => {
|
||||
setStart(myDate.toLocaleDateString())
|
||||
setEnd('')
|
||||
}
|
||||
|
||||
// 弹窗确认选择
|
||||
const handSureSelect = () => {
|
||||
pageNum.current.size = 10
|
||||
setSearchField({ ...searchField, size: 10 })
|
||||
getOrderList()
|
||||
setSelectPopup(false)
|
||||
}
|
||||
|
||||
// 展示时间筛选
|
||||
const [showTime, setShowTime] = useState(false)
|
||||
// 关闭时间筛选
|
||||
const handClose = () => {
|
||||
setShowTime(false)
|
||||
}
|
||||
|
||||
const [start, setStart] = useState<any>(myDate.toLocaleDateString())
|
||||
const [end, setEnd] = useState<any>('')
|
||||
// 选择时间
|
||||
const handTime = (eq) => {
|
||||
// 直接进来点确定的时候做处理
|
||||
if (Object.keys(eq).length === 0) {
|
||||
const obj = {
|
||||
start: '',
|
||||
end: '',
|
||||
}
|
||||
obj.start = `${dayjs(new Date(`${myDate?.toLocaleDateString()} ` + '00:00:00')).format('YYYY-MM-DD')} 00:00:00`,
|
||||
obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
eq.value = obj
|
||||
}
|
||||
setSearchField(val => ({ ...val, start_time: eq?.value?.start, end_time: eq?.value?.end }))
|
||||
setStart(eq?.value?.start)
|
||||
setEnd(eq?.value?.end)
|
||||
setShowTime(false)
|
||||
pageNum.current.size = 10
|
||||
}
|
||||
|
||||
const timeArea = useMemo(() => {
|
||||
// const res = TimeList.filter(item => {
|
||||
// return item.checked
|
||||
// })
|
||||
// && res.length > 0
|
||||
if (end !== '') {
|
||||
return `${start} ` + '-' + ` ${end}`
|
||||
}
|
||||
else {
|
||||
return '自定义起始时间'
|
||||
}
|
||||
}, [end])
|
||||
|
||||
useEffect(() => {
|
||||
setSearchField(searchField)
|
||||
}, [searchField])
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
<Search placeholder="请输入客户或客户跟进人" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
<Search placeholder="请输入客户或客户跟进人" showBtn={false} changeOnSearch={getSearchData} >
|
||||
<View className={styles.flexBox} onClick={() => { setSelectPopup(true) }}>
|
||||
<IconFont name="icon-shaixuan" size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles.activeshaixuan} />
|
||||
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
|
||||
@@ -303,3 +299,4 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default NewCollection
|
||||
|
||||
@@ -29,8 +29,7 @@ interface Props {
|
||||
title: string
|
||||
picUrl?: string
|
||||
}
|
||||
|
||||
export default memo((props: Props) => {
|
||||
const PayPopup = (props: Props) => {
|
||||
const {
|
||||
showSide = true,
|
||||
showPopup = false,
|
||||
@@ -73,10 +72,6 @@ export default memo((props: Props) => {
|
||||
|
||||
// 检查是否开启保存图片权限
|
||||
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||
const saveImageCheck = async() => {
|
||||
const res = await check()
|
||||
res && saveImage()
|
||||
}
|
||||
|
||||
// 保存图片
|
||||
const saveImage = () => {
|
||||
@@ -102,7 +97,10 @@ export default memo((props: Props) => {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const saveImageCheck = async() => {
|
||||
const res = await check()
|
||||
res && saveImage()
|
||||
}
|
||||
return (
|
||||
<View className={styles.popupBox}>
|
||||
<Popup show={showPopup} title={title} onClose={() => popupClose?.()}>
|
||||
@@ -190,4 +188,5 @@ export default memo((props: Props) => {
|
||||
</Popup >
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(PayPopup)
|
||||
|
||||
@@ -13,8 +13,7 @@ interface propsObj {
|
||||
nextBuy?: (arg: any, obj: any) => void
|
||||
toPay?: (arg: any, obj: any) => void
|
||||
}
|
||||
|
||||
export default memo((props: propsObj) => {
|
||||
const ItemList = (props: propsObj) => {
|
||||
const navTo = (e) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/orderDetails/index?id=${props?.obj?.id}`,
|
||||
@@ -105,4 +104,5 @@ export default memo((props: propsObj) => {
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(ItemList)
|
||||
|
||||
@@ -18,7 +18,7 @@ interface Param {
|
||||
}
|
||||
showKong?: true | false
|
||||
}
|
||||
export default memo(({ show = true, onClose, offlineInfo, showKong = true }: Param) => {
|
||||
const OfflinePay = ({ show = true, onClose, offlineInfo, showKong = true }: Param) => {
|
||||
// 复制功能
|
||||
const clipboardData = () => {
|
||||
Taro.setClipboardData({
|
||||
@@ -98,4 +98,5 @@ export default memo(({ show = true, onClose, offlineInfo, showKong = true }: Par
|
||||
</View>
|
||||
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(OfflinePay)
|
||||
|
||||
@@ -8,11 +8,17 @@ interface Param {
|
||||
defaultId?: number | null
|
||||
onSelect?: (val: number) => void
|
||||
}
|
||||
export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
const OrderStatusList = ({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
const [selectInfo, setSelectInfo] = useState({
|
||||
selected: -1, // 当前选中的id
|
||||
tabId: '', // 需要滚动到的id
|
||||
})
|
||||
|
||||
const clickEvent = ({ item, index }: { item: any; index: number }) => {
|
||||
const num = index > 0 ? index - 1 : 0
|
||||
setSelectInfo(e => ({ ...e, tabId: list[num].id.toString(), selected: item.id }))
|
||||
onSelect?.(item.id)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (typeof defaultId === 'number' && defaultId >= 0) {
|
||||
console.log('defaultId:::', defaultId)
|
||||
@@ -26,12 +32,6 @@ export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
}
|
||||
setSelectInfo(e => ({ ...e, selected: defaultId || -1 }))
|
||||
}, [defaultId])
|
||||
const clickEvent = ({ item, index }: { item: any; index: number }) => {
|
||||
const num = index > 0 ? index - 1 : 0
|
||||
setSelectInfo(e => ({ ...e, tabId: list[num].id.toString(), selected: item.id }))
|
||||
onSelect?.(item.id)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.order_status_list}>
|
||||
<ScrollView scrollX scrollIntoView={`tabs_${selectInfo.tabId}`} scrollWithAnimation>
|
||||
@@ -52,4 +52,5 @@ export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
</ScrollView>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(OrderStatusList)
|
||||
|
||||
+15
-15
@@ -8,14 +8,14 @@ import ItemList from './components/itemList'
|
||||
import OfflinePay from './components/offlinePay'
|
||||
import PayPopup from './components/PayPopup'
|
||||
import {
|
||||
GetPayCode, OrderListApi,
|
||||
mpenumsaleorderstatus,
|
||||
mpsaleOrdercancel,
|
||||
mpshoppingCartproductColorlist,
|
||||
orderPaymentorderPaymentMethodInfo,
|
||||
orderPaymentorderPaymentSubmission,
|
||||
orderPaymentpreCollectOrderorderPaymentMethodInfo,
|
||||
orderPaymentpreCollectOrderorderPaymentSubmission,
|
||||
GetPayCode, MpEnumSaleOrderStatus,
|
||||
MpSaleOrderCancel,
|
||||
MpShoppingCartProductColorList,
|
||||
OrderListApi,
|
||||
OrderPaymentOrderPaymentMethodInfo,
|
||||
OrderPaymentOrderPaymentSubmission,
|
||||
OrderPaymentPreCollectOrderOrderPaymentMethodInfo,
|
||||
OrderPaymentPreCollectOrderOrderPaymentSubmission,
|
||||
} from '@/api/order'
|
||||
import Search from '@/components/search'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
@@ -81,7 +81,7 @@ export default () => {
|
||||
}, [orderData])
|
||||
|
||||
// //获取订单状态
|
||||
const { fetchData: orderStatusListFetchData } = mpenumsaleorderstatus()
|
||||
const { fetchData: orderStatusListFetchData } = MpEnumSaleOrderStatus()
|
||||
const [statusList, setStatusList] = useState<any[]>([{ id: -1, name: '全部' }])
|
||||
const getOrderStatusList = async() => {
|
||||
const res = await orderStatusListFetchData()
|
||||
@@ -247,7 +247,7 @@ export default () => {
|
||||
getOrderStatusList()
|
||||
}, [])
|
||||
|
||||
const { fetchData: cancelFetch } = mpsaleOrdercancel()
|
||||
const { fetchData: cancelFetch } = MpSaleOrderCancel()
|
||||
// 取消订单
|
||||
const cancle = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
@@ -280,7 +280,7 @@ export default () => {
|
||||
})
|
||||
}
|
||||
// 再次购买
|
||||
const { fetchData: buyFetch } = mpshoppingCartproductColorlist()
|
||||
const { fetchData: buyFetch } = MpShoppingCartProductColorList()
|
||||
const nextBuy = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
Taro.showLoading({
|
||||
@@ -318,8 +318,8 @@ export default () => {
|
||||
}
|
||||
}
|
||||
// 去支付逻辑
|
||||
const { fetchData: infoOneFetch } = orderPaymentorderPaymentMethodInfo()
|
||||
const { fetchData: infoTwoFetch } = orderPaymentpreCollectOrderorderPaymentMethodInfo()
|
||||
const { fetchData: infoOneFetch } = OrderPaymentOrderPaymentMethodInfo()
|
||||
const { fetchData: infoTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentMethodInfo()
|
||||
const [itemObj, setItemObj] = useState<any>({})
|
||||
const [payList, setPayList] = useState<any[]>([
|
||||
{
|
||||
@@ -539,8 +539,8 @@ export default () => {
|
||||
}
|
||||
|
||||
// 确认交易
|
||||
const { fetchData: payOneFetch } = orderPaymentorderPaymentSubmission()
|
||||
const { fetchData: payTwoFetch } = orderPaymentpreCollectOrderorderPaymentSubmission()
|
||||
const { fetchData: payOneFetch } = OrderPaymentOrderPaymentSubmission()
|
||||
const { fetchData: payTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentSubmission()
|
||||
const handsurePay = (obj) => {
|
||||
let arr: any = []
|
||||
// if (obj.status !== 10) {
|
||||
|
||||
@@ -16,8 +16,7 @@ interface prosObj {
|
||||
goodsObj?: any
|
||||
// handSureGoods?: () => void,
|
||||
}
|
||||
|
||||
export default memo((props: prosObj) => {
|
||||
const BottomApply = (props: prosObj) => {
|
||||
const {
|
||||
obj = {
|
||||
sale_mode: 0,
|
||||
@@ -86,4 +85,5 @@ export default memo((props: prosObj) => {
|
||||
}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(BottomApply)
|
||||
|
||||
@@ -11,7 +11,7 @@ interface propsObj {
|
||||
obj?: any
|
||||
navSelect?: (any) => void
|
||||
}
|
||||
export default memo((props: propsObj) => {
|
||||
const AddressDetailBox = (props: propsObj) => {
|
||||
const {
|
||||
receivingStatus = null,
|
||||
onReceivingStatus,
|
||||
@@ -61,4 +61,5 @@ export default memo((props: propsObj) => {
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(AddressDetailBox)
|
||||
|
||||
@@ -23,8 +23,7 @@ interface Param {
|
||||
status: number // 订单状态
|
||||
}
|
||||
}
|
||||
|
||||
export default memo(({ orderInfo, onRefresh }: Param) => {
|
||||
const AdvanceOrderState = ({ orderInfo, onRefresh }: Param) => {
|
||||
const { showTime, onStart, timeStatus } = useTimeCountDown()
|
||||
|
||||
// 订单状态枚举
|
||||
@@ -68,4 +67,5 @@ export default memo(({ orderInfo, onRefresh }: Param) => {
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(AdvanceOrderState)
|
||||
|
||||
@@ -24,8 +24,7 @@ interface Param {
|
||||
account_period_time?: string // 还款日期
|
||||
}
|
||||
}
|
||||
|
||||
export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
const OrderState = ({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
useEffect(() => {
|
||||
console.log('orderInfo33::', 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}>
|
||||
<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 != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||
<View className={styles.order_status_content}>
|
||||
@@ -62,7 +61,7 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
</View>)}
|
||||
</View>
|
||||
{(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>
|
||||
</View>}
|
||||
<View className={styles.image_tag}>
|
||||
@@ -76,4 +75,5 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(OrderState)
|
||||
|
||||
@@ -9,17 +9,13 @@ interface Param {
|
||||
defaultValue?: string
|
||||
showInput: boolean
|
||||
}
|
||||
export default ({ onBlur, onSave, defaultValue = '', showInput = false }: Param) => {
|
||||
const Remark = ({ onBlur, onSave, defaultValue = '', showInput = false }: Param) => {
|
||||
const [descData, setDescData] = useState({
|
||||
number: 0,
|
||||
value: '',
|
||||
count: 200,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
getDesc(defaultValue)
|
||||
}, [defaultValue])
|
||||
|
||||
const getDesc = (value) => {
|
||||
let res = value
|
||||
if (value.length > descData.count) {
|
||||
@@ -31,6 +27,9 @@ export default ({ onBlur, onSave, defaultValue = '', showInput = false }: Param)
|
||||
const setSave = () => {
|
||||
onSave?.(descData.value)
|
||||
}
|
||||
useEffect(() => {
|
||||
getDesc(defaultValue)
|
||||
}, [defaultValue])
|
||||
return (
|
||||
<View className={styles.order_popup}>
|
||||
<View className={styles.order_popup_title}>编辑备注</View>
|
||||
@@ -45,3 +44,5 @@ export default ({ onBlur, onSave, defaultValue = '', showInput = false }: Param)
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default Remark
|
||||
|
||||
+336
-336
@@ -16,40 +16,165 @@ import BottomBtns from '@/components/BottomBtns'
|
||||
import { debounce } from '@/common/util'
|
||||
import {
|
||||
GetPayCode,
|
||||
mpsaleOrder,
|
||||
mpsaleOrderaddress,
|
||||
mpsaleOrdercancel,
|
||||
mpsaleOrderput,
|
||||
mpsaleOrderreceive,
|
||||
mpsaleOrdershipmentMode,
|
||||
mpshoppingCartproductColorlist,
|
||||
orderPaymentorderPaymentMethodInfo,
|
||||
orderPaymentorderPaymentSubmission,
|
||||
orderPaymentpreCollectOrderorderPaymentMethodInfo,
|
||||
orderPaymentpreCollectOrderorderPaymentSubmission,
|
||||
MpSaleOrder,
|
||||
MpSaleOrderAddress,
|
||||
MpSaleOrderCancel,
|
||||
MpSaleOrderPut,
|
||||
MpSaleOrderReceive,
|
||||
MpSaleOrderShipmentMode,
|
||||
MpShoppingCartProductColorList,
|
||||
OrderPaymentOrderPaymentMethodInfo,
|
||||
OrderPaymentOrderPaymentSubmission,
|
||||
OrderPaymentPreCollectOrderOrderPaymentMethodInfo,
|
||||
OrderPaymentPreCollectOrderOrderPaymentSubmission,
|
||||
} from '@/api/order'
|
||||
import { alert, goLink } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
import { PAY_H5_CODE_URL } from '@/common/constant'
|
||||
|
||||
export default () => {
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = (props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
}
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const OrderDetails = () => {
|
||||
const router = useRouter()
|
||||
// useEffect(() => {
|
||||
// getDetail()
|
||||
// }, [])
|
||||
useDidShow(() => {
|
||||
getDetail()
|
||||
})
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
// 收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState(null)
|
||||
// 切换自提或者物流
|
||||
const { fetchData: selectFetch } = mpsaleOrdershipmentMode()
|
||||
const { fetchData: selectFetch } = MpSaleOrderShipmentMode()
|
||||
// 订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
leftTitle: '订单编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '创建时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '发货时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '业务员:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
])
|
||||
const { fetchData: infoFetch } = MpSaleOrder()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
// 获取订单详情
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await infoFetch({ id: router.params.id })
|
||||
setInfoObj(res.data)
|
||||
orderMsg.forEach((it) => {
|
||||
if (it.leftTitle === '订单编号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '创建时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.create_time)
|
||||
}
|
||||
if (it.leftTitle === '发货时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.delivery_time)
|
||||
}
|
||||
if (it.leftTitle === '业务员:') {
|
||||
it.rightTitle = res.data.sale_user_name
|
||||
}
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
setReceivingStatus(res.data.shipment_mode)
|
||||
// 小程序提供的api,通知页面停止下拉刷新效果
|
||||
Taro.stopPullDownRefresh()
|
||||
Taro.hideLoading()
|
||||
}
|
||||
const onReceivingStatus = debounce(async(e, value) => {
|
||||
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 3 || infoObj.status === 11) {
|
||||
alert.error('不允许更改')
|
||||
@@ -92,36 +217,6 @@ export default () => {
|
||||
}
|
||||
}, 300)
|
||||
|
||||
const { fetchData: infoFetch } = mpsaleOrder()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
// 获取订单详情
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await infoFetch({ id: router.params.id })
|
||||
setInfoObj(res.data)
|
||||
orderMsg.map((it) => {
|
||||
if (it.leftTitle === '订单编号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '创建时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.create_time)
|
||||
}
|
||||
if (it.leftTitle === '发货时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.delivery_time)
|
||||
}
|
||||
if (it.leftTitle === '业务员:') {
|
||||
it.rightTitle = res.data.sale_user_name
|
||||
}
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
setReceivingStatus(res.data.shipment_mode)
|
||||
// 小程序提供的api,通知页面停止下拉刷新效果
|
||||
Taro.stopPullDownRefresh()
|
||||
Taro.hideLoading()
|
||||
}
|
||||
// 复制功能
|
||||
const clipboardData = () => {
|
||||
Taro.setClipboardData({
|
||||
@@ -138,30 +233,10 @@ export default () => {
|
||||
// useEffect(() => {
|
||||
// setReceivingStatus(receivingStatus)
|
||||
// }, [receivingStatus])
|
||||
// 订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
leftTitle: '订单编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '创建时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '发货时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '业务员:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
])
|
||||
|
||||
// 备注操作
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
const { fetchData: remarkFetch } = mpsaleOrderput()
|
||||
const { fetchData: remarkFetch } = MpSaleOrderPut()
|
||||
const getRemark = async() => {
|
||||
const res = await remarkFetch({ remark: infoObj.remark, id: Number(router.params.id) })
|
||||
if (res.msg === 'success') {
|
||||
@@ -183,7 +258,7 @@ export default () => {
|
||||
getDetail()
|
||||
}, [])
|
||||
|
||||
const { fetchData: cancelFetch } = mpsaleOrdercancel()
|
||||
const { fetchData: cancelFetch } = MpSaleOrderCancel()
|
||||
// 取消订单
|
||||
const cancle = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
@@ -216,7 +291,7 @@ export default () => {
|
||||
})
|
||||
}
|
||||
// 再次购买
|
||||
const { fetchData: buyFetch } = mpshoppingCartproductColorlist()
|
||||
const { fetchData: buyFetch } = MpShoppingCartProductColorList()
|
||||
const nextBuy = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
Taro.showLoading({
|
||||
@@ -254,8 +329,8 @@ export default () => {
|
||||
}
|
||||
}
|
||||
// 去支付逻辑
|
||||
const { fetchData: infoOneFetch } = orderPaymentorderPaymentMethodInfo()
|
||||
const { fetchData: infoTwoFetch } = orderPaymentpreCollectOrderorderPaymentMethodInfo()
|
||||
const { fetchData: infoOneFetch } = OrderPaymentOrderPaymentMethodInfo()
|
||||
const { fetchData: infoTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentMethodInfo()
|
||||
const [payList, setPayList] = useState<any[]>([
|
||||
{
|
||||
id: 2,
|
||||
@@ -290,6 +365,138 @@ export default () => {
|
||||
name: '扫码支付',
|
||||
},
|
||||
])
|
||||
|
||||
useDidShow(() => {
|
||||
getDetail()
|
||||
})
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
// 扫码支付
|
||||
const [showSide, setShowSide] = useState(true)
|
||||
const [title, setTitle] = useState('')
|
||||
const [picUrl, setPicUrl] = useState('')
|
||||
const { fetchData: payFetch } = GetPayCode()
|
||||
const handScanpay = async() => {
|
||||
const list: any = []
|
||||
infoObj.product_list.forEach((item) => {
|
||||
item.product_colors.forEach((it) => {
|
||||
list.push({
|
||||
product_code: item.code,
|
||||
product_name: item.name,
|
||||
product_color_code: it.product_color_code,
|
||||
product_color_name: it.product_color_name,
|
||||
num: it.roll.toString(),
|
||||
weight: formatWeightDiv(it.actual_weight).toString(),
|
||||
sale_price: (it.sale_price / 100).toString(),
|
||||
total_price:
|
||||
it.total_sale_price !== 0
|
||||
? (it.total_sale_price / 100).toString()
|
||||
: (it.estimate_amount / 100).toString(),
|
||||
length: (it.length / 100).toString(),
|
||||
weight_error: formatWeightDiv(it.weight_error).toString(),
|
||||
})
|
||||
})
|
||||
})
|
||||
const query = {
|
||||
list,
|
||||
title: '面料销售电子确认单',
|
||||
show_qrcode: true,
|
||||
show_barcode: true,
|
||||
show_wait_pay_amount: true,
|
||||
order_type: infoObj.sale_mode_name,
|
||||
shipment_mode: infoObj.shipment_mode_name,
|
||||
company: infoObj.title_purchaser_name,
|
||||
sale_user: infoObj.sale_user_name,
|
||||
order_created_time: formatDateTime(infoObj.create_time),
|
||||
order_no: infoObj.order_no,
|
||||
target_user_name: infoObj.target_user_name,
|
||||
target_address: infoObj.address_detail,
|
||||
target_description: infoObj.remark,
|
||||
pay_account: infoObj.transfer_remittance_account,
|
||||
bank_account_name: infoObj.account_name,
|
||||
bank_name: infoObj.bank_of_deposit,
|
||||
pay_type: infoObj.settle_mode_name,
|
||||
client: infoObj.purchaser_name,
|
||||
phone: infoObj.target_user_phone,
|
||||
order_total_length: (infoObj.total_number / 100).toString(),
|
||||
order_total_price: (
|
||||
infoObj.bill_total_sale_price / 100
|
||||
).toString(),
|
||||
total_weight_error_discount: (
|
||||
infoObj.total_weight_error_discount / 100
|
||||
).toString(),
|
||||
order_total_num: infoObj.total_number.toString(),
|
||||
qrcode: `${PAY_H5_CODE_URL}?sale_order_no=${infoObj.order_no}`,
|
||||
order_total_weight: (infoObj.total_weight / 1000).toString(),
|
||||
estimate_amount: (infoObj.estimate_amount / 100).toString(),
|
||||
total_sale_price: (infoObj.total_sale_price / 100).toString(),
|
||||
show_total_sale_price: true,
|
||||
show_total_weight_error_discount: true,
|
||||
actual_amount: (infoObj.actual_amount / 100).toString(),
|
||||
wait_pay_amount: (infoObj.wait_pay_amount / 100).toString(),
|
||||
order_total_weight_error: (
|
||||
infoObj.total_weight_error / 1000
|
||||
).toString(),
|
||||
}
|
||||
const res = await payFetch(query)
|
||||
if (res.data) {
|
||||
console.log(res.data.base64)
|
||||
setShowSide(false)
|
||||
setTitle('查看销售码单')
|
||||
setPicUrl(res.data.base64)
|
||||
}
|
||||
}
|
||||
|
||||
// 确认交易
|
||||
const { fetchData: payOneFetch } = OrderPaymentOrderPaymentSubmission()
|
||||
const { fetchData: payTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentSubmission()
|
||||
|
||||
// 显示支付
|
||||
const [showPay, setShowPay] = useState(false)
|
||||
// 显示线下汇款
|
||||
const [showOffline, setShowOffine] = useState(false)
|
||||
// 选择地址
|
||||
const handSelect = (obj) => {
|
||||
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 11 || infoObj.status === 3)) {
|
||||
alert.error('不允许更改')
|
||||
return false
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: `/pages/addressManager/index?orderId=${obj.id}&purchaser_id=${obj.purchaser_id}`,
|
||||
})
|
||||
}
|
||||
|
||||
// 申请退货
|
||||
const handApplyGood = () => {
|
||||
if (infoObj.av_return_product.length == 0) {
|
||||
return alert.error('暂无货物退')
|
||||
}
|
||||
else {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyGoods/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
setShowMore(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 申请退款
|
||||
const handApplyMoney = () => {
|
||||
// 三种类型的 待收货,已收货后申请退货退款,需要选择质量/非质量问题
|
||||
if (infoObj?.status == 8 || infoObj?.status == 9) {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyGoods/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
}
|
||||
else {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyMoney/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
}
|
||||
setShowMore(false)
|
||||
}
|
||||
const toPay = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
|
||||
@@ -372,102 +579,43 @@ export default () => {
|
||||
setTitle('待支付款项')
|
||||
setShowPay(true)
|
||||
}
|
||||
|
||||
// 选择支付方式
|
||||
const clickItem = (item) => {
|
||||
if (item.name === '扫码支付') { handScanpay() }
|
||||
if (item.name === '线下汇款') { setShowOffine(true) }
|
||||
payList.map((it) => {
|
||||
if (item.id === it.id) {
|
||||
it.checked = true
|
||||
}
|
||||
else {
|
||||
it.checked = false
|
||||
}
|
||||
return it
|
||||
// 确认收货
|
||||
const { fetchData: receveFetch } = MpSaleOrderReceive()
|
||||
const handSureGoods = async() => {
|
||||
Taro.showModal({
|
||||
content: '确认收货吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await receveFetch({ sale_order_id: Number(infoObj.id) })
|
||||
if (res?.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
})
|
||||
Taro.hideLoading()
|
||||
setShowMore(false)
|
||||
getDetail()
|
||||
}
|
||||
else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res?.msg,
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
setPayList([...payList])
|
||||
}
|
||||
|
||||
// 扫码支付
|
||||
const [showSide, setShowSide] = useState(true)
|
||||
const [title, setTitle] = useState('')
|
||||
const [picUrl, setPicUrl] = useState('')
|
||||
const { fetchData: payFetch } = GetPayCode()
|
||||
const handScanpay = async() => {
|
||||
const list: any = []
|
||||
infoObj.product_list.forEach((item) => {
|
||||
item.product_colors.forEach((it) => {
|
||||
list.push({
|
||||
product_code: item.code,
|
||||
product_name: item.name,
|
||||
product_color_code: it.product_color_code,
|
||||
product_color_name: it.product_color_name,
|
||||
num: it.roll.toString(),
|
||||
weight: formatWeightDiv(it.actual_weight).toString(),
|
||||
sale_price: (it.sale_price / 100).toString(),
|
||||
total_price:
|
||||
it.total_sale_price !== 0
|
||||
? (it.total_sale_price / 100).toString()
|
||||
: (it.estimate_amount / 100).toString(),
|
||||
length: (it.length / 100).toString(),
|
||||
weight_error: formatWeightDiv(it.weight_error).toString(),
|
||||
})
|
||||
})
|
||||
})
|
||||
const query = {
|
||||
list,
|
||||
title: '面料销售电子确认单',
|
||||
show_qrcode: true,
|
||||
show_barcode: true,
|
||||
show_wait_pay_amount: true,
|
||||
order_type: infoObj.sale_mode_name,
|
||||
shipment_mode: infoObj.shipment_mode_name,
|
||||
company: infoObj.title_purchaser_name,
|
||||
sale_user: infoObj.sale_user_name,
|
||||
order_created_time: formatDateTime(infoObj.create_time),
|
||||
order_no: infoObj.order_no,
|
||||
target_user_name: infoObj.target_user_name,
|
||||
target_address: infoObj.address_detail,
|
||||
target_description: infoObj.remark,
|
||||
pay_account: infoObj.transfer_remittance_account,
|
||||
bank_account_name: infoObj.account_name,
|
||||
bank_name: infoObj.bank_of_deposit,
|
||||
pay_type: infoObj.settle_mode_name,
|
||||
client: infoObj.purchaser_name,
|
||||
phone: infoObj.target_user_phone,
|
||||
order_total_length: (infoObj.total_number / 100).toString(),
|
||||
order_total_price: (
|
||||
infoObj.bill_total_sale_price / 100
|
||||
).toString(),
|
||||
total_weight_error_discount: (
|
||||
infoObj.total_weight_error_discount / 100
|
||||
).toString(),
|
||||
order_total_num: infoObj.total_number.toString(),
|
||||
qrcode: `${PAY_H5_CODE_URL}?sale_order_no=${infoObj.order_no}`,
|
||||
order_total_weight: (infoObj.total_weight / 1000).toString(),
|
||||
estimate_amount: (infoObj.estimate_amount / 100).toString(),
|
||||
total_sale_price: (infoObj.total_sale_price / 100).toString(),
|
||||
show_total_sale_price: true,
|
||||
show_total_weight_error_discount: true,
|
||||
actual_amount: (infoObj.actual_amount / 100).toString(),
|
||||
wait_pay_amount: (infoObj.wait_pay_amount / 100).toString(),
|
||||
order_total_weight_error: (
|
||||
infoObj.total_weight_error / 1000
|
||||
).toString(),
|
||||
}
|
||||
const res = await payFetch(query)
|
||||
if (res.data) {
|
||||
console.log(res.data.base64)
|
||||
setShowSide(false)
|
||||
setTitle('查看销售码单')
|
||||
setPicUrl(res.data.base64)
|
||||
}
|
||||
const onChange = (e) => {
|
||||
setInfoObj(val => ({ ...val, remark: e }))
|
||||
}
|
||||
|
||||
// 确认交易
|
||||
const { fetchData: payOneFetch } = orderPaymentorderPaymentSubmission()
|
||||
const { fetchData: payTwoFetch } = orderPaymentpreCollectOrderorderPaymentSubmission()
|
||||
const handsurePay = (obj) => {
|
||||
let arr: any = []
|
||||
// if (obj.status !== 10) {
|
||||
@@ -514,89 +662,6 @@ export default () => {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// 显示支付
|
||||
const [showPay, setShowPay] = useState(false)
|
||||
// 显示线下汇款
|
||||
const [showOffline, setShowOffine] = useState(false)
|
||||
// 选择地址
|
||||
const handSelect = (obj) => {
|
||||
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 11 || infoObj.status === 3)) {
|
||||
alert.error('不允许更改')
|
||||
return false
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: `/pages/addressManager/index?orderId=${obj.id}&purchaser_id=${obj.purchaser_id}`,
|
||||
})
|
||||
}
|
||||
|
||||
// 申请退货
|
||||
const handApplyGood = () => {
|
||||
if (infoObj.av_return_product.length == 0) {
|
||||
return alert.error('暂无货物退')
|
||||
}
|
||||
else {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyGoods/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
setShowMore(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 申请退款
|
||||
const handApplyMoney = () => {
|
||||
// 三种类型的 待收货,已收货后申请退货退款,需要选择质量/非质量问题
|
||||
if (infoObj?.status == 8 || infoObj?.status == 9) {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyGoods/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
}
|
||||
else {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/applyMoney/index?orderId=${infoObj.id}`,
|
||||
})
|
||||
}
|
||||
setShowMore(false)
|
||||
}
|
||||
|
||||
// 确认收货
|
||||
const { fetchData: receveFetch } = mpsaleOrderreceive()
|
||||
const handSureGoods = async() => {
|
||||
Taro.showModal({
|
||||
content: '确认收货吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await receveFetch({ sale_order_id: Number(infoObj.id) })
|
||||
if (res?.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
})
|
||||
Taro.hideLoading()
|
||||
setShowMore(false)
|
||||
getDetail()
|
||||
}
|
||||
else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res?.msg,
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const onChange = (e) => {
|
||||
setInfoObj(val => ({ ...val, remark: e }))
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setInfoObj(infoObj)
|
||||
}, [infoObj])
|
||||
@@ -632,7 +697,21 @@ export default () => {
|
||||
return '合计金额'
|
||||
}
|
||||
}, [infoObj])
|
||||
|
||||
// 选择支付方式
|
||||
const clickItem = (item) => {
|
||||
if (item.name === '扫码支付') { handScanpay() }
|
||||
if (item.name === '线下汇款') { setShowOffine(true) }
|
||||
payList.map((it) => {
|
||||
if (item.id === it.id) {
|
||||
it.checked = true
|
||||
}
|
||||
else {
|
||||
it.checked = false
|
||||
}
|
||||
return it
|
||||
})
|
||||
setPayList([...payList])
|
||||
}
|
||||
return (
|
||||
<View className={styles.mainBox}>
|
||||
{(infoObj?.status != 10 && <OrderState orderInfo={infoObj} />)}
|
||||
@@ -645,7 +724,7 @@ export default () => {
|
||||
receivingStatus={receivingStatus}
|
||||
onReceivingStatus={(e, value) => onReceivingStatus(e, value)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
<DefaultBoxWithMemo
|
||||
showMode
|
||||
title="客户信息"
|
||||
modeName={infoObj.sale_mode_name}
|
||||
@@ -654,10 +733,10 @@ export default () => {
|
||||
<View className={styles.pussName}>{infoObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{infoObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<View className={styles.total}> {infoObj.total_fabrics} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.productBox}>
|
||||
<GoodsItem list={infoObj?.product_list} obj={infoObj}></GoodsItem>
|
||||
<GoodsItemWithMemo list={infoObj?.product_list} obj={infoObj}></GoodsItemWithMemo>
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>{payFont}</View>
|
||||
@@ -692,7 +771,7 @@ export default () => {
|
||||
}
|
||||
|
||||
</View>
|
||||
<DefaultBox title="订单信息">
|
||||
<DefaultBoxWithMemo title="订单信息">
|
||||
{
|
||||
orderMsg.map((item, index) => {
|
||||
return (
|
||||
@@ -710,7 +789,7 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBox title="备注信息" showMode modeName={showRemarkFont} clickNode={() => setShowDesc(showRemarkFont != '')}>
|
||||
<View className={styles.remarkFont}>{infoObj.remark === '' ? '暂无' : infoObj.remark}</View>
|
||||
</DefaultBox>
|
||||
@@ -779,83 +858,4 @@ export default () => {
|
||||
</View >
|
||||
)
|
||||
}
|
||||
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default OrderDetails
|
||||
|
||||
@@ -10,7 +10,7 @@ interface propsObj {
|
||||
obj: any
|
||||
handUp?: (any) => void
|
||||
}
|
||||
export default memo((props: propsObj) => {
|
||||
const AddressDetailBox = (props: propsObj) => {
|
||||
const {
|
||||
obj = {},
|
||||
handUp,
|
||||
@@ -46,4 +46,5 @@ export default memo((props: propsObj) => {
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(AddressDetailBox)
|
||||
|
||||
@@ -24,8 +24,7 @@ interface Param {
|
||||
account_period_time?: string // 还款日期
|
||||
}
|
||||
}
|
||||
|
||||
export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
const OrderState = ({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
useEffect(() => {
|
||||
console.log('orderInfo33::', orderInfo)
|
||||
}, [orderInfo])
|
||||
@@ -48,7 +47,7 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
<>
|
||||
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
||||
<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 != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||
<View className={styles.order_status_content}>
|
||||
@@ -59,10 +58,11 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
</View>)}
|
||||
</View>
|
||||
{(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>
|
||||
</View>}
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(OrderState)
|
||||
|
||||
+164
-162
@@ -9,9 +9,9 @@ import OrderState from './components/orderState'
|
||||
import AddressDetailBox from './components/addressDetailBox'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpreturnApplyOrder,
|
||||
returnApplyOrdercancel,
|
||||
returnApplyOrderuploadAccessory,
|
||||
MpReturnApplyOrder,
|
||||
ReturnApplyOrderCancel,
|
||||
ReturnApplyOrderUploadAccessory,
|
||||
} from '@/api/refound'
|
||||
import { IMG_CND_Prefix } from '@/common/constant'
|
||||
import Popup from '@/components/popup'
|
||||
@@ -20,17 +20,150 @@ import { alert } from '@/common/common'
|
||||
import RefundCodelist from '@/components/RefundCodelist'
|
||||
import LabAndImg from '@/components/LabAndImg'
|
||||
|
||||
export default () => {
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = (props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: any
|
||||
}
|
||||
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
{
|
||||
it.texture_url === ''
|
||||
&& <Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== ''
|
||||
&& <View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
</View>
|
||||
}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const RefundDetail = () => {
|
||||
// 页面下拉刷新
|
||||
const router = useRouter()
|
||||
// 查看图片
|
||||
const [ShowPic, setShowPic] = useState(false)
|
||||
|
||||
const [PicList, setPicList] = useState<any[]>([])
|
||||
// 订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
leftTitle: '售后编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '订单号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '退货原因:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '退货说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '其他说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '货物状况:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '申请时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
])
|
||||
// 获取详情
|
||||
const { fetchData: detailFetch } = mpreturnApplyOrder()
|
||||
const { fetchData: detailFetch } = MpReturnApplyOrder()
|
||||
const [DeatailObj, setDeatailObj] = useState<any>({})
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
@@ -40,7 +173,7 @@ export default () => {
|
||||
const res = await detailFetch({ id: Number(router.params.id) })
|
||||
if (res.data) {
|
||||
setDeatailObj(res.data)
|
||||
orderMsg.map((it) => {
|
||||
orderMsg.forEach((it) => {
|
||||
if (it.leftTitle === '售后编号:') {
|
||||
it.rightTitle = res.data.return_order_no
|
||||
}
|
||||
@@ -82,40 +215,6 @@ export default () => {
|
||||
}
|
||||
}, [DeatailObj])
|
||||
|
||||
// 订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
leftTitle: '售后编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '订单号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '退货原因:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '退货说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '其他说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '货物状况:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '申请时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
])
|
||||
|
||||
// 复制功能
|
||||
const clipboardData = (val) => {
|
||||
Taro.setClipboardData({
|
||||
@@ -130,7 +229,7 @@ export default () => {
|
||||
}
|
||||
|
||||
// 取消退货
|
||||
const { fetchData: cancelFetch } = returnApplyOrdercancel()
|
||||
const { fetchData: cancelFetch } = ReturnApplyOrderCancel()
|
||||
const handCancle = async() => {
|
||||
Taro.showModal({
|
||||
content: '确定要取消吗?',
|
||||
@@ -160,10 +259,6 @@ export default () => {
|
||||
},
|
||||
})
|
||||
}
|
||||
// 查看图片
|
||||
const [ShowPic, setShowPic] = useState(false)
|
||||
|
||||
const [PicList, setPicList] = useState<any[]>([])
|
||||
|
||||
const handUp = (value) => {
|
||||
setShowPic(true)
|
||||
@@ -185,7 +280,7 @@ export default () => {
|
||||
}, [])
|
||||
|
||||
// 提交附件
|
||||
const { fetchData: sureFetch } = returnApplyOrderuploadAccessory()
|
||||
const { fetchData: sureFetch } = ReturnApplyOrderUploadAccessory()
|
||||
const handSure = () => {
|
||||
let arr: any = []
|
||||
arr = [...picUrl.current]
|
||||
@@ -234,7 +329,12 @@ export default () => {
|
||||
const handSee = () => {
|
||||
setShowCode(true)
|
||||
}
|
||||
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<OrderState orderInfo={DeatailObj} />
|
||||
@@ -242,7 +342,7 @@ export default () => {
|
||||
obj={DeatailObj}
|
||||
handUp={() => handUp(DeatailObj)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
<DefaultBoxWithMemo
|
||||
showMode
|
||||
title="客户信息"
|
||||
modeName={DeatailObj.sale_mode_name}
|
||||
@@ -251,9 +351,9 @@ export default () => {
|
||||
<View className={styles.pussName}>{DeatailObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{DeatailObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<DefaultBox title="退款信息">
|
||||
<GoodsItem list={productList} obj={DeatailObj}></GoodsItem>
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="退款信息">
|
||||
<GoodsItemWithMemo list={productList} obj={DeatailObj}></GoodsItemWithMemo>
|
||||
<View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>总计</View>
|
||||
<View className={styles.totalRight}>{DeatailObj.total_fabrics} 种面料,{DeatailObj?.total_colors} 种颜色,共 {
|
||||
@@ -270,8 +370,8 @@ export default () => {
|
||||
</View>
|
||||
|
||||
}
|
||||
</DefaultBox>
|
||||
<DefaultBox title="订单信息">
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="订单信息">
|
||||
{
|
||||
orderMsg.map((item, index) => {
|
||||
return (
|
||||
@@ -289,8 +389,8 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
</DefaultBox>
|
||||
<DefaultBox title="售后图片">
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="售后图片">
|
||||
<View className={styles.picBox}>
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
|
||||
@@ -305,7 +405,7 @@ export default () => {
|
||||
DeatailObj?.fabric_piece_accessory_url?.length === 0 && <View className={styles.noPic}>暂无图片</View>
|
||||
}
|
||||
</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<View className={styles.safeBox}></View>
|
||||
|
||||
<View className={styles.bottomMuck}>
|
||||
@@ -336,102 +436,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: any
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
{
|
||||
it.texture_url === ''
|
||||
&& <Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== ''
|
||||
&& <View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
</View>
|
||||
}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default RefundDetail
|
||||
|
||||
@@ -9,7 +9,7 @@ interface propsObj {
|
||||
obj: any
|
||||
handUp?: (any) => void
|
||||
}
|
||||
export default memo((props: propsObj) => {
|
||||
const AddressDetailBox = (props: propsObj) => {
|
||||
const {
|
||||
obj = {},
|
||||
handUp,
|
||||
@@ -46,4 +46,5 @@ export default memo((props: propsObj) => {
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(AddressDetailBox)
|
||||
|
||||
@@ -24,8 +24,7 @@ interface Param {
|
||||
account_period_time?: string // 还款日期
|
||||
}
|
||||
}
|
||||
|
||||
export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
const OrderState = ({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
useEffect(() => {
|
||||
console.log('orderInfo33::', orderInfo)
|
||||
}, [orderInfo])
|
||||
@@ -48,7 +47,7 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
<>
|
||||
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
||||
<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 != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||
<View className={styles.order_status_content}>
|
||||
@@ -59,10 +58,11 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s
|
||||
</View>)}
|
||||
</View>
|
||||
{(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>
|
||||
</View>}
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(OrderState)
|
||||
|
||||
@@ -8,65 +8,122 @@ import ItemList from './components/itemList'
|
||||
import OrderState from './components/orderState'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpreturnApplyOrder,
|
||||
returnApplyOrdercancel,
|
||||
returnApplyOrderuploadAccessory,
|
||||
MpReturnApplyOrder,
|
||||
ReturnApplyOrderCancel,
|
||||
ReturnApplyOrderUploadAccessory,
|
||||
} from '@/api/refound'
|
||||
// import AddressDetailBox from './components/addressDetailBox'
|
||||
import { IMG_CND_Prefix } from '@/common/constant'
|
||||
import RefundCodelist from '@/components/RefundCodelist'
|
||||
import LabAndImg from '@/components/LabAndImg'
|
||||
|
||||
export default () => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = (props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: any
|
||||
}
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item?.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
{
|
||||
it.texture_url === ''
|
||||
&& <Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== ''
|
||||
&& <View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
</View>
|
||||
}
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const RefundMoneyDetail = () => {
|
||||
const router = useRouter()
|
||||
|
||||
// 获取详情
|
||||
const { fetchData: detailFetch } = mpreturnApplyOrder()
|
||||
const { fetchData: detailFetch } = MpReturnApplyOrder()
|
||||
const [DeatailObj, setDeatailObj] = useState<any>({})
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await detailFetch({ id: Number(router.params.id) })
|
||||
if (res.data) {
|
||||
setDeatailObj(res.data)
|
||||
orderMsg.map((it) => {
|
||||
if (it.leftTitle === '售后编号:') {
|
||||
it.rightTitle = res.data.return_order_no
|
||||
}
|
||||
if (it.leftTitle === '订单号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '退货原因:') {
|
||||
it.rightTitle = res.data.return_reason_name
|
||||
}
|
||||
if (it.leftTitle === '退货说明:') {
|
||||
it.rightTitle = res.data.return_explain_name
|
||||
}
|
||||
if (it.leftTitle === '其他说明:') {
|
||||
it.rightTitle = res.data.reason_describe
|
||||
}
|
||||
// if (it.leftTitle === '货物状况:') {
|
||||
// it.rightTitle = res.data.goods_status_name
|
||||
// }
|
||||
if (it.leftTitle === '申请时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.apply_time)
|
||||
}
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
Taro.stopPullDownRefresh()
|
||||
// setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
|
||||
Taro.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 分辨用质检中还是质检前的数组
|
||||
const productList = useMemo(() => {
|
||||
@@ -124,9 +181,45 @@ export default () => {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await detailFetch({ id: Number(router.params.id) })
|
||||
if (res.data) {
|
||||
setDeatailObj(res.data)
|
||||
orderMsg.forEach((it) => {
|
||||
if (it.leftTitle === '售后编号:') {
|
||||
it.rightTitle = res.data.return_order_no
|
||||
}
|
||||
if (it.leftTitle === '订单号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '退货原因:') {
|
||||
it.rightTitle = res.data.return_reason_name
|
||||
}
|
||||
if (it.leftTitle === '退货说明:') {
|
||||
it.rightTitle = res.data.return_explain_name
|
||||
}
|
||||
if (it.leftTitle === '其他说明:') {
|
||||
it.rightTitle = res.data.reason_describe
|
||||
}
|
||||
// if (it.leftTitle === '货物状况:') {
|
||||
// it.rightTitle = res.data.goods_status_name
|
||||
// }
|
||||
if (it.leftTitle === '申请时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.apply_time)
|
||||
}
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
Taro.stopPullDownRefresh()
|
||||
// setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
|
||||
Taro.hideLoading()
|
||||
}
|
||||
}
|
||||
// 取消退货
|
||||
const { fetchData: cancelFetch } = returnApplyOrdercancel()
|
||||
const { fetchData: cancelFetch } = ReturnApplyOrderCancel()
|
||||
const handCancle = async() => {
|
||||
Taro.showModal({
|
||||
content: '确定要取消吗?',
|
||||
@@ -193,6 +286,13 @@ export default () => {
|
||||
setShowCode(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<OrderState orderInfo={DeatailObj} />
|
||||
@@ -200,7 +300,7 @@ export default () => {
|
||||
obj={DeatailObj}
|
||||
handUp={() => handUp(DeatailObj)}
|
||||
></AddressDetailBox> */}
|
||||
<DefaultBox
|
||||
<DefaultBoxWithMemo
|
||||
showMode
|
||||
title="客户信息"
|
||||
modeName={DeatailObj.sale_mode_name}
|
||||
@@ -209,9 +309,9 @@ export default () => {
|
||||
<View className={styles.pussName}>{DeatailObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{DeatailObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<DefaultBox title="退款信息">
|
||||
<GoodsItem list={productList} obj={DeatailObj}></GoodsItem>
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="退款信息">
|
||||
<GoodsItemWithMemo list={productList} obj={DeatailObj}></GoodsItemWithMemo>
|
||||
<View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>总计</View>
|
||||
<View className={styles.totalRight}>{DeatailObj.total_fabrics} 种面料,{DeatailObj?.total_colors} 种颜色,共 {
|
||||
@@ -251,8 +351,8 @@ export default () => {
|
||||
}</View>
|
||||
</View>
|
||||
}
|
||||
</DefaultBox>
|
||||
<DefaultBox title="订单信息">
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="订单信息">
|
||||
{
|
||||
orderMsg.map((item, index) => {
|
||||
return (
|
||||
@@ -270,8 +370,8 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
</DefaultBox>
|
||||
<DefaultBox title="售后图片">
|
||||
</DefaultBoxWithMemo>
|
||||
<DefaultBoxWithMemo title="售后图片">
|
||||
<View className={styles.picBox}>
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
|
||||
@@ -286,7 +386,7 @@ export default () => {
|
||||
DeatailObj?.fabric_piece_accessory_url?.length === 0 && <View className={styles.noPic}>暂无图片</View>
|
||||
}
|
||||
</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<View className={styles.safeBox}></View>
|
||||
<View className={styles.bottomMuck}>
|
||||
{
|
||||
@@ -307,102 +407,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: any
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item?.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
{
|
||||
it.texture_url === ''
|
||||
&& <Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== ''
|
||||
&& <View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
</View>
|
||||
}
|
||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default RefundMoneyDetail
|
||||
|
||||
@@ -14,8 +14,7 @@ interface propsObj {
|
||||
toPay?: (arg: any, obj: any) => void
|
||||
handSee?: (any) => void
|
||||
}
|
||||
|
||||
export default memo((props: propsObj) => {
|
||||
const ItemList = (props: propsObj) => {
|
||||
const navTo = (e) => {
|
||||
if (e.type == 1) {
|
||||
Taro.navigateTo({
|
||||
@@ -124,4 +123,5 @@ export default memo((props: propsObj) => {
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(ItemList)
|
||||
|
||||
@@ -7,7 +7,7 @@ interface Props {
|
||||
list: any[]
|
||||
handChose?: (any) => void
|
||||
}
|
||||
export default memo((props: Props) => {
|
||||
const Tabs = (props: Props) => {
|
||||
const { list = [], handChose } = props
|
||||
|
||||
return (
|
||||
@@ -29,4 +29,5 @@ export default memo((props: Props) => {
|
||||
}
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
export default memo(Tabs)
|
||||
|
||||
@@ -12,15 +12,15 @@ import Popup from '@/components/popup'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpenumreturnStage,
|
||||
mpenumreturnType,
|
||||
mpreturnApplyOrderlist,
|
||||
MpEnumReturnStage,
|
||||
MpEnumReturnType,
|
||||
MpReturnApplyOrderList,
|
||||
} from '@/api/refound'
|
||||
import TimePickerPopup from '@/components/timePickerPopup'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
import RefundCodelist from '@/components/RefundCodelist'
|
||||
|
||||
export default () => {
|
||||
const RefundPage = () => {
|
||||
// 页码和页数
|
||||
|
||||
const [searchField, setSearchField] = useState<
|
||||
@@ -47,24 +47,9 @@ export default () => {
|
||||
})
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
|
||||
// 监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField.size, searchField.name, searchField.status])
|
||||
|
||||
// 获取订单列表
|
||||
const { fetchData: listFetchData, state: orderState } = mpreturnApplyOrderlist()
|
||||
const { fetchData: listFetchData, state: orderState } = MpReturnApplyOrderList()
|
||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||
const getOrderList = async() => {
|
||||
const res = await listFetchData({
|
||||
...searchField,
|
||||
// ...getFilterData(searchField),
|
||||
// ...getFilterData(searchObj)
|
||||
})
|
||||
setOrderData(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
// setshowPopup(false)
|
||||
setRefresherTriggeredStatus(false)
|
||||
}
|
||||
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
@@ -75,12 +60,7 @@ export default () => {
|
||||
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.size = 1
|
||||
setRefresherTriggeredStatus(true)
|
||||
setSearchField(val => ({ ...val, size: 10 }))
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading! })
|
||||
@@ -99,7 +79,7 @@ export default () => {
|
||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '售后申请', showBorder: true }, { id: 2, name: '申请记录', showBorder: false }])
|
||||
const handChose = (item) => {
|
||||
if (item.id === searchField.status) { return }
|
||||
TarBarList.map((it) => {
|
||||
TarBarList.forEach((it) => {
|
||||
if (it.id === item.id) {
|
||||
it.showBorder = true
|
||||
}
|
||||
@@ -141,14 +121,10 @@ export default () => {
|
||||
setModeList([...modeList])
|
||||
setSearchField(e => ({ ...e, sale_mode: item.id }))
|
||||
}
|
||||
useEffect(() => {
|
||||
getStagelist()
|
||||
getTypeList()
|
||||
}, [])
|
||||
|
||||
// 售后状态
|
||||
const [stageList, setStageList] = useState<any[]>([])
|
||||
const { fetchData: stageFetch } = mpenumreturnStage()
|
||||
const { fetchData: stageFetch } = MpEnumReturnStage()
|
||||
const getStagelist = async() => {
|
||||
const res = await stageFetch()
|
||||
if (res.data) {
|
||||
@@ -178,7 +154,7 @@ export default () => {
|
||||
|
||||
// 退款类型
|
||||
const [typeList, setTypeList] = useState<any[]>([])
|
||||
const { fetchData: typeFetch } = mpenumreturnType()
|
||||
const { fetchData: typeFetch } = MpEnumReturnType()
|
||||
const getTypeList = async() => {
|
||||
const res = await typeFetch()
|
||||
if (res.data) {
|
||||
@@ -221,6 +197,59 @@ export default () => {
|
||||
}
|
||||
}, [searchField])
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.checked = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
|
||||
// 展示时间筛选
|
||||
const [showTime, setShowTime] = useState(false)
|
||||
// 关闭时间筛选
|
||||
const handClose = () => {
|
||||
setShowTime(false)
|
||||
}
|
||||
const myDate = new Date()
|
||||
const [start, setStart] = useState<any>(myDate.toLocaleDateString())
|
||||
const [end, setEnd] = useState<any>('')
|
||||
// 选择时间
|
||||
const handTime = (eq) => {
|
||||
// 直接进来点确定的时候做处理
|
||||
if (Object.keys(eq).length === 0) {
|
||||
const obj = {
|
||||
start: '',
|
||||
end: '',
|
||||
}
|
||||
obj.start = `${dayjs(new Date(`${myDate?.toLocaleDateString()} ` + '00:00:00')).format('YYYY-MM-DD')} 00:00:00`
|
||||
obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
eq.value = obj
|
||||
}
|
||||
setSearchField(val => ({ ...val, sale_start_time: eq?.value?.start, sale_end_time: eq?.value?.end, size: 10 }))
|
||||
setStart(eq?.value?.start)
|
||||
setEnd(eq?.value?.end)
|
||||
setShowTime(false)
|
||||
}
|
||||
const getOrderList = async() => {
|
||||
const res = await listFetchData({
|
||||
...searchField,
|
||||
// ...getFilterData(searchField),
|
||||
// ...getFilterData(searchObj)
|
||||
})
|
||||
setOrderData(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
// setshowPopup(false)
|
||||
setRefresherTriggeredStatus(false)
|
||||
}
|
||||
const timeArea = useMemo(() => {
|
||||
if (end !== '') {
|
||||
return `${start} ` + '-' + ` ${end}`
|
||||
}
|
||||
else {
|
||||
return '自定义起始时间'
|
||||
}
|
||||
}, [end])
|
||||
// 重置
|
||||
const handReset = () => {
|
||||
const arrOne = resetArr(modeList)
|
||||
@@ -241,59 +270,18 @@ export default () => {
|
||||
getOrderList()
|
||||
setEnd('')
|
||||
}
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.checked = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
|
||||
// 展示时间筛选
|
||||
const [showTime, setShowTime] = useState(false)
|
||||
// 关闭时间筛选
|
||||
const handClose = () => {
|
||||
setShowTime(false)
|
||||
}
|
||||
let myDate = new Date()
|
||||
const [start, setStart] = useState<any>(myDate.toLocaleDateString())
|
||||
const [end, setEnd] = useState<any>('')
|
||||
// 选择时间
|
||||
const handTime = (eq) => {
|
||||
// 直接进来点确定的时候做处理
|
||||
if (Object.keys(eq).length === 0) {
|
||||
const obj = {
|
||||
start: '',
|
||||
end: '',
|
||||
}
|
||||
obj.start = `${dayjs(new Date(`${myDate?.toLocaleDateString()} ` + '00:00:00')).format('YYYY-MM-DD')} 00:00:00`,
|
||||
obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
eq.value = obj
|
||||
}
|
||||
setSearchField(val => ({ ...val, sale_start_time: eq?.value?.start, sale_end_time: eq?.value?.end, size: 10 }))
|
||||
setStart(eq?.value?.start)
|
||||
setEnd(eq?.value?.end)
|
||||
setShowTime(false)
|
||||
}
|
||||
|
||||
const timeArea = useMemo(() => {
|
||||
if (end !== '') {
|
||||
return `${start} ` + '-' + ` ${end}`
|
||||
}
|
||||
else {
|
||||
return '自定义起始时间'
|
||||
}
|
||||
}, [end])
|
||||
|
||||
const handSure = () => {
|
||||
pageNum.current.page = 1
|
||||
setSearchField(val => ({ ...val, size: 10 }))
|
||||
setshowPopup?.(false)
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.size = 1
|
||||
setRefresherTriggeredStatus(true)
|
||||
setSearchField(val => ({ ...val, size: 10 }))
|
||||
getOrderList()
|
||||
}
|
||||
useEffect(() => {
|
||||
setSearchField(searchField)
|
||||
}, [searchField])
|
||||
@@ -305,7 +293,14 @@ export default () => {
|
||||
setItemInfo(item)
|
||||
setShowCode(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getStagelist()
|
||||
getTypeList()
|
||||
}, [])
|
||||
// 监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField.size, searchField.name, searchField.status])
|
||||
return (
|
||||
<>
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
@@ -416,3 +411,5 @@ export default () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default RefundPage
|
||||
|
||||
+277
-280
@@ -77,8 +77,278 @@ const FilterTimeOptions = {
|
||||
},
|
||||
}
|
||||
|
||||
// 需要传进来的数据示例
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const productRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'product_name',
|
||||
title: '面料名称',
|
||||
dataIndex: 'product_name',
|
||||
width: '20%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '30%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '交易金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const purchaserRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'purchaser_name',
|
||||
title: '客户名称',
|
||||
dataIndex: 'purchaser_name',
|
||||
width: '20%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '交易匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '30%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '交易金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const salesmanRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'sale_user_name',
|
||||
title: '业务员名称',
|
||||
dataIndex: 'sale_user_name',
|
||||
width: '25%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '销售匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '25%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '销售金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
const tabsConfig = [
|
||||
{
|
||||
name: '面料',
|
||||
key: 0,
|
||||
},
|
||||
{
|
||||
name: '客户',
|
||||
key: 1,
|
||||
},
|
||||
{
|
||||
name: '业务员',
|
||||
key: 2,
|
||||
},
|
||||
]
|
||||
|
||||
interface RankingBlockPropsType {
|
||||
saleType?: number | null
|
||||
saleDepartmentId?: number | null
|
||||
date_min?: string
|
||||
date_max?: string
|
||||
}
|
||||
// 销售排行
|
||||
const RankingBlock = (props: RankingBlockPropsType) => {
|
||||
const { saleType, saleDepartmentId, date_min, date_max } = props
|
||||
|
||||
const { fetchData: fetchProductRank } = ProductRankApi()
|
||||
const { fetchData: fetchPurchaserRank } = PurchaserRankApi()
|
||||
const { fetchData: fetchSalesmanRank } = SalesmanRankApi()
|
||||
|
||||
const [limit, setLimit] = useState(defaultLimit)
|
||||
|
||||
const [indicator, setIndicator] = useState<number | null>(null)
|
||||
|
||||
// 切换排行指标
|
||||
const onChangeIndicators = useCallback((indicators: number) => {
|
||||
console.log('indicators', indicators)
|
||||
if (indicators === -1) {
|
||||
setIndicator(null)
|
||||
}
|
||||
else {
|
||||
setIndicator(indicators)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const [currentKey, setCurrentKey] = useState(tabsConfig[0].key)
|
||||
|
||||
const handleClickTab = (event) => {
|
||||
const key = event.target.dataset.key
|
||||
if (key === currentKey) { return }
|
||||
setCurrentKey(key)
|
||||
setLimit(defaultLimit)
|
||||
}
|
||||
const [currentTable, setCurrentTable] = useState<TablePropsType>({
|
||||
columns: productRankingColumns,
|
||||
})
|
||||
const getData = useCallback(
|
||||
async(tabKey: number) => {
|
||||
let res: any
|
||||
const payload = {
|
||||
limit,
|
||||
saleType,
|
||||
saleDepartmentId,
|
||||
date_min,
|
||||
date_max,
|
||||
data_form_status: indicator,
|
||||
}
|
||||
if (tabKey === 0) {
|
||||
res = await fetchProductRank(getFilterData(payload))
|
||||
}
|
||||
else if (tabKey === 1) {
|
||||
res = await fetchPurchaserRank(getFilterData(payload))
|
||||
}
|
||||
else {
|
||||
res = await fetchSalesmanRank(getFilterData(payload))
|
||||
}
|
||||
if (res.data) {
|
||||
console.log('排名', res.data)
|
||||
if (tabKey === 0) {
|
||||
setCurrentTable(() => ({
|
||||
columns: productRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
product_name: item.product_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
else if (tabKey === 1) {
|
||||
setCurrentTable(() => ({
|
||||
columns: purchaserRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
purchaser_name: item.purchaser_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
else {
|
||||
setCurrentTable(() => ({
|
||||
columns: salesmanRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
sale_user_name: item.sale_user_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
[limit, saleType, saleDepartmentId, date_min, date_max, indicator],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
getData(currentKey)
|
||||
}, [currentKey, getData])
|
||||
|
||||
const handleLoadMore = () => {
|
||||
console.log('loadmore')
|
||||
// TODO(优化):结合接口的offset 和 limit 分段请求接口然后通过 push 将旧数据和新数据拼接起来
|
||||
setLimit(v => v + defaultLimit)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 销售排行 */}
|
||||
<LayoutBlock circle flexDirection="col" customStyle={{ padding: 0 }}>
|
||||
<View className={classnames(styles.rankingIndicatorTitle, 'flex-row justify-between')} style={{ position: 'relative' }}>
|
||||
<View className="flex-row items-center">
|
||||
<Iconfont name="icon-paiming" size={32}></Iconfont>
|
||||
<Text className={styles.title}>销售排行</Text>
|
||||
</View>
|
||||
<View style={{ width: '90px' }}>
|
||||
<SelectSaleRankingIndicators onChange={onChangeIndicators} dropDownStyle={{ padding: '16rpx 0' }}></SelectSaleRankingIndicators>
|
||||
</View>
|
||||
</View>
|
||||
<View style={{ padding: '0 32rpx' }}>
|
||||
<Divider direction="horizontal" customStyles={{ margin: '10rpx 0 20rpx 0' }}></Divider>
|
||||
<View className={styles.rankingTabs} onClick={handleClickTab}>
|
||||
{tabsConfig.map((item) => {
|
||||
return (
|
||||
<View data-key={item.key} className={classnames(styles.rankingTab, item.key === currentKey ? styles.active : '')} key={item.key}>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
<Table columns={currentTable.columns} dataSource={currentTable.dataSource} onLoadMore={handleLoadMore}></Table>
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
</>
|
||||
)
|
||||
}
|
||||
const RankingBlockWithMemo = memo<RankingBlockPropsType>(RankingBlock)
|
||||
|
||||
// 销售统计
|
||||
const saleStatistic = () => {
|
||||
const SaleStatistic = () => {
|
||||
const { fetchData } = SaleOrderDataFormApi()
|
||||
|
||||
const [saleType, setSaleType] = useState<number | null>(null)
|
||||
@@ -88,10 +358,6 @@ const saleStatistic = () => {
|
||||
date_max: FilterTimeOptions[0].date_max,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
getData()
|
||||
}, [saleType, saleDepartmentId, dateRange])
|
||||
|
||||
const getData = async() => {
|
||||
const res = await fetchData(
|
||||
getFilterData({
|
||||
@@ -164,14 +430,16 @@ const saleStatistic = () => {
|
||||
const selectSaleTypeRef = useRef<any>(null)
|
||||
const selectMarketingDepartmentRef = useRef<any>(null)
|
||||
const selectTimePickerRef = useRef<any>(null)
|
||||
|
||||
useEffect(() => {
|
||||
getData()
|
||||
}, [saleType, saleDepartmentId, dateRange])
|
||||
return (
|
||||
<View className={styles.saleStatistic}>
|
||||
<View className={styles['saleStatistic--filterBar']}>
|
||||
<SelectGroup>
|
||||
<SelectSaleType onChange={onChangeSaleType} defaultValue={-1} onCloseOverlay={() => true} ref={selectSaleTypeRef}></SelectSaleType>
|
||||
<SelectMarketingDepartment onChange={onChangeDepartment} onCloseOverlay={() => true} ref={selectMarketingDepartmentRef}></SelectMarketingDepartment>
|
||||
<SelectTimePicker onChange={onChangeTimePicker} onCloseOverlay={() => true} defaultValue="0" timeOptions={FilterTimeOptions} ref={selectTimePickerRef}></SelectTimePicker>
|
||||
<SelectTimePicker onChange={onChangeTimePicker} onCloseOverlay={() => true} defaultValue={0} timeOptions={FilterTimeOptions} ref={selectTimePickerRef}></SelectTimePicker>
|
||||
</SelectGroup>
|
||||
</View>
|
||||
<View className={styles['saleStatistic--content']}>
|
||||
@@ -319,281 +587,10 @@ const saleStatistic = () => {
|
||||
)
|
||||
})}
|
||||
</LayoutBlock>
|
||||
<RankingBlock saleType={saleType} saleDepartmentId={saleDepartmentId} date_min={dateRange.date_min} date_max={dateRange.date_max}></RankingBlock>
|
||||
<RankingBlockWithMemo saleType={saleType} saleDepartmentId={saleDepartmentId} date_min={dateRange.date_min} date_max={dateRange.date_max}></RankingBlockWithMemo>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 需要传进来的数据示例
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const productRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'product_name',
|
||||
title: '面料名称',
|
||||
dataIndex: 'product_name',
|
||||
width: '20%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '30%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '交易金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const purchaserRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'purchaser_name',
|
||||
title: '客户名称',
|
||||
dataIndex: 'purchaser_name',
|
||||
width: '20%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '交易匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '30%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '交易金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
// 需要传进来的表头数据示例
|
||||
const salesmanRankingColumns = [
|
||||
{
|
||||
key: 'index',
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: '20%',
|
||||
},
|
||||
{
|
||||
key: 'sale_user_name',
|
||||
title: '业务员名称',
|
||||
dataIndex: 'sale_user_name',
|
||||
width: '25%',
|
||||
ellipsis: {
|
||||
isEllipsis: true,
|
||||
rows: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'roll',
|
||||
title: '销售匹数',
|
||||
dataIndex: 'roll',
|
||||
width: '25%',
|
||||
},
|
||||
{
|
||||
key: 'sales_amount',
|
||||
title: '销售金额',
|
||||
dataIndex: 'sales_amount',
|
||||
width: '30%',
|
||||
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
|
||||
},
|
||||
]
|
||||
|
||||
const tabsConfig = [
|
||||
{
|
||||
name: '面料',
|
||||
key: 0,
|
||||
},
|
||||
{
|
||||
name: '客户',
|
||||
key: 1,
|
||||
},
|
||||
{
|
||||
name: '业务员',
|
||||
key: 2,
|
||||
},
|
||||
]
|
||||
|
||||
interface RankingBlockPropsType {
|
||||
saleType?: number | null
|
||||
saleDepartmentId?: number | null
|
||||
date_min?: string
|
||||
date_max?: string
|
||||
}
|
||||
// 销售排行
|
||||
const RankingBlock = memo<RankingBlockPropsType>((props) => {
|
||||
const { saleType, saleDepartmentId, date_min, date_max } = props
|
||||
|
||||
const { fetchData: fetchProductRank } = ProductRankApi()
|
||||
const { fetchData: fetchPurchaserRank } = PurchaserRankApi()
|
||||
const { fetchData: fetchSalesmanRank } = SalesmanRankApi()
|
||||
|
||||
const [limit, setLimit] = useState(defaultLimit)
|
||||
|
||||
const [indicator, setIndicator] = useState<number | null>(null)
|
||||
|
||||
// 切换排行指标
|
||||
const onChangeIndicators = useCallback((indicators: number) => {
|
||||
console.log('indicators', indicators)
|
||||
if (indicators === -1) {
|
||||
setIndicator(null)
|
||||
}
|
||||
else {
|
||||
setIndicator(indicators)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const [currentKey, setCurrentKey] = useState(tabsConfig[0].key)
|
||||
|
||||
const handleClickTab = (event) => {
|
||||
const key = event.target.dataset.key
|
||||
if (key === currentKey) { return }
|
||||
setCurrentKey(key)
|
||||
setLimit(defaultLimit)
|
||||
}
|
||||
|
||||
const getData = useCallback(
|
||||
async(tabKey: number) => {
|
||||
let res: any
|
||||
const payload = {
|
||||
limit,
|
||||
saleType,
|
||||
saleDepartmentId,
|
||||
date_min,
|
||||
date_max,
|
||||
data_form_status: indicator,
|
||||
}
|
||||
if (tabKey === 0) {
|
||||
res = await fetchProductRank(getFilterData(payload))
|
||||
}
|
||||
else if (tabKey === 1) {
|
||||
res = await fetchPurchaserRank(getFilterData(payload))
|
||||
}
|
||||
else {
|
||||
res = await fetchSalesmanRank(getFilterData(payload))
|
||||
}
|
||||
if (res.data) {
|
||||
console.log('排名', res.data)
|
||||
if (tabKey === 0) {
|
||||
setCurrentTable(() => ({
|
||||
columns: productRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
product_name: item.product_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
else if (tabKey === 1) {
|
||||
setCurrentTable(() => ({
|
||||
columns: purchaserRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
purchaser_name: item.purchaser_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
else {
|
||||
setCurrentTable(() => ({
|
||||
columns: salesmanRankingColumns,
|
||||
dataSource: {
|
||||
list: res.data.list.map((item, index: number) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
sale_user_name: item.sale_user_name || '--',
|
||||
sales_amount: `¥${priceformat(item.sales_amount)}`,
|
||||
roll: dataUnit(item.roll),
|
||||
})),
|
||||
total: res.data.total,
|
||||
},
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
[limit, saleType, saleDepartmentId, date_min, date_max, indicator],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
getData(currentKey)
|
||||
}, [currentKey, getData])
|
||||
|
||||
const handleLoadMore = () => {
|
||||
console.log('loadmore')
|
||||
// TODO(优化):结合接口的offset 和 limit 分段请求接口然后通过 push 将旧数据和新数据拼接起来
|
||||
setLimit(v => v + defaultLimit)
|
||||
}
|
||||
|
||||
const [currentTable, setCurrentTable] = useState<TablePropsType>({
|
||||
columns: productRankingColumns,
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 销售排行 */}
|
||||
<LayoutBlock circle flexDirection="col" customStyle={{ padding: 0 }}>
|
||||
<View className={classnames(styles.rankingIndicatorTitle, 'flex-row justify-between')} style={{ position: 'relative' }}>
|
||||
<View className="flex-row items-center">
|
||||
<Iconfont name="icon-paiming" size={32}></Iconfont>
|
||||
<Text className={styles.title}>销售排行</Text>
|
||||
</View>
|
||||
<View style={{ width: '90px' }}>
|
||||
<SelectSaleRankingIndicators onChange={onChangeIndicators} dropDownStyle={{ padding: '16rpx 0' }}></SelectSaleRankingIndicators>
|
||||
</View>
|
||||
</View>
|
||||
<View style={{ padding: '0 32rpx' }}>
|
||||
<Divider direction="horizontal" customStyles={{ margin: '10rpx 0 20rpx 0' }}></Divider>
|
||||
<View className={styles.rankingTabs} onClick={handleClickTab}>
|
||||
{tabsConfig.map((item) => {
|
||||
return (
|
||||
<View data-key={item.key} className={classnames(styles.rankingTab, item.key === currentKey ? styles.active : '')} key={item.key}>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
<Table columns={currentTable.columns} dataSource={currentTable.dataSource} onLoadMore={handleLoadMore}></Table>
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
||||
export default saleStatistic
|
||||
export default SaleStatistic
|
||||
|
||||
@@ -4,11 +4,11 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import Search from '@/components/search'
|
||||
import { mpenumsaleUserlist } from '@/api/order'
|
||||
import { MpEnumSaleUserList } from '@/api/order'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
|
||||
export default () => {
|
||||
const SaleUserPage = () => {
|
||||
const [search, setSearch] = useState({
|
||||
name: null,
|
||||
page: 1,
|
||||
@@ -16,7 +16,7 @@ export default () => {
|
||||
})
|
||||
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||
|
||||
const { fetchData: clitentFetch, state: orderState } = mpenumsaleUserlist()
|
||||
const { fetchData: clitentFetch, state: orderState } = MpEnumSaleUserList()
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading! })
|
||||
@@ -27,6 +27,7 @@ export default () => {
|
||||
saleuserName: '',
|
||||
})
|
||||
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((eq) => {
|
||||
pageNum.current.page = 1
|
||||
@@ -36,15 +37,7 @@ export default () => {
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (search.name === '') {
|
||||
setSearch(e => ({ ...e, name: null }))
|
||||
}
|
||||
if (search.name !== '') { getCuss() }
|
||||
}, [search])
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
const getScrolltolower = useCallback(() => {
|
||||
if (clentList.list.length < clentList.total) {
|
||||
pageNum.current.page++
|
||||
@@ -113,6 +106,13 @@ export default () => {
|
||||
})
|
||||
}
|
||||
}, [clientObj])
|
||||
|
||||
useEffect(() => {
|
||||
if (search.name === '') {
|
||||
setSearch(e => ({ ...e, name: null }))
|
||||
}
|
||||
if (search.name !== '') { getCuss() }
|
||||
}, [search])
|
||||
return (
|
||||
<View className={styles.cussBox}>
|
||||
<View className={styles.searchBox}>
|
||||
@@ -146,3 +146,5 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default SaleUserPage
|
||||
|
||||
@@ -6,15 +6,15 @@ import styles from './index.module.scss'
|
||||
import Goods from './components/goods'
|
||||
import Search from '@/components/search'
|
||||
import Empty from '@/components/empty'
|
||||
import { mpproductlist } from '@/api/search'
|
||||
import { MpProductList } from '@/api/search'
|
||||
import { debounce, getFilterData } from '@/common/util'
|
||||
import ShopCart from '@/components/shoppingCart'
|
||||
import {
|
||||
ClientListApi,
|
||||
mpproductcolorlist,
|
||||
mpsearchHistory,
|
||||
mpsearchHistorylist
|
||||
, mpshoppingCartproductColorlist,
|
||||
MpProductColorList,
|
||||
MpSearchHistory,
|
||||
MpSearchHistoryList
|
||||
, MpShoppingCartProductColorList,
|
||||
} from '@/api/order'
|
||||
|
||||
const SearchPage = () => {
|
||||
@@ -78,7 +78,7 @@ const SearchPage = () => {
|
||||
const [showShopCart, setShowShopCart] = useState(false)
|
||||
|
||||
// 获取商品
|
||||
const { fetchData: colorlistFetch } = mpproductcolorlist()
|
||||
const { fetchData: colorlistFetch } = MpProductColorList()
|
||||
const getGoodList = async() => {
|
||||
const res = await colorlistFetch({ product_id: search.goodsId, sale_mode: search.modeId, code_or_name: search.code_or_name, physical_warehouse: search?.physical_warehouse, purchaser_id: clientObj?.clientId })
|
||||
res.data.list.map((item) => {
|
||||
@@ -107,7 +107,7 @@ const SearchPage = () => {
|
||||
}, [search])
|
||||
|
||||
// 加入购物车
|
||||
const { fetchData: preViewFetch } = mpshoppingCartproductColorlist()
|
||||
const { fetchData: preViewFetch } = MpShoppingCartProductColorList()
|
||||
const handSure = async() => {
|
||||
const arr = goodList.filter((item) => {
|
||||
return item.showInput
|
||||
@@ -199,13 +199,22 @@ const SearchPage = () => {
|
||||
if (item.id === it.id) {
|
||||
item.nums--
|
||||
if (search.modeId == 0) {
|
||||
if (item.nums < 1) { it.showInput = false, it.nums = 1 }
|
||||
if (item.nums < 1) {
|
||||
it.showInput = false
|
||||
it.nums = 1
|
||||
}
|
||||
}
|
||||
if (search.modeId == 1) {
|
||||
if (item.nums < 0.5) { it.showInput = false, it.nums = 0.5 }
|
||||
if (item.nums < 0.5) {
|
||||
it.showInput = false
|
||||
it.nums = 0.5
|
||||
}
|
||||
}
|
||||
if (search.modeId == 2) {
|
||||
if (item.nums < 3) { it.showInput = false, it.nums = 3 }
|
||||
if (item.nums < 3) {
|
||||
it.showInput = false
|
||||
it.nums = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
return item
|
||||
@@ -236,7 +245,7 @@ const SearchPage = () => {
|
||||
|
||||
// 获取关键字数据
|
||||
const [histroyList, setHistroyList] = useState<any[]>([])
|
||||
const { fetchData: historyFetch } = mpsearchHistorylist()
|
||||
const { fetchData: historyFetch } = MpSearchHistoryList()
|
||||
const getHistory = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
@@ -258,8 +267,8 @@ const SearchPage = () => {
|
||||
}, [])
|
||||
|
||||
// 搜索获取商品数据
|
||||
const { fetchData: productFetch } = mpproductlist()
|
||||
const { fetchData: historyputFetch } = mpsearchHistory()
|
||||
const { fetchData: productFetch } = MpProductList()
|
||||
const { fetchData: historyputFetch } = MpSearchHistory()
|
||||
const getProduct = debounce(async(e) => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
|
||||
@@ -11,8 +11,7 @@ interface PropsType {
|
||||
disabled?: boolean
|
||||
isSelectAll?: boolean
|
||||
}
|
||||
|
||||
export default (props: PropsType) => {
|
||||
const BottomEditBar = (props: PropsType) => {
|
||||
const { onDelete, onSelectCheckbox, disabled = false, isSelectAll: selectAll = false } = props
|
||||
const dispatch = useShoppingDispatch()
|
||||
console.log('isSelectAll==>', selectAll)
|
||||
@@ -57,3 +56,5 @@ export default (props: PropsType) => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default BottomEditBar
|
||||
|
||||
@@ -8,8 +8,7 @@ interface PropsType {
|
||||
amount?: number
|
||||
onSettleAccount?: Function
|
||||
}
|
||||
|
||||
export default (props: PropsType) => {
|
||||
const BottomSettleBar = (props: PropsType) => {
|
||||
const { onSettleAccount, amount = 0 } = props
|
||||
|
||||
const handleSettle = () => {
|
||||
@@ -36,3 +35,5 @@ export default (props: PropsType) => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default BottomSettleBar
|
||||
|
||||
@@ -43,11 +43,6 @@ const ColorKindItem: FC<PropsType> = (props) => {
|
||||
return itemData.sale_mode == EnumSaleMode.Bulk ? itemData.roll : formatMeterDiv(itemData.length)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log('itemData==>', itemData)
|
||||
setCount(formatCount(itemData))
|
||||
}, [itemData.roll, itemData.length])
|
||||
|
||||
const [count, setCount] = useState(formatCount(itemData))
|
||||
|
||||
// 格式化金额
|
||||
@@ -111,7 +106,10 @@ const ColorKindItem: FC<PropsType> = (props) => {
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.product_color_texture_url }
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('itemData==>', itemData)
|
||||
setCount(formatCount(itemData))
|
||||
}, [itemData.roll, itemData.length])
|
||||
return (
|
||||
<MCheckbox
|
||||
status={isChecked}
|
||||
|
||||
@@ -23,6 +23,11 @@ import LoadingCard from '@/components/loadingCard'
|
||||
import { ShoppingCartListApi } from '@/api'
|
||||
import { usePropsValue } from '@/use/useCommon'
|
||||
|
||||
enum BackEndSaleModeListFieldMap {
|
||||
bulk_color_list = 0,
|
||||
length_cut_color_list = 1,
|
||||
weight_cut_color_list = 2,
|
||||
}
|
||||
interface ButtonPropsType {
|
||||
isActive: boolean
|
||||
onClick?: Function
|
||||
@@ -43,19 +48,138 @@ const SaleModeButton: FC<ButtonPropsType> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
const DrawerButton = memo<{ isOpen: boolean }>(({ isOpen }) => {
|
||||
const DrawerButton = ({ isOpen }: { isOpen: boolean }) => {
|
||||
return (
|
||||
<View className={styles.drawerButton}>
|
||||
{isOpen ? <IconFont name="icon-shouqi" size={52}></IconFont> : <IconFont name="icon-zhankai" size={52}></IconFont>}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
enum BackEndSaleModeListFieldMap {
|
||||
bulk_color_list = 0,
|
||||
length_cut_color_list = 1,
|
||||
weight_cut_color_list = 2,
|
||||
}
|
||||
const DrawerButtonWithMemo = memo(DrawerButton)
|
||||
|
||||
interface GoodsListPropType {
|
||||
itemData?: ShoppingCartData
|
||||
multipleSelection?: GoodsMeta['multipleSelection']
|
||||
selected: EnumSaleMode
|
||||
isPending: boolean
|
||||
startTransition: React.TransitionStartFunction
|
||||
}
|
||||
const GoodsList = (props: GoodsListPropType) => {
|
||||
const { itemData, selected, isPending, startTransition, multipleSelection } = props
|
||||
const prevMultipleSelection = useRef(multipleSelection)
|
||||
const currentSelected = useRef<EnumSaleMode | null>(null)
|
||||
|
||||
const dispatch = useShoppingDispatch()
|
||||
|
||||
const [component, setComponent] = useState<JSX.Element | null>(null)
|
||||
// 使用 produce 更新特定的 ColorKindItem
|
||||
const updateSpecifiedComponent = () => {
|
||||
let newId
|
||||
if (multipleSelection && prevMultipleSelection.current !== multipleSelection) {
|
||||
for (const key in multipleSelection) {
|
||||
if (!prevMultipleSelection.current?.hasOwnProperty(key)) {
|
||||
newId = key
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('multipleSelection==+>', multipleSelection)
|
||||
console.log('currentSelected', currentSelected.current, selected)
|
||||
console.log('component', component)
|
||||
if (component) {
|
||||
if (itemData?.[BackEndSaleModeListFieldMap[selected]].length !== 0) {
|
||||
setComponent(produce(component, (draft) => {
|
||||
console.log('prev', component)
|
||||
const index = (draft as unknown as any[]).findIndex(item => item.key === newId)
|
||||
console.log('index', index)
|
||||
if (index !== -1) {
|
||||
const item = itemData?.[BackEndSaleModeListFieldMap[selected]].find((item) => {
|
||||
return item.id === Number(newId)
|
||||
})
|
||||
console.log('item', item, newId)
|
||||
draft![index] = <ColorKindItem checked={multipleSelection?.hasOwnProperty(newId)} purchaserId={itemData?.purchaser_id} key={newId} itemData={item}></ColorKindItem>
|
||||
}
|
||||
}))
|
||||
}
|
||||
else {
|
||||
setComponent(<View className={styles.noList}>暂无数据</View>)
|
||||
}
|
||||
}
|
||||
prevMultipleSelection.current = multipleSelection
|
||||
}
|
||||
// 更新 GoodsList 组件
|
||||
const updateComponent = () => {
|
||||
setComponent(
|
||||
() => itemData?.[BackEndSaleModeListFieldMap[selected]].length !== 0
|
||||
? (
|
||||
itemData?.[BackEndSaleModeListFieldMap[selected]].map((item) => {
|
||||
console.log('item===>', item, multipleSelection?.hasOwnProperty(item.id))
|
||||
return <ColorKindItem checked={multipleSelection?.hasOwnProperty(item.id)} purchaserId={itemData.purchaser_id} key={item.id} itemData={item}></ColorKindItem>
|
||||
})
|
||||
)
|
||||
: (
|
||||
<View className={styles.noList}>暂无数据</View>
|
||||
),
|
||||
)
|
||||
prevMultipleSelection.current = multipleSelection
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const newGoodsKind = Object.fromEntries(
|
||||
itemData?.[BackEndSaleModeListFieldMap[selected]].map(item => [
|
||||
item?.id,
|
||||
{
|
||||
id: item?.id,
|
||||
estimate_amount: item.estimate_amount,
|
||||
product_code: item.product_code,
|
||||
product_color_code: item.product_color_code,
|
||||
sale_mode: item.sale_mode,
|
||||
count: selected === EnumSaleMode.Bulk ? item.roll : Number(formatMeterDiv(item.length)),
|
||||
},
|
||||
]),
|
||||
)
|
||||
// 这里做一层比较是为了 重新渲染的时候如果没有切换订单类型的话就不让面料的选中状态初始化
|
||||
if (currentSelected.current === selected) {
|
||||
dispatch({
|
||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||
data: {
|
||||
purchaserId: itemData?.purchaser_id as number,
|
||||
goodsKind: newGoodsKind,
|
||||
multipleSelection,
|
||||
},
|
||||
})
|
||||
updateComponent()
|
||||
}
|
||||
else {
|
||||
currentSelected.current = selected
|
||||
// 重新把当前的选中状态赋值给ref 作为下一次比较的旧状态
|
||||
dispatch({
|
||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||
data: {
|
||||
purchaserId: itemData?.purchaser_id as number,
|
||||
goodsKind: newGoodsKind,
|
||||
multipleSelection: {},
|
||||
},
|
||||
})
|
||||
startTransition(updateComponent)
|
||||
}
|
||||
}, [itemData, selected, multipleSelection])
|
||||
|
||||
return (
|
||||
<>
|
||||
{isPending
|
||||
? (
|
||||
<View className={styles.noList} style={{ margin: '60rpx 0' }}>
|
||||
<LoadingCard />
|
||||
</View>
|
||||
)
|
||||
: (
|
||||
component
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
const GoodsListWithMemo = memo<GoodsListPropType>(GoodsList)
|
||||
|
||||
interface PropsType {
|
||||
itemData?: ShoppingCartData
|
||||
@@ -79,13 +203,9 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
|
||||
const [openDetail, setOpenDetail] = useState(false)
|
||||
|
||||
const handleOpenDetail = () => {
|
||||
setOpenDetail(isOpen => !isOpen)
|
||||
handleClickLayout()
|
||||
}
|
||||
|
||||
const [selected, setSelect] = useState<EnumSaleMode>(0)
|
||||
|
||||
const [isPending, startTransition] = useTransition()
|
||||
const onSelectOrderType = (type: EnumSaleMode) => {
|
||||
if (isPending) { return }
|
||||
setSelect(type)
|
||||
@@ -107,7 +227,10 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
})
|
||||
dispatch({ type: ShoppingDispatchType.UPDATE_MULTIPLE_SELECTION_STATUS, data: false })
|
||||
}
|
||||
|
||||
const handleOpenDetail = () => {
|
||||
setOpenDetail(isOpen => !isOpen)
|
||||
handleClickLayout()
|
||||
}
|
||||
// 统计已选面料
|
||||
const materialChecked = useMemo(() => {
|
||||
if (!multipleSelection || isEmptyObject(multipleSelection)) { return 0 }
|
||||
@@ -146,7 +269,6 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
)
|
||||
}, [multipleSelection, currentCheckedPurchaserId, selected, itemData])
|
||||
|
||||
const [isPending, startTransition] = useTransition()
|
||||
const { fetchData } = ShoppingCartListApi()
|
||||
// 更新当前客户的多选项
|
||||
const updatePurchaserMultipleSelection = (purchaserId, payload, operationType: OperationType, goodsId: number) => {
|
||||
@@ -268,7 +390,7 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
<DrawerButton isOpen={openDetail} />
|
||||
<DrawerButtonWithMemo isOpen={openDetail} />
|
||||
</View>
|
||||
{/* 减少节点渲染 */}
|
||||
{openDetail && (
|
||||
@@ -313,7 +435,7 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.orderContainer}>
|
||||
<GoodsList
|
||||
<GoodsListWithMemo
|
||||
multipleSelection={multipleSelection}
|
||||
itemData={itemData}
|
||||
selected={selected}
|
||||
@@ -328,128 +450,6 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
interface GoodsListPropType {
|
||||
itemData?: ShoppingCartData
|
||||
multipleSelection?: GoodsMeta['multipleSelection']
|
||||
selected: EnumSaleMode
|
||||
isPending: boolean
|
||||
startTransition: React.TransitionStartFunction
|
||||
}
|
||||
const GoodsList = memo<GoodsListPropType>((props) => {
|
||||
const { itemData, selected, isPending, startTransition, multipleSelection } = props
|
||||
const prevMultipleSelection = useRef(multipleSelection)
|
||||
const currentSelected = useRef<EnumSaleMode | null>(null)
|
||||
|
||||
const dispatch = useShoppingDispatch()
|
||||
|
||||
const [component, setComponent] = useState<JSX.Element | null>(null)
|
||||
// 使用 produce 更新特定的 ColorKindItem
|
||||
const updateSpecifiedComponent = () => {
|
||||
let newId
|
||||
if (multipleSelection && prevMultipleSelection.current !== multipleSelection) {
|
||||
for (const key in multipleSelection) {
|
||||
if (!prevMultipleSelection.current?.hasOwnProperty(key)) {
|
||||
newId = key
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('multipleSelection==+>', multipleSelection)
|
||||
console.log('currentSelected', currentSelected.current, selected)
|
||||
console.log('component', component)
|
||||
if (component) {
|
||||
if (itemData?.[BackEndSaleModeListFieldMap[selected]].length !== 0) {
|
||||
setComponent(produce(component, (draft) => {
|
||||
console.log('prev', component)
|
||||
const index = (draft as unknown as any[]).findIndex(item => item.key === newId)
|
||||
console.log('index', index)
|
||||
if (index !== -1) {
|
||||
const item = itemData?.[BackEndSaleModeListFieldMap[selected]].find((item) => {
|
||||
return item.id === Number(newId)
|
||||
})
|
||||
console.log('item', item, newId)
|
||||
draft![index] = <ColorKindItem checked={multipleSelection?.hasOwnProperty(newId)} purchaserId={itemData?.purchaser_id} key={newId} itemData={item}></ColorKindItem>
|
||||
}
|
||||
}))
|
||||
}
|
||||
else {
|
||||
setComponent(<View className={styles.noList}>暂无数据</View>)
|
||||
}
|
||||
}
|
||||
prevMultipleSelection.current = multipleSelection
|
||||
}
|
||||
// 更新 GoodsList 组件
|
||||
const updateComponent = () => {
|
||||
setComponent(
|
||||
() => itemData?.[BackEndSaleModeListFieldMap[selected]].length !== 0
|
||||
? (
|
||||
itemData?.[BackEndSaleModeListFieldMap[selected]].map((item) => {
|
||||
console.log('item===>', item, multipleSelection?.hasOwnProperty(item.id))
|
||||
return <ColorKindItem checked={multipleSelection?.hasOwnProperty(item.id)} purchaserId={itemData.purchaser_id} key={item.id} itemData={item}></ColorKindItem>
|
||||
})
|
||||
)
|
||||
: (
|
||||
<View className={styles.noList}>暂无数据</View>
|
||||
),
|
||||
)
|
||||
prevMultipleSelection.current = multipleSelection
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const newGoodsKind = Object.fromEntries(
|
||||
itemData?.[BackEndSaleModeListFieldMap[selected]].map(item => [
|
||||
item?.id,
|
||||
{
|
||||
id: item?.id,
|
||||
estimate_amount: item.estimate_amount,
|
||||
product_code: item.product_code,
|
||||
product_color_code: item.product_color_code,
|
||||
sale_mode: item.sale_mode,
|
||||
count: selected === EnumSaleMode.Bulk ? item.roll : Number(formatMeterDiv(item.length)),
|
||||
},
|
||||
]),
|
||||
)
|
||||
// 这里做一层比较是为了 重新渲染的时候如果没有切换订单类型的话就不让面料的选中状态初始化
|
||||
if (currentSelected.current === selected) {
|
||||
dispatch({
|
||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||
data: {
|
||||
purchaserId: itemData?.purchaser_id!,
|
||||
goodsKind: newGoodsKind,
|
||||
multipleSelection,
|
||||
},
|
||||
})
|
||||
updateComponent()
|
||||
}
|
||||
else {
|
||||
currentSelected.current = selected
|
||||
// 重新把当前的选中状态赋值给ref 作为下一次比较的旧状态
|
||||
dispatch({
|
||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||
data: {
|
||||
purchaserId: itemData?.purchaser_id!,
|
||||
goodsKind: newGoodsKind,
|
||||
multipleSelection: {},
|
||||
},
|
||||
})
|
||||
startTransition(updateComponent)
|
||||
}
|
||||
}, [itemData, selected, multipleSelection])
|
||||
|
||||
return (
|
||||
<>
|
||||
{isPending
|
||||
? (
|
||||
<View className={styles.noList} style={{ margin: '60rpx 0' }}>
|
||||
<LoadingCard />
|
||||
</View>
|
||||
)
|
||||
: (
|
||||
component
|
||||
)}
|
||||
</>
|
||||
)
|
||||
})
|
||||
// State 分割组件 思路就是把 context 直接通过 props 的形式传给组件,这样的话就解决了 context 强制刷新 memo 的问题了
|
||||
// 那么当 context 内的 value 被更新的时候,react 只会强制渲染 Wrapper
|
||||
const withStateSlice = (comp, slice) => {
|
||||
|
||||
@@ -18,29 +18,6 @@ import IconText from '@/components/iconText'
|
||||
import Search from '@/components/search'
|
||||
import { alert, goLink, isEmptyObject } from '@/common/common'
|
||||
|
||||
export const Shopping: FC = memo(() => {
|
||||
// 计算总的预估金额
|
||||
const handleTriggerCheckbox = ({ multipleSelection, setSelectedAmount }) => {
|
||||
console.log('handleTriggerCheckbox==>', multipleSelection)
|
||||
|
||||
if (multipleSelection) {
|
||||
const result = Object.values(multipleSelection).reduce((prev: number, value: Goods) => {
|
||||
return prev + Number(formatPriceDiv(value.estimate_amount))
|
||||
}, 0) as number
|
||||
// 同步修改上下文的 预估金额
|
||||
setSelectedAmount(result)
|
||||
}
|
||||
else {
|
||||
setSelectedAmount(0)
|
||||
}
|
||||
}
|
||||
return (
|
||||
<ShoppingProvider onTriggerCheckbox={handleTriggerCheckbox}>
|
||||
<ShoppingCartContainer />
|
||||
</ShoppingProvider>
|
||||
)
|
||||
})
|
||||
|
||||
interface SearchOptions {
|
||||
short_name_or_phone?: string
|
||||
}
|
||||
@@ -272,5 +249,27 @@ const ShoppingCartContainer: FC = () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
export const Shopping: FC = () => {
|
||||
// 计算总的预估金额
|
||||
const handleTriggerCheckbox = ({ multipleSelection, setSelectedAmount }) => {
|
||||
console.log('handleTriggerCheckbox==>', multipleSelection)
|
||||
|
||||
export default Shopping
|
||||
if (multipleSelection) {
|
||||
const result = Object.values(multipleSelection).reduce((prev: number, value: Goods) => {
|
||||
return prev + Number(formatPriceDiv(value.estimate_amount))
|
||||
}, 0) as number
|
||||
// 同步修改上下文的 预估金额
|
||||
setSelectedAmount(result)
|
||||
}
|
||||
else {
|
||||
setSelectedAmount(0)
|
||||
}
|
||||
}
|
||||
return (
|
||||
<ShoppingProvider onTriggerCheckbox={handleTriggerCheckbox}>
|
||||
<ShoppingCartContainer />
|
||||
</ShoppingProvider>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(Shopping)
|
||||
|
||||
+133
-130
@@ -9,57 +9,99 @@ import styles from './index.module.scss'
|
||||
import Popup from '@/components/popup'
|
||||
import { debounce } from '@/common/util'
|
||||
import {
|
||||
mpsaleOrderpost,
|
||||
mpsaleOrderpreView,
|
||||
MpSaleOrderPost,
|
||||
MpSaleOrderPreview,
|
||||
} from '@/api/order'
|
||||
import { alert } from '@/common/common'
|
||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
export default () => {
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = (props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
}
|
||||
const GoodsItem = (porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods} key={inx}>
|
||||
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code} {it.name}</View>
|
||||
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.estimate_amount)}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
const GoodsItemWithMemo = memo(GoodsItem)
|
||||
|
||||
const SubmitOrder = () => {
|
||||
const router: any = useRouter()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
let selectId = -1
|
||||
useDidShow(() => {
|
||||
// 获取选择的地址
|
||||
const pages = Taro.getCurrentPages()
|
||||
const currPage = pages[pages.length - 1] // 获取当前页面
|
||||
setInfoObj(val => ({
|
||||
...val,
|
||||
sale_mode: Number(router.params.sale_mode),
|
||||
province_name: currPage.data?.addressObj?.province_name ? currPage.data?.addressObj?.province_name : '',
|
||||
address_id: currPage.data?.addressObj?.id ? currPage.data?.addressObj?.id : '',
|
||||
city_name: currPage.data?.addressObj?.city_name ? currPage.data?.addressObj?.city_name : '',
|
||||
address_detail: currPage.data?.addressObj?.address_detail ? currPage.data?.addressObj?.address_detail : '',
|
||||
district_name: currPage.data?.addressObj?.district_name ? currPage.data?.addressObj?.district_name : '',
|
||||
target_user_name: currPage.data?.addressObj?.name ? currPage.data?.addressObj?.name : '',
|
||||
purchaser_phone: currPage.data?.addressObj?.phone ? currPage.data?.addressObj?.phone : '',
|
||||
}))
|
||||
selectId = currPage.data?.addressObj?.id
|
||||
const obj = currPage?.data?.ids?.filter((item) => { return item == selectId })
|
||||
if (currPage?.data?.ids && obj.length === 0) {
|
||||
setInfoObj(val => ({
|
||||
...val,
|
||||
sale_mode: Number(router.params.sale_mode),
|
||||
province_name: '',
|
||||
address_id: '',
|
||||
city_name: '',
|
||||
address_detail: '',
|
||||
district_name: '',
|
||||
target_user_name: '',
|
||||
purchaser_phone: '',
|
||||
}))
|
||||
}
|
||||
if (!currPage.data?.addressObj) {
|
||||
setReceivingStatus(1)
|
||||
}
|
||||
else {
|
||||
setReceivingStatus(2)
|
||||
}
|
||||
})
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
|
||||
// 收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState<any>(null)
|
||||
@@ -78,7 +120,7 @@ export default () => {
|
||||
Taro.hideLoading()
|
||||
}, 300)
|
||||
|
||||
const { fetchData: infoFetch } = mpsaleOrderpreView()
|
||||
const { fetchData: infoFetch } = MpSaleOrderPreview()
|
||||
const [pussName, setPusername] = useState<String>('')
|
||||
// 获取订单详情
|
||||
const getDetail = async() => {
|
||||
@@ -116,7 +158,7 @@ export default () => {
|
||||
}
|
||||
|
||||
// 提交订单
|
||||
const { fetchData: postFetch } = mpsaleOrderpost()
|
||||
const { fetchData: postFetch } = MpSaleOrderPost()
|
||||
const handSure = () => {
|
||||
if (receivingStatus == 2 && !infoObj.address_id) {
|
||||
return alert.error('请选择地址')
|
||||
@@ -174,6 +216,46 @@ export default () => {
|
||||
useEffect(() => {
|
||||
setInfoObj(infoObj)
|
||||
}, [infoObj])
|
||||
useDidShow(() => {
|
||||
// 获取选择的地址
|
||||
const pages = Taro.getCurrentPages()
|
||||
const currPage = pages[pages.length - 1] // 获取当前页面
|
||||
setInfoObj(val => ({
|
||||
...val,
|
||||
sale_mode: Number(router.params.sale_mode),
|
||||
province_name: currPage.data?.addressObj?.province_name ? currPage.data?.addressObj?.province_name : '',
|
||||
address_id: currPage.data?.addressObj?.id ? currPage.data?.addressObj?.id : '',
|
||||
city_name: currPage.data?.addressObj?.city_name ? currPage.data?.addressObj?.city_name : '',
|
||||
address_detail: currPage.data?.addressObj?.address_detail ? currPage.data?.addressObj?.address_detail : '',
|
||||
district_name: currPage.data?.addressObj?.district_name ? currPage.data?.addressObj?.district_name : '',
|
||||
target_user_name: currPage.data?.addressObj?.name ? currPage.data?.addressObj?.name : '',
|
||||
purchaser_phone: currPage.data?.addressObj?.phone ? currPage.data?.addressObj?.phone : '',
|
||||
}))
|
||||
selectId = currPage.data?.addressObj?.id
|
||||
const obj = currPage?.data?.ids?.filter((item) => { return item == selectId })
|
||||
if (currPage?.data?.ids && obj.length === 0) {
|
||||
setInfoObj(val => ({
|
||||
...val,
|
||||
sale_mode: Number(router.params.sale_mode),
|
||||
province_name: '',
|
||||
address_id: '',
|
||||
city_name: '',
|
||||
address_detail: '',
|
||||
district_name: '',
|
||||
target_user_name: '',
|
||||
purchaser_phone: '',
|
||||
}))
|
||||
}
|
||||
if (!currPage.data?.addressObj) {
|
||||
setReceivingStatus(1)
|
||||
}
|
||||
else {
|
||||
setReceivingStatus(2)
|
||||
}
|
||||
})
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
return (
|
||||
<View className={styles.mainBox}>
|
||||
<AddressDetailBox
|
||||
@@ -182,7 +264,7 @@ export default () => {
|
||||
receivingStatus={receivingStatus}
|
||||
onReceivingStatus={(e, value) => onReceivingStatus(e, value)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
<DefaultBoxWithMemo
|
||||
showMode
|
||||
title="客户信息"
|
||||
modeName={infoObj.sale_mode_name}
|
||||
@@ -191,10 +273,10 @@ export default () => {
|
||||
<View className={styles.pussName}>{pussName}</View>
|
||||
{/* <View className={styles.pussPhone}>{infoObj.purchaser_phone}</View> */}
|
||||
</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
{/* <View className={styles.total}> {infoObj.product_list?.length} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
<View className={styles.productBox}>
|
||||
<GoodsItem list={infoObj?.product_list} obj={infoObj}></GoodsItem>
|
||||
<GoodsItemWithMemo list={infoObj?.product_list} obj={infoObj}></GoodsItemWithMemo>
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>合计金额</View>
|
||||
@@ -204,9 +286,9 @@ export default () => {
|
||||
<View className={styles.shoudPay}>¥{formatPriceDiv(infoObj.estimate_amount)}</View>
|
||||
</View>
|
||||
</View>
|
||||
<DefaultBox title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||
<DefaultBoxWithMemo title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||
<View className={styles.remarkFont}>{infoObj.remark === '' ? '暂无' : infoObj.remark}</View>
|
||||
</DefaultBox>
|
||||
</DefaultBoxWithMemo>
|
||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||
<Remark onSave={e => getRemark(e)} defaultValue={infoObj.remark} showInput={!!showDesc} />
|
||||
</Popup>
|
||||
@@ -224,83 +306,4 @@ export default () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 卡片盒子元素
|
||||
interface Obs {
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
// 产品商品元素
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: {
|
||||
sale_mode?: number | string
|
||||
}
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
<View className={styles.goodsLine}></View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code} {it.name}</View>
|
||||
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.estimate_amount)}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
export default SubmitOrder
|
||||
|
||||
@@ -6,7 +6,7 @@ interface PropsType {
|
||||
onChangeStatus?: (data: { id: number; name: string }) => void
|
||||
}
|
||||
|
||||
const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
const DeliveryStatusList = (props: PropsType) => {
|
||||
const { onChangeStatus } = props
|
||||
const { fetchData } = EnumTakeGoodsOrderStatus()
|
||||
const [statusList, setStatusList] = useState([
|
||||
@@ -38,5 +38,5 @@ const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
[onChangeStatus],
|
||||
)
|
||||
return <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={statusList[0].id} />
|
||||
})
|
||||
export default DeliveryStatusList
|
||||
}
|
||||
export default memo<PropsType>(DeliveryStatusList)
|
||||
|
||||
@@ -60,7 +60,7 @@ export const filterTimeOptions = {
|
||||
},
|
||||
} as const
|
||||
|
||||
const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
const DeliveryFilter = (props: DeliveryPropsType) => {
|
||||
const { onSearchTime, onConfirm, onCancal, onReset } = props
|
||||
|
||||
const { fetchData, state } = EnumTakeGoodsOrderTypeList()
|
||||
@@ -83,17 +83,15 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
return state.data.list
|
||||
}, [state])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!typeList?.length) {
|
||||
getEnumData()
|
||||
console.log('getEnumData')
|
||||
}
|
||||
}, [typeList])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
|
||||
const [customTime, setCustomTime] = useState({
|
||||
date_min: undefined,
|
||||
date_max: undefined,
|
||||
@@ -135,9 +133,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
不限
|
||||
</FilterButton>
|
||||
{!!typeList?.length
|
||||
&& typeList?.map((item) => {
|
||||
&& typeList?.map((item, key) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.take_goods_order_type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
<FilterButton key={key} isActive={searchFilter.take_goods_order_type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
{item.name}
|
||||
</FilterButton>
|
||||
// <NormalButton type='info' circle onClick={() => handleSelectedType(item?.id)}>
|
||||
@@ -151,9 +149,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
<View className={styles.filterItem}>
|
||||
<View className={styles['filterItem--title']}>查询日期</View>
|
||||
<View className={classnames(styles['filterItem--wrapper'], styles['filter--time'])}>
|
||||
{Object.entries(filterTimeOptions).map(([key, value]) => {
|
||||
{Object.entries(filterTimeOptions).map(([key, value], index) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
<FilterButton key={index} isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
{value.name}
|
||||
</FilterButton>
|
||||
)
|
||||
@@ -173,6 +171,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
export default DeliveryFilter
|
||||
export default memo<DeliveryPropsType>(DeliveryFilter)
|
||||
|
||||
@@ -8,17 +8,13 @@ interface Param {
|
||||
onSave?: (val: string) => void
|
||||
defaultValue?: string
|
||||
}
|
||||
export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||
const Remark = ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||
const [descData, setDescData] = useState({
|
||||
number: 0,
|
||||
value: '',
|
||||
count: 200,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
getDesc(defaultValue)
|
||||
}, [defaultValue])
|
||||
|
||||
const getDesc = (value) => {
|
||||
let res = value
|
||||
if (value.length > descData.count) {
|
||||
@@ -30,6 +26,9 @@ export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||
const setSave = () => {
|
||||
onSave?.(descData.value)
|
||||
}
|
||||
useEffect(() => {
|
||||
getDesc(defaultValue)
|
||||
}, [defaultValue])
|
||||
return (
|
||||
<View className={styles.order_popup}>
|
||||
<View className={styles.order_popup_title}>编辑备注</View>
|
||||
@@ -41,3 +40,5 @@ export default ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default Remark
|
||||
|
||||
@@ -53,19 +53,6 @@ const Delivery: FC = () => {
|
||||
console.log('searchValue==>', searchValue)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('useEffect ===> search', search)
|
||||
// 已经不是第一次加载该页面了
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
isFirst.current = false
|
||||
})
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
|
||||
@@ -172,11 +159,22 @@ const Delivery: FC = () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
useEffect(() => {
|
||||
console.log('useEffect ===> search', search)
|
||||
// 已经不是第一次加载该页面了
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
isFirst.current = false
|
||||
})
|
||||
return (
|
||||
<View className={styles.delivery}>
|
||||
<View className={styles.searchBox}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} customRightSlot={scanIcon()}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} customRightSlot={scanIcon()}>
|
||||
<View onClick={onShowFilter} className={styles.icon__filter}>
|
||||
<IconText svg iconName="icon-shaixuan" text="筛选" customClass={styles['icon--filter']} />
|
||||
</View>
|
||||
|
||||
@@ -44,9 +44,9 @@ const TakeDeliveryDetail: FC = () => {
|
||||
const DetailItem = useMemo(() => {
|
||||
const element
|
||||
= !!detailInfo?.dyelot_number_list?.length
|
||||
&& detailInfo?.dyelot_number_list.map((weightItem) => {
|
||||
&& detailInfo?.dyelot_number_list.map((weightItem, key) => {
|
||||
return (
|
||||
<View className={styles.detailInfo}>
|
||||
<View className={styles.detailInfo} key={key}>
|
||||
<Divider direction="horizontal" customClassName={styles.divider}></Divider>
|
||||
<View className={styles.detailInfoItem}>
|
||||
<View className={styles['detailInfoItem--title']}>
|
||||
|
||||
+19
-19
@@ -6,6 +6,10 @@ import { useDispatch } from 'react-redux'
|
||||
import type { Dispatch } from 'redux'
|
||||
import defaultAvatar from '../../styles/image/defaultAvatar.png'
|
||||
import styles from './index.module.scss'
|
||||
import { checkKey, goLink } from '@/common/common'
|
||||
import type { TabBarAction } from '@/reducers/tabBar'
|
||||
import { TabBarIndex } from '@/reducers/tabBar'
|
||||
import { TabBarType } from '@/constants/tabbar'
|
||||
import NormalButton from '@/components/normalButton'
|
||||
import Tag from '@/components/tag'
|
||||
import Divider from '@/components/Divider'
|
||||
@@ -13,11 +17,16 @@ import LayoutBlock from '@/components/layoutBlock'
|
||||
import IconCard from '@/components/iconCard'
|
||||
import type { IconNames } from '@/components/iconfont/iconfont'
|
||||
import useUserInfo from '@/use/useUserInfo'
|
||||
import { checkKey, goLink } from '@/common/common'
|
||||
import type { TabBarAction } from '@/reducers/tabBar'
|
||||
import { TabBarIndex } from '@/reducers/tabBar'
|
||||
import { TabBarType } from '@/constants/tabbar'
|
||||
|
||||
// 用户头像
|
||||
const UserAvatar = ({ src }: { src?: string }) => {
|
||||
return (
|
||||
<View className={styles.userAvatar}>
|
||||
<Image className="full-100" src={src || defaultAvatar} />
|
||||
{src ? null : <Text className={styles['userAvatar-text']}>编辑</Text>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
interface IconCardType {
|
||||
jurisdiction?: string // 权限key值
|
||||
iconName: IconNames
|
||||
@@ -196,8 +205,8 @@ const UserInfo: FC = () => {
|
||||
!!Features.length && <LayoutBlock circle>
|
||||
<View className={styles.layoutTitle}>功能特色</View>
|
||||
<View className={styles['grid-container']}>
|
||||
{Features.map((item) => {
|
||||
return <IconCard iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
{Features.map((item, key) => {
|
||||
return <IconCard key={key} iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
})}
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
@@ -206,8 +215,8 @@ const UserInfo: FC = () => {
|
||||
!!Coloring.length && <LayoutBlock circle>
|
||||
<View className={styles.layoutTitle}>布料取色</View>
|
||||
<View className={styles['grid-container']}>
|
||||
{Coloring.map((item) => {
|
||||
return <IconCard iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
{Coloring.map((item, key) => {
|
||||
return <IconCard key={key} iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
})}
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
@@ -216,8 +225,8 @@ const UserInfo: FC = () => {
|
||||
!!Statistics.length && <LayoutBlock circle>
|
||||
<View className={styles.layoutTitle}>统计分析</View>
|
||||
<View className={styles['grid-container']}>
|
||||
{Statistics.map((item) => {
|
||||
return <IconCard iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
{Statistics.map((item, key) => {
|
||||
return <IconCard key={key} iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
|
||||
})}
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
@@ -226,15 +235,6 @@ const UserInfo: FC = () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
// 用户头像
|
||||
const UserAvatar = ({ src }) => {
|
||||
return (
|
||||
<View className={styles.userAvatar}>
|
||||
<Image className="full-100" src={src || defaultAvatar} />
|
||||
{src ? null : <Text className={styles['userAvatar-text']}>编辑</Text>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// 我的
|
||||
const User = () => {
|
||||
|
||||
Reference in New Issue
Block a user