Commit 86764238 by 胡悦

增删页面

1 parent f9877dbe
Showing 179 changed files with 50 additions and 4779 deletions
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-09 15:17:35
*/
import api from './request'
import ssoApi from './ssoApi'
import wechatApi from './wechatApi'
import entmicroApi from './entmicroApi'
const common = 'scrm.api.carlife.common.'
module.exports = {
ssoApi,
entmicroApi,
wechatApi,
commonApi: {
/**上传图片
*/
uploadImg(data) {
return api.post({
method: `${common}uploadImg`,
...data,
noSignAttr: ['file']
})
},
/**视频上传
*/
uploadVideo(data) {
return api.post({
method: `${common}uploadVideo`,
...data,
noSignAttr: ['file']
})
},
// /**根据sceneId 查参数 */
// getSceneById(data) {
// return api.post('dj.api.smartcarlife.common.getSceneById', data)
// },
/** 首页、发现列表 搜索接口 */
search(data) {
return api.post({
method: 'scrm.api.carlife.weapp.homeSearch.search',
pageSize: 10,
...data
})
},
/** 根据sap编码获取商户详情 */
getBySapCode(data) {
return api.post({
method: `scrm.api.carlife.merchant.getBySapCode`,
...data,
}, true)
},
/**获取图片版本号 */
getMockConfig() {
return api.getMock()
......
import api from "./request";
const serverApi = {
//生成二维码
createQrCode: "scrm.api.wechat.miniprogram.createQrcode",
// 解析二维码参数
sceneById:'scrm.api.wechat.get.scene.by.id'
};
export const createQrCodeApi = (data) => {
return api.post(
{
method: serverApi.createQrCode,
...data,
},
true
);
};
export const sceneByIdApi = (data) => {
return api.post(
{
method: serverApi.sceneById,
...data,
}
);
};
\ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-09 13:59:57
*/
const target = ["ip", "dev", "uat", "beta", "prod"];
/**
*
......@@ -7,7 +14,7 @@ const target = ["ip", "dev", "uat", "beta", "prod"];
3预发布
4生产
*/
const index = 4;
const index = 2;
const secretKey = {
ip: {},
dev: {
......
{
"pages": [
"pages/tab/index/index",
"pages/applicationAccount/applicationAccount",
"pages/applicationPartener/applicationPartener",
"pages/applySuccess/applySuccess",
"pages/tab/introduction/introduction",
"pages/addTransform/addTransform/addTransform",
"pages/addTransform/addTransformDetail/addTransformDetail",
"pages/addValue/addValue/addValue",
"pages/productDetail/ambientLighting/ambientLighting",
"pages/productDetail/arNavigation/arNavigation",
"pages/productDetail/carBeauty/carBeauty",
"pages/productDetail/changingFilm/changingFilm",
"pages/productDetail/equity/equity",
"pages/productDetail/lossPhase/lossPhase",
"pages/productDetail/navigationArround/navigationArround",
"pages/productDetail/paintProtect/paintProtect",
"pages/productDetail/seatVentilate/seatVentilate",
"pages/productDetail/solarFilm/solarFilm",
"pages/activityApplication/activityApplication",
"pages/newEnergy/newEnergy",
"pages/measure/measure/measure",
"pages/measure/measureResult/measureResult",
"pages/scene/scene",
"pages/checkProduct/checkProduct"
"pages/tab/index/index"
],
"window": {
"backgroundTextStyle": "light",
......@@ -32,10 +9,19 @@
"navigationBarTextStyle": "black",
"initialRenderingCache": "static"
},
"subpackages": [
{
"root": "packagesList",
"name": "packagesList",
"pages": [
"pages/index/index",
"pages/measure/measure/measure",
"pages/measure/measureResult/measureResult"
]
}
],
"usingComponents": {
"authorize": "components/Authorize/Authorize",
"phone-number": "components/PhoneNumber/PhoneNumber",
"tab": "/components/Tab/Tab",
"navigation-bar": "/components/NavigationBar/NavigationBar"
},
"resolveAlias": {
......
// components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
scopeType: String,
/**是否自动打开 */
autoOpen: Boolean,
show: Boolean,
title: {
type: String,
value: '是否打开授权设置?'
},
confirmText: {
type: String,
value: '确定'
},
cancelText: {
type: String,
value: '取消'
},
buttonType: String,
confirmColor: String,
cancelColor: String,
isShowCheck: {
type: Boolean,
value: true
},
init: {
type: Boolean,
observer(n) {
if (n) this.check()
}
}
},
observers: {
'show': function (newVal) {
this.setData({
openSet: newVal
})
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
/**
* 禁止滑动
*/
noScroll: wx.$util.noScroll(),
cancel(e) {
let {
confirm
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let _this = this
if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({
desc: title,
success(res) {
_this.triggerEvent('success', {
message: '授权成功',
data: res
})
}
})
}
this.setData({
openSet: false
})
this.triggerEvent('cancel')
},
/**检验是否已授权位置 */
check() {
const _this = this
let {
buttonType,
scopeType,
autoOpen
} = this.properties
if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}`
buttonType = 'openSetting'
if (type === 'scope.userInfo') buttonType = 'getUserInfo'
this.setData({
buttonType
})
wx.getSetting({
success(res) {
if (!res.authSetting[type]) {
wx.authorize({
scope: type,
success() {
_this.triggerEvent('success', {
message: '授权成功'
})
},
fail() {
_this.triggerEvent('fail', {
message: '未授权'
})
if (autoOpen) {
_this.setData({
openSet: true
})
}
}
})
} else {
_this.triggerEvent('success', {
message: '已授权'
})
}
}
})
}
},
/**授权手机号 */
getPhoneNumber({
detail
}) {
this.triggerEvent('getphonenumber', detail)
}
},
pageLifetimes: {
show: function () {
if (this.data.isShowCheck || this.data.init) this.check()
},
hide: function () {}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="open-seting-bg text-center" wx:if="{{openSet}}" catchtap="cancel" catchtouchmove="noScroll">
<view class="open-set-inner">
<view class="set-title"><text>{{title}}</text></view>
<view class="btn-openset">
<view catchtap="cancel" class="btn text-center" style="color:{{cancelColor}};">{{cancelText}}</view>
<view class="btn text-center" style="color:{{confirmColor}};">
{{confirmText}}
<block wx:if="{{buttonType == 'getPhoneNumber'}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="button-style"></button>
</block>
<block wx:else>
<button open-type="{{buttonType}}" class="button-style" catchtap="cancel" data-confirm></button>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/Authorize/Authorize.wxss */
.open-seting-bg {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 998;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.open-set-inner {
width: 564rpx;
height: 400rpx;
background: #FFFFFF;
border-radius: 16px;
}
@keyframes show-auth-box {
0% {
opacity: 0;
transform: scale(2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.set-title {
font-size: 36rpx;
min-height: 286rpx;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
flex-direction: column;
}
.btn-openset {
display: flex;
font-size: 36rpx;
height: 112rpx;
border-top: 2rpx solid #E5E5E5;
font-weight: 500;
letter-spacing: 1rpx;
}
.btn {
flex: 1;
height: 100%;
position: relative;
}
.button-style {
position: absolute;
width: 100% !important;
height: 100%;
box-sizing: border-box;
opacity: 0;
top: 0;
left: 0;
}
\ No newline at end of file
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
},
dateChange(e) {
let {
current
} = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
done() {
let {
dateType
} = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
let { value } = e.detail
this.setData({
current: value
})
},
showShortcutPicker() {
this.setData({
showShortcut: !this.data.showShortcut
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
}
},
attached() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot></slot>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar"></view>
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{isFullSucreen&&!showConfirm?"isFullSucreen":""}}' style="height:{{height}}">
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
<block wx:if="{{rangeAll && dateType == 'range'}}">
<view class="calender-all" style="color:{{calenderColor}};" bindtap="chooseAll">全选</view>
</block>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="../images/close.png" webp class='calender-close-image'></image>
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}'></view>
</view>
</picker>
<view class='calender-subtitle' wx:else>{{dateList[current]}}</view>
</block>
<view class='calendar-weekdays'>
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<swiper class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view>
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}' style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose" data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}'></view>
<view class='box-center text'>
{{i.day}}
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class='calender-footer {{isFullSucreen}}' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">
{{confirmText||'确定'}}
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 99;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: 34px !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: 24rpx;
transform: translateY(-50%);
font-size: 20rpx;
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: rgba(0, 0, 0, .1);
text-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 999rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file
const _CalendarObject_ = Symbol('_CalendarObject_')
const _nowDate_ = Symbol('_nowDate_')
const _separator_ = Symbol('_separator_')
class Calendar {
[_CalendarObject_] = {};
[_nowDate_] = new Date();
[_separator_] = '-';
constructor(calendarObject) {
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let {
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let {
data: calenderHeight
} = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => {
let {
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
}
_this.setData({
isFullSucreen: wx.$util.isFullSucreen(),
height
})
}
/**设置日期高度 */
setCalenderBodyHeight() {
let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => {
wx.$util.getViewInfo('.calender-footer', footer => {
let headerHeight = header.height
let footerHeight = footer && footer.height || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
}, _this)
}, _this)
}
/**设置日期列表 */
setMonthList() {
let {
separator,
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
if (maxDate || minDate) {
if (!minDate) {
let nowMonth = new Date().getMonth()
minDate = new Date(new Date().setMonth(nowMonth - previous)).format(`yyyy${separator}MM${separator}dd`)
}
if (!maxDate) {
maxDate = this[_nowDate_].format(`yyyy${separator}MM${separator}dd`)
}
previous = this.getMonthDifference(minDate, this[_nowDate_].format(`yyyy${separator}MM${separator}dd`))
next = this.getMonthDifference(this[_nowDate_].format(`yyyy${separator}MM${separator}dd`), maxDate)
} else {
previous = previous < 0 ? 0 : previous
next = next < 0 ? 0 : next
}
let nowMonth = this[_nowDate_].getMonth()
let now = new Date().setDate(1)
for (let i = nowMonth - previous; i <= nowMonth + next; i++) {
this.init(new Date(now).setMonth(i))
}
}
/**初始化日期 */
init(date) {
let _this = this[_CalendarObject_]
let {
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [now_year, now_month, now_day] = today.split(separator)
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}`
let obj = {
day: i,
data: dayStr,
active: now_year == year && now_month == month && i == Number(now_day)
}
if ((minDate && Date.parse(minDate) > Date.parse(dayStr)) || (maxDate && Date.parse(maxDate) < Date.parse(dayStr))) obj.disable = true
if (dateType === 'multiple') multipleDate.push(todayStr)
if (nextDay) {
if (now_year == year && now_month == month && i == Number(now_day)) {
obj.start = true
rangeDate.start = todayStr
}
if (next_year == year && next_month == month && i == Number(next_day)) {
obj.active = true
obj.end = true
rangeDate.end = `${year}${separator}${next_month}${separator}${next_day}`
}
}
firstDayOfWeek = firstDayOfWeek == 7 ? 0 : firstDayOfWeek
if (i === 1) obj.week = `week-${week - firstDayOfWeek}`
arr.push(obj)
}
monthList.push({
data: arr,
mark: Number(month)
})
if (current <= 1) {
let [nowYear, nowMonth] = today.split(separator)
current = dateList.findIndex(e => e === `${nowYear}${separator}${nowMonth}`)
}
_this.setData({
multipleDate,
date: today,
rangeDate,
monthList,
dateList,
current
})
}
/**当设置最小日期或者最大日期时 自动设置前后月份 */
getMonthDifference(date1, date2) {
let separator = this[_separator_]
//获取年,月数
let [year1, month1] = date1.split(separator)
let [year2, month2] = date2.split(separator)
let months = (parseInt(year2) - parseInt(year1)) * 12 + (parseInt(month2) - parseInt(month1))
return months
}
/**单选 */
single(e) {
let _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
monthList.map(x => {
x.data.map(i => i.active = false)
})
monthList[index].data[ind].active = true
_this.setData({
monthList,
date: data
})
if (!showConfirm) this.done()
}
/**多选 */
multiple(e) {
let _this = this[_CalendarObject_]
let {
index,
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => {
if (i.active) arr.push(i.data)
}))
_this.setData({
[`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr
})
}
/**范围选择 */
range(e) {
const _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({
monthList,
index,
ind
})
rangeDate.start = data
rangeDate.end = ''
} else {
if (!allowSameDay && Date.parse(data) == Date.parse(rangeDate.start)) return
monthList[index].data[ind].active = true
monthList[index].data[ind].end = true
rangeDate.end = data
monthList.map(x => {
x.data.map(i => {
let day = Date.parse(i.data)
i.middle = day > start && day < Date.parse(data)
})
})
}
_this.setData({
monthList,
rangeDate
})
if (!showConfirm && rangeDate.end) this.done()
}
/**点击完成 */
done() {
let _this = this[_CalendarObject_]
let {
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let targer = {
'single': date,
'multiple': multipleDate,
'range': rangeDate
}
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', {
date: targer[dateType]
})
_this.showCalendar()
}
/**清空范围选择状态 */
clearStatus(params) {
let {
monthList,
index,
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
}))
monthList[index].data[ind].active = true
monthList[index].data[ind].start = true
return monthList
}
/**
* 获取月份天数
*/
getDayNumber(year, month) {
let days = 31
switch (month) {
case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break;
case 4:
case 6:
case 9:
case 11:
days = 30
break;
}
return days
}
/**日期范围 点击全选 */
chooseAll() {
let _this = this[_CalendarObject_]
let {
monthList,
minDate,
maxDate
} = _this.data
monthList.map((e, index) => {
e.data.map((i, ind) => {
let obj = {
currentTarget: {
dataset: {
index,
ind,
data: i.data
}
}
}
if (i.data == minDate) this.range(obj)
if(i.data == maxDate) this.range(obj)
})
})
}
}
export default Calendar
\ No newline at end of file
export default {
properties: {
calenderHeight: {
type: [String, Number]
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#00A479'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
dateType: {
type: String,
value: 'single'
},
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/**是否显示日期范围 全选 */
rangeAll: Boolean,
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
type: [Number, String],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
}
}
\ No newline at end of file
// components/GlCell/GlCell.js
Component({
/**
* 组件的属性列表
*/
properties: {
label:String,
labelWidth:String,
border:Boolean,
haveArrow:Boolean,
value:String,
valueAlign:String,
required:Boolean
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
click(e){
this.triggerEvent('click')
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='cell-box'>
<view class='cell {{border?"border":""}}' bindtap="click">
<view class='cell-label' style="width:{{labelWidth}}">
<text wx:if='{{required}}' class='required'>*</text>{{label||'标题'}}
</view>
<view class='cell-value ' style="width:calc(100% - {{labelWidth}});">
<view class='value {{valueAlign}} {{haveArrow}}'>
<view class='slot'><slot></slot></view>
<view class='details'>{{value}}</view>
</view>
<image wx:if='{{haveArrow}}' webp class='arrow' src="../images/arrow-x.png"></image>
</view>
</view>
</view>
\ No newline at end of file
/* components/GlCell/GlCell.wxss */
.cell-box {
background: #fff;
font-size: 28rpx;
color: #333333;
padding-left: 40rpx;
box-sizing: border-box;
}
.cell {
width: 100%;
height: 90rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.cell.border {
border-bottom: 2rpx solid #eee;
}
.cell-label {
width: 25%;
}
.cell-value {
width: 75%;
position: relative;
height: 100%;
}
.cell-value .false {
padding-right: 40rpx !important;
}
.value {
width: 100%;
height: 100%;
display: flex;
align-items: center;
padding-right: 70rpx;
box-sizing: border-box;
}
.required{
color: #f00;
}
.details{
display: none;
}
.slot:empty + .details{
display: block;
}
.cell-value .right {
justify-content: flex-end;
height: 100%;
box-sizing: border-box;
}
.slot{
width: 100%;
}
.slot:empty{
display: none;
}
.arrow {
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 28rpx;
height: 26rpx;
}
// components/glTextarea/glTextarea.js
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
placeholder: String,
showWordLimit: Boolean,
disabled: Boolean,
value: String,
filterEmoji:{
type:Boolean,
value:true
}
},
/**
* 组件的初始数据
*/
data: {
edit: true,
value: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
setValue(value) {
if(this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
this.setData({
value
})
},
textareaInput(e) {
let {
value
} = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
})
},
textareaBlur(e) {
let {
value
} = e.detail
this.setData({
edit: true
})
this.setValue(value)
this.triggerEvent('blur', {
value
})
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<text class='textarea' bindtap="openTextarea" style="color:{{value?'#333':'#999'}}">{{value||placeholder||'请输入'}}</text>
</block>
<block wx:else>
<textarea class='_textarea_' maxlength="{{maxlength}}" value='{{value}}' bindinput='textareaInput' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur' ></textarea>
</block>
<block wx:if='{{maxlength>0&&showWordLimit}}'>
<view class='wordLimit'>
{{value.length||0}} / {{maxlength}}
</view>
</block>
</view>
\ No newline at end of file
/* components/glTextarea/glTextarea.wxss */
.textarea-box {
width: 100%;
height: 100%;
position: relative;
}
.textarea-box .textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
}
._textarea_ {
width: 100%;
height: calc(100% - 40rpx);
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
// components/Login/Login.js
import {
ssoApi
} from '../../api/api'
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
content: {
type: String,
value: '您还没有登录,请您登录后查看!'
},
returnResponse: {
type: Boolean,
value: true
}
},
observers: {
'show': function (newVal, oldVal) {
let {
returnResponse
} = this.data
if (newVal) {
wx.$util.showLoading()
getApp().login(returnResponse).then(({
code,
data
}) => {
this.triggerEvent('loginInfo', {
code,
data
})
wx.hideLoading()
if (data) {
let {
sessionId
} = data
this.setData({
sessionId,
openSet: code != 0
})
this.sessionId = sessionId
if (data.isLogin == 'Y'&& code == '0') {
let thisPage = wx.$router.getPageInstance()
if (thisPage.loginCallBack) thisPage.loginCallBack(data)
if (thisPage.onRoute) thisPage.onRoute()
}
}
})
} else {
this.hide()
}
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
hide() {
this.setData({
openSet: false
})
},
cancel(flag) {
this.hide()
if (flag) this.triggerEvent('cancel')
},
noScroll: wx.$util.noScroll(),
getPhoneNumber({
detail
}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') {
this.cancel(true)
return
}
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
const {
sessionId
} = this.data
wx.$util.showLoading()
detail.sessionId = sessionId
ssoApi.authUserPhone(detail).then(({
data,
code
}) => {
wx.$Track.setTrack({}, 3)
wx.hideLoading()
let thisPage = wx.$router.getPageInstance()
if (code == '0') {
thisPage.setData({
showLogin: false,
userInfo: data
})
wx.$authStatus = false
this.setData({
sessionId: ''
})
wx.$util.setUserInfo(data)
// wx.$util.setSessionId(data.sessionId)
thisPage.onLoad()
thisPage.onShow()
if (thisPage.init) thisPage.init()
if (thisPage.onRoute) thisPage.onRoute()
if (thisPage.loginCallBack) thisPage.loginCallBack(data)
let customerId = wx.$storage.get('srcm_shopmall_customer_id')
let merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
if (customerId) {
ssoApi.updataCustomerPhone({
customerId,
merchantId
}).then(() => {
wx.removeStorageSync('srcm_shopmall_customer_id')
})
}
wx.$util.customerbehavior()
wx.$eventbus.emit('EQUITY')
}
})
}
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="open-seting-bg text-center" wx:if="{{openSet}}" catchtouchmove="noScroll">
<view class="bg" ></view>
<view class="open-set-inner">
<view class="set-title">
<text class="title">温馨提示</text>
<view class="content">{{content}}</view>
</view>
<view class="btn-openset">
<!-- <view bindtap="cancel" class="btn text-center cancel" >取消</view> -->
<navigator class="btn text-center cancel" target="miniProgram" open-type="exit">取消</navigator>
<view class="btn text-center">
登录
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="button-style"></button>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/Login/Login.wxss */
@import '../Authorize/Authorize.wxss';
.bg {
position: absolute;
left: 0;
top: 0;
z-index: -1;
width: 100%;
height: 100%;
}
.title {
margin-bottom: 60rpx;
font-size: 36rpx;
font-weight: 500;
}
.content {
font-size: 28rpx;
color: #A3A3A3;
}
.btn {
color: #F13C3D;
}
.cancel {
color: #999;
}
\ No newline at end of file
// components/share/share.js
import Draw_Function from './draw_function'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (newVal, oldVal) {
let {
wxShare
} = this.data
this.check(newVal)
if (!wxShare) {
this.setData({
_show: true
})
}
}
},
toast: {
type: String,
value: '生成中...'
},
canvasObject: Object,
hideCancel: Boolean,
diyDraw: Boolean,
hideWx: Boolean,
wxShare: Boolean
},
ready() {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
/**
* 检查
*/
check(bool) {
if (bool) {
if (this.data.tempFilePath) return
this.getImgData(res => {
this.draw(res)
})
}
},
/**
* 禁止滑动
*/
noScroll: wx.$util.noScroll(),
/**
* 取消
*/
cancel() {
this.setData({
_show: false
})
},
saveImg() {
let _this = this
wx.saveImageToPhotosAlbum({
filePath: _this.data.tempFilePath,
success(e) {
wx.$util.showToast('保存成功')
_this.triggerEvent('callBack')
}
})
},
/**保存 */
save() {
this.saveImg()
wx.nextTick(() => this.cancel())
},
/**
* 检查
*/
checkSetting() {
this.setData({
settingStatus: !this.data.settingStatus
})
},
/**
* 开始生成
*/
draw(images) {
const {
canvasObject,
wxShare
} = this.__data__
let {
height,
width
} = canvasObject
width = width || 300
height = height || 150
wx.$util.getPhoneInfo(phoneInfo => {
wx.$util.getViewInfo('.choose-list', listInfo => {
wx.$util.getViewInfo('.bg', bgInfo => {
let {
windowWidth
} = phoneInfo
let pixelRatio = windowWidth / 750
let viewTop = !wxShare ? (bgInfo.height - listInfo.height - height * pixelRatio) / 2 : 0
this.setData({
canvasStyle: `width:${width * pixelRatio}px;height:${height * pixelRatio}px;top:${viewTop}px;`,
previewStyle: `width:${width * pixelRatio}px;height:${width * pixelRatio * 0.8}px;`,
pixelRatio,
viewTop,
height,
width
})
this.ctx = wx.createCanvasContext('canvasImg', this)
this.ctx.clearRect(0, 0, width, height)
this.draw_canvas({
canvasObject,
images,
width,
height
}, canvas => {
canvas.draw(false, setTimeout(() => {
this.getCanvasImg()
}, 500))
})
})
}, this)
}, this)
},
/**画布 */
draw_canvas(params, callBack) {
const {
canvasObject,
images,
height,
width
} = params
const {
backgroundColor,
textList,
lines
} = canvasObject
const draw_function = new Draw_Function(this)
this.ctx.setFillStyle(backgroundColor || '#fff')
this.ctx.fillRect(0, 0, width, height)
this.ctx.save()
if (this.__data__.diyDraw) {
this.triggerEvent('draw', {
ctx: this.ctx,
canvasObject,
callBack,
height,
images,
width
})
} else {
images && images.length > 0 && (images.map(e => {
draw_function.drawImages(e)
}))
textList && textList.length > 0 && (textList.map(e => {
e.width = canvasObject.width
draw_function.drawText(e)
}))
lines && lines.length > 0 && (lines.map(e => {
draw_function.drawLine(e)
}))
callBack(this.ctx)
}
},
/**
* 画布生成图片
*/
getCanvasImg() {
let _this = this
let {
pixelRatio,
wxShare,
height,
width
} = _this.data
wx.canvasToTempFilePath({
canvasId: 'canvasImg',
width: width * pixelRatio,
height: height * pixelRatio,
fileType: 'jpg',
quality: 1,
x: 0,
y: 0,
success(res) {
let {
tempFilePath
} = res
if (wxShare) {
wx.hideLoading()
_this.checkSetting()
wx.showShareImageMenu({
path: tempFilePath,
success(res) {
console.log(res)
}
})
} else {
setTimeout(() => {
_this.createPreviewImg({
tempFilePath,
width
})
}, 300)
}
},
fail(err) {
wx.hideLoading()
}
}, this)
},
/**生成预览图 */
createPreviewImg(params) {
const p_ctx = wx.createCanvasContext('preview', this)
let {
tempFilePath,
width
} = params
p_ctx.drawImage(tempFilePath, 0, 0, width, width * 0.8)
let _this = this
p_ctx.draw(false, setTimeout(() => {
wx.canvasToTempFilePath({
height: width * 1.6,
width: width * 2,
canvasId: 'preview',
fileType: 'jpg',
quality: 1,
x: 0,
y: 0,
success(preview) {
_this.setData({
tempFilePath
})
_this.triggerEvent('init', {
previewImg: preview.tempFilePath,
tempFilePath
})
wx.hideLoading()
},
fail(err) {
wx.hideLoading()
}
}, this)
}, 500))
},
/**
* 批量转换图片
*/
getImgData(callBack) {
let _this = this
let {
canvasObject,
toast,
} = this.__data__
let {
imgList
} = canvasObject
wx.showLoading({
title: toast,
mask: true,
success() {
if (imgList.length > 0) {
_this.createLocalImg(imgList, 0, res => {
callBack(res)
})
} else {
callBack()
}
}
})
},
/**网络图片转成本地资源 */
createLocalImg(imgList, index = 0, callBack) {
if (index === imgList.length) return callBack(imgList)
wx.$util.promise(resolve => {
wx.getImageInfo({
src: imgList[index].url,
success(res) {
imgList[index].url = res.path
resolve()
},
fail() {
wx.$util.showToast('图片生成失败,请稍后再试')
wx.hideLoading()
console.error(`索引为:${index}的图片转换本地失败,${JSON.stringify(imgList[index].url)}`)
}
})
}).then(() => {
this.createLocalImg(imgList, index + 1, callBack)
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='share-box' catchtouchmove='noScroll' wx:if='{{_show}}'>
<view class='bg' bindtap='cancel'></view>
<view class='info {{flag?"flag":""}}' style="top:{{viewTop}}px;" hidden="{{canvasObject.showCanvas}}">
<slot></slot>
</view>
<view class='choose-list' style="height:{{hideCancel?'auto':'298rpx'}}">
<view class='list'>
<view class='list-btn' wx:if='{{!hideWx}}'>
<image src='../images/wx.png' webp class='image'></image>
<view>微信好友</view>
<button open-type='share' bindtap='cancel' class='button'></button>
</view>
<view class='list-btn' bindtap='checkSetting'>
<image src='../images/share.png' webp class='image'></image>
<view>保存分享</view>
</view>
</view>
<view wx:if='{{!hideCancel}}' class='cancel' bindtap='cancel'>取消</view>
</view>
</view>
<view class='canvas {{wxShare?"":"showCanvas"}}' style="{{canvasStyle}}">
<canvas canvas-id='canvasImg' style='width:100%;height:100%;'></canvas>
</view>
<view class='preview' style="{{previewStyle}}">
<canvas canvas-id="preview" style='width:100%;height:100%;'></canvas>
</view>
<authorize scopeType='writePhotosAlbum' checkSetting='{{settingStatus}}' bindsuccess='save'></authorize>
\ No newline at end of file
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.share-box {
position: fixed;
z-index: 999999;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.share-box .info {
width: auto;
height: auto;
position: absolute;
left: 1000%;
transform: translateX(-50%);
overflow: hidden;
}
.share-box .info.flag{
left: 50%;
animation: showInfo .5s forwards;
}
@keyframes showInfo{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.share-box .bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
}
.choose-list {
width: 100%;
position: absolute;
left: 0;
background: #f6f6f6;
animation: showChoose .4s forwards;
}
@keyframes showChoose{
0%{
bottom: -100%;
}
100%{
bottom: 0%;
}
}
.choose-list .cancel {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
font-size: 28rpx;
color: #333;
background: #fff;
}
.list {
width: 100%;
height: 182rpx;
background: #fff;
display: flex;
}
.list-btn {
flex: 1;
text-align: center;
font-size: 24rpx;
color: #333;
padding-top: 40rpx;
position: relative;
}
.list-btn .image {
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
}
.list-btn .button {
width: 100%;
height: 100%;
position: absolute;
opacity: 0;
top: 0;
left: 0;
}
.canvas {
position: fixed;
top: -1000%;
left: -1000%;
animation: canvasShow .5s forwards;
}
.preview{
position: fixed;
top: 1000%;
left: 1000%;
z-index: 999999999;
}
@keyframes canvasShow{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.showCanvas{
left: 50%;
transform: translateX(-50%);
z-index: 99999999999;
}
\ No newline at end of file
const _ctx_ = Symbol('_ctx_')
const _pixelRatio_ = Symbol('_pixelRatio_')
class Draw_Function {
[_ctx_] = null;
[_pixelRatio_] = null;
constructor(_this_) {
this[_ctx_] = _this_.ctx
this[_pixelRatio_] = _this_.data.pixelRatio || 2
}
drawImages(imageParams) {
this[_ctx_].beginPath()
this[_ctx_].save()
let {
borderRadius,
height,
width,
url,
x,
y,
} = imageParams
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
if (borderRadius) {
this.drawRadiusRect({
borderRadius,
height,
width,
x,
y,
})
this[_ctx_].clip()
}
this[_ctx_].drawImage(url, x, y, width, height)
this[_ctx_].restore()
}
toRpx(val) {
return this[_pixelRatio_] * val
}
getTextWidth(text, fontSize) {
if (fontSize) this[_ctx_].setFontSize(fontSize)
return this[_ctx_].measureText(text).width
}
drawFill(x, y, width, height, color) {
this[_ctx_].beginPath()
this[_ctx_].setFillStyle(color || '#000')
this[_ctx_].fillRect(x, y, width, height)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
}
drawText(textParams) {
let {
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
opacity,
lineNum,
width,
color,
text,
x,
y,
} = textParams
let text_width = this.getTextWidth(text)
textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal'
opacity = typeof opacity === 'number' ? opacity : 1
lineHeight = this.toRpx(lineHeight || fontSize || 12)
textWidth = this.toRpx(textWidth || 0)
fontSize = this.toRpx(fontSize || 12)
maxWidth = this.toRpx(maxWidth || width)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
let fontX = this.getFontWidth({
textAlign,
fontSize,
text,
x,
})
if (textParams.border) {
let boxX = this.toRpx(textParams.x - 4.5),
boxY = this.toRpx(textParams.y - 0.5),
boxWidth = text_width + this.toRpx(9),
boxHeight = lineHeight + this.toRpx(4)
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(9)
}
this.drawFill(boxX, boxY, boxWidth, boxHeight, textParams.border)
}
if (textParams.background) {
let boxX = this.toRpx(textParams.x - 4),
boxY = this.toRpx(textParams.y),
boxWidth = text_width + this.toRpx(8),
boxHeight = lineHeight + this.toRpx(3)
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(8)
}
this.drawFill(boxX, boxY, boxWidth, boxHeight, textParams.background)
}
this[_ctx_].beginPath()
this[_ctx_].setGlobalAlpha(opacity)
this[_ctx_].setFontSize(fontSize)
this[_ctx_].setFillStyle(color || '#000')
this[_ctx_].setStrokeStyle(color || '#000')
this[_ctx_].setTextBaseline(textBaseline)
this[_ctx_].setTextAlign(textAlign)
this[_ctx_].setLineWidth(this.toRpx(2))
const drawOneLineText = () => {
let textArr = text.split(''),
newText = '',
ellipsis = false
try {
textArr.map(e => {
newText += e
if (this.getTextWidth(newText) > width - fontX) throw true
})
} catch (error) {
ellipsis = error
}
if (ellipsis) newText += '…'
if (lastFont) newText += lastFont
this[_ctx_].fillText(newText, x, y, maxWidth)
if (checkFontWeight(fontWeight)) this[_ctx_].strokeText(newText, x, textHeight, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
textDecoration,
textBaseline,
textAlign,
fontSize,
newText,
opacity,
text,
y,
x
})
}
}
if (lineNum > 1) {
let textArr = text.split(''),
textRowArr = [],
currentText = '',
viewWidth = width - fontX
if (text_width > viewWidth) {
textArr.map(e => {
currentText += e
if (this.getTextWidth(currentText) >= viewWidth && textRowArr.length < lineNum - 1) {
textRowArr.push(currentText)
currentText = ''
}
})
if (currentText.length) textRowArr.push(currentText)
textRowArr.map((e, index) => {
if (this.getTextWidth(e) > viewWidth && index == lineNum - 1) {
try {
let lastText = '',
lastArr = e.split('')
lastArr.map(i => {
lastText += i
if (this.getTextWidth(lastText) > width - fontX - this.getTextWidth('…')) throw lastText
})
} catch (error) {
if (lastFont) e = `${error.substring(0, error.length - lastFont.length)}…${lastFont}`
else e = `${error}…`
}
}
if (lastFont && e.indexOf(lastFont) == -1 && textRowArr.length < 2) e = `${e.substring(0, e.length - lastFont.length)}…${lastFont}`
let textHeight = y + index * (lineHeight || fontSize)
this[_ctx_].fillText(e, x, textHeight, maxWidth)
if (checkFontWeight(fontWeight)) this[_ctx_].strokeText(newText, x, textHeight, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
y: textHeight,
textDecoration,
textBaseline,
textAlign,
fontSize,
newText: e,
opacity,
text,
x
})
}
})
} else {
drawOneLineText()
}
} else {
drawOneLineText()
}
this[_ctx_].stroke()
}
drawLine(lineParams) {
this[_ctx_].beginPath()
let {
opacity,
startX,
startY,
width,
color,
endX,
endY,
} = lineParams
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
endX = this.toRpx(endX)
endY = this.toRpx(endY)
this[_ctx_].setGlobalAlpha(typeof opacity === 'number' ? opacity : 1)
this[_ctx_].setStrokeStyle(color || '#000')
this[_ctx_].setLineWidth(width || this.toRpx(1))
this[_ctx_].moveTo(startX, startY)
this[_ctx_].lineTo(endX, endY)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
}
setLineY = params => {
let {
textDecoration,
textBaseline,
fontSize,
y
} = params
let type = {
'underline': {
'top': y + fontSize,
'middle': y + fontSize / 2,
'bottom': y,
'normal': y,
},
'overline': {
'top': y,
'middle': y - fontSize / 2,
'bottom': y - fontSize,
'normal': y,
},
'line-through': {
'top': y + fontSize / 2,
'middle': y - fontSize / 2,
'bottom': y,
'normal': y,
}
}
return type[textDecoration][textBaseline]
}
setLineX(params) {
let {
textAlign,
text,
x
} = params
let textWidth = this[_ctx_].measureText(text).width
let type = {
'left': x,
'center': x - textWidth / 2,
'right': x - textWidth
}
return type[textAlign]
}
drawRadiusRect(params) {
let {
borderRadius,
height,
width,
x,
y,
} = params
let radius = typeof borderRadius === 'string' ? (Number(borderRadius.split('%')[0]) / 100 * width) / 2 : borderRadius / 2
radius = radius || 0
this[_ctx_].beginPath()
for (let i = 1; i < 5; i++) {
let arcX = i === 1 || i === 4 ? x + width - radius : x + radius
let arcY = i === 1 || i === 2 ? y + height - radius : y + radius
this[_ctx_].arc(arcX, arcY, radius, 2 * Math.PI * ((i - 1) / 4), 2 * Math.PI * (i / 4))
}
}
getFontWidth(params) {
let {
textAlign,
fontSize,
text,
x
} = params
let type = {
'left': x,
'center': x - fontSize * text.length / 2,
'right': x - fontSize * text.length
}
return type[textAlign] < 0 ? 0 : type[textAlign]
}
drawDecoration(params) {
let {
newText,
opacity,
y,
x
} = params
let lineX = x
let lineY = y
lineX = this.setLineX(params)
lineY = this.setLineY(params)
this[_ctx_].setGlobalAlpha(opacity)
this[_ctx_].moveTo(lineX, lineY)
this[_ctx_].lineTo(lineX + this[_ctx_].measureText(newText).width, lineY)
}
}
const checkFontWeight = (fontWeight = '0') => {
return (fontWeight && (typeof fontWeight === 'string' || typeof fontWeight === 'number') && (fontWeight == 'bold' || fontWeight >= 700))
}
const checkTextDecoration = textDecoration => {
return (textDecoration && (textDecoration === 'underline' || textDecoration === 'overline' || textDecoration === 'line-through'))
}
export default Draw_Function
\ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height: {
type: String,
value: '100vh'
},
tagIndex: {
type: Number,
value: 0,
observer: function (n, o) {
this.setData({
count: n
})
}
},
key: {
type: String,
value: 'name'
},
showClickLoading:Boolean
},
/**
* 组件的初始数据
*/
data: {
count: 0,
scrollTop: 0
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
item,
index
} = e.currentTarget.dataset
if(this.data.count === index) return
if(this.properties.showClickLoading) wx.$util.showLoading('')
item.index = index
this.setData({
count: index,
scrollTop: 0
})
this.triggerEvent('click', item)
wx.nextTick(()=>{
wx.hideLoading()
})
},
tabScrollTolower(e) {
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e) {
this.triggerEvent('viewScrollTolower')
}
},
ready() {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='tab-box' id='tabView' style="height:{{height}}">
<scroll-view style="height:100%;" scroll-y class='tab' bindscrolltolower='tabScrollTolower'>
<view>
<block wx:for='{{tabList}}' wx:key='index'>
<view class='tab-item {{count==index?"active":""}}' bindtap="click" data-item='{{item}}' data-index='{{index}}'>{{item[key]}}</view>
</block>
</view>
</scroll-view>
<view class='view'>
<scroll-view style="height:100%" scroll-y scroll-top='{{scrollTop}}' bindscrolltolower='viewScrollTolower'>
<slot></slot>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* components/tabView/tabView.wxss */
.tab {
float: left;
width: 26.67%;
box-sizing: border-box;
text-align: center;
background: #f4f4f4;
}
.view {
float: left;
width: 73.33%;
height: 100%;
position: relative;
}
.tab-item {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #333;
box-sizing: border-box;
padding: 0 10rpx;
}
.active {
font-weight: 700;
background: #fff;
position: sticky;
top: 0;
font-size: 28rpx;
}
// components/TimeHorizon/TimeHorizon.js
Component({
/**
* 组件的属性列表
*/
properties: {
config: {
type: Object,
observer: function (newVal, oldVal) {
let {
havehhmmss,
startData,
startTime,
startLabel,
valueAlign,
endData,
endLabel,
} = newVal
valueAlign = valueAlign || 'left'
this.setData({
havehhmmss,
startData,
startTime,
startLabel,
valueAlign,
endData,
endLabel
})
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
dateChange(e) {
let {
value
} = e.detail
let {
type
} = e.currentTarget.dataset
if (this.data.endData && type === 'start') {
this.setData({
endData: ''
})
}
let {
havehhmmss
} = this.data
if(havehhmmss)
value = havehhmmss ? type === 'start' ? `${value} 00:00:00` : `${value} 23:59:59` : value
this.setData({
[`${type}Data`]: value
})
let {
startData,
endData,
} = this.data
if (startData && endData) this.triggerEvent('change', {
startData,
endData
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='time-box'>
<picker class='time-picker' mode="date" value="{{startData}}" start="{{startTime}}" bindchange="dateChange" data-type='start'>
<view class='time-picker-view'>
<view class='time-picker-label'>{{startLabel||'开始时间'}}</view>
<view class='time-picker-value {{!startData?"no-data":""}} {{valueAlign}}'>
{{startData||'请选择'}}
<image class='arrow' webp src="../images/arrow-x.png"></image>
</view>
</view>
</picker>
<picker class='time-picker' mode="date" value="{{endData}}" start="{{startData}}" bindchange="dateChange" data-type='end'>
<view class='time-picker-view'>
<view class='time-picker-label'>{{endLabel||'结束时间'}}</view>
<view class='time-picker-value {{!endData?"no-data":""}} {{valueAlign}}'>
{{endData||'请选择'}}
<image class='arrow' webp src="../images/arrow-x.png"></image>
</view>
</view>
</picker>
</view>
\ No newline at end of file
/* components/TimeHorizon/TimeHorizon.wxss */
.time-box {
background: #fff;
font-size: 28rpx;
color: #333333;
}
.time-picker {
padding-left: 40rpx;
}
.time-picker-view {
display: flex;
align-items: center;
width: 100%;
height: 90rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #eee;
}
.time-picker-label{
width: 25%;
box-sizing: border-box;
}
.time-picker-value{
width: 75%;
display: flex;
align-items: center;
position: relative;
}
.time-picker-value.right{
justify-content: flex-end;
padding-right: 70rpx;
}
.no-data {
color: #999;
}
.arrow {
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 28rpx;
height: 26rpx;
}
// components/shareBtn/shareBtn.js
import { componentsMixin } from "../../mixins/index";
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--components/shareBtn/shareBtn.wxml-->
<button class="btn-share" open-type="share">
<image class="btn-icon" mode="widthFix" webp src="{{IMGURL}}image/productDetail/equity/share.png?v={{img_version}}" />
<text>分享此页面</text>
</button>
\ No newline at end of file
/* components/shareBtn/shareBtn.wxss */
.btn-icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
.btn-share {
display: flex;
justify-content: center;
align-items: center;
height: 72rpx;
line-height: 72rpx;
font-size: 28rpx;
color: #FFFFFF;
background: #5850FF;
background-image: linear-gradient(180deg, #4791FF 0%, #5850FF 100%, #643DFF 100%);
border-radius: 8rpx;
margin: 0 48rpx;
}
\ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-09 14:34:08
*/
import { trackData } from "../utils/data";
module.exports = Behavior({
data: {
......@@ -17,13 +24,13 @@ module.exports = Behavior({
})
switch(curIntroduceIndex) {
case 3:
wx.$router.go('scene');
// wx.$router.go('scene');
// wx.$router.go('addTransform', {notIntercept: true});
// wx.showToast({
// title: '敬请期待',
// icon: 'none'
// })
wx.$Track.sendTrack(trackData.DIJIA)
wx.showToast({
title: '敬请期待',
icon: 'none'
})
// wx.$Track.sendTrack(trackData.DIJIA)
break
case 2:
this.setData({
......
// pages/tab/introduction/introduction.js
import {menuMixin} from '../../../mixins/index'
// packagesList/pages/index/index.js
Page({
behaviors: [menuMixin],
/**
* 页面的初始数据
*/
data: {
// 0-员工,1-代理商
customerType: 1
},
/**
......
/* packagesList/pages/index/index.wxss */
\ No newline at end of file
<!--packagesList/pages/index/index.wxml-->
<text>packagesList/pages/index/index.wxml</text>
// pages/measure/measure.js
import Util from '../../../utils/util'
import measureData from '../constant/data'
const checkMap = new Map()
Page({
......@@ -48,7 +47,7 @@ Page({
console.log(checkArray)
const params = Object.assign({checkArray}, this.data.formData)
console.log(params)
wx.$router.go("measureResult", params);
wx.$router.go("/packagesList/pages/measure/measureResult/measureResult", params);
}
},
// 选择产品
......
// pages/measureResult/measureResult.js
import Util from '../../../utils/util'
import Util from '../../../../utils/util'
import measureData from '../constant/data'
Page({
......
......@@ -199,21 +199,14 @@ function formatValue(value, hasUnit = true, onlyUnit = false) {
if (typeof value == 'number') {
val = value.toString()
}
if (val.length > 8 ) {
if (val && val.length > 8 ) {
val = (val / 100000000).toFixed(0)
unit = '亿'
} else if (val.length > 5) {
} else if (val && val.length > 5) {
val = (val / 10000).toFixed(0)
unit = '万'
}
return onlyUnit ? unit : hasUnit ? val + unit : val
// if (val.length > 8 ) {
// return (val / 100000000).toFixed(0) + '亿'
// } else if (val.length > 5) {
// return (val / 10000).toFixed(0) + '万'
// } else {
// return val
// }
}
function decimalFormat(value) {
return (value * 100).toFixed(2)
......
// pages/activityApplication/activityApplication.js
// import { trackData } from "../../utils/data";
import { entmicroApi } from "../../api/api";
Page({
/**
* 页面的初始数据
*/
data: {
productTabList: [
{
id: "0",
name: "scene1",
title: "新车洽谈场景",
type: "1.0新车权益升级",
url: "car4",
},
{
id: "1",
name: "scene2",
title: "新车交付场景",
type: "1.1 新车精品升级",
url: "car1",
},
{
id: "2",
name: "scene3",
title: "0-6个月",
type: "1.2次新车膨胀金活动",
url: "car2",
},
{
id: "3",
name: "scene4",
title: "6个月以上",
type: "1.3售后直播众筹活动",
url: "car3",
},
],
productList: {
scene1: [
{
name: "equity",
url: "digital_icon",
nameZh: "数字无忧权益卡",
isSelect: false,
actNum: 0,
activeNavIdx: 0,
},
{
nameZh: "其他",
isSelect: false,
},
],
scene2: [
{
name: "solarFilm",
url: "solar_icon",
nameZh: "汽车太阳膜",
isSelect: false,
actNum: 1,
activeNavIdx: 0,
},
{
nameZh: "其他",
isSelect: false,
},
],
scene3: [
{
name: "paintProtect",
url: "protect_icon",
nameZh: "漆面保护膜",
isSelect: false,
actNum: 2,
activeNavIdx: 0,
},
{
name: "changingFilm",
url: "change_icon",
nameZh: "改色膜",
isSelect: false,
actNum: 2,
activeNavIdx: 1,
},
{
nameZh: "其他",
isSelect: false,
},
],
scene4: [
{
name: "carBeauty",
url: "beauty_icon",
nameZh: "数字化美容",
isSelect: false,
actNum: 3,
activeNavIdx: 0,
},
{
name: "seatVentilate",
url: "seat_icon",
nameZh: "座椅通风",
isSelect: false,
actNum: 3,
activeNavIdx: 1,
},
{
name: "arNavigation",
url: "ar_icon",
nameZh: "AR实景导航",
isSelect: false,
actNum: 3,
activeNavIdx: 2,
},
{
name: "ambientLighting",
url: "light_icon",
nameZh: "氛围灯",
isSelect: false,
actNum: 3,
activeNavIdx: 3,
},
{
name: "navigationArround",
url: "arround_icon",
nameZh: "360全景导航",
isSelect: false,
actNum: 3,
activeNavIdx: 4,
},
{
nameZh: "其他",
isSelect: false,
},
],
},
selectItemIndex: 0,
selectItemName: "scene1",
// applyForm: {
// merchantName: '',
// carModel: '',
// contactName: '',
// contactPhone: ''
// },
foldFlag: false,
sceneNum: "",
sceneName: "",
sceneTip: {
scene1: "合作门店数2200+,单店年增量产值100万+",
scene2: "合作门店数300+,单店年增量产值60万+",
scene3: "正在直播中,目前有17万+用户正在观看",
scene4: "本月活动进行中100+门店,预估产值1000万+",
},
},
// 提交表单
submitApply() {
wx.$util.showLoading("提交中...");
let validFlag = this.selectComponent("#applyForm").validateForm();
if (!validFlag[0]) return;
let params = JSON.parse(JSON.stringify(validFlag[0]));
let applyType = validFlag[1];
// 区分代理商和门店
params.merchantName =
applyType == 0
? params.merchantName + "(活动-门店)"
: params.merchantName + "(活动-代理商)";
// 如果选择了业务场景
if (this.data.sceneName) {
let selectFlag = 0;
let productItems = [];
this.data.productList[this.data.sceneName].forEach((item) => {
if (item.isSelect) {
selectFlag = selectFlag + 1;
productItems.push(item.nameZh);
}
});
if (!selectFlag) {
wx.hideLoading();
wx.showToast({
title: "请至少选择一个产品",
icon: "none",
});
return;
}
let businessItem = this.data.productTabList.find((item) => {
return item.id == this.data.sceneNum;
});
params.businessScenario = businessItem.title;
params.productItems = productItems.join(",");
}
params.cardId = wx.$storage.get("scene").cardId;
params.merchant =
wx.$storage.get("scene").merchant ||
wx.$storage.get("scene").merchantId;
params.openId = wx.$storage.get("aicard_info").openId;
params.unionId = wx.$storage.get("aicard_info").unionId;
console.log(params);
entmicroApi.activityApply(params).then(({ data, code, message }) => {
if (code == 0) {
wx.hideLoading();
wx.showToast({
msg: "提交成功",
});
wx.$router.go("applySuccess");
} else {
wx.hideLoading();
wx.showToast({
title: message,
icon: "none",
});
}
});
},
// 选择活动tab
selectProduct(e) {
this.setData({
selectItemIndex: e.currentTarget.dataset.item.id,
selectItemName: e.currentTarget.dataset.item.name,
});
},
// 跳转产品详情页
goPage(e) {
let actNum = e.currentTarget.dataset.item.actNum;
let activeNavIdx = e.currentTarget.dataset.item.activeNavIdx;
console.log(actNum, activeNavIdx, "000");
wx.$router.go("scene", { actNum, activeNavIdx });
},
// 展开收起
handleFold() {
this.setData({
foldFlag: !this.data.foldFlag,
});
},
// 选择业务场景
selectScene(e) {
// 遍历之前业务场景下产品是否已选择,选择了的话取消选中
if (this.data.sceneName) {
let newProductList;
newProductList = this.data.productList[this.data.sceneName].map(
(item) => {
if (item.isSelect) item.isSelect = false;
return item;
}
);
let selectList = `productList.${this.data.sceneName}`;
this.setData({
[selectList]: newProductList,
});
}
this.setData({
sceneNum: e.currentTarget.dataset.item.id,
sceneName: e.currentTarget.dataset.item.name,
});
},
// 选择业务场景产品
selectScenePro(e) {
var index = e.currentTarget.dataset.index;
var item = this.data.productList[this.data.sceneName][index];
item.isSelect = !item.isSelect;
this.setData({
productList: this.data.productList,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 禁用分享转发
wx.hideShareMenu({
menus: ["shareAppMessage", "shareTimeline"],
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});
{
"usingComponents": {
"apply-content": "../../components/CooperationApply/CooperationApply"
},
"navigationBarTitleText": "活动申请"
}
<!-- pages/activityApplication/activityApplication.wxml -->
<view class="apply-content">
<image class="apply-background" mode="widthFix" webp src="{{IMGURL}}application/application_top.png?v={{img_version}}"></image>
<view class="box-background">
<!-- 产品展示 -->
<view class="product-box">
<!-- 产品选择tab -->
<view class="product-tab-box">
<!-- tab栏 -->
<block wx:for="{{productTabList}}" wx:key="index">
<view class="product-item {{item.id == selectItemIndex ? 'product-item-active' : ''}}" bindtap="selectProduct" data-item="{{item}}">
<view class="product-item-title {{item.id == selectItemIndex ? 'product-item-title-active' : ''}}">
{{item.title}}
</view>
<view class="product-item-type {{item.id == selectItemIndex ? 'product-item-type-active' : ''}}">
{{item.type}}
</view>
<view wx:if="{{item.id == selectItemIndex}}" class="selected-item">
<view class="selected-item-top"></view>
<view class="selected-item-bottom"></view>
</view>
</view>
</block>
</view>
<view class="product-tip">
<image class="tip-icon" wx:if="{{selectItemName == 'scene3'}}" mode="widthFix" webp src="{{IMGURL}}application/tip_icon.png?v={{img_version}}"></image>
<image class="tip-icon" wx:else="" mode="widthFix" webp src="{{IMGURL}}application/tip_icon2.png?v={{img_version}}"></image>
<text class="tip-text">{{sceneTip[selectItemName]}}</text>
</view>
<block wx:for="{{productList[selectItemName]}}" wx:key="index">
<image wx:if="{{item.name}}" class="product-img" mode="widthFix" webp src="{{IMGURL}}application/{{item.url}}.png?v={{img_version}}" bindtap="goPage" data-item="{{item}}"></image>
</block>
</view>
</view>
<!-- 申请表单 -->
<view class="apply-box">
<!-- 表单 -->
<apply-content id="applyForm"></apply-content>
<!-- 展开收起 -->
<view class="apply-fold" bindtap="handleFold">
<text wx:if="{{!foldFlag}}">选择业务场景</text>
<text wx:else>收起</text>
<image wx:if="{{!foldFlag}}" class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/down_icon.png?v={{img_version}}"></image>
<image wx:else class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/up_icon.png?v={{img_version}}"></image>
</view>
<block wx:if="{{foldFlag}}">
<!-- 业务场景 -->
<view class="fold-title">业务场景</view>
<view class="product-tab-box fold-box">
<view wx:for="{{productTabList}}" wx:key="index" class="item-wrap {{item.id == sceneNum ? 'act':''}}" bindtap="selectScene" data-item="{{item}}">
<view class="fold-scene-item {{item.id == sceneNum ? 'fold-scene-item-active':''}}">
<image class="fold-img" mode="widthFix" webp src="{{IMGURL}}application/{{item.url}}.png?v={{img_version}}"></image>
<view class="product-item-title {{item.id == sceneNum ? 'product-item-title-active':''}}">
{{item.title}}
</view>
<view class="product-item-type {{item.id == sceneNum ? 'product-item-type-active':''}}">
{{item.type}}
</view>
</view>
</view>
</view>
<!-- 选择产品 -->
<block wx:if="{{sceneNum}}">
<view>
<text class="fold-title">选择产品</text>
<text class="fold-tip">(可多选)</text>
</view>
<view class="fold-product">
<block wx:for="{{productList[sceneName]}}">
<view class="item {{item.isSelect ? 'item-selected': ''}}" bindtap="selectScenePro" data-index="{{index}}">
<view>{{item.nameZh}}</view>
<image wx:if="{{item.isSelect}}" class="selected-img" mode="widthFix" webp src="{{IMGURL}}application/selected_icon.png?v={{img_version}}"></image>
</view>
</block>
</view>
</block>
</block>
</view>
<view class="btn-box">
<button class="submit-btn" bindtap="submitApply">提交申请</button>
</view>
</view>
\ No newline at end of file
/* pages/activityApplication/activityApplication.wxss */
.apply-content {
/* overflow: auto; */
}
.apply-background {
width: 100%;
}
.box-background {
background-image: linear-gradient(179deg, #E3E8FF 0%, #FEFEFE 100%);
}
.product-tab-box {
display: flex;
margin-bottom: 38rpx;
}
.product-item {
/* width: 166rpx; */
width: calc(100%/4);
height: 120rpx;
margin-right: 12rpx;
background: #F5F5FC;
border-radius: 8rpx;
}
.product-item:last-child {
margin-right: 0;
}
.product-item-active {
background: #FFFFFF;
}
.product-item-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
line-height: 44rpx;
margin-top: 24rpx;
}
.product-item-title-active {
color: #5850FF;
}
.product-item-type {
font-family: PingFangSC-Regular;
font-weight: 500;
font-size: 17rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
line-height: 24rpx;
}
.product-item-type-active {
color: #807AFF;
}
.selected-item {
margin-top: 27rpx;
/* width: 166rpx; */
position: relative;
}
.selected-item-top {
/* width: 166rpx; */
height: 4rpx;
border-bottom-left-radius: 4rpx;
border-bottom-right-radius: 4rpx;
background: #5850FF;
}
.selected-item-bottom {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 0px;
height: 0px;
border: 12rpx solid #5850FF;
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
}
.product-img {
width: calc((100% - 32rpx)/3);
height: 216rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
box-shadow: 0 6rpx 24rpx 0 rgba(175, 181, 219, 0.40);
}
.product-img:nth-child(3n+2) {
margin-right: 0;
}
.product-box {
margin-bottom: 56rpx;
padding: 0 26rpx;
background-image: linear-gradient(179deg, #DBE3FF 0%, #FEFEFE 100%);
}
.product-tip {
display: flex;
align-items: center;
width: 704rpx;
height: 44rpx;
background-image: linear-gradient(133deg, rgba(0, 51, 255, 0.08) 0%, #FFFFFF 100%);
border-radius: 24rpx;
margin-bottom: 32rpx;
}
.tip-icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
.tip-text {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
color: #5850FF;
line-height: 36rpx;
}
.apply-box {
width: 702rpx;
/* height: 680rpx; */
background: #FFFFFF;
box-shadow: 0 6rpx 24rpx 0 rgba(175, 181, 219, 0.40);
border-radius: 12rpx;
margin: 0 24rpx;
margin-bottom: 30rpx;
/* position: absolute;
top: 420rpx;
left: 24rpx; */
}
.submit-btn {
width: 622rpx;
height: 80rpx;
background: #5850FF;
border-radius: 8rpx;
margin-top: 60rpx;
text-align: center;
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
font-family: PingFangSC-Medium;
line-height: 80rpx;
}
.btn-box {
padding-bottom: 60rpx;
}
.apply-fold {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #5850FF;
text-align: center;
padding: 76rpx 0 40rpx 0;
}
.fold-icon {
width: 24rpx;
height: 24rpx;
vertical-align: middle;
margin-left: 8rpx;
}
.fold-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
padding-left: 32rpx;
}
.fold-tip {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 22rpx;
color: #6E6E7A;
}
.fold-box {
padding: 44rpx 16rpx;
}
.fold-scene-item {
/* width: 160rpx; */
width: 100%;
height: 180rpx;
background: #F7F7FC;
border-radius: 12rpx;
text-align: center;
}
.fold-scene-item-active {
background-image: linear-gradient(145deg, #E6E6FF 0%, #FFFFFF 73%);
}
.fold-img {
width: 56rpx;
height: 56rpx;
margin-top: 20rpx;
}
.item-wrap {
position: relative;
/* width: 160rpx; */
width: calc(100%/4);
height: 180rpx;
border-radius: 12rpx;
margin-right: 12rpx;
}
.item-wrap:last-child {
margin-right: 0
}
.act {
border: 2rpx solid #5850FF;
}
.act::after {
position: absolute;
left: 50%;
bottom: -15rpx;
display: block;
content: "";
width: 14rpx;
height: 14rpx;
border-bottom: 2rpx solid #5850FF;
border-right: 2rpx solid #5850FF;
transform: rotate(45deg) translateX(-50%);
background-color: #fff;
}
.item {
/* width: 216rpx; */
width: calc((100% - 24rpx)/3);
height: 64rpx;
background: #F5F5FA;
border-radius: 8rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
margin-right: 12rpx;
margin-bottom: 20rpx;
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.item:nth-child(3n) {
margin-right: 0;
}
.fold-product {
display: flex;
flex-wrap: wrap;
padding: 36rpx 16rpx 64rpx 16rpx;
}
.item-selected {
color: #5850FF;
font-weight: 600;
border: 2rpx solid #9B96FF;
}
.selected-img {
width: 30rpx;
height: 22rpx;
position: absolute;
top: -1rpx;
right: -1rpx;
}
\ No newline at end of file
// pages/addTransform/index/index.js
import pageData from '../constant/data'
Page({
/**
* 页面的初始数据
*/
data: {
editForm: {
sales: 100,
userNum: 10000
},
actualForm: {
sales: 100,
userNum: 10000
},
IMGURL: wx.$imgUrl,
height: 'calc(100vh - 100rpx)',
tagIndex: 0,
tabList: pageData.tabList,
introduceObj: {},
cardList: [],
// 玩法介绍
introduceVisible: false,
introduceList: pageData.introduceList,
// 产品详情
detailKeyList: Object.keys(pageData.addDatailObj)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
introduceObj: this.data.tabList[this.data.tagIndex].introduce,
cardList: this.data.tabList[this.data.tagIndex].cardList
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
handleInput(e) {
const attr = e.target.dataset.attr
this.setData({
[`${attr}`]: e.detail.value
})
},
handleTabClick(e) {
let {
index,
introduce,
cardList
} = e.detail
let {
tagIndex
} = this.data
if (index == tagIndex) return
this.setData({
tagIndex: index,
introduceObj: introduce || {},
cardList: cardList || []
})
},
handleCardClick(e) {
var obj = e.detail
if(!this.data.detailKeyList.includes(obj.detailAttrName)) {
wx.$util.showToast('敬请期待')
return true
}
wx.$router.go('addTransformDetail', { proName: obj.proName, attrName: obj.detailAttrName })
},
handleIntroduceClick() {
this.handleIntroduceClose()
},
handleIntroduceClose() {
this.setData({
introduceVisible: !this.data.introduceVisible
})
},
handleConfirm() {
this.setData({
actualForm: this.data.editForm
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "D+增值转化",
"usingComponents": {
"add-tab-view": "../components/AddTabView/AddTabView",
"card": "../components/Card/Card"
},
"backgroundColor": "#F6F5F8"
}
\ No newline at end of file
<!--pages/addTransform/index/index.wxml-->
<view class="layout">
<view class="head">测算您门店的基本情况</view>
<view class="form-box">
<view class="form-row flex">
<text class="form-label">门店月平均新车销量</text>
<input class="form-input" placeholder="请输入" type="number" value="{{editForm.sales}}" bindinput="handleInput" data-attr="editForm.sales" />
<!-- <text class="suffix">台</text> -->
</view>
<view class="form-row flex">
<text class="form-label">3年售后存量用户数</text>
<input class="form-input" placeholder="请输入" type="number" value="{{editForm.userNum}}" bindinput="handleInput" data-attr="editForm.userNum" />
<!-- <text class="suffix">家</text> -->
</view>
<button class="submit-btn" bindtap="handleConfirm">提交测算</button>
</view>
</view>
<view class="layout">
<view class="head">我们的产品和服务</view>
<add-tab-view tabList="{{tabList}}" tagIndex="{{tagIndex}}" height="{{height}}" bindclick="handleTabClick">
<view class="tab-content-box" wx:if="{{cardList.length}}">
<view class="pos-relative" bindtap="handleIntroduceClick">
<view class="card-introduce">
<image class="introduce-img" webp src="{{IMGURL}}{{introduceObj.imgUrl}}?v={{img_version}}" />
<view class="introduce-content">
<view class="introduce-txt">{{introduceObj.title}}</view>
<view class="introduce-btn">查看阶段玩法</view>
</view>
</view>
</view>
<view class="card-title-box">
<view>阶段产品</view>
<view class="tips">预估收益根据您的新车销量 {{ actualForm.sales || 0 }}台 测算所得</view>
</view>
<view wx:for="{{cardList}}" wx:key="index">
<card cardForm="{{item}}" actualForm="{{actualForm}}" tagIndex="{{tagIndex}}" bindclick="handleCardClick"></card>
</view>
</view>
</add-tab-view>
</view>
<!-- 玩法介绍 -->
<view class="pos-relative">
<view class="{{introduceVisible ? 'model' : 'model-hidden'}}" catchtouchmove="noScroll" bindtap="handleIntroduceClose">
<view>
<view class="model-box">
<image class="model-img" webp src="{{IMGURL}}addTransform/card/deliver/model-introduce.png?v={{img_version}}" />
<view class="model-block">
<view class="model-head">
<view class="head-title">{{introduceList[tagIndex].title}}</view>
<view>{{introduceList[tagIndex].subTitle}}</view>
</view>
<view class="model-content">
<view class="content-block" wx:for="{{introduceList[tagIndex].contentList}}" wx:key="index">
<image class="content-icon" src="{{IMGURL}}addTransform/card/deliver/model-{{item.icon}}.png?v={{img_version}}" />
<view>
<view class="content-title">{{item.title}}</view>
<view class="content-row" wx:for="{{item.list}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex">
<view class="content-txt" wx:if="{{subItem.name}}">{{subItem.name}}</view>
<view class="content-tip">{{subItem.tip}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="model-btn">知道了</view>
</view>
</view>
</view>
\ No newline at end of file
/* pages/addTransform/index/index.wxss */
page {
background-color: #F6F5F8;
}
.layout {
background: #FFFFFF;
padding-bottom: 32rpx;
margin-bottom: 16rpx;
}
.flex {
display: flex;
}
.head {
font-size: 32rpx;
font-weight: 600;
line-height: 48rpx;
padding: 32rpx 0 16rpx 0;
}
.head::before {
content: '';
display: inline-block;
width: 8rpx;
height: 28rpx;
background: #5850FF;
border-radius: 0 2rpx 2rpx 0;
margin-right: 32rpx;
}
.form-box {
margin: 0 32rpx;
font-size: 28rpx;
color: #2D2D33;
background-image: linear-gradient(179deg, rgba(123, 112, 255, 0.02) 15%, rgba(99, 92, 255, 0.10) 100%);
border-radius: 8rpx;
padding: 24rpx 32rpx;
}
.form-box .form-row {
justify-content: space-around;
align-items: center;
line-height: 72rpx;
margin-bottom: 24rpx;
}
.form-row .form-label {
padding-right: 10rpx;
flex-grow: 1;
}
.form-input {
box-sizing: border-box;
height: 72rpx;
width: 256rpx;
border: 2rpx solid #E6E6E6;
border-radius: 4rpx;
padding: 0 20rpx;
}
.suffix {
width: 28rpx;
color: #6E6E7A;
margin-left: 16rpx;
}
.submit-btn {
height: 72rpx;
line-height: 72rpx;
background: #5850FF;
border-radius: 8rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
}
.tab-content-box {
margin: 16rpx 16rpx;
}
.pos-relative {
position: relative;
z-index: 1;
}
.card-introduce {
font-size: 28rpx;
width: 100%;
height: 160rpx;
color: #FFFFFF;
}
.introduce-img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.introduce-content {
padding: 32rpx 0 28rpx 32rpx;
}
.introduce-txt {
height: 44rpx;
line-height: 44rpx;
font-size: 28rpx;
margin-bottom: 16rpx;
}
.introduce-btn {
box-sizing: border-box;
width: 144rpx;
height: 40rpx;
opacity: 0.8;
font-size: 20rpx;
background: #7E78FF;
border-radius: 4rpx;
padding: 4rpx 12rpx;
}
.card-title-box {
font-size: 28rpx;
color: #2D2D2E;
margin: 32rpx 0;
}
.tips {
font-size: 24rpx;
color: #9E9EA8;
margin-top: 8rpx;
}
.model-hidden {
position: fixed;
left: -1000000;
top: -100000;
}
.model {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 99;
background: rgba(0, 0, 0, 0.7);
}
.model-box {
position: relative;
box-sizing: border-box;
width: calc(100vw - 128rpx);
height: 848rpx;
margin: 0 64rpx 48rpx;
}
.model-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.model-block {
position: absolute;
font-size: 28rpx;
width: 100%;
height: 100%;
}
.model-head {
display: flex;
width: 100%;
height: 20%;
font-size: 24rpx;
color: #5850FF;
justify-content: center;
align-items: center;
flex-direction: column;
}
.model-head .head-title {
font-size: 40rpx;
font-weight: 600;
margin-bottom: 8rpx;
}
.model-block .model-content {
width: 100%;
padding: 4% 40rpx;
}
.model-content .content-block {
display: flex;
font-size: 24rpx;
margin-bottom: 16rpx;
}
.model-content .content-icon {
width: 64rpx;
height: 64rpx;
margin-right: 16rpx;
}
.model-content .content-row {
display: flex;
margin-bottom: 8rpx;
}
.model-content .content-title {
height: 64rpx;
line-height: 64rpx;
font-size: 28rpx;
color: #2D2D33;
font-weight: 700;
}
.model-content .content-txt {
color: #2D2D33;
margin-right: 16rpx;
font-weight: 600;
}
.model-content .content-tip {
color: #6E6E7A;
}
.model-btn {
height: 88rpx;
line-height: 88rpx;
background: #5850FF;
border: 2rpx solid rgba(255, 255, 255, 0.50);
border-radius: 12rpx;
font-weight: 600;
font-size: 36rpx;
color: #FFFFFF;
text-align: center;
margin: 0 176rpx;
}
\ No newline at end of file
// pages/addTransform/detail/detail.js
import pageData from '../constant/data'
import util from '../../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
IMGURL: wx.$imgUrl,
attrName: '',
proName: '',
addDatailObj: pageData.addDatailObj,
detailObj: {},
hasShare: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (util.getUserInfo().phone) {
this.setData({
hasShare: true
})
}
wx.$router.getData(({
attrName,
proName
}) => {
this.setData({
proName: proName,
attrName: attrName,
detailObj: this.data.addDatailObj[attrName]
})
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "D+增值转化",
"usingComponents": {}
}
\ No newline at end of file
<!--pages/addTransform/detail/detail.wxml-->
<view>
<view class="layout">
<view class="head">
<image class="head-icon" src="{{IMGURL}}addTransform/detail/icon-name.png?v={{img_version}}" />
<text class="head-txt">{{proName}}</text>
</view>
<swiper class="m-b-32" indicator-dots="true" autoplay="true">
<block wx:for="{{detailObj.imgList}}" wx:key="*this">
<swiper-item>
<image class="swiper-img" src="{{IMGURL}}{{item.url}}?v={{img_version}}" />
</swiper-item>
</block>
</swiper>
<view class="content-txt">{{detailObj.text}}</view>
</view>
<view class="layout">
<view class="head">
<image class="head-icon" webp src="{{IMGURL}}addTransform/detail/icon-video.png?v={{img_version}}" />
<text class="head-txt">案例视频</text>
</view>
<video class="video" wx:for="{{detailObj.videoList}}" wx:key="index" title="案例视频:{{proName}}" src="{{IMGURL}}{{item.url}}?v={{img_version}}"></video>
</view>
<view class="fixed-btn" wx:if="{{hasShare}}">
<button class="btn-share" open-type="share">
<image class="btn-icon" webp src="{{IMGURL}}addTransform/detail/share.png?v={{img_version}}"/>
<text>分享此页面</text>
</button>
</view>
</view>
\ No newline at end of file
/* pages/addTransform/detail/detail.wxss */
page {
background-color: #F6F5F8;
padding-bottom: 112rpx;
}
.layout {
background: #FFFFFF;
padding: 32rpx;
margin-bottom: 20rpx;
}
.head {
display: flex;
align-items: center;
margin-bottom: 32rpx;
}
.head-icon {
width: 48rpx;
height: 48rpx;
}
.head-txt {
font-size: 32rpx;
color: #333333;
font-weight: 600;
margin-left: 20rpx;
}
.swiper-img {
width: 100%;
height: 100%;
}
.m-b-32 {
margin-bottom: 32rpx;
}
.content-txt {
font-size: 28rpx;
color: #111111;
line-height: 48rpx;
}
.video {
width: 100%;
height: 396rpx;
}
.fixed-btn {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background: #FFFFFF;
padding: 24rpx 0 16rpx;
box-shadow: 0 -4rpx 8rpx 0 rgba(196, 199, 204, 0.20);
}
.btn-icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
.btn-share {
display: flex;
justify-content: center;
align-items: center;
height: 72rpx;
line-height: 72rpx;
font-size: 28rpx;
color: #FFFFFF;
background: #5850FF;
background-image: linear-gradient(180deg, #4791FF 0%, #5850FF 100%, #643DFF 100%);
border-radius: 8rpx;
margin: 0 48rpx;
}
\ No newline at end of file
// pages/addTransform/components/AddTabView/AddTabView.js
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height: {
type: String,
value: '100vh'
},
tagIndex: {
type: Number,
value: 0,
observer: function (n, o) {
this.setData({
count: n
})
}
},
key: {
type: String,
value: 'name'
},
showClickLoading:Boolean
},
/**
* 组件的初始数据
*/
data: {
count: 0,
scrollTop: 0,
IMGURL: wx.$imgUrl
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
item,
index
} = e.currentTarget.dataset
if(this.data.count === index) return
if(this.properties.showClickLoading) wx.$util.showLoading('')
item.index = index
this.setData({
count: index,
scrollTop: 0
})
this.triggerEvent('click', item)
wx.nextTick(()=>{
wx.hideLoading()
})
},
tabScrollTolower(e) {
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e) {
this.triggerEvent('viewScrollTolower')
}
},
ready() {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--pages/addTransform/components/AddTabView/AddTabView.wxml-->
<view class='tab-box' id='tabView' style="height:{{height}}">
<scroll-view style="height:100%;" scroll-y class='tab' bindscrolltolower='tabScrollTolower'>
<view>
<block wx:for='{{tabList}}' wx:key='index'>
<view class='tab-item {{count==index?"active":""}}' bindtap="click" data-item='{{item}}' data-index='{{index}}'>
<image webp class="tab-bg" src="{{IMGURL}}addTransform/tab-{{index + 1}}.png?v={{img_version}}" />
<view wx:for="{{item[key]}}" wx:key="index" wx:for-item="subItem">{{subItem}}</view>
</view>
</block>
</view>
</scroll-view>
<view class='view'>
<scroll-view style="height:100%" scroll-y scroll-top='{{scrollTop}}' bindscrolltolower='viewScrollTolower'>
<slot></slot>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/addTransform/components/AddTabView/AddTabView.wxss */
.tab {
float: left;
width: 21.34%;
box-sizing: border-box;
text-align: center;
background: #F2F2F7;
}
.view {
box-sizing: border-box;
float: left;
width: 78.66%;
height: 100%;
position: relative;
padding: 0px 16rpx;
}
::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
.tab-item {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 240rpx;
font-size: 28rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #6E6E7A;
box-sizing: border-box;
padding: 0 10rpx;
}
.tab-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.active {
font-weight: 700;
background: #fff;
color: #2D2D33;
position: sticky;
top: 0;
font-size: 28rpx;
}
\ No newline at end of file
// pages/addTransform/components/card/Card.js
Component({
/**
* 组件的属性列表
*/
properties: {
cardForm: {
type: Object,
      observer(n) {
        this.setData({
cardForm: n
        })
}
},
actualForm: {
type: Object,
observer(n) {
      this.setData({
actualForm: n
      })
this.calcProfit()
}
},
tagIndex: {
type: Number,
observer(n) {
this.calcProfit()
}
}
},
/**
* 组件的初始数据
*/
data: {
IMGURL: wx.$imgUrl,
typeObj: {
service: {
name: '服务类',
bgColor: 'rgba(255,231,205,0.80)',
color: '#EF971E'
},
membrane: {
name: '膜类',
bgColor: '#E3ECFF',
color: '#4E87FB'
},
beauty: {
name: '美容类',
bgColor: '#EAE9FF',
color: '#5851FF'
},
light: {
name: '轻改类',
bgColor: '#D7F5E5',
color: '#21AB60'
}
},
},
ready() {
},
/**
* 组件的方法列表
*/
methods: {
handleClick() {
this.triggerEvent('click', this.data.cardForm)
},
calcProfit() {
var targetItem = this.data.cardForm
let sales = +this.data.actualForm.sales || 0
let userNum = +this.data.actualForm.userNum || 0
let defaultPrice = +targetItem.priceList[0].value
if(targetItem.detailAttrName) {
switch(targetItem.detailAttrName) {
case 'digitRight':
targetItem.profit = (sales * 0.5 * defaultPrice * 12).toFixed(0) + ''
break
case 'sunMembrane':
targetItem.profit = (sales * 0.8 * 0.7 * defaultPrice * 12).toFixed(0) + ''
break
case 'paintMembrane':
targetItem.profit = (userNum * 0.15 * defaultPrice * 12).toFixed(0) + ''
break
case 'colorMembrane':
targetItem.profit = (userNum * 0.05 * defaultPrice * 12).toFixed(0) + ''
break
case 'digitBeauty':
targetItem.profit = (sales * 0.2 * defaultPrice * 12).toFixed(0) + ''
break
case 'chair':
targetItem.profit = (userNum * defaultPrice * 0.9 * 0.01).toFixed(0) + ''
break
case 'ar':
targetItem.profit = (userNum * defaultPrice * 0.9 * 0.15).toFixed(0) + ''
break
case 'lamp':
targetItem.profit = (userNum * defaultPrice * 0.9 * 0.15).toFixed(0) + ''
break
case 'navigation':
targetItem.profit = (userNum * defaultPrice * 0.9 * 0.15).toFixed(0) + ''
break
default:
break
}
}
this.setData({
cardForm: targetItem
})
},
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--pages/addTransform/components/card/Card.wxml-->
<view class="card-box" bindtap="handleClick">
<image class="img" webp src="{{IMGURL}}{{cardForm.imgUrl}}?v={{img_version}}" />
<view class="card-block">
<view class="m-b-20">
<text class="card-type" style="color: {{typeObj[cardForm.type].color}}; background-color: {{typeObj[cardForm.type].bgColor}}">{{typeObj[cardForm.type].name}}</text>
<text class="card-title">{{cardForm.proName}}</text>
</view>
<view class="flex card-row">
<view wx:for="{{cardForm.priceList}}" wx:key="index" class="price-item">
<text class="m-r-8">{{item.name}}</text>
<text>¥{{item.value}}</text>
</view>
</view>
<view class="flex-space card-row">
<view wx:if="{{cardForm.profit}}">
<text class="m-r-8">预估收益</text>
<text class="profit-txt">¥{{cardForm.profit}}</text>
</view>
<view wx:else="">暂无预估收益,敬请期待</view>
<view class="profit-jump">产品介绍<text class="arrow"></text></view>
</view>
</view>
</view>
\ No newline at end of file
/* pages/addTransform/components/card/Card.wxss */
.card-box {
box-sizing: border-box;
height: 440rpx;
background: #FAFAFA;
box-shadow: 0 8rpx 20rpx 0 rgba(180, 186, 204, 0.32);
border-radius: 16rpx;
margin-bottom: 40rpx;
font-size: 24rpx;
}
.flex {
display: flex;
}
.flex-space {
display: flex;
justify-content: space-between;
}
.card-block {
padding: 32rpx 24rpx 24rpx;
}
.img {
width: 100%;
height: 240rpx;
}
.card-type {
padding: 4rpx 16rpx;
border-radius: 4rpx;
margin-right: 20rpx;
}
.m-b-20 {
margin-bottom: 20rpx;
}
.m-r-8 {
margin-right: 8rpx;
}
.card-title {
font-size: 32rpx;
color: #2D2D33;
font-weight: 600;
}
.card-row {
color: #6E6E7A;
height: 40rpx;
margin-bottom: 4rpx;
}
.price-item {
margin-right: 32rpx;
}
.price-item:last-child {
margin-right: 0;
}
.profit-txt {
font-size: 28rpx;
color: #5850FF;
font-weight: 600;
}
.profit-jump {
color: #9E9EA8;
}
.arrow {
display: inline-block;
width: 12rpx;
height: 12rpx;
border: 2rpx solid #9E9EA8;
border-width: 2rpx 2rpx 0 0;
opacity: 0.7;
transform: rotate(45deg);
margin-left: 10rpx;
}
\ No newline at end of file
var tabList = [{
name: ['新车', '交付期'],
introduce: {
title: '车主处于“已购车待交付车辆”阶段?',
imgUrl: 'addTransform/card/deliver/introduce.png'
},
cardList: [{
proName: '数字无忧卡权益',
detailAttrName: 'digitRight',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'service',
priceList: [{
name: '均客单价',
value: '2000'
}],
profit: '1200000'
}, {
proName: '汽车太阳膜',
detailAttrName: 'sunMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
name: '合资自主品牌',
value: '1500'
}, {
name: '豪华品牌',
value: '2000'
}],
profit: '10080000'
}]
}, {
name: ['新车', '磨合期'],
introduce: {
title: '车主处于“已购车待交付车辆”阶段?',
imgUrl: 'addTransform/card/deliver/introduce.png'
},
cardList: [{
proName: '漆面保护膜',
detailAttrName: 'paintMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
name: '均客单价',
value: '12000'
}],
profit: '2160000'
}, {
proName: '改色膜',
detailAttrName: 'colorMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
name: '均客单价',
value: '5000'
}],
profit: '300000'
}]
}, {
name: ['用车', '热络期'],
introduce: {
title: '车主处于“已购车待交付车辆”阶段?',
imgUrl: 'addTransform/card/deliver/introduce.png'
},
cardList: [{
proName: '数字化美容',
detailAttrName: 'digitBeauty',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'beauty',
priceList: [{
name: '均客单价',
value: '300'
}],
profit: '72000'
}, {
proName: '座椅通风',
detailAttrName: 'chair',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2580'
}],
profit: '880'
}, {
proName: 'AR导航',
detailAttrName: 'ar',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '1680'
}],
profit: '880'
}, {
proName: '氛围灯',
detailAttrName: 'lamp',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2680'
}],
profit: '880'
}, {
proName: '360全景导航',
detailAttrName: 'navigation',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2880'
}],
profit: '880'
}]
}, {
name: ['用车', '流失期'],
introduce: {
title: '车主处于“已购车待交付车辆”阶段?',
imgUrl: 'addTransform/card/deliver/introduce.png'
},
cardList: [{
proName: '车险续保',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'service',
priceList: [{
name: '均客单价',
value: '2500'
}],
profit: null
}, {
proName: '金融车贷',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'service',
priceList: [{
name: '均客单价',
value: '20000'
}],
profit: null
}, {
proName: '数字化美容',
detailAttrName: 'digitBeauty',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'beauty',
priceList: [{
name: '均客单价',
value: '350'
}],
profit: '880'
}]
}]
var introduceList = [{
title: '新车交付期',
subTitle: '已购车/待交付车辆阶段',
contentList: [{
icon: 'play',
title: '销售玩法',
list: [{
name: '',
tip: '新车套餐打包 + 驻点销售升级'
}, {
name: '',
tip: '产品升级 + 线下体验'
}]
}, {
icon: 'crux',
title: '营销关键',
list: [{
name: '流量来源',
tip: '4S店新车、展厅车销售'
}, {
name: '触达工具',
tip: '新车销售打包、太阳膜安装施工'
}, {
name: '配合岗位',
tip: '新车销售岗、精品岗'
}, {
name: '营销频次',
tip: '每月'
}, {
name: '转化关键',
tip: '套餐毛利、流量触达'
}]
}, {
icon: 'income',
title: '增量收入',
list: [{
name: '转化率/渗透率',
tip: '30%'
}, {
name: '预计单月',
tip: '6万/100台新车月销量'
}]
}]
}, {
title: '新车磨合期',
subTitle: '购车第一年(0-12个月内)',
contentList: [{
icon: 'play',
title: '销售玩法',
list: [{
name: '',
tip: '订单膨胀、团购众筹'
}, {
name: '',
tip: '产品升级 + 线下体验'
}]
}, {
icon: 'crux',
title: '营销关键',
list: [{
name: '流量来源',
tip: '4S店新车、展厅车销售'
}, {
name: '触达工具',
tip: '企业微信'
}, {
name: '配合岗位',
tip: '精品岗'
}, {
name: '营销频次',
tip: '每月'
}, {
name: '转化关键',
tip: '内容种草'
}]
}, {
icon: 'income',
title: '增量收入',
list: [{
name: '转化率/渗透率',
tip: '5%'
}, {
name: '预计单月',
tip: '5万'
}]
}]
}, {
title: '用车熟络期',
subTitle: '购车第二年(12-36个月内)',
contentList: [{
icon: 'play',
title: '销售玩法',
list: [{
name: '',
tip: '众筹团购、以旧换新抵扣'
}, {
name: '',
tip: '直播展示+线下体验,秒杀活动+勾子产品'
}]
}, {
icon: 'crux',
title: '营销关键',
list: [{
name: '流量来源',
tip: '4S店售后基盘'
}, {
name: '触达工具',
tip: '企业微信/个人微信'
}, {
name: '配合岗位',
tip: '全员岗位'
}, {
name: '营销频次',
tip: '轻改类每个季度、美容类每个月'
}, {
name: '转化关键',
tip: '内容种草+高性价比'
}]
}, {
icon: 'income',
title: '增量收入',
list: [{
name: '转化率/渗透率',
tip: '2%'
}, {
name: '预计单月',
tip: '5万'
}]
}]
}, {
title: '用车流失期',
subTitle: '购车三年以上(36个月以上)',
contentList: [{
icon: 'play',
title: '销售玩法',
list: [{
name: '',
tip: '权益套餐买送'
}, {
name: '',
tip: '产品升级 + 线下体验'
}]
}, {
icon: 'crux',
title: '营销关键',
list: [{
name: '流量来源',
tip: '4S店续保流失客户'
}, {
name: '触达工具',
tip: '企业微信/个人微信'
}, {
name: '配合岗位',
tip: '续保岗'
}, {
name: '营销频次',
tip: '每月'
}, {
name: '转化关键',
tip: '高性价比'
}]
}, {
icon: 'income',
title: '增量收入',
list: [{
name: '转化率/渗透率',
tip: '10%'
}, {
name: '预计单月',
tip: '2万'
}]
}]
}]
var addDatailObj = {
digitRight: {
imgList: [{
url: 'addTransform/card/deliver/introduce.png'
}, {
url: 'addTransform/card/deliver/card-0.png'
}],
text: '产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案产品介绍文案。',
videoList: [{
url: 'addTransform/detail/video.mp4'
}]
},
sunMembrane: {
imgList: [{
url: 'addTransform/card/deliver/introduce.png'
}, {
url: 'addTransform/card/deliver/card-0.png'
}],
text: '太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜。',
videoList: [{
url: 'addTransform/detail/video.mp4'
}]
}
}
export default {
tabList,
introduceList,
addDatailObj
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!