Commit ef802de6 by 李伟康

feat(common): 添加门店分类查询接口并优化日报功能

- 在 common.js 中新增 getSceneByMerchantId 接口用于查询门店分类
- 在 dailyTemplateApi.js 中新增 getReportList 和 getReportDetail 接口
- 重构 HomeFrame.vue 中的组件结构,优化代码可读性
- 在 HomeFrame.vue 中集成门店分类获取功能
- 优化日报页面的数据获取和显示逻辑
- 更新日报弹窗组件配置和员工列表查询逻辑
- 添加 baseSceneCode 缓存常量支持门店分类存储
1 parent 0302960f
...@@ -708,4 +708,16 @@ module.exports = { ...@@ -708,4 +708,16 @@ module.exports = {
...data, ...data,
}) })
}, },
/**
* 查询门店分类
*
*/
getSceneByMerchantId(data = {}) {
return http.post({
method: 'dj.api.scenemerchantref.findAllSceneByMerchantId',
projectName: 'boutique',
...data
})
},
} }
...@@ -13,9 +13,9 @@ const ENV = env == 'ip' ? 'develop' : env, ...@@ -13,9 +13,9 @@ const ENV = env == 'ip' ? 'develop' : env,
const getDailyTemplate = async (templateType) => { const getDailyTemplate = async (templateType) => {
try { try {
const configModule = { const configModule = {
1:'staff-daily-template', 1: 'staff-daily-template',
2:'store-daily-template', 2: 'store-daily-template',
3:'negotiation-details-template', 3: 'negotiation-details-template',
}[templateType] }[templateType]
const data = await http.uni_request({ url: `${configUrl}&moduleUrl=${configModule}` }) const data = await http.uni_request({ url: `${configUrl}&moduleUrl=${configModule}` })
return Promise.resolve(data) return Promise.resolve(data)
...@@ -23,5 +23,32 @@ const getDailyTemplate = async (templateType) => { ...@@ -23,5 +23,32 @@ const getDailyTemplate = async (templateType) => {
return Promise.reject(error) return Promise.reject(error)
} }
} }
/**
* 查询日报是否填写列表
* @param {*} data
* @returns
*/
const getReportList = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.weekly.list',
projectName: 'boutique',
...data
})
}
/**
查询日报详情
*/
const getReportDetail = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.detail.get',
projectName: 'boutique',
...data
})
}
module.exports = { getDailyTemplate }
module.exports = {
getDailyTemplate,
getReportList,
getReportDetail
}
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
}, },
methods: { methods: {
async getList (searchValue, search) { async getList (searchValue, search) {
const { userInfo, params } = this, const { userInfo, params, data: { optionsKey } } = this,
{ cacheData } = params { cacheData } = params
this.currentId = '' this.currentId = ''
this.currentIds = [] this.currentIds = []
...@@ -45,14 +45,13 @@ export default { ...@@ -45,14 +45,13 @@ export default {
return return
} }
this.componentLoading(params) this.componentLoading(params)
const { shopMerchantId, sceneType, merchantId } = userInfo, console.log(optionsKey)
apiTargetName = sceneType == 1 || params.defeat ? 'getEmployeeList' : 'getOrderScreenEmployeeList', const { shopMerchantId, merchantId } = userInfo,
apiParams = { apiParams = {
merchantId: params.idKey == 'sellerUserId' ? merchantId : shopMerchantId, merchantId: optionsKey == '4sStaffList' ? shopMerchantId : merchantId,
sceneList: params.idKey == 'sellerUserId' ? '' : [sceneType],
} }
if (searchValue) apiParams.name = searchValue if (searchValue) apiParams.name = searchValue
const data = await uni.$api.popupApi[apiTargetName](apiParams) const data = await uni.$api.popupApi.getEmployeeList(apiParams)
this.updateParams(params, data || []) this.updateParams(params, data || [])
}, },
initData (list) { initData (list) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
const componentConfig = { const componentConfig = {
0: { 0: {
name: 'EmployeeList', name: 'EmployeeList',
title: '销售顾问/录单员', title: '选择人员',
placeholder: '请输入姓名', placeholder: '请输入姓名',
idKey: ['userId'], idKey: ['userId'],
cacheData: [], cacheData: [],
...@@ -30,6 +30,16 @@ const componentConfig = { ...@@ -30,6 +30,16 @@ const componentConfig = {
searchValue: '', searchValue: '',
noData: false noData: false
}, },
2: {
name: 'EmployeeList',
title: '选择人员',
placeholder: '请输入姓名',
idKey: ['userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
3: { 3: {
name: 'CarModelList', name: 'CarModelList',
title: '选择车型', title: '选择车型',
......
...@@ -114,7 +114,6 @@ export default { ...@@ -114,7 +114,6 @@ export default {
default: false default: false
}, },
externalData: null, externalData: null,
popupTitle: String,
endDate: { endDate: {
type: String, type: String,
default: '' default: ''
...@@ -141,7 +140,8 @@ export default { ...@@ -141,7 +140,8 @@ export default {
dataKey: null, dataKey: null,
popupType: 0, popupType: 0,
itemIndex: null, itemIndex: null,
calendarData: '' calendarData: '',
popupTitle: ''
} }
}, },
...@@ -186,10 +186,12 @@ export default { ...@@ -186,10 +186,12 @@ export default {
}) })
}, },
open (data, popupType, index) { open (data, popupType, index) {
this.popupTitle = data.label || ''
this.data = data this.data = data
this.dataKey = data.key this.dataKey = data.key
this.popupType = popupType this.popupType = popupType
this.itemIndex = index this.itemIndex = index
if (popupType == 5) { if (popupType == 5) {
this.calendarData = data.value || dayjs().format('YYYY-MM-DD') this.calendarData = data.value || dayjs().format('YYYY-MM-DD')
this.$refs.calendar.open() this.$refs.calendar.open()
......
...@@ -196,7 +196,6 @@ export default { ...@@ -196,7 +196,6 @@ export default {
if (popupType == 5) { if (popupType == 5) {
this.$set(this.data[itemIndex], 'value', chooseContent) this.$set(this.data[itemIndex], 'value', chooseContent)
} else if (popupType == 3) { } else if (popupType == 3) {
console.log(chooseContent)
const { vehicleBrandName, vehicleSubBrandName, vehicleSeriesName, vehicleShapeName } = chooseContent const { vehicleBrandName, vehicleSubBrandName, vehicleSeriesName, vehicleShapeName } = chooseContent
this.$set(this.data[itemIndex], 'value', `${vehicleBrandName}-${vehicleSubBrandName}-${vehicleSeriesName}-${vehicleShapeName}`) this.$set(this.data[itemIndex], 'value', `${vehicleBrandName}-${vehicleSubBrandName}-${vehicleSeriesName}-${vehicleShapeName}`)
this.$set(this.data[itemIndex], this.data[itemIndex].key, chooseContent) this.$set(this.data[itemIndex], this.data[itemIndex].key, chooseContent)
......
...@@ -187,9 +187,10 @@ export default { ...@@ -187,9 +187,10 @@ export default {
this.$emit('onInput', e.detail.value) this.$emit('onInput', e.detail.value)
}, },
select (e) { select (e) {
let { item } = this let { item, popupType } = this
if (item.optionsKey || item.type == 'datetime' || item.type == 'carBrandSelect') { if (item.optionsKey || item.type == 'datetime' || item.type == 'carBrandSelect') {
this.$emit('openSelect', item, this.popupType) if(item.optionsKey == 'storeStaffList') popupType = 2
this.$emit('openSelect', item, popupType)
} else { } else {
this.$emit('onSelect', item.options[e.detail.value].value) this.$emit('onSelect', item.options[e.detail.value].value)
} }
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
:clearDate="false" :clearDate="false"
:endDate="endDate" :endDate="endDate"
:showMonth="false" :showMonth="false"
@monthSwitch="currentMonth = `${$event.year}-${$event.month}`" @monthSwitch="changeMonth"
@change="currentDate = $event.fulldate" @change="changeCurrentDate"
backgroundColor="transparent" backgroundColor="transparent"
:selected="selectedDays" :selected="selectedDays"
:date="currentDate" :date="currentDate"
...@@ -43,15 +43,8 @@ ...@@ -43,15 +43,8 @@
</view> </view>
<view class="detail-right"> <view class="detail-right">
<component <component
:ref="``" :ref="`ref-${componentName}`"
:is="componentName" :is="componentName"
@jump="jump"
:transmission-of-data="transmissionOfData"
:currentDate="currentDate"
:currentMonth="currentMonth"
:lastMonth="lastMonth"
@setCalendarSelected="selectedDays = $event"
:enterType="enterType"
:templateData="templateData" :templateData="templateData"
/> />
</view> </view>
...@@ -89,16 +82,19 @@ export default { ...@@ -89,16 +82,19 @@ export default {
return { return {
options: {}, options: {},
transmissionOfData: null, transmissionOfData: null,
endDate: dayjs().format('YYYY-MM-DD'), endDate: dayjs().format('YYYY-MM-DD'), // 日历结束日期
currentDate: dayjs().format('YYYY-MM-DD'), currentDate: dayjs().format('YYYY-MM-DD'), // 当前选中日期
currentMonth: dayjs().format('YYYY-MM'), currentMonth: dayjs().format('YYYY-MM'), // 当前月份
selectedDays: [], selectedDays: [], // 填写日报日期
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'), lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'), // 上个月份
enterType: '', enterType: '',
templateData: [] templateData: []
} }
}, },
computed: { computed: {
userInfo () {
return uni.$storage.get("userInfo")
},
SCENE_TYPE () { SCENE_TYPE () {
const { sceneType } = uni.$storage.get('userInfo') const { sceneType } = uni.$storage.get('userInfo')
return Number(sceneType) return Number(sceneType)
...@@ -108,17 +104,9 @@ export default { ...@@ -108,17 +104,9 @@ export default {
carBrandId = carBrandList.map(item => item.id) carBrandId = carBrandList.map(item => item.id)
return carBrandId return carBrandId
}, },
/**
* '1.1': 100101, //精品升级
// '1.2': 100102, //次新车升配
// '1.3': 100103, //售后众筹
// '2.1.1': 110101, //售前会员权益升级
// '2.1.2': 110102, //售后会员权益升级
// '2.3.1': 110201, //售前延保
// '2.3.2': 110202, //售后延保
*/
BASE_SCENE_CODE () { BASE_SCENE_CODE () {
return [100101, 100102,100103, 110101, 110102, 110201, 110202] const baseSceneCode = uni.$storage.get('baseSceneCode')
return baseSceneCode
}, },
title () { title () {
...@@ -144,16 +132,54 @@ export default { ...@@ -144,16 +132,54 @@ export default {
componentName = 'EditNegotiationDetail' componentName = 'EditNegotiationDetail'
} }
return componentName return componentName
},
templateType () {
return {
staffdailyreport: 1,
storedailyreport: 2,
negotiationdetaillist: 3,
editnegotiationdetail: 3
}[this.componentName.toLowerCase()]
},
dayList () {
let currentMonth = dayjs(this.currentMonth).format('YYYY-MM'),
mouthNumber = dayjs(currentMonth).daysInMonth(),
nowYear = dayjs(currentMonth).format('YYYY'),
nowMonth = dayjs(currentMonth).format('MM'),
maxDay = dayjs().format('D'),
maxMonth = dayjs().format('YYYY-MM'),
dayNum = currentMonth != maxMonth ? mouthNumber : maxDay,
dayList = []
for (let i = 1; i <= dayNum; i++) {
let date = dayjs(`${nowYear}-${nowMonth}-${i}`).format('YYYY-MM-DD')
dayList.push(date)
} }
return dayList
},
}, },
onLoad (options) { onLoad (options) {
this.options = options this.options = options
this.getReportList()
this.getDailyTemplate(options.componentName) this.getDailyTemplate(options.componentName)
if (options.currentDate) this.setCurrentDate(options.currentDate) if (options.currentDate) this.setCurrentDate(options.currentDate)
}, },
onUnload () { onUnload () {
}, },
methods: { methods: {
async getReportList () {
const { uuid, shopMerchantId } = this.userInfo,
{ templateType, dayList } = this
const data = await uni.$api.dailyTemplateApi.getReportList({
merchantId: shopMerchantId,
staffUuid: uuid,
templateType,
reportStartDate: dayList[0],
reportEndDate: dayList[dayList.length - 1]
})
console.log(data)
},
async getDailyTemplate (componentName) { async getDailyTemplate (componentName) {
const hasCommonElement = (arrA, arrB) => { const hasCommonElement = (arrA, arrB) => {
return arrA.some(item => arrB.includes(item)) return arrA.some(item => arrB.includes(item))
...@@ -217,9 +243,17 @@ export default { ...@@ -217,9 +243,17 @@ export default {
console.log(templateData) console.log(templateData)
}, },
setCurrentDate (currentDate) { setCurrentDate (currentDate) {
console.log(currentDate)
this.currentDate = currentDate this.currentDate = currentDate
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
changeCurrentDate (e) {
this.currentDate = e.fulldate
},
changeMonth (e) {
this.currentMonth = `${e.year}-${e.month}`
this.getReportList()
},
backPage () { backPage () {
uni.navigateBack() uni.navigateBack()
}, },
...@@ -230,6 +264,7 @@ export default { ...@@ -230,6 +264,7 @@ export default {
this.transmissionOfData = val this.transmissionOfData = val
} }
}, },
} }
} }
</script> </script>
......
...@@ -622,6 +622,7 @@ export default { ...@@ -622,6 +622,7 @@ export default {
date date
}) })
}) })
console.log(data, selectedDay)
this.weeklyList = data this.weeklyList = data
this.$emit('setCalendarSelected', selectedDay) this.$emit('setCalendarSelected', selectedDay)
}, },
......
...@@ -45,5 +45,6 @@ export const STORAGE_OBJECTKEY = { ...@@ -45,5 +45,6 @@ export const STORAGE_OBJECTKEY = {
caseInfo: 'caseInfo', caseInfo: 'caseInfo',
boutique_YQorderSetting: 'boutique_YQorderSetting', boutique_YQorderSetting: 'boutique_YQorderSetting',
sessionId: 'sessionId', sessionId: 'sessionId',
createAllGoodsFlag: 'createAllGoodsFlag' createAllGoodsFlag: 'createAllGoodsFlag',
baseSceneCode: 'baseSceneCode',
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!