3f535f30
杨鑫
'初始'
|
1
2
3
4
5
|
<template>
<div style="padding: 0 10px;background-color:#f7f7f7;">
<div class="tab_show">
<el-form ref="ruleForm" :model="storeDetails" :rules="rules" label-width="100px">
<div class="h5">
|
1991126c
杨鑫
'最新'
|
6
7
|
<!-- <div class="title">店铺信息</div> -->
<TitleWithCircle title="店铺信息" style="margin-bottom: 15px;flex: 1;"/>
|
3f535f30
杨鑫
'初始'
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<!-- <el-button
v-if="!disabled1"
type="text"
@click="editDisabled1(0)"
>取消</el-button> -->
<!-- <el-button v-else type="text" @click="editDisabled1(1)">编辑</el-button> -->
<div class="tableBtn greens" style="font-size:14px;" v-if="!disabled1" @click="editDisabled1(0)" >
取消
</div>
<div class="tableBtn greens" style="font-size:14px;" v-if="disabled1" @click="editDisabled1(1)" >
编辑
</div>
<div class="tableBtn greens" style="font-size:14px;" v-if="!disabled1" @click="updateStore('ruleForm')" >
保存
</div>
</div>
<div class="shop-details">
<el-form-item label="店铺logo">
|
1991126c
杨鑫
'最新'
|
27
28
29
30
31
|
<img :src="$baseURL+storeDetails.shopLogo" class="shopLogon" v-if="disabled1" style="width: 100px;height: 100px;"/>
<upimg filePath="bueniss" :value="storeDetails.shopLogo" inputtype="coverImage" :limit="1"
@changimg="e=>changimg(e,'shopLogo')" v-else></upimg>
<!-- <el-upload
|
3f535f30
杨鑫
'初始'
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
:class="[{ 'avatar-uploader': !storeDetails.shopLogo }]"
:headers="headers"
:data="dataObj"
:action="action"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:disabled="disabled1"
>
<img
v-if="storeDetails.shopLogo"
:src="storeDetails.shopLogo"
class="avatar"
width="80"
height="80"
>
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
1991126c
杨鑫
'最新'
|
48
|
</el-upload> -->
|
3f535f30
杨鑫
'初始'
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
</el-form-item>
<el-form-item label="店铺名称">
<el-input v-model="storeDetails.shopName" :disabled="disabled1" />
</el-form-item>
<el-form-item label="发货地址">
<el-input
v-model="storeDetails.shopAdress"
:disabled="disabled1"
:resize="`${disabled1 ? 'none' : ''}`"
type="textarea"
/>
</el-form-item>
<el-form-item label="店铺简介">
<el-input
v-model="storeDetails.shopBrief"
:disabled="disabled1"
:resize="`${disabled1 ? 'none' : ''}`"
type="textarea"
/>
</el-form-item>
|
bbf88c5c
杨鑫
活动
|
69
|
<!-- <el-form-item label="注册手机号" prop="shopPhone">
|
3f535f30
杨鑫
'初始'
|
70
71
72
73
74
75
76
77
78
79
80
81
|
<el-input
v-if="shopPhoneShow"
:value="hidden(storeDetails.shopPhone,3,4)"
:disabled="disabled1"
@focus="focusShopPhoneInput"
/>
<el-input
v-else
ref="userPhoneCls"
v-model="storeDetails.shopPhone"
:disabled="disabled1"
/>
|
bbf88c5c
杨鑫
活动
|
82
|
</el-form-item> -->
|
3f535f30
杨鑫
'初始'
|
83
84
|
</div>
<div class="h5">
|
1991126c
杨鑫
'最新'
|
85
86
|
<!-- <div class="title">店铺认证</div> -->
<TitleWithCircle title="店铺认证" style="margin-bottom: 15px;"/>
|
3f535f30
杨鑫
'初始'
|
87
88
89
90
91
92
|
</div>
<div class="shop-details" style="overflow: hidden; line-height: 40px">
微信支付-商户认证
<!-- <el-button type="primary" style="float:right" @click="approve">立即认证</el-button> -->
</div>
<div class="h5">
|
1991126c
杨鑫
'最新'
|
93
94
|
<!-- <div class="title">退货地址</div> -->
<TitleWithCircle title="退货地址" style="margin-bottom: 15px;"/>
|
3f535f30
杨鑫
'初始'
|
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
|
</div>
<div class="shop-details">
<el-form-item label="地址">
<el-input
v-model="storeDetails.shopReturn.returnAdress"
:disabled="disabled1"
/>
</el-form-item>
<el-form-item label="联系人">
<el-input
v-model="storeDetails.shopReturn.returnPerson"
:disabled="disabled1"
/>
</el-form-item>
<el-form-item label="联系电话">
<el-input
v-if="returnPhoneShow"
:value="hidden(storeDetails.shopReturn.returnPhone,3,4)"
:disabled="disabled1"
@focus="focusReturnPhoneInput"
/>
<el-input
v-else
ref="returnPhoneCls"
v-model="storeDetails.shopReturn.returnPhone"
:disabled="disabled1"
/>
</el-form-item>
</div>
</el-form>
</div>
</div>
</template>
<script>
import { shopSysGetById, shopSysUpdate } from '@/api/shopSys';
import { uploadUrl } from '@/utils/request';
import { getToken } from '@/utils/auth';
|
1991126c
杨鑫
'最新'
|
133
134
|
import upimg from "@/components/ImageUpload/index"
import TitleWithCircle from '@/components/top/index';
|
3f535f30
杨鑫
'初始'
|
135
136
|
const PhoneRule = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
export default {
|
1991126c
杨鑫
'最新'
|
137
138
139
140
|
components: {
upimg,
TitleWithCircle
},
|
3f535f30
杨鑫
'初始'
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
data() {
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
logo: '',
},
headers: {
'Authorization-business': getToken(),
},
shopPhone: '',
userPhone: '',
showUserPhone: false,
action: uploadUrl,
dataObj: {
folderId: 1,
},
disabled1: true,
storeDetails: {
shopReturn: {},
},
privacyTime: 0,
shopPhoneShow: true,
returnPhoneShow: true,
oldShopPhone: '',
oldReturnPhone: '',
rules: {
|
bbf88c5c
杨鑫
活动
|
174
175
176
177
178
179
180
|
// shopPhone: [
// { required: true, message: '请输入注册手机号', trigger: 'blur' },
// {
// pattern: /^1[3456789]\d{9}$/,
// message: '目前只支持中国大陆的手机号码'
// }
// ],
|
3f535f30
杨鑫
'初始'
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
returnPhone: [
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{
pattern: /^1[3456789]\d{9}$/,
message: '目前只支持中国大陆的手机号码'
}
],
}
};
},
created() {
this.getStoreDetails();
this.privacyTime = localStorage.getItem('privacyTime');
},
methods: {
|
1991126c
杨鑫
'最新'
|
196
197
198
|
changimg(e, type) {
this.storeDetails[type] = e
},
|
3f535f30
杨鑫
'初始'
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
focusReturnPhoneInput() {
// 处理后端没有返回shopReturn字段
if (!this.storeDetails.shopReturn) {
this.$set(this.storeDetails, 'shopReturn', {
returnPhone: null
})
}
this.oldReturnPhone = this.storeDetails.shopReturn.returnPhone
this.returnPhoneShow = false
},
focusShopPhoneInput() {
this.oldShopPhone = this.storeDetails.shopPhone
this.shopPhoneShow = false
this.storeDetails.shopPhone = ''
},
async getStoreDetails() {
const res = await shopSysGetById({});
if (res.code === '') {
this.storeDetails = res.data;
}
},
onSubmit() {
console.log('submit!');
},
// 编辑取消
editDisabled1(value) {
this.disabled1 = !this.disabled1;
this.showUserPhone = false;
if (value === 0) {
this.shopPhoneShow = true
this.returnPhoneShow = true
this.storeDetails.shopPhone = this.oldShopPhone ? this.oldShopPhone : this.storeDetails.shopPhone
this.storeDetails.shopReturn.returnPhone = this.oldReturnPhone ? this.oldReturnPhone : this.storeDetails.shopReturn.returnPhone
}
},
async updateStore(ruleForm) {
this.$refs[ruleForm].validate(valid => {
console.log(this.storeDetails, 'this.storeDetails999')
if (!PhoneRule.test(this.storeDetails.shopReturn.returnPhone)) {
return this.$message.warning('请输入正确联系电话');
}
if (valid) {
shopSysUpdate(this.storeDetails).then(res => {
if (res.code === '') {
this.getStoreDetails()
this.disabled1 = true;
this.returnPhoneShow = true
this.shopPhoneShow = true
this.$message({
message: '修改成功',
type: 'success',
});
}
})
}
})
},
handleAvatarSuccess(response) {
const { url } = response.data;
this.storeDetails.shopLogo = url;
},
approve() {
this.$router.push({ path: '/setting/shop/wechat-approve' });
},
// 编辑号码
inputShopPhone() {
// this.showShopPhone = true;
this.shopPhone = '';
this.$nextTick(() => {
this.$refs.phoneCls.focus();
});
},
inputUserPhone() {
this.showUserPhone = true;
this.userPhone = '';
this.$nextTick(() => {
this.$refs.userPhoneCls.focus();
});
},
// 中间部分
hidden(str, frontLen, endLen) {
if (!str) {
return // 如果值为空,直接return
}
let endLenData = 0;
if (str && str.length !== 2) {
endLenData = endLen;
}
const len = str.length - frontLen - endLenData;
let xing = '';
for (let i = 0; i < len; i++) {
xing += '*';
}
return (
str.substring(0, frontLen) +
xing +
str.substring(str.length - endLenData)
);
},
},
};
</script>
<style lang="scss" scoped>
@import url("../../../styles/elDialog.scss");
.tab_show {
margin-top:-20px;
padding: 0 20px 20px 20px;
background-color:#fff;
.h5 {
max-width: 1000px;
display: flex;
font-size: 20px;
margin: 20px auto;
padding-left: 10px;
padding-right: 300px;
flex-wrap: 800;
.title {
flex: 1;
}
}
.shop-details {
max-width: 800px;
margin: auto;
.el-input,
.el-textarea {
width: 380px;
}
// 不能编辑样式
.el-input.is-disabled .el-input__inner,
.el-textarea.is-disabled .el-textarea__inner {
cursor: inherit;
background-color: #f8f8f8;
border: 1px solid #f8f8f8;
color: #606266;
}
}
.avatar-uploader {
width: 80px;
height: 80px;
border-radius: 6px;
line-height: 80px;
text-align: center;
.el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px;
height: 80px;
line-height: 80px;
text-align: center;
}
}
}
}
</style>
|