|
|
@@ -10,7 +10,7 @@
|
|
|
<template>
|
|
|
<div class="addorder">
|
|
|
<van-cell-group :border="false" class="form">
|
|
|
- <van-field
|
|
|
+ <!-- <van-field
|
|
|
label="卡牌名称"
|
|
|
:value="name"
|
|
|
placeholder="请输入卡牌名称"
|
|
|
@@ -18,7 +18,16 @@
|
|
|
readonly
|
|
|
@click="pickerShow('show')"
|
|
|
>
|
|
|
+ </van-field> -->
|
|
|
+ <van-field
|
|
|
+ label="卡牌名称"
|
|
|
+ type="digit"
|
|
|
+ :value="form.name"
|
|
|
+ @input="form.name = $event.detail"
|
|
|
+ placeholder="请输入卡牌名称"
|
|
|
+ >
|
|
|
</van-field>
|
|
|
+ <van-uploader style="padding-left:20px" :file-list="images" :after-read="afterRead" @delete="deleteImg" />
|
|
|
<van-field
|
|
|
label="卡牌售价"
|
|
|
type="digit"
|
|
|
@@ -183,17 +192,18 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
form: {
|
|
|
- collectionId: '',
|
|
|
- seriesId: '',
|
|
|
+ // collectionId: '',
|
|
|
+ // seriesId: '',
|
|
|
code: 1,
|
|
|
id: '',
|
|
|
+ name: '',
|
|
|
postage: '',
|
|
|
// boxesCount: null,
|
|
|
boxPrice: '',
|
|
|
startTime: '',
|
|
|
description: '',
|
|
|
packagesCount: null,
|
|
|
- caseStatus: 'PROGRESS',
|
|
|
+ caseStatus: 'UNDO',
|
|
|
cardCaseId: '',
|
|
|
special: false,
|
|
|
limitOne: false,
|
|
|
@@ -207,11 +217,11 @@ export default {
|
|
|
newShow: false,
|
|
|
showId: false,
|
|
|
id: 0,
|
|
|
- // images: [],
|
|
|
- // cardList: [],
|
|
|
- // imagesList: [],
|
|
|
- // imageUrls: [],
|
|
|
- // nowChooseId: [],
|
|
|
+ images: [],
|
|
|
+ cardList: [],
|
|
|
+ imagesList: [],
|
|
|
+ imageUrls: [],
|
|
|
+ nowChooseId: [],
|
|
|
sotrId: [],
|
|
|
list: [],
|
|
|
actions: [],
|
|
|
@@ -357,6 +367,7 @@ export default {
|
|
|
}
|
|
|
this.form = {
|
|
|
id: res.id,
|
|
|
+ name: res.name,
|
|
|
boxPrice: res.boxPrice,
|
|
|
groupDTOS: res.groupDTOS,
|
|
|
startTime: res.startTime,
|
|
|
@@ -366,16 +377,16 @@ export default {
|
|
|
collectionId: res.collectionId,
|
|
|
caseStatus: res.caseStatus,
|
|
|
packagesCount: res.packagesCount,
|
|
|
- postage: res.postage || 0
|
|
|
- // images: res.images,
|
|
|
+ postage: res.postage || 0,
|
|
|
+ images: res.images
|
|
|
// boxesCount: res.boxesCount || null
|
|
|
};
|
|
|
- // this.images = res.images.split(',').map(item => {
|
|
|
- // return {
|
|
|
- // url: item
|
|
|
- // };
|
|
|
- // });
|
|
|
- // this.imageUrls = res.images.split(',');
|
|
|
+ this.images = res.images.split(',').map(item => {
|
|
|
+ return {
|
|
|
+ url: item
|
|
|
+ };
|
|
|
+ });
|
|
|
+ this.imageUrls = res.images.split(',');
|
|
|
});
|
|
|
},
|
|
|
select(e) {
|
|
|
@@ -444,42 +455,42 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- // afterRead(file) {
|
|
|
- // this.showLoading();
|
|
|
- // this.$http
|
|
|
- // .uploadFile(file.path)
|
|
|
- // .then(res => {
|
|
|
- // if (this.images.length > 2) {
|
|
|
- // this.toast('最多上传三张图片');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.hideLoading();
|
|
|
- // this.imagesList.push({ ...file, url: res });
|
|
|
- // this.images = [...this.imagesList];
|
|
|
- // this.imageUrls.push(res);
|
|
|
- // // console.log(this.images);
|
|
|
- // })
|
|
|
- // .catch(e => {
|
|
|
- // this.hideLoading();
|
|
|
- // wx.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: e.error
|
|
|
- // });
|
|
|
- // });
|
|
|
- // },
|
|
|
- // deleteImg(e) {
|
|
|
- // let list = [...this.images];
|
|
|
- // list.splice(e.detail.index, 1);
|
|
|
- // this.images = list;
|
|
|
- // this.imageUrls = list.map(item => {
|
|
|
- // return item.url;
|
|
|
- // });
|
|
|
- // },
|
|
|
+ afterRead(file) {
|
|
|
+ this.showLoading();
|
|
|
+ this.$http
|
|
|
+ .uploadFile(file.path)
|
|
|
+ .then(res => {
|
|
|
+ if (this.images.length > 0) {
|
|
|
+ this.toast('最多上传一张图片');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.hideLoading();
|
|
|
+ this.imagesList.push({ ...file, url: res });
|
|
|
+ this.images = [...this.imagesList];
|
|
|
+ this.imageUrls.push(res);
|
|
|
+ // console.log(this.images);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.hideLoading();
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: e.error
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deleteImg(e) {
|
|
|
+ let list = [...this.images];
|
|
|
+ list.splice(e.detail.index, 1);
|
|
|
+ this.images = list;
|
|
|
+ this.imageUrls = list.map(item => {
|
|
|
+ return item.url;
|
|
|
+ });
|
|
|
+ },
|
|
|
submit() {
|
|
|
- if (!this.name) {
|
|
|
+ if (!this.form.name) {
|
|
|
wx.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '请选择卡牌名称'
|
|
|
+ title: '请填写卡牌名称'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
@@ -504,16 +515,17 @@ export default {
|
|
|
// });
|
|
|
// return;
|
|
|
// }
|
|
|
- // if (this.imageUrls.length == 0) {
|
|
|
- // wx.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: '请添加图片'
|
|
|
- // });
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ if (this.imageUrls.length == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请添加图片'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
let cardCaseInputDTO = { ...this.form };
|
|
|
- // let images = this.imageUrls.join(',');
|
|
|
- // cardCaseInputDTO.images = images;
|
|
|
+ let images = this.imageUrls.join(',');
|
|
|
+ // let images = this.imageUrls;
|
|
|
+ cardCaseInputDTO.images = images;
|
|
|
console.log(cardCaseInputDTO);
|
|
|
this.showLoading();
|
|
|
this.$http
|
|
|
@@ -537,8 +549,8 @@ export default {
|
|
|
caseStatus: res.caseStatus,
|
|
|
limitOne: res.limitOne,
|
|
|
packagesCount: res.packagesCount,
|
|
|
- postage: res.postage || 0
|
|
|
- // images: res.images,
|
|
|
+ postage: res.postage || 0,
|
|
|
+ images: res.images
|
|
|
// boxesCount: res.boxesCount || null
|
|
|
};
|
|
|
wx.showToast({
|