|
@@ -176,9 +176,25 @@
|
|
|
</el-select> -->
|
|
|
<!-- <el-input v-model="form.orderId" placeholder="请输入分值id" /> -->
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="分值图片" prop="number">
|
|
|
+ <!-- <el-form-item label="分值图片" prop="number">
|
|
|
<img v-for="item in urlPath" :src="item" width="40">
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="类目图片" prop="urlPath">
|
|
|
+ <el-upload
|
|
|
+ :action="uploadPath"
|
|
|
+ :headers="headers"
|
|
|
+ :limit="1"
|
|
|
+ :file-list="imgsFileList"
|
|
|
+ :on-exceed="uploadOverrun"
|
|
|
+ :on-success="handleimgsUrl"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ multiple
|
|
|
+ accept=".jpg, .jpeg, .png, .gif"
|
|
|
+ list-type="picture-card"
|
|
|
+ >
|
|
|
+ <i class="el-icon-plus" />
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="编号" prop="number">
|
|
|
<el-input v-model="form.number" placeholder="请输入编号" />
|
|
|
</el-form-item>
|
|
@@ -243,11 +259,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { uploadPath } from '@/api/storage'
|
|
|
+import { getToken } from '@/utils/auth'
|
|
|
import { listTransaction, getTransaction, delTransaction, addTransaction, updateTransaction, exportTransaction, typeList } from "@/api/gubi/transaction";
|
|
|
import { listThree, getThree, delThree, addThree, updateThree, exportThree } from "@/api/gubi/three";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ imgsFileList: [],
|
|
|
+ uploadPath,
|
|
|
data: [],
|
|
|
newList: [],
|
|
|
defaultProps: {
|
|
@@ -294,7 +314,6 @@ export default {
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
orderName: "",
|
|
|
- urlPath: [],
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
deleteFlag: [
|
|
@@ -303,10 +322,49 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ headers() {
|
|
|
+ return {
|
|
|
+ accessToken: getToken()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ uploadOverrun: function() {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '上传文件个数超出限制!最多上传2张图片!'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleimgsUrl(response, file, fileList) {
|
|
|
+ if (response.errno === 200) {
|
|
|
+ this.form.urlPath.push(response.url)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleRemove: function(file, fileList) {
|
|
|
+ for (var i = 0; i < this.form.urlPath.length; i++) {
|
|
|
+ // 这里存在两种情况
|
|
|
+ // 1. 如果所删除图片是刚刚上传的图片,那么图片地址是file.response.url
|
|
|
+ // 此时的file.url虽然存在,但是是本机地址,而不是远程地址。
|
|
|
+ // 2. 如果所删除图片是后台返回的已有图片,那么图片地址是file.url
|
|
|
+ var url
|
|
|
+ if (file.response === undefined) {
|
|
|
+ url = file.url
|
|
|
+ } else {
|
|
|
+ url = file.response.url
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.urlPath[i] === url) {
|
|
|
+ this.form.urlPath.splice(i, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.form.urlPath.length > 0) {
|
|
|
+ this.form.pictureUrl = this.form.urlPath[0]
|
|
|
+ }
|
|
|
+ },
|
|
|
handleNodeClick(data) {
|
|
|
console.log(data);
|
|
|
this.form.orderId = data.id
|
|
@@ -322,7 +380,7 @@ export default {
|
|
|
/** 查询交易记录列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- listTransaction(this.queryParams).then(response => {
|
|
|
+ listTransaction(this.queryParams).then(response => {debugger
|
|
|
this.transactionList = response.data.data.items
|
|
|
for (let i = 0; i < this.transactionList.length; i++) {
|
|
|
if (this.transactionList[i].urlPath) {
|
|
@@ -385,8 +443,8 @@ export default {
|
|
|
grade: undefined,
|
|
|
collection: undefined,
|
|
|
price: undefined,
|
|
|
- status: "0",
|
|
|
- urlPath: undefined,
|
|
|
+ status: "",
|
|
|
+ urlPath: [],
|
|
|
deleteFlag: undefined,
|
|
|
gmtCreate: undefined,
|
|
|
gmtUpdate: undefined,
|
|
@@ -424,6 +482,11 @@ export default {
|
|
|
const id = row.id || this.ids.join(',')
|
|
|
getTransaction(id).then(response => {
|
|
|
this.form = response.data.data
|
|
|
+ if (this.form.urlPath) {
|
|
|
+ this.form.urlPath = this.form.urlPath.split(',')
|
|
|
+ } else {
|
|
|
+ this.form.urlPath = []
|
|
|
+ }
|
|
|
this.form.collection = new Date(response.data.data.collection)
|
|
|
this.open = true;
|
|
|
this.title = "修改交易记录";
|
|
@@ -433,7 +496,8 @@ export default {
|
|
|
submitForm: function () {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.form.urlPath = this.urlPath.toString()
|
|
|
+ console.log()
|
|
|
+ this.form.urlPath = this.form.urlPath.toString()
|
|
|
if (this.form.id != undefined) {
|
|
|
updateTransaction(this.form).then(response => {
|
|
|
if (response.data) {
|