Commit 4244f6b0 by crushh

update: 优化

parent 5f0e8c33
......@@ -21,7 +21,7 @@
<el-table :data="tableDate" @row-click="onRowClick" v-loading="loading">
<el-table-column width="35">
<template slot-scope="{row}">
<el-radio v-model="tableRadio" :label="row">
<el-radio v-model="tableRadio" :label="row.integralMallProRuleId">
<i />
</el-radio>
</template>
......@@ -63,8 +63,13 @@
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="cancel">取消</el-button>
<el-button size="small" type="primary" @click="submit">确认</el-button>
<el-button size="small" @click="closePop">取消</el-button>
<el-button
size="small"
type="primary"
:loading="btnLoading"
@click="submit"
>确认</el-button>
</span>
</el-dialog>
</template>
......@@ -75,11 +80,12 @@ import request from '@/service/request.js';
export default {
name: 'RelatePop',
props: {
integralMallProId: String,
integralMallProRuleId: String,
},
data () {
return {
loading: false,
btnLoading: false,
tableRadio: '',
tableDate: [],
relateForm: {
......@@ -88,17 +94,22 @@ export default {
currentPage: 1,
},
dialogTableVisible: false,
echoRuleId: '',
};
},
watch: {
integralMallProRuleId (val) {
if (val) {
this.echoRuleId = val;
}
},
},
mounted () {
},
methods: {
onRowClick (row) {
this.tableRadio = row;
this.tableRadio = row.integralMallProRuleId;
},
showPop () {
this.dialogTableVisible = true;
......@@ -122,6 +133,7 @@ export default {
}
}
this.tableDate = this.tableDate.splice(0);
if (this.echoRuleId) this.tableRadio = this.echoRuleId;
}).finally(_ => {
this.loading = false;
});
......@@ -133,7 +145,7 @@ export default {
form.append('sceneCode', 'member');
return request.post('/api-plug/screening-show-back', form);
},
cancel () {
closePop () {
this.tableRadio = '';
this.relateForm = {
ruleTitle: '',
......@@ -141,21 +153,19 @@ export default {
currentPage: 1,
};
this.dialogTableVisible = false;
this.btnLoading = false;
},
finishBtnLoading () {
this.btnLoading = false;
},
submit () {
if (!this.tableRadio) {
this.$message.warning('请选择规则');
return;
}
const row = this.tableDate.filter(item => item.integralMallProRuleId == this.tableRadio)[0];
this.btnLoading = true;
const data = {};
console.log(this.tableRadio);
console.log(this.integralMallProId);
data.integralMallProIdList = [this.integralMallProId];
data.integralMallProRuleId = this.tableRadio.integralMallProRuleId;
request.post('/api-integral-mall/add-rule-pro', data).then(res => {
this.$message.success('添加成功');
this.dialogTableVisible = false;
this.$emit('finish');
}).finally(_ => {
this.btnLoading = false;
});
this.$emit('finish', row);
},
},
};
......
<template>
<div class="updateInfo">
<span class="title">积分商城升级说明</span>
<div class="content">
为了提供更好的服务,积分商城商品系统升级,升级后可设置【上架规则】,<br>
编辑前需要清除当前商品的【展现门店】,<span style="color:#F5222D;">操作不可逆</span>;不升级则当前页面配置继续生效。
</div>
<el-button type="primary" size="small" @click="update">
去编辑
</el-button>
</div>
</template>
<script>
export default {
methods: {
update () {
this.$emit('update');
},
},
};
</script>
<style lang="less" scoped>
.updateInfo{
width: 100%;
background: #FFFFFF;
border-radius: 2px;
padding: 20px 30px;
.title{
font-size: 18px;
line-height: 25px;
font-weight: bold;
}
.content{
margin: 16px 0;
font-size: 14px;
line-height: 20px;
}
}
</style>
<template>
<el-form :model="giftForm" :rules="rules">
<el-form
ref="form"
:model="giftForm"
:rules="rules"
label-width="100px"
class="demo-ruleForm"
label-position="right"
style="margin-top: 20px"
>
<el-form-item label="上架规则" prop="ruleTitle" v-if="isNew">
<el-button type="small" @click="openRelating">
{{ giftForm.ruleTitle }}
<span class="ruleTitle" v-show="giftForm.ruleTitle">{{ giftForm.ruleTitle }}</span>
<el-button small type="text" @click="openRelating">
修改上架规则
</el-button>
</el-form-item>
<el-form-item label="上架时间" prop="releaseType">
......@@ -14,8 +23,9 @@
自定义上架时间段
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item class="form-item-mt" v-if="giftForm.releaseType === 2" prop="limitTimeBegin">
<el-date-picker
v-if="giftForm.releaseType === 2"
v-model="giftForm.limitTimeBegin"
type="datetimerange"
range-separator="至"
......@@ -45,6 +55,7 @@
label="展现门店"
required
style="position:relative"
v-if="!isNew"
>
<el-tooltip
class="tips-content"
......@@ -58,32 +69,38 @@
<i class="iconfont icon-xinxixianshi" style="color:#1890ff" />
</el-tooltip>
<vue-gic-store-linkage
v-show="(setting.useNewStoreWidget === 0&&setting.creatorId) || showComponent"
v-if="giftForm.useNewStoreWidget === 0 &&(giftForm.creatorId|| showComponent)"
style="margin-left:10px"
:creatorId="setting.creatorId"
:creatorId="giftForm.creatorId"
:disabled="true"
:openFlag="setting.openFlag"
:openFlag="giftForm.openFlag"
@getDisGroupList="getDisGroupList"
:msg="setting.sendChildData"
:msg="giftForm.sendChildData"
ref="selectTree"
/>
<span v-if="giftForm.useNewStoreWidget === 0&&giftForm.sendChildData.storeType === 1" class="store-tip">若选中的父分组下有新增的门店分组,系统不会默认选中此新增门店分组,请重新确认选择并保存礼品</span>
<vue-gic-store-card
v-show="setting.useNewStoreWidget === 1"
v-show="giftForm.useNewStoreWidget === 1"
style="margin-left:10px"
class="pt10"
ref="storeCard"
:readonly="true"
:uuid.sync="setting.uuid"
:uuid.sync="giftForm.uuid"
scenes
/>
<span v-if="setting.sendChildData.storeType === 1" class="store-tip">若选中的父分组下有新增的门店分组,系统不会默认选中此新增门店分组,请重新确认选择并保存礼品</span>
</el-form-item>
<relate-pop ref="relatePop" :integralMallProRuleId="giftForm.integralMallProRuleId" @finish="onPopFinish" />
</el-form>
</template>
<script>
// import request from '@/service/request.js';
import getInputVal from '@/utils/common.js';
import relatePop from '@/components/relatePop';
export default {
components: {
relatePop,
},
props: {
form: Object,
configuration: Object,
......@@ -95,24 +112,30 @@ export default {
},
data () {
return {
giftForm: {}, // 表单的值
setting: {
giftForm: {
useNewStoreWidget: 1,
openFlag: false,
creatorId: '',
sendChildData: {
sendChildData: { // 公共组件的值
storeType: 1,
storeGroupIds: '',
storeIds: [],
},
uuid: '',
}, // 各种组件的配置
}, // 表单的值
groupIdDisableList: [],
pickerOptions: {
disabledDate (time) {
return time.getTime() < Date.now() - 24 * 3600 * 1000;
},
},
rules: {
ruleTitle: [{ required: true, message: '请选择上架规则' }],
proShowStatus: [{ required: true, message: '请选择显示状态', trigger: 'change' }],
releaseType: [{ required: true, message: '请选择上架时间', trigger: 'change' }],
limitTimeBegin: [{ required: true, message: '请选择时间', trigger: 'change' }],
},
getTimeAll: getInputVal.formatDate,
};
},
computed: {
......@@ -121,46 +144,121 @@ export default {
},
},
watch: {
form (val) {
if (val) {
this.giftForm = JSON.parse(JSON.stringify(val));
}
},
configuration (val) {
if (val) {
form: {
handler (val) {
console.log(val);
this.setting = JSON.parse(JSON.stringify(val));
if (this.setting.useNewStoreWidget == 1) {
this.giftForm = JSON.parse(JSON.stringify(val));
if (this.giftForm.useNewStoreWidget == 1) {
this.$nextTick(_ => {
this.$refs.storeCard.init();
this.$refs.storeCard && this.$refs.storeCard.init();
});
} else {
if (this.giftForm.sendChildData.storeType === 1) {
console.log('groupIdDisableList====>');
console.log(this.groupIdDisableList);
if (this.groupIdDisableList.length) {
// const arr = this.sendChildData.storeGroupIds;
// for (let i = 0; i < arr.length; i++) {
// if (this.groupIdDisableList.indexOf(arr[i]) !== -1) {
// arr.splice(i, 1);
// i--;
// }
// }
// this.sendChildData.storeGroupIds = arr.join(',');
}
}
}
// if (this.setting.sendChildData.storeType === 1) {
// const arr = this.sendChildData.storeGroupIds;
// // console.log(222, this.groupIdDisableList);
// for (let i = 0; i < arr.length; i++) {
// if (this.groupIdDisableList.indexOf(arr[i]) !== -1) {
// arr.splice(i, 1);
// i--;
// }
// }
// this.sendChildData.storeGroupIds = arr.join(',');
// }
}
},
immediate: true,
},
},
mounted () {
},
methods: {
getDisGroupList (arr) {
console.log('methods---groupIdDisableList====>');
console.log(arr);
this.groupIdDisableList = arr;
},
openRelating () {
this.$refs.relatePop.showPop();
},
onPopFinish (row) {
const { ruleTitle, integralMallProRuleId } = row;
this.giftForm.ruleTitle = ruleTitle;
this.giftForm.integralMallProRuleId = integralMallProRuleId;
this.$refs.relatePop.closePop();
this.giftForm = Object.assign({}, this.giftForm);
this.$refs.form.clearValidate('ruleTitle');
},
vaidataDataPicker () {
const endTime = this.giftForm.limitTimeBegin[1];
const startTime = this.giftForm.limitTimeBegin[0];
const currentTime = new Date().getTime();
return endTime > currentTime && endTime > startTime;
},
submit () {
return new Promise((resolve) => {
this.$refs.form.validate(val => {
if (val) {
const { releaseType, proShowStatus, isNewGuestVisible, ruleTitle, integralMallProRuleId, sendChildData: { storeType, storeGroupIds, storeIds }, useNewStoreWidget, uuid } = this.giftForm;
const params = {
proShowStatus: proShowStatus, // 显示状态
releaseType: releaseType, // 上架状态
limitTimeBegin: releaseType === 2 ? this.getTimeAll(this.giftForm.limitTimeBegin[0]) : '', // 定时上架开始时间
limitTimeEnd: releaseType === 2 ? this.getTimeAll(this.giftForm.limitTimeBegin[1]) : '', // 定时上架结束时间
isNewGuestVisible: proShowStatus == 1 ? isNewGuestVisible : 0, // 新客是否可见 0:新客不可见、1:新客可见'
showStore: storeType, // 显示门店 0所有 1部分分类 2部分门店
};
// 校验定时上架时间
if (this.giftForm.releaseType == 2 && !this.vaidataDataPicker()) return this.$message.error('定时上架结束时间必须大于当前时间和开始时间');
params.useNewStoreWidget = useNewStoreWidget;
if (useNewStoreWidget === 0) {
if (storeType === 1) {
if (storeGroupIds) {
params.storeGroupIds = storeGroupIds || '';
}
} else if (storeType === 2) {
if (storeIds.length) {
params.storeIds = storeIds.map(v => v.storeId).join(',');
} else {
params.storeIds = '';
}
}
} else if (useNewStoreWidget === 1) {
params.storeWidgetId = uuid;
}
if (this.isNew) {
params.ruleTitle = ruleTitle;
params.integralMallProRuleId = integralMallProRuleId;
params.newRuleFlag = 1;
} else {
params.newRuleFlag = 0;
}
console.log(params);
resolve(params);
} else {
resolve(false);
}
});
});
},
},
};
</script>
<style>
<style scoped>
.ruleTitle{
width: fit-content;
height: 32px;
background: #F7F8FA;
border-radius: 2px;
border: 1px solid #DCDFE6;
margin-right: 10px;
padding: 6px 12px;
font-size: 14px;
}
.el-form-item {
margin-left: 32px;
}
</style>
......@@ -5,13 +5,14 @@ import Router from 'vue-router';
import VueClipboard from 'vue-clipboard2';
import main from '../views/main';
import gift from '../views/goods/gift/gift';
import giftInfo from '../views/goods/gift/info';
// import giftInfo from '../views/goods/gift/info';
import giftDetail from '../views/goods/gift/detail';
import coupon from '../views/goods/coupon/coupon';
import soldStatistics from '../views/goods/soldStatistics/statistics';
import flashSale from '../views/activities/flashSale/list';
import flashSaleInfo from '../views/activities/flashSale/detail';
import couponInfo from '../views/goods/coupon/info';
// import couponInfo from '../views/goods/coupon/info';
import couponDetail from '../views/goods/coupon/detail';
import giftExchange from '../views/order/giftExchange';
import couponExchange from '../views/order/couponExchange';
import refundList from '../views/order/refundList';
......@@ -55,7 +56,7 @@ const router = new Router({
{
path: '/giftDetail',
name: 'giftDetail',
component: giftInfo,
component: giftDetail,
},
{
path: '/coupon',
......@@ -68,17 +69,17 @@ const router = new Router({
{
path: '/couponAdd',
name: 'couponAdd',
component: couponInfo,
component: couponDetail,
},
{
path: '/couponInfo',
name: 'couponInfo',
component: couponInfo,
component: couponDetail,
},
{
path: '/couponDetail',
name: 'couponDetail',
component: couponInfo,
component: couponDetail,
},
{
path: '/soldStatistics',
......
......@@ -345,8 +345,8 @@
</el-button>
<el-button
type="text"
v-if="!scope.row.ruleTitle && $getButtonLimit($buttonCode.couponRelating)"
@click="relating(scope.row) "
v-if="scope.row.newRuleFlag!=1 && $getButtonLimit($buttonCode.couponRelating)"
@click="relating(scope.row)"
:limit-code="$buttonCode.couponRelating"
>
关联
......@@ -493,7 +493,7 @@
v-if="stockDialog"
@getList="getList"
/>
<relate-pop ref="relatePop" :integralMallProId="integralMallProId" @finish="onPopFinish" />
<relate-pop ref="relatePop" @finish="onPopFinish" />
</div>
</template>
......@@ -579,6 +579,7 @@ export default {
};
},
created () {
console.log(this.$buttonCode);
if (localStorage.getItem('couponListObj')) {
this.couponListObj = JSON.parse(localStorage.getItem('couponListObj'));
this.currentPage = this.couponListObj.currentPage;
......@@ -613,7 +614,16 @@ export default {
this.integralMallProId = row.integralMallProId;
this.$refs.relatePop.showPop();
},
onPopFinish () {
onPopFinish (row) {
const data = {};
data.integralMallProIdList = [this.integralMallProId];
data.integralMallProRuleId = row.integralMallProRuleId;
request.post('/api-integral-mall/add-rule-pro', data).then(res => {
this.$message.success('添加成功');
this.$refs.relatePop.closePop();
}).finally(_ => {
this.$refs.relatePop.finishBtnLoading();
});
this.getList();
},
renderHeader (h, { column, $index }, index) {
......
......@@ -361,7 +361,7 @@
</el-button>
<el-button
type="text"
v-if="!scope.row.ruleTitle && $getButtonLimit($buttonCode.giftRelating)"
v-if="scope.row.newRuleFlag!=1&& $getButtonLimit($buttonCode.giftRelating)"
@click="relating(scope.row)"
:limit-code="$buttonCode.giftRelating"
>
......@@ -476,7 +476,7 @@
v-if="stockDialog"
@getList="getList"
/>
<relate-pop ref="relatePop" :integralMallProId="integralMallProId" @finish="onPopFinish" />
<relate-pop ref="relatePop" @finish="onPopFinish" />
</div>
</template>
......@@ -616,7 +616,16 @@ export default {
this.integralMallProId = row.integralMallProId;
this.$refs.relatePop.showPop();
},
onPopFinish () {
onPopFinish (row) {
const data = {};
data.integralMallProIdList = [this.integralMallProId];
data.integralMallProRuleId = row.integralMallProRuleId;
request.post('/api-integral-mall/add-rule-pro', data).then(res => {
this.$message.success('添加成功');
this.$refs.relatePop.closePop();
}).finally(_ => {
this.$refs.relatePop.finishBtnLoading();
});
this.getList();
},
renderHeader (h, { column, $index }, index) {
......
......@@ -1317,6 +1317,8 @@ export default {
},
getDisGroupList (arr) {
console.log('methods---groupIdDisableList====>');
console.log(arr);
this.groupIdDisableList = arr;
// console.log(this.mallProId);
// if (this.giftId !== '-1') {
......@@ -1563,6 +1565,8 @@ export default {
if (this.sendChildData.storeType === 1) {
const arr = res.data.result.storeGroupIds.split(',');
// console.log(222, this.groupIdDisableList);
console.log('groupIdDisableList====>');
console.log(this.groupIdDisableList);
for (let i = 0; i < arr.length; i++) {
if (this.groupIdDisableList.indexOf(arr[i]) !== -1) {
// 存在
......@@ -1762,7 +1766,7 @@ export default {
limitProCodeType () {
const reg = /^[0-9a-zA-Z\-]+?$/;
if (!reg.test(this.giftForm.proCode)) {
this.$message.error('请输入数字或者字母或-');
this.$message.error('请输入数字或者字母');
this.giftForm.proCode = '';
} else {
// 校验是否重复给出提示
......
......@@ -179,7 +179,7 @@
<el-button
type="primary"
size="small"
v-if="type=='查看'&&$getButtonLimit($buttonCode.ruleListDelGoods)"
v-show="type=='查看'&&$getButtonLimit($buttonCode.ruleListDelGoods)"
:disabled="!multipleSelection.length"
slot="reference"
:limit-code="$buttonCode.ruleListDelGoods"
......@@ -317,6 +317,7 @@ export default {
};
},
mounted () {
console.log(this.$buttonCode);
this.getList();
},
methods: {
......
......@@ -423,4 +423,8 @@ input[type="number"] {
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.tips-content {
position: absolute;
left: -10px;
}
\ No newline at end of file
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