Commit 456a6126 by 张立顺

feat 订单功能迁移

1 parent 729d2d4a
Showing 284 changed files with 4821 additions and 0 deletions
...@@ -531,4 +531,44 @@ module.exports = { ...@@ -531,4 +531,44 @@ module.exports = {
getPotentialCustomersPage(data) { getPotentialCustomersPage(data) {
return api.post('dj.api.staff.miniprogram.recruitment.demand.potentialCustomers.page', data) return api.post('dj.api.staff.miniprogram.recruitment.demand.potentialCustomers.page', data)
}, },
// 精品工单:查询员工可用场景
getUserScene(data) {
return api.post('dj.api.smartcarlife.scene.config.getUserScene', data)
},
// 精品工单:异常订单锁单状态
abnormalOrderLock() {
return api.post(
'dj.api.smartcarlife.goodsOrder.abnormalOrder.lock.select',
{}
)
},
// 精品工单:异常流水门店锁单状态
checkAbnormalFlowShopLock(data) {
return api.post(
'dj.api.smartcarlife.abnormalFlowDeclaration.checkShopLock',
data
)
},
// 精品工单:学习任务开单限制
checkStudyTaskAPI(data) {
return api.post(
'dj.api.pad.learning.center.study.permission',
data,
[],
'/rop-dj-pad/router'
)
},
// 精品工单:VIN 校验
checkVinValidate(data) {
return api.post('dj.pad.api.vin.validate', data, [], '/rop-dj-pad/router')
},
// 精品工单学习任务弹窗:获取北森单点登录令牌
findBeiSenSSOToken(data) {
return api.post(
'dj.pad.api.beisen.findBeiSenSSOToken',
data,
[],
'/rop-dj-pad/router'
)
},
} }
...@@ -30,6 +30,11 @@ import { Version } from 'glsx-common-sdk' ...@@ -30,6 +30,11 @@ import { Version } from 'glsx-common-sdk'
import { areaList } from '@vant/area-data' //预加载省市区 import { areaList } from '@vant/area-data' //预加载省市区
import globalDataFunction from './mixins/globalDataFunction' import globalDataFunction from './mixins/globalDataFunction'
import {
hasPermission,
createPermissionHelpers,
LOGIN_ROLE
} from './utils/rolePermission'
/**全埋点 */ /**全埋点 */
import Track from '~/utils/track' import Track from '~/utils/track'
...@@ -93,6 +98,9 @@ App({ ...@@ -93,6 +98,9 @@ App({
} }
}) })
wx.$globalDataFunction = globalDataFunction wx.$globalDataFunction = globalDataFunction
wx.$hasPermission = hasPermission
wx.$permission = createPermissionHelpers()
wx.$LOGIN_ROLE = LOGIN_ROLE
}, },
async getVersionInfo(request) { async getVersionInfo(request) {
if (request) this.globalData.versionData = null if (request) this.globalData.versionData = null
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"pages/webView/webView", "pages/webView/webView",
"pages/tab/index/index", "pages/tab/index/index",
"pages/tab/workspace/workspace", "pages/tab/workspace/workspace",
"pages/tabWorkOrder/pages/index/index",
"pages/tab/matters/matters", "pages/tab/matters/matters",
"pages/tab/study/study", "pages/tab/study/study",
"pages/tab/mine/mine", "pages/tab/mine/mine",
...@@ -123,8 +124,32 @@ ...@@ -123,8 +124,32 @@
"pages/aiCheck/detail/detail", "pages/aiCheck/detail/detail",
"pages/aiCheck/defense/defense" "pages/aiCheck/defense/defense"
] ]
},
{
"root": "tabWorkOrder",
"name": "tabWorkOrder",
"pages": [
"pages/createOrder/createOrder",
"pages/confirmOrder/confirmOrder",
"pages/orderDetail/orderDetail",
"pages/ocr/ocr"
]
} }
], ],
"preloadRule": {
"pages/tab/workspace/workspace": {
"network": "all",
"packages": [
"tabWorkOrder"
]
},
"pages/tabWorkOrder/pages/index/index": {
"network": "all",
"packages": [
"tabWorkOrder"
]
}
},
"usingComponents": { "usingComponents": {
"gl-textarea": "/components/GlTextarea/GlTextarea", "gl-textarea": "/components/GlTextarea/GlTextarea",
"gl-cell": "/components/GlCell/GlCell", "gl-cell": "/components/GlCell/GlCell",
......
// components/CalendarMonth/CalendarMonth.js
import Calendar from './Calendar_Function'
import CalendarMonthOnly from './Calendar_Function_monthOnly'
import _component_ from './Static_Properties'
import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
import {
getInitialDayType,
resolveMonthOnly,
resolveDayOnly,
buildMonthSetDataPayload,
shouldUseSingleMonthView,
shouldRebuildMonthListOnBoundsChange
} from './calendarMonth.helpers.js'
const CalendarFunction = Symbol('CalendarFunction')
Component({
properties: _component_.properties,
data: _component_.data,
methods: {
noScroll() {},
/** 确保月份数据已 lazy 构建 */
ensureMonthListReady() {
if (this._monthListReady || this._monthOnlyMode) return
this[CalendarFunction].setMonthList()
this._monthListReady = true
},
/** 按外部回显值重置当前选中日期 */
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() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
if (this.data.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 {
if (!this._monthOnlyMode) {
this.ensureMonthListReady()
}
this.setData({ show: result })
if (!this.data.calenderBodyHeight) {
this[CalendarFunction].setCalenderBodyHeight()
}
}
this.triggerEvent('tapCalendar')
},
dateChange(e) {
let { current, source } = e.detail
let { dayType, dayOnly } = this.data
if (source !== 'touch') return
if (dayType) {
if (!shouldUseSingleMonthView(dayOnly, false, false)) {
this[CalendarFunction].onSwiperDateChange(current)
}
} else {
this.setData({ yearCurrent: current })
}
},
bindDateChange: function (e) {
var date = e.detail.value
this.setData({ date: date })
this.post_data.year = date
this.renderHtml()
},
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)
},
monChoose(e) {
const { data, type } = e.currentTarget.dataset
if (data.disable) return false
if (this._monthOnlyMode) {
this[CalendarFunction][this.properties.dateType](e)
return
}
this[CalendarFunction][type](e)
},
done() {
if (this._monthOnlyMode) {
this[CalendarFunction].done()
return
}
this[CalendarFunction].done(this.data.dateType)
},
changeDate(e) {
let { value } = e.detail
if (this._monthOnlyMode) {
this.setData({ current: value })
return
}
this[CalendarFunction].onPickerMonthChange(Number(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.ensureMonthListReady()
this[CalendarFunction].chooseAll()
},
changeModel() {
let { dayType } = this.data
this.setData({ dayType: dayType == 0 ? 1 : 0 })
},
/**
* minDate/maxDate 变更时失效 lazy monthList,弹层打开时立即重建
* @param {string} minDate
* @param {string} maxDate
*/
onCalendarBoundsChange(minDate, maxDate) {
if (!this[CalendarFunction]) return
const prevMin = this._lastBoundsMin
const prevMax = this._lastBoundsMax
this._lastBoundsMin = minDate
this._lastBoundsMax = maxDate
if (prevMin === undefined && prevMax === undefined) return
if (
!shouldRebuildMonthListOnBoundsChange(prevMin, prevMax, minDate, maxDate)
) {
return
}
this._monthListReady = false
if (this.data.show && !this._monthOnlyMode) {
this[CalendarFunction].setMonthList()
this._monthListReady = true
}
}
},
observers: {
'minDate, maxDate': function (minDate, maxDate) {
this.onCalendarBoundsChange(minDate, maxDate)
}
},
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({
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)
}
}
})
{
"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' wx:if="{{show}}" catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" />
<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-title' wx:if='{{showTitle}}'>
<view wx:if="{{!monthOnly && !monType && !dayOnly}}" class="calender-all" style="color:{{calenderColor}};" bindtap="changeModel">
{{dateObj['tips'][dayType]}}
</view>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="{{ closeIconUrl }}" class='calender-close-image' mode="aspectFit" />
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker wx:if="{{!monthOnly && !monType && shortcut && dayType}}" class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}">
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}' />
</view>
</picker>
<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">
{{monPickList[yearCurrent]}}
<view class='arrow {{showShortcutYear}}' />
</view>
</picker>
<view class='calender-subtitle' wx:else>{{monPickList[current]}}</view>
</block>
<view class='calendar-weekdays' hidden="{{!dayType || monthOnly || monType}}">
<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}})">
<block wx:if="{{dayOnly || (!monthOnly && !monType)}}">
<!-- dayOnly:单月渲染,无全量 swiper -->
<view wx:if="{{dayOnly && dayType && monthList.length}}" class="calender-month-panel">
<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-month'>
<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}}'>
<text class="calender-day-text">{{i.day}}<text wx:if="{{i.rangeLabel}}" class="calender-tips">{{i.rangeLabel}}</text></text>
</view>
</view>
</swiper-item>
</swiper>
</block>
<div class='calenderMonth' wx:if="{{monthOnly || monType || (!dayOnly && !dayType)}}">
<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">
<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 class="text" wx:if="{{!monthOnly && !monType && monItem.start}}">开始</view>
<view class="text" wx:if="{{!monthOnly && !monType && 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>
/* 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-month-panel {
height: 100%;
position: relative;
}
.calender-day.active {
color: #fff;
border-radius: var(--fontSize8);
background: var(--calender-color, #00A479);
}
.calender-day.disable {
opacity: .25;
}
.calender-day--middle {
color: var(--calender-color, #00A479);
}
.calender-day--middle::before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: var(--calender-color, #00A479);
opacity: 0.1;
}
.calender-day-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
width: 100%;
font-size: var(--fontSize32);
}
.calender-day .calender-middle {
display: none;
}
.calender-day .text {
display: none;
}
.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;
}
/* monthOnly 单选:四角圆角,非范围起点样式(对齐原 CalendarMonthSingle) */
.calender-view--monthOnly .monItem.active {
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,
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: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
/** 三窗 swiper 可见月份(全功能模式) */
displayMonths: [],
swiperCurrent: 1,
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 月份 默认日期
closeIconUrl: '',
dateObj: {
// switch:'按月份',
// type:'day',
tips: ['按日期', '按月份']
}
}
}
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<popup
title="选择车型"
show="{{show}}"
bindconfirm="confirm"
bindcancel="onPopupCancel"
height="{{ equityFlag ? '85%' : '90%' }}">
<view class="car-brands-box">
<search-input bindsearch="searchCar" />
<view class="car-brands">
<scroll-view style="height:100%;" scroll-y scroll-into-view="{{letter}}">
<block wx:if="{{brandList.length > 0}}">
<block wx:for="{{brandList}}" wx:key="index">
<view>
<view class="title y-center" id="{{item.letter}}">{{item.letter}}</view>
<view class="box">
<block
wx:for="{{item.list}}"
wx:for-item="i"
wx:key="ind"
wx:for-index="ind">
<view
class="brands"
catchtap="showChilds"
data-index='{{index}}'
data-ind='{{ind}}'>
<view class="list y-center">{{i.name}}</view>
<block wx:if="{{i.active}}">
<block
wx:for='{{i.childs_list}}'
wx:key="cind"
wx:for-item='c'
wx:for-index='cind'>
<view
class="list y-center child {{c.active?'active':''}} {{c.isTitle?'title':''}}"
catchtap="choose"
data-index="{{index}}"
data-ind="{{ind}}"
data-cind="{{cind}}"
data-item="{{i}}"
data-that="{{c}}">
{{c.name}}
<view class="icon">
<image src="../images/choose.png" />
</view>
</view>
</block>
</block>
</view>
</block>
</view>
</view>
</block>
</block>
<block wx:if="{{merchantId && brandList.length <= 0}}">
<view class="nothing">暂无数据</view>
</block>
<block wx:if="{{!merchantId}}">
<view class="nothing">请先选择流量来源</view>
</block>
</scroll-view>
<view class="side-bar" id="side-bar">
<block wx:for="{{brandList}}" wx:key="index">
<view
data-letter="{{item.letter}}"
class="view {{item.active?'active':''}}"
capture-catch:touchstart="start"
id="letter-{{item.letter}}"
data-index="{{index}}"
capture-catch:touchmove="move"
capture-catch:touchend="end">
{{item.letter}}
</view>
</block>
</view>
<!-- 提示 -->
<view class='tips' hidden='{{!showTip}}'>{{letter}}</view>
</view>
</view>
</popup>
/* components/CarBrands/CarBrands.wxss */
.car-brands-box {
width: calc(100% + var(--fontSize64));
height: 100%;
margin-left: calc(-1 * var(--fontSize32));
}
.car-brands {
height: calc(100% - var(--fontSize104));
position: relative;
/* display: flex; */
}
.y-center {
display: flex;
align-items: center;
}
.car-brands .title {
background: #f7f8fa;
font-size: var(--fontSize24);
color: #969799;
padding-left: var(--fontSize32);
height: var(--fontSize64);
/* position: sticky;
left: 0;
top: 0;
z-index: 998; */
}
.list {
height: var(--fontSize88);
padding-left: var(--fontSize32);
font-size: var(--fontSize32);
font-weight: 700;
color: #323436;
}
.child {
font-weight: normal;
padding-left: var(--fontSize96);
font-size: var(--fontSize28);
color: #323436;
position: relative;
}
.child.active {
color: #347BFF;
}
.child.title {
color: #282829;
padding-left: var(--fontSize64);
/* color: #347BFF; */
}
.child .icon {
display: none;
width: var(--fontSize32);
height: var(--fontSize32);
position: absolute;
top: 50%;
left: var(--fontSize40);
transform: translateY(-50%);
}
.child.active .icon {
display: block;
}
.side-bar {
z-index: 999;
/* display: none; */
/* position: fixed; */
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size: var(--fontSize24);
color: #4c4c4c;
width: 10%;
/* width: var(--fontSize452); */
opacity: 0;
animation: show-side-bar 0.5s forwards;
}
@media screen and (min-device-width: 600px) and (-webkit-min-device-pixel-ratio: 1) {
.side-bar {
font-size: var(--fontSize12);
}
}
@keyframes show-side-bar {
0% {
opacity: 0;
right: -100%;
}
100% {
opacity: 1;
right: 0;
}
}
.side-bar .view {
width: 100%;
text-align: center;
}
.tips {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: var(--fontSize140);
height: var(--fontSize140);
border-radius: 50%;
color: #fff;
background: rgba(153, 153, 153, 0.7);
z-index: 9999;
font-size: var(--fontSize60);
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
}
.nothing {
padding: var(--fontSize100);
text-align: center;
color: #999;
}
\ No newline at end of file \ No newline at end of file
/**
* @file 客户档案选择弹框:分页拉取工单客户列表,不调 setData 外的页面实例。
*/
import api from '../../api/api.js'
import {
DEFAULT_PAGE_SIZE,
canLoadMorePage,
mapCustomerListWithCarType
} from './customerInfo.pagination.js'
Component({
properties: {
show: {
type: Boolean,
observer(n) {
if (n) {
wx.$util.pointRecord(19)
this.init()
return
}
this.resetList()
this.setData({ orderInfo: {} })
}
},
merchantId: {
type: Number,
observer(n) {
if (n) {
// 销售顾问切换门店时重新拉取顾客数据
this.init()
}
}
},
apiType: Number
},
data: {
orderInfo: {},
customerList: [],
pageNum: 1,
total: 0,
nothing: false,
keyword: '',
loading: false
},
pageLifetimes: {
show() {},
hide() {}
},
methods: {
/** 阻止弹框列表滚到底后 touchmove 穿透到底层页面 */
noScroll() {},
/**
* 首次打开 / 搜索 / 切换门店入口,重置后加载第一页
* @param {string} [keyword] 搜索关键字
*/
init(keyword) {
const { apiType } = this.data
if (apiType == 2) {
this.loadCustomerFileList(keyword)
return
}
this.resetList(keyword)
this.loadList()
},
/**
* 重置分页状态(搜索或重新筛选时)
* @param {string} [keyword]
*/
resetList(keyword = '') {
this.setData({
pageNum: 1,
total: 0,
nothing: false,
keyword: keyword || '',
customerList: []
})
},
/**
* 按当前 pageNum 请求一页并追加到 customerList
*/
loadList() {
const { merchantId, pageNum, keyword, loading } = this.data
if (loading) return
const userInfo = wx.$util.getUserInfo()
const params = {
merchantId: merchantId || userInfo?.shopMerchantId,
pageNum,
pageSize: 20,
statusList: [1],
keyword
}
this.setData({ loading: true })
wx.$util.showLoading()
api.getWorkPackageGoodsList(params).then((res) => {
wx.$util.hideLoading()
const { data, code } = res
let { customerList, total } = this.data
if (code == 0 && data) {
total = data.total || 0
const pageItems = mapCustomerListWithCarType(data.list || [])
customerList = pageNum === 1 ? pageItems : customerList.concat(pageItems)
}
const nothing = !canLoadMorePage(total, pageNum, DEFAULT_PAGE_SIZE)
this.setData({
customerList,
total,
nothing,
loading: false
})
}).catch(() => {
wx.$util.hideLoading()
this.setData({ loading: false })
})
},
/**
* apiType=2 时走客户档案独立接口,保持原全量逻辑
* @param {string} [keyword]
*/
loadCustomerFileList(keyword) {
const { merchantId } = this.data
const userInfo = wx.$util.getUserInfo()
let customerList = []
wx.$util.showLoading()
api.getCustomerFileList({
currentPage: 1,
merchantId: merchantId || userInfo?.shopMerchantId,
pageSize: 999999,
search: keyword
}).then(({ code, data }) => {
wx.$util.hideLoading()
if (code == 0 && data?.list?.length) {
data.list.forEach((item) => {
customerList.push({
customer: item,
carType: `${item.carBrand || ''}-${item.carChildsBrandName || ''}-${item.carSeriesName || ''}`
})
})
}
this.setData({ customerList })
}).catch(() => {
wx.$util.hideLoading()
})
},
searchCar(e) {
const { value } = e.detail
this.init(value)
},
/** scroll-view 触底加载下一页 */
scrolltolower() {
const { total, pageNum, nothing, loading } = this.data
if (loading || nothing) return
if (canLoadMorePage(total, pageNum, DEFAULT_PAGE_SIZE)) {
this.setData({ pageNum: pageNum + 1 }, () => this.loadList())
} else {
this.setData({ nothing: true })
}
},
choose(e) {
const { item, index } = e.currentTarget.dataset
let { customerList } = this.data
customerList = customerList.map((row) => {
row.active = false
return row
})
customerList[index].active = true
const orderInfo = item
orderInfo.orderSource = 4
const deleteList = ['associateOrderCode', 'merchantDistributionList', 'expenseCategoryList', 'profitAllocatinList']
for (let i = 0; i < deleteList.length; i++) {
delete orderInfo[deleteList[i]]
}
this.setData({
customerList,
orderInfo
})
},
/** 取消时通知父页面关闭,便于 page-meta 解锁 */
onPopupCancel() {
this.triggerEvent('cancel')
},
confirm() {
const { orderInfo, customerList } = this.data
const flag = customerList.some((item) => item.active)
if (!flag) {
return wx.$util.showToast('请选择客户')
}
this.triggerEvent('confirm', orderInfo)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<popup title="选择客户" show="{{show}}" bindconfirm="confirm" bindcancel="onPopupCancel" height="90%">
<view class="car-brands-box">
<search-input bindsearch="searchCar" />
<view class="car-brands" catchtouchmove="noScroll">
<view class="label title y-center">
<span class="labelName">姓名</span>
<span class="labelPhone">| 手机号</span>
</view>
<scroll-view style="height: calc(100% - var(--fontSize88))" scroll-y enhanced="{{ true }}" show-scrollbar="{{ false }}" scroll-into-view="{{letter}}" bindscrolltolower="scrolltolower" lower-threshold="100">
<block wx:if="{{customerList.length > 0}}">
<view class="box">
<block wx:for="{{customerList}}" wx:for-item="item" wx:key="ind" wx:for-index="ind">
<view class="list y-center child {{item.active?'active':''}}" data-item="{{item}}" data-index="{{ind}}" catchtap="choose">
<span class="name text-hide">{{item.customer.customerName || '--'}}</span>
<span class="carType " wx:if="{{item.carType.length}}">
<view>(</view>
<view class="text-hide cartypeLabel">{{item.carType}}</view>
<view>)</view>
</span>
<span class="phone">{{item.customer.customerPhone}}</span>
<view class="icon">
<image src="../images/choose.png" />
</view>
</view>
</block>
</view>
<block wx:if="{{ nothing }}">
<view class="list-nothing">到底了~</view>
</block>
</block>
<block wx:if="{{ customerList.length <= 0 && !loading }}">
<view class="nothing">暂无数据</view>
</block>
</scroll-view>
<view class='tips' hidden='{{!showTip}}'>{{letter}}</view>
</view>
</view>
</popup>
/* components/CarBrands/CarBrands.wxss */
.car-brands-box {
width: calc(100% + var(--fontSize64));
height: 100%;
margin-left: calc(-1 * var(--fontSize32));
}
.car-brands {
height: calc(100% - var(--fontSize104));
position: relative;
/* display: flex; */
}
.label {
padding-left: var(--fontSize32);
line-height: var(--fontSize88);
}
.labelName {
font-size: var(--fontSize32);
color: #333333;
padding-right: var(--fontSize20);
}
.text-hide {
/* display: inline-block; */
/* width: var(--fontSize200); */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* line-height: var(--fontSize37); */
}
.labelPhone {
font-size: var(--fontSize24);
color: #999999;
}
.y-center {
display: flex;
align-items: center;
}
.list {
box-sizing: border-box;
height: var(--fontSize88);
/* padding-left: var(--fontSize32); */
margin: 0 var(--fontSize32) 0 var(--fontSize92);
font-weight: 700;
border-top: var(--fontSize2) solid #EBEDF0;
}
.list .name {
/* flex: 4; */
max-width: var(--fontSize150);
}
.list .carType {
/* flex: 10; */
display: flex;
align-items: center;
margin-left: 15px;
max-width: var(--fontSize300);
}
.cartypeLabel {
flex: 1;
}
.list .phone {
/* flex: 5; */
margin-left: auto;
}
.child {
font-weight: normal;
/* padding-left: var(--fontSize96); */
font-size: var(--fontSize28);
/* color: #888888; */
position: relative;
color: #333333;
}
.child.active {
color: #347BFF;
}
.child.title {
color: #282829;
padding-left: var(--fontSize64);
/* color: #347BFF; */
}
.child .icon {
display: none;
width: var(--fontSize32);
height: var(--fontSize32);
position: absolute;
top: 50%;
left: calc(-1 * var(--fontSize46));
transform: translateY(-50%);
}
.child.active .icon {
display: block;
}
@keyframes show-side-bar {
0% {
opacity: 0;
right: -100%;
}
100% {
opacity: 1;
right: 0;
}
}
.tips {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: var(--fontSize140);
height: var(--fontSize140);
border-radius: 50%;
color: #fff;
background: rgba(153, 153, 153, 0.7);
z-index: 9999;
font-size: var(--fontSize60);
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
}
.nothing {
padding: var(--fontSize100);
text-align: center;
color: #999;
}
.list-nothing {
padding: var(--fontSize32) 0 var(--fontSize48);
text-align: center;
font-size: var(--fontSize24);
color: #999;
}
\ No newline at end of file \ No newline at end of file
/**
* @file 客户档案弹框分页纯函数,供 CustomerInfo 组件与单测复用。
*/
/** 客户档案弹框每页条数 */
const DEFAULT_PAGE_SIZE = 20
/**
* 是否还能加载下一页(与工单首页 onReachBottom 判断一致)
* @param {number} total 总条数
* @param {number} pageNum 当前已加载页码
* @param {number} [pageSize=20] 每页条数
* @returns {boolean}
*/
function canLoadMorePage(total, pageNum, pageSize = DEFAULT_PAGE_SIZE) {
if (!total || !pageNum) return false
return Math.ceil(total / pageSize) > pageNum
}
/**
* 为订单列表项补充车型展示字段
* @param {Array} list 接口返回的 list
* @returns {Array}
*/
function mapCustomerListWithCarType(list) {
if (!list?.length) return []
return list.map((item) => {
if (item.customer?.carSeriesName) {
item.carType = `${item.customer.carBrand || ''}-${item.customer.carChildsBrandName || ''}-${item.customer.carSeriesName || ''}`
}
return item
})
}
export {
DEFAULT_PAGE_SIZE,
canLoadMorePage,
mapCustomerListWithCarType
}
Component({
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
this.initDate()
}
}
},
selectPay:{
type:Number
}
},
data: {
hours: [],
days: [],
minutes: [],
dateValues: [],
hourValues: [],
minuteValues: [],
loading: true
},
methods: {
noScroll() { },
hide(e) {
let {
name
} = e.currentTarget.dataset
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[name]: false
})
this.triggerEvent('close')
},
getDateList(starDay, endDay) {
// const start = new Date(startDate);
// const end = new Date(endDate);
// const result = [];
// let date = start;
// while (date <= end) {
// const dateItem = date.toISOString().slice(0, 10)
// result.push(new Date(dateItem).format('yyyy.MM.dd'));
// date.setDate(date.getDate() + 1);
// }
const arr = [];
const dates = [];
// 设置两个日期UTC时间
const db = new Date(starDay);
const de = new Date(endDay);
// 获取两个日期GTM时间
const s = db.getTime() - 24 * 60 * 60 * 1000;
const d = de.getTime() - 24 * 60 * 60 * 1000;
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d;) {
i = i + 24 * 60 * 60 * 1000;
arr.push(parseInt(String(i)));
}
// 获取每一天的时间 YY-MM-DD
for (const j in arr) {
const time = new Date(arr[j]);
const year = time.getFullYear();
const mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
const day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
const YYMMDD = year + '/' + mouth + '/' + day;
dates.push(YYMMDD);
}
this.getHourList(dates)
},
getHourList(days) {
const hours = [], today = new Date();
for (let hour = 0; hour < today.getHours() + 1; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
this.getMinuteList(days, hours)
},
getMinuteList(days, hours) {
const minutes = [];
const today = new Date()
for (let minute = 0; minute < today.getMinutes() + 1; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
// 设置默认时间
let { dateValues, hourValues, minuteValues } = this.data
const HOUR_STR = today.getHours().toString().padStart(2, '0')
const MUNTUE_STR = today.getMinutes().toString().padStart(2, '0')
// const defalutHIndex = hours.indexOf(HOUR_STR)
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
dateValues.push(days.length + 1)
hourValues.push(hours.length + 1)
minuteValues.push(minutes.length + 1)
this.currentDate = new Date().format('yyyy/MM/dd')
this.currentHour = HOUR_STR
this.currentMinute = MUNTUE_STR
this.setData({
hours,
days,
minutes,
dateValues,
hourValues,
minuteValues,
loading: false
}, () => {
wx.nextTick(() => { });
setTimeout(() => {
this.setData({
minuteValues,
loading: false
})
}, 0);
})
},
changeDate(e) {
const { days } = this.data
const { value } = e.detail
const index = value[0]
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = new Date().format('yyyy/MM/dd')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
changeHour(e) {
const { hours, days, dateValues } = this.data
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const today = new Date().format('yyyy/MM/dd')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
changeMinutes(e) {
const { minutes } = this.data
const { value } = e.detail
const index = value[0]
this.currentMinute = minutes[index]
},
confirm() {
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute + ":00"
const result = new Date(str).format('yyyy/MM/dd hh:mm:ss')
this.triggerEvent('confirm', result)
},
initDate() {
this.setData({
dateValues: [],
hourValues: [],
minuteValues: [],
})
const today = new Date()
this.getDateList('2019/01/01', new Date(today.getFullYear(), today.getMonth(), today.getDate()))
},
getAllTimeOrPartTime(type) {
const today = new Date()
const hours = [], minutes = [], hour_len = type == 1 ? 24 : today.getHours() + 1, minute_len = type == 1 ? 60 : today.getMinutes() + 1;
for (let hour = 0; hour < hour_len; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.setData({
hours,
minutes,
})
},
getAllTimeOrPartTimeMinute(type) {
const today = new Date()
const currentHour = today.getHours()
const timeType = this.currentHour != currentHour ? 1 : 0
const minutes = [], minute_len = type == 1 || timeType==1 ? 60 : today.getMinutes() + 1;
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.setData({
minutes,
})
}
},
//组件的生命周期
lifetimes: {
attached: function () {
this.initDate()
},
},
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!-- components/DatePicker/DatePicker.wxml -->
<block wx:if="{{show}}">
<view class="fixed-box fixed-date-box" catchtouchmove="noScroll">
<view class="fixed-bg" data-name="showDateSelect"></view>
<view class="fixed-content">
<view class="fixed-title text-center">{{selectPay==2?'4S店收款时间':'嘀加收款时间'}}</view>
<view class="fixed-body">
<picker-view class="picker picker_max" value="{{dateValues}}" indicator-class="indicator" bindchange="changeDate">
<picker-view-column>
<block wx:for="{{days}}" wx:key="index">
<view class="view">{{item}}</view>
</block>
</picker-view-column>
</picker-view>
<picker-view class="picker" value="{{hourValues}}" indicator-class="indicator" bindchange="changeHour">
<picker-view-column>
<block wx:for="{{hours}}" wx:key="index">
<view class="view">{{item}}</view>
</block>
</picker-view-column>
</picker-view>
<picker-view wx:if="{{!loading}}" class="picker" value="{{minuteValues}}" indicator-class="indicator" bindchange="changeMinutes">
<picker-view-column>
<block wx:for="{{minutes}}" wx:key="index">
<view class="view">{{item}}</view>
</block>
</picker-view-column>
</picker-view>
</view>
<view class="fixed-footer">
<view class="fixed-cancel text-center" bindtap="hide" data-name="showDateSelect">
取消
</view>
<view class="fixed-confirm text-center" bindtap="confirm">确定</view>
</view>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
/* components/DatePicker/DatePicker.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;
}
.fixed-date-box .fixed-body {
height: var(--fontSize360);
display: flex;
}
.fixed-date-box .picker {
width: 30%;
height: 100%;
}
.picker_max{
width: 40% !important;
}
.fixed-date-box .picker .view {
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize30);
color: #292D33;
}
.fixed-date-box .picker .view.disabled{
opacity: 0.5;
}
.fixed-date-box .indicator {
height: var(--fontSize96);
}
.fixed-date-box .picker .tips {
font-size: var(--fontSize20);
color: rgba(100, 101, 102, .5);
margin-left: var(--fontSize10);
}
.fixed-content .fixed-footer {
height: var(--fontSize96);
display: flex;
align-items: center;
position: relative;
}
.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: '';
}
.text-center{
display: flex;
justify-content: center;
align-items: center;
}
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/Goods/Goods.wxss */
/* 商品弹层布局(与 tabWorkOrder Coupon 组件独立维护,勿 @import) */
.coupon-box {
width: calc(100% + var(--fontSize64));
height: 100%;
margin-left: calc(-1 * var(--fontSize32));
}
.coupon {
height: calc(100% - var(--fontSize104));
}
.box {
border-bottom: var(--fontSize2) solid #EBEDF0;
padding-left: 0;
}
.item {
border-top: var(--fontSize2) solid #EBEDF0;
height: var(--fontSize84);
display: flex;
align-items: center;
font-size: var(--fontSize28);
color: #888888;
position: relative;
justify-content: space-between;
padding-right: var(--fontSize32);
width: calc(100% - var(--fontSize130));
}
.title .tips {
font-size: var(--fontSize24);
color: #999999;
}
.item .value {
width: 100%;
display: flex;
justify-content: space-between;
}
.item .labelWidth {
width: calc(100% - var(--fontSize180));
}
.item .value .name {
max-width: 85%;
min-width: 0;
flex: 1;
}
.item .value .name.goods-name {
display: flex;
align-items: center;
flex-wrap: wrap;
overflow: hidden;
}
.item .value .name .goods-name-with-icon {
display: flex;
align-items: center;
flex: 0 1 auto;
max-width: 100%;
min-width: 0;
}
.item .value .name .goods-name-text {
flex: 0 1 auto;
min-width: 0;
}
.item .value .name .marketing-icon {
width: var(--fontSize56);
height: var(--fontSize28);
flex-shrink: 0;
margin-left: var(--fontSize8);
}
.item .value .name .warning_text {
color: #F24724;
margin-left: var(--fontSize10);
font-size: var(--fontSize22);
}
.item .value .textWidth {
max-width: 100%;
}
.item .value .last {
max-width: 15%;
}
.item .value .price {
color: #347BFF;
}
.item .control {
display: flex;
align-items: center;
}
.item .control .minus,
.item .control .add {
width: var(--fontSize44);
height: var(--fontSize44);
color: #347BFF;
background: #F7F7F7;
border-radius: var(--fontSize6);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize32);
font-weight: 700;
}
.item .control .input {
width: var(--fontSize72);
height: var(--fontSize40);
text-align: center;
font-size: var(--fontSize28);
color: #333333;
margin: 0 var(--fontSize5);
}
.disableSelect {
opacity: 0.4;
}
.choose {
width: var(--fontSize32);
height: var(--fontSize32);
margin: 0 var(--fontSize32);
}
.choose .arc {
width: 100%;
height: 100%;
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
.nothing {
padding: var(--fontSize100);
text-align: center;
color: #999;
}
.itemBox {
display: flex;
align-items: center;
}
.itemBox .item {
flex: 1;
}
.specification {
background: #F7F7F7;
border-radius: 16rpx 16rpx 0 0;
width: calc(100% - var(--fontSize80));
margin: var(--fontSize9) 0 var(--fontSize32) var(--fontSize52);
}
.picker {
display: flex;
flex-direction: row-reverse;
height: var(--fontSize80);
line-height: var(--fontSize80);
text-align: right;
}
.placeholder {
font-weight: 400;
font-size: var(--fontSize28);
color: #B6B6B8;
}
.arrow {
width: var(--fontSize28);
height: var(--fontSize26);
margin-top: var(--fontSize26);
flex-shrink: 0;
}
<wxs src="/components/Goods/index.wxs" module="filter" />
<popup show="{{ show }}" title="选择商品" bindconfirm="confirm" bindcancel="cancel">
<view class="coupon-box">
<search-input bindsearch="searchGoods" value="{{ keyWord }}" />
<scroll-view class="coupon" scroll-y>
<block wx:if="{{ goodsList.length > 0 }}">
<view class="box">
<block wx:for="{{ goodsList }}" wx:key="ind" wx:for-index="ind" wx:for-item="i">
<view class="item-wrap">
<view class="itemBox">
<view class="choose" catchtap="choose" data-ind="{{ ind }}" data-item="{{ i }}">
<image src="{{ filter.getImageSrc(i.active) }}" />
</view>
<!-- 单商品 -->
<block wx:if="{{ i.goodsFlag==1 }}">
<view class="item {{ minPrice?(minPrice/100)>= i.minSellPrice ?'':'disableSelect':'' }}">
<view class="value {{ i.active?'labelWidth':'' }}" catchtap="choose" data-ind="{{ ind }}" data-item="{{ i }}">
<view class="name goods-name {{ i.active?'textWidth':'' }}">
<view class="goods-name-with-icon">
<text class="goods-name-text text-hide">{{filter.replaceItemText(i.goods.goodsAlias) ||filter.replaceItemText(i.goods.upgradeGoodsName) || filter.replaceItemText(i.goods.goodsInfo.goodsName)}}</text>
<image wx:if="{{ filter.isMarketingActive(i) }}" class="marketing-icon" src="/tabWorkOrder/images/activeIcon.png" mode="aspectFit" />
</view>
<text wx:if="{{ i.goods.merchantGoodsPosition || i.goods.upgradeGoodsPosition }}">{{'「' + i.goods.positionStr+'」'}}</text>
<text class="warning_text" wx:if="{{ !i.goods.merchantGoodsPosition && !i.goods.upgradeGoodsPosition && (i.goods.goodsInfo.goodsType == 1 || i.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType) }}">无部位</text>
</view>
<view class="last" wx:if="{{ !i.active }}">
<text class="price">¥{{i.goods.price}}</text>
</view>
</view>
<block wx:if="{{ i.active }}">
<view class="control">
<view class="minus" catchtap="addCount" data-count="{{ -1 }}" data-ind="{{ ind }}" data-item="{{ i }}">-</view>
<input
type="number"
catchtap="noScroll"
class="input"
value="{{ i.count || 1 }}"
catchinput="input"
data-ind="{{ ind }}"
data-item="{{ i }}"
/>
<view class="add" catchtap="addCount" data-count="{{ 1 }}" data-ind="{{ ind }}" data-item="{{ i }}">+</view>
</view>
</block>
</view>
</block>
<!-- 多规格 -->
<block wx:if="{{ i.goodsFlag==2 }}">
<view class="item {{ minPrice?(minPrice/100)>= i.minSellPrice ?'':'disableSelect':'' }}">
<view class="value {{ i.active?'labelWidth':'' }}" catchtap="choose" data-ind="{{ ind }}" data-item="{{ i }}">
<view class="name goods-name {{ i.active?'textWidth':'' }}">
<view class="goods-name-with-icon">
<text class="goods-name-text text-hide">{{i.multipleSpecificationsGoods.baseGoodsName }}</text>
<image wx:if="{{ filter.isMarketingActive(i) }}" class="marketing-icon" src="/tabWorkOrder/images/activeIcon.png" mode="aspectFit" />
</view>
</view>
<view class="last" wx:if="{{ !i.active }}">
<text class="price" wx:if="{{ i.multipleSpecificationsGoods.goods.sellPrice }}">¥{{i.multipleSpecificationsGoods.goods.sellPrice}}</text>
</view>
</view>
<block wx:if="{{ i.active }}">
<view class="control">
<view class="minus" catchtap="addCount" data-count="{{ -1 }}" data-ind="{{ ind }}" data-item="{{ i }}">-</view>
<input
type="number"
catchtap="noScroll"
class="input"
value="{{ i.count || 1 }}"
catchinput="input"
data-ind="{{ ind }}"
data-item="{{ i }}"
/>
<view class="add" catchtap="addCount" data-count="{{ 1 }}" data-ind="{{ ind }}" data-item="{{ i }}">+</view>
</view>
</block>
</view>
</block>
</view>
<view class="specification" wx:if="{{ i.goodsFlag==2 }}">
<view wx:for="{{ i.multipleSpecificationsGoods.specificationList }}" wx:for-item="specific" wx:for-index="specInd">
<gl-cell
border
valueAlign="right"
label="{{ specific.specificationName }}"
labelWidth="var(--fontSize180)"
placeholder="请选择"
bindclick="showPopup"
background="#F7F7F7"
data-show-name="specificBox"
>
<picker
bindchange="handlePickerChange"
data-item="{{ i }}"
value="{{ specific.selectIndex }}"
data-specIndex="{{ specInd }}"
data-index="{{ ind }}"
range="{{ specific.specificationSelectValueList }}"
>
<view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{ specific.value }}">{{specific.value}}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
</gl-cell>
</view>
</view>
</view>
</block>
</view>
</block>
<block wx:else>
<view class="nothing">暂无数据</view>
</block>
</scroll-view>
</view>
</popup>
/**
* @file 全局商品组件 wxs
* 用法:<wxs src="/components/Goods/index.wxs" module="filter" />
*
* replaceItemText:将商品名中的 ;~; 分隔符显示为空格
* getImageSrc:单选按钮图(带时间戳防缓存)
*/
var replaceItemText = function (item) {
var reg = getRegExp(';~;', 'g')
return item ? item.replace(reg, ' ') : ''
}
var getImageSrc = function (active) {
var baseImagePath = active ? '../images/radio.png' : '../images/radio_icon.png';
var timestamp = Date.now(); // 使用 Date.now() 获取当前时间戳
return baseImagePath + '?t=' + timestamp; // 使用字符串拼接
}
/**
* 活动标:兼容顶层/子对象字段及 string 类型
* @param {object} item selectOrderGoods.list 单项
*/
var isMarketingActive = function (item) {
if (!item) return false
if (item.marketingFlag == 1 || item.marketingFlag == '1') return true
var orderChildren = item.packageGoodsOrderList || item.goodsList || []
for (var j = 0; j < orderChildren.length; j++) {
if (orderChildren[j].marketingFlag == 1 || orderChildren[j].marketingFlag == '1') return true
}
if (item.packageGoods) {
if (item.packageGoods.marketingFlag == 1 || item.packageGoods.marketingFlag == '1') {
return true
}
var list = item.packageGoods.goodsList || item.packageGoods.packageGoodsOrderList || []
for (var i = 0; i < list.length; i++) {
if (list[i].marketingFlag == 1 || list[i].marketingFlag == '1') return true
}
}
if (item.goods && (item.goods.marketingFlag == 1 || item.goods.marketingFlag == '1')) {
return true
}
if (
item.multipleSpecificationsGoods &&
(item.multipleSpecificationsGoods.marketingFlag == 1 ||
item.multipleSpecificationsGoods.marketingFlag == '1')
) {
return true
}
if (
item.multipleSpecificationsGoods &&
item.multipleSpecificationsGoods.goods &&
(item.multipleSpecificationsGoods.goods.marketingFlag == 1 ||
item.multipleSpecificationsGoods.goods.marketingFlag == '1')
) {
return true
}
return false
}
/*
* 导出
*/
module.exports = {
replaceItemText: replaceItemText,
getImageSrc: getImageSrc,
isMarketingActive: isMarketingActive
}
// components/InventoryInfo/InventoryInfo.js
Component({
/**
* 组件的属性列表
*/
properties: {
// 是否显示弹窗
show: {
type: Boolean,
value: false,
observer: 'onShowChange'
},
// 库存信息数据
inventoryData: {
type: Object,
value: {},
observer: 'onDataChange'
},
// 自定义标题
title: {
type: String,
value: '库存信息'
}
},
/**
* 组件的初始数据
*/
data: {
// 弹窗显示状态
isShowing: false,
// 缓存的数据
dataList:[]
},
/**
* 组件的方法列表
*/
methods: {
/**
* 显示弹窗
*/
showPopup() {
this.setData({
isShowing: true
});
},
/**
* 隐藏弹窗
*/
hidePopup() {
this.setData({
isShowing: false
});
},
/**
* 关闭弹窗事件处理
*/
onClose() {
this.hidePopup();
// 触发关闭事件
this.triggerEvent('close');
},
/**
* 复制文本到剪贴板
*/
copyText(e) {
const { text } = e.currentTarget.dataset;
wx.setClipboardData({
data: text,
success: () => {
wx.showToast({
title: '复制成功',
icon: 'success',
duration: 1500
});
},
fail: () => {
wx.showToast({
title: '复制失败',
icon: 'none',
duration: 1500
});
}
});
},
/**
* 监听show属性变化
*/
onShowChange(newVal, oldVal) {
if (newVal !== oldVal) {
this.setData({
isShowing: newVal
});
}
},
/**
* 监听数据变化
*/
onDataChange(newVal, oldVal) {
if (newVal && typeof newVal === 'object') {
const dataList = Object.keys(newVal).map(key => ({
key: key,
value: newVal[key],
label: this.getFieldLabel(key)
}));
this.setData({
dataList: dataList
},()=>{
console.log(this.data.dataList)
});
}
},
/**
* 获取字段值(支持格式化)
*/
getFieldLabel(field) {
const fieldMap = {
upgradeGoodsCommodityCode: 'UID',
upgradeGoodsCustomCode: '商品编码',
specification: '规格值',
stock: '库存总数'
};
return fieldMap[field] || field;
},
/**
* 获取字段值
*/
getFieldValue(field) {
const data = this.data.cachedData;
return data ? data[field] : '';
}
},
/**
* 组件生命周期函数
*/
lifetimes: {
attached() {
// 组件创建完成后执行
},
detached() {
// 组件销毁时执行
}
},
/**
* 外部样式类
*/
externalClasses: [
'custom-class'
]
});
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/InventoryInfo/InventoryInfo.wxss */
.inventory-info-container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999999;
}
.overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.popup {
padding: 48rpx 0 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80%;
max-width: 622rpx;
background-color: white;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1);
}
.popup-header {
font-size: 32rpx;
font-style: normal;
font-weight: 500;
text-align: center;
margin-bottom: 48rpx;
}
.popup-title {
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.popup-content {
padding: 0 48rpx;
}
.info-item {
padding: 24rpx 0;
color: #292d33;
font-size: 28rpx;
position: relative;
.item {
display: flex;
align-items: flex-start;
width: calc(100% - 48rpx);
.key {
max-width: 130rpx;
white-space: nowrap;
}
.value {
white-space: wrap;
word-break: break-word;
word-wrap: break-word;
}
}
}
.copy-btn {
margin-left: 16rpx;
padding: 8rpx;
width: 32rpx;
height: 32rpx;
cursor: pointer;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
image {
width: 100%;
}
}
.popup-footer {
padding: 30rpx;
text-align: center;
border-top: 1rpx solid #EBEDF0;
}
.close-btn {
width: 100%;
font-size: 32rpx;
color: #333;
}
<!-- components/InventoryInfo/InventoryInfo.wxml -->
<view class="inventory-info-container" wx:if="{{isShowing}}">
<view class="overlay" bindtap="onClose"></view>
<view class="popup">
<view class="popup-header">
<text class="popup-title">{{title}}</text>
</view>
<view class="popup-content">
<view wx:for="{{dataList}}" wx:key="key" class="info-item">
<view class="item">
<view class="key">{{item.label}}:</view>
<view class="value">{{item.value||item.value===0?item.value:'-'}}</view>
</view>
<view class="copy-btn" data-text="{{item.value}}" bindtap="copyText" wx:if="{{item.value||item.value===0}}">
<image src="https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/equity/copy.png" class="image"></image>
</view>
</view>
</view>
<view class="popup-footer">
<view class="close-btn" bindtap="onClose">关闭</view>
</view>
</view>
</view>
<!--components/InventoryInfo/InventoryInfo.wxml-->
\ No newline at end of file \ No newline at end of file
// components/Qrbox.js
Component({
/**
* 组件的属性列表
*/
properties: {
imgSrc: {
type: String,
// observer: function (n) {
// if (n) this.setImgUrl()
// }
},
isLoading: {
type: Boolean,
default: false
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
previewImage(e) {
let { url } = e.currentTarget.dataset
// console.log(url)
if (url.includes('http')) {
wx.previewImage({
urls: [url],
current: url
})
} else {
this.triggerEvent('refresh')
}
},
imageLoad(params) {
console.log('load', this.data.imgSrc)
// this.setdata({})
},
imageError(params) {
console.log('error', this.data.imgSrc)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!-- components/Qrbox.wxml -->
<!-- <text>components/Qrbox.wxml</text> -->
<view class="qr-box">
<view wx:if="{{!imgSrc}}" class="loader box-center" />
<image
wx:else
class="qrImg"
webp="{{true}}"
bindtap="previewImage"
binderror="imageError"
bindload="imageLoad"
data-url="{{imgSrc}}"
src="{{imgSrc}}"
/>
</view>
/* components/Qrbox.wxss */
.qr-box {
display: flex;
justify-content: center;
align-items: center;
min-height: var(--fontSize400);
margin-bottom: var(--fontSize14);
}
.qr-box .qrImg {
width: var(--fontSize400);
height: var(--fontSize400);
display: inline-block;
}
.loadingBox {
width: var(--fontSize400);
height: var(--fontSize400);
position: relative;
}
.loader {
border-top:0.2em solid rgba(0,0,0,0.1);
border-right:0.2em solid rgba(0,0,0,0.1);
border-bottom:0.2em solid rgba(0,0,0,0.1);
border-left:0.2em solid #555;
transform:translateZ(0);
animation:loader 500ms infinite linear;
transition:all 500ms ease;
}
.loader,.loader:after {
border-radius:50%;
width:1.5em;
height:1.5em;
}
@keyframes loader {
0% {
-webkit-transform:rotate(0deg);
transform:rotate(0deg);
}
100% {
-webkit-transform:rotate(360deg);
transform:rotate(360deg);
}
}
\ No newline at end of file \ No newline at end of file
// components/RemarkPopup/RemarkPopup.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (n) {
// if (n) this.getLetter()
console.log(n)
}
},
placeholder: String,
maxlength: Number,
value: {
type: String
},
// isFormComponent: {
// type: Boolean,
// value: false
// },
title: {
type: String,
value: '备注'
},
btnName: {
type: String
},
isLimitNum: {
type: Boolean,
value: false
},
isInt: {
type: Boolean,
value: false
},
required: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
inputValue: '',
isEdit: false
},
/**
* 组件的方法列表
*/
methods: {
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 { isInt, value, inputValue, isEdit, required } = this.data
let confirmValue = isEdit ? inputValue : value
console.log('1', confirmValue)
console.log('confirmValue', confirmValue.length)
if (isInt && !confirmValue.toString().length) {
return wx.showToast({
title: '修改值不能为空',
icon: 'none'
})
}
if (required && !confirmValue.length) {
return wx.showToast({
title: '内容不能为空',
icon: 'none'
})
}
// let { isFormComponent } = this.data
this.triggerEvent('confirm', confirmValue)
// if (!isFormComponent) {
this.showPopup({
currentTarget: {
dataset: {
name: 'showRemark'
}
}
})
// }
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<block>
<!-- wx:if="{{show}}" -->
<view class="fixed-box fixed-remark-box" catchtouchmove="noScroll">
<view class="fixed-bg" bindtap="showPopup" data-name="showRemark" />
<view class="fixed-content">
<view class="fixed-title text-center">{{title}}</view>
<view class="fixed-body text-center">
<view class="fixed-remark">
<gl-textarea
value="{{value}}"
show="{{show}}"
bindinput="blur"
maxlength="{{maxlength}}"
placeholder="{{placeholder || '请输入'}}"
isLimitNum="{{isLimitNum}}"
isInt="{{isInt}}"
customMaxLength></gl-textarea>
</view>
</view>
<view class="fixed-footer">
<view
class="fixed-cancel text-center"
bindtap="showPopup"
data-btnName="cancel"
data-name="showRemark">
取消
</view>
<view class="fixed-confirm text-center" bindtap="remarkConfirm">{{btnName||'确定'}}</view>
</view>
</view>
</view>
</block>
/* 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;
}
.fixed-date-box .fixed-body {
height: var(--fontSize360);
display: flex;
}
.fixed-content .fixed-footer {
height: var(--fontSize96);
display: flex;
align-items: center;
position: relative;
}
.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(--fontSize30) 0 var(--fontSize72);
}
.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/carQuotation/components/skuGoods/Goods.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import { normalizeMarketingMetaOnItem } from '~/utils/marketingFlag'
import { seedMarketingActivitySellPrice } from '~/utils/orderSubOrderExtras'
Component({
/**
* 组件的属性列表
*/
properties: {
//1:精品升级 0 会员权益
sceneType: {
type: String
},
show: {
type: Boolean,
observer: function (n) {}
},
goodsData: {
type: Object,
observer: function (n) {
console.log(n, '999', this.data.chooseGoodsList)
this.setGoodsActive()
}
},
chooseGoodsList: {
type: Array,
observer: function (n) {
// this.setGoodsActive();
}
}
},
observers: {
show: function (value, old) {
console.log(value, old, 'show')
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
scrollDisabled: value
})
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
setGoodsActive() {
//同步数量
let { chooseGoodsList, goodsData } = this.data
if (
goodsData &&
goodsData.multipleSpecificationsGoods &&
goodsData.multipleSpecificationsGoods.skuGoodsList
) {
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => {
if (chooseGoodsList && chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2) {
if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId == c.goodsId
) {
c.count = x.count || 0
}
}
})
}
})
this.setData({
goodsData
})
}
},
hidePopup() {
this.setData({
show: false
})
this.triggerEvent('cancel')
},
choose(e) {
let { item, index } = e.currentTarget.dataset
let { goodsData } = this.data
let { active } = item
//全部取消选择
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(
item => (item.active = false)
)
goodsData.multipleSpecificationsGoods.skuGoodsList[index].active = !active
this.setData({
goodsData
})
},
input(e) {
let { index } = e.currentTarget.dataset
let { goodsData } = this.data
console.log(e)
let { value } = e.detail
if (value < 1) value = 1
if (value > 999) value = 999
goodsData.multipleSpecificationsGoods.skuGoodsList[index].count = value
// this.setData({
// // goodsData
// })
},
blur() {
this.setData({
goodsData: this.data.goodsData
})
},
getChooseList() {
let { chooseGoodsList, goodsData } = this.data
console.log(chooseGoodsList, goodsData)
let chooseList = [],
selectList = []
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => {
if (c.active) {
const specRoot = goodsData.multipleSpecificationsGoods || {}
const marketingFlag =
goodsData.marketingFlag ?? specRoot.marketingFlag ?? c.marketingFlag ?? 0
const activityId =
goodsData.activityId ?? specRoot.activityId ?? c.activityId ?? null
//构建多规格需要的数据格式
selectList.push({
active: true,
count: c.count,
goods: null,
goodsFlag: 2,
isFlag: true,
marketingFlag: marketingFlag == 1 || marketingFlag === '1' ? 1 : 0,
activityId,
multipleSpecificationsGoods: {
baseGoodsName: specRoot.baseGoodsName,
id: specRoot.id,
marketingFlag:
specRoot.marketingFlag ?? (marketingFlag == 1 || marketingFlag === '1' ? 1 : 0),
activityId,
specificationGoodsMap: specRoot.specificationGoodsMap,
specificationList: specRoot.specificationList,
goods: {
...c,
marketingFlag: c.marketingFlag ?? specRoot.marketingFlag ?? marketingFlag,
activityId: c.activityId ?? specRoot.activityId ?? activityId
}
}
})
}
})
console.log(selectList, 'selectList')
//精品升级需要处理数量,会员权益不需要
if (selectList.length) {
selectList.forEach(c => {
if (!c.count) c.count = 1
let price = c.multipleSpecificationsGoods.goods.sellPrice || 0
// 会员权益
if (this.data.sceneType == '0') {
price = Math.round(price * 100)
}
c.multipleSpecificationsGoods.goods.price = price
seedMarketingActivitySellPrice(c.multipleSpecificationsGoods.goods)
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2 && x.multipleSpecificationsGoods) {
console.log(
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId,
'x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId'
)
if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId
) {
console.log(c)
//精品升级需要处理数量,会员权益不需要
x.count = c.multipleSpecificationsGoods.goods.count || 0
}
}
})
let arr = chooseGoodsList.filter(
item =>
item.multipleSpecificationsGoods &&
item.multipleSpecificationsGoods.goods
)
console.log(arr)
selectList.forEach(oldval => {
if (oldval.multipleSpecificationsGoods) {
if (
!arr.some(
newVal =>
newVal.multipleSpecificationsGoods.goods.goodsId ==
oldval.multipleSpecificationsGoods.goods.goodsId
)
) {
chooseList.push(oldval)
}
}
})
} else {
chooseList = selectList
}
})
}
console.log(chooseList, 'chooseList')
chooseList = chooseList.concat(chooseGoodsList)
chooseList.forEach(item => normalizeMarketingMetaOnItem(item))
console.log(chooseList, 'chooseList')
return [selectList, chooseList]
},
confirm() {
let [selectList, chooseList] = this.getChooseList()
console.log(selectList, chooseList)
if (!selectList.length) return wx.$util.showToast('请勾选商品')
this.triggerEvent('confirm', chooseList)
let thisPage = wx.$router.getPageInstance()
if (this.data.sceneType == 1) {
thisPage.setData({
goodsList: chooseList
})
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList)
} else {
thisPage.setData(
{
['orderInfo.vdQuotationGoodsList']: chooseList
},
() => {
//会员权益
thisPage.totalFee()
}
)
}
this.setData({
show: false
})
}
},
lifetimes: {
attached() {
console.log(77777)
this.setData({
windowHight: getSystemInfoSync().windowHeight
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageEquity/pages/carQuotation/components/skuGoods/Goods.wxss */
.title {
width: 100%;
font-weight: 500;
font-size: 32rpx;
color: #222222;
text-align: center;
line-height: 48rpx;
padding: 32rpx 0;
border-bottom: 1rpx solid #EBEDF0;
}
.tips {
font-weight: 400;
font-size: 24rpx;
color: #999999;
line-height: 36rpx;
text-align: center;
padding: 20rpx 0;
}
.goods {
margin: 0 24rpx;
max-height:700rpx;
overflow-Y:scroll;
}
.goods .active {
background: #347bff14!important;
border: 2rpx solid #347BFF;
}
.goods .item-wrap {
background: #F7F8FA;
border-radius: 12rpx;
display: flex;
align-items: center;
padding: 24rpx;
box-sizing: border-box;
min-height: 184rpx;
margin-bottom:16rpx;
}
.item-wrap .icon {
display: block;
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: 20rpx;
}
.item-wrap.active {
color: #347BFF;
}
.item-wrap .icon .arc {
width: var(--fontSize32);
height: var(--fontSize32);
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
.value {
width: calc(100% - 56rpx);
}
.value .alias {
font-weight: 400;
font-size: 24rpx;
color: #222222;
line-height: 36rpx;
margin-bottom: 16rpx;
}
.bottom_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.bottom_box .left {
margin-right:8rpx;
}
.bottom_box .left .name {
font-weight: 400;
font-size: 28rpx;
color: #EA6612;
margin-bottom: 8rpx;
}
.bottom_box .left .position {
font-weight: 400;
font-size: 24rpx;
color: #9B9B9E;
line-height: 36rpx;
}
.right {
display: flex;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.right .price-box {
display: flex;
align-items: center;
margin-right: 16rpx;
}
.input {
width: 84rpx;
height: 72rpx;
background: #FFFFFF;
border: 2rpx solid #EFF0F2;
border-radius: 12rpx;
text-align: center;
}
.popup-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--fontSize20) var(--fontSize32) ;
}
.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(--fontSize32);
}
.popup-footer .cancel {
/* color: #323233;
border: var(--fontSize2) solid #DCDEE0; */
color: #292D33;
background: #F7F8FA;
}
.popup-footer .confirm {
background: #347BFF;
color: #fff;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
<van-popup lock-scroll catchtouchmove="noScroll" custom-style="min-height: 280px;width:var(--fontSize686);" round z-index="999999" custom-class="popclass" bind:click-overlay="closeMenu" bind:before-enter="hideTabBar" bind:after-leave="showTabBar" show="{{ show }}">
<view class="title">确认需购买的商品</view>
<view class="tips">温馨提示:请仔细确认当前售价,避免录错单</view>
<view class="goods" catchtouchmove="noScroll">
<scroll-view scroll-y style="height:350px;">
<view class="item-wrap {{i.active?'active':''}}" wx:for="{{goodsData.multipleSpecificationsGoods.skuGoodsList}}" wx:key="ind" wx:for-index="index" wx:for-item="i">
<view class="icon" catchtap="choose" data-index="{{index}}" data-item="{{i}}">
<block wx:if="{{i.active}}">
<image src="./images/radio.png" />
</block>
<block wx:else>
<view class="arc" />
</block>
</view>
<view class="value">
<view class="alias" wx:if="{{i.goodsAlias}}">
商品别名:{{i.goodsAlias}}
</view>
<view class="bottom_box">
<view class="left">
<view class="name">{{goodsData.multipleSpecificationsGoods.baseGoodsName}}</view>
<view class="position" wx:if="{{ i.specificationStr }}">{{i.specificationStr}}</view>
</view>
<view class="right">
<view class="price-box">
<text>¥</text>
<view class="price">
<!-- {{i}} -->
{{i.sellPrice}}
</view>
</view>
<view style="display:flex;align-items: center;" wx:if="{{i.active&&sceneType==1}}">x <input type="number" catchtap="noScroll" class="input" value="{{i.count || 1}}" catchinput="input" bindblur="blur" data-index="{{index}}" data-item="{{i}}" /></view>
<view class="count" catchtap="showPopup" wx:else data-show-name="goodsBox">x{{i.count||1}}</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}">
<view class="cancel btn text-center" bind:tap="hidePopup">取消</view>
<view class="confirm btn text-center" bind:tap="confirm">确认</view>
</view>
</van-popup>
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '../../utils/imageBase.js'
// components/StoreSelectPopup/StoreSelectPopup.js
import api from '~/api/api'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function(n) {
if (n) {
this.setData({
scrollTop: 0,
pageNum: 1,
nothing: false,
searchValue: ''
})
this.getList(true)
}
}
},
type: Number,
selectedData: Array
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
pageNum: 1,
scrollTop: 0,
nothing: false
},
/**
* 组件的方法列表
*/
methods: {
getList(isReset = false) {
let { type, pageNum, searchValue, nothing, selectedData } = this.data
// type 1园区店数据 2 4s店数据
let requestEvent = type == 1 ? 'getYqMerchantListPage' : 'getMerchantListPage'
let params = {
pageSize: 20,
pageNum: isReset ? 1 : pageNum,
scene: 1,
merchantName: searchValue
}
if (nothing) return
api[requestEvent](params).then(res => {
let { code, data, message } = res
if (code == 0) {
if (isReset) data?.list.unshift({ merchantId: '', merchantName: '全部', active: true })
let tempList = isReset ? data?.list : this.data.storeRangeList.concat(data?.list)
if (selectedData?.length) {
tempList[0].active = false
tempList.forEach(val => {
val.active = selectedData.some(v => v.merchantId == val.merchantId)
})
}
this.setData({
storeRangeList: tempList,
pageNum: pageNum + 1,
total: data?.total,
nothing: data?.total == (tempList.length - 1),
})
} else {
wx.$util.showToast(message)
}
})
},
scrollonReachBottom() {
this.getList()
},
open() {
if (this.data.disabled) return
this.setData({
edit: true,
inputFocus: true
})
},
setValue(value) {
if (this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
this.setData({
searchValue: value
})
},
input(e) {
let { value } = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
})
},
inputConfifm(e) {
this.emit(e)
},
emit(e) {
let {
detail: { value },
type
} = e
this.setData({
edit: false,
nothing: false,
pageNum: 1
})
this.setValue(value)
this.getList(true)
},
choose(e) {
let { item, index } = e.currentTarget.dataset
let { active } = item
let { storeRangeList } = this.data
if (index > 0) {
let target = `storeRangeList[${index}].active`
this.setData({
[target]: !active,
'storeRangeList[0].active': false
}, () => {
this.setSelectedData()
})
} else {
if (!active) {
storeRangeList.map(val => { return val.active = false })
storeRangeList[0].active = true
}
this.setData({storeRangeList}, () => {
this.setSelectedData()
})
}
},
setSelectedData() {
let { storeRangeList, selectedData } = this.data
let arr = []
// 已选的未分页加载出的数据置为选中状态
let selectedArr = wx.$util.arrayUnique(selectedData.concat(storeRangeList), 'merchantId')
selectedArr.forEach(val => {
if (val.active && val.merchantId) arr.push(val)
})
if (!arr?.length) storeRangeList[0].active = true
this.setData({
selectedData: storeRangeList[0]?.active ? [] : arr, // 选择全部清除已选的门店数据
storeRangeList
})
},
hidePopup() {
this.triggerEvent('cancel')
},
confirm() {
let {selectedData} = this.data
this.triggerEvent('confirm', selectedData)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--components/StoreSelectPopup/StoreSelectPopup.wxml-->
<popup title="选择门店" show="{{ show }}" bindconfirm="confirm" height="85%" bindcancel="hidePopup">
<view class="search-box">
<view class="search-input">
<block wx:if="{{ !edit }}">
<view class="input {{ searchValue?'':'placeholder' }}" bindtap="open">
<block wx:if="{{ searchValue }}">{{searchValue}}</block>
<block wx:else>
<image src="{{ IMG_URL }}images/search.png" class="icon"></image>
查找
</block>
</view>
</block>
<block wx:else>
<input
type="text"
class="input"
value="{{ searchValue }}"
focus="{{ inputFocus }}"
confirm-type="search"
bindinput="input"
bindblur="inputBlur"
bindconfirm="inputConfifm"
/>
</block>
</view>
</view>
<view class="title">门店名称</view>
<scroll-view class="store-select-box" scroll-y enhanced="{{true}}" show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower="scrollonReachBottom">
<view class="box">
<view class="merchant-box">
<block wx:for="{{storeRangeList}}" wx:key="index">
<view class="item {{item.active?'active':''}}" bindtap="choose" data-item="{{item}}"
data-index="{{index}}">
<view
class="icon"
catchtap="choose"
data-index="{{index}}"
data-item="{{item}}">
<block wx:if="{{item.active}}">
<image src="../images/radio.png" />
</block>
<block wx:else>
<view class="arc" />
</block>
</view>
<view class="merchant_item">
<view class="text-hide">{{item.merchantName}}</view>
<view>{{item.merchantId}}</view>
</view>
</view>
</block>
</view>
</view>
</scroll-view>
</popup>
\ No newline at end of file \ No newline at end of file
/* components/StoreSelectPopup/StoreSelectPopup.wxss */
.search-box {
height: var(--fontSize104);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize28);
}
.search-box .search-input {
width: var(--fontSize686);
height: var(--fontSize72);
background: #F7F8FA;
border-radius: var(--fontSize38);
color: #333;
}
.search-input .input{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
text-align: center;
}
.search-input .icon{
width: var(--fontSize28);
height: var(--fontSize28);
margin-right: var(--fontSize10);
}
.search-input .placeholder{
color: #C8C9CC;
}
.title{
margin-bottom: var(--fontSize20);
color: #292D33;
font-weight: 400;
font-size: var(--fontSize32);
}
.store-select-box{
height: calc(100% - var(--fontSize168));
}
.merchant-box .item{
display: flex;
height: var(--fontSize88);
align-items: center;
color: #292D33;
}
.merchant-box .item.active{
color: #347BFF;
}
.item .merchant_item{
height: var(--fontSize88);
font-size: var(--fontSize28);
display: flex;
align-items: center;
width: calc(100% - var(--fontSize52));
border-top: var(--fontSize1) solid #EFF0F2;
}
.item .merchant_item .text-hide{
max-width: calc(100% - var(--fontSize192));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item .icon {
width: var(--fontSize32);
height: var(--fontSize32);
display: block;
margin-right: var(--fontSize20);
flex-shrink: 0;
}
.item .icon .arc {
width: 100%;
height: 100%;
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
\ No newline at end of file \ No newline at end of file
import {
buildSelectArr,
buildRatioMap,
mapArtificerList,
calcShowMainShareRatio,
buildConfirmPayload,
getItemKey
} from './technicianSelect.helpers.js'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
let {
copyArtificerList,
artificerSelectObj,
disabledSelectObj,
deputyFlag,
idKey
} = this.data
const selectedList = Array.isArray(artificerSelectObj)
? artificerSelectObj
: artificerSelectObj
? [artificerSelectObj]
: []
const selectArr = buildSelectArr(artificerSelectObj, idKey)
const ratioMap = buildRatioMap(selectedList, idKey)
copyArtificerList = mapArtificerList(copyArtificerList, {
artificerSelectObj,
selectArr,
ratioMap,
idKey,
disabledSelectObj,
deputyFlag
})
const showMainShareRatio = calcShowMainShareRatio(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,
/** technicianId:工单页;uuid:repair/施工单 */
idKey: {
type: String,
value: 'technicianId'
}
},
data: {
orderObj: {},
IMG_URL,
artificerList: [],
searchValue: '',
showMainShareRatio: 100
},
methods: {
noop() {},
changeShareRatio(e) {
let { value } = e.detail
let { index } = e.currentTarget.dataset
let { artificerList, copyArtificerList, idKey } = 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, 10))
.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 targetKey = getItemKey(artificerList[index], idKey)
if (Array.isArray(copyArtificerList)) {
const ci = copyArtificerList.findIndex(
i => getItemKey(i, idKey) === targetKey
)
if (ci >= 0) copyArtificerList[ci].shareRatio = v
}
const showMainShareRatio = calcShowMainShareRatio(artificerList)
this.setData({
artificerList,
copyArtificerList,
showMainShareRatio
})
},
search(e) {
let { copyArtificerList } = wx.$util.deepClone(this.data)
let { selectedTechnicianId, idKey } = this.data
let { value } = e.detail
const matchSelected = i => {
const key = getItemKey(i, idKey)
return selectedTechnicianId.includes(key)
}
if (!value) {
copyArtificerList.map(i => {
i.active = matchSelected(i)
return i
})
this.setData({ artificerList: copyArtificerList })
} else {
let arr = []
copyArtificerList.map(i => {
i.active = matchSelected(i)
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, idKey } =
this.data
let { copyArtificerList } = wx.$util.deepClone(this.data)
if (target.disabled) return
const targetKey = getItemKey(target, idKey)
const updateList = list =>
list.map(i => {
const itemKey = getItemKey(i, idKey)
const active =
itemKey === targetKey ? !i.active : multiple ? i.active : false
return { ...i, active, shareRatio: active ? i.shareRatio : '' }
})
artificerList = updateList(artificerList)
copyArtificerList = updateList(copyArtificerList)
const arr = copyArtificerList
.filter(v => v.active)
.map(v => getItemKey(v, idKey))
if (deputyFlag) {
if (arr.length === 2) {
const disableIfNotSelected = i => ({
...i,
disabled: !arr.includes(getItemKey(i, idKey))
})
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)
}
}
const showMainShareRatio = calcShowMainShareRatio(artificerList)
this.setData({
artificerList,
copyArtificerList,
selectedTechnicianId: multiple ? arr : [targetKey],
showMainShareRatio
})
},
cancel() {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({ artificerSelectPopup: false })
this.triggerEvent('cancel')
},
goMiniprogram() {
wx.navigateToMiniProgram({ appId: 'wx2c28337db96364d2' })
},
async confirm() {
let {
copyArtificerList,
artificerSelectObj,
deputyFlag,
idKey
} = this.data
let arr = copyArtificerList?.filter(v => v.active) || []
if (!arr.length) {
this.setData({ selectedTechnicianId: [] })
}
const result = buildConfirmPayload({
artificerSelectObj,
activeArr: arr,
idKey,
deputyFlag
})
if (!result.ok) {
if (result.reason === 'empty') {
return wx.$util.showToast('请选择技师')
}
if (result.reason === 'invalid_ratio') {
return wx.$util.showToast('请填写副手技师分成比例')
}
return
}
this.triggerEvent('confirm', result.payload)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* 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
/**
* @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 }
}
// components/areaOperationsModal/areaOperationsModal.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
isShow: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
handleClose() {
this.triggerEvent('close')
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/areaOperationsModal/areaOperationsModal.wxss */
.icon {
width: 64px;
height: 64px;
}
.layout {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 1000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .8);
}
.content {
position: relative;
text-align: center;
box-sizing: border-box;
padding: var(--fontSize48) var(--fontSize76);
width: var(--fontSize542);
height: var(--fontSize576);
background-image: linear-gradient(180deg, #F7F9FF 0%, #FFFFFF 54%);
border-radius: var(--fontSize24);
font-weight: 400;
font-size: var(--fontSize28);
color: #9B9B9E;
}
.title {
text-align: center;
font-weight: 500;
font-size: var(--fontSize48);
color: #292D33;
margin-top: var(--fontSize32);
}
.tipTxt {
font-size: 14px;
color: #9B9B9E;
margin-top: var(--fontSize8);
}
.btn {
position: absolute;
bottom: var(--fontSize80);
width: var(--fontSize392);
height: var(--fontSize96);
line-height: var(--fontSize96);
text-align: center;
background: #347BFF;
border-radius: var(--fontSize12);
font-weight: 600;
font-size: var(--fontSize36);
color: #FFFFFF;
margin-top: var(--fontSize48);
}
\ No newline at end of file \ No newline at end of file
<!--components/areaOperationsModal/areaOperationsModal.wxml-->
<view wx:if="{{isShow}}" class="layout">
<view class="bg" bindtap="handleShow" />
<view class="content">
<image class="icon" src="{{IMG_URL}}equity/reopen_error.png" show-menu-by-longpress="{{true}}"></image>
<view class="title">申请失败</view>
<view class="tipTxt">未配置区域运营,请联系总部处理</view>
<view class="btn" bindtap="handleClose">知道了</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// components/orderPromptPop/orderPromptPop.js
const FULL_PAY_TYPE_LIST = [
{
label: '收款方为门店收款',
value: '3'
},
{
label: '收款方为嘀加且属于对公转账收款',
value: '4'
},
{
label: '收款方为嘀加二维码收款',
value: '5',
tips: '适用于已有交易收款流水需补录订单时'
},
{
label: '特殊收款',
value: '6',
tips: '仅用于无法关联流水或混合支付场景,请谨慎选择。'
}
]
const DJ_QR_ONLY_PAY_TYPE_LIST = FULL_PAY_TYPE_LIST.filter(item => item.value === '5')
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer(n) {
if (n) {
this.applyDjQrOnlyPresentation(this.properties.djQrOnlyMode)
}
}
},
/** 异常流水锁单态:仅允许嘀加二维码收款 */
djQrOnlyMode: {
type: Boolean,
value: false,
observer(n) {
if (this.data.show) {
this.applyDjQrOnlyPresentation(n)
}
}
},
popupSlotStyle: {
type: String,
value: 'height: calc(100% - var(--fontSize120));'
},
height: {
type: String,
value: 'var(--fontSize500)'
},
includesChildHeight: {
type: String,
value: 'var(--fontSize1020)'
},
sceneObj: {
type: Object,
value: {},
observer: function (v) {
if (this.properties.djQrOnlyMode) return
// 是否是扫码核销或再次下单,是的话不显示补录入口
if (Object.keys(v)?.length) {
let { payTypeList } = this.data
let index = payTypeList?.findIndex(v => v.value == 5)
if (index > -1) {
payTypeList?.splice(index, 1)
this.setData({
payTypeList,
includesChildHeight: 'var(--fontSize870)'
})
}
this.setData({
payTypeList
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
infoData: {},
payTypeList: FULL_PAY_TYPE_LIST.map(item => ({ ...item }))
},
/**
* 组件的方法列表
*/
methods: {
/**
* 锁单态仅展示嘀加二维码,并预选已支付 + 嘀加二维码
* @param {boolean} djQrOnlyMode
*/
applyDjQrOnlyPresentation(djQrOnlyMode) {
if (djQrOnlyMode) {
this.setData({
payTypeList: DJ_QR_ONLY_PAY_TYPE_LIST.map(item => ({ ...item })),
includesChildHeight: 'var(--fontSize870)',
infoData: { payFlag: '2', payType: '5' }
})
return
}
this.setData({
payTypeList: FULL_PAY_TYPE_LIST.map(item => ({ ...item })),
includesChildHeight: 'var(--fontSize1020)',
infoData: {}
})
},
chooseParent(e) {
if (this.properties.djQrOnlyMode) {
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款')
}
let { type } = e.currentTarget.dataset
this.setData({
'infoData.payFlag': type
})
},
chooseChild(e) {
let { type } = e.currentTarget.dataset
if (this.properties.djQrOnlyMode && String(type) !== '5') {
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款')
}
this.setData({
'infoData.payType': type
})
},
cancel() {
this.triggerEvent('cancel')
},
confirm() {
let { infoData } = this.data
const { djQrOnlyMode } = this.properties
if (djQrOnlyMode && String(infoData.payType) !== '5') {
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款')
}
if (!infoData.payFlag || (infoData.payFlag == 2 && !infoData.payType)) {
return wx.$util.showToast('请选择订单收款方式')
}
this.cancel()
this.triggerEvent('confirm', infoData)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/orderPromptPop/orderPromptPop.wxss */
.sub-title {
height: var(--fontSize100);
font-size: var(--fontSize32);
color: #222222;
font-weight: 600;
position: sticky;
left: 0;
top: 0;
background-color: #fff;
z-index: 2;
border-bottom: var(--fontSize1) solid #EDEDED;
display: flex;
align-items: center;
justify-content: center;
}
.prompt_content{
padding: var(--fontSize24) 0;
font-size: var(--fontSize28);
color: #222222;
.select_item{
padding: var(--fontSize24) 0;
border-bottom: var(--fontSize2) solid #EBEDF0;
display: flex;
}
.child_select_content{
margin-left: var(--fontSize56);
background: #F7F7F7;
border-radius: var(--fontSize16);
.child_select_item{
display: flex;
align-items: center;
border-bottom: var(--fontSize1) solid rgba(195, 195, 195, 0.3);
padding: var(--fontSize32) var(--fontSize24);
&:last-child{
border-bottom: 0;
}
}
}
.radio_label{
font-size: var(--fontSize28);
color: #292D33;
margin-left: var(--fontSize24);
margin-top: calc(-1 * var(--fontSize6))
}
.arc{
width: var(--fontSize28);
height: var(--fontSize28);
border-radius: 50%;
border: var(--fontSize2) solid #E3E3E6;
}
.radio-icon{
width: var(--fontSize32);
height: var(--fontSize32);
}
.radio_tips{
font-size: var(--fontSize24);
color: #9B9B9E;
margin-top: var(--fontSize8);
margin-left: var(--fontSize24);
}
}
\ No newline at end of file \ No newline at end of file
<!--components/orderPromptPop/orderPromptPop.wxml-->
<popup show="{{show}}" bindconfirm="confirm" bindcancel="cancel" height="{{infoData.payFlag == 2 ? includesChildHeight : height}}" slotStyle="{{ popupSlotStyle }}">
<view class="sub-title">
<view>确认订单收款方式</view>
</view>
<view class="prompt_content">
<view class="select_item" wx:if="{{ !djQrOnlyMode }}">
<block wx:if="{{infoData.payFlag == 1}}">
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseParent" data-type="1" />
</block>
<view bindtap="chooseParent" data-type="1">
<view class="radio_label">未支付</view>
<view class="radio_tips">去创建线上付款码订单</view>
</view>
</view>
<view class="select_item" style="border-bottom: 0rpx;">
<block wx:if="{{infoData.payFlag == 2}}">
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseParent" data-type="2" />
</block>
<view bindtap="chooseParent" data-type="2">
<view class="radio_label">已支付</view>
<view class="radio_tips">款项已付需补录订单</view>
</view>
</view>
<view class="child_select_content" wx:if="{{infoData.payFlag == 2}}">
<view wx:for="{{payTypeList}}" class="child_select_item" wx:key="index">
<block wx:if="{{infoData.payType == item.value}}">
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseChild" data-type="{{item.value}}" />
</block>
<view bindtap="chooseChild" data-type="{{item.value}}">
<view class="radio_label">{{item.label}}</view>
<view class="radio_tips" wx:if="{{item.tips}}">{{item.tips}}</view>
</view>
</view>
</view>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
// components/studyPermissionModal/studyPermissionModal.js
import api from '~/api/api'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
title: '',
type: '',
btnText: '',
customContent: ''
},
/**
* 组件的方法列表
*/
methods: {
open(options = {}) {
return new Promise((resolve, reject) => {
this.setData({
show: true,
...options
})
})
},
goPage(e) {
let { cancel } = e.currentTarget.dataset
let userInfo = wx.$util.getUserInfo()
// 暂不测评 返回首页
if (cancel) {
let url = userInfo?.sceneType == 1 ? '/tabIndex/pages/index/index' : '/packageEquity/pages/TabBar/equityPage'
return wx.reLaunch({
url: url
})
}
let { type, examId } = this.data
this.setData({
show: false
})
if (type == 'permission') {
wx.navigateTo({
url: '/packageStudyCenter/pages/studyCenter/studyCenter',
})
} else { // 北森考试
api.findBeiSenSSOToken({}).then(res => {
const beisenToken = res.data;
const COURSE_ID = examId;
if (beisenToken) {
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: COURSE_ID
};
this.jumpUrl = ''
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
const tokenUrl = beisenToken
wx.$router.jumpH5(`${tokenUrl}&return_url=${url}`)
} else {
wx.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
})
}
},
}
})
\ 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!