Commit b2b53411 by 张立顺

Merge branch 'SAAS+V5.3.0-1117' of 192.168.3.233:saas_plus/sales-assistant into SAAS+V5.3.0-1117

2 parents 65933729 26c69c2c
Showing 120 changed files with 8080 additions and 2165 deletions
import api from "~/utils/request/request";
const path = "scrm.api.stoassistant";
class ActivityApi {
// 获取活动列表数据
// getActivityList(data) {
// return api.post({
// // method: `scrm.api.assistant.activity.page`,
// method: `scrm.api.assistant.activity.staff.page`,
// ...data,
// },
// false
// );
// }
// 获取活动中任务内容
getActiveTaskList(data, params) {
return api.post({
method: `stoassistant.api.mission.findStaffMissionList`,
...data,
},
false,
);
}
// 获取单个任务详情内容
getActiveTaskDetail(data) {
return api.post({
method: "stoassistant.api.mission.getMissionById",
...data,
});
}
// 获取被分享者打开分享内容数据
getTaskShareDetail(data) {
return api.post({
method: "stoassistant.api.mission.getMissionByIdAndNoSession",
...data,
});
}
// 获取申请活动已开通场景
getOpenSceneList(data) {
return api.post({
method: "scrm.api.busassistant.activity.SceneOpenStatus.stoAss",
...data,
}, true);
}
// 获取申请活动可开通的产品
getNotOpenProductsList(data) {
return api.post({
method: "scrm.api.busassistant.activity.productOpenStatus.stoAss",
...data,
});
}
// 获取我的订单数据
getActivityOrderList(data) {
return api.post({
method: `${path}.user.activity.order.list`,
...data,
});
}
// 获取活动诊断待预约安装订单数据
getActivityEndInstallOrderList(data, params) {
return api.post({
method: `${path}.user.activity.to.be.installed.list`,
...data,
},
false
);
}
// 获取我的访客数据
getActivityVisitorList(data) {
return api.post({
method: `${path}.user.activity.visitor.list`,
...data,
});
}
// 救援码扫码信息分页查询
rescuePage(data) {
return api.post({
method: `entmicro.api.drac.rescue.card.scan.record.page`,
projectName: "entmicro",
...data,
});
}
// 获取当前活动的海报
getActivityPosters(data) {
return api.post({
method: `scrm.api.assistant.crowdFunding.poster`,
...data,
});
}
// 获取活动短链接
getActivityUrl(data) {
return api.post({
method: `scrm.api.assistant.activity.poster`,
...data,
});
}
// 任务分享埋点
taskShareReport(data) {
return api.post({
method: "entmicro.api.customercollect.reportCustomerList",
...data,
});
}
/** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动)
*/
reportData(data = {}, operationType = 0) {
return api.post({
method: "scrm.api.busassistant.clue.report",
...data,
operationType,
operationDate: new Date().format("yyyy-MM-dd hh:mm:ss"),
});
}
// 确认安装
comfirmInstall(data) {
return api.post({
method: `scrm.api.stoassistant.user.activity.confirm.install`,
...data,
});
}
// 获取膨胀金活动
getPengZApi(data) {
return api.post({
method: `scrm.api.assistant.bulge.staff.page`,
...data,
});
}
// 获取订阅配置
getSubscribeConfigApi(data) {
return api.post({
method: `entmicro.api.system.subscribe.findActivityIdList`,
...data
})
}
// 获取定保/救援车活动列表
getSubscribeListByIdsApi(data) {
return api.post({
method: `scrm.api.assistant.activity.bulge.staff.page.byIds`,
...data
})
}
// 查询福利官
getWelfareInfo(data) {
return api.post({
method: `entmicro.api.system.subscribe.findMerchantWelfareInfo`,
...data
})
}
// 查询订阅服务
checkSubcribe(data) {
return api.post({
method: `entmicro.api.system.subscribe.getOpenedMerchant`,
...data
})
}
// 私域客户看板
praviteBoradData(data) {
return api.post({
method: `scrm.api.stoassistant.wechat.cloud.welfare.statics`,
...data
})
}
// 私域客户群里列表
praviteGroups(data) {
return api.post({
method: `scrm.api.stoassistant.wechat.cloud.welfare.group`,
...data
})
}
// 私域访客列表
praviteVistitor(data) {
return api.post({
method: `scrm.api.stoassistant.wechat.cloud.welfare.customerVisit`,
...data
})
}
/**
* 活动中-订单列表-上传支付凭证
*/
uploadPaymentVoucher(data) {
return api.post({
method: 'scrm.api.stoassistant.user.activity.uploadPaymentVoucher',
...data
}, true)
}
/**
* 根据活动id查询任务详情 */
getFindMissionByActiviyId(activityId) {
const {
merchantId
} = wx.$storage.get('userInfo')
return api.post({
method: 'stoassistant.api.mission.findMissionByActiviyId',
bussinessType: 3,
merchantNo: merchantId,
activityId
})
}
/** 根据订阅类型查询膨胀金活动列表(包含当前员工统计数据*/
getActivityPageBySubscribe(data) {
return api.post({
method: `scrm.api.assistant.activity.bulge.staff.page.bySubscribe`,
...data
})
}
/**获取跟进分页列表 */
getFollowData(data) {
return api.post({
method: `stoassistant.api.follow.page`,
...data
})
}
/**完成跟进 */
finishFollow(data) {
return api.post({
method: `stoassistant.api.follow.finish`,
...data
})
}
/**创建广汇续保权益登记订单 */
sendEquity(data) {
return api.post({
method: `scrm.api.stoassistant.gh.expanded.gold.activity.order.create`,
...data
})
}
/**看产值-车损权益升级-产值总览 */
merchantsOutput(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.output.value.statistics`,
...data
})
}
/**看产值-车损权益升级-产值总览当日 */
merchantsOutputToday(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.output.value.statistics.today`,
...data
})
}
/**看产值-车损权益升级-产值报表 */
merchantsOutputReport(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.output.value.report.forms`,
...data
})
}
/**看产值-车损权益升级-柱状图 */
merchantsHistogram(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.output.value.histogram.chart`,
...data
})
}
/**看产值-车损权益升级-趋势图 */
merchantsTrend(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.output.value.trend.chart`,
...data
})
}
/**看产值-车损权益升级-员工排行分页列表 */
merchantsStaffOutput(data) {
return api.post({
method: `scrm.api.boutiquecoupon.store.assistant.merchants.total.staff.output.value.statistics.page`,
...data
})
}
/**查询4s店商户产值总览、当日新增产值 --精品升级 */
boutiquecouponOutputValue(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.overview.forStoreManager`,
...data
})
}
/**查询4s店商户查询员工产值排行信息--精品升级 */
boutiquecouponQueryEmployeeRankList(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.queryEmployeeRankList.forStoreManager`,
...data
})
}
/**查询4s店商户查询发券量营业额统计数据--精品升级 */
boutiquecouponQueryCouponCountAndOrderMoney(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.queryCouponCountAndOrderMoney.forStoreManager`,
...data
})
}
/**查询4s店商户查询营业额到店量统计数据--精品升级 */
boutiquecouponQueryOrderMoneyTotalAndToShopCount(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.queryOrderMoneyTotalAndToShopCount.forStoreManager`,
...data
})
}
/**查询4s店商户日报表--精品升级 */
boutiquecouponQueryByDayReport(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.queryByDayReport.forStoreManager`,
...data
})
}
/**查询4s店商户月报表--精品升级 */
boutiquecouponQueryByMonthReport(data) {
return api.post({
method: `scrm.api.boutiquecoupon.outputValue.queryByMonthReport.forStoreManager`,
...data
})
}
activityStaffRank(data) {
return api.post({
method: `scrm.api.assistant.activity.staff.rank`,
...data
})
}
/*门店助手-店总版售后众筹活动相关统计*/
getActivityList(data) {
return api.post({
method: `scrm.api.assistant.activity.statics`,
...data
})
}
}
export default ActivityApi;
\ No newline at end of file \ No newline at end of file
import ActivityApi from './ActivityApi.js'
export default new ActivityApi()
\ No newline at end of file \ No newline at end of file
import api from '~/utils/request/request'
// const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class applyApi {
/**申请门店 */
merchantApply(data) {
return api.post(
{
method: 'scrm.api.busassistant.merchant.apply',
...data
}
// true
)
}
}
export default applyApi
import applyApi from './applyApi.js'
export default new applyApi()
import api from "~/utils/request/request";
const serverApi = {
getMerchantList: "scrm.api.busassistant.merchant.getMerchantListBySceneRemote", //根据场景值、服务商查询4s店
addCoProduct: "scrm.api.busassistant.merchant.addCoProduct", //申请合作产品
};
export const getMerchantListApi = (data) => {
return api.post(
{
method: serverApi.getMerchantList,
...data,
},
true
);
};
export const addCoProductApi = (data) => {
return api.post(
{
method: serverApi.addCoProduct,
...data,
},
true
);
};
import api from '~/utils/request/request'
class CustomerApi {
// 获取周选择数据
getWeekSelectData(data) {
return api.post({
method: "dj.api.sale.get.generateWeeklyRanges",
...data,
})
}
// 获取行政地区数据
getAreaTreeList(data) {
return api.post({
method: "dj.api.sale.map.districts",
...data
})
}
// 获取门店的KPI进度数据
getKPIData(data) {
return api.post({
method: "dj.api.sale.store.kpi.progress",
...data
})
}
// 获取门店详情数据
getMaterialData(data) {
return api.post({
method: "dj.api.sale.potential.store.detail",
...data
})
}
// 获取潜客详情数据
getCustomerData(data) {
return api.post({
method: "dj.api.sale.potential.customer.detail",
...data
})
}
// 新增潜客
addCustomer(data) {
return api.post({
method: "dj.api.sale.potential.customer.add",
...data
})
}
// 信息完善
editCustomer(data) {
return api.post({
method: "dj.api.sale.potential.customer.edit",
...data
})
}
// 获取省市区数据
getAreaData(data) {
return api.post({
method: "dj.api.sale.map.districts",
...data
})
}
// 新增拜访
addVisit(data) {
return api.post({
method: "dj.api.sale.potential.customer.visit.add",
...data
})
}
// 结果反馈
reslutFeedbackApi(data) {
return api.post({
method: "dj.api.sale.potential.customer.result.feedback",
...data
})
}
// 拜访记录列表
getVisitList(data) {
return api.post({
method: "dj.api.sale.potential.customer.visit.list",
...data
})
}
// 潜客数据看板
getPotentialStatic(data) {
return api.post({
method: "dj.api.sale.potential.customer.data.dashboard.count",
...data
})
}
// 潜客列表
getPotentialList(data) {
return api.post({
method: "dj.api.sale.data.dashboard.potential.customer.list.page",
...data
})
}
// 获取销售人员数据
getSalesPersonList(data) {
return api.post({
method: "dj.api.sale.login.sales.list",
...data
})
}
// 获取门店数据看板数据
getStoreStatic(data) {
return api.post({
method: "dj.api.sale.store.data.dashboard.count",
...data
})
}
// 获取门店列表分页数据
getStorePageList(data) {
return api.post({
method: "dj.api.sale.data.dashboard.store.list.page",
...data
})
}
}
export default CustomerApi
\ No newline at end of file \ No newline at end of file
import CustomerApi from './CustomerApi.js'
export default new CustomerApi()
\ No newline at end of file \ No newline at end of file
import outputApi from './output.js'
export default new outputApi()
import api from '~/utils/request/request'
// const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class outputApi {
/** 获取服务商(生意助手看产值)我的客户页总收益 */
getMerchantTotal(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.getMerchantTotal',
...data
})
}
/** 分页获取服务商(生意助手看产值)我的客户页数据 */
getCustomerPageList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.customerPageList',
...data
})
}
/** 服务商(生意助手看产值)我的客户详情数据 */
getCustomerDetail(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.getCustomerDetail',
...data
})
}
/**获取园区店开通场景数据 */
getSignMerchant(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.getSceneTotal.byYqMerchantId',
...data
}
// true
)
}
/**获取服务商(生意助手看产值)我的门店页数据 */
partnerMerchantTotal(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.partnermerchant.yqList',
...data
},
true
)
}
/** 查找可开通的产品 */
getNoOpenPro(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
...data
})
}
/**查询场景和产品的开通状态 */
getSceneProStatus(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findSceneProductStatus',
...data
})
}
/** 申请开通活动*/
applyActivity(data) {
return api.post({
method: 'scrm.api.busassistant.activity.apply',
...data
})
}
/** 查询门店众筹活动产值 */
getActivityRevenue(data) {
return api.post({
method: 'scrm.api.busassistant.merchant.activity.Revenue',
...data
})
}
/** 查询门店权益订单数据统计-车险升级活动产值 */
getEquityRevenue(data) {
return api.post(
{
// method: 'scrm.api.busassistant.merchant.equity.statistics',
method: 'dj.api.smartcarlife.vd.quotation.merchant.statistics',
...data
},
false,
'dj'
)
}
/** 店面汇总-下载海报 */
getPosterUrl(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.poster',
...data
})
}
/**长按海报埋点 */
reportPosterTrack(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.poster.shared.createRecord',
...data
})
}
/**获取活动最新战报 */
getNewReportUrl(data) {
return api.post({
method: 'scrm.api.stoassistant.crowd.activity.newest.report',
...data
})
}
/**获取最新喜报 */
getNewGoodUrl(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.good.report',
...data
})
}
/** 根据场景查询产品 */
findProByScene(data) {
return api.post({
method: 'scrm.api.busassistant.activity.productByscene',
...data
})
}
/** 业务经营汇总列表查询 */
getBusiStatistics(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.business.assistant.merchants.statistics',
...data
})
}
/** 业务经营汇总列表查询-次新车转化 */
getActivityList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.expanded.gold.activity.page',
...data
})
}
/** 业务经营汇总列表查询-次新车转化-总收益 */
getActivityTotal(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.expanded.gold.activity.total.output.value',
...data
})
}
/** 业务经营汇总列表查询-详情页-次新车转化-总收益 */
getActivityStatistics(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.expanded.gold.activity.statistics',
...data
})
}
// 我的员工
/** 服务商查询园区店员工产值统计 */
getStaffList(data) {
data.routerMethod = 'dj.api.smarcarlife.yquser.stat.byPartnerMerchant'
return api.post({
method: 'scrm.api.boutiquecoupon.rop.boutique.router.withoutLogin',
...data
})
}
/** 业务数据指标分析诊断-趋势分析 */
analysisTendency(data) {
return api.post({ method: 'dj.api.smartcarlife.data.analysis.tendency', ...data }, false, 'dj')
}
/** 业务数据指标分析诊断-营收概要 */
analysisOverview(data) {
return api.post({ method: 'dj.api.smartcarlife.data.analysis.overview', ...data }, false, 'dj')
}
/** 业务数据指标分析诊断-营收概要 权益会员*/
analysisOverviewVdquotation(data) {
return api.post({ method: 'dj.api.smartcarlife.data.analysis.Vdquotation.overview', ...data }, false, 'dj')
}
/** 业务数据指标分析诊断-趋势分析 权益会员*/
analysisTendencyVdquotation(data) {
return api.post({ method: 'dj.api.smartcarlife.data.Vdquotation.analysis.tendency', ...data }, false, 'dj')
}
/** 业务数据指标分析诊断-流量情况*/
analysisInviteRecord(data) {
return api.post({ method: 'dj.api.smartcarlife.data.analysis.inviteRecord.count', ...data }, false, 'dj')
}
/** 业务数据指标分析诊断-无效流量(战败订单)*/
analysisNotUpgradePage(data) {
return api.post({ method: 'dj.api.smartcarlife.data.analysis.notUpgrade.page', ...data }, false, 'dj')
}
/** 经营分析 */
/** 经营分析数据概览 */
getOverview(data) {
return api.post({
method: 'scrm.api.busassistant.business.analysis.overview',
...data
})
}
/** 门店引流数据 */
getFlowRank(data) {
return api.post({
method: 'scrm.api.busassistant.business.analysis.flow.rank',
...data
})
}
/** 门店引流数据分页查询 */
getRankList(data) {
return api.post({
method: 'scrm.api.busassistant.business.analysis.flow.rank.page',
...data
})
}
/** 采购数量分页查询 */
getPurchaseList(data) {
return api.post({
method: 'scrm.api.busassistant.business.analysis.purchase.page',
...data
})
}
/** 采购金额走势 */
getPurTendency(data) {
return api.post({
method: 'scrm.api.busassistant.business.analysis.purchase.tendency',
...data
})
}
}
export default outputApi
import outputValueApi from './outputValue.js'
export default new outputValueApi()
import api from '~/utils/request/request'
class outputValueApi {
/** 我的员工分页 */
GETSTAFFLISTAPI(data) {
return api.post({
method: 'scrm.api.busassistant.outputValue.staff.list',
...data
})
}
/** 员工列表(仅员工信息筛选用) */
GETALLSTAFFDATAAPI(data) {
return api.post({
method: 'scrm.api.busassistant.staff.list',
...data
})
}
/** 获取服务商(生意助手看产值)全场景我的门店数据 */
getAllSceneList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchantTotal.allSceneShopList',
...data
})
}
/** 获取服务商(生意助手看产值)我的门店页总累计产值 */
getMerchantTotal(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchantTotal.getMerchantTotal',
...data
})
}
/** 获取服务商(生意助手看产值)指定场景我的门店数据 */
getQuerySceneList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchantTotal.querySceneShopList',
...data
})
}
}
export default outputValueApi
...@@ -37,6 +37,7 @@ import './utils/network' ...@@ -37,6 +37,7 @@ import './utils/network'
import { getDiscoverList } from '~/api/index.js' import { getDiscoverList } from '~/api/index.js'
import {Version} from 'glsx-common-sdk' import {Version} from 'glsx-common-sdk'
import { areaList } from "@vant/area-data"
/**全埋点 */ /**全埋点 */
import Track from '~/utils/track' import Track from '~/utils/track'
...@@ -53,6 +54,7 @@ App({ ...@@ -53,6 +54,7 @@ App({
wx.$storage = $Storage /** 挂载全局缓存方法 */ wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$eventbus = eventbus wx.$eventbus = eventbus
wx.$track = $Track wx.$track = $Track
wx.$areaList = areaList
wx.$versionConfig = new Version({ wx.$versionConfig = new Version({
request: { request: {
baseUrl: 'https://config-center-backend.glsx.com.cn/glsxAdmin/config', baseUrl: 'https://config-center-backend.glsx.com.cn/glsxAdmin/config',
......
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
"potentialDetail/potentialDetail", "potentialDetail/potentialDetail",
"createVisit/createVisit", "createVisit/createVisit",
"resultFeedback/resultFeedback", "resultFeedback/resultFeedback",
"createPotential/createPotential" "createPotential/createPotential",
"merchantDetail/merchantDetail"
] ]
}, },
{ {
...@@ -91,10 +92,10 @@ ...@@ -91,10 +92,10 @@
"preloadRule": {}, "preloadRule": {},
"usingComponents": { "usingComponents": {
"tab": "/components/Tab/Tab", "tab": "/components/Tab/Tab",
"tab-bar": "/components/TabBar/TabBar",
"navigation-bar": "/components/NavigationBar/NavigationBar", "navigation-bar": "/components/NavigationBar/NavigationBar",
"popup": "/components/Popup/Popup", "popup": "/components/Popup/Popup",
"nothing-tips": "/components/Nothing-tips/nothingTips", "nothing-tips": "/components/Nothing-tips/nothingTips",
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster",
"glsx-image": "/components/image/index", "glsx-image": "/components/image/index",
"no-product": "/components/NoProduct/index", "no-product": "/components/NoProduct/index",
"glsx-privacy": "glsx-applet-component/GlsxPrivacy/index", "glsx-privacy": "glsx-applet-component/GlsxPrivacy/index",
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/Alimama_ShuHeiTi_Bold_Number.ttf"); src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/Alimama_ShuHeiTi_Bold_Number.ttf");
} */ } */
@font-face { @font-face {
font-family: "numberNor";
src: url("https://img02.glsx.com.cn/weapp/resource/miniprogram/sales-assistant/font/D-DIN-PRO-500-Medium.ttf");
}
@font-face {
font-family: "number"; font-family: "number";
src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/subset-AlimamaShuHeiTi-Bold.woff"); src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/subset-AlimamaShuHeiTi-Bold.woff");
} }
......
// packageMine/components/CarBrand/CarBrand.js
import mineApi from '~/api/mineApi/index'
import Util from '~/utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
popupShow: {
type: Boolean,
value: false,
observer: function (n) {
if (n) this.getBrandList()
}
},
selectedList: {
type: Array,
value: []
},
multiple: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
selectingList: [],
searchKeyword: '',
allBrandList: []
},
/**
* 组件的方法列表
*/
methods: {
dealSelectedList(brandList) {
return new Promise(resolve => {
let { selectedList } = this.data
console.log(selectedList)
// 根据外部选中列表设置初始 active
selectedList.forEach((item) => {
let brandIdx = brandList.findIndex(k => k.id == item.id)
if (brandIdx === -1) return
let brandChildList = brandList[brandIdx].children || []
item.label = item.name
;(item.children || []).forEach(subItem => {
let cIdx = brandChildList.findIndex(k => k.id == subItem.id)
if (cIdx !== -1) {
brandList[brandIdx].children[cIdx].active = true
subItem.active = true
subItem.label = subItem.name
}
})
})
// 单选模式:只保留第一个 active 子项,其余清空
if (!this.properties.multiple) {
let keepBrandIdx = -1
let keepChildIdx = -1
brandList.forEach((b, bIdx) => {
(b.children || []).forEach((c, cIdx) => {
if (c.active) {
if (keepBrandIdx === -1) {
keepBrandIdx = bIdx
keepChildIdx = cIdx
} else {
c.active = false
}
}
})
})
if (keepBrandIdx !== -1) {
const pItem = Util.deepClone(brandList[keepBrandIdx])
this.setData({ selectingList: [pItem] })
} else {
this.setData({ selectingList: [] })
}
} else {
this.setData({ selectingList: Util.deepClone(selectedList) })
}
resolve(brandList)
})
},
getBrandList() {
let data = wx.$storage.get('car_brand_list')
if (data) {
this.dealSelectedList(Util.deepClone(data)).then(brandlist => {
this.formatData(brandlist)
})
} else {
mineApi.getCarBrandList().then(data => {
wx.$storage.set('car_brand_list', data)
this.dealSelectedList(Util.deepClone(data)).then(brandlist => {
this.formatData(brandlist)
})
})
}
},
formatData(data) {
let letterList = Array.from(new Set([...data.map(e => e.letter)]))
let brandList = letterList.map(e => {
let list = []
data.map(i => {
if (e === i.letter) {
list.push(i)
}
})
return {
letter: e,
list
}
})
this.setCarData(brandList)
},
setCarData(brandList) {
wx.$api.showLoading('加载中...')
this.setData({
allBrandList: brandList
})
let count = 0
let settime = setInterval(() => {
if (null != brandList[count].list && brandList[count].list.length > 0) {
this.setData({
[`brandList[${count}]`]: brandList[count]
})
}
count++
if (count >= brandList.length) {
clearInterval(settime)
this.getLetter()
}
}, 10)
},
getLetter() {
wx.hideLoading()
let { brandList, letter } = this.data
let arr = []
if (brandList.length > 0) {
brandList.forEach(e => {
arr.push(e.letter)
})
this.setData({
arr,
letter,
flag: true
})
}
setTimeout(() => {
this.getSideBarInfo()
}, 500)
},
getSideBarInfo() {
let _this = this
const firstLetter = (_this.data.arr && _this.data.arr.length) ? _this.data.arr[0] : 'A'
wx.$api.getViewInfo(`#letter-${firstLetter}`, res => {
wx.$api.getViewInfo('#side-bar', _res => {
_this.setData({
letterHeight: res.height,
toTop: res.height + _res.top,
height: _res.bottom
})
})
})
},
dealSelectList(index, pidx, cidx) {
let { selectingList } = this.data
let pItem = Util.deepClone(this.data.brandList[index].list[pidx])
const isSingle = !this.properties.multiple
if (isSingle) {
const hasActive = (pItem.children || []).some(c => c.active)
this.setData({ selectingList: hasActive ? [pItem] : [] })
return true
}
// 已选列表中,当前选中的品牌是否存在
let selectPItemId = selectingList.findIndex(item => item.id == pItem.id)
// 不存在该品牌,插入;存在该品牌,替换
if (selectPItemId == -1) {
selectingList.push(pItem)
this.setData({
selectingList
})
return true
}
this.setData({
[`selectingList[${selectPItemId}]`]: pItem
})
},
// 选中/取消子品牌(支持单选/多选)
clickChild(e) {
let { index, pidx, cidx } = e.currentTarget.dataset
const { multiple } = this.properties
let childItem = this.data.brandList[index].list[pidx].children[cidx]
if (multiple) {
// 多选:原行为,直接切换当前子项,并同步到全量列表
const newActive = !childItem.active
this.setData({
[`brandList[${index}].list[${pidx}].children[${cidx}].active`]: newActive
})
const { pitem, that } = e.currentTarget.dataset
const parentId = (pitem && pitem.id) || this.data.brandList[index].list[pidx].id
const childId = (that && that.id) || this.data.brandList[index].list[pidx].children[cidx].id
const updatedAll = (this.data.allBrandList || []).map(group => ({
...group,
list: (group.list || []).map(p => {
if (p.id === parentId) {
return {
...p,
children: (p.children || []).map(c => ({ ...c, active: c.id === childId ? newActive : c.active }))
}
}
return p
})
}))
this.setData({ allBrandList: updatedAll })
this.dealSelectList(index, pidx, cidx)
return
}
// 单选:若当前是未选中,则清空其他所有选中,只选中当前;若当前已选中,则取消选中
if (!childItem.active) {
// 清空所有选中(当前视图 + 全量列表),并仅选中当前
const clearedView = (this.data.brandList || []).map(group => ({
...group,
list: (group.list || []).map(p => ({
...p,
children: (p.children || []).map(c => ({ ...c, active: false }))
}))
}))
clearedView[index].list[pidx].children[cidx].active = true
const { pitem, that } = e.currentTarget.dataset
const parentId = (pitem && pitem.id) || clearedView[index].list[pidx].id
const childId = (that && that.id) || clearedView[index].list[pidx].children[cidx].id
const clearedAll = (this.data.allBrandList || []).map(group => ({
...group,
list: (group.list || []).map(p => ({
...p,
children: (p.children || []).map(c => ({ ...c, active: (p.id === parentId && c.id === childId) ? true : false }))
}))
}))
this.setData({ brandList: clearedView, allBrandList: clearedAll })
const pItem = Util.deepClone(clearedView[index].list[pidx])
this.setData({ selectingList: [pItem] })
} else {
// 当前已选中 -> 取消选中(当前视图 + 全量列表)
const { pitem, that } = e.currentTarget.dataset
const parentId = (pitem && pitem.id) || this.data.brandList[index].list[pidx].id
const childId = (that && that.id) || this.data.brandList[index].list[pidx].children[cidx].id
this.setData({
[`brandList[${index}].list[${pidx}].children[${cidx}].active`]: false
})
const updatedAll = (this.data.allBrandList || []).map(group => ({
...group,
list: (group.list || []).map(p => ({
...p,
children: (p.children || []).map(c => ({ ...c, active: (p.id === parentId && c.id === childId) ? false : c.active }))
}))
}))
this.setData({ allBrandList: updatedAll, selectingList: [] })
}
},
handleConfirm() {
let { selectingList } = this.data
let _list = []
let idx = 0
selectingList.forEach(item => {
if (item.children.some(k => k.active == true)) {
_list.push({
id: item.id,
name: item.label,
logoUrl: item.logoUrl,
children: []
})
item.children.forEach(k => {
if (k.active) {
_list[idx].children.push({
id: k.id,
name: k.label
})
}
})
idx = idx + 1
}
})
console.log(_list, '_list处理后---')
return _list
},
start(e) {
let { letter } = e.target.dataset
this.setData({
showTip: true,
letter
})
},
move(e) {
let { letterHeight, showTip, height, toTop, arr } = this.data
let { y, num, isNum } = this
if (showTip) {
y = e.touches[0].clientY
num = Math.ceil((y - toTop) / letterHeight)
if (num < 0) num = 0
if (y < height && isNum != num) {
clearTimeout(this.time)
isNum = num
this.time = setTimeout(() => {
this.setData({
letter: arr[num]
})
}, 1000 / 60)
}
}
},
end(e) {
clearTimeout(this.time)
this.setData({
showTip: false
})
},
onSearchInput(e) {
const { value } = e.detail || {}
},
onSearchConfirm(e) {
const { value } = e.detail || {}
this.filterBrandList(value)
},
filterBrandList(keyword) {
keyword = (keyword || '').trim()
this.setData({ searchKeyword: keyword })
const all = this.data.allBrandList || []
if (!keyword) {
this.setData({ brandList: all })
this.getLetter()
return
}
const lower = keyword.toLowerCase()
const filtered = (all || []).map(group => {
const list = []
;(group.list || []).forEach(i => {
const pLabel = String(i.label || '')
const matchParent = pLabel.includes(keyword) || pLabel.toLowerCase().includes(lower)
const children = i.children || []
let matchedChildren = []
if (matchParent) {
matchedChildren = children
} else {
matchedChildren = children.filter(c => {
const cLabel = String(c.label || '')
return cLabel.includes(keyword) || cLabel.toLowerCase().includes(lower)
})
}
if (matchParent || matchedChildren.length) {
list.push({
...i,
children: matchedChildren
})
}
})
return { letter: group.letter, list }
}).filter(g => g.list && g.list.length)
this.setData({ brandList: filtered })
this.getLetter()
}
}
})
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-tab": "@vant/weapp/tab/index", "search-input": "../SearchInput/SearchInput"
"van-tabs": "@vant/weapp/tabs/index"
} }
} }
\ No newline at end of file \ No newline at end of file
/* packageMine/components/CarBrand/CarBrand.wxss */
.y-center {
display: flex;
align-items: center;
transform: translateY(0);
}
.car-brands-box {
width: 100%;
height: 100%;
background: #FFFFFF;
// padding-top: 20rpx;
}
.car-brands {
height: calc(100% - 104rpx);
position: relative;
}
.box-title {
height: 112rpx;
line-height: 112rpx;
font-size: 32rpx;
font-weight: 600;
color: #323436;
text-align: center;
}
.car-brands .title {
position: sticky;
top: 0;
z-index: 2;
background: #F7F8FA;
font-size: 24rpx;
color: #969799;
padding-left: 32rpx;
height: 64rpx;
line-height: 64rpx;
}
.pBrand {
display: flex;
align-items: center;
width: 100%;
height: 88rpx;
line-height: 88rpx;
margin-right: 24rpx;
font-weight: 700;
font-size: 32rpx;
}
.list {
height: 88rpx;
padding-left: 32rpx;
font-weight: 500;
}
.child {
font-weight: normal;
font-size: 28rpx;
padding-left: 64rpx;
color: #323436;
position: relative;
animation: show-child .25s forwards;
}
.child.active {
box-sizing: border-box;
display: flex;
justify-content: space-between;
color: #3666FE;
padding-right: 70rpx;
.icon {
width: 32rpx;
height: 32rpx;
}
}
@keyframes show-child {
0% {
height: 0;
}
100% {
height: 88rpx;
}
}
.side-bar {
z-index: 999;
position: fixed;
top: 52%;
transform: translateY(-50%);
font-size: 24rpx;
color: #4c4c4c;
width: 10%;
opacity: 0;
animation: show-side-bar .5s forwards;
}
@keyframes show-side-bar {
0% {
opacity: 0;
right: -100%;
}
100% {
opacity: 1;
right: 0;
}
}
.side-bar .view {
width: 100%;
text-align: center;
}
.tips {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 140rpx;
height: 140rpx;
border-radius: 50%;
color: #fff;
background: rgba(153, 153, 153, 0.7);
z-index: 9999;
font-size: 60rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
}
.nothing {
padding: 100rpx;
text-align: center;
color: #999;
}
.car-type-box {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
font-size: 28rpx;
color: #333;
z-index: 9999;
}
.car-type-box .bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.car-type-box .brands-box {
position: absolute;
top: 0;
right: 0;
width: 60.5%;
height: 100%;
overflow-y: scroll;
background: #fff;
-webkit-overflow-scrolling: touch;
animation: move 0.4s;
box-sizing: border-box;
padding-bottom: 40rpx;
}
.car-type-box .title {
width: 100%;
height: 64rpx;
box-sizing: border-box;
padding-left: 32rpx;
color: #969799;
background: #F7F8FA;
top: 0;
}
.car-type-box .brands-box .brands-list {
width: 100%;
box-sizing: border-box;
padding-left: 32rpx;
border-bottom: 1rpx solid #e9e9e9;
animation: show-car-type .25s forwards;
}
@keyframes show-car-type {
0% {
min-height: 0;
opacity: 0;
}
100% {
min-height: 100rpx;
opacity: 1;
}
}
@keyframes move {
from {
right: -60.5%;
}
to {
right: 0;
}
}
.btn-box {
width: 100%;
position: fixed;
bottom: 0;
display: flex;
padding: 8rpx 32rpx 16rpx;
background: #FFFFFF;
.btn {
box-sizing: border-box;
width: calc((100% - 78rpx) / 2);
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 28rpx;
color: #FFFFFF;
background: #3666FE;
border-radius: 12rpx;
border: 2rpx solid #3666FE;
}
.btn-cancel {
color: #8A8C90;
border: 2rpx solid #EEEEEE;
background: #FFFFFF;
margin-right: 14rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--packageMine/components/CarBrand/CarBrand.wxml-->
<view class="car-brands-box">
<!-- <view class="box-title">选择品牌</view> -->
<search-input value="{{searchKeyword}}" bind:input="onSearchInput" bind:search="onSearchConfirm" />
<view class="car-brands">
<scroll-view style="height:100%;" scroll-y scroll-into-view="{{letter}}">
<block wx:if="{{flag}}">
<block wx:if="{{brandList.length > 0}}">
<block wx:for="{{brandList}}" wx:key="index">
<view id="{{item.letter}}">
<view class="title y-center" id="{{item.letter}}">{{item.letter}}</view>
<view class="box">
<block wx:for="{{item.list}}" wx:for-item="i" wx:key="ind" wx:for-index="ind">
<view class="brands" data-index='{{index}}' data-ind='{{ind}}'>
<view class="list y-center">
<view class="pBrand">
{{i.label}}
</view>
</view>
<block wx:if="{{i.children}}">
<block wx:for="{{i.children}}" wx:key="cind" wx:for-item="c" wx:for-index="cind">
<view class="list y-center child {{c.active ? 'active' : ''}}" catchtap="clickChild" data-index="{{index}}" data-pidx="{{ind}}" data-cidx="{{cind}}" data-pitem="{{i}}" data-that="{{c}}">
{{c.label}}
<glsx-image src="customer/checked.png" class="icon" />
</view>
</block>
</block>
</view>
</block>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="nothing">暂无数据</view>
</block>
</block>
</scroll-view>
<view class="side-bar" id="side-bar">
<block wx:for="{{brandList}}" wx:key="index">
<view data-letter="{{item.letter}}" class="view {{item.active?'active':''}}" capture-catch:touchstart="start" id="letter-{{item.letter}}" data-index="{{index}}" capture-catch:touchmove="move" capture-catch:touchend="end">{{item.letter}}
</view>
</block>
</view>
<!-- 提示 -->
<view class='tips' hidden='{{!showTip}}'>{{letter}}</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.js
import Draw from '~/utils/Draw'
Component({
/**
* 组件的属性列表
*/
properties: {
// 默认母链海报 不是须样式须单独处理 通过item.type 区分类型
item: {
type: Object,
observer(n) {
// 如果是喜报和战报就跳过图片生成
if (n.type == 'warReport') {
// n.posterUrl
wx.$api.showLoading('图片加载中')
return this.setData({
poster: n.posterUrl,
show: true
})
}
n.posterUrl &&
this.checkUrl()
.then(result => {
result &&
this.setData({
poster: result,
show: true
})
})
.catch(err => {
console.log(err)
this.begin()
})
}
},
scrollImg: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
_item_: null,
findKey: 'posterUrl',
height: '68%'
// poster: 'https://wx.glsx.com.cn/upload/biz/599036445419769856.png'
},
/**
* 组件的方法列表
*/
methods: {
successOnload() {
// debugger
// console.log('a123456')
wx.$api.hideLoading()
// this.setData({
// show: true
// })
},
// 图片缓存 有取小程序缓存图片
checkUrl() {
console.log('checkUrl')
let { item: postObj } = this.data
const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager(),
{ findKey } = this.data
return new Promise((resolve, reject) => {
// return reject()
if (fileList.length) {
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({ files }) {
let obj = fileList.find(e => e[findKey] === postObj[findKey])
const poster = files.find(s => obj?.path.includes(s))
wx.hideLoading()
// console.log(poster)
// 处理图片文件缓存太多的问题
let filesLength = files.length
console.log(files)
if (filesLength > 21) {
files.map((e, index) => {
// debugger
// console.log(filesLength - index > 21)
filesLength - index > 21 &&
index != 0 &&
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`,
fail(res) {
console.error(res)
}
})
})
}
// console.log(poster)
if (poster) {
resolve(`${wx.env.USER_DATA_PATH}/${poster}`)
} else {
reject()
}
}
})
} else reject()
})
},
begin() {
let { item } = this.data
item.posterUrl && this.getImageInfo(item)
},
check(n) {
this.setData({
_item_: n
})
},
getImageInfo(n) {
// console.log(n)
wx.$api.showLoading('处理中')
let that = this
wx.getImageInfo({
src: `${n.posterUrl}?v=${Date.now()}`,
success: function (res) {
// console.log(res)
// w = res.width
// h = res.height
that.init(n, res.width, res.height)
},
fail: function (res) {
// console.log(res)
wx.$api.showToast('生成失败')
}
})
},
async init(n, ImgWidth, ImgHeight) {
const { findKey } = this.data
// debugger
// const {pixelRatio} = wx.getWindowInfo()
let actualWidth = 247 //默认宽度
let canvasHeight = 1959 //最大高度
let proportion = ImgWidth / actualWidth //图片实例化对应的比例
let actualHeight = ImgHeight / proportion //实际高度
// 解决 createOffscreenCanvas 最大高度不能超过4096的问题
// 这个 pixelRatio 不写是默认两倍 需转换计算
if (actualHeight > canvasHeight) {
actualWidth = actualWidth / (actualHeight / canvasHeight)
actualHeight = canvasHeight
}
// console.log(actualHeight)
// 默认母链海报 不是须单独处理
this.setData({
width: actualWidth + 32,
height: actualHeight + 82
})
const drawfun = new Draw( // 大画布
{
// height: 554
width: actualWidth + 32,
height: actualHeight + 82
// pixelRatio
},
this
),
{ userInfo } = wx.$storage.get(),
merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName
console.log(merchantName)
// console.log(n.activityName)
let imageList = [],
textList = []
// debugger
if (n.type == 'warReport') {
imageList = [
{
x: 0,
y: 0,
width: actualWidth + 32,
height: actualHeight + 82,
url: n.posterUrl
}
]
textList = []
} else {
n.activityName = n.activityName.length > 12 ? `${n.activityName.substring(0, 12)}...` : n.activityName
imageList = [
{
x: 0,
y: 0,
width: 279,
height: 66,
url: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/poster-bg.png'
},
{
x: 16,
y: 70,
width: actualWidth,
height: actualHeight,
url: n.posterUrl
}
]
textList = [
{
x: 12,
y: 14,
fontSize: 14,
color: '#2D2D33',
text: merchantName,
textBaseline: 'top'
},
{
x: 12,
y: 36,
fontSize: 14,
color: '#1B233D',
text: n.activityName,
textBaseline: 'top',
fontWeight: 500
},
{
x: 14 + drawfun.getTextWidth(n.activityName, 14) + 9,
y: 37,
fontSize: 10,
color: '#4466F0',
text: '众筹',
textBaseline: 'top',
border: {
width: 1,
color: '#4466F0',
radius: 2,
padding: [2, 5],
opacity: 0.5
}
}
]
}
let res = await drawfun.begin({
imageList,
textList
})
// console.log(res)
wx.hideLoading()
this.setData({
poster: res.path,
show: true
})
let fileList = wx.$storage.get('fileList') || []
// console.log([findKey])
// this.setData({
// [findKey]: n[findKey]
// })
// 去重
// debugger
// let fileLength = fileList.length
let obj = {
fileId: res.fileId,
path: res.path,
[findKey]: n[findKey]
}
// console.log(fileLength)
// if (fileLength) {
// fileList.forEach((item, index) => {
// // console.log(index)
// console.log(condition.posterUrl == n.posterUrl)
// if (condition.posterUrl == n.posterUrl) {
// item = obj
// } else if (index == fileLength) {
// fileList.unshift(obj)
// }
// })
// } else {
// fileList.unshift(obj)
// }
fileList.unshift(obj)
// console.log(fileList)
// fileList = [...fileList, ...fileList]
fileList = fileList.slice(0, 21)
// console.log(fileList)
wx.$storage.set('fileList', fileList)
},
download() {
const filePath = this.data.poster,
_this = this
wx.saveImageToPhotosAlbum({
filePath,
success() {
wx.$api.showToast('保存成功')
},
fail(err) {
const auth = _this.selectComponent('#auth')
auth.check()
}
})
},
hide() {
console.log('hide')
this.setData({
show: false,
poster: ''
})
},
noScroll() {},
authFail(e) {
this.setData({
showAuth: true
})
},
longpress() {
let { item } = this.data
this.triggerEvent('longtouch', item)
}
}
})
/* packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.wxss */
.layout {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .8);
}
.poster {
box-sizing: border-box;
width: 500rpx;
max-height: 68%;
// height: 68%;
// height: 1108rpx;
overflow: scroll;
// smoo
// overflow: scroll;
border-radius: 8rpx 8rpx 0 0;
}
.pd {
padding: 32rpx;
background-color: #fff;
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 500rpx;
height: 90rpx;
background: #F7F8FA;
border-radius: 0 0 12rpx 12rpx;
font-weight: 500;
font-size: 32rpx;
color: #3666FE;
margin-top: -2rpx;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 12rpx;
}
}
.tips {
margin: 40rpx 80rpx 0;
font-size: 24rpx;
color: #FFFFFF;
line-height: 36rpx;
.underline {
font-weight: 600;
text-decoration: underline;
}
}
}
.titleTime {
height: 64rpx;
line-height: 64rpx;
width: 100%;
// background-color: rgba(54, 102, 254, 0.08);
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
color: #fff;
text-align: center;
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}">
<!-- catchtouchmove="noScroll" catchtouchmove="noScroll" -->
<view class="layout">
<view class="bg" bindtap="hide" />
<!-- style="height:{{height}}" -->
<view class="poster {{item.type == 'warReport'?'pd':''}}">
<block wx:if="{{scrollImg}}">
<scroll-view scroll-y scroll-x="false" style="height: 100%">
<!-- mode="widthFix" -->
<image
bindload="successOnload"
src="{{poster}}"
mode="widthFix"
show-menu-by-longpress
bindlongpress="longpress" />
</scroll-view>
<!-- </view> -->
</block>
<block wx:else>
<!-- <view class="poster {{item.type == 'warReport'?'pd':''}}"> -->
<!-- mode="widthFix" -->
<scroll-view scroll-y scroll-x="false" style="height: 100%">
<image
bindload="successOnload"
src="{{poster}}"
mode="widthFix"
show-menu-by-longpress
bindlongpress="longpress" />
</scroll-view>
<!-- </view> -->
`
</block>
</view>
<view class="btn">
<glsx-image src="output/longtap.png" class="icon" />
长按图片转发
</view>
<view wx:if="{{item.type == 'warReport'}}" class="titleTime">最近更新时间: {{item.updatedTime}}</view>
<view wx:else class="tips">
温馨提示:您可以转发到门店群,门店员工通过扫描海报二维码可以注册登录
<text class="underline">门店助手</text>
小程序,执行活动任务,转发活动链接促成订单。
</view>
</view>
</block>
<!-- <authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" isShowCheck="{{false}}" id="auth" /> -->
// components/FullscreenVideo/FullscreenVideo.js
Component({
/**
* 组件的属性列表
*/
properties: {
src:String,
title:String,
},
/**
* 组件的初始数据
*/
data: {
fullScreen: false,
},
lifetimes: {
ready() {
// this.play();
},
},
/**
* 组件的方法列表
*/
methods: {
/**播放视屏 */
play(e) {
//执行全屏方法
var videoContext = wx.createVideoContext("myvideo", this);
videoContext.requestFullScreen();
this.setData({
fullScreen: true,
});
},
/**关闭视屏 */
closeVideo() {
//执行退出全屏方法
var videoContext = wx.createVideoContext("myvideo", this);
videoContext.exitFullScreen();
this.setData({
fullScreen: false,
});
},
/**视屏进入、退出全屏 */
fullScreenFn(e) {
var isFull = e.detail.fullScreen;
//视屏全屏时显示加载video,非全屏时,不显示加载video
this.setData({
fullScreen: isFull,
});
},
},
});
/* components/FullscreenVideo/FullscreenVideo.wxss */
.show{
display:block;
}
.hide{
display:none;
}
\ No newline at end of file \ No newline at end of file
<!-- components/FullscreenVideo/FullscreenVideo.wxml -->
<!-- -->
<video id='myvideo' class='{{fullScreen?"show":"hide"}}' src="{{src}}" title="{{title}}" autoplay="true" direction="{{0}}" bindfullscreenchange="fullScreenFn" bindended="closeVideo" controls></video>
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,7 @@ Component({ ...@@ -11,6 +11,7 @@ Component({
custom: Boolean, custom: Boolean,
showBack: Boolean, showBack: Boolean,
customBack: Boolean, customBack: Boolean,
fixedShowBack: Boolean,
pageTitle: { pageTitle: {
type: String, type: String,
value: '', value: '',
......
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}"> <view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}"> <block wx:if="{{!custom}}">
<view class="navigation-bar-box custom-class" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}{{navBarBoxStyle}}"> <view class="navigation-bar-box custom-class" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}{{navBarBoxStyle}}">
<block wx:if="{{SHOWBACK}}"> <block wx:if="{{SHOWBACK || fixedShowBack}}">
<view class="back " bindtap="back"> <view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" /> <image class="img" src="./images/icon-back.png" />
</view> </view>
......
...@@ -6,7 +6,10 @@ Component({ ...@@ -6,7 +6,10 @@ Component({
*/ */
properties: { properties: {
tips: String, tips: String,
bg: String, bg: {
type: String,
value: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/sales-assistant/customer/nothing.png'
},
bgColor: { bgColor: {
type: String, type: String,
value: '#fff' value: '#fff'
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
// justify-content: center; // justify-content: center;
.bg { .bg {
width: 512rpx; width: 172rpx;
height: 512rpx; height: 172rpx;
} }
.tips { .tips {
margin-top: -15rpx;
font-size: 24rpx; font-size: 24rpx;
color: #CCCED1; color: #CCCED1;
text-align: center; text-align: center;
......
<!-- components/Nothing-tips/nothingTips.wxml --> <!-- components/Nothing-tips/nothingTips.wxml -->
<view class="nothingCon custom-class" style="background-color: {{bgColor}};{{emptyDataStyle}}"> <view class="nothingCon custom-class" style="background-color: {{bgColor}};{{emptyDataStyle}}">
<image <image
wx:if="{{bg}}"
class="bg" class="bg"
src="{{bg}}" src="{{bg}}"
webp></image> webp></image>
......
// components/TabBar/TabBar.js
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: Array,
activeIndex: {
type: Number,
observer: function (n) {
console.log(this.data.tabIndex, 'activeIndex', n);
console.log(this.data.tabIndex != n);
if (this.data.tabIndex != n) {
this.setData({
tabIndex: this.data.activeIndex
})
this.setTab(this.data.tabIndex)
}
}
},
scroll: Boolean
},
/**
* 组件的初始数据
*/
data: {
tabIndex: 0
},
lifetimes: {
ready() {
// console.log('lifetimes',this.data.tabIndex);
// console.log('lifetimes',this.data.activeIndex);
this.setTab(this.data.tabIndex)
let that = this
wx.$eventbus.on('page_show', n => {
!that.data.width && that.setTab(that.data.tabIndex)
})
}
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let {
index
} = e.currentTarget.dataset
this.setTab(index)
},
setTab(index = 0) {
let {
tabIndex,
} = this.data
wx.$api.getViewInfo(`#tab-${tabIndex}`, old => {
let oldLeft = old[0].left
let oldWidth = old.width
wx.$api.getViewInfo(`#tab-${index}`, res => {
let {
left,
width
} = res[0]
if (tabIndex != index) {
let readyLeft = oldLeft > left ? left : oldLeft
let readyWidth = oldLeft > left ? oldLeft - left : left - oldLeft
this.setData({
activeStyle: `width: 64rpx;background-color:#347BFF;border-radius:3rpx;left:${readyLeft + readyWidth / 2}px;transition: all .1s;`
})
}
setTimeout(() => {
this.setData({
activeStyle: `width: 64rpx;left:${left + (width - 32) / 2}px;background-color:#347BFF;`,
tabIndex: index,
to: `to-${index}`,
width
})
this.triggerEvent('click', index)
}, 100)
}, this)
}, this)
}
}
})
\ No newline at end of file \ No newline at end of file
<block wx:if="{{scroll}}">
<scroll-view class=" scroll" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}" id="to-{{index}}">
<text id="tab-{{index}}">
<text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text>
</text>
</view>
</block>
<!-- <view class="active-doc" style="{{activeStyle}}" /> -->
</scroll-view>
</block>
<block wx:else>
<view class="tab" style="grid-template-columns: repeat({{tabList.length}}, 1fr);font-size:{{tabList.length>5?'var(--fontSize24)':''}} ;">
<block wx:for="{{tabList}}" wx:key="index">
<!-- style="color:{{tabIndex==index?'#347BFF':''}};" -->
<view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}">
<text id="tab-{{index}}"><text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text></text>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}" />
</view>
</block>
\ No newline at end of file \ No newline at end of file
/* components/TabBar/TabBar.wxss */
.tab {
background-color: #fff;
height: 88rpx;
box-sizing: border-box;
display: grid;
align-items: center;
font-size: 28rpx;
color: #999999;
position: relative;
}
.scroll {
background-color: #fff;
height: 88rpx;
box-sizing: border-box;
color: #999999;
width: 100%;
display: flex;
line-height: 72rpx;
font-size: 0;
}
.active {
font-weight: 600;
color: #347BFF;
font-size: 32rpx;
}
.active-doc {
position: absolute;
bottom: 1rpx;
height: 4rpx;
border-radius: 2rpx 2rpx 0 0;
transition: all .25s;
}
.tab .tab-item {
text-align: center;
}
.scroll .tab-item {
width: fit-content;
min-width: 144rpx;
height: 100%;
flex-shrink: 0;
font-size: 28rpx;
text-align: center;
position: relative;
padding: 0 10rpx;
}
.scroll .active::after {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 64rpx;
height: 4rpx;
background-color: #347BFF;
content: '';
}
\ No newline at end of file \ No newline at end of file
// packagesList/pages/productDetail/components/proDetail/proDetail.js
import { senceData, productData } from '~/pages/tab/index/constant/senceData'
const norTabList = ['海报案例', '测算营销', '产品介绍', '项目亮点']
Component({
externalClasses: ['custom-class'],
/**
* 组件的属性列表
*/
properties: {
// 场景值下标
// actNum: {
// type: Number,
// value: -1,
// observer(n) {
// this.getInfo()
// if (n == 3) {
// this.setVideoCtx()
// }
// }
// },
// // 选中的产品
// activeNavIdx: {
// type: Number,
// value: 0
// },
// cardInfo: {
// type: Object,
// value: {}
// },
// // 配置url
// activeUrl: {
// type: String,
// value: ''
// },
sharephone: {
type: String,
value: ''
},
showLeftFlag: {
type: Boolean,
value: false
},
detailType: {
type: String,
value: 'pro'
},
proDetail: {
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
videoBaseUrl: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/',
productData,
proInfo: {},
prodItemVideo: '', //选中的场景下的video的第一个
tabAct: 0,
scrollTop: 0,
showCard: false,
tabList: [],
imgTopArr: []
},
lifetimes: {
attached() {
wx.showLoading()
setTimeout(() => {
wx.hideLoading()
this.getImgHeight()
}, 800)
},
},
/**
* 组件的方法列表
*/
methods: {
setVideoCtx() {
this.setData({
videoCtx: wx.createVideoContext('video', this),
crowdVideoCtx: wx.createVideoContext('crowd-video', this)
})
},
handleVideoPlay(e) {
let { attr } = e.currentTarget.dataset
this.data[attr] && this.data[attr].pause()
},
// getInfo() {
// let { activeNavIdx, actNum } = this.data
// const spcList = [99] // 订阅模块需要特殊处理
// const senceList = this.data.productData[actNum].filter(item => item.name != '全部')
// for (let i = 0; i < senceList.length; i++) {
// let item = senceList[i]
// let proIdList = item?.productList.map(k => k.id)
// if (proIdList.includes(activeNavIdx)) {
// let proInfo = item.productList.find(k => k.id == activeNavIdx)
// this.setData({
// proInfo,
// productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : (proInfo.productImgs ? proInfo.productImgs : item.productImgs),
// tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
// prodItemVideo: item.videoList.length ? spcList.includes(actNum) ? item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
// })
// break
// }
// }
// },
async loadImg(e){
this.data.loadedNum += 1
if(e.currentTarget.dataset.len==this.data.loadedNum){
let imgTopArr = [];
const topList = await this.getDomInfo('.calc-wrap')
const top = topList.reduce((prev, cur)=>{
return prev + cur.height;
}, 0)
imgTopArr.push(top)
const imgList = await this.getDomInfo('.img-items')
imgList.reduce((prev, cur, index)=>{
if(index<imgList.length-1){
imgTopArr.push(prev + cur.height)
}
return prev + cur.height;
}, top)
this.setData({
imgTopArr
})
}
},
getDomInfo(dom){
return new Promise((resolve,reject)=>{
let query = wx.createSelectorQuery().in(this);
query
.selectAll(dom)
.boundingClientRect((rt) => {
resolve(rt)
})
.exec();
})
},
getImgHeight() {
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let imgTopArr = []
let s = 0
let top
let { scrollTop } = this.data
let _this = this
query
.selectAll('.img-items')
.boundingClientRect(react => {
react.forEach((item, index) => {
//44 tab的高度
s = item.top - 44 + scrollTop
imgTopArr.push(s)
})
_this.setData({
imgTopArr
})
})
.exec()
// setTimeout(() => {
// console.log('imgTopArr',this.data.imgTopArr)
// },500)
},
// 1.3查看活动详情按钮
checkActive(e) {
// let { activeUrl } = this.data
// wx.$router.jumpH5(activeUrl);
console.log(e);
let { url } = e.currentTarget.dataset
wx.$router.jumpH5(url);
},
onClickTab(event) {
// console.log('event: ', event);
let { index } = event.detail
// console.log('index: ', index);
this.setData({
tabAct: index
})
let { imgTopArr } = this.data
wx.pageScrollTo({
scrollTop: imgTopArr[index] + 5
})
},
pageSroll(e) {
let { imgTopArr } = this.data
wx.nextTick(() => {
let idx
if (imgTopArr[0] > e.scrollTop) {
idx = 0
} else if (imgTopArr[imgTopArr.length - 1] > e.scrollTop && imgTopArr[0] < e.scrollTop) {
idx = imgTopArr.findIndex(item => item > e.scrollTop) - 1
} else {
idx = imgTopArr.length - 1
}
this.setData({
tabAct: idx,
scrollTop: e.scrollTop
})
})
},
selectCard() {
//console.log(this.data.showCard)
this.setData({
showCard: !this.data.showCard
})
},
phoneCall(e) {
let { phone } = e.currentTarget.dataset;
wx.$api.phoneCall(phone);
},
getUserInfo(e) {
this.triggerEvent('getUserInfo', { detail: e.detail })
},
// 膨胀金-二维码-长按图片
handleLongPress(e) {
let {item} = e.currentTarget.dataset
// 如果图片有长按事件 posterEventType: 1-无 2-有
if (item.posterEventType == 1) return
wx.downloadFile({
url: item.posterEventUrl,
success: function (res) {
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
}
})
}
})
},
}
})
/* packagesList/pages/productDetail/components/proDetail/proDetail.wxss */
page {
background-color: #fff;
}
.view-prod {
.frame {
margin: 16rpx 32rpx;
width: calc(100% - 64rpx);
height: 422rpx;
border-radius: 16rpx;
box-sizing: border-box;
}
.title-wrap {
margin-bottom: 32rpx;
margin-left: 32rpx;
margin-right: 32rpx;
display: flex;
height: 104rpx;
align-items: center;
.title {
width: 564rpx;
height: 48rpx;
font-weight: 500;
font-size: 32rpx;
color: #323436;
// line-height: 48rpx;
}
.check {
margin-left: 30rpx;
margin-right: 6rpx;
width: 28rpx;
height: 28rpx;
}
.num {
font-size: 24rpx;
color: #5a6066;
}
}
.no-video {
margin: 16rpx auto 32rpx;
display: block;
width: 686rpx;
height: 386rpx;
border-radius: 16rpx;
}
.tab-wrap {
position: sticky;
top: 0;
margin-bottom: 20rpx;
z-index: 1;
.tabs-index--van-tabs {
top: -1px
}
.van-tab {
font-size: 28rpx;
color: #5a6066;
}
.van-tab--active {
font-weight: 600;
font-size: 28rpx;
color: #3666fe;
}
frame .van-tabs__line {
width: 112rpx !important;
height: 4rpx !important;
}
}
.prod-detail {
.img-items {
position: relative;
}
.occupancy {
height: 120rpx;
}
.img-item {
position: relative;
}
.phone {
position: absolute;
top: 60rpx;
right: 32rpx;
font-weight: 400;
font-size: 24rpx;
color: #6C6C6C;
display: flex;
align-items: center;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 6rpx;
}
}
.check-act {
width: 100%;
text-align: center;
position: absolute;
bottom: 64rpx;
right: 0;
font-weight: 600;
font-size: 28rpx;
color: #3666FE;
text-decoration: underline;
}
.crowd-video {
width: calc(100% - 64rpx);
height: 386rpx;
position: absolute;
top: 264rpx;
margin: 0 32rpx;
border-radius: 16rpx;
}
.more-btn {
position: absolute;
left: 50%;
bottom: 50px;
transform: translateX(-50%);
width: 622rpx;
height: 96rpx;
background-image: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/btn.png");
background-size: 100% 100%;
font-weight: 500;
font-size: 16px;
color: #ffffff;
text-align: center;
line-height: 96rpx;
}
// .img-item0 {
// width: 100%;
// height: 2564rpx;
// }
// .img-item1 {
// width: 100%;
// height: 1812rpx;
// }
// .img-item2 {
// width: 100%;
// height: 620rpx;
// }
// .img-item3 {
// width: 100%;
// height: 2156rpx;
// }
// 流程图一
.img-item00 {
width: 100%;
height: 3308rpx;
}
.img-item01 {
width: 100%;
height: 2598rpx;
}
.img-item02 {
width: 100%;
height: 490rpx;
}
.img-item03 {
width: 100%;
height: 688rpx;
}
// // 流程图二
.img-item10 {
width: 100%;
height: 1488rpx;
}
.img-item11 {
width: 100%;
height: 2192rpx;
}
.img-item12 {
width: 100%;
height: 490rpx;
}
.img-item13 {
width: 100%;
height: 688rpx;
}
// // 流程图三
.img-item20 {
width: 100%;
height: 1488rpx;
}
.img-item21 {
width: 100%;
height: 570rpx;
}
.img-item22 {
width: 100%;
height: 490rpx;
}
.img-item23 {
width: 100%;
height: 864rpx;
}
// // 流程图四
.img-item30 {
width: 100%;
height: 5758rpx;
}
.img-item31 {
width: 100%;
height: 1812rpx;
}
.img-item32 {
width: 100%;
height: 490rpx;
}
.img-item46 {
width: 100%;
height: 1684rpx;
}
.img-item47 {
width: 100%;
height: 3688rpx;
}
// .img-item48 {
// width: 100%;
// height: 4004rpx;
// }
.img-item48 {
width: 100%;
height: 472rpx;
}
.img-item49 {
width: 100%;
height: 4594rpx;
}
.img-item50 {
width: 100%;
height: 1650rpx;
}
.img-item51 {
width: 100%;
height: 552rpx;
}
.img-item52 {
width: 100%;
height: 4360rpx;
}
.img-item53 {
width: 100%;
height: 1130rpx;
}
.img-item54 {
width: 100%;
height: 428rpx;
}
}
}
/* 用户授权 */
.user-profile {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 3;
background-color: transparent;
}
.pro-head {
position: relative;
.select-card {
position: absolute;
right: 0;
top: 26rpx;
width: 142rpx;
height: 68rpx;
background: #FFFFFF;
box-shadow: 0 6rpx 16rpx 0 rgba(175, 175, 219, 0.65);
border-radius: 34rpx 0 0 34rpx;
z-index: 2;
display: flex;
align-items: center;
padding: 12rpx;
box-sizing: border-box;
font-weight: 600;
font-size: 26rpx;
color: #57578A;
.icon-card {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml -->
<view class="view-prod custom-class">
<view class="pro-head">
<!-- 产品详情是视频 -->
<!-- mediaType: 1-图片,2-视频 -->
<video class="frame" id="video" wx:if="{{proDetail.mediaType == '2'}}" src="{{proDetail.vedioUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" />
<!-- 产品详情是图片 -->
<image class="no-video" wx:if="{{proDetail.mediaType == '1'}}" src="{{proDetail.imageUrl}}?v={{img_version}}" />
<!-- 标题+视频时展示观看人数 -->
<view class="title-wrap">
<view class="title">{{proDetail.title}}</view>
<image class="check" wx:if="{{proDetail.mediaType != '1'}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{proDetail.mediaType != '1'}}">{{proDetail.view}}</view>
</view>
</view>
<view wx:if="{{proDetail.detailList}}" class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab wx:for="{{proDetail.detailList}}" title="{{item.name}}" wx:key="idnex" />
</van-tabs>
</view>
<view class="prod-detail">
<block wx:for="{{proDetail.detailList}}" wx:key="index">
<image webp mode="widthFix" class="img-items" src="{{item.posterUrl}}?v={{img_version}}" bindlongpress="handleLongPress" data-item="{{item}}">
<!-- 第一张图的点击拨打电话事件 -->
<block wx:if="{{ index == 0}}">
<view class="phone" bindtap="phoneCall" data-phone="{{sharephone}}">
<image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image>
<glsx-image webp src="index/phone.png" class="icon" />
请联系我
<view style="color:#3666fe">{{sharephone}}</view>
</view>
</block>
<!-- 如果有活动跳转 -->
<!-- 按钮点击事件 buttonClickEvent:1-无 2-有 -->
<block wx:if="{{ item.buttonEventType == 2 }}">
<view class="check-act" bindtap="checkActive" data-url="{{item.buttonEventUrl}}">{{item.buttonEventName}}</view>
</block>
<!-- 获取更多详情 -->
<!-- <block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情
</button>
</block> -->
<!-- 如果有视频 -->
<block wx:if="{{ item.videoUrl }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{item.videoUrl}}" />
</block>
</image>
</block>
<view class="occupancy" wx:if="{{!isShare}}">
</view>
</view>
</view>
<!-- 申请按钮 不是分享出去的显示按钮 -->
<!-- <apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button> -->
<!-- 授权昵称 -->
<!-- <view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view> -->
\ No newline at end of file \ No newline at end of file
...@@ -4,11 +4,26 @@ ...@@ -4,11 +4,26 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@vant/area-data": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/@vant/area-data/-/area-data-1.5.2.tgz",
"integrity": "sha512-Gtxgt6Rjgopt6234ANpO0bBsSwtjZ23lBlVDHIy8Mi2NJqyoj1vgVWY0dri8/2LCZAWzQ6EnwRrUVViUZ0cvMA=="
},
"@vant/weapp": { "@vant/weapp": {
"version": "1.10.7", "version": "1.10.7",
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.7.tgz", "resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.7.tgz",
"integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A==" "integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A=="
}, },
"dayjs": {
"version": "1.11.18",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz",
"integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA=="
},
"glsk-map-jssdk": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/glsk-map-jssdk/-/glsk-map-jssdk-0.1.1.tgz",
"integrity": "sha512-kwCyU8A1t7Q7V2hlzC03nc9VNNW9HPXQ5YhHsGGnrEtPxykGDG7AEyT5O7LY1zZk/8adkkk6FHgCM53r6p/4yw=="
},
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.1.24", "version": "1.1.24",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"description": "", "description": "",
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
"@vant/area-data": "^1.5.1",
"@vant/weapp": "^1.10.7", "@vant/weapp": "^1.10.7",
"dayjs": "^1.11.18",
"glsk-map-jssdk": "^0.1.1",
"glsx-applet-component": "^1.1.24", "glsx-applet-component": "^1.1.24",
"glsx-common-sdk": "^0.2.8", "glsx-common-sdk": "^0.2.8",
"glsx-map-sdk": "^0.1.5" "glsx-map-sdk": "^0.1.5"
......
// packageCustomer/components/BusinessAnalysis/BusinessAnalysis.js
import { MERCHANTMENUS, IMG_URL } from '~/utils/constantData'
import dayjs from 'dayjs'
import Dialog from '@vant/weapp/dialog/dialog'
import CustomerApi from "~/api/customerApi/index"
let currentObj
let weekObj
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
menus: MERCHANTMENUS,
current: 0,
dateList: [{
title: '日',
index: 0
},
{
title: '周',
index: 1
},
{
title: '月',
index: 2
},
{
title: '自定义',
index: 3
}],
// 默认展示今天日期,格式为 月/日
date: '',
show: false,
minDate: dayjs().subtract(1, 'year').valueOf(),
maxDate: dayjs().valueOf(),
dateCurrent: 0,
// 日选择
currentDate: dayjs().valueOf(),
selectedDate: '',
dateShow: false,
timeType: 'date',
timeTypeEnum: {
0: 'date',
1: 'week',
2: 'year-month',
3: 'custom'
},
titleEnum: {
date: '选择日期',
week: '选择周',
'year-month': '选择年月',
custom: '自定义'
},
weekList: [],
weekColumns: [],
currentWeek: {},
merchantId: '',
boardData: {},
leftCurrent: false,
rightCurrent: false,
defaultIndex: 1,
opts: {
keys: ['stattime', 'output'],
color: '#69C9FF',
lineColr: '#6ED0BE',
tickCount: 8,
lineList: [],
barList: [],
},
},
lifetimes: {
attached() {
// 获取当前页面的merchantId
const merchantId = wx.$router.getPageInstance().options.merchantId
this.setData({
merchantId
})
// 初始化日期为昨天
this.initDate()
// 周数据
this.getWeeklyData()
},
},
/**
* 组件的方法列表
*/
methods: {
selectMenu(event) {
const { index } = event.currentTarget.dataset;
this.setData({
current: index,
timeType: 'date',
dateCurrent: 0,
rightCurrent: false,
leftCurrent: false,
});
this.initDate('date')
},
// 切换日期类型
selectDate(event) {
const { index } = event.currentTarget.dataset;
const {timeTypeEnum} = this.data
console.log(index, 'dateCurrent')
this.setData({
dateCurrent: index,
timeType: timeTypeEnum[index],
rightCurrent: false,
leftCurrent: false
});
if (index == 3) {
this.setData({
show: true
})
}
this.initDate(timeTypeEnum[index])
},
getAnalysisData() {
},
initDate(type = 'date') {
const now = dayjs();
const {current} = this.data
const setData = (payload) => {
this.setData(payload);
if (current == 0) this.getAnalysisData(this.data.merchantId);
};
switch (type) {
case 'date': {
const yesterday = now.subtract(1, 'day');
setData({
date: yesterday.format('YYYY/MM/DD'),
currentDate: yesterday.valueOf(),
});
break;
}
case 'year-month': {
const lastMonth = now.subtract(1, 'month');
setData({
date: lastMonth.format('YYYY/MM'),
currentDate: lastMonth.valueOf(),
});
break;
}
case 'week': {
const secondWeek = this.data.weekColumns[1];
if (secondWeek) {
setData({
currentWeek: secondWeek,
date: `${secondWeek.startDate}-${secondWeek.endDate}`,
});
}
break;
}
case 'custom': {
const yesterday = now.subtract(1, 'day');
setData({
date: `${yesterday.format('YYYY/MM/DD')}-${now.format('YYYY/MM/DD')}`,
currentDate: yesterday.valueOf(),
});
break;
}
default:
console.warn('[initDate] 未知 type:', type);
}
},
// 周数据
async getWeeklyData() {
const result = await CustomerApi.getWeekSelectData()
const weekColumns = result.map((item, index) => ({
label: `${item.startDate}至${item.endDate}`,
startDate: dayjs(item.startDate).format('YYYY/MM/DD'),
endDate: dayjs(item.endDate).format('YYYY/MM/DD'),
index
}))
this.setData({
weekColumns
})
},
// 日历的关闭
onClose() {
this.setData({
show: false,
// currentDate: dayjs().valueOf(),
});
},
// 日历的确认
onConfirm(event) {
console.log(event)
const {current} = this.data
const start = event.detail[0]
const end = event.detail[1]
this.setData({
show: false,
date: `${dayjs(start).format('YYYY/MM/DD')}-${dayjs(end).format('YYYY/MM/DD')}`,
});
console.log(current, 'current')
if (current == 0) this.getAnalysisData()
},
// 日选择
onDisplayDate() {
const { timeType, date, currentDate } = this.data
if (timeType == 'custom') {
this.setData({
show: true
})
const calendar = this.selectComponent("#calendar")
if (calendar && calendar.__data__ && calendar.__data__.currentDate) {
const _calendar = calendar.__data__.currentDate.map(item => dayjs(item).format('YYYY/MM/DD'))
const _value = date.split('-')
if (_value[0] != _calendar[0] || _value[1] != _calendar[1]) {
calendar.reset()
}
}
} else {
this.setData({
dateShow: true
})
if (timeType == 'date' && currentObj) {
const c_value = currentObj.getValues()
const _date = date.split('/')
if (c_value[0] != _date[0] || c_value[1] != _date[1] || c_value[2] != _date[2]) {
const picker = this.selectComponent("#datePicker")
console.log(picker.picker, 'picker')
console.log(date)
this.setData({
minDate: dayjs().subtract(1, 'year').valueOf(),
maxDate: dayjs().valueOf(),
},
() => {
picker.picker.setValues(_date)
})
}
} else if (timeType == 'year-month'&& currentObj) {
const c_value = currentObj.getValues()
const _date = date.split('/')
if (c_value[0] != _date[0] || c_value[1] != _date[1]) {
const picker = this.selectComponent("#datePicker")
console.log(picker.picker, 'picker')
console.log(date)
this.setData({
minDate: dayjs().subtract(1, 'year').valueOf(),
maxDate: dayjs().valueOf(),
},
() => {
picker.picker.setValues(_date)
})
}
} else if (timeType == 'week') {
const { date, weekColumns} = this.data
const picker = this.selectComponent("#weekPicker")
console.log(picker.getColumnIndex(0), 'picker')
const label = date.replace('-', '至').replace(/\//g, '-');
const index = weekColumns.findIndex(i => i.label == label)
console.log(label, index)
setTimeout(() => {
picker.setColumnIndex(0, index)
}, 0)
}
}
},
// 取消
cancel() {
this.setData({
dateShow: false
})
},
// 年月日确认
confirm() {
const { selectedDate, timeType, currentWeek, current } = this.data;
const formatMap = {
date: () => dayjs(selectedDate).format('YYYY/MM/DD'),
'year-month': () => dayjs(selectedDate).format('YYYY/MM'),
week: () => `${currentWeek.startDate}-${currentWeek.endDate}`
};
// 边界状态统一计算
const calcBoundary = () => {
const { timeType, selectedDate, currentWeek, weekColumns, minDate } = this.data;
let rightCurrent = false;
let leftCurrent = false;
switch (timeType) {
case 'date': {
const today = dayjs().startOf('day');
const min = dayjs(minDate).startOf('day');
const sel = dayjs(selectedDate).startOf('day');
rightCurrent = sel.isSame(today, 'day');
leftCurrent = sel.isSame(min, 'day');
break;
}
case 'year-month': {
const current = dayjs().startOf('month');
const min = dayjs(minDate).startOf('month');
const sel = dayjs(selectedDate);
rightCurrent = sel.isSame(current, 'month');
leftCurrent = sel.isSame(min, 'month');
break;
}
case 'week':
if (currentWeek.index === 0) rightCurrent = true;
if (currentWeek.index === weekColumns.length - 1) leftCurrent = true;
break;
default:
console.warn('[confirm] 未知 timeType:', timeType);
}
this.setData({ rightCurrent, leftCurrent });
};
calcBoundary();
this.setData({
dateShow: false,
date: (formatMap[timeType] || (() => ''))()
});
console.log(current, 'current')
if (current == 0) this.getAnalysisData(this.data.merchantId);
},
onChange(e) {
console.log(e, e.detail.getValues(), 'onChange')
currentObj = e.detail
},
// 日选择
onInput(event) {
console.log(dayjs(event.detail).format('YYYY/MM/DD'), 'onInput')
// 防止选择之后,取消选择,导致日期不变
this.setData({
selectedDate: event.detail
})
},
// 周选择
onWeekChange(event) {
console.log(event, 'weekChange')
const {value} = event.detail
const currentWeek = value
this.setData({
currentWeek,
})
},
// 上一个月
last() {
const {timeType, merchantId, date, minDate, current} = this.data
if (timeType == 'year-month') {
// 使用 dayjs 处理年月逻辑
const currentDisplayDate = dayjs(date);
const prevMonth = currentDisplayDate.subtract(1, 'month');
const leftCurrent = prevMonth.isSame(dayjs(minDate), 'month');
this.setData({
date: prevMonth.format('YYYY/MM'),
currentDate: prevMonth.valueOf(),
rightCurrent: false,
leftCurrent
});
} else if (timeType == 'date') {
// 日选择:使用 dayjs 处理日期减一天
const currentDisplayDate = dayjs(date);
const prevDate = currentDisplayDate.subtract(1, 'day');
const leftCurrent = prevDate.isSame(dayjs(minDate), 'day');
this.setData({
date: prevDate.format('YYYY/MM/DD'),
currentDate: prevDate.valueOf(),
rightCurrent: false,
leftCurrent
});
} else if (timeType == 'week') {
const {currentWeek, weekColumns} = this.data;
if (currentWeek.index > -1) {
const prevWeek = weekColumns[currentWeek.index + 1];
const prevDate = dayjs(prevWeek.startDate, 'YYYY/MM/DD');
this.setData({
date: `${prevWeek.startDate}-${prevWeek.endDate}`,
currentDate: prevDate.valueOf(),
defaultIndex: currentWeek.index + 1,
currentWeek: prevWeek,
leftCurrent: prevWeek.index === weekColumns.length - 1,
rightCurrent: false
});
}
}
if (current == 0) this.getAnalysisData(merchantId)
},
// 下一个月
next() {
const {timeType, merchantId, date, current} = this.data
if (timeType == 'year-month') {
// 获取当前显示的日期
const currentDisplayDate = dayjs(date);
// 设置为上一个月
const nextMonth = currentDisplayDate.add(1, 'month');
const rightCurrent = nextMonth.isSame(dayjs(), 'month');
this.setData({
date: nextMonth.format('YYYY/MM'),
currentDate: nextMonth.valueOf(),
leftCurrent: false,
rightCurrent
});
console.log(currentDisplayDate, 'currentDisplayDate')
} else if (timeType == 'date') {
// 日选择
// 获取当前显示的日期
const currentDisplayDate = dayjs(date, 'YYYY/MM/DD');
// 设置为下一个月
const nextDate = currentDisplayDate.add(1, 'day');
const _date = nextDate.format('YYYY/MM/DD');
const _currentDate = dayjs().format('YYYY/MM/DD');
const rightCurrent = _date == _currentDate
this.setData({
date: _date,
currentDate: nextDate.valueOf(),
rightCurrent,
leftCurrent: false
});
} else if (timeType == 'week') {
const {currentWeek, weekColumns} = this.data
console.log(currentWeek)
if (currentWeek.index < weekColumns.length) {
const nextWeek = weekColumns[currentWeek.index - 1]
console.log(nextWeek)
const nextDate = dayjs(nextWeek.startDate, 'YYYY/MM/DD');
this.setData({
date: `${nextWeek.startDate}-${nextWeek.endDate}`,
currentDate: nextDate.valueOf(),
defaultIndex: currentWeek.index - 1,
currentWeek: nextWeek,
rightCurrent: nextWeek.index == 0,
leftCurrent: false
})
console.log(nextWeek == 0, this.data.currentDate)
}
}
console.log(current, 'current')
if (current == 0) this.getAnalysisData(merchantId)
},
handleShow(e) {
const { type } = e.currentTarget.dataset
const obj = {
output: {
title: "总产值",
content: "当前门店+业务+统计周期下,全部订单金额总和",
},
atv: {
title: "客单价",
content: "当前门店+业务+统计周期下,产值/门店订单数",
},
};
Dialog.alert({
title: obj[type].title,
message: obj[type].content,
context: this,
confirmButtonColor: '#347BFF',
messageAlign: 'left',
confirmButtonText: '知道了',
}).then(() => {
});
},
// 帮助
handleIsAnalyse() {
this.setData({helpShow: true})
},
// 获取门店产值趋势数据
getTrend() {
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-icon": "@vant/weapp/icon/index",
"van-dialog": "@vant/weapp/dialog/index",
"analyse-line": "../analyseLine/analyseLine",
"van-picker": "@vant/weapp/picker/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageCustomer/components/BusinessAnalysis/BusinessAnalysis.wxss */
.analysis {
padding-bottom: 150rpx;
.header {
margin-bottom: 20rpx;
background: #FFFFFF;
padding-bottom: 24rpx;
.title-section {
width: 440rpx;
height: 64rpx;
font-size: 32rpx;
font-weight: 400;
padding: 32rpx 0;
margin: 0 auto;
overflow: hidden;
.title-container {
display: flex;
align-items: center;
width: calc(100% - 12rpx);
height: 100%;
background-color: #F7F8FA;
border-radius: 16rpx;
padding: 0 4rpx;
}
.title {
display: flex;
align-items: center;
justify-content: center;
width: 144rpx;
color: #999EA8;
text-align: center;
height: 56rpx;
&.active {
color: #347BFF;
background-color: #fff;
border-radius: 16rpx;
}
}
}
.person-section {
width: calc(100% - 64rpx);
box-sizing: border-box;
margin: 0 32rpx 28rpx;
background: #F7F8FA;
height: 72rpx;
display: flex;
align-items: center;
padding: 0 24rpx;
color: #5A5E66;
}
.tab-section {
width: 528rpx;
height: 62rpx;
display: flex;
align-items: center;
margin: 0 auto;
background-color: #F7F8FA;
border-radius: 8rpx;
overflow: hidden;
margin-bottom: 32rpx;
.tab {
flex: 1;
text-align: center;
height: 48rpx;
line-height: 48rpx;
// padding: 16rpx 0;
font-size: 28rpx;
margin: 0 8rpx;
color: #999EA8;
&.active {
background-color: #fff;
color: #292D33;
border-radius: 4rpx;
}
}
}
.date-section {
width: 528rpx;
margin: 0 auto;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
.date {
color: #5A5E66;
font-size: 28rpx;
}
.arrow {
display: flex;
align-items: center;
width: 30rpx;
height: 30rpx;
font-size: 30rpx;
color: #666;
.arrow-left {
padding-left: 24rpx;
padding-right: 24rpx;
}
.arrow-right {
padding-right: 24rpx;
padding-left: 24rpx;
}
}
}
}
.content {
.data-base {
display: flex;
margin: 24rpx;
.statistics {
flex: 1;
height: 150rpx;
box-shadow: 0 2rpx 12rpx 0 #0000000d;
text-align: center;
padding: 20rpx 0;
box-sizing: border-box;
border-radius: 16rpx;
background: #fff;
font-family: "numberNor";
.title {
color: #5a5e66;
font-size: 24rpx;
margin-bottom: 8rpx;
line-height: 34rpx;
.info {
width: 28rpx;
height: 28rpx;
vertical-align: top;
}
}
.value {
color: #347bff;
font-size: 40rpx;
font-weight: 700;
}
.ratio {
color: #999ea8;
font-size: 20rpx;
display: flex;
align-items: center;
justify-content: center;
text {
font-size: 24rpx;
margin-left: 4rpx;
}
}
}
.statistics:nth-child(1) {
margin-right: 16rpx;
}
}
.analyse-data {
height: 704rpx;
width: calc(100% - 48rpx);
border-radius: 16rpx;
box-shadow: 0 2rpx 12rpx 0 #0000000d;
margin: 0 24rpx 24rpx;
position: relative;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/sales-assistant/customer/analyse-bg.png') no-repeat;
background-size: 100% 704rpx;
.helps {
position: absolute;
right: 24rpx;
border-radius: 8rpx;
background: #f7f8fa;
top: 24rpx;
padding: 4rpx 12rpx;
}
.chunk {
width: 206rpx;
text-align: center;
position: absolute;
font-family: "numberNor";
.name {
font-size: 24rpx;
color: #5a5e66;
margin-bottom: 4rpx;
}
.name-tips {
font-size: 20rpx;
}
.value {
color: #347bff;
font-size: 32rpx;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
}
.red-txt {
font-size: 24rpx;
color: #f24724b3;
font-weight: 400;
}
.chunkLabel {
display: flex;
align-items: center;
justify-content: center;
text {
color: #999ea8;
font-size: 20rpx;
font-weight: normal;
margin-left: 8rpx;
}
label {
font-size: 24rpx;
margin-left: 4rpx;
color: #999ea8;
font-weight: normal;
}
.arrow {
width: 24rpx;
height: 24rpx;
}
}
.rate {
color: #347bff;
font-size: 20rpx;
text {
font-size: 24rpx;
margin-left: 4rpx;
}
}
.font-10 {
font-size: 20rpx !important;
}
.link {
color: #999ea8;
font-size: 20rpx;
display: flex;
align-items: center;
justify-content: center;
text {
font-size: 24rpx;
margin-left: 4rpx;
}
.arrow {
width: 24rpx;
height: 24rpx;
}
}
}
.delivery {
left: 28rpx;
top: 44rpx;
}
.drainage {
left: 28rpx;
top: 188rpx;
}
.arrival {
left: 28rpx;
top: 300rpx;
}
.sqzhuanhualv {
left: 28rpx;
top: 444rpx;
}
.shzhuanhualv {
left: 248rpx;
top: 444rpx;
}
.after {
left: 242rpx;
top: 300rpx;
}
.totaltostore {
right: 30rpx;
top: 300rpx;
}
.percent {
right: 30rpx;
top: 444rpx;
}
.sqsucceednum {
left: 28rpx;
top: 560rpx;
}
.shsucceednum {
left: 242rpx;
top: 560rpx;
}
.make {
right: 30rpx;
top: 560rpx;
}
.permeate {
right: 40rpx;
top: 120rpx;
}
}
.arrow {
width: 12px;
height: 12px;
}
.data-wrap {
height: 582rpx;
background: #ffffff;
border-radius: 16rpx;
margin: 24rpx;
padding: 28rpx 24rpx;
box-sizing: border-box;
position: relative;
.helps {
position: absolute;
right: 24rpx;
top: 24rpx;
border-radius: 8rpx;
background: #f7f8fa;
padding: 4rpx 12rpx;
}
.center {
height: 100%;
width: 280rpx;
margin: 0 auto;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/sales-assistant/customer/analyse-bg_1.png') no-repeat;
background-size: 280rpx 100%;
background-size: cover;
.item {
width: 100%;
height: 106rpx;
border-radius: 16rpx;
text-align: center;
padding: 16rpx 0;
box-sizing: border-box;
p {
&:first-child {
margin-bottom: 8rpx;
}
letter-spacing: 0;
}
.title {
line-height: 34rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
color: #5a5e66;
}
.info {
display: flex;
justify-content: center;
align-items: center;
.num {
line-height: 32rpx;
font-family: numberNor;
font-weight: 600;
font-size: 32rpx;
color: #347bff;
margin-right: 2rpx;
}
.desc {
line-height: 28rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 20rpx;
color: #999ea8;
}
.val {
line-height: 24rpx;
font-family: numberNor;
font-weight: 400;
font-size: 24rpx;
color: #999ea8;
letter-spacing: 0;
}
.trend-image {
width: 24rpx;
height: 24rpx;
}
}
.flow-info {
color: #347bff;
display: flex;
justify-content: center;
align-items: center;
.desc {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 20rpx;
line-height: 28rpx;
margin-right: 4rpx;
}
.val {
font-family: numberNor;
font-weight: 400;
font-size: 24rpx;
line-height: 24rpx;
}
}
}
.s-item {
padding-top: 20rpx;
p {
margin-bottom: 0 !important;
}
}
}
}
.product-value {
padding: 24rpx;
margin: 0 24rpx;
height: 556rpx;
box-shadow: 0 2rpx 12rpx 0 #0000000d;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
.title {
color: #292d33;
font-size: 32rpx;
text-align: left;
padding-bottom: 16rpx;
border-bottom: 2rpx solid #e8e8ea;
font-weight: 500;
line-height: 46rpx;
}
}
}
}
.just {
width: 30rpx;
height: 18rpx;
}
.helps {
color: #5a5e66;
font-size: 24rpx;
font-weight: normal;
display:flex;
align-items:center;
.info {
width: 28rpx;
height: 28rpx;
margin-left: 6rpx;
vertical-align: middle;
}
}
.helps-dialog {
font-size: 28rpx;
color: #5A5E66;
padding: 34rpx 40rpx 48rpx;
text {
color: #347BFF;
}
}
\ No newline at end of file \ No newline at end of file
<!--packageCustomer/components/BusinessAnalysis/BusinessAnalysis.wxml-->
<view class="analysis">
<view class="header">
<view class="title-section">
<view class="title-container">
<block wx:for="{{menus}}" wx:key="index">
<view class="title {{item.index==current?'active':''}}" data-index="{{item.index}}" bind:tap="selectMenu">{{item.title}}</view>
</block>
</view>
</view>
<view class="person-section">销售:{{'迪丽热巴·迪力木拉提'}}</view>
<view class="tab-section">
<block wx:for="{{dateList}}" wx:key="index">
<view class="tab {{item.index==dateCurrent?'active':''}}" data-index="{{item.index}}" bind:tap="selectDate">{{item.title}}</view>
</block>
</view>
<view class="date-section">
<view class="arrow left">
<van-icon wx:if="{{timeType != 'custom' && !leftCurrent}}" class="arrow-left" name="arrow-left" bind:tap="last" />
</view>
<view class="date" bind:tap="onDisplayDate">{{date}}</view>
<view class="arrow right">
<van-icon wx:if="{{timeType != 'custom' && !rightCurrent}}" class="arrow-right" name="arrow" bind:tap="next" />
</view>
</view>
</view>
<view class="content">
<view class="data-base">
<view class="statistics">
<view class="title">
总产值
<image class="info" bindtap="handleShow" src="{{IMG_URL}}customer/warning.png" data-type="output"/>
</view>
<view class="value">{{ outputData[0].output }}</view>
<view class="ratio" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ outputData[0].outputhb }} </text>
<image wx:if="{{outputData[0].outputhbsj > 0}}" class="arrow" src="{{IMG_URL}}customer/up.png"/>
<image wx:elif="{{outputData[0].outputhbsj == 0}}" class="arrow just" src="{{IMG_URL}}customer/just.png"/>
<image wx:else class="arrow" src="{{IMG_URL}}customer/down.png"/>
</view>
</view>
<view class="statistics">
<view class="title">
客单价
<image class="info" bindtap="handleShow" data-type="atv" src="{{IMG_URL}}customer/warning.png"/>
</view>
<view class="value">{{ outputData[0].atv }}</view>
<view class="ratio" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ outputData[0].atvhb }}</text>
<image wx:if="{{outputData[0].atvhbsj > 0}}" class="arrow" src="{{IMG_URL}}customer/up.png"/>
<image wx:elif="{{outputData[0].atvhbsj == 0}}" class="arrow just" src="{{IMG_URL}}customer/just.png"/>
<image wx:else class="arrow" src="{{IMG_URL}}customer/down.png"/>
</view>
</view>
</view>
<view wx:if="{{current != 2}}" class="analyse-data">
<view class="helps" bindtap="handleIsAnalyse">
帮助
<image class="info" src="{{IMG_URL}}customer/warning.png"/>
</view>
<view class="chunk delivery">
<view class="name">新车交付数<text class="name-tips">(异常)</text></view>
<view class="value">
{{ buyAndToStoreData[0].newcarbuynum }}
<text wx:if="{{buyAndToStoreData[0].newcarbuynummark != null}}" class="red-txt">({{ buyAndToStoreData[0].newcarbuynummark }})</text>
</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text>
<label hidden="{{listParams.queryType == 'self'}}">{{buyAndToStoreData[0].newcarbuynumhb}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].newcarbuynumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].newcarbuynumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk drainage">
<view class="rate font-10">
引流率<text>{{ buyAndToStoreData[0].yinliulv }}</text>
</view>
<view class="link" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ buyAndToStoreData[0].yinliulvhb }}</text>
<image class="arrow" wx:if="{{buyAndToStoreData[0].yinliulvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].yinliulvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</view>
</view>
<view class="chunk arrival">
<view class="name">售前触客数<text class="name-tips">(异常)</text></view>
<view class="value">
{{ buyAndToStoreData[0].newcartostore }}
<text wx:if="{{buyAndToStoreData[0].newcartostoremark != null}}" class="red-txt">({{ buyAndToStoreData[0].newcartostoremark }})</text>
</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text>
<label hidden="{{listParams.queryType == 'self'}}">{{buyAndToStoreData[0].newcartostorehb}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].newcartostorehbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].newcartostorehbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk after">
<view class="name">售后触客数<text class="name-tips">(异常)</text></view>
<view class="value">
{{ buyAndToStoreData[0].aftersalestostore }}
<text wx:if="{{buyAndToStoreData[0].aftersalestostoremark != null}}" class="red-txt">({{ buyAndToStoreData[0].aftersalestostoremark }})</text>
</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text>
<label hidden="{{listParams.queryType == 'self'}}">{{buyAndToStoreData[0].aftersalestostorehb}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].aftersalestostorehbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].aftersalestostorehbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk totaltostore">
<view class="name">总触客数<text class="name-tips">(异常)</text></view>
<view class="value">
{{ buyAndToStoreData[0].totaltostore }}
<text wx:if="{{buyAndToStoreData[0].totaltostoremark != null}}" class="red-txt">({{ buyAndToStoreData[0].totaltostoremark }})</text>
</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text>
<label hidden="{{listParams.queryType == 'self'}}">{{buyAndToStoreData[0].totaltostorehb}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].totaltostorehbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:if="{{buyAndToStoreData[0].totaltostorehbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk sqzhuanhualv">
<view class="rate">
售前转化率<text>{{ buyAndToStoreData[0].sqzhuanhualv }}</text>
</view>
<view class="link" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ buyAndToStoreData[0].sqzhuanhualvhb }}</text>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].sqzhuanhualvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].sqzhuanhualvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk shzhuanhualv">
<view class="rate">
售后转化率<text>{{ buyAndToStoreData[0].shzhuanhualv }}</text>
</view>
<view class="link" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ buyAndToStoreData[0].shzhuanhualvhb }}</text>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].shzhuanhualvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].shzhuanhualvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk percent">
<view class="rate">
转化率<text>{{ buyAndToStoreData[0].zhuanhualv }}</text>
</view>
<view class="link" hidden="{{listParams.queryType == 'self'}}">
环比<text>{{ buyAndToStoreData[0].zhuanhualvhb }}</text>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].zhuanhualvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].zhuanhualvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk sqsucceednum">
<view class="name">成交数(售前)</view>
<view class="value">{{ buyAndToStoreData[0].sqsucceednum }}</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text
><label hidden="{{listParams.queryType == 'self'}}">{{
buyAndToStoreData[0].sqsucceednumhb
}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].sqsucceednumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].sqsucceednumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk shsucceednum">
<view class="name">成交数(售后)</view>
<view class="value">{{ buyAndToStoreData[0].shsucceednum }}</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text
><label hidden="{{listParams.queryType == 'self'}}">{{
buyAndToStoreData[0].shsucceednumhb
}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].shsucceednumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].shsucceednumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk make">
<view class="name">总成交数</view>
<view class="value">{{ buyAndToStoreData[0].succeednum }}</view>
<view class="chunkLabel">
<text hidden="{{listParams.queryType == 'self'}}">环比</text
><label hidden="{{listParams.queryType == 'self'}}">{{
buyAndToStoreData[0].succeednumhb
}}</label>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].succeednumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].succeednumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="chunk permeate">
<view class="rate">
渗透率<text>{{ buyAndToStoreData[0].shentoulv }}</text>
</view>
<view class="link">
<label hidden="{{listParams.queryType == 'self'}}"
>环比<text>{{ buyAndToStoreData[0].shentoulvhb }}</text></label
>
<block wx:if="{{listParams.queryType != 'self'}}">
<image class="arrow" wx:if="{{buyAndToStoreData[0].shentoulvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="arrow just" wx:elif="{{buyAndToStoreData[0].shentoulvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="arrow" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
</view>
<view wx:else class="data-wrap">
<view class="helps" bindtap="handleIsAnalyse">
帮助
<image class="info" src="{{IMG_URL}}customer/warning.png" mode=""/>
</view>
<view class="center">
<view class="item">
<view class="title">新车交付数</view>
<view class="info">
<text class="num"> {{ buyAndToStoreData[0].newcarbuynum }}</text>
<block hidden="{{listParams.queryType == 'self'}}">
<text class="desc">环比</text>
<text class="val">{{buyAndToStoreData[0].newcarbuynumhb}}</text>
<image class="trend-image" wx:if="{{buyAndToStoreData[0].newcarbuynumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="trend-image" wx:elif="{{buyAndToStoreData[0].newcarbuynumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="trend-image" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="s-item item">
<view class="flow-info">
<text class="desc">引流率</text>
<text class="val">{{ buyAndToStoreData[0].yinliulv }}</text>
</view>
<view class="info" hidden="{{listParams.queryType == 'self'}}">
<text class="desc">环比</text>
<text class="val">{{ buyAndToStoreData[0].yinliulvhb }}</text>
<image class="trend-image" wx:if="{{buyAndToStoreData[0].yinliulvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="trend-image" wx:elif="{{buyAndToStoreData[0].yinliulvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="trend-image" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</view>
</view>
<view class="item">
<view class="title">触客台次</view>
<view class="info">
<text class="num">{{ buyAndToStoreData[0].totaltostore }}</text>
<block hidden="{{listParams.queryType == 'self'}}">
<text class="desc">环比</text>
<text class="val">{{ buyAndToStoreData[0].totaltostorehb }}</text>
<image class="trend-image" wx:if="{{buyAndToStoreData[0].totaltostorehbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="trend-image" wx:elif="{{buyAndToStoreData[0].totaltostorehbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="trend-image" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
<view class="s-item item">
<view class="flow-info">
<text class="desc">转化率</text>
<text class="val">{{ buyAndToStoreData[0].zhuanhualv }}</text>
</view>
<view class="info" hidden="{{listParams.queryType == 'self'}}">
<text class="desc">环比</text>
<text class="val">{{ buyAndToStoreData[0].zhuanhualvhb }}</text>
<image class="trend-image" wx:if="{{buyAndToStoreData[0].zhuanhualvhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="trend-image" wx:elif="{{buyAndToStoreData[0].zhuanhualvhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="trend-image" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</view>
</view>
<view class="item">
<view class="title">总成交量</view>
<view class="info">
<text class="num">{{ buyAndToStoreData[0].succeednum }}</text>
<block hidden="{{listParams.queryType == 'self'}}">
<text class="desc">环比</text>
<text class="val">{{buyAndToStoreData[0].succeednumhb}}</text>
<image class="trend-image" wx:if="{{buyAndToStoreData[0].succeednumhbsj > 0}}" src="{{IMG_URL}}customer/up.png" mode=""/>
<image class="trend-image" wx:elif="{{buyAndToStoreData[0].succeednumhbsj == 0}}" src="{{IMG_URL}}customer/just.png" mode=""/>
<image class="trend-image" wx:else src="{{IMG_URL}}customer/down.png" mode=""/>
</block>
</view>
</view>
</view>
</view>
<view class="product-value">
<view class="title">门店产值趋势</view>
<analyse-line
id="line"
opts="{{opts}}"
chartData="{{lineData}}"
/>
</view>
</view>
</view>
<!-- 年月日 -->
<popup bind:hidePopup="cancel" bind:confirm="confirm" show="{{dateShow}}" title="{{titleEnum[timeType]}}" height="50vh">
<block wx:if="{{timeType == 'date' || timeType == 'year-month'}}">
<van-datetime-picker id="datePicker" show-toolbar="{{false}}" min-date="{{ minDate }}" max-date="{{ maxDate }}" model:value="{{ currentDate }}" type="{{timeType=='date'?'date':'year-month'}}" bind:change="onChange" bind:input="onInput" />
</block>
<!-- 周 -->
<block wx:if="{{timeType == 'week'}}">
<van-picker id="weekPicker" show-toolbar="{{false}}" model:value="{{ currentDate }}" default-index="{{defaultIndex}}" value-key="label" columns="{{ weekColumns }}" bind:change="onWeekChange" />
</block>
</popup>
<van-calendar
id="calendar"
max-range="{{ 31 }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
show="{{ show }}"
type="range"
color="#347BFF"
bind:confirm="onConfirm"
bind:close="onClose"
/>
<van-dialog id="van-dialog" />
<van-dialog show="{{ helpShow }}" use-slot title="帮助" confirm-button-text="知道了" confirm-button-color="#347BFF">
<view class="helps-dialog">
<block wx:if="{{current != 2}}">
<view>
<text>渗透率:</text>当前门店+业务+统计周期下,总成交数/新车交付数。
</view>
<view>
<text>新车交付数:</text>当前门店+业务+统计周期下,全部新车交付数之和。
</view>
<view>
<text>引流率:</text>当前门店+业务+统计周期下,触客数(售前)/新车交付数。
</view>
<view>
<text>触客数(售前):</text>当前门店+业务+统计周期下,全部触客数(售前)之和。
</view>
<view>
<text>触客数(售后):</text>当前门店+业务+统计周期下,全部触客数(售后)之和。
</view>
<view><text>总触客数:</text>当前门店+业务+统计周期下,全部触客数之和。</view>
<view>
<text>成交数(售前):</text>当前门店+业务+统计周期下,售前流量成交的订单数。
</view>
<view>
<text>成交数(售后):</text>当前门店+业务+统计周期下,售后流量成交的订单数。
</view>
<view><text>总成交数:</text>当前门店+业务+统计周期下,成交的总订单数。</view>
<view>
<text>售前转化率:</text>当前门店+业务+统计周期下,成交数(售前)/触客数(售前)。
</view>
<view>
<text>售后转化率:</text
>当前门店+业务+统计周期下,成交数(售后)/触客数(售后)。
</view>
<view><text>转化率:</text>当前门店+业务+统计周期下,总成交数/总触客数。</view>
</block>
<block wx:else>
<view>
<text>新车交付数:</text>当前门店+业务+统计周期下,全部新车交付数之和。
</view>
<view>
<text>引流率:</text>当前门店+业务+统计周期下,触客台次/新车交付数。
</view>
<view>
<text>触客台次:</text>当前门店+业务+统计周期下,全部触客台次之和。
</view>
<view>
<text>转化率:</text>当前门店+业务+统计周期下,总成交数/触客台次。
</view>
<view><text>总成交量:</text>当前门店+业务+统计周期下,成交的总订单数。</view>
</block>
</view>
</van-dialog>
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '~/utils/constantData.js'
Component({
externalClasses: ['custom-class'],
properties: {
items: {
type: Array,
value: []
},
threshold: {
type: Number,
value: 24
},
clampLines: {
type: Number,
value: 1
}
},
data: {
IMG_URL,
displayItems: [],
showPopup: false,
popupTitle: '',
popupText: ''
},
observers: {
'items, threshold, clampLines': function (items, threshold, clampLines) {
console.log(items)
const display = (items || []).map(it => {
const val = (it && it.value !== undefined && it.value !== null) ? String(it.value) : ''
// 初始不按字符数判断,渲染后根据容器宽度再计算
return { ...it, isLong: false, clampLines: it.clampLines || clampLines }
})
this.setData({ displayItems: display }, () => {
wx.nextTick(() => this._calcOverflowByWidth())
})
}
},
methods: {
rpx2px(rpx) {
const sw = this._screenWidth || (this._screenWidth = wx.getSystemInfoSync().windowWidth)
return (rpx * sw) / 750
},
_calcTextWidth(text, fontPx) {
if (!text) return 0
let width = 0
for (let i = 0; i < text.length; i++) {
const ch = text[i]
if (ch === '/' || ch === '-' || ch === '·') {
width += fontPx * 0.35
} else if (ch === '_' || ch === ':' || ch === ';' || ch === '、' || ch === ',' || ch === '。') {
width += fontPx * 0.5
} else if (/\s/.test(ch)) {
width += fontPx * 0.32
} else if (/\d/.test(ch)) {
width += fontPx * 0.62
} else if (/[a-z]/.test(ch)) {
width += fontPx * 0.62
} else if (/[A-Z]/.test(ch)) {
width += fontPx * 0.74
} else if (/[\u4e00-\u9fa5]/.test(ch)) {
width += fontPx * 0.98
} else {
width += fontPx * 0.55
}
}
return width
},
_calcOverflowByWidth() {
const query = wx.createSelectorQuery().in(this)
query.selectAll('.value-text').boundingClientRect()
query.exec(res => {
const rects = (res && res[0]) || []
const { displayItems, clampLines, threshold } = this.data
if (!displayItems || !displayItems.length) return
const updated = displayItems.map((it, i) => {
const rect = rects[i] || {}
const widthPx = rect.width || 0
const fontRpx = it.highlight ? 36 : 24
const fontPx = this.rpx2px(fontRpx)
const lines = it.clampLines || clampLines || 1
const fallback = it.threshold || threshold
const val = (it.value !== undefined && it.value !== null) ? String(it.value) : ''
if (!widthPx || !fontPx) {
return { ...it, isLong: val.length > fallback }
}
const textWidth = this._calcTextWidth(val, fontPx)
const isLong = textWidth > (widthPx * lines)
return { ...it, isLong }
})
this.setData({ displayItems: updated })
})
},
onMoreTap(e) {
const index = e.currentTarget.dataset.index
const item = this.data.displayItems[index] || {}
this.setData({
showPopup: true,
popupTitle: item.label || '',
popupText: item.value || ''
})
},
onPopupConfirm() {
this.setData({ showPopup: false })
},
onPopupClose() {
this.setData({ showPopup: false })
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup"
}
}
\ No newline at end of file \ No newline at end of file
/* InfoBoard styles */
.info-board {
padding: 28rpx 0 0;
.cells {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 16rpx;
.cell {
background: #FFFFFF;
border-radius: 16rpx;
border: 1rpx solid #DEE0E3;
padding: 16rpx;
box-sizing: border-box;
min-width: 0;
text-align: center;
.cell-label {
font-size: 24rpx;
color: #757B85;
}
.cell-value {
margin-top: 12rpx;
font-size: 24rpx;
display: flex;
align-items: center;
.more-icon {
width: 32rpx;
height: 32rpx;
margin-left: 4rpx;
}
.value-text {
color: #292D33;
height: 36rpx;
flex: 1;
min-width: 0;
font-weight: 600;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.highlight {
.value-text {
font-weight: 700;
font-size: 36rpx;
line-height: 36rpx;
}
}
}
.cell-full {
grid-column: 1 / -1;
}
.cell-span2 {
grid-column: span 2;
}
}
}
.board-modal {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 998;
.board-backdrop {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,.6);
}
.board-dialog {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 622rpx;
max-width: 88%;
background: #fff;
border-radius: 20rpx;
box-shadow: 0 8rpx 24rpx rgba(0,0,0,.08);
overflow: hidden;
.board-title {
padding-top: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
color: #292D33;
font-weight: 600;
}
.board-content {
padding: 32rpx 48rpx 48rpx;
font-size: 28rpx;
color: #5A5E66;
word-break: break-all;
}
.board-footer {
display: flex;
align-items: center;
justify-content: center;
padding: 24rpx;
border-top: 1rpx solid #EBEDF0;
color: #292D33;
font-size: 32rpx;
}
}
}
<view class="info-board">
<view class="cells">
<block wx:for="{{displayItems}}" wx:key="index">
<view class="cell {{item.full ? 'cell-full' : (item.span === 2 ? 'cell-span2' : '')}}">
<view class="cell-label">{{item.label}}</view>
<view class="cell-value {{item.highlight ? 'highlight' : ''}}">
<text class="value-text">{{item.value}}</text>
<image wx:if="{{item.isLong}}" class="more-icon" src="{{IMG_URL}}/customer/more-icon.png" mode="aspectFit" data-index="{{index}}" bindtap="onMoreTap" />
</view>
</view>
</block>
</view>
<view wx:if="{{showPopup}}" class="board-modal" catchtouchmove="true">
<view class="board-backdrop"></view>
<view class="board-dialog">
<view class="board-title">{{popupTitle}}</view>
<view class="board-content">{{popupText}}</view>
<view class="board-footer" bindtap="onPopupConfirm">
<view class="board-confirm">我知道了</view>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageCustomer/components/KPIProgress/KPIProgress.js
import { MERCHANTMENUS, IMG_URL } from '~/utils/constantData'
import CustomerApi from "~/api/customerApi/index"
import dayjs from 'dayjs'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
menus: MERCHANTMENUS,
current: 0,
year: '',
rightCurrent: false,
leftCurrent: false,
minDate: dayjs().subtract(5, 'year').valueOf(),
maxDate: dayjs().valueOf(),
// KPI 列表行数据(按月)
kpiRows: []
},
lifetimes: {
attached() {
// 获取当前页面的merchantId
const merchantId = wx.$router.getPageInstance().options?.merchantId
this.setData({
merchantId
})
// 年份数据
this.generateRecentYears()
},
},
/**
* 组件的方法列表
*/
methods: {
generateRecentYears() {
const currentYear = new Date().getFullYear()
const years = []
// 生成近五年的数据(包括当前年)
for (let i = 5; i >= 0; i--) {
const year = currentYear - i
years.push({
label: year,
value: year,
index: years.length
})
}
this.setData({
yearColumns: years,
currentDate: years[years.length - 1],
defaultIndex: years.length - 1,
selectedYear: {
value: dayjs().year(),
index: years.length - 1
},
year: years[years.length - 1]?.value,
rightCurrent: true
}, () => {
this.getListData()
})
},
onYearChange(e) {
const {value} = e.detail
this.setData({
selectedYear: value
})
},
confirm() {
let { selectedYear } = this.data
this.setData({
year: selectedYear?.value,
rightCurrent: selectedYear.index == 5,
leftCurrent: selectedYear.index == selectedYear.length - 1
}, () => {
this.getListData()
})
this.cancel()
},
cancel() {
this.setData({
yearShow: false
})
},
selectMenu(event) {
const { index } = event.currentTarget.dataset
let { yearColumns } = this.data
this.setData({
current: index,
rightCurrent: true,
leftCurrent: false,
year: yearColumns[yearColumns?.length - 1]?.value
})
this.generateRecentYears()
},
// 上一个
last() {
const { selectedYear, yearColumns } = this.data
if (selectedYear.index > -1) {
const prevYear = yearColumns[selectedYear.index - 1]
console.log(selectedYear.index + 1,)
this.setData({
year: prevYear.value,
rightCurrent: false,
leftCurrent: prevYear.index == 0,
defaultIndex: selectedYear.index - 1,
selectedYear: prevYear
}, () => {
this.getListData()
})
}
},
// 下一个
next() {
const { selectedYear, yearColumns } = this.data
if (selectedYear.index > -1) {
const prevYear = yearColumns[selectedYear.index + 1]
this.setData({
year: prevYear.value,
rightCurrent: prevYear.index == yearColumns.length - 1,
leftCurrent: false,
defaultIndex: selectedYear.index + 1,
selectedYear: prevYear
}, () => {
this.getListData()
})
}
},
onDisplayYear() {
this.setData({
yearShow: true
})
},
// 格式化金额为 ¥x,xxx.xx
formatCurrency(n, rate) {
const num = Number(n || 0)
return rate ? `${num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}%` : `¥${num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
},
// 计算完成率并保留两位小数
formatPercent(done, target) {
const d = Number(done || 0)
const t = Number(target || 0)
const rate = t ? (d / t) * 100 : 0
return `${rate.toFixed(2)}%`
},
getListData() {
let { year, merchantId, current } = this.data
const businessTypeObj = {
0: 1, // 延保
1: 3, // 权益
2: 2 // 轻改
}
const params = {
year,
merchantId,
businessType: businessTypeObj[current]
}
// TODO: 接入后端后替换为真实数据
const mock = [
{ month: 1, completed: 9666660000, target: 9666660000, completionRate: 100 },
{ month: 2, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 3, completed: 56000000, target: 99000000, completionRate: 65 },
{ month: 4, completed: 32000000, target: 66000000, completionRate: 100 },
{ month: 5, completed: 66000000, target: 99000000, completionRate: 100 },
{ month: 6, completed: 4000000, target: 20000000, completionRate: 100 },
{ month: 7, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 8, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 9, completed: 66000000, target: 99000000, completionRate: 100 },
{ month: 10, completed: 66000000, target: 300000, completionRate: 100 },
{ month: 11, completed: 90000, target: 2000, completionRate: 100 },
{ month: 12, completed: 2000, target: 2000, completionRate: 100 }
]
const rows = mock.map(m => {
const completed = this.formatCurrency(m.completed, )
const target = this.formatCurrency(m.target)
const completionRate = this.formatCurrency(m.completionRate, true)
return { ...m, completed, target, completionRate }
})
this.setData({ kpiRows: rows })
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-icon": "@vant/weapp/icon/index",
"van-picker": "@vant/weapp/picker/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageCustomer/components/KPIProgress/KPIProgress.wxss */
.KPI-progress {
padding-bottom: 150rpx;
.header {
margin-bottom: 20rpx;
background: #FFFFFF;
padding-bottom: 24rpx;
.title-section {
width: 440rpx;
height: 64rpx;
font-size: 32rpx;
font-weight: 400;
padding: 32rpx 0;
margin: 0 auto;
overflow: hidden;
.title-container {
display: flex;
align-items: center;
width: calc(100% - 12rpx);
height: 100%;
background-color: #F7F8FA;
border-radius: 16rpx;
padding: 0 4rpx;
}
.title {
display: flex;
align-items: center;
justify-content: center;
width: 144rpx;
color: #999EA8;
text-align: center;
height: 56rpx;
&.active {
color: #347BFF;
background-color: #fff;
border-radius: 16rpx;
}
}
}
.tab-section {
width: 528rpx;
height: 62rpx;
display: flex;
align-items: center;
margin: 0 auto;
background-color: #F7F8FA;
border-radius: 8rpx;
overflow: hidden;
margin-bottom: 32rpx;
.tab {
flex: 1;
text-align: center;
height: 48rpx;
line-height: 48rpx;
// padding: 16rpx 0;
font-size: 28rpx;
margin: 0 8rpx;
color: #999EA8;
&.active {
background-color: #fff;
color: #292D33;
border-radius: 4rpx;
}
}
}
.date-section {
width: 528rpx;
margin: 0 auto;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
.date {
color: #5A5E66;
font-size: 28rpx;
}
.arrow {
display: flex;
align-items: center;
width: 30rpx;
height: 30rpx;
font-size: 30rpx;
color: #666;
.arrow-left {
padding-left: 24rpx;
padding-right: 24rpx;
}
.arrow-right {
padding-right: 24rpx;
padding-left: 24rpx;
}
}
}
}
.content {
padding: 0 32rpx 32rpx;
.kpi-table {
background: #FFFFFF;
overflow: hidden;
}
.kpi-header, .kpi-row {
display: flex;
align-items: center;
padding: 20rpx 0;
}
.kpi-header {
color: #999EA8;
font-size: 24rpx;
background: #E4E8EE;
border-bottom: 0.5px solid #e4e8ee;
}
.kpi-row {
color: #5A5E66;
font-size: 28rpx;
font-family: "numberNor";
border-bottom: 1rpx solid #F7F8FA;
}
.kpi-row:last-child {
border-bottom: none;
}
.col {
flex: 1;
text-align: right;;
}
.col.month {
flex: 0 0 56rpx;
text-align: left;
}
.col.rate {
flex: 0 0 100rpx; text-align: left;
margin-left: 30rpx;
}
.col.done, .col.target { flex: 1.2; }
.number {
color: #347BFF;
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageCustomer/components/KPIProgress/KPIProgress.wxml-->
<view class="KPI-progress">
<view class="header">
<view class="title-section">
<view class="title-container">
<block wx:for="{{menus}}" wx:key="index">
<view class="title {{item.index==current?'active':''}}" data-index="{{item.index}}" bind:tap="selectMenu">{{item.title}}</view>
</block>
</view>
</view>
<view class="date-section">
<view class="arrow left">
<van-icon wx:if="{{!leftCurrent}}" class="arrow-left" name="arrow-left" bind:tap="last" />
</view>
<view class="date" bind:tap="onDisplayYear">{{year}}</view>
<view class="arrow right">
<van-icon wx:if="{{!rightCurrent}}" class="arrow-right" name="arrow" bind:tap="next" />
</view>
</view>
</view>
<view class="content">
<view class="kpi-table">
<view class="kpi-header">
<view class="col month">时间</view>
<view class="col done">已完成</view>
<view class="col target">当月目标</view>
<view class="col rate">完成率</view>
</view>
<block wx:for="{{kpiRows}}" wx:key="month">
<view class="kpi-row">
<view class="col month">{{item.month}}月</view>
<view class="col done number">{{item.completed}}</view>
<view class="col target number">{{item.target}}</view>
<view class="col rate number">{{item.completionRate}}</view>
</view>
</block>
</view>
</view>
</view>
<popup bind:hidePopup="cancel" bind:confirm="confirm" show="{{yearShow}}" title="选择年份" height="50vh">
<van-picker id="yearPicker" show-toolbar="{{false}}" model:value="{{ currentDate }}" default-index="{{defaultIndex}}" value-key="label" columns="{{ yearColumns }}" bind:change="onYearChange" />
</popup>
\ No newline at end of file \ No newline at end of file
// components/SelectArea/SelectArea.js
// 直接使用 Vant 的 areaData 作为默认数据源
const { areaList: vantAreaList } = require('@vant/area-data')
Component({
options: {
addGlobalClass: true
},
properties: {
show: { type: Boolean, value: false },
title: { type: String, value: '选择所在地区' },
// 2 或 3,表示二级(省/市)或三级(省/市/区)
columnsNum: { type: Number, value: 3 },
value: { type: null, value: '' },
areaList: { type: Object, value: vantAreaList },
confirmOnSelect: { type: Boolean, value: false }
},
data: {
areaValues: [],
currentValue: ''
},
observers: {
// 当初始值、层级或数据源变化时,规范化初始值,并推导出 values
'value, columnsNum, areaList': function (value, columnsNum, areaList) {
let normalized = this.normalizeInitCode(value, columnsNum, areaList)
if (!normalized) normalized = this.getDefaultCode(columnsNum, areaList)
const values = this.mapValueToValues(normalized, columnsNum, areaList)
this.setData({ currentValue: normalized, areaValues: values })
}
},
methods: {
// van-area 选项变化:保存当前 values
onAreaChange(e) {
const values = e && e.detail && e.detail.values ? e.detail.values : []
this.setData({ areaValues: values })
},
// 外层 Popup 的“确定”按钮:输出当前选中结果
onConfirm() {
const { columnsNum, areaList, value } = this.properties
const values = this.data.areaValues || []
// 如未触发过 change,尝试根据初始 value 或默认值补齐 values
let normalized = this.normalizeInitCode(value, columnsNum, areaList)
if (!normalized) normalized = this.data.currentValue || this.getDefaultCode(columnsNum, areaList)
const filledValues = values.length ? values : this.mapValueToValues(normalized, columnsNum, areaList)
const codes = filledValues.map(v => v && v.code).filter(Boolean)
const names = filledValues.map(v => v && v.name).filter(Boolean)
const detail = {
provinceCode: codes[0] || '',
provinceName: names[0] || '',
cityCode: codes[1] || '',
cityName: names[1] || '',
countyCode: columnsNum === 3 ? (codes[2] || '') : '',
countyName: columnsNum === 3 ? (names[2] || '') : '',
columnsNum,
codes,
names,
text: names.join(' ')
}
this.triggerEvent('confirm', detail)
},
// 外层 Popup 的“取消”按钮(或遮罩关闭):透传取消
onCancel() {
this.triggerEvent('cancel')
},
// 规范化初始 code 为末级编码(兼容 2/3 级,支持省/市/区传入)
normalizeInitCode(code = '', columnsNum = 3, areaList = {}) {
if (!code) return ''
const input = (code + '')
const provCode = input.slice(0, 2) + '0000'
const cityCode = input.slice(0, 4) + '00'
if (columnsNum === 3) {
// 已是区级
if (input.length === 6 && input.slice(4) !== '00') return input
// 传市级:找该市下第一个区
if (areaList && areaList.county_list && areaList.county_list[cityCode]) return cityCode // unlikely
if (areaList && areaList.county_list) {
const prefix = cityCode.slice(0, 4)
const match = Object.keys(areaList.county_list).find(c => c.slice(0, 4) === prefix)
if (match) return match
}
// 传省级:找该省下第一个市,再找该市下第一个区
if (areaList && areaList.city_list) {
const cMatch = Object.keys(areaList.city_list).find(c => c.slice(0, 2) === provCode.slice(0, 2))
if (cMatch) {
if (areaList && areaList.county_list) {
const pfx = cMatch.slice(0, 4)
const aMatch = Object.keys(areaList.county_list).find(c => c.slice(0, 4) === pfx)
if (aMatch) return aMatch
}
return cMatch // 退化为市级
}
}
return input // 无法推导则原样返回
} else {
// 二级:需要市级编码
// 若传区级,转为市级
if (input.length === 6 && input.slice(4) !== '00') return cityCode
// 若传省级,选该省首个市
if (areaList && areaList.city_list) {
const cMatch = Object.keys(areaList.city_list).find(c => c.slice(0, 2) === provCode.slice(0, 2))
if (cMatch) return cMatch
}
// 已是市级
if (input.length === 6 && input.slice(4) === '00') return input
return ''
}
},
// 根据末级编码映射为 values 数组(兼容 2/3 级)
mapValueToValues(code = '', columnsNum = 3, areaList = {}) {
if (!code || !areaList || !areaList.province_list || !areaList.city_list) return []
const provCode = (code + '').slice(0, 2) + '0000'
const cityCode = (code + '').slice(0, 4) + '00'
const values = []
// 省
const pName = areaList.province_list[provCode]
if (pName) values.push({ code: provCode, name: pName })
// 市
const cName = areaList.city_list[cityCode]
if (cName) values.push({ code: cityCode, name: cName })
// 区
if (columnsNum === 3) {
const aName = (areaList.county_list || {})[code]
if (aName) values.push({ code, name: aName })
}
return values
},
// 当无初始值时,基于数据源计算一个默认末级编码(保证有值)
getDefaultCode(columnsNum = 3, areaList = {}) {
const provinces = areaList && areaList.province_list ? Object.keys(areaList.province_list) : []
if (!provinces.length) return ''
const provCode = provinces.sort()[0]
const cities = areaList && areaList.city_list ? Object.keys(areaList.city_list).filter(c => c.slice(0, 2) === provCode.slice(0, 2)) : []
if (!cities.length) return ''
const cityCode = cities.sort()[0]
if (columnsNum === 2) return cityCode
const counties = areaList && areaList.county_list ? Object.keys(areaList.county_list).filter(a => a.slice(0, 4) === cityCode.slice(0, 4)) : []
if (!counties.length) return cityCode // 若无区,退化为市
const countyCode = counties.sort()[0]
return countyCode
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup",
"van-area": "@vant/weapp/area/index"
}
}
\ No newline at end of file \ No newline at end of file
/* components/SelectArea/SelectArea.wxss */
.sa-columns {
display: flex;
height: 100%;
}
.sa-columns.two .col { width: 50%; }
.sa-columns.three .col { width: 33.33%; }
.col {
border-right: 2rpx solid #F0F2F5;
}
.col:last-child {
border-right: none;
}
.item {
display: flex;
align-items: center;
justify-content: space-between;
height: 96rpx;
padding: 0 32rpx;
border-bottom: 2rpx solid #F5F7FA;
color: #303133;
font-size: 28rpx;
}
.item:last-child { border-bottom: none; }
.item.active .name { color: #3D74FF; }
.name {
max-width: 600rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.check {
width: 36rpx;
height: 36rpx;
}
.sa-empty {
height: 200rpx;
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 28rpx;
}
\ No newline at end of file \ No newline at end of file
<!-- components/SelectArea/SelectArea.wxml -->
<popup show="{{show}}" title="{{title}}" height="50%" bind:confirm="onConfirm" bind:hidePopup="onCancel">
<van-area area-list="{{ areaList }}" show-toolbar="{{ false }}" columns-num="{{ columnsNum }}" value="{{ currentValue }}" bind:change="onAreaChange" />
</popup>
\ No newline at end of file \ No newline at end of file
// components/SelectPopup/SelectPopup.js
import { IMG_URL } from '~/utils/constantData'
Component({
options: {
addGlobalClass: true
},
properties: {
show: {
type: Boolean,
value: false
},
title: {
type: String,
value: ''
},
// 原始选项列表,支持任意字段名,通过 labelKey/valueKey 映射
options: {
type: Array,
value: []
},
// 是否多选
multiple: {
type: Boolean,
value: false
},
// 单选初始值
value: {
type: null,
value: null
},
// 多选初始值
values: {
type: Array,
value: []
},
// 字段映射
labelKey: {
type: String,
value: 'name'
},
valueKey: {
type: String,
value: 'value'
},
// 多选最大数量(不限制则设为 0 或不传)
max: {
type: Number,
value: 0
},
// 单选时点击即确认
confirmOnSelect: {
type: Boolean,
value: false
}
},
data: {
IMG_URL,
displayOptions: [], // 带 checked 的渲染选项
selectedValues: [] // 选中的值列表(单选也统一用数组)
},
observers: {
'options, multiple, value, values': function(options, multiple, value, values) {
this.initDisplay(options || [], multiple, value, values)
},
show(n) {
// 进出场时保持数据一致
if (n) {
this.initDisplay(this.properties.options || [], this.properties.multiple, this.properties.value, this.properties.values)
}
}
},
methods: {
initDisplay(options = [], multiple = false, value = null, values = []) {
console.log(value)
const vKey = this.properties.valueKey
// 初始选中值统一转为数组
const initSelected = multiple ? (Array.isArray(values) ? values.slice() : []) : (value !== null && value !== undefined ? value : [])
const display = (options || []).map(item => {
const val = item[vKey]
const checked = initSelected.some(v => v === val)
return { ...item, checked }
})
this.setData({
displayOptions: display,
selectedValues: initSelected
})
},
toggle(e) {
const { index } = e.currentTarget.dataset
const { multiple, max, valueKey } = this.properties
const item = this.data.displayOptions[index]
if (!item || item.disabled) return
if (multiple) {
let nextChecked = !item.checked
// 限制最大数量
if (nextChecked && max > 0) {
const selectedCount = this.data.selectedValues.length
if (selectedCount >= max) {
// 可根据项目规范提示用户,这里不做 UI 弹窗,保持组件纯净
return
}
}
this.setData({ [`displayOptions[${index}].checked`]: nextChecked })
const val = item[valueKey]
let selected = this.data.selectedValues.slice()
const pos = selected.findIndex(v => v === val)
if (nextChecked && pos === -1) selected.push(val)
if (!nextChecked && pos > -1) selected.splice(pos, 1)
this.setData({ selectedValues: selected })
this.triggerEvent('change', { values: selected, items: this.getSelectedItems() })
} else {
// 单选:取消其他,选中当前
const currentVal = item[valueKey]
const display = this.data.displayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
const selected = display[index].checked ? [currentVal] : []
this.setData({ displayOptions: display, selectedValues: selected })
this.triggerEvent('change', { values: selected, items: this.getSelectedItems() })
if (this.properties.confirmOnSelect) {
this.onConfirm()
}
}
},
onCancel() {
this.triggerEvent('cancel')
},
onConfirm() {
const values = this.data.selectedValues
const items = this.getSelectedItems()
this.triggerEvent('confirm', { values, items })
},
getSelectedItems() {
return (this.data.displayOptions || []).filter(it => it.checked)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup"
}
}
\ No newline at end of file \ No newline at end of file
/* components/SelectPopup/SelectPopup.wxss */
.sp-list {
padding: 0 32rpx;
.sp-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 96rpx;
border-bottom: 2rpx solid #F0F2F5;
color: #333;
font-size: 28rpx;
&:last-child {
border-bottom: none;
}
.label {
max-width: 600rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.check {
width: 36rpx;
height: 36rpx;
}
}
.active {
.label {
color: #3D74FF;
}
}
}
<!-- components/SelectPopup/SelectPopup.wxml -->
<popup show="{{show}}" title="{{title}}" height="50%" bind:confirm="onConfirm" bind:hidePopup="onCancel" customPopupSlotStyle="overflow:auto;">
<view class="sp-list">
<block wx:for="{{displayOptions}}" wx:key="value">
<view class="sp-item {{item.checked ? 'active' : ''}} {{item.disabled ? 'disabled' : ''}}" bindtap="toggle" data-index="{{index}}">
<text class="label">{{item[labelKey] || item.label || item.text}}</text>
<image class="check" src="{{IMG_URL}}customer/checked.png" wx:if="{{item.checked}}" />
</view>
</block>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
// packageCustomer/components/StoreMessage/StoreMessage.js
import { IMG_URL } from '~/utils/constantData'
Component({
options: {
addGlobalClass: true
},
properties: {
// 盈亏与展业等摘要信息
summary: {
type: Object,
value: {
profit: { ok: true, text: '盈利情况' },
business: { ok: true, text: '展业情况', warningCount: 0 },
bottomMetric: {
title: '渗透率临近业务兜底指标',
periodIndex: 0.1094, // 10.94%
bottomRequire: 0.5 // 50%
}
}
},
// 兜底指标预警列表
warnings: {
type: Array,
value: [
{ title: '轮胎转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 },
{ title: '安心包转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 },
{ title: '转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 }
]
},
// 驻店人员列表
residents: {
type: Array,
value: [
// { role: '店总', name: '李四', phone: '13510769158' },
// { role: '王五', name: '王五', phone: '13510769158' }
]
},
// 默认展开的折叠项(自定义折叠仍可参考该配置)
defaultActive: {
type: Array,
value: ['bottom', 'residents']
}
},
data: {
IMG_URL,
activeNames: [],
// 自定义折叠展开状态
showBusiness: false,
showBottom: false,
// 动画对象
businessAnimation: {},
bottomAnimation: {},
infoData: {
displaySituationWarningCount: 5,
safetyIndexWarningCount: 2,
profitAndLoss: 2,
// 展业情况测试数据
displaySituationWarningList: [],
// 兜底指标预警测试数据
safetyIndexWarningList: [{
rule: '轮胎转化率临近业务兜底指标预警',
cycleIndicator: 50,
fallbackIndicator: 20
}, {
rule: '安心包转化率临近业务兜底指标预警',
cycleIndicator: 35,
fallbackIndicator: 25
}, {
rule: '保险产品转化率临近业务兜底指标预警',
cycleIndicator: 28,
fallbackIndicator: 30
}, {
rule: '增值服务转化率临近业务兜底指标预警',
cycleIndicator: 45,
fallbackIndicator: 40
}, {
rule: '客户满意度临近业务兜底指标预警',
cycleIndicator: 38,
fallbackIndicator: 35
}],
storePersonnel: [{
personnelName: '王五王五王五王五王五王五王五王五王五王五王五',
personnelMobile: 13510769158
}, {
personnelName: '王五',
personnelMobile: 13510769158
}]
}
},
lifetimes: {
attached() {
// 初始化展开状态:仅在有数据时允许展开
const hasBusiness = (this.data.infoData?.displaySituationWarningList || []).length > 0
const hasBottom = (this.data.infoData?.safetyIndexWarningList || []).length > 0
this.setData({
showBusiness: hasBusiness ? false : false,
showBottom: hasBottom ? false : false
})
}
},
methods: {
// 兼容之前 collapse 的回调(不再使用)
onCollapseChange(e) {
this.setData({ activeNames: e.detail })
},
// 切换展业情况展开
toggleBusiness(e) {
const has = Number(e?.currentTarget?.dataset?.has || 0)
if (!has) return
const isExpanding = !this.data.showBusiness
this.setData({ showBusiness: isExpanding })
if (isExpanding) {
this.expandPanel('business')
} else {
this.collapsePanel('business')
}
},
// 切换兜底预警展开
toggleBottom(e) {
const has = Number(e?.currentTarget?.dataset?.has || 0)
if (!has) return
const isExpanding = !this.data.showBottom
this.setData({ showBottom: isExpanding })
if (isExpanding) {
this.expandPanel('bottom')
} else {
this.collapsePanel('bottom')
}
},
getDetailData() {
let { infoData } = this.data
infoData.safetyIndexWarningList?.forEach(val => {
val.cycleIndicator = this.formatPercent(val.cycleIndicator)
val.fallbackIndicator = this.formatPercent(val.fallbackIndicator)
})
this.setData({
infoData
})
},
formatPercent(n) {
const rate = Number(n || 0)
return `${rate.toFixed(2)}%`
},
// 展开面板动画
expandPanel(type) {
const contentSelector = type === 'business' ? '.business-content' : '.bottom-content'
const animationKey = type === 'business' ? 'businessAnimation' : 'bottomAnimation'
// 先临时设置为auto高度以获取实际高度
const tempAnimation = wx.createAnimation({
duration: 0,
timingFunction: 'ease'
})
tempAnimation.height('auto').opacity(1).step()
this.setData({
[animationKey]: tempAnimation.export()
})
// 下一帧获取内容实际高度并应用动画
setTimeout(() => {
wx.createSelectorQuery().in(this).select(contentSelector).boundingClientRect((rect) => {
if (rect && rect.height > 0) {
// 先设置为0,然后动画到实际高度
const startAnimation = wx.createAnimation({
duration: 0,
timingFunction: 'ease'
})
startAnimation.height('0px').opacity(0).step()
const endAnimation = wx.createAnimation({
duration: 300,
timingFunction: 'ease'
})
endAnimation.height(rect.height + 'px').opacity(1).step()
this.setData({
[animationKey]: startAnimation.export()
})
setTimeout(() => {
this.setData({
[animationKey]: endAnimation.export()
})
}, 50)
}
}).exec()
}, 50)
},
// 收起面板动画
collapsePanel(type) {
const animationKey = type === 'business' ? 'businessAnimation' : 'bottomAnimation'
const animation = wx.createAnimation({
duration: 300,
timingFunction: 'ease'
})
animation.height('0px').opacity(0).step()
this.setData({
[animationKey]: animation.export()
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-collapse": "@vant/weapp/collapse/index",
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-icon": "@vant/weapp/icon/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageCustomer/components/StoreMessage/StoreMessage.wxss */
.custom-collapse-item .van-collapse-item__content {
background: #fffcf7;
}
.store-message {
background: #FFFFFF;
overflow: hidden;
.cell-title {
display: flex;
justify-content: space-between;
align-items: center;
height: 104rpx;
padding: 0 32rpx;
border-bottom: 0.5px solid #e4e8ee80;
.title-text {
color: #999EA8;
font-size: 28rpx;
}
}
.person-cell {
padding: 32rpx;
display: flex;
justify-content: space-between;
min-height: 104rpx;
.title-text {
flex-shrink: 0;
color: #999EA8;
}
.resident-item {
color: #292D33;
display: flex;
width: calc(100% - 260rpx);
justify-content: flex-end;
.name {
margin-right: 30rpx;
max-width: calc(100% - 260rpx);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.collapse-title {
color: #999EA8;
height: 104rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 32rpx;
border-bottom: 0.5px solid #e4e8ee80;
}
.mar-r20 {
margin-right: 40rpx;
}
.status {
display: flex;
align-items: center;
color: #292D33;
font-size: 28rpx;
image{
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.arrow-icon{
font-size: 26rpx;
color: #C2C7CF;
margin-left: 8rpx;
transition: transform .25s ease;
transform: rotate(180deg);
}
.arrow-icon.open{
transform: rotate(0deg);
}
}
.collapsible-panel {
overflow: hidden;
height: 0;
opacity: 0;
.summary-card {
background: #fffcf7;
padding: 24rpx 32rpx;
.summary-title {
color: #292D33;
font-size: 28rpx;
margin-bottom: 16rpx;
}
.summary-row {
color: #757B85;
font-size: 26rpx;
.red {
color: #F24724;
}
.ml {
margin-left: 40rpx;
}
}
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageCustomer/components/StoreMessage/StoreMessage.wxml-->
<view class="store-message">
<!-- 盈亏情况 -->
<view class="cell-title">
<view class="title-text">盈亏情况</view>
<view class="status">
<image src="{{IMG_URL}}customer/{{infoData.profitAndLoss == 1 ? 'success-icon' : 'warning-icon'}}.png" mode=""/>
<text class="status-text mar-r20">{{ infoData.profitAndLoss == 1 ? '盈利' : '亏损' }}</text>
</view>
</view>
<view class="section">
<view class="collapse-title" bindtap="toggleBusiness" data-has="{{infoData.displaySituationWarningList.length}}">
<view class="title-text">展业情况</view>
<view class="status">
<image src="{{IMG_URL}}customer/{{infoData.displaySituation == 1 ? 'success-icon' : 'warning-icon'}}.png" mode=""/>
<text class="status-text mar-r20" wx:if="{{!infoData.displaySituationWarningCount}}">{{ infoData.displaySituation == 1 ? '正常' : '预警' }}</text>
<text class="status-text {{!infoData.displaySituationWarningList.length ? 'mar-r20' : ''}}" wx:if="{{infoData.displaySituationWarningCount}}">{{infoData.displaySituationWarningCount}}项预警</text>
<image wx:if="{{infoData.displaySituationWarningList.length}}" src="{{IMG_URL}}customer/show-icon.png" class="arrow-icon {{showBusiness ? 'open' : ''}}" mode=""/>
</view>
</view>
<!-- 动画容器:使用小程序animation属性 -->
<view wx:if="{{infoData.displaySituationWarningList.length}}" class="collapsible-panel" animation="{{businessAnimation}}">
<view class="summary-card business-content">
<block wx:for="{{infoData.displaySituationWarningList}}" wx:key="index">
<view class="summary-title">{{item.rule}}</view>
<view class="summary-row">
<text class="label">周期指标:</text>
<text class="value red">{{ item.cycleIndicator }}</text>
<text class="label ml">兜底要求:</text>
<text class="value">{{ item.fallbackIndicator }}</text>
</view>
</block>
</view>
</view>
</view>
<view class="section">
<view class="collapse-title" bindtap="toggleBottom" data-has="{{infoData.safetyIndexWarningList.length}}">
<view class="title-text">兜底指标预警</view>
<view class="status">
<image src="{{IMG_URL}}customer/{{infoData.safetyIndexWarning == 1 ? 'success-icon' : 'warning-icon'}}.png" mode=""/>
<text class="status-text mar-r20" wx:if="{{!infoData.safetyIndexWarningCount}}">{{ infoData.safetyIndexWarning == 1 ? '正常' : '预警' }}</text>
<text wx:if="{{infoData.safetyIndexWarningCount}}">{{infoData.safetyIndexWarningCount}}项预警</text>
<image src="{{IMG_URL}}customer/show-icon.png" class="arrow-icon {{showBottom ? 'open' : ''}}" mode=""/>
</view>
</view>
<view wx:if="{{infoData.safetyIndexWarningList.length}}" class="collapsible-panel" animation="{{bottomAnimation}}">
<view class="summary-card bottom-content">
<block wx:for="{{infoData.safetyIndexWarningList}}" wx:key="index">
<view class="summary-title">{{item.rule}}</view>
<view class="summary-row">
<text class="label">周期指标:</text>
<text class="value red">{{ item.cycleIndicator }}</text>
<text class="label ml">兜底要求:</text>
<text class="value">{{ item.fallbackIndicator }}</text>
</view>
</block>
</view>
</view>
</view>
<!-- 驻店人员 -->
<view class="person-cell">
<view class="title-text">驻店人员</view>
<view class="status" wx:if="{{!infoData.storePersonnel.length}}">
<text class="status-text">无</text>
</view>
<view wx:if="{{infoData.storePersonnel.length}}">
<block wx:for="{{infoData.storePersonnel}}" wx:key="index">
<view class="resident-item">
<text class="name">{{item.personnelName}}</text>
<text class="phone">{{item.personnelMobile}}</text>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageOutput/pages/boutique/components/OutputLine/OutputLine.js
Component({
/**
* 组件的属性列表
*/
properties: {
opts: {
type: Object,
value: {}
},
chartData:{
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"line-echart": "../line/line"
}
}
\ No newline at end of file \ No newline at end of file
.bar-wrap {
padding: 34rpx 30rpx 30rpx 40rpx;
box-sizing: border-box;
.searchList {
display: flex;
align-items: center;
.search-text {
font-weight: 400;
font-size: 28rpx;
color: #A6A6A6;
line-height: 48rpx;
}
.search-text+.search-text {
margin-left: 40rpx;
}
.search-unit {
margin-left: auto;
font-size: 24rpx;
color: #8A8C90;
}
.active {
font-weight: 600;
font-size: 32rpx;
color: #1B233D;
}
}
.searchTime {
padding: 24rpx 0rpx;
display: flex;
align-items: center;
z-index: 9999;
position: relative;
.time {
padding: 6rpx 30rpx;
// border: 2rpx solid #EBEBEB;
// border-radius: 32rpx;
background: #FFFFFF;
border: 2rpx solid #C3C3C3;
border-radius: 6rpx;
font-weight: 400;
font-size: 20rpx;
color: #5A6066;
// color: #A6A6A6;
}
.active {
// background: #4466f01a;
border-color: #fff;
// color: #4466F0;
color: #fff;
background: #3582EE;
border: 2rpx solid #3582EE;
}
.time+.time {
margin-left: 8rpx;
}
.flex {
display: flex;
align-items: center;
position: absolute;
right: 30rpx;
.time-icon {
width: 26rpx;
height: 26rpx;
}
.temporal {
font-size: 22rpx;
color: #A6A6A6;
margin: 0 8rpx;
}
.arrows {
width: 20rpx;
height: 12rpx;
}
}
}
.remind {
color: #D3D3D3;
font-size: 20rpx;
text-align: center;
padding: 24rpx;
}
.container {
height: 370rpx;
}
}
\ No newline at end of file \ No newline at end of file
<view class="bar-wrap">
<view class="container">
<line-echart class="f2-chart" chartData="{{chartData}}" color="{{opts.lineColr}}" tickCount="{{opts.tickCount}}" keys="{{opts.keys}}"/>
</view>
</view>
\ No newline at end of file \ No newline at end of file
import WxCanvas from './wx-canvas';
import * as echarts from './echarts';
let ctx;
function compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
}
Component({
properties: {
canvasId: {
type: String,
value: 'ec-canvas'
},
ec: {
type: Object
},
forceUseOldCanvas: {
type: Boolean,
value: false
}
},
data: {
isUseNewCanvas: false
},
ready: function () {
// Disable prograssive because drawImage doesn't support DOM as parameter
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
echarts.registerPreprocessor(option => {
if (option && option.series) {
if (option.series.length > 0) {
option.series.forEach(series => {
series.progressive = 0;
});
}
else if (typeof option.series === 'object') {
option.series.progressive = 0;
}
}
});
if (!this.data.ec) {
console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
+ 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
return;
}
if (!this.data.ec.lazyLoad) {
this.init();
}
},
methods: {
init: function (callback) {
const version = wx.getSystemInfoSync().SDKVersion
const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
const forceUseOldCanvas = this.data.forceUseOldCanvas;
const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
this.setData({ isUseNewCanvas });
console.log(this.data.isUseNewCanvas)
if (forceUseOldCanvas && canUseNewCanvas) {
console.warn('开发者强制使用旧canvas,建议关闭');
}
if (isUseNewCanvas) {
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
// 2.9.0 可以使用 <canvas type="2d"></canvas>
this.initByNewWay(callback);
} else {
const isValid = compareVersion(version, '1.9.91') >= 0
if (!isValid) {
console.error('微信基础库版本过低,需大于等于 1.9.91。'
+ '参见:https://github.com/ecomfe/echarts-for-weixin'
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
return;
} else {
console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
this.initByOldWay(callback);
}
}
},
initByOldWay(callback) {
// 1.9.91 <= version < 2.9.0:原来的方式初始化
ctx = wx.createCanvasContext(this.data.canvasId, this);
const canvas = new WxCanvas(ctx, this.data.canvasId, false);
echarts.setCanvasCreator(() => {
return canvas;
});
// const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
const canvasDpr = 1
var query = wx.createSelectorQuery().in(this);
query.select('.ec-canvas').boundingClientRect(res => {
if (typeof callback === 'function') {
this.chart = callback(canvas, res.width, res.height, canvasDpr);
}
else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
}
else {
this.triggerEvent('init', {
canvas: canvas,
width: res.width,
height: res.height,
canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
});
}
}).exec();
},
initByNewWay(callback) {
// version >= 2.9.0:使用新的方式初始化
const query = wx.createSelectorQuery().in(this)
query
.select('.ec-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvasNode = res[0].node
this.canvasNode = canvasNode
const canvasDpr = wx.getSystemInfoSync().pixelRatio
const canvasWidth = res[0].width
const canvasHeight = res[0].height
const ctx = canvasNode.getContext('2d')
const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
echarts.setCanvasCreator(() => {
return canvas
})
if (typeof callback === 'function') {
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
} else {
this.triggerEvent('init', {
canvas: canvas,
width: canvasWidth,
height: canvasHeight,
dpr: canvasDpr
})
}
})
},
canvasToTempFilePath(opt) {
if (this.data.isUseNewCanvas) {
// 新版
const query = wx.createSelectorQuery().in(this)
query
.select('.ec-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvasNode = res[0].node
opt.canvas = canvasNode
wx.canvasToTempFilePath(opt)
})
} else {
// 旧的
if (!opt.canvasId) {
opt.canvasId = this.data.canvasId;
}
ctx.draw(true, () => {
wx.canvasToTempFilePath(opt, this);
});
}
},
touchStart(e) {
if (this.chart && e.touches.length > 0) {
var touch = e.touches[0];
var handler = this.chart.getZr().handler;
handler.dispatch('mousedown', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
handler.dispatch('mousemove', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
handler.processGesture(wrapTouch(e), 'start');
}
},
touchMove(e) {
if (this.chart && e.touches.length > 0) {
var touch = e.touches[0];
var handler = this.chart.getZr().handler;
handler.dispatch('mousemove', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
handler.processGesture(wrapTouch(e), 'change');
}
},
touchEnd(e) {
if (this.chart) {
const touch = e.changedTouches ? e.changedTouches[0] : {};
var handler = this.chart.getZr().handler;
handler.dispatch('mouseup', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
handler.dispatch('click', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
handler.processGesture(wrapTouch(e), 'end');
}
}
}
});
function wrapTouch(event) {
for (let i = 0; i < event.touches.length; ++i) {
const touch = event.touches[i];
touch.offsetX = touch.x;
touch.offsetY = touch.y;
}
return event;
}
{ {
"component": true "component": true,
"usingComponents": {}
} }
\ No newline at end of file \ No newline at end of file
<!-- 新的:接口对其了H5 -->
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
<!-- 旧的 -->
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
.ec-canvas {
width: 100%;
height: 100%;
z-index:10;
}
This diff could not be displayed because it is too large.
export default class WxCanvas {
constructor(ctx, canvasId, isNew, canvasNode) {
this.ctx = ctx;
this.canvasId = canvasId;
this.chart = null;
this.isNew = isNew
if (isNew) {
this.canvasNode = canvasNode;
}
else {
this._initStyle(ctx);
}
// this._initCanvas(zrender, ctx);
this._initEvent();
}
getContext(contextType) {
if (contextType === '2d') {
return this.ctx;
}
}
// canvasToTempFilePath(opt) {
// if (!opt.canvasId) {
// opt.canvasId = this.canvasId;
// }
// return wx.canvasToTempFilePath(opt, this);
// }
setChart(chart) {
this.chart = chart;
}
addEventListener() {
// noop
}
attachEvent() {
// noop
}
detachEvent() {
// noop
}
_initCanvas(zrender, ctx) {
zrender.util.getContext = function () {
return ctx;
};
zrender.util.$override('measureText', function (text, font) {
ctx.font = font || '12px sans-serif';
return ctx.measureText(text);
});
}
_initStyle(ctx) {
ctx.createRadialGradient = () => {
return ctx.createCircularGradient(arguments);
};
}
_initEvent() {
this.event = {};
const eventNames = [{
wxName: 'touchStart',
ecName: 'mousedown'
}, {
wxName: 'touchMove',
ecName: 'mousemove'
}, {
wxName: 'touchEnd',
ecName: 'mouseup'
}, {
wxName: 'touchEnd',
ecName: 'click'
}];
eventNames.forEach(name => {
this.event[name.wxName] = e => {
const touch = e.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
};
});
}
set width(w) {
if (this.canvasNode) this.canvasNode.width = w
}
set height(h) {
if (this.canvasNode) this.canvasNode.height = h
}
get width() {
if (this.canvasNode)
return this.canvasNode.width
return 0
}
get height() {
if (this.canvasNode)
return this.canvasNode.height
return 0
}
}
import * as echarts from '../ec-canvas/echarts';
Component({
/**
* 组件的属性列表
*/
properties: {
chartData: {
type: Array,
value: () => []
},
keys: {
type: Array,
value: ['year', 'sales']
},
tickCount: {
type: Number,
value: 5
},
color: {
type: String,
value: '#3975C6'
}
},
observers: {
'chartData': function (data) {
this.initData(data)
},
},
/**
* 组件的初始数据
*/
data: {
ec: {
lazyLoad: true
}
},
/**
* 组件的方法列表
*/
methods: {
onInitChart(xData, yData) {
this.ecComponent && this.ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // new
});
this.setOption(chart, xData, yData);
return chart;
})
},
setOption(chart, xData, yData) {
let maxSpan = xData.length < 10 ? 80 : 20
// let start= xData.length < 10 ? 50 : 80
var option = {
grid: {
left: 8,
right: 30,
top: 30,
bottom: 0,
containLabel: true
},
tooltip: {
trigger: 'axis',
triggerOn: "mousemove",
axisPointer: {
type: "shadow",
shadowStyle: {
shadowColor: 'rgba(53, 195, 118, .1)',
color: 'rgba(53, 195, 118, .1)',
},
lineStyle: {
color: '#35C376',
type: 'shadow'
}
},
position: 'top',
padding: [0, 12],
borderWidth: 2,
borderColor: '#6ED0BE',
borderRadius: 10,
textStyle: {
color: '#6ED0BE',
fontSize: 10
},
position: function (point, params, dom, rect, size) {
// 固定在顶部
return [point[0]-20, '10%'];
},
formatter: function (item) {
return `${item[0].value}`
}
},
xAxis: {
type: 'category',
boundaryGap: false,
// min:1,
// max: 5,
axisLabel: {
fontSize: 11,
color: '#A6A6A6'
},
axisLine: {
show: false //坐标轴线线
},
axisTick: {
show: false //坐标轴刻度
},
data: xData
},
yAxis: {
x: 'center',
type: 'value',
axisLabel: {
fontSize: 11,
color: '#A6A6A6'
},
axisLine: {
show: false //坐标轴线线
},
axisTick: {
show: false //坐标轴刻度
},
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
dataZoom: {
type: "inside",
maxSpan: maxSpan,
// end: 100,
// // start: start,
},
series: [{
data: yData,
type: 'line',
// smooth: true,
color: this.data.color
}]
}
chart.setOption(option)
},
//初始化数据
initData(data) {
const xData = [],
yData = [];
const [x, y] = this.data.keys
data.forEach(item => {
xData.push(item[x])
yData.push(item[y])
})
this.setData({
xData,
yData
})
this.onInitChart(xData, yData)
},
},
ready() {
// 获取组件
this.ecComponent = this.selectComponent('#mychart-dom-line');
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"ec-canvas": "../ec-canvas/ec-canvas"
}
}
ec-canvas {
width: 100%;
height: 100%;
}
\ No newline at end of file \ No newline at end of file
<!--packageOutput/components/line/line.wxml-->
<ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas>
.merchant-info-detail { .merchant-info-detail {
box-sizing: border-box; box-sizing: border-box;
margin-bottom: 200rpx;
background: #FFFFFF;
width: 100%; width: 100%;
padding: 24rpx 32rpx 32rpx 32rpx;
} }
.section { .section {
margin: 16rpx 16rpx 24rpx; margin: 16rpx 16rpx 24rpx;
border-bottom: 1rpx solid #E4E8EE; border-bottom: 1rpx solid #E4E8EE80;
&:last-child { &:last-child {
border-bottom: 0; border-bottom: 0;
margin-bottom: 0; margin-bottom: 0;
...@@ -40,7 +43,6 @@ ...@@ -40,7 +43,6 @@
.photo-wrap { .photo-wrap {
padding: 12rpx; padding: 12rpx;
width: 100%; width: 100%;
background: #F7F8FA;
border-radius: 8rpx; border-radius: 8rpx;
.photo { .photo {
width: 72rpx; width: 72rpx;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="card"> <view class="card">
<view class="row"> <view class="row">
<view class="label">门店名称</view> <view class="label">门店名称</view>
<view class="value">{{detail.shopName || '-'}}</view> <view class="value">{{detail.storeName || '-'}}</view>
</view> </view>
<view class="row"> <view class="row">
<view class="label">业务类型</view> <view class="label">业务类型</view>
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
<view class="card"> <view class="card">
<view class="row"> <view class="row">
<view class="label">所在地区</view> <view class="label">所在地区</view>
<view class="value">{{detail.region || '-'}}</view> <view class="value">{{detail.provinceName || ''}}{{detail.city || ''}}{{detail.districtName || ''}}</view>
</view> </view>
<view class="row"> <view class="row">
<view class="label">详细地址</view> <view class="label">详细地址</view>
<view class="value">{{detail.addressDetail || '-'}}</view> <view class="value">{{detail.address || '-'}}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -55,24 +55,24 @@ ...@@ -55,24 +55,24 @@
</view> </view>
<view class="row note-row"> <view class="row note-row">
<view class="label">备注信息</view> <view class="label">备注信息</view>
<view class="value">{{detail.note || '-'}} <view class="value">{{detail.remark || '-'}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 联系人(根据配置页面生成的角色) --> <!-- 联系人(根据配置页面生成的角色) -->
<block wx:for="{{managers}}" wx:for-item="m" wx:key="role"> <block wx:for="{{detail.salePotentialCustomerPersonnelInfoDTOList}}" wx:for-item="m" wx:key="role">
<view class="section"> <view class="section">
<view class="section-title">{{m.role}}</view> <view class="section-title">{{m.roleName}}</view>
<view class="card"> <view class="card">
<view class="row"> <view class="row">
<view class="label">名称</view> <view class="label">名称</view>
<view class="value">{{m.name || '未配置'}}</view> <view class="value">{{m.personnelName}}</view>
</view> </view>
<view class="row"> <view class="row">
<view class="label">手机号</view> <view class="label">手机号</view>
<view class="value">{{m.phone || '未配置'}}</view> <view class="value">{{m.personnelPhone}}</view>
</view> </view>
</view> </view>
</view> </view>
......
// packageCustomer/pages/createPotential/createPotential.js // packageCustomer/pages/createPotential/createPotential.js
import { IMG_URL, SCENELIST, COOPERATIONMODELIST, TRSFFICSTATUSLIST, ROLELIST } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
import { commonApi } from "~/api/api"
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
IMG_URL,
navHeight: 0,
pageType: 'create',
baseForm: [
{ label: '门店名称', key: 'storeName', type: 'textarea', maxLength: 20 },
{ label: '业务类型', key: 'bizType', type: 'select', callback: 'changeScene' },
{ label: '合作模式', key: 'coopMode', type: 'select', callback: 'changecoopMode' },
{ label: '主营品牌', key: 'mainCategory', type: 'select', callback: 'changemainCategory' },
{ label: '流量情况', key: 'flowScale', type: 'select', callback: 'changeFlowScale' }
],
addressForm: [{
label: '所在地区',
key: 'area',
type: 'select',
callback: 'changeArea'
}, {
label: '详细地址',
key: 'address',
type: 'textarea',
maxLength: 30
}],
infoData: {},
remarkLength: 0,
managerRoles: ROLELIST
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) { onLoad(options) {
let { pageType, query } = options
if (query) {
const pageQuery = JSON.parse(decodeURIComponent(query))
this.setData({pageQuery})
// 获取潜客详情数据
this.getDetail(pageQuery)
}
// 假数据
this.getDetail()
this.setData({
pageType
})
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() { onReady() {
}, },
/**
* 生命周期函数--监听页面显示
*/
onShow() { onShow() {
}, },
/** getDetail(par) {
* 生命周期函数--监听页面隐藏 // 假数据
*/ const res = {
code: 0,
message: '',
data: {
status: 1,
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}, {
businessSceneType: 3
}, {
businessSceneType: 4
}, {
businessSceneType: 5
}],
brandList: [{
mainBrandId: 2978,
mainBrand: '鸿蒙智行',
subBrandName: '问界',
subBrandId: 3454
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
districtId: 440305,
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
}
// 处理数据
this.progressData(res.data)
return
CustomerApi.getMaterialData({}).then(res => {
})
},
progressData(data) {
console.log(data)
const businessSceneNames = {0: '轻改', 1: '权益', 2: '延保'}
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
data.bizType_value = data?.businessTypeList?.map(val => { return val.businessSceneType })
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
data.coopMode_value = data?.cooperationModeList?.map(val => { return val.directSalesFlag })
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
let selectedMainBrand = []
data?.brandList?.forEach(val => {
val.children = [{id: val.subBrandId, name: val.subBrandName}]
val.id = val.mainBrandId
val.name = val.mainBrand
selectedMainBrand.push(val)
})
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
data.flowScale_value = [data.flowSituation]
data.area = `${data.provinceName} ${data.city} ${data.districtName}`
data.attachmentList = [data.storePhoto]
this.setData({
infoData: data,
selectedMainBrand,
remarkLength: data.remark?.length
})
},
onInput(e) {
const key = e.currentTarget?.dataset?.key || ''
let val = e.detail?.value || ''
val = val.replace(/[\u0020\u00A0\u3000]/g, '')
let maxLen
const baseForm = this.data.baseForm || []
const found = baseForm.find(i => i.key === key && typeof i.maxLength === 'number')
if (found) maxLen = found.maxLength
if (val.length > maxLen) {
val = val.slice(0, maxLen)
}
this.setData({ [`infoData.${key}`]: val })
},
// 备注输入框
onRemarkInput(e) {
let val = e.detail.value || ""
if (val.length > 200) {
val = val.substring(0, 200)
}
this.setData({
'infoData.remark': val,
remarkLength: val.length
})
},
showPopup(e) {
let { type } = e.currentTarget.dataset
console.log(type)
if (!type) return
this[type]()
},
// 选择主营品牌
changemainCategory() {
this.setData({
carBrandPopupShow: true
})
},
hideBrandPopup() {
this.setData({
carBrandPopupShow: !this.data.carBrandPopupShow
})
},
brandConfirm() {
let brandMoudle = this.selectComponent('#car-brand')
const selected = brandMoudle && brandMoudle.handleConfirm() || []
let arr = []
selected?.forEach(val => {
val.children?.forEach(v => {
arr.push(`${val.name}-${v.name}`)
})
})
this.setData({
'infoData.mainCategory': arr?.join('/'),
selectedMainBrand: selected
})
console.log(selected)
this.hideBrandPopup()
},
// 选择业务类型
changeScene() {
this.setData({
showSelectPopup: true,
selectOptions: SCENELIST,
selectTitle: '选择业务类型',
selectMultiple: true,
selectType: 'bizType',
selectValues: this.data.infoData['bizType_value'] || []
})
},
// 选择合作模式
changecoopMode() {
this.setData({
showSelectPopup: true,
selectOptions: COOPERATIONMODELIST,
selectTitle: '选择合作模式',
selectMultiple: false,
selectType: 'coopMode',
selectValue: this.data.infoData['coopMode_value'] || null
})
},
// 选择流量情况
changeFlowScale() {
this.setData({
showSelectPopup: true,
selectOptions: TRSFFICSTATUSLIST,
selectTitle: '选择流量情况',
selectMultiple: false,
selectType: 'flowScale',
selectValue: this.data.infoData['flowScale_value'] || null
})
},
handlePopupConfirm(e) {
const { values, items } = e.detail
let { selectType } = this.data
this.setData({
[`infoData.${selectType}`]: items?.map(val => { return val.name })?.join('/'),
[`infoData.${selectType}_value`]: values
})
this.hideSelectPopup()
},
hideSelectPopup() {
this.setData({
showSelectPopup: false
})
},
// 选择所在地区
showArea(e) {
let { type } = e.currentTarget.dataset
if (type != 'select') return
this.setData({
showSelectArea: true
})
},
areaConfirm(e) {
const { names, codes } = e.detail
console.log(e.detail)
this.setData({
'infoData.area': names?.join(' '),
'infoData.area_value': codes,
'infoData.area_name': names
})
this.areaCancel()
},
areaCancel() {
this.setData({
showSelectArea: false
})
},
changeManage(e) {
let { target, index } = e.currentTarget.dataset
this.setData({
[`managerRoles[${index}].checked`]: !target.checked
})
},
// 上传图片
uploadImages() {
let _this = this
wx.chooseImage({
count: 1,
success(res) {
console.log(res)
let [tempFiles] = res.tempFilePaths
let tempFilesList = tempFiles.split('.')
let imgType = tempFilesList[tempFilesList.length - 1]
let type = imgType == 'unknown' ? 'jpg' : imgType
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$api.showLoading('上传中...')
commonApi.uploadImg({
file: `${type}@${_res.data}`
}).then(img => {
wx.$api.hideLoading()
_this.setData({
'infoData.attachmentList': [img]
})
})
}
})
},
fail(err) {
console.log(err)
}
})
},
// 图片预览
previewImage(e) {
let { url, index } = e.currentTarget.dataset
let imageUrl = url?.map(v => { return v})
wx.previewImage({
urls: imageUrl,
current: imageUrl[index]
})
},
// 删除图片
deleteFile(e) {
let { index } = e.currentTarget.dataset
let { infoData } = this.data
infoData.attachmentList.splice(index, 1)
this.setData({infoData})
},
manangeInput(e) {
let { type, index } = e.currentTarget.dataset
let { managerRoles } = this.data
let value = e.detail.value
value = value.replace(/\s+/g, '')
if (managerRoles[index]) {
managerRoles[index][type] = value
this.setData({
[`managerRoles[${index}].${type}`]: value
})
}
},
handleCancel() {
wx.navigateBack()
},
handleConfirm() {
let { infoData, managerRoles } = this.data
if (!infoData.storeName || !infoData.bizType || !infoData.coopMode || !infoData.mainCategory || !infoData.flowScale || !infoData.area || !infoData.address) return wx.$api.showToast('请填入必填信息')
console.log(managerRoles)
const phoneRex = /^[1]([3-9])[0-9]{9}$/
for (const item of (managerRoles || [])) {
if (item.checked && item.personnelPhone) {
if (!phoneRex.test(item.personnelPhone)) {
wx.$api.showToast("请填写正确手机号")
return false
}
}
}
const {
storeName,
bizType_value,
coopMode_value,
flowScale_value,
area_value = [],
area_name = [],
address,
attachmentList,
remark
} = infoData
// 空值处理函数
const getValue = (value, defaultValue = '') => value ?? defaultValue
let params = {
storeName: getValue(storeName),
businessTypeList: getValue(bizType_value?.join(',')),
cooperationMode: getValue(coopMode_value?.[0]),
flowSituation: getValue(flowScale_value?.[0]),
provinceId: getValue(area_value[0]),
provinceName: getValue(area_name[0]),
cityId: getValue(area_value[1]),
city: getValue(area_name[1]),
districtId: getValue(area_value[2]),
districtName: getValue(area_name[2]),
address: getValue(address),
storePhoto: getValue(attachmentList?.[0]),
remark: getValue(remark),
alePotentialCustomerPersonnelInfoDTOList: managerRoles
.filter(val => val.checked && (val.personnelName || val.personnelPhone))
.map(val => ({
personnelName: getValue(val.personnelName),
personnelPhone: getValue(val.personnelPhone),
personnelType: getValue(val.value)
}))
}
console.log(params)
const methodName = this.data.pageQuery ? 'editCustomer' : 'addCustomer'
CustomerApi[methodName](params).then(res => {
})
},
onHide() { onHide() {
}, },
/**
* 生命周期函数--监听页面卸载
*/
onUnload() { onUnload() {
}, },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() { onPullDownRefresh() {
}, },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() { onReachBottom() {
}, },
/**
* 用户点击右上角分享
*/
onShareAppMessage() { onShareAppMessage() {
} },
}) })
\ No newline at end of file \ No newline at end of file
{ {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": {} "usingComponents": {
"car-brand": "/components/CarBrand/CarBrand",
"select-popup": "../../components/SelectPopup/SelectPopup",
"select-area": "../../components/SelectArea/SelectArea"
}
} }
\ No newline at end of file \ No newline at end of file
/* packageCustomer/pages/createPotential/createPotential.wxss */ /* packageCustomer/pages/createPotential/createPotential.wxss */
.potential-create {
background: #F7F8FA;
padding-bottom: 200rpx;
.card {
margin: 24rpx 20rpx;
background: #FFFFFF;
border-radius: 16rpx;
box-sizing: border-box;
padding-bottom: 32rpx;
.section-title {
padding-left: 40rpx;
height: 82rpx;
display: flex;
align-items: center;
font-size: 24rpx;
color: #999EA8;
}
.row {
display: flex;
align-items: flex-start;
justify-content: space-between;
border-bottom: 0.5px solid #EFF0F280;
padding: 32rpx 40rpx;
color: #292D33;
.label {
flex-shrink: 0;
width: 168rpx;
margin-right: 10rpx;
.star {
color: #F24724;
}
}
.value {
display: flex;
align-items: center;
justify-content: flex-end;
width: calc(100% - 178rpx);
.placeholder-class {
color: #BEC1C7;
font-size: 28rpx;
}
.placeholder {
color: #BEC1C7;
font-size: 28rpx;
}
.textarea {
text-align: right;
font-size: 28rpx;
min-height: 40rpx;
line-height: 40rpx;
width: 100%;
}
image {
flex-shrink: 0;
width: 32rpx;
height: 32rpx;
}
}
}
.no-border {
border-bottom: none;
}
.uploader-wrap {
padding: 0 0 32rpx 40rpx;
border-bottom: 1rpx solid #EFF0F280;
.image_content {
width: 160rpx;
height: 160rpx;
position: relative;
.image_box {
width: 100%;
height: 100%;
}
.del_icon {
width: 40rpx;
height: 40rpx;
position: absolute;
top: 10rpx;
right: 10rpx;
}
}
.upload_content {
width: 160rpx;
height: 160rpx;
display: flex;
align-items: center;
justify-content: center;
background: #EFF0F2;
border-radius: 8rpx;
image {
width: 56rpx;
height: 56rpx;
}
}
}
.textarea-wrap {
position: relative;
padding: 0 40rpx;
.textarea {
width: 100%;
min-height: 200rpx;
border-radius: 12rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.input-ph {
color: #BEC1C7;
}
.counter {
position: absolute;
right: 40rpx;
bottom: 10rpx;
color: #AAB0B7;
font-size: 28rpx;
}
}
.manange-box {
.item {
.check-box {
display: flex;
align-items: center;
height: 86rpx;
color: #292D33;
font-size: 26rpx;
padding: 0 40rpx;
image {
width: 32rpx;
height: 32rpx;
margin-right: 16rpx;
}
}
.row {
display: flex;
align-items: center;
justify-content: space-between;
.label {
width: 84rpx;
flex-shrink: 0;
margin-right: 10rpx;
}
.value {
.input {
width: calc(100% - 100rpx);
text-align: right;
}
}
}
&:last-child{
.row {
border-bottom: none;
}
}
}
}
}
.btn {
position: fixed;
bottom: 0;
left: 0;
width: calc(100% - 64rpx);
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
background: #FFFFFF;
padding: 20rpx 32rpx;
display: flex;
align-items: center;
z-index: 100;
.cancel {
width: 184rpx;
background: #F4F5F7;
border-radius: 12rpx;
color: #292D33;
margin-right: 22rpx;
}
.confirm {
width: 480rpx;
background: #347BFF;
border-radius: 12rpx;
color: #FFFFFF;
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageCustomer/pages/createPotential/createPotential.wxml--> <!--packageCustomer/pages/createPotential/createPotential.wxml-->
<navigation-bar showBack="{{true}}" bind:navbarReady="onNavbarReady">新增潜客</navigation-bar>
\ No newline at end of file \ No newline at end of file
<glsx-privacy appletName="销售助手" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<navigation-bar showBack="{{true}}" bind:navbarReady="onNavbarReady">{{pageType == 'edit' ? '信息完善' : '新增潜客'}}</navigation-bar>
<view class="potential-create" style="padding-top: {{navHeight}}px;">
<view class="card">
<view class="section-title">基本信息</view>
<block wx:for="{{baseForm}}" wx:key="index">
<view class="row">
<view class="label">{{item.label}} <text class="star">*</text></view>
<view class="value" bindtap="showPopup" data-type="{{item.callback}}">
<block wx:if="{{item.type == 'textarea'}}">
<textarea value="{{infoData[item.key]}}" class="textarea" placeholder="请输入" placeholder-class="placeholder-class" auto-height="true" maxlength="{{item.maxLength}}" cursor-spacing="16" bindinput="onInput" data-key="{{item.key}}"/>
</block>
<block wx:else>
<block wx:if="{{infoData[item.key]}}">
<text style="word-break: break-all;">{{infoData[item.key]}}</text>
</block>
<block wx:else>
<text class="placeholder">点击选择</text>
</block>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</block>
</view>
</view>
</block>
<view class="section-title">地址信息</view>
<block wx:for="{{addressForm}}" wx:key="index">
<view class="row">
<view class="label">{{item.label}} <text class="star">*</text></view>
<view class="value" bindtap="showArea" data-type="{{item.type}}">
<block wx:if="{{item.type == 'textarea'}}">
<textarea value="{{infoData[item.key]}}" class="textarea" placeholder="请输入" placeholder-class="placeholder-class" auto-height="true" maxlength="{{item.maxLength}}" cursor-spacing="16" bindinput="onInput" data-key="{{item.key}}"/>
</block>
<block wx:else>
<block wx:if="{{infoData[item.key]}}">
<text>{{infoData[item.key]}}</text>
</block>
<block wx:else>
<text class="placeholder">点击选择</text>
</block>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</block>
</view>
</view>
</block>
<view class="row no-border">
<view class="label">店面门头照片</view>
</view>
<view class="uploader-wrap">
<view class="content_box">
<view class="image_content" wx:for="{{infoData.attachmentList}}" wx:key="index">
<image bindtap="previewImage" class="image_box" data-url="{{infoData.attachmentList}}" data-index="{{index}}" src="{{item}}"/>
<image class="del_icon" src="{{IMG_URL}}customer/del-icon.png" mode="" bindtap="deleteFile" data-index="{{index}}" />
</view>
<view class="upload_content" bindtap="uploadImages" wx:if="{{!infoData.attachmentList.length}}">
<image src="{{IMG_URL}}customer/add-icon.png"></image>
</view>
</view>
</view>
<view class="row no-border">
<view class="label">备注信息</view>
</view>
<view class="textarea-wrap">
<textarea class="textarea" maxlength="200" placeholder="请输入" placeholder-class="input-ph" value="{{infoData.remark}}" bindinput="onRemarkInput" />
<view class="counter">{{remarkLength}}/200</view>
</view>
</view>
<view class="card">
<view class="manange-box">
<block wx:for="{{managerRoles}}" wx:key="index">
<view class="item">
<view class="check-box" bindtap="changeManage" data-target="{{item}}" data-index="{{index}}">
<image wx:if="{{!item.checked}}" src="{{IMG_URL}}customer/check.png" mode=""/>
<image wx:else src="{{IMG_URL}}customer/check-active.png" mode=""/>
<view class="label">{{item.label}}</view>
</view>
<block wx:if="{{item.checked}}">
<view class="row">
<view class="label">名称</view>
<view class="value">
<input value="{{item.personnelName}}" class="input" bindinput="manangeInput" data-index="{{index}}" data-type="personnelName" placeholder="请输入" placeholder-class="placeholder-class" maxlength="{{10}}" />
</view>
</view>
<view class="row">
<view class="label">手机号</view>
<view class="value">
<input value="{{item.personnelPhone}}" class="input" bindinput="manangeInput" data-index="{{index}}" data-type="personnelPhone" type="number" placeholder="请输入" placeholder-class="placeholder-class" maxlength="{{11}}" />
</view>
</view>
</block>
</view>
</block>
</view>
</view>
<view class="isFullSucreen btn">
<view class="cancel" bindtap="handleCancel">取消</view>
<view class="confirm" bindtap="handleConfirm">提交</view>
</view>
</view>
<popup show="{{carBrandPopupShow}}" title="选择品牌" bind:hidePopup="hideBrandPopup" customPopupSlotStyle="{{'height: calc(100% - 282rpx)'}}" bindconfirm="brandConfirm" height="90%">
<car-brand id="car-brand" popupShow="{{carBrandPopupShow}}" multiple selectedList="{{selectedMainBrand}}"></car-brand>
</popup>
<select-popup show="{{showSelectPopup}}" options="{{selectOptions}}" multiple="{{selectMultiple}}" values="{{selectValues}}" value="{{selectValue}}" bindconfirm="handlePopupConfirm" title="{{selectTitle}}"></select-popup>
<select-area show="{{showSelectArea}}" bindconfirm="areaConfirm" bindcancel="areaCancel" value="{{infoData.districtId || ''}}"></select-area>
\ No newline at end of file \ No newline at end of file
// packageCustomer/pages/createVisit/createVisit.js // packageCustomer/pages/createVisit/createVisit.js
import mapApi from "~/utils/mapapi/mapapi"; import mapApi from "~/utils/mapapi/mapapi";
import { IMG_URL } from '~/utils/constantData' import { IMG_URL } from '~/utils/constantData'
import { commonApi } from "~/api/api"
import CustomerApi from "~/api/customerApi/index"
Page({ Page({
data: { data: {
IMG_URL: IMG_URL, IMG_URL: IMG_URL,
navHeight: 0, navHeight: 0,
showTimePicker: false, timeVisible: false,
timeValue: Date.now(), currentDate: new Date().getTime(),
minDate: new Date(2000, 0, 1).getTime(), minDate: new Date().getTime() - 365 * 24 * 60 * 60 * 1000,
maxDate: new Date(2100, 0, 1).getTime(), maxDate: new Date().getTime() + 365 * 24 * 60 * 60 * 1000,
visitTimeText: "", selectedTime: '', // 存储已选择的时间
contactName: "", tempTime: '',
content: "",
contentLength: 0, contentLength: 0,
fileList: [], fileList: [],
locationName: "", locationName: "",
...@@ -24,7 +25,6 @@ Page({ ...@@ -24,7 +25,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
}, },
onReady() { onReady() {
...@@ -43,6 +43,78 @@ Page({ ...@@ -43,6 +43,78 @@ Page({
this.setData({ navHeight: height || 0 }); this.setData({ navHeight: height || 0 });
}, },
openTimePicker() {
let initialDate;
let initialFormattedTime;
if (this.data.selectedTime) {
// 如果已有选择的时间,使用已选择的时间
initialDate = this.dateTimeToTimestamp(this.data.selectedTime);
initialFormattedTime = this.data.selectedTime;
} else {
// 如果没有选择过,使用当前时间
const now = new Date();
initialDate = now.getTime();
initialFormattedTime = this.formatDateTime(now);
}
this.setData({
timeVisible: true,
currentDate: initialDate,
tempTime: initialFormattedTime
});
},
// 弹窗确认事件
popupConfirm() {
this.setData({
selectedTime: this.data.tempTime, // 保存选择的时间
timeVisible: false,
'infoData.visitTimeText': this.data.tempTime
})
},
onChange(e) {
const values = e.detail.getValues()
const formattedTime = this.valuesToDateTime(values)
this.setData({
tempTime: formattedTime
})
},
cancel() {
this.setData({
timeVisible: false
})
},
// 将 yyyy-mm-dd hh:mm 转换为时间戳
dateTimeToTimestamp(dateTimeStr) {
if (!dateTimeStr) return new Date().getTime()
const [datePart, timePart] = dateTimeStr.split(' ')
const [year, month, day] = datePart.split('-')
const [hour, minute] = timePart.split(':')
return new Date(year, month - 1, day, hour, minute).getTime()
},
formatDateTime(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hour = String(date.getHours()).padStart(2, '0')
const minute = String(date.getMinutes()).padStart(2, '0')
return `${year}-${month}-${day} ${hour}:${minute}`
},
valuesToDateTime(values) {
const [year, month, day, hour, minute] = values.map(item => {
return item.replace(/[年月日时分]/g, '').padStart(2, '0')
});
return `${year}-${month}-${day} ${hour}:${minute}`
},
onContactInput(e) { onContactInput(e) {
this.setData({ this.setData({
'infoData.contactName': e.detail.value 'infoData.contactName': e.detail.value
...@@ -50,17 +122,15 @@ Page({ ...@@ -50,17 +122,15 @@ Page({
}, },
onContentInput(e) { onContentInput(e) {
const val = e.detail.value || "" let val = e.detail.value || ""
if (val.length > 100) {
val = val.substring(0, 100)
}
this.setData({ this.setData({
'infoData.content': val, 'infoData.content': val,
contentLength: val.length contentLength: val.length
}) })
}, },
copy() {
wx.setClipboardData({
data: 1111,
})
},
// 上传图片 // 上传图片
uploadImages() { uploadImages() {
...@@ -77,23 +147,14 @@ Page({ ...@@ -77,23 +147,14 @@ Page({
filePath: tempFiles, //选择图片返回的相对路径 filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式 encoding: 'base64', //编码格式
success(_res) { success(_res) {
wx.$util.showLoading('上传中...') wx.$api.showLoading('上传中...')
uploadImg({ commonApi.uploadImg({
file: `${type}@${_res.data}` file: `${type}@${_res.data}`
}).then(img => { }).then(img => {
wx.$util.hideLoading() wx.$api.hideLoading()
let {
code,
data,
message
} = img
if (code == 0) {
_this.setData({ _this.setData({
'infoData.attachmentList': data 'infoData.attachmentList': [img]
}) })
} else {
wx.$util.showToast(message)
}
}) })
} }
}) })
...@@ -107,7 +168,7 @@ Page({ ...@@ -107,7 +168,7 @@ Page({
// 图片预览 // 图片预览
previewImage(e) { previewImage(e) {
let { url, index } = e.currentTarget.dataset let { url, index } = e.currentTarget.dataset
let imageUrl = url?.map(v => { return v.fileUrl}) let imageUrl = url?.map(v => { return v})
wx.previewImage({ wx.previewImage({
urls: imageUrl, urls: imageUrl,
current: imageUrl[index] current: imageUrl[index]
...@@ -126,8 +187,8 @@ Page({ ...@@ -126,8 +187,8 @@ Page({
try { try {
const loc = await wx.getLocation({ type: "gcj02" }) const loc = await wx.getLocation({ type: "gcj02" })
const { latitude, longitude } = loc const { latitude, longitude } = loc
const res = await mapApi.detailedAdrress({ location: `${latitude},${longitude}` }) const res = await mapApi.detailedAdrress([latitude, longitude])
const locationName = res?.result?.address || res?.result?.formatted_addresses?.recommend || "已定位" const locationName = res?.formatted_addresses || res?.address || "已定位"
this.setData({ latitude, longitude, locationName }) this.setData({ latitude, longitude, locationName })
} catch (err) { } catch (err) {
wx.showToast({ title: "定位失败,请检查权限", icon: "none" }) wx.showToast({ title: "定位失败,请检查权限", icon: "none" })
...@@ -145,7 +206,18 @@ Page({ ...@@ -145,7 +206,18 @@ Page({
handleConfirm() { handleConfirm() {
const { infoData } = this.data const { infoData } = this.data
if (!infoData.visitTimeText || !infoData.contactName || !infoData.content) return wx.$api.showToast("请输入必填信息") if (!infoData.visitTimeText || !infoData.contactName || !infoData.content) return wx.$api.showToast("请输入必填信息")
const res = {code: 1} let params = {
visitTime: infoData.visitTimeText,
contactPerson: infoData.contactName,
visitContent: infoData.content,
visitPhotos: infoData.attachmentList || [],
checkInLocation: infoData.locationName
}
console.log(params, this.resultDialog)
// CustomerApi.addVisit(params).then(res => {
// })
const res = {code: 0}
const okText = '我知道了' const okText = '我知道了'
if (this.resultDialog) { if (this.resultDialog) {
if (res.code == 0) { if (res.code == 0) {
......
{ {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"result-dialog": "../../components/ResultDialog/index" "result-dialog": "../../components/ResultDialog/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -18,15 +18,19 @@ page { ...@@ -18,15 +18,19 @@ page {
justify-content: space-between; justify-content: space-between;
height: 96rpx; height: 96rpx;
padding: 0 40rpx; padding: 0 40rpx;
border-bottom: 1rpx solid #EFF0F2; border-bottom: 1rpx solid #EFF0F280;
font-size: 28rpx;
.label { .label {
color: #1A2233; color: #1A2233;
font-size: 30rpx; width: 140rpx;
flex-shrink: 0;
.star { color: #F24724; } .star { color: #F24724; }
} }
.value { .value {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end;
width: calc(100% - 158rpx);
.placeholder { .placeholder {
color: #BEC1C7; color: #BEC1C7;
font-size: 28rpx; font-size: 28rpx;
...@@ -35,8 +39,10 @@ page { ...@@ -35,8 +39,10 @@ page {
text-align: right; text-align: right;
font-size: 28rpx; font-size: 28rpx;
padding: 16rpx 0; padding: 16rpx 0;
width: 100%;
} }
image { image {
flex-shrink: 0;
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
} }
...@@ -52,7 +58,7 @@ page { ...@@ -52,7 +58,7 @@ page {
} }
.textarea-wrap { .textarea-wrap {
position: relative; position: relative;
border-bottom: 1rpx solid #EFF0F2; border-bottom: 1rpx solid #EFF0F280;
padding: 0 40rpx; padding: 0 40rpx;
.textarea { .textarea {
width: 100%; width: 100%;
...@@ -80,6 +86,22 @@ page { ...@@ -80,6 +86,22 @@ page {
.uploader-wrap { .uploader-wrap {
padding: 0 0 32rpx 40rpx; padding: 0 0 32rpx 40rpx;
border-bottom: 1rpx solid #EFF0F2; border-bottom: 1rpx solid #EFF0F2;
.image_content {
width: 160rpx;
height: 160rpx;
position: relative;
.image_box {
width: 100%;
height: 100%;
}
.del_icon {
width: 40rpx;
height: 40rpx;
position: absolute;
top: 10rpx;
right: 10rpx;
}
}
.upload_content { .upload_content {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
...@@ -115,6 +137,7 @@ page { ...@@ -115,6 +137,7 @@ page {
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
z-index: 100;
.cancel { .cancel {
width: 184rpx; width: 184rpx;
background: #F4F5F7; background: #F4F5F7;
......
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
<text wx:if="{{infoData.visitTimeText}}" class="value-text">{{infoData.visitTimeText}}</text> <text wx:if="{{infoData.visitTimeText}}" class="value-text">{{infoData.visitTimeText}}</text>
<block wx:else> <block wx:else>
<text class="placeholder">点击选择</text> <text class="placeholder">点击选择</text>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</block> </block>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view> </view>
</view> </view>
<view class="row"> <view class="row">
...@@ -25,7 +24,7 @@ ...@@ -25,7 +24,7 @@
<view class="label">拜访内容 <text class="star">*</text></view> <view class="label">拜访内容 <text class="star">*</text></view>
</view> </view>
<view class="textarea-wrap"> <view class="textarea-wrap">
<textarea class="textarea" maxlength="100" placeholder="请输入" placeholder-class="input-ph" value="{{infoData.content}}" bindinput="onContentInput" /> <textarea class="textarea" placeholder="请输入" placeholder-class="input-ph" value="{{infoData.content}}" bindinput="onContentInput" />
<view class="counter">{{contentLength}}/100</view> <view class="counter">{{contentLength}}/100</view>
</view> </view>
<view class="row no-border"> <view class="row no-border">
...@@ -34,13 +33,12 @@ ...@@ -34,13 +33,12 @@
<view class="uploader-wrap"> <view class="uploader-wrap">
<view class="content_box"> <view class="content_box">
<view class="image_content" wx:for="{{infoData.attachmentList}}" wx:key="index"> <view class="image_content" wx:for="{{infoData.attachmentList}}" wx:key="index">
<image bindtap="previewImage" class="image_box" data-url="{{infoData.attachmentList}}" data-index="{{index}}" src="{{item.fileUrl}}"/> <image bindtap="previewImage" class="image_box" data-url="{{infoData.attachmentList}}" data-index="{{index}}" src="{{item}}"/>
<image class="del_icon" src="{{IMG_URL}}customer/del-icon.png" mode="" bindtap="deleteFile" data-index="{{index}}" /> <image class="del_icon" src="{{IMG_URL}}customer/del-icon.png" mode="" bindtap="deleteFile" data-index="{{index}}" />
</view> </view>
<view class="upload_content" bindtap="uploadImages" wx:if="{{!infoData.attachmentList.length}}"> <view class="upload_content" bindtap="uploadImages" wx:if="{{!infoData.attachmentList.length}}">
<image src="{{IMG_URL}}customer/add-icon.png"></image> <image src="{{IMG_URL}}customer/add-icon.png"></image>
</view> </view>
<view bindtap="copy">fuzh</view>
</view> </view>
</view> </view>
<view class="row no-border"> <view class="row no-border">
...@@ -61,3 +59,6 @@ ...@@ -61,3 +59,6 @@
</view> </view>
<!-- 结果弹窗组件:统一反馈弹窗 --> <!-- 结果弹窗组件:统一反馈弹窗 -->
<result-dialog id="resultDialog" bind:ok="onDialogOk" bind:close="onDialogClose" /> <result-dialog id="resultDialog" bind:ok="onDialogOk" bind:close="onDialogClose" />
<popup bind:hidePopup="cancel" bind:confirm="popupConfirm" show="{{timeVisible}}" title="拜访时间" height="50vh">
<van-datetime-picker id="datePicker" show-toolbar="{{false}}" min-date="{{ minDate }}" max-date="{{ maxDate }}" model:value="{{ currentDate }}" type="datetime" bind:change="onChange"/>
</popup>
\ No newline at end of file \ No newline at end of file
// packageCustomer/pages/merchantDetail/merchantDetail.js
import CustomerApi from "~/api/customerApi/index"
import { IMG_URL, COOPERATIONMODELIST, TRSFFICSTATUSLIST, SCENELIST, ROLELIST } from '~/utils/constantData'
Page({
options: {
styleIsolation: 'shared'
},
/**
* 页面的初始数据
*/
data: {
IMG_URL: IMG_URL,
listTabs: ['KPI进度', '经营指标', '门店信息', '资料详情'],
tabIndex: 3,
infoDetail: {},
statusText: {
1: {label: '老店', color: '#347BFF', background: '#347bff14'},
2: {label: '新店', color: '#35C376', background: '#35c37614'}
},
scrollTop: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// let { query } = options
// if (query) {
// const pageQuery = JSON.parse(decodeURIComponent(query))
// this.setData({pageQuery})
// }
this.getMerchantDetail()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
},
onScroll(e) {
const scrollTop = e.detail.scrollTop
this.setData({ scrollTop })
},
recordTabTop() {
const query = wx.createSelectorQuery().in(this)
query.select('.tabbar-anchor').boundingClientRect()
query.exec(res => {
const top = res[0]?.top
const height = res[0]?.height
this.setData({
initialTabTop: top,
tabHeight: height
})
})
},
buildInfoBoard() {
const { infoDetail } = this.data
const items = [
{ label: '主营品牌', value: infoDetail.mainCategory },
{ label: '合作模式', value: infoDetail.coopMode },
{ label: '拜访次数', value: infoDetail.visitCount, highlight: true },
{ label: '流量情况', value: infoDetail.flowScale },
{ label: '展业时间', value: infoDetail.expectBizTime },
{ label: '分润规则', value: infoDetail.profitRule },
{ label: '业务类型', value: infoDetail.bizType, full: true }
].filter(Boolean)
this.setData({ infoBoardItems: items })
},
getMerchantDetail() {
// 假数据
const res = {
code: 0,
message: '',
data: {
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}],
brandList: [{
mainBrand: '鸿蒙智行',
subBrandName: '问界',
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
}
// 处理数据回显
this.progressData(res.data)
return
CustomerApi.getMaterialData({merchantId}).then(res => {
})
},
progressData(data) {
const businessSceneNames = {0: '轻改', 1: '权益', 2: '延保'}
// 主营品牌
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
// 合作模式
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
// 流量情况
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
// 业务类型
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
// 人员类型
data.salePotentialCustomerPersonnelInfoDTOList?.forEach(val => {
val.roleName = ROLELIST?.find(v => v.value == val.personnelType)?.label
})
this.setData({
infoDetail: data
}, () => {
this.buildInfoBoard()
this.recordTabTop()
})
},
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({
tabIndex: index,
showVisitButton: index != 1
})
wx.nextTick(() => { this.measureLayout() })
},
measureLayout() {
const { scrollTop, initialTabTop, navBarHeight } = this.data
console.log(scrollTop, initialTabTop, navBarHeight)
if (scrollTop >= (initialTabTop - navBarHeight)) {
this.setData({
setScrollTop: (initialTabTop - navBarHeight)
})
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "门店详情",
"navigationStyle": "custom",
"usingComponents": {
"info-board": "../../components/InfoBoard/index",
"business-analysis": "../../components/BusinessAnalysis/BusinessAnalysis",
"KPI-progress": "../../components/KPIProgress/KPIProgress",
"material-details": "../../components/materialDetails/index",
"store-message": "../../components/StoreMessage/StoreMessage"
}
}
\ No newline at end of file \ No newline at end of file
/* packageCustomer/pages/merchantDetail/merchantDetail.wxss */
.layout {
box-sizing: border-box;
background: #F7F8FA;
height: 100vh;
.container {
min-height: 100%;
.card {
background: #fff;
padding: 24rpx 32rpx 32rpx 32rpx;
box-sizing: border-box;
margin-bottom: 24rpx;
.title-row {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 62rpx;
.shop-name {
font-size: 28rpx;
font-weight: 500;
color: #292D33;
flex: 1;
margin-right: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status {
flex-shrink: 0;
font-size: 22rpx;
padding: 0 8rpx;
margin-right: 16rpx;
}
}
.addr-row {
margin-top: 16rpx;
display: flex;
align-items: center;
image {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.addr-tag {
display: inline-block;
color: #757B85;
font-size: 26rpx;
width: calc(100% - 40rpx);
}
}
.summary-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding-top: 28rpx;
box-sizing: border-box;
gap: 16rpx;
.summary-item {
width: 31.5%;
background-color: #fff;
border: 1rpx solid #e8e8e8;
border-radius: 12rpx;
padding: 20rpx 24rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
&:last-child {
margin-right: 0;
}
.label {
font-size: 24rpx;
color: #757B85;
}
.value {
font-size: 24rpx;
color: #292D33;
margin-top: 12rpx;
}
}
.double {
width: 65%;
}
.triple {
width: 100%;
}
}
}
.tabbar-anchor {
width: 100%;
min-height: 88rpx;
margin-top: 24rpx;
position: sticky;
top: 0;
z-index: 99;
}
.tab-content-box {
padding-bottom: 1rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageCustomer/pages/merchantDetail/merchantDetail.wxml-->
<navigation-bar showBack="{{true}}" navStyle="{{navStyle}}" bindnavbarReady="navbarReady">门店详情</navigation-bar>
<scroll-view class="layout" scroll-y style="padding-top: {{navBarHeight}}px;" bindscroll="onScroll" scroll-top="{{setScrollTop}}">
<view class="container">
<view class="card header-card">
<view class="title-row">
<text class="status" style="color: {{statusText[infoDetail.storeType].color}};background: {{statusText[infoDetail.storeType].background}}">{{statusText[infoDetail.storeType].label}}</text>
<text class="shop-name">{{infoDetail.storeName}}</text>
</view>
<view class="addr-row">
<image src="{{IMG_URL}}customer/location.png" mode=""/>
<text class="addr-tag">{{infoDetail.provinceName}}{{infoDetail.city}}{{infoDetail.districtName}}{{infoDetail.address}}</text>
</view>
<info-board items="{{infoBoardItems}}" threshold="{{24}}" clampLines="{{1}}" />
</view>
<view class="tabbar-anchor" id="tabbarAnchor">
<tab-bar tabList="{{ listTabs }}" bindclick="tabClick" activeIndex="{{ tabIndex }}" />
</view>
<view class="tab-content-box" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px);">
<block wx:if="{{tabIndex == 0}}">
<KPI-progress />
</block>
<block wx:elif="{{tabIndex == 1}}">
<business-analysis />
</block>
<block wx:elif="{{tabIndex == 2}}">
<store-message />
</block>
<block wx:else>
<material-details detail="{{infoDetail}}"/>
</block>
</view>
</view>
</scroll-view>
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '~/utils/constantData' import { IMG_URL, COOPERATIONMODELIST, TRSFFICSTATUSLIST, SCENELIST, ROLELIST } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
import { getUserInfo } from '~/utils/cache/userInfo'
Page({ Page({
data: { data: {
IMG_URL: IMG_URL, IMG_URL: IMG_URL,
// 导航栏样式(与项目保持一致的白底) userInfo: getUserInfo(),
navStyle: 'background: #fff;', navStyle: 'background: #fff;',
// 角色与按钮显示控制
role: 'guest',
roleWhitelist: ['sales', 'manager', 'bd'],
showVisitButton: true, showVisitButton: true,
infoBoardItems: [], // 信息看板数据
listTabs: ['拜访记录', '资料详情'],
tabIndex: 0,
scrollTop: 0, // 监听页面滚动位置
initialTabTop: 0, // 初始tab的top值
setScrollTop: 0, // scroll-view的滚动位置
statusText: { statusText: {
1: {label: '跟进中', color: '#FF9D0A'}, 1: {label: '跟进中', color: '#FF9D0A'},
2: {label: '已签约', color: '#35C376'}, 2: {label: '已签约', color: '#35C376'},
3: {label: '未签约', color: '#F24724'}, 3: {label: '未签约', color: '#F24724'},
4: {label: '已绑定', color: '#347BFF'} 4: {label: '已绑定', color: '#347BFF'}
}, },
detailInfo: {
status: 3,
reason: '客户对分润规则不太满意,合作模式未能谈妥,需要有商量的余地xxxxxxxxxxxxxxx'
},
// 页面内容数据(示例,可后续替换为接口数据)
visitCount: 2,
activeTab: 0,
visitRecords: [], visitRecords: [],
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
bgUrl: `${IMG_URL}/customer/nothing.png`, bgUrl: `${IMG_URL}/customer/nothing.png`,
cardItemObj: [{ cardItemObj: [{
label: '拜访时间', label: '拜访时间',
key: 'contactName' key: 'visitTime'
}, { }, {
label: '联系人', label: '联系人',
key: 'contact' key: 'contactPerson'
}, { }, {
label: '拜访内容', label: '拜访内容',
key: 'content' key: 'visitContent'
}, { }, {
label: '拜访签到', label: '拜访签到',
key: 'address' key: 'checkInLocation'
}, { }, {
label: '拜访照片', label: '拜访照片',
key: 'photo', key: 'visitPhotos',
type: 'image' type: 'image'
}], }],
// 资料详情组件数据 infoDetail: {}
infoDetail: { },
shopName: '杭州旺泽宝华哥哥桑的尼汽车销售服务有限公司',
bizType: '1.1 精品升级/2.1 改装升级/2.2 渠道分为/2.3 直营升级', onReady() {
mainCategory: '鸿蒙智行/问界', // 记录tab的位置 请求接口后再记录一次位置 数据加载 假数据
coopMode: '直营', this.recordTabTop()
flowScale: '120 以上',
region: '广东省深圳市龙岗区龙城街道',
addressDetail: '中海康城',
storePhoto: '',
note: '客户意向高,希望互相帮助,让门店生意再上一层楼'
},
managers: [
{ role: '店总', name: '张三', phone: '1351076958' },
{ role: '销售经理', name: '张三', phone: '1351076958' }
]
}, },
onLoad(options) { onLoad(options) {
let { query } = options
if (query) {
const pageQuery = JSON.parse(decodeURIComponent(query))
this.setData({pageQuery})
}
},
onShow() {
// 获取潜客详情数据
this.getPotentialDetail()
// 初始加载数据 // 初始加载数据
this.resetAndLoad(); this.resetAndLoad()
},
getPotentialDetail() {
// 假数据
const res = {
code: 0,
message: '',
data: {
status: 1,
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}, {
businessSceneType: 3
}, {
businessSceneType: 4
}, {
businessSceneType: 5
}],
brandList: [{
mainBrand: '鸿蒙智行',
subBrandName: '问界',
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
}
// 处理数据回显
this.progressData(res.data)
return
CustomerApi.getCustomerData({id}).then(res => {
})
},
progressData(data) {
const businessSceneNames = {0: '轻改', 1: '权益', 2: '延保'}
// 主营品牌
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
// 合作模式
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
// 流量情况
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
// 业务类型
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
// 人员类型
data.salePotentialCustomerPersonnelInfoDTOList?.forEach(val => {
val.roleName = ROLELIST?.find(v => v.value == val.personnelType)?.label
})
this.setData({
infoDetail: data
}, () => {
this.buildInfoBoard()
this.recordTabTop()
})
},
recordTabTop() {
const query = wx.createSelectorQuery().in(this)
query.select('.tabbar-anchor').boundingClientRect()
query.exec(res => {
const top = res[0]?.top
const height = res[0]?.height
this.setData({
initialTabTop: top,
tabHeight: height
})
})
},
buildInfoBoard() {
const { infoDetail } = this.data
const items = [
{ label: '主营品牌', value: infoDetail.mainCategory },
{ label: '合作模式', value: infoDetail.coopMode },
{ label: '拜访次数', value: infoDetail.visitCount, highlight: true },
{ label: '流量情况', value: infoDetail.flowScale },
[2, 4].includes(infoDetail.status) ? { label: '预计展业时间', value: infoDetail.expectBizTime } : null, // 已签约或已绑定展示
[2, 4].includes(infoDetail.status) ? { label: '分润规则', value: infoDetail.profitRule } : null, // 已签约或已绑定展示
{ label: '业务类型', value: infoDetail.bizType, span: 2, full: [2, 4].includes(infoDetail.status), clampLines: 1, threshold: 16 },
[2, 4].includes(infoDetail.status) ? { label: '上架商品', value: infoDetail.shelfProduct, full: true } : null
].filter(Boolean)
this.setData({ infoBoardItems: items })
}, },
// 加载逻辑 // 加载逻辑
resetAndLoad(cb) { resetAndLoad(cb) {
this.setData({ pageNum: 1, hasMore: true, visitRecords: [] }); // 假数据
this.loadMore(cb); const res = {code: 0}
let { code } = res
const list = this.mockFetch()
if (code == 0) {
this.setData({
visitRecords: list
})
} else {
wx.$api.showToast(message)
}
return
CustomerApi.getVisitList().then(res => {
let { code, data, message } = res
const list = this.mockFetch()
if (code == 0) {
this.setData({
visitRecords: list
})
} else {
wx.$api.showToast(message)
}
})
}, },
loadMore(cb) { loadMore(cb) {
this.setData({ loading: true }); this.setData({ loading: true })
const { pageNum, pageSize } = this.data
// TODO: 替换为真实接口请求 // TODO: 替换为真实接口请求
setTimeout(() => { setTimeout(() => {
const { pageNum, pageSize } = this.data; const { pageNum, pageSize } = this.data;
...@@ -84,88 +211,63 @@ Page({ ...@@ -84,88 +211,63 @@ Page({
hasMore, hasMore,
loading: false loading: false
}); });
console.log(this.data.visitRecords)
cb && cb(); cb && cb();
}, 400); }, 400);
}, },
// 模拟数据 // 模拟数据
mockFetch(page, pageSize) { mockFetch() {
const baseIndex = (page - 1) * pageSize; return Array.from({ length: 10 }).map((_, i) => {
return Array.from({ length: pageSize }).map((_, i) => { const id = i + 1
const id = baseIndex + i + 1;
return { return {
id, id,
contactName: id % 2 ? '张三' : '迪丽热巴·迪力木拉提', createdBy: id % 2 ? '张三' : '迪丽热巴·迪力木拉提',
time: `2025-09-2${(id % 10)} 22:3${id % 6}`, visitTime: `2025-09-2${(id % 10)}`,
contact: id % 3 ? '王总' : '古力娜扎', contactPerson: id % 3 ? '王总' : '古力娜扎',
content: id % 2 ? '客户意向很高。' : '客户意向很高,门店运营里有觉得吃力的地方,希望互相帮助下,让门店营再上一层楼', visitContent: id % 2 ? '客户意向很高。' : '客户意向很高,门店运营里有觉得吃力的地方,希望互相帮助下,让门店营再上一层楼',
address: this.data.address, checkInLocation: '广东省深圳市龙岗区中海康城 5 栋 26很长的地址',
photo: id % 4 ? '' : 'https://dummyimage.com/68x68/eeeeee/999999.png&text=\u25A1' visitPhotos: id % 4 ? '' : 'https://dummyimage.com/68x68/eeeeee/999999.png&text=\u25A1'
}; };
}); });
}, },
// 下拉刷新
onPullDownRefresh() {
this.resetAndLoad(() => wx.stopPullDownRefresh());
},
// 触底加载更多
onReachBottom() {
if (!this.data.hasMore || this.data.loading) return;
this.loadMore();
},
// 导航栏就绪,按需记录高度(如需吸顶或内容偏移可使用) // 导航栏就绪,按需记录高度(如需吸顶或内容偏移可使用)
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height let navBarHeight = e.detail.height
this.setData({ this.setData({
navBarHeight navBarHeight
}) })
wx.nextTick(() => this.measureLayout())
}, },
onTabChange(e) { tabClick(e) {
const { index } = e.detail; const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({ activeTab: index }); this.setData({
tabIndex: index,
showVisitButton: index != 1
})
this.resetAndLoad()
wx.nextTick(() => { this.measureLayout() }) wx.nextTick(() => { this.measureLayout() })
}, },
onCreateVisit() {
wx.navigateTo({
url: '/packageCustomer/pages/createVisit/createVisit' onScroll(e) {
}) const scrollTop = e.detail.scrollTop
this.setData({ scrollTop })
}, },
measureLayout(cb) { measureLayout(cb) {
const query = wx.createSelectorQuery().in(this) const { scrollTop, initialTabTop, navBarHeight } = this.data
query.select('.van-tabs__wrap').boundingClientRect() if (scrollTop >= (initialTabTop - navBarHeight)) {
query.select('.bottom-bar').boundingClientRect() this.setData({
query.selectViewport().scrollOffset() setScrollTop: (initialTabTop - navBarHeight)
query.exec(res => {
const tabsRect = res[0] || {}
const bottomRect = res[1] || {}
const viewport = res[2] || { scrollTop: 0 }
const tabsWrapHeight = tabsRect.height || 44
const bottomBarHeight = bottomRect.height || 0
const wh = wx.getSystemInfoSync().windowHeight
const tabMinHeight = Math.max(0, wh - this.data.navBarHeight - tabsWrapHeight - bottomBarHeight)
this.setData({ tabsWrapHeight, bottomBarHeight, tabMinHeight })
cb && cb({ tabsRect, bottomRect, viewport })
}) })
}
}, },
ensureStickyPosition() {
// 优先通过锚点定位,保持吸顶稳定 onCreateVisit() {
wx.pageScrollTo({ selector: '#tabsAnchor', offsetTop: this.data.navBarHeight, duration: 0 }) wx.navigateTo({
// 兼容部分旧版本,回退到计算 top 的方案 url: '/packageCustomer/pages/createVisit/createVisit'
const query = wx.createSelectorQuery().in(this)
query.select('.van-tabs__wrap').boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(res => {
const tabsTop = (res[0] && res[0].top) || 0
const scrollTop = (res[1] && res[1].scrollTop) || 0
const target = Math.max(0, scrollTop + tabsTop - this.data.navBarHeight)
wx.pageScrollTo({ scrollTop: target, duration: 0 })
}) })
} }
}); });
\ No newline at end of file \ No newline at end of file
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
"navigationBarTitleText": "潜客详情", "navigationBarTitleText": "潜客详情",
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"van-tabs": "@vant/weapp/tabs/index", "material-details": "../../components/materialDetails/index",
"van-tab": "@vant/weapp/tab/index", "info-board": "../../components/InfoBoard/index"
"material-details": "../../components/materialDetails/index"
} }
} }
\ No newline at end of file \ No newline at end of file
.page { .layout {
box-sizing: border-box;
background: #F7F8FA; background: #F7F8FA;
min-height: 100vh; height: 100vh;
.container {
min-height: 100%;
}
} }
.card { .card {
...@@ -24,6 +28,7 @@ ...@@ -24,6 +28,7 @@
white-space: nowrap; white-space: nowrap;
} }
.status { .status {
flex-shrink: 0;
font-size: 26rpx; font-size: 26rpx;
} }
} }
...@@ -40,9 +45,6 @@ ...@@ -40,9 +45,6 @@
display: inline-block; display: inline-block;
color: #757B85; color: #757B85;
font-size: 26rpx; font-size: 26rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
} }
} }
...@@ -100,16 +102,13 @@ ...@@ -100,16 +102,13 @@
} }
} }
.van-tabs__wrap { .tabbar-anchor {
.van-tab { width: 100%;
font-size: 28rpx; min-height: 88rpx;
color: #5A5E66; margin-top: 24rpx;
} position: sticky;
.van-tab--active { top: 0;
color: #347BFF; z-index: 99;
font-weight: 600;
font-size: 32rpx;
}
} }
.list-section { .list-section {
...@@ -151,13 +150,14 @@ ...@@ -151,13 +150,14 @@
} }
.list-footer { .list-footer {
text-align:center; text-align:center;
padding:12px 0 80px; padding-bottom: 200rpx;
color:#999EA8; color:#999EA8;
} }
} }
.info-card { .info-card {
margin-top: 24rpx; margin-top: 24rpx;
padding-bottom: 1rpx;
} }
.bottom-bar { .bottom-bar {
......
<view class="page" style="padding-bottom: {{showVisitButton ? '188rpx' : 0}};"> <!-- 统一导航栏 -->
<!-- 统一导航栏 --> <navigation-bar showBack="{{true}}" navStyle="{{navStyle}}" bindnavbarReady="navbarReady">潜客详情</navigation-bar>
<navigation-bar showBack="{{true}}" navStyle="{{navStyle}}" bindnavbarReady="navbarReady">潜客详情</navigation-bar> <scroll-view class="layout" scroll-y style="padding-top: {{navBarHeight}}px;" bindscroll="onScroll" scroll-top="{{setScrollTop}}">
<!-- 顶部店名与状态 --> <view class="container">
<view class="card header-card" style="margin-top:{{navBarHeight}}px;"> <view class="card header-card">
<view class="title-row"> <view class="title-row">
<text class="shop-name">杭州旺泽宝华哥桑纳尼汽车销售服务有限公司</text> <text class="shop-name">杭州旺泽宝华哥桑纳尼汽车销售服务有限公司</text>
<text class="status" style="color: {{statusText[detailInfo.status].color}}">{{statusText[detailInfo.status].label}}</text> <text class="status" style="color: {{statusText[detailInfo.status].color}}">{{statusText[detailInfo.status].label}}</text>
...@@ -11,61 +11,20 @@ ...@@ -11,61 +11,20 @@
<image src="{{IMG_URL}}customer/location.png" mode=""/> <image src="{{IMG_URL}}customer/location.png" mode=""/>
<text class="addr-tag">广东省深圳市龙岗区中海康城 5栋 26F</text> <text class="addr-tag">广东省深圳市龙岗区中海康城 5栋 26F</text>
</view> </view>
<view class="summary-row"> <info-board items="{{infoBoardItems}}" threshold="{{24}}" clampLines="{{1}}" />
<view class="summary-item">
<view class="label">主营品牌</view>
<view class="value">跨整车价同频</view>
</view>
<view class="summary-item">
<view class="label">合作模式</view>
<view class="value">直接买</view>
</view>
<view class="summary-item">
<view class="label">拜访次数</view>
<view class="value">{{visitCount}}</view>
</view>
<view class="summary-item">
<view class="label">流量情况</view>
<view class="value">{{visitCount}}</view>
</view>
<block wx:if="{{detailInfo.status == 1 || detailInfo.status == 3}}">
<view class="summary-item double">
<view class="label">业务类型</view>
<view class="value">{{visitCount}}</view>
</view>
</block>
<block wx:else>
<view class="summary-item">
<view class="label">预计展业时间</view>
<view class="value">{{}}</view>
</view>
<view class="summary-item">
<view class="label">分润规则</view>
<view class="value">{{}}</view>
</view>
<view class="summary-item triple">
<view class="label">业务类型</view>
<view class="value">{{visitCount}}</view>
</view>
<view class="summary-item triple">
<view class="label">上架商品</view>
<view class="value">{{visitCount}}</view>
</view>
</block>
</view>
<view class="fail-row" wx:if="{{detailInfo.status == 3}}"> <view class="fail-row" wx:if="{{detailInfo.status == 3}}">
<view class="title">战败原因</view> <view class="title">战败原因</view>
<view class="content">{{detailInfo.reason}}</view> <view class="content">{{detailInfo.reason}}</view>
</view> </view>
</view> </view>
<!-- 吸顶锚点:用于切换时稳定滚动位置 --> <view class="tabbar-anchor" id="tabbarAnchor">
<view id="tabsAnchor" style="height:0;" /> <tab-bar tabList="{{ listTabs }}" bindclick="tabClick" activeIndex="{{ tabIndex }}" />
<!-- Tabs --> </view>
<van-tabs active="{{activeTab}}" bind:change="onTabChange" color="#3666FE" line-width="36" sticky="{{true}}" offset-top="{{navHeight}}" animated="{{false}}" swipeable="{{false}}">
<van-tab title="拜访记录"> <block wx:if="{{tabIndex == 0}}">
<view class="list-section"> <view class="list-section" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx);">
<block wx:if="{{!visitRecords.length}}"> <block wx:if="{{!visitRecords.length}}">
<nothing-tips tips="暂无拜访" bgColor="{{'#F2F3F7'}}" bg="{{bgUrl}}" emptyDataStyle="{{'height:'+tabMinHeight+'px; width: 100%;'}}" /> <nothing-tips tips="暂无数据" bgColor="{{'#F7F8FA'}}" bg="{{bgUrl}}" emptyDataStyle="height:calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx)" />
</block> </block>
<block wx:else> <block wx:else>
<block wx:for="{{visitRecords}}" wx:key="index"> <block wx:for="{{visitRecords}}" wx:key="index">
...@@ -90,18 +49,18 @@ ...@@ -90,18 +49,18 @@
</view> </view>
</block> </block>
</view> </view>
</van-tab> </block>
<van-tab title="资料详情"> <block wx:else>
<view class="card info-card" style="min-height: {{tabMinHeight}}px;"> <view class="info-card">
<material-details detail="{{infoDetail}}" managers="{{managers}}"></material-details> <view id="markDetail"></view>
<material-details detail="{{infoDetail}}"></material-details>
</view>
</block>
</view> </view>
</van-tab> </scroll-view>
</van-tabs> <!-- 底部固定操作条:新增拜访 -->
<view class="bottom-bar" wx:if="{{showVisitButton && userInfo.loginRole != 1}}">
<!-- 底部固定操作条:新增拜访 -->
<view class="bottom-bar" wx:if="{{showVisitButton}}">
<view class="inner safe-area-bottom"> <view class="inner safe-area-bottom">
<view class="btn" bind:tap="onCreateVisit">新增拜访</view> <view class="btn" bind:tap="onCreateVisit">新增拜访</view>
</view> </view>
</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
// packageCustomer/pages/resultFeedback/resultFeedback.js // packageCustomer/pages/resultFeedback/resultFeedback.js
import { IMG_URL } from '~/utils/constantData' import { IMG_URL } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
Page({ Page({
/** /**
...@@ -8,8 +9,13 @@ Page({ ...@@ -8,8 +9,13 @@ Page({
data: { data: {
IMG_URL: IMG_URL, IMG_URL: IMG_URL,
infoData: { infoData: {
result: 'success' result: 1
}, },
timeVisible: false,
currentDate: new Date().getTime() + 24 * 60 * 60 * 1000,
minDate: new Date().getTime() + 24 * 60 * 60 * 1000,
selectedTime: '', // 存储已选择的时间
tempTime: '',
profitLength: 0, profitLength: 0,
productLength: 0, productLength: 0,
failLength: 0 failLength: 0
...@@ -19,7 +25,10 @@ Page({ ...@@ -19,7 +25,10 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let { query } = options
this.setData({
pageQuery: JSON.parse(decodeURIComponent(query))
})
}, },
/** /**
...@@ -44,6 +53,7 @@ Page({ ...@@ -44,6 +53,7 @@ Page({
changeRadio(e) { changeRadio(e) {
let { type } = e.currentTarget.dataset let { type } = e.currentTarget.dataset
this.setData({ this.setData({
infoData: {},
'infoData.result': type 'infoData.result': type
}) })
}, },
...@@ -70,6 +80,71 @@ Page({ ...@@ -70,6 +80,71 @@ Page({
}) })
}, },
openTimePicker() {
let initialDate
let initialFormattedTime
if (this.data.selectedTime) {
initialDate = this.dateTimeToTimestamp(this.data.selectedTime)
initialFormattedTime = this.data.selectedTime
} else {
const now = new Date()
const tomorrow = new Date(now)
tomorrow.setDate(now.getDate() + 1)
initialDate = now.getTime() + 24 * 60 * 60 * 1000
initialFormattedTime = this.formatDateTime(tomorrow)
}
this.setData({
timeVisible: true,
currentDate: initialDate,
tempTime: initialFormattedTime
});
},
// 弹窗确认事件
popupConfirm() {
this.setData({
selectedTime: this.data.tempTime, // 保存选择的时间
timeVisible: false,
'infoData.expectTimeText': this.data.tempTime
})
},
onChange(e) {
const values = e.detail.getValues()
const formattedTime = this.valuesToDateTime(values)
this.setData({
tempTime: formattedTime
})
},
cancel() {
this.setData({
timeVisible: false
})
},
// 将 yyyy-mm-dd 转换为时间戳
dateTimeToTimestamp(dateTimeStr) {
if (!dateTimeStr) return new Date().getTime() + 24 * 60 * 60 * 1000
const [year, month, day] = dateTimeStr.split('-')
return new Date(year, month - 1, day).getTime()
},
formatDateTime(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
valuesToDateTime(values) {
const [year, month, day] = values.map(item => {
return item.replace(/[年月日时分]/g, '').padStart(2, '0')
});
return `${year}-${month}-${day}`
},
handleCancel() { handleCancel() {
if (wx.$router && wx.$router.back) { if (wx.$router && wx.$router.back) {
wx.$router.back() wx.$router.back()
...@@ -80,12 +155,22 @@ Page({ ...@@ -80,12 +155,22 @@ Page({
handleConfirm() { handleConfirm() {
const { infoData } = this.data const { infoData } = this.data
if (infoData.result === 'success') { if (infoData.result == 1) {
if (!infoData.expectTimeText || !infoData.profitRule || !infoData.productInfo ) return wx.$api.showToast('请填入必填信息') if (!infoData.expectTimeText || !infoData.profitRule || !infoData.productInfo ) return wx.$api.showToast('请填入必填信息')
} else { } else {
if (!infoData.failReason) return wx.$api.showToast('请填入必填信息') if (!infoData.failReason) return wx.$api.showToast('请填入必填信息')
} }
const params = {
resultFeedbackStatus: infoData.result,
expectedOperationDate: infoData.expectTimeText,
profitRule: infoData.profitRule,
productShelfInfo: infoData.productInfo,
failureReason: infoData.result == 2 ? infoData.failReason : undefined
}
console.log(params)
// CustomerApi.reslutFeedbackApi(params).then(res => {
// })
// TODO: 接入后端提交接口 // TODO: 接入后端提交接口
const res = {code: 1} const res = {code: 1}
const okText = '我知道了' const okText = '我知道了'
......
{ {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"result-dialog": "../../components/ResultDialog/index" "result-dialog": "../../components/ResultDialog/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -36,6 +36,7 @@ page { ...@@ -36,6 +36,7 @@ page {
} }
} }
image { image {
flex-shrink: 0;
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
margin-left: 8rpx; margin-left: 8rpx;
...@@ -87,6 +88,7 @@ page { ...@@ -87,6 +88,7 @@ page {
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
z-index: 100;
.cancel { .cancel {
width: 184rpx; width: 184rpx;
background: #F4F5F7; background: #F4F5F7;
......
...@@ -6,28 +6,28 @@ ...@@ -6,28 +6,28 @@
<view class="row"> <view class="row">
<view class="label">结果反馈 <text class="star">*</text></view> <view class="label">结果反馈 <text class="star">*</text></view>
<view class="value value-gap"> <view class="value value-gap">
<view class="radio" bindtap="changeRadio" data-type="success"> <view class="radio" bindtap="changeRadio" data-type="1">
<image wx:if="{{infoData.result == 'success'}}" src="{{IMG_URL}}customer/radio-active.png" mode=""/> <image wx:if="{{infoData.result == 1}}" src="{{IMG_URL}}customer/radio-active.png" mode=""/>
<image wx:else src="{{IMG_URL}}customer/radio.png" mode=""/> <image wx:else src="{{IMG_URL}}customer/radio.png" mode=""/>
<text>成功</text> <text>成功</text>
</view> </view>
<view class="radio" bindtap="changeRadio" data-type="fail"> <view class="radio" bindtap="changeRadio" data-type="2">
<image wx:if="{{infoData.result == 'fail'}}" src="{{IMG_URL}}customer/radio-active.png" mode=""/> <image wx:if="{{infoData.result == 2}}" src="{{IMG_URL}}customer/radio-active.png" mode=""/>
<image wx:else src="{{IMG_URL}}customer/radio.png" mode=""/> <image wx:else src="{{IMG_URL}}customer/radio.png" mode=""/>
<text>失败</text> <text>失败</text>
</view> </view>
</view> </view>
</view> </view>
<!-- 成功表单 --> <!-- 成功表单 -->
<block wx:if="{{infoData.result === 'success'}}"> <block wx:if="{{infoData.result == 1}}">
<view class="row" bindtap="openTimePicker"> <view class="row" bindtap="openTimePicker">
<view class="label">预计展业时间 <text class="star">*</text></view> <view class="label">预计展业时间 <text class="star">*</text></view>
<view class="value"> <view class="value">
<text wx:if="{{infoData.expectTimeText}}" class="value-text">{{infoData.expectTimeText}}</text> <text wx:if="{{infoData.expectTimeText}}" class="value-text">{{infoData.expectTimeText}}</text>
<block wx:else> <block wx:else>
<text class="placeholder">点击选择</text> <text class="placeholder">点击选择</text>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</block> </block>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view> </view>
</view> </view>
<view class="row no-border"> <view class="row no-border">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</block> </block>
<!-- 失败表单 --> <!-- 失败表单 -->
<block wx:elif="{{infoData.result === 'fail'}}"> <block wx:elif="{{infoData.result == 2}}">
<view class="row no-border"> <view class="row no-border">
<view class="label">战败原因 <text class="star">*</text></view> <view class="label">战败原因 <text class="star">*</text></view>
</view> </view>
...@@ -63,5 +63,8 @@ ...@@ -63,5 +63,8 @@
<view class="confirm" bindtap="handleConfirm">提交</view> <view class="confirm" bindtap="handleConfirm">提交</view>
</view> </view>
</view> </view>
<popup bind:hidePopup="cancel" bind:confirm="popupConfirm" show="{{timeVisible}}" title="拜访时间" height="50vh">
<van-datetime-picker id="datePicker" show-toolbar="{{false}}" min-date="{{ minDate }}" model:value="{{ currentDate }}" type="date" bind:change="onChange"/>
</popup>
<!-- 结果弹窗组件:统一反馈弹窗 --> <!-- 结果弹窗组件:统一反馈弹窗 -->
<result-dialog id="resultDialog" bind:ok="onDialogOk" bind:close="onDialogClose" /> <result-dialog id="resultDialog" bind:ok="onDialogOk" bind:close="onDialogClose" />
\ No newline at end of file \ No newline at end of file
// pages/tabWorkOrder/components/OrderScreen/OrderScreen.js
import { IMG_URL, PROVINCES, SCENELIST, COOPERATIONMODELIST, TRSFFICSTATUSLIST } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
Component({
/**
* 组件的属性列表
*/
properties: {
userInfo: Object,
navBarHeight: String,
show: {
type: Boolean,
observer: function (n, o) {
if (n) {
this.setViewData()
let { userInfo } = this.data
if (userInfo.loginRole == 1) {
// 总监获取销售人员数据
this.getSalesList()
}
const page = wx.$router.getPageInstance()
const criteria = (this.data.currentTab === 1 ? page.data?.storeSearchObj : page.data?.searchObj) || {}
this.applySelectedCriteria(criteria)
} else {
this.setData({
x: this.data.windowWidth
})
}
}
},
currentTab: Number
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
form: {
businessTypeList: [{
name: '全部',
active: true,
value: ''
}, ...SCENELIST],
cooperationModelList: [{
name: '全部',
active: true,
value: ''
}, ...COOPERATIONMODELIST],
trafficStatusList: [{
name: '全部',
active: true,
value: ''
}, ...TRSFFICSTATUSLIST],
provinces: [{
name: '全部',
active: true,
value: ''
}, ...PROVINCES],
salesStaffList: [],
selectedMainBrand: []
},
salesStaffShowMore: false
},
/**
* 组件的方法列表
*/
methods: {
applySelectedCriteria(criteria = {}) {
const toVal = (item) => {
// 统一取值优先级:value > id > staffId > code > name
return item?.value ?? item?.id ?? item?.staffId ?? item?.code ?? item?.name
}
const setSingleActive = (list = [], selected) => {
const selectedVal = selected ? toVal(selected) : undefined
return (list || []).map((opt, idx) => {
const isAll = idx === 0 // “全部”项
const match = selectedVal !== undefined && toVal(opt) === selectedVal
return { ...opt, active: match ? true : (isAll && selectedVal === undefined) }
})
}
const setMultiActive = (list = [], selectedArr = []) => {
const selectedVals = Array.isArray(selectedArr) ? selectedArr.map(toVal).filter(v => v !== undefined) : []
const next = (list || []).map((opt, idx) => {
const isAll = idx === 0
const match = selectedVals.includes(toVal(opt))
return { ...opt, active: match ? true : false }
})
const anySelected = next.some((opt, idx) => idx !== 0 && opt.active)
// 如果多选为空,则激活“全部”
next[0] = { ...next[0], active: !anySelected }
return next
}
// 业务类型(多选)
const businessTypeList = setMultiActive(this.data.form.businessTypeList, criteria.businessTypeList)
// 合作模式 / 流量情况 / 省份 / 销售人员(单选)
const cooperationModelList = setSingleActive(this.data.form.cooperationModelList, criteria.cooperationModelList)
const trafficStatusList = setSingleActive(this.data.form.trafficStatusList, criteria.trafficStatusList)
const provinces = setSingleActive(this.data.form.provinces, criteria.provinces)
const salesStaffList = setSingleActive(this.data.form.salesStaffList, criteria.salesStaffList)
// 主营品牌(数组直接回填)
const selectedMainBrand = Array.isArray(criteria.selectedMainBrand) ? criteria.selectedMainBrand : []
this.setData({
'form.businessTypeList': businessTypeList,
'form.cooperationModelList': cooperationModelList,
'form.trafficStatusList': trafficStatusList,
'form.provinces': provinces,
'form.salesStaffList': salesStaffList,
'form.selectedMainBrand': selectedMainBrand,
isReset: false
})
},
setViewData() {
let { navBarHeight } = this.data
wx.$api.getViewInfo(
'.btn-box',
res => {
console.log(res)
this.setData({
height: navBarHeight,
btnHeight: res[0].height
})
},
this
)
},
// 选择主营品牌
chooseCarBrand() {
this.setData({
carBrandPopupShow: true
})
},
getSalesList() {
// 假数据
const res = {
code: 0,
message: '',
data: [{
staffName: '张四',
value: 1
}]
}
res.data.unshift({
staffName: '全部',
active: true,
value: ''
})
this.setData({
'form.salesStaffList': res.data || []
})
return
CustomerApi.getSalesPersonList({}).then(res => {
console.log(res)
})
},
init() {
},
showMore(e) {
let { type } = e.currentTarget.dataset
let prop = type
this.setData({
[prop]: !this.data[type]
})
},
choose(e) {
let { index, listName } = e.currentTarget.dataset
let target = this.data.form[listName]
// 多选
if (listName === 'businessTypeList') {
if (index == 0) {
target.forEach(i => i.active = false)
target[index].active = true
} else {
target[index].active = !target[index].active
target[0].active = false
if (!target.filter(val => val.active).length) target[0].active = true
}
} else {
target.forEach(i => {
i.active = false
})
target[index].active = true
}
this.setData({
[`form.${listName}`]: target,
isReset: false
})
},
reset() {
let { businessTypeList, cooperationModelList, trafficStatusList, provinces, salesStaffList } = this.data.form
const setActiveStatus = (list) => {
return list?.map((item, index) => ({
...item,
active: index === 0
}));
};
this.setData({
'form.businessTypeList': setActiveStatus(businessTypeList),
'form.cooperationModelList': setActiveStatus(cooperationModelList),
'form.trafficStatusList': setActiveStatus(trafficStatusList),
'form.provinces': setActiveStatus(provinces),
'form.salesStaffList': setActiveStatus(salesStaffList),
'form.selectedMainBrand': [],
isReset: true
})
this.init()
},
brandConfirm() {
let brandMoudle = this.selectComponent('#car-brand')
console.log(brandMoudle)
this.setData({
'form.selectedMainBrand': brandMoudle && brandMoudle.handleConfirm() || []
})
this.hideBrandPopup()
},
hideBrandPopup() {
this.setData({
carBrandPopupShow: !this.data.carBrandPopupShow
})
},
handleChooseBrand() {
// wx.$router.go('packageMine.carBrandList')
this.hideBrandPopup()
},
confirm() {
let { form, isReset, currentTab } = this.data
let obj = {}
Object.keys(form).forEach(e => {
let arr = []
form[e]?.map(i => {
if (i.active) {
obj[e] = i
if (e == 'businessTypeList') {
arr.push(i)
obj[e] = arr
}
}
})
})
obj.selectedMainBrand = form.selectedMainBrand
let page = wx.$router.getPageInstance()
if (isReset) {
obj = {}
}
const currentTarget = currentTab == 0 ? 'searchObj' : 'storeSearchObj'
page.setData({
[currentTarget]: obj
})
page.back()
page.search()
}
},
attached() {
wx.$api.getSystemInfo(info => {
let { windowWidth } = info
this.setData({
x: windowWidth,
windowWidth
})
})
this.init()
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"car-brand": "/components/CarBrand/CarBrand"
}
}
\ No newline at end of file \ No newline at end of file
/* pages/tabWorkOrder/components/OrderScreen/OrderScreen.wxss */
.confirm-box {
position: fixed;
top: 0;
z-index: 10;
height: 100vh;
width: 100%;
box-sizing: border-box;
background-color: #fff;
animation: show-confirm-box .5s forwards;
.main {
box-sizing: border-box;
}
}
@keyframes show-confirm-box {
0%{
right: -100%;
}
100%{
right: 0;
}
}
.box {
margin: 0 32rpx;
border-bottom: 1rpx solid #EFF0F2;
&:last-child{
border-bottom: none;
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 32rpx;
font-weight: 500;
color: #292D33;
padding: 32rpx 0 24rpx;
position: sticky;
left: 0;
top: 0;
background: #fff;
z-index: 2;
.title-left{
display: flex;
align-items: flex-end;
}
.collapse-btn{
image {
width: 48rpx;
height: 48rpx;
}
}
.rotate-180{
transform: rotate(180deg);
}
}
.choose-btn {
width: 100%;
background: #F7F8FA;
border-radius: 4rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 16rpx;
font-size: 24rpx;
margin-bottom: 20rpx;
image {
width: 32rpx;
height: 32rpx;
margin-left: 8rpx;
}
}
.list-box {
display: flex;
flex-wrap: wrap;
padding-bottom: 20rpx;
.item {
width: calc(234 / 750 * 100%);
min-height: 68rpx;
border-radius: 4rpx;
box-sizing: border-box;
font-weight: 500;
border: 2rpx solid transparent;
padding: 16rpx 33rpx;
flex-wrap: wrap;
font-size: 24rpx;
text-align: center;
background-color: #F7F8FA;
color: #292D33;
transition: all .2s;
margin: 0 calc(20 / 750 * 100%) calc(20 / 750 * 100%) 0;
.text-item{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
&:nth-of-type(3n+3) {
margin-right: 0;
}
}
.flex-1{
width: 100%;
text-align: left;
margin-right: 0;
line-height: 100%;
display: flex;
align-items: center;
}
.active {
background: rgba(53, 130, 238, 0.08);
border: 2rpx solid #347BFF;
color: #347BFF;
}
}
}
.btn-box {
position: sticky;
padding: 10rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 32rpx;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
z-index: 9;
background-color: #fff;
.btn {
border-radius: 12rpx;
box-sizing: border-box;
height: 80rpx;
}
.clear {
width: 186rpx;
background: #F4F5F7;
color: #292D33;
}
.done {
background: #347BFF;
color: #fff;
width: 480rpx;
}
}
.isFullSucreen-btn {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tabWorkOrder/components/OrderScreen/OrderScreen.wxml-->
<scroll-view scroll-y class="confirm-box" style="height:calc(100vh - {{navBarHeight}}px);margin-top:{{navBarHeight}}px;" hidden="{{!show}}">
<view class="main" style="padding-bottom: {{btnHeight}}px;min-height: calc(100% - {{btnHeight}}px);">
<view class="box">
<view class="title">
<view class="title-left">
主营品牌
</view>
</view>
<view class="choose-btn" bindtap="chooseCarBrand">
<text>请选择</text>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view>
<view class="list-box">
<block wx:for="{{form.selectedMainBrand}}" wx:key="index">
<view class="item flex-1 text-center active" data-index="{{index}}">{{ (item.children && item.children[0] && item.children[0].name) || (item.name || '') }}</view>
</block>
</view>
</view>
<view class="box">
<view class="title">
业务类型
</view>
<view class="list-box">
<block wx:for="{{form.businessTypeList}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" bindtap="choose" data-list-name="businessTypeList" data-index="{{index}}">{{item.name}}</view>
</block>
</view>
</view>
<view class="box">
<view class="title">
合作模式
</view>
<view class="list-box">
<block wx:for="{{form.cooperationModelList}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" bindtap="choose" data-list-name="cooperationModelList" data-index="{{index}}">{{item.name}}</view>
</block>
</view>
</view>
<view class="box">
<view class="title">
流量情况
</view>
<view class="list-box">
<block wx:for="{{form.trafficStatusList}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" bindtap="choose" data-list-name="trafficStatusList" data-index="{{index}}">{{item.name}}</view>
</block>
</view>
</view>
<view class="box" wx:if="{{userInfo.loginRole == 1}}">
<view class="title">
<view class="title-left">
所属省份
</view>
<view wx:if="{{form.provinces.length > 12}}" bindtap="showMore" data-type="provincesShowMore" class="collapse-btn {{!provincesShowMore ? 'rotate-180' : ''}}">
<image src="{{IMG_URL}}customer/collapse_icon.png" mode="" />
</view>
</view>
<view class="list-box">
<block wx:for="{{form.provinces}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" hidden="{{index >= 12 && !provincesShowMore}}" bindtap="choose" data-list-name="provinces" data-index="{{index}}">{{item.name}}</view>
</block>
</view>
</view>
<view class="box" wx:if="{{userInfo.loginRole == 1}}">
<view class="title">
<view class="title-left">
销售人员
</view>
<view wx:if="{{form.salesStaffList.length > 12}}" bindtap="showMore" data-type="salesStaffShowMore" class="collapse-btn {{!salesStaffShowMore ? 'rotate-180' : ''}}">
<image src="{{IMG_URL}}customer/collapse_icon.png" mode="" />
</view>
</view>
<view class="list-box">
<block wx:for="{{form.salesStaffList}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" bindtap="choose" data-list-name="salesStaffList" data-index="{{index}}" hidden="{{index >= 12 && !salesStaffShowMore}}">
<view class="text-item">{{item.staffName}}</view>
</view>
</block>
</view>
</view>
</view>
<view class="btn-box isFullSucreen-btn">
<view class="btn clear text-center" bindtap="reset">清除</view>
<view class="btn done text-center" bindtap="confirm">确定</view>
</view>
</scroll-view>
<popup show="{{carBrandPopupShow}}" title="选择品牌" bind:hidePopup="hideBrandPopup" customPopupSlotStyle="{{'height: calc(100% - 282rpx)'}}" bindconfirm="brandConfirm" height="90%">
<car-brand id="car-brand" popupShow="{{carBrandPopupShow}}" multiple="{{false}}" selectedList="{{form.selectedMainBrand}}"></car-brand>
</popup>
\ No newline at end of file \ No newline at end of file
// pages/tab/customer/components/PotentialSection/PotentialSection.js
import { IMG_URL } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
// 预计算安全的月份时间戳,避免初始 0 值
const __NOW__ = new Date()
const __CUR_YM_TS__ = new Date(__NOW__.getFullYear(), __NOW__.getMonth(), 1).getTime()
const __MIN_YM_TS__ = new Date(__NOW__.getFullYear(), __NOW__.getMonth() - 23, 1).getTime()
Component({
properties: {
showAddIcon: Boolean,
navBarHeight: Number,
searchObj: Object,
userInfo: Object
},
data: {
IMG_URL,
// 列表与分页(保持原有结构)
listTabs: ['全部', '跟进中', '已签约', '已绑定', '未签约'],
customerList: [],
currentPage: 1,
pageSize: 10,
hasMore: true,
loading: false,
statusIndex: 0,
boardMonthText: `${__NOW__.getMonth() + 1}月`,
boardScopeText: '全部',
dashboard: {},
boardMonthActive: true,
boardScopeActive: false,
monthPickerShow: false,
minMonthDate: __MIN_YM_TS__,
maxMonthDate: __CUR_YM_TS__,
monthPickerValue: __CUR_YM_TS__,
// 新增:暂存用户正在选择的值,确认后写入
pendingMonthValue: 0,
// 保持原有的状态标签映射
statusText: {
1: { label: '跟进中', color: '#FF9D0A' },
2: { label: '已签约', color: '#35C376' },
3: { label: '未签约', color: '#F24724' },
4: { label: '已绑定', color: '#347BFF' }
}
},
lifetimes: {
attached() {
this.getPageData()
}
},
methods: {
getPageData() {
// 获取数据看板数据
this.getStatic()
// 获取潜客列表数据
this.resetAndLoad()
},
getParams() {
let { boardScopeActive, monthPickerValue, searchObj, statusIndex } = this.data
const statusMap = {
0: 0, // 全部
1: 1, // 待跟进
2: 3, // 已签约
3: 4, // 已绑定
4: 2 // 未签约
}
const obj = {
isAll: boardScopeActive ? 1 : 0,
year: boardScopeActive ? undefined : new Date(monthPickerValue).getFullYear(),
month: boardScopeActive ? undefined : new Date(monthPickerValue).getMonth() + 1,
mainBrandId: searchObj?.selectedMainBrand?.[0]?.id,
subBrandId: searchObj?.selectedMainBrand?.[0]?.children[0]?.id,
cooperationMode: searchObj?.cooperationModelList?.value,
businessTypeList: searchObj?.businessTypeList?.map(val => { if (val.value) return val.value })?.join(','),
flowSituation: searchObj?.trafficStatusList?.value,
provinceId: searchObj?.provinces?.value,
salesPersonId: searchObj?.salesStaffList?.value,
status: statusMap[statusIndex]
}
return obj
},
getStatic() {
let params = this.getParams()
delete params.status
console.log(params, '111111111')
// CustomerApi.getPotentialStatic({}).then(res => {
// })
this.setData({
dashboard: {
potentialCustomersCount: 900,
followUpCount: 60,
signedCount: 30,
notSignedCount: 30,
bindCount: 10
}
}, () => {
this.recordTabTop()
})
},
recordTabTop() {
const query = wx.createSelectorQuery().in(this)
query.select('.tabbar-anchor').boundingClientRect()
query.exec(res => {
const top = res[0]?.top
const height = res[0]?.height
this.setData({
initialTabTop: top,
tabHeight: height
})
})
},
chooseBoard(e) {
const { type } = e.currentTarget.dataset
if (type === 'month') {
// 打开月份选择器
this.openMonthPicker()
} else {
this.setData({ boardMonthActive: false, boardScopeActive: true }, () => {
this.getPageData()
})
}
},
openMonthPicker() {
this.setData({ monthPickerShow: true, pendingMonthValue: this.data.monthPickerValue })
},
closeMonthPicker() {
this.setData({ monthPickerShow: false })
},
popupConfirm() {
const val = this.data.pendingMonthValue || this.data.monthPickerValue
if (val) {
const d = new Date(val)
this.setData({
monthPickerValue: val,
boardMonthText: `${d.getMonth() + 1}月`,
boardMonthActive: true,
boardScopeActive: false
}, () => {
this.getPageData()
})
}
this.closeMonthPicker()
},
cancel() {
this.closeMonthPicker()
},
onMonthChange(e) {
const values = e.detail.getValues()
const year = Number(String(values?.[0] || '').replace(/[年月日时分]/g, ''))
const month = Number(String(values?.[1] || '').replace(/[年月日时分]/g, ''))
if (!year || !month) return
const ts = new Date(year, month - 1, 1).getTime()
this.setData({ pendingMonthValue: ts })
},
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({ statusIndex: index }, () => {
this.resetAndLoad(() => {
this.triggerEvent('needScrollTop', this.data.initialTabTop)
})
})
},
resetAndLoad(cb) {
this.setData({ currentPage: 1, hasMore: true })
this.loadMore(cb)
},
getMore() {
this.loadMore()
},
async loadMore(cb) {
this.setData({ loading: true })
try {
const { currentPage, pageSize } = this.data
const params = this.getParams()
console.log({
currentPage,
pageSize,
...params
}, '222222222222')
// const res = await mineCustomerApi.getPotentialList({ currentPage, pageSize })
// 假数据
const res = {
list: [{
id: 1
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}]
}
res.list?.forEach(val => {
val.status = 1
})
const nextList = res?.list || []
const total = res?.total || res?.count || 0
const pages = res?.pages || (total ? Math.ceil(total / pageSize) : null)
const hasMore = pages != null ? currentPage < pages : nextList.length === pageSize
this.setData({
customerList: this.data.customerList.concat(nextList),
currentPage: currentPage + 1,
hasMore,
loading: false
})
} catch (err) {
console.warn('获取客户列表失败:', err)
this.setData({ loading: false, hasMore: false })
}
cb && cb()
},
// 新增潜客
jump(e) {
let { item, name } = e.currentTarget.dataset
if (name) { // 结果反馈
wx.navigateTo({
url: `/packageCustomer/pages/resultFeedback/resultFeedback?query=${encodeURIComponent(JSON.stringify(item))}`
})
} else { // 新增编辑潜客
wx.navigateTo({
url: item && Object.keys(item)?.length > 0 ? `/packageCustomer/pages/createPotential/createPotential?pageType=edit&query=${encodeURIComponent(JSON.stringify(item))}` : `/packageCustomer/pages/createPotential/createPotential?pageType=add`
})
}
},
// 潜客详情
goDetail(e) {
let { item } = e.currentTarget.dataset
wx.navigateTo({
url: `/packageCustomer/pages/potentialDetail/potentialDetail?query=${encodeURIComponent(JSON.stringify(item))}`
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"tab-bar": "/components/TabBar/TabBar",
"nothing-tips": "/components/Nothing-tips/nothingTips",
"popup": "/components/Popup/Popup",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}
\ No newline at end of file \ No newline at end of file
/* pages/tab/customer/components/PotentialSection/PotentialSection.wxss */
.potential-page {
.data-board {
margin: 0 20rpx;
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.board-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
.board-title {
font-size: 32rpx;
font-weight: 600;
color: #181A1F;
}
.board-actions {
display: flex;
gap: 16rpx;
.board-action {
display: flex;
align-items: center;
height: 48rpx;
padding: 0 16rpx;
font-size: 28rpx;
border-radius: 4rpx;
opacity: 1;
border: 1rpx solid #e0e0e0;
box-shadow: 0 0 8rpx 0 #0000000f;
color: #757980;
position: relative;
image {
width: 28rpx;
height: 28rpx;
margin-left: 8rpx;
transform: rotate(90deg);
}
&.active {
color: #292D33;
}
}
}
}
.board-grid {
display: flex;
flex-wrap: wrap;
.grid-item {
width: calc(100% / 3);
margin: 16rpx 0;
.label {
font-size: 24rpx;
color: #757B85;
}
.value {
margin-top: 8rpx;
font-size: 40rpx;
font-weight: 700;
color: #292D33;
}
}
}
}
.tabbar-anchor {
width: 100%;
min-height: 88rpx;
margin-top: 24rpx;
position: sticky;
top: 0;
z-index: 99;
}
/* 列表卡片 */
.list-section {
box-sizing: border-box;
padding: 24rpx 20rpx 0;
background: #F7F8FA;
.list-card {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 8rpx 16rpx 0 rgba(0,0,0,0.04);
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8rpx;
.title {
font-size: 32rpx;
font-weight: 600;
color: #292D33;
}
.status-tag {
flex-shrink: 0;
font-size: 26rpx;
margin-left: 28rpx;
}
}
.card-row {
display: flex;
margin-top: 10rpx;
font-size: 28rpx;
.label {
margin-right: 24rpx;
color: #999EA8;
}
.value {
flex: 1;
color: #292D33;
}
}
.card-actions {
display: flex;
gap: 16rpx;
margin-top: 16rpx;
justify-content: flex-end;
.btn {
padding: 8rpx 16rpx;
border-radius: 12rpx;
background: #347BFF;
color: #fff;
font-size: 28rpx;
}
.ghost {
background: #347bff1a;
color: #347BFF;
}
}
}
.list-footer {
color: #999EA8;
padding-bottom: 20rpx;
font-size: 24rpx;
display: flex;
justify-content: center;
}
}
.fixed-btns {
position: fixed;
right: 20rpx;
bottom: 66rpx;
display: flex;
justify-content: center;
background: #FFFFFF;
box-shadow: 0 4rpx 20rpx 0 #0000001a;
border-radius: 16rpx;
.btn {
box-sizing: border-box;
padding: 20rpx 18rpx;
display: flex;
flex-flow: column;
align-items: center;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 24rpx;
color: #347BFF;
width: 136rpx;
height: 136rpx;
image {
width: 60rpx;
height: 60rpx;
flex-shrink: 0;
}
}
}
.arrowIcon {
position: fixed;
right: 0;
bottom: 66rpx;
width: 36rpx;
height: 136rpx;
background: #FFFFFF;
border: 2rpx solid #EFF0F2;
box-shadow: 0 4rpx 20rpx 0 #0000001a;
border-radius: 16rpx 0 0 16rpx;
display: flex;
align-items: center;
justify-content: center;
.image {
width: 32rpx;
height: 32rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/customer/components/PotentialSection/PotentialSection.wxml-->
<view class="potential-page">
<view class="data-board">
<view class="customer-page">
<view class="board">
<view class="board-header">
<view class="board-title">数据看板</view>
<view class="board-actions">
<view class="board-action {{boardMonthActive ? 'active' : ''}}" bindtap="chooseBoard" data-type="month">
<text>{{boardMonthText}}</text>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view>
<view class="board-action {{boardScopeActive ? 'active' : ''}}" bindtap="chooseBoard">
<text>{{boardScopeText}}</text>
</view>
</view>
</view>
<view class="board-grid">
<view class="grid-item">
<view class="label">潜客数</view>
<view class="value">{{dashboard.potentialCustomersCount}}</view>
</view>
<view class="grid-item">
<view class="label">跟进中</view>
<view class="value">{{dashboard.followUpCount}}</view>
</view>
<view class="grid-item">
<view class="label">已签约</view>
<view class="value">{{dashboard.signedCount}}</view>
</view>
<view class="grid-item">
<view class="label">已绑定</view>
<view class="value">{{dashboard.bindCount}}</view>
</view>
<view class="grid-item">
<view class="label">未签约</view>
<view class="value">{{dashboard.notSignedCount}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="tabbar-anchor" >
<tab-bar tabList="{{ listTabs }}" bindclick="tabClick" activeIndex="{{ statusIndex }}" />
</view>
<!-- 列表(潜客) -->
<view class="list-section" id="" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);" >
<block wx:if="{{customerList.length}}">
<block wx:for="{{customerList}}" wx:key="index">
<view class="list-card" bindtap="goDetail" data-item="{{item}}">
<view class="card-header">
<view class="title">{{item.shopName || item.merchantName || '-'}} </view>
<view class="status-tag" style="color: {{statusText[item.status].color}}">{{statusText[item.status].label}}</view>
</view>
<view class="card-row">
<view class="label">拜访次数</view>
<view class="value">{{item.visitCount || item.visitTimes || 0}}次</view>
</view>
<view class="card-row">
<view class="label">跟进人</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
</view>
<block wx:if="{{item.status == 2 || item.status == 4}}">
<view class="card-row" >
<view class="label">预计展业时间</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
</view>
<view class="card-row">
<view class="label">分润规则</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
</view>
<view class="card-row">
<view class="label">上架产品信息</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
</view>
</block>
<view class="card-row" wx:if="{{item.status == 3}}">
<view class="label">战败原因</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
</view>
<view class="card-actions" wx:if="{{userInfo.loginRole != 1}}">
<view wx:if="{{item.status == 1 || item.status == 2}}" class="btn {{item.status == 1 ? 'ghost' : ''}}" catchtap="jump" data-item="{{item}}">信息完善</view>
<view wx:if="{{item.status == 1}}" class="btn" catchtap="jump" data-item="{{item}}" data-name="resultFeedback">结果反馈</view>
</view>
</view>
</block>
<view class="list-footer" wx:if="{{loading}}">加载中...</view>
<view class="list-footer" wx:if="{{!hasMore && customerList.length}}">到底了~</view>
</block>
<block wx:else>
<nothing-tips tips="暂无数据" bgColor="{{'#F7F8FA'}}" emptyDataStyle="height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);" />
</block>
</view>
<!-- 悬浮新增潜客按钮 -->
<block wx:if="{{userInfo.loginRole != 1}}">
<block wx:if="{{ showAddIcon }}">
<view class="fixed-btns">
<view class="btn text-center" bindtap="jump">
<image src="{{ IMG_URL }}customer/add-potential.png" />
新增潜客
</view>
</view>
</block>
<block wx:else>
<view class="arrowIcon">
<image class="image" src="{{ IMG_URL }}customer/arrow.png" />
</view>
</block>
</block>
</view>
<popup bind:hidePopup="cancel" bind:confirm="popupConfirm" customPopupSlotStyle="{{'height: calc(100% - 210rpx)'}}" show="{{monthPickerShow}}" title="选择月份" height="50%">
<van-datetime-picker
id="datePicker"
type="year-month"
model:value="{{monthPickerValue}}"
min-date="{{minMonthDate}}"
max-date="{{maxMonthDate}}"
show-toolbar="{{false}}"
bind:change="onMonthChange"
/>
</popup>
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
// 预计算安全的月份时间戳,避免初始 0 值
const __NOW__ = new Date()
const __CUR_YM_TS__ = new Date(__NOW__.getFullYear(), __NOW__.getMonth(), 1).getTime()
const __MIN_YM_TS__ = new Date(__NOW__.getFullYear(), __NOW__.getMonth() - 23, 1).getTime()
Component({
properties: {
navBarHeight: Number,
searchObj: Object
},
data: {
IMG_URL,
// 门店数据看板(示例数据)
boardMonthText: `${__NOW__.getMonth() + 1}月`,
boardScopeText: '全部',
boardMonthActive: true,
boardScopeActive: false,
// 月份选择器
monthPickerShow: false,
minMonthDate: __MIN_YM_TS__,
maxMonthDate: __CUR_YM_TS__,
monthPickerValue: __CUR_YM_TS__,
pendingMonthValue: 0,
// 列表与分页
storeList: [],
currentPage: 1,
pageSize: 10,
hasMore: true,
loading: false,
// 门店状态 TabBar
listTabs: ['全部', '新店', '老店'],
statusIndex: 0,
activeStatus: 'all'
},
lifetimes: {
attached() {
this.getPageData()
}
},
methods: {
getPageData() {
// 获取数据看板数据
this.getStatic()
// 获取潜客列表数据
this.resetAndLoad()
},
getParams() {
let { boardScopeActive, monthPickerValue, searchObj, statusIndex } = this.data
console.log(searchObj)
const statusMap = {
0: 0, // 全部
1: 1, // 待跟进
2: 3, // 已签约
3: 4, // 已绑定
4: 2 // 未签约
}
const obj = {
isAll: boardScopeActive ? 1 : 0,
year: boardScopeActive ? undefined : new Date(monthPickerValue).getFullYear(),
month: boardScopeActive ? undefined : new Date(monthPickerValue).getMonth() + 1,
mainBrandId: searchObj?.selectedMainBrand?.[0]?.id,
subBrandId: searchObj?.selectedMainBrand?.[0]?.children[0]?.id,
cooperationMode: searchObj?.cooperationModelList?.value,
businessTypeList: searchObj?.businessTypeList?.map(val => { if (val.value) return val.value })?.join(','),
flowSituation: searchObj?.trafficStatusList?.value,
provinceId: searchObj?.provinces?.value,
salesPersonId: searchObj?.salesStaffList?.value,
status: statusMap[statusIndex]
}
return obj
},
getStatic() {
const params = this.getParams()
console.log(params, '11111')
// 假数据
const res = {
code: 0,
message: '',
data: {
total: 900,
newStore: 60,
oldStore: 30,
notOrdered: 30,
ordered: 10
}
}
this.setData({
dashboard: res.data || {}
}, () => {
this.recordTabTop()
})
return
CustomerApi.getStoreStatic(params).then(res => {
})
},
recordTabTop() {
const query = wx.createSelectorQuery().in(this)
query.select('.tabbar-anchor').boundingClientRect()
query.exec(res => {
console.log(res, '1111')
const top = res[0]?.top
const height = res[0]?.height
this.setData({
initialTabTop: top,
tabHeight: height
})
})
},
// 选择数据看板的月份或范围(保持原交互)
chooseBoard(e) {
const { type } = e.currentTarget.dataset
if (type === 'month') {
// 打开月份选择器
this.openMonthPicker()
} else {
this.setData({ boardMonthActive: false, boardScopeActive: true }, () => {
this.getPageData()
})
}
},
// 打开/关闭月份选择器(保持原有结构)
openMonthPicker() {
this.setData({ monthPickerShow: true, pendingMonthValue: this.data.monthPickerValue })
},
closeMonthPicker() {
this.setData({ monthPickerShow: false })
},
// 弹窗事件:确认后写入月份值与文案
popupConfirm() {
const val = this.data.pendingMonthValue || this.data.monthPickerValue
if (val) {
const d = new Date(val)
this.setData({
monthPickerValue: val,
boardMonthText: `${d.getMonth() + 1}月`,
boardMonthActive: true,
boardScopeActive: false
}, () => {
this.getPageData()
})
}
this.closeMonthPicker()
},
cancel() {
this.closeMonthPicker()
},
// 选择变化:严格参照 createVisit(使用 getValues 返回的带单位字符串)
onMonthChange(e) {
const values = e.detail.getValues()
const year = Number(String(values?.[0] || '').replace(/[年月日时分]/g, ''))
const month = Number(String(values?.[1] || '').replace(/[年月日时分]/g, ''))
if (!year || !month) return
const ts = new Date(year, month - 1, 1).getTime()
this.setData({ pendingMonthValue: ts })
},
// TabBar 点击(门店状态筛选)
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
const statusMap = ['all', 'new', 'old']
this.setData({ statusIndex: index, activeStatus: statusMap[index] || 'all' }, () => {
this.resetAndLoad(() => {
this.triggerEvent('needScrollTop', this.data.initialTabTop)
})
})
},
// 列表加载逻辑
resetAndLoad(cb) {
this.setData({ currentPage: 1, hasMore: true })
this.loadMore(cb)
},
getMore() {
console.log(222)
},
async loadMore(cb) {
this.setData({ loading: true })
try {
const { currentPage, pageSize } = this.data
const params = this.getParams()
console.log({
currentPage,
pageSize,
...params
}, '22222222')
// 暂用同一接口演示门店列表:真实项目可替换为门店专用接口
// const res = await CustomerApi.getStorePageList({ currentPage, pageSize })
// 假数据
const res = {
list: [{
id: 1
}]
}
const nextList = (res?.list || []).map((item, idx) => {
// 演示数据:根据当前门店状态索引打标 new/old(真实项目用后端字段)
const storeStatus = this.data.statusIndex === 1 ? 'new' : (this.data.statusIndex === 2 ? 'old' : (idx % 2 ? 'new' : 'old'))
return { ...item, storeStatus }
})
const total = res?.total || res?.count || 0
const pages = res?.pages || (total ? Math.ceil(total / pageSize) : null)
const hasMore = pages != null ? currentPage < pages : nextList.length === pageSize
this.setData({
storeList: this.data.storeList.concat(nextList),
currentPage: currentPage + 1,
hasMore,
loading: false
})
} catch (err) {
console.warn('获取门店列表失败:', err)
this.setData({ loading: false, hasMore: false })
}
cb && cb()
},
goDetail(e) {
let { item } = e.currentTarget.dataset
wx.navigateTo({
url: `/packageCustomer/pages/merchantDetail/merchantDetail?query=${encodeURIComponent(JSON.stringify(item))}`
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"tab-bar": "/components/TabBar/TabBar",
"nothing-tips": "/components/Nothing-tips/nothingTips",
"popup": "/components/Popup/Popup",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}
\ No newline at end of file \ No newline at end of file
.store-layout {
background: transparent;
}
.tabbar-anchor {
width: 100%;
min-height: 88rpx;
margin-top: 24rpx;
position: sticky;
top: 0;
z-index: 99;
}
.data-board {
margin: 0 20rpx;
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.board-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
.board-title {
font-size: 32rpx;
font-weight: 600;
color: #181A1F;
}
.board-actions {
display: flex;
gap: 16rpx;
.board-action {
display: flex;
align-items: center;
height: 48rpx;
padding: 0 16rpx;
font-size: 28rpx;
border-radius: 4rpx;
opacity: 1;
border: 1rpx solid #e0e0e0;
box-shadow: 0 0 8rpx 0 #0000000f;
color: #757980;
position: relative;
image {
width: 28rpx;
height: 28rpx;
margin-left: 8rpx;
transform: rotate(90deg);
}
&.active {
color: #292D33;
}
}
}
}
.board-grid {
display: flex;
flex-wrap: wrap;
.grid-item {
width: calc(100% / 3);
margin: 16rpx 0;
.label {
font-size: 24rpx;
color: #757B85;
}
.value {
margin-top: 8rpx;
font-size: 40rpx;
font-weight: 700;
color: #292D33;
}
}
}
}
.list-section {
box-sizing: border-box;
padding: 24rpx 20rpx 0;
background: #F7F8FA;
.list-card {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
&:last-child{
margin-bottom: 0;
}
.card-header {
display: flex;
.status-tag {
margin-top: 6rpx;
flex-shrink: 0;
font-size: 22rpx;
height: 32rpx;
line-height: 32rpx;
padding: 0 8rpx;
border-radius: 4rpx;
margin-right: 8rpx;
}
.new {
color: #35C376;
background: #35c37614;
}
.old {
color: #347BFF;
background: #347bff14;
}
.title {
font-size: 32rpx;
font-weight: 600;
color: #292D33;
}
}
.card-row {
display: flex;
align-items: center;
margin-top: 16rpx;
color: #999EA8;
font-size: 28rpx;
.label {
flex-shrink: 0;
width: 112rpx;
margin-right: 24rpx;
}
.value {
color: #292D33;
}
}
}
}
.list-footer {
text-align: center;
color: #757B85;
padding-bottom: 20rpx;
}
\ No newline at end of file \ No newline at end of file
<view class="store-layout">
<!-- 数据看板(门店) -->
<view class="data-board">
<view class="board">
<view class="board-header">
<view class="board-title">数据看板</view>
<view class="board-actions">
<view class="board-action {{boardMonthActive ? 'active' : ''}}" bindtap="chooseBoard" data-type="month">
<text>{{boardMonthText}}</text>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view>
<view class="board-action {{boardScopeActive ? 'active' : ''}}" bindtap="chooseBoard" data-type="scope">
<text>{{boardScopeText}}</text>
</view>
</view>
</view>
<view class="board-grid">
<view class="grid-item">
<view class="label">门店总数</view>
<view class="value">{{dashboard.total}}</view>
</view>
<view class="grid-item">
<view class="label">新店</view>
<view class="value">{{dashboard.newStore}}</view>
</view>
<view class="grid-item">
<view class="label">老店</view>
<view class="value">{{dashboard.oldStore}}</view>
</view>
<view class="grid-item">
<view class="label">未出单</view>
<view class="value">{{dashboard.notOrdered}}</view>
</view>
<view class="grid-item">
<view class="label">已出单</view>
<view class="value">{{dashboard.ordered}}</view>
</view>
</view>
</view>
</view>
<!-- 列表状态筛选 TabBar(与父页吸顶逻辑保持一致类名) -->
<view class="tabbar-anchor" id="storeListTop">
<tab-bar tabList="{{ listTabs }}" bindclick="tabClick" activeIndex="{{ statusIndex }}" />
</view>
<!-- 列表(门店) -->
<view class="list-section" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);">
<block wx:if="{{storeList.length}}">
<block wx:for="{{storeList}}" wx:key="index">
<view class="list-card" bindtap="goDetail" data-item="{{item}}">
<view class="card-header">
<view class="status-tag {{item.storeStatus == 'new' ? 'new' : 'old'}}">{{ item.storeStatus == 'new' ? '新店' : '老店' }}</view>
<view class="title">{{item.shopName || item.merchantName || '-'}} </view>
</view>
<view class="card-row">
<view class="label">拜访次数</view>
<view class="value">{{item.visitCount || item.visitTimes || 0}}次</view>
</view>
<view class="card-row">
<view class="label">销售人员</view>
<view class="value">{{item.salesUser || item.follower || '-'}} </view>
</view>
<view class="card-row">
<view class="label">门店地址</view>
<view class="value">{{item.address || item.shopAddress || '-'}} </view>
</view>
<view class="card-row">
<view class="label">签约时间</view>
<view class="value">{{item.lastFollow || item.lastFollowTime || '-'}} </view>
</view>
<view class="card-row">
<view class="label">展业时间</view>
<view class="value">{{item.bizTime || item.expectBizTime || '-'}} </view>
</view>
</view>
</block>
<view class="list-footer" wx:if="{{loading}}">加载中...</view>
<view class="list-footer" wx:if="{{!hasMore && storeList.length}}">到底了~</view>
</block>
<block wx:else>
<nothing-tips tips="暂无数据" bgColor="{{'#F7F8FA'}}" emptyDataStyle="height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);" />
</block>
</view>
<!-- 月份选择弹窗(门店) -->
<popup bind:hidePopup="cancel" bind:confirm="popupConfirm" customPopupSlotStyle="{{'height: calc(100% - 210rpx)'}}" show="{{monthPickerShow}}" title="选择月份" height="50%">
<van-datetime-picker
type="year-month"
model:value="{{monthPickerValue}}"
min-date="{{minMonthDate}}"
max-date="{{maxMonthDate}}"
show-toolbar="{{false}}"
bind:change="onMonthChange"
/>
</popup>
</view>
\ No newline at end of file \ No newline at end of file
// pages/tab/customer/customer.js // pages/tab/customer/customer.js
import { IMG_URL } from '~/utils/constantData'
import { getUserInfo } from '~/utils/cache/userInfo'
const navStyleTransparent = 'background-color: transparent;'
import reportPageTrackMixin from '~/mixins/reportPageTrackMixin'
Page({ Page({
// behaviors: [reportPageTrackMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMG_URL,
navStyle: navStyleTransparent,
userInfo: getUserInfo(),
tabList: [{
id: 1,
name: '潜客'
}, {
id: 2,
name: '门店'
}],
myTabIdx: 0,
scrollIntoView: '',
selectedScreenPotential: [{
label: '主营品牌',
valueText: '',
key: 'selectedMainBrand'
}, {
label: '业务类型',
valueText: '',
key: 'businessTypeList'
}, {
label: '合作模式',
valueText: '',
key: 'cooperationModelList'
}, {
label: '流量情况',
valueText: '',
key: 'trafficStatusList'
}, {
label: '所属省份',
valueText: '',
key: 'provinces'
}, {
label: '销售人员',
valueText: '',
key: 'salesStaffList'
}],
selectedScreenStore: [{
label: '主营品牌',
valueText: '',
key: 'selectedMainBrand'
}, {
label: '业务类型',
valueText: '',
key: 'businessTypeList'
}, {
label: '合作模式',
valueText: '',
key: 'cooperationModelList'
}, {
label: '流量情况',
valueText: '',
key: 'trafficStatusList'
}, {
label: '所属省份',
valueText: '',
key: 'provinces'
}, {
label: '销售人员',
valueText: '',
key: 'salesStaffList'
}],
pendingMonthValue: null,
showAddIcon: true,
navBarHeight: 0,
navigationBarHeight: 0,
scrollTop: 0,
setScrollTop: 0,
track_event_code: 'customer_view_page',
},
// 总监有查看某个员工的潜客数据,手动触发时,将员工过滤条件清除
onTabItemTap(e) {
console.log('2222')
// 点击埋点
wx.$track.setTrackData(0, 'customer_page', {}, '')
}, },
/** // 导航栏就绪,记录高度并进行一次测量
* 生命周期函数--监听页面加载 navbarReady(e) {
*/ const {height, navigationBarHeight} = e.detail
onLoad(options) { this.setData({
navBarHeight: height,
navigationBarHeight
})
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() { onReady() {
const query = wx.createSelectorQuery().in(this)
query.select('.fixed-header').boundingClientRect()
query.exec(res => {
const height = res[0]?.height
this.setData({
fixedHeight: height
})
})
},
onLoad(options) {
}, },
/**
* 生命周期函数--监听页面显示
*/
onShow() { onShow() {
// this.onPageShow()
}, },
getMore() {
/** let { myTabIdx } = this.data
* 生命周期函数--监听页面隐藏 const component = myTabIdx == 0 ? 'potentialSection' : 'storeSection'
*/ const coms = this.selectComponent(`#${component}`)
onHide() { if (coms.getMore) coms.getMore()
},
onPageScroll(e) {
const scrollTop = e.detail.scrollTop
// 悬浮按钮:滚动中收起,停止后展开
if (this._fabTimer) clearTimeout(this._fabTimer)
this.setData({ showAddIcon: false, scrollTop })
this._fabTimer = setTimeout(() => {
this.setData({ showAddIcon: true })
}, 120)
}, },
/** scrollToListTop(e) {
* 生命周期函数--监听页面卸载 let { scrollTop, navBarHeight, fixedHeight } = this.data
*/ if (scrollTop > (e.detail - navBarHeight - fixedHeight)) {
onUnload() { this.setData({
setScrollTop: e.detail - navBarHeight - fixedHeight
})
}
}, },
/** // 触底加载转发到当前组件
* 页面相关事件处理函数--监听用户下拉动作 onReachBottom() {
*/ const comp = this.data.myTabIdx === 0 ? this.selectComponent('#potentialSection') : this.selectComponent('#storeSection')
onPullDownRefresh() { comp && comp.loadMore && comp.loadMore()
},
// 筛选页面返回
back() {
this.setData({
show_confirm: false,
})
wx.showTabBar()
}, },
/** // 筛选页面确认
* 页面上拉触底事件的处理函数 search() {
*/ const { selectedScreenPotential, selectedScreenStore, searchObj, storeSearchObj, myTabIdx } = this.data
onReachBottom() { const sourceList = myTabIdx == 0 ? selectedScreenPotential : selectedScreenStore
const valueObj = myTabIdx == 0 ? (searchObj || {}) : (storeSearchObj || {})
const nextSelected = (sourceList || []).map(item => {
const key = item.key
const val = valueObj[key]
let text = ''
if (val) {
if (key === 'businessTypeList') {
// 业务类型为多选;当为“全部”或空时不回显
if (Array.isArray(val)) {
const filtered = val.filter(v => !(v?.name === '全部' || v?.value === ''))
text = filtered.length ? filtered.map(v => v.name).join('/') : ''
}
} else if (key === 'selectedMainBrand') {
// 主营品牌为数组;为空不回显
text = Array.isArray(val)
? val.map(v => (v?.children?.[0]?.name || v?.name || ''))
.filter(Boolean)
.join('/')
: ''
} else {
// 单选项;选择“全部”或空值不回显
text = (val?.name === '全部' || val?.value === '') ? '' : (val?.name || '')
}
}
return { ...item, valueText: text }
})
if (myTabIdx == 0) {
this.setData({ selectedScreenPotential: nextSelected }, () => {
const potential = this.selectComponent('#potentialSection')
if (potential) potential.getPageData()
})
} else {
this.setData({ selectedScreenPotential: nextSelected }, () => {
const storeSection = this.selectComponent('#storeSection')
if (storeSection) storeSection.getPageData()
})
}
},
// 选择筛选条件
changeScreen() {
this.setData({
showRendering: true,
show_confirm: true,
});
wx.hideTabBar()
}, },
/** createPotential() {
* 用户点击右上角分享 wx.navigateTo({ url: '/packageCustomer/pages/createPotential/createPotential' })
*/ },
onShareAppMessage() {
// Tab 切换 + 重测量 + 列表刷新
changeMyTab(e) {
const index = e?.currentTarget?.dataset?.id
const nextIdx = typeof index === 'number' ? index : 0
if (nextIdx === this.data.myTabIdx) return
this.setData({ myTabIdx: nextIdx, setScrollTop: 0 }, () => {
if (nextIdx === 0) {
const comp = this.selectComponent('#potentialSection')
comp && comp.resetAndLoad && comp.resetAndLoad()
} else {
const comp = this.selectComponent('#storeSection')
comp && comp.resetAndLoad && comp.resetAndLoad()
}
})
},
onHide() {
// this.onPageHide()
},
onUnload() {
// this.onPageHide()
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": {} "navigationStyle": "custom",
"usingComponents": {
"page-screen": "./components/PageScreen/PageScreen",
"store-section": "./components/StoreSection/StoreSection",
"potential-section": "./components/PotentialSection/PotentialSection"
}
} }
\ No newline at end of file \ No newline at end of file
/* pages/tab/customer/customer.wxss */ /* pages/tab/customer/customer.wxss */
.bar-nav {
display: flex;
align-items: center;
justify-content: center;
color: #000000;
font-weight: 600;
}
.fixed-header {
left: 0;
position: absolute;
height: 172rpx;
width: 100%;
.my-tab{
display: flex;
margin: 24rpx 0 24rpx 52rpx;
.my-tab-item{
font-weight: 400;
font-size: 32rpx;
color: #181A1F;
text-align: center;
height: 52rpx;
display: inline-block;
line-height: 52rpx;
margin-right: 30rpx;
&:last-child{
margin-right: 0;
}
}
.tab-item-active{
font-weight: 600;
font-size: 36rpx;
}
}
.screen-box {
box-sizing: border-box;
padding: 0 20rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: space-between;
.view-container {
height: 100%;
width: calc(100% - 32rpx);
flex-wrap: nowrap;
}
.view-box {
height: 100%;
display: inline-flex;
align-items: center;
gap: 16rpx;
font-size: 24rpx;
width: auto;
.view-item {
flex: 0 0 auto;
height: 100%;
display: flex;
padding: 0 8rpx;
border-radius: 8rpx;
opacity: 1;
background: #ffffff80;
align-items: center;
margin-right: 16rpx;
&:last-child {
margin-right: 0;
}
.label {
color: #757980;
}
image {
width: 32rpx;
height: 32rpx;
margin-left: 8rpx;
transform: rotate(90deg);
}
}
}
.screen-icon {
width: 64rpx;
display: flex;
align-items: center;
image {
width: 32rpx;
height: 32rpx;
}
}
}
}
.bg_iamge{
width: 100%;
height: 1000rpx;
position: absolute;
left: 0;
top: 0;
z-index: -1;
.image_class{
background-color: #fff;
width: 100%;
height: 100%;
}
}
.layout {
position: relative;
height: 100vh;
box-sizing: border-box;
overflow: hidden;
.container {
// height: 100%;
}
}
<!--pages/tab/customer/customer.wxml-->
<text>pages/tab/customer/customer.wxml</text>
\ No newline at end of file \ No newline at end of file
<!-- pages/tab/customer/customer.wxml -->
<view class="navigation-bar">
<navigation-bar fixedShowBack="{{ show_confirm }}" customBack bindback="back" navStyle="{{!show_confirm ? navStyle : ''}}" bindnavbarReady="navbarReady" page-title="工作台">
<view class="bar-nav" style="height: {{navigationBarHeight}}px">
<view class="bar-text">{{!show_confirm ? (staffName || '客户') : '筛选'}}</view>
</view>
<view class="fixed-header">
<view class="my-tab">
<view wx:for="{{tabList}}" wx:key="index" bindtap="changeMyTab" data-id="{{index}}" class='my-tab-item {{myTabIdx==index ? "tab-item-active": ""}}'>{{item.name}}</view>
</view>
<view class="screen-box">
<scroll-view class="view-container" scroll-x>
<view class="view-box">
<block wx:for="{{myTabIdx == 0 ? selectedScreenPotential : selectedScreenStore}}" wx:key="index">
<view bindtap="changeScreen" class="view-item" wx:if="{{userInfo.loginRole == 1 ? true : item.key != 'provinces' && item.key != 'salesStaffList'}}">
<view class="label" wx:if="{{!item.valueText}}">{{item.label}}</view>
<view class="value">{{item.valueText}}</view>
<image src="{{IMG_URL}}customer/arrow.png" mode=""/>
</view>
</block>
</view>
</scroll-view>
<view class="screen-icon" bindtap="changeScreen">
<image src="{{IMG_URL}}customer/screen-icon.png" mode=""/>
</view>
</view>
</view>
</navigation-bar>
</view>
<view class="bg_iamge">
<glsx-image src="{{'customer/top-bg.png'}}" class="image_class" />
</view>
<scroll-view class="layout" style="padding-top: calc({{navBarHeight}}px + 172rpx);" scroll-top="{{setScrollTop}}" scroll-y bindscrolltolower="getMore" bindscroll="onPageScroll">
<view class="container">
<block wx:if="{{myTabIdx==0}}">
<potential-section id="potentialSection"
showAddIcon="{{showAddIcon}}"
navBarHeight="{{navBarHeight}}"
bind:needScrollTop="scrollToListTop"
searchObj="{{searchObj}}"
userInfo="{{userInfo}}"
></potential-section>
</block>
<!-- 门店 Tab 内容:独立组件 -->
<block wx:else>
<store-section id="storeSection"
bind:needScrollTop="scrollToListTop"
showAddIcon="{{showAddIcon}}"
navBarHeight="{{navBarHeight}}"
searchObj="{{storeSearchObj}}"
/>
</block>
</view>
</scroll-view>
<page-container show="{{ show_confirm }}" duration="{{ 0 }}" overlay="{{ false }}" bind:afterleave="back">
<page-screen wx:if="{{ showRendering }}" show="{{ show_confirm }}" navBarHeight="{{ navBarHeight }}" currentTab="{{myTabIdx}}" userInfo="{{ userInfo }}"></page-screen>
</page-container>
\ No newline at end of file \ No newline at end of file
...@@ -26,3 +26,118 @@ export const IMG_VERSION = () => { ...@@ -26,3 +26,118 @@ export const IMG_VERSION = () => {
const accountInfo = wx.getAccountInfoSync() const accountInfo = wx.getAccountInfoSync()
return accountInfo.miniProgram.version || '1.0.0' return accountInfo.miniProgram.version || '1.0.0'
} }
export const PROVINCES = [
{ value: '110000', name: '北京市' },
{ value: '120000', name: '天津市' },
{ value: '130000', name: '河北省' },
{ value: '140000', name: '山西省' },
{ value: '150000', name: '内蒙古自治区' },
{ value: '210000', name: '辽宁省' },
{ value: '220000', name: '吉林省' },
{ value: '230000', name: '黑龙江省' },
{ value: '310000', name: '上海市' },
{ value: '320000', name: '江苏省' },
{ value: '330000', name: '浙江省' },
{ value: '340000', name: '安徽省' },
{ value: '350000', name: '福建省' },
{ value: '360000', name: '江西省' },
{ value: '370000', name: '山东省' },
{ value: '410000', name: '河南省' },
{ value: '420000', name: '湖北省' },
{ value: '430000', name: '湖南省' },
{ value: '440000', name: '广东省' },
{ value: '450000', name: '广西壮族自治区' },
{ value: '460000', name: '海南省' },
{ value: '500000', name: '重庆市' },
{ value: '510000', name: '四川省' },
{ value: '520000', name: '贵州省' },
{ value: '530000', name: '云南省' },
{ value: '540000', name: '西藏自治区' },
{ value: '610000', name: '陕西省' },
{ value: '620000', name: '甘肃省' },
{ value: '630000', name: '青海省' },
{ value: '640000', name: '宁夏回族自治区' },
{ value: '650000', name: '新疆维吾尔自治区' },
{ value: '710000', name: '台湾省' },
{ value: '810000', name: '香港特别行政区' },
{ value: '820000', name: '澳门特别行政区' }
]
export const COOPERATIONMODELIST = [{
name: '直营',
value: 1
}, {
name: '服务商',
value: 2
}, {
name: '合资',
value: 3
}]
export const SCENELIST = [{
name: '1.1 精品升级',
value: 1
}, {
name: '2.1权益升级',
value: 2
}, {
name: '2.2续保积分',
value: 3
}, {
name: '2.3延保升级',
value: 4
}, {
name: '6.1二手车',
value: 5
}]
export const TRSFFICSTATUSLIST = [{
name: '30 以下',
value: 1
}, {
name: '30-50',
value: 2
}, {
name: '50-80',
value: 3
}, {
name: '80-120',
value: 4
}, {
name: '120 以上',
value: 5
}]
export const MERCHANTMENUS = [
{
title: '延保',
index: 0
},
{
title: '权益',
index: 1
},
{
title: '轻改',
index: 2
}
]
export const ROLELIST = [{
label: '店总',
value: 1,
checked: true
}, {
label: '销售经理',
value: 2
}, {
label: '交付经理',
value: 3
}, {
label: '装饰经理',
value: 4
}, {
label: '保险经理',
value: 5
}]
\ No newline at end of file \ No newline at end of file
import GlMap from 'glsx-map-sdk' import GlMap from 'glsk-map-jssdk'
export default new GlMap() export default new GlMap()
...@@ -116,8 +116,10 @@ const djSecretKey = { ...@@ -116,8 +116,10 @@ const djSecretKey = {
const domain = { const domain = {
ip: { ip: {
// dj: 'http://192.168.1.165:8292', // dj: 'http://192.168.1.165:8292',
dj: 'http://192.168.3.189:8385', dj: 'http://192.168.1.150:8293',
scrm: 'http://192.168.1.165:8292' scrm: 'https://scrm.dev.glsx.com.cn'
// dj: 'http://192.168.3.189:8385',
// scrm: 'http://192.168.1.165:8292'
}, },
dev: { dev: {
dj: 'http://192.168.3.122:9203', dj: 'http://192.168.3.122:9203',
......
...@@ -29,7 +29,7 @@ class Request { ...@@ -29,7 +29,7 @@ class Request {
path = requestPath == 'dj' ? `/rop-dj-${projectName}/` : `/rop-scrm-${projectName}/` path = requestPath == 'dj' ? `/rop-dj-${projectName}/` : `/rop-scrm-${projectName}/`
} }
params = this.getData(params, requestPath) params = this.getData(params, requestPath)
// console.log(params,'params'); console.log(params.method,'params');
wx.request({ wx.request({
url: `${domain[requestPath]}${path}router?method=${params.method}`, url: `${domain[requestPath]}${path}router?method=${params.method}`,
data: params, data: params,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// 实例化对象存储 // 实例化对象存储
import { Storage } from '~/utils/cache/storage' import { Storage } from '~/utils/cache/storage'
import { getUserInfo } from '~/utils/cache/userInfo'
const $Storage = new Storage() const $Storage = new Storage()
let TRACK_TIME = null let TRACK_TIME = null
...@@ -133,12 +134,11 @@ class TRACK { ...@@ -133,12 +134,11 @@ class TRACK {
let recordList = $Storage.get('recordList'), let recordList = $Storage.get('recordList'),
{ route } = this.getPageInstance(), { route } = this.getPageInstance(),
prePagePath = this.getPageInstance(2), prePagePath = this.getPageInstance(2),
{ accountName, uuid, userType } = wx.$util.getUserInfo(), userInfo = getUserInfo(),
item = { item = {
loginAccount: accountName, loginAccount: userInfo.name,
uuid, uuid: userInfo.uuid,
userType, systemSource: 5,
systemSource: 0,
eventTime: new Date().format('yyyy-MM-dd hh:mm:ss'), eventTime: new Date().format('yyyy-MM-dd hh:mm:ss'),
eventType, eventType,
prePagePath: prePagePath ? prePagePath.route : '/', prePagePath: prePagePath ? prePagePath.route : '/',
...@@ -174,14 +174,13 @@ class TRACK { ...@@ -174,14 +174,13 @@ class TRACK {
if (recordList && recordList.length) if (recordList && recordList.length)
api api
.post( .post(
'clue.api.burial.point.record.batch.insert',
{ {
method: 'clue.api.burial.point.record.batch.insert',
apiProjectName: 'clue',
recordList recordList
}, },
[], '',
'/rop-scrm-clue/router', 'scrm'
'scrm',
false
) )
.then(({ code, data, message }) => { .then(({ code, data, message }) => {
if (code == 0 && data) { if (code == 0 && data) {
......
...@@ -7,6 +7,23 @@ import { commonApi, equityApi } from "../api/api"; ...@@ -7,6 +7,23 @@ import { commonApi, equityApi } from "../api/api";
// equityApi // equityApi
// } from '../api/api' // } from '../api/api'
import $router from "../router/index"; import $router from "../router/index";
/**emoji正则 */
const emojiReg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac])/g
/**过滤表情 */
const haveEmoji = value => {
let val = false
value = value.replace(/\s/g, '').trimStart().trimEnd()
if (emojiReg.test(value) && !/\s/g.test(value)) {
wx.showToast('不能输入表情')
val = true
}
return val
}
/**替换表情 */
const replaceEmoji = value => {
let val = value.replace(emojiReg, '')
return val.trimStart().trimEnd()
}
/** /**
* 日期格式化 * 日期格式化
...@@ -366,6 +383,8 @@ const Util = { ...@@ -366,6 +383,8 @@ const Util = {
setNavigationBarTitle, setNavigationBarTitle,
moneyThreeForTwoThousands, moneyThreeForTwoThousands,
checkRule, checkRule,
accMul accMul,
haveEmoji,
replaceEmoji
}; };
export default Util; export default Util;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!