feat:根据客户传递id接口获得商品价格

This commit is contained in:
Haiyi 2022-11-08 18:54:48 +08:00
parent eedc18db75
commit 3c18710b91
10 changed files with 64 additions and 27 deletions

View File

@ -37,7 +37,6 @@
width: 260px;
height: 30px;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
margin-bottom: 16px;
@ -48,10 +47,16 @@
.productNums {
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.productName {
font-size: 24px;
font-weight: 400;
color: #000000;
height: 40px;
}
}
.rightFontsbox {
@ -59,7 +64,6 @@
display: flex;
justify-content: flex-end;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #F41A39;
margin-bottom: 14px;
@ -94,7 +98,6 @@
align-items: center;
justify-content: center;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
text-align: center;

View File

@ -20,7 +20,8 @@ interface props {
name?: string,
roll?: number | string,
buyNums?: number | string,
id?: number
id?: number,
weight_error?: number | string
},
goodList?: any[],
onBlur?: (a: any, c: any) => void
@ -68,8 +69,8 @@ export default memo((props: props) => {
<View className={styles.rightGoodbox}>
<View className={styles.leftFontsbox}>
<View className={styles.title}>{props.value?.code} {props.value?.name}</View>
{/* <View className={styles.productName}>0681# 26S全棉平纹</View> */}
<View className={styles.productNums}>:{props.value?.roll}</View>
<View className={styles.productNums}>{props.value?.roll}</View>
<View className={styles.productName}>{props?.value?.weight_error as number / 1000}Kg</View>
</View>
<View className={styles.rightFontsbox}>
<View className={styles.money}>¥{props?.modeFont === 0 ? Number(props.value?.bulk_price) / 100 : props.modeFont === 1 ? Number(props.value?.length_cut_price) / 100 : Number(props.value?.weight_cut_price) / 100}{props.modeFont != 1 ? '/Kg' : '/m'}</View>

View File

@ -1,19 +1,17 @@
.addBox {
height: 556px;
margin: 24px;
padding: 0px 32px 40px 32px;
padding: 0px 32px 0px 32px;
background: #FFFFFF;
border-radius: 16px 16px 0px 0px;
border-radius: 16px;
transition: 0.3s;
}
.activeBox {
transition: 0.3s;
height: 1000px;
margin: 24px;
padding: 0px 32px 40px 32px;
padding: 0px 32px 0px 32px;
background: #FFFFFF;
border-radius: 16px 16px 0px 0px;
border-radius: 16px;
}
.textAreaBox {
@ -106,7 +104,7 @@
}
.openBox {
height: 82px;
// height: 82px;
display: flex;
align-items: center;
justify-content: center;

View File

@ -11,15 +11,21 @@ import Form from "./components/form"
import Remark from '../orderDetails/components/remark';
import Address from "@/components/address"
import { mppurchaser, mppurchaserpost, mppurchaserput } from '@/api/customer'
type AddressParms = {
id: number,
name: string
}
export default () => {
const router = useRouter()
const [infoObj, setinfoObj] = useState<any>()
const [formData, setformData] = useState<any>()
const [addressArr, setaddressArr] = useState<AddressParms[]>([])
useEffect(() => {
if (router.params.type === 'edit') {
getInfo()
@ -86,6 +92,13 @@ export default () => {
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()
}
@ -324,7 +337,7 @@ export default () => {
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
<Remark onSave={(e) => getRemark(e)} defaultValue={infoObj?.remark} showInput={showDesc ? true : false} />
</Popup>
<Address addressOnChange={(val) => handleSetSite(val)} defaultValue={[infoObj?.province_id, infoObj?.city_id, infoObj?.district_id]} addressOnClose={() => onClose()} show={showSiteModal} />
<Address addressOnChange={(val) => handleSetSite(val)} defaultValue={addressArr} addressOnClose={() => onClose()} show={showSiteModal} />
<View className={styles.safeBox}></View>
<View className={styles.bottomBox}>
<Button className={styles.resetBox} onClick={() => { handReset() }}> </Button >

View File

@ -7,7 +7,8 @@ import { alert } from '@/common/common'
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
interface Props {
obj: any
obj: any,
sortId: number | string
}
export default memo((props: Props) => {
@ -25,6 +26,21 @@ export default memo((props: Props) => {
})
}
const time = useMemo(() => {
if (props?.sortId == '') {
return props?.obj?.recent_order_time
}
if (props?.sortId == 1 || props?.sortId == -1) {
return props?.obj?.recent_order_time
}
if (props?.sortId == 2 || props?.sortId == -2) {
return props?.obj?.create_time
}
if (props?.sortId == 3 || props?.sortId == -3) {
return props?.obj?.update_time
}
}, [props?.sortId])
return (
<View className={styles.mainItem} onClick={() => handNav()}>
<View className={styles.itemTop}>
@ -59,7 +75,7 @@ export default memo((props: Props) => {
<View className={styles.line}></View>
<View className={styles.flex_bottom}>
<View className={styles.flex_left}>{props.obj.default_address.province_name + props.obj.default_address.city_name + props.obj.default_address.district_name || '暂无'}</View>
<View className={styles.flex_right}>{formatDateTime(props.obj.recent_order_time) || '暂无'}</View>
<View className={styles.flex_right}>{formatDateTime(time) || '暂无'}</View>
</View>
</View >
)

View File

@ -32,14 +32,14 @@
.itemFont {
font-size: 28px;
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
font-weight: 700;
font-weight: 400;
color: #000000;
}
.activeItems {
font-size: 28px;
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
font-weight: 400;
font-weight: 700;
color: #337FFF;
}

View File

@ -87,9 +87,11 @@ export default () => {
}
//选择排序
const sortRefRef = useRef<any>()
const handSort = useCallback((e: string) => {
pageNum.current.page = 1
setSearchField((val) => ({ ...val, size: 10, abstract_sort_key: e }))
sortRefRef.current = e
}, [])
const SortRef = useRef<any>()
@ -153,7 +155,7 @@ export default () => {
selfOnRefresherRefresh={getRefresherRefresh}>
{orderData?.list?.map((item, index) => {
return (
<ItemLiist obj={item}></ItemLiist>
<ItemLiist sortId={sortRefRef.current} obj={item}></ItemLiist>
)
})}
</InfiniteScroll>

View File

@ -96,7 +96,8 @@ export default () => {
modeId: 0,
goodsId: null,
code_or_name: '',
physical_warehouse: onj.physical_warehouse
physical_warehouse: onj.physical_warehouse,
purchaser_id: -1,
})
//选择的类型
@ -122,14 +123,14 @@ export default () => {
const [goodObj, setGoodsobj] = useState({})
//点击对应商品显示购物车
const showCart = async (item) => {
setSearchObj((e) => ({ ...e, goodsId: item.id }))
setSearchObj((e) => ({ ...e, goodsId: item.id, purchaser_id: clientObj?.clientId }))
setShowShopCart(true)
setGoodsobj(item)
ShopCartRef.current.SearchRef.current.clearInput()
}
const getGoodList = async () => {
const res = await colorlistFetch({ product_id: search.goodsId, sale_mode: search.modeId, code_or_name: search.code_or_name, physical_warehouse: 1 })
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) => {
item.showInput = false
if (search.modeId == 0) {
@ -309,6 +310,7 @@ export default () => {
clientId: currPage.data?.clientId,
clientName: currPage.data?.clientName,
})
setSearchObj((val) => ({ ...val, purchaser_id: currPage.data?.clientId }))
}
//默认客户
if (currPage.data?.clientId == null) {

View File

@ -191,7 +191,7 @@
}
.bottomBox {
width: 100%;
// width: 100%;
// width: 750px;
height: 160px;
background: #FFFFFF;

View File

@ -54,6 +54,7 @@ export default memo(() => {
clientId: currPage.data?.clientId,
clientName: currPage.data?.clientName,
})
setSearchObj((val) => ({ ...val, purchaser_id: currPage.data?.clientId }))
}
//默认客户
if (currPage.data?.clientId == null) {
@ -73,7 +74,8 @@ export default memo(() => {
modeId: 0,
goodsId: null,
code_or_name: '',
physical_warehouse: onj.physical_warehouse
physical_warehouse: onj.physical_warehouse,
purchaser_id: -1
})
const [showShopCart, setShowShopCart] = useState(false)
@ -88,7 +90,7 @@ export default memo(() => {
//获取商品
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: 1 })
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) => {
item.showInput = false
if (search.modeId == 0) {
@ -178,7 +180,7 @@ export default memo(() => {
const ShopCartRef = useRef<any>()
//点击对应商品显示购物车
const showCart = async (item) => {
setSearchObj((e) => ({ ...e, goodsId: item.id }))
setSearchObj((e) => ({ ...e, goodsId: item.id, purchaser_id: clientObj?.clientId }))
setShowShopCart(true)
setGoodsobj(item)
ShopCartRef.current.SearchRef.current.clearInput()