🌈 style:订单页搜索合成一个

This commit is contained in:
Haiyi 2022-09-26 19:05:42 +08:00
parent 113ac6b229
commit ba018b1d25
8 changed files with 69 additions and 55 deletions

View File

@ -39,7 +39,7 @@ export const mpproductcolorlist = () => {
//购物车提交 //购物车提交
export const mpsaleOrderpreView = () => { export const mpsaleOrderpreView = () => {
return useRequest({ return useRequest({
url: `/v1/mp/saleOrder/preView`, url: `/v2/mp/saleOrder/preView`,
method: "put" method: "put"
}) })
} }

View File

@ -1,4 +1,4 @@
// export const BASE_URL = CURRENT_BASE_URL export const BASE_URL = CURRENT_BASE_URL
// export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.75:50001/lymarket`
// export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket`
// export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket`
@ -14,7 +14,7 @@
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华 // export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华
// CDN // CDN
// 生成密钥 // 生成密钥

View File

@ -21,7 +21,9 @@ type Params = {
defaultValue?: string defaultValue?: string
children?: ReactNode children?: ReactNode
customRightSlot?: ReactNode customRightSlot?: ReactNode
adjustPosition?: boolean adjustPosition?: boolean,
showScan?: boolean
handScan?: () => void
} }
export default memo( export default memo(
@ -30,7 +32,7 @@ export default memo(
{ {
clickOnSearch, //点击筛选按钮触发 clickOnSearch, //点击筛选按钮触发
changeOnSearch, //输入文字触发 changeOnSearch, //输入文字触发
adjustPosition=false, adjustPosition = false,
disabled = false, //是否禁用 disabled = false, //是否禁用
placeholder = '输入搜索内容', placeholder = '输入搜索内容',
showIcon = true, //是否显示关闭图标 showIcon = true, //是否显示关闭图标
@ -42,6 +44,8 @@ export default memo(
defaultValue = '', //默认值 defaultValue = '', //默认值
children, children,
customRightSlot, customRightSlot,
showScan = false,
handScan
}: Params, }: Params,
ref, ref,
) => { ) => {
@ -102,6 +106,16 @@ export default memo(
<View className={styles.search_closeBtn}> <View className={styles.search_closeBtn}>
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />} {!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
</View> </View>
{
showScan && <View onClick={() => {
handScan?.()
}}>
<IconFont
name={'icon-saomiao'} size={40}
></IconFont>
</View>
}
<View>{customRightSlot}</View> <View>{customRightSlot}</View>
</View> </View>
</View> </View>

View File

@ -22,14 +22,24 @@ import {
} from '@/api/order' } from '@/api/order'
import PayPopup from './components/PayPopup' import PayPopup from './components/PayPopup'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
interface filterObj {
purchaser_id?: string | number,
clientName?: string,
sale_user_id?: string | number,
saleuserName?: string,
order_no?: string | undefined,
sale_mode?: Number | undefined,
shipment_mode?: Number | undefined
}
export default () => { export default () => {
//页码和页数 //页码和页数
const [searchField, setSearchField] = useState<{ status: number | unknown; page: number; size: number; name: string }>({ const [searchField, setSearchField] = useState<{ status: number | unknown; page: number; size: number; order_no: string }>({
status: -1, status: -1,
page: 1, page: 1,
size: 10, size: 10,
name: '', order_no: '',
}) })
//获取订单列表 //获取订单列表
@ -88,8 +98,6 @@ export default () => {
const changeStatus = useCallback((e) => { const changeStatus = useCallback((e) => {
pageNum.current.page = 1 pageNum.current.page = 1
setSearchField((value) => ({ ...value, status: e, size: 10 })) setSearchField((value) => ({ ...value, status: e, size: 10 }))
console.log(e, '123123')
setOrderData(() => ({ list: [], total: 0 })) setOrderData(() => ({ list: [], total: 0 }))
}, []) }, [])
@ -97,7 +105,7 @@ export default () => {
const getSearchData = useCallback((e) => { const getSearchData = useCallback((e) => {
pageNum.current.page = 1 pageNum.current.page = 1
setOrderData(() => ({ list: [], total: 0 })) setOrderData(() => ({ list: [], total: 0 }))
setSearchField((val) => ({ ...val, name: e, size: 10 })) setSearchField((val) => ({ ...val, order_no: e, size: 10 }))
}, []) }, [])
//筛选内容展示 //筛选内容展示
const [showPopup, setshowPopup] = useState(false) const [showPopup, setshowPopup] = useState(false)
@ -126,15 +134,7 @@ export default () => {
})) }))
}) })
interface filterObj {
purchaser_id?: string | number,
clientName?: string,
sale_user_id?: string | number,
saleuserName?: string,
orderNo?: string | undefined,
sale_mode?: Number | undefined,
shipment_mode?: Number | undefined
}
//筛选参数 //筛选参数
const [searchObj, setsearchObj] = useState<filterObj>({ const [searchObj, setsearchObj] = useState<filterObj>({
@ -142,7 +142,7 @@ export default () => {
clientName: '', clientName: '',
sale_user_id: '', sale_user_id: '',
saleuserName: '', saleuserName: '',
orderNo: '', // order_no: '',
sale_mode: undefined, sale_mode: undefined,
shipment_mode: undefined shipment_mode: undefined
}) })
@ -158,10 +158,10 @@ export default () => {
}) })
} }
} }
//订单号输入框 // //订单号输入框
const handInput = (eq) => { // const handInput = (eq) => {
setsearchObj((e) => ({ ...e, orderNo: eq.detail.value })) // setsearchObj((e) => ({ ...e, order_no: eq.detail.value }))
} // }
//订单类型 //订单类型
const [modeList, setModeList] = useState<any[]>([{ id: -1, name: '不限' }, { id: 0, name: '大货' }, { id: 1, name: '剪版' }, { id: 2, name: '散剪' }]) const [modeList, setModeList] = useState<any[]>([{ id: -1, name: '不限' }, { id: 0, name: '大货' }, { id: 1, name: '剪版' }, { id: 2, name: '散剪' }])
@ -197,7 +197,6 @@ export default () => {
//是否不允许确认筛选 //是否不允许确认筛选
const isDisabled = useMemo(() => { const isDisabled = useMemo(() => {
if (searchObj.clientName !== '' || if (searchObj.clientName !== '' ||
searchObj.orderNo !== '' ||
searchObj.saleuserName !== '' || searchObj.saleuserName !== '' ||
searchObj.sale_mode !== undefined || searchObj.sale_mode !== undefined ||
searchObj.shipment_mode !== undefined searchObj.shipment_mode !== undefined
@ -210,15 +209,16 @@ export default () => {
//重置 //重置
const handReset = () => { const handReset = () => {
pageNum.current.page = 1
setsearchObj({ setsearchObj({
purchaser_id: '', purchaser_id: '',
clientName: '', clientName: '',
sale_user_id: '', sale_user_id: '',
saleuserName: '', saleuserName: '',
orderNo: '',
sale_mode: undefined, sale_mode: undefined,
shipment_mode: undefined shipment_mode: undefined,
}) })
setSearchField({ ...searchField, size: 10 })
const arrOne = resetArr(modeList) const arrOne = resetArr(modeList)
setModeList([...arrOne]) setModeList([...arrOne])
const arrTwo = resetArr(deliveryList) const arrTwo = resetArr(deliveryList)
@ -242,7 +242,8 @@ export default () => {
const handScan = () => { const handScan = () => {
Taro.scanCode({ Taro.scanCode({
success(res) { success(res) {
setsearchObj((e) => ({ ...e, orderNo: res.result })) // setsearchObj((e) => ({ ...e, order_no: res.result }))
setSearchField({ ...searchField, order_no: res.result })
}, },
fail(res) { fail(res) {
console.log(res); console.log(res);
@ -594,7 +595,7 @@ export default () => {
return ( return (
<View> <View>
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}> <View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
<Search placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300}> <Search handScan={() => handScan()} showScan placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300}>
<View className={styles.flexBox} onClick={() => showSelctPopup()}> <View className={styles.flexBox} onClick={() => showSelctPopup()}>
<View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View>
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}></View> <View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}></View>
@ -644,24 +645,6 @@ export default () => {
</View> </View>
</View> </View>
</View> </View>
<View className={styles.secondBox}>
<View className={styles.secondTopfont}></View>
<View className={styles.inputBox}>
<Input
onInput={(e) => {
handInput(e)
}}
placeholderStyle='color:#000000; font-size:26rpx'
className={styles.orderInput}
value={searchObj.orderNo}
placeholder={'请输入或扫描条形码'}></Input>
<View
className={classnames('iconfont', 'icon-saomiao', styles.saomiao)}
onClick={() => {
handScan()
}}></View>
</View>
</View>
<View className={styles.thirdBox}> <View className={styles.thirdBox}>
<View className={styles.thirdTopfont}></View> <View className={styles.thirdTopfont}></View>
<View className={styles.flexModebox}> <View className={styles.flexModebox}>

View File

@ -82,6 +82,10 @@ export default () => {
const [infoObj, setInfoObj] = useState<any>({}) const [infoObj, setInfoObj] = useState<any>({})
//获取订单详情 //获取订单详情
const getDetail = async () => { const getDetail = async () => {
Taro.showLoading({
title: '加载中...',
mask: true
})
const res = await infoFetch({ id: router.params.id }) const res = await infoFetch({ id: router.params.id })
setInfoObj(res.data) setInfoObj(res.data)
orderMsg.map(it => { orderMsg.map(it => {
@ -100,6 +104,7 @@ export default () => {
}) })
setOrderMsg([...orderMsg]) setOrderMsg([...orderMsg])
setReceivingStatus(res.data.shipment_mode) setReceivingStatus(res.data.shipment_mode)
Taro.hideLoading()
} }
//复制功能 //复制功能
const clipboardData = () => { const clipboardData = () => {

View File

@ -310,7 +310,7 @@ export default memo(() => {
</View> </View>
} }
{ {
!histroyList.length && <Empty fonst={'无搜索历史'}></Empty> !histroyList.length && <Empty picUrl='' fonst={'无搜索历史'}></Empty>
} }
</> </>
} }
@ -330,7 +330,7 @@ export default memo(() => {
}) })
} }
{ {
!searchList.length && <Empty fonst={'暂无数据'}></Empty> !searchList.length && <Empty picUrl='' fonst={'暂无数据'}></Empty>
} }
</> </>
} }

View File

@ -8,7 +8,7 @@ import Remark from '../orderDetails/components//remark'
import Popup from '@/components/popup' import Popup from '@/components/popup'
import { debounce } from '@/common/util' import { debounce } from '@/common/util'
import { import {
mpsaleOrder, mpsaleOrderpreView,
mpsaleOrderput, mpsaleOrderput,
mpsaleOrderaddress mpsaleOrderaddress
} from '@/api/order' } from '@/api/order'
@ -16,7 +16,7 @@ import { alert } from '@/common/common'
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
export default () => { export default () => {
const router = useRouter() const router: any = useRouter()
useDidShow(() => { useDidShow(() => {
getDetail() getDetail()
@ -62,11 +62,23 @@ export default () => {
} }
}, 300) }, 300)
const { fetchData: infoFetch } = mpsaleOrder() const { fetchData: infoFetch } = mpsaleOrderpreView()
const [infoObj, setInfoObj] = useState<any>({}) const [infoObj, setInfoObj] = useState<any>({})
//获取订单详情 //获取订单详情
const getDetail = async () => { const getDetail = async () => {
const res = await infoFetch({ id: 27708 }) let list: any[] = []
router.params?.shopping_cart_product_color_list?.forEach(item => {
list.push({
shopping_cart_product_color_id: item.shopping_cart_product_color_id,
sale_price: 0
})
})
const query = {
purchaser_id: router.params.purchaser_id,
sale_mode: router.params.sale_mode,
shopping_cart_product_color_list: list
}
const res = await infoFetch(query)
setInfoObj(res.data) setInfoObj(res.data)
setReceivingStatus(res.data.shipment_mode) setReceivingStatus(res.data.shipment_mode)
} }

View File

@ -3,7 +3,7 @@
/* Project id 3619513 */ /* Project id 3619513 */
// url('/src/styles/iconfont.ttf') format('truetype'); // url('/src/styles/iconfont.ttf') format('truetype');
src: src:
url('/src/styles/iconfont.ttf?t=1663556335905') format('truetype'); url('iconfont.ttf?t=1663556335905') format('truetype');
} }
.iconfont { .iconfont {
@ -296,4 +296,4 @@
.icon-gouwu:before { .icon-gouwu:before {
content: "\e607"; content: "\e607";
} }