Commit 1c8c5039 authored by XieZhiXiong's avatar XieZhiXiong

chore: 加强判断

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