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 = {
...data,
})
},
/**
* 查询门店分类
*
*/
getSceneByMerchantId(data = {}) {
return http.post({
method: 'dj.api.scenemerchantref.findAllSceneByMerchantId',
projectName: 'boutique',
...data
})
},
}
......@@ -13,9 +13,9 @@ const ENV = env == 'ip' ? 'develop' : env,
const getDailyTemplate = async (templateType) => {
try {
const configModule = {
1:'staff-daily-template',
2:'store-daily-template',
3:'negotiation-details-template',
1: 'staff-daily-template',
2: 'store-daily-template',
3: 'negotiation-details-template',
}[templateType]
const data = await http.uni_request({ url: `${configUrl}&moduleUrl=${configModule}` })
return Promise.resolve(data)
......@@ -23,5 +23,32 @@ const getDailyTemplate = async (templateType) => {
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 {
},
methods: {
async getList (searchValue, search) {
const { userInfo, params } = this,
const { userInfo, params, data: { optionsKey } } = this,
{ cacheData } = params
this.currentId = ''
this.currentIds = []
......@@ -45,14 +45,13 @@ export default {
return
}
this.componentLoading(params)
const { shopMerchantId, sceneType, merchantId } = userInfo,
apiTargetName = sceneType == 1 || params.defeat ? 'getEmployeeList' : 'getOrderScreenEmployeeList',
console.log(optionsKey)
const { shopMerchantId, merchantId } = userInfo,
apiParams = {
merchantId: params.idKey == 'sellerUserId' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'sellerUserId' ? '' : [sceneType],
merchantId: optionsKey == '4sStaffList' ? shopMerchantId : merchantId,
}
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 || [])
},
initData (list) {
......
......@@ -10,7 +10,7 @@
const componentConfig = {
0: {
name: 'EmployeeList',
title: '销售顾问/录单员',
title: '选择人员',
placeholder: '请输入姓名',
idKey: ['userId'],
cacheData: [],
......@@ -30,6 +30,16 @@ const componentConfig = {
searchValue: '',
noData: false
},
2: {
name: 'EmployeeList',
title: '选择人员',
placeholder: '请输入姓名',
idKey: ['userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
3: {
name: 'CarModelList',
title: '选择车型',
......
......@@ -114,7 +114,6 @@ export default {
default: false
},
externalData: null,
popupTitle: String,
endDate: {
type: String,
default: ''
......@@ -141,7 +140,8 @@ export default {
dataKey: null,
popupType: 0,
itemIndex: null,
calendarData: ''
calendarData: '',
popupTitle: ''
}
},
......@@ -186,10 +186,12 @@ export default {
})
},
open (data, popupType, index) {
this.popupTitle = data.label || ''
this.data = data
this.dataKey = data.key
this.popupType = popupType
this.itemIndex = index
if (popupType == 5) {
this.calendarData = data.value || dayjs().format('YYYY-MM-DD')
this.$refs.calendar.open()
......
......@@ -196,7 +196,6 @@ export default {
if (popupType == 5) {
this.$set(this.data[itemIndex], 'value', chooseContent)
} else if (popupType == 3) {
console.log(chooseContent)
const { vehicleBrandName, vehicleSubBrandName, vehicleSeriesName, vehicleShapeName } = chooseContent
this.$set(this.data[itemIndex], 'value', `${vehicleBrandName}-${vehicleSubBrandName}-${vehicleSeriesName}-${vehicleShapeName}`)
this.$set(this.data[itemIndex], this.data[itemIndex].key, chooseContent)
......
......@@ -187,9 +187,10 @@ export default {
this.$emit('onInput', e.detail.value)
},
select (e) {
let { item } = this
let { item, popupType } = this
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 {
this.$emit('onSelect', item.options[e.detail.value].value)
}
......
......@@ -31,8 +31,8 @@
:clearDate="false"
:endDate="endDate"
:showMonth="false"
@monthSwitch="currentMonth = `${$event.year}-${$event.month}`"
@change="currentDate = $event.fulldate"
@monthSwitch="changeMonth"
@change="changeCurrentDate"
backgroundColor="transparent"
:selected="selectedDays"
:date="currentDate"
......@@ -43,15 +43,8 @@
</view>
<view class="detail-right">
<component
:ref="``"
:ref="`ref-${componentName}`"
:is="componentName"
@jump="jump"
:transmission-of-data="transmissionOfData"
:currentDate="currentDate"
:currentMonth="currentMonth"
:lastMonth="lastMonth"
@setCalendarSelected="selectedDays = $event"
:enterType="enterType"
:templateData="templateData"
/>
</view>
......@@ -89,16 +82,19 @@ export default {
return {
options: {},
transmissionOfData: null,
endDate: dayjs().format('YYYY-MM-DD'),
currentDate: dayjs().format('YYYY-MM-DD'),
currentMonth: dayjs().format('YYYY-MM'),
selectedDays: [],
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'),
endDate: dayjs().format('YYYY-MM-DD'), // 日历结束日期
currentDate: dayjs().format('YYYY-MM-DD'), // 当前选中日期
currentMonth: dayjs().format('YYYY-MM'), // 当前月份
selectedDays: [], // 填写日报日期
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'), // 上个月份
enterType: '',
templateData: []
}
},
computed: {
userInfo () {
return uni.$storage.get("userInfo")
},
SCENE_TYPE () {
const { sceneType } = uni.$storage.get('userInfo')
return Number(sceneType)
......@@ -108,17 +104,9 @@ export default {
carBrandId = carBrandList.map(item => item.id)
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 () {
return [100101, 100102,100103, 110101, 110102, 110201, 110202]
const baseSceneCode = uni.$storage.get('baseSceneCode')
return baseSceneCode
},
title () {
......@@ -144,16 +132,54 @@ export default {
componentName = 'EditNegotiationDetail'
}
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) {
this.options = options
this.getReportList()
this.getDailyTemplate(options.componentName)
if (options.currentDate) this.setCurrentDate(options.currentDate)
},
onUnload () {
},
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) {
const hasCommonElement = (arrA, arrB) => {
return arrA.some(item => arrB.includes(item))
......@@ -217,9 +243,17 @@ export default {
console.log(templateData)
},
setCurrentDate (currentDate) {
console.log(currentDate)
this.currentDate = currentDate
this.currentMonth = dayjs(currentDate).format('YYYY-MM')
},
changeCurrentDate (e) {
this.currentDate = e.fulldate
},
changeMonth (e) {
this.currentMonth = `${e.year}-${e.month}`
this.getReportList()
},
backPage () {
uni.navigateBack()
},
......@@ -230,6 +264,7 @@ export default {
this.transmissionOfData = val
}
},
}
}
</script>
......
......@@ -622,6 +622,7 @@ export default {
date
})
})
console.log(data, selectedDay)
this.weeklyList = data
this.$emit('setCalendarSelected', selectedDay)
},
......
......@@ -45,5 +45,6 @@ export const STORAGE_OBJECTKEY = {
caseInfo: 'caseInfo',
boutique_YQorderSetting: 'boutique_YQorderSetting',
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!