Commit 1c8c5039 authored by XieZhiXiong's avatar XieZhiXiong

chore: 加强判断

parent b378995c
......@@ -46,4 +46,23 @@ export const MERCHANT_COUPON_RECEIVE_ACTIVITY = 3;
/**
* 会员运营用券
*/
export const MERCHANT_COUPON_RECEIVE_OPERATE = 4;
\ No newline at end of file
export const MERCHANT_COUPON_RECEIVE_OPERATE = 4;
/* --------------------------------- 商家优惠券适用用户 -------------------------------- */
/**
* 新用户(不包含会员)
*/
export const SUITABLE_TYPE_NEW_USER = 1;
/**
* 老用户(不包含会员)
*/
export const SUITABLE_TYPE_OLD_USER = 2;
/**
* 新会员(仅会员用户)
*/
export const SUITABLE_TYPE_NEW_MEMBER = 3;
/**
* 老会员(仅会员用户)
*/
export const SUITABLE_TYPE_OLD_MEMBER = 4;
\ No newline at end of file
......@@ -96,7 +96,9 @@ const ApplicableGoods: React.FC<IProps> = (props) => {
dataIndex: 'unitPrice',
render: (text) => {
const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`;
const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
},
},
];
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-07-19 14:19:31
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-19 18:18:38
* @LastEditTime: 2021-07-28 11:01:30
* @Description: 适用商品 Form Item
*/
import React, { useState } from 'react';
......@@ -70,7 +70,9 @@ const ApplicableGoodsFormItem = (props) => {
align: 'center',
render: (text) => {
const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`;
const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
},
},
(
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 16:11:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-20 10:29:12
* @LastEditTime: 2021-07-28 14:13:43
* @Description: 商品选择抽屉
*/
import React, { useEffect } from 'react';
......@@ -101,13 +101,16 @@ const GoodsDrawer: React.FC<IProps> = (props) => {
}, [checkeds]);
const fetchData = async (params: ExtraFetchType) => {
let res = await PublicApi.getProductCommodityGetCommoditySkuListByShopId({
const res = await PublicApi.getProductCommodityGetCommoditySkuListByShopId({
...params,
current: `${params.current}`,
pageSize: `${params.pageSize}`,
shopId: `${shopIds[0] || ''}`,
});
return res.data;
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const handleClose = () => {
......@@ -150,11 +153,13 @@ const GoodsDrawer: React.FC<IProps> = (props) => {
},
{
title: '商品价格',
dataIndex: 'price',
dataIndex: 'unitPrice',
align: 'center',
render: (text) => {
const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`;
const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
},
},
];
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 16:19:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-24 16:19:18
* @LastEditTime: 2021-07-28 10:54:23
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -26,18 +26,19 @@ export const querySchema: ISchema = {
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component': 'mega-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
grid: true,
full: true,
autoRow: true,
columns: 6,
},
properties: {
category: {
type: 'string',
'x-component-props': {
placeholder: '商品品类',
allowClear: true,
allowClear: true,
},
},
brand: {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-07-20 10:10:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-23 15:00:55
* @LastEditTime: 2021-07-28 16:48:48
* @Description:
*/
import { OptionItemType } from '../components/ApplicableList';
......@@ -69,6 +69,9 @@ export type BrandItemType = {
}
export function normalizeUnitPrice(unitPrice: UnitPriceType): UnitPriceType[] {
if (!unitPrice) {
return;
}
const ret = [];
const objKeys = Object.keys(unitPrice).sort((a, b) => parseFloat(a) - parseFloat(b));
......
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