Commit be88d9c7 by 张立顺

feat: 按响应值展示精品工单日报字段

1 parent a3013b69
......@@ -2,11 +2,7 @@ import api from '../../api.js'
import order_mixins from '../order_mixins.js'
import { setWebSocket, getPositionList } from '~/store/index'
import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag'
import {
formatDeliveryDateForDisplay,
getCustomerTagLabels,
isBoutiqueCustomerTagsVisible
} from '../createOrder/services/customerDailyFields.helpers.js'
import { buildBoutiqueCustomerDailyDisplay } from '../createOrder/services/customerDailyFields.helpers.js'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
let time = null
......@@ -338,16 +334,13 @@ Page({
data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}`
}
data.customerTagLabels = getCustomerTagLabels(
data.customer?.customerTags
const customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(
data.customer
)
data.actualDeliveryDateDisplay = formatDeliveryDateForDisplay(
data.customer?.actualDeliveryDate
)
data.showCustomerTags = isBoutiqueCustomerTagsVisible(
data.customer?.salesType
)
data.showActualDeliveryDate = !!data.actualDeliveryDateDisplay
data.customerTagLabels = customerDailyDisplay.customerTagLabels
data.actualDeliveryDateDisplay = customerDailyDisplay.actualDeliveryDate
data.showCustomerTags = customerDailyDisplay.showCustomerTags
data.showActualDeliveryDate = customerDailyDisplay.showActualDeliveryDate
this.setData({
orderInfo: data,
customerTagLabels: data.customerTagLabels,
......
......@@ -100,6 +100,20 @@ export function formatDeliveryDateForDisplay(value) {
return match ? match[1] : ''
}
export function buildBoutiqueCustomerDailyDisplay(customer = {}) {
const customerTagLabels = getCustomerTagLabels(customer.customerTags)
const actualDeliveryDate = formatDeliveryDateForDisplay(
customer.actualDeliveryDate
)
return {
showCustomerTags: customerTagLabels.length > 0,
showActualDeliveryDate: !!actualDeliveryDate,
customerTagLabels,
customerTagsText: customerTagLabels.join('/'),
actualDeliveryDate
}
}
export function formatDeliveryDateForSubmit(value) {
const date = formatDeliveryDateForDisplay(value)
return date ? `${date} 00:00:00` : ''
......
......@@ -2,6 +2,7 @@ import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
BOUTIQUE_CUSTOMER_TAGS,
buildBoutiqueCustomerDailyDisplay,
formatCustomerTags,
formatDeliveryDateForDisplay,
formatDeliveryDateForSubmit,
......@@ -156,4 +157,29 @@ describe('customerDailyFields.helpers', () => {
assert.equal(formatDeliveryDateForSubmit('2026-08-04'), '2026-08-04 00:00:00')
assert.equal(formatDeliveryDateForSubmit(''), '')
})
it('IT-WO-DAILY-008: builds read-only display state from returned customer fields', () => {
assert.deepEqual(
buildBoutiqueCustomerDailyDisplay({
salesType: 2,
customerTags: '3,1,3,9',
actualDeliveryDate: '2026-08-14 16:20:30'
}),
{
showCustomerTags: true,
showActualDeliveryDate: true,
customerTagLabels: ['已触客', '已交付引荐'],
customerTagsText: '已触客/已交付引荐',
actualDeliveryDate: '2026-08-14'
}
)
assert.deepEqual(buildBoutiqueCustomerDailyDisplay({ salesType: 0 }), {
showCustomerTags: false,
showActualDeliveryDate: false,
customerTagLabels: [],
customerTagsText: '',
actualDeliveryDate: ''
})
})
})
......@@ -41,4 +41,13 @@ describe('boutique customer daily field UI contract', () => {
/merchantBrands:\s*data\.customerDailyFieldMerchantBrands/
)
})
it('IT-WO-DAILY-UI-005: list, detail and confirm reuse response display state', () => {
const listWxml = read('../../tabWorkOrderRelevance/index.wxml')
assert.match(listWxml, /li\.customerDailyDisplay\.showCustomerTags/)
assert.match(listWxml, /li\.customerDailyDisplay\.customerTagsText/)
assert.match(listWxml, /li\.customerDailyDisplay\.showActualDeliveryDate/)
assert.match(listWxml, /li\.customerDailyDisplay\.actualDeliveryDate/)
})
})
......@@ -13,11 +13,7 @@ import {
} from '~/store/ModalToQueueControl'
import commonApi from '~/api/api'
import { normalizeMarketingFlagOnItem } from '~/utils/marketingFlag'
import {
formatDeliveryDateForDisplay,
getCustomerTagLabels,
isBoutiqueCustomerTagsVisible
} from '../createOrder/services/customerDailyFields.helpers.js'
import { buildBoutiqueCustomerDailyDisplay } from '../createOrder/services/customerDailyFields.helpers.js'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
const app = getApp()
......@@ -623,16 +619,13 @@ openInventory(e){
data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}`
}
data.customerTagLabels = getCustomerTagLabels(
data.customer?.customerTags
)
data.actualDeliveryDateDisplay = formatDeliveryDateForDisplay(
data.customer?.actualDeliveryDate
)
data.showCustomerTags = isBoutiqueCustomerTagsVisible(
data.customer?.salesType
const customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(
data.customer
)
data.showActualDeliveryDate = !!data.actualDeliveryDateDisplay
data.customerTagLabels = customerDailyDisplay.customerTagLabels
data.actualDeliveryDateDisplay = customerDailyDisplay.actualDeliveryDate
data.showCustomerTags = customerDailyDisplay.showCustomerTags
data.showActualDeliveryDate = customerDailyDisplay.showActualDeliveryDate
// 处理订单是否显示 操作按钮 支付方式为pos和微信 并且订单状态是 4和6
// data.failureFlag != 'Y'
data.canOperate =
......
// tabWorkOrder/pages/index/index.js
import api from './api'
import order_mixins from './order_mixins.js'
import { buildBoutiqueCustomerDailyDisplay } from '../createOrder/services/customerDailyFields.helpers.js'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
let timeoutId
......@@ -526,6 +527,7 @@ Page({
// let userType = true
data.list.map(e => {
e.customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(e.customer)
if (e.orderTime)
e.orderTime = new Date(e.orderTime).format('yyyy-MM-dd hh:mm:ss')
e.subOrderList.map(i => {
......
......@@ -89,6 +89,14 @@
</view>
</view>
</block>
<view class="order" wx:if="{{ li.customerDailyDisplay.showCustomerTags }}">
<view class="order-label">日报标签</view>
<view class="order-value">{{ li.customerDailyDisplay.customerTagsText }}</view>
</view>
<view class="order" wx:if="{{ li.customerDailyDisplay.showActualDeliveryDate }}">
<view class="order-label">实际交付日期</view>
<view class="order-value">{{ li.customerDailyDisplay.actualDeliveryDate }}</view>
</view>
</view>
<view class="order-payType" wx:if="{{ li.selectPayType || li.selectPayType == 0 }}">
......@@ -144,4 +152,4 @@
<order-screen show="{{ show_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" orderStatus="{{ tabIndex }}" />
</view>
</page-container>
<study-permission-modal id="customModal" />
\ No newline at end of file
<study-permission-modal id="customModal" />
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!