Commit 2edaff9e by crushh

update: 修改

parent 06ac1947
This source diff could not be displayed because it is too large. You can view the blob instead.
<template> <template>
<el-dialog title="上架规则" :visible.sync="dialogTableVisible" width="850px"> <el-dialog
title=""
:visible.sync="dialogTableVisible"
width="1000px"
destroy-on-close
>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="上架规则" name="list">
<div class="tab-pane-container">
<div class="search-wrap"> <div class="search-wrap">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
...@@ -14,11 +22,11 @@ ...@@ -14,11 +22,11 @@
/> />
</el-form> </el-form>
</div> </div>
<div class="tips" style="font-size:14px"> <!-- <div class="tips" style="font-size:14px">
没有适用规则?<el-button type="text" size="small" @click="$router.push('/addRule')"> 没有适用规则?<el-button type="text" size="small" @click="$router.push('/addRule')">
去新建上架规则 去新建上架规则
</el-button> </el-button>
</div> </div> -->
</div> </div>
<el-table :data="tableDate" @row-click="onRowClick" v-loading="loading"> <el-table :data="tableDate" @row-click="onRowClick" v-loading="loading">
<el-table-column width="35"> <el-table-column width="35">
...@@ -76,6 +84,20 @@ ...@@ -76,6 +84,20 @@
/> />
</div> </div>
</div> </div>
</div>
</el-tab-pane>
<el-tab-pane label="新建规则" name="form">
<div class="tab-pane-container">
<ruleInfo
:isDialog="true"
ref="ruleInfo"
@submit="getRow"
@btnLoading="btnLoading=true"
@btnStop="btnLoading=false"
/>
</div>
</el-tab-pane>
</el-tabs>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="closePop">取消</el-button> <el-button size="small" @click="closePop">取消</el-button>
<el-button <el-button
...@@ -90,9 +112,12 @@ ...@@ -90,9 +112,12 @@
<script> <script>
import request from '@/service/request.js'; import request from '@/service/request.js';
import ruleInfo from '@/components/ruleDetail.vue';
export default { export default {
name: 'RelatePop', name: 'RelatePop',
components: {
ruleInfo,
},
props: { props: {
integralMallProRuleId: String, integralMallProRuleId: String,
}, },
...@@ -101,6 +126,7 @@ export default { ...@@ -101,6 +126,7 @@ export default {
loading: false, loading: false,
btnLoading: false, btnLoading: false,
tableRadio: '', tableRadio: '',
activeName: 'list',
tableDate: [], tableDate: [],
relateForm: { relateForm: {
ruleTitle: '', ruleTitle: '',
...@@ -165,7 +191,11 @@ export default { ...@@ -165,7 +191,11 @@ export default {
finishBtnLoading () { finishBtnLoading () {
this.btnLoading = false; this.btnLoading = false;
}, },
getRow (row) {
this.$emit('finish', row);
},
submit () { submit () {
if (this.activeName == 'list') {
if (!this.tableRadio) { if (!this.tableRadio) {
this.$message.warning('请选择规则'); this.$message.warning('请选择规则');
return; return;
...@@ -173,6 +203,9 @@ export default { ...@@ -173,6 +203,9 @@ export default {
const row = this.tableDate.filter(item => item.integralMallProRuleId == this.tableRadio)[0]; const row = this.tableDate.filter(item => item.integralMallProRuleId == this.tableRadio)[0];
this.btnLoading = true; this.btnLoading = true;
this.$emit('finish', row); this.$emit('finish', row);
} else {
this.$refs.ruleInfo.submit();
}
}, },
}, },
}; };
...@@ -184,4 +217,7 @@ export default { ...@@ -184,4 +217,7 @@ export default {
display: none; display: none;
} }
} }
.tab-pane-container{
margin-top: 24px;
}
</style> </style>
<template>
<el-form
ref="ruleForm"
:rules="rules"
:model="ruleForm"
label-width="130px"
size="small"
v-loading="loading"
>
<el-form-item label="上架规则名称" prop="ruleTitle">
<el-input
maxlength="30"
show-word-limit
placeholder="请输入上架规则名称"
v-model="ruleForm.ruleTitle"
clearable
@clear="ruleForm.ruleTitle=''"
style="width:340px"
/>
</el-form-item>
<el-form-item label="上架规则名称备注" prop="ruleExplanation">
<el-input
maxlength="50"
show-word-limit
placeholder="请输入上架规则说明"
v-model="ruleForm.ruleExplanation"
style="width:340px"
/>
</el-form-item>
<el-form-item label="适用人群" prop="memberType">
<span class="tips">【人群筛选器】类型的上架规则最多支持20条,目前已创建 <span style="color:#1890ff">{{ memberTypeTotal }}</span></span>
<div>
<el-radio v-model="ruleForm.memberType" :label="1">
全部客户
</el-radio>
<el-radio v-model="ruleForm.memberType" :label="4">
门店筛选
</el-radio>
<el-radio
v-model="ruleForm.memberType"
:label="3"
:disabled="memberTypeTotal>=20&&isAdd"
v-if="ruleMemberFilterClose==0"
>
人群筛选器
</el-radio>
</div>
</el-form-item>
<el-form-item v-show="ruleForm.memberType === 4">
<vue-gic-store-new
:isAdd="isAdd || !uuid"
:uuid.sync="uuid"
ref="storeGroup"
@store-change="storeChange"
/>
</el-form-item>
<vue-gic-people
v-show="ruleForm.memberType === 3"
v-bind="storeParams"
:projectName="projectName"
:triggerReset="true"
:useId="useId"
:hasSearchData="hasSearchData"
:sceneValue="sceneValue"
ref="peopleFilter"
@findFilter="findFilter"
@getBackData="getBackData"
@editShow="hasEditGicPeople=true"
/>
<div>
<el-form-item style="margin-top:50px" v-show="!isDialog">
<el-button
type="primary"
size="small"
@click="submit()"
:loading="btnLoading"
>
确认
</el-button>
</el-form-item>
</div>
</el-form>
</template>
<script>
import request from '@/service/request';
export default {
props: {
isDialog: {
default: false,
type: Boolean,
},
},
data () {
const activityTimeVal = (rule, value, callback) => {
callback(new Error('请填写'));
};
return {
breadcrumbTitle: '新建上架规则',
fixedWidth: document.documentElement.clientWidth - 200,
ruleForm: {
memberType: 1, // 1:全部顾客 3 人群筛选 4 门店筛选
},
rules: {
ruleTitle: [
{ required: true, message: '请填写', trigger: 'blur' },
],
activityTime: [
{ required: true, message: '请填写', trigger: 'blur', validator: activityTimeVal },
],
},
projectName: 'integral-mall',
useId: '',
hasSearchData: '',
sceneValue: 'member', // 场景值
hasEditGicPeople: false,
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy',
loading: false,
btnLoading: false,
uuid: '',
memberTypeTotal: 0,
ruleMemberFilterClose: 0, // 是否关闭人群筛选器
};
},
computed: {
storeParams () {
return !this.isAdd ? { creatorId: this.ruleForm.creatorId } : {};
},
},
mounted () {
if (!this.isAdd) {
this.integralMallProRuleId = this.$route.params.id;
this.getDatail(this.$route.params.id);
}
this.memberTypeNum();
const obj = {
edit: '编辑上架规则',
add: '新建上架规则',
copy: '复制上架规则',
};
this.breadcrumbTitle = obj[this.$route.meta.type];
this.getRuleMemberFilterClose();
},
methods: {
// 检测是否开启 人群筛选器
getRuleMemberFilterClose () {
request.get('/api-integral-mall/get-config').then(res => {
const result = res.data.result || {};
this.ruleMemberFilterClose = result.ruleMemberFilterClose;
});
},
/** 门店筛选器 */
storeChange (storeId) {
this.uuid = storeId;
},
/** 人群筛选器 */
// 获取需要回显的数据, 供保存时候使用
getBackData (val) {
console.log(val);
this.ruleForm.searchJson = val;
},
// 子组件触发父组件事件,返回过滤条件数据
findFilter (val) {
console.log(val);
this.ruleForm.filterJson = val;
},
getDatail (integralMallProRuleId) {
this.loading = true;
request.get('/api-integral-mall/get-rule', { params: { integralMallProRuleId } }).then(res => {
if (res.data.result) {
this.ruleForm = res.data.result;
if (this.ruleForm.memberType == 3) { // 人群筛选器回显
this.hasSearchData = this.ruleForm.filterJson;
this.useId = this.ruleForm.searchId;
if (this.isCopy) {
const form = new FormData();
form.append('requestProject', 'integral-mall');
form.append('id', this.ruleForm.searchId);
request.post('/api-plug/get-screening-detail', form).then(res => {
this.ruleForm.searchJson = res.data.result && res.data.result.detail;
});
}
} else if (this.ruleForm.memberType == 4) { // 门店筛选器回显
this.uuid = JSON.parse(this.ruleForm.filterJson).storeWidgetId;
}
}
}).finally(() => {
this.loading = false;
});
},
submitRequest () {
this.$refs.ruleForm.validate(val => {
if (val) {
let data = {};
if (this.isCopy) {
const { ruleTitle, ruleExplanation, filterJson, memberType, searchJson, showBack } = this.ruleForm;
data = { ruleTitle, ruleExplanation, memberType, filterJson, searchJson, showBack };
} else {
data = this.ruleForm;
}
this.btnLoading = true;
this.$emit('btnLoading');
request.post('/api-integral-mall/add-update-rule', data).then(res => {
const integralMallProRuleId = res.data.result;
if (this.isDialog) {
this.$emit('submit', { ...data, integralMallProRuleId });
} else {
this.$router.go(-1);
}
}).finally(() => {
this.$emit('btnStop');
this.btnLoading = false;
});
}
});
},
async submit () {
if (this.ruleForm.memberType == 1) {
this.ruleForm.filterJson = '';
this.ruleForm.searchJson = '';
this.ruleForm.searchId = '';
this.submitRequest();
} else if (this.ruleForm.memberType == 3) {
if (this.hasEditGicPeople) {
this.$refs.peopleFilter.confirmSet().then(async () => {
const res = await this.echoData(this.ruleForm.filterJson);
this.ruleForm.showBack = res.data.result;
this.submitRequest();
});
} else {
const res = await this.echoData(this.ruleForm.filterJson);
this.ruleForm.showBack = res.data.result;
this.submitRequest();
}
} else if (this.ruleForm.memberType == 4) {
this.$refs.storeGroup.getStoreConfig().then(async (data) => {
let type = 0;
if (data.type != 0) {
type = 1;
}
const res = await this.echoData2(this.uuid, data.type);
const { data: { result: { result } } } = res;
console.log(result);
if (result) {
this.ruleForm.showBack = result.map(item => item.name).join(',');
} else {
this.ruleForm.showBack = '所有门店';
}
this.ruleForm.filterJson = JSON.stringify({ storeMode: type, storeWidgetId: this.uuid });
this.ruleForm.searchJson = '';
this.ruleForm.searchId = this.uuid;
this.submitRequest();
});
}
},
echoData (filterJson) { // 取得人群筛选器回显文字
const form = new FormData();
form.append('params', filterJson);
form.append('requestProject', 'integral-mall');
form.append('sceneCode', 'member');
return request.post('/api-plug/screening-show-back', form);
},
echoData2 (key, type) { // 取得门店筛选器的文字回显
const form = new FormData();
form.append('key', key);
form.append('selectType', type);
form.append('currentPage', 1);
form.append('pageSize', 20);
return request.post('/api-plug/list-right-data', form);
},
memberTypeNum () {
request.get('/api-integral-mall/list-rule', { params: { memberType: 3 } }).then(res => {
this.memberTypeTotal = res.data.result.length || 0;
});
},
},
};
</script>
<style scoped>
.gic-people--button{
background: #f2f3f4;
padding: 0 0 20px 124px;
}
</style>
...@@ -1046,7 +1046,7 @@ export default { ...@@ -1046,7 +1046,7 @@ export default {
this.cardList = []; this.cardList = [];
this.cardList = res.data.result; this.cardList = res.data.result;
if (this.cardList.length === 1) { if (this.cardList.length === 1) {
this.cardCouponList[0].proName = this.cardList[0].cardName; this.cardCouponList[0].proRefName = this.cardList[0].cardName;
this.cardCouponList[0].proRefId = this.cardList[0].coupCardId; this.cardCouponList[0].proRefId = this.cardList[0].coupCardId;
} }
if (this.cardList) { if (this.cardList) {
......
...@@ -2329,7 +2329,7 @@ export default { ...@@ -2329,7 +2329,7 @@ export default {
}, },
// 检测是否开启 erp商品兑换接口 // 检测是否开启 erp商品兑换接口
getErpGoodsFlag() { getErpGoodsFlag() {
request.get('/api-integral-mall/get-erp-config').then(res => { request.get('/api-integral-mall/get-config').then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
const result = res.data.result || {}; const result = res.data.result || {};
this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0); this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0);
......
...@@ -2686,7 +2686,7 @@ export default { ...@@ -2686,7 +2686,7 @@ export default {
}, },
// 检测是否开启 erp商品兑换接口 // 检测是否开启 erp商品兑换接口
getErpGoodsFlag() { getErpGoodsFlag() {
request.get('/api-integral-mall/get-erp-config').then(res => { request.get('/api-integral-mall/get-config').then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
const result = res.data.result || {}; const result = res.data.result || {};
this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0); this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0);
......
...@@ -18,262 +18,18 @@ ...@@ -18,262 +18,18 @@
</h3> </h3>
</div> </div>
<div class="section"> <div class="section">
<el-form <ruleInfo />
ref="ruleForm"
:rules="rules"
:model="ruleForm"
label-width="160px"
size="small"
v-loading="loading"
>
<el-form-item label="上架规则名称" prop="ruleTitle">
<el-input
maxlength="30"
show-word-limit
placeholder="请输入上架规则名称"
v-model="ruleForm.ruleTitle"
clearable
@clear="ruleForm.ruleTitle=''"
style="width:340px"
/>
</el-form-item>
<el-form-item label="上架规则名称备注" prop="ruleExplanation">
<el-input
maxlength="50"
show-word-limit
placeholder="请输入上架规则说明"
v-model="ruleForm.ruleExplanation"
style="width:340px"
/>
</el-form-item>
<el-form-item label="适用人群" prop="memberType">
<span class="tips">【人群筛选器】类型的上架规则最多支持20条,目前已创建 <span style="color:#1890ff">{{ memberTypeTotal }}</span></span>
<div>
<el-radio v-model="ruleForm.memberType" :label="1">
全部客户
</el-radio>
<el-radio v-model="ruleForm.memberType" :label="4">
门店筛选
</el-radio>
<el-radio v-model="ruleForm.memberType" :label="3" :disabled="memberTypeTotal>=20&&isAdd">
人群筛选器
</el-radio>
</div>
</el-form-item>
<el-form-item v-show="ruleForm.memberType === 4">
<vue-gic-store-new
:isAdd="isAdd || !uuid"
:uuid.sync="uuid"
ref="storeGroup"
@store-change="storeChange"
/>
</el-form-item>
<el-form-item v-show="ruleForm.memberType === 3">
<vue-gic-people
v-bind="storeParams"
:projectName="projectName"
:triggerReset="true"
:useId="useId"
:hasSearchData="hasSearchData"
:sceneValue="sceneValue"
ref="peopleFilter"
@findFilter="findFilter"
@getBackData="getBackData"
@editShow="hasEditGicPeople=true"
/>
</el-form-item>
<div>
<el-form-item style="margin-top:50px">
<el-button
type="primary"
size="small"
@click="submit()"
:loading="btnLoading"
>
确认
</el-button>
</el-form-item>
</div>
</el-form>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import request from '../../../service/request'; import ruleInfo from '@/components/ruleDetail.vue';
export default { export default {
data () { components: {
const activityTimeVal = (rule, value, callback) => { ruleInfo,
callback(new Error('请填写'));
};
return {
breadcrumbTitle: '新建上架规则',
fixedWidth: document.documentElement.clientWidth - 200,
ruleForm: {
memberType: 1, // 1:全部顾客 3 人群筛选 4 门店筛选
},
rules: {
ruleTitle: [
{ required: true, message: '请填写', trigger: 'blur' },
],
activityTime: [
{ required: true, message: '请填写', trigger: 'blur', validator: activityTimeVal },
],
},
projectName: 'integral-mall',
useId: '',
hasSearchData: '',
sceneValue: 'member', // 场景值
hasEditGicPeople: false,
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy',
loading: false,
btnLoading: false,
uuid: '',
memberTypeTotal: 0,
};
},
computed: {
storeParams () {
return !this.isAdd ? { creatorId: this.ruleForm.creatorId } : {};
},
},
mounted () {
if (!this.isAdd) {
this.integralMallProRuleId = this.$route.params.id;
this.getDatail(this.$route.params.id);
}
this.memberTypeNum();
const obj = {
edit: '编辑上架规则',
add: '新建上架规则',
copy: '复制上架规则',
};
this.breadcrumbTitle = obj[this.$route.meta.type];
},
methods: {
/** 门店筛选器 */
storeChange (storeId) {
this.uuid = storeId;
},
/** 人群筛选器 */
// 获取需要回显的数据, 供保存时候使用
getBackData (val) {
console.log(val);
this.ruleForm.searchJson = val;
}, },
// 子组件触发父组件事件,返回过滤条件数据
findFilter (val) {
console.log(val);
this.ruleForm.filterJson = val;
},
getDatail (integralMallProRuleId) {
this.loading = true;
request.get('/api-integral-mall/get-rule', { params: { integralMallProRuleId } }).then(res => {
if (res.data.result) {
this.ruleForm = res.data.result;
if (this.ruleForm.memberType == 3) { // 人群筛选器回显
this.hasSearchData = this.ruleForm.filterJson;
this.useId = this.ruleForm.searchId;
if (this.isCopy) {
const form = new FormData();
form.append('requestProject', 'integral-mall');
form.append('id', this.ruleForm.searchId);
request.post('/api-plug/get-screening-detail', form).then(res => {
this.ruleForm.searchJson = res.data.result && res.data.result.detail;
});
}
} else if (this.ruleForm.memberType == 4) { // 门店筛选器回显
this.uuid = JSON.parse(this.ruleForm.filterJson).storeWidgetId;
}
}
}).finally(() => {
this.loading = false;
});
},
submitRequest () {
console.log(this.ruleForm);
this.$refs.ruleForm.validate(val => {
if (val) {
let data = {};
if (this.isCopy) {
const { ruleTitle, ruleExplanation, filterJson, memberType, searchJson, showBack } = this.ruleForm;
data = { ruleTitle, ruleExplanation, memberType, filterJson, searchJson, showBack };
} else {
data = this.ruleForm;
}
this.btnLoading = true;
request.post('/api-integral-mall/add-update-rule', data).then(res => {
this.$router.go(-1);
}).finally(() => {
this.btnLoading = false;
});
}
});
},
async submit () {
if (this.ruleForm.memberType == 1) {
this.ruleForm.filterJson = '';
this.ruleForm.searchJson = '';
this.ruleForm.searchId = '';
this.submitRequest();
} else if (this.ruleForm.memberType == 3) {
if (this.hasEditGicPeople) {
this.$refs.peopleFilter.confirmSet().then(async () => {
const res = await this.echoData(this.ruleForm.filterJson);
this.ruleForm.showBack = res.data.result;
this.submitRequest();
});
} else {
const res = await this.echoData(this.ruleForm.filterJson);
this.ruleForm.showBack = res.data.result;
this.submitRequest();
}
} else if (this.ruleForm.memberType == 4) {
this.$refs.storeGroup.getStoreConfig().then(async (data) => {
let type = 0;
if (data.type != 0) {
type = 1;
}
const res = await this.echoData2(this.uuid, data.type);
const { data: { result: { result } } } = res;
console.log(result);
if (result) {
this.ruleForm.showBack = result.map(item => item.name).join(',');
} else {
this.ruleForm.showBack = '所有门店';
}
this.ruleForm.filterJson = JSON.stringify({ storeMode: type, storeWidgetId: this.uuid });
this.ruleForm.searchJson = '';
this.ruleForm.searchId = this.uuid;
this.submitRequest();
});
}
},
echoData (filterJson) { // 取得人群筛选器回显文字
const form = new FormData();
form.append('params', filterJson);
form.append('requestProject', 'integral-mall');
form.append('sceneCode', 'member');
return request.post('/api-plug/screening-show-back', form);
},
echoData2 (key, type) { // 取得门店筛选器的文字回显
const form = new FormData();
form.append('key', key);
form.append('selectType', type);
form.append('currentPage', 1);
form.append('pageSize', 20);
return request.post('/api-plug/list-right-data', form);
},
memberTypeNum () {
request.get('/api-integral-mall/list-rule', { params: { memberType: 3 } }).then(res => {
this.memberTypeTotal = res.data.result.length || 0;
});
},
},
}; };
</script> </script>
......
...@@ -818,7 +818,7 @@ export default { ...@@ -818,7 +818,7 @@ export default {
}, },
// 检测是否开启 erp商品兑换接口 // 检测是否开启 erp商品兑换接口
getErpGoodsFlag () { getErpGoodsFlag () {
request.get('/api-integral-mall/get-erp-config').then(res => { request.get('/api-integral-mall/get-config').then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
const result = res.data.result || {}; const result = res.data.result || {};
this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0); this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0);
......
...@@ -592,7 +592,7 @@ export default { ...@@ -592,7 +592,7 @@ export default {
}, },
// 检测是否开启 erp商品兑换接口 // 检测是否开启 erp商品兑换接口
getErpGoodsFlag () { getErpGoodsFlag () {
request.get('/api-integral-mall/get-erp-config').then(res => { request.get('/api-integral-mall/get-config').then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
const result = res.data.result || {}; const result = res.data.result || {};
this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0); this.$store.commit('mutations_erpGoodsFlag', result.goodsStockSync || 0);
......
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