Commit 7d5f7c96 by 张立顺

feat 日报功能开发

1 parent d1b8a1e0
Showing 32 changed files with 1275 additions and 36 deletions
...@@ -193,7 +193,7 @@ Component({ ...@@ -193,7 +193,7 @@ Component({
api.logout().then(_res_ => { api.logout().then(_res_ => {
let { code, message } = _res_ let { code, message } = _res_
if (code == 0) { if (code == 0) {
wx.$storage.remove('abnormalFlowPop') wx.$storage.rm('abnormalFlowPop')
app.login(false) app.login(false)
} else { } else {
_this.setData({ _this.setData({
......
...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false ...@@ -22,7 +22,7 @@ export const RECRUIT_MENU_ENABLED = false
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = getSystemInfoSync(); const systemInfo = getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
...@@ -162,7 +162,8 @@ Component({ ...@@ -162,7 +162,8 @@ Component({
[dataAttrName + '.' + target.labelName]: target.optionList[idx][target.optionLabel] [dataAttrName + '.' + target.labelName]: target.optionList[idx][target.optionLabel]
}) })
this.triggerEvent('pickerChange', { this.triggerEvent('pickerChange', {
obj: target.optionList[idx] obj: target.optionList[idx],
attr: target.name
}) })
}, },
handleTimeChange(e) { handleTimeChange(e) {
......
// packageEquity/pages/carQuotation/CarQuotationDetail/CarQuotationDetail.js // packageEquity/pages/carQuotation/CarQuotationDetail/CarQuotationDetail.js
import { getOrderDetail,getQuotationInfoById, updateCustomerInfo } from '../../../api' import { getOrderDetail,getQuotationInfoById, updateCustomerInfo } from '../../../api'
import {
formatEquityDeliveryDateForDisplay,
getEquityCustomerTagLabels,
isEquityActualDeliveryDateVisible,
isEquityCustomerTagsVisible
} from '../services/customerDailyFields.helpers.js'
let timer = null let timer = null
Page({ Page({
/** /**
...@@ -13,7 +19,9 @@ Page({ ...@@ -13,7 +19,9 @@ Page({
timer: null timer: null
}, },
showZyPopup: false, showZyPopup: false,
zyFlag: false zyFlag: false,
customerDailyInfo: {},
customerTagLabels: []
}, },
// 倒计时10s功能 // 倒计时10s功能
...@@ -136,13 +144,28 @@ Page({ ...@@ -136,13 +144,28 @@ Page({
} }
// 处理用于上传合同协议更新客户信息接口的参数 // 处理用于上传合同协议更新客户信息接口的参数
let zyPayOrderInfo = this.getInsurance(data) let zyPayOrderInfo = this.getInsurance(data)
const owner = data?.owner || {}
const customerDailyInfo = {
showCustomerTags: isEquityCustomerTagsVisible(owner.salesType),
showActualDeliveryDate: isEquityActualDeliveryDateVisible(
owner.salesType
),
actualDeliveryDate: formatEquityDeliveryDateForDisplay(
owner.actualDeliveryDate
)
}
const customerTagLabels = getEquityCustomerTagLabels(
owner.customerTags
)
this.setData({ this.setData({
orderCode: payId, orderCode: payId,
merchantAddress, merchantAddress,
merchantName4s, merchantName4s,
orderId, orderId,
['orderDetail.quotationGoodsInfoList']:quotationGoodsInfoList, ['orderDetail.quotationGoodsInfoList']:quotationGoodsInfoList,
zyPayOrderInfo zyPayOrderInfo,
customerDailyInfo,
customerTagLabels
// quotationGoodsInfoList // quotationGoodsInfoList
// id // id
}) })
......
...@@ -60,6 +60,58 @@ ...@@ -60,6 +60,58 @@
width: var(--fontSize710); width: var(--fontSize710);
margin: 0 auto; margin: 0 auto;
} }
.customer-daily-info {
box-sizing: border-box;
width: var(--fontSize710);
margin: var(--fontSize20) auto;
padding: var(--fontSize32) var(--fontSize40);
background: #FFFFFF;
box-shadow: 0 var(--fontSize6) var(--fontSize16) 0 #cdcdd159;
border-radius: var(--fontSize16);
.title {
margin-bottom: var(--fontSize28);
font-size: var(--fontSize32);
font-weight: 600;
color: #222222;
}
.item {
display: flex;
align-items: flex-start;
margin-bottom: var(--fontSize28);
font-size: var(--fontSize28);
&:last-child {
margin-bottom: 0;
}
}
.label {
flex-shrink: 0;
width: var(--fontSize200);
color: #999EA8;
}
.text {
color: #292D33;
}
}
.customer-tag-list {
display: flex;
flex-wrap: wrap;
gap: var(--fontSize12);
}
.customer-tag {
padding: var(--fontSize6) var(--fontSize14);
color: #347BFF;
background: #F2F6FF;
border: var(--fontSize1) solid #9BBCFF;
border-radius: var(--fontSize8);
font-size: var(--fontSize24);
}
.btn_box { .btn_box {
padding: 0 var(--fontSize64) padding: 0 var(--fontSize64)
} }
...@@ -22,6 +22,19 @@ ...@@ -22,6 +22,19 @@
<view class="order-info"> <view class="order-info">
<order-info OderType="detail" orderInfo="{{orderDetail}}" /> <order-info OderType="detail" orderInfo="{{orderDetail}}" />
</view> </view>
<view class="customer-daily-info" wx:if="{{ customerDailyInfo.showCustomerTags || customerDailyInfo.showActualDeliveryDate }}">
<view class="title">客户信息</view>
<view class="item" wx:if="{{ customerDailyInfo.showCustomerTags }}">
<view class="label">日报标签</view>
<view class="customer-tag-list">
<view class="customer-tag" wx:for="{{ customerTagLabels }}" wx:key="*this">{{ item }}</view>
</view>
</view>
<view class="item" wx:if="{{ customerDailyInfo.showActualDeliveryDate }}">
<view class="label">实际交付日期</view>
<view class="text">{{ customerDailyInfo.actualDeliveryDate || '' }}</view>
</view>
</view>
<view class="btn_box"> <view class="btn_box">
<Gl-Button-Group bindbtnTap="btnTap" wx:if="{{showBtnFlag}}" textNameObj="{{textNameObj}}" /> <Gl-Button-Group bindbtnTap="btnTap" wx:if="{{showBtnFlag}}" textNameObj="{{textNameObj}}" />
</view> </view>
......
...@@ -7,6 +7,14 @@ const defaultLabelWidth = 'var(--fontSize140)' ...@@ -7,6 +7,14 @@ const defaultLabelWidth = 'var(--fontSize140)'
import Util from '~/utils/util' import Util from '~/utils/util'
import { validateVin, formatVinInput } from '~/utils/vinVaildate' import { validateVin, formatVinInput } from '~/utils/vinVaildate'
import { ImgUrl } from '~/config' import { ImgUrl } from '~/config'
import {
EQUITY_CUSTOMER_TAGS,
formatEquityCustomerTags,
formatEquityDeliveryDateForDisplay,
parseEquityCustomerTags,
reconcileEquityCustomerDailyFields,
serializeEquityCustomerTags
} from '../../services/customerDailyFields.helpers.js'
const IMG_URL = ImgUrl + '/' const IMG_URL = ImgUrl + '/'
// import api from '~/api/api' // import api from '~/api/api'
Component({ Component({
...@@ -21,7 +29,11 @@ Component({ ...@@ -21,7 +29,11 @@ Component({
type: Object, type: Object,
observer: function (n) { observer: function (n) {
this.setData({ this.setData({
formData: n formData: n,
customerTagsText: formatEquityCustomerTags(n?.customerTags),
actualDeliveryDateText: formatEquityDeliveryDateForDisplay(
n?.actualDeliveryDate
)
}) })
} }
}, },
...@@ -98,7 +110,12 @@ Component({ ...@@ -98,7 +110,12 @@ Component({
createAllGoodsFlag: 1, createAllGoodsFlag: 1,
showSceneSelect: false, showSceneSelect: false,
sceneColumns: [], sceneColumns: [],
sceneDefaultIndex: 0 sceneDefaultIndex: 0,
equityCustomerTagOptions: EQUITY_CUSTOMER_TAGS,
equityCustomerTagDraftOptions: [],
equityCustomerTagsPopup: false,
customerTagsText: '',
actualDeliveryDateText: ''
}, },
lifetimes: { lifetimes: {
...@@ -125,6 +142,83 @@ Component({ ...@@ -125,6 +142,83 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
syncEquityCustomerDailyFields(owner) {
const thisPage = wx.$router.getPageInstance()
const { dataAttrName } = this.data
const nextOwner = reconcileEquityCustomerDailyFields(
owner || thisPage?.data?.[dataAttrName] || {}
)
thisPage.setData({ [dataAttrName]: nextOwner })
this.setData({
customerTagsText: formatEquityCustomerTags(nextOwner.customerTags),
actualDeliveryDateText: formatEquityDeliveryDateForDisplay(
nextOwner.actualDeliveryDate
)
})
},
handlePickerChange(e) {
if (e.detail?.attr !== 'salesType') return
const thisPage = wx.$router.getPageInstance()
this.syncEquityCustomerDailyFields(
thisPage?.data?.[this.data.dataAttrName]
)
},
openEquityCustomerTagsPopup() {
if (this.data.disable) return
const selected = new Set(
parseEquityCustomerTags(this.properties.serviceInfo?.customerTags)
)
this.setData({
equityCustomerTagsPopup: true,
equityCustomerTagDraftOptions: EQUITY_CUSTOMER_TAGS.map(item => ({
...item,
checked: selected.has(item.value)
}))
})
},
onToggleEquityCustomerTag(e) {
const index = Number(e.currentTarget.dataset.index)
this.setData({
equityCustomerTagDraftOptions: (
this.data.equityCustomerTagDraftOptions || []
).map((item, itemIndex) =>
itemIndex === index ? { ...item, checked: !item.checked } : item
)
})
},
onClearEquityCustomerTags() {
this.setData({
equityCustomerTagDraftOptions: (
this.data.equityCustomerTagDraftOptions || []
).map(item => ({ ...item, checked: false }))
})
},
onCancelEquityCustomerTags() {
this.setData({ equityCustomerTagsPopup: false })
},
onConfirmEquityCustomerTags() {
const customerTags = serializeEquityCustomerTags(
(this.data.equityCustomerTagDraftOptions || [])
.filter(item => item.checked)
.map(item => item.value)
)
const thisPage = wx.$router.getPageInstance()
const { dataAttrName } = this.data
this.setData({ equityCustomerTagsPopup: false })
this.syncEquityCustomerDailyFields({
...(thisPage?.data?.[dataAttrName] || {}),
customerTags
})
},
onEquityDeliveryDateChange(e) {
if (this.data.disable) return
const thisPage = wx.$router.getPageInstance()
const { dataAttrName } = this.data
this.syncEquityCustomerDailyFields({
...(thisPage?.data?.[dataAttrName] || {}),
actualDeliveryDate: e.detail.value || ''
})
},
async prefillRecentScene(options = {}) { async prefillRecentScene(options = {}) {
const { const {
refreshGoods = true, refreshGoods = true,
......
...@@ -130,6 +130,90 @@ ...@@ -130,6 +130,90 @@
color: #C3C3C3; color: #C3C3C3;
} }
.daily-field-picker {
min-height: var(--fontSize80);
display: flex;
align-items: center;
justify-content: flex-end;
text-align: right;
font-size: var(--fontSize28);
color: #292D33;
}
.equity-customer-tags-sheet {
padding: 0 var(--fontSize32) calc(var(--fontSize24) + env(safe-area-inset-bottom));
background: #fff;
}
.equity-customer-tags-sheet__title {
height: var(--fontSize96);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize32);
font-weight: 500;
color: #292D33;
border-bottom: var(--fontSize1) solid #EFF0F2;
}
.equity-customer-tags-sheet__item {
height: var(--fontSize88);
display: flex;
align-items: center;
justify-content: space-between;
font-size: var(--fontSize28);
color: #292D33;
border-bottom: var(--fontSize1) solid #EFF0F2;
.active {
color: #347BFF;
}
}
.equity-customer-tags-sheet__check {
width: var(--fontSize40);
text-align: center;
font-size: var(--fontSize34);
}
.equity-customer-tags-sheet__footer {
display: flex;
align-items: center;
gap: var(--fontSize20);
padding-top: var(--fontSize32);
font-size: var(--fontSize30);
}
.equity-customer-tags-sheet__clear,
.equity-customer-tags-sheet__cancel,
.equity-customer-tags-sheet__confirm {
height: var(--fontSize80);
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--fontSize12);
}
.equity-customer-tags-sheet__clear {
width: 18%;
color: #347BFF;
}
.equity-customer-tags-sheet__cancel,
.equity-customer-tags-sheet__confirm {
flex: 1;
}
.equity-customer-tags-sheet__cancel {
color: #292D33;
background: #F5F6F8;
}
.equity-customer-tags-sheet__confirm {
color: #fff;
background: #347BFF;
}
.tire-box { .tire-box {
padding: 0 var(--fontSize40) var(--fontSize44); padding: 0 var(--fontSize40) var(--fontSize44);
font-size: var(--fontSize28); font-size: var(--fontSize28);
......
...@@ -49,7 +49,23 @@ ...@@ -49,7 +49,23 @@
<image data-type="idCard" data-ocrType="idCard" class="pictureIcon" src="{{IMG_URL}}packageEquity/images/pictureIcon.png" binderror="" bindload="" /> <image data-type="idCard" data-ocrType="idCard" class="pictureIcon" src="{{IMG_URL}}packageEquity/images/pictureIcon.png" binderror="" bindload="" />
</view> </view>
</view> </view>
<gl-form disable="{{disable}}" formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{first.customerFormList}}" bindRegionChange="bindRegionChange"> <gl-form disable="{{disable}}" formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{first.customerFormList}}" bindRegionChange="bindRegionChange" bind:pickerChange="handlePickerChange">
<view class="daily-field-picker" slot="customerTags" bindtap="openEquityCustomerTagsPopup">
<text wx:if="{{ customerTagsText }}">{{ customerTagsText }}</text>
<text class="placeholder" wx:else>请选择</text>
</view>
<picker
slot="actualDeliveryDate"
mode="date"
value="{{ actualDeliveryDateText }}"
disabled="{{ disable }}"
bindchange="onEquityDeliveryDateChange"
>
<view class="daily-field-picker">
<text wx:if="{{ actualDeliveryDateText }}">{{ actualDeliveryDateText }}</text>
<text class="placeholder" wx:else>请选择日期</text>
</view>
</picker>
<view class="gender-box" slot="ownerGender"> <view class="gender-box" slot="ownerGender">
<block wx:if="{{serviceInfo.ownerGender}}"> <block wx:if="{{serviceInfo.ownerGender}}">
<view class="block text-center {{ serviceInfo.ownerGender=='男'?'':'right' }}" /> <view class="block text-center {{ serviceInfo.ownerGender=='男'?'':'right' }}" />
...@@ -94,3 +110,23 @@ ...@@ -94,3 +110,23 @@
bind:confirm="onConfirmSceneSelect" bind:confirm="onConfirmSceneSelect"
/> />
</van-popup> </van-popup>
<van-popup show="{{ equityCustomerTagsPopup }}" position="bottom" round bind:close="onCancelEquityCustomerTags">
<view class="equity-customer-tags-sheet">
<view class="equity-customer-tags-sheet__title">选择日报标签</view>
<view
class="equity-customer-tags-sheet__item"
wx:for="{{ equityCustomerTagDraftOptions }}"
wx:key="value"
bindtap="onToggleEquityCustomerTag"
data-index="{{ index }}"
>
<text class="{{ item.checked ? 'active' : '' }}">{{ item.label }}</text>
<text class="equity-customer-tags-sheet__check {{ item.checked ? 'active' : '' }}">{{ item.checked ? '✓' : '' }}</text>
</view>
<view class="equity-customer-tags-sheet__footer">
<view class="equity-customer-tags-sheet__clear" bindtap="onClearEquityCustomerTags">清空</view>
<view class="equity-customer-tags-sheet__cancel" bindtap="onCancelEquityCustomerTags">取消</view>
<view class="equity-customer-tags-sheet__confirm" bindtap="onConfirmEquityCustomerTags">确定</view>
</view>
</view>
</van-popup>
...@@ -184,6 +184,27 @@ const firstObj = { ...@@ -184,6 +184,27 @@ const firstObj = {
requiredAfter: true, requiredAfter: true,
}, },
{ {
label: "日报标签",
name: "customerTags",
type: "slot",
haveArrow: true,
isShowObj: {
attr: "salesType",
list: [0, 1, "售前", "售后"],
},
},
{
label: "实际交付日期",
name: "actualDeliveryDate",
type: "slot",
haveArrow: true,
labelWidth: "var(--fontSize220)",
isShowObj: {
attr: "salesType",
list: [0, "售前"],
},
},
{
label: "性别", label: "性别",
name: "ownerGender", name: "ownerGender",
type: "slot", type: "slot",
...@@ -316,6 +337,27 @@ const firstObjSimple = { ...@@ -316,6 +337,27 @@ const firstObjSimple = {
requiredAfter: true, requiredAfter: true,
}, },
{ {
label: "日报标签",
name: "customerTags",
type: "slot",
haveArrow: true,
isShowObj: {
attr: "salesType",
list: [0, 1],
},
},
{
label: "实际交付日期",
name: "actualDeliveryDate",
type: "slot",
haveArrow: true,
labelWidth: "var(--fontSize220)",
isShowObj: {
attr: "salesType",
list: [0],
},
},
{
label: "性别", label: "性别",
name: "ownerGender", name: "ownerGender",
type: "slot", type: "slot",
......
...@@ -13,10 +13,11 @@ import { ...@@ -13,10 +13,11 @@ import {
buildInsurancePayload, buildInsurancePayload,
buildOwnerPayload, buildOwnerPayload,
mapOwnerSalesTypeForApi, mapOwnerSalesTypeForApi,
mapOwnerSalesTypeFromApi,
mapQuotationGoodsList, mapQuotationGoodsList,
parseInsureListToForm parseInsureListToForm
} from '../services/quotationPayload.helpers.js' } from '../services/quotationPayload.helpers.js'
import { reconcileEquityCustomerDailyFields } from '../services/customerDailyFields.helpers.js'
import constantList from '../components/constant/constantList'
// console.log(quotedImgUrl, 'quotedImgUrl') // console.log(quotedImgUrl, 'quotedImgUrl')
Page({ Page({
/** /**
...@@ -33,7 +34,10 @@ Page({ ...@@ -33,7 +34,10 @@ Page({
price: '', price: '',
confirmStatus: false, confirmStatus: false,
saveStatus: false, saveStatus: false,
salesType: '售前' salesType: 0,
salesTypeLabel: constantList.salesTypeList[0].optionLabel,
customerTags: '',
actualDeliveryDate: ''
}, },
// owner: { // owner: {
// owner: 'test2', // owner: 'test2',
...@@ -301,7 +305,17 @@ Page({ ...@@ -301,7 +305,17 @@ Page({
tableInfo.insureList, tableInfo.insureList,
this.data.needChangeList this.data.needChangeList
) )
tableInfo.owner.salesType = mapOwnerSalesTypeFromApi(tableInfo.owner.salesType) const salesTypeNum = Number(tableInfo.owner.salesType)
tableInfo.owner.salesType = [0, 1, 2].includes(salesTypeNum)
? salesTypeNum
: 0
const salesTypeOption = constantList.salesTypeList.find(
item => item.optionId === tableInfo.owner.salesType
)
tableInfo.owner.salesTypeLabel =
salesTypeOption?.optionLabel ||
constantList.salesTypeList[0].optionLabel
tableInfo.owner = reconcileEquityCustomerDailyFields(tableInfo.owner)
this.setData({ this.setData({
orderInfo: Object.assign(orderInfo, tableInfo, insuranceTypeObj), orderInfo: Object.assign(orderInfo, tableInfo, insuranceTypeObj),
owner: tableInfo.owner owner: tableInfo.owner
......
...@@ -31,6 +31,8 @@ import dataForm from "../components/constant/stepData"; ...@@ -31,6 +31,8 @@ import dataForm from "../components/constant/stepData";
import constantList from "../components/constant/constantList"; import constantList from "../components/constant/constantList";
import NP from "number-precision"; import NP from "number-precision";
import { getProductStrategy, DISCOUNT_TYPE } from "./productStrategy"; import { getProductStrategy, DISCOUNT_TYPE } from "./productStrategy";
import { buildOwnerPayload } from "../services/quotationPayload.helpers.js";
import { reconcileEquityCustomerDailyFields } from "../services/customerDailyFields.helpers.js";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -69,6 +71,8 @@ Page({ ...@@ -69,6 +71,8 @@ Page({
carSeriesId: "", carSeriesId: "",
carSeriesName: "", carSeriesName: "",
salesType: 0, salesType: 0,
customerTags: "",
actualDeliveryDate: "",
// GLForm 客户来源展示用 labelName;仅有 salesType 无 label 时会显示「请选择」 // GLForm 客户来源展示用 labelName;仅有 salesType 无 label 时会显示「请选择」
salesTypeLabel: constantList.salesTypeList[0].optionLabel, salesTypeLabel: constantList.salesTypeList[0].optionLabel,
}, },
...@@ -918,13 +922,10 @@ Page({ ...@@ -918,13 +922,10 @@ Page({
return orderInfo; return orderInfo;
}, },
getOwnerInfo() { getOwnerInfo() {
let { owner } = this.data; let owner = buildOwnerPayload(
this.data.owner,
owner = wx.$util.deepClone(owner); this.data.needChangeList
owner.price = );
parseFloat(owner?.price).toString() != "NaN"
? this.multipliedByHundred(owner?.price)
: "";
// 0:门店引流-售前 1:门店引流-售后 2:自然到店 // 0:门店引流-售前 1:门店引流-售后 2:自然到店
let salesTypeNum = Number(owner.salesType); let salesTypeNum = Number(owner.salesType);
if ([0, 1, 2].includes(salesTypeNum)) { if ([0, 1, 2].includes(salesTypeNum)) {
...@@ -932,9 +933,6 @@ Page({ ...@@ -932,9 +933,6 @@ Page({
} else { } else {
owner.salesType = 0; owner.salesType = 0;
} }
if (owner) {
delete owner?.buyCarTime;
}
return owner; return owner;
}, },
handleSecondConfirmCheck(check, detail) { handleSecondConfirmCheck(check, detail) {
...@@ -1268,6 +1266,9 @@ Page({ ...@@ -1268,6 +1266,9 @@ Page({
} }
tableInfo.owner.ownerGender = tableInfo.owner.ownerGender =
tableInfo.owner.ownerGender || "男"; tableInfo.owner.ownerGender || "男";
tableInfo.owner = reconcileEquityCustomerDailyFields(
tableInfo.owner
);
this.setData({ this.setData({
orderInfo: Object.assign(orderInfo, tableInfo, { orderInfo: Object.assign(orderInfo, tableInfo, {
insureList: [], insureList: [],
...@@ -1963,6 +1964,8 @@ Page({ ...@@ -1963,6 +1964,8 @@ Page({
}, },
setCustomerInfo(customerInfo) { setCustomerInfo(customerInfo) {
let { owner, orderInfo } = this.data; let { owner, orderInfo } = this.data;
const customerTags = owner.customerTags || "";
const actualDeliveryDate = owner.actualDeliveryDate || "";
owner.owner = customerInfo.customerName; owner.owner = customerInfo.customerName;
owner.phone = customerInfo.customerPhone; owner.phone = customerInfo.customerPhone;
owner.ownerGender = customerInfo.customerSex != 2 ? "男" : "女"; owner.ownerGender = customerInfo.customerSex != 2 ? "男" : "女";
...@@ -1978,6 +1981,8 @@ Page({ ...@@ -1978,6 +1981,8 @@ Page({
owner = { owner = {
...owner, ...owner,
...customerInfoRest, ...customerInfoRest,
customerTags,
actualDeliveryDate,
}; };
if (customerInfo.salesUuid) { if (customerInfo.salesUuid) {
orderInfo.referrerId = customerInfo.salesUuid; orderInfo.referrerId = customerInfo.salesUuid;
...@@ -1997,6 +2002,7 @@ Page({ ...@@ -1997,6 +2002,7 @@ Page({
owner.salesTypeLabel = owner.salesTypeLabel =
(salesMatch && salesMatch.optionLabel) || (salesMatch && salesMatch.optionLabel) ||
constantList.salesTypeList[0].optionLabel; constantList.salesTypeList[0].optionLabel;
owner = reconcileEquityCustomerDailyFields(owner);
this.setData({ this.setData({
owner, owner,
orderInfo, orderInfo,
...@@ -2075,7 +2081,11 @@ Page({ ...@@ -2075,7 +2081,11 @@ Page({
]; ];
} }
if (required.includes("idNumber")) { if (required.includes("idNumber")) {
first.customerFormList[6] = { const certificateIndex = first.customerFormList.findIndex(
(item) => item.name === "certificateNo"
);
if (certificateIndex >= 0) {
first.customerFormList[certificateIndex] = {
label: "证件号码", label: "证件号码",
maxlength: "18", maxlength: "18",
name: "certificateNo", name: "certificateNo",
...@@ -2084,6 +2094,7 @@ Page({ ...@@ -2084,6 +2094,7 @@ Page({
required: true, required: true,
requiredAfter: true, requiredAfter: true,
}; };
}
formRule.certificateNo = [ formRule.certificateNo = [
{ {
required: true, required: true,
......
export const EQUITY_CUSTOMER_TAGS = [
{ value: '1', label: '已触客' },
{ value: '3', label: '已交付引荐' }
]
const EQUITY_CUSTOMER_TAG_ORDER = EQUITY_CUSTOMER_TAGS.map(item => item.value)
function toTagValues(value) {
if (Array.isArray(value)) return value
if (value === undefined || value === null || value === '') return []
return String(value).split(',')
}
export function parseEquityCustomerTags(value) {
const selected = new Set(
toTagValues(value)
.map(item => String(item).trim())
.filter(item => EQUITY_CUSTOMER_TAG_ORDER.includes(item))
)
return EQUITY_CUSTOMER_TAG_ORDER.filter(item => selected.has(item))
}
export function serializeEquityCustomerTags(value) {
return parseEquityCustomerTags(value).join(',')
}
export function formatEquityCustomerTags(value) {
return getEquityCustomerTagLabels(value).join('/')
}
export function getEquityCustomerTagLabels(value) {
const selected = new Set(parseEquityCustomerTags(value))
return EQUITY_CUSTOMER_TAGS.filter(item => selected.has(item.value)).map(
item => item.label
)
}
export function isEquityCustomerTagsVisible(salesType) {
return salesType === '售前' || salesType === '售后' || [0, 1].includes(Number(salesType))
}
export function isEquityActualDeliveryDateVisible(salesType) {
return salesType === '售前' || Number(salesType) === 0
}
export function formatEquityDeliveryDateForDisplay(value) {
if (!value) return ''
const match = String(value).match(/^(\d{4}-\d{2}-\d{2})/)
return match ? match[1] : ''
}
export function formatEquityDeliveryDateForSubmit(value) {
const date = formatEquityDeliveryDateForDisplay(value)
return date ? `${date} 00:00:00` : ''
}
export function reconcileEquityCustomerDailyFields(owner = {}) {
const next = { ...owner }
next.customerTags = isEquityCustomerTagsVisible(next.salesType)
? serializeEquityCustomerTags(next.customerTags)
: ''
next.actualDeliveryDate = isEquityActualDeliveryDateVisible(next.salesType)
? formatEquityDeliveryDateForDisplay(next.actualDeliveryDate)
: ''
return next
}
...@@ -9,6 +9,11 @@ import { ...@@ -9,6 +9,11 @@ import {
multipliedByHundred, multipliedByHundred,
multipliedByHundredObj multipliedByHundredObj
} from './quotationMoney.helpers.js' } from './quotationMoney.helpers.js'
import {
formatEquityDeliveryDateForSubmit,
reconcileEquityCustomerDailyFields,
serializeEquityCustomerTags
} from './customerDailyFields.helpers.js'
const INSURANCE_FORM_KEYS = [ const INSURANCE_FORM_KEYS = [
'business', 'business',
...@@ -86,8 +91,14 @@ export function buildInsurancePayload( ...@@ -86,8 +91,14 @@ export function buildInsurancePayload(
* @returns {object} * @returns {object}
*/ */
export function buildOwnerPayload(owner, _needChangeList = DEFAULT_NEED_CHANGE_LIST) { export function buildOwnerPayload(owner, _needChangeList = DEFAULT_NEED_CHANGE_LIST) {
const out = JSON.parse(JSON.stringify(owner || {})) const out = reconcileEquityCustomerDailyFields(
JSON.parse(JSON.stringify(owner || {}))
)
out.price = multipliedByHundred(out?.price) || '' out.price = multipliedByHundred(out?.price) || ''
out.customerTags = serializeEquityCustomerTags(out.customerTags)
out.actualDeliveryDate = formatEquityDeliveryDateForSubmit(
out.actualDeliveryDate
)
if (out.buyCarTime !== undefined) { if (out.buyCarTime !== undefined) {
delete out.buyCarTime delete out.buyCarTime
} }
...@@ -145,17 +156,19 @@ export function mapQuotationGoodsList(apiRows, options = {}) { ...@@ -145,17 +156,19 @@ export function mapQuotationGoodsList(apiRows, options = {}) {
/** /**
* owner.salesType 文案 → 接口数值 * owner.salesType 文案 → 接口数值
* @param {string|number} salesType * @param {string|number} salesType
* @returns {0|1} * @returns {0|1|2}
*/ */
export function mapOwnerSalesTypeForApi(salesType) { export function mapOwnerSalesTypeForApi(salesType) {
if (Number(salesType) === 2) return 2
return salesType == '售后' || salesType == 1 ? 1 : 0 return salesType == '售后' || salesType == 1 ? 1 : 0
} }
/** /**
* 接口 salesType → 表单文案 * 接口 salesType → 表单文案
* @param {number|string} salesType * @param {number|string} salesType
* @returns {'售前'|'售后'} * @returns {'售前'|'售后'|2}
*/ */
export function mapOwnerSalesTypeFromApi(salesType) { export function mapOwnerSalesTypeFromApi(salesType) {
if (Number(salesType) === 2) return 2
return salesType == 1 ? '售后' : '售前' return salesType == 1 ? '售后' : '售前'
} }
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
EQUITY_CUSTOMER_TAGS,
formatEquityCustomerTags,
formatEquityDeliveryDateForDisplay,
formatEquityDeliveryDateForSubmit,
isEquityActualDeliveryDateVisible,
isEquityCustomerTagsVisible,
parseEquityCustomerTags,
reconcileEquityCustomerDailyFields,
serializeEquityCustomerTags
} from '../pages/carQuotation/services/customerDailyFields.helpers.js'
describe('quotation customer daily fields', () => {
it('IT-EQ-DAILY-001: parses, deduplicates, sorts and formats supported tags', () => {
assert.deepEqual(parseEquityCustomerTags('3,1,3,5'), ['1', '3'])
assert.equal(serializeEquityCustomerTags([3, 1, 3]), '1,3')
assert.equal(formatEquityCustomerTags('3,1'), '已触客/已交付引荐')
assert.deepEqual(EQUITY_CUSTOMER_TAGS.map(item => item.value), ['1', '3'])
})
it('IT-EQ-DAILY-002: source visibility supports standard and simple values', () => {
assert.equal(isEquityCustomerTagsVisible(0), true)
assert.equal(isEquityCustomerTagsVisible('售后'), true)
assert.equal(isEquityCustomerTagsVisible(2), false)
assert.equal(isEquityActualDeliveryDateVisible(0), true)
assert.equal(isEquityActualDeliveryDateVisible('售前'), true)
assert.equal(isEquityActualDeliveryDateVisible(1), false)
})
it('IT-EQ-DAILY-003: reconciliation clears hidden fields immediately', () => {
assert.deepEqual(
reconcileEquityCustomerDailyFields({
salesType: 2,
customerTags: '1,3',
actualDeliveryDate: '2026-08-04 10:00:00'
}),
{ salesType: 2, customerTags: '', actualDeliveryDate: '' }
)
assert.deepEqual(
reconcileEquityCustomerDailyFields({
salesType: 1,
customerTags: '3,1',
actualDeliveryDate: '2026-08-04 10:00:00'
}),
{ salesType: 1, customerTags: '1,3', actualDeliveryDate: '' }
)
})
it('IT-EQ-DAILY-004: date display and submit formats are stable', () => {
assert.equal(
formatEquityDeliveryDateForDisplay('2026-08-04 10:00:00'),
'2026-08-04'
)
assert.equal(
formatEquityDeliveryDateForSubmit('2026-08-04'),
'2026-08-04 00:00:00'
)
assert.equal(formatEquityDeliveryDateForSubmit(), '')
})
})
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
const read = relativePath =>
readFileSync(fileURLToPath(new URL(relativePath, import.meta.url)), 'utf8')
describe('quotation customer daily field UI contract', () => {
it('IT-EQ-DAILY-UI-001: standard and simple forms contain both optional fields', () => {
const config = read('../pages/carQuotation/components/constant/stepData.js')
const wxml = read('../pages/carQuotation/components/FirstStep/FirstStep.wxml')
assert.equal((config.match(/label: "日报标签"/g) || []).length, 2)
assert.equal((config.match(/label: "实际交付日期"/g) || []).length, 2)
assert.match(wxml, /equityCustomerTagsPopup/)
assert.match(wxml, /onConfirmEquityCustomerTags/)
assert.match(wxml, /mode="date"/)
})
it('IT-EQ-DAILY-UI-002: required certificate config no longer relies on index', () => {
const simple = read(
'../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
)
assert.doesNotMatch(simple, /customerFormList\[6\]/)
assert.match(simple, /findIndex\([\s\S]*certificateNo/)
})
it('IT-EQ-DAILY-UI-003: payment detail shows stored daily fields', () => {
const detail = read(
'../pages/carQuotation/CarQuotationDetail/CarQuotationDetail.wxml'
)
assert.match(detail, /日报标签/)
assert.match(detail, /实际交付日期/)
assert.match(detail, /customerTagLabels/)
})
it('IT-EQ-DAILY-UI-004: add, update and additional recording share owner formatting', () => {
const standard = read(
'../pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js'
)
const simple = read(
'../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
)
assert.match(standard, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/)
assert.match(standard, /orderInfo\.owner = owner[\s\S]*updateQuotation\(orderInfo\)[\s\S]*quotationAdd\(orderInfo\)/)
assert.match(simple, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/)
assert.match(simple, /setQuotationRecording\(\)[\s\S]*orderInfo\.owner = owner[\s\S]*quotationRecording\(orderInfo\)/)
})
})
...@@ -43,9 +43,41 @@ describe('quotationPayload.helpers', () => { ...@@ -43,9 +43,41 @@ describe('quotationPayload.helpers', () => {
}) })
it('IT-EQ-PAY-003: buildOwnerPayload scales price', () => { it('IT-EQ-PAY-003: buildOwnerPayload scales price', () => {
const owner = buildOwnerPayload({ price: 12.5, buyCarTime: '2020' }) const owner = buildOwnerPayload({
price: 12.5,
salesType: 0,
buyCarTime: '2020',
customerTags: '3,1,3',
actualDeliveryDate: '2026-08-04'
})
assert.equal(owner.price, 1250) assert.equal(owner.price, 1250)
assert.equal(owner.buyCarTime, undefined) assert.equal(owner.buyCarTime, undefined)
assert.equal(owner.customerTags, '1,3')
assert.equal(owner.actualDeliveryDate, '2026-08-04 00:00:00')
})
it('IT-EQ-PAY-003b: buildOwnerPayload keeps empty daily fields', () => {
const owner = buildOwnerPayload({ price: '', customerTags: [], actualDeliveryDate: '' })
assert.equal(owner.customerTags, '')
assert.equal(owner.actualDeliveryDate, '')
})
it('IT-EQ-PAY-003c: buildOwnerPayload clears values hidden by source', () => {
const afterSales = buildOwnerPayload({
salesType: 1,
customerTags: '1,3',
actualDeliveryDate: '2026-08-04'
})
assert.equal(afterSales.customerTags, '1,3')
assert.equal(afterSales.actualDeliveryDate, '')
const natural = buildOwnerPayload({
salesType: 2,
customerTags: '1,3',
actualDeliveryDate: '2026-08-04'
})
assert.equal(natural.customerTags, '')
assert.equal(natural.actualDeliveryDate, '')
}) })
it('IT-EQ-PAY-004: parseInsureListToForm type 4 multiple', () => { it('IT-EQ-PAY-004: parseInsureListToForm type 4 multiple', () => {
...@@ -82,5 +114,7 @@ describe('quotationPayload.helpers', () => { ...@@ -82,5 +114,7 @@ describe('quotationPayload.helpers', () => {
assert.equal(mapOwnerSalesTypeForApi('售后'), 1) assert.equal(mapOwnerSalesTypeForApi('售后'), 1)
assert.equal(mapOwnerSalesTypeForApi('售前'), 0) assert.equal(mapOwnerSalesTypeForApi('售前'), 0)
assert.equal(mapOwnerSalesTypeFromApi(1), '售后') assert.equal(mapOwnerSalesTypeFromApi(1), '售后')
assert.equal(mapOwnerSalesTypeForApi(2), 2)
assert.equal(mapOwnerSalesTypeFromApi(2), 2)
}) })
}) })
...@@ -144,6 +144,19 @@ module.exports = { ...@@ -144,6 +144,19 @@ module.exports = {
data data
) )
}, },
/** 获取门店经营品牌,用于精品日报标签选项 */
getMerchantCarBrandList(merchantIdList) {
return api.post(
'merchants.api.open.merchant.info',
{
merchantIdList,
merchantInfoSwitch: { brandFlag: true }
},
[],
'/rop-merchants/router',
'merchants'
)
},
/** 根据id查询待补录订单 */ /** 根据id查询待补录订单 */
waitinputorderSelectById(data) { waitinputorderSelectById(data) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.selectById', data) return api.post('dj.api.smartcarlife.weapp.waitinputorder.selectById', data)
......
...@@ -2,6 +2,12 @@ import api from '../../api.js' ...@@ -2,6 +2,12 @@ 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 {
formatDeliveryDateForDisplay,
getCustomerTagLabels,
isBoutiqueActualDeliveryDateVisible,
isBoutiqueCustomerTagsVisible
} from '../createOrder/services/customerDailyFields.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
...@@ -18,7 +24,8 @@ Page({ ...@@ -18,7 +24,8 @@ Page({
artificerSelectObj: {}, artificerSelectObj: {},
successDate: '', successDate: '',
showDateSelect: false, showDateSelect: false,
isErrorOrder: false isErrorOrder: false,
customerTagLabels: []
}, },
getSelectDate(e) { getSelectDate(e) {
this.setData({ this.setData({
...@@ -332,8 +339,21 @@ Page({ ...@@ -332,8 +339,21 @@ Page({
data.customer.carChildsBrandName || '' data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}` }-${data.customer.carSeriesName || ''}`
} }
data.customerTagLabels = getCustomerTagLabels(
data.customer?.customerTags
)
data.actualDeliveryDateDisplay = formatDeliveryDateForDisplay(
data.customer?.actualDeliveryDate
)
data.showCustomerTags = isBoutiqueCustomerTagsVisible(
data.customer?.salesType
)
data.showActualDeliveryDate = isBoutiqueActualDeliveryDateVisible(
data.customer?.salesType
)
this.setData({ this.setData({
orderInfo: data, orderInfo: data,
customerTagLabels: data.customerTagLabels,
flag: true, flag: true,
warrantyCardList warrantyCardList
}) })
......
...@@ -204,6 +204,16 @@ ...@@ -204,6 +204,16 @@
</view> </view>
</view> </view>
</block> </block>
<view class="cell" wx:if="{{ orderInfo.showCustomerTags }}">
<view class="label">日报标签</view>
<view class="value daily-tag-list">
<view class="daily-tag" wx:for="{{ customerTagLabels }}" wx:key="*this">{{ item }}</view>
</view>
</view>
<view class="cell" wx:if="{{ orderInfo.showActualDeliveryDate }}">
<view class="label">实际交付日期</view>
<view class="value">{{ orderInfo.actualDeliveryDateDisplay || '' }}</view>
</view>
</view> </view>
<!-- v4.6版本需求去掉 --> <!-- v4.6版本需求去掉 -->
<!-- <block wx:if="{{warrantyCardList&&warrantyCardList.length}}"> <!-- <block wx:if="{{warrantyCardList&&warrantyCardList.length}}">
......
...@@ -232,3 +232,18 @@ ...@@ -232,3 +232,18 @@
.isFullSucreen-btn { .isFullSucreen-btn {
padding-bottom: var(--fontSize68) !important; padding-bottom: var(--fontSize68) !important;
} }
.daily-tag-list {
display: flex;
flex-wrap: wrap;
gap: var(--fontSize12);
}
.daily-tag {
padding: var(--fontSize6) var(--fontSize14);
color: #347BFF;
background: #F2F6FF;
border: var(--fontSize1) solid #9BBCFF;
border-radius: var(--fontSize8);
font-size: var(--fontSize24);
}
...@@ -77,6 +77,16 @@ import { ...@@ -77,6 +77,16 @@ 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 {
BOUTIQUE_CUSTOMER_TAGS,
formatCustomerTags,
getBoutiqueCustomerTagOptions,
isBoutiqueActualDeliveryDateVisible,
isBoutiqueCustomerTagsVisible,
parseCustomerTags,
reconcileBoutiqueCustomerDailyFields,
serializeCustomerTags
} from './services/customerDailyFields.helpers.js'
import {
ensureCatalogUpgradePrice, ensureCatalogUpgradePrice,
seedCatalogSellPriceFromCatalog, seedCatalogSellPriceFromCatalog,
seedMarketingActivitySellPrice, seedMarketingActivitySellPrice,
...@@ -172,7 +182,9 @@ Page({ ...@@ -172,7 +182,9 @@ Page({
plateNumber: '', plateNumber: '',
customerSex: GENDER_TYPE.MALE, customerSex: GENDER_TYPE.MALE,
experienceFlag: 'Y', experienceFlag: 'Y',
salesType: SALES_TYPE.PRE_SALES salesType: SALES_TYPE.PRE_SALES,
customerTags: '',
actualDeliveryDate: ''
}, },
deliveryUserId: '', deliveryUserId: '',
deliveryEmployeeName: '', deliveryEmployeeName: '',
...@@ -216,6 +228,12 @@ Page({ ...@@ -216,6 +228,12 @@ Page({
packageList: [], packageList: [],
baseConfigData: {}, baseConfigData: {},
showSource: false, showSource: false,
customerTagOptions: getBoutiqueCustomerTagOptions(),
customerTagDraftOptions: [],
customerTagsPopup: false,
customerTagsText: '',
showCustomerTags: true,
showActualDeliveryDate: true,
Sourcecolumns: [ Sourcecolumns: [
{ {
type: SALES_TYPE.PRE_SALES, type: SALES_TYPE.PRE_SALES,
...@@ -820,11 +838,18 @@ Page({ ...@@ -820,11 +838,18 @@ Page({
} }
} }
this.setData({ this.setData(
{
orderObj: nextOrderObj, orderObj: nextOrderObj,
goodsList: nextGoodsList, goodsList: nextGoodsList,
staffPickerBox: false staffPickerBox: false
}) },
() => {
if (mode === STAFF_MODE.SALES) {
this.loadBoutiqueCustomerTagOptions(nextOrderObj.merchantId)
}
}
)
}, },
/** /**
* onLoad 预填销售顾问:上一单同店或单门店「系统」兜底 * onLoad 预填销售顾问:上一单同店或单门店「系统」兜底
...@@ -845,6 +870,7 @@ Page({ ...@@ -845,6 +870,7 @@ Page({
}, },
() => { () => {
const nextOrderObj = this.data.orderObj || {} const nextOrderObj = this.data.orderObj || {}
this.loadBoutiqueCustomerTagOptions(nextOrderObj.merchantId)
if (nextOrderObj?.merchantId && nextOrderObj?.baseSceneCode) { if (nextOrderObj?.merchantId && nextOrderObj?.baseSceneCode) {
if ( if (
nextOrderObj.sceneType !== undefined && nextOrderObj.sceneType !== undefined &&
...@@ -1763,6 +1789,10 @@ Page({ ...@@ -1763,6 +1789,10 @@ Page({
orderObj.sellerMerchantId = options.yqMerchantId orderObj.sellerMerchantId = options.yqMerchantId
} }
if (!orderObj.customer.salesType) orderObj.customer.salesType = 0 if (!orderObj.customer.salesType) orderObj.customer.salesType = 0
orderObj.customer = reconcileBoutiqueCustomerDailyFields(
orderObj.customer,
BOUTIQUE_CUSTOMER_TAGS
)
// 回显订单类型名称 // 回显订单类型名称
let { orderTypeName, orderTypeList } = this.data let { orderTypeName, orderTypeList } = this.data
if (orderObj.djOrderType !== undefined && orderObj.djOrderType !== null) { if (orderObj.djOrderType !== undefined && orderObj.djOrderType !== null) {
...@@ -1786,6 +1816,11 @@ Page({ ...@@ -1786,6 +1816,11 @@ Page({
isAppointment: options.isAppointment isAppointment: options.isAppointment
}, },
() => { () => {
this.applyBoutiqueCustomerDailyFields(
orderObj.customer,
BOUTIQUE_CUSTOMER_TAGS
)
this.loadBoutiqueCustomerTagOptions(orderObj.merchantId)
this.echoCustomerProfileIfNeeded(options).catch(() => {}) this.echoCustomerProfileIfNeeded(options).catch(() => {})
this._setOrderObjInvoked = false this._setOrderObjInvoked = false
} }
...@@ -2896,7 +2931,12 @@ Page({ ...@@ -2896,7 +2931,12 @@ Page({
// console.log(isErrorOrder, isAlreadyExistOrder); // console.log(isErrorOrder, isAlreadyExistOrder);
!(isErrorOrder || isAlreadyExistOrder) && !(isErrorOrder || isAlreadyExistOrder) &&
api api
.waitinputorder() .waitinputorder({
yqMerchantId:
this.data.orderObj?.sellerMerchantId ||
this.data.userInfo?.merchantId ||
''
})
.then(result => { .then(result => {
let { code, data } = result let { code, data } = result
this.setTime() this.setTime()
...@@ -2942,6 +2982,91 @@ Page({ ...@@ -2942,6 +2982,91 @@ Page({
return new Date(latestTimestamp).format('yyyy-MM-dd hh:mm:ss') return new Date(latestTimestamp).format('yyyy-MM-dd hh:mm:ss')
// return latestDate.formattedDate(); // 或返回时间戳 latestTimestamp // return latestDate.formattedDate(); // 或返回时间戳 latestTimestamp
}, },
applyBoutiqueCustomerDailyFields(
customer = this.data.orderObj?.customer || {},
tagOptions = this.data.customerTagOptions || []
) {
const nextCustomer = reconcileBoutiqueCustomerDailyFields(
customer,
tagOptions
)
this.setData({
'orderObj.customer': nextCustomer,
customerTagsText: formatCustomerTags(nextCustomer.customerTags),
showCustomerTags: isBoutiqueCustomerTagsVisible(nextCustomer.salesType),
showActualDeliveryDate: isBoutiqueActualDeliveryDateVisible(
nextCustomer.salesType
)
})
},
async loadBoutiqueCustomerTagOptions(merchantId) {
const requestMerchantId = merchantId || ''
let customerTagOptions = getBoutiqueCustomerTagOptions()
if (requestMerchantId) {
try {
const res = await api.getMerchantCarBrandList([requestMerchantId])
const merchantBrands =
res?.code == 0 ? res?.data?.data?.[0]?.carBrandList || [] : []
customerTagOptions = getBoutiqueCustomerTagOptions(merchantBrands)
} catch (error) {}
}
if ((this.data.orderObj?.merchantId || '') !== requestMerchantId) return
this.setData({ customerTagOptions }, () => {
this.applyBoutiqueCustomerDailyFields(
this.data.orderObj?.customer,
customerTagOptions
)
})
},
openCustomerTagsPopup() {
if (!this.data.showCustomerTags) return
const selected = new Set(
parseCustomerTags(this.data.orderObj?.customer?.customerTags)
)
this.setData({
customerTagsPopup: true,
customerTagDraftOptions: (this.data.customerTagOptions || []).map(item => ({
...item,
checked: selected.has(item.value)
}))
})
},
onToggleCustomerTag(e) {
const index = Number(e.currentTarget.dataset.index)
const customerTagDraftOptions = (this.data.customerTagDraftOptions || []).map(
(item, itemIndex) =>
itemIndex === index ? { ...item, checked: !item.checked } : item
)
this.setData({ customerTagDraftOptions })
},
onClearCustomerTags() {
this.setData({
customerTagDraftOptions: (this.data.customerTagDraftOptions || []).map(
item => ({ ...item, checked: false })
)
})
},
onCancelCustomerTags() {
this.setData({ customerTagsPopup: false })
},
onConfirmCustomerTags() {
const selected = (this.data.customerTagDraftOptions || [])
.filter(item => item.checked)
.map(item => item.value)
const customerTags = serializeCustomerTags(selected)
this.setData(
{
customerTagsPopup: false,
'orderObj.customer.customerTags': customerTags
},
() => this.applyBoutiqueCustomerDailyFields()
)
},
onCustomerDeliveryDateChange(e) {
this.setData({
'orderObj.customer.actualDeliveryDate': e.detail.value || ''
})
},
toSelectCustomerSource() { toSelectCustomerSource() {
this.setData({ this.setData({
showSource: true showSource: true
...@@ -2950,9 +3075,12 @@ Page({ ...@@ -2950,9 +3075,12 @@ Page({
onChangeSource(e) { onChangeSource(e) {
console.log(e) console.log(e)
const { type } = e.detail.value const { type } = e.detail.value
this.setData({ const customer = {
showSource: false, ...(this.data.orderObj?.customer || {}),
'orderObj.customer.salesType': type salesType: type
}
this.setData({ showSource: false }, () => {
this.applyBoutiqueCustomerDailyFields(customer)
}) })
}, },
onCloseSource() { onCloseSource() {
......
...@@ -600,6 +600,80 @@ page { ...@@ -600,6 +600,80 @@ page {
color: #f00; color: #f00;
} }
.customer-tags-sheet {
padding: 0 var(--fontSize32) calc(var(--fontSize24) + env(safe-area-inset-bottom));
background: #fff;
}
.customer-tags-sheet__title {
height: var(--fontSize96);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize32);
font-weight: 500;
color: #292d33;
border-bottom: var(--fontSize1) solid #eff0f2;
}
.customer-tags-sheet__item {
height: var(--fontSize88);
display: flex;
align-items: center;
justify-content: space-between;
font-size: var(--fontSize28);
color: #292d33;
border-bottom: var(--fontSize1) solid #eff0f2;
.active {
color: #347bff;
}
}
.customer-tags-sheet__check {
width: var(--fontSize40);
text-align: center;
font-size: var(--fontSize34);
}
.customer-tags-sheet__footer {
display: flex;
align-items: center;
gap: var(--fontSize20);
padding-top: var(--fontSize32);
font-size: var(--fontSize30);
}
.customer-tags-sheet__clear,
.customer-tags-sheet__cancel,
.customer-tags-sheet__confirm {
height: var(--fontSize80);
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--fontSize12);
}
.customer-tags-sheet__clear {
width: 18%;
color: #347bff;
}
.customer-tags-sheet__cancel,
.customer-tags-sheet__confirm {
flex: 1;
}
.customer-tags-sheet__cancel {
color: #292d33;
background: #f5f6f8;
}
.customer-tags-sheet__confirm {
color: #fff;
background: #347bff;
}
.strategy-box { .strategy-box {
margin-top: 10rpx; margin-top: 10rpx;
padding-top: 10rpx; padding-top: 10rpx;
......
...@@ -253,6 +253,33 @@ value="{{ orderObj.remark }}" ...@@ -253,6 +253,33 @@ value="{{ orderObj.remark }}"
>否</view> >否</view>
</view> </view>
</gl-cell> </gl-cell>
<gl-cell
wx:if="{{ showCustomerTags }}"
border
label="日报标签"
value="{{ customerTagsText }}"
placeholder="请选择"
valueAlign="right"
labelWidth="var(--fontSize180)"
haveArrow
bindclick="openCustomerTagsPopup"
/>
<picker
wx:if="{{ showActualDeliveryDate }}"
mode="date"
value="{{ orderObj.customer.actualDeliveryDate }}"
bindchange="onCustomerDeliveryDateChange"
>
<gl-cell
border
label="实际交付日期"
value="{{ orderObj.customer.actualDeliveryDate }}"
placeholder="请选择日期"
valueAlign="right"
labelWidth="var(--fontSize220)"
haveArrow
/>
</picker>
</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 }}">
...@@ -896,6 +923,31 @@ value="{{ orderObj.remark }}" ...@@ -896,6 +923,31 @@ value="{{ orderObj.remark }}"
bind:confirm="onConfirmOrderType" bind:confirm="onConfirmOrderType"
/> />
</van-popup> </van-popup>
<van-popup
show="{{ customerTagsPopup }}"
position="bottom"
round
bind:close="onCancelCustomerTags"
>
<view class="customer-tags-sheet">
<view class="customer-tags-sheet__title">选择日报标签</view>
<view
class="customer-tags-sheet__item"
wx:for="{{ customerTagDraftOptions }}"
wx:key="value"
bindtap="onToggleCustomerTag"
data-index="{{ index }}"
>
<text class="{{ item.checked ? 'active' : '' }}">{{ item.label }}</text>
<text class="customer-tags-sheet__check {{ item.checked ? 'active' : '' }}">{{ item.checked ? '✓' : '' }}</text>
</view>
<view class="customer-tags-sheet__footer">
<view class="customer-tags-sheet__clear" bindtap="onClearCustomerTags">清空</view>
<view class="customer-tags-sheet__cancel" bindtap="onCancelCustomerTags">取消</view>
<view class="customer-tags-sheet__confirm" bindtap="onConfirmCustomerTags">确定</view>
</view>
</view>
</van-popup>
<set-meal <set-meal
wx:if="{{ packageBox }}" wx:if="{{ packageBox }}"
show="{{ packageBox }}" show="{{ packageBox }}"
......
export const BOUTIQUE_CUSTOMER_TAGS = [
{ value: '1', label: '已触客' },
{ value: '2', label: '已拉群' },
{ value: '3', label: '已交付引荐' },
{ value: '4', label: '首保维保客户' },
{ value: '5', label: '事故车客户' }
]
const CUSTOMER_TAG_ORDER = BOUTIQUE_CUSTOMER_TAGS.map(item => item.value)
function toTagValues(value) {
if (Array.isArray(value)) return value
if (value === undefined || value === null || value === '') return []
return String(value).split(',')
}
export function parseCustomerTags(value, allowedValues = CUSTOMER_TAG_ORDER) {
const allowed = new Set((allowedValues || []).map(String))
const selected = new Set(
toTagValues(value)
.map(item => String(item).trim())
.filter(item => allowed.has(item))
)
return CUSTOMER_TAG_ORDER.filter(item => selected.has(item))
}
export function serializeCustomerTags(value, allowedValues = CUSTOMER_TAG_ORDER) {
return parseCustomerTags(value, allowedValues).join(',')
}
export function formatCustomerTags(value) {
return getCustomerTagLabels(value).join('/')
}
export function getCustomerTagLabels(value) {
const selected = new Set(parseCustomerTags(value))
return BOUTIQUE_CUSTOMER_TAGS.filter(item => selected.has(item.value)).map(
item => item.label
)
}
function getBrandName(brand) {
if (typeof brand === 'string') return brand
return (
brand?.brandName ||
brand?.name ||
brand?.carBrandName ||
brand?.carBrand ||
''
)
}
export function getBoutiqueCustomerTagOptions(merchantBrands = []) {
const hasHarmonyBrand = (Array.isArray(merchantBrands) ? merchantBrands : []).some(
brand => /鸿蒙智行|问界/.test(getBrandName(brand))
)
return hasHarmonyBrand
? BOUTIQUE_CUSTOMER_TAGS.map(item => ({ ...item }))
: [{ ...BOUTIQUE_CUSTOMER_TAGS[0] }]
}
export function isBoutiqueCustomerTagsVisible(salesType) {
return [0, 1, 3].includes(Number(salesType))
}
export function isBoutiqueActualDeliveryDateVisible(salesType) {
return [0, 3].includes(Number(salesType))
}
export function formatDeliveryDateForDisplay(value) {
if (!value) return ''
const match = String(value).match(/^(\d{4}-\d{2}-\d{2})/)
return match ? match[1] : ''
}
export function formatDeliveryDateForSubmit(value) {
const date = formatDeliveryDateForDisplay(value)
return date ? `${date} 00:00:00` : ''
}
export function reconcileBoutiqueCustomerDailyFields(customer = {}, tagOptions = []) {
const next = { ...customer }
const allowedValues = (tagOptions || []).map(item => item.value)
next.customerTags = isBoutiqueCustomerTagsVisible(next.salesType)
? serializeCustomerTags(next.customerTags, allowedValues)
: ''
next.actualDeliveryDate = isBoutiqueActualDeliveryDateVisible(next.salesType)
? formatDeliveryDateForDisplay(next.actualDeliveryDate)
: ''
return next
}
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
*/ */
/** 提交前从 orderObj 根级剥离的审计/展示字段 */ /** 提交前从 orderObj 根级剥离的审计/展示字段 */
import {
BOUTIQUE_CUSTOMER_TAGS,
formatDeliveryDateForSubmit,
reconcileBoutiqueCustomerDailyFields,
serializeCustomerTags
} from './customerDailyFields.helpers.js'
export const SUBMIT_ROOT_PROPERTIES_TO_DELETE = [ export const SUBMIT_ROOT_PROPERTIES_TO_DELETE = [
'profitAllocatinList', 'profitAllocatinList',
'packageGoodsList', 'packageGoodsList',
...@@ -115,5 +122,20 @@ export function prepareSubmitPayload(orderObj, context = {}) { ...@@ -115,5 +122,20 @@ export function prepareSubmitPayload(orderObj, context = {}) {
isErrorOrder: !!context.isErrorOrder, isErrorOrder: !!context.isErrorOrder,
orderCreateType: context.orderCreateType orderCreateType: context.orderCreateType
}) })
if (
['createWithPay', 'supplementOrder'].includes(apiName) &&
submitObj.customer
) {
submitObj.customer = reconcileBoutiqueCustomerDailyFields(
submitObj.customer,
BOUTIQUE_CUSTOMER_TAGS
)
submitObj.customer.customerTags = serializeCustomerTags(
submitObj.customer.customerTags
)
submitObj.customer.actualDeliveryDate = formatDeliveryDateForSubmit(
submitObj.customer.actualDeliveryDate
)
}
return { submitObj, apiName } return { submitObj, apiName }
} }
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
BOUTIQUE_CUSTOMER_TAGS,
formatCustomerTags,
formatDeliveryDateForDisplay,
formatDeliveryDateForSubmit,
getBoutiqueCustomerTagOptions,
isBoutiqueActualDeliveryDateVisible,
isBoutiqueCustomerTagsVisible,
parseCustomerTags,
reconcileBoutiqueCustomerDailyFields,
serializeCustomerTags
} from '../services/customerDailyFields.helpers.js'
describe('customerDailyFields.helpers', () => {
it('IT-WO-DAILY-001: parses, deduplicates and sorts customer tags', () => {
assert.deepEqual(parseCustomerTags('3,1,3,5'), ['1', '3', '5'])
assert.equal(serializeCustomerTags(['5', 1, '3', '1']), '1,3,5')
assert.equal(formatCustomerTags('3,1'), '已触客/已交付引荐')
})
it('IT-WO-DAILY-002: Hongmeng and Wenjie stores support all tags', () => {
assert.deepEqual(
getBoutiqueCustomerTagOptions([{ brandName: '鸿蒙智行' }]),
BOUTIQUE_CUSTOMER_TAGS
)
assert.deepEqual(
getBoutiqueCustomerTagOptions([{ name: 'AITO 问界' }]),
BOUTIQUE_CUSTOMER_TAGS
)
})
it('IT-WO-DAILY-003: other or failed brand query falls back to contacted', () => {
assert.deepEqual(getBoutiqueCustomerTagOptions([{ brandName: '宝马' }]), [
BOUTIQUE_CUSTOMER_TAGS[0]
])
assert.deepEqual(getBoutiqueCustomerTagOptions(), [
BOUTIQUE_CUSTOMER_TAGS[0]
])
})
it('IT-WO-DAILY-004: source controls both field visibilities', () => {
assert.equal(isBoutiqueCustomerTagsVisible(0), true)
assert.equal(isBoutiqueCustomerTagsVisible(1), true)
assert.equal(isBoutiqueCustomerTagsVisible(2), false)
assert.equal(isBoutiqueActualDeliveryDateVisible(0), true)
assert.equal(isBoutiqueActualDeliveryDateVisible(3), true)
assert.equal(isBoutiqueActualDeliveryDateVisible(1), false)
})
it('IT-WO-DAILY-005: reconciliation clears hidden and unavailable values', () => {
const natural = reconcileBoutiqueCustomerDailyFields(
{
salesType: 2,
customerTags: '1,3',
actualDeliveryDate: '2026-08-04 11:20:30'
},
BOUTIQUE_CUSTOMER_TAGS
)
assert.equal(natural.customerTags, '')
assert.equal(natural.actualDeliveryDate, '')
const otherBrand = reconcileBoutiqueCustomerDailyFields(
{
salesType: 0,
customerTags: '1,3,5',
actualDeliveryDate: '2026-08-04 11:20:30'
},
[BOUTIQUE_CUSTOMER_TAGS[0]]
)
assert.equal(otherBrand.customerTags, '1')
assert.equal(otherBrand.actualDeliveryDate, '2026-08-04')
})
it('IT-WO-DAILY-006: delivery date has display and submit formats', () => {
assert.equal(
formatDeliveryDateForDisplay('2026-08-04 11:20:30'),
'2026-08-04'
)
assert.equal(formatDeliveryDateForSubmit('2026-08-04'), '2026-08-04 00:00:00')
assert.equal(formatDeliveryDateForSubmit(''), '')
})
})
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
const read = relativePath =>
readFileSync(fileURLToPath(new URL(relativePath, import.meta.url)), 'utf8')
describe('boutique customer daily field UI contract', () => {
it('IT-WO-DAILY-UI-001: create page renders optional fields and multi-select popup', () => {
const wxml = read('../createOrder.wxml')
assert.match(wxml, /label="日报标签"/)
assert.match(wxml, /label="实际交付日期"/)
assert.match(wxml, /customerTagsPopup/)
assert.match(wxml, /onConfirmCustomerTags/)
assert.match(wxml, /mode="date"/)
})
it('IT-WO-DAILY-UI-002: dormant count request forwards yqMerchantId', () => {
const js = read('../createOrder.js')
assert.match(js, /waitinputorder\(\{[\s\S]*yqMerchantId/)
})
it('IT-WO-DAILY-UI-003: confirm and detail show tags and delivery date', () => {
const confirm = read('../../confirmOrder/confirmOrder.wxml')
const detail = read('../../orderDetail/orderDetail.wxml')
;[confirm, detail].forEach(source => {
assert.match(source, /日报标签/)
assert.match(source, /实际交付日期/)
assert.match(source, /customerTagLabels/)
})
})
})
...@@ -14,7 +14,12 @@ describe('submitPayload.helpers', () => { ...@@ -14,7 +14,12 @@ describe('submitPayload.helpers', () => {
subOrderList: [{}], subOrderList: [{}],
customerCouponCode: 'C1', customerCouponCode: 'C1',
selectPayType: 1, selectPayType: 1,
customer: { buyTime: 'x', createdDate: 'y', plateNumber: 'P' }, customer: {
buyTime: 'x',
createdDate: 'y',
plateNumber: 'P',
salesType: 0
},
profitAllocatinList: [], profitAllocatinList: [],
associateOrderCode: 'OLD1' associateOrderCode: 'OLD1'
} }
...@@ -103,4 +108,59 @@ describe('submitPayload.helpers', () => { ...@@ -103,4 +108,59 @@ describe('submitPayload.helpers', () => {
assert.equal(apiName, 'createWithPay') assert.equal(apiName, 'createWithPay')
assert.equal(submitObj.filmOrder, 0) assert.equal(submitObj.filmOrder, 0)
}) })
it('IT-WO-SUB-013: createWithPay normalizes nested daily fields', () => {
const { submitObj } = prepareSubmitPayload(
{
...baseOrder,
sellerMerchantId: 'seller-merchant',
customer: {
...baseOrder.customer,
customerTags: '3,1,3',
actualDeliveryDate: '2026-08-04'
}
},
{ save: false, isErrorOrder: false }
)
assert.equal(submitObj.customer.customerTags, '1,3')
assert.equal(
submitObj.customer.actualDeliveryDate,
'2026-08-04 00:00:00'
)
assert.equal(submitObj.sellerMerchantId, 'seller-merchant')
})
it('IT-WO-SUB-014: supplementOrder submits empty daily fields', () => {
const { apiName, submitObj } = prepareSubmitPayload(
{
...baseOrder,
customer: {
...baseOrder.customer,
customerTags: [],
actualDeliveryDate: ''
}
},
{ orderCreateType: 'additionRecordOrder' }
)
assert.equal(apiName, 'supplementOrder')
assert.equal(submitObj.customer.customerTags, '')
assert.equal(submitObj.customer.actualDeliveryDate, '')
})
it('IT-WO-SUB-015: submit clears fields hidden by natural source', () => {
const { submitObj } = prepareSubmitPayload(
{
...baseOrder,
customer: {
...baseOrder.customer,
salesType: 2,
customerTags: '1,3',
actualDeliveryDate: '2026-08-04'
}
},
{}
)
assert.equal(submitObj.customer.customerTags, '')
assert.equal(submitObj.customer.actualDeliveryDate, '')
})
}) })
...@@ -13,6 +13,12 @@ import { ...@@ -13,6 +13,12 @@ import {
} from '~/store/ModalToQueueControl' } from '~/store/ModalToQueueControl'
import commonApi from '~/api/api' import commonApi from '~/api/api'
import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag' import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag'
import {
formatDeliveryDateForDisplay,
getCustomerTagLabels,
isBoutiqueActualDeliveryDateVisible,
isBoutiqueCustomerTagsVisible
} from '../createOrder/services/customerDailyFields.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/'
const app = getApp() const app = getApp()
...@@ -62,7 +68,8 @@ Page({ ...@@ -62,7 +68,8 @@ Page({
invoiveVisible: false, invoiveVisible: false,
showModal: false, showModal: false,
sublistVisible: false, sublistVisible: false,
constructionVisible: false constructionVisible: false,
customerTagLabels: []
}, },
// 监听弹窗关闭事件 // 监听弹窗关闭事件
onInventoryClose() { onInventoryClose() {
...@@ -617,6 +624,18 @@ openInventory(e){ ...@@ -617,6 +624,18 @@ openInventory(e){
data.customer.carChildsBrandName || '' data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}` }-${data.customer.carSeriesName || ''}`
} }
data.customerTagLabels = getCustomerTagLabels(
data.customer?.customerTags
)
data.actualDeliveryDateDisplay = formatDeliveryDateForDisplay(
data.customer?.actualDeliveryDate
)
data.showCustomerTags = isBoutiqueCustomerTagsVisible(
data.customer?.salesType
)
data.showActualDeliveryDate = isBoutiqueActualDeliveryDateVisible(
data.customer?.salesType
)
// 处理订单是否显示 操作按钮 支付方式为pos和微信 并且订单状态是 4和6 // 处理订单是否显示 操作按钮 支付方式为pos和微信 并且订单状态是 4和6
// data.failureFlag != 'Y' // data.failureFlag != 'Y'
data.canOperate = data.canOperate =
...@@ -626,6 +645,7 @@ openInventory(e){ ...@@ -626,6 +645,7 @@ openInventory(e){
this.setData({ this.setData({
allNoConstruction, allNoConstruction,
orderInfo: data, orderInfo: data,
customerTagLabels: data.customerTagLabels,
flag: true, flag: true,
warrantyCardList, warrantyCardList,
invoiceName: data.invoiceStatus == 2 ? '查看发票' : '申请开票' invoiceName: data.invoiceStatus == 2 ? '查看发票' : '申请开票'
......
...@@ -1131,3 +1131,16 @@ page { ...@@ -1131,3 +1131,16 @@ page {
border-radius: var(--fontSize12); border-radius: var(--fontSize12);
margin: 0 calc(-1 * var(--fontSize20)) var(--fontSize16); margin: 0 calc(-1 * var(--fontSize20)) var(--fontSize16);
} }
.daily-tag-list {
gap: var(--fontSize12);
}
.daily-tag {
padding: var(--fontSize6) var(--fontSize14);
color: #347BFF;
background: #F2F6FF;
border: var(--fontSize1) solid #9BBCFF;
border-radius: var(--fontSize8);
font-size: var(--fontSize24);
}
...@@ -258,6 +258,16 @@ ...@@ -258,6 +258,16 @@
</view> </view>
</view> </view>
</block> </block>
<view class="cell" wx:if="{{ orderInfo.showCustomerTags }}">
<view class="label">日报标签</view>
<view class="value daily-tag-list">
<view class="daily-tag" wx:for="{{ customerTagLabels }}" wx:key="*this">{{ item }}</view>
</view>
</view>
<view class="cell" wx:if="{{ orderInfo.showActualDeliveryDate }}">
<view class="label">实际交付日期</view>
<view class="value">{{ orderInfo.actualDeliveryDateDisplay || '' }}</view>
</view>
<block wx:if="{{ orderInfo.selectPayType == 0 }}"> <block wx:if="{{ orderInfo.selectPayType == 0 }}">
<view class="cell"> <view class="cell">
<view class="label">拒升理由</view> <view class="label">拒升理由</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!