Commit be88d9c7 by 张立顺

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

1 parent a3013b69
...@@ -2,11 +2,7 @@ import api from '../../api.js' ...@@ -2,11 +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 { import { buildBoutiqueCustomerDailyDisplay } from '../createOrder/services/customerDailyFields.helpers.js'
formatDeliveryDateForDisplay,
getCustomerTagLabels,
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
...@@ -338,16 +334,13 @@ Page({ ...@@ -338,16 +334,13 @@ Page({
data.customer.carChildsBrandName || '' data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}` }-${data.customer.carSeriesName || ''}`
} }
data.customerTagLabels = getCustomerTagLabels( const customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(
data.customer?.customerTags data.customer
) )
data.actualDeliveryDateDisplay = formatDeliveryDateForDisplay( data.customerTagLabels = customerDailyDisplay.customerTagLabels
data.customer?.actualDeliveryDate data.actualDeliveryDateDisplay = customerDailyDisplay.actualDeliveryDate
) data.showCustomerTags = customerDailyDisplay.showCustomerTags
data.showCustomerTags = isBoutiqueCustomerTagsVisible( data.showActualDeliveryDate = customerDailyDisplay.showActualDeliveryDate
data.customer?.salesType
)
data.showActualDeliveryDate = !!data.actualDeliveryDateDisplay
this.setData({ this.setData({
orderInfo: data, orderInfo: data,
customerTagLabels: data.customerTagLabels, customerTagLabels: data.customerTagLabels,
......
...@@ -100,6 +100,20 @@ export function formatDeliveryDateForDisplay(value) { ...@@ -100,6 +100,20 @@ export function formatDeliveryDateForDisplay(value) {
return match ? match[1] : '' 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) { export function formatDeliveryDateForSubmit(value) {
const date = formatDeliveryDateForDisplay(value) const date = formatDeliveryDateForDisplay(value)
return date ? `${date} 00:00:00` : '' return date ? `${date} 00:00:00` : ''
......
...@@ -2,6 +2,7 @@ import { describe, it } from 'node:test' ...@@ -2,6 +2,7 @@ import { describe, it } from 'node:test'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import { import {
BOUTIQUE_CUSTOMER_TAGS, BOUTIQUE_CUSTOMER_TAGS,
buildBoutiqueCustomerDailyDisplay,
formatCustomerTags, formatCustomerTags,
formatDeliveryDateForDisplay, formatDeliveryDateForDisplay,
formatDeliveryDateForSubmit, formatDeliveryDateForSubmit,
...@@ -156,4 +157,29 @@ describe('customerDailyFields.helpers', () => { ...@@ -156,4 +157,29 @@ describe('customerDailyFields.helpers', () => {
assert.equal(formatDeliveryDateForSubmit('2026-08-04'), '2026-08-04 00:00:00') assert.equal(formatDeliveryDateForSubmit('2026-08-04'), '2026-08-04 00:00:00')
assert.equal(formatDeliveryDateForSubmit(''), '') 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', () => { ...@@ -41,4 +41,13 @@ describe('boutique customer daily field UI contract', () => {
/merchantBrands:\s*data\.customerDailyFieldMerchantBrands/ /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 { ...@@ -13,11 +13,7 @@ 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 { import { buildBoutiqueCustomerDailyDisplay } from '../createOrder/services/customerDailyFields.helpers.js'
formatDeliveryDateForDisplay,
getCustomerTagLabels,
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()
...@@ -623,16 +619,13 @@ openInventory(e){ ...@@ -623,16 +619,13 @@ openInventory(e){
data.customer.carChildsBrandName || '' data.customer.carChildsBrandName || ''
}-${data.customer.carSeriesName || ''}` }-${data.customer.carSeriesName || ''}`
} }
data.customerTagLabels = getCustomerTagLabels( const customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(
data.customer?.customerTags 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
// 处理订单是否显示 操作按钮 支付方式为pos和微信 并且订单状态是 4和6 // 处理订单是否显示 操作按钮 支付方式为pos和微信 并且订单状态是 4和6
// data.failureFlag != 'Y' // data.failureFlag != 'Y'
data.canOperate = data.canOperate =
......
// tabWorkOrder/pages/index/index.js // tabWorkOrder/pages/index/index.js
import api from './api' import api from './api'
import order_mixins from './order_mixins.js' import order_mixins from './order_mixins.js'
import { buildBoutiqueCustomerDailyDisplay } 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 timeoutId let timeoutId
...@@ -526,6 +527,7 @@ Page({ ...@@ -526,6 +527,7 @@ Page({
// let userType = true // let userType = true
data.list.map(e => { data.list.map(e => {
e.customerDailyDisplay = buildBoutiqueCustomerDailyDisplay(e.customer)
if (e.orderTime) if (e.orderTime)
e.orderTime = new Date(e.orderTime).format('yyyy-MM-dd hh:mm:ss') e.orderTime = new Date(e.orderTime).format('yyyy-MM-dd hh:mm:ss')
e.subOrderList.map(i => { e.subOrderList.map(i => {
......
...@@ -89,6 +89,14 @@ ...@@ -89,6 +89,14 @@
</view> </view>
</view> </view>
</block> </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>
<view class="order-payType" wx:if="{{ li.selectPayType || li.selectPayType == 0 }}"> <view class="order-payType" wx:if="{{ li.selectPayType || li.selectPayType == 0 }}">
...@@ -144,4 +152,4 @@ ...@@ -144,4 +152,4 @@
<order-screen show="{{ show_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" orderStatus="{{ tabIndex }}" /> <order-screen show="{{ show_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" orderStatus="{{ tabIndex }}" />
</view> </view>
</page-container> </page-container>
<study-permission-modal id="customModal" />
\ No newline at end of file \ 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!