info.vue
3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
<Form :label-width="100">
<Form-item label="店铺名称:">
<span>{{}}</span>
</Form-item>
<Form-item label="店铺类型:">
<span>{{}}</span>
</Form-item>
<Form-item label="店铺域名:">
<span>{{}}</span>
</Form-item>
<Form-item label="店铺LOGO:">
<div class="upload-item">
<div class="upload-item-img">
<drag-file-upload
:id="{goodIndex:1, imageIndex: 1}"
@on-success="uploadImageSuccess"
@on-remove="uploadImageRemove">
</drag-file-upload>
</div>
</div>
<em class="upload-img-tip">尺寸要求150px*150px 不大于500KB</em>
</Form-item>
<Form-item label="店铺简介:">
<editor :content="content" @change="updateData"></editor>
</Form-item>
<Form-item label="品牌-供应商:">
<Table :columns="columns1" :data="data1"></Table>
</Form-item>
<Form-item>
<Button type="primary" @click="submit">提交</Button>
</Form-item>
</Form>
</template>
<script>
import service from 'shop-service';
const _ = require('lodash');
const makeSubmitShop = () => {
return {
};
};
export default {
created() {
},
data() {
return {
//店铺简介
content: '',
//供应商
columns1: [
{
title: '品牌',
key: 'coupon'
},
{
title: '供应商',
key: 'supplier'
}
],
data1: [
{
coupon: 'hahahah',
supplier: 'hhhhhhhh'
}
]
};
},
methods: {
updateData(c) {
this.content = c;
},
//上传图片
uploadImageSuccess: function(attach, file) {
let colorIndex = attach.goodIndex;
let imageIndex = attach.imageIndex;
this.product.goods[colorIndex].goodsImage[imageIndex].imageUrl = file.url;
},
uploadImageRemove: function(attach) {
let colorIndex = attach.goodIndex;
let imageIndex = attach.imageIndex;
this.product.goods[colorIndex].goodsImage[imageIndex].imageUrl = '';
},
//提交
beforeSubmit: function() {
let newShop = makeSubmitShop();
// newShop.expectSaleTimeStr = this.product.expectSaleTimeStr;
//
// newShop.sellerGoodsInfoStr = JSON.stringify(this.handleColor());
return newShop;
},
submit: function() {
let newShop = this.beforeSubmit();
this.$Loading.start();
service.saveBaseShopInfo(newShop).then((result) => {
this.$Loading.finish();
if (result.code === 200) {
this.$Notice.success({
title: '修改成功',
desc: '该店铺保存成功!'
});
this.$router.push({name: 'shop'});
} else {
this.$Notice.error({
title: '保存错误',
desc: result.message
});
}
});
}
}
};
</script>
<style lang="scss" scoped>
.upload-item {
float: left;
}
.upload-img-tip {
float: left;
margin-top: 112px;
padding-left: 20px;
color: #c90;
line-height: 1;
font-size: 12px;
font-style: normal;
font-weight: 500;
}
.upload-item-img {
display: inline-block;
height: 126px;
width: 124px;
border: 2px solid #e8e8e8;
box-sizing: border-box;
}
</style>