Commit a8ff1c0b authored by GuanHua's avatar GuanHua

fix:下单添加是否会员折扣字段

parent 54d97bbc
......@@ -33,7 +33,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [form] = Form.useForm()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [operationType, setOprationType] = useState<string>(OPERATION_TYPE.list) // 操作类型:list:显示已选列表;select:选择列表
let [isHighSearch, setIsHighSearch] = useState(false)
const [isHighSearch, setIsHighSearch] = useState(false)
const { templateid, categoryid, goodsList = [], templateType } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
......@@ -49,33 +49,27 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [categoryResponseList, setCategoryResponseList] = useState<any>([])
const [noSelectBrands, setNoSelectBrands] = useState<any[]>([])
const changeNewProps = (key: string, data: any) => {
const newProps = { ...props }
newProps[key] = data
setNewProps(newProps)
}
useEffect(() => {
fetchBrandsList()
fetchCategoryList()
}, [])
const fetchCategoryList = () => {
let param = {
const param: any = {
categoryId: categoryid,
templateId: templateid
}
setSpinLoading(true)
//@ts-ignore
PublicApi.getTemplatePlatformFindCategoryList(param).then(res => {
const data = res.data
setCategoryResponseList(data.categoryBOList || [])
setSpinLoading(false)
if (res.code === 1000) {
const data = res.data
setCategoryResponseList(data.categoryBOList || [])
}
})
}
const fetchBrandsList = () => {
let param = {
const param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -83,7 +77,6 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
pageSize: 100
}
//@ts-ignore
PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
......@@ -98,7 +91,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}, [filterParam, current])
const fetchGoodsList = () => {
let param = {
let param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -115,13 +108,14 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
getFn = PublicApi.getTemplateShopFindGoodsList
}
//@ts-ignore
setSpinLoading(true)
getFn(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
setTotalCount(dataInfo.totalCount)
setNoSelectGoods(dataInfo.data || [])
}
setSpinLoading(false)
})
}
......@@ -154,7 +148,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleSearch = () => {
setCurrent(1)
let param = filterProps(form.getFieldsValue())
const param = filterProps(form.getFieldsValue())
setFilterParam(param)
}
......@@ -194,7 +188,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
// if (selectGoodsList.length <= 0) {
// message.error("请选择要推荐的商品")
// return
// } else
// } else
if (selectGoodsList.length > 10) {
message.error("最多只能推荐10件商品")
return
......@@ -228,13 +222,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const saveGoods = () => {
return new Promise((resolve, reject) => {
let param: any = {
const param: any = {
templateId: templateid,
categoryId: categoryid,
}
let ids: number[] = []
const ids: number[] = []
for (let item of selectGoodsList) {
for (const item of selectGoodsList) {
ids.push(item.goodsId)
}
param.goodsIds = ids
......@@ -258,8 +252,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleChangeOprationType = (type: string) => {
setOprationType(type)
let keys: number[] = []
for (let item of selectGoodsList) {
const keys: number[] = []
for (const item of selectGoodsList) {
keys.push(item.goodsId)
}
setGoodsIds(keys)
......@@ -314,7 +308,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
</Col>
<Col>
<Button onClick={() => setIsHighSearch(isHighSearch = !isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
<Button onClick={() => setIsHighSearch(!isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
</Col>
<Col>
<Button onClick={() => handleReset()}>重置</Button>
......@@ -336,7 +330,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
>
<Select placeholder="品类" style={{ width: 180 }}>
{
categoryResponseList.map((item, index) => <Select.Option kye={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
categoryResponseList.map((item, index) => <Select.Option key={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
}
</Select>
</Form.Item>
......@@ -348,7 +342,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
>
<Select placeholder="品牌" style={{ width: 180 }}>
{
noSelectBrands.map((item, index) => (<Select.Option kye={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
noSelectBrands.map((item, index) => (<Select.Option key={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
}
</Select>
</Form.Item>
......
......@@ -501,7 +501,8 @@ const CommodityDetail = (props) => {
stockCount: stockCount,
minOrder: commodityDetail.minOrder,
commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic,
attribute: attrAndValList.attributeAndValueList
attribute: attrAndValList.attributeAndValueList,
isMemberPrice: commodityDetail.isMemberPrice ? 1 : 0
}
const sessionKey = `${commodityDetail.id}${new Date().getTime()}`
......
......@@ -73,11 +73,11 @@ const Order: React.FC<OrderPropsType> = (props) => {
}, [])
const initOrderInfo = async () => {
let result = []
const result = []
const sessionOrderInfo: any = await getOrderInfo(spam_id)
for (let item of sessionOrderInfo.orderList) {
let tempOrderList = []
for (let orderItem of item.orderList) {
for (const item of sessionOrderInfo.orderList) {
const tempOrderList = []
for (const orderItem of item.orderList) {
let resData: any = {}
if (orderItem.logistics?.sendAddress) {
try {
......@@ -103,17 +103,17 @@ const Order: React.FC<OrderPropsType> = (props) => {
// 是否选用电子合同
if (data.isElectronicContract) {
setElectronicContractId(data.electronicContractId)
if (!!sessionStorage.getItem(`contract${spam_id}`)) {
if (sessionStorage.getItem(`contract${spam_id}`)) {
setContractInfo(JSON.parse(sessionStorage.getItem(`contract${spam_id}`)))
setIsElectronicContract(true)
} else {
// 根据电子合同模板id获取生成电子合同
let param = {
const param: any = {
contractTemplateId: data.electronicContractId,
signMemberId: userInfo?.memberId,
orderNo: new Date().getTime()
}
//@ts-ignore
const signRes = await PublicApi.postOrderSignatureSignContractCreate(param)
const signData: any = signRes.data
if (signRes.code === 1000) {
......@@ -173,8 +173,8 @@ const Order: React.FC<OrderPropsType> = (props) => {
const getCommodityAmount = () => {
let amount = 0
for (let item of orderInfo.orderList) {
for (let orderItem of item.orderList) {
for (const item of orderInfo.orderList) {
for (const orderItem of item.orderList) {
amount += (orderItem.unitPrice * orderItem.count)
}
}
......@@ -187,10 +187,10 @@ const Order: React.FC<OrderPropsType> = (props) => {
const getLogisticsFeeAnync = async () => {
if (selectAddressInfo) {
let orderProductList = []
for (let item of orderInfo.orderList) {
for (let orderItem of item.orderList) {
let templateId = orderItem.logistics?.templateId
const orderProductList = []
for (const item of orderInfo.orderList) {
for (const orderItem of item.orderList) {
const templateId = orderItem.logistics?.templateId
// 判断是否物流的方式和由买家承担费用并使用了运费模板
if (orderItem.logistics?.deliveryType === 1 && orderItem.logistics?.carriageType === 2 && orderItem.logistics?.useTemplate && templateId) {
orderProductList.push({
......@@ -202,7 +202,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
}
if (orderProductList.length > 0) {
let params: any = {
const params: any = {
orderProductList,
receiverAddressId: selectAddressInfo.id
}
......@@ -210,7 +210,9 @@ const Order: React.FC<OrderPropsType> = (props) => {
const res: any = await PublicApi.postLogisticsFreightTemplateCalFreightPrice(params)
message.destroy()
setLogisticsFee(Number(res.data))
} catch (error) { }
} catch (error) {
console.log(error)
}
}
}
}
......@@ -261,7 +263,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
* 提交订单
*/
const submitOrder = (signatureLogId?: number) => {
let params: any = {
const params: any = {
orderModel: getOrderMode(), // 下单模式
needTheInvoice: needTheInvoice ? 1 : 0,
}
......@@ -278,12 +280,12 @@ const Order: React.FC<OrderPropsType> = (props) => {
// params.addres = selectAddressInfo.address
}
let orderProductRequests = []
let purchaseIds = []
for (let item of orderList) {
const orderProductRequests = []
const purchaseIds = []
for (const item of orderList) {
for (let orderItem of item.orderList) {
let temp: any = {}
for (const orderItem of item.orderList) {
const temp: any = {}
purchaseIds.push(orderItem.purchaseId)
temp.imgUrl = orderItem.commodityPic
temp.productId = orderItem.id
......@@ -299,6 +301,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
temp.minOrder = orderItem.minOrder
temp.memberId = orderInfo.supplyMembersId
temp.memberRoleId = orderInfo.supplyMembersRoleId
temp.isMemberPrice = orderItem.isMemberPrice
orderProductRequests.push(temp)
}
}
......@@ -316,7 +319,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
params.theInvoiceId = selectInvoiceInfo.id
params.theInvoiceInfo = selectInvoiceInfo
}
if (!!orderInfo.purchaseOrder) {
if (orderInfo.purchaseOrder) {
params.idList = purchaseIds
params.productType = (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? 2 : 1
}
......@@ -388,13 +391,13 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
const handleSignModalConfirm = () => {
let param = {
const param: any = {
contractTemplateId: electronicContractId,
contractName: contractInfo.contractName,
contractUrl: contractInfo.contractUrl,
}
setAgreeSignLoading(true)
// @ts-ignore
PublicApi.postOrderSignatureOrderSettleSign(param).then((res: any) => {
if (res.code === 1000) {
message.destroy()
......@@ -409,7 +412,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
const pollingCheckStatus = (signatureLogId) => {
let param = {
const param = {
signatureLogId
}
PublicApi.getOrderSignatureOrderSettleSignDetail(param).then(res => {
......
......@@ -89,8 +89,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 初始化进货单数据
* @param list
* @param initState
* @param list
* @param initState
*/
const initPurchaseList = async (list: GetSearchShopPurchaseGetPurchaseListResponse) => {
let result = []
......@@ -119,7 +119,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
price: isMemberPrice ? Number(unitPrice[key]) * Number(parameter) : unitPrice[key]
})
})
item.commodityUnitPrice['priceRange'] = tempPriceRange
tempItem.orderList = [...tempItem.orderList, item]
tempResult.push(tempItem)
......@@ -234,8 +234,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 修改购买数量
* @param count
* @param id
* @param count
* @param id
*/
const handleCountChange = (count: number, id: number, type: string) => {
handleChangeFinishCount(count, id)
......@@ -273,8 +273,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 修改商品购买数量
* @param count
* @param id
* @param count
* @param id
*/
const handleChangeFinishCount = (count, id) => {
const result = orderList.map(item => {
......@@ -291,8 +291,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 计算单个商品总价格
* @param priceRange
* @param count
* @param priceRange
* @param count
*/
const computeItemPrice = (priceRange, count) => {
count = Number(count)
......@@ -314,7 +314,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 删除进货单的商品
* @param id
* @param id
*/
const handleDeleteItem = (id: number) => {
Modal.confirm({
......@@ -387,7 +387,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 删除指定id的商品
* @param ids
* @param ids
*/
const deleteListItems = (ids: number[]) => {
const newOrderList = JSON.parse(JSON.stringify(orderList))
......@@ -436,8 +436,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 获取用户权益参数
* @param memberId
* @param memberRoleId
* @param memberId
* @param memberRoleId
*/
const getMemberCredit = (memberId, memberRoleId) => {
return new Promise((resolve) => {
......@@ -455,10 +455,10 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
/**
* 获取支付方式
* @param memberId
* @param memberId
*/
const getPayWayListByMemberId = (memberId: number) => {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
if (!memberId) {
resolve([])
return
......@@ -469,6 +469,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
PublicApi.getPayPayWayList(param).then(res => {
if (res.code === 1000) {
resolve(initPayWayList(res.data))
} else {
resolve([])
}
})
})
......@@ -539,7 +541,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
purchaseIds.push(item.id)
productIds.push(item.commodityUnitPrice.id)
commonLogistics = item.commodityUnitPrice.commodity.logistics
if(item.commodityUnitPrice.commodity.logistics.deliveryType === 1) {
hasLogistics = true
logisticsInfo = item.commodityUnitPrice.commodity.logistics
......@@ -558,7 +560,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
brand: item.commodityUnitPrice.commodity.brand.name,
commodityPic: item.commodityUnitPrice.commodity.mainPic,
attribute: item.commodityUnitPrice.attributeAndValueList,
stockCount: item.stockCount || 0
stockCount: item.stockCount || 0,
isMemberPrice: item.commodityUnitPrice.commodity.isMemberPrice ? 1 : 0
}
if (item.commodityUnitPrice.commodity.isMemberPrice) {
......@@ -582,7 +585,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
orderList: buyOrderlist
}]
}
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment