【类 型】:feat
【原 因】:在商铺设置页面 设置下单备注的预设 和 退款备注的预设 【过 程】: 【影 响】:
This commit is contained in:
parent
c2ba68ec63
commit
e3dd48a34f
@ -110,6 +110,8 @@ const store = new Vuex.Store({
|
||||
const res = await api.get('getShopList', 'Admin')
|
||||
if (res.data.status === 1) {
|
||||
res.data.shopList.forEach((shop, index) => {
|
||||
shop.remark_presup = JSON.parse(shop.remark_presup)// 反序列化 remark_presup字段
|
||||
shop.refund_remark_presup = JSON.parse(shop.refund_remark_presup)// 反序列化 refund_remark_presup字段
|
||||
shop.logo = JSON.parse(shop.logo)// 反序列化 photo字段
|
||||
shop.logo.forEach((logo, i) => {
|
||||
res.data.shopList[index].logo[i] = settings.state.logoPath + logo // 把绝对路径加上
|
||||
@ -137,6 +139,8 @@ const store = new Vuex.Store({
|
||||
params.append('weight_max', form.weight_max)
|
||||
params.append('default_transport_price', form.default_transport_price)
|
||||
params.append('default_pack_price', form.default_pack_price)
|
||||
params.append('remark_presup', JSON.stringify(form.remark_presup))
|
||||
params.append('refund_remark_presup', JSON.stringify(form.refund_remark_presup))
|
||||
params.append('desc', form.desc)
|
||||
params.append('upFile', form.upFile)
|
||||
params.append('opening_time', form.opening_time)
|
||||
@ -167,6 +171,8 @@ const store = new Vuex.Store({
|
||||
params.append('weight_max', form.weight_max)
|
||||
params.append('default_transport_price', form.default_transport_price)
|
||||
params.append('default_pack_price', form.default_pack_price)
|
||||
params.append('remark_presup', JSON.stringify(form.remark_presup))
|
||||
params.append('refund_remark_presup', JSON.stringify(form.refund_remark_presup))
|
||||
params.append('desc', form.desc)
|
||||
params.append('upFile', form.upFile)
|
||||
params.append('oldFile', form.oldFile)
|
||||
|
@ -11,7 +11,8 @@
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="border p-20 m-b-20">
|
||||
<el-form ref="form" :model="form" label-width="120px" :label-position="$store.state.app.isWideScreen?'top':'right'">
|
||||
<el-form ref="form" :model="form" label-width="120px"
|
||||
:label-position="$store.state.app.isWideScreen ? 'top' : 'right'">
|
||||
<!-- 用户select选项 -->
|
||||
<el-form-item v-if="pageState === 'edit'" label="商铺选择">
|
||||
<SelectionShopId v-model="form.shop_id" />
|
||||
@ -51,6 +52,32 @@
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<!-- 下单备注预设 -->
|
||||
<el-form-item label="下单备注预设">
|
||||
<el-tag :key="index" v-for="(tag, index) in form.remark_presup" closable :disable-transitions="false"
|
||||
@close="handleCloseTag(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<span class="" v-if="inputTagVisible">
|
||||
<el-input class="input-new-tag" v-model="inputTagValue" ref="saveTagInput">
|
||||
</el-input>
|
||||
<el-button type="primary" @click="handleInputConfirm" icon="el-icon-plus">添加</el-button>
|
||||
</span>
|
||||
<el-button v-else @click="showTagInput" icon="el-icon-plus">点击添加</el-button>
|
||||
</el-form-item>
|
||||
<!-- 退款订单备注预设 -->
|
||||
<el-form-item label="退款备注预设">
|
||||
<el-tag :key="index" v-for="(tag, index) in form.refund_remark_presup" closable :disable-transitions="false"
|
||||
@close="handleCloseTagRefund(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<span class="" v-if="inputTagVisibleRefund">
|
||||
<el-input class="input-new-tag" v-model="inputTagValueRefund" ref="saveTagInputRefund">
|
||||
</el-input>
|
||||
<el-button type="primary" @click="handleInputConfirmRefund" icon="el-icon-plus">添加</el-button>
|
||||
</span>
|
||||
<el-button v-else @click="showTagInputRefund" icon="el-icon-plus">点击添加</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="营业时间">
|
||||
<el-time-picker is-range v-model="form.intervalTime" range-separator="至" start-placeholder="开始时间"
|
||||
end-placeholder="结束时间" placeholder="选择时间范围">
|
||||
@ -60,10 +87,8 @@
|
||||
<el-upload class="avatar-uploader" drag name="file" :action="action" :headers="myheader"
|
||||
:show-file-list="false" :on-success="handleUpSuccess" :on-error="handleUpErr"
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="form.upFile != ''"
|
||||
:src="$store.state.settings.tempPath + form.upFile" class="avatar" />
|
||||
<img v-else-if="form.oldFile != [] && form.upFile == ''"
|
||||
:src="form.oldFile[0]" class="avatar" />
|
||||
<img v-if="form.upFile != ''" :src="$store.state.settings.tempPath + form.upFile" class="avatar" />
|
||||
<img v-else-if="form.oldFile != [] && form.upFile == ''" :src="form.oldFile[0]" class="avatar" />
|
||||
<template v-else>
|
||||
<i class="el-icon-plus f-s-30 m-t-70 seatFontColor"></i>
|
||||
<div class="el-upload__text"><em>建议200*200像素 <br> jpg png gif svg</em></div>
|
||||
@ -110,11 +135,17 @@ export default {
|
||||
weight_max: '',
|
||||
default_transport_price: '',
|
||||
default_pack_price: '',
|
||||
remark_presup: [],
|
||||
refund_remark_presup: [],
|
||||
desc: '',
|
||||
upFile: '',
|
||||
oldFile: '',
|
||||
intervalTime: [new Date(0, 0, 0, 8, 0), new Date(0, 0, 0, 20, 0)]
|
||||
},
|
||||
inputTagVisible: false, // 备注预设 添加按钮 输入框反向显示
|
||||
inputTagValue: '', // 备注预设 输入框值
|
||||
inputTagVisibleRefund: false, // 备注预设 添加按钮 输入框反向显示
|
||||
inputTagValueRefund: '', // 备注预设 输入框值
|
||||
pageState: 'add', // 页面状态
|
||||
shop: null
|
||||
}
|
||||
@ -134,6 +165,41 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 备注预设 相关函数
|
||||
handleCloseTag (tag) { // 删除标签
|
||||
this.form.remark_presup.splice(this.form.remark_presup.indexOf(tag), 1)
|
||||
},
|
||||
showTagInput () { // 显示输入框
|
||||
this.inputTagVisible = true
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInput.$refs.input.focus()
|
||||
})
|
||||
},
|
||||
handleInputConfirm () { // 添加新的标签
|
||||
const inputValue = this.inputTagValue
|
||||
if (inputValue) {
|
||||
this.form.remark_presup.push(inputValue)
|
||||
}
|
||||
this.inputTagVisible = false// 隐藏输入框 显示添加按钮
|
||||
this.inputTagValue = ''
|
||||
},
|
||||
handleCloseTagRefund (tag) { // 删除标签
|
||||
this.form.refund_remark_presup.splice(this.form.refund_remark_presup.indexOf(tag), 1)
|
||||
},
|
||||
showTagInputRefund () { // 显示输入框
|
||||
this.inputTagVisibleRefund = true
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInputRefund.$refs.input.focus()
|
||||
})
|
||||
},
|
||||
handleInputConfirmRefund () { // 添加新的标签
|
||||
const inputTagValueRefund = this.inputTagValueRefund
|
||||
if (inputTagValueRefund) {
|
||||
this.form.refund_remark_presup.push(inputTagValueRefund)
|
||||
}
|
||||
this.inputTagVisibleRefund = false// 隐藏输入框 显示添加按钮
|
||||
this.inputTagValueRefund = ''
|
||||
},
|
||||
/* 文件上传表单 */
|
||||
handleUpSuccess (res) {
|
||||
console.log(res)
|
||||
@ -181,6 +247,8 @@ export default {
|
||||
this.form.weight_max = data.weight_max
|
||||
this.form.default_transport_price = data.default_transport_price
|
||||
this.form.default_pack_price = data.default_pack_price
|
||||
this.form.remark_presup = data.remark_presup || []
|
||||
this.form.refund_remark_presup = data.refund_remark_presup || []
|
||||
this.form.oldFile = data.oldFile
|
||||
this.form.upFile = data.upFile
|
||||
this.form.desc = data.desc
|
||||
@ -207,6 +275,8 @@ export default {
|
||||
weight_max: this.shop.weight_max,
|
||||
default_transport_price: this.shop.default_transport_price,
|
||||
default_pack_price: this.shop.default_pack_price,
|
||||
remark_presup: this.shop.remark_presup,
|
||||
refund_remark_presup: this.shop.refund_remark_presup,
|
||||
oldFile: this.shop.logo,
|
||||
upFile: '',
|
||||
intervalTime: [this.parseTimeString(this.shop.opening_time), this.parseTimeString(this.shop.closeing_time)]
|
||||
@ -233,6 +303,7 @@ export default {
|
||||
this.form.opening_time = this.formatDateToString(this.form.intervalTime[0])
|
||||
this.form.closeing_time = this.formatDateToString(this.form.intervalTime[1])
|
||||
const res = await this.$store.dispatch('fetchSaveShop', this.form)
|
||||
console.log(this.form)
|
||||
if (res.data.status === 1) {
|
||||
this.$router.push({ path: '/shop/edit', query: { refresh: Date.now() } })
|
||||
}
|
||||
@ -254,6 +325,16 @@ export default {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input-new-tag {
|
||||
margin-right: 10px;
|
||||
width: 20%;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
|
Loading…
Reference in New Issue
Block a user