Commit ff36bbbc by Kyle_Li

update: 接口完善

parent 5f9fbedb
......@@ -11,22 +11,22 @@ import getFetch from './get-fetch.js';
let api = {
// 指标管理
getTargetList: '/perfromance/total-performance-list', // 获取指标列表
getDaySet: '/', // 获取日指标设置
saveDaySet: { // 保存日指标设置
url: '/',
getTargetList: '/performance/total-performance-list', // 获取指标列表
getStorePerformanceDetail: '/performance/list-store-performance', // 指标列表-查看店列表
changeStorePerformanceMonth: '/performance/change-store-month-performance', // 指标列表-修改门店月指标
getStorePerformanceDay: '/performance/list-day-performance', // 指标列表-查看门店日列表
changeStorePerformanceDay: {
url: '/performance/save-day-performance', // 指标列表-保存门店日列表
method: 'post',
useFormData: true,
useIntercept: false
useFormData: true
},
getSaleSet: '/', // 获取导购指标设置
saveSaleSet: { // 保存导购指标设置
url: '/',
getStorePerformanceClerk: '/performance/list-clerk-performance', // 指标列表-查看导购指标
changeStorePerformanceClerk: {
url: '/performance/save-clerk-performance', // 指标列表-保存导购指标
method: 'post',
useFormData: true,
useIntercept: false
useFormData: true
},
getYearList: '/setting/get-year-list', // 获取年份
getStorePerformanceList: '/setting/list-store-performance', // 指标设置-已设置门店指标列表
getNoStorePerformanceList: '/setting/list-no-store-performance', // 指标设置-未设置门店指标列表
......@@ -36,6 +36,19 @@ let api = {
useFormData: true,
useIntercept: true
},
editStorePerformance: { // 指标设置-编辑单个门店指标
url: '/setting/edit-single-store-performance',
method: 'post',
useFormData: true,
useIntercept: true
},
batchEditStorePerformance: { // 指标设置-批量设置门店指标
url: '/setting/batch-setting-store-performance',
method: 'post',
useFormData: true,
useIntercept: true
},
batchSettingRight: '/setting/batch-setting-right', // 指标设置-批量修改权限
};
api = getFetch(api, '/hb-app-performance-web');
......
......@@ -19,23 +19,27 @@
<el-form :model="form" ref="form" :rules="rules" label-width="180px" hide-required-asterisk>
<el-form-item label="选择年份" prop="performanceYear">
<el-select v-model="form.performanceYear" placeholder="请选择年份">
<el-select v-model="form.performanceYear" placeholder="请选择年份" v-if="!edit">
<el-option v-for="item in yearList" :key="item" :label="item" :value="item"></el-option>
</el-select>
<span v-else>{{ form.performanceYear }}</span>
</el-form-item>
<el-form-item label="选择门店" prop="storeValue">
<el-radio-group v-model="form.storeMode">
<el-radio :label="0">所有门店</el-radio>
<el-radio :label="1">选择分组</el-radio>
<el-radio :label="2">选择门店</el-radio>
</el-radio-group>
<customer-store-group v-if="form.storeMode == 1" :brand-id="brandId" :select-group="storeValue" @checkGroupIds="checkGroupIds"></customer-store-group>
<customer-store v-if="form.storeMode == 2" :brand-id="brandId" :select-store="storeValue" @checkStoreIds="checkGroupIds"></customer-store>
<template v-if="!edit">
<el-radio-group v-model="form.storeMode">
<el-radio :label="0">所有门店</el-radio>
<el-radio :label="1">选择分组</el-radio>
<el-radio :label="2">选择门店</el-radio>
</el-radio-group>
<customer-store-group v-if="form.storeMode == 1" :brand-id="brandId" :select-group="storeValue" @checkGroupIds="checkGroupIds"></customer-store-group>
<customer-store v-if="form.storeMode == 2" :brand-id="brandId" :select-store="storeValue" @checkStoreIds="checkGroupIds"></customer-store>
</template>
<span v-else>{{ targetStoreInfoIds.map(item => item.storeName).join(';') }}</span>
</el-form-item>
<el-form-item label="指标类型(必填一项)" prop="type">
<el-form-item label="指标类型(必填一项)" prop="type" v-if="!edit">
<el-checkbox v-model="form.performanceFlag" :true-label="1" :false-label="0">
业绩指标(元)
<el-select v-model="form.performanceSubType" style="width: 240px;margin: 0 20px 20px 48px" :disabled="form.performanceFlag == 0">
......@@ -57,7 +61,7 @@
</el-form-item>
<el-form-item label="指标编辑权限" prop="storeEdit">
<el-checkbox v-model="storeEdit" :true-label="1" :false-label="0">店长可修改指标</el-checkbox>
<el-checkbox v-model="form.storeEdit" :true-label="1" :false-label="0">店长可修改指标</el-checkbox>
</el-form-item>
<el-form-item label="">
......@@ -73,7 +77,7 @@ import customerStoreGroup from '@/components/app/my-customer/customer-store-grou
import customerStore from '@/components/app/my-customer/customer-store.vue';
import MonthTarget from './MonthTarget.vue';
import fetch from '@/api/target-manage-app.js';
const { getYearList, saveStorePerformance } = fetch;
const { getYearList, saveStorePerformance, batchSettingRight, batchEditStorePerformance, editStorePerformance } = fetch;
export default {
name: 'EditStoreQuota',
......@@ -120,13 +124,26 @@ export default {
performanceVal: null,
addMemberCallback: null, // 回显数据
addMemberVal: null,
targetStoreInfoIds: [], // 批量编辑的门店
edit: '', // 3:批量编辑权限
};
},
mounted() {
this.$emit('showTab', '/quota-set');
let bread = [ { name: '指标设置', path: '/quota-set' }, { name: '编辑指标' } ];
created() {
let bread = [ { name: '指标设置', path: '/quota-set' }, { name: '新建指标' } ];
// 修改面包屑
const { applicationId, edit, year, storeEdit } = this.$route.query;
bread[0].path += `?applicationId=${applicationId}`;
if (edit === '3') { // 批量权限
this.targetStoreInfoIds = JSON.parse(localStorage.getItem('targetStoreInfoIds'));
this.form.performanceYear = year;
this.form.storeEdit = Number(storeEdit);
}
this.edit = edit;
this.$emit('change-nav', bread);
},
mounted() {
this.$emit('showTab', '/quota-set');
this.getYearList();
},
methods: {
......@@ -142,24 +159,40 @@ export default {
confirm() {
this.$refs.form.validate(valid => {
if (!valid) return;
const { performanceFlag, addMemberFlag, storeValue, performanceYear, storeMode } = this.form;
const { performanceFlag, addMemberFlag, storeValue, performanceYear, storeMode, storeEdit } = this.form;
if (performanceFlag && this.$refs.monthTargetRef1.validate()) return this.$message.warning('请完善业绩指标');
if (addMemberFlag && this.$refs.monthTargetRef2.validate()) return this.$message.warning('请完善新增会员指标');
this.loading = true;
const { staffName, staffId, wxEnterpriseId } = JSON.parse(localStorage.getItem('haoBanUser'));
let params = {
...this.form,
wxEnterpriseId,
submitStaffName: staffName,
submitStaffId: staffId,
enterpriseId: this.brandId,
// eslint-disable-next-line
storeValue: storeValue.map(item => storeMode == 1 ? item.storeGroupId : item.storeInfoId).join(','),
performanceValue: this.filterTargetVal('performanceVal', performanceYear),
addMemebrValue: this.filterTargetVal('addMemberVal', performanceYear)
};
saveStorePerformance(params, { headers: { sign: this.brandId } })
let params;
if (this.edit === '3') { // 批量权限
console.log(this.targetStoreInfoIds);
params = {
wxEnterpriseId,
submitStaffName: staffName,
submitStaffId: staffId,
enterpriseId: this.brandId,
performanceYear,
storeEdit,
storeInfoIds: this.targetStoreInfoIds.map(item => item.storeInfoId).join(','),
};
} else if (!this.edit) { // 新增
params = {
...this.form,
wxEnterpriseId,
submitStaffName: staffName,
submitStaffId: staffId,
enterpriseId: this.brandId,
// eslint-disable-next-line
storeValue: storeValue.map(item => storeMode == 1 ? item.storeGroupId : item.storeInfoId).join(','),
performanceValue: this.filterTargetVal('performanceVal', performanceYear),
addMemebrValue: this.filterTargetVal('addMemberVal', performanceYear)
};
}
[ saveStorePerformance, editStorePerformance, batchEditStorePerformance, batchSettingRight ][this.edit || 0](params, { headers: { sign: this.brandId } })
.then(res => {
this.$message.success('保存成功');
this.$router.go(-1);
......
......@@ -65,21 +65,21 @@
</div>
<el-select placeholder="操作" @change="batchOperation">
<el-option label="新增指标" :value="1"></el-option>
<el-option label="编辑指标" :value="2" v-show="activeName === '0'"></el-option>
<el-option label="新增指标" :value="1" v-show="activeName === '0'"></el-option>
<el-option label="编辑指标" :value="2"></el-option>
<el-option label="修改编辑权限" :value="3" v-show="activeName === '0'"></el-option>
</el-select>
</div>
<div class="content-data">
<div class="content-data" v-show="activeName === '1'">
<div>
<span class="color2">年业绩指标:¥ </span>
<!-- <span class="color2">年业绩指标:¥ </span>
<span class="color1">100,000</span>
<span class="color2">年新增会员指标:¥ </span>
<span class="color1">100,000</span>
<span class="color1">100,000</span> -->
</div>
<span v-show="activeName === '1'">
<span>
<el-checkbox v-model="search1.noPerformanceFlag" :true-label="1" :false-label="0" @change="searchChange">未设置业绩指标门店</el-checkbox>
<el-checkbox v-model="search1.noAddMemberFlag" :true-label="1" :false-label="0" @change="searchChange">未设置新增会员指标门店</el-checkbox>
</span>
......@@ -130,7 +130,7 @@
<el-table-column prop="date" label="操作">
<template>
<el-button type="text">编辑</el-button>
<el-button type="text">删除</el-button>
<el-button type="text" v-show="activeName === '0'">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -169,6 +169,7 @@ export default {
data() {
return {
activeName: '',
applicationId: '',
haoban: {},
search: {
......@@ -203,8 +204,9 @@ export default {
},
created() {
const { tab } = this.$route.query;
const { tab, applicationId } = this.$route.query;
this.activeName = tab || '0';
this.applicationId = applicationId;
const { staffId, wxEnterpriseId } = JSON.parse(localStorage.getItem('haoBanUser'));
this.haoban = { staffId, wxEnterpriseId };
},
......@@ -255,6 +257,15 @@ export default {
switch (val) {
case 1:
return this.$router.push({ path: '/edit-store-quota', query: { applicationId: this.applicationId } });
case 3:
if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.warning('请选择指标门店');
// 判断是否一致
let edit = this.multipleSelection[0].storeEdit;
let bool = this.multipleSelection.some(item => item.storeEdit !== edit);
if (bool) return this.$message.warning('选择的指标门店的 编辑权限 必须一致');
localStorage.setItem('targetStoreInfoIds', JSON.stringify(this.multipleSelection));
return this.$router.push({ path: '/edit-store-quota', query: { applicationId: this.applicationId, edit: '3', year: this.search.performanceYear, storeEdit: edit } });
default:
break;
}
......@@ -344,6 +355,7 @@ export default {
.content-search {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.content-first {
display: flex;
......@@ -352,7 +364,7 @@ export default {
.content-data {
display: flex;
justify-content: space-between;
margin: 20px 0;
margin-bottom: 20px;
}
.color1 {
color: #303133;
......
......@@ -16,7 +16,7 @@
</el-tabs>
<div class="list-content">
<el-select v-model="search.date">
<el-select v-model="search.date" @change="getData">
<el-option v-for="item in yearList" :key="item" :label="item" :value="item"></el-option>
</el-select>
......@@ -27,14 +27,16 @@
<el-table-column prop="performanceYm" label="月份"></el-table-column>
<el-table-column prop="storeCount" label="门店总数"></el-table-column>
<el-table-column prop="totalPerformanceValue" label="总业绩指标"></el-table-column>
<el-table-column label="业绩指标">
<template slot-scope="{row}">
{{ row.noPerfectCount || '--' }} 未完善;{{ row.prefectCount || '--' }} 已完善
{{ row.noPerfectCount }} 未完善;{{ row.prefectCount }} 已完善
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="{row}">
<el-button type="text" @click="$router.push({ path: '/target-store', query: { tab: activeName, id: row.id } })">查看门店</el-button>
<el-button type="text" @click="$router.push({ path: '/target-store', query: { tab: activeName, year: row.performanceYm, applicationId } })">查看门店</el-button>
</template>
</el-table-column>
</el-table>
......@@ -60,28 +62,31 @@ export default {
},
data() {
return {
wxEnterpriseId: localStorage.getItem('haoBanUser') ? JSON.parse(localStorage.getItem('haoBanUser')).wxEnterpriseId : '',
tableData: [ {} ],
haoban: {},
tableData: [],
activeName: '1',
search: {
date: ''
date: new Date().getFullYear()
},
yearList: [],
loading: false
};
},
created() {
const { tab } = this.$route.query;
const { tab, applicationId } = this.$route.query;
this.applicationId = applicationId;
this.activeName = tab || '1';
const { staffId, wxEnterpriseId } = JSON.parse(localStorage.getItem('haoBanUser'));
this.haoban = { staffId, wxEnterpriseId };
},
// 生命周期 - 挂载完成(访问DOM元素)
mounted() {
const that = this;
that.$emit('showTab', '/target-list');
that.$emit('change-nav', [ { name: '指标管理' } ]);
that.getYearList();
if (!!that.brandId) {
that.getData();
that.getYearList();
}
},
// methods
......@@ -94,10 +99,10 @@ export default {
this.loading = true;
const that = this;
const para = {
wxEnterpriseId: that.wxEnterpriseId,
...that.haoban,
enterpriseId: that.brandId,
perfromanceType: this.activeName,
performanceYear: this.search.date
perfromanceType: that.activeName,
performanceYear: that.search.date
};
getTargetList(para, { headers: { sign: that.brandId } })
.then(res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment