|
@@ -50,6 +50,30 @@
|
|
<template #status>
|
|
<template #status>
|
|
<el-option v-for="i in goodsStatusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
<el-option v-for="i in goodsStatusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
</template>
|
|
</template>
|
|
|
|
+ <template #is_cashBack>
|
|
|
|
+ <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ <template #cb_config>
|
|
|
|
+ <el-form :model="cb_config" ref="cb_config" label-width="180px" @save="toSave">
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="返现金额类型" prop="back_type">
|
|
|
|
+ <el-select v-model="cb_config.back_type" clearable filterable placeholder="请选择返现金额类型" size="small" style="width: 100%">
|
|
|
|
+ <el-option v-for="i in typeList" :key="i.label" :label="i.label" :value="i.label"> </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" v-if="cb_config.back_type == '固定金额'">
|
|
|
|
+ <el-form-item label="具体返现金额设置" prop="money">
|
|
|
|
+ <el-input v-model="cb_config.money" placeholder="请输入金额" type="number" size="small"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" v-if="cb_config.back_type == '百分比'">
|
|
|
|
+ <el-form-item label="具体返现金额设置" prop="money">
|
|
|
|
+ <el-input v-model="cb_config.money" placeholder="请输入百分比" type="number" size="small"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-form>
|
|
|
|
+ </template>
|
|
<template #brief>
|
|
<template #brief>
|
|
<editor v-model="form.brief" url="/files/point/goods/upload" />
|
|
<editor v-model="form.brief" url="/files/point/goods/upload" />
|
|
</template>
|
|
</template>
|
|
@@ -114,11 +138,15 @@ export default {
|
|
{ label: '商品来源', model: 'source' },
|
|
{ label: '商品来源', model: 'source' },
|
|
{ label: '网址', model: 'url' },
|
|
{ label: '网址', model: 'url' },
|
|
{ label: '排序', model: 'sort', type: 'number' },
|
|
{ label: '排序', model: 'sort', type: 'number' },
|
|
|
|
+ { label: '是否返现', model: 'is_cashBack', type: 'select' },
|
|
|
|
+ { label: '返现设置', model: 'cb_config', custom: true },
|
|
{ label: '商品图片', model: 'file', type: 'upload', url: '/files/point/goods/upload' },
|
|
{ label: '商品图片', model: 'file', type: 'upload', url: '/files/point/goods/upload' },
|
|
{ label: '商品介绍', model: 'brief', custom: true },
|
|
{ label: '商品介绍', model: 'brief', custom: true },
|
|
],
|
|
],
|
|
rules: {},
|
|
rules: {},
|
|
form: {},
|
|
form: {},
|
|
|
|
+ // 返现设置
|
|
|
|
+ cb_config: {},
|
|
// 商品分类
|
|
// 商品分类
|
|
tagsList: [],
|
|
tagsList: [],
|
|
props: { multiple: true, label: 'label', value: 'code' },
|
|
props: { multiple: true, label: 'label', value: 'code' },
|
|
@@ -126,6 +154,10 @@ export default {
|
|
// 活动标签
|
|
// 活动标签
|
|
act_tagsList: [],
|
|
act_tagsList: [],
|
|
goodsStatusList: [],
|
|
goodsStatusList: [],
|
|
|
|
+ // 是否返现
|
|
|
|
+ statusList: [],
|
|
|
|
+ // 返现金额类型
|
|
|
|
+ typeList: [{ label: '固定金额' }, { label: '百分比' }],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -148,6 +180,17 @@ export default {
|
|
this.$set(this, `total`, res.total);
|
|
this.$set(this, `total`, res.total);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 去编辑
|
|
|
|
+ async toEdit({ data }) {
|
|
|
|
+ const res = await this.fetch(data._id);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
|
+ this.cb_config = res.data.cb_config;
|
|
|
|
+ this.view = 'info';
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('未找到指定数据');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 添加自定义
|
|
// 添加自定义
|
|
initAddData() {
|
|
initAddData() {
|
|
const obj = {
|
|
const obj = {
|
|
@@ -177,6 +220,53 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ // 保存
|
|
|
|
+ async toSave({ data }) {
|
|
|
|
+ let res;
|
|
|
|
+ if (data == '' || data == undefined) {
|
|
|
|
+ let form = this.form;
|
|
|
|
+ form.cb_config = this.cb_config;
|
|
|
|
+ form.cb_config.money = Number(form.cb_config.money);
|
|
|
|
+ if (form.id) res = await this.update(form);
|
|
|
|
+ else res = await this.create(form);
|
|
|
|
+ } else {
|
|
|
|
+ data.cb_config = this.cb_config;
|
|
|
|
+ data.cb_config.money = Number(data.cb_config.money);
|
|
|
|
+ if (data.id) res = await this.update(data);
|
|
|
|
+ else res = await this.create(data);
|
|
|
|
+ }
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `维护信息成功` });
|
|
|
|
+ this.toBack();
|
|
|
|
+ this.search();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 执行返回
|
|
|
|
+ toBack() {
|
|
|
|
+ this.form = {};
|
|
|
|
+ this.view = 'list';
|
|
|
|
+ },
|
|
|
|
+ // 上架
|
|
|
|
+ async toPuton({ data }) {
|
|
|
|
+ this.$confirm('是否确认上架/下架该商品?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ }).then(async () => {
|
|
|
|
+ if (data.status == '1') data.status = '0';
|
|
|
|
+ else data.status = '1';
|
|
|
|
+ let res;
|
|
|
|
+ if (data._id) res = await this.update(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `修改成功` });
|
|
|
|
+ }
|
|
|
|
+ this.search();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 库存管理
|
|
|
|
+ toSpec({ data }) {
|
|
|
|
+ this.$router.push({ path: `/selfShop/spec/${data._id}` });
|
|
|
|
+ },
|
|
// 查询其他信息
|
|
// 查询其他信息
|
|
async searchOthers() {
|
|
async searchOthers() {
|
|
// 商品分类
|
|
// 商品分类
|
|
@@ -188,6 +278,9 @@ export default {
|
|
// 活动标签
|
|
// 活动标签
|
|
res = await this.actQuery();
|
|
res = await this.actQuery();
|
|
if (this.$checkRes(res)) this.$set(this, `act_tagsList`, res.data);
|
|
if (this.$checkRes(res)) this.$set(this, `act_tagsList`, res.data);
|
|
|
|
+ // 商品状态
|
|
|
|
+ res = await this.getDict({ code: 'use' });
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
|
|
},
|
|
},
|
|
// 商品状态
|
|
// 商品状态
|
|
getStatus(data) {
|
|
getStatus(data) {
|
|
@@ -221,49 +314,6 @@ export default {
|
|
}
|
|
}
|
|
return arr.join(';');
|
|
return arr.join(';');
|
|
},
|
|
},
|
|
- // 保存
|
|
|
|
- async toSave({ data }) {
|
|
|
|
- let res;
|
|
|
|
- if (data == '' || data == undefined) {
|
|
|
|
- let form = this.form;
|
|
|
|
- if (form.id) res = await this.update(form);
|
|
|
|
- else res = await this.create(form);
|
|
|
|
- } else {
|
|
|
|
- if (data.id) res = await this.update(data);
|
|
|
|
- else res = await this.create(data);
|
|
|
|
- }
|
|
|
|
- if (this.$checkRes(res)) {
|
|
|
|
- this.$message({ type: `success`, message: `维护信息成功` });
|
|
|
|
- this.toBack();
|
|
|
|
- this.search();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- // 执行返回
|
|
|
|
- toBack() {
|
|
|
|
- this.form = {};
|
|
|
|
- this.view = 'list';
|
|
|
|
- },
|
|
|
|
- // 上架
|
|
|
|
- async toPuton({ data }) {
|
|
|
|
- this.$confirm('是否确认上架/下架该商品?', '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning',
|
|
|
|
- }).then(async () => {
|
|
|
|
- if (data.status == '1') data.status = '0';
|
|
|
|
- else data.status = '1';
|
|
|
|
- let res;
|
|
|
|
- if (data._id) res = await this.update(data);
|
|
|
|
- if (this.$checkRes(res)) {
|
|
|
|
- this.$message({ type: `success`, message: `修改成功` });
|
|
|
|
- }
|
|
|
|
- this.search();
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 库存管理
|
|
|
|
- toSpec({ data }) {
|
|
|
|
- this.$router.push({ path: `/selfShop/spec/${data._id}` });
|
|
|
|
- },
|
|
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|