diff --git a/config/routes.ts b/config/routes.ts index 13b2980..b7447bf 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -662,6 +662,31 @@ export default [ path: 'memberInfor', name: 'memberInfor', component: './travelMember/memberInfor/index' + }, + { + path: 'PointsRuleConfig', + name: 'PointsRuleConfig', + component: './travelMember/PointsRuleConfig/index' + }, + { + path: 'GrowthValueRuleConfig', + name: 'GrowthValueRuleConfig', + component: './travelMember/GrowthValueRuleConfig/index' + }, + { + path: 'ConsumptionRecordSearch', + name: 'ConsumptionRecordSearch', + component: './travelMember/ConsumptionRecordSearch/index' + }, + { + path: 'PointsRecordSearch', + name: 'PointsRecordSearch', + component: './travelMember/PointsRecordSearch/index' + }, + { + path: 'GrowthValueRecordSearch', + name: 'GrowthValueRecordSearch', + component: './travelMember/GrowthValueRecordSearch/index' } ] }, diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index a4b63e9..62b0b2b 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -205,6 +205,51 @@ const BasicLayout: React.FC = (props) => { // 拿到所有枚举的方法 const handleGetAllFieldEnum = async () => { + // 成长值规则类型 + getFieldEnumTree({ FieldExplainField: 'GROWTH_TYPE' }).then((GROWTHSETTINGTYPE: any) => { + if (GROWTHSETTINGTYPE && GROWTHSETTINGTYPE.length > 0) { + const obj: any = {} + const list: any = [] + GROWTHSETTINGTYPE.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('GROWTHSETTINGTYPEList', list); + session.set('GROWTHSETTINGTYPEObj', obj); + session.set('GROWTHSETTINGTYPETree', GROWTHSETTINGTYPE); + } + }) + + // 积分规则 + getFieldEnumTree({ FieldExplainField: 'POINT_TYPE' }).then((SCORETYPE: any) => { + if (SCORETYPE && SCORETYPE.length > 0) { + const obj: any = {} + const list: any = [] + SCORETYPE.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('SCORETYPEList', list); + session.set('SCORETYPEObj', obj); + session.set('SCORETYPETree', SCORETYPE); + } + }) + + + // 消费类型 + getFieldEnumTree({ FieldExplainField: 'CONSUMPTIONRECORD_TYPE' }).then((CONSUMPTIONRECORDTYPE: any) => { + if (CONSUMPTIONRECORDTYPE && CONSUMPTIONRECORDTYPE.length > 0) { + const obj: any = {} + const list: any = [] + CONSUMPTIONRECORDTYPE.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('CONSUMPTIONRECORDTYPEList', list); + session.set('CONSUMPTIONRECORDTYPEObj', obj); + session.set('CONSUMPTIONRECORDTYPETree', CONSUMPTIONRECORDTYPE); + } + }) // 会员类型的枚举 // const MEMBERSHIPTYPE = @@ -261,211 +306,280 @@ const BasicLayout: React.FC = (props) => { // 结算模式数组 - const SETTLEMENT_MODESList = await getFieldEnum({ FieldExplainField: 'SETTLEMENT_MODES' }) - session.set('SETTLEMENT_MODESList', SETTLEMENT_MODESList); - // 结算模式对象 - if (SETTLEMENT_MODESList && SETTLEMENT_MODESList.length > 0) { - const SETTLEMENT_MODESObj = handleGetLabel(SETTLEMENT_MODESList) - session.set('SETTLEMENT_MODESObj', SETTLEMENT_MODESObj); - } + // const SETTLEMENT_MODESList = await + getFieldEnum({ FieldExplainField: 'SETTLEMENT_MODES' }).then((SETTLEMENT_MODESList) => { + session.set('SETTLEMENT_MODESList', SETTLEMENT_MODESList); + // 结算模式对象 + if (SETTLEMENT_MODESList && SETTLEMENT_MODESList.length > 0) { + const SETTLEMENT_MODESObj = handleGetLabel(SETTLEMENT_MODESList) + session.set('SETTLEMENT_MODESObj', SETTLEMENT_MODESObj); + } + }) + + // 卡券类型 + getFieldEnum({ FieldExplainField: 'COUPONTYPE' }).then((COUPONTYPEList) => { + session.set('COUPONTYPEList', COUPONTYPEList); + if (COUPONTYPEList && COUPONTYPEList.length > 0) { + const COUPONTYPEObj = handleGetLabel(COUPONTYPEList) + session.set('COUPONTYPEObj', COUPONTYPEObj); + } + }) + + // 合同类型数组 - const COMPACT_CHARACTERList = await getFieldEnum({ FieldExplainField: 'COMPACT_CHARACTER' }) - session.set('COMPACT_CHARACTERList', COMPACT_CHARACTERList); - // 合同类型对象 - if (COMPACT_CHARACTERList && COMPACT_CHARACTERList.length > 0) { - const COMPACT_CHARACTERObj = handleGetLabel(COMPACT_CHARACTERList) - session.set('COMPACT_CHARACTERObj', COMPACT_CHARACTERObj); - } + // const COMPACT_CHARACTERList = await + getFieldEnum({ FieldExplainField: 'COMPACT_CHARACTER' }).then((COMPACT_CHARACTERList) => { + session.set('COMPACT_CHARACTERList', COMPACT_CHARACTERList); + // 合同类型对象 + if (COMPACT_CHARACTERList && COMPACT_CHARACTERList.length > 0) { + const COMPACT_CHARACTERObj = handleGetLabel(COMPACT_CHARACTERList) + session.set('COMPACT_CHARACTERObj', COMPACT_CHARACTERObj); + } + }) + // 合同类型子项数组 - const COMPACT_DETAILSList = await getFieldEnum({ FieldExplainField: 'COMPACT_DETAILS' }) - session.set('COMPACT_DETAILSList', COMPACT_DETAILSList); - // 合同类型子项对象 - if (COMPACT_DETAILSList && COMPACT_DETAILSList.length > 0) { - const COMPACT_DETAILSObj = handleGetLabel(COMPACT_DETAILSList) - session.set('COMPACT_DETAILSObj', COMPACT_DETAILSObj); - } + // const COMPACT_DETAILSList = await + getFieldEnum({ FieldExplainField: 'COMPACT_DETAILS' }).then(COMPACT_DETAILSList => { + session.set('COMPACT_DETAILSList', COMPACT_DETAILSList); + // 合同类型子项对象 + if (COMPACT_DETAILSList && COMPACT_DETAILSList.length > 0) { + const COMPACT_DETAILSObj = handleGetLabel(COMPACT_DETAILSList) + session.set('COMPACT_DETAILSObj', COMPACT_DETAILSObj); + } + }) + // 合同附属类型数组 - const COMPACT_CHILDTYPEList = await getFieldEnum({ FieldExplainField: "COMPACT_CHILDTYPE" }) - session.set('COMPACT_CHILDTYPEList', COMPACT_CHILDTYPEList); - // 合同附属类型对象 - if (COMPACT_CHILDTYPEList && COMPACT_CHILDTYPEList.length > 0) { - const COMPACT_CHILDTYPEObj = handleGetLabel(COMPACT_CHILDTYPEList) - session.set('COMPACT_CHILDTYPEObj', COMPACT_CHILDTYPEObj); - } + // const COMPACT_CHILDTYPEList = await + getFieldEnum({ FieldExplainField: "COMPACT_CHILDTYPE" }).then(COMPACT_CHILDTYPEList => { + session.set('COMPACT_CHILDTYPEList', COMPACT_CHILDTYPEList); + // 合同附属类型对象 + if (COMPACT_CHILDTYPEList && COMPACT_CHILDTYPEList.length > 0) { + const COMPACT_CHILDTYPEObj = handleGetLabel(COMPACT_CHILDTYPEList) + session.set('COMPACT_CHILDTYPEObj', COMPACT_CHILDTYPEObj); + } + }) + // 合同结算周期数组 - const SETTLEMENT_CYCLEList = await getFieldEnum({ FieldExplainField: 'SETTLEMENT_CYCLE' }) - session.set('SETTLEMENT_CYCLEList', SETTLEMENT_CYCLEList); - // 合同结算周期对象 - if (SETTLEMENT_CYCLEList && SETTLEMENT_CYCLEList.length > 0) { - const SETTLEMENT_CYCLEObj = handleGetLabel(SETTLEMENT_CYCLEList) - session.set('SETTLEMENT_CYCLEObj', SETTLEMENT_CYCLEObj); - } + // const SETTLEMENT_CYCLEList = await + getFieldEnum({ FieldExplainField: 'SETTLEMENT_CYCLE' }).then(SETTLEMENT_CYCLEList => { + session.set('SETTLEMENT_CYCLEList', SETTLEMENT_CYCLEList); + // 合同结算周期对象 + if (SETTLEMENT_CYCLEList && SETTLEMENT_CYCLEList.length > 0) { + const SETTLEMENT_CYCLEObj = handleGetLabel(SETTLEMENT_CYCLEList) + session.set('SETTLEMENT_CYCLEObj', SETTLEMENT_CYCLEObj); + } + }) + // 合同类型数组 - const COMPACT_TYPEList = await getFieldEnum({ FieldExplainField: 'COMPACT_TYPE' }) - session.set('COMPACT_TYPEList', COMPACT_TYPEList); - // 合同类型对象 - if (COMPACT_TYPEList && COMPACT_TYPEList.length > 0) { - const COMPACT_TYPEObj = handleGetLabel(COMPACT_TYPEList) - session.set('COMPACT_TYPEObj', COMPACT_TYPEObj); - } + // const COMPACT_TYPEList = await + getFieldEnum({ FieldExplainField: 'COMPACT_TYPE' }).then(COMPACT_TYPEList => { + session.set('COMPACT_TYPEList', COMPACT_TYPEList); + // 合同类型对象 + if (COMPACT_TYPEList && COMPACT_TYPEList.length > 0) { + const COMPACT_TYPEObj = handleGetLabel(COMPACT_TYPEList) + session.set('COMPACT_TYPEObj', COMPACT_TYPEObj); + } + }) + // 签订程序数组 - const COMPACTREGPROINSTList = await getFieldEnum({ FieldExplainField: 'COMPACTREGPROINST' }) - session.set('COMPACTREGPROINSTList', COMPACTREGPROINSTList); - // 合同类型对象 - if (COMPACTREGPROINSTList && COMPACTREGPROINSTList.length > 0) { - const COMPACTREGPROINSTObj = handleGetLabel(COMPACTREGPROINSTList) - session.set('COMPACTREGPROINSTObj', COMPACTREGPROINSTObj); - } + // const COMPACTREGPROINSTList = await + getFieldEnum({ FieldExplainField: 'COMPACTREGPROINST' }).then(COMPACTREGPROINSTList => { + session.set('COMPACTREGPROINSTList', COMPACTREGPROINSTList); + // 合同类型对象 + if (COMPACTREGPROINSTList && COMPACTREGPROINSTList.length > 0) { + const COMPACTREGPROINSTObj = handleGetLabel(COMPACTREGPROINSTList) + session.set('COMPACTREGPROINSTObj', COMPACTREGPROINSTObj); + } + }) + // 所属区域数组 - const shopregionList = await getFieldEnum({ FieldExplainField: 'shopregion', notformate: true }) - session.set('shopregionList', shopregionList); - // 合同类型对象 - if (shopregionList && shopregionList.length > 0) { - const shopregionObj = handleGetLabel(shopregionList) - session.set('shopregionObj', shopregionObj); - } + // const shopregionList = await + getFieldEnum({ FieldExplainField: 'shopregion', notformate: true }).then(shopregionList => { + session.set('shopregionList', shopregionList); + // 合同类型对象 + if (shopregionList && shopregionList.length > 0) { + const shopregionObj = handleGetLabel(shopregionList) + session.set('shopregionObj', shopregionObj); + } + }) + // 经营模式 - const BUSINESSTYPEList = await getFieldEnum({ FieldExplainField: 'BUSINESS_TYPE' }) - session.set('BUSINESSTYPEList', BUSINESSTYPEList); + // const BUSINESSTYPEList = await + getFieldEnum({ FieldExplainField: 'BUSINESS_TYPE' }).then(BUSINESSTYPEList => { + session.set('BUSINESSTYPEList', BUSINESSTYPEList); + // 合同类型对象 + if (BUSINESSTYPEList && BUSINESSTYPEList.length > 0) { + const BUSINESSTYPEObj = handleGetLabel(BUSINESSTYPEList) + session.set('BUSINESSTYPEObj', BUSINESSTYPEObj); + } + }) + + + // 商品业态 - const SHOPTRADEList = await getFieldEnum({ FieldExplainField: 'BUSINESSTYPE' }) - session.set('SHOPTRADEList', SHOPTRADEList); - const SHOPTRADEObj: any = {} - if (SHOPTRADEList && SHOPTRADEList.length > 0) { - SHOPTRADEList.forEach((item: any) => { - SHOPTRADEObj[item.value] = item.label - }) - } - session.set('SHOPTRADEObj', SHOPTRADEObj); + // const SHOPTRADEList = await + getFieldEnum({ FieldExplainField: 'BUSINESSTYPE' }).then(SHOPTRADEList => { + session.set('SHOPTRADEList', SHOPTRADEList); + const SHOPTRADEObj: any = {} + if (SHOPTRADEList && SHOPTRADEList.length > 0) { + SHOPTRADEList.forEach((item: any) => { + SHOPTRADEObj[item.value] = item.label + }) + } + session.set('SHOPTRADEObj', SHOPTRADEObj); + }) + // 经营品牌 - const BUSINESSBRANDList = await getFieldEnumTree({ FieldExplainField: 'BusinessBrandIds', FieldEnumPID: null, noStorge: true }) - session.set('BUSINESSBRANDList', BUSINESSBRANDList); - const BUSINESSBRANDObj: any = {} - if (BUSINESSBRANDList && BUSINESSBRANDList.length > 0) { - BUSINESSBRANDList.forEach((item: any) => { - BUSINESSBRANDObj[item.value] = item.label - }) - } - session.set('BUSINESSBRANDObj', BUSINESSBRANDObj); + // const BUSINESSBRANDList = await + + getFieldEnumTree({ FieldExplainField: 'BusinessBrandIds', FieldEnumPID: null, noStorge: true }).then(BUSINESSBRANDList => { + session.set('BUSINESSBRANDList', BUSINESSBRANDList); + const BUSINESSBRANDObj: any = {} + if (BUSINESSBRANDList && BUSINESSBRANDList.length > 0) { + BUSINESSBRANDList.forEach((item: any) => { + BUSINESSBRANDObj[item.value] = item.label + }) + } + session.set('BUSINESSBRANDObj', BUSINESSBRANDObj); + }) + // 经营状态 - const BUSINESSSTATEList = await getFieldEnum({ FieldExplainField: 'BUSINESSSTATE' }) - session.set('businessStateList', BUSINESSSTATEList); - const stateObj: any = {} - if (BUSINESSSTATEList && BUSINESSSTATEList.length > 0) { - BUSINESSSTATEList.forEach((item: any) => { - stateObj[item.value] = item.label - }) - } - session.set('businessStateObj', stateObj); + // const BUSINESSSTATEList = await + getFieldEnum({ FieldExplainField: 'BUSINESSSTATE' }).then(BUSINESSSTATEList => { + session.set('businessStateList', BUSINESSSTATEList); + const stateObj: any = {} + if (BUSINESSSTATEList && BUSINESSSTATEList.length > 0) { + BUSINESSSTATEList.forEach((item: any) => { + stateObj[item.value] = item.label + }) + } + session.set('businessStateObj', stateObj); + }) + + - // 合同类型对象 - if (BUSINESSTYPEList && BUSINESSTYPEList.length > 0) { - const BUSINESSTYPEObj = handleGetLabel(BUSINESSTYPEList) - session.set('BUSINESSTYPEObj', BUSINESSTYPEObj); - } // 品牌类型 - const brandList = await getFieldEnumTree({ FieldExplainField: 'BRAND_TYPE', sessionName: 'BRAND_TYPE' }) - const brandObj: any = {} - if (brandList && brandList.length > 0) { - brandList.forEach((item: any) => { - brandObj[item.value] = item.label - }) - } - session.set('brandObj', brandObj); - session.set('brandList', brandList); + // const brandList = await + getFieldEnumTree({ FieldExplainField: 'BRAND_TYPE', sessionName: 'BRAND_TYPE' }).then(brandList => { + const brandObj: any = {} + if (brandList && brandList.length > 0) { + brandList.forEach((item: any) => { + brandObj[item.value] = item.label + }) + } + session.set('brandObj', brandObj); + session.set('brandList', brandList); + }) + // 服务区枚举 - const ServerpartIdsList = await getFieldEnumTree({ FieldExplainField: 'ServerpartIds' }) - const obj: any = {} - if (ServerpartIdsList && ServerpartIdsList.length > 0) { - ServerpartIdsList.forEach((item: any) => { - obj[item.value] = item.label - }) - } - session.set('ServerpartIdsList', obj); + // const ServerpartIdsList = await + getFieldEnumTree({ FieldExplainField: 'ServerpartIds' }).then(ServerpartIdsList => { + const obj: any = {} + if (ServerpartIdsList && ServerpartIdsList.length > 0) { + ServerpartIdsList.forEach((item: any) => { + obj[item.value] = item.label + }) + } + session.set('ServerpartIdsList', obj); + }) + // 服务区类型 - const serverpartTypeList = await getFieldEnumTree({ FieldExplainField: 'SERVERPART_TYPE' }) - const ServerpartTypeObj: any = {} - if (serverpartTypeList && serverpartTypeList.length > 0) { - serverpartTypeList.forEach((item: any) => { - ServerpartTypeObj[item.value] = item.label - }) - } - session.set('serverpartTypeList', serverpartTypeList); - session.set('ServerpartTypeObj', ServerpartTypeObj); + // const serverpartTypeList = await + getFieldEnumTree({ FieldExplainField: 'SERVERPART_TYPE' }).then(serverpartTypeList => { + const ServerpartTypeObj: any = {} + if (serverpartTypeList && serverpartTypeList.length > 0) { + serverpartTypeList.forEach((item: any) => { + ServerpartTypeObj[item.value] = item.label + }) + } + session.set('serverpartTypeList', serverpartTypeList); + session.set('ServerpartTypeObj', ServerpartTypeObj); + }) + // 经营业态 - const BusinessTradeIdsList = await getFieldEnumTree({ FieldExplainField: 'BusinessTradeIds' }) - const BusinessTradeIdsObj: any = {} - const BusinessTradeIdsBigObj: any = {} - if (BusinessTradeIdsList && BusinessTradeIdsList.length > 0) { - BusinessTradeIdsList.forEach((item: any) => { - const childrenValue: any = [] - BusinessTradeIdsObj[item.value] = item.label - BusinessTradeIdsBigObj[item.value] = item.label - if (item.children && item.children.length > 0) { - item.children.forEach((subItem: any) => { - if (childrenValue.indexOf(subItem.value) === -1) { - childrenValue.push(subItem.value) - } - BusinessTradeIdsObj[subItem.value] = subItem.label - }) - } - item.childrenValue = childrenValue - }) - } - session.set('BusinessTradeIdsObj', BusinessTradeIdsObj); - session.set('BusinessTradeIdsChildrenList', BusinessTradeIdsList); - session.set('BusinessTradeIdsBigObj', BusinessTradeIdsBigObj); + // const BusinessTradeIdsList = await + getFieldEnumTree({ FieldExplainField: 'BusinessTradeIds' }).then(BusinessTradeIdsList => { + const BusinessTradeIdsObj: any = {} + const BusinessTradeIdsBigObj: any = {} + if (BusinessTradeIdsList && BusinessTradeIdsList.length > 0) { + BusinessTradeIdsList.forEach((item: any) => { + const childrenValue: any = [] + BusinessTradeIdsObj[item.value] = item.label + BusinessTradeIdsBigObj[item.value] = item.label + if (item.children && item.children.length > 0) { + item.children.forEach((subItem: any) => { + if (childrenValue.indexOf(subItem.value) === -1) { + childrenValue.push(subItem.value) + } + BusinessTradeIdsObj[subItem.value] = subItem.label + }) + } + item.childrenValue = childrenValue + }) + } + session.set('BusinessTradeIdsObj', BusinessTradeIdsObj); + session.set('BusinessTradeIdsChildrenList', BusinessTradeIdsList); + session.set('BusinessTradeIdsBigObj', BusinessTradeIdsBigObj); + }) + // 预警类型 - const waringList = await getFieldGetFieEnumList({ FieldexPlain_Field: 'WARNING_TYPE' }) - if (waringList && waringList.length > 0) { - const list: any = [] - const obj: any = {} - const descList: any = [] - const descObj: any = {} - waringList.forEach((item: any) => { - list.push({ label: item.FieldEnum_Name, value: item.FieldEnum_Value }) - obj[item.FieldEnum_Value] = item.FieldEnum_Name - descList.push({ label: item.FieldEnum_Desc, value: item.FieldEnum_Value }) - descObj[item.FieldEnum_Value] = item.FieldEnum_Desc - }) - session.set('waringList', list); - session.set('waringObj', obj); - session.set('waringDescList', descList); - session.set('waringDescObj', descObj); - } + // const waringList = await + getFieldGetFieEnumList({ FieldexPlain_Field: 'WARNING_TYPE' }).then(waringList => { + if (waringList && waringList.length > 0) { + const list: any = [] + const obj: any = {} + const descList: any = [] + const descObj: any = {} + waringList.forEach((item: any) => { + list.push({ label: item.FieldEnum_Name, value: item.FieldEnum_Value }) + obj[item.FieldEnum_Value] = item.FieldEnum_Name + descList.push({ label: item.FieldEnum_Desc, value: item.FieldEnum_Value }) + descObj[item.FieldEnum_Value] = item.FieldEnum_Desc + }) + session.set('waringList', list); + session.set('waringObj', obj); + session.set('waringDescList', descList); + session.set('waringDescObj', descObj); + } + }) + // 业务类型 - const PROCESS_TYPEList = await getFieldEnumTree({ FieldExplainField: 'PROCESS_TYPE', sessionName: 'PROCESS_TYPE' }) - if (PROCESS_TYPEList && PROCESS_TYPEList.length > 0) { - const obj: any = {} - const list: any = [] - PROCESS_TYPEList.forEach((item: any) => { - if (item.children && item.children.length > 0) { - item.children.forEach((subItem: any) => { - list.push({ label: subItem.label, value: subItem.value }) - obj[subItem.value] = subItem.label - }) - } - }) - session.set('PROCESS_TYPEList', list); - session.set('PROCESS_TYPEObj', obj); - session.set('PROCESS_TYPETree', PROCESS_TYPEList); - } + // const PROCESS_TYPEList = await + getFieldEnumTree({ FieldExplainField: 'PROCESS_TYPE', sessionName: 'PROCESS_TYPE' }).then(PROCESS_TYPEList => { + if (PROCESS_TYPEList && PROCESS_TYPEList.length > 0) { + const obj: any = {} + const list: any = [] + PROCESS_TYPEList.forEach((item: any) => { + if (item.children && item.children.length > 0) { + item.children.forEach((subItem: any) => { + list.push({ label: subItem.label, value: subItem.value }) + obj[subItem.value] = subItem.label + }) + } + }) + session.set('PROCESS_TYPEList', list); + session.set('PROCESS_TYPEObj', obj); + session.set('PROCESS_TYPETree', PROCESS_TYPEList); + } + }) + // 服务区枚举 - const serverpartList = await handleGetServerpartTree({ + // const serverpartList = await + handleGetServerpartTree({ ProvinceCode: currentUser?.ProvinceCode, ServerpartType: 1000, StatisticsType: 1000, @@ -473,19 +587,16 @@ const BasicLayout: React.FC = (props) => { ShowSPRegion: false, ShowRoyalty: false, ShowCompactCount: false, + }).then((serverpartList) => { + if (serverpartList && serverpartList.length > 0) { + session.set('serverpartList', serverpartList); + const obj: any = {} + serverpartList.forEach((item: any) => { + obj[item.value] = item.label + }) + session.set('serverpartObj', obj); + } }) - if (serverpartList && serverpartList.length > 0) { - session.set('serverpartList', serverpartList); - const obj: any = {} - serverpartList.forEach((item: any) => { - obj[item.value] = item.label - }) - session.set('serverpartObj', obj); - } - - - - } // 显示就调用 diff --git a/src/pages/CardInformation/CardCouponApplicRules/index.less b/src/pages/CardInformation/CardCouponApplicRules/index.less new file mode 100644 index 0000000..6db8db9 --- /dev/null +++ b/src/pages/CardInformation/CardCouponApplicRules/index.less @@ -0,0 +1,18 @@ +.CardCouponApplicRules { + .shopList { + width: 100%; + max-height: 500px; + overflow-y: auto; + display: flex; + align-items: center; + flex-wrap: wrap; + + .shopItem { + width: 20%; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding: 8px 0; + } + } +} \ No newline at end of file diff --git a/src/pages/CardInformation/CardCouponApplicRules/index.tsx b/src/pages/CardInformation/CardCouponApplicRules/index.tsx index fa9a688..d9b48b4 100644 --- a/src/pages/CardInformation/CardCouponApplicRules/index.tsx +++ b/src/pages/CardInformation/CardCouponApplicRules/index.tsx @@ -14,9 +14,11 @@ import ProTable from "@ant-design/pro-table"; import ReactHTMLTableToExcel from "react-html-table-to-excel"; import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; import PageTitleBox from "@/components/PageTitleBox"; -import { handleDeleteCOOPSHOP_RULE, handleGetCOOPSHOP_RULEList } from "../service"; +import { handleDeleteCOOPSHOP_RULE, handleGetCOOPSHOP_RULEList, handleSynchroCOOPSHOP_RULE } from "../service"; import moment from 'moment' import ProForm, { ProFormSelect, ProFormText } from "@ant-design/pro-form"; +import './index.less' +import { handleSetlogSave } from "@/utils/format"; const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -44,6 +46,8 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => const [showDetail, setShowDetail] = useState(false) // 当前行数据 const [currentRow, setCurrentRow] = useState() + // 悬浮框 按钮加载的属性 + const [modalLoading, setModalLoading] = useState(false) const columns: any = [ // { @@ -129,10 +133,7 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => setCurrentRow(record) }}>编辑 { - let req: any = { - - } - const data = await handleDeleteCOOPSHOP_RULE(req) + await handleDeleteShopRule(record?.COOPSHOP_RULE_ID) }}> 删除 @@ -141,6 +142,62 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => } ] + // 同步规则记录 + const handleSynchroCOOPSHOPRULE = async (res: any) => { + let req: any = {} + setModalLoading(true) + if (currentRow?.COOPSHOP_RULE_ID) { + req = { + ...currentRow, + ISOFFLINE: res.ISOFFLINE, + UPDATE_STAFF_ID: currentUser?.ID, + UPDATE_STAFF_NAME: currentUser?.Name, + UPDATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + COOPSHOP_RULE_NAME: res.COOPSHOP_RULE_NAME, + ISVALID: res.ISVALID, + CREATE_STAFF_ID: currentUser?.ID, + CREATE_STAFF_NAME: currentUser?.Name, + CREATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + PROVINCE_CODE: currentUser?.ProvinceCode, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + ISOFFLINE: res.ISOFFLINE + } + } + + const data = await handleSynchroCOOPSHOP_RULE(req) + console.log('datadatadatadatadata', data); + setModalLoading(false) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + ModalFormRef?.current?.resetFields() + setCurrentRow(undefined) + setShowDetail(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + handleSetlogSave(currentRow?.COOPSHOP_RULE_ID ? '卡券规则的编辑' : '卡券规则的新增') + } + + // 删除规则记录 + const handleDeleteShopRule = async (id: any) => { + const req: any = { + COOPSHOP_RULEId: id + } + const data = await handleDeleteCOOPSHOP_RULE(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + handleSetlogSave('卡券规则的删除') + } + return (
{ // 打印报表 @@ -170,7 +227,8 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => request={async (params) => { const req: any = { SearchParameter: { - OWNERUNIT_ID: 911 + OWNERUNIT_ID: 911, + ISVALID: 1 }, PageIndex: 1, PageSize: 999999 @@ -212,48 +270,102 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => { + ModalFormRef?.current?.resetFields() setCurrentRow(undefined) setShowDetail(false) }} + destroyOnClose + confirmLoading={modalLoading} width={'70%'} title={currentRow?.COOPSHOP_RULE_ID ? currentRow?.COOPSHOP_RULE_NAME : "新增规则"} + onOk={() => { + ModalFormRef?.current?.validateFields().then(async (res) => { + console.log('res', res) + await handleSynchroCOOPSHOPRULE(res) + }) + }} > 基础信息 - + - + {/* - + */} @@ -279,11 +391,21 @@ const CardCouponApplicRules: React.FC<{ currentUser: CurrentUser }> = (props) => + 适用门店 + { + currentRow?.ShopItemList && currentRow?.ShopItemList.length > 0 ? +
+ { + currentRow?.ShopItemList.map((item: any) => { + return
+ {`${item.SERVERPART_NAME} ${item.SHOPNAME}`} +
+ }) + } +
: "" + }
-
- -
) } diff --git a/src/pages/CardInformation/CardInformationManager/index.less b/src/pages/CardInformation/CardInformationManager/index.less new file mode 100644 index 0000000..95245d1 --- /dev/null +++ b/src/pages/CardInformation/CardInformationManager/index.less @@ -0,0 +1,10 @@ +.CardInformationManager { + .CardInformationManagerModalContent { + height: calc(100vh - 350px); + overflow-y: auto; + } + + .CardInformationManagerModalContent::-webkit-scrollbar { + display: none; + } +} \ No newline at end of file diff --git a/src/pages/CardInformation/CardInformationManager/index.tsx b/src/pages/CardInformation/CardInformationManager/index.tsx index 5617678..897c373 100644 --- a/src/pages/CardInformation/CardInformationManager/index.tsx +++ b/src/pages/CardInformation/CardInformationManager/index.tsx @@ -1 +1,780 @@ -// 卡券信息管理 \ No newline at end of file +// 卡券信息管理 +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { ExclamationCircleOutlined, MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, Col, Divider, message, Modal, Popconfirm, Row, Space, Spin, Tree, Image } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getFieldEnum, getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import { handleGetCOOPSHOP_RULEList, handleGetCOUPONList, handleSynchroCOUPONService } from "../service"; +import ProForm, { ProFormDatePicker, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from "@ant-design/pro-form"; +import session from "@/utils/session"; +import './index.less' +import { handleSetlogSave } from "@/utils/format"; +import moment from 'moment' +import { uploadPicture } from "@/services/picture"; + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; +} + + +const CardInformationManager: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const ModalFormRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + const COUPONTYPEObj = session.get('COUPONTYPEObj') + const COUPONTYPEList = session.get('COUPONTYPEList') + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 显示详情的抽屉 + const [showDetail, setShowDetail] = useState(false) + // 当前行数据 + const [currentRow, setCurrentRow] = useState() + // 悬浮框 按钮加载的属性 + const [modalLoading, setModalLoading] = useState(false) + // 适用门店选择列表 + const [COOPSHOPRULEIDOPTIONS, setCOOPSHOPRULEIDOPTIONS] = useState() + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + const columns: any = [ + { + title: "序号", + dataIndex: "index", + width: 70, + hideInSearch: true, + valueType: 'index', + align: 'center', + }, + { + title: "优惠券类型", + dataIndex: "COUPON_TYPES", + valueType: 'select', + valueEnum: COUPONTYPEObj, + hideInTable: true, + }, + { + title: "卡券名称", + dataIndex: "COUPON_NAME", + align: 'left', + hideInSearch: true, + ellipsis: true, + }, + { + title: "运营单位", + dataIndex: "OPERATINGUNIT_NAME", + width: 200, + align: 'left', + hideInSearch: true, + ellipsis: true, + }, + { + title: "发放数量", + dataIndex: "COUPON_QUOTA", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + render: (_, record) => { + return record?.COUPON_QUOTA === -1 ? '不限量' : record?.COUPON_QUOTA + } + }, + { + title: "活动开始时间", + dataIndex: "START_TIME", + width: 150, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "活动结束时间", + dataIndex: "END_TIME", + width: 150, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "操作", + dataIndex: "options", + width: 120, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return + { + console.log('record', record); + setShowDetail(true) + setCurrentRow(record) + if (record.COUPON_IMAGEURL) { + setFileList([ + { name: "-", url: record.COUPON_IMAGEURL } + ]) + } + }}> + 编辑 + + { + await handleDeleteShopRule(record?.COOPSHOP_RULE_ID) + }}> + 删除 + + + } + } + ] + + + // 删除的方法 + const handleDeleteShopRule = async (id: any) => { + + } + + + // 同步的方法 + const handleSynchroCOUPON = async (res: any) => { + let req: any = {} + if (currentRow?.COUPON_ID) { + req = { + ...currentRow, + ...res, + END_TIME: moment(res.END_TIME).format("YYYY-MM-DD"), + START_TIME: moment(res.START_TIME).format("YYYY-MM-DD"), + VALID_END_TIME: moment(res.VALID_END_TIME).format("YYYY-MM-DD"), + VALID_START_TIME: moment(res.VALID_START_TIME).format("YYYY-MM-DD"), + UPDATE_STAFF_ID: currentUser?.ID, + UPDATE_STAFF_NAME: currentUser?.Name, + UPDATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + COUPON_IMAGEURL: fileList && fileList.length > 0 ? fileList[0].url : "", + } + } else { + req = { + ...res, + END_TIME: moment(res.END_TIME).format("YYYY-MM-DD"), + START_TIME: moment(res.START_TIME).format("YYYY-MM-DD"), + VALID_END_TIME: moment(res.VALID_END_TIME).format("YYYY-MM-DD"), + VALID_START_TIME: moment(res.VALID_START_TIME).format("YYYY-MM-DD"), + COUPON_IMAGEURL: fileList && fileList.length > 0 ? fileList[0].url : "", + CREATE_STAFF_ID: currentUser?.ID, + CREATE_STAFF_NAME: currentUser?.Name, + CREATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + + console.log('reqreqreqreq', req); + + const data = await handleSynchroCOUPONService(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + ModalFormRef?.current?.resetFields() + setCurrentRow(undefined) + setShowDetail(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + handleSetlogSave(currentRow?.COOPSHOP_RULE_ID ? '卡券的编辑' : '卡券的新增') + } + + + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + + + +
+
+ 单品销售排行统计} + headerTitle={} + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + OWNERUNIT_ID: 911, + COUPON_TYPES: params?.COUPON_TYPES || "" + }, + PageIndex: 1, + PageSize: 999999 + } + setSearchParams(params) + + + const data = await handleGetCOUPONList(req) + if (data && data.length > 0) { + return { data, success: true } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+ + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + { + ModalFormRef?.current?.resetFields() + setCurrentRow(null) + setShowDetail(false) + setFileList([]) + }} + confirmLoading={modalLoading} + width={'70%'} + destroyOnClose + title={currentRow?.COUPON_ID ? currentRow?.COUPON_NAME : "新增卡券"} + onOk={() => { + ModalFormRef?.current?.validateFields().then(async (res) => { + await handleSynchroCOUPON(res) + }) + }} + > +
+ 0 ? COUPONTYPEList[0].value : "", + CATEGORY_RULE_ID: currentRow?.CATEGORY_RULE_ID || 0, + PAY_METHOD: currentRow?.PAY_METHOD || 1000, + COOPSHOP_RULE_ID: currentRow?.COOPSHOP_RULE_ID ? currentRow?.COOPSHOP_RULE_ID : (COOPSHOPRULEIDOPTIONS && COOPSHOPRULEIDOPTIONS.lengtg > 0 ? COOPSHOPRULEIDOPTIONS[0].value : ""), + VALID_TYPE: currentRow?.VALID_TYPE || 1000, + OVERLAY: currentRow?.OVERLAY || 0, + LIMIT_COUNT: currentRow?.LIMIT_COUNT || -1, + LIMIT_COUNT_PERDAY: currentRow?.LIMIT_COUNT_PERDAY || -1, + COUPON_ISVALID: currentRow?.COUPON_ISVALID || currentRow?.COUPON_ISVALID === 0 ? currentRow?.COUPON_ISVALID : 1 + }}> + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本规则 + + + { + const req: any = { + SearchParameter: { + OWNERUNIT_ID: 911, + ISVALID: 1 + }, + PageIndex: 1, + PageSize: 999999 + } + + const data = await handleGetCOOPSHOP_RULEList(req) + let list: any = [] + console.log('data', data); + if (data && data.length > 0) { + data.forEach((item: any) => { + list.push({ label: item.COOPSHOP_RULE_NAME, value: item.COOPSHOP_RULE_ID }) + }) + } + setCOOPSHOPRULEIDOPTIONS(list) + return list + }} + rules={[ + { + required: true, + message: '请选择适用门店' + } + ]} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + 上架信息 + + + + + + + + + + 详情介绍 + + + + + + + + + + 卡券图标 + + + { + const formData = new FormData(); + formData.append('files', info.file); + formData.append('TableType', '1208'); + formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : ''); + if (info.filename) { + const success = await uploadPicture(formData) + if (success) { + const list = [{ + // uid: `${success.ImageId}`, // 注意,这个uid一定不能少,否则上传失败 + name: success.Result_Data.ImageName, + // status: 'done', + url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接 + // imgUrl: success.ImagePath // + success.ImageUrl, + }] + + + setFileList(list) + } + } else { + message.error("您上传的图片不存在.") + } + }, + onChange: async (info: any) => { + if (info.file.status === 'removed') { + confirm({ + title: '确认删除该图片吗?', + icon: , + async onOk() { + console.log('infoinfoinfoinfo', info); + + setFileList([]) + + // const deleteLoading = message.loading('正在删除...') + // try { + + // const deleteIndex = fileList?.findIndex((n: any) => n.uid === info.file.uid) + // const success = await deletePicture(info.file?.ImagePath, info.file?.ImageId, '1208') + // if (deleteIndex !== -1) { + // const files = [...fileList] + // files.splice(deleteIndex, 1) + // setFileList(files) + // } + // deleteLoading() + // return true + // } catch (error) { + // deleteLoading() + // return false + // } + } + }); + } + } + }} + /> + + + +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(CardInformationManager); diff --git a/src/pages/CardInformation/CardVoucherCollection/index.tsx b/src/pages/CardInformation/CardVoucherCollection/index.tsx index 2e592e5..7a3f540 100644 --- a/src/pages/CardInformation/CardVoucherCollection/index.tsx +++ b/src/pages/CardInformation/CardVoucherCollection/index.tsx @@ -1 +1,152 @@ -// 卡券库存管理 \ No newline at end of file +// 卡券库存管理 +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import type { FormInstance } from "antd"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; + + +const CardVoucherCollection: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [ + { + title: "卡券类型", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "卡券名称", + dataIndex: "", + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "发放数量", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "发放金额", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "领取数量", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "领取金额", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "剩余数量", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "活动开始时间", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: "活动结束时间", + dataIndex: "", + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + ] + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + + + + + +
+
+ 单品销售排行统计} + headerTitle={} + search={{ span: 6 }} + request={async (params) => { + setSearchParams(params) + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(CardVoucherCollection); diff --git a/src/pages/CardInformation/service.ts b/src/pages/CardInformation/service.ts index 347b13f..41851b5 100644 --- a/src/pages/CardInformation/service.ts +++ b/src/pages/CardInformation/service.ts @@ -1,4 +1,3 @@ -import requestNoPrefix from '@/utils/requestNoPrefix'; import requestEncryption from '@/utils/requestEncryption'; @@ -7,10 +6,13 @@ export async function handleGetCOOPSHOP_RULEList(params: any) { const data = await requestEncryption(`/Coupon/GetCOOPSHOP_RULEList`, { method: 'POST', - data: params + data: { + ...params, + requestEncryption: true + }, }) - if (data.Result_Code === 500) { + if (data.Result_Code !== 100) { return [] } @@ -22,13 +24,68 @@ export async function handleGetCOOPSHOP_RULEList(params: any) { export async function handleDeleteCOOPSHOP_RULE(params: any) { const data = await requestEncryption(`/Coupon/DeleteCOOPSHOP_RULE`, { - method: 'GET', - params + method: 'POST', + data: { + ...params, + requestEncryption: true + } }) - if (data.Result_Code === 500) { + if (data.Result_Code !== 100) { return [] } + return data +} + + +// 同步优惠券适用门店规则 +export async function handleSynchroCOOPSHOP_RULE(params: any) { + + const data = await requestEncryption(`/Coupon/SynchroCOOPSHOP_RULE`, { + method: 'POST', + data: { + ...params, + requestEncryption: true + } + }) + + if (data.Result_Code !== 100) { + return [] + } + + return data +} + + +// 卡券信息管理页面内容 +export async function handleGetCOUPONList(params: any) { + const data = await requestEncryption(`/Coupon/GetCOUPONList`, { + method: 'POST', + data: { + ...params, + requestEncryption: true + } + }) + if (data.Result_Code !== 100) { + return [] + } return data.Result_Data.List -} \ No newline at end of file +} + + +// 同步卡券 +export async function handleSynchroCOUPONService(params: any) { + const data = await requestEncryption(`/Coupon/SynchroCOUPON`, { + method: 'POST', + data: { + ...params, + requestEncryption: true + } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + diff --git a/src/pages/travelMember/ConsumptionRecordSearch/index.tsx b/src/pages/travelMember/ConsumptionRecordSearch/index.tsx new file mode 100644 index 0000000..ede7dee --- /dev/null +++ b/src/pages/travelMember/ConsumptionRecordSearch/index.tsx @@ -0,0 +1,173 @@ +// 消费记录查询 +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import { handleGetCONSUMPTIONRECORDList } from "../service"; +import moment from 'moment' +import session from "@/utils/session"; + + +const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + let CONSUMPTIONRECORDTYPEObj = session.get('CONSUMPTIONRECORDTYPEObj') + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "消费类型", + width: 120, + dataIndex: "CONSUMPTIONRECORD_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: CONSUMPTIONRECORDTYPEObj + }, + { + title: "订单金额", + width: 120, + dataIndex: "CONSUME_AMOUNT", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "消费金额", + width: 120, + dataIndex: "CONSUME_PRICE", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "消费积分", + width: 120, + dataIndex: "CONSUME_SCORE", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "实付金额", + width: 120, + dataIndex: "PAY_AMOUNT", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "优惠金额", + width: 150, + dataIndex: "COUPON_AMOUNT", + hideInSearch: true, + ellipsis: true, + }, + { + title: "消费时间 ", + width: 150, + dataIndex: "CONSUMPTIONRECORD_DATE", + hideInSearch: true, + render: (_, record) => { + return record?.CONSUMPTIONRECORD_DATE ? moment(record?.CONSUMPTIONRECORD_DATE).format('YYYY-MM-DD HH:mm:ss') : '-' + } + }, + ] + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + +
+
+ } + scroll={{ x: '100%', y: 'calc(100vh - 450px)' }} + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetCONSUMPTIONRECORDList(req) + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(ConsumptionRecordSearch); diff --git a/src/pages/travelMember/GrowthValueRecordSearch/index.tsx b/src/pages/travelMember/GrowthValueRecordSearch/index.tsx new file mode 100644 index 0000000..d22b5cc --- /dev/null +++ b/src/pages/travelMember/GrowthValueRecordSearch/index.tsx @@ -0,0 +1,166 @@ +// 成长值记录查询 +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import { handleGetMEMBERGROWTHList } from "../service"; + + +const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "累计成长值", + width: 120, + dataIndex: "MEMBERSHIP_GROWTH", + hideInSearch: true, + ellipsis: true, + valueType: 'digit' + }, + { + title: "本次成长值", + width: 120, + dataIndex: "CURRENT_GROWTH", + hideInSearch: true, + ellipsis: true, + valueType: 'digit' + }, + { + title: "成长来源", + width: 120, + dataIndex: "GROWTH_VALUE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1000": "消费赠送", + "2000": "消费抵扣", + "3000": "注册赠送", + } + }, + { + title: "成长方式", + width: 120, + dataIndex: "GROWTH_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1": "积累", + "-1": "消耗", + } + }, + { + title: "操作时间", + width: 120, + dataIndex: "OPERATE_DATE", + hideInSearch: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD') : "-" + } + }, + ] + + + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + + +
+
+ } + search={{ span: 6 }} + request={async (params) => { + const req: any = { + searchParameter: { + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911, + SCORESETTING_STATE: 1 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetMEMBERGROWTHList(req); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(GrowthValueRecordSearch); diff --git a/src/pages/travelMember/GrowthValueRuleConfig/index.tsx b/src/pages/travelMember/GrowthValueRuleConfig/index.tsx new file mode 100644 index 0000000..f811c6f --- /dev/null +++ b/src/pages/travelMember/GrowthValueRuleConfig/index.tsx @@ -0,0 +1,529 @@ +// 成长值规则配置 +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; + +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; + +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handleDeleteGROWTHSETTING, handleGetGROWTHSETTINGList, handleSynchroGROWTHSETTING } from '../service'; +import session from '@/utils/session'; + + + +const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + + // 会员成长值枚举 + let GROWTHSETTINGTYPEList = session.get('GROWTHSETTINGTYPEList') + let GROWTHSETTINGTYPEObj = session.get('GROWTHSETTINGTYPEObj') + let MEMBERSHIP_TYPEList = session.get('MEMBERSHIP_TYPEList') + let MEMBERSHIP_TYPEObj = session.get('MEMBERSHIP_TYPEObj') + let MEMBERSHIP_LEVELList = session.get('MEMBERSHIP_LEVELList') + let MEMBERSHIP_LEVELObj = session.get('MEMBERSHIP_LEVELObj') + + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + // 拖动结束 + + // 定义列表字段内容 + const columns: any = [ + { + dataIndex: 'GROWTHSETTING_TYPE', + title: '规则类型', + width: 120, + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: GROWTHSETTINGTYPEObj + }, + { + dataIndex: 'GROWTHSETTING_NAME', + title: '规则名称', + align: 'center', + width: 120, + hideInSearch: true, + hideInDescriptions: true, + }, + { + dataIndex: 'MEMBERSHIP_TYPE', + title: '会员类型', + align: 'center', + width: 120, + hideInSearch: true, + valueType: 'select', + valueEnum: MEMBERSHIP_TYPEObj + }, + { + dataIndex: 'MEMBERSHIP_LEVEL', + title: '会员等级', + align: 'center', + width: 120, + hideInSearch: true, + valueType: 'select', + valueEnum: MEMBERSHIP_LEVELObj + }, + { + dataIndex: 'PROMOTION_LEVEL', + title: '晋升等级', + width: 120, + align: 'center', + hideInSearch: true, + valueEnum: MEMBERSHIP_LEVELObj + }, + { + dataIndex: 'GROWTH_VALUE', + title: '所需成长值', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'GROWTHDAILY_CAP', + title: '每日上限', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'GROWTHTOTAL_CAP', + title: '总上限值', + width: 120, + align: 'center', + hideInSearch: true, + }, + // { + // dataIndex: 'PROVINCE_CODE', + // title: '省份编码', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'OWNERUNIT_NAME', + // title: '业主单位名称', + // align: 'center', + // hideInSearch: true, + // }, + { + dataIndex: 'GROWTHSETTING_STATE', + title: '有效状态', + width: 120, + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: { + "1": "有效", + "0": "无效" + } + }, + // { + // dataIndex: 'STAFF_NAME', + // title: '操作人员', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'OPERATE_DATE', + // title: '操作时间', + // valueType: 'fromNow', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'GROWTHSETTING_DESC', + // title: '备注说明', + // align: 'center', + // hideInSearch: true, + // }, + { + dataIndex: 'option', + title: '操作', + width: 120, + align: 'center', + valueType: 'option', + hideInSearch: true, + render: (_, record) => { + return ( + + { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + await handelDelete(record.GROWTHSETTING_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + + const handelDelete = async (id: number) => { + const result = await handleDeleteGROWTHSETTING({ + GROWTHSETTINGId: id + }); + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + + if (currentRow?.GROWTHSETTING_ID) { + req = { + ...currentRow, + ...res + } + } else { + req = { + ...res, + ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + const data = await handleSynchroGROWTHSETTING(req); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + formRef?.current?.resetFields() + setCurrentRow(undefined) + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }; + + + return ( + + { + return `${record?.GROWTHSETTING_ID}` + }} + formRef={formRef} + headerTitle="会员成长值配置列表" // 列表表头 + actionRef={actionRef} + bordered + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + const req: any = { + searchParameter: { + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911, + GROWTHSETTING_STATE: 1 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetGROWTHSETTINGList(req); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + pagination={{ defaultPageSize: 10 }} + /> + { + setCurrentRow(undefined); + setShowDetail(false); + }} + closable={false} + > + {currentRow?.GROWTHSETTING_ID && ( + ({ + data: currentRow || {}, + })} + params={{ + id: currentRow?.GROWTHSETTING_ID, + }} + columns={columns} + /> + )} + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新会员成长值配置' : '新建会员成长值配置'} + + } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, SCORESETTING_ID: currentRow.SCORESETTING_ID }; + } + console.log('newValue', newValue); + + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(GrowthValueRuleConfig); diff --git a/src/pages/travelMember/PointsRecordSearch/index.tsx b/src/pages/travelMember/PointsRecordSearch/index.tsx new file mode 100644 index 0000000..e841bce --- /dev/null +++ b/src/pages/travelMember/PointsRecordSearch/index.tsx @@ -0,0 +1,161 @@ +// 积分记录查询 +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import { handleGetCONSUMPTIONRECORDList, handleGetPOINTRECORDList } from "../service"; +import PageTitleBox from "@/components/PageTitleBox"; + + +const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "积分方式", + width: 120, + dataIndex: "POINT_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1": "累计", + "-1": "消耗" + } + }, + { + title: "积分来源", + width: 120, + dataIndex: "POINT_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1000": "消费赠送", + "2000": "消费抵扣", + "3000": "注册赠送" + } + }, + { + title: "本次积分", + width: 120, + dataIndex: "CURRENT_POINT", + hideInSearch: true, + ellipsis: true, + valueType: "digit" + }, + { + title: "累计积分", + width: 120, + dataIndex: "MEMBERSHIP_POINT", + hideInSearch: true, + ellipsis: true, + valueType: "digit" + }, + { + title: "获取时间", + width: 120, + dataIndex: "CREATE_DATE", + hideInSearch: true, + ellipsis: true, + }, + ] + + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + +
+
+ } + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetPOINTRECORDList(req) + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(PointsRecordSearch); diff --git a/src/pages/travelMember/PointsRuleConfig/index.tsx b/src/pages/travelMember/PointsRuleConfig/index.tsx new file mode 100644 index 0000000..c7936cb --- /dev/null +++ b/src/pages/travelMember/PointsRuleConfig/index.tsx @@ -0,0 +1,541 @@ +// 积分规则配置 +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; + +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; + +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handleDeleteSCORESETTING, handleGetSCORESETTINGList, handleSynchroSCORESETTING } from '../service'; +import session from '@/utils/session'; + + + +const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 积分类型的枚举 + let SCORETYPEList = session.get('SCORETYPEList') + let SCORETYPEObj = session.get('SCORETYPEObj') + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + // 拖动结束 + + // 定义列表字段内容 + const columns: any = [ + { + dataIndex: 'SCORE_TYPE', + title: '积分类别', + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: SCORETYPEObj + }, + { + dataIndex: 'SCORE_NAME', + title: '规则名称', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'EXCHANGE_BASE', + title: '兑换基数', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'CONVERTIBLE_PROPORTION', + title: '兑换比例', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'MEET_AMOUNT', + title: '满足金额', + valueType: 'money', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'EARN_POINTS', + title: '赚取积分', + align: 'center', + width: 120, + hideInSearch: true, + }, + { + dataIndex: 'GROWTH_VALUE', + title: '获得成长值', + width: 120, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'START_DATE', + title: '开始时间', + width: 150, + valueType: 'date', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.START_DATE ? moment(record?.START_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + { + dataIndex: 'END_DATE', + title: '结束时间', + width: 150, + valueType: 'date', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.END_DATE ? moment(record?.END_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + // { + // dataIndex: 'EXPIRY_DATE', + // title: '有效期', + // width: 120, + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'PROVINCE_CODE', + // title: '省份编码', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'OWNERUNIT_NAME', + // title: '业主单位名称', + // align: 'center', + // hideInSearch: true, + // }, + { + dataIndex: 'SCORESETTING_STATE', + title: '有效状态', + width: 120, + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: { + "1": "有效", + "0": "无效" + } + }, + { + dataIndex: 'ADDTIME', + title: '添加时间', + width: 150, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.ADDTIME ? moment(record?.ADDTIME).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + // { + // dataIndex: 'STAFF_NAME', + // title: '操作员名称', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'OPERATE_DATE', + // title: '操作时间', + // valueType: 'fromNow', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'SCORESETTING_DESC', + // title: '备注', + // align: 'center', + // hideInSearch: true, + // }, + { + dataIndex: 'option', + title: '操作', + width: 150, + valueType: 'option', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return ( + + { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + await handelDelete(record.SCORESETTING_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + const handelDelete = async (id: number) => { + const result = await handleDeleteSCORESETTING({ + SCORESETTINGId: id + }); + + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + // 同步积分规则 + const handleAddUpdate = async (res: any) => { + let req: any = {} + + if (currentRow?.SCORESETTING_ID) { + req = { + ...currentRow, + ...res + } + } else { + req = { + ...res, + ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + + const data = await handleSynchroSCORESETTING(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + formRef?.current?.resetFields() + setCurrentRow(undefined) + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + + return ( + + { + return `${record?.SCORESETTING_ID}` + }} + bordered + formRef={formRef} + headerTitle="积分规则列表" // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + + const searchWholeParams = { + searchParameter: { + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911, + SCORESETTING_STATE: 1 + }, + PageIndex: 1, + PageSize: 20 + } + setSearchParams(searchWholeParams) + const data = await handleGetSCORESETTINGList(searchWholeParams); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + pagination={{ defaultPageSize: 10 }} + /> + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新积分规则' : '新建积分规则'} + + } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, SCORESETTING_ID: currentRow.SCORESETTING_ID }; + } + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(PointsRuleConfig); diff --git a/src/pages/travelMember/memberInfor/index.tsx b/src/pages/travelMember/memberInfor/index.tsx index e436d12..7fcac27 100644 --- a/src/pages/travelMember/memberInfor/index.tsx +++ b/src/pages/travelMember/memberInfor/index.tsx @@ -5,7 +5,7 @@ import React, { useRef, useState } from "react"; import ProCard from "@ant-design/pro-card"; import { MenuFoldOutlined } from "@ant-design/icons"; import type { FormInstance } from "antd"; -import { Button, message, Space, Spin, Tree } from "antd"; +import { Button, Drawer, message, Space, Spin, Tree } from "antd"; import useRequest from "@ahooksjs/use-request"; import { getServerpartTree } from "@/services/options"; import type { ActionType } from "@ant-design/pro-table"; @@ -13,7 +13,7 @@ import ProTable from "@ant-design/pro-table"; import ReactHTMLTableToExcel from "react-html-table-to-excel"; import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; import PageTitleBox from "@/components/PageTitleBox"; -import { handleGetMEMBERSHIPList } from "../service"; +import { handleGetCONSUMPTIONRECORDList, handleGetMEMBERGROWTHList, handleGetMEMBERSHIPList, handleGetPOINTRECORDList } from "../service"; import session from "@/utils/session"; import moment from 'moment' @@ -33,6 +33,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { let MEMBERSHIP_TYPEObj = session.get('MEMBERSHIP_TYPEObj'); let MEMBERSHIP_LEVELObj = session.get('MEMBERSHIP_LEVELObj'); let COMPANY_STATEObj = session.get('COMPANY_STATEObj'); + let CONSUMPTIONRECORDTYPEObj = session.get('CONSUMPTIONRECORDTYPEObj') // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() @@ -46,16 +47,29 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { const [tableData, setTableData] = useState() // 表格的加载效果 const [tableLoading, setTableLoading] = useState(false) + // 显示详情抽屉 + const [showDetailDrawer, setShowDetailDrawer] = useState(false) + // 当前行数据 + const [currentRow, setCurrentRow] = useState() const columns: any = [ { title: "会员名称", - width: 120, + width: 200, dataIndex: "MEMBERSHIP_NAME", hideInSearch: true, ellipsis: true, align: 'center', - fixed: 'left' + fixed: 'left', + render: (_, record) => { + return { + console.log('recordrecord', record); + setCurrentRow(record) + setShowDetailDrawer(true) + }}> + {record?.MEMBERSHIP_NAME || ""} + + } }, { title: "会员类型", @@ -134,6 +148,11 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { hideInSearch: true, ellipsis: true, align: 'center', + render: (_, record) => { + return record?.MEMBERSHIP_HEADIMAGEURL ? { + window.open(record?.MEMBERSHIP_HEADIMAGEURL) + }}>点击查看 : "" + } }, { title: "联系地址", @@ -258,6 +277,214 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { tempTable.remove() // 防止重复打印一个内容 } + // 消费的列表 + let consumptionColumns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "消费类型", + width: 120, + dataIndex: "CONSUMPTIONRECORD_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: CONSUMPTIONRECORDTYPEObj + }, + { + title: "订单金额", + width: 120, + dataIndex: "CONSUME_AMOUNT", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "消费金额", + width: 120, + dataIndex: "CONSUME_PRICE", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "消费积分", + width: 120, + dataIndex: "CONSUME_SCORE", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "实付金额", + width: 120, + dataIndex: "PAY_AMOUNT", + hideInSearch: true, + valueType: 'digit', + ellipsis: true, + }, + { + title: "优惠金额", + width: 150, + dataIndex: "COUPON_AMOUNT", + hideInSearch: true, + ellipsis: true, + }, + { + title: "消费时间 ", + width: 150, + dataIndex: "CONSUMPTIONRECORD_DATE", + hideInSearch: true, + render: (_, record) => { + return record?.CONSUMPTIONRECORD_DATE ? moment(record?.CONSUMPTIONRECORD_DATE).format('YYYY-MM-DD HH:mm:ss') : '-' + } + }, + ] + // 积分的列表 + let PointColumns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "积分方式", + width: 120, + dataIndex: "POINT_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1": "累计", + "-1": "消耗" + } + }, + { + title: "积分来源", + width: 120, + dataIndex: "POINT_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1000": "消费赠送", + "2000": "消费抵扣", + "3000": "注册赠送" + } + }, + { + title: "本次积分", + width: 120, + dataIndex: "CURRENT_POINT", + hideInSearch: true, + ellipsis: true, + valueType: "digit" + }, + { + title: "累计积分", + width: 120, + dataIndex: "MEMBERSHIP_POINT", + hideInSearch: true, + ellipsis: true, + valueType: "digit" + }, + { + title: "获取时间", + width: 120, + dataIndex: "CREATE_DATE", + hideInSearch: true, + ellipsis: true, + }, + ] + + // 成长值的列表 + let GrowthValueColumns: any = [ + { + title: "服务区名称", + width: 150, + dataIndex: "SERVERPART_NAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "门店名称", + width: 150, + dataIndex: "SHOPNAME", + hideInSearch: true, + ellipsis: true, + }, + { + title: "累计成长值", + width: 120, + dataIndex: "MEMBERSHIP_GROWTH", + hideInSearch: true, + ellipsis: true, + valueType: 'digit' + }, + { + title: "本次成长值", + width: 120, + dataIndex: "CURRENT_GROWTH", + hideInSearch: true, + ellipsis: true, + valueType: 'digit' + }, + { + title: "成长来源", + width: 120, + dataIndex: "GROWTH_VALUE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1000": "消费赠送", + "2000": "消费抵扣", + "3000": "注册赠送", + } + }, + { + title: "成长方式", + width: 120, + dataIndex: "GROWTH_TYPE", + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1": "积累", + "-1": "消耗", + } + }, + { + title: "操作时间", + width: 120, + dataIndex: "OPERATE_DATE", + hideInSearch: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD') : "-" + } + }, + ] + return (
{ @@ -366,6 +593,102 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { />
+ + + { + setShowDetailDrawer(false); + setCurrentRow(null) + }} + title={`${MEMBERSHIP_LEVELObj ? MEMBERSHIP_LEVELObj[currentRow?.MEMBERSHIP_LEVEL] ? MEMBERSHIP_LEVELObj[currentRow?.MEMBERSHIP_LEVEL] : "" : ''}${currentRow?.MEMBERSHIP_NAME}`} + bodyStyle={{ padding: 0 }} + footer={ +
+
+ } + > + + 消费记录} + search={false} + options={false} + bordered + columns={consumptionColumns} + scroll={{ x: '100%', y: '450px' }} + request={async () => { + const req: any = { + SearchParameter: { + MEMBERSHIP_IDS: currentRow?.MEMBERSHIP_ID, + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetCONSUMPTIONRECORDList(req) + console.log('11111', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + /> + + 积分记录} + search={false} + options={false} + bordered + scroll={{ x: '100%', y: '450px' }} + columns={PointColumns} + request={async () => { + const req: any = { + SearchParameter: { + MEMBERSHIP_IDS: currentRow?.MEMBERSHIP_ID, + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetPOINTRECORDList(req) + console.log('22222', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + /> + + 成长值记录} + search={false} + options={false} + bordered + scroll={{ x: '100%', y: '450px' }} + columns={GrowthValueColumns} + request={async () => { + const req: any = { + SearchParameter: { + MEMBERSHIP_IDS: currentRow?.MEMBERSHIP_ID, + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911 + }, + PageIndex: 1, + PageSize: 20 + } + const data = await handleGetMEMBERGROWTHList(req) + console.log('33333', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + /> +
) } diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts index d31b819..3dbcfe9 100644 --- a/src/pages/travelMember/service.ts +++ b/src/pages/travelMember/service.ts @@ -1,17 +1,130 @@ -import request from '@/utils/request'; +// import request from '@/utils/request'; +import requestEncryption from '@/utils/requestEncryption'; +// 会员信息列表 export async function handleGetMEMBERSHIPList(params: any) { - - const data = await request(`/Member/GetMEMBERSHIPList`, { + const data = await requestEncryption(`/Member/GetMEMBERSHIPList`, { method: 'POST', - data: params + data: { ...params, requestEncryption: true } }) - - if (data.Result_Code === 500) { + if (data.Result_Code !== 100) { return [] } - return data.Result_Data +} + + +// 消费记录列表 +export async function handleGetCONSUMPTIONRECORDList(params: any) { + const data = await requestEncryption(`/OnlineOrder/GetCONSUMPTIONRECORDList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + +// 获取积分记录列表 +export async function handleGetPOINTRECORDList(params: any) { + const data = await requestEncryption(`/MemberOrder/GetPOINTRECORDList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + +// 获取成长值记录列表 +export async function handleGetMEMBERGROWTHList(params: any) { + const data = await requestEncryption(`/MemberMarketing/GetGROWTHRECORDList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + +// 获取积分规则配置列表 +export async function handleGetSCORESETTINGList(params: any) { + const data = await requestEncryption(`/MemberMarketing/GetSCORESETTINGList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + +// 同步积分规则 +export async function handleSynchroSCORESETTING(params: any) { + const data = await requestEncryption(`/MemberMarketing/SynchroSCORESETTING`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除积分同步规则 +export async function handleDeleteSCORESETTING(params: any) { + const data = await requestEncryption(`/MemberMarketing/DeleteSCORESETTING`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + + +// 成长值配置的列表 +export async function handleGetGROWTHSETTINGList(params: any) { + const data = await requestEncryption(`/MemberMarketing/GetGROWTHSETTINGList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + +// 同步成长值的配置 +export async function handleSynchroGROWTHSETTING(params: any) { + const data = await requestEncryption(`/MemberMarketing/SynchroGROWTHSETTING`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除成长值配置 +export async function handleDeleteGROWTHSETTING(params: any) { + const data = await requestEncryption(`/MemberMarketing/DeleteGROWTHSETTING`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data } \ No newline at end of file diff --git a/src/utils/format.ts b/src/utils/format.ts index 731fb67..0992a3e 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -498,12 +498,37 @@ export const handleChangeKeyTo = async (params: any, keyObj: any) => { // 传入秒 返回时分 export const secondsToHuman = (seconds: number) => { - const hours = Math.floor(seconds / 3600); - const minutes = Math.floor((seconds % 3600) / 60); + const hours = Math.floor(seconds / 3600); + const minutes = Math.floor((seconds % 3600) / 60); - const parts = []; - if (hours > 0) parts.push(`${hours}小时`); - if (minutes > 0) parts.push(`${minutes}分钟`); + const parts = []; + if (hours > 0) parts.push(`${hours}小时`); + if (minutes > 0) parts.push(`${minutes}分钟`); - return parts.join('') || '0分钟'; + return parts.join('') || '0分钟'; +} + + +// 封装一个只要传入操作事项的就可以记录日志 +export const handleSetlogSave = async (str: string) => { + const currentUser = session.get('currentUser') + const basicInfo = session.get('basicInfo') + const browserVersion = session.get('browserVersion') + const systemBasin = session.get('systemBasin') + + synchroBehaviorRecord({ + USER_ID: currentUser?.ID, + USER_NAME: currentUser?.Name, + BEHAVIORRECORD_TYPE: "2000", + BEHAVIORRECORD_EXPLAIN: str, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + BUSINESSMAN_ID: currentUser?.BUSINESSMAN_ID, + BUSINESSMAN_NAME: currentUser?.BUSINESSMAN_NAME, + SOURCE_PLATFORM: "出行平台", + USER_LOGINIP: basicInfo?.ip, + USER_LOGINPLACE: `${basicInfo?.prov}${basicInfo?.city}${basicInfo?.district}`, + BROWSER_VERSION: browserVersion, + OPERATING_SYSTEM: systemBasin + }) } \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index 8f8fcf9..24d9d1a 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -73,6 +73,7 @@ const request = extend({ // 存一下进来调用的值 // let userbeHaviObj: any = {} + // request拦截器, 改变url 或 options. request.interceptors.request.use((url, opt: any) => { const options = { ...opt } @@ -147,7 +148,6 @@ request.interceptors.request.use((url, opt: any) => { } - return { // url: url.indexOf('handler_ajax.ashx')>-1 ?`https://user.eshangtech.com${url}`: `http://47.96.233.105/EShangApiMain${url}`, url,// .indexOf('handler_ajax.ashx')>-1 ?`${url}`: `/EShangApiMain${url}`, diff --git a/src/utils/requestEncryption.ts b/src/utils/requestEncryption.ts index 1c28bee..7e51086 100644 --- a/src/utils/requestEncryption.ts +++ b/src/utils/requestEncryption.ts @@ -50,7 +50,7 @@ const errorHandler = (error: { response: Response }): Response => { return response; }; -const request = extend({ +const requestEncryption = extend({ errorHandler, // default error handling // prefix: '/EShangApiMain',// 开发 prefix: 'https://api.eshangtech.com/MemberApi', // 正式 @@ -64,7 +64,7 @@ const request = extend({ }); // request拦截器, 改变url 或 options. -request.interceptors.request.use((url, opt: any) => { +requestEncryption.interceptors.request.use((url, opt: any) => { const options = { ...opt } const currentUser: CurrentUser = session.get('currentUser'); @@ -126,21 +126,22 @@ request.interceptors.request.use((url, opt: any) => { } } - - - options.data = { - name: "", - value: encryptAES(JSON.stringify(options.data)) + if (options.data.requestEncryption) { + options.data = { + name: "", + value: encryptAES(JSON.stringify(options.data)) + } } + return { url, options, } }) -request.interceptors.response.use((response, option) => { +requestEncryption.interceptors.response.use((response, option) => { const nowTmp = moment() Cookies.set('tmp', nowTmp.format()) return response }) -export default request; +export default requestEncryption;