Commit 35e54893 by 张立顺

feat 低价订单功能迁移和开发

1 parent 0a3fa2ab
Showing 101 changed files with 3466 additions and 449 deletions
...@@ -69,6 +69,13 @@ module.exports = { ...@@ -69,6 +69,13 @@ module.exports = {
getYQList() { getYQList() {
return api.post('dj.api.smartcarlife.serviceMerchant.curYqList') return api.post('dj.api.smartcarlife.serviceMerchant.curYqList')
}, },
/** 获取当前登录账号关联的4S店及园区店列表 */
getShopWithYqList(data) {
return api.post(
'dj.api.smartcarlife.serviceMerchant.shopWithYqList',
data || {}
)
},
/** 根据商户号获取员工列表信息(转化人员) */ /** 根据商户号获取员工列表信息(转化人员) */
getConversionEmployeeList(data) { getConversionEmployeeList(data) {
// 0->2.0 1->1.1 2->1.2 3->1.3 场景对应 // 0->2.0 1->1.1 2->1.2 3->1.3 场景对应
...@@ -172,6 +179,7 @@ module.exports = { ...@@ -172,6 +179,7 @@ module.exports = {
}, },
/**补录订单 */ /**补录订单 */
waitinputorder(data) { waitinputorder(data) {
data = data || {}
data.inputStatus = 0 data.inputStatus = 0
// data.payType = 1 // data.payType = 1
return api.post('dj.api.smartcarlife.weapp.waitinputorder.page', data) return api.post('dj.api.smartcarlife.weapp.waitinputorder.page', data)
...@@ -514,10 +522,6 @@ module.exports = { ...@@ -514,10 +522,6 @@ module.exports = {
getStaffTemplate(data) { getStaffTemplate(data) {
return api.post('dj.api.carboutique.find.staff.good.news.template', data) return api.post('dj.api.carboutique.find.staff.good.news.template', data)
}, },
// 获取异常订单待审核数量
getOrderWaitForAudit(data) {
return api.post('dj.api.smartcarlife.goodsOrderApplyRecord.waitForAudit.count', data)
},
/** 带教申请列表 */ /** 带教申请列表 */
getMentorShipList(data) { getMentorShipList(data) {
return api.post( return api.post(
......
...@@ -12,6 +12,7 @@ import router from './router/index.js' ...@@ -12,6 +12,7 @@ import router from './router/index.js'
// 判断小程序是否需要更新 // 判断小程序是否需要更新
import getUpdateManager from './utils/lib/wxUpdateManager' import getUpdateManager from './utils/lib/wxUpdateManager'
import util from './utils/util.js' import util from './utils/util.js'
import { installFixedUserInfoMock } from './utils/fixedUserInfoMock.js'
import wxApi from './utils/utils_wx' import wxApi from './utils/utils_wx'
// 实例化对象存储 // 实例化对象存储
import { Storage } from '~/utils/cache/storage' import { Storage } from '~/utils/cache/storage'
...@@ -88,7 +89,12 @@ App({ ...@@ -88,7 +89,12 @@ App({
wx.$eventbus = eventbus wx.$eventbus = eventbus
wx.$areaList = areaList wx.$areaList = areaList
wx.$track = $Track wx.$track = $Track
let userInfo = util.getStorageSync('dj_boutique_user_info') const fixedUserInfo = installFixedUserInfoMock({
setLegacyUserInfo: userInfo => util.setUserInfo(userInfo),
setCurrentUserInfo: userInfo => $Storage.set('userInfo', userInfo)
})
let userInfo =
fixedUserInfo || util.getStorageSync('dj_boutique_user_info')
// ,this.globalData, userInfo // ,this.globalData, userInfo
userInfo && this.gobalCheckYqdSuper(userInfo) userInfo && this.gobalCheckYqdSuper(userInfo)
wx.$versionConfig = new Version({ wx.$versionConfig = new Version({
......
...@@ -16,6 +16,14 @@ Component({ ...@@ -16,6 +16,14 @@ Component({
} }
}, },
title: String, title: String,
cancelText: {
type: String,
value: '取消'
},
confirmText: {
type: String,
value: '确认'
},
height: { height: {
type: String, type: String,
value: '85%' value: '85%'
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<slot></slot> <slot></slot>
</view> </view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}"> <view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}">
<view class="cancel btn text-center" bind:tap="hidePopup">取消</view> <view class="cancel btn text-center" bind:tap="hidePopup">{{ cancelText }}</view>
<view class="confirm btn text-center" bind:tap="confirm">确认</view> <view class="confirm btn text-center" bind:tap="confirm">{{ confirmText }}</view>
</view> </view>
</view> </view>
</view> </view>
import { IMG_URL } from '../../utils/imageBase.js' import { IMG_URL } from '../../utils/imageBase.js'
// components/StoreSelectPopup/StoreSelectPopup.js // components/StoreSelectPopup/StoreSelectPopup.js
import api from '~/api/api' import api from '~/api/api'
import { normalizeOrderMerchantOptions } from '../orderPromptPop/orderMerchantContext.helpers'
Component({ Component({
/** /**
...@@ -22,6 +23,10 @@ Component({ ...@@ -22,6 +23,10 @@ Component({
} }
}, },
type: Number, type: Number,
lowPriceMode: {
type: Boolean,
value: false
},
selectedData: Array selectedData: Array
}, },
...@@ -41,6 +46,10 @@ Component({ ...@@ -41,6 +46,10 @@ Component({
methods: { methods: {
getList(isReset = false) { getList(isReset = false) {
let { type, pageNum, searchValue, nothing, selectedData } = this.data let { type, pageNum, searchValue, nothing, selectedData } = this.data
if (this.properties.lowPriceMode) {
this.getLowPriceStoreList(type, searchValue, selectedData)
return
}
// type 1园区店数据 2 4s店数据 // type 1园区店数据 2 4s店数据
let requestEvent = type == 1 ? 'getYqMerchantListPage' : 'getMerchantListPage' let requestEvent = type == 1 ? 'getYqMerchantListPage' : 'getMerchantListPage'
let params = { let params = {
...@@ -72,6 +81,52 @@ Component({ ...@@ -72,6 +81,52 @@ Component({
} }
}) })
}, },
getLowPriceStoreList(type, searchValue, selectedData) {
api
.getShopWithYqList({
merchantName: searchValue || '',
sceneType: 1
})
.then(res => {
const { code, message } = res || {}
if (code != 0) {
wx.$util.showToast(message || '门店列表加载失败')
return
}
const shopList = normalizeOrderMerchantOptions(res?.data)
let list = shopList
if (type == 1) {
const seen = new Set()
list = shopList.reduce((result, item) => {
const key = String(item.yqMerchantId)
if (seen.has(key)) return result
seen.add(key)
result.push({
merchantId: item.yqMerchantId,
merchantName: item.yqMerchantName
})
return result
}, [])
}
list = list.map(item => ({
...item,
active: (selectedData || []).some(
selected => selected.merchantId == item.merchantId
)
}))
const allItem = {
merchantId: '',
merchantName: '全部',
active: !(selectedData || []).length
}
this.setData({
storeRangeList: [allItem, ...list],
pageNum: 2,
total: list.length,
nothing: true
})
})
},
scrollonReachBottom() { scrollonReachBottom() {
this.getList() this.getList()
}, },
......
export const LOW_PRICE_FLAG = 1
const CHILD_LIST_KEYS = [
'shopMerchantList',
'shopList',
'shopWithYqList',
'merchantList',
'storeList',
'shopMerchantInfoList',
'children'
]
function firstDefined(...values) {
return values.find(value => value !== undefined && value !== null && value !== '')
}
function unwrapList(value) {
if (Array.isArray(value)) return value
if (!value || typeof value !== 'object') return []
if (value.data !== undefined) return unwrapList(value.data)
for (const key of ['list', 'records', 'rows', 'result']) {
if (Array.isArray(value[key])) return value[key]
}
return []
}
function childListOf(item) {
for (const key of CHILD_LIST_KEYS) {
if (Array.isArray(item?.[key])) return item[key]
}
return []
}
function toOption(item, parent) {
const hasExplicitShop = item?.shopMerchantId !== undefined
const merchantId = firstDefined(
item?.shopMerchantId,
item?.merchantId,
item?.shopId,
item?.id
)
const merchantName = firstDefined(
item?.shopMerchantName,
item?.merchantName,
item?.shopName,
item?.name,
''
)
const yqMerchantId = firstDefined(
item?.yqMerchantId,
item?.sellerMerchantId,
item?.parkMerchantId,
parent?.yqMerchantId,
parent?.sellerMerchantId,
parent?.parkMerchantId,
parent?.merchantId,
hasExplicitShop ? item?.merchantId : undefined,
merchantId
)
const yqMerchantName = firstDefined(
item?.yqMerchantName,
item?.sellerMerchantName,
item?.parkMerchantName,
parent?.yqMerchantName,
parent?.sellerMerchantName,
parent?.parkMerchantName,
parent?.merchantName,
hasExplicitShop ? item?.merchantName : undefined,
merchantName
)
if (merchantId === undefined || merchantId === null || merchantId === '') {
return null
}
return {
merchantId,
merchantName,
yqMerchantId,
yqMerchantName,
key: `${yqMerchantId}:${merchantId}`
}
}
/**
* 将 shopWithYqList 的园区/4S 店混合返回结构统一为可选 4S 店。
*/
export function normalizeOrderMerchantOptions(payload) {
const result = []
const seen = new Set()
unwrapList(payload).forEach(parent => {
const children = childListOf(parent)
const rows = children.length ? children : [parent]
rows.forEach(row => {
const option = toOption(row, children.length ? parent : null)
if (!option || seen.has(option.key)) return
seen.add(option.key)
result.push(option)
})
})
return result
}
export function filterOrderMerchantOptions(options, keyword) {
const normalizedKeyword = String(keyword || '').trim().toLowerCase()
if (!normalizedKeyword) return [...(options || [])]
return (options || []).filter(item =>
`${item.merchantName || ''} ${item.yqMerchantName || ''}`
.toLowerCase()
.includes(normalizedKeyword)
)
}
export function buildLowPriceMerchantContext(option = {}) {
const yqMerchantId = firstDefined(
option.yqMerchantId,
option.sellerMerchantId
)
const yqMerchantName = firstDefined(
option.yqMerchantName,
option.sellerMerchantName,
''
)
return {
lowPriceFlag: LOW_PRICE_FLAG,
merchantId: option.merchantId,
merchantName: option.merchantName || '',
yqMerchantId,
yqMerchantName,
sellerMerchantId: yqMerchantId,
sellerMerchantName: yqMerchantName
}
}
// components/orderPromptPop/orderPromptPop.js import api from '~/api/api'
import {
buildLowPriceMerchantContext,
filterOrderMerchantOptions,
normalizeOrderMerchantOptions
} from './orderMerchantContext.helpers'
const FULL_PAY_TYPE_LIST = [ const FULL_PAY_TYPE_LIST = [
{ { label: '收款方为门店收款', value: '3' },
label: '收款方为门店收款', { label: '收款方为嘀加且属于对公转账收款', value: '4' },
value: '3'
},
{
label: '收款方为嘀加且属于对公转账收款',
value: '4'
},
{ {
label: '收款方为嘀加二维码收款', label: '收款方为嘀加二维码收款',
value: '5', value: '5',
...@@ -20,39 +20,48 @@ const FULL_PAY_TYPE_LIST = [ ...@@ -20,39 +20,48 @@ const FULL_PAY_TYPE_LIST = [
} }
] ]
const DJ_QR_ONLY_PAY_TYPE_LIST = FULL_PAY_TYPE_LIST.filter(item => item.value === '5') const DJ_QR_ONLY_PAY_TYPE_LIST = FULL_PAY_TYPE_LIST.filter(
item => item.value === '5'
)
Component({ Component({
/**
* 组件的属性列表
*/
properties: { properties: {
show: { show: {
type: Boolean, type: Boolean,
observer(n) { observer(show) {
if (n) { if (show) this.openPresentation()
this.applyDjQrOnlyPresentation(this.properties.djQrOnlyMode)
} }
},
lowPriceMode: {
type: Boolean,
value: false,
observer() {
if (this.data.show) this.openPresentation()
} }
}, },
/** 异常流水锁单态:仅允许嘀加二维码收款 */ /** 异常流水锁单态:仅允许嘀加二维码收款 */
djQrOnlyMode: { djQrOnlyMode: {
type: Boolean, type: Boolean,
value: false, value: false,
observer(n) { observer(value) {
if (this.data.show) { if (this.data.show && !this.properties.lowPriceMode) {
this.applyDjQrOnlyPresentation(n) this.applyDjQrOnlyPresentation(value)
} }
} }
}, },
popupSlotStyle: { popupSlotStyle: {
type: String, type: String,
value: 'height: calc(100% - var(--fontSize120));' value:
'height: calc(100% - var(--fontSize120) - env(safe-area-inset-bottom)); overflow: hidden;'
}, },
height: { height: {
type: String, type: String,
value: 'var(--fontSize500)' value: 'var(--fontSize500)'
}, },
merchantHeight: {
type: String,
value: '80%'
},
includesChildHeight: { includesChildHeight: {
type: String, type: String,
value: 'var(--fontSize1020)' value: 'var(--fontSize1020)'
...@@ -60,43 +69,52 @@ Component({ ...@@ -60,43 +69,52 @@ Component({
sceneObj: { sceneObj: {
type: Object, type: Object,
value: {}, value: {},
observer: function (v) { observer(value) {
if (this.properties.djQrOnlyMode) return if (this.properties.djQrOnlyMode || this.properties.lowPriceMode) return
// 是否是扫码核销或再次下单,是的话不显示补录入口 if (Object.keys(value || {}).length) {
if (Object.keys(v)?.length) { const payTypeList = this.data.payTypeList.filter(item => item.value != 5)
let { payTypeList } = this.data
let index = payTypeList?.findIndex(v => v.value == 5)
if (index > -1) {
payTypeList?.splice(index, 1)
this.setData({ this.setData({
payTypeList, payTypeList,
includesChildHeight: 'var(--fontSize870)' includesChildHeight: 'var(--fontSize870)'
}) })
} }
this.setData({
payTypeList
})
}
} }
} }
}, },
/**
* 组件的初始数据
*/
data: { data: {
currentStep: 1,
infoData: {}, infoData: {},
payTypeList: FULL_PAY_TYPE_LIST.map(item => ({ ...item })) payTypeList: FULL_PAY_TYPE_LIST.map(item => ({ ...item })),
merchantList: [],
filteredMerchantList: [],
merchantKeyword: '',
selectedMerchantKey: '',
selectedMerchant: null,
merchantLoading: false,
merchantError: ''
}, },
/**
* 组件的方法列表
*/
methods: { methods: {
/** openPresentation() {
* 锁单态仅展示嘀加二维码,并预选已支付 + 嘀加二维码 if (this.properties.lowPriceMode) {
* @param {boolean} djQrOnlyMode this.setData({
*/ currentStep: 1,
infoData: {},
payTypeList: FULL_PAY_TYPE_LIST.map(item => ({ ...item })),
merchantList: [],
filteredMerchantList: [],
merchantKeyword: '',
selectedMerchantKey: '',
selectedMerchant: null,
merchantError: ''
})
this.loadOrderMerchantList()
return
}
this.applyDjQrOnlyPresentation(this.properties.djQrOnlyMode)
},
applyDjQrOnlyPresentation(djQrOnlyMode) { applyDjQrOnlyPresentation(djQrOnlyMode) {
if (djQrOnlyMode) { if (djQrOnlyMode) {
this.setData({ this.setData({
...@@ -112,38 +130,112 @@ Component({ ...@@ -112,38 +130,112 @@ Component({
infoData: {} infoData: {}
}) })
}, },
chooseParent(e) {
if (this.properties.djQrOnlyMode) { async loadOrderMerchantList() {
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款') this.setData({ merchantLoading: true, merchantError: '' })
try {
const response = await api.getShopWithYqList({ sceneType: 1 })
if (response?.code != 0) {
throw new Error(response?.message || '下单门店加载失败')
}
const merchantList = normalizeOrderMerchantOptions(response?.data)
this.setData({
merchantList,
filteredMerchantList: merchantList,
merchantLoading: false,
merchantError: merchantList.length ? '' : '暂无可选择的下单门店'
})
} catch (error) {
const merchantError = error?.message || '下单门店加载失败,请稍后重试'
this.setData({
merchantList: [],
filteredMerchantList: [],
merchantLoading: false,
merchantError
})
wx.$util.showToast(merchantError)
} }
let { type } = e.currentTarget.dataset },
onMerchantKeywordInput(e) {
const merchantKeyword = e.detail.value || ''
this.setData({
merchantKeyword,
filteredMerchantList: filterOrderMerchantOptions(
this.data.merchantList,
merchantKeyword
)
})
},
clearMerchantKeyword() {
this.setData({ this.setData({
'infoData.payFlag': type merchantKeyword: '',
filteredMerchantList: [...this.data.merchantList]
}) })
}, },
chooseMerchant(e) {
const selectedMerchant = e.currentTarget.dataset.item
this.setData({
selectedMerchant,
selectedMerchantKey: selectedMerchant.key
})
},
chooseParent(e) {
if (this.properties.djQrOnlyMode) {
return wx.$util.showToast(
'存在异常流水未处理,请选择嘀加二维码收款'
)
}
this.setData({ 'infoData.payFlag': e.currentTarget.dataset.type })
},
chooseChild(e) { chooseChild(e) {
let { type } = e.currentTarget.dataset const type = e.currentTarget.dataset.type
if (this.properties.djQrOnlyMode && String(type) !== '5') { if (this.properties.djQrOnlyMode && String(type) !== '5') {
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款') return wx.$util.showToast(
'存在异常流水未处理,请选择嘀加二维码收款'
)
} }
this.setData({ this.setData({ 'infoData.payType': type })
'infoData.payType': type
})
}, },
cancel() { cancel() {
this.triggerEvent('cancel') this.triggerEvent('cancel')
}, },
confirm() { confirm() {
let { infoData } = this.data if (this.properties.lowPriceMode && this.data.currentStep === 1) {
const { djQrOnlyMode } = this.properties if (!this.data.selectedMerchant) {
if (djQrOnlyMode && String(infoData.payType) !== '5') { return wx.$util.showToast('请选择下单门店')
return wx.$util.showToast('存在异常流水未处理,请选择嘀加二维码收款') }
this.setData({ currentStep: 2 })
return
}
const { infoData } = this.data
if (
this.properties.djQrOnlyMode &&
String(infoData.payType) !== '5'
) {
return wx.$util.showToast(
'存在异常流水未处理,请选择嘀加二维码收款'
)
} }
if (!infoData.payFlag || (infoData.payFlag == 2 && !infoData.payType)) { if (!infoData.payFlag || (infoData.payFlag == 2 && !infoData.payType)) {
return wx.$util.showToast('请选择订单收款方式') return wx.$util.showToast('请选择订单收款方式')
} }
const detail = this.properties.lowPriceMode
? {
...infoData,
...buildLowPriceMerchantContext(this.data.selectedMerchant)
}
: infoData
this.cancel() this.cancel()
this.triggerEvent('confirm', infoData) this.triggerEvent('confirm', detail)
} }
} }
}) })
/* components/orderPromptPop/orderPromptPop.wxss */ /* components/orderPromptPop/orderPromptPop.wxss */
.prompt-layout {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.sub-title { .sub-title {
height: var(--fontSize100); height: var(--fontSize100);
font-size: var(--fontSize32); font-size: var(--fontSize32);
...@@ -13,50 +21,204 @@ ...@@ -13,50 +21,204 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0;
} }
.prompt_content{
.stepper {
position: relative;
display: flex;
justify-content: center;
padding: var(--fontSize28) var(--fontSize72) var(--fontSize20);
flex-shrink: 0;
}
.stepper-line {
position: absolute;
width: 35%;
height: var(--fontSize2);
top: var(--fontSize36);
left: 32.5%;
background: #D9E3FF;
}
.stepper-item {
position: relative;
z-index: 1;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
color: #292D33;
}
.stepper-item.active {
color: #2C66F7;
}
.stepper-item.active .stepper-dot {
background: #2C66F7;
border-color: #2C66F7;
}
.stepper-dot {
width: var(--fontSize12);
height: var(--fontSize12);
border-radius: 50%;
border: var(--fontSize2) solid #9DB7FF;
background: #FFFFFF;
box-sizing: border-box;
}
.stepper-text {
margin-top: var(--fontSize16);
font-size: var(--fontSize24);
}
.merchant_content {
height: 0;
min-height: 0;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding-bottom: var(--fontSize12);
box-sizing: border-box;
}
.merchant-search {
height: var(--fontSize64);
border-radius: var(--fontSize32);
background: #F5F6F8;
display: flex;
align-items: center;
padding: 0 var(--fontSize20);
box-sizing: border-box;
flex-shrink: 0;
}
.merchant-search input {
flex: 1;
height: 100%;
font-size: var(--fontSize26);
color: #292D33;
}
.merchant-search-icon,
.merchant-clear-icon {
width: var(--fontSize28);
height: var(--fontSize28);
flex-shrink: 0;
}
.merchant-search-icon {
margin-right: var(--fontSize12);
}
.merchant-clear-icon {
margin-left: var(--fontSize12);
}
.merchant-list {
height: 0;
min-height: 0;
flex: 1;
margin-top: var(--fontSize12);
}
.payment-scroll {
height: 0;
min-height: 0;
flex: 1;
}
.merchant-item {
min-height: var(--fontSize76);
border-bottom: var(--fontSize1) solid #EBEDF0;
display: flex;
align-items: center;
justify-content: space-between;
font-size: var(--fontSize26);
color: #292D33;
padding: 0 var(--fontSize4);
box-sizing: border-box;
}
.merchant-item.selected {
color: #2C66F7;
}
.merchant-name {
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.merchant-check {
color: #2C66F7;
font-size: var(--fontSize32);
font-weight: 600;
margin-left: var(--fontSize16);
}
.merchant-state {
color: #9B9B9E;
font-size: var(--fontSize26);
text-align: center;
padding: var(--fontSize64) 0;
}
.prompt_content {
padding: var(--fontSize24) 0; padding: var(--fontSize24) 0;
font-size: var(--fontSize28); font-size: var(--fontSize28);
color: #222222; color: #222222;
.select_item{ }
.prompt_content .select_item {
padding: var(--fontSize24) 0; padding: var(--fontSize24) 0;
border-bottom: var(--fontSize2) solid #EBEDF0; border-bottom: var(--fontSize2) solid #EBEDF0;
display: flex; display: flex;
} }
.child_select_content{
.prompt_content .child_select_content {
margin-left: var(--fontSize56); margin-left: var(--fontSize56);
background: #F7F7F7; background: #F7F7F7;
border-radius: var(--fontSize16); border-radius: var(--fontSize16);
.child_select_item{ }
.prompt_content .child_select_content .child_select_item {
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: var(--fontSize1) solid rgba(195, 195, 195, 0.3); border-bottom: var(--fontSize1) solid rgba(195, 195, 195, 0.3);
padding: var(--fontSize32) var(--fontSize24); padding: var(--fontSize32) var(--fontSize24);
&:last-child{ }
.prompt_content .child_select_content .child_select_item:last-child {
border-bottom: 0; border-bottom: 0;
} }
}
} .prompt_content .radio_label {
.radio_label{
font-size: var(--fontSize28); font-size: var(--fontSize28);
color: #292D33; color: #292D33;
margin-left: var(--fontSize24); margin-left: var(--fontSize24);
margin-top: calc(-1 * var(--fontSize6)) margin-top: calc(-1 * var(--fontSize6));
} }
.arc{
.prompt_content .arc {
width: var(--fontSize28); width: var(--fontSize28);
height: var(--fontSize28); height: var(--fontSize28);
border-radius: 50%; border-radius: 50%;
border: var(--fontSize2) solid #E3E3E6; border: var(--fontSize2) solid #E3E3E6;
} }
.radio-icon{
.prompt_content .radio-icon {
width: var(--fontSize32); width: var(--fontSize32);
height: var(--fontSize32); height: var(--fontSize32);
} }
.radio_tips{
.prompt_content .radio_tips {
font-size: var(--fontSize24); font-size: var(--fontSize24);
color: #9B9B9E; color: #9B9B9E;
margin-top: var(--fontSize8); margin-top: var(--fontSize8);
margin-left: var(--fontSize24); margin-left: var(--fontSize24);
}
} }
<!--components/orderPromptPop/orderPromptPop.wxml--> <popup show="{{ show }}"
<popup show="{{show}}" bindconfirm="confirm" bindcancel="cancel" height="{{infoData.payFlag == 2 ? includesChildHeight : height}}" slotStyle="{{ popupSlotStyle }}"> bindconfirm="confirm"
bindcancel="cancel"
height="{{ lowPriceMode ? merchantHeight : (infoData.payFlag == 2 ? includesChildHeight : height) }}"
slotStyle="{{ popupSlotStyle }}"
confirmText="{{ lowPriceMode && currentStep == 1 ? '下一步' : '确认' }}">
<view class="prompt-layout">
<view class="sub-title"> <view class="sub-title">
<view>确认订单收款方式</view> <view>
{{ lowPriceMode ? '新建低价单' : '确认订单收款方式' }}
</view> </view>
</view>
<view class="stepper" wx:if="{{ lowPriceMode }}">
<view class="stepper-line"></view>
<view class="stepper-item active">
<view class="stepper-dot"></view>
<view class="stepper-text">
选择下单门店
</view>
</view>
<view class="stepper-item {{ currentStep == 2 ? 'active' : '' }}">
<view class="stepper-dot"></view>
<view class="stepper-text">
订单收款方式
</view>
</view>
</view>
<view class="merchant_content" wx:if="{{ lowPriceMode && currentStep == 1 }}">
<view class="merchant-search">
<image class="merchant-search-icon" src="/images/search.png" />
<input value="{{ merchantKeyword }}"
placeholder="搜索"
bindinput="onMerchantKeywordInput" />
<image wx:if="{{ merchantKeyword }}"
class="merchant-clear-icon"
src="/images/clear.png"
bindtap="clearMerchantKeyword" />
</view>
<scroll-view class="merchant-list" scroll-y>
<view class="merchant-item {{ selectedMerchantKey == item.key ? 'selected' : '' }}"
wx:for="{{ filteredMerchantList }}"
wx:key="key"
data-item="{{ item }}"
bindtap="chooseMerchant">
<view class="merchant-name">
{{ item.merchantName }}
</view>
<view class="merchant-check" wx:if="{{ selectedMerchantKey == item.key }}">
✓
</view>
</view>
<view class="merchant-state" wx:if="{{ merchantLoading }}">
门店加载中...
</view>
<view class="merchant-state"
wx:elif="{{ merchantError || !filteredMerchantList.length }}">
{{ merchantError || '未搜索到匹配门店' }}
</view>
</scroll-view>
</view>
<scroll-view class="payment-scroll"
wx:else
scroll-y
enhanced="{{ true }}"
show-scrollbar="{{ false }}">
<view class="prompt_content"> <view class="prompt_content">
<view class="select_item" wx:if="{{ !djQrOnlyMode }}"> <view class="select_item" wx:if="{{ !djQrOnlyMode }}">
<block wx:if="{{infoData.payFlag == 1}}"> <image wx:if="{{ infoData.payFlag == 1 }}"
<image class="radio-icon" src="/components/images/radio.png" /> class="radio-icon"
</block> src="/components/images/radio.png" />
<block wx:else> <view wx:else
<view class="arc" bindtap="chooseParent" data-type="1" /> class="arc"
</block> bindtap="chooseParent"
data-type="1" />
<view bindtap="chooseParent" data-type="1"> <view bindtap="chooseParent" data-type="1">
<view class="radio_label">未支付</view> <view class="radio_label">
<view class="radio_tips">去创建线上付款码订单</view> 未支付
</view>
<view class="radio_tips">
去创建线上付款码订单
</view>
</view> </view>
</view> </view>
<view class="select_item" style="border-bottom: 0rpx;"> <view class="select_item" style="border-bottom: 0rpx;">
<block wx:if="{{infoData.payFlag == 2}}"> <image wx:if="{{ infoData.payFlag == 2 }}"
<image class="radio-icon" src="/components/images/radio.png" /> class="radio-icon"
</block> src="/components/images/radio.png" />
<block wx:else> <view wx:else
<view class="arc" bindtap="chooseParent" data-type="2" /> class="arc"
</block> bindtap="chooseParent"
data-type="2" />
<view bindtap="chooseParent" data-type="2"> <view bindtap="chooseParent" data-type="2">
<view class="radio_label">已支付</view> <view class="radio_label">
<view class="radio_tips">款项已付需补录订单</view> 已支付
</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="value">
<image wx:if="{{ infoData.payType == item.value }}"
class="radio-icon"
src="/components/images/radio.png" />
<view wx:else
class="arc"
bindtap="chooseChild"
data-type="{{ item.value }}" />
<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 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>
</view> </view>
</scroll-view>
</view> </view>
</popup> </popup>
...@@ -18,12 +18,12 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,12 +18,12 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
//手动控制体验版环境的请求 true就依据下面index false就默认2 //手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false; const manual = true;
const release = false; const release = false;
// 判断小程序环境 // 判断小程序环境
......
# 低价单接口清单
| 接口 | 调用位置 | 参数或返回改造 |
| --- | --- | --- |
| `order.search.containPackageGoods.byArea` | 低价单列表 | `sceneType=1`、`lowPriceFlag=1`、审批状态筛选 |
| `order.statByApplyStatus` | 低价单页签统计 | `sceneType=1`、`lowPriceFlag=1` |
| `weapp.waitinputorder.page` | 待补录弹层 | `lowPriceFlag`、`merchantId`、`yqMerchantId` |
| `weapp.waitinputorder.count` | 创建页待补录统计 | `lowPriceFlag`、`yqMerchantId` |
| `order.supplementOrder` | 补录提交 | `lowPriceFlag`、`sellerMerchantId` |
| `order.createWithPay` | 普通提交 | `lowPriceFlag`、`sellerMerchantId` |
| `serviceMerchant.curYqList` | 创建页非销售类人员选择 | 返回当前账号可见园区店;不用于新建低价单第一步 |
| `serviceMerchant.shopWithYqList` | 新建低价单第一步、低价单筛选 | 必传 `sceneType=1`;返回当前账号关联 4S 店及园区店并归一化 |
| `order.detail` | 详情与编辑回显 | 保留返回的 `lowPriceFlag` |
`merchantId` 始终表示所选 4S 店,`yqMerchantId` 与 `sellerMerchantId` 始终表示该 4S 店所属园区店。固定用户模拟只负责用户身份,不提供或覆盖 session,也不参与下单门店选择。
低价商品资格为前端提交前规则,不新增 ROP 接口:选品接口返回的每个实际商品需
`validMinSellPrice='Y'` 且存在 `minSellPrice`,录入基础单价必须严格小于该值;失败时在进入
`order.createWithPay` 或 `order.supplementOrder` 前终止。
{
"id": "low-price-order-store-selection",
"title": "低价单下单门店选择与接口改造",
"sourceProject": "dj-car-boutique-work-wechat",
"affectedPaths": [
"api",
"components/orderPromptPop",
"pages/tab/workspace",
"pages/tabWorkOrder",
"tabIndex/components/recordingOrderPopup",
"tabWorkOrder/pages/createOrder",
"docs/migrations/low-price-order-store-selection"
],
"interfaces": [
"dj.api.smartcarlife.order.search.containPackageGoods.byArea",
"dj.api.smartcarlife.order.statByApplyStatus",
"dj.api.smartcarlife.weapp.waitinputorder.page",
"dj.api.smartcarlife.weapp.waitinputorder.count",
"dj.api.smartcarlife.order.supplementOrder",
"dj.api.smartcarlife.order.createWithPay",
"dj.api.smartcarlife.serviceMerchant.curYqList",
"dj.api.smartcarlife.serviceMerchant.shopWithYqList",
"dj.api.smartcarlife.order.detail"
],
"tests": [
{
"id": "low-price-order-flow",
"file": "tests/work-order-migration/low-price-order-flow.test.mjs",
"level": "unit-integration",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "low-price-api-contract",
"file": "tests/work-order-migration/low-price-api-contract.test.mjs",
"level": "contract",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "low-price-goods-validation",
"file": "tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "low-price-goods-integration",
"file": "tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.integration.test.mjs",
"level": "unit-integration",
"expectedBefore": "pass",
"status": "pass"
}
],
"baseline": {
"command": "git rev-parse --short HEAD",
"result": "0a3fa2a"
},
"apiInventory": "docs/migrations/low-price-order-store-selection/api-inventory.md",
"acceptance": "docs/migrations/low-price-order-store-selection/test-acceptance.md",
"verification": {
"commands": [
{
"command": "npm run test:workOrder",
"status": "pass"
}
]
}
}
# 低价单下单门店选择验收矩阵
## 页面行为
1. 工作台点击新增工单后,先显示“选择下单门店”,以 `sceneType=1` 调用 `serviceMerchant.shopWithYqList`,加载并可搜索当前账号关联的 4S 店。
2. 未选择门店不能进入收款方式步骤;选择后可进入“订单收款方式”。
3. 未支付、已支付及四种已支付收款方式保持现有业务含义。
4. 选择嘀加二维码时,待补录列表只查询当前选中 4S 店与园区店的低价单流水。
5. 普通下单和补录下单均使用同一次门店选择结果。
6. 订单收款方式步骤使用响应式高度,标题和按钮固定,超出可用高度的选项可以纵向滚动。
7. 新建工单页底部只显示“直接下单”,不显示“建档”按钮。
8. 低价单商品行回显最低价;未开启最低价时明确显示“未开启”。
9. 商品确认时仅回显最低价,不弹提醒;用户改价后,如未开启最低价或录入价未严格低于最低价,立即提示“价格未触发最低价,其他正常单请到生意助手侧录单”。
## 数据行为
1. 低价单标记统一为数值 `1`。
2. 4S 店写入 `merchantId`,所属园区店写入 `yqMerchantId` 和 `sellerMerchantId`。
3. 列表页签为全部、待审批、已通过、已驳回,分别对应无筛选、`[1,2]`、`[3]`、`[4]`。
4. 订单详情返回的 `lowPriceFlag` 在页面数据与后续编辑流程中不丢失。
5. 固定用户保持现状,sessionId 沿用系统原登录态且不会被固定用户模拟覆盖。
6. 工作台不查询订单待审核或异常数量;退款审核和招聘待处理统计保持原逻辑。
7. 下单页销售顾问直接将已选 4S 店作为唯一合作门店,不依赖第二次关联门店查询;非低价单仍使用原查询与用户上下文。
8. 普通商品、多规格 SKU 和套餐每个子商品都必须 `validMinSellPrice='Y'`,且基础单价严格小于 `minSellPrice`;提交前整单复核,任一不满足都不调用下单接口。
9. 上述反向最低价规则仅适用于 `lowPriceFlag=1`,普通工单原有最低价校验保持不变。
## 自动验证
Node.js 使用项目约束的 24.x 运行。单元测试覆盖门店归一化、搜索、审批状态映射、路由上下文、提交字段以及三类商品的最低价严格边界;契约测试覆盖 9 个接口及页面接线;迁移闭包检查覆盖依赖、路由、资源和公共 API。
...@@ -14,12 +14,44 @@ ...@@ -14,12 +14,44 @@
## 目标项目入口 ## 目标项目入口
`pages/tab/workspace/workspace` 的“门店运营管理”新增“新增工单”。点击后直接展示订单收款 `pages/tab/workspace/workspace` 的“门店运营管理”只展示“低价提单”,原“新增工单”菜单入口
方式,不执行来源项目入口中的日报、学习任务、异常订单或异常流水判断。 已隐藏。“低价提单”作为该分组首个工单入口,点击后直接进入
`/pages/tabWorkOrder/pages/index/index`,使用产品提供的本地紫色图标
`/images/low-price-order.png`,不会打开新增工单收款方式弹窗。
入口会传递 `skipOrderGuards=true`。只有该显式入口链路可以跳过上述业务守卫;表单必填、 低价提单列表固定显示返回按钮。搜索框提示为“关键词”且不显示右侧筛选按钮;列表页保留
VIN、价格、手机号配置和接口错误处理继续执行。扫码、撤销、标记错误等其他操作保留来源 四个审批状态页签、查看和“新建低价单”入口,不提供“扫码核销”入口。
校验。
点击列表“新建低价单”,先展示“选择下单门店”,从
`dj.api.smartcarlife.serviceMerchant.shopWithYqList`(`sceneType=1`)返回结果中搜索并单选 4S 店;选定后再进入
“订单收款方式”。入口不执行来源项目中的日报、学习任务、异常订单或异常流水判断。
列表右下角入口使用产品提供的 56×56 本地图标 `/images/new-low-price-order.png`。
入口仍会传递 `skipOrderGuards=true` 作为路由兼容标记,但创建页提交模块不再依赖
`ModalToQueueControl`,因此“直接下单”不会调用日报、学习任务、异常订单或异常流水接口。
提交时仍先应用手机号配置,再执行表单必填、商品、VIN、价格和接口错误处理;列表撤销、
详情标记错误等其他页面继续保留来源校验。
低价单上下文固定携带 `lowPriceFlag=1`。选中的 4S 店写入 `merchantId`,所属园区店写入
`yqMerchantId` 和下单字段 `sellerMerchantId`;这些值会继续传入待补录查询、普通下单和
补录下单,不再从临时固定用户的默认门店推导。
低价单选中的每个普通商品、多规格 SKU 和套餐子商品都必须开启最低价
(`validMinSellPrice='Y'`),且录入基础单价必须严格小于 `minSellPrice`。选品后商品行显示
“最低价:¥金额”;未开启时显示“最低价:未开启”。商品确认时仅静默同步回显和校验状态,
不弹提醒;价格输入时实时校验,提交前再整单复核。未满足时提示“价格未触发最低价,其他正常单请到生意助手侧录单”并阻止下单。该规则
只在 `lowPriceFlag=1` 时启用,不改变普通工单原有最低价校验。
进入下单页选择销售顾问或交付专员时,低价单直接回显前一步选定的 4S 店作为唯一合作
门店,并按该店加载员工;不再依赖“园区关联 4S 店”接口再次返回该门店。非低价单继续使用
原有门店查询逻辑。
新建工单页底部只提供“直接下单”,不提供“建档”入口;客户信息仍通过页面内带档案图标的
“客户档案”选择器导入。未选档案时只在车主姓名行提示“请通过选择客户档案”,其余客户字段
不重复显示提示。客户档案列表、车型、商品、场景、礼券等需要门店参数的查询统一使用前一步
选中的 `merchantId`(4S 店)及 `yqMerchantId/sellerMerchantId`(园区店)。档案或历史订单回显
只更新客户和订单业务数据,不会覆盖已经选定的下单门店。
支付方式约定: 支付方式约定:
...@@ -40,7 +72,19 @@ VIN遠蔭秤憭誧蝏剜銵 ...@@ -40,7 +72,19 @@ VIN遠蔭秤憭誧蝏剜銵
- `tabWorkOrder/pages/ocr/ocr` - `tabWorkOrder/pages/ocr/ocr`
未迁移:战败单、签名、客户画像、客户资料修改、发票、施工单新建与独立施工详情页面。 未迁移:战败单、签名、客户画像、客户资料修改、发票、施工单新建与独立施工详情页面。
退款操作复用目标项目 `packageWorkspace` 页面。确认施工成功后刷新当前详情页。 工单详情“工单信息”标题后不展示退款或纠错操作按钮。确认施工成功后刷新当前详情页。
## 临时用户模拟
登录功能尚未迁入,当前通过 `utils/fixedUserInfoMock.js` 启用固定身份模式。小程序启动时
只初始化旧缓存 `dj_boutique_user_info` 和当前环境下的 `userInfo`。
`wx.$util.getUserInfo()` 每次返回一份独立的固定用户副本;会话不属于该模拟范围,
`wx.$util.getSessionId()` 继续直接读取系统原有的 `dj_boutique_sessionId`,启动时不会覆盖
旧、新 session 缓存。
该模拟只提供页面流程需要的用户和默认门店上下文,不提供会话、验证码或接口签名,也不会
把完整用户对象输出到日志。登录功能迁入后,应关闭 `FIXED_USER_INFO_MOCK_ENABLED`,
移除用户双缓存初始化,再运行本页列出的完整回归命令。
## 自动化命令 ## 自动化命令
...@@ -60,12 +104,19 @@ npm run test:workOrder ...@@ -60,12 +104,19 @@ npm run test:workOrder
| ID | 操作 | 预期 | | ID | 操作 | 预期 |
|---|---|---| |---|---|---|
| MR-WO-001 | 工作台点击“新增工单” | 直接展示收款方式弹窗 | | MR-WO-001 | 查看工作台“门店运营管理” | 不显示“新增工单”,首个工单入口为“低价提单” |
| MR-WO-002 | 选择未支付 | 进入新建页,业务守卫标记为跳过 | | MR-WO-002 | 选择 4S 店并进入下一步 | 展示收款方式,保留该店的 `merchantId/yqMerchantId/sellerMerchantId` |
| MR-WO-003 | 选择嘀加二维码收款并选流水 | 进入补录模式,保留已选交易参考号 | | MR-WO-003 | 选择嘀加二维码收款并选流水 | 仅查询所选门店的低价单流水,进入补录模式并保留交易参考号 |
| MR-WO-004 | 从列表扫码进入 | 扫码前业务守卫仍执行 | | MR-WO-004 | 进入低价提单列表 | 固定显示返回按钮,搜索提示为“关键词”,无筛选/扫码按钮并提供“新建低价单” |
| MR-WO-005 | 新建页点击 VIN/车牌识别 | OCR 可拍照或选图并回填 | | MR-WO-005 | 新建页点击 VIN/车牌识别 | OCR 可拍照或选图并回填 |
| MR-WO-006 | 提交缺失必填项 | 表单校验仍拦截 | | MR-WO-006 | 提交缺失必填项 | 表单校验仍拦截 |
| MR-WO-007 | 查看详情并申请退款 | 打开 `packageWorkspace` 退款页面 | | MR-WO-007 | 查看详情页“工单信息”标题 | 标题后不显示退款、纠错或其他操作按钮 |
| MR-WO-008 | 查看严格范围外功能 | 不显示死入口,不发生无效跳转 | | MR-WO-008 | 详情接口返回 `confirmFlag=2` | 不显示“查看施工单”按钮 |
| MR-WO-009 | 工作台点击“低价提单” | 使用产品提供的紫色图标并直接进入低价提单列表 |
| MR-WO-010 | 查看工单详情和工单确认客户信息 | 优先显示 `customer` 中的手机号、车牌号,不被顶层空值覆盖 |
| MR-WO-011 | 普通创建或流水补录提交 | 分别向 `createWithPay`/`supplementOrder` 传递 `lowPriceFlag=1` 与所选 `sellerMerchantId` |
| MR-WO-012 | 进入新建低价单并选择销售顾问 | 合作门店直接显示前一步选中的 4S 店,选择员工后可确认 |
| MR-WO-013 | 查看新建工单页底部操作区 | 只显示占满操作区的“直接下单”,不显示“建档”按钮 |
| MR-WO-014 | 未选择客户档案时查看客户区 | “客户档案”前显示档案图标,仅车主姓名行显示一次“请通过选择客户档案” |
| MR-WO-015 | 打开客户档案并选择客户/历史数据 | 列表请求使用前一步选中的 4S 店 ID,回填后仍保留下单 4S 店和所属园区店 |
| MR-WO-016 | 低价单选品、改价并直接下单 | 所有商品均显示最低价,选品回显不弹提醒;仅已开启最低价且录入价严格低于最低价时允许提交,否则改价时实时提示并阻断接口请求 |
# 新建工单客户档案唯一导入实施计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让新建工单页面的客户信息只能经“客户档案”导入,页面内不再允许手动填写或修改。
**Architecture:** 仅调整 `createOrder.wxml` 的客户信息展示层;既有的 `showCustomPop`、`chooseCustomerInfo`、`onRoute` 与客户档案补全逻辑不变。新增 Node 模板回归测试直接读取 WXML,锁定客户档案入口和禁止手动编辑的交互边界。
**Tech Stack:** 微信小程序 WXML、Node.js 内置 `node:test`、Node.js 内置 `assert`、`npm run test:createOrder`。
## Global Constraints
- 客户信息区覆盖车主姓名、客户来源、性别、手机号、车型、VIN、车牌号、是否体验。
- “客户档案”仍是唯一数据选择入口,继续调用现有 `showCustomPop`。
- 不改动客户档案组件、接口、`chooseCustomerInfo`、`onRoute`、提交校验或提交载荷。
- 空值展示文案固定为“请通过客户档案选择”。
- 小型页面交互修复,不属于跨项目迁移或较大重构,无需迁移 manifest 门禁。
---
## File Structure
- Create: `tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs` — 读取客户信息 WXML 区段,回归验证唯一导入入口和只读约束。
- Modify: `tabWorkOrder/pages/createOrder/createOrder.wxml:112-256` — 将客户信息区从可编辑控件替换成只读文本展示,保留客户档案按钮。
### Task 1: 锁定客户档案唯一导入交互
**Files:**
- Create: `tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.wxml:112-256`
- Test: `tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
**Interfaces:**
- Consumes: `showCustomPop()` 是 `createOrder.js` 已有的客户档案弹窗打开方法;客户信息展示数据来自 `orderObj.customer`。
- Produces: WXML 中仅保留 `bindtitleClick="showCustomPop"` 的客户档案入口;客户信息区不包含 `input`、来源选择、性别/体验切换、车型选择或 OCR 扫描绑定。
- [ ] **Step 1: 写入失败的模板回归测试**
创建 `tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`:
```js
import { readFileSync } from 'node:fs'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
const template = readFileSync(
new URL('../createOrder.wxml', import.meta.url),
'utf8'
)
const start = template.indexOf('<view class="customerName">')
const end = template.indexOf(
'\\n\\t\\t<view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">',
start
)
const customerSection = template.slice(start, end)
describe('createOrder customer information template', () => {
it('keeps customer archive as the only manual customer-data entry', () => {
assert.ok(start >= 0)
assert.ok(end > start)
assert.match(customerSection, /bindtitleClick="showCustomPop"/)
assert.match(customerSection, /请通过客户档案选择/)
assert.doesNotMatch(customerSection, /<input/)
assert.doesNotMatch(customerSection, /bind:click="toSelectCustomerSource"/)
assert.doesNotMatch(customerSection, /bindtap="changeGender"/)
assert.doesNotMatch(customerSection, /data-show-name="carBrandBox"/)
assert.doesNotMatch(customerSection, /bindtitleClick="navOcr"/)
assert.doesNotMatch(customerSection, /bindtap="changeExperience"/)
})
})
```
- [ ] **Step 2: 运行测试,确认其因现有手工交互失败**
Run: `node --test tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
Expected: FAIL。失败断言应指出客户信息区仍存在 `<input` 或手动修改事件绑定;不得因文件路径或测试语法错误失败。
- [ ] **Step 3: 以最小 WXML 改动切换为只读展示**
在 `tabWorkOrder/pages/createOrder/createOrder.wxml` 的客户信息区执行以下变更:
```wxml
<gl-cell
border
valueAlign="right"
label="车主姓名"
titleBtn="客户档案"
bindtitleClick="showCustomPop"
value="{{ orderObj.customer.customerName || '请通过客户档案选择' }}"
/>
<gl-cell
border
label="客户来源"
value="{{ filter.getSalesTypeName(Sourcecolumns, orderObj.customer.salesType) || '请通过客户档案选择' }}"
valueAlign="right"
/>
```
对性别、手机号、车型、VIN、车牌号、是否体验使用同样的只读 `gl-cell` 或文本插槽:有值时显示 `orderObj.customer` 中的现有值,无值时显示“请通过客户档案选择”。删除这些字段的 `<input>`、`bindinput`、`bindblur`、`toSelectCustomerSource`、`changeGender`、`showPopup`(车型)、`navOcr`、`changeExperience` 与相关交互图标属性;不删除姓名行的 `titleBtn` 和 `bindtitleClick="showCustomPop"`。
- [ ] **Step 4: 重新运行单测,确认模板约束通过**
Run: `node --test tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
Expected: PASS,且仅该一个测试文件被执行。
- [ ] **Step 5: 运行 createOrder 回归测试**
Run: `npm run test:createOrder`
Expected: PASS,所有 `tabWorkOrder/pages/createOrder/tests` 测试通过,退出码为 0。
- [ ] **Step 6: 复查变更并提交**
Run: `git diff --check && git diff -- tabWorkOrder/pages/createOrder/createOrder.wxml tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
Expected: 没有空白错误;差异仅包含客户信息只读化和回归测试。
```bash
git add tabWorkOrder/pages/createOrder/createOrder.wxml tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs
git commit -m "feat: require customer archive for create order"
```
# Customer Work Order Menu Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 在工作台“门店运营管理”中,把“客户工单”菜单放在“新增工单”之后并直达已迁移客户工单列表。
**Architecture:** 复用工作台现有 `storeManagementMenus` 和 `jumpTo()` 的本地 `path` 分支,不增加路由别名或事件方法。从来源项目复制原 `tab-order.png`,菜单通过 `iconUrl` 使用本地资源。
**Tech Stack:** 微信小程序 JavaScript/WXML、Node.js 24 LTS、`node:test`
## Global Constraints
- 当前分支开发,不创建 worktree 或新分支。
- 客户工单必须紧跟“新增工单”,路径固定为 `/pages/tabWorkOrder/pages/index/index`。
- 图标必须从来源项目 `images/tab-order.png` 原样复制到目标项目同路径。
- 不修改客户工单页面、开单弹窗、公共路由器或订单业务判断。
- 这是已迁移页面的小型入口补充,不执行迁移 manifest 门禁。
- 未经用户要求,不提交或推送运行时代码。
---
### Task 1: 客户工单菜单、图标和入口契约
**Files:**
- Modify: `tests/work-order-migration/workspace-source-contract.test.mjs`
- Modify: `pages/tab/workspace/workspace.js`
- Create: `images/tab-order.png`
**Interfaces:**
- Consumes: `jumpTo()` 已有 `path` 分支
- Produces: `storeManagementMenus` 中的客户工单配置
- [ ] **Step 1: Write the failing test**
Add imports for `@babel/parser`, `@babel/generator`, and `node:vm`. Load the
actual `Page` configuration by parsing `workspace.js`, removing only import
declarations, and evaluating the remaining module with controlled `wx` and
`Page` globals:
```js
async function loadWorkspacePage() {
const pageSource = await readFile(
path.join(projectRoot, 'pages/tab/workspace/workspace.js'),
'utf8'
)
const ast = parse(pageSource, { sourceType: 'module' })
ast.program.body = ast.program.body.filter(
node => node.type !== 'ImportDeclaration'
)
let pageConfig
const navigations = []
const tracks = []
runInNewContext(generate(ast).code, {
Page(config) { pageConfig = config },
wx: {
$util: { getUserInfo: () => ({ sceneType: 1 }) },
$track: { setTrackData: (...args) => tracks.push(args) },
$router: { go: () => assert.fail('本地 path 不应调用公共路由器') },
navigateTo: options => navigations.push(options)
}
})
return { pageConfig, navigations, tracks }
}
```
Add a second test to `workspace-source-contract.test.mjs`:
```js
it('客户工单紧跟新增工单并直达已迁移列表页', async () => {
const { pageConfig, navigations, tracks } = await loadWorkspacePage()
const menus = pageConfig.data.storeManagementMenus
const createOrderIndex = menus.findIndex(item => item.name === '新增工单')
const customerOrderIndex = menus.findIndex(item => item.name === '客户工单')
assert.equal(customerOrderIndex, createOrderIndex + 1)
assert.deepEqual(
JSON.parse(JSON.stringify(menus[customerOrderIndex])),
{
name: '客户工单',
path: '/pages/tabWorkOrder/pages/index/index',
iconUrl: '/images/tab-order.png',
trackingCode: 'regional-assistant-customer-work-order'
}
)
pageConfig.jumpTo({
currentTarget: { dataset: { target: menus[customerOrderIndex] } }
})
assert.deepEqual(
JSON.parse(JSON.stringify(navigations)),
[{ url: '/pages/tabWorkOrder/pages/index/index' }]
)
assert.equal(tracks[0][1], 'regional-assistant-customer-work-order')
const icon = await readFile(
path.join(projectRoot, 'images/tab-order.png')
)
assert.ok(icon.length > 0)
})
```
- [ ] **Step 2: Verify RED**
Run:
```powershell
node scripts/run-node-tests.mjs tests/work-order-migration/workspace-source-contract.test.mjs
```
Expected: FAIL because `客户工单` is absent from `storeManagementMenus`.
- [ ] **Step 3: Copy the source icon**
Run:
```powershell
Copy-Item -LiteralPath 'C:\Users\admin\Desktop\工作\dj-car-boutique-work-wechat\images\tab-order.png' -Destination 'C:\Users\admin\Desktop\工作\regional-assistant\images\tab-order.png'
```
The source file is 1,087 bytes and the target path is currently absent.
- [ ] **Step 4: Add the menu item**
Insert immediately after “新增工单”:
```js
{
name: "客户工单",
path: "/pages/tabWorkOrder/pages/index/index",
iconUrl: "/images/tab-order.png",
trackingCode: "regional-assistant-customer-work-order",
},
```
- [ ] **Step 5: Verify GREEN**
Run:
```powershell
node scripts/run-node-tests.mjs tests/work-order-migration/workspace-source-contract.test.mjs
npm run test:workOrderMigration
npm run check:workOrderClosure
```
Expected: the workspace tests, migration suite, route check, and asset closure all pass.
### Task 2: Entry documentation and complete regression
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
**Interfaces:**
- Consumes: the new customer-work-order menu contract
- Produces: maintainer and acceptance guidance
- [ ] **Step 1: Update documentation**
Document that:
- “客户工单” follows “新增工单” under “门店运营管理”;
- it directly opens `/pages/tabWorkOrder/pages/index/index`;
- it does not trigger the create-order payment prompt;
- the original `tab-order.png` is now part of the migration closure.
Update acceptance test counts and scanned-file statistics from the final command output.
- [ ] **Step 2: Run complete verification**
Run:
```powershell
npm run test:workOrder
node --check pages/tab/workspace/workspace.js
git diff --check
```
Expected: all automated tests and static closure checks pass, the workspace script parses, and the diff has no whitespace errors.
# System Session Restore Implementation Plan
**Goal:** 撤销固定 sessionId 模拟,保留固定用户信息,并让所有请求继续使用系统原有登录态。
**Architecture:** `utils/fixedUserInfoMock.js` 只负责固定用户;`utils/util.js` 的
`getSessionId()` 直接读取 `dj_boutique_sessionId`;`App.onLaunch()` 不再传入或执行任何
session writer。
**Tech Stack:** 微信小程序 JavaScript、Node.js 24 LTS、`node:test`
## 变更清单
- [x] 先增加失败测试,验证固定用户模块不再导出 session resolver。
- [x] 验证 `getSessionId()` 恢复系统原有缓存读取。
- [x] 删除固定 session 常量和创建函数。
- [x] 删除启动阶段的旧、新 session 缓存写入。
- [x] 删除工作台订单待审核/异常数量查询及其 API wrapper。
- [x] 执行完整精品工单回归、迁移后置门禁和差异格式检查。
## 完成标准
- 仓库不包含原指定 sessionId。
- 固定用户模块不再生成、解析或写入 sessionId。
- 工作台刷新不调用订单待审核/异常数量接口。
- 固定用户、工作台入口和精品工单完整回归全部通过。
# Fixed User Info Mock Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 在登录功能尚未迁入期间,让 `wx.$util.getUserInfo()` 与两套现有缓存读取路径稳定取得需求指定的固定用户信息。
**Architecture:** 新增一个不依赖微信运行时的固定用户模块,集中保存临时用户、返回深拷贝,并负责把独立副本写入旧缓存和新缓存。`utils/util.js` 通过该模块解析用户,`app.js` 在其他用户初始化逻辑之前预热两套缓存。
**Tech Stack:** 微信小程序 JavaScript、Node.js 24 LTS、`node:test`
## Global Constraints
- 当前分支开发,不创建 worktree 或新分支。
- 固定用户模拟默认开启,登录功能迁入后可通过单一开关关闭。
- 不在控制台、测试输出或文档中打印完整用户对象。
- 这是小型兼容修复,不执行迁移 manifest 门禁。
---
### Task 1: 固定用户行为与双缓存初始化
**Files:**
- Create: `utils/fixedUserInfoMock.js`
- Create: `tests/work-order-migration/fixed-user-info-mock.test.mjs`
- Modify: `utils/util.js`
- Modify: `app.js`
**Interfaces:**
- Produces: `createFixedUserInfo(): object`
- Produces: `resolveRuntimeUserInfo(readStoredUserInfo: Function): object | null`
- Produces: `installFixedUserInfoMock({ setLegacyUserInfo, setCurrentUserInfo }): object | null`
- Produces: `FIXED_USER_INFO_MOCK_ENABLED: boolean`
- [ ] **Step 1: Write the failing tests**
```js
it('模拟开启时忽略旧缓存并返回固定用户的独立副本', () => {
const first = resolveRuntimeUserInfo(() => ({ accountName: 'old' }))
const second = resolveRuntimeUserInfo(() => ({ accountName: 'old' }))
assert.equal(first.accountName, '18372203315')
first.subLoginUser.sceneType = 0
assert.equal(second.subLoginUser.sceneType, 7)
})
it('启动安装器把独立用户副本写入旧缓存和新缓存', () => {
let legacyUser
let currentUser
const installed = installFixedUserInfoMock({
setLegacyUserInfo: value => { legacyUser = value },
setCurrentUserInfo: value => { currentUser = value }
})
assert.deepEqual(legacyUser, installed)
assert.deepEqual(currentUser, installed)
assert.notEqual(legacyUser, currentUser)
})
```
- [ ] **Step 2: Run tests to verify RED**
Run: `node scripts/run-node-tests.mjs tests/work-order-migration/fixed-user-info-mock.test.mjs`
Expected: FAIL because `utils/fixedUserInfoMock.js` does not exist.
- [ ] **Step 3: Implement the minimal fixed-user module**
```js
export const FIXED_USER_INFO_MOCK_ENABLED = true
export function createFixedUserInfo() {
return JSON.parse(JSON.stringify(FIXED_USER_INFO))
}
export function resolveRuntimeUserInfo(readStoredUserInfo) {
return FIXED_USER_INFO_MOCK_ENABLED
? createFixedUserInfo()
: readStoredUserInfo()
}
export function installFixedUserInfoMock(writers) {
if (!FIXED_USER_INFO_MOCK_ENABLED) return null
const installed = createFixedUserInfo()
writers.setLegacyUserInfo(createFixedUserInfo())
writers.setCurrentUserInfo(createFixedUserInfo())
return installed
}
```
- [ ] **Step 4: Connect the runtime**
In `utils/util.js`, make `getUserInfo()` call `resolveRuntimeUserInfo()` with the existing legacy-storage reader as its fallback.
In `app.js`, call `installFixedUserInfoMock()` after `wx.$storage` and `wx.$util` are mounted but before `gobalCheckYqdSuper()`. Bind the writers to `util.setUserInfo()` and `$Storage.set('userInfo', value)`.
- [ ] **Step 5: Run the focused migration tests**
Run: `npm run test:workOrderMigration`
Expected: PASS with no user-object logging.
### Task 2: Temporary-login documentation and regression verification
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
**Interfaces:**
- Consumes: `FIXED_USER_INFO_MOCK_ENABLED`
- Produces: login-migration removal guidance for maintainers
- [ ] **Step 1: Document the temporary simulation**
Add a “临时用户模拟” section explaining:
- fixed-user mode is active while login is absent;
- both `dj_boutique_user_info` and environment-scoped `userInfo` are initialized;
- `wx.$util.getUserInfo()` returns a fresh fixed-user copy;
- disable/remove the mock when login migration is completed.
Update the automated acceptance summary with the fixed-user case, the actual
Node 24 pass/skip counts, and the distinction between local user context and
live API credentials.
- [ ] **Step 2: Run complete verification**
Run:
```powershell
npm run test:workOrder
git diff --check
git status --short
```
Expected: all tests and closure checks pass; diff contains only the fixed-user implementation, tests, plan, and documentation.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
- 只改本次精品工单迁移闭包,不改目标项目其他原有功能。 - 只改本次精品工单迁移闭包,不改目标项目其他原有功能。
- 当前分支直接开发,不创建分支或 worktree。 - 当前分支直接开发,不创建分支或 worktree。
- 工作台新建入口继续传递 `skipOrderGuards=true`。 - 工作台新建入口继续传递 `skipOrderGuards=true`。
- 固定用户与固定 sessionId 模拟保持启用。 - 固定用户模拟保持启用;sessionId 沿用系统原有登录态缓存。
- OCR 不新增用户上下文依赖。 - OCR 不新增用户上下文依赖。
- 生产代码必须在对应失败测试验证后再写入。 - 生产代码必须在对应失败测试验证后再写入。
......
# 低价单下单门店选择实施计划
1. 新增低价单门店上下文纯函数与单元测试,覆盖 `shopWithYqList` 多种返回结构、搜索、选择及提交字段。
2. 新增接口契约和页面集成失败测试,固定 9 个接口、低价单列表页签及参数传递行为。
3. 建立 `docs/migrations/low-price-order-store-selection` manifest、接口清单和验收矩阵,执行 pre 门禁。
4. 扩展 `order-prompt-pop` 为可选的两步低价单模式,在工作台接入门店加载、搜索、选择及支付确认。
5. 将门店上下文传入待补录分页、待补录统计和创建页;确保普通下单/补录提交含 `lowPriceFlag` 与 `sellerMerchantId`。
6. 切换列表/统计接口及审批页签映射,新增 `shopWithYqList` 封装并用于新建低价单第一步及筛选,保留详情 `lowPriceFlag`。
7. 同步精品工单接口文档、迁移验收文档,使用 Node 24 执行全量相关测试、闭包检查和 post 门禁。
# 新增工单客户档案与已选门店上下文实施计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 收敛客户档案提示,并保证精品工单新增页的门店相关查询持续使用前置弹框所选门店。
**Architecture:** 页面模板直接消费 `orderObj` 的低价门店上下文;路由/客户回显后重新覆盖该上下文;共享园区配置 getter 增加显式门店入参和按门店缓存。非低价流程保留原用户上下文兜底。
**Tech Stack:** 微信小程序 WXML/JavaScript、Node 24 `node:test`。
## Global Constraints
- 只修改精品工单迁移范围及共享 getter 的兼容扩展。
- `merchantId` 表示前置选择的 4S 店。
- `yqMerchantId/sellerMerchantId` 表示所属园区店。
- 不写死 sessionId,不提交或推送代码。
---
### Task 1: 客户档案单行入口
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/createOrder.wxml`
- Test: `tabWorkOrder/pages/createOrder/tests/customerProfileOnlyTemplate.test.mjs`
- [x] 增加失败测试,要求提示只出现一次、`iconSrc="{{ recordIcon }}"` 存在、客户档案组件绑定 `orderObj.merchantId`。
- [x] 运行目标测试并确认因重复提示、缺图标和错误门店绑定失败。
- [x] 修改 WXML:仅姓名行保留“请通过选择客户档案”,补图标,其余空值不显示重复提示。
- [x] 运行目标测试并确认通过。
### Task 2: 客户回显保留前置门店
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Test: `tabWorkOrder/pages/createOrder/tests/selectedMerchantContext.integration.test.mjs`
- [x] 增加失败测试,输入历史客户订单门店和当前低价门店时,结果必须保留当前低价门店。
- [x] 在 `setOrderObj` 写回数据后调用既有 `mergeLowPriceOrderContext` 覆盖门店字段。
- [x] 运行目标测试并确认通过。
### Task 3: 园区配置使用已选园区店
**Files:**
- Modify: `store/index.js`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Test: `tabWorkOrder/pages/createOrder/tests/orderSettingMerchantContext.test.mjs`
- Test support: `tests/work-order-migration/shims/mock-api.mjs`
- [x] 增加失败测试:显式选中园区店时只接受该园区店的配置响应,并拒绝复用其他园区缓存。
- [x] 扩展 `getYQorderInfo({ merchantId, merchantName })`,显式入参优先并记录缓存对应园区店。
- [x] 创建页 `getSetting()` 传入 `orderObj.yqMerchantId || orderObj.sellerMerchantId` 及对应名称;低价单缺少园区店时不回退固定用户。
- [x] 运行目标测试并确认通过。
### Task 4: 文档与完整验证
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
- Modify: `docs/tabWorkOrder/精品工单页面接口清单.md`
- [x] 同步客户档案入口、门店参数来源和园区配置缓存说明。
- [x] 使用 Node 24 运行 `npm run test:workOrder`。
- [x] 运行 `npm run check:migration -- --manifest docs/migrations/low-price-order-store-selection/manifest.json --phase post`。
- [x] 运行 `git diff --check` 并核对无缺失依赖、死路由和公共 API。
# 新增工单直接下单跳过业务守卫 Implementation Plan
> 已由 [2026-08-07 实施计划](./2026-08-07-direct-order-without-daily-guard.md) 取代;本文记录的 `newOrderGuardPolicy` 已从运行代码清理。
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让新增工单“直接下单”稳定跳过日报、学习任务和锁单业务守卫,同时保留订单数据校验。
**Architecture:** 由提交上下文表达直接下单语义,守卫策略同时识别提交上下文和原路由标记。异步前置校验只提前结束业务守卫部分,后续校验链不变。
**Tech Stack:** 微信小程序 JavaScript、Node 24 `node:test`。
## Global Constraints
- 只修改精品工单创建页提交守卫范围。
- 不跳过手机号配置、商品、必填、VIN、价格及总价校验。
- 不创建分支,不提交或推送代码。
---
### Task 1: 直接下单守卫策略
**Files:**
- Modify: `tests/work-order-migration/new-order-guard-policy.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/services/newOrderGuardPolicy.js`
- Modify: `tabWorkOrder/pages/createOrder/submitStrategy.js`
**Interfaces:**
- Consumes: `SubmitContext.execute(event)` 中的 `event.currentTarget.dataset.save`
- Produces: `shouldSkipOrderBusinessGuards(pageContext, submitContext): boolean`
- [x] 增加失败测试:`directSubmit=true` 必须跳过,`directSubmit=false` 且无入口标记时不得跳过。
- [x] 运行目标测试并确认当前策略对直接下单返回 `false`。
- [x] 扩展策略第二入参,并由 `SubmitContext` 传入 `directSubmit: !save`。
- [x] 运行目标测试和创建页测试并确认通过。
### Task 2: 文档和完整验证
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
- [x] 记录直接下单按钮语义,不再把跳过能力仅描述为入口参数。
- [x] 使用 Node 24 运行 `npm run test:workOrder`。
- [x] 运行迁移 post 门禁和 `git diff --check`。
# Low-price Order Popup and Staff Context Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让低价单收款方式在可用高度内完整滚动,并让销售顾问使用前一步选定的 4S 店及所属园区店。
**Architecture:** 弹层局部采用统一响应式高度、safe-area slot 和 flex scroll,不修改公共 Popup。低价单员工选择直接把 `orderObj` 中已选 4S 店作为唯一合作门店;非低价单仍通过用户园区上下文查询并过滤门店。
**Tech Stack:** 微信小程序 JavaScript、WXML、Sass/WXSS、Node.js 24、`node:test`
## Global Constraints
- 当前分支直接开发,不创建分支或 worktree。
- 只修改精品工单迁移闭包,不改变目标项目其他业务。
- 固定用户信息保持现状,sessionId 继续使用系统原登录态。
- 先运行失败测试,再写生产代码。
- 不提交或推送改动。
---
### Task 1: 低价单弹层可用高度与滚动
**Files:**
- Modify: `tests/work-order-migration/low-price-api-contract.test.mjs`
- Modify: `components/orderPromptPop/orderPromptPop.wxml`
- Modify: `components/orderPromptPop/orderPromptPop.js`
- Modify: `components/orderPromptPop/orderPromptPop.sass`
**Interfaces:**
- Consumes: `lowPriceMode`, `merchantHeight`, `currentStep`, `infoData.payFlag`
- Produces: 低价单统一 popup 高度、safe-area slot、固定头部和可滚动内容区
- [x] **Step 1: 写失败测试**
断言低价单高度不再依赖 `payFlag`,slot 高度包含 `env(safe-area-inset-bottom)`,且收款方式
内容位于启用 `scroll-y` 的 `scroll-view` 中。
- [x] **Step 2: 验证 RED**
Run: `node scripts/run-node-tests.mjs tests/work-order-migration/low-price-api-contract.test.mjs`
Expected: FAIL,因为当前第二步仍使用旧高度且收款区域是普通 `view`。
- [x] **Step 3: 最小实现**
将低价单两步的 popup 高度统一为 `merchantHeight`;slot 高度扣除 footer 和 safe-area;用
`.prompt-layout` 纵向 flex 包裹标题、步骤条及内容,收款方式改为占据剩余高度的
`scroll-view`,门店列表改为 flex 剩余高度滚动。
- [x] **Step 4: 验证 GREEN**
Run: `node scripts/run-node-tests.mjs tests/work-order-migration/low-price-api-contract.test.mjs`
Expected: PASS。
### Task 2: 销售顾问继承已选下单门店
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/tests/merchantStaffSelection.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/services/merchantStaffSelection.helpers.js`
- Modify: `tabWorkOrder/pages/createOrder/services/merchantStaffSelection.js`
**Interfaces:**
- Produces: `resolveStaffMerchantScope(orderObj, userContext): { parkMerchantId, shopMerchantId }`
- Consumes: `orderObj.lowPriceFlag/merchantId/yqMerchantId/sellerMerchantId` 和用户上下文兜底
- [x] **Step 1: 写失败测试**
用不同的用户默认门店和低价单所选门店构造数据,断言解析结果使用订单园区/4S 店;另写非
低价单断言确保仍使用用户上下文。
- [x] **Step 2: 验证 RED**
Run: `node scripts/run-node-tests.mjs tabWorkOrder/pages/createOrder/tests/merchantStaffSelection.test.mjs`
Expected: FAIL,因为 `resolveStaffMerchantScope` 尚不存在。
- [x] **Step 3: 最小实现并接线**
在纯函数层实现 `resolveStaffMerchantScope` 并导出;低价单 `fetchMerchantList` 直接返回
`orderObj.merchantId/merchantName` 组成的唯一门店。非低价单继续用解析出的
`parkMerchantId` 请求园区下 4S 店,并用 `shopMerchantId` 过滤。
- [x] **Step 4: 验证 GREEN**
Run: `node scripts/run-node-tests.mjs tabWorkOrder/pages/createOrder/tests/merchantStaffSelection.test.mjs`
Expected: PASS。
- [x] **Step 5: 增加空关联列表集成回归**
`merchantStaffSelection.integration.test.mjs` 模拟关联门店接口返回空数组,验证订单已有
4S 店仍作为唯一 active 合作门店返回。
### Task 3: 文档与完整验证
**Files:**
- Modify: `docs/order-lifecycle/test-acceptance.md`
- Modify: `docs/migrations/low-price-order-store-selection/test-acceptance.md`
**Interfaces:**
- Consumes: 两项回归的最终测试结果
- Produces: 更新后的验收场景和实际测试计数
- [x] **Step 1: 更新验收文档**
新增弹层滚动和销售顾问继承门店的验收项,并按实际输出更新测试计数。
- [x] **Step 2: 完整验证**
Run: `npm run test:workOrder`
Expected: 全部本地自动化通过,真实 API/UI 用例仅按安全开关跳过。
- [x] **Step 3: 迁移后置门禁与格式检查**
Run: `npm run check:migration -- --manifest docs/migrations/low-price-order-store-selection/manifest.json --phase post`
Run: `git diff --check`
Expected: 两条命令均退出 0。
# 新增工单直接下单不调用日报接口 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 保证新增工单页面点击“直接下单”时不调用 `dj.api.smartcarlife.staff.daily.report.popup.need`,而是在订单数据校验通过后直接调用既有下单接口。
**Architecture:** 从创建页依赖闭包中移除 `ModalToQueueControl` 和异步业务守卫策略,把手机号配置处理保留在 `SubmitContext.execute` 的本地校验入口。使用 Node ESM loader 构造依赖边界测试,只要创建页重新导入业务守卫模块就失败。
**Tech Stack:** 微信小程序 JavaScript、Node.js 24、`node:test`、ESM loader、现有迁移检查脚本。
## Global Constraints
- 仅修改精品工单迁移涉及的新增工单创建页;其他页面原有业务守卫不动。
- 固定使用 Node.js 24 LTS 测试,不兼容 Node.js 14。
- 保留手机号配置、必填项、商品、VIN、错单金额和总价校验。
- 保留现有下单接口选择及请求参数处理。
- 在当前分支实施,不创建分支、不提交。
---
### Task 1: 创建页业务守卫依赖边界
**Files:**
- Create: `tests/work-order-migration/shims/create-order-without-business-guards-loader.mjs`
- Create: `tests/work-order-migration/direct-order-without-daily-guard.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Modify: `tabWorkOrder/pages/createOrder/submitStrategy.js`
**Interfaces:**
- Consumes: `SubmitContext.execute(event)`、创建页 `Page` 配置和现有 `create-order-context-loader` 解析规则。
- Produces: 创建页依赖闭包不包含 `~/store/ModalToQueueControl`;提交入口继续调用 `checkPhoneUseConfig()` 后执行本地订单校验。
- [x] **Step 1: 写依赖边界失败测试**
新 loader 复用创建页测试的 API/util 替身与路径补全逻辑,但在解析
`~/store/ModalToQueueControl` 时抛出 `FORBIDDEN_CREATE_ORDER_BUSINESS_GUARD`。测试注册 loader、准备微信小程序全局对象,并导入 `createOrder.js`;导入成功且 `Page` 暴露 `submit` 才通过。
- [x] **Step 2: 运行测试并确认 RED**
Run:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' --experimental-detect-module --test tests/work-order-migration/direct-order-without-daily-guard.test.mjs
```
Expected: FAIL,错误包含 `FORBIDDEN_CREATE_ORDER_BUSINESS_GUARD`,证明当前创建页仍加载业务守卫模块。
- [x] **Step 3: 最小化移除创建页业务守卫调用**
从 `createOrder.js` 删除未使用的 `checkDailyReport/checkStudyTask` 导入;从
`submitStrategy.js` 删除 `ModalToQueueControl`、异常流水锁单和
`newOrderGuardPolicy` 导入及 `AsyncPreCheckStrategy`。在
`SubmitContext.execute` 构建本地策略数组之前直接调用:
```js
this.page.checkPhoneUseConfig()
```
策略数组从 `StatePermissionStrategy` 开始,其余订单数据校验和 `finishSubmit(save)` 保持不变。
- [x] **Step 4: 运行测试并确认 GREEN**
Run: 与 Step 2 相同。
Expected: PASS。
- [x] **Step 5: 运行创建页和迁移回归测试**
Run:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' run test:createOrder
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' run test:workOrderMigration
```
Expected: 全部通过。
### Task 2: 文档与完整迁移验收
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
- Modify: `docs/tabWorkOrder/createOrder.md`
- Modify: `docs/tabWorkOrder/精品工单页面接口清单.md`
**Interfaces:**
- Consumes: Task 1 确立的创建页依赖边界和回归测试。
- Produces: 与实际代码一致的流程、接口范围和验收证据。
- [x] **Step 1: 同步流程和接口文档**
把“按标记跳过日报等业务守卫”更新为“创建页不加载该组守卫”;明确公共日报接口仍供其他页面使用,创建页直接下单不会调用它。
- [x] **Step 2: 运行完整精品工单测试**
Run:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' run test:workOrder
```
Expected: 所有非 live 测试通过,live 测试按环境条件跳过。
- [x] **Step 3: 执行迁移 post 门禁和差异检查**
Run:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' scripts/check-migration-readiness.mjs --manifest docs/migrations/low-price-order-store-selection/manifest.json --phase post
git diff --check
```
Expected: post 门禁通过,`git diff --check` 无错误。
- [x] **Step 4: 自检影响范围**
确认 `tabWorkOrder/pages/createOrder` 不再引用 `checkDailyReport`,同时
`orderDetail.js` 等其他页面保留原有业务守卫调用;不暂存、不提交当前分支修改。
# 工单详情隐藏确认施工按钮 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让工单详情页不再渲染“确认订单是否施工”按钮。
**Architecture:** 沿用详情页隐藏“查看施工单”的模板边界方案,只移除确认施工按钮节点。保留详情状态查询和兼容 JavaScript 方法,不扩大到其他页面或公共 API。
**Tech Stack:** 微信小程序 WXML、Node.js 24、`node:test`。
## Global Constraints
- 仅修改 `tabWorkOrder/pages/orderDetail/orderDetail` 的用户可见按钮。
- 不修改工单确认页、列表页或公共施工接口。
- 保留详情状态提示、标错和刷新逻辑。
- 在当前分支实施,不提交、不推送。
---
### Task 1: 隐藏详情页确认施工入口
**Files:**
- Modify: `tests/work-order-migration/order-detail-scope.test.mjs`
- Modify: `tabWorkOrder/pages/orderDetail/orderDetail.wxml`
- Modify: `docs/order-lifecycle/test-acceptance.md`
**Interfaces:**
- Consumes: `confirmFlagObj` 详情状态和现有 `orderDetail.wxml` 底部操作区。
- Produces: 详情模板不再绑定 `confirmConstruction`,其他详情状态和操作保持原样。
- [x] **Step 1: 写失败测试**
将原“保留确认施工”测试改为“详情页不渲染确认施工按钮”,断言模板不包含:
```js
assert.doesNotMatch(template, /btnName == ['"]confirmConstruction['"]/)
assert.doesNotMatch(template, /bindtap=['"]confirmConstruction['"]/)
```
- [x] **Step 2: 运行测试确认 RED**
Run:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' --test tests/work-order-migration/order-detail-scope.test.mjs
```
Expected: FAIL,当前模板仍包含 `confirmConstruction` 条件或点击绑定。
- [x] **Step 3: 删除按钮节点**
从 `orderDetail.wxml` 删除包含 `confirmFlagObj.showBtn` 的底部按钮容器及其中
`bindtap="confirmConstruction"` 节点,不修改其他模板内容。
- [x] **Step 4: 运行测试确认 GREEN**
Run: 与 Step 2 相同。
Expected: 详情页范围测试全部通过。
- [x] **Step 5: 同步验收文档并完整验证**
把 AC-23 更新为详情页不展示确认施工按钮,然后运行:
```powershell
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' run test:workOrder
& 'C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' run check:migration -- --manifest docs/migrations/low-price-order-store-selection/manifest.json --phase post
git diff --check
```
Expected: 自动化无失败、迁移 post 门禁通过、差异检查通过。
# 低价提单商品价格校验 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 让低价提单只允许提交已开启最低价且录入价严格低于最低价的商品,并在选品后回显最低价。
**Architecture:** 使用独立纯函数展开普通商品、SKU 和套餐子项并执行统一规则;创建页仅在 `lowPriceFlag=1` 时把规则接入选品、输入、失焦和提交。商品行组件消费校验器生成的最低价展示文本,普通工单逻辑保持不变。
**Tech Stack:** 微信小程序 JavaScript/WXML/Sass、Node.js 24 `node:test`
## Global Constraints
- 统一提醒文案必须为“价格未触发最低价,其他正常单请到生意助手侧录单”。
- 合法价格必须严格小于 `minSellPrice`,等于最低价也不允许提交。
- 只修改本次迁移的 `lowPriceFlag=1` 链路,不改变普通工单最低价规则。
- 当前分支直接开发,不创建分支、提交或推送。
---
### Task 1: 低价商品规则
**Files:**
- Create: `tabWorkOrder/pages/createOrder/services/lowPriceGoodsValidation.helpers.js`
- Create: `tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.helpers.test.mjs`
**Interfaces:**
- Produces: `LOW_PRICE_NOT_TRIGGERED_MESSAGE`、`resolveLowPriceGoodsEntries(goodsList)`、`validateLowPriceGoods(goods)`、`validateLowPriceGoodsList(goodsList)`、`applyLowPriceGoodsValidation(goodsList)`。
- [x] **Step 1: 写失败测试**:用手工 fixture 覆盖普通商品、SKU、套餐以及未开启、缺字段、空价格、等于、高于和低于边界。
- [x] **Step 2: 验证红灯**:运行 `node scripts/run-node-tests.mjs tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.helpers.test.mjs`,预期因模块不存在失败。
- [x] **Step 3: 最小实现**:展开叶子商品,按 `basePrice/sellPrice/price` 解析当前价,严格比较 `currentPrice < minSellPrice`,同步 `lowPriceMinPriceText/errorTarget/checkError/basePriceError`。
- [x] **Step 4: 验证绿灯**:重复运行定向测试,预期全部通过。
### Task 2: 创建页实时与提交接入
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Modify: `tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.integration.test.mjs`
**Interfaces:**
- Consumes: Task 1 的校验常量和函数。
- Produces: 选品确认后静默回显、普通商品/SKU/套餐子项改价提示、低价单失焦状态及提交阻断。
- [x] **Step 1: 写失败集成契约**:验证创建页只在 `lowPriceFlag=1` 调用低价规则,输入时使用统一提醒,提交前重新校验。
- [x] **Step 2: 验证红灯**:运行新集成测试,预期缺少页面接入而失败。
- [x] **Step 3: 最小接入**:在 `chooseGoods`、`changePrice`、`changeMealPrice`、`priceBlur`、`checkGoods` 和 `setGoodsTotal` 接入规则,普通单继续走旧分支。
- [x] **Step 4: 验证绿灯**:运行低价规则与集成测试,预期全部通过。
### Task 3: 商品行最低价回显
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/createOrder.wxml`
- Modify: `tabWorkOrder/pages/createOrder/components/OrderGoodsRow/order-goods-row.js`
- Modify: `tabWorkOrder/pages/createOrder/components/OrderGoodsRow/order-goods-row.wxml`
- Modify: `tabWorkOrder/pages/createOrder/components/OrderGoodsRow/order-goods-row.sass`
- Modify: `tabWorkOrder/pages/createOrder/tests/lowPriceGoodsValidation.integration.test.mjs`
**Interfaces:**
- Consumes: Task 1 写入叶子商品的 `lowPriceMinPriceText`。
- Produces: 仅低价单可见的“最低价:¥金额/未开启”商品行。
- [x] **Step 1: 写失败模板契约**:验证所有商品行传入 `lowPriceFlag`,组件只在低价单渲染最低价文本。
- [x] **Step 2: 验证红灯**:运行集成测试,预期模板尚未接线而失败。
- [x] **Step 3: 最小实现**:增加组件属性、WXML 展示与辅助样式,并为创建页全部 `order-goods-row` 实例传值。
- [x] **Step 4: 验证绿灯**:运行创建页测试,预期全部通过。
### Task 4: 文档与迁移验收
**Files:**
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
- Modify: `docs/tabWorkOrder/精品工单页面接口清单.md`
- Modify: `docs/migrations/low-price-order-store-selection/test-acceptance.md`
- Modify: `docs/migrations/low-price-order-store-selection/manifest.json`
**Interfaces:**
- Consumes: Tasks 1-3 的最终行为和测试文件。
- Produces: 可追溯规则、验收项和 post 门禁证据。
- [x] **Step 1: 同步规则与边界**:记录启用字段、严格小于、统一提示、三类商品和普通单隔离。
- [x] **Step 2: 更新 manifest 测试证据**:加入低价商品规则测试并标记最终状态为 `pass`。
- [x] **Step 3: 完整验证**:依次运行定向测试、`npm run test:workOrder`、`npm run check:workOrderClosure`、`git diff --check` 和迁移 post 门禁。
# 低价提单列表视觉改造 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 将工作台入口和低价单列表按设计稿统一为“低价提单”,并以最新 Swagger 返回模型驱动列表字段。
**Architecture:** 保留现有列表接口、分页、审批统计、新建与详情路由,只替换菜单资源和低价提单专属 WXML/Sass 展示层。通过源代码契约测试锁定菜单、搜索栏、卡片字段及 Swagger 字段来源,避免回退到旧通用工单卡片。
**Tech Stack:** 微信小程序 WXML/WXSS(Sass)、JavaScript、Node.js 24、`node:test`
## Global Constraints
- 仅在当前分支工作,不创建分支或 worktree。
- 不提交、不推送、不覆盖工作区既有用户改动。
- Node.js 固定使用 24 LTS。
- 列表接口固定为 `order.search.containPackageGoods.byArea`,统计接口固定为 `order.statByApplyStatus`。
- 两个接口固定携带 `sceneType=1`、`lowPriceFlag=1`。
- 保留新建低价单、详情跳转、分页刷新和撤销能力。
---
### Task 1: 锁定菜单和列表展示契约
**Files:**
- Modify: `tests/work-order-migration/workspace-source-contract.test.mjs`
- Modify: `tests/work-order-migration/work-order-list-page.test.mjs`
**Interfaces:**
- Consumes: 工作台 `storeManagementMenus` 与列表 WXML/Sass 源码。
- Produces: 菜单名称/图标、关键词搜索、无筛选按钮、低价卡片字段的失败测试。
- [ ] **Step 1: 更新工作台菜单测试**
将菜单断言改为:
```js
{
name: '低价提单',
path: '/pages/tabWorkOrder/pages/index/index',
iconUrl: '/images/low-price-order.png',
trackingCode: 'regional-assistant-customer-work-order'
}
```
- [ ] **Step 2: 增加列表模板契约**
断言导航标题包含“低价提单”、输入框为 `placeholder="关键词"`、模板不包含
`bindtap="showConfirm"` 和 `search-filter`,并包含“订单类型、销售顾问、转化人员、工单编号、
工单时间”及 `low-price-view`。
- [ ] **Step 3: 运行测试确认失败**
Run:
```powershell
node scripts/run-node-tests.mjs tests/work-order-migration/workspace-source-contract.test.mjs tests/work-order-migration/work-order-list-page.test.mjs
```
Expected: 旧菜单名称、旧图标、旧搜索提示和旧卡片模板导致断言失败。
### Task 2: 替换工作台菜单资源
**Files:**
- Create: `images/low-price-order.png`
- Modify: `pages/tab/workspace/workspace.js`
- Test: `tests/work-order-migration/workspace-source-contract.test.mjs`
**Interfaces:**
- Consumes: 产品提供的 72×72 PNG。
- Produces: 名为“低价提单”的工作台菜单,路由与历史埋点保持不变。
- [ ] **Step 1: 复制并校验图标**
将 `C:/Users/admin/AppData/Local/Temp/codex-clipboard-a5d46ac1-5437-435a-8090-378af68eb95d.png`
复制到 `images/low-price-order.png`,校验 PNG 签名和 72×72 尺寸。
- [ ] **Step 2: 更新菜单配置**
把 `name` 改为“低价提单”,把 `iconUrl` 改为 `/images/low-price-order.png`,其余路由和
埋点字段不变。
- [ ] **Step 3: 运行菜单测试确认通过**
Run:
```powershell
node scripts/run-node-tests.mjs tests/work-order-migration/workspace-source-contract.test.mjs
```
Expected: PASS。
### Task 3: 实现 Swagger 驱动的低价提单卡片
**Files:**
- Modify: `pages/tabWorkOrder/pages/index/index.js`
- Modify: `pages/tabWorkOrder/pages/index/index.wxml`
- Modify: `pages/tabWorkOrder/pages/index/index.sass`
- Test: `tests/work-order-migration/work-order-list-page.test.mjs`
- Test: `tests/work-order-migration/low-price-api-contract.test.mjs`
**Interfaces:**
- Consumes: `GoodsOrderDTO.customer.customerName`、`merchantName`、`employeeName`、
`sellerMerchantName`、`sellerName`、`orderCode`、`orderTime`、`goodsOrderApplyStatus`。
- Produces: 设计稿对应的低价提单列表卡片。
- [ ] **Step 1: 收敛展示数据**
在接口结果归一化时生成:
```js
e.lowPriceOrderTypeText = '低价订单'
e.salesConsultantText = [e.merchantName, e.employeeName].filter(Boolean).join('|')
e.conversionStaffText = [e.sellerMerchantName, e.sellerName].filter(Boolean).join('|')
```
审批文案改为 `1/2=待审批`、`3=已通过`、`4=已驳回`,颜色沿用现有黄/绿/红映射。
- [ ] **Step 2: 替换列表模板**
导航标题改为“低价提单”;搜索提示改为“关键词”并删除右侧筛选节点。将旧商品、支付、
出库和异常信息卡片替换为固定五行信息及底部“查看”按钮,客户名使用
`li.customer.customerName || '--'`。
- [ ] **Step 3: 按设计稿重写专属样式**
使用浅灰列表背景、20rpx 外间距、24rpx 卡片圆角、32rpx 内边距、灰色字段名、单行省略
值、浅蓝查看按钮;搜索框改为全宽。保留 `.touch-item/.del/.low-price-create` 的交互样式。
- [ ] **Step 4: 运行列表和接口测试确认通过**
Run:
```powershell
node scripts/run-node-tests.mjs tests/work-order-migration/work-order-list-page.test.mjs tests/work-order-migration/low-price-api-contract.test.mjs
```
Expected: PASS。
### Task 4: 同步接口清单与验收说明
**Files:**
- Modify: `docs/tabWorkOrder/精品工单页面接口清单.md`
- Modify: `docs/order-creation/README.md`
- Modify: `docs/order-lifecycle/README.md`
- Modify: `docs/order-lifecycle/test-acceptance.md`
**Interfaces:**
- Consumes: 开发 Swagger 的两个响应模型及已完成页面行为。
- Produces: 统一使用“低价提单”的菜单/页面说明和 Swagger 字段映射。
- [ ] **Step 1: 更新可见名称和交互说明**
将菜单和页面语境中的“客户工单/低价单列表”更新为“低价提单”,记录搜索提示为“关键词”
且无筛选按钮。
- [ ] **Step 2: 记录 Swagger 响应契约**
在接口清单写明列表返回 `RpcPagination<GoodsOrderDTO>`、统计返回
`GoodsOrderApplyStatDTO(totalCount/pendingCount/passCount/rejectCount)`,并列出卡片字段映射。
### Task 5: 全量验证
**Files:**
- Verify: `docs/migrations/low-price-order-store-selection/manifest.json`
**Interfaces:**
- Consumes: 本计划全部实现与现有迁移闭包。
- Produces: 可复核的测试和迁移门禁结果。
- [ ] **Step 1: 运行格式和静态检查**
用 Prettier 检查改动的 JS/WXML/Sass/Markdown 文件,并解析 JSON、JS、WXML/WXSS。
- [ ] **Step 2: 运行工作单测试集合**
Run:
```powershell
npm run test:workOrder
```
Expected: PASS。
- [ ] **Step 3: 运行迁移后置门禁**
Run:
```powershell
npm run check:migration -- --manifest docs/migrations/low-price-order-store-selection/manifest.json --phase post
```
Expected: PASS,或只报告 manifest 已登记且不阻塞的人工验证项。
### Task 6: 产品后续入口调整
**Files:**
- Create: `images/new-low-price-order.png`
- Modify: `pages/tab/workspace/workspace.js`
- Modify: `pages/tabWorkOrder/pages/index/index.wxml`
- Modify: `tests/work-order-migration/workspace-source-contract.test.mjs`
- Modify: `tests/work-order-migration/work-order-list-page.test.mjs`
**Interfaces:**
- Consumes: 产品提供的 56×56 “新建低价单” PNG。
- Produces: 隐藏工作台“新增工单”菜单、以“低价提单”为首个工单入口,并替换列表右下角图标。
- [x] **Step 1: 先更新菜单与图标契约测试并确认失败**
- [x] **Step 2: 从 `storeManagementMenus` 删除“新增工单”,保留列表新建流程**
- [x] **Step 3: 将产品 PNG 复制为 `/images/new-low-price-order.png` 并更新 WXML 引用**
- [x] **Step 4: 运行定向测试确认通过**
# 固定用户 SessionId 模拟设计 # 固定 SessionId 模拟撤销说明
## 目标 ## 当前结论
登录功能尚未迁入期间,固定用户必须始终配套使用本任务指定的固定 sessionId。精品工单及 原固定 sessionId 方案已经撤销。登录功能尚未迁入期间只保留固定用户信息模拟,会话继续
其他通过公共请求层发出的请求,不得继续读取旧登录流程遗留的 sessionId。 沿用目标项目原有登录态,不再由 `utils/fixedUserInfoMock.js` 生成、返回或写入缓存。
固定 sessionId 只在运行时代码的固定身份模块中保存一份;设计文档、验收文档和日志不 ## 当前数据流
重复输出完整值。
## 范围 1. `App.onLaunch()` 只把固定用户的独立副本写入旧、新用户缓存。
2. `wx.$util.getUserInfo()` 继续返回固定用户副本,支持精品工单本地流程。
3. `wx.$util.getSessionId()` 直接读取系统原有 `dj_boutique_sessionId`。
4. 固定用户安装器不读取或写入 `dj_boutique_sessionId`、`sessionId`。
5. 公共请求层、签名算法和登录接口保持原有行为。
- 扩展现有 `utils/fixedUserInfoMock.js`,让固定用户和固定 sessionId 共用 ## 范围与安全
`FIXED_USER_INFO_MOCK_ENABLED` 开关。
- `wx.$util.getSessionId()` 在模拟开启时始终返回固定 sessionId。
- `App.onLaunch()` 在初始化固定用户时,同时预热旧缓存
`dj_boutique_sessionId` 和当前环境缓存 `sessionId`。
- 保留模拟关闭后的现有缓存读取行为,供后续登录迁移恢复使用。
- 不修改请求参数结构、签名算法、登录接口或精品工单业务判断。
## 数据流 - 不在仓库、日志或测试输出中保存指定会话值。
- 不修改请求参数结构和精品工单业务参数。
- 固定用户仅提供临时用户与默认门店上下文,不能替代真实环境授权。
- 真实 API/UI 测试仍需系统登录态、显式安全开关和受控测试数据。
1. 小程序启动并挂载 `wx.$storage`、`wx.$util`。 ## 自动化证据
2. 固定身份安装器生成固定用户副本,并向旧、新用户缓存各写入一份独立副本。
3. 同一安装器把固定 sessionId 写入旧、新 session 缓存。
4. 请求层继续调用现有 `util.getSessionId()`;模拟开启时 getter 直接返回固定值,因此旧
缓存被覆盖、删除或尚未初始化都不会改变请求使用的 sessionId。
5. 模拟关闭时,用户和 session getter 都回退到原有缓存读取逻辑。
## 接口设计 `tests/work-order-migration/fixed-user-info-mock.test.mjs` 验证:
`utils/fixedUserInfoMock.js` 新增: 1. 用户 getter 返回互不影响的固定用户副本。
2. 启动时只初始化旧、新用户缓存。
- `createFixedSessionId(): string`:返回固定 sessionId。 3. session getter 保持系统原有缓存读取实现。
- `resolveRuntimeSessionId(readStoredSessionId: Function): string`:模拟开启时返回固定值, 4. 固定用户安装器不会覆盖旧、新 session 缓存。
关闭时调用原缓存读取函数。
- `installFixedUserInfoMock(...)` 增加两个 writer:
`setLegacySessionId(value)` 和 `setCurrentSessionId(value)`。
安装器仍返回固定用户副本,不改变现有调用方对返回值的使用。
## 异常与安全
- 不新增 sessionId 日志。
- 固定 sessionId 不进入验收文档、实施计划或测试失败消息。
- 缓存写入沿用现有同步存储封装,不新增网络请求。
- 真实 API 测试的安全开关和授权校验保持不变;固定 sessionId 只服务当前固定用户模拟。
## 测试
在现有 `fixed-user-info-mock.test.mjs` 中先增加失败测试,再实现代码:
1. 模拟开启时,session resolver 不读取旧缓存并返回固定值。
2. 固定用户安装器同时写入旧、新 session 缓存。
3. 用户与 session 共享模拟开关,原用户副本隔离测试继续通过。
4. 执行 `npm run test:workOrder`、JavaScript 语法检查、静态依赖闭包和
`git diff --check`。
## 完成标准
- 所有公共请求通过 `util.getSessionId()` 获得固定用户对应的 sessionId。
- 两套 session 缓存均在启动时完成初始化。
- 模拟关闭路径仍保留原缓存读取逻辑。
- 自动化测试、静态闭包和格式检查全部通过。
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
- 不修改工作台其他菜单、工单列表、详情和目标项目原有功能。 - 不修改工作台其他菜单、工单列表、详情和目标项目原有功能。
- 不改变日报、学习任务和异常锁单守卫;工作台新建入口仍通过 `skipOrderGuards=true` 跳过。 - 不改变日报、学习任务和异常锁单守卫;工作台新建入口仍通过 `skipOrderGuards=true` 跳过。
- 不改变扫码礼券兼容分支依赖的 `userType` 判断。 - 不改变扫码礼券兼容分支依赖的 `userType` 判断。
- 不改变统一请求层的 session 注入;固定 sessionId 继续由现有运行时模拟提供。 - 不改变统一请求层的 session 注入;sessionId 继续来自系统原有登录态缓存,固定用户模拟不参与。
- OCR 不读取用户上下文,不增加无效依赖。 - OCR 不读取用户上下文,不增加无效依赖。
## 错误与空值处理 ## 错误与空值处理
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
复用工作台现有 `order-prompt-pop`,新增 `lowPriceMode` 两步模式: 复用工作台现有 `order-prompt-pop`,新增 `lowPriceMode` 两步模式:
1. 打开弹层后调用 `dj.api.smartcarlife.serviceMerchant.curYqList`,展示接口返回的 4S 店列表。 1. 打开弹层后以 `sceneType=1` 调用 `dj.api.smartcarlife.serviceMerchant.shopWithYqList`,展示当前账号关联的 4S 店列表。
2. 第一步标题为“新建低价单”,步骤为“选择下单门店 / 订单收款方式”;支持按门店名称搜索、单选、取消和下一步。 2. 第一步标题为“新建低价单”,步骤为“选择下单门店 / 订单收款方式”;支持按门店名称搜索、单选、取消和下一步。
3. 未选择门店时禁止进入下一步并提示“请选择下单门店”。 3. 未选择门店时禁止进入下一步并提示“请选择下单门店”。
4. 第二步复用现有未支付、已支付及已支付子收款方式;可返回第一步,确认时一起返回收款方式和门店上下文。 4. 第二步复用现有未支付、已支付及已支付子收款方式;可返回第一步,确认时一起返回收款方式和门店上下文。
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
} }
``` ```
`curYqList` 返回结构通过纯函数归一化。优先识别园区对象内的 4S 店数组,同时兼容直接返回 4S 店行的结构;缺少园区字段时使用该行的园区/商户标识,但不读取全局用户默认门店。`lowPriceFlag` 按现有管理端契约使用数值 `1`。 `shopWithYqList` 返回结构通过纯函数归一化。优先识别园区对象内的 4S 店数组,同时兼容直接返回 4S 店行的结构;缺少园区字段时使用该行的园区/商户标识,但不读取全局用户默认门店。`lowPriceFlag` 按现有管理端契约使用数值 `1`。
工作台把该上下文合并进路由参数。若选择嘀加二维码补录,待补录弹层收到同一上下文后请求列表;选定流水后仍将同一上下文传到创建页。 工作台把该上下文合并进路由参数。若选择嘀加二维码补录,待补录弹层收到同一上下文后请求列表;选定流水后仍将同一上下文传到创建页。
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
| 待补录统计 | `dj.api.smartcarlife.weapp.waitinputorder.count` | 增加 `lowPriceFlag`、`yqMerchantId` | | 待补录统计 | `dj.api.smartcarlife.weapp.waitinputorder.count` | 增加 `lowPriceFlag`、`yqMerchantId` |
| 普通下单 | `dj.api.smartcarlife.order.createWithPay` | 提交 `lowPriceFlag`、`sellerMerchantId` | | 普通下单 | `dj.api.smartcarlife.order.createWithPay` | 提交 `lowPriceFlag`、`sellerMerchantId` |
| 订单补录 | `dj.api.smartcarlife.order.supplementOrder` | 提交 `lowPriceFlag`、`sellerMerchantId` | | 订单补录 | `dj.api.smartcarlife.order.supplementOrder` | 提交 `lowPriceFlag`、`sellerMerchantId` |
| 下单门店 | `dj.api.smartcarlife.serviceMerchant.curYqList` | 加载可下单 4S 店及所属园区店 | | 当前账号可见园区店 | `dj.api.smartcarlife.serviceMerchant.curYqList` | 保留创建页非销售类人员选择使用,不作为低价单下单门店来源 |
| 账号关联门店 | `dj.api.smartcarlife.serviceMerchant.shopWithYqList` | 新增公共封装,供列表筛选/后续复用 | | 下单门店/账号关联门店 | `dj.api.smartcarlife.serviceMerchant.shopWithYqList` | 必传 `sceneType=1`,加载可下单 4S 店及所属园区店,同时供低价单筛选复用 |
| 订单详情 | `dj.api.smartcarlife.order.detail` | 保留返回的 `lowPriceFlag`,回显/再次进入时不丢失 | | 订单详情 | `dj.api.smartcarlife.order.detail` | 保留返回的 `lowPriceFlag`,回显/再次进入时不丢失 |
低价单列表页签改为“全部、待审批、已通过、已驳回”。待审批映射审批状态 `1,2`,已通过映射 `3`,已驳回映射 `4`。统计返回字段通过适配器兼容常见命名,避免页面直接绑定后端字段名。 低价单列表页签改为“全部、待审批、已通过、已驳回”。待审批映射审批状态 `1,2`,已通过映射 `3`,已驳回映射 `4`。统计返回字段通过适配器兼容常见命名,避免页面直接绑定后端字段名。
...@@ -57,4 +57,3 @@ ...@@ -57,4 +57,3 @@
## 测试与门禁 ## 测试与门禁
先增加失败测试覆盖门店归一化、搜索、步骤切换、工作台参数传递、待补录入参、创建页初始化和接口 method;确认红灯后创建迁移 manifest 并通过 pre 门禁,再改业务代码。完成后使用 Node 24 运行精品工单迁移、创建页、订单生命周期与静态闭包检查,最后执行 post 门禁并同步接口清单和验收文档。 先增加失败测试覆盖门店归一化、搜索、步骤切换、工作台参数传递、待补录入参、创建页初始化和接口 method;确认红灯后创建迁移 manifest 并通过 pre 门禁,再改业务代码。完成后使用 Node 24 运行精品工单迁移、创建页、订单生命周期与静态闭包检查,最后执行 post 门禁并同步接口清单和验收文档。
# 新增工单客户档案与已选门店上下文设计
## 目标
精品工单从前置弹框选择 4S 店及所属园区店后,新增工单页所有门店相关查询必须继续使用该选择结果,不得回退到固定用户默认门店。客户信息区只保留一处客户档案空态提示,并恢复客户档案图标。
## 页面行为
1. “车主姓名”行显示客户档案入口,入口前使用 `record.png` 图标。
2. 未选客户时仅“车主姓名”行显示“请通过选择客户档案”。手机号、车型、VIN、车牌等行保持空值,不重复提示。
3. 选中客户档案后继续回显实际客户字段;客户信息仍不可在页面内手工编辑。
## 门店上下文
低价单门店字段含义固定为:
```js
{
merchantId, // 前置弹框选中的 4S 店
merchantName,
yqMerchantId, // 该 4S 店所属园区店
yqMerchantName,
sellerMerchantId: yqMerchantId,
sellerMerchantName: yqMerchantName
}
```
- 客户档案列表组件的 `merchantId` 直接绑定 `orderObj.merchantId`。
- 客户档案回显或路由数据写回时,低价单门店上下文以进入页面时的选择结果为准,历史订单数据不得覆盖。
- 园区订单字段配置使用 `orderObj.yqMerchantId || orderObj.sellerMerchantId` 查询,并按园区店 ID 区分缓存。
- 场景、商品、礼券、支付配置、积分配置、员工和待补录保持现有 `orderObj` 门店参数链路。
- 非低价旧流程保留用户上下文兜底,避免扩大迁移影响范围。
## 测试
1. 模板回归验证提示只出现一次、图标存在、客户档案组件绑定已选 4S 店。
2. 低价门店上下文回归验证客户档案/历史数据不能覆盖前置选择。
3. 园区配置回归验证显式园区店参数优先于固定用户,并避免复用其他园区缓存。
4. 使用 Node 24 执行创建页、迁移、生命周期、静态闭包及迁移 post 门禁。
# 新增工单直接下单跳过业务守卫设计
> 已由 [2026-08-07 创建页无日报守卫设计](./2026-08-07-direct-order-without-daily-guard-design.md) 取代。旧的运行时参数分支已删除,本文仅保留为历史决策记录。
## 目标
新增工单页点击“直接下单”时,不执行昨日日报、学习任务、异常订单或异常流水锁单校验。
手机号配置、商品、必填字段、VIN、价格、错单金额和订单总价校验继续执行。
## 根因
`AsyncPreCheckStrategy` 当前只依赖页面路由参数 `skipOrderGuards`。该参数属于入口状态,
不能稳定表达用户点击的是“直接下单”按钮;入口未携带或序列化丢失时,提交会重新进入业务守卫。
## 方案
扩展 `shouldSkipOrderBusinessGuards(pageContext, submitContext)`:保留既有路由标记兼容,
同时当 `submitContext.directSubmit === true` 时跳过业务守卫。`SubmitContext.execute` 根据
`dataset.save` 计算 `directSubmit`,并把提交上下文交给异步前置校验。
该判断只包围日报、学习任务和锁单校验;后续校验策略顺序及提交接口保持不变。
## 验证
- 策略单测覆盖直接下单、建档和既有路由标记。
- 创建页回归确认非业务校验链仍在。
- 运行精品工单全套测试、静态闭包和迁移 post 门禁。
# 低价单弹层与销售顾问门店上下文修复设计
## 目标
修复新建低价单流程的两个回归:订单收款方式内容在小屏或安全区设备上被底部按钮遮挡且
无法滚动;进入下单页后,销售顾问选择没有使用前一步选定的 4S 店和所属园区店。
## 范围
- 只修改低价单两步弹层的高度、slot 安全区和内容滚动布局。
- 销售顾问及交付专员加载门店时,低价单优先使用订单中已经选定的园区店和 4S 店。
- 非低价单员工选择继续使用现有用户上下文,不改变原有页面行为。
- 固定用户模拟、系统 session、下单接口参数和公共 Popup 组件不做扩展重构。
## 弹层布局
低价单第一步和第二步统一使用 `merchantHeight` 的响应式高度,不再根据收款选项切换旧的
`500rpx/1020rpx` 高度。传给公共 Popup 的 slot 高度扣除固定 footer 和
`env(safe-area-inset-bottom)`,避免全屏设备上的底部安全区挤占内容。
slot 内新增占满可用高度的纵向 flex 容器:标题和步骤条固定,门店列表或收款方式区域占用
剩余高度。收款方式使用纵向 `scroll-view`;门店搜索固定,门店列表继续独立滚动。底部取消、
下一步和确认按钮仍由公共 Popup 渲染,不随内容滚动。
## 销售顾问门店上下文
新增一个纯函数解析员工选择范围:
- 低价单园区店:`orderObj.yqMerchantId || orderObj.sellerMerchantId`。
- 低价单 4S 店:`orderObj.merchantId`。
- 任一关键值缺失时分别回退 `userContext.parkMerchantId` 和
`userContext.shopMerchantId`。
- 非低价单完全使用原用户上下文。
低价单销售顾问/交付专员直接把 `orderObj.merchantId/merchantName` 组装成唯一合作门店,
不再依赖“园区关联 4S 店”接口再次返回该门店;员工接口继续使用该 4S 店 ID。这样即使关联
列表因登录权限为空,也不会丢失前一步选择结果。非低价单继续用解析后的用户园区和 4S 店
执行原查询、过滤逻辑,转化人员逻辑保持不变。
## 错误处理
门店或员工接口失败仍使用现有 toast 和关闭/留在弹层策略。所选园区或 4S 店缺失时继续走
原用户上下文兜底,不新增阻断提示。
## 测试
1. 纯函数测试证明低价单优先解析所选园区和 4S 店,非低价单保持用户上下文。
2. 服务集成测试证明关联门店接口为空时,低价单仍返回前一步选择的唯一 active 4S 店。
3. 低价单弹层契约测试证明两步使用统一响应式高度、slot 扣除安全区且收款内容位于可滚动
容器内。
4. 运行创建页测试、迁移契约、完整精品工单回归和迁移 post 门禁。
# 新增工单直接下单不调用日报接口设计
## 目标
新增工单页面点击“直接下单”时,不调用
`dj.api.smartcarlife.staff.daily.report.popup.need`,完成页面本地订单校验后直接进入既有下单接口流程。
## 问题定位
创建页的 `SubmitContext.execute` 首先执行 `AsyncPreCheckStrategy`。该策略依赖
`store/ModalToQueueControl.js`,并在部分提交上下文下调用 `checkDailyReport()`,最终请求
`staffDailyReportMerchantValid`。虽然现有实现通过路由标记和按钮上下文尝试跳过,但创建页仍然保留了该依赖和可达调用分支,无法从结构上保证直接下单不请求日报接口。
## 方案
从新增工单创建页依赖闭包中移除 `ModalToQueueControl`:
- 删除 `createOrder.js` 中未使用的日报/学习任务导入。
- 删除 `submitStrategy.js` 中日报、学习任务、异常订单/流水锁单的导入及异步业务守卫策略。
- `checkPhoneUseConfig()` 仍在提交校验链开始前执行。
- 必填项、商品、VIN、错单金额和订单总价校验保持不变。
- 校验通过后仍由 `prepareSubmitPayload` 选择原有下单接口,并由 `doSubmit` 发起请求。
- 工单详情标错、扫码等其他页面的业务守卫保持不变。
## 回归保护
增加模块依赖边界测试:测试加载新增工单创建页时,若依赖
`~/store/ModalToQueueControl` 则立即失败。该测试确保日报接口不能通过创建页提交链重新变为可达。
## 非目标
- 不删除公共 API `staffDailyReportMerchantValid`。
- 不修改其他页面的日报、学习任务或异常订单/流水校验。
- 不绕过手机号配置、表单、VIN、商品和金额等订单数据校验。
- 不修改既有下单接口与请求参数。
# 工单详情隐藏确认施工按钮设计
## 目标
在 `tabWorkOrder/pages/orderDetail/orderDetail` 中不再显示“确认订单是否施工”按钮。
## 根因
详情模板底部根据 `confirmFlagObj.showBtn` 创建按钮容器,并在
`confirmFlagObj.btnName == 'confirmConstruction'` 时绑定 `confirmConstruction`,所以接口返回
`confirmFlag=1` 时按钮仍然可见。
## 方案
只删除 `orderDetail.wxml` 中详情页底部的确认施工按钮节点。保留 `showFlag` 查询、
`confirmFlagObj` 状态、页面顶部状态提示、兼容方法和公共 API 封装,避免扩大到订单状态和
其他页面的施工逻辑。
该处理与同页已隐藏“查看施工单”按钮的范围一致:目标是移除用户可见入口,不做公共接口
和历史兼容代码的全局清理。
## 测试
更新详情页范围测试,要求模板中同时不存在 `confirmConstruction` 按钮条件和点击绑定;
保留“查看施工单”不渲染及签名、发票范围测试。
# 低价提单商品价格校验设计
## 目标与范围
仅在创建页 `orderObj.lowPriceFlag=1` 的低价提单链路启用反向最低价校验。每个被提交的普通商品、多规格 SKU 和套餐子商品都必须满足:商品已开启最低价(`validMinSellPrice === 'Y'`)、存在有效的 `minSellPrice`,且当前录入单价严格小于该最低价。普通工单继续使用原有“不得低于最低价”规则,不改变全局 `productStrategy` 语义。
统一提醒文案为:`价格未触发最低价,其他正常单请到生意助手侧录单`。未开启最低价、最低价缺失、价格为空、价格等于最低价或高于最低价均视为未触发。
## 规则边界
页面商品按实际提交叶子节点检查:
- 普通商品读取 `line.goods`;
- 多规格商品读取 `line.multipleSpecificationsGoods.goods`;
- 套餐逐项读取 `line.packageGoods.goodsList`。
当前录入价按 `basePrice -> sellPrice -> price` 读取,与创建页改价后的基础单价保持一致,不使用折扣后的 `finalPrice`。最低价只读取商品接口契约字段 `minSellPrice`,启用状态只认 `validMinSellPrice === 'Y'`,避免其他价格字段被误判为已配置最低价。
## 页面行为
低价单选中商品后,商品行在部位/规格信息下方显示 `最低价:¥金额`;未开启或缺少最低价时显示 `最低价:未开启`。普通订单不显示该行。
商品确认后立即执行低价规则,但只同步最低价回显和错误状态,不弹提醒;价格输入后再实时校验,不满足时标红当前价格并提示统一文案,满足时清除低价单错误状态。失焦再次同步状态但不重复弹提示。提交前对整份商品列表重新校验,防止未经过输入或失焦的默认价格绕过规则;失败时沿用提交策略的提示弹窗并停止接口请求。
## 代码边界
新增 `services/lowPriceGoodsValidation.helpers.js` 作为纯规则模块,负责叶子商品展开、价格解析、单项/整单校验、最低价展示字段和错误状态同步。`createOrder.js` 只负责在选品确认、改价、失焦和提交节点调用该模块;`OrderGoodsRow` 只消费 `lowPriceFlag` 与已计算的展示文本。
## 测试与验收
Node 单元测试覆盖普通商品、SKU、套餐、等于边界、未开启、最低价缺失、空价格、合法低价及错误状态清理。页面契约测试覆盖组件收到 `lowPriceFlag`、最低价文案渲染,以及创建页在实时输入与提交阶段使用同一校验器。完成后运行创建页测试、精品工单全量测试、静态闭包检查与迁移 post 门禁。
# 低价提单列表视觉改造设计
## 目标
将工作台“客户工单”入口统一改名为“低价提单”,使用产品提供的紫色低价提单图标;将
`pages/tabWorkOrder/pages/index/index` 改造成设计稿中的低价提单专属列表,同时保留现有
新建低价单、详情跳转、分页刷新和撤销能力。
## 方案选择
采用“保留业务数据链路,替换专属展示层”的方案。列表仍由现有页面负责请求、分页、
审批状态统计和详情跳转,不复制接口逻辑;卡片模板只展示设计稿要求的字段。相比在旧通用
工单卡片上逐项隐藏商品、支付和异常信息,该方案模板边界清楚,也不会继续继承无关样式。
未采用以下方案:
1. 仅覆盖旧卡片 CSS:旧模板仍包含商品、支付、出库、异常订单等节点,容易出现空白和
点击区域错位。
2. 新建独立列表页面:会重复分页、审批页签、新建入口和详情路由,超出本次需求。
## Swagger 契约
2026-08-07 核查结果:
- 测试及生产 Swagger
`https://dj.test.glsx.com.cn/rop-dj-car-boutique/swagger-rop/api-docs` 尚未包含两个新接口。
- 开发 Swagger
`http://dj.dev.glsx.com.cn/rop-dj-car-boutique/swagger-rop/api-docs` 已包含最新定义,本次按该
定义实现。
列表接口为
`dj.api.smartcarlife.order.search.containPackageGoods.byArea`,响应类型为
`RopResponse<RpcPagination<GoodsOrderDTO>>`。页面字段映射如下:
| 设计稿字段 | Swagger 字段 | 展示规则 |
| --- | --- | --- |
| 客户姓名 | `customer.customerName` | 空值显示 `--` |
| 订单类型 | `lowPriceFlag` | 本页面请求固定 `lowPriceFlag=1`,统一显示“低价订单” |
| 销售顾问 | `merchantName`、`employeeName` | 以 `门店名|员工名` 拼接,单行省略 |
| 转化人员 | `sellerMerchantName`、`sellerName` | 以 `园区店名|员工名` 拼接,单行省略 |
| 工单编号 | `orderCode` | 空值显示 `--` |
| 工单时间 | `orderTime` | 保留现有 `yyyy-MM-dd HH:mm:ss` 格式化 |
| 审批状态 | `goodsOrderApplyStatus` | `1/2=待审批`、`3=已通过`、`4=已驳回` |
统计接口为 `dj.api.smartcarlife.order.statByApplyStatus`,响应类型为
`RopResponse<GoodsOrderApplyStatDTO>`,字段为 `totalCount`、`pendingCount`、`passCount`、
`rejectCount`。两个接口请求均由 API 封装固定追加 `sceneType=1` 和 `lowPriceFlag=1`。
## 页面结构与样式
- 导航标题为“低价提单”。
- 搜索框独占一行,提示词为“关键词”,移除右侧筛选按钮。
- 保留全部、待审批、已通过、已驳回四个页签及统计数量。
- 列表区域使用浅灰背景;卡片使用白底、大圆角和无阴影布局。
- 卡片顶部展示客户姓名和审批状态标签,中部固定展示五行字段,底部右侧展示浅蓝色
“查看”按钮。
- 保留右下角“新建低价单”入口,因为该入口属于已确认迁移功能,当前设计改造不撤销它。
- 保留已有左滑撤销逻辑,但不在卡片内展示旧通用工单的商品、支付、出库和异常信息。
## 菜单与资源
工作台入口名称改为“低价提单”,路由保持
`/pages/tabWorkOrder/pages/index/index`,埋点编码保持
`regional-assistant-customer-work-order` 以避免历史统计口径中断。产品提供的 72×72 透明
PNG 复制为 `/images/low-price-order.png`,菜单改用该本地资源。
后续产品调整:工作台“新增工单”菜单隐藏,“低价提单”成为门店运营管理的首个工单入口;
列表右下角“新建低价单”入口改用产品提供的 56×56 PNG
`/images/new-low-price-order.png`,下单流程本身保持不变。
## 测试与文档
- 更新工作台菜单源代码契约测试,校验名称、路由、图标和资源存在。
- 更新列表页面源代码契约测试,校验标题、关键词搜索、无筛选入口、五个字段与查看按钮。
- 更新接口契约文档,记录最新开发 Swagger 的响应模型和字段映射。
- 运行工作单迁移测试、创建页测试、生命周期测试、闭包检查和迁移后置门禁。
...@@ -21,9 +21,10 @@ ...@@ -21,9 +21,10 @@
`onLoad` → 若有 `orderCode` 则 `onRoute`;否则场景预填、`getUserSceneList`、销售默认人选。 `onLoad` → 若有 `orderCode` 则 `onRoute`;否则场景预填、`getUserSceneList`、销售默认人选。
工作台入口固定传递 `skipOrderGuards=true`。该标记只跳过日报、学习任务、异常订单和异常 工作台入口仍传递 `skipOrderGuards=true` 作为路由兼容标记。创建页提交模块本身不加载
流水业务守卫;手机号配置、必填、商品、VIN、价格和提交错误处理不跳过。扫码、撤销、 日报、学习任务、异常订单和异常流水业务守卫,因此“直接下单”在本地订单数据校验通过后
标记错误等其他入口没有该标记,继续执行来源业务守卫。 直接调用下单接口。手机号配置、必填、商品、VIN、价格和提交错误处理继续执行;列表撤销、
详情标记错误等其他页面继续执行来源业务守卫。
--- ---
...@@ -83,6 +84,15 @@ flowchart TD ...@@ -83,6 +84,15 @@ flowchart TD
订单类型 `djOrderType`:打折 / 买赠 / 组合等影响 `order-goods-row` 展示与 `checkGoods` 规则。 订单类型 `djOrderType`:打折 / 买赠 / 组合等影响 `order-goods-row` 展示与 `checkGoods` 规则。
`lowPriceFlag=1` 时额外启用
[`lowPriceGoodsValidation.helpers.js`](../../tabWorkOrder/pages/createOrder/services/lowPriceGoodsValidation.helpers.js):
- 普通商品、选中的多规格 SKU、套餐内每个子商品都必须 `validMinSellPrice='Y'`;
- 当前基础单价按 `basePrice -> sellPrice -> price` 读取,必须严格小于 `minSellPrice`;
- 等于/高于最低价、未开启、缺少最低价或价格为空都统一提示“价格未触发最低价,其他正常单请到生意助手侧录单”;
- 商品行回显“最低价:¥金额”,未开启时显示“最低价:未开启”;
- 商品确认时仅静默回显并同步校验状态,不弹提醒;输入时实时提示,失焦时静默同步,提交前复核,普通工单原最低价逻辑不变。
--- ---
## 6. 人员 / 礼券 / 客户 ## 6. 人员 / 礼券 / 客户
...@@ -95,14 +105,19 @@ flowchart TD ...@@ -95,14 +105,19 @@ flowchart TD
精品升级(`sceneType==1`):[`orderMerchantConfig.js`](../../tabWorkOrder/pages/createOrder/services/orderMerchantConfig.js) 限制订单类型为正常单 + 内部结算。 精品升级(`sceneType==1`):[`orderMerchantConfig.js`](../../tabWorkOrder/pages/createOrder/services/orderMerchantConfig.js) 限制订单类型为正常单 + 内部结算。
低价单客户区只在车主姓名行显示一次“请通过选择客户档案”,并在“客户档案”前使用
`record.png` 图标。客户档案组件接收前置弹框所选 4S 店的 `merchantId`;档案或历史订单
回显后通过 `mergeLowPriceOrderContext` 恢复已选 4S/园区店,录单字段设置按所选园区店查询
并按园区 ID 缓存。
--- ---
## 7. 提交流程 ## 7. 提交流程
`submit(i)` → `SubmitContext.execute`: `submit(i)` → `SubmitContext.execute`:
1. AsyncPreCheck(始终应用手机号配置;仅在没有 `skipOrderGuards` 时执行日报、学习、锁单) 1. `checkPhoneUseConfig()`(应用手机号配置,不发起日报请求)
2. StatePermission(错单/预约/补录禁建档) 2. StatePermission(保留兼容提交策略中的错单/预约/补录建档限制;迁移页面不展示建档入口)
3. GoodsValidation(`checkGoods`) 3. GoodsValidation(`checkGoods`)
4. RequiredField(`checkRequired`) 4. RequiredField(`checkRequired`)
5. VinValidation 5. VinValidation
...@@ -113,7 +128,7 @@ flowchart TD ...@@ -113,7 +128,7 @@ flowchart TD
| 条件 | API | | 条件 | API |
|------|-----| |------|-----|
| 建档 `save` | `createPrerecordedOrder` | | 兼容建档 `save`(页面无入口) | `createPrerecordedOrder` |
| 错单 | `correctionOrder` | | 错单 | `correctionOrder` |
| 补录 | `supplementOrder` | | 补录 | `supplementOrder` |
| 默认 | `createWithPay` → `confirmOrder` | | 默认 | `createWithPay` → `confirmOrder` |
...@@ -130,6 +145,6 @@ flowchart TD ...@@ -130,6 +145,6 @@ flowchart TD
**手动回归:** 见 [order-creation/README.md](../order-creation/README.md) MR-WO-* 表。 **手动回归:** 见 [order-creation/README.md](../order-creation/README.md) MR-WO-* 表。
**改前必查:** 工作台直达入口、`newOrderGuardPolicy`、`goodsPositionBucket`、页面级 **改前必查:** 工作台直达入口、`direct-order-without-daily-guard.test.mjs`、
`CalendarMonth`/`RemarkPopup` 绑定以及 `Goods`/`SetMeal`/`Coupon` 组件。战败单不在目标 `goodsPositionBucket`、页面级 `CalendarMonth`/`RemarkPopup` 绑定以及
项目迁移范围内。 `Goods`/`SetMeal`/`Coupon` 组件。战败单不在目标项目迁移范围内。
...@@ -7,13 +7,27 @@ ...@@ -7,13 +7,27 @@
*/ */
export function resolveDirectWorkOrderAction(detail = {}) { export function resolveDirectWorkOrderAction(detail = {}) {
const paymentMethod = detail.payFlag != 2 ? 1 : detail.payType const paymentMethod = detail.payFlag != 2 ? 1 : detail.payType
const orderMerchantContext = {}
;[
'lowPriceFlag',
'merchantId',
'merchantName',
'yqMerchantId',
'yqMerchantName',
'sellerMerchantId',
'sellerMerchantName'
].forEach(key => {
if (detail[key] !== undefined && detail[key] !== null && detail[key] !== '') {
orderMerchantContext[key] = detail[key]
}
})
return { return {
action: String(paymentMethod) === '5' ? 'recording' : 'navigate', action: String(paymentMethod) === '5' ? 'recording' : 'navigate',
params: { params: {
paymentMethod, paymentMethod,
skipOrderGuards: true skipOrderGuards: true,
...orderMerchantContext
} }
} }
} }
// pages/tab/workspace/workspace.js // pages/tab/workspace/workspace.js
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/"; const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/";
import { getWaitAuditCountAPI, waitstaffstateAPI, getStaffTemplate, getOrderWaitForAudit } from "~/api/api"; import { getWaitAuditCountAPI, waitstaffstateAPI, getStaffTemplate } from "~/api/api";
import Dialog from "@vant/weapp/dialog/dialog"; import Dialog from "@vant/weapp/dialog/dialog";
import { dialogOptions, noticeSort, ServerCenterEnum } from "~/utils/enum/index.js"; import { dialogOptions, noticeSort, ServerCenterEnum } from "~/utils/enum/index.js";
import { getCompanyNoticeDetail, getCompanyNoticeList } from "~/api/serviceCenter/index.js"; import { getCompanyNoticeDetail, getCompanyNoticeList } from "~/api/serviceCenter/index.js";
import { resolveDirectWorkOrderAction } from "./services/workOrderEntry.helpers.js"; import { resolveDirectWorkOrderAction } from "./services/workOrderEntry.helpers.js";
const WORK_ORDER_ICON_URL =
"https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/upgrade/create_newworkorder.png";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -27,10 +24,10 @@ Page({ ...@@ -27,10 +24,10 @@ Page({
}], }],
storeManagementMenus: [ storeManagementMenus: [
{ {
name: "新增工单", name: "低价提单",
action: "openWorkOrderPrompt", path: "/pages/tabWorkOrder/pages/index/index",
iconUrl: WORK_ORDER_ICON_URL, iconUrl: "/images/low-price-order.png",
trackingCode: "regional-assistant-create-work-order", trackingCode: "regional-assistant-customer-work-order",
}, },
{ {
name: "驻店管理", name: "驻店管理",
...@@ -321,8 +318,6 @@ Page({ ...@@ -321,8 +318,6 @@ Page({
this.getWaitAuditCount(userInfo); this.getWaitAuditCount(userInfo);
// 获取招聘管理待处理数量 // 获取招聘管理待处理数量
this.getWaitStaff(); this.getWaitStaff();
// 获取待审核订单数量
this.getWaitAudit();
}, },
); );
if (!this.data.isShowingModal) { if (!this.data.isShowingModal) {
...@@ -360,21 +355,6 @@ Page({ ...@@ -360,21 +355,6 @@ Page({
}) })
.catch((err) => {}); .catch((err) => {});
}, },
// 获取订单待审核角标数量
getWaitAudit() {
let { compensationMenus } = this.data
let userInfo = wx.$util.getUserInfo()
let index = compensationMenus.findIndex(e => e.name == '订单审核')
getOrderWaitForAudit({sceneType: userInfo.sceneType }).then(res => {
let { code, data } = res
if (code == 0) {
this.setData({
[`compensationMenus[${index}].tipsNum`]: data.waitAuditNum
})
}
})
},
jump(e) { jump(e) {
// 创建节流函数,1500ms 内只能触发一次 // 创建节流函数,1500ms 内只能触发一次
if (!this.throttledJump) { if (!this.throttledJump) {
......
...@@ -70,13 +70,16 @@ ...@@ -70,13 +70,16 @@
<van-dialog id="van-dialog" confirm-button-color="#2C66F7" /> <van-dialog id="van-dialog" confirm-button-color="#2C66F7" />
<order-prompt-pop <order-prompt-pop
show="{{showWorkOrderPrompt}}" show="{{showWorkOrderPrompt}}"
low-price-mode="{{true}}"
bindcancel="onWorkOrderPromptCancel" bindcancel="onWorkOrderPromptCancel"
bindconfirm="onWorkOrderPromptConfirm" bindconfirm="onWorkOrderPromptConfirm"
/> />
<recording-order-popup <recording-order-popup
wx:if="{{showOrderpop}}" wx:if="{{showOrderpop}}"
show="{{showOrderpop}}" show="{{showOrderpop}}"
lowPriceFlag="{{pendingWorkOrderParams.lowPriceFlag}}"
merchantId="{{pendingWorkOrderParams.merchantId}}"
yqMerchantId="{{pendingWorkOrderParams.yqMerchantId}}"
bind:success="onRecordingOrderSuccess" bind:success="onRecordingOrderSuccess"
title="请选择交易参考号" title="请选择交易参考号"
/> />
...@@ -13,9 +13,12 @@ module.exports = { ...@@ -13,9 +13,12 @@ module.exports = {
}, },
/**搜索订单(含套餐) */ /**搜索订单(含套餐) */
getWorkPackageGoodsList(data){ getWorkPackageGoodsList(data){
let params = data || {} const params = {
params.sceneType = 1 ...(data || {}),
return api.post('dj.api.smartcarlife.order.search.containPackageGoods', { sceneType: 1,
lowPriceFlag: 1
}
return api.post('dj.api.smartcarlife.order.search.containPackageGoods.byArea', {
pageSize: 10, pageSize: 10,
...params ...params
}) })
...@@ -28,9 +31,12 @@ module.exports = { ...@@ -28,9 +31,12 @@ module.exports = {
/** 根据订单状态统计订单数*/ /** 根据订单状态统计订单数*/
statByStatus(data) { statByStatus(data) {
data = data || {} const params = {
data.sceneType = 1 ...(data || {}),
return api.post('dj.api.smartcarlife.order.statByStatus', data) sceneType: 1,
lowPriceFlag: 1
}
return api.post('dj.api.smartcarlife.order.statByApplyStatus', params)
}, },
/** 获取商户基本信息 */ /** 获取商户基本信息 */
......
...@@ -9,6 +9,10 @@ Component({ ...@@ -9,6 +9,10 @@ Component({
properties: { properties: {
userInfo: Object, userInfo: Object,
navBarHeight: String, navBarHeight: String,
lowPriceMode: {
type: Boolean,
value: false
},
show: { show: {
type: Boolean, type: Boolean,
observer: function (n, o) { observer: function (n, o) {
......
...@@ -314,6 +314,7 @@ ...@@ -314,6 +314,7 @@
<store-select-popup <store-select-popup
show="{{ showStoreSelectPopup }}" show="{{ showStoreSelectPopup }}"
type="{{ storeType }}" type="{{ storeType }}"
lowPriceMode="{{ lowPriceMode }}"
bindconfirm="storeConfirm" bindconfirm="storeConfirm"
bindcancel="hideStorePopup" bindcancel="hideStorePopup"
selectedData="{{ storeType == 1 ? form.selectedYqMerchantList || [] : form.selectedMerchantList || [] }}" selectedData="{{ storeType == 1 ? form.selectedYqMerchantList || [] : form.selectedMerchantList || [] }}"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"navigationStyle":"custom", "navigationStyle":"custom",
"usingComponents": { "usingComponents": {
"order-screen": "../../components/OrderScreen/OrderScreen", "order-screen": "../../components/OrderScreen/OrderScreen",
"order-prompt-popup": "/components/orderPromptPop/orderPromptPop", "study-permission-modal": "/components/studyPermissionModal/studyPermissionModal",
"recording-order-popup": "/tabIndex/components/recordingOrderPopup/recordingOrderPopup", "order-prompt-pop": "/components/orderPromptPop/orderPromptPop",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal" "recording-order-popup": "/tabIndex/components/recordingOrderPopup/recordingOrderPopup"
} }
} }
...@@ -463,76 +463,6 @@ page { ...@@ -463,76 +463,6 @@ page {
z-index: 10; z-index: 10;
} }
.fixed-btns {
position: fixed;
right: var(--fontSize20);
bottom: var(--fontSize65);
/* width: var(--fontSize104); */
/* height: var(--fontSize296); */
display: flex;
justify-content: center;
/* flex-flow: column; */
background: #FFFFFF;
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
border-radius: var(--fontSize16);
/* background: #ffffffe6;
border: 1px solid #EFF0F2;
box-shadow: 0 2px 10px 0 #0000001a;
border-radius: 26px; */
}
.fixed-btns .btn {
box-sizing: border-box;
padding: var(--fontSize20) var(--fontSize18);
display: flex;
flex-flow: column;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize24);
color: #347BFF;
width: var(--fontSize135);
height: var(--fontSize136);
}
.fixed-btns .btn image {
width: var(--fontSize60);
height: var(--fontSize60);
flex-shrink: 0;
}
.arrowIcon {
position: fixed;
right: 0;
bottom: var(--fontSize65);
width: var(--fontSize36);
height: var(--fontSize136);
background: #FFFFFF;
border: var(--fontSize2) solid #EFF0F2;
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
border-radius: var(--fontSize16) 0 0 var(--fontSize16);
display: flex;
align-items: center;
justify-content: center;
}
.arrowIcon .image {
/* line-height: var(--fontSize136); */
width: var(--fontSize32);
height: var(--fontSize32);
}
/* .fixed-btns::after {
position: absolute;
top: 50%;
left: 50%;
background: #FFFFFF;
border-radius: var(--fontSize1);
width: var(--fontSize2);
height: var(--fontSize26);
content: '';
transform: translate(-50%, -50%);
} */
.touch-item { .touch-item {
/* margin: 0 var(--fontSize20); */ /* margin: 0 var(--fontSize20); */
box-sizing: border-box; box-sizing: border-box;
...@@ -753,3 +683,146 @@ page { ...@@ -753,3 +683,146 @@ page {
// margin-right: 6rpx; // margin-right: 6rpx;
margin-top: 3rpx; margin-top: 3rpx;
} }
.low-price-create {
position: fixed;
right: 28rpx;
bottom: calc(40rpx + env(safe-area-inset-bottom));
z-index: 20;
min-width: 104rpx;
min-height: 104rpx;
padding: 12rpx 16rpx;
box-sizing: border-box;
border-radius: 16rpx;
background: #FFFFFF;
box-shadow: 0 6rpx 24rpx rgba(44, 102, 247, 0.18);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #2C66F7;
font-size: 22rpx;
}
.low-price-create image {
width: 48rpx;
height: 48rpx;
margin-bottom: 4rpx;
}
/* 低价提单专属列表 */
page,
.main,
.list {
background: #F4F5F8;
}
.main {
min-height: 100vh;
}
.to-box {
background: #FFFFFF;
}
.search-box {
padding: 24rpx 24rpx 16rpx;
}
.search-box .search-input {
width: 100%;
height: 72rpx;
border-radius: 36rpx;
background: #F7F8FA;
}
.search-box .search-input .input {
flex: 1;
min-width: 0;
width: auto;
}
.list {
padding: 20rpx;
}
.touch-item {
margin: 0 0 20rpx;
border-radius: 24rpx;
box-shadow: none;
}
.list .item.low-price-card {
min-width: 100%;
padding: 32rpx;
border-radius: 24rpx;
background: #FFFFFF;
}
.low-price-card-header {
display: flex;
align-items: center;
justify-content: space-between;
min-width: 0;
margin-bottom: 28rpx;
}
.low-price-customer-name {
flex: 1;
min-width: 0;
padding-right: 20rpx;
color: #202124;
font-size: 32rpx;
font-weight: 600;
}
.low-price-card-status {
flex-shrink: 0;
padding: 8rpx 12rpx;
border-radius: 8rpx;
font-size: 24rpx;
line-height: 32rpx;
}
.low-price-card-row {
display: flex;
align-items: center;
min-width: 0;
margin-bottom: 18rpx;
font-size: 28rpx;
line-height: 40rpx;
}
.low-price-card-row:last-child {
margin-bottom: 0;
}
.low-price-card-label {
width: 168rpx;
flex-shrink: 0;
color: #A0A3A8;
}
.low-price-card-value {
flex: 1;
min-width: 0;
color: #25262A;
}
.low-price-card-footer {
display: flex;
justify-content: flex-end;
margin-top: 30rpx;
}
.low-price-view {
width: 144rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
background: #EEF3FF;
color: #2C66F7;
font-size: 28rpx;
}
export const APPROVAL_STATUS_TABS = ['全部', '待审批', '已通过', '已驳回']
const APPROVAL_STATUS_FILTERS = [undefined, [1, 2], [3], [4]]
export function resolveApprovalStatusFilter(index) {
const filter = APPROVAL_STATUS_FILTERS[Number(index)]
return filter ? [...filter] : undefined
}
function numberValue(data, keys) {
for (const key of keys) {
if (data?.[key] !== undefined && data?.[key] !== null) {
const value = Number(data[key])
return Number.isNaN(value) ? 0 : value
}
}
return 0
}
export function buildApprovalStatusCounts(data = {}) {
const pendingFallback =
numberValue(data, ['status1Count', 'applyStatus1Count']) +
numberValue(data, ['status2Count', 'applyStatus2Count'])
return [
numberValue(data, ['totalCount', 'allCount', 'count']),
numberValue(data, [
'pendingCount',
'waitApplyCount',
'waitingCount',
'applyingCount',
'auditCount'
]) || pendingFallback,
numberValue(data, [
'approvedCount',
'passCount',
'passedCount',
'applyPassCount',
'status3Count',
'applyStatus3Count'
]),
numberValue(data, [
'rejectedCount',
'rejectCount',
'refusedCount',
'applyRejectCount',
'status4Count',
'applyStatus4Count'
])
]
}
...@@ -98,16 +98,33 @@ export const getYQInfo = userInfo => { ...@@ -98,16 +98,33 @@ export const getYQInfo = userInfo => {
}) })
} }
export const getYQorderInfo = () => { export const getYQorderInfo = (merchantContext = {}) => {
const app = getApp() const app = getApp()
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 如果有 直接返回 const userInfo = wx.$util.getUserInfo() || {}
if (app.globalData.YQorderSetting) { const fallbackUser = userInfo.subLoginUser || userInfo
const hasExplicitMerchant = Boolean(merchantContext?.merchantId)
const merchantId = merchantContext?.merchantId || fallbackUser.merchantId
const merchantName =
merchantContext?.merchantName || fallbackUser.merchantName || ''
const cachedMerchantId = app.globalData.YQorderSettingMerchantId
const isSameMerchant =
merchantId &&
cachedMerchantId &&
String(cachedMerchantId) === String(merchantId)
// 园区配置必须跟随本次下单所选园区;旧流程无显式门店时兼容未分店缓存。
if (
app.globalData.YQorderSetting &&
(isSameMerchant || (!hasExplicitMerchant && !cachedMerchantId))
) {
return resolve(app.globalData.YQorderSetting) return resolve(app.globalData.YQorderSetting)
} else { }
let userInfo = wx.$util.getUserInfo()
if (!userInfo) this.login(true) if (!merchantId) {
let { merchantId, merchantName } = userInfo.subLoginUser return reject(new Error('缺少园区店 merchantId,无法查询订单配置'))
}
wx.$util.showLoading() wx.$util.showLoading()
api api
.getMerchantRecordingSettings({ .getMerchantRecordingSettings({
...@@ -115,28 +132,33 @@ export const getYQorderInfo = () => { ...@@ -115,28 +132,33 @@ export const getYQorderInfo = () => {
merchantName merchantName
}) })
.then(res => { .then(res => {
// console.log(res)
wx.$util.hideLoading() wx.$util.hideLoading()
let { code, data } = res const { code } = res
if (code == 0) { if (code != 0) {
// debugger reject(res)
// console.log(typeof data.yqPhoneConfig, 'data.yqPhoneConfig') return
// 过滤园区店是否需要屏蔽手机号选项 }
let filterYqPhoneConfig = JSON.parse(data.yqPhoneConfig)
// console.log(filterYqPhoneConfig) const data = { ...(res.data || {}) }
let filterYqPhoneConfig = []
try {
filterYqPhoneConfig = Array.isArray(data.yqPhoneConfig)
? data.yqPhoneConfig
: JSON.parse(data.yqPhoneConfig || '[]')
} catch (error) {
filterYqPhoneConfig = []
}
data.yqPhoneConfig = data.yqPhoneConfig =
filterYqPhoneConfig?.find(item => item.yqMerchantId == merchantId) filterYqPhoneConfig?.find(item => item.yqMerchantId == merchantId)
?.shopMerchantPhoneList || false ?.shopMerchantPhoneList || false
// console.log(data)
app.globalData.YQorderSetting = data app.globalData.YQorderSetting = data
// this.checkSeverType(userInfo) app.globalData.YQorderSettingMerchantId = merchantId
resolve(app.globalData.YQorderSetting) resolve(app.globalData.YQorderSetting)
}
}) })
.catch(error => { .catch(error => {
console.log(error) wx.$util.hideLoading()
reject(error)
}) })
}
}) })
} }
......
...@@ -13,7 +13,9 @@ Component({ ...@@ -13,7 +13,9 @@ Component({
if (n) { if (n) {
let { switchValuerec } = this.data let { switchValuerec } = this.data
this.setData({ this.setData({
switchValue: switchValuerec || 1 switchValue: switchValuerec || 1,
currentPage: 1,
orderNoList: []
}) })
this.getWaitinputorder() this.getWaitinputorder()
} }
...@@ -28,7 +30,19 @@ Component({ ...@@ -28,7 +30,19 @@ Component({
}) })
} }
}, },
switchValuerec: Number switchValuerec: Number,
lowPriceFlag: {
type: Number,
value: 0
},
merchantId: {
type: String,
value: ''
},
yqMerchantId: {
type: String,
value: ''
}
}, },
/** /**
...@@ -159,10 +173,24 @@ Component({ ...@@ -159,10 +173,24 @@ Component({
this.getWaitinputorder() this.getWaitinputorder()
}, },
getWaitinputorder() { getWaitinputorder() {
let { currentPage, pageSize, orderNoList, selectOutTradeNoArr, switchValue } = let {
this.data currentPage,
pageSize,
orderNoList,
selectOutTradeNoArr,
switchValue,
lowPriceFlag,
merchantId,
yqMerchantId
} = this.data
const params = { currentPage, pageSize, inputOrderType: switchValue }
if (lowPriceFlag) {
params.lowPriceFlag = lowPriceFlag
params.merchantId = merchantId
params.yqMerchantId = yqMerchantId
}
api api
.waitinputorder({ currentPage, pageSize, inputOrderType: switchValue }) .waitinputorder(params)
.then(result => { .then(result => {
let { code, data } = result let { code, data } = result
if (code == 0) { if (code == 0) {
......
...@@ -2,6 +2,7 @@ import api from '../../api.js' ...@@ -2,6 +2,7 @@ import api from '../../api.js'
import order_mixins from '../order_mixins.js' import order_mixins from '../order_mixins.js'
import { setWebSocket, getPositionList } from '~/store/index' import { setWebSocket, getPositionList } from '~/store/index'
import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag' import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag'
import { buildOrderDisplayInfo } from '../../utils/orderDisplay.helpers.js'
const IMG_URL = const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/' 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
let time = null let time = null
...@@ -220,7 +221,6 @@ Page({ ...@@ -220,7 +221,6 @@ Page({
// this.getDetail(options.orderCode) // this.getDetail(options.orderCode)
// } // }
if (time) clearInterval(time) if (time) clearInterval(time)
this.checkPhoneShow(app.globalData.YQorderSetting?.yqPhoneConfig)
// wx.$util.setWebSocket() // wx.$util.setWebSocket()
setWebSocket() setWebSocket()
if (options.orderCode) { if (options.orderCode) {
...@@ -314,9 +314,7 @@ Page({ ...@@ -314,9 +314,7 @@ Page({
normalizeMarketingFlagOnItem(item) normalizeMarketingFlagOnItem(item)
}) })
data = { data = {
...data.customer, ...buildOrderDisplayInfo(data),
...data.payOrder,
...data,
packageGoodsList: data.packageGoodsList, packageGoodsList: data.packageGoodsList,
couponName, couponName,
total_price: Number(wx.$util.decimal(total_price, 2)).toFixed(2) total_price: Number(wx.$util.decimal(total_price, 2)).toFixed(2)
...@@ -514,16 +512,6 @@ Page({ ...@@ -514,16 +512,6 @@ Page({
}) })
}, },
checkPhoneShow(config) {
// 有就屏蔽手机号的显示
if (config) {
let { customerObj } = this.data
delete customerObj[2]
this.setData({
customerObj
})
}
},
edit() { edit() {
let { orderInfo } = this.data let { orderInfo } = this.data
// filmOrder 0车膜升级 1精品升级 // filmOrder 0车膜升级 1精品升级
......
...@@ -15,6 +15,10 @@ Component({ ...@@ -15,6 +15,10 @@ Component({
type: Number, type: Number,
value: 0 value: 0
}, },
lowPriceFlag: {
type: Number,
value: 0
},
index: { index: {
type: Number, type: Number,
value: 0 value: 0
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
</view> </view>
</view> </view>
<view class="bottom_box"> <view class="bottom_box">
<view class="goods-meta">
<view class="position" wx:if="{{ product.specificationStr }}">{{product.specificationStr}}</view> <view class="position" wx:if="{{ product.specificationStr }}">{{product.specificationStr}}</view>
<view class="position" wx:elif="{{ product.positionStr }}">{{product.positionStr}}</view> <view class="position" wx:elif="{{ product.positionStr }}">{{product.positionStr}}</view>
<view <view
...@@ -29,6 +30,8 @@ ...@@ -29,6 +30,8 @@
wx:elif="{{ (product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !product.merchantGoodsPosition && !product.upgradeGoodsPosition }}" wx:elif="{{ (product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !product.merchantGoodsPosition && !product.upgradeGoodsPosition }}"
>无部位属性</view> >无部位属性</view>
<view class="position" wx:else></view> <view class="position" wx:else></view>
<view class="low-price-minimum" wx:if="{{ lowPriceFlag == 1 }}">{{product.lowPriceMinPriceText}}</view>
</view>
<!-- Price and Count --> <!-- Price and Count -->
<view class="price_count"> <view class="price_count">
<view class="price"> <view class="price">
......
...@@ -69,6 +69,26 @@ ...@@ -69,6 +69,26 @@
color: #888888; color: #888888;
} }
.goods .bottom_box .goods-meta {
min-width: 0;
flex: 1;
display: flex;
flex-direction: column;
margin-right: 20rpx;
}
.goods .bottom_box .goods-meta .position {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.goods .bottom_box .low-price-minimum {
color: #F24724;
font-size: 24rpx;
margin-top: 8rpx;
}
.goods .bottom_box .red_text { .goods .bottom_box .red_text {
color: red; color: red;
} }
...@@ -77,6 +97,7 @@ ...@@ -77,6 +97,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
flex-shrink: 0;
} }
.goods .price { .goods .price {
......
// tabWorkOrder/pages/createOrder/createOrder.js // tabWorkOrder/pages/createOrder/createOrder.js
import { getSystemInfoSync } from '~/utils/systemInfo' import { getSystemInfoSync } from '~/utils/systemInfo'
import { checkDailyReport, checkStudyTask } from '~/store/ModalToQueueControl'
import api from '../../api' import api from '../../api'
import { import {
getProductStrategy, getProductStrategy,
...@@ -63,6 +62,7 @@ import { ...@@ -63,6 +62,7 @@ import {
createWorkOrderUserContext, createWorkOrderUserContext,
getWorkOrderUserContext getWorkOrderUserContext
} from './services/workOrderUserContext' } from './services/workOrderUserContext'
import { mergeLowPriceOrderContext } from './services/lowPriceOrderContext.helpers'
import { import {
normalizeSceneColumns, normalizeSceneColumns,
resolveAutoScene, resolveAutoScene,
...@@ -81,6 +81,10 @@ import { ...@@ -81,6 +81,10 @@ import {
} from './services/goodsChooseEcho.helpers.js' } from './services/goodsChooseEcho.helpers.js'
import { isMarketingGoodsPriceLocked } from './services/goodsPriceEdit.helpers.js' import { isMarketingGoodsPriceLocked } from './services/goodsPriceEdit.helpers.js'
import { import {
LOW_PRICE_NOT_TRIGGERED_MESSAGE,
applyLowPriceGoodsValidation
} from './services/lowPriceGoodsValidation.helpers.js'
import {
ensureCatalogUpgradePrice, ensureCatalogUpgradePrice,
seedCatalogSellPriceFromCatalog, seedCatalogSellPriceFromCatalog,
seedMarketingActivitySellPrice, seedMarketingActivitySellPrice,
...@@ -1003,11 +1007,28 @@ Page({ ...@@ -1003,11 +1007,28 @@ Page({
}) })
}, },
/** 商品/套餐弹框确认后关闭,Goods/SetMeal 已通过 getPageInstance 写入 goodsList */ /** 商品/套餐弹框确认后关闭,Goods/SetMeal 已通过 getPageInstance 写入 goodsList */
chooseGoods() { chooseGoods(e) {
const patch = {} const patch = {}
if (this.data.goodsBox) Object.assign(patch, closePagePopupPatch('goodsBox')) if (this.data.goodsBox) Object.assign(patch, closePagePopupPatch('goodsBox'))
if (this.data.packageBox) Object.assign(patch, closePagePopupPatch('packageBox')) if (this.data.packageBox) Object.assign(patch, closePagePopupPatch('packageBox'))
if (Object.keys(patch).length) this.setData(patch) if (Object.keys(patch).length) this.setData(patch)
const selectedGoodsList = Array.isArray(e?.detail)
? e.detail
: this.data.goodsList
this.applyLowPriceGoodsRules(selectedGoodsList)
},
isLowPriceOrder() {
return Number(this.data.orderObj?.lowPriceFlag) === 1
},
applyLowPriceGoodsRules(goodsList = this.data.goodsList, options = {}) {
if (!this.isLowPriceOrder()) {
return { valid: true, invalidGoods: [], entries: [] }
}
const result = applyLowPriceGoodsValidation(goodsList)
if (options.notify && result.entries.length && !result.valid) {
wx.$util.showToast(LOW_PRICE_NOT_TRIGGERED_MESSAGE)
}
return result
}, },
//修改套餐价格 //修改套餐价格
changeMealPrice(e) { changeMealPrice(e) {
...@@ -1069,6 +1090,7 @@ Page({ ...@@ -1069,6 +1090,7 @@ Page({
strategy.updateSubItemPrice(gindex, number) strategy.updateSubItemPrice(gindex, number)
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
this.applyLowPriceGoodsRules(goodsList, { notify: true })
} }
return number return number
}, },
...@@ -1121,6 +1143,7 @@ Page({ ...@@ -1121,6 +1143,7 @@ Page({
strategy.setBasePrice(number) strategy.setBasePrice(number)
} }
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
this.applyLowPriceGoodsRules(goodsList, { notify: true })
} }
return number return number
}, },
...@@ -1179,6 +1202,12 @@ Page({ ...@@ -1179,6 +1202,12 @@ Page({
const strategy = getProductStrategy(goodsList[index]) const strategy = getProductStrategy(goodsList[index])
if (!strategy) return if (!strategy) return
if (this.isLowPriceOrder()) {
this.applyLowPriceGoodsRules(goodsList)
this.setGoodsTotal(goodsList)
return
}
let validation = { valid: true } let validation = { valid: true }
if ( if (
...@@ -1223,6 +1252,9 @@ Page({ ...@@ -1223,6 +1252,9 @@ Page({
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
}, },
setGoodsTotal(goodsList) { setGoodsTotal(goodsList) {
if (this.isLowPriceOrder()) {
applyLowPriceGoodsValidation(goodsList)
}
let total = 0 let total = 0
goodsList.forEach(item => { goodsList.forEach(item => {
normalizeMarketingMetaOnItem(item) normalizeMarketingMetaOnItem(item)
...@@ -1303,6 +1335,13 @@ Page({ ...@@ -1303,6 +1335,13 @@ Page({
checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) { checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) {
if (save) return false if (save) return false
if (Number(orderObj?.lowPriceFlag) === 1) {
const lowPriceValidation = applyLowPriceGoodsValidation(goodsList)
if (!lowPriceValidation.valid) {
this.setData({ goodsList })
return LOW_PRICE_NOT_TRIGGERED_MESSAGE
}
}
// if (orderObj.selectPayType != 0) { // if (orderObj.selectPayType != 0) {
let { baseConfigData } = this.data let { baseConfigData } = this.data
let filmArr = [] let filmArr = []
...@@ -1762,6 +1801,9 @@ Page({ ...@@ -1762,6 +1801,9 @@ Page({
if (options.yqMerchantId && options.isAppointment) { if (options.yqMerchantId && options.isAppointment) {
orderObj.sellerMerchantId = options.yqMerchantId orderObj.sellerMerchantId = options.yqMerchantId
} }
// 低价工单的下单门店由进入页面前的弹框确定;客户档案、历史订单等回显
// 只补充业务数据,不能反向覆盖已选 4S 店及园区店上下文。
orderObj = mergeLowPriceOrderContext(orderObj, prevOrderObj)
if (!orderObj.customer.salesType) orderObj.customer.salesType = 0 if (!orderObj.customer.salesType) orderObj.customer.salesType = 0
// 回显订单类型名称 // 回显订单类型名称
let { orderTypeName, orderTypeList } = this.data let { orderTypeName, orderTypeList } = this.data
...@@ -1863,7 +1905,8 @@ Page({ ...@@ -1863,7 +1905,8 @@ Page({
workOrderUserContext.sceneType workOrderUserContext.sceneType
) )
this.setData({ this.setData({
workOrderUserContext workOrderUserContext,
orderObj: mergeLowPriceOrderContext(this.data.orderObj, options)
}) })
this.applyOrderTypeConfig(initialCreateAllGoodsFlag, { this.applyOrderTypeConfig(initialCreateAllGoodsFlag, {
preserveOrderType: true preserveOrderType: true
...@@ -2662,9 +2705,18 @@ Page({ ...@@ -2662,9 +2705,18 @@ Page({
}, },
getSetting() { getSetting() {
// 动态获取 车型 车架 车牌 是否必填 // 动态获取 车型 车架 车牌 是否必填
let { dynamicSetting, requiredList } = this.data let { dynamicSetting, requiredList, orderObj = {} } = this.data
// app . const selectedYqMerchantId =
getYQorderInfo() orderObj.yqMerchantId || orderObj.sellerMerchantId
if (Number(orderObj.lowPriceFlag) === 1 && !selectedYqMerchantId) return
const selectedYqMerchant = selectedYqMerchantId
? {
merchantId: selectedYqMerchantId,
merchantName:
orderObj.yqMerchantName || orderObj.sellerMerchantName || ''
}
: undefined
getYQorderInfo(selectedYqMerchant)
.then(merchantSettingInfo => { .then(merchantSettingInfo => {
let dictionaryObj = { let dictionaryObj = {
carTypeRequiredFlag: 'carBrand', carTypeRequiredFlag: 'carBrand',
...@@ -2855,7 +2907,8 @@ Page({ ...@@ -2855,7 +2907,8 @@ Page({
getShopMerchantPointConfig() { getShopMerchantPointConfig() {
const userContext = const userContext =
this.data.workOrderUserContext || getWorkOrderUserContext() this.data.workOrderUserContext || getWorkOrderUserContext()
const shopMerchantId = userContext.shopMerchantId const shopMerchantId =
this.data.orderObj?.merchantId || userContext.shopMerchantId
if (!shopMerchantId) return if (!shopMerchantId) return
api.getShopMerchantPointConfig({ merchantId: shopMerchantId }).then(res => { api.getShopMerchantPointConfig({ merchantId: shopMerchantId }).then(res => {
...@@ -2900,12 +2953,15 @@ Page({ ...@@ -2900,12 +2953,15 @@ Page({
}, },
// 10s轮询一次待补录 // 10s轮询一次待补录
getWaitOrder() { getWaitOrder() {
let { isErrorOrder, isAlreadyExistOrder } = this.data let { isErrorOrder, isAlreadyExistOrder, orderObj } = this.data
// isStaff && // isStaff &&
// console.log(isErrorOrder, isAlreadyExistOrder); // console.log(isErrorOrder, isAlreadyExistOrder);
!(isErrorOrder || isAlreadyExistOrder) && !(isErrorOrder || isAlreadyExistOrder) &&
api api
.waitinputorder() .waitinputorder({
lowPriceFlag: orderObj?.lowPriceFlag,
yqMerchantId: orderObj?.yqMerchantId || orderObj?.sellerMerchantId
})
.then(result => { .then(result => {
let { code, data } = result let { code, data } = result
this.setTime() this.setTime()
......
...@@ -393,34 +393,19 @@ page { ...@@ -393,34 +393,19 @@ page {
box-sizing: border-box; box-sizing: border-box;
} }
.btns .save, .btns .confirm {
.confirm {
border: var(--fontSize2) solid #0075F9; border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize12); border-radius: var(--fontSize12);
height: var(--fontSize80); height: var(--fontSize80);
box-sizing: border-box; box-sizing: border-box;
} }
.btns .save {
/* width: var(--fontSize186); */
width: 28%;
margin-right: var(--fontSize20);
color: #347BFF;
margin-right: var(--fontSize20);
}
.btns .confirm { .btns .confirm {
/* width: var(--fontSize480); */ width: 100%;
width: 72%;
color: #fff; color: #fff;
background-color: #347BFF; background-color: #347BFF;
} }
.btns .save.disabled {
border: 1px solid #DCDEE0;
color: #c0c0cc;
}
.meal-wrap { .meal-wrap {
background: #F7F8FA; background: #F7F8FA;
border-radius: var(--fontSize16); border-radius: var(--fontSize16);
......
...@@ -115,25 +115,26 @@ value="{{ orderObj.remark }}" ...@@ -115,25 +115,26 @@ value="{{ orderObj.remark }}"
valueAlign="right" valueAlign="right"
label="车主姓名" label="车主姓名"
titleBtn="客户档案" titleBtn="客户档案"
iconSrc="{{ recordIcon }}"
bindtitleClick="showCustomPop" bindtitleClick="showCustomPop"
labelWidth="var(--fontSize290)" labelWidth="var(--fontSize290)"
value="{{ orderObj.customer.customerName || '请通过客户档案选择' }}" value="{{ orderObj.customer.customerName || '请通过选择客户档案' }}"
/> />
</view> </view>
<gl-cell <gl-cell
border border
label="客户来源" label="客户来源"
value="{{ filter.getSalesTypeName(Sourcecolumns, orderObj.customer.salesType) || '请通过客户档案选择' }}" value="{{ filter.getSalesTypeName(Sourcecolumns, orderObj.customer.salesType) }}"
valueAlign="right" valueAlign="right"
/> />
<gl-cell border label="性别" value="{{ orderObj.customer.customerSex == 1 ? '男' : (orderObj.customer.customerSex == 2 ? '女' : '请通过客户档案选择') }}" valueAlign="right" labelWidth="var(--fontSize140)" /> <gl-cell border label="性别" value="{{ orderObj.customer.customerSex == 1 ? '男' : (orderObj.customer.customerSex == 2 ? '女' : '') }}" valueAlign="right" labelWidth="var(--fontSize140)" />
<gl-cell border valueAlign="right" label="手机号" value="{{ orderObj.customer.customerPhone || '请通过客户档案选择' }}" labelWidth="var(--fontSize140)" /> <gl-cell border valueAlign="right" label="手机号" value="{{ orderObj.customer.customerPhone }}" labelWidth="var(--fontSize140)" />
<gl-cell <gl-cell
border border
valueAlign="right" valueAlign="right"
label="选择车型" label="选择车型"
labelWidth="var(--fontSize140)" labelWidth="var(--fontSize140)"
value="{{ orderObj.customer.carSeriesName ? orderObj.customer.carBrand + ' - ' + orderObj.customer.carChildsBrandName + ' - ' + orderObj.customer.carSeriesName : '请通过客户档案选择' }}" value="{{ orderObj.customer.carSeriesName ? orderObj.customer.carBrand + ' - ' + orderObj.customer.carChildsBrandName + ' - ' + orderObj.customer.carSeriesName : '' }}"
/> />
<gl-cell <gl-cell
wx:if="{{ orderObj.selectPayType !=0 }}" wx:if="{{ orderObj.selectPayType !=0 }}"
...@@ -142,7 +143,7 @@ value="{{ orderObj.remark }}" ...@@ -142,7 +143,7 @@ value="{{ orderObj.remark }}"
valueAlign="right" valueAlign="right"
label="车架号( VIN )" label="车架号( VIN )"
labelWidth="var(--fontSize280)" labelWidth="var(--fontSize280)"
value="{{ orderObj.customer.standNo || '请通过客户档案选择' }}" value="{{ orderObj.customer.standNo }}"
/> />
<gl-cell <gl-cell
wx:if="{{ orderObj.selectPayType !=0 }}" wx:if="{{ orderObj.selectPayType !=0 }}"
...@@ -151,9 +152,9 @@ value="{{ orderObj.remark }}" ...@@ -151,9 +152,9 @@ value="{{ orderObj.remark }}"
valueAlign="right" valueAlign="right"
label="车牌号" label="车牌号"
labelWidth="var(--fontSize240)" labelWidth="var(--fontSize240)"
value="{{ orderObj.customer.plateNumber || '请通过客户档案选择' }}" value="{{ orderObj.customer.plateNumber }}"
/> />
<gl-cell wx:if="{{ orderObj.selectPayType !=0 }}" border label="是否体验" value="{{ orderObj.customer.experienceFlag == 'Y' ? '是' : (orderObj.customer.experienceFlag == 'N' ? '否' : '请通过客户档案选择') }}" valueAlign="right" labelWidth="var(--fontSize140)" /> <gl-cell wx:if="{{ orderObj.selectPayType !=0 }}" border label="是否体验" value="{{ orderObj.customer.experienceFlag == 'Y' ? '是' : (orderObj.customer.experienceFlag == 'N' ? '否' : '') }}" valueAlign="right" labelWidth="var(--fontSize140)" />
</view> </view>
<view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}"> <view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">
<block wx:if="{{ orderObj.merchantId }}"> <block wx:if="{{ orderObj.merchantId }}">
...@@ -247,6 +248,7 @@ value="{{ orderObj.remark }}" ...@@ -247,6 +248,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -289,6 +291,7 @@ value="{{ orderObj.remark }}" ...@@ -289,6 +291,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -331,6 +334,7 @@ value="{{ orderObj.remark }}" ...@@ -331,6 +334,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -373,6 +377,7 @@ value="{{ orderObj.remark }}" ...@@ -373,6 +377,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -415,6 +420,7 @@ value="{{ orderObj.remark }}" ...@@ -415,6 +420,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -471,6 +477,7 @@ value="{{ orderObj.remark }}" ...@@ -471,6 +477,7 @@ value="{{ orderObj.remark }}"
count="{{ item.count }}" count="{{ item.count }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
gindex="{{ gInx }}" gindex="{{ gInx }}"
isPackageSubItem="{{ true }}" isPackageSubItem="{{ true }}"
...@@ -518,6 +525,7 @@ value="{{ orderObj.remark }}" ...@@ -518,6 +525,7 @@ value="{{ orderObj.remark }}"
activityId="{{ item.activityId }}" activityId="{{ item.activityId }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -541,6 +549,7 @@ value="{{ orderObj.remark }}" ...@@ -541,6 +549,7 @@ value="{{ orderObj.remark }}"
count="{{ item.count }}" count="{{ item.count }}"
djOrderType="{{ orderObj.djOrderType }}" djOrderType="{{ orderObj.djOrderType }}"
selectPayType="{{ orderObj.selectPayType }}" selectPayType="{{ orderObj.selectPayType }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
index="{{ index }}" index="{{ index }}"
positionTypeList="{{ positionTypeList }}" positionTypeList="{{ positionTypeList }}"
baseConfigData="{{ baseConfigData }}" baseConfigData="{{ baseConfigData }}"
...@@ -683,11 +692,6 @@ value="{{ orderObj.remark }}" ...@@ -683,11 +692,6 @@ value="{{ orderObj.remark }}"
<!-- <image class="closeIcon"bindtap="closeTips"src="../../images/closeIcon.png"/>--> <!-- <image class="closeIcon"bindtap="closeTips"src="../../images/closeIcon.png"/>-->
</view> </view>
<view class="btns-con"> <view class="btns-con">
<view
class="save text-center {{ isErrorOrder || isAlreadyExistOrder || orderCreateType == 'additionRecordOrder' ? 'disabled':'' }}"
bindtap="submit"
data-save
>建档</view>
<view class="confirm text-center" bindtap="submit">直接下单</view> <view class="confirm text-center" bindtap="submit">直接下单</view>
</view> </view>
</view> </view>
...@@ -700,6 +704,9 @@ value="{{ orderObj.remark }}" ...@@ -700,6 +704,9 @@ value="{{ orderObj.remark }}"
outTradeNo="{{ selectOutTradeNoArr }}" outTradeNo="{{ selectOutTradeNoArr }}"
switchValuerec="{{ switchValue }}" switchValuerec="{{ switchValue }}"
show="{{ showOrderpop }}" show="{{ showOrderpop }}"
lowPriceFlag="{{ orderObj.lowPriceFlag }}"
merchantId="{{ orderObj.merchantId }}"
yqMerchantId="{{ orderObj.yqMerchantId || orderObj.sellerMerchantId }}"
bind:success="navigator" bind:success="navigator"
title="请选择交易参考号" title="请选择交易参考号"
/> />
...@@ -778,7 +785,7 @@ value="{{ orderObj.remark }}" ...@@ -778,7 +785,7 @@ value="{{ orderObj.remark }}"
></sku-goods> ></sku-goods>
<customerInfo <customerInfo
show="{{ customerInfoBox }}" show="{{ customerInfoBox }}"
merchantId="{{ workOrderUserContext.shopMerchantId || 0 }}" merchantId="{{ orderObj.merchantId || 0 }}"
bindconfirm="chooseCustomerInfo" bindconfirm="chooseCustomerInfo"
bindcancel="onCustomerInfoCancel" bindcancel="onCustomerInfoCancel"
/> />
......
import api from '../../api' import api from '../../api'
import { matchRouteStrategy, ROUTE_STRATEGY } from './services/routeMatch.helpers.js' import { matchRouteStrategy, ROUTE_STRATEGY } from './services/routeMatch.helpers.js'
import {
buildLowPriceOrderPatch,
mergeLowPriceOrderContext
} from './services/lowPriceOrderContext.helpers.js'
/** /**
* 路由策略上下文 * 路由策略上下文
...@@ -14,6 +18,12 @@ export function RouteContext(page) { ...@@ -14,6 +18,12 @@ export function RouteContext(page) {
* @param {Object} res 路由参数 * @param {Object} res 路由参数
*/ */
RouteContext.prototype.execute = async function (res) { RouteContext.prototype.execute = async function (res) {
const lowPriceOrderPatch = buildLowPriceOrderPatch(res)
if (Object.keys(lowPriceOrderPatch).length) {
this.page.setData({
orderObj: mergeLowPriceOrderContext(this.page.data.orderObj, res)
})
}
// 1. 公共前置处理 (PaymentMethod) // 1. 公共前置处理 (PaymentMethod)
if (res && res.paymentMethod) { if (res && res.paymentMethod) {
this.page.setData({ this.page.setData({
...@@ -286,6 +296,10 @@ MerchantStrategy.prototype = Object.create(BaseStrategy.prototype) ...@@ -286,6 +296,10 @@ MerchantStrategy.prototype = Object.create(BaseStrategy.prototype)
MerchantStrategy.prototype.constructor = MerchantStrategy MerchantStrategy.prototype.constructor = MerchantStrategy
MerchantStrategy.prototype.finalHandle = function (res) { MerchantStrategy.prototype.finalHandle = function (res) {
if (Number(res?.lowPriceFlag) === 1) {
BaseStrategy.prototype.finalHandle.call(this, res)
return
}
this.page.setData({ this.page.setData({
returnFun: true returnFun: true
}) })
......
/**
* @file 低价提单商品价格规则
* 纯规则模块:不访问页面实例,不调用 wx,不发请求。
*/
export const LOW_PRICE_NOT_TRIGGERED_MESSAGE =
'价格未触发最低价,其他正常单请到生意助手侧录单'
function toFiniteNumber(value) {
if (value === '' || value === null || value === undefined) return null
const number = Number(value)
return Number.isFinite(number) ? number : null
}
/**
* 展开创建页 goodsList 的实际提交商品。
* @param {Array<object>} goodsList
* @returns {Array<object>}
*/
export function resolveLowPriceGoodsEntries(goodsList = []) {
const entries = []
;(Array.isArray(goodsList) ? goodsList : []).forEach(line => {
if (line?.goods) {
entries.push(line.goods)
return
}
if (line?.multipleSpecificationsGoods?.goods) {
entries.push(line.multipleSpecificationsGoods.goods)
return
}
if (Array.isArray(line?.packageGoods?.goodsList)) {
line.packageGoods.goodsList.forEach(goods => {
if (goods) entries.push(goods)
})
}
})
return entries
}
/**
* 当前改价后的基础单价。折扣后的 finalPrice 不参与低价触发判断。
* @param {object} goods
* @returns {number|null}
*/
export function resolveLowPriceCurrentPrice(goods = {}) {
const rawPrice =
goods.basePrice !== undefined && goods.basePrice !== ''
? goods.basePrice
: goods.sellPrice !== undefined && goods.sellPrice !== ''
? goods.sellPrice
: goods.price
return toFiniteNumber(rawPrice)
}
/**
* @param {object} goods
* @returns {{valid:boolean, enabled:boolean, minPrice:number|null, currentPrice:number|null}}
*/
export function validateLowPriceGoods(goods = {}) {
const enabled = goods?.validMinSellPrice === 'Y'
const minPrice = toFiniteNumber(goods?.minSellPrice)
const currentPrice = resolveLowPriceCurrentPrice(goods)
return {
valid:
enabled &&
minPrice !== null &&
currentPrice !== null &&
currentPrice < minPrice,
enabled,
minPrice,
currentPrice
}
}
/**
* @param {Array<object>} goodsList
* @returns {{valid:boolean, invalidGoods:Array<object>, entries:Array<object>}}
*/
export function validateLowPriceGoodsList(goodsList = []) {
const entries = resolveLowPriceGoodsEntries(goodsList)
const invalidGoods = entries.filter(goods => !validateLowPriceGoods(goods).valid)
return {
valid: invalidGoods.length === 0,
invalidGoods,
entries
}
}
/**
* 同步商品行最低价文案和低价单错误态。
* 仅应由 lowPriceFlag=1 的页面分支调用。
* @param {Array<object>} goodsList
* @returns {{valid:boolean, invalidGoods:Array<object>, entries:Array<object>}}
*/
export function applyLowPriceGoodsValidation(goodsList = []) {
const result = validateLowPriceGoodsList(goodsList)
result.entries.forEach(goods => {
const validation = validateLowPriceGoods(goods)
goods.lowPriceMinPriceText =
validation.enabled && validation.minPrice !== null
? `最低价:¥${validation.minPrice}`
: '最低价:未开启'
goods.errorTarget = !validation.valid
goods.checkError = !validation.valid
goods.basePriceError = !validation.valid
})
return result
}
const LOW_PRICE_CONTEXT_FIELDS = [
'merchantId',
'merchantName',
'yqMerchantId',
'yqMerchantName',
'sellerMerchantId',
'sellerMerchantName'
]
export function buildLowPriceOrderPatch(source = {}) {
if (Number(source.lowPriceFlag) !== 1) return {}
const patch = { lowPriceFlag: 1 }
LOW_PRICE_CONTEXT_FIELDS.forEach(key => {
if (source[key] !== undefined && source[key] !== null && source[key] !== '') {
patch[key] = source[key]
}
})
if (!patch.sellerMerchantId && patch.yqMerchantId) {
patch.sellerMerchantId = patch.yqMerchantId
}
if (!patch.sellerMerchantName && patch.yqMerchantName) {
patch.sellerMerchantName = patch.yqMerchantName
}
return patch
}
export function mergeLowPriceOrderContext(orderObj = {}, source = {}) {
return {
...orderObj,
...buildLowPriceOrderPatch(source)
}
}
...@@ -43,6 +43,31 @@ export const STAFF_MODE = { ...@@ -43,6 +43,31 @@ export const STAFF_MODE = {
DELIVERY: 'delivery' DELIVERY: 'delivery'
} }
/**
* 员工选择使用的园区/4S 店范围。
* 低价单优先使用前一步选定的下单门店;其他流程保持原用户上下文。
* @param {Object} [orderObj]
* @param {Object} [userContext]
*/
export function resolveStaffMerchantScope(orderObj = {}, userContext = {}) {
if (Number(orderObj.lowPriceFlag) === 1) {
return {
parkMerchantId:
orderObj.yqMerchantId ||
orderObj.sellerMerchantId ||
userContext.parkMerchantId ||
'',
shopMerchantId:
orderObj.merchantId || userContext.shopMerchantId || ''
}
}
return {
parkMerchantId: userContext.parkMerchantId || '',
shopMerchantId: userContext.shopMerchantId || ''
}
}
const MODE_CONFIG = { const MODE_CONFIG = {
[STAFF_MODE.SALES]: { [STAFF_MODE.SALES]: {
merchantTitle: '选择合作门店', merchantTitle: '选择合作门店',
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
hasStaffConflict, hasStaffConflict,
markMerchantActive, markMerchantActive,
markStaffActive, markStaffActive,
resolveStaffMerchantScope,
resolveSelectedMerchant, resolveSelectedMerchant,
shouldEchoSystemStaff, shouldEchoSystemStaff,
shouldUseSystemStaffFallback, shouldUseSystemStaffFallback,
...@@ -39,6 +40,7 @@ export { ...@@ -39,6 +40,7 @@ export {
getSelectedStaff, getSelectedStaff,
hasStaffConflict, hasStaffConflict,
isSystemStaff, isSystemStaff,
resolveStaffMerchantScope,
resolveSelectedMerchant, resolveSelectedMerchant,
shouldEchoSystemStaff, shouldEchoSystemStaff,
shouldUseSystemStaffFallback, shouldUseSystemStaffFallback,
...@@ -59,10 +61,25 @@ async function fetchMerchantList(mode, context) { ...@@ -59,10 +61,25 @@ async function fetchMerchantList(mode, context) {
const isSalesLike = const isSalesLike =
mode === STAFF_MODE.SALES || mode === STAFF_MODE.DELIVERY mode === STAFF_MODE.SALES || mode === STAFF_MODE.DELIVERY
if (
isSalesLike &&
Number(orderObj.lowPriceFlag) === 1 &&
orderObj.merchantId
) {
return [
{
merchantId: orderObj.merchantId,
merchantName: orderObj.merchantName || ''
}
]
}
const merchantScope = resolveStaffMerchantScope(orderObj, userContext)
let data = [] let data = []
if (isSalesLike) { if (isSalesLike) {
const res = await api.getSceneMerchantRefStoreList({ const res = await api.getSceneMerchantRefStoreList({
merchantId: userContext.parkMerchantId, merchantId: merchantScope.parkMerchantId,
scene: SCENE, scene: SCENE,
staffUUID: orderObj.sellerUserId staffUUID: orderObj.sellerUserId
}) })
...@@ -71,7 +88,7 @@ async function fetchMerchantList(mode, context) { ...@@ -71,7 +88,7 @@ async function fetchMerchantList(mode, context) {
} }
data = res.data || [] data = res.data || []
if (config.singleSeller) { if (config.singleSeller) {
data = data.filter(item => item.merchantId == userContext.shopMerchantId) data = data.filter(item => item.merchantId == merchantScope.shopMerchantId)
} }
} else { } else {
const res = await api.getYQList() const res = await api.getYQList()
......
/**
* 仅允许工作台新建工单入口传入的显式标记跳过业务守卫。
* 路由参数在小程序中可能被序列化为字符串。
*
* @param {{ skipOrderGuards?: boolean|string|number }} context
* @returns {boolean}
*/
export function shouldSkipOrderBusinessGuards(context = {}) {
const marker = context.skipOrderGuards
return marker === true || marker === 'true' || marker === '1'
}
import {
checkDailyReport,
checkStudyTask,
checkOrderLockGate
} from '~/store/ModalToQueueControl'
import { buildAdditionRecordLockBypassContext } from '~/utils/abnormalFlowLock.helpers.js'
import api from '../../api' import api from '../../api'
import NP from 'number-precision' import NP from 'number-precision'
import { buildSubmitGoodsSnapshot } from './services/submitGoodsSnapshot' import { buildSubmitGoodsSnapshot } from './services/submitGoodsSnapshot'
import { prepareSubmitPayload } from './services/submitPayload.helpers.js' import { prepareSubmitPayload } from './services/submitPayload.helpers.js'
import { shouldSkipOrderBusinessGuards } from './services/newOrderGuardPolicy.js'
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// 辅助构造函数:校验结果 // 辅助构造函数:校验结果
...@@ -37,34 +30,7 @@ ValidationResult.errorKey = function (key) { ...@@ -37,34 +30,7 @@ ValidationResult.errorKey = function (key) {
// 实际上不需要复杂的继承结构,只需确保每个策略对象都有 validate 方法即可。 // 实际上不需要复杂的继承结构,只需确保每个策略对象都有 validate 方法即可。
// 这里使用工厂函数模式来创建策略对象。 // 这里使用工厂函数模式来创建策略对象。
// 1. 异步前置校验 (日报、学习任务、配置) // 1. 状态与权限校验
function AsyncPreCheckStrategy(page, context) {
this.page = page
this.context = context
}
AsyncPreCheckStrategy.prototype.validate = async function () {
// 手机号默认值属于页面配置,不属于本次要求跳过的业务拦截。
this.page.checkPhoneUseConfig()
if (shouldSkipOrderBusinessGuards(this.page.data)) {
return ValidationResult.success()
}
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return ValidationResult.failure(null) // checkDailyReport 自带提示或跳转
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return ValidationResult.failure(null)
let lockCheck = await checkOrderLockGate(
buildAdditionRecordLockBypassContext(this.page.data)
)
if (lockCheck) return ValidationResult.failure(null)
return ValidationResult.success()
}
// 2. 状态与权限校验
function StatePermissionStrategy(page, context) { function StatePermissionStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -87,7 +53,7 @@ StatePermissionStrategy.prototype.validate = async function () { ...@@ -87,7 +53,7 @@ StatePermissionStrategy.prototype.validate = async function () {
return ValidationResult.success() return ValidationResult.success()
} }
// 3. 必填项校验 // 2. 必填项校验
function RequiredFieldStrategy(page, context) { function RequiredFieldStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -104,7 +70,7 @@ RequiredFieldStrategy.prototype.validate = async function () { ...@@ -104,7 +70,7 @@ RequiredFieldStrategy.prototype.validate = async function () {
return ValidationResult.success() return ValidationResult.success()
} }
// 4. VIN码校验 // 3. VIN码校验
function VinValidationStrategy(page, context) { function VinValidationStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -128,7 +94,7 @@ VinValidationStrategy.prototype.validate = async function () { ...@@ -128,7 +94,7 @@ VinValidationStrategy.prototype.validate = async function () {
return ValidationResult.success() return ValidationResult.success()
} }
// 5. 商品校验 // 4. 商品校验
function GoodsValidationStrategy(page, context) { function GoodsValidationStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -156,7 +122,7 @@ GoodsValidationStrategy.prototype.validate = async function () { ...@@ -156,7 +122,7 @@ GoodsValidationStrategy.prototype.validate = async function () {
return ValidationResult.success() return ValidationResult.success()
} }
// 6. 错单金额校验 // 5. 错单金额校验
function ErrorOrderPriceStrategy(page, context) { function ErrorOrderPriceStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -188,7 +154,7 @@ ErrorOrderPriceStrategy.prototype.validate = async function () { ...@@ -188,7 +154,7 @@ ErrorOrderPriceStrategy.prototype.validate = async function () {
return ValidationResult.success() return ValidationResult.success()
} }
// 7. 总价校验 // 6. 总价校验
function TotalPriceStrategy(page, context) { function TotalPriceStrategy(page, context) {
this.page = page this.page = page
this.context = context this.context = context
...@@ -220,11 +186,13 @@ function SubmitContext(page) { ...@@ -220,11 +186,13 @@ function SubmitContext(page) {
SubmitContext.prototype.execute = async function (event) { SubmitContext.prototype.execute = async function (event) {
const dataset = event.currentTarget.dataset const dataset = event.currentTarget.dataset
const save = dataset.save const save = dataset.save
const context = { save: save } const context = { save }
// 手机号默认值属于页面配置,保留在订单数据校验之前处理。
this.page.checkPhoneUseConfig()
// 1. 构建校验链 // 1. 构建校验链
const strategies = [ const strategies = [
new AsyncPreCheckStrategy(this.page, context),
new StatePermissionStrategy(this.page, context), new StatePermissionStrategy(this.page, context),
new GoodsValidationStrategy(this.page, context), new GoodsValidationStrategy(this.page, context),
new RequiredFieldStrategy(this.page, context), new RequiredFieldStrategy(this.page, context),
......
import { readFileSync } from 'node:fs'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
const template = readFileSync(
new URL('../createOrder.wxml', import.meta.url),
'utf8'
)
const actionsStart = template.indexOf('<view class="btns-con">')
const actionsEnd = template.indexOf('\n\t</view>', actionsStart)
const actions = template.slice(actionsStart, actionsEnd)
describe('createOrder bottom actions', () => {
it('only exposes direct order submission without the archive action', () => {
assert.ok(actionsStart >= 0)
assert.ok(actionsEnd > actionsStart)
assert.match(actions, /class="confirm text-center" bindtap="submit">直接下单<\/view>/)
assert.doesNotMatch(actions, /data-save/)
assert.doesNotMatch(actions, />建档<\/view>/)
})
})
...@@ -6,6 +6,10 @@ const template = readFileSync( ...@@ -6,6 +6,10 @@ const template = readFileSync(
new URL('../createOrder.wxml', import.meta.url), new URL('../createOrder.wxml', import.meta.url),
'utf8' 'utf8'
) )
const constantsSource = readFileSync(
new URL('../constants.js', import.meta.url),
'utf8'
)
const start = template.indexOf('<view class="customerName">') const start = template.indexOf('<view class="customerName">')
const end = template.indexOf( const end = template.indexOf(
'\n\t\t<view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">', '\n\t\t<view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">',
...@@ -19,22 +23,29 @@ describe('createOrder customer information template', () => { ...@@ -19,22 +23,29 @@ describe('createOrder customer information template', () => {
assert.ok(end > start) assert.ok(end > start)
assert.match(customerSection, /bindtitleClick="showCustomPop"/) assert.match(customerSection, /bindtitleClick="showCustomPop"/)
assert.match(customerSection, /label="车主姓名"/) assert.match(customerSection, /label="车主姓名"/)
assert.match(customerSection, /iconSrc="\{\{ recordIcon \}\}"/)
assert.match(
constantsSource,
/RECORD_ICON: `\$\{CDN_BASE\}\/miniProgram\/record\.png`/
)
assert.match(customerSection, /labelWidth="var\(--fontSize290\)"/) assert.match(customerSection, /labelWidth="var\(--fontSize290\)"/)
assert.match(customerSection, /orderObj\.customer\.customerName \|\| '请通过客户档案选择'/) assert.match(customerSection, /orderObj\.customer\.customerName \|\| '请通过选择客户档案'/)
assert.equal(customerSection.match(/请通过选择客户档案/g)?.length, 1)
assert.doesNotMatch(customerSection, /请通过客户档案选择/)
assert.match(customerSection, /label="客户来源"/) assert.match(customerSection, /label="客户来源"/)
assert.match(customerSection, /filter\.getSalesTypeName\(Sourcecolumns, orderObj\.customer\.salesType\) \|\| '请通过客户档案选择'/) assert.match(customerSection, /value="\{\{ filter\.getSalesTypeName\(Sourcecolumns, orderObj\.customer\.salesType\) \}\}"/)
assert.match(customerSection, /label="性别"/) assert.match(customerSection, /label="性别"/)
assert.match(customerSection, /orderObj\.customer\.customerSex == 1 \? '男' : \(orderObj\.customer\.customerSex == 2 \? '女' : '请通过客户档案选择'\)/) assert.match(customerSection, /orderObj\.customer\.customerSex == 1 \? '男' : \(orderObj\.customer\.customerSex == 2 \? '女' : ''\)/)
assert.match(customerSection, /label="手机号"/) assert.match(customerSection, /label="手机号"/)
assert.match(customerSection, /orderObj\.customer\.customerPhone \|\| '请通过客户档案选择'/) assert.match(customerSection, /value="\{\{ orderObj\.customer\.customerPhone \}\}"/)
assert.match(customerSection, /label="选择车型"/) assert.match(customerSection, /label="选择车型"/)
assert.match(customerSection, /orderObj\.customer\.carSeriesName \? orderObj\.customer\.carBrand \+ ' - ' \+ orderObj\.customer\.carChildsBrandName \+ ' - ' \+ orderObj\.customer\.carSeriesName : '请通过客户档案选择'/) assert.match(customerSection, /orderObj\.customer\.carSeriesName \? orderObj\.customer\.carBrand \+ ' - ' \+ orderObj\.customer\.carChildsBrandName \+ ' - ' \+ orderObj\.customer\.carSeriesName : ''/)
assert.match(customerSection, /label="车架号\( VIN \)"/) assert.match(customerSection, /label="车架号\( VIN \)"/)
assert.match(customerSection, /orderObj\.customer\.standNo \|\| '请通过客户档案选择'/) assert.match(customerSection, /value="\{\{ orderObj\.customer\.standNo \}\}"/)
assert.match(customerSection, /label="车牌号"/) assert.match(customerSection, /label="车牌号"/)
assert.match(customerSection, /orderObj\.customer\.plateNumber \|\| '请通过客户档案选择'/) assert.match(customerSection, /value="\{\{ orderObj\.customer\.plateNumber \}\}"/)
assert.match(customerSection, /label="是否体验"/) assert.match(customerSection, /label="是否体验"/)
assert.match(customerSection, /orderObj\.customer\.experienceFlag == 'Y' \? '是' : \(orderObj\.customer\.experienceFlag == 'N' \? '否' : '请通过客户档案选择'\)/) assert.match(customerSection, /orderObj\.customer\.experienceFlag == 'Y' \? '是' : \(orderObj\.customer\.experienceFlag == 'N' \? '否' : ''\)/)
assert.doesNotMatch(customerSection, /<input/) assert.doesNotMatch(customerSection, /<input/)
assert.doesNotMatch(customerSection, /bind:click="toSelectCustomerSource"/) assert.doesNotMatch(customerSection, /bind:click="toSelectCustomerSource"/)
assert.doesNotMatch(customerSection, /bindtap="changeGender"/) assert.doesNotMatch(customerSection, /bindtap="changeGender"/)
...@@ -42,4 +53,9 @@ describe('createOrder customer information template', () => { ...@@ -42,4 +53,9 @@ describe('createOrder customer information template', () => {
assert.doesNotMatch(customerSection, /bindtitleClick="navOcr"/) assert.doesNotMatch(customerSection, /bindtitleClick="navOcr"/)
assert.doesNotMatch(customerSection, /bindtap="changeExperience"/) assert.doesNotMatch(customerSection, /bindtap="changeExperience"/)
}) })
it('queries customer archives with the 4S store selected before order creation', () => {
assert.match(template, /<customerInfo[\s\S]*merchantId="\{\{ orderObj\.merchantId \|\| 0 \}\}"/)
assert.doesNotMatch(template, /<customerInfo[\s\S]*merchantId="\{\{ workOrderUserContext\.shopMerchantId \|\| 0 \}\}"/)
})
}) })
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
LOW_PRICE_NOT_TRIGGERED_MESSAGE,
resolveLowPriceGoodsEntries,
validateLowPriceGoods,
validateLowPriceGoodsList,
applyLowPriceGoodsValidation
} from '../services/lowPriceGoodsValidation.helpers.js'
describe('lowPriceGoodsValidation.helpers', () => {
it('IT-WO-LPG-001: accepts an enabled product only when input price is strictly below minSellPrice', () => {
assert.deepEqual(
validateLowPriceGoods({
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 99.99
}),
{
valid: true,
enabled: true,
minPrice: 100,
currentPrice: 99.99
}
)
assert.equal(
validateLowPriceGoods({
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 100
}).valid,
false
)
assert.equal(
validateLowPriceGoods({
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 101
}).valid,
false
)
})
it('IT-WO-LPG-002: rejects disabled, missing-minimum and empty-price products', () => {
const invalidGoods = [
{ validMinSellPrice: 'N', minSellPrice: 100, sellPrice: 50 },
{ validMinSellPrice: 'Y', sellPrice: 50 },
{ validMinSellPrice: 'Y', minSellPrice: '', sellPrice: 50 },
{ validMinSellPrice: 'Y', minSellPrice: 100, sellPrice: '' }
]
invalidGoods.forEach(goods => {
assert.equal(validateLowPriceGoods(goods).valid, false)
})
})
it('IT-WO-LPG-003: validates the edited basePrice before catalog sellPrice', () => {
const result = validateLowPriceGoods({
validMinSellPrice: 'Y',
minSellPrice: 100,
basePrice: 80,
sellPrice: 120,
price: 130
})
assert.equal(result.currentPrice, 80)
assert.equal(result.valid, true)
})
it('IT-WO-LPG-004: flattens single goods, selected SKU and every package child', () => {
const single = { sellPrice: 10 }
const sku = { sellPrice: 20 }
const packageChildA = { sellPrice: 30 }
const packageChildB = { sellPrice: 40 }
assert.deepEqual(
resolveLowPriceGoodsEntries([
{ goodsFlag: 1, goods: single },
{
goodsFlag: 2,
multipleSpecificationsGoods: { goods: sku }
},
{
goodsFlag: 3,
packageGoods: { goodsList: [packageChildA, packageChildB] }
}
]),
[single, sku, packageChildA, packageChildB]
)
})
it('IT-WO-LPG-005: whole-order validation fails when any leaf does not trigger minimum price', () => {
const result = validateLowPriceGoodsList([
{
goodsFlag: 1,
goods: {
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 80
}
},
{
goodsFlag: 3,
packageGoods: {
goodsList: [
{
validMinSellPrice: 'Y',
minSellPrice: 50,
sellPrice: 50
}
]
}
}
])
assert.equal(result.valid, false)
assert.equal(result.invalidGoods.length, 1)
})
it('IT-WO-LPG-006: applies minimum-price echo and clears stale normal-order errors for valid low-price goods', () => {
const valid = {
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 80,
errorTarget: true,
checkError: true,
basePriceError: true
}
const disabled = {
validMinSellPrice: 'N',
minSellPrice: 60,
sellPrice: 30
}
const goodsList = [
{ goodsFlag: 1, goods: valid },
{ goodsFlag: 1, goods: disabled }
]
const result = applyLowPriceGoodsValidation(goodsList)
assert.equal(result.valid, false)
assert.equal(valid.lowPriceMinPriceText, '最低价:¥100')
assert.equal(valid.errorTarget, false)
assert.equal(valid.checkError, false)
assert.equal(valid.basePriceError, false)
assert.equal(disabled.lowPriceMinPriceText, '最低价:未开启')
assert.equal(disabled.errorTarget, true)
})
it('IT-WO-LPG-007: exposes the required reminder copy', () => {
assert.equal(
LOW_PRICE_NOT_TRIGGERED_MESSAGE,
'价格未触发最低价,其他正常单请到生意助手侧录单'
)
})
})
import { readFileSync } from 'node:fs'
import { register } from 'node:module'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
register(
'../../../../tests/work-order-migration/shims/create-order-context-loader.mjs',
import.meta.url
)
const pageSource = readFileSync(
new URL('../createOrder.js', import.meta.url),
'utf8'
)
const pageTemplate = readFileSync(
new URL('../createOrder.wxml', import.meta.url),
'utf8'
)
const rowComponentSource = readFileSync(
new URL('../components/OrderGoodsRow/order-goods-row.js', import.meta.url),
'utf8'
)
const rowComponentTemplate = readFileSync(
new URL('../components/OrderGoodsRow/order-goods-row.wxml', import.meta.url),
'utf8'
)
const chooseGoodsStart = pageSource.indexOf(' chooseGoods(e) {')
const chooseGoodsEnd = pageSource.indexOf('\n isLowPriceOrder()', chooseGoodsStart)
const chooseGoodsSource = pageSource.slice(chooseGoodsStart, chooseGoodsEnd)
describe('createOrder low-price goods integration', () => {
it('IT-WO-LPG-008: selection only syncs state while live price input enables the reminder', () => {
assert.match(
pageSource,
/LOW_PRICE_NOT_TRIGGERED_MESSAGE[\s\S]*applyLowPriceGoodsValidation/
)
assert.match(
pageSource,
/Number\(this\.data\.orderObj\?\.lowPriceFlag\) === 1/
)
assert.match(chooseGoodsSource, /applyLowPriceGoodsRules\(selectedGoodsList\)/)
assert.doesNotMatch(chooseGoodsSource, /notify:\s*true/)
assert.match(
pageSource,
/changeMealPrice\(e\)[\s\S]*applyLowPriceGoodsRules\(goodsList,\s*\{\s*notify:\s*true\s*\}\)/
)
assert.match(
pageSource,
/changePrice\(e\)[\s\S]*applyLowPriceGoodsRules\(goodsList,\s*\{\s*notify:\s*true\s*\}\)/
)
assert.match(
pageSource,
/wx\.\$util\.showToast\(LOW_PRICE_NOT_TRIGGERED_MESSAGE\)/
)
})
it('IT-WO-LPG-009: revalidates the full goods list before building the submit payload', () => {
assert.match(
pageSource,
/checkGoods\(save, subOrderList, priceDisabled, goodsList, orderObj\)[\s\S]*Number\(orderObj\?\.lowPriceFlag\) === 1[\s\S]*applyLowPriceGoodsValidation\(goodsList\)[\s\S]*LOW_PRICE_NOT_TRIGGERED_MESSAGE/
)
})
it('IT-WO-LPG-010: passes lowPriceFlag to every selected-goods row and renders the minimum-price echo only for low-price orders', () => {
const rowTags = [
...pageTemplate.matchAll(/<order-goods-row[\s\S]*?\/>/g)
].map(match => match[0])
assert.ok(rowTags.length > 0)
rowTags.forEach(tag => {
assert.match(tag, /lowPriceFlag="\{\{ orderObj\.lowPriceFlag \}\}"/)
})
assert.match(rowComponentSource, /lowPriceFlag:\s*\{[\s\S]*type:\s*Number/)
assert.match(
rowComponentTemplate,
/class="low-price-minimum"\s+wx:if="\{\{ lowPriceFlag == 1 \}\}">\{\{product\.lowPriceMinPriceText\}\}/
)
})
it('IT-WO-LPG-011: selection stays silent, live input warns, and submit blocks invalid low-price goods', async () => {
let pageConfig
const toastMessages = []
globalThis.getApp = () => ({ globalData: {} })
globalThis.Page = config => {
pageConfig = config
}
globalThis.wx = {
getAccountInfoSync: () => ({
miniProgram: { appId: 'test-app-id', envVersion: 'develop' }
}),
getSystemInfoSync: () => ({ platform: 'devtools' }),
getStorageSync: () => '',
$util: {
getUserInfo: () => ({}),
showToast: message => toastMessages.push(message)
}
}
await import(`../createOrder.js?low-price-goods=${Date.now()}`)
const lowPriceGoods = {
validMinSellPrice: 'N',
minSellPrice: 100,
sellPrice: 80
}
const lowPriceGoodsList = [{ goodsFlag: 1, goods: lowPriceGoods }]
const lowPricePage = {
...pageConfig,
data: {
orderObj: { lowPriceFlag: 1 },
goodsList: lowPriceGoodsList
},
setData(patch) {
Object.assign(this.data, patch)
}
}
lowPricePage.chooseGoods({ detail: lowPriceGoodsList })
assert.equal(lowPriceGoods.lowPriceMinPriceText, '最低价:未开启')
assert.deepEqual(toastMessages, [])
const liveResult = lowPricePage.applyLowPriceGoodsRules(
lowPriceGoodsList,
{ notify: true }
)
const submitMessage = lowPricePage.checkGoods(
false,
[],
true,
lowPriceGoodsList,
lowPricePage.data.orderObj
)
assert.equal(liveResult.valid, false)
assert.equal(lowPriceGoods.errorTarget, true)
assert.deepEqual(toastMessages, [
'价格未触发最低价,其他正常单请到生意助手侧录单'
])
assert.equal(
submitMessage,
'价格未触发最低价,其他正常单请到生意助手侧录单'
)
const normalGoods = {
validMinSellPrice: 'Y',
minSellPrice: 100,
sellPrice: 80
}
const normalPage = {
...pageConfig,
data: {
orderObj: { lowPriceFlag: 0 },
goodsList: [{ goodsFlag: 1, goods: normalGoods }]
}
}
assert.equal(normalPage.applyLowPriceGoodsRules().valid, true)
assert.equal(normalGoods.lowPriceMinPriceText, undefined)
})
})
import assert from 'node:assert/strict'
import { register } from 'node:module'
import test from 'node:test'
register(
'../../../../tests/work-order-migration/shims/create-order-context-loader.mjs',
import.meta.url
)
test('低价单关联门店接口为空时仍回显前一步选中的 4S 店', async () => {
globalThis.__WORK_ORDER_MOCK_API__ = {
getSceneMerchantRefStoreList() {
return { code: 0, data: [] }
}
}
try {
const { STAFF_MODE, fetchMerchants } = await import(
`../services/merchantStaffSelection.js?selected-store=${Date.now()}`
)
const result = await fetchMerchants(STAFF_MODE.SALES, {
orderObj: {
lowPriceFlag: 1,
merchantId: 44210999,
merchantName: '前一步选中的4S店',
yqMerchantId: 44211999,
sellerMerchantId: 44211999
},
userContext: {
parkMerchantId: 44211025,
shopMerchantId: 44210895
}
})
assert.deepEqual(result.merchantList, [
{
merchantId: 44210999,
merchantName: '前一步选中的4S店',
active: true
}
])
assert.equal(result.selectedMerchantId, 44210999)
} finally {
delete globalThis.__WORK_ORDER_MOCK_API__
}
})
import { describe, it } from 'node:test' import { describe, it } from 'node:test'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import * as merchantStaffHelpers from '../services/merchantStaffSelection.helpers.js'
import { import {
STAFF_MODE, STAFF_MODE,
applySystemStaffFallbackIfNeeded, applySystemStaffFallbackIfNeeded,
...@@ -159,4 +160,54 @@ describe('merchantStaffSelection', () => { ...@@ -159,4 +160,54 @@ describe('merchantStaffSelection', () => {
}) })
assert.equal(result[0].staffName, '系统') assert.equal(result[0].staffName, '系统')
}) })
it('低价单销售顾问使用前一步选中的园区店和 4S 店', () => {
assert.equal(
typeof merchantStaffHelpers.resolveStaffMerchantScope,
'function',
'尚未实现 resolveStaffMerchantScope'
)
const scope = merchantStaffHelpers.resolveStaffMerchantScope(
{
lowPriceFlag: 1,
merchantId: 44210999,
yqMerchantId: 44211999,
sellerMerchantId: 44211999
},
{
parkMerchantId: 44211025,
shopMerchantId: 44210895
}
)
assert.deepEqual(scope, {
parkMerchantId: 44211999,
shopMerchantId: 44210999
})
})
it('非低价单销售顾问继续使用原用户门店上下文', () => {
assert.equal(
typeof merchantStaffHelpers.resolveStaffMerchantScope,
'function',
'尚未实现 resolveStaffMerchantScope'
)
const scope = merchantStaffHelpers.resolveStaffMerchantScope(
{
merchantId: 44210999,
sellerMerchantId: 44211999
},
{
parkMerchantId: 44211025,
shopMerchantId: 44210895
}
)
assert.deepEqual(scope, {
parkMerchantId: 44211025,
shopMerchantId: 44210895
})
})
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!