123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548 |
- import { sldCommonService } from "@/utils/utils";
- import moment from "moment";
- export default {
- namespace: "bigscreen",
- state: {
- overviewData: {
- loading: false,
- data: {},
- },
- portalTrafficData: {
- loading: false,
- data: {},
- options: [
- {
- label: "近7日",
- value: {
- startTime:
- moment()
- .subtract(7, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近30日",
- value: {
- startTime:
- moment()
- .subtract(30, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- ],
- current: "近7日",
- },
- enquireData: {
- loading: false,
- data: {},
- options: [
- {
- label: "近7日",
- value: {
- startTime:
- moment()
- .subtract(7, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近30日",
- value: {
- startTime:
- moment()
- .subtract(30, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- ],
- current: "近7日",
- },
- overseasEnquireLocationData: {
- loading: false,
- data: [],
- },
- distributorEnquireLocationData: {
- loading: false,
- data: [],
- },
- memberAddTrendData: {
- loading: false,
- data: [],
- },
- productAddTrendData: {
- loading: false,
- data: [],
- },
- searchRankData: {
- loading: false,
- data: [],
- options: [
- {
- label: "昨日",
- value: {
- startTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近7日",
- value: {
- startTime:
- moment()
- .subtract(7, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近30日",
- value: {
- startTime:
- moment()
- .subtract(30, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- ],
- current: "昨日",
- },
- storeTrafficData: {
- loading: false,
- data: [],
- options: [
- {
- label: "昨日",
- value: {
- startTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近7日",
- value: {
- startTime:
- moment()
- .subtract(7, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- {
- label: "近30日",
- value: {
- startTime:
- moment()
- .subtract(30, "days")
- .format("YYYY-MM-DD") + " 00:00:00",
- endTime:
- moment()
- .subtract(1, "days")
- .format("YYYY-MM-DD") + " 23:59:59:999",
- },
- },
- ],
- current: "昨日",
- },
- mapContainerData: {
- loading: false,
- data: [],
- },
- updateTime: "",
- },
- effects: {
- // 平台数据汇总
- *load_overview({ payload }, { call, put }) {
- yield put({
- type: "setOverviewData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/dataSummary"
- );
- yield put({
- type: "setOverviewData",
- payload: { data: response.data, loading: false },
- });
- },
- // 门户流量
- *load_portal_traffic({ payload }, { call, put, select }) {
- const current = yield select(
- (state) => state.bigscreen.portalTrafficData.current
- );
- const options = yield select(
- (state) => state.bigscreen.portalTrafficData.options
- );
- const condition = options.filter((item) => item.label == current)[0]
- .value;
- payload = { ...payload, ...condition };
- yield put({
- type: "setPortalTrafficData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/flowTrend"
- );
- yield put({
- type: "setPortalTrafficData",
- payload: { data: response.data, loading: false },
- });
- },
- // 询盘概况
- *load_enquire_data({ payload }, { call, put, select }) {
- const current = yield select(
- (state) => state.bigscreen.enquireData.current
- );
- const options = yield select(
- (state) => state.bigscreen.enquireData.options
- );
- const condition = options.filter((item) => item.label == current)[0]
- .value;
- payload = { ...payload, ...condition };
- yield put({
- type: "setEnquireData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/enquiryTrend"
- );
- yield put({
- type: "setEnquireData",
- payload: { data: response.data, loading: false },
- });
- },
- // 海外询盘地区分布
- *load_overseas_enquire_location({ payload }, { call, put, select }) {
- yield put({
- type: "setOverseasEnquireLocation",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/enquiryDistribution"
- );
- yield put({
- type: "setOverseasEnquireLocation",
- payload: { data: response.data, loading: false },
- });
- },
- // 供应链企业地区分布
- *load_distributor_enquire_location({ payload }, { call, put, select }) {
- yield put({
- type: "setDistributorEnquireLocation",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/regionDistribution"
- );
- yield put({
- type: "setDistributorEnquireLocation",
- payload: { data: response.data, loading: false },
- });
- },
- // 新增会员趋势
- *load_add_member_trend({ payload }, { put, call }) {
- yield put({
- type: "setMemberAddTrendData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/memberTrend"
- );
- yield put({
- type: "setMemberAddTrendData",
- payload: { data: response.data, loading: false },
- });
- },
- // 新增商品趋势
- *load_add_product_trend({ payload }, { put, call }) {
- yield put({
- type: "setProductAddTrendData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/goodsTrend"
- );
- yield put({
- type: "setProductAddTrendData",
- payload: { data: response.data, loading: false },
- });
- },
- // 门户关键词搜索
- *load_search_rank({ payload }, { put, call, select }) {
- const current = yield select(
- (state) => state.bigscreen.searchRankData.current
- );
- const options = yield select(
- (state) => state.bigscreen.searchRankData.options
- );
- const condition = options.filter((item) => item.label == current)[0]
- .value;
- payload = { ...payload, ...condition };
- yield put({
- type: "setSearchRankData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/searchRank"
- );
- yield put({
- type: "setSearchRankData",
- payload: { data: response.data, loading: false },
- });
- },
- // 店铺流量排行
- *load_store_traffic({ payload }, { put, call, select }) {
- const current = yield select(
- (state) => state.bigscreen.storeTrafficData.current
- );
- const options = yield select(
- (state) => state.bigscreen.storeTrafficData.options
- );
- const condition = options.filter((item) => item.label == current)[0]
- .value;
- payload = { ...payload, ...condition };
- yield put({
- type: "setStoreTrafficData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/storeFlowRank"
- );
- yield put({
- type: "setStoreTrafficData",
- payload: { data: response.data, loading: false },
- });
- },
- // 世界地图站点数据
- *load_world_map({ payload }, { put, call, select }) {
- yield put({
- type: "setWorldMapData",
- payload: { loading: true },
- });
- const response = yield call(
- sldCommonService,
- payload,
- "get",
- "v3/statistics/screen/analysis/memberDistribution"
- );
- yield put({
- type: "setWorldMapData",
- payload: { data: response.data, loading: false },
- });
- },
- // 初始化数据
- *load_data({ payload }, { put, call, all }) {
- // 更新时间
- const now = new Date();
- const pad = (n) => n.toString().padStart(2, "0");
- const currentTime = `${now.getFullYear()}-${pad(
- now.getMonth() + 1
- )}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(
- now.getMinutes()
- )}:${pad(now.getSeconds())}`;
- yield put({
- type: "setUpdateTime",
- payload: currentTime,
- });
- yield all([
- put({ type: "load_overview" }),
- put({ type: "load_portal_traffic" }),
- put({ type: "load_enquire_data" }),
- put({ type: "load_overseas_enquire_location" }),
- put({ type: "load_distributor_enquire_location" }),
- put({ type: "load_add_member_trend" }),
- put({ type: "load_add_product_trend" }),
- put({ type: "load_search_rank" }),
- put({ type: "load_store_traffic" }),
- put({ type: "load_world_map" }),
- ]);
- },
- },
- reducers: {
- setWorldMapData(state, { payload }) {
- return {
- ...state,
- mapContainerData: {
- ...state.mapContainerData,
- ...payload,
- },
- };
- },
- setStoreTrafficData(state, { payload }) {
- return {
- ...state,
- storeTrafficData: {
- ...state.storeTrafficData,
- ...payload,
- },
- };
- },
- setUpdateTime(state, { payload }) {
- return {
- ...state,
- updateTime: payload,
- };
- },
- setSearchRankData(state, { payload }) {
- return {
- ...state,
- searchRankData: {
- ...state.searchRankData,
- ...payload,
- },
- };
- },
- setOverviewData(state, { payload }) {
- return {
- ...state,
- overviewData: {
- ...state.overviewData,
- ...payload,
- },
- };
- },
- setPortalTrafficData(state, { payload }) {
- return {
- ...state,
- portalTrafficData: {
- ...state.portalTrafficData,
- ...payload,
- },
- };
- },
- setEnquireData(state, { payload }) {
- return {
- ...state,
- enquireData: {
- ...state.enquireData,
- ...payload,
- },
- };
- },
- setOverseasEnquireLocation(state, { payload }) {
- return {
- ...state,
- overseasEnquireLocationData: {
- ...state.overseasEnquireLocationData,
- ...payload,
- },
- };
- },
- setDistributorEnquireLocation(state, { payload }) {
- return {
- ...state,
- distributorEnquireLocationData: {
- ...state.distributorEnquireLocationData,
- ...payload,
- },
- };
- },
- setMemberAddTrendData(state, { payload }) {
- return {
- ...state,
- memberAddTrendData: {
- ...state.memberAddTrendData,
- ...payload,
- },
- };
- },
- setProductAddTrendData(state, { payload }) {
- return {
- ...state,
- productAddTrendData: {
- ...state.productAddTrendData,
- ...payload,
- },
- };
- },
- },
- subscriptions: {
- setup({ history }) {
- // Subscribe history(url) change, trigger `load` action if pathname is `/`
- return history.listen(({ pathname, search }) => {
- if (typeof window.ga !== "undefined") {
- window.ga("send", "pageview", pathname + search);
- }
- });
- },
- },
- };
|