礼包配置中心 - 奖品列表删除奖品刷新列表
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button style="" type="primary" @click="addDialog = true;resetaddFormData()"
|
||||
<el-button
|
||||
style=""
|
||||
type="primary"
|
||||
@click="
|
||||
addDialog = true;
|
||||
resetaddFormData();
|
||||
"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-table
|
||||
@@ -77,20 +83,26 @@
|
||||
奖品列表
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="getAwardsFun(scope.row.partitionId);addFormData.packId = scope.row.packId"
|
||||
@click="
|
||||
getAwardsFun(scope.row.partitionId);
|
||||
addFormData.packId = scope.row.packId;
|
||||
"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
style="margin-left: 0;margin-top: 10px;"
|
||||
style="margin-left: 0; margin-top: 10px"
|
||||
>
|
||||
添加奖品
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="addFormData.packId = scope.row.packId;sendPackCenterDialog = true"
|
||||
@click="
|
||||
addFormData.packId = scope.row.packId;
|
||||
sendPackCenterDialog = true;
|
||||
"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
style="margin-top: 10px;"
|
||||
style="margin-top: 10px"
|
||||
>
|
||||
赠送礼包
|
||||
</el-button>
|
||||
@@ -235,10 +247,10 @@
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="awardTypeName" align="center" label="类型" >
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.awardTypeName + '-' + scope.row.awardName }}
|
||||
</template>
|
||||
<el-table-column prop="awardTypeName" align="center" label="类型">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.awardTypeName + "-" + scope.row.awardName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="awardId" align="center" label="ID" />
|
||||
<el-table-column prop="awardNum" align="center" label="天数/数量" />
|
||||
@@ -269,26 +281,22 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="addRewardDialog"
|
||||
title="添加奖品"
|
||||
width="28%"
|
||||
center
|
||||
>
|
||||
<el-dialog v-model="addRewardDialog" title="添加奖品" width="28%" center>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>添加奖品</span
|
||||
>
|
||||
<el-select v-model="addFormData.awardId"
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in awardsList"
|
||||
:key="item.awardId"
|
||||
:label="item.awardTypeName + '-' + item.awardName"
|
||||
:value="item.awardId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="addFormData.awardId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in awardsList"
|
||||
:key="item.awardId"
|
||||
:label="item.awardTypeName + '-' + item.awardName"
|
||||
:value="item.awardId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
@@ -303,7 +311,7 @@
|
||||
width="28%"
|
||||
center
|
||||
>
|
||||
<div style="margin-bottom: 25px">
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
@@ -337,14 +345,16 @@
|
||||
v-model="addFormData.remark"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
:rows="5"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="sendPackCenterDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="sendPackCenterFun()"> 确认 </el-button>
|
||||
<el-button type="primary" @click="sendPackCenterFun()">
|
||||
确认
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -361,7 +371,7 @@ import {
|
||||
deleteReward,
|
||||
addReward,
|
||||
getAwardsList,
|
||||
sendPackCenter
|
||||
sendPackCenter,
|
||||
} from "@/api/giftPackCenter/giftPackCenter";
|
||||
import PartitionSelect from "@/views/common/partitionSelect.vue";
|
||||
export default {
|
||||
@@ -384,10 +394,10 @@ export default {
|
||||
packNameEn: "",
|
||||
packNameAr: "",
|
||||
packNameTr: "",
|
||||
awardId:'',
|
||||
erbanNo:'',
|
||||
packNum:'',
|
||||
remark:'',
|
||||
awardId: "",
|
||||
erbanNo: "",
|
||||
packNum: "",
|
||||
remark: "",
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
@@ -404,6 +414,7 @@ export default {
|
||||
const addDialog = ref(false);
|
||||
const detailsDialog = ref(false);
|
||||
const sendPackCenterDialog = ref(false);
|
||||
const getRewardPackId = ref('');
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getConfigList(formData).then((res) => {
|
||||
@@ -452,18 +463,21 @@ export default {
|
||||
};
|
||||
// 重置
|
||||
const resetaddFormData = () => {
|
||||
Object.assign(addFormData, {
|
||||
expireDay: "",
|
||||
imgUrl: "",
|
||||
packId: "",
|
||||
status: "",
|
||||
partitionId: undefined,
|
||||
packNameZh: "",
|
||||
packNameEn: "",
|
||||
packNameAr: "",
|
||||
packNameTr: "",
|
||||
awardId:''
|
||||
});
|
||||
Object.assign(addFormData, {
|
||||
expireDay: "",
|
||||
imgUrl: "",
|
||||
packId: "",
|
||||
status: "",
|
||||
partitionId: undefined,
|
||||
packNameZh: "",
|
||||
packNameEn: "",
|
||||
packNameAr: "",
|
||||
packNameTr: "",
|
||||
awardId: "",
|
||||
erbanNo: "",
|
||||
packNum: "",
|
||||
remark: "",
|
||||
});
|
||||
};
|
||||
// 编辑
|
||||
const detailPageFun = (row) => {
|
||||
@@ -478,6 +492,7 @@ export default {
|
||||
};
|
||||
// 奖品列表
|
||||
const getRewardList = (packId) => {
|
||||
getRewardPackId.value = packId;
|
||||
tableDetailData.loading = true;
|
||||
getItemList({ packId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@@ -496,53 +511,53 @@ export default {
|
||||
deleteReward({ itemId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("删除成功");
|
||||
detailsDialog.value = false;
|
||||
getRewardList(getRewardPackId.value);
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
const getAwardsFun = (partitionId) => {
|
||||
getAwardsList({ partitionId}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
awardsList.value = res.data;
|
||||
addRewardDialog.value = true;
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
const getAwardsFun = (partitionId) => {
|
||||
getAwardsList({ partitionId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
awardsList.value = res.data;
|
||||
addRewardDialog.value = true;
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 添加奖品
|
||||
const addRewardFun = () => {
|
||||
const {awardId,packId} = addFormData
|
||||
addReward({awardId,packId}).then((res=>{
|
||||
if(res.code == 200){
|
||||
ElMessage.success('添加成功');
|
||||
addRewardDialog.value = false;
|
||||
addFormData.awardId = '';
|
||||
addFormData.packId = '';
|
||||
}else{
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
}))
|
||||
const addRewardFun = () => {
|
||||
const { awardId, packId } = addFormData;
|
||||
addReward({ awardId, packId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("添加成功");
|
||||
addRewardDialog.value = false;
|
||||
addFormData.awardId = "";
|
||||
addFormData.packId = "";
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 赠送礼包
|
||||
const sendPackCenterFun = () => {
|
||||
let obj = {
|
||||
erbanNo:addFormData.erbanNo,
|
||||
packId :addFormData.packId,
|
||||
packNum:addFormData.packNum,
|
||||
remark:addFormData.remark,
|
||||
const sendPackCenterFun = () => {
|
||||
let obj = {
|
||||
erbanNo: addFormData.erbanNo,
|
||||
packId: addFormData.packId,
|
||||
packNum: addFormData.packNum,
|
||||
remark: addFormData.remark,
|
||||
};
|
||||
sendPackCenter(obj).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("赠送成功");
|
||||
sendPackCenterDialog.value = false;
|
||||
resetaddFormData();
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
sendPackCenter(obj).then((res=>{
|
||||
if(res.code == 200){
|
||||
ElMessage.success('赠送成功');
|
||||
sendPackCenterDialog.value = false;
|
||||
resetaddFormData();
|
||||
}else{
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
}))
|
||||
});
|
||||
};
|
||||
const // 解析json字段
|
||||
getJsonField = (jsonStr, field) => {
|
||||
@@ -609,7 +624,8 @@ export default {
|
||||
awardsList,
|
||||
resetaddFormData,
|
||||
sendPackCenterDialog,
|
||||
sendPackCenterFun
|
||||
sendPackCenterFun,
|
||||
getRewardPackId
|
||||
};
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user