🌈 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 = () => {
return useRequest({
url: `/v1/mp/saleOrder/preView`,
url: `/v2/mp/saleOrder/preView`,
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.89: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.7:50002/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
// 生成密钥

View File

@ -21,7 +21,9 @@ type Params = {
defaultValue?: string
children?: ReactNode
customRightSlot?: ReactNode
adjustPosition?: boolean
adjustPosition?: boolean,
showScan?: boolean
handScan?: () => void
}
export default memo(
@ -42,6 +44,8 @@ export default memo(
defaultValue = '', //默认值
children,
customRightSlot,
showScan = false,
handScan
}: Params,
ref,
) => {
@ -102,6 +106,16 @@ export default memo(
<View className={styles.search_closeBtn}>
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
</View>
{
showScan && <View onClick={() => {
handScan?.()
}}>
<IconFont
name={'icon-saomiao'} size={40}
></IconFont>
</View>
}
<View>{customRightSlot}</View>
</View>
</View>

View File

@ -22,14 +22,24 @@ import {
} from '@/api/order'
import PayPopup from './components/PayPopup'
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 () => {
//页码和页数
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,
page: 1,
size: 10,
name: '',
order_no: '',
})
//获取订单列表
@ -88,8 +98,6 @@ export default () => {
const changeStatus = useCallback((e) => {
pageNum.current.page = 1
setSearchField((value) => ({ ...value, status: e, size: 10 }))
console.log(e, '123123')
setOrderData(() => ({ list: [], total: 0 }))
}, [])
@ -97,7 +105,7 @@ export default () => {
const getSearchData = useCallback((e) => {
pageNum.current.page = 1
setOrderData(() => ({ list: [], total: 0 }))
setSearchField((val) => ({ ...val, name: e, size: 10 }))
setSearchField((val) => ({ ...val, order_no: e, size: 10 }))
}, [])
//筛选内容展示
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>({
@ -142,7 +142,7 @@ export default () => {
clientName: '',
sale_user_id: '',
saleuserName: '',
orderNo: '',
// order_no: '',
sale_mode: undefined,
shipment_mode: undefined
})
@ -158,10 +158,10 @@ export default () => {
})
}
}
//订单号输入框
const handInput = (eq) => {
setsearchObj((e) => ({ ...e, orderNo: eq.detail.value }))
}
// //订单号输入框
// const handInput = (eq) => {
// 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: '散剪' }])
@ -197,7 +197,6 @@ export default () => {
//是否不允许确认筛选
const isDisabled = useMemo(() => {
if (searchObj.clientName !== '' ||
searchObj.orderNo !== '' ||
searchObj.saleuserName !== '' ||
searchObj.sale_mode !== undefined ||
searchObj.shipment_mode !== undefined
@ -210,15 +209,16 @@ export default () => {
//重置
const handReset = () => {
pageNum.current.page = 1
setsearchObj({
purchaser_id: '',
clientName: '',
sale_user_id: '',
saleuserName: '',
orderNo: '',
sale_mode: undefined,
shipment_mode: undefined
shipment_mode: undefined,
})
setSearchField({ ...searchField, size: 10 })
const arrOne = resetArr(modeList)
setModeList([...arrOne])
const arrTwo = resetArr(deliveryList)
@ -242,7 +242,8 @@ export default () => {
const handScan = () => {
Taro.scanCode({
success(res) {
setsearchObj((e) => ({ ...e, orderNo: res.result }))
// setsearchObj((e) => ({ ...e, order_no: res.result }))
setSearchField({ ...searchField, order_no: res.result })
},
fail(res) {
console.log(res);
@ -594,7 +595,7 @@ export default () => {
return (
<View>
<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={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View>
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}></View>
@ -644,24 +645,6 @@ export default () => {
</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.thirdTopfont}></View>
<View className={styles.flexModebox}>

View File

@ -82,6 +82,10 @@ export default () => {
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 => {
@ -100,6 +104,7 @@ export default () => {
})
setOrderMsg([...orderMsg])
setReceivingStatus(res.data.shipment_mode)
Taro.hideLoading()
}
//复制功能
const clipboardData = () => {

View File

@ -310,7 +310,7 @@ export default memo(() => {
</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 { debounce } from '@/common/util'
import {
mpsaleOrder,
mpsaleOrderpreView,
mpsaleOrderput,
mpsaleOrderaddress
} from '@/api/order'
@ -16,7 +16,7 @@ import { alert } from '@/common/common'
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
export default () => {
const router = useRouter()
const router: any = useRouter()
useDidShow(() => {
getDetail()
@ -62,11 +62,23 @@ export default () => {
}
}, 300)
const { fetchData: infoFetch } = mpsaleOrder()
const { fetchData: infoFetch } = mpsaleOrderpreView()
const [infoObj, setInfoObj] = useState<any>({})
//获取订单详情
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)
setReceivingStatus(res.data.shipment_mode)
}

View File

@ -3,7 +3,7 @@
/* Project id 3619513 */
// url('/src/styles/iconfont.ttf') format('truetype');
src:
url('/src/styles/iconfont.ttf?t=1663556335905') format('truetype');
url('iconfont.ttf?t=1663556335905') format('truetype');
}
.iconfont {