Commit 1a2c0276 authored by 陈万宝's avatar 陈万宝

Merge branch 'feature/20230327_public_takeaway' into feature/20230315_take_out_goods

parents b4396b47 73fe2222
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
targets: { targets: {
ie: 11, ie: 11,
}, },
devtool: isAntDesignProPreview ? 'source-map' : false, devtool: process.env.SENTRY_ENV === 'test' ? false : 'hidden-source-map',
// umi routes: https://umijs.org/zh/guide/router.html // umi routes: https://umijs.org/zh/guide/router.html
routes: [ routes: [
{ {
...@@ -305,6 +305,7 @@ export default { ...@@ -305,6 +305,7 @@ export default {
}, },
define: { define: {
'process.env.PRE_ENV': process.env.PRE_ENV, 'process.env.PRE_ENV': process.env.PRE_ENV,
'process.env.SENTRY_ENV': process.env.SENTRY_ENV,
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
}, },
......
...@@ -22487,7 +22487,7 @@ ...@@ -22487,7 +22487,7 @@
}, },
"react-router-dom": { "react-router-dom": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.1.2.tgz", "resolved": "http://npmprivate.quantgroups.com/react-router-dom/-/react-router-dom-5.1.2.tgz",
"integrity": "sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==", "integrity": "sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==",
"requires": { "requires": {
"@babel/runtime": "^7.1.2", "@babel/runtime": "^7.1.2",
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"analyze": "cross-env ANALYZE=1 umi build", "analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build", "build": "umi build",
"build:pre": "cross-env PRE_ENV=pre umi build", "build:pre": "cross-env PRE_ENV=pre umi build",
"build:test": "cross-env SENTRY_ENV=test umi build",
"deploy": "npm run site && npm run gh-pages", "deploy": "npm run site && npm run gh-pages",
"fetch:blocks": "pro fetch-blocks && npm run prettier", "fetch:blocks": "pro fetch-blocks && npm run prettier",
"format-imports": "cross-env import-sort --write '**/*.{js,jsx,ts,tsx}'", "format-imports": "cross-env import-sort --write '**/*.{js,jsx,ts,tsx}'",
......
...@@ -17,9 +17,10 @@ const GoodsGroup = forwardRef((options, ref) => { ...@@ -17,9 +17,10 @@ const GoodsGroup = forwardRef((options, ref) => {
const [tags, setTags] = useState([]); const [tags, setTags] = useState([]);
const getShopList = async () => { const getShopList = async () => {
const user = localStorage.getItem('user'); const res = await apiSupplierShopList({
const json = JSON.parse(user); state: 1,
const res = await apiSupplierShopList(json.id); productBusiness: 1,
});
if (res && res.data && res.data.length > 0) { if (res && res.data && res.data.length > 0) {
setShops( setShops(
res.data.map(item => ({ res.data.map(item => ({
......
...@@ -320,8 +320,8 @@ export async function apiTopTakeawayGoods(data) { ...@@ -320,8 +320,8 @@ export async function apiTopTakeawayGoods(data) {
}); });
} }
// 获取供应商门店列表 // 获取供应商门店列表
export async function apiSupplierShopList() { export async function apiSupplierShopList(params) {
return request.get('/api/merchants/shops/getBySupplierId?state=1', { return request.get(`/api/merchants/shops/getBySupplierId?${stringify(params)}`, {
prefix: goodsApi, prefix: goodsApi,
}); });
} }
......
...@@ -217,8 +217,8 @@ ...@@ -217,8 +217,8 @@
} }
.ant-form-text { .ant-form-text {
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
justify-content: center;
} }
} }
} }
...@@ -249,20 +249,20 @@ ...@@ -249,20 +249,20 @@
.multiSpecification { .multiSpecification {
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
:global{ :global {
.ant-form-item-control { .ant-form-item-control {
flex-direction:none; flex-direction: none;
} }
.ant-form-item-control-input-content{ .ant-form-item-control-input-content {
flex:none flex: none;
} }
} }
} }
.specsSingularBetween { .specsSingularBetween {
display: flex; display: flex;
align-items: center;
justify-content: flex-start; justify-content: flex-start;
width: max-content; width: max-content;
align-items:center;
:global { :global {
.ant-form-item-label { .ant-form-item-label {
overflow: inherit; overflow: inherit;
...@@ -336,12 +336,12 @@ ...@@ -336,12 +336,12 @@
} }
.rowWarp { .rowWarp {
display: flex; display: flex;
background: #f8f8f8;
flex-direction: column; flex-direction: column;
background: #f8f8f8;
} }
:global { :global {
.reactEasyCrop_Container { .reactEasyCrop_Container {
height: 750px !important; height: 550px !important;
} }
} }
...@@ -78,26 +78,13 @@ const AddRepertoryModal = (props, ref) => { ...@@ -78,26 +78,13 @@ const AddRepertoryModal = (props, ref) => {
}; };
useEffect(() => { useEffect(() => {
if (item?.serviceItem) { if (item?.serviceItem) {
const { productStock = 1, autoStock = 0, maxStock = 2 } = item?.serviceItem; const { productStock = 0, autoStock = 0, maxStock = 0 } = item?.serviceItem;
const params = { const params = {
productStock, productStock,
autoStock: +autoStock === 1, autoStock: +autoStock === 1,
maxStock, maxStock,
}; };
switch (type) { form.setFieldsValue(params);
case 'all': // 统一设置
form.setFieldsValue(params);
break;
case 'multi': // 多规格设置
form.setFieldsValue(params);
break;
case 'singular': // 单规格设置
// setInitialValues(params);
form.setFieldsValue(params);
break;
default:
break;
}
} }
}, [openRepertory, item]); }, [openRepertory, item]);
return ( return (
......
...@@ -38,7 +38,7 @@ import UploadCropImage from './UploadCropImage'; ...@@ -38,7 +38,7 @@ import UploadCropImage from './UploadCropImage';
// import AddSellTimeModal from './AddSellTimeModal'; // import AddSellTimeModal from './AddSellTimeModal';
import styles from '../common.less'; import styles from '../common.less';
import AddRepertoryModal from './AddRepertoryModal'; import AddRepertoryModal from './AddRepertoryModal';
import AddMultiSpecModal from './AddMultiSpecModal'; // import AddMultiSpecModal from './AddMultiSpecModal';
import { apiTagList, apiUnits } from '../service'; import { apiTagList, apiUnits } from '../service';
import { localAutoSaveKey, calcDescartes } from '../utils'; import { localAutoSaveKey, calcDescartes } from '../utils';
import localStorage from '@/utils/localStorage'; import localStorage from '@/utils/localStorage';
...@@ -103,16 +103,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -103,16 +103,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
return null; return null;
} }
}; };
// // 过滤存在的sku对象
// const objectComparison = (item, itm) => {
// console.log(item, itm, '==========');
// const {
// serviceItem: { maxStock, autoStock, productStock },
// } = itm;
// const params = { maxStock, autoStock, productStock: productStock || itm.productStock };
// const temp = { ...item, ...params };
// return temp;
// };
const takeawayCalc = takeawayData => { const takeawayCalc = takeawayData => {
// 商品基本信息编辑商品名称 // 商品基本信息编辑商品名称
...@@ -267,7 +257,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -267,7 +257,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (itm?.specName) { if (itm?.specName) {
return itm.specName; return itm.specName;
} }
return itm return itm;
}) })
.toString(); .toString();
}); });
...@@ -303,7 +293,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -303,7 +293,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
multiSpu.map(item => { multiSpu.map(item => {
tempMultiSpu.forEach(itm => { tempMultiSpu.forEach(itm => {
if (item.unique === itm.unique) { if (item.unique === itm.unique) {
item.serviceItem = { ...item.serviceItem, ...itm.serviceItem }; // 修改商品售卖信息参数
const params = {
saleDates: temp.serviceItem.saleDates,
saleTimes: temp.serviceItem.saleTimes,
saleTimeType: temp.serviceItem.saleTimeType,
minPurchaseNum: temp.serviceItem.minPurchaseNum,
};
item.serviceItem = { ...item.serviceItem, ...itm.serviceItem, ...params };
itm.specs = [...item.specs]; itm.specs = [...item.specs];
} }
}); });
...@@ -349,7 +346,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -349,7 +346,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const getFormValues = debounce(() => { const getFormValues = debounce(() => {
const values = form.getFieldsValue(); const values = form.getFieldsValue();
console.log(values, 'values==='); console.log(values, 'values===');
// debugger
props.onValuesChange({ takeawayItem: JSON.parse(JSON.stringify(values)) }); props.onValuesChange({ takeawayItem: JSON.parse(JSON.stringify(values)) });
const takeawayData = customer.isEdit const takeawayData = customer.isEdit
? { takeawayItem: Object.assign({}, editData, values) } ? { takeawayItem: Object.assign({}, editData, values) }
...@@ -545,17 +541,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -545,17 +541,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const weight = specList?.filter(item => item.specGroupName === '份量'); const weight = specList?.filter(item => item.specGroupName === '份量');
const specs = specList?.filter(item => item.specGroupName !== '份量'); const specs = specList?.filter(item => item.specGroupName !== '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits')); const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => { if (weight?.length) {
if (item?.specs?.length) { weight.forEach(item => {
item.specs.forEach(itm => { if (item?.specs?.length) {
console.log('itm?.unit11111', itm?.unit); item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) { if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity = itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || ''; itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
} }
}); });
} }
}); });
}
editData.saleTimes = saleTimes?.length editData.saleTimes = saleTimes?.length
? saleTimes.map(item => [moment(item?.startTime, format), moment(item?.endTime, format)]) ? saleTimes.map(item => [moment(item?.startTime, format), moment(item?.endTime, format)])
: []; : [];
...@@ -587,20 +584,20 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -587,20 +584,20 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const specList = editData?.specList; const specList = editData?.specList;
const weight = specList.filter(item => item.specGroupName === '份量'); const weight = specList.filter(item => item.specGroupName === '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits')); const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => { if (weight?.length) {
if (item?.specs?.length) { weight.forEach(item => {
item.specs.forEach(itm => { if (item?.specs?.length) {
console.log('itm?.unit112222', itm?.unit); item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
if (itm?.unit && tempWeightName.includes(itm?.unit)) { itm.quantity =
itm.quantity = itm?.quantity?.indexOf('约') > -1
itm?.quantity?.indexOf('约') > -1 ? itm?.quantity.slice(1)
? itm?.quantity.slice(1) : itm?.quantity || '';
: itm?.quantity || ''; }
} });
}); }
} });
}); }
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId]; editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.productRefShopId = editData.shopId; editData.productRefShopId = editData.shopId;
// setTempWeight(weight) // setTempWeight(weight)
...@@ -611,7 +608,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -611,7 +608,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
form.setFieldsValue({ specs }); form.setFieldsValue({ specs });
const tempMultiSpu = editData?.skuList.map(item => { const tempMultiSpu = editData?.skuList.map(item => {
if (item) { if (item) {
console.log('item===', item);
item.serviceItem.productStock = item.productStock; item.serviceItem.productStock = item.productStock;
const weightIndex = item.specs.findIndex(itm => itm.specGroupName === '份量'); const weightIndex = item.specs.findIndex(itm => itm.specGroupName === '份量');
const tempQuantity = item.specs[weightIndex].quantity; const tempQuantity = item.specs[weightIndex].quantity;
...@@ -860,7 +856,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -860,7 +856,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
> >
{form => { {form => {
let unit = form.getFieldValue('unit') || ''; let unit = form.getFieldValue('unit') || '';
console.log('unit', unit);
unit = unit =
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) || (unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit; unit;
...@@ -1335,8 +1330,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -1335,8 +1330,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
intactData={intactData} intactData={intactData}
repertoryModel={repertoryModel} repertoryModel={repertoryModel}
/> />
{/* 加入多规格 */}
<AddMultiSpecModal ref={AddMultiSpecRef} />
</> </>
); );
}); });
......
...@@ -216,7 +216,7 @@ const UploadCropImage = forwardRef((props, ref) => { ...@@ -216,7 +216,7 @@ const UploadCropImage = forwardRef((props, ref) => {
onMouseEnter={() => setActiveImgIndex(index)} onMouseEnter={() => setActiveImgIndex(index)}
onMouseLeave={() => setActiveImgIndex(null)} onMouseLeave={() => setActiveImgIndex(null)}
> >
<div style={{ width: '100%', height: '100%', overflow: 'hidden' }}> <div style={{ width: '90%', height: '90%', overflow: 'hidden' }}>
<img width="100%" key={item.uid} src={item.url} alt="" /> <img width="100%" key={item.uid} src={item.url} alt="" />
</div> </div>
{activeImgIndex === index && ( {activeImgIndex === index && (
...@@ -238,7 +238,7 @@ const UploadCropImage = forwardRef((props, ref) => { ...@@ -238,7 +238,7 @@ const UploadCropImage = forwardRef((props, ref) => {
{limit !== null && fileList.length >= limit ? ( {limit !== null && fileList.length >= limit ? (
'' ''
) : ( ) : (
<ImgCrop rotationSlider modalWidth={900} modalHeight={900} quality={0.5} showReset> <ImgCrop rotationSlider modalWidth={500} modalHeight={500} quality={0.5} showReset>
<Upload <Upload
{...uploadParams} {...uploadParams}
disabled={Boolean(disabled)} disabled={Boolean(disabled)}
......
...@@ -60,7 +60,7 @@ const ServiceGoods = options => { ...@@ -60,7 +60,7 @@ const ServiceGoods = options => {
const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID
const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态 const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态
const [isUseCache, setIsUseCache] = useState(false); // 是否使用缓存 const [isUseCache, setIsUseCache] = useState(false); // 是否使用缓存
let ptype = canTakeawayService ? 5 : 4; let ptype = canAddService ? 4 : 5;
ptype = canAddNormal ? 1 : ptype; ptype = canAddNormal ? 1 : ptype;
const [productType, setProductType] = useState(ptype); // 商品状态 const [productType, setProductType] = useState(ptype); // 商品状态
const [pageLoading, setPageLoading] = useState(false); // 页面加载状态 const [pageLoading, setPageLoading] = useState(false); // 页面加载状态
......
...@@ -153,7 +153,7 @@ export const apiUnits = data => ...@@ -153,7 +153,7 @@ export const apiUnits = data =>
}); });
// 获取shopids http://yapi.quantgroups.com/project/389/interface/api/38056 // 获取shopids http://yapi.quantgroups.com/project/389/interface/api/38056
export const apiShopIds = data => export const apiShopIds = data =>
request.get('/api/merchants/shops/getBySupplierId?state=1', { request.get('/api/merchants/shops/getBySupplierId?state=1&productBusiness=1', {
prefix: goodsApi, prefix: goodsApi,
data, data,
}); });
......
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