|
|
@@ -65,6 +65,55 @@
|
|
|
<el-form-item prop="category" label="分类">
|
|
|
<el-input v-model="formData.category"></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item prop="properties" label="特性" style="width: calc(100vw - 450px)" size="mini">
|
|
|
+ <el-table :data="formData.properties">
|
|
|
+ <el-table-column prop="name" label="名称">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-input v-model="row.name" placeholder="20字以内" maxlength="20"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="value" label="内容">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-input v-model="row.value" placeholder="20字以内" maxlength="20"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="80" align="center">
|
|
|
+ <template v-slot="{ row, $index }">
|
|
|
+ <el-button type="danger" plain size="mini" @click="delProperty($index)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button size="mini" @click="addProperty"> 添加特性</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="特权" prop="privileges" style="width: calc(100vw - 450px)">
|
|
|
+ <el-table :data="privilegeOptions">
|
|
|
+ <el-table-column prop="name" label="可选特权" width="150"></el-table-column>
|
|
|
+ <el-table-column prop="description"></el-table-column>
|
|
|
+ <el-table-column width="155" align="right">
|
|
|
+ <template v-slot="{ row, $index }">
|
|
|
+ <el-button size="mini" v-if="!row.added" @click="addPrivilege(row, $index)">
|
|
|
+ 添加
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" v-if="!!row.added" plain @click="editPrivilege(row, $index)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ v-if="!!row.added"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ @click="delPrivilege(row, $index)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="price" label="起拍价">
|
|
|
<el-input-number type="number" v-model="formData.price"></el-input-number>
|
|
|
</el-form-item>
|
|
|
@@ -79,8 +128,8 @@
|
|
|
<el-form-item prop="minutes" label="间隔时间(分钟)">
|
|
|
<el-input-number type="number" v-model="formData.minutes"></el-input-number>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="price" label="起拍价">
|
|
|
- <el-input-number type="number" v-model="formData.price"></el-input-number>
|
|
|
+ <el-form-item prop="recommendPrice" label="起拍价">
|
|
|
+ <el-input-number type="number" v-model="formData.recommendPrice"></el-input-number>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="form-submit">
|
|
|
<el-button @click="onSave" :loading="saving" type="primary">
|
|
|
@@ -102,24 +151,52 @@ import resolveUrl from "resolve-url";
|
|
|
export default {
|
|
|
name: 'TradeAuctionEdit',
|
|
|
created() {
|
|
|
- if (this.$route.query.id) {
|
|
|
+ Promise.all([
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ return this.$http
|
|
|
+ .get('tradeAuction/get/' + this.$route.query.id)
|
|
|
+ .then(res => {
|
|
|
+ res.properties = res.properties || [];
|
|
|
+ res.privileges = res.privileges || [];
|
|
|
+ this.formData = res;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$message.error(e.error);
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resolve();
|
|
|
+ }
|
|
|
+ ),
|
|
|
this.$http
|
|
|
- .get('tradeAuction/get/' + this.$route.query.id)
|
|
|
+ .post('/privilegeOption/all', {size: 10000, query: {del: false}}, {body: 'json'})
|
|
|
.then(res => {
|
|
|
- this.formData = res;
|
|
|
+ this.privilegeOptions = res.content;
|
|
|
+ return Promise.resolve();
|
|
|
})
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- this.$message.error(e.error);
|
|
|
- });
|
|
|
- }
|
|
|
+ ]).then(() => {
|
|
|
+ console.log(this.formData, this.privilegeOptions);
|
|
|
+ this.formData.privileges.forEach(p => {
|
|
|
+ let idx = this.privilegeOptions.findIndex(i => i.name === p.name);
|
|
|
+ if (idx > -1) {
|
|
|
+ this.$set(this.privilegeOptions[idx], 'added', true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
saving: false,
|
|
|
customUrl: resolveUrl(this.$baseUrl, 'upload/3dModel'),
|
|
|
+ privilegeOptions: [],
|
|
|
+ showPrivilegeEditDialog: false,
|
|
|
+ privilegeForm: {},
|
|
|
formData: {
|
|
|
pic: [],
|
|
|
+ properties: []
|
|
|
},
|
|
|
rules: {},
|
|
|
cateogories: ['勋章', '收藏品', '数字艺术', '门票', '游戏', '音乐', '使用', '其他'],
|
|
|
@@ -131,13 +208,15 @@ export default {
|
|
|
"value": "FIXED_PRICE_PURCHASED"
|
|
|
}, {"label": "流拍", "value": "PASS"}, {"label": "完成", "value": "FINISH"}],
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
methods: {
|
|
|
onMinterDetail(e) {
|
|
|
console.log(e);
|
|
|
this.$set(this.formData, 'minter', e.nickname);
|
|
|
this.$set(this.formData, 'minterAvatar', e.avatar);
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
onSave() {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
@@ -146,7 +225,8 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
submit() {
|
|
|
let data = {...this.formData};
|
|
|
|
|
|
@@ -163,7 +243,8 @@ export default {
|
|
|
this.saving = false;
|
|
|
this.$message.error(e.error);
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
onDelete() {
|
|
|
this.$confirm('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
|
|
|
return this.$http.post(`/tradeAuction/del/${this.formData.id}`)
|
|
|
@@ -176,7 +257,66 @@ export default {
|
|
|
this.$message.error((e || {}).error || '删除失败');
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ addProperty() {
|
|
|
+ this.formData.properties.push({
|
|
|
+ name: '',
|
|
|
+ value: ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ delProperty(i) {
|
|
|
+ this.formData.properties.splice(i, 1);
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ addPrivilege(row, i) {
|
|
|
+ this.privilegeForm = {...row};
|
|
|
+ this.showPrivilegeEditDialog = true;
|
|
|
+ if (this.$refs.privilegeForm) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.privilegeForm.clearValidate();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ editPrivilege(row, i) {
|
|
|
+ this.privilegeForm = {...(this.formData.privileges.find(e => e.name === row.name) || {})};
|
|
|
+ this.showPrivilegeEditDialog = true;
|
|
|
+ if (this.$refs.privilegeForm) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.privilegeForm.clearValidate();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ delPrivilege(row, i) {
|
|
|
+ let idx = this.formData.privileges.findIndex(e => e.name === row.name);
|
|
|
+ if (idx > -1) {
|
|
|
+ this.formData.privileges.splice(idx, 1);
|
|
|
+ }
|
|
|
+ this.$set(this.privilegeOptions[i], 'added', false);
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ savePrivilege() {
|
|
|
+ this.$refs.privilegeForm
|
|
|
+ .validate()
|
|
|
+ .then(() => {
|
|
|
+ let i = this.formData.privileges.findIndex(e => e.name === this.privilegeForm.name);
|
|
|
+ if (i > -1) {
|
|
|
+ this.$set(this.formData.privileges, i, {...this.privilegeForm});
|
|
|
+ } else {
|
|
|
+ this.formData.privileges.push({...this.privilegeForm});
|
|
|
+ }
|
|
|
+ let ii = this.privilegeOptions.findIndex(i => i.name === this.privilegeForm.name);
|
|
|
+ console.log(ii);
|
|
|
+ this.$set(this.privilegeOptions[ii], 'added', true);
|
|
|
+ this.showPrivilegeEditDialog = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|