update
This commit is contained in:
parent
52119dd4d1
commit
9a7cf2f7c9
@ -482,6 +482,12 @@ export default [
|
|||||||
name: 'CardCouponApplicRules',
|
name: 'CardCouponApplicRules',
|
||||||
component: './CardInformation/CardCouponApplicRules/index'
|
component: './CardInformation/CardCouponApplicRules/index'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'CardInformationManager',
|
||||||
|
name: 'CardInformationManager',
|
||||||
|
component: './CardInformation/CardInformationManager/index'
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: 'CardVoucherCollection',
|
path: 'CardVoucherCollection',
|
||||||
name: 'CardVoucherCollection',
|
name: 'CardVoucherCollection',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ant-design-pro",
|
"name": "ant-design-pro",
|
||||||
"version": "4.5.66",
|
"version": "4.5.69",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "An out-of-box UI solution for enterprise applications",
|
"description": "An out-of-box UI solution for enterprise applications",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -293,7 +293,7 @@ const Edit = ({ tableTab, openType, detail, reloadTable, currentUser, selectTab,
|
|||||||
USER_PASSPORT: initialDetail?.USER_PASSPORT,
|
USER_PASSPORT: initialDetail?.USER_PASSPORT,
|
||||||
USER_MOBILEPHONE: initialDetail?.USER_MOBILEPHONE,
|
USER_MOBILEPHONE: initialDetail?.USER_MOBILEPHONE,
|
||||||
BEHAVIORRECORD_TYPE: type,
|
BEHAVIORRECORD_TYPE: type,
|
||||||
BEHAVIORRECORD_EXPLAIN: '删除用户',
|
BEHAVIORRECORD_EXPLAIN: type === 1001 ? '更新用户' : '删除用户',
|
||||||
BEHAVIORRECORD_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
BEHAVIORRECORD_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
BEHAVIORRECORD_ROUT: pageType ? '/setting/merchantManagement' : '/setting/users',
|
BEHAVIORRECORD_ROUT: pageType ? '/setting/merchantManagement' : '/setting/users',
|
||||||
BEHAVIORRECORD_ROUTNAME: pageType ? '商户管理' : '账号管理',
|
BEHAVIORRECORD_ROUTNAME: pageType ? '商户管理' : '账号管理',
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import loginBg from '../../../assets/login-bg.png';
|
|||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import { line } from '@antv/g2plot';
|
import { line } from '@antv/g2plot';
|
||||||
import session from '@/utils/session';
|
import session from '@/utils/session';
|
||||||
|
import { getLocationByIP, getUserIP } from '@/utils/format';
|
||||||
|
|
||||||
// 可接受的页面参数
|
// 可接受的页面参数
|
||||||
export type LoginProps = {
|
export type LoginProps = {
|
||||||
@ -117,7 +118,22 @@ const Login: React.FC<LoginProps> = (props) => {
|
|||||||
function successCallBack(req: any) {
|
function successCallBack(req: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(async () => {
|
||||||
|
// 先拿到ip
|
||||||
|
let IpInfo: any = await getUserIP()
|
||||||
|
console.log('IpInfoIpInfoIpInfoIpInfo', IpInfo);
|
||||||
|
// 用ip 去获取信息
|
||||||
|
let ipDetail: any = await getLocationByIP(IpInfo, 'XrQQuNQRGxap9YH2xmvx3dzuJVkXhTzT')
|
||||||
|
console.log('ipDetailipDetailipDetail', ipDetail);
|
||||||
|
const ipRes: any = {
|
||||||
|
country: ipDetail.country,
|
||||||
|
prov: ipDetail.province,
|
||||||
|
city: ipDetail.city,
|
||||||
|
district: ipDetail.district,
|
||||||
|
ip: IpInfo,
|
||||||
|
}
|
||||||
|
session.set('basicInfo', ipRes);
|
||||||
|
setBaseInfo(ipRes)
|
||||||
// 第三方 说是不安全
|
// 第三方 说是不安全
|
||||||
// fetch('https://api.ipify.org?format=json').then(response => response.json())
|
// fetch('https://api.ipify.org?format=json').then(response => response.json())
|
||||||
// .then(json => console.log(json.ip));
|
// .then(json => console.log(json.ip));
|
||||||
|
|||||||
@ -123,3 +123,16 @@ export async function handlecsyncWeChatGetMallGoodsInfoAll(params: any) {
|
|||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 按照实际商品分类 去同步商城商品
|
||||||
|
export async function handlecsyncWeChatGetMallGoodsInfo(params: any) {
|
||||||
|
const data = await requestJava(`/third-party/syncWeChatGetMallGoodsInfo`, {
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
@ -335,7 +335,7 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{
|
{
|
||||||
currentRow?.SALEBILL_STATE > 1020 && currentRow?.SALEBILL_STATE < 3000 ?
|
currentRow?.SALEBILL_STATE > 1010 && currentRow?.SALEBILL_STATE < 3000 ?
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={'确认更新物流信息?'}
|
title={'确认更新物流信息?'}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
@ -344,7 +344,7 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
|
|||||||
>
|
>
|
||||||
<Button type="primary">更新物流信息</Button>
|
<Button type="primary">更新物流信息</Button>
|
||||||
</Popconfirm> :
|
</Popconfirm> :
|
||||||
currentRow?.SALEBILL_STATE === 1020 ?
|
currentRow?.SALEBILL_STATE === 1010 ?
|
||||||
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={'确认发货?'}
|
title={'确认发货?'}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { connect } from "umi";
|
|||||||
import type { CurrentUser } from "umi";
|
import type { CurrentUser } from "umi";
|
||||||
import type { ConnectState } from "@/models/connect";
|
import type { ConnectState } from "@/models/connect";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useRef, useState } from "react";
|
||||||
import { Col, Modal, Row, type FormInstance } from "antd";
|
import { Button, Col, Modal, Row, type FormInstance } from "antd";
|
||||||
import type { ActionType } from "@ant-design/pro-table";
|
import type { ActionType } from "@ant-design/pro-table";
|
||||||
import ProTable from "@ant-design/pro-table";
|
import ProTable from "@ant-design/pro-table";
|
||||||
import PageTitleBox from "@/components/PageTitleBox";
|
import PageTitleBox from "@/components/PageTitleBox";
|
||||||
@ -18,6 +18,7 @@ import closeIcon from '@/assets/detail/closeIcon.png'
|
|||||||
import { convertTreeFieldToNumber, handleSetlogSave } from "@/utils/format";
|
import { convertTreeFieldToNumber, handleSetlogSave } from "@/utils/format";
|
||||||
import OrderDetailModal from "../BookingMealOrder/components/orderDetailModal";
|
import OrderDetailModal from "../BookingMealOrder/components/orderDetailModal";
|
||||||
import { highlightText } from "@/utils/highlightText";
|
import { highlightText } from "@/utils/highlightText";
|
||||||
|
import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun";
|
||||||
|
|
||||||
const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolean, searchReq?: any }> = (props) => {
|
const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolean, searchReq?: any }> = (props) => {
|
||||||
const { currentUser, isComponent, searchReq } = props
|
const { currentUser, isComponent, searchReq } = props
|
||||||
@ -36,6 +37,8 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||||
// 当前查询的文字
|
// 当前查询的文字
|
||||||
const [currentSearchText, setCurrentSearchText] = useState<string>('')
|
const [currentSearchText, setCurrentSearchText] = useState<string>('')
|
||||||
|
// 导出的表格数据
|
||||||
|
const [reqDetailList, setReqDetailList] = useState<any>()
|
||||||
|
|
||||||
const onDraggaleStart = (event, uiData) => {
|
const onDraggaleStart = (event, uiData) => {
|
||||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||||
@ -83,7 +86,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
|
// initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
|
||||||
initialValue: [moment(moment().subtract(1, 'd')).startOf('M'), moment()],
|
initialValue: [moment().subtract(1, 'M').startOf('M'), moment()],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "订单状态",
|
title: "订单状态",
|
||||||
@ -397,8 +400,10 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
fieldNames: {
|
fieldNames: {
|
||||||
label: 'MERCHANTS_NAME',
|
label: 'MERCHANTS_NAME',
|
||||||
value: 'MERCHANTS_ID',
|
value: 'MERCHANTS_ID',
|
||||||
}
|
},
|
||||||
}
|
disabled: currentUser?.UserPattern === 4000
|
||||||
|
},
|
||||||
|
initialValue: currentUser?.UserPattern === 4000 ? currentUser?.SupplierID : ""
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: "订单编号",
|
// title: "订单编号",
|
||||||
@ -478,6 +483,191 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//导出的columns 普通
|
||||||
|
const exportColumnsNomal: any = [
|
||||||
|
{
|
||||||
|
title: "订单编号",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "会员名称",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "收货人",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "收货人电话",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "收货地址",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "物流信息",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "商品名称",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "商品条码",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "供货商",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "商品规格",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "下单数量",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "采购单价",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "采购合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "采购不含税合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "销售单价",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "销售合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "销售不含税合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "平台手续费",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "财务到账含税金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "税率",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单位名称",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "付款积分",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "实付总金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付方式",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付时间",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付订单号",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单状态",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "工会订单",
|
||||||
|
dataIndex: "",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
//导出的columns 财务
|
||||||
|
const exportColumns: any = [
|
||||||
|
{
|
||||||
|
title: "支付订单号",
|
||||||
|
dataIndex: "PAYMENT_CODE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "会员名称",
|
||||||
|
dataIndex: "ORDER_PERSON",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付时间",
|
||||||
|
dataIndex: "ORDER_DATE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "下单数量",
|
||||||
|
dataIndex: "TOTAL_COUNT",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "采购合计金额",
|
||||||
|
dataIndex: "COST_AMOUNT",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "采购不含税合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "销售合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "销售不含税合计金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "平台手续费",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "财务到账含税金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单位名称",
|
||||||
|
dataIndex: "OWNERUNIT_NAME",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "付款积分",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "实付总金额",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付方式",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单状态",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "工会订单",
|
||||||
|
dataIndex: "",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
@ -517,7 +707,8 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
CHANNEL_TYPE: params?.PAY_METHOD === "0" ? "" : params?.PAY_METHOD,
|
CHANNEL_TYPE: params?.PAY_METHOD === "0" ? "" : params?.PAY_METHOD,
|
||||||
SearchKeyValue: params?.searchText || "",
|
SearchKeyValue: params?.searchText || "",
|
||||||
MERCHANTS_IDS: params?.MERCHANTS_IDS || "",
|
MERCHANTS_IDS: params?.MERCHANTS_IDS || "",
|
||||||
MEMBERSHIP_TARGET: params?.MEMBERSHIP_TARGET && params?.MEMBERSHIP_TARGET.length > 0 ? params?.MEMBERSHIP_TARGET.toString() : ""
|
MEMBERSHIP_TARGET: params?.MEMBERSHIP_TARGET && params?.MEMBERSHIP_TARGET.length > 0 ? params?.MEMBERSHIP_TARGET.toString() : "",
|
||||||
|
// MERCHANTS_IDS: currentUser?.SupplierID
|
||||||
},
|
},
|
||||||
PageIndex: 1,
|
PageIndex: 1,
|
||||||
PageSize: 999999,
|
PageSize: 999999,
|
||||||
@ -528,18 +719,40 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
|
|||||||
// },
|
// },
|
||||||
}
|
}
|
||||||
console.log('reqreqreqreqreq', req);
|
console.log('reqreqreqreqreq', req);
|
||||||
|
setSearchParams(params)
|
||||||
// const data = await handeGetSALEBILLList(req);
|
// const data = await handeGetSALEBILLList(req);
|
||||||
const data = await handeGetSaleBillWholeList(req);
|
const data = await handeGetSaleBillWholeList(req);
|
||||||
console.log('datadatadatadatadata', data);
|
console.log('datadatadatadatadata', data);
|
||||||
setCurrentSearchText(params?.searchText || "")
|
setCurrentSearchText(params?.searchText || "")
|
||||||
handleSetlogSave(`点击查询按钮`)
|
handleSetlogSave(`点击查询按钮`)
|
||||||
if (data.List && data.List.length > 0) {
|
if (data.List && data.List.length > 0) {
|
||||||
|
setReqDetailList(data.List)
|
||||||
return { data: data.List, success: true, total: data.TotalCount }
|
return { data: data.List, success: true, total: data.TotalCount }
|
||||||
}
|
}
|
||||||
|
setReqDetailList([])
|
||||||
return { data: [], success: true }
|
return { data: [], success: true }
|
||||||
}}
|
}}
|
||||||
toolbar={{
|
toolbar={{
|
||||||
|
// actions: [
|
||||||
|
// <Button type={"primary"} onClick={() => {
|
||||||
|
// // exportXlsxFromProColumnsExcelJS(exportColumnsNomal,
|
||||||
|
// // reqDetailList,
|
||||||
|
// // `云南交投集团经营开发有限公司彩云驿商业管理分公司-销售出库单(${searchParams.ORDER_DATE_Start}-${searchParams.ORDER_DATE_End})`,
|
||||||
|
// // {
|
||||||
|
|
||||||
|
// // }
|
||||||
|
// // )
|
||||||
|
// }}>导出Excel</Button>,
|
||||||
|
// <Button type={"primary"} onClick={() => {
|
||||||
|
// // exportXlsxFromProColumnsExcelJS(exportColumns,
|
||||||
|
// // reqDetailList,
|
||||||
|
// // `云南交投集团经营开发有限公司彩云驿商业管理分公司-财务结算单(${searchParams.ORDER_DATE_Start}-${searchParams.ORDER_DATE_End})`,
|
||||||
|
// // {
|
||||||
|
|
||||||
|
// // }
|
||||||
|
// // )
|
||||||
|
// }}>导出财务结算Excel</Button>
|
||||||
|
// ]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,7 +29,8 @@ import session from '@/utils/session';
|
|||||||
import { deleteAHYDPicture, deletePicture, uploadAHYDPicture, uploadPicture } from '@/services/picture';
|
import { deleteAHYDPicture, deletePicture, uploadAHYDPicture, uploadPicture } from '@/services/picture';
|
||||||
import { handleSetlogSave } from '@/utils/format';
|
import { handleSetlogSave } from '@/utils/format';
|
||||||
import { highlightText } from '@/utils/highlightText';
|
import { highlightText } from '@/utils/highlightText';
|
||||||
import { handlecsyncWeChatGetMallGoodsInfoAll } from '@/pages/operatingMerchants/service';
|
import { handlecsyncWeChatGetMallGoodsInfo, handlecsyncWeChatGetMallGoodsInfoAll } from '@/pages/operatingMerchants/service';
|
||||||
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
|
|
||||||
const beforeUpload = (file: any) => {
|
const beforeUpload = (file: any) => {
|
||||||
@ -109,6 +110,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
const [showRateModal, setShowRateModal] = useState<boolean>(false)
|
const [showRateModal, setShowRateModal] = useState<boolean>(false)
|
||||||
// 税率悬浮框的加载效果
|
// 税率悬浮框的加载效果
|
||||||
const [rateLoading, setRateLoading] = useState<boolean>(false)
|
const [rateLoading, setRateLoading] = useState<boolean>(false)
|
||||||
|
// 点开的商品详情信息
|
||||||
|
const [currentRowDetail, setCurrentRowDetail] = useState<any>()
|
||||||
|
|
||||||
// 预览上传后的图片
|
// 预览上传后的图片
|
||||||
const handlePreview = async (type: number) => {
|
const handlePreview = async (type: number) => {
|
||||||
@ -509,12 +512,14 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
setHeaderImgList([])
|
setHeaderImgList([])
|
||||||
setDetailImgList([])
|
setDetailImgList([])
|
||||||
actionRef.current?.reload()
|
actionRef.current?.reload()
|
||||||
|
|
||||||
|
handlecsyncWeChatGetMallGoodsInfo({ appId: 'wxee018fb96955552a', userdefinedTypeId: currentRow?.USERDEFINEDTYPE_ID })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddUpdate = async (res: any) => {
|
const handleAddUpdate = async (res: any, type?: string) => {
|
||||||
let req: any = {}
|
let req: any = {}
|
||||||
if (currentRow?.USERDEFINEDTYPE_ID) {
|
if (currentRow?.USERDEFINEDTYPE_ID && type !== 'saveAs') {
|
||||||
req = {
|
req = {
|
||||||
...currentRow,
|
...currentRow,
|
||||||
...res,
|
...res,
|
||||||
@ -534,6 +539,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
|
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
|
||||||
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
|
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
|
||||||
|
WECHATAPP_APPID: "wxee018fb96955552a",
|
||||||
|
WECHATAPPSIGN_NAME: "彩云驿出行"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
req = {
|
req = {
|
||||||
@ -554,6 +561,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
|
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
|
||||||
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
|
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
|
||||||
|
WECHATAPP_APPID: "wxee018fb96955552a",
|
||||||
|
WECHATAPPSIGN_NAME: "彩云驿出行"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('reqreqreqreq', req);
|
console.log('reqreqreqreq', req);
|
||||||
@ -566,7 +575,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
|
|
||||||
handleSetlogSave(`${currentRow?.USERDEFINEDTYPE_ID ? '更新' : '新增'}商品【${data.Result_Data?.COMMODITY_NAME}】`)
|
handleSetlogSave(`${currentRow?.USERDEFINEDTYPE_ID ? '更新' : '新增'}商品【${data.Result_Data?.COMMODITY_NAME}】`)
|
||||||
|
|
||||||
message.success("新增成功!")
|
message.success(currentRow ? "同步成功!" : "新增成功!")
|
||||||
setCurrentRow(undefined)
|
setCurrentRow(undefined)
|
||||||
formRef?.current?.resetFields()
|
formRef?.current?.resetFields()
|
||||||
handleModalVisible(false)
|
handleModalVisible(false)
|
||||||
@ -580,7 +589,47 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
setHeaderImgList([])
|
setHeaderImgList([])
|
||||||
setDetailImgList([])
|
setDetailImgList([])
|
||||||
|
|
||||||
handlecsyncWeChatGetMallGoodsInfoAll({ appId: 'wxee018fb96955552a' })
|
|
||||||
|
let USERDEFINEDTYPEList: any = session.get('USERDEFINEDTYPEList')
|
||||||
|
let list: any = []
|
||||||
|
if (USERDEFINEDTYPEList && USERDEFINEDTYPEList.length > 0) {
|
||||||
|
list = USERDEFINEDTYPEList
|
||||||
|
} else {
|
||||||
|
const req = {
|
||||||
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
|
PROVINCE_CODE: "",
|
||||||
|
GOODSTYPE: 4000,
|
||||||
|
USERDEFINEDTYPE_STATE: 1
|
||||||
|
}
|
||||||
|
const data = await handlGetUSERDEFINEDTYPEList(req);
|
||||||
|
session.set("USERDEFINEDTYPEList", data)
|
||||||
|
list = data
|
||||||
|
}
|
||||||
|
let resPid: any = ''
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
let obj: any = {}
|
||||||
|
list.forEach((item: any) => {
|
||||||
|
let childrenTypeList: any = []
|
||||||
|
if (item.children && item.children.length > 0) [
|
||||||
|
item.children.forEach((subItem: any) => {
|
||||||
|
childrenTypeList.push(subItem.USERDEFINEDTYPE_ID)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
obj[item.USERDEFINEDTYPE_ID] = childrenTypeList
|
||||||
|
})
|
||||||
|
console.log('objobjobjobj', obj);
|
||||||
|
console.log('datadatadatadata', data);
|
||||||
|
|
||||||
|
for (let key in obj) {
|
||||||
|
if (obj[key].indexOf(Number(data.Result_Data?.USERDEFINEDTYPE_ID)) !== -1) {
|
||||||
|
resPid = key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('resPidresPidresPidresPid', resPid);
|
||||||
|
|
||||||
|
handlecsyncWeChatGetMallGoodsInfo({ appId: 'wxee018fb96955552a', userdefinedTypeId: data.Result_Data?.USERDEFINEDTYPE_ID })
|
||||||
} else {
|
} else {
|
||||||
message.error(data.Result_Desc)
|
message.error(data.Result_Desc)
|
||||||
}
|
}
|
||||||
@ -698,6 +747,32 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const normalize = (obj: any) => {
|
||||||
|
if (!obj || typeof obj !== 'object') return obj;
|
||||||
|
|
||||||
|
const result: any = {};
|
||||||
|
Object.keys(obj).forEach(key => {
|
||||||
|
let value = obj[key];
|
||||||
|
|
||||||
|
// 把 undefined 转 null,避免 undefined 导致比较失败
|
||||||
|
if (value === undefined) value = null;
|
||||||
|
|
||||||
|
// 如果是数组,排序后再比较(避免顺序不同被判不同)
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value = value.map(v => (typeof v === 'number' ? v : Number(v) || v)).sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是数字字符串,转换为数字
|
||||||
|
if (typeof value === 'string' && !isNaN(Number(value)) && value.trim() !== '') {
|
||||||
|
value = Number(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
result[key] = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
|
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
|
||||||
@ -733,6 +808,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH,
|
DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH,
|
||||||
COMMODITY_TYPE: 4000,
|
COMMODITY_TYPE: 4000,
|
||||||
COMMODITY_STATE: 1,
|
COMMODITY_STATE: 1,
|
||||||
|
MERCHANTS_ID: currentUser?.SupplierID
|
||||||
},
|
},
|
||||||
|
|
||||||
keyWord: {
|
keyWord: {
|
||||||
@ -904,6 +980,65 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<Button loading={confirmLoading} onClick={() => {
|
||||||
|
let oldFormRes: any = {
|
||||||
|
COMMODITY_NAME: currentRow?.COMMODITY_NAME,
|
||||||
|
BRAND_ID: `${currentRow?.BRAND_NAME}-${currentRow?.BRAND_ID}`,
|
||||||
|
COMMODITY_NATURE: currentRow?.COMMODITY_NATURE,
|
||||||
|
USERDEFINEDTYPE_ID: currentRowDetail?.UserDefinedTypeIds ? currentRowDetail?.UserDefinedTypeIds.split(',').map(Number) : null,
|
||||||
|
MERCHANTS_ID: `${currentRow?.MERCHANTS_NAME}-${currentRow?.MERCHANTS_ID}`,
|
||||||
|
COMMODITY_BARCODE: currentRow?.COMMODITY_BARCODE,
|
||||||
|
COMMODITY_ORI: currentRow?.COMMODITY_ORI,
|
||||||
|
COMMODITY_UNIT: currentRow?.COMMODITY_UNIT,
|
||||||
|
COMMODITY_RULE: currentRow?.COMMODITY_RULE,
|
||||||
|
COMMODITY_STOCK: currentRow?.COMMODITY_STOCK,
|
||||||
|
COMMODITY_EN: currentRow?.COMMODITY_EN,
|
||||||
|
COMMODITY_GRADE: currentRow?.COMMODITY_GRADE,
|
||||||
|
COMMODITY_INDEX: currentRow?.COMMODITY_INDEX,
|
||||||
|
COMMODITY_DESC: currentRow?.COMMODITY_DESC,
|
||||||
|
PAY_METHOD: currentRow?.PAY_METHOD,
|
||||||
|
DUTY_PARAGRAPH: currentRow?.DUTY_PARAGRAPH,
|
||||||
|
COMMODITY_RETAILPRICE: currentRow?.COMMODITY_RETAILPRICE,
|
||||||
|
COMMODITY_MEMBERPRICE: currentRow?.COMMODITY_MEMBERPRICE,
|
||||||
|
COMMODITY_PURCHASEPRICE: currentRow?.COMMODITY_PURCHASEPRICE,
|
||||||
|
COMMODITY_POINT: currentRow?.COMMODITY_POINT,
|
||||||
|
SEND_MODE: currentRow?.SEND_MODE,
|
||||||
|
DELIVER_AREA: currentRow?.DELIVER_AREA,
|
||||||
|
REMINDER_DAY: currentRow?.REMINDER_DAY,
|
||||||
|
AFTERSALE_NATRUE: currentRow?.AFTERSALE_NATRUE,
|
||||||
|
UPPER_DATE: currentRow?.UPPER_DATE ? currentRow?.UPPER_DATE : [],
|
||||||
|
LIMIT_TOTALCOUNT: currentRow?.LIMIT_TOTALCOUNT,
|
||||||
|
LIMIT_DAILYCOUNT: currentRow?.LIMIT_DAILYCOUNT,
|
||||||
|
WECHATAPPSIGN_ID: currentRow?.WECHATAPPSIGN_ID,
|
||||||
|
UPPER_STATE: currentRow?.UPPER_STATE,
|
||||||
|
DATAFORMAT: currentRow?.DATAFORMAT,
|
||||||
|
}
|
||||||
|
console.log('oldFormRes', oldFormRes);
|
||||||
|
|
||||||
|
const names = [
|
||||||
|
"COMMODITY_NAME", "COMMODITY_NATURE", "BRAND_ID", "USERDEFINEDTYPE_ID", "MERCHANTS_ID",
|
||||||
|
"COMMODITY_BARCODE", "COMMODITY_ORI", "COMMODITY_UNIT", "COMMODITY_RULE", "COMMODITY_STOCK",
|
||||||
|
"COMMODITY_EN", "COMMODITY_GRADE", "COMMODITY_INDEX", "COMMODITY_DESC", "PAY_METHOD",
|
||||||
|
"DUTY_PARAGRAPH", "COMMODITY_RETAILPRICE", "COMMODITY_MEMBERPRICE", "COMMODITY_PURCHASEPRICE",
|
||||||
|
"COMMODITY_POINT", "SEND_MODE", "DELIVER_AREA", "REMINDER_DAY", "AFTERSALE_NATRUE",
|
||||||
|
"UPPER_DATE", "LIMIT_TOTALCOUNT", "LIMIT_DAILYCOUNT", "WECHATAPPSIGN_ID", "UPPER_STATE", "DATAFORMAT"
|
||||||
|
];
|
||||||
|
let newFormRes: any = formRef.current?.getFieldsValue(names)
|
||||||
|
console.log('newFormResnewFormResnewFormRes', newFormRes);
|
||||||
|
|
||||||
|
if (isEqual(normalize(oldFormRes), normalize(newFormRes))) {
|
||||||
|
message.error('与原商品一致,无法另存为!')
|
||||||
|
} else {
|
||||||
|
formRef?.current?.validateFields().then(async (newValue) => {
|
||||||
|
handleConfirmLoading(true)
|
||||||
|
await handleAddUpdate(newValue, 'saveAs');
|
||||||
|
})
|
||||||
|
// 如果有开关,要把开关的代码写进去
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
另存为
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Button onClick={() => {
|
<Button onClick={() => {
|
||||||
handleConfirmLoading(false)
|
handleConfirmLoading(false)
|
||||||
handleModalVisible(false)
|
handleModalVisible(false)
|
||||||
@ -916,11 +1051,13 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
setMainImgList([])
|
setMainImgList([])
|
||||||
setHeaderImgList([])
|
setHeaderImgList([])
|
||||||
setDetailImgList([])
|
setDetailImgList([])
|
||||||
|
setCurrentRowDetail(undefined)
|
||||||
}}>取 消</Button>
|
}}>取 消</Button>
|
||||||
<Button type={"primary"} loading={confirmLoading} onClick={() => {
|
<Button type={"primary"} loading={confirmLoading} onClick={() => {
|
||||||
formRef?.current?.validateFields().then(() => {
|
formRef?.current?.validateFields().then(() => {
|
||||||
handleConfirmLoading(true)
|
handleConfirmLoading(true)
|
||||||
formRef?.current?.submit()
|
formRef?.current?.submit()
|
||||||
|
|
||||||
})
|
})
|
||||||
}}>确 定</Button>
|
}}>确 定</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -952,6 +1089,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
request={async () => {
|
request={async () => {
|
||||||
if (currentRow?.COMMODITY_ID) {
|
if (currentRow?.COMMODITY_ID) {
|
||||||
const data = await handeGetCOMMODITYDetail({ COMMODITYId: currentRow?.COMMODITY_ID })
|
const data = await handeGetCOMMODITYDetail({ COMMODITYId: currentRow?.COMMODITY_ID })
|
||||||
|
setCurrentRowDetail(data)
|
||||||
|
|
||||||
let mainImgList: any = []
|
let mainImgList: any = []
|
||||||
let headerImgList: any = []
|
let headerImgList: any = []
|
||||||
@ -1013,8 +1151,6 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// initialValues={currentRow ? {
|
// initialValues={currentRow ? {
|
||||||
// ...currentRow,
|
// ...currentRow,
|
||||||
// BRAND_ID: `${currentRow?.BRAND_NAME}-${currentRow?.BRAND_ID}`,
|
// BRAND_ID: `${currentRow?.BRAND_NAME}-${currentRow?.BRAND_ID}`,
|
||||||
@ -1073,7 +1209,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
const req: any = {
|
const req: any = {
|
||||||
searchParameter: {
|
searchParameter: {
|
||||||
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
PROVINCE_CODE: currentUser?.ProvinceCode,
|
// PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
BRAND_STATE: 1,
|
BRAND_STATE: 1,
|
||||||
BRAND_CATEGORY: 2000
|
BRAND_CATEGORY: 2000
|
||||||
},
|
},
|
||||||
@ -1089,6 +1225,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
})
|
})
|
||||||
|
|
||||||
setBRAND_NAMEList(list)
|
setBRAND_NAMEList(list)
|
||||||
|
console.log('品牌列表', list);
|
||||||
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
@ -1284,7 +1422,19 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}></Col>
|
<Col span={6}>
|
||||||
|
<ProFormText
|
||||||
|
name="TAX_CODE"
|
||||||
|
label="税务代码"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择税务代码!"
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={6}></Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<ProFormDigit
|
<ProFormDigit
|
||||||
name="COMMODITY_RETAILPRICE"
|
name="COMMODITY_RETAILPRICE"
|
||||||
@ -1360,10 +1510,10 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
|||||||
width={'lg'}
|
width={'lg'}
|
||||||
name="UPPER_DATE"
|
name="UPPER_DATE"
|
||||||
label="上架时间"
|
label="上架时间"
|
||||||
rules={[{
|
// rules={[{
|
||||||
required: true,
|
// required: true,
|
||||||
message: "请选择上架时间!"
|
// message: "请选择上架时间!"
|
||||||
}]}
|
// }]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
|
|||||||
@ -415,7 +415,8 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
|
|||||||
PROVINCE_CODE: "",
|
PROVINCE_CODE: "",
|
||||||
GOODSTYPE: 6000,
|
GOODSTYPE: 6000,
|
||||||
USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE,
|
USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE,
|
||||||
SearchKey: params?.searchText || ""
|
SearchKey: params?.searchText || "",
|
||||||
|
MERCHANTS_ID: currentUser?.SupplierID
|
||||||
}
|
}
|
||||||
console.log('req', req);
|
console.log('req', req);
|
||||||
|
|
||||||
|
|||||||
@ -671,6 +671,7 @@ const ShoppingMallProductSearch: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH,
|
DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH,
|
||||||
COMMODITY_TYPE: 4000,
|
COMMODITY_TYPE: 4000,
|
||||||
COMMODITY_STATE: 1,
|
COMMODITY_STATE: 1,
|
||||||
|
MERCHANTS_ID: currentUser?.SupplierID
|
||||||
},
|
},
|
||||||
keyWord: {
|
keyWord: {
|
||||||
Key: "BRAND_NAME,COMMODITY_NAME",
|
Key: "BRAND_NAME,COMMODITY_NAME",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -667,7 +667,7 @@ export const handleSetPublicLog = (obj: any) => {
|
|||||||
BUSINESSMAN_NAME: currentUser.BusinessManName,
|
BUSINESSMAN_NAME: currentUser.BusinessManName,
|
||||||
SOURCE_PLATFORM: '驿商云平台',
|
SOURCE_PLATFORM: '驿商云平台',
|
||||||
USER_LOGINIP: basicInfo.ip,
|
USER_LOGINIP: basicInfo.ip,
|
||||||
USER_LOGINPLACE: `${basicInfo.country}${basicInfo.prov}${basicInfo.city}${basicInfo.district}`,
|
USER_LOGINPLACE: `${basicInfo.country || ""}${basicInfo.prov || ""}${basicInfo.city || ""}${basicInfo.district || ""}`,
|
||||||
BROWSER_VERSION: browserVersion,
|
BROWSER_VERSION: browserVersion,
|
||||||
OPERATING_SYSTEM: systemBasin
|
OPERATING_SYSTEM: systemBasin
|
||||||
}
|
}
|
||||||
@ -698,8 +698,120 @@ export const secondsToHuman = (seconds: number) => {
|
|||||||
|
|
||||||
return parts.join('') || '0分钟';
|
return parts.join('') || '0分钟';
|
||||||
}
|
}
|
||||||
|
export async function getUserIP(): Promise<string> {
|
||||||
|
try {
|
||||||
|
// 尝试多个第三方API服务
|
||||||
|
const apis = [
|
||||||
|
'https://api.ipify.org?format=json',
|
||||||
|
'https://ipapi.co/json/',
|
||||||
|
'https://jsonip.com/',
|
||||||
|
'https://httpbin.org/ip'
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const api of apis) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(api, {
|
||||||
|
method: 'GET',
|
||||||
|
timeout: 5000, // 5秒超时
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
// 根据不同API返回格式获取IP
|
||||||
|
if (data.ip) {
|
||||||
|
return data.ip;
|
||||||
|
} else if (data.origin) {
|
||||||
|
// httpbin返回格式
|
||||||
|
return data.origin;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`IP API ${api} 请求失败:`, error);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('所有IP服务都无法访问');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取IP地址失败:', error);
|
||||||
|
return '获取失败';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据IP地址获取地理位置信息
|
||||||
|
* @param ip IP地址
|
||||||
|
* @returns Promise<object> 地理位置信息
|
||||||
|
*/
|
||||||
|
export async function getLocationByIP(ip: string, ak: string): Promise<{
|
||||||
|
country?: string;
|
||||||
|
province?: string;
|
||||||
|
city?: string;
|
||||||
|
district?: string;
|
||||||
|
isp?: string;
|
||||||
|
success: boolean;
|
||||||
|
message?: string;
|
||||||
|
}> {
|
||||||
|
if (!ip || ip === '获取失败') {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: 'IP地址无效'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ak) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: '百度地图API密钥(ak)不能为空'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`/baidu-api/location/ip?ip=${ip}&ak=${ak}`, {
|
||||||
|
method: 'GET',
|
||||||
|
timeout: 8000,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP错误: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
// 检查百度API返回状态
|
||||||
|
if (data.status !== 0) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: `百度API错误: ${data.message || '未知错误'}`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析百度地图返回的数据
|
||||||
|
const content = data.content;
|
||||||
|
const addressDetail = content.address_detail;
|
||||||
|
|
||||||
|
return {
|
||||||
|
country: '中国', // 百度地图IP定位默认中国
|
||||||
|
province: addressDetail.province || '',
|
||||||
|
city: addressDetail.city || '',
|
||||||
|
district: addressDetail.district || '',
|
||||||
|
isp: content.address || '',
|
||||||
|
success: true
|
||||||
|
};
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取地理位置失败:', error);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: '获取地理位置失败'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
// 封装一个只要传入操作事项的就可以记录日志
|
// 封装一个只要传入操作事项的就可以记录日志
|
||||||
export const handleSetlogSave = async (str?: string) => {
|
export const handleSetlogSave = async (str?: string) => {
|
||||||
const currentUser = session.get('currentUser')
|
const currentUser = session.get('currentUser')
|
||||||
@ -725,7 +837,7 @@ export const handleSetlogSave = async (str?: string) => {
|
|||||||
BUSINESSMAN_NAME: currentUser?.BUSINESSMAN_NAME,
|
BUSINESSMAN_NAME: currentUser?.BUSINESSMAN_NAME,
|
||||||
SOURCE_PLATFORM: "出行平台",
|
SOURCE_PLATFORM: "出行平台",
|
||||||
USER_LOGINIP: basicInfo?.ip,
|
USER_LOGINIP: basicInfo?.ip,
|
||||||
USER_LOGINPLACE: `${basicInfo?.prov}${basicInfo?.city}${basicInfo?.district}`,
|
USER_LOGINPLACE: `${basicInfo?.prov || ""}${basicInfo?.city || ""}${basicInfo?.district || ""}`,
|
||||||
BROWSER_VERSION: browserVersion,
|
BROWSER_VERSION: browserVersion,
|
||||||
OPERATING_SYSTEM: systemBasin
|
OPERATING_SYSTEM: systemBasin
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// 由 scripts/writeVersion.js 自动生成
|
// 由 scripts/writeVersion.js 自动生成
|
||||||
export const VERSION = "4.5.66";
|
export const VERSION = "4.5.69";
|
||||||
export const GIT_HASH = "4be0bb5";
|
export const GIT_HASH = "52119dd";
|
||||||
export const BUILD_TIME = "2025-11-01T07:07:35.002Z";
|
export const BUILD_TIME = "2025-11-03T07:37:38.106Z";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user