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 2770 additions and 1848 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
import ActivityApi from './ActivityApi.js'
export default new ActivityApi()
\ 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
import CustomerApi from './CustomerApi.js'
export default new CustomerApi()
\ 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'
import { getDiscoverList } from '~/api/index.js'
import {Version} from 'glsx-common-sdk'
import { areaList } from "@vant/area-data"
/**全埋点 */
import Track from '~/utils/track'
......@@ -53,6 +54,7 @@ App({
wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$eventbus = eventbus
wx.$track = $Track
wx.$areaList = areaList
wx.$versionConfig = new Version({
request: {
baseUrl: 'https://config-center-backend.glsx.com.cn/glsxAdmin/config',
......
......@@ -68,7 +68,8 @@
"potentialDetail/potentialDetail",
"createVisit/createVisit",
"resultFeedback/resultFeedback",
"createPotential/createPotential"
"createPotential/createPotential",
"merchantDetail/merchantDetail"
]
},
{
......@@ -91,10 +92,10 @@
"preloadRule": {},
"usingComponents": {
"tab": "/components/Tab/Tab",
"tab-bar": "/components/TabBar/TabBar",
"navigation-bar": "/components/NavigationBar/NavigationBar",
"popup": "/components/Popup/Popup",
"nothing-tips": "/components/Nothing-tips/nothingTips",
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster",
"glsx-image": "/components/image/index",
"no-product": "/components/NoProduct/index",
"glsx-privacy": "glsx-applet-component/GlsxPrivacy/index",
......
......@@ -20,6 +20,10 @@
src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/Alimama_ShuHeiTi_Bold_Number.ttf");
} */
@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";
src: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/font/subset-AlimamaShuHeiTi-Bold.woff");
}
......
{
"component": true,
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index"
"search-input": "../SearchInput/SearchInput"
}
}
\ 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
<!--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
// 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
<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
<!-- 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
......@@ -11,6 +11,7 @@ Component({
custom: Boolean,
showBack: Boolean,
customBack: Boolean,
fixedShowBack: Boolean,
pageTitle: {
type: String,
value: '',
......
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}">
<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">
<image class="img" src="./images/icon-back.png" />
</view>
......
......@@ -6,7 +6,10 @@ Component({
*/
properties: {
tips: String,
bg: String,
bg: {
type: String,
value: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/sales-assistant/customer/nothing.png'
},
bgColor: {
type: String,
value: '#fff'
......
......@@ -9,12 +9,11 @@
// justify-content: center;
.bg {
width: 512rpx;
height: 512rpx;
width: 172rpx;
height: 172rpx;
}
.tips {
margin-top: -15rpx;
font-size: 24rpx;
color: #CCCED1;
text-align: center;
......
<!-- components/Nothing-tips/nothingTips.wxml -->
<view class="nothingCon custom-class" style="background-color: {{bgColor}};{{emptyDataStyle}}">
<image
wx:if="{{bg}}"
class="bg"
src="{{bg}}"
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
<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
/* 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
// 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
<!-- 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
......@@ -4,11 +4,26 @@
"lockfileVersion": 1,
"requires": true,
"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": {
"version": "1.10.7",
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.7.tgz",
"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": {
"version": "1.1.24",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
......
......@@ -4,7 +4,10 @@
"description": "",
"main": "app.js",
"dependencies": {
"@vant/area-data": "^1.5.1",
"@vant/weapp": "^1.10.7",
"dayjs": "^1.11.18",
"glsk-map-jssdk": "^0.1.1",
"glsx-applet-component": "^1.1.24",
"glsx-common-sdk": "^0.2.8",
"glsx-map-sdk": "^0.1.5"
......
{
"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
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
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup"
}
}
\ 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
// 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
{
"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
/* 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
<!--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
// 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
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup",
"van-area": "@vant/weapp/area/index"
}
}
\ 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
<!-- 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
// 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
{
"component": true,
"usingComponents": {
"popup": "/components/Popup/Popup"
}
}
\ 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
// 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
{
"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
/* 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
<!--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
// 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
{
"component": true,
"usingComponents": {
"line-echart": "../line/line"
}
}
\ 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
<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
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
<!-- 新的:接口对其了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
{
"component": true,
"usingComponents": {
"ec-canvas": "../ec-canvas/ec-canvas"
}
}
ec-canvas {
width: 100%;
height: 100%;
}
\ 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 {
box-sizing: border-box;
margin-bottom: 200rpx;
background: #FFFFFF;
width: 100%;
padding: 24rpx 32rpx 32rpx 32rpx;
}
.section {
margin: 16rpx 16rpx 24rpx;
border-bottom: 1rpx solid #E4E8EE;
border-bottom: 1rpx solid #E4E8EE80;
&:last-child {
border-bottom: 0;
margin-bottom: 0;
......@@ -40,7 +43,6 @@
.photo-wrap {
padding: 12rpx;
width: 100%;
background: #F7F8FA;
border-radius: 8rpx;
.photo {
width: 72rpx;
......
......@@ -5,7 +5,7 @@
<view class="card">
<view class="row">
<view class="label">门店名称</view>
<view class="value">{{detail.shopName || '-'}}</view>
<view class="value">{{detail.storeName || '-'}}</view>
</view>
<view class="row">
<view class="label">业务类型</view>
......@@ -32,11 +32,11 @@
<view class="card">
<view class="row">
<view class="label">所在地区</view>
<view class="value">{{detail.region || '-'}}</view>
<view class="value">{{detail.provinceName || ''}}{{detail.city || ''}}{{detail.districtName || ''}}</view>
</view>
<view class="row">
<view class="label">详细地址</view>
<view class="value">{{detail.addressDetail || '-'}}</view>
<view class="value">{{detail.address || '-'}}</view>
</view>
</view>
</view>
......@@ -55,24 +55,24 @@
</view>
<view class="row note-row">
<view class="label">备注信息</view>
<view class="value">{{detail.note || '-'}}
<view class="value">{{detail.remark || '-'}}
</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-title">{{m.role}}</view>
<view class="section-title">{{m.roleName}}</view>
<view class="card">
<view class="row">
<view class="label">名称</view>
<view class="value">{{m.name || '未配置'}}</view>
<view class="value">{{m.personnelName}}</view>
</view>
<view class="row">
<view class="label">手机号</view>
<view class="value">{{m.phone || '未配置'}}</view>
<view class="value">{{m.personnelPhone}}</view>
</view>
</view>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!