Commit 084c5681 by 张立顺

fix 组件优化

1 parent 9664e8d6
Showing 110 changed files with 1590 additions and 2846 deletions
...@@ -283,15 +283,12 @@ ...@@ -283,15 +283,12 @@
"usingComponents": { "usingComponents": {
"gl-textarea": "/components/GlTextarea/GlTextarea", "gl-textarea": "/components/GlTextarea/GlTextarea",
"gl-cell": "/components/GlCell/GlCell", "gl-cell": "/components/GlCell/GlCell",
"calendar": "/components/Calendar/Calendar", "calendar": "/components/CalendarMonth/CalendarMonth",
"navigation-bar": "/components/navigationBar/navigationBar", "navigation-bar": "/components/navigationBar/navigationBar",
"popup": "/components/Popup/Popup", "popup": "/components/Popup/Popup",
"search-input": "/components/SearchInput/SearchInput", "search-input": "/components/SearchInput/SearchInput",
"date-picker": "/components/DatePicker/DatePicker",
"remark-popup": "/components/RemarkPopup/RemarkPopup", "remark-popup": "/components/RemarkPopup/RemarkPopup",
"tab-bar": "/components/TabBar/TabBar", "tab-bar": "/components/TabBar/TabBar",
"order-confirm": "/components/Confirm/Confirm",
"qr-box": "components/Qrbox/Qrbox",
"modal": "components/modal/modal", "modal": "components/modal/modal",
"tips-bottom": "components/tipsBottom/index", "tips-bottom": "components/tipsBottom/index",
"gl-image": "components/GlImage/index", "gl-image": "components/GlImage/index",
......
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// components/subShopMerchant/subShopMerchant.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
let {
copyArtificerList,
artificerSelectObj,
disabledSelectObj,
deputyFlag
} = this.data
const selectArr = Array.isArray(artificerSelectObj)
? artificerSelectObj?.map(val => {
return val.technicianId || val.id
})
: [artificerSelectObj?.technicianId]
const selectedList = Array.isArray(artificerSelectObj)
? artificerSelectObj
: artificerSelectObj
? [artificerSelectObj]
: []
const ratioMap = selectedList.reduce((m, v) => {
const k = v.technicianId || v.id
m[k] = v.shareRatio
return m
}, {})
copyArtificerList = copyArtificerList.map(i => {
const active = selectArr?.includes(i.id)
const disabled =
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const shareRatio = active ? ratioMap[i.id] ?? '' : ''
return { ...i, active, disabled, shareRatio }
})
// 是副手技师选中两个后其余置灰
if (selectArr.length == 2 && deputyFlag) {
copyArtificerList.forEach(i => {
if (!selectArr.includes(i.id)) i.disabled = true
})
}
const sum = (copyArtificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
console.log(copyArtificerList, 'copyArtificerList')
this.setData({
artificerList: wx.$util.deepClone(copyArtificerList),
copyArtificerList,
selectedTechnicianId: selectArr,
searchValue: '',
showMainShareRatio
})
}
}
},
title: String,
orderInfo: Object,
artificerSelectObj: Object,
copyArtificerList: Array,
multiple: Boolean,
disabledSelectObj: {
type: Array
},
deputyFlag: Boolean // 是否选择副手技师
},
/**
* 组件的初始数据
*/
data: {
orderObj: {},
IMG_URL,
artificerList: [],
searchValue: '',
showMainShareRatio: 100
},
/**
* 组件的方法列表
*/
methods: {
noop() {},
changeShareRatio(e) {
let { value } = e.detail
let { index } = e.currentTarget.dataset
let { artificerList, copyArtificerList } = this.data
let v = parseInt(value, 10)
if (isNaN(v)) v = 0
if (v > 100) v = 100
const sumOthers = (artificerList || [])
.filter((i, idx) => i.active && idx !== index)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
const allowed = Math.max(0, 100 - sumOthers)
v = Math.min(v, allowed)
artificerList[index].shareRatio = v
const targetId = artificerList[index]?.id
if (Array.isArray(copyArtificerList)) {
const ci = copyArtificerList.findIndex(i => i.id === targetId)
if (ci >= 0) copyArtificerList[ci].shareRatio = v
}
const sum = sumOthers + v
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({
artificerList,
copyArtificerList,
showMainShareRatio
})
},
search(e) {
let { copyArtificerList } = wx.$util.deepClone(this.data)
let { selectedTechnicianId } = this.data
console.log(selectedTechnicianId)
let { value } = e.detail
if (!value) {
copyArtificerList.map(i => {
i.active = false
if (selectedTechnicianId.includes(i.id)) i.active = true
return i
})
this.setData({
artificerList: copyArtificerList
})
} else {
let arr = []
copyArtificerList.map(i => {
i.active = false
if (selectedTechnicianId.includes(i.id)) i.active = true
if (i.staffName.indexOf(value) != -1) {
arr.push(i)
}
})
this.setData({
artificerList: arr
})
}
},
changeItem(e) {
let { target } = e.currentTarget.dataset
let { artificerList, multiple, deputyFlag, disabledSelectObj } = this.data
let { copyArtificerList } = wx.$util.deepClone(this.data)
// 禁用项不允许点击切换
if (target.disabled) return
const targetId = target?.id
// 同步切换 active 状态;在单选模式下,其他项自动取消激活
// 对未激活项清空 shareRatio,保持分成比例与选中状态一致
const updateList = list =>
list.map(i => {
const active =
i.id === targetId ? !i.active : multiple ? i.active : false
return { ...i, active, shareRatio: active ? i.shareRatio : '' }
})
artificerList = updateList(artificerList)
copyArtificerList = updateList(copyArtificerList)
// 当前选中的技师 id 集合
const arr = copyArtificerList.filter(v => v.active).map(v => v.id)
// 副手模式:选满两个后将其他置灰;未满两个时根据预设禁用恢复
if (deputyFlag) {
if (arr.length === 2) {
const disableIfNotSelected = i => ({
...i,
disabled: !arr.includes(i.id)
})
artificerList = artificerList.map(disableIfNotSelected)
copyArtificerList = copyArtificerList.map(disableIfNotSelected)
} else {
const isPresetDisabled = i =>
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const enableWithPreset = i => ({
...i,
disabled: isPresetDisabled(i)
})
artificerList = artificerList.map(enableWithPreset)
copyArtificerList = copyArtificerList.map(enableWithPreset)
}
}
// 更新视图与选中集合(单选返回当前 id,多选返回所有选中)
const sum = (artificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({
artificerList,
copyArtificerList,
selectedTechnicianId: multiple ? arr : [targetId],
showMainShareRatio
})
},
cancel() {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
artificerSelectPopup: false
})
this.triggerEvent('cancel')
},
// 打开生意助手小程序
goMiniprogram() {
wx.navigateToMiniProgram({
appId: 'wx2c28337db96364d2'
})
},
async confirm() {
let {
copyArtificerList,
orderInfo,
artificerSelectObj,
selectedTechnicianId,
deputyFlag
} = this.data
let arr = copyArtificerList?.filter(v => v.active) || []
console.log(arr, 'arr')
if (!arr.length) {
// 未选技师 将selectedTechnicianId清除
this.setData({
selectedTechnicianId: []
})
return wx.$util.showToast('请选择技师')
}
if (deputyFlag) {
const invalid = arr.some(
v =>
v.shareRatio === '' ||
v.shareRatio === undefined ||
v.shareRatio === null
)
if (invalid) {
return wx.$util.showToast('请填写副手技师分成比例')
}
}
let obj = {
...artificerSelectObj,
technicianUuid: arr[0]?.uuid || '',
technicianId: arr[0]?.id || '',
technicianName: arr[0]?.staffName || '',
selectedTechnicians: arr
}
// orderInfo.technicianUuid = arr[0]?.uuid || ''
// orderInfo.technicianId = arr[0]?.id || ''
// orderInfo.technicianName = arr[0]?.staffName || ''
this.triggerEvent('confirm', obj)
}
}
})
/* components/subShopMerchant/subShopMerchant.wxss */
.artificer-select-popup-box {
height: 100%;
width: calc(100% + var(--fontSize64));
transform: translateX(calc(-1 * var(--fontSize32)));
}
.sub-title {
height: var(--fontSize100);
font-size: var(--fontSize32);
color: #333333;
background-color: #fff;
z-index: 2;
border-bottom: var(--fontSize2) solid #F9F9F9;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.box {
height: 100%;
padding: 0 var(--fontSize32);
}
.artificer-box {
height: calc(100% - var(--fontSize102));
overflow: hidden;
transition: all .25s;
}
.box-title {
color: #333333;
font-size: var(--fontSize32);
height: var(--fontSize88);
line-height: var(--fontSize88);
display: flex;
align-items: center;
/* justify-content: space-between; */
}
.box-title .tips {
font-size: 24rpx;
margin-left: 8rpx;
color: #888888;
}
.box-title .tips text {
color: #347BFF;
}
.artificerList {
width: calc(100% - var(--fontSize50));
height: var(--fontSize98);
display: flex;
align-items: center;
font-size: var(--fontSize28);
font-size: 28rpx;
color: #292D33;
padding: 0 var(--fontSize25);
transition: all .5s;
.shareRatioBox {
display: flex;
font-size: 24rpx;
color: #5A5E66;
align-items: center;
font-weight: 400;
.shareRatioInput {
box-sizing: border-box;
width: 88rpx;
height: 68rpx;
margin: 0 8rpx;
background: #FFFFFF;
padding: 0 16rpx;
border: 2rpx solid #EFF0F2;
border-radius: 12rpx;
}
}
}
.checked_img {
width: var(--fontSize32);
height: var(--fontSize32);
flex-shrink: 0;
margin-right: var(--fontSize20);
}
.artificerList .text_box {
flex: 1;
border-bottom: var(--fontSize2) solid #F9F9F9;
height: 100%;
line-height: var(--fontSize98);
}
.artificerList .text_box .disabled {
opacity: .5;
}
.artificerList.active {
color: #347BFF;
font-weight: 700;
position: relative;
}
.bottomTips {
text-align: center;
color: #5a5e66;
font-size: 24rpx;
margin-top: 10rpx;
.text {
color: #347bff;
}
}
\ No newline at end of file \ No newline at end of file
<popup
show="{{ show }}"
bindconfirm="confirm"
bindcancel="cancel"
height="85%"
slotStyle="height: calc(100% - var(--fontSize150));"
>
<view class="artificer-select-popup-box">
<view class="box">
<view class="sub-title text-center">{{title}}</view>
<view class="artificer-box">
<search-input bindsearch="search" value="{{ searchValue }}" />
<view class="box-title">
<view>技师</view>
<!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> -->
<view class="tips" wx:if="{{ multiple && deputyFlag }}">产生副手技师,请主技师为副手技师分配整单提成比例</view>
</view>
<block wx:if="{{ artificerList.length }}">
<scroll-view
scroll-y
style="{{ multiple? 'height: calc(100% - var(--fontSize236))':'height: calc(100% - var(--fontSize194))' }}"
enhanced="{{ true }}"
show-scrollbar="{{ false }}"
>
<block wx:for="{{ artificerList }}" wx:key="index">
<view
class="artificerList {{ item.active?'active':'' }}"
bindtap="changeItem"
data-target="{{ item }}"
data-index="{{ index }}"
>
<view class="checked_img">
<block wx:if="{{ multiple }}">
<image src="{{ item.active ? '../images/radio.png' : '../images/radio_icon.png' }}" />
</block>
<block wx:else>
<image wx:if="{{ item.active }}" src="{{ IMG_URL }}checked.png"></image>
</block>
</view>
<view class="text_box">
<view class="text-hide {{ item.disabled ? 'disabled' : '' }}">{{item.staffName}}</view>
</view>
<view class="shareRatioBox" wx:if="{{ multiple && item.active && deputyFlag }}">
整单分成比例
<input
placeholder="整数"
class="shareRatioInput"
type="number"
maxlength="3"
value="{{ item.shareRatio }}"
placeholder-style="color:#BEC1C7"
catchinput="changeShareRatio"
catchtap="noop"
data-index="{{ index }}"
/>
%
</view>
</view>
</block>
</scroll-view>
</block>
<block wx:else>
<empty-data style="width: 100%;" />
</block>
<view class="tips bottomTips" wx:if="{{ multiple && deputyFlag }}">
主技师整单分成比例
<text class="text">{{ showMainShareRatio }}%</text>
</view>
</view>
</view>
</view>
</popup>
\ No newline at end of file \ 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() { },
/** 日期手动改 */
resetData(date) {
// let _this = this[_CalendarObject_]
let { monthList, current } = this.data
console.log(monthList)
console.log(date)
// return
monthList.map(x => {
x.data.map(i => (i.active = false))
})
monthList.map((item, index) => {
item.data.map(ele => {
if (ele.data == date) {
console.log(ele.data)
console.log(current)
ele.active = true
current = index
}
})
})
this.setData({
monthList,
current
})
},
// resetData(date) {
// // console.log(this.resetData)
// // this.getUserDayReport(n)[CalendarFunction]
// // this[CalendarFunction].resetData(date)
// // console.log(date)
// // console.log(this[CalendarFunction].setCalenderBodyHeight)
// },
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
console.log(e)
let { disabled } = this.data
if (disabled) return false;
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, source } = e.detail
/**
* 根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。
* touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制
* 只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
*/
source == 'touch' &&
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()
}
},
ready() {
this[CalendarFunction] = new Calendar(this)
}
})
{
"component": true,
"usingComponents": {}
}
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot/>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" />
<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" class='calender-close-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>
</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 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?true:""}} ' 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>
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
width: 100%;
height: 100%;
}
.calender-bg {
position: absolute;
background: rgba(0, 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 0.5s forwards;
color: #333;
}
.calender-view.true {
border-radius: var(--fontSize40) var(--fontSize40) 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 0.5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 var(--fontSize4) var(--fontSize20) rgba(0, 0, 0, 0.1);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: var(--fontSize88);
text-align: center;
position: relative;
font-size: var(--fontSize32);
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: var(--fontSize40);
transform: translateY(-50%);
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: var(--fontSize28);
}
.calender-subtitle .arrow {
width: var(--fontSize14);
height: var(--fontSize14);
border-top: var(--fontSize2) solid transparent;
border-right: var(--fontSize2) solid #ccc;
border-bottom: var(--fontSize2) solid #ccc;
border-left: var(--fontSize2) solid transparent;
transform: rotate(45deg) translateY(calc(-1 * var(--fontSize4)));
margin-left: var(--fontSize16);
transition: all 0.3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(calc(-1 * var(--fontSize4)));
}
.calender-close {
position: absolute;
width: var(--fontSize40);
height: var(--fontSize40);
top: 50%;
right: var(--fontSize24);
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: var(--fontSize24);
height: var(--fontSize24);
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: var(--fontSize24);
line-height: var(--fontSize60);
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: var(--fontSize20) 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: #f2f3f5;
text-shadow: 0 var(--fontSize4) var(--fontSize20) #f2f3f5;
font-size: var(--fontSize320);
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: var(--fontSize32);
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: var(--fontSize8);
}
.calender-day.disable {
opacity: 0.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: var(--fontSize14);
}
@media screen and (min-width: 1000px) {
.calender-day .text {
display: flex;
justify-content: center;
align-items: center;
}
.calender-tips {
margin-left: var(--fontSize5);
}
}
.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: var(--fontSize14) var(--fontSize32);
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: var(--fontSize72);
font-size: var(--fontSize28);
color: #fff;
border-radius: var(--fontSize999);
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: 0.3;
}
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
// 兼容新版本不能使用type 改用optionalTypes 属性避免提示错误
type: String,
optionalTypes: [Number]
// optionalTypes: [String]
},
title: String, // 标题名称
disabled: {
type: Boolean,
value: false
}, //是否能选中
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 改用optionalTypes 属性避免提示错误
type: Number,
optionalTypes: [Number],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean,
isComponents: Boolean,
maxDayRange: Number, // 最大可选范围长度
maxDayRangeType: String // 最大可选范围类型
// dataDateStr: {
// type: String,
// observer: function (n) {
// // console.log(n)
// this.resetData(n)
// }
// } //日期变化
// forceFullSucreen: {
// // 兼容isFullSucreen 属性不准确的情况
// type: Boolean,
// value: false
// }
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
}
}
// components/Calendar/Calendar.js // components/CalendarMonth/CalendarMonth.js
import Calendar from './Calendar_Function' import Calendar from './Calendar_Function'
import CalendarMonthOnly from './Calendar_Function_monthOnly'
import _component_ from './Static_Properties' import _component_ from './Static_Properties'
import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
import {
getInitialDayType,
resolveMonthOnly,
resolveDayOnly,
buildMonthSetDataPayload,
shouldUseSingleMonthView
} from './calendarMonth.helpers.js'
const CalendarFunction = Symbol('CalendarFunction') const CalendarFunction = Symbol('CalendarFunction')
Component({ Component({
/**
* 组件的属性列表
*/
properties: _component_.properties, properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data, data: _component_.data,
/**
* 组件的方法列表
*/
methods: { methods: {
noScroll() {}, noScroll() {},
/** 确保月份数据已 lazy 构建 */
ensureMonthListReady() {
if (this._monthListReady || this._monthOnlyMode) return
this[CalendarFunction].setMonthList()
this._monthListReady = true
},
/** 日期手动改(原全局 Calendar API,createArchives/defeatOrder 等仍调用) */
resetData(date) {
this.ensureMonthListReady()
let { monthList, current } = this.data
monthList.map(x => {
x.data.map(i => {
i.active = false
i.rangeLabel = ''
})
})
monthList.map((item, index) => {
item.data.map(ele => {
if (ele.data == date) {
ele.active = true
current = index
}
})
})
this.setData(buildMonthSetDataPayload(this.data, { monthList, current }))
},
setCalenderBodyHeight() { setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight() this[CalendarFunction].setCalenderBodyHeight()
}, },
showCalendar(e) { showCalendar(e) {
if (this.data.disabled) return false
let type = (e && e.currentTarget && e.currentTarget.dataset.type) || '' let type = (e && e.currentTarget && e.currentTarget.dataset.type) || ''
let result = type === 'show' let result = type === 'show'
if (!result) { if (!result) {
this.setData({ this.setData({ hideCalendar: true })
hideCalendar: true
})
setTimeout(() => { setTimeout(() => {
this.setData({ this.setData({
show: result, show: result,
...@@ -36,91 +63,126 @@ Component({ ...@@ -36,91 +63,126 @@ Component({
}) })
}, 300) }, 300)
} else { } else {
this.setData({ if (!this._monthOnlyMode) {
show: result this.ensureMonthListReady()
}) }
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight() this.setData({ show: result })
if (!this.data.calenderBodyHeight) {
this[CalendarFunction].setCalenderBodyHeight()
}
} }
this.triggerEvent('tapCalendar') this.triggerEvent('tapCalendar')
}, },
dateChange(e) { dateChange(e) {
let { current, source } = e.detail let { current, source } = e.detail
let {dayType} = this.data let { dayType, dayOnly } = this.data
// console.log(source) if (source !== 'touch') return
// console.log(current)
/** if (dayType) {
* 根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。 if (!shouldUseSingleMonthView(dayOnly, false, false)) {
* touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制 this[CalendarFunction].onSwiperDateChange(current)
* 只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug }
*/ } else {
source == 'touch' && this.setData({ yearCurrent: current })
this.setData({ }
[dayType?'current':'yearCurrent']:current
})
}, },
bindDateChange: function (e) { bindDateChange: function (e) {
var date = e.detail.value var date = e.detail.value
console.log(date) this.setData({ date: date })
this.setData({
date: date
})
this.post_data.year = date this.post_data.year = date
this.renderHtml() this.renderHtml()
}, },
choose(e) { choose(e) {
let { dateType, minDate, maxDate } = this.data let { dateType, minDate, maxDate } = this.data
let { data } = e.currentTarget.dataset let { data } = e.currentTarget.dataset
// console.log((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) if (
console.log(minDate && Date.parse(minDate) > Date.parse(data)) (minDate && Date.parse(minDate) > Date.parse(data)) ||
console.log(maxDate && Date.parse(maxDate) < Date.parse(data)) (maxDate && Date.parse(maxDate) < Date.parse(data))
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return ) {
return
}
this[CalendarFunction][dateType](e) this[CalendarFunction][dateType](e)
}, },
monChoose(e) { monChoose(e) {
let { data, type } = e.currentTarget.dataset const { data, type } = e.currentTarget.dataset
if (data.disable) return false if (data.disable) return false
if (this._monthOnlyMode) {
this[CalendarFunction][this.properties.dateType](e)
return
}
this[CalendarFunction][type](e) this[CalendarFunction][type](e)
}, },
done() { done() {
let { dateType } = this.data if (this._monthOnlyMode) {
this[CalendarFunction].done(dateType) this[CalendarFunction].done()
return
}
this[CalendarFunction].done(this.data.dateType)
}, },
changeDate(e) { changeDate(e) {
let { value } = e.detail let { value } = e.detail
console.log(value) if (this._monthOnlyMode) {
this.setData({ this.setData({ current: value })
current: value return
}) }
this[CalendarFunction].onPickerMonthChange(Number(value))
}, },
bindYearChange(e) { bindYearChange(e) {
let { value } = e.detail let { value } = e.detail
this.setData({ this.setData({ yearCurrent: value })
yearCurrent: value
})
}, },
showShortcutPicker() { showShortcutPicker() {
this.setData({ this.setData({ showShortcut: !this.data.showShortcut })
showShortcut: !this.data.showShortcut
})
}, },
showShortcutPickerYear() { showShortcutPickerYear() {
this.setData({ this.setData({ showShortcutYear: !this.data.showShortcutYear })
showShortcutYear: !this.data.showShortcutYear
})
}, },
chooseAll() { chooseAll() {
this.ensureMonthListReady()
this[CalendarFunction].chooseAll() this[CalendarFunction].chooseAll()
}, },
changeModel() { changeModel() {
let { dayType } = this.data let { dayType } = this.data
this.setData({ dayType: dayType == 0 ? 1 : 0 })
}
},
attached() {
const monthOnly = resolveMonthOnly(
this.properties.monthOnly,
this.properties.monType
)
const dayOnly = resolveDayOnly(this.properties.dayOnly, monthOnly)
this._monthOnlyMode = monthOnly
this._dayOnlyMode = dayOnly
this._monthListReady = false
if (monthOnly) {
this.setData({ this.setData({
dayType: dayType == 0 ? 1 : 0 dayType: getInitialDayType({ monthOnly: true }),
closeIconUrl: CLOSE_ICON_URL,
dayOnly: false
}) })
this[CalendarFunction] = new CalendarMonthOnly(this)
this._monthListReady = true
} else {
this.setData({
dayType: getInitialDayType({ monthOnly: false, dayOnly }),
closeIconUrl: CLOSE_ICON_URL,
dayOnly
})
this[CalendarFunction] = new Calendar(this)
} }
},
ready() {
// console.log(this)
// return
this[CalendarFunction] = new Calendar(this)
} }
}) })
<view class='calender-picker' bindtap="showCalendar" data-type='show'> <view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot /> <slot />
</view> </view>
<!-- 弹框模式 --> <view class='calender-box' wx:if="{{show}}" catchtouchmove="noScroll">
<!-- 先取消 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" /> <view class='calender-bg' bindtap="showCalendar" />
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{(isFullSucreen&&!showConfirm)?"isFullSucreen":""}} ' style="height:{{height}};"> <view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{(isFullSucreen&&!showConfirm)?"isFullSucreen":""}} {{ monthOnly || monType ? "calender-view--monthOnly" : "" }}' style="height:{{height}};--calender-color:{{calenderColor}};">
<!-- 按日期选择 开始 -->
<view class='calender-header'> <view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'> <view class='calender-title' wx:if='{{showTitle}}'>
<!-- <block wx:if="{{rangeAll && dateType == 'range'}}"> --> <view wx:if="{{!monthOnly && !monType && !dayOnly}}" class="calender-all" style="color:{{calenderColor}};" bindtap="changeModel">
<!-- bindtap="chooseAll" -->
<view class="calender-all" style="color:{{calenderColor}};" bindtap="changeModel">
{{dateObj['tips'][dayType]}} {{dateObj['tips'][dayType]}}
</view> </view>
<!-- </block> -->
{{title||'日期选择'}} {{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar"> <view class='calender-close' bindtap="showCalendar">
<image src="./images/close.png" class='calender-close-image' /> <image src="{{ closeIconUrl }}" class='calender-close-image' mode="aspectFit" />
</view> </view>
</view> </view>
<block wx:if='{{showSubTitle}}'> <block wx:if='{{showSubTitle}}'>
<!-- <block hidden="{{!dayType}}"> --> <picker wx:if="{{!monthOnly && !monType && shortcut && dayType}}" class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}">
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut&&dayType}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker"> <view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}} {{dateList[current]}}
<view class='arrow {{showShortcut}}' /> <view class='arrow {{showShortcut}}' />
</view> </view>
</picker> </picker>
<picker class='calender-subtitle' value="{{yearCurrent}}" bindcancel='showShortcutPickerYear' range="{{monPickList}}" wx:elif='{{shortcut&&!dayType}}' bindchange="bindYearChange"> <picker wx:elif="{{shortcut && (!dayType || monthOnly || monType)}}" class='calender-subtitle' value="{{yearCurrent}}" bindcancel='showShortcutPickerYear' range="{{monPickList}}" bindchange="bindYearChange">
<view class='calender-subtitle-text' bindtap="showShortcutPickerYear`"> <view class='calender-subtitle-text' bindtap="showShortcutPickerYear">
{{monPickList[yearCurrent]}} {{monPickList[yearCurrent]}}
<view class='arrow {{showShortcutYear}}' /> <view class='arrow {{showShortcutYear}}' />
</view> </view>
</picker> </picker>
<view class='calender-subtitle' wx:else>{{monPickList[current]}}</view> <view class='calender-subtitle' wx:else>{{monPickList[current]}}</view>
<!-- </block> -->
<!-- <block hidden="{{dayType}}"> -->
<!-- </block> -->
</block> </block>
<view class='calendar-weekdays' hidden="{{!dayType}}"> <view class='calendar-weekdays' hidden="{{!dayType || monthOnly || monType}}">
<block wx:for='{{weekdays}}' wx:key='index'> <block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view> <view class='calendar-weekday'>{{item}}</view>
</block> </block>
</view> </view>
</view> </view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})"> <view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<!-- 日期 --> <block wx:if="{{dayOnly || (!monthOnly && !monType)}}">
<swiper hidden="{{!dayType}}" class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'> <!-- dayOnly:单月渲染,无全量 swiper -->
<block wx:for='{{monthList}}' wx:key='index'> <view wx:if="{{dayOnly && dayType && monthList.length}}" class="calender-month-panel">
<swiper-item> <view class='calender-mark box-center' wx:if="{{!hideMark}}">{{monthList[current].mark}}</view>
<view class='calender-month'>
<view wx:for='{{monthList[current].data}}' wx:for-item='i' wx:for-index='ind' wx:key='data' class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}} {{i.middle?"calender-day--middle":""}}' bindtap="choose" data-index='{{current}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<text class="calender-day-text">{{i.day}}<text wx:if="{{i.rangeLabel}}" class="calender-tips">{{i.rangeLabel}}</text></text>
</view>
</view>
</view>
<!-- 全功能:三窗 swiper -->
<swiper wx:elif="{{dayType && displayMonths.length}}" class='calender-swiper' bindchange='dateChange' current='{{swiperCurrent}}' vertical='{{vertical}}'>
<swiper-item wx:for='{{displayMonths}}' wx:key='monthIndex'>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view> <view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view>
<view class='calender-month'> <view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'> <view wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='data' class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}} {{i.middle?"calender-day--middle":""}}' bindtap="choose" data-index='{{item.monthIndex}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<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}}'> <text class="calender-day-text">{{i.day}}<text wx:if="{{i.rangeLabel}}" class="calender-tips">{{i.rangeLabel}}</text></text>
<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> </view>
</swiper-item> </swiper-item>
</block> </swiper>
</swiper> </block>
<!-- 月份 wx:if="{{!dayType}}" --> <div class='calenderMonth' wx:if="{{monthOnly || monType || (!dayOnly && !dayType)}}">
<div class='calenderMonth'> <swiper class='calender-year ' bindchange='dateChange' current='{{yearCurrent}}' vertical='{{vertical}}'>
<swiper hidden="{{dayType}}" class='calender-year ' bindchange='dateChange' current='{{yearCurrent}}' vertical='{{vertical}}'>
<block wx:for="{{yearList}}" wx:for-item="item" wx:for-index="index" wx:key="index"> <block wx:for="{{yearList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<swiper-item class="calenderMonth"> <swiper-item class="calenderMonth">
<block wx:for="{{item}}" wx:for-item="monItem" wx:for-index="monIndex" wx:key="monIndex"> <block wx:for="{{item}}" wx:for-item="monItem" wx:for-index="monIndex" wx:key="monIndex">
<view bindtap="monChoose" data-type="month" data-index="{{monIndex}}" data-yearindex="{{index}}" data-data="{{monItem}}" class="monItem {{monItem.start?'active':''}} {{monItem.select?'select':''}} {{monItem.end?'end':''}} {{monItem.disable?'disable':''}}"> <view bindtap="monChoose" data-type="month" data-index="{{monIndex}}" data-yearindex="{{index}}" data-data="{{monItem}}" class="monItem {{ monthOnly || monType ? (monItem.active?'active':'') : (monItem.start?'active':'') }} {{ !monthOnly && !monType && monItem.select ? 'select' : '' }} {{ !monthOnly && !monType && monItem.end ? 'end' : '' }} {{monItem.disable?'disable':''}}">
<view>{{monItem.label}}</view> <view>{{monItem.label}}</view>
<view class="text" wx:if="{{monItem.start}}">开始</view> <view class="text" wx:if="{{!monthOnly && !monType && monItem.start}}">开始</view>
<view class="text" wx:if="{{monItem.end}}">结束</view> <view class="text" wx:if="{{!monthOnly && !monType && monItem.end}}">结束</view>
</view> </view>
</block> </block>
</swiper-item> </swiper-item>
...@@ -85,11 +74,10 @@ ...@@ -85,11 +74,10 @@
</swiper> </swiper>
</div> </div>
</view> </view>
<!-- 月份 结束 -->
<view class='calender-footer {{isFullSucreen?true:""}} ' wx:if='{{showConfirm}}'> <view class='calender-footer {{isFullSucreen?true:""}} ' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done"> <view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">
{{confirmText||'确定'}} {{confirmText||'确定'}}
</view> </view>
</view> </view>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</view>
...@@ -178,27 +178,52 @@ ...@@ -178,27 +178,52 @@
display: flex; display: flex;
} }
.calender-month-panel {
height: 100%;
position: relative;
}
.calender-day.active { .calender-day.active {
color: #fff; color: #fff;
border-radius: var(--fontSize8); border-radius: var(--fontSize8);
background: var(--calender-color, #00A479);
} }
.calender-day.disable { .calender-day.disable {
opacity: .25; opacity: .25;
} }
.calender-day .calender-middle { .calender-day--middle {
color: var(--calender-color, #00A479);
}
.calender-day--middle::before {
content: '';
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
background: var(--calender-color, #00A479);
opacity: 0.1; opacity: 0.1;
} }
.calender-day .text { .calender-day-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center; text-align: center;
width: 100%; width: 100%;
font-size: var(--fontSize32);
}
.calender-day .calender-middle {
display: none;
}
.calender-day .text {
display: none;
} }
.calender-tips { .calender-tips {
...@@ -289,6 +314,11 @@ flex-wrap: wrap; */ ...@@ -289,6 +314,11 @@ flex-wrap: wrap; */
border-radius: 8px 0px 0px 8px; border-radius: 8px 0px 0px 8px;
} }
/* monthOnly 单选:四角圆角,非范围起点样式(对齐原 CalendarMonthSingle) */
.calender-view--monthOnly .monItem.active {
border-radius: 8px;
}
.monItem.end { .monItem.end {
color: #fff; color: #fff;
background: #347BFF; background: #347BFF;
......
...@@ -77,11 +77,26 @@ export default { ...@@ -77,11 +77,26 @@ export default {
maxDate: String, maxDate: String,
/**隐藏水印 */ /**隐藏水印 */
hideMark: Boolean, hideMark: Boolean,
isComponents: Boolean isComponents: Boolean,
disabled: {
type: Boolean,
value: false
},
maxDayRange: Number,
maxDayRangeType: String,
/** 仅日期模式(合并原全局 Calendar,隐藏日/月切换) */
dayOnly: { type: Boolean, value: true },
/** 仅月份模式(合并原 CalendarMonthSingle) */
monthOnly: { type: Boolean, value: false },
/** @deprecated 兼容 tabIndex,等同 monthOnly */
monType: Boolean
}, },
data: { data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'], weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [], monthList: [],
/** 三窗 swiper 可见月份(全功能模式) */
displayMonths: [],
swiperCurrent: 1,
dateList: [], dateList: [],
monPickList: [], monPickList: [],
current: 0, current: 0,
...@@ -179,6 +194,7 @@ export default { ...@@ -179,6 +194,7 @@ export default {
// } // }
// ], // ],
dayType: 1, // 1 日期 0 月份 默认日期 dayType: 1, // 1 日期 0 月份 默认日期
closeIconUrl: '',
dateObj: { dateObj: {
// switch:'按月份', // switch:'按月份',
// type:'day', // type:'day',
......
// 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()
}
this.triggerEvent('tapCalendar')
},
dateChange(e) {
let { current, source } = e.detail
// console.log(source)
console.log(current)
/**
* 根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。
* touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制
* 只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
*/
source == 'touch' &&
this.setData({
current
})
},
bindDateChange: function (e) {
var date = e.detail.value
console.log(date)
this.setData({
date: date
})
this.post_data.year = date
this.renderHtml()
},
choose(e) {
let { dateType, minDate, maxDate } = this.data
let { data } = e.currentTarget.dataset
// console.log((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data)))
console.log(minDate && Date.parse(minDate) > Date.parse(data))
console.log(maxDate && Date.parse(maxDate) < Date.parse(data))
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
monChoose(e) {
let { dateType } = this.data
let { data, type } = e.currentTarget.dataset
if (data.disable) return false
this[CalendarFunction][dateType](e)
},
done() {
let { dateType } = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
let { value } = e.detail
console.log(value)
this.setData({
current: value
})
},
bindYearChange(e) {
let { value } = e.detail
this.setData({
yearCurrent: value
})
},
showShortcutPicker() {
this.setData({
showShortcut: !this.data.showShortcut
})
},
showShortcutPickerYear() {
this.setData({
showShortcutYear: !this.data.showShortcutYear
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
},
changeModel() {
let { dayType } = this.data
this.setData({
dayType: dayType == 0 ? 1 : 0
})
}
},
ready() {
// console.log(this)
// return
this[CalendarFunction] = new Calendar(this)
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot />
</view>
<!-- 弹框模式 -->
<!-- 先取消 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" />
<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'}}"> -->
<!-- bindtap="chooseAll" -->
<!-- <view class="calender-all" style="color:{{calenderColor}};" bindtap="changeModel">
{{dateObj['tips'][dayType]}}
</view> -->
<!-- </block> -->
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="./images/close.png" class='calender-close-image' />
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<!-- <block hidden="{{!dayType}}"> -->
<!-- <picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut&&dayType}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}' />
</view>
</picker> -->
<!-- wx:elif='{{shortcut&&!dayType}}' -->
<picker class='calender-subtitle' value="{{yearCurrent}}" bindcancel='showShortcutPickerYear' range="{{monPickList}}" bindchange="bindYearChange">
<view class='calender-subtitle-text' bindtap="showShortcutPickerYear`">
{{monPickList[yearCurrent]}}
<view class='arrow {{showShortcutYear}}' />
</view>
</picker>
</block>
<view class='calendar-weekdays' hidden="{{!dayType}}">
<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 hidden="{{!dayType}}" 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 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> -->
<!-- 月份 wx:if="{{!dayType}}" hidden="{{dayType}}" -->
<div class='calenderMonth'>
<swiper class='calender-year ' bindchange='dateChange' current='{{yearCurrent}}' vertical='{{vertical}}'>
<block wx:for="{{yearList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<swiper-item class="calenderMonth">
<block wx:for="{{item}}" wx:for-item="monItem" wx:for-index="monIndex" wx:key="monIndex">
<!-- {{monItem.end?'end':''}} {{monItem.select?'select':''}}-->
<view bindtap="monChoose" data-type="month" data-index="{{monIndex}}" data-yearindex="{{index}}" data-data="{{monItem}}" class="monItem {{monItem.active?'active':''}} {{monItem.disable?'disable':''}}">
<view>{{monItem.label}}</view>
<!-- <view class="text" wx:if="{{monItem.start}}">开始</view>
<view class="text" wx:if="{{monItem.end}}">结束</view> -->
</view>
</block>
</swiper-item>
</block>
</swiper>
</div>
</view>
<!-- 月份 结束 -->
<view class='calender-footer {{isFullSucreen?true:""}} ' 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 \ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
width: 100%;
height: 100%;
}
.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: var(--fontSize40) var(--fontSize40) 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 var(--fontSize4) var(--fontSize20) rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: var(--fontSize88);
text-align: center;
position: relative;
font-size: var(--fontSize32);
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: var(--fontSize40);
transform: translateY(-50%);
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: var(--fontSize28);
}
.calender-subtitle .arrow {
width: var(--fontSize14);
height: var(--fontSize14);
border-top: var(--fontSize2) solid transparent;
border-right: var(--fontSize2) solid #ccc;
border-bottom: var(--fontSize2) solid #ccc;
border-left: var(--fontSize2) solid transparent;
transform: rotate(45deg) translateY(calc(-1 * var(--fontSize4)));
margin-left: var(--fontSize16);
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(calc(-1 * var(--fontSize4)));
}
.calender-close {
position: absolute;
width: var(--fontSize40);
height: var(--fontSize40);
top: 50%;
right: var(--fontSize24);
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: var(--fontSize24);
height: var(--fontSize24);
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: var(--fontSize24);
line-height: var(--fontSize60);
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: var(--fontSize20) 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: #F2F3F5;
text-shadow: 0 var(--fontSize4) var(--fontSize20) #F2F3F5;
font-size: var(--fontSize320);
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: var(--fontSize32);
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: var(--fontSize8);
}
.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: var(--fontSize14);
}
@media screen and (min-width: 1000px) {
.calender-day .text {
display: flex;
justify-content: center;
align-items: center;
}
.calender-tips {
margin-left: var(--fontSize5);
}
}
.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-year {
/* display: flex;
flex-wrap: wrap; */
width: 100%;
height: 100%;
}
.calenderMonth {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.monItem {
box-sizing: border-box;
width: 25%;
height: var(--fontSize186);
font-size: var(--fontSize32);
/* text-align: center; */
/* line-height: var(--fontSize186); */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-wrap: wrap;
color: #666666;
border: var(--fontSize1) solid #fff;
}
.monItem .text {
font-size: var(--fontSize20);
margin-top: var(--fontSize5);
}
.monItem.select {
color: #347BFF;
/* background: #347BFF;
opacity: 0.1; */
background-color: rgba(53, 130, 238, .1);
}
.monItem.active {
color: #fff;
background: #347BFF;
/* border-radius: 8px 0px 0px 8px; */
border-radius: 8px ;
}
.monItem.end {
color: #fff;
background: #347BFF;
border-radius: 0px 8px 8px 0px;
}
.monItem.disable {
color: #C8C9CC;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: var(--fontSize14) var(--fontSize32);
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: var(--fontSize72);
font-size: var(--fontSize28);
color: #fff;
border-radius: var(--fontSize999);
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
// 新版本不能使用type 改用optionalTypes 属性避免提示错误
type: String,
optionalTypes: [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 改用optionalTypes 属性避免提示错误
type: Number,
optionalTypes: [Number],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean,
isComponents: Boolean
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
monPickList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: [],
date: '',
yearCurrent: 0,
yearList: [],
rangeMonth: {},
// MonthShowList: [
// {
// label: '1月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '2月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '3月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '4月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '5月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '6月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '7月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '8月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '9月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '10月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '11月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '12月',
// disable: false,
// start: false,
// end: false,
// select: false
// }
// ],
dayType: 1, // 1 日期 0 月份 默认日期
dateObj: {
// switch:'按月份',
// type:'day',
tips: ['按日期', '按月份']
}
}
}
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js /**
* @file 底部弹层 Popup — 合并 tipsPopup / tabPopup / 分包 Popup 变体
* footerMode: default | none | tips
*/
import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
import {
getPopupSlotClass,
shouldShowCloseIcon,
shouldShowFooter,
shouldShowTips
} from './popup.helpers.js'
Component({ Component({
externalClasses: ['popup-slot-class'], externalClasses: ['popup-slot-class'],
/**
* 组件的属性列表
*/
properties: { properties: {
show: { show: {
type: Boolean, type: Boolean,
value: false, value: false,
observer: function (n, o) { observer(n) {
n && wx.hideKeyboard() n && wx.hideKeyboard()
this.setData({ this.setData({ showPopup: n })
showPopup: n
})
} }
}, },
title: String, title: String,
height: { height: { type: String, value: '85%' },
slotStyle: String,
/** default=双按钮 none=仅关闭图标 tips=提示+双按钮 */
footerMode: {
type: String,
value: 'default',
observer() {
this._syncFooterUi()
}
},
showCloseIcon: {
type: Boolean,
value: false,
observer() {
this._syncFooterUi()
}
},
tips: {
type: String, type: String,
value: '85%' observer() {
this._syncFooterUi()
}
}, },
slotStyle: String cancelText: { type: String, value: '取消' },
confirmText: { type: String, value: '确认' },
cancelStyle: String,
confirmStyle: String,
singleButton: { type: Boolean, value: false }
},
data: {
showPopup: false,
isFullSucreen: false,
showFooter: true,
showTitleClose: false,
showTipsArea: false,
slotClass: 'popup-slot',
footerLayoutClass: '',
closeIconUrl: ''
}, },
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: { methods: {
noScroll() { }, _syncFooterUi() {
hidePopup() { const { footerMode, tips, showCloseIcon } = this.properties
const hasTips = shouldShowTips(footerMode, tips)
let slotClass = getPopupSlotClass(footerMode, hasTips)
if (footerMode === 'none') {
slotClass += ' popup-slot--noneFooter'
}
this.setData({ this.setData({
show: false showFooter: shouldShowFooter(footerMode),
showTitleClose: shouldShowCloseIcon(footerMode, showCloseIcon),
showTipsArea: hasTips,
slotClass,
footerLayoutClass: footerMode === 'tips' ? 'popup-footer--tips' : ''
}) })
},
noScroll() {},
hidePopup() {
this.setData({ show: false })
this.triggerEvent('cancel') this.triggerEvent('cancel')
}, },
confirm() { confirm() {
...@@ -45,7 +88,9 @@ Component({ ...@@ -45,7 +88,9 @@ Component({
}, },
attached() { attached() {
this.setData({ this.setData({
isFullSucreen: wx.$util.isFullSucreen(true) isFullSucreen: wx.$util.isFullSucreen(true),
closeIconUrl: CLOSE_ICON_URL
}) })
this._syncFooterUi()
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -2,14 +2,22 @@ ...@@ -2,14 +2,22 @@
<view class="popup-bg" bindtap="hidePopup"></view> <view class="popup-bg" bindtap="hidePopup"></view>
<view class="popup-content" style="height:{{ height }}"> <view class="popup-content" style="height:{{ height }}">
<block wx:if="{{ title }}"> <block wx:if="{{ title }}">
<view class="popup-title text-center">{{title}}</view> <view class="popup-title text-center {{ showTitleClose ? 'popup-title--closable' : '' }}">
{{ title }}
<view wx:if="{{ showTitleClose }}" class="close" bindtap="hidePopup">
<image src="{{ closeIconUrl }}" class="close-image" mode="aspectFit" />
</view>
</view>
</block> </block>
<view class="popup-slot popup-slot-class {{ isFullSucreen?title?'isFullSucreen':'isFullSucreen-notitle':'' }}" style="{{slotStyle}}"> <view class="{{ slotClass }} popup-slot-class {{ isFullSucreen ? title ? 'isFullSucreen' : 'isFullSucreen-notitle' : '' }}" style="{{ slotStyle }}">
<slot></slot> <slot></slot>
</view> </view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}"> <block wx:if="{{ showTipsArea }}">
<view class="cancel btn text-center" bind:tap="hidePopup">取消</view> <view class="tips text-center">{{ tips }}</view>
<view class="confirm btn text-center" bind:tap="confirm">确认</view> </block>
<view wx:if="{{ showFooter }}" class="popup-footer {{ footerLayoutClass }} {{ isFullSucreen ? 'isFullSucreen' : '' }}">
<view wx:if="{{ !singleButton }}" class="cancel btn text-center" style="{{ cancelStyle }}" bind:tap="hidePopup">{{ cancelText }}</view>
<view class="confirm btn text-center {{ singleButton ? 'confirm--full' : '' }}" style="{{ confirmStyle }}" bind:tap="confirm">{{ confirmText }}</view>
</view> </view>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</view>
...@@ -42,6 +42,65 @@ ...@@ -42,6 +42,65 @@
border-bottom: var(--fontSize2) solid #EBEDF0; border-bottom: var(--fontSize2) solid #EBEDF0;
} }
.popup-title--closable {
position: relative;
}
.close {
position: absolute;
right: 0;
top: 50%;
height: 100%;
width: var(--fontSize100);
transform: translateY(-50%);
}
.close-image {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
width: var(--fontSize24);
height: var(--fontSize24);
}
.popup-slot-other {
height: calc(100% - var(--fontSize200) - var(--fontSize71));
overflow: scroll;
}
/* 原 tipsPopup:无 footer,slot 带内边距 */
.popup-slot--noneFooter {
height: calc(100% - var(--fontSize200));
padding: var(--fontSize50) var(--fontSize40);
box-sizing: border-box;
}
.popup-content .tips {
color: #999;
font-size: var(--fontSize24);
margin-bottom: var(--fontSize40);
}
/* 原 tabPopup:footer 按钮样式 */
.popup-footer--tips .btn {
font-size: var(--fontSize28);
}
.popup-footer--tips .cancel {
color: #323233;
border: var(--fontSize2) solid #DCDEE0;
background: transparent;
}
.popup-footer--hidden {
display: none;
}
.confirm--full {
width: 100% !important;
}
.popup-slot { .popup-slot {
height: calc(100% - var(--fontSize214)); height: calc(100% - var(--fontSize214));
} }
......
/**
* @file Popup 变体合并 — footer 与关闭按钮可见性纯逻辑
*/
/** @typedef {'default' | 'none' | 'tips'} PopupFooterMode */
/**
* 是否显示底部取消/确认按钮
* @param {PopupFooterMode} footerMode
* @returns {boolean}
*/
export function shouldShowFooter(footerMode) {
return footerMode === 'default' || footerMode === 'tips'
}
/**
* 是否显示标题栏关闭图标(tipsPopup 风格)
* @param {PopupFooterMode} footerMode
* @param {boolean} showCloseIcon
* @returns {boolean}
*/
export function shouldShowCloseIcon(footerMode, showCloseIcon) {
return footerMode === 'none' || showCloseIcon
}
/**
* 是否显示 tips 文案区域
* @param {PopupFooterMode} footerMode
* @param {string} [tips]
* @returns {boolean}
*/
export function shouldShowTips(footerMode, tips) {
return footerMode === 'tips' && Boolean(tips)
}
/**
* slot 区域 class:tips 模式用更高 scroll 区域
* @param {PopupFooterMode} footerMode
* @param {boolean} hasTips
* @returns {'popup-slot' | 'popup-slot-other'}
*/
export function getPopupSlotClass(footerMode, hasTips) {
return footerMode === 'tips' && hasTips ? 'popup-slot-other' : 'popup-slot'
}
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--components/SideSelectPopup/SideSelectPopup.wxml-->
<van-popup custom-style="height: 100%;width:var(--fontSize560);" z-index="999999" custom-class="popclass" bind:click-overlay="closeMenu" position="left" bind:before-enter="hideTabBar" bind:after-leave="showTabBar" show="{{ show }}">
<view class="wrapper">
<view class="title_box">
<view class="title">店面列表</view>
</view>
<view class="search-box">
<view class='select_box' wx:if="{{userInfo.sceneType == 1}}">
<view class='select' catchtap='selectTap'>
<view class='select_text'>{{searchSelectData[searchSelectIndex]}}</view>
<image class='select_img {{showSelect&&"select_img_rotate"}}' src="{{ IMG_URL }}images/arrow-right.png"></image>
</view>
<view class='option_box' wx:if="{{showSelect}}">
<view class='option {{searchSelectIndex == index ? "active" : ""}}' wx:for='{{searchSelectData}}' wx:key='this' data-index='{{index}}' catchtap='optionTap'>{{item}}</view>
</view>
<view class="mask_class" wx:if="{{showSelect}}" bindtap="closeSelect"></view>
</view>
<view class="search-input">
<image src="{{ IMG_URL }}images/search.png" class="search-icon" />
<input type="text" placeholder="{{searchSelectIndex == 0 ? '搜索门店名称/商户号' : '搜索客户姓名/手机号'}}" class="input" confirm-type="search" value="{{searchValue}}" placeholder-class="input-placeholder" bindinput="input" bindconfirm="inputConfifm" />
<block wx:if="{{searchValue}}">
<image src="{{ IMG_URL }}images/clear.png" class="search-clear" bindtap="clearInputText" />
</block>
</view>
</view>
<!-- 搜门店 -->
<scroll-view wx:if="{{searchSelectIndex == 0}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower="scrollonReachBottom">
<block wx:for="{{storeRangeList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element {{item.actived ? 'active' : ''}}">
<view>
<image src="{{IMG_URL}}/store_icon_nobg.png"></image>
</view>
<view class="text_box">
<view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view>
</view>
</block>
</scroll-view>
<!-- 搜客户 -->
<scroll-view wx:if="{{customStoreList.length && searchSelectIndex == 1 && userInfo.sceneType == 1}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" bindscrolltolower="scrollonReachBottom">
<block wx:for="{{customStoreList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element custom_element {{item.actived ? 'active' : ''}}">
<view>
<image src="{{IMG_URL}}/user_avatar.png"></image>
</view>
<view class="text_box">
<view class="custom_text">
<view class="name_phone">
<text class="custom_name">{{item.customer.customerName}}</text>
<text class="custom_phone">{{item.customer.customerPhone}}</text>
</view>
<view class="status_text status_text_{{item.listStatus}}">{{statusText[item.listStatus]}}</view>
</view>
<view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view>
</view>
</block>
</scroll-view>
<block wx:if="{{(!customStoreList.length && searchSelectIndex == 1) || (!storeRangeList.length && searchSelectIndex == 0)}}">
<view class="list_not">
<image class="list_nothing_img {{customSearchFlag ? '' : 'big_list_nothing_img'}}" src="{{IMG_URL}}/{{customSearchFlag ? 'no_data_bg' : 'search_icon_bg'}}.png" mode="" />
<view class="list_not_text">{{customSearchFlag ? '您搜索的内容暂无结果' : '快去搜索看看'}}</view>
</view>
</block>
</view>
</van-popup>
\ No newline at end of file \ No newline at end of file
@import "../SideSelectPopup/SideSelectPopup.wxss";
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
</block> </block>
</view> </view>
</view> </view>
<!-- 搜门店 --> <!-- 搜门店 prop 模式 -->
<scroll-view wx:if="{{copyStoreList.length && searchSelectIndex == 0}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}"> <scroll-view wx:if="{{dataSource !== 'page' && copyStoreList.length && searchSelectIndex == 0}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}">
<block wx:for="{{copyStoreList}}" wx:key="index" wx:for-index="index"> <block wx:for="{{copyStoreList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element {{item.actived ? 'active' : ''}}"> <view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element {{item.actived ? 'active' : ''}}">
<view><image class="element-icon" src="{{IMG_URL}}/store_icon_nobg.png"></image></view> <view><image class="element-icon" src="{{IMG_URL}}/store_icon_nobg.png"></image></view>
...@@ -68,6 +68,19 @@ ...@@ -68,6 +68,19 @@
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
<!-- 搜门店 page 模式 -->
<scroll-view wx:if="{{dataSource === 'page' && searchSelectIndex == 0}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower="scrollonReachBottom">
<block wx:for="{{storeRangeList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element {{item.actived ? 'active' : ''}}">
<view><image class="element-icon" src="{{IMG_URL}}/store_icon_nobg.png"></image></view>
<view class="text_box">
<view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view>
</view>
</block>
</scroll-view>
<!-- 搜客户 --> <!-- 搜客户 -->
<scroll-view wx:if="{{customStoreList.length && searchSelectIndex == 1 && userInfo.sceneType == 1}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" bindscrolltolower="scrollonReachBottom"> <scroll-view wx:if="{{customStoreList.length && searchSelectIndex == 1 && userInfo.sceneType == 1}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" bindscrolltolower="scrollonReachBottom">
<block wx:for="{{customStoreList}}" wx:key="index" wx:for-index="index"> <block wx:for="{{customStoreList}}" wx:key="index" wx:for-index="index">
...@@ -88,7 +101,7 @@ ...@@ -88,7 +101,7 @@
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
<block wx:if="{{(!customStoreList.length && searchSelectIndex == 1) || (!copyStoreList.length && searchSelectIndex == 0)}}"> <block wx:if="{{(!customStoreList.length && searchSelectIndex == 1) || (dataSource !== 'page' && !copyStoreList.length && searchSelectIndex == 0) || (dataSource === 'page' && !storeRangeList.length && searchSelectIndex == 0)}}">
<view class="list_not"> <view class="list_not">
<image class="list_nothing_img {{customSearchFlag ? '' : 'big_list_nothing_img'}}" src="{{IMG_URL}}/{{customSearchFlag ? 'no_data_bg' : 'search_icon_bg'}}.png" mode=""/> <image class="list_nothing_img {{customSearchFlag ? '' : 'big_list_nothing_img'}}" src="{{IMG_URL}}/{{customSearchFlag ? 'no_data_bg' : 'search_icon_bg'}}.png" mode=""/>
<view class="list_not_text">{{customSearchFlag ? '您搜索的内容暂无结果' : '快去搜索看看'}}</view> <view class="list_not_text">{{customSearchFlag ? '您搜索的内容暂无结果' : '快去搜索看看'}}</view>
......
/**
* @file SideSelectPopup 纯逻辑 — dataSource 分支与 prop 模式门店高亮
* 供 SideSelect/SideSelectByPage 合并后单测;组件内 setData 前调用。
*/
/**
* 是否分页自拉门店列表
* @param {string} dataSource
* @returns {boolean}
*/
export function shouldUsePageDataSource(dataSource) {
return dataSource === 'page'
}
/**
* show=true 时重置的 UI 状态(prop/page 共用)
* @param {boolean} show
* @returns {object|null}
*/
export function getInitialPageState(show) {
if (!show) return null
return {
searchValue: '',
edit: false,
customSearchFlag: false,
showSelect: false,
nothing: false,
pageNum: 1
}
}
/**
* prop 模式:对 storeList 计算 actived 高亮
* @param {object[]} storeList
* @param {object} userInfo
* @param {number} subIndex
* @param {string} sceneName
* @param {boolean} isSuper
* @returns {object[]}
*/
export function mapStoreActived(storeList, userInfo, subIndex, sceneName, isSuper) {
return (storeList || []).map((val, index) => {
const item = {
...val,
actived: false,
index,
sceneName: val.sceneName || sceneName
}
if (userInfo?.sceneType == 1) {
if (isSuper && userInfo?.shopMerchantId == val.merchantId) item.actived = true
else if (!isSuper && val.merchantId == userInfo?.shopMerchantId) item.actived = true
} else {
const matchDefault4S =
(userInfo?.sceneType == 0 &&
userInfo?.default4SStoreInfo?.merchantId == val.merchantId) ||
(userInfo?.sceneType == 3 &&
userInfo?.default4SStoreInfo_crowdFunding?.merchantId == val.merchantId) ||
(userInfo?.sceneType == 2 &&
userInfo?.default4SStoreInfo_newCarConversion?.merchantId == val.merchantId)
if (isSuper && matchDefault4S) item.actived = true
else if (!isSuper && val.merchantId == userInfo?.shopMerchantId) item.actived = true
}
return item
})
}
/**
* 按属性去重(page 模式门店列表)
* @param {object[]} arr
* @param {string} prop
* @returns {object[]}
*/
export function uniqueByProperty(arr, prop) {
const map = new Map()
;(arr || []).forEach(obj => {
map.set(obj[prop], obj)
})
return Array.from(map.values())
}
/**
* page 模式 API 返回列表后处理:prepend「全部」、补当前店、高亮
* @param {object[]} tempList
* @param {object} userInfo
* @param {string} sceneName
* @param {string} searchValue
* @returns {object[]}
*/
export function finalizePageModeStoreList(tempList, userInfo, sceneName, searchValue) {
let list = [...(tempList || [])]
if (!searchValue) {
if (!list.some(v => v.merchantName === '全部')) {
list.unshift({ merchantName: '全部' })
}
if (
userInfo?.shopMerchantId &&
!list.some(v => v.merchantId === userInfo.shopMerchantId)
) {
list.push({
merchantId: userInfo.shopMerchantId,
merchantName: userInfo.shopMerchantName
})
}
}
list = uniqueByProperty(list, 'merchantId')
return list.map(v => ({
...v,
actived:
userInfo?.shopMerchantId === v.merchantId ||
(!userInfo?.shopMerchantId && !v.merchantId),
sceneName: v.sceneName || sceneName
}))
}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class="box-title"> <view class="box-title">
<view>技师</view> <view>技师</view>
<!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> --> <!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> -->
<view class="tips" wx:if="{{ multiple }}">产生副手技师,请主技师为副手技师分配整单提成比例</view> <view class="tips" wx:if="{{ multiple && deputyFlag }}">产生副手技师,请主技师为副手技师分配整单提成比例</view>
</view> </view>
<block wx:if="{{ artificerList.length }}"> <block wx:if="{{ artificerList.length }}">
<scroll-view <scroll-view
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<view class="text_box"> <view class="text_box">
<view class="text-hide {{ item.disabled ? 'disabled' : '' }}">{{item.staffName}}</view> <view class="text-hide {{ item.disabled ? 'disabled' : '' }}">{{item.staffName}}</view>
</view> </view>
<view class="shareRatioBox" wx:if="{{ multiple && item.active }}"> <view class="shareRatioBox" wx:if="{{ multiple && item.active && deputyFlag }}">
整单分成比例 整单分成比例
<input <input
placeholder="整数" placeholder="整数"
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<block wx:else> <block wx:else>
<empty-data style="width: 100%;" /> <empty-data style="width: 100%;" />
</block> </block>
<view class="tips bottomTips" wx:if="{{ multiple }}"> <view class="tips bottomTips" wx:if="{{ multiple && deputyFlag }}">
主技师整单分成比例 主技师整单分成比例
<text class="text">{{ showMainShareRatio }}%</text> <text class="text">{{ showMainShareRatio }}%</text>
</view> </view>
......
/**
* @file 技师选择弹层纯逻辑 — idKey 分支、列表映射、confirm 载荷
* 供 Artificer/Technician 合并后单测;组件内 setData 前调用。
*/
/**
* 从选中对象取 identity key
* @param {object} item
* @param {'technicianId'|'uuid'} idKey
* @returns {string|number|undefined}
*/
export function getItemKey(item, idKey) {
if (!item) return undefined
if (idKey === 'uuid') return item.uuid
return item.technicianId || item.id
}
/**
* 从 artificerSelectObj 构建选中 id 数组
* @param {object|object[]} artificerSelectObj
* @param {'technicianId'|'uuid'} idKey
* @returns {Array<string|number>}
*/
export function buildSelectArr(artificerSelectObj, idKey) {
if (Array.isArray(artificerSelectObj)) {
return artificerSelectObj.map(val => getItemKey(val, idKey)).filter(k => k != null)
}
const key = getItemKey(artificerSelectObj, idKey)
return key != null ? [key] : []
}
/**
* 选中项 shareRatio 映射
* @param {object[]} selectedList
* @param {'technicianId'|'uuid'} idKey
* @returns {Record<string|number, *>}
*/
export function buildRatioMap(selectedList, idKey) {
return selectedList.reduce((m, v) => {
const k = getItemKey(v, idKey)
if (k != null) m[k] = v.shareRatio
return m
}, {})
}
/**
* 打开弹层时映射技师列表 active/disabled/shareRatio
* @param {object[]} copyArtificerList
* @param {object} options
* @returns {object[]}
*/
export function mapArtificerList(copyArtificerList, options) {
const {
artificerSelectObj,
selectArr,
ratioMap,
idKey,
disabledSelectObj,
deputyFlag
} = options
const selectedList = Array.isArray(artificerSelectObj)
? artificerSelectObj
: artificerSelectObj
? [artificerSelectObj]
: []
let list = (copyArtificerList || []).map(i => {
let item = { ...i }
if (idKey === 'uuid' && selectedList.length) {
const matched = selectedList.find(v => v.uuid == i.uuid)
if (matched?.id !== undefined) item.id = matched.id
}
const itemKey = idKey === 'uuid' ? i.uuid : i.id
const active = selectArr?.includes(itemKey)
const disabled =
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const shareRatio = active ? ratioMap[itemKey] ?? '' : ''
return { ...item, active, disabled, shareRatio }
})
if (selectArr.length === 2 && deputyFlag) {
list = list.map(i => {
const itemKey = idKey === 'uuid' ? i.uuid : i.id
if (!selectArr.includes(itemKey)) return { ...i, disabled: true }
return i
})
}
return list
}
/**
* 计算主技师剩余分成比例
* @param {object[]} list
* @returns {number}
*/
export function calcShowMainShareRatio(list) {
const sum = (list || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0, 10))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
return showMainShareRatio
}
/**
* 确认时构建 payload;空选时 deputy 模式允许清空
* @param {object} params
* @returns {{ ok: boolean, reason?: string, payload?: object }}
*/
export function buildConfirmPayload({ artificerSelectObj, activeArr, idKey, deputyFlag }) {
if (!activeArr?.length) {
if (deputyFlag) {
return {
ok: true,
payload: {
...artificerSelectObj,
technicianUuid: '',
technicianName: '',
selectedTechnicians: []
}
}
}
return { ok: false, reason: 'empty' }
}
if (deputyFlag) {
const invalid = activeArr.some(
v =>
v.shareRatio === '' ||
v.shareRatio === undefined ||
v.shareRatio === null
)
if (invalid) return { ok: false, reason: 'invalid_ratio' }
}
const payload = {
...artificerSelectObj,
technicianUuid: activeArr[0]?.uuid || '',
technicianName: activeArr[0]?.staffName || '',
selectedTechnicians: activeArr
}
if (idKey === 'technicianId') {
payload.technicianId = activeArr[0]?.id || ''
}
return { ok: true, payload }
}
/**
* @file storePicker 纯逻辑 — confirm/toast 与 show 重置
* 供全局 storePicker 合并 staffDaily 副本后单测。
*/
/**
* 未选时的 toast 文案
* @param {string|undefined} pickerType - 'merchant' | 'staff'
* @returns {string}
*/
export function getConfirmToast(pickerType) {
if (pickerType === 'staff') return '请选择员工'
return '请选择门店'
}
/**
* confirm 时是否额外 trigger search(operatingShow 默认 true)
* @param {string|undefined} pickerType
* @returns {boolean}
*/
export function shouldEmitSearchOnConfirm(pickerType) {
return !pickerType
}
/**
* show=true 时是否清空搜索并 emit search
* @param {boolean} show
* @returns {{ searchValue: string, shouldEmitSearch: boolean }|null}
*/
export function getShowResetSearchState(show) {
if (!show) return null
return { searchValue: '', shouldEmitSearch: true }
}
/**
* 搜索 confirm 时是否重置 picker 选中索引为 0(staffDaily 行为)
* @param {string} type - input 事件 type
* @returns {boolean}
*/
export function shouldResetSelectOnSearchConfirm(type) {
return type === 'confirm'
}
import { IMG_URL } from '../../utils/imageBase.js' import { IMG_URL } from '../../utils/imageBase.js'
// packageEquity/components/storePicker/storePicker.js import {
getConfirmToast,
shouldEmitSearchOnConfirm,
getShowResetSearchState,
shouldResetSelectOnSearchConfirm
} from './storePicker.helpers.js'
Component({ Component({
options: { options: {
// 在组件定义时的选项中启用多slot支持 multipleSlots: true
multipleSlots: true,
}, },
/**
* 组件的属性列表
*/
properties: { properties: {
subIndex: { subIndex: {
type: Number, type: Number,
// value: [],
observer: function (n) { observer: function (n) {
this.setData({ this.setData({ selectStoreIndex: [n] })
selectStoreIndex: [n]
})
} }
}, },
pickList: { pickList: {
type: Array, type: Array,
value: [] value: [],
observer: function () {
if (this.properties.pickerType) {
this.setData({ selectStoreIndex: this.data.selectStoreIndex })
}
}
}, },
show: { show: {
type: Boolean type: Boolean,
observer: function (n) {
const reset = getShowResetSearchState(n)
if (!reset) return
this.setData({ searchValue: reset.searchValue })
if (reset.shouldEmitSearch && this.properties.pickerType) {
this.triggerEvent('search', { value: '' })
}
}
},
/** staffDaily:merchant | staff;不传则 operatingShow 默认行为 */
pickerType: {
type: String,
observer: function () {
if (!this.properties.pickerType) return
let thisPage = wx.$router.getPageInstance()
if (this.data.searchValue) thisPage.setData({ subIndex: 0 })
this.setData({ searchValue: '' })
this.triggerEvent('search', { value: '' })
}
},
merchantRangeListTotal: {
type: Number
} }
}, },
/**
* 组件的初始数据
*/
data: { data: {
IMG_URL, IMG_URL,
searchValue: '', searchValue: '',
selectStoreIndex: '', selectStoreIndex: '',
edit: false edit: false
}, },
/**
* 组件的方法列表
*/
methods: { methods: {
open() { open() {
if (this.data.disabled) return if (this.data.disabled) return
this.setData({ this.setData({ edit: true, inputFocus: true })
edit: true,
inputFocus: true
})
}, },
setValue(value) { setValue(value) {
if (this.properties.filterEmoji) { if (this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value) if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
} }
this.setData({ this.setData({ searchValue: value })
searchValue: value
})
}, },
input(e) { input(e) {
let { value } = e.detail let { value } = e.detail
this.setValue(value) this.setValue(value)
this.triggerEvent('input', { this.triggerEvent('input', { value })
value
})
}, },
inputBlur(e) { inputBlur(e) {
this.emit(e) this.emit(e)
...@@ -72,33 +85,33 @@ Component({ ...@@ -72,33 +85,33 @@ Component({
detail: { value }, detail: { value },
type type
} = e } = e
this.setData({ this.setData({ edit: false })
edit: false if (shouldResetSelectOnSearchConfirm(type) && this.properties.pickerType) {
}) this.setData({ selectStoreIndex: [0] })
}
this.setValue(value) this.setValue(value)
console.log('123')
this.triggerEvent(type == 'confirm' ? 'search' : 'blur', { value }) this.triggerEvent(type == 'confirm' ? 'search' : 'blur', { value })
}, },
confirm() { confirm() {
let { selectStoreIndex, pickList } = this.data let { selectStoreIndex, pickList, pickerType } = this.data
let value = selectStoreIndex[0] let value = selectStoreIndex[0]
console.log(value) const item = pickList[value]
console.log(pickList) const hasSelection =
if (!pickList[value]?.merchantName) { pickerType === 'staff' ? item?.staffName : item?.merchantName
return wx.$util.showToast('请选择门店') if (!hasSelection) {
return wx.$util.showToast(getConfirmToast(pickerType))
} }
// console.log(value)
this.triggerEvent('confirm', { value }) this.triggerEvent('confirm', { value })
this.triggerEvent('search', { value }) if (shouldEmitSearchOnConfirm(pickerType)) {
this.setData({ this.triggerEvent('search', { value })
show: false }
}) this.setData({ show: false })
},
cancel() {
this.triggerEvent('cancel')
}, },
changeStore(e) { changeStore(e) {
// console.log(e.detail.value[0]) this.setData({ selectStoreIndex: [e.detail.value[0]] })
this.setData({
selectStoreIndex: [e.detail.value[0]]
})
} }
} }
}) })
<!--packageEquity/components/storePicker/storePicker.wxml--> <!--components/storePicker/storePicker.wxml-->
<popup class="date-background" popup-slot-class="popup-style" show="{{ show }}" bindconfirm="confirm" height="80%"> <popup
class="date-background"
popup-slot-class="popup-style"
show="{{ show }}"
bindconfirm="confirm"
bindcancel="cancel"
height="{{ pickerType ? 'var(--fontSize800)' : '80%' }}"
>
<view class="date-container"> <view class="date-container">
<view class="date-confirm"> <view class="date-confirm">
<view class="search-box"> <view class="search-box">
...@@ -9,7 +16,9 @@ ...@@ -9,7 +16,9 @@
<block wx:if="{{ searchValue }}">{{searchValue}}</block> <block wx:if="{{ searchValue }}">{{searchValue}}</block>
<block wx:else> <block wx:else>
<image src="{{ IMG_URL }}images/search.png" class="icon"></image> <image src="{{ IMG_URL }}images/search.png" class="icon"></image>
{{'请输入门店'}} <block wx:if="{{ pickerType == 'staff' }}">请输入员工姓名</block>
<block wx:elif="{{ pickerType == 'merchant' }}">请输入门店</block>
<block wx:else>请输入门店</block>
</block> </block>
</view> </view>
</block> </block>
...@@ -38,10 +47,14 @@ ...@@ -38,10 +47,14 @@
> >
<picker-view-column> <picker-view-column>
<block wx:for="{{ pickList }}" wx:key="merchantId"> <block wx:for="{{ pickList }}" wx:key="merchantId">
<view class="view pickViewColumn">{{item.merchantName}}</view> <view class="view pickViewColumn">
<block wx:if="{{ pickerType == 'staff' }}">{{item.staffName}}</block>
<block wx:else>{{item.merchantName}}</block>
</view>
</block> </block>
</picker-view-column> </picker-view-column>
</picker-view> </picker-view>
</view> </view>
<view class="totalCount" wx:if="{{ pickerType == 'merchant' }}">共计{{merchantRangeListTotal}}家门店</view>
</view> </view>
</popup>
\ No newline at end of file \ No newline at end of file
</popup>
...@@ -64,4 +64,10 @@ ...@@ -64,4 +64,10 @@
.popup-style{ .popup-style{
height: calc(100% - var(--fontSize100))!important; height: calc(100% - var(--fontSize100))!important;
}
.totalCount {
text-align: center;
margin-top: 100rpx;
color: #347BFF;
} }
\ No newline at end of file \ No newline at end of file
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (n, o) {
this.setData({
showPopup: n
})
}
},
title: String,
tips: String,
height: {
type: String,
value: '85%'
},
isFullSucreen: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
hidePopup() {
this.setData({
show: false
})
},
confirm() {
this.triggerEvent('confirm')
}
},
attached() {
let { isFullSucreen } = this.data
// console.log(wx.$util.isFullSucreen())
// console.log(isFullSucreen)
this.setData({
isFullSucreen: wx.$util.isFullSucreen(isFullSucreen)
})
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="popup" hidden="{{!showPopup}}">
<!-- catchtouchmove="noScroll" -->
<view class="popup-bg" bindtap="hidePopup" />
<view class="popup-content" style="height:{{height}}">
<block wx:if="{{title}}">
<view class="popup-title text-center">{{title}}</view>
</block>
<!-- {{isFullSucreen?title?'isFullSucreen':'isFullSucreen-notitle':''}}" -->
<view class="{{tips?'popup-slot-other':'popup-slot'}}">
<slot />
</view>
<block wx:if="{{tips}}">
<view class="tips text-center">{{tips}}</view>
</block>
<!-- {{isFullSucreen?'isFullSucreen':''}} -->
<view class="popup-footer ">
<view class="cancel btn text-center" bindtap="hidePopup">取消</view>
<view class="confirm btn text-center" bindtap="confirm">确认</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.wxss */
.popup {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
}
.popup-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .6);
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.popup-content {
position: absolute;
left: 0;
width: 100%;
background: #FFFFFF;
border-radius: var(--fontSize20) var(--fontSize20) 0 0;
animation: show-popup .5s forwards;
box-sizing: border-box;
padding: 0 var(--fontSize32);
}
.popup-title {
height: var(--fontSize98);
font-size: var(--fontSize32);
color: #333333;
border-bottom: var(--fontSize2) solid #EBEDF0;
}
.popup-slot {
height: calc(100% - var(--fontSize200));
}
.popup-slot-other {
height: calc(100% - var(--fontSize200) - var(--fontSize71));
overflow: scroll;
}
.popup-slot.isFullSucreen{
height: calc(100% - var(--fontSize268));
}
.popup-slot.isFullSucreen-notitle{
height: calc(100% - var(--fontSize170));
}
.popup-content .tips {
color: #999;
font-size: var(--fontSize24);
margin-bottom: var(--fontSize40);
}
.popup-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding:var(--fontSize10) 0 ;
}
.popup-footer.isFullSucreen{
padding-bottom: var(--fontSize68) !important;
}
.popup-footer .btn {
width: var(--fontSize330);
height: var(--fontSize80);
box-sizing: border-box;
border-radius: var(--fontSize12);
font-size: var(--fontSize28);
}
.popup-footer .cancel {
color: #323233;
border: var(--fontSize2) solid #DCDEE0;
}
.popup-footer .confirm{
background: #347BFF;
color: #fff;
}
@keyframes show-popup {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
\ No newline at end of file \ No newline at end of file
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js // tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/' import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
Component({ Component({
externalClasses: ["custom-class"], externalClasses: ["custom-class"],
options: { options: {
...@@ -20,7 +20,8 @@ Component({ ...@@ -20,7 +20,8 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
IMG_URL IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/',
defaultCloseIconUrl: CLOSE_ICON_URL
}, },
/** /**
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<view class="contentText"> <view class="contentText">
{{tipsProps.tipsText}} {{tipsProps.tipsText}}
</view> </view>
<image class="closeIcon" wx:if="{{tipsProps.type == 1}}" bindtap="tapCallback" data-type="{{tipsProps.type}}" src="{{tipsProps.iconUrl || '/components/CalendarMonth/images/close.png'}}" /> <image class="closeIcon" wx:if="{{tipsProps.type == 1}}" bindtap="tapCallback" data-type="{{tipsProps.type}}" src="{{tipsProps.iconUrl || defaultCloseIconUrl}}" />
<view class="btn" wx:if="{{tipsProps.type == 2}}" bindtap="tapCallback" data-type="{{tipsProps.type}}">{{tipsProps.typeText}}</view> <view class="btn" wx:if="{{tipsProps.type == 2}}" bindtap="tapCallback" data-type="{{tipsProps.type}}">{{tipsProps.typeText}}</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (n, o) {
this.setData({
showPopup: n
})
}
},
title: String,
height: {
type: String,
value: '85%'
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
hidePopup() {
this.setData({
show: false
})
}
// confirm() {
// this.triggerEvent('confirm')
// }
},
attached() {
this.setData({
isFullSucreen: wx.$util.isFullSucreen()
})
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="popup" hidden="{{!showPopup}}" catchtouchmove="noScroll">
<view class="popup-bg" bindtap="hidePopup" />
<view class="popup-content" style="height:{{height}}">
<block wx:if="{{title}}">
<view class="popup-title text-center">
{{title}}
<view class='close' bindtap="hidePopup">
<image src="../images/close.png" class='close-image' />
</view>
</view>
</block>
<view class="popup-slot {{isFullSucreen?title?'isFullSucreen':'isFullSucreen-notitle':''}}">
<slot/>
</view>
<!-- <view class="popup-footer {{isFullSucreen?'isFullSucreen':''}}">
<view class="cancel btn text-center" bindtap="hidePopup">取消</view>
<view class="confirm btn text-center" bindtap="hidePopup">确定</view>
</view> -->
</view>
</view>
/* tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.wxss */
.popup {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
}
.popup-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .6);
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.close {
/* margin-left: auto; */
position: absolute;
right: 0;
top: 50%;
/* height: var(--fontSize24); */
height: 100%;
width: var(--fontSize100);
transform: translateY(-50%);
margin-bottom: 0;
}
.close-image {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
width: var(--fontSize24);
height: var(--fontSize24);
}
.popup-content {
position: absolute;
left: 0;
width: 100%;
background: #FFFFFF;
border-radius: var(--fontSize20) var(--fontSize20) 0 0;
animation: show-popup .5s forwards;
box-sizing: border-box;
padding: 0 var(--fontSize32);
}
.popup-title {
position: relative;
height: var(--fontSize98);
font-size: var(--fontSize32);
color: #333333;
border-bottom: var(--fontSize2) solid #EBEDF0;
}
.popup-slot {
height: calc(100% - var(--fontSize200));
padding: var(--fontSize50) var(--fontSize40);
}
/* .popup-slot .item {
margin-bottom: var(--fontSize20);
} */
.popup-slot.isFullSucreen{
height: calc(100% - var(--fontSize268));
}
.popup-slot.isFullSucreen-notitle{
height: calc(100% - var(--fontSize170));
}
.popup-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: var(--fontSize14) var(--fontSize32);
box-sizing: border-box;
}
.popup-footer.isFullSucreen{
padding-bottom: var(--fontSize68) !important;
}
.popup-footer .btn {
/* width: var(--fontSize330); */
width: 100%;
height: var(--fontSize80);
box-sizing: border-box;
border-radius: var(--fontSize12);
font-size: var(--fontSize28);
}
.popup-footer .cancel {
color: #323233;
border: var(--fontSize2) solid #DCDEE0;
}
.popup-footer .confirm{
background: #347BFF;
color: #fff;
}
@keyframes show-popup {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false ...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = getSystemInfoSync(); const systemInfo = getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
# components 优化 — 修改记录
> 规划阶段尚未开始代码改动。实施后按 Phase 追加条目。
---
## [Planning] 2026-07-06 — 初始规划文档
### 变更类型
- [x] 文档 / 规划(无业务代码改动)
### 变更摘要
完成 `components/` 全局组件审计,输出脑图、流程图、测试用例规格、全局影响矩阵与分批修改规划。
### 产出物
- `docs/components-optimization/README.md` — 主规划文档
- `docs/components-optimization/CHANGELOG.md` — 本文件
- `.cursor/plans/全局组件优化治理_124596be.plan.md` — Cursor 计划
### 关键结论
| 编号 | 决策 |
|------|------|
| C-01 | CalendarMonthSingle 可合并进 CalendarMonth |
| C-08 | collegeScene RemarkPopup 不可合并,应重命名为 PasswordPopup |
| C-09 | Merchant-Seles 需逐页迁移,不可一次性替换 |
### 测试
- 自动化:尚未编写(Phase 0 前置)
- 手动:尚未执行
### 备注
- 用户要求:先不做代码改动,先确认流程图、脑图、测试用例与全局影响
- 下一步:评审通过后进入 Phase 0(仅写测试)
---
## [Phase 1] 2026-07-06 — CalendarMonthSingle + Popup 合并 + 全局下沉
### 变更类型
- [x] 合并组件 / [x] 删除组件 / [x] 下沉注册 / [x] 重命名
### 变更摘要
删除 CalendarMonthSingle、tipsPopup、tabPopup;CalendarMonth 增加 `monthOnly`;Popup 超集化(`footerMode`);Confirm/date-picker/qr-box 从 app.json 下沉;collegeScene 密码弹窗重命名为 PasswordPopup。
### 测试
- 自动化:`npm run test:components` — **12/12 PASS**
### 兼容性(2026-07-06 补充)
- 见 [COMPATIBILITY.md](./COMPATIBILITY.md):packOptions.include、popup 子组件 json 注册、本地 close 图标、CSS 变体、布尔属性写法
---
## [Hotfix] 2026-07-06 — close.png 改回本地包路径
### 变更类型
- [x] 修复 CDN 404
### 变更摘要
`rootImageUrl('close.png')` 指向未上传的 CDN 路径;改回 `CLOSE_ICON_URL`(`/components/images/close.png`)。
### 测试
- 自动化:`npm run test:components` — 含 `componentsImageUrl.test.mjs`
---
## [Hotfix] 2026-07-06 — CalendarMonth monthOnly 合并与修复
### 变更类型
- [x] 合并组件 / [x] 修复交互 / [x] 修复 UI
### 变更摘要
CalendarMonthSingle 合并进 CalendarMonth(`monthOnly` + `Calendar_Function_monthOnly`)。修复项:`attached` 读 `this.properties` 实例化 monthOnly 逻辑;`monChoose`/`done` 走 `dateType=single`;WXML 不绑 `end`/`select`;单选四角圆角样式;close 图标改本地 `CLOSE_ICON_URL`。
### 测试
- 自动化:`npm run test:components` — CAL-01/02/05
---
## [Phase 2] 2026-07-06 — 技师 / SideSelect / storePicker 合并
### 变更类型
- [x] 合并组件 / [x] 删除组件 / [x] 提取 helpers
### 变更摘要
- **2.1** 删除 `ArtificerSelectPopup/`,统一为 `TechnicianSelectPopup` + `idKey`(`technicianId` | `uuid`);清理 `updateOrderInfo` x2 无效注册
- **2.2** 删除 `SideSelectByPagePopup/`,`SideSelectPopup` 增加 `dataSource`(`prop` | `page`);tabIndex/equityPage 改 `dataSource="page"`
- **2.3** 删除 staffDaily/upgradeStaffDaily 本地 `storePicker/` 副本,全局 `storePicker` 扩展 `pickerType` / `merchantRangeListTotal`
### 文件清单
- 新增:`technicianSelect.helpers.js`、`sideSelect.helpers.js`、`storePicker.helpers.js`
- 新增:`tests/technicianSelect.helpers.test.mjs`、`tests/sideSelectDataSource.test.mjs`、`tests/storePickerConfirm.test.mjs`
- 删除:`ArtificerSelectPopup/`、`SideSelectByPagePopup/`、2× 本地 `storePicker/`
### 测试
- 自动化:`npm run test:components` — **30/30 PASS**
### 手动回归
- 见 [REGRESSION.md](./REGRESSION.md) §七 M2-01 ~ M2-05
---
## [Phase 2.4] 2026-07-06 — Calendar 合并进 CalendarMonth
### 变更类型
- [x] 合并组件 / [x] 删除组件 / [x] 提取 helpers
### 变更摘要
- 删除 `components/Calendar/`,全局 `calendar` 改指 `CalendarMonth`
- 新增 `dayOnly` prop(默认 `true`,对齐原全局 Calendar);`monthOnly` 优先
- `operatingShow` 显式 `dayOnly="{{ false }}"` 保留日/月切换
- 移植 `resetData`、`disabled`、`maxDayRange` 至 CalendarMonth
- **tabDate/components/calendar**(apprManage 排班历)评估为第三套,本批保留不合并
### 测试
- 自动化:`npm run test:components` — **33/33 PASS**(含 CAL-06~08)
### 手动回归
- 见 [REGRESSION.md](./REGRESSION.md) §八 M2.6-01 ~ M2.6-05
---
## [Phase 2.5] 2026-07-06 — CalendarMonth 日选择渲染性能
### 变更类型
- [x] 性能优化 / [x] 提取 helpers
### 变更摘要
- **Lazy init**:首次打开弹层才 `setMonthList`,attached 不再构建全量月份
- **合并 setData**:`buildAllMonthsMeta` 一次 setData(原 ~69 次循环 setData)
- **DOM 虚拟化**:dayOnly 单月渲染;全功能三窗 swiper(`displayMonths`)
- **dayOnly 跳过 yearList** 构建
- **日格精简**:`rangeLabel` + CSS variable `--calender-color`,减少嵌套 view
- 弹层 `hidden` 改 `wx:if="{{show}}"`
### 测试
- 自动化:`npm run test:components` — **38/38 PASS**(含 CAL-10~13)
### 手动回归
- 见 [REGRESSION.md](./REGRESSION.md) §九 M2.7-01 ~ M2.7-04
---
<!-- 后续条目按模板追加:
## [Phase 1-1] 2026-MM-DD — CalendarMonthSingle 合并
...
-->
# Phase 1 兼容性说明
> 避免合并组件后 CSS/JS 引用报错,实施时已做以下防护。
## 1. JS 依赖(微信依赖分析 / 上传)
| 文件 | 用途 | 防护 |
|------|------|------|
| `components/Popup/popup.helpers.js` | Popup footer 逻辑 | 已加入 `project.config.json` → `packOptions.include` |
| `components/CalendarMonth/calendarMonth.helpers.js` | monthOnly 初始状态 | 同上 |
| `components/CalendarMonth/Calendar_Function_monthOnly.js` | 首页月历专用逻辑 | 同上 |
| `components/TechnicianSelectPopup/technicianSelect.helpers.js` | Phase 2 技师 idKey 逻辑 | 同上 |
| `components/SideSelectPopup/sideSelect.helpers.js` | Phase 2 dataSource 分支 | 同上 |
| `components/storePicker/storePicker.helpers.js` | Phase 2 pickerType/confirm | 同上 |
与现有 `customerInfo.pagination.js`、`Confirm/form.js` 同一处理方式,避免 `ignoreUploadUnusedFiles: true` 误过滤。
## 2. 组件 json 显式注册 popup
子组件内使用 `<popup>` 时,除 `app.json` 全局注册外,**在组件 json 内再次声明**更稳妥:
- `packageEquity/components/OrderNoPopup/OrderNoPopup.json`
- `tabIndex/components/recordingOrderPopup/recordingOrderPopup.json`
- `tabMine/components/switchPopup/switchPopup.json`
- `pages/tabMine/components/switchPopup/switchPopup.json`
## 3. 静态资源(close 图标)
close 图标使用**本地包内路径**(非 CDN):
```js
import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
// CLOSE_ICON_URL → /components/images/close.png
```
`rootImageUrl('close.png')` 会拼 CDN `images/close.png`,该文件**未上传 CDN**,会导致 404,勿用于 close 图标。
涉及:`Popup`、`CalendarMonth`、`tipsBottom`。`packOptions.include` 已登记 `components/images/close.png`。
## 4. WXML 布尔属性
微信对无值布尔属性解析不一致,已改为显式写法:
```xml
monthOnly="{{ true }}"
show-close-icon="{{ true }}"
```
## 5. CalendarMonth monthOnly 选月
- `attached` 读 `this.properties.monthOnly` / `monType`,设置 `_monthOnlyMode`,实例化 `CalendarMonthOnly`
- `monChoose` / `done`:monthOnly 下固定走 `this.properties.dateType`(single)及 `CalendarMonthOnly.done()`
- WXML:monthOnly 仅绑 `active` class;`calender-view--monthOnly` 单选四角圆角
- close 图标:`CLOSE_ICON_URL`(本地 `/components/images/close.png`)
- helper 仅 `getInitialDayType` / `resolveMonthOnly`(`calendarMonth.helpers.js`)
## 6. Popup CSS 变体兼容
| 原组件 | 合并后 | CSS class |
|--------|--------|-----------|
| tipsPopup | `footer-mode="none"` | `.popup-slot--noneFooter`(内边距) |
| tabPopup | `footer-mode="tips"` | `.popup-footer--tips`(按钮 28px + 取消边框) |
| 默认 Popup | `footer-mode="default"` | 保持原 `.popup-footer` 样式 |
## 7. Popup data 默认值
`showFooter` / `showTitleClose` / `slotClass` 等在 `data` 中有初始值,`attached` 前 WXML 不会访问 undefined。
## 8. 全局组件下沉后页面 json
| 组件 | 注册位置 | 备注 |
|------|----------|------|
| `order-confirm` | `tabDate/pages/index/index.json` | 该页**未**在 `app.json` 注册,无线上入口;预约 Tab 用 `DateScreen` |
| `date-picker` | `tabDate/pages/detail/detail.json`、`pages/tabDateIndex/pages/tabDateIndex.json` | 可测;`tabDate/pages/index` 同 orphan 页,勿作回归入口 |
| `qr-box` | `tabWorkOrder/pages/orderDetail`、`constructionOrderDetail` |
若新增页面使用上述标签,须在对应页 `json` 注册,**不能仅依赖 app.json**(已从全局移除)。
## 9. 编译自检清单
1. 微信开发者工具 → 详情 → 本地设置 → 打开「将 JS 编译成 ES5」
2. 编译后 Console 无 `Component is not found` / `module not defined`
3. 预览上传前确认 `packOptions.include` 三项 helper 仍在
4. 运行 `npm run test:components`(33/33)
## 11. Phase 2 合并要点
| 组件 | 新 prop | 默认(向后兼容) |
|------|---------|------------------|
| `TechnicianSelectPopup` | `idKey` | `technicianId`(工单页);repair 页显式 `uuid` |
| `SideSelectPopup` | `dataSource` | `prop`(父传 storeList);多店账号用 `page` |
| `storePicker` | `pickerType` / `merchantRangeListTotal` | 不传则 operatingShow 行为(confirm+search) |
删除目录:`ArtificerSelectPopup/`、`SideSelectByPagePopup/`、staffDaily/upgradeStaffDaily 本地 `storePicker/`。
## 12. Phase 2.4 日历统一
| 模式 | prop | 行为 |
|------|------|------|
| 原全局 Calendar | `dayOnly=true`(**默认**) | 无日/月切换,仅日期选择 |
| operatingShow 等 | `dayOnly="{{ false }}"` | 日/月切换 + range |
| 绩效 monthOnly | `monthOnly=true` | 优先于 dayOnly,Phase 1 行为不变 |
- `app.json`:`"calendar": "/components/CalendarMonth/CalendarMonth"`
- 删除:`components/Calendar/`
- 保留 API:`resetData(date)`、`disabled`、range 的 `maxDayRange` / `maxDayRangeType`
### 第三套日历(本批不合并)
[`tabDate/components/calendar/`](tabDate/components/calendar/) 仅 [`apprManage`](tabDate/pages/apprManage/apprManage.json) 使用:
- 内嵌 swiper 周历、`spotMap`、`refresh()`、`bindselectDay`
- 与全局 CalendarMonth **API/UI 不同**,勿与 Phase 2.4 合并混淆
- 后续若迁移需单独开 Phase 2.4b
## 10. 已知行为差异(非报错)
- `footer-mode="none"` 关闭时仍会 `triggerEvent('cancel')`(原 tipsPopup 不触发);当前引用页未绑 `bindcancel`,无影响。
- 全局 `<popup>` 默认 `footerMode=default`,旧页面无 footer 变体需求则行为不变。
# Phase 1 + CalendarMonth 手动回归清单
> 覆盖范围:Phase 1 组件合并、close 图标 hotfix、tabIndex 绩效月历 monthOnly 修复。
> **测试前**:微信开发者工具 → **编译 → 清除缓存 → 重新编译**。
---
## 一、优先回归(本次改动核心)
### 1.1 首页 · 我的绩效 · 月历
**路径**:`tabIndex/pages/index` → **我的绩效** → 点击月份标签
| # | 操作 | 预期 | 通过 |
|---|------|------|:----:|
| P-01 | 点击月份打开弹层 | 无 Console 报错(尤其无 `TypeError`) | ☐ |
| P-02 | 查看弹层标题栏 | **无**「按日期 / 按月份」切换按钮 | ☐ |
| P-03 | 初始状态 | 当前月(如 7 月)高亮,**四角圆角**蓝底白字 | ☐ |
| P-04 | 点击其他月份(如 3 月) | **仅**该月高亮;原月份恢复普通样式,无「开始/结束」连选态 | ☐ |
| P-05 | 点**确定** | 弹层关闭,`dateObj.label` 更新(如「3月份」) | ☐ |
| P-06 | 查看绩效/产值数据 | 随所选月份刷新 | ☐ |
| P-07 | Network 面板 | 可见 `getOutputValue`(或同类接口),`dataMonth` 随所选月变化 | ☐ |
| P-08 | 再次打开月历 | 上次选中的月份高亮(非固定当前月) | ☐ |
---
## 二、close 图标(CDN 404 修复)
> **说明**:`recordingOrderPopup` / `OrderNoPopup` 的**主流水弹层**只有底部「取消/确认」,**无标题栏 X**;带 X 的是内层「超分账期说明」弹层(`footer-mode="none"` + `show-close-icon`),需点「超分账期」旁 **?** 进入。
| # | 场景 | 路径/入口 | 预期 | 通过 |
|---|------|-----------|------|:----:|
| C-01 | Popup 标题栏 X | 补录流水 → 打开流水弹层 → 点「超分账期」旁 **?** → 说明弹层 | 说明弹层标题栏 X 正常显示、可关闭 | ☐ |
| C-02 | CalendarMonth 关闭图标 | 首页绩效月历弹层 | 右上角 X 正常显示 | ☐ |
| C-03 | tips-bottom 关闭图标 | 各页带关闭按钮的 tips-bottom 条 | 关闭图标正常显示 | ☐ |
| C-04 | Network 面板 | C-01 ~ C-03 场景 | **不应**请求 `img02.glsx.com.cn/.../images/close.png` | ☐ |
| C-05 | Network 面板 | 同上 | 使用本地 `/components/images/close.png` | ☐ |
**不测**:主流水弹层标题栏 X(产品设计无此按钮)。
---
## 三、Phase 1 · Popup 合并(tipsPopup / tabPopup)
### 3.1 recordingOrderPopup / OrderNoPopup(双层 Popup)
**入口示例**:
- `recordingOrderPopup`:`tabWorkOrder/pages/createOrder` 补录流水
- `OrderNoPopup`:`packageEquity/pages/beforeCreate` 等选流水
| # | 层级 | 操作 | 预期 | 通过 |
|---|------|------|------|:----:|
| POP-01 | 主流水弹层 | 打开弹层 | 流水列表、正常/超分账期切换正常 | ☐ |
| POP-02 | 主流水弹层 | 底部按钮 | **取消 / 确认** 可用(无标题栏 X,属正常) | ☐ |
| POP-03 | 说明子弹层 | 点「超分账期」旁 **?** | 弹出「超分账期」说明(`footer-mode="none"`) | ☐ |
| POP-04 | 说明子弹层 | 标题栏 X | 可关闭说明弹层(见 C-01 close 图标) | ☐ |
### 3.2 其他 Popup
| # | 场景 | 路径/入口 | 预期 | 通过 |
|---|------|-----------|------|:----:|
| POP-05 | switchPopup tips 模式 | 我的 Tab → `switchPopup` | 底部 tips 文案 + 按钮样式正常 | ☐ |
| POP-06 | 默认 Popup | 其他仍用全局 Popup 的页面 | 取消/确认 footer 正常 | ☐ |
---
## 四、Phase 1 · 全局组件下沉
> **路由说明**:`tabDate/pages/index` 虽在仓库中存在,但**未**写入 `app.json` 分包 `pages`,开发者工具无法作为启动页打开。预约 Tab 实际入口为 **`pages/tabDateIndex/pages/tabDateIndex`**(筛选层用 `DateScreen`,不是 `order-confirm`)。
| # | 组件 | 可测入口 | 预期 | 通过 |
|---|------|----------|------|:----:|
| G-01 | `order-confirm` | **跳过** — 仅 `tabDate/pages/index/index.json` 注册,该页未上架 | Phase 1 下沉改动无线上可达页;预约 Tab 已改用 `DateScreen` | — |
| G-02 | `date-picker` | ① Tab **预约管理** → `pages/tabDateIndex/pages/tabDateIndex` → 列表项「预约时间」图标(`showDateBox`)<br>② 预约详情 → `tabDate/pages/detail/detail` → 修改到店时间 | 日期选择器弹层正常 | ☐ |
| G-03 | `qr-box` | `tabWorkOrder/pages/orderDetail/orderDetail`、`tabWorkOrder/pages/constructionOrderDetail/constructionOrderDetail` → 质保卡二维码 | 二维码弹层正常 | ☐ |
| G-04 | `PasswordPopup` | `collegeScene` 密码场景 | 原 RemarkPopup 重命名后功能正常 | ☐ |
**自定义编译模式路径**(测 G-02):
- `/pages/tabDateIndex/pages/tabDateIndex`
- `/tabDate/pages/detail/detail`(需带 `id` 等 query,或从预约列表点进详情)
---
## 五、其他(有时间可测)
| # | 场景 | 预期 | 通过 |
|---|------|------|:----:|
| O-01 | 首页绩效下方表格日历(`calendar` 组件) | 日/周/月切换正常 | ☐ |
| O-02 | 各分包 Menu 入口跳转 | 无 `Component is not found` 编译/运行报错 | ☐ |
| O-03 | 非 monthOnly 的 `CalendarMonth` 用法(如有) | 日/月切换 + 范围选月起止样式正常 | ☐ |
---
## 六、自动化(改后已跑过,可选复验)
```bash
npm run test:components
```
预期:**30/30 通过**(Phase 1 12 + Phase 2 TECH/SIDE/STP 18)
---
## 七、Phase 2 · 组件合并(M2 手动回归)
> **测试前**:清除缓存 → 重新编译。
| # | 入口 | 验证点 | 通过 |
|---|------|--------|:----:|
| M2-01 | `tabWorkOrder/pages/orderDetail` → 选技师 | 回显、分账比例、提交 payload 含 `technicianId` | ☐ |
| M2-02 | `tabRepairOrder/pages/confirmWorkOrder` | uuid 模式(`idKey="uuid"`)、主/副手互斥、deputy 空选清空 | ☐ |
| M2-03 | `tabIndex/pages/index` → 侧栏选店(**多店权限**账号) | `dataSource="page"`:分页搜店、load more、「全部」 | ☐ |
| M2-04 | `packageEquity/pages/TabBar/equityPage` | 同上 | ☐ |
| M2-05 | `tabWorkOrder/pages/staffDaily` | 门店/员工 picker 切换、搜索重置、toast、cancel | ☐ |
**自定义编译模式**(M2-03/04 需多店权限账号):
- `/tabIndex/pages/index/index`
- `/packageEquity/pages/TabBar/equityPage`
预期:**38/38 通过**(Phase 1~2 + CAL-06~13 + TECH/SIDE/STP)
---
## 九、Phase 2.5 · 日历性能(M2.7 手动回归)
> **说明**:日选择默认 lazy 初始化;首次点开日历应无明显卡顿;dayOnly 仅渲染当前月。
| # | 入口 | 验证点 | 通过 |
|---|------|--------|:----:|
| M2.7-01 | defeatOrder / createArchives | 首次打开日历流畅;选日、确定、resetData 回显 | ☐ |
| M2.7-02 | OrderScreen / DateScreen | range 跨月起止/中间态正确 | ☐ |
| M2.7-03 | operatingShow | 三窗纵向滑月 + 日/月切换 + range 确定 | ☐ |
| M2.7-04 | tabIndex monthOnly | 绩效月历 smoke 不受影响 | ☐ |
---
## 八、Phase 2.4 · 日历统一(M2.6 手动回归)
> **说明**:全局 `<calendar>` 现为 `CalendarMonth` + 默认 `dayOnly`;`CalendarMonth` 标签页需按需传 `dayOnly="{{ false }}"` 或 `monthOnly`。
| # | 入口 | 验证点 | 通过 |
|---|------|--------|:----:|
| M2.6-01 | tabIndex 绩效 `monthOnly` | 与 Phase 1 P-01~P-08 一致 | ☐ |
| M2.6-02 | operatingShow 日期 | 日/月切换 + range 筛选正常 | ☐ |
| M2.6-03 | defeatOrder / createArchives | 全局 calendar 选日、`resetData` 回显 | ☐ |
| M2.6-04 | DateScreen 预约筛选 | range 日历选期 | ☐ |
| M2.6-05 | tabDate/apprManage | 本地排班历(第三套)未改,smoke 正常 | ☐ |
**自定义编译模式**:
- `/tabOperating/pages/operatingShow/operatingShow`
- `/tabWorkOrder/pages/defeatOrder/defeatOrder`
- `/tabDate/pages/apprManage/apprManage`
---
## 建议回归顺序
1. **P-01 ~ P-08**(绩效月历,必测)
2. **C-01 ~ C-05**(close 图标,含流水 ? 说明弹层)
3. **POP-01 ~ POP-06**(Popup,含流水双层弹层)
4. **G-02 ~ G-04**(下沉组件;G-01 `order-confirm` 跳过)
5. **M2-01 ~ M2-05**(Phase 2 合并,有余力必测)
6. **M2.6-01 ~ M2.6-05**(Phase 2.4 日历统一,必测 operatingShow + 全局 calendar)
7. **M2.7-01 ~ M2.7-04**(Phase 2.5 日历性能,必测首次打开 + range)
8. **O-01 ~ O-03**(有余力再测)
---
## 问题记录(测试时填写)
| 编号 | 现象 | 复现步骤 | 截图/Console |
|------|------|----------|--------------|
| | | | |
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"test:tabIndex": "node --test tabIndex/tests/**/*.test.mjs", "test:tabIndex": "node --test tabIndex/tests/**/*.test.mjs",
"test:equity": "node --test packageEquity/tests/**/*.test.mjs", "test:equity": "node --test packageEquity/tests/**/*.test.mjs",
"test:dynamicForm": "node --test packageDynamicForm/tests/**/*.test.mjs", "test:dynamicForm": "node --test packageDynamicForm/tests/**/*.test.mjs",
"test:createOrder": "node --test tabWorkOrder/pages/createOrder/tests/**/*.test.mjs" "test:createOrder": "node --test tabWorkOrder/pages/createOrder/tests/**/*.test.mjs",
"test:components": "node --test tests/popupBehavior.test.mjs tests/calendarMonthMode.test.mjs tests/componentsImageUrl.test.mjs tests/technicianSelect.helpers.test.mjs tests/sideSelectDataSource.test.mjs tests/storePickerConfirm.test.mjs"
} }
} }
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"tipsPopup": "/components/tipsPopup/Popup" "popup": "/components/Popup/Popup"
} }
}
\ No newline at end of file \ No newline at end of file
}
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</block> </block>
</scroll-view> </scroll-view>
</popup> </popup>
<tipsPopup show="{{ tipsshow }}" bindconfirm="confirm" bindcancel="cancel" height="70%" title="超分账期"> <popup show="{{ tipsshow }}" footer-mode="none" show-close-icon="{{ true }}" height="70%" title="超分账期">
<scroll-view scroll-y class="ul"> <scroll-view scroll-y class="ul">
<view class="title"> <view class="title">
字段定义 字段定义
...@@ -82,4 +82,4 @@ ...@@ -82,4 +82,4 @@
</scroll-view> </scroll-view>
<!-- <view>说明内容</view> --> <!-- <view>说明内容</view> -->
</tipsPopup>
\ No newline at end of file \ No newline at end of file
</popup>
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"makert-material":"../trainingMaterials/components/Materials/materials", "makert-material":"../trainingMaterials/components/Materials/materials",
"reception-screen": "../index/components/receptionScreen/receptionScreen", "reception-screen": "../index/components/receptionScreen/receptionScreen",
"order-screen": "../carQuotation/components/OrderScreen/OrderScreen", "order-screen": "../carQuotation/components/OrderScreen/OrderScreen",
"side-select-by-page-popup": "/components/SideSelectByPagePopup/SideSelectByPagePopup",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal" "study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
......
...@@ -97,8 +97,9 @@ ...@@ -97,8 +97,9 @@
tab-index="{{ tabIndex }}" /> tab-index="{{ tabIndex }}" />
<!-- <store-picker items="{{ storeListRange }}" show="{{ showPicker }}" bindsearch="getStoreList" bindconfirm="changePicker" /> --> <!-- <store-picker items="{{ storeListRange }}" show="{{ showPicker }}" bindsearch="getStoreList" bindconfirm="changePicker" /> -->
<block wx:if="{{ perm.hasPermission.canSelectMultiStore(userInfo) }}"> <block wx:if="{{ perm.hasPermission.canSelectMultiStore(userInfo) }}">
<side-select-by-page-popup bindconfirm="changePicker" <side-select-popup bindconfirm="changePicker"
show="{{ shopSideSelectPopup }}" /> show="{{ shopSideSelectPopup }}"
dataSource="page" />
</block> </block>
<block wx:else> <block wx:else>
<side-select-popup bindconfirm="changePicker" <side-select-popup bindconfirm="changePicker"
......
{ {
"navigationBarTitleText": "修改客户信息", "navigationBarTitleText": "修改客户信息",
"usingComponents": { "usingComponents": {
"car-brands": "/components/CarBrands/CarBrands", "car-brands": "/components/CarBrands/CarBrands"
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"artificer-select-popup": "/components/ArtificerSelectPopup/artificerSelectPopup"
} }
} }
{ {
"usingComponents": { "usingComponents": {
"password-pop": "./components/RemarkPopup/RemarkPopup" "password-pop": "./components/PasswordPopup/PasswordPopup"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
/**
* @file 学院场景绩效密码弹窗 — 与全局 RemarkPopup 不同,仅处理密码设置/校验
*/
import md5 from '~/utils/lib/md5.js'
import { performancePasswordUpdate, performancePasswordCheck } from '~/packageEquity/api'
Component({
properties: {
show: {
type: Boolean,
value: false,
observer(n) {
if (n) {
this.setData({ password: '', repassword: '' })
}
}
},
maxlength: Number,
title: { type: String },
btnName: { type: String },
isSetPassword: { type: Boolean }
},
data: {
password: '',
repassword: ''
},
methods: {
input(e) {
const { value } = e.detail
const { name } = e.currentTarget.dataset
this.setData({ [name]: value })
},
noScroll() {},
showPopup(e) {
const { name } = e.currentTarget.dataset
const thisPage = wx.$router.getPageInstance()
thisPage.setData({ [name]: false })
this.triggerEvent('cancel')
},
remarkConfirm() {
const { isSetPassword, maxlength, password, repassword } = this.data
if (maxlength != password.length) {
return wx.$util.showToast('请输入4位数字密码')
}
if (isSetPassword) {
if (maxlength != repassword.length) {
return wx.$util.showToast('请输入4位数字确认密码')
}
if (password != repassword) {
return wx.$util.showToast('两次密码输入不一致')
}
performancePasswordUpdate({ passwordMd5: md5(password) })
.then(res => {
const { code, data, message } = res
if (code == 0 && data) {
this.triggerEvent('confirm')
this.showPopup({
currentTarget: { dataset: { name: 'passwordPop' } }
})
} else {
wx.$util.showToast(message)
}
})
.catch(err => console.log(err))
} else {
performancePasswordCheck({ passwordMd5: md5(password) })
.then(res => {
const { code, data, message } = res
if (code == 0 && data) {
this.triggerEvent('confirm')
this.showPopup({
currentTarget: { dataset: { name: 'passwordPop' } }
})
} else {
wx.$util.showToast(message)
}
})
.catch(err => console.log(err))
}
}
}
})
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
}
/* components/RemarkPopup/RemarkPopup.wxss */
.fixed-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
perspective: 99999999px;
}
.fixed-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
animation: show-bg .1s forwards .5s;
}
@keyframes show-bg {
0% {
background-color: rgba(0, 0, 0, 0);
}
100% {
background-color: rgba(0, 0, 0, .6);
}
}
.fixed-content {
position: absolute;
left: 50%;
top: 50%;
background: #FFFFFF;
border-radius: var(--fontSize20);
width: var(--fontSize622);
animation: show-modal .5s forwards;
}
@keyframes show-modal {
0% {
opacity: 0;
transform: translate3d(-50%, -50%, -99999999px);
}
100% {
opacity: 1;
transform: translate3d(-50%, -50%, 0);
}
}
.fixed-content .fixed-title {
/* height: var(--fontSize96);
font-size: var(--fontSize32);
color: #333333; */
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize32);
color: #292D33;
padding: var(--fontSize28) 0;
}
.fixed-date-box .fixed-body {
height: var(--fontSize360);
display: flex;
flex-direction: column;
}
.fixed-content .fixed-footer {
box-sizing: border-box;
height: var(--fontSize96);
display: flex;
align-items: center;
position: relative;
border-top: var(--fontSize2) solid #EBEDF0;
// border-top:
}
.fixed-content .fixed-footer .text-center {
width: 50%;
height: 100%;
font-size: var(--fontSize32);
color: #333333;
}
.fixed-content .fixed-footer .fixed-confirm {
color: #347BFF;
}
.fixed-content .fixed-footer::after {
background-color: #EBEDF0;
width: var(--fontSize1);
height: 100%;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
content: '';
}
.fixed-remark-box .fixed-body {
padding: var(--fontSize20);
}
.inputCon {
box-sizing: border-box;
width: var(--fontSize558);
height: var(--fontSize80);
display: flex;
align-items: center;
background: #F7F8FA;
border-radius: var(--fontSize8);
padding: var(--fontSize22) var(--fontSize32);
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize28);
color: #292D33;
input{
height: 100%;
}
.label {
margin-right: var(--fontSize16);
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: var(--fontSize24);
color: #757980;
// display: flex;
}
}
.inputCon+.inputCon {
margin-top: var(--fontSize24);
}
/* .fixed-remark {
background: #F4F5F7;
border: var(--fontSize2) solid #EFF0F2;
border-radius: var(--fontSize12);
width: var(--fontSize552);
height: var(--fontSize260);
box-sizing: border-box;
padding: var(--fontSize24) var(--fontSize46);
animation: show-remark .1s forwards .4s;
opacity: 0;
}
@keyframes show-remark {
0%{
opacity: 0;
}
100%{
opacity: 1;
}
} */
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
/* packageEquity/pages/collegeScene/components/PasswordPopup/PasswordPopup.sass */
.fixed-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
perspective: 99999999px;
}
.fixed-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
animation: show-bg .1s forwards .5s;
}
@keyframes show-bg {
0% {
background-color: rgba(0, 0, 0, 0);
}
100% {
background-color: rgba(0, 0, 0, .6);
}
}
.fixed-content {
position: absolute;
left: 50%;
top: 50%;
background: #FFFFFF;
border-radius: var(--fontSize20);
width: var(--fontSize622);
animation: show-modal .5s forwards;
}
@keyframes show-modal {
0% {
opacity: 0;
transform: translate3d(-50%, -50%, -99999999px);
}
100% {
opacity: 1;
transform: translate3d(-50%, -50%, 0);
}
}
.fixed-content .fixed-title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize32);
color: #292D33;
padding: var(--fontSize28) 0;
}
.fixed-date-box .fixed-body {
height: var(--fontSize360);
display: flex;
flex-direction: column;
}
.fixed-content .fixed-footer {
box-sizing: border-box;
height: var(--fontSize96);
display: flex;
align-items: center;
position: relative;
border-top: var(--fontSize2) solid #EBEDF0;
}
.fixed-content .fixed-footer .text-center {
width: 50%;
height: 100%;
font-size: var(--fontSize32);
color: #333333;
}
.fixed-content .fixed-footer .fixed-confirm {
color: #347BFF;
}
.fixed-content .fixed-footer::after {
background-color: #EBEDF0;
width: var(--fontSize1);
height: 100%;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
content: '';
}
.fixed-remark-box .fixed-body {
padding: var(--fontSize20);
}
.inputCon {
box-sizing: border-box;
width: var(--fontSize558);
height: var(--fontSize80);
display: flex;
align-items: center;
background: #F7F8FA;
border-radius: var(--fontSize8);
padding: var(--fontSize22) var(--fontSize32);
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize28);
color: #292D33;
input{
height: 100%;
}
.label {
margin-right: var(--fontSize16);
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: var(--fontSize24);
color: #757980;
}
}
.inputCon+.inputCon {
margin-top: var(--fontSize24);
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
<block> <block>
<!-- wx:if="{{show}}" -->
<view class="fixed-box fixed-remark-box" catchtouchmove="noScroll"> <view class="fixed-box fixed-remark-box" catchtouchmove="noScroll">
<view class="fixed-bg" bindtap="showPopup" data-name="passwordPop" /> <view class="fixed-bg" bindtap="showPopup" data-name="passwordPop" />
<view class="fixed-content"> <view class="fixed-content">
<view class="fixed-title text-center">{{title}}</view> <view class="fixed-title text-center">{{title}}</view>
<view class="fixed-body"> <view class="fixed-body">
<!-- value="{{ }}" value="{{ 1}}" -->
<view class="inputCon"> <view class="inputCon">
<view class="label">输入密码</view> <view class="label">输入密码</view>
<input <input
...@@ -41,4 +39,4 @@ ...@@ -41,4 +39,4 @@
</view> </view>
</view> </view>
</view> </view>
</block>
\ No newline at end of file \ No newline at end of file
</block>
// components/RemarkPopup/RemarkPopup.js
import md5 from '~/utils/lib/md5.js'
import { performancePasswordUpdate, performancePasswordCheck } from '~/packageEquity/api'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (n) {
if (n) {
this.setData({
password: '',
repassword: ''
})
}
}
},
maxlength: Number,
title: {
type: String
},
btnName: {
type: String
},
isSetPassword: {
type: Boolean
// value: false
}
// isInt: {
// type: Boolean,
// value: false
// },
// required: {
// type: Boolean,
// value: false
// }
},
/**
* 组件的初始数据
*/
data: {
// inputValue: '',
// isEdit: false,
password: '',
repassword: ''
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
let { value } = e.detail
console.log(e)
let { name } = e.currentTarget.dataset
this.setData({
[name]: value
})
},
noScroll() {},
blur(e) {
this.setData({
inputValue: e.detail.value,
isEdit: true
})
},
showPopup(e) {
// console.log()
let { name, btnName } = e.currentTarget.dataset
// if (btnName == 'cancel') {
// this.setData({
// value: ''
// })
// }
// console.log(name)
// 判断是不是来自组件 不是调用页面的数据修改
// 是用方法回传关闭
// let { isFormComponent } = this.data
// if (!isFormComponent) {
let thisPage = wx.$router.getPageInstance()
// console.log(thisPage)
console.log(thisPage)
thisPage.setData({
[name]: false
})
// 组件中使用
this.triggerEvent('cancel')
// this.setData({
// isEdit: false
// })
// } else {
// // console.log('tri')
// this.triggerEvent('closePop')
// }
},
remarkConfirm() {
// console.log('confirm')
let { isSetPassword, maxlength, password, repassword } = this.data
if (maxlength != password.length) {
return wx.$util.showToast('请输入4位数字密码')
}
// 判断 是设置密码还是输入密码
if (isSetPassword) {
if (maxlength != repassword.length) {
return wx.$util.showToast('请输入4位数字确认密码')
}
if (password != repassword) {
return wx.$util.showToast('两次密码输入不一致')
}
let params = {
passwordMd5: md5(password)
}
performancePasswordUpdate(params)
.then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0 && data) {
this.triggerEvent('confirm')
this.showPopup({
currentTarget: {
dataset: {
name: 'passwordPop'
}
}
})
} else {
wx.$util.showToast(message)
}
})
.catch(err => {
console.log(err)
})
} else {
performancePasswordCheck({ passwordMd5: md5(password) })
.then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0 && data) {
this.triggerEvent('confirm')
this.showPopup({
currentTarget: {
dataset: {
name: 'passwordPop'
}
}
})
} else {
wx.$util.showToast(message)
}
})
.catch(err => {
console.log(err)
})
// this.showPopup({
// currentTarget: {
// dataset: {
// name: 'passwordPop'
// }
// }
// })
}
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
{ {
"navigationStyle":"custom", "navigationStyle":"custom",
"usingComponents": { "usingComponents": {
"date-screen": "../components/DateScreen/DateScreen" "date-screen": "../components/DateScreen/DateScreen",
"date-picker": "/components/DatePicker/DatePicker"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"switch-block": "/components/switchBlock/switchBlock", "switch-block": "/components/switchBlock/switchBlock",
"tab-popup": "/components/tabPopup/tabPopup", "popup": "/components/Popup/Popup",
"store-select-popup": "/components/StoreSelectPopup/StoreSelectPopup" "store-select-popup": "/components/StoreSelectPopup/StoreSelectPopup"
} }
} }
<tab-popup show="{{ show }}" title="{{ title }}" height="{{ height }}" tips="{{ tips }}" bindconfirm="confirm"> <popup show="{{ show }}" title="{{ title }}" height="{{ height }}" footer-mode="tips" tips="{{ tips }}" bindconfirm="confirm">
<gl-cell border valueAlign="right" label="{{ '门店切换' }}" requiredAfter labelWidth="var(--fontSize140)" required haveArrow bindclick="showPopup" data-show-name="selesBox" placeholder="请选择" disabled="{{ false }}"> <gl-cell border valueAlign="right" label="{{ '门店切换' }}" requiredAfter labelWidth="var(--fontSize140)" required haveArrow bindclick="showPopup" data-show-name="selesBox" placeholder="请选择" disabled="{{ false }}">
<!-- <block wx:if="{{ orderObj.merchantName && orderObj.employeeName }}"> --> <!-- <block wx:if="{{ orderObj.merchantName && orderObj.employeeName }}"> -->
<view class="between"> <view class="between">
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
<switch-block switchStatus="{{ item.value }}" disable="{{ isYqdSuper && selectedMerchantList.length }}" bindswitchEvent="onSwitchChange" data-index="{{ index }}" /> <switch-block switchStatus="{{ item.value }}" disable="{{ isYqdSuper && selectedMerchantList.length }}" bindswitchEvent="onSwitchChange" data-index="{{ index }}" />
</gl-cell> </gl-cell>
</block> </block>
</tab-popup> </popup>
<store-select-popup show="{{ showStoreSelectPopup }}" type="{{ 2 }}" bindconfirm="storeConfirm" bindcancel="hideStorePopup" selectedData="{{ selectedMerchantList || [] }}"></store-select-popup> <store-select-popup show="{{ showStoreSelectPopup }}" type="{{ 2 }}" bindconfirm="storeConfirm" bindcancel="hideStorePopup" selectedData="{{ selectedMerchantList || [] }}"></store-select-popup>
<!-- <store-select-popup></store-select-popup> --> <!-- <store-select-popup></store-select-popup> -->
\ No newline at end of file \ No newline at end of file
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"artificer-select-popup" : "/components/ArtificerSelectPopup/artificerSelectPopup" "artificer-select-popup" : "/components/TechnicianSelectPopup/TechnicianSelectPopup"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -117,6 +117,34 @@ ...@@ -117,6 +117,34 @@
{ {
"value": "components/Confirm/form.js", "value": "components/Confirm/form.js",
"type": "file" "type": "file"
},
{
"value": "components/Popup/popup.helpers.js",
"type": "file"
},
{
"value": "components/CalendarMonth/calendarMonth.helpers.js",
"type": "file"
},
{
"value": "components/CalendarMonth/Calendar_Function_monthOnly.js",
"type": "file"
},
{
"value": "components/images/close.png",
"type": "file"
},
{
"value": "components/TechnicianSelectPopup/technicianSelect.helpers.js",
"type": "file"
},
{
"value": "components/SideSelectPopup/sideSelect.helpers.js",
"type": "file"
},
{
"value": "components/storePicker/storePicker.helpers.js",
"type": "file"
} }
] ]
}, },
......
{ {
"libVersion": "3.14.3", "libVersion": "3.14.3",
"projectname": "dj-car-boutique-work-wechat", "projectname": "dj-car-boutique-work-wechat",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"coverView": true, "coverView": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"ignoreDevUnusedFiles": false, "ignoreDevUnusedFiles": false,
"lazyloadPlaceholderEnable": false, "lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false, "skylineRenderEnable": false,
"preloadBackgroundData": false, "preloadBackgroundData": false,
"autoAudits": false, "autoAudits": false,
"compileHotReLoad": true, "compileHotReLoad": true,
"useApiHook": true, "useApiHook": true,
"useStaticServer": false, "useStaticServer": false,
"useLanDebug": false, "useLanDebug": false,
"showES6CompileOption": false, "showES6CompileOption": false,
"checkInvalidKey": true, "checkInvalidKey": true,
"bigPackageSizeSupport": true, "bigPackageSizeSupport": true,
"useApiHostProcess": true "useApiHostProcess": true
}, },
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
{ {
"name": "tabWorkOrder/pages/createArchives/createArchives", "name": "tabOperating/pages/operatingShow/operatingShow",
"pathName": "tabWorkOrder/pages/createArchives/createArchives", "pathName": "tabOperating/pages/operatingShow/operatingShow",
"query": "", "query": "",
"scene": null, "scene": null,
"launchMode": "default" "launchMode": "default"
}, },
{ {
"name": "packageDynamicForm/pages/storeDailyReport/storeDailyReport", "name": "tabWorkOrder/pages/staffDaily/staffDaily",
"pathName": "packageDynamicForm/pages/storeDailyReport/storeDailyReport", "pathName": "tabWorkOrder/pages/staffDaily/staffDaily",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
{ {
"name": "packageDynamicForm/pages/negotiationDetail/negotiationDetail", "name": "tabWorkOrder/pages/createArchives/createArchives",
"pathName": "packageDynamicForm/pages/negotiationDetail/negotiationDetail", "pathName": "tabWorkOrder/pages/createArchives/createArchives",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
{ {
"name": "packageDynamicForm/pages/staffDailyReport/staffDailyReport", "name": "packageDynamicForm/pages/storeDailyReport/storeDailyReport",
"pathName": "packageDynamicForm/pages/staffDailyReport/staffDailyReport", "pathName": "packageDynamicForm/pages/storeDailyReport/storeDailyReport",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
{ {
"name": "tabWorkOrder/pages/staffDaily/staffDaily", "name": "packageDynamicForm/pages/negotiationDetail/negotiationDetail",
"pathName": "tabWorkOrder/pages/staffDaily/staffDaily", "pathName": "packageDynamicForm/pages/negotiationDetail/negotiationDetail",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
{ {
"name": "tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily", "name": "packageDynamicForm/pages/staffDailyReport/staffDailyReport",
"pathName": "tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily", "pathName": "packageDynamicForm/pages/staffDailyReport/staffDailyReport",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
} },
] {
} "name": "tabWorkOrder/pages/staffDaily/staffDaily",
} "pathName": "tabWorkOrder/pages/staffDaily/staffDaily",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily",
"pathName": "tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
} }
\ No newline at end of file \ 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!