Commit 0ce2c6dd by xinla

pc订单问题修复

1 parent 8f660f17
<template> <template>
<div>
<!-- -->
<el-dialog <el-dialog
title="新建字段" :modelValue="modelValue"
v-model="dialogVisible" @update:modelValue="(val) => $emit('update:modelValue', val)"
width="30%" :title="(editId ? '编辑' : '新建') + '字段'"
v-if="dialogVisible" width="30%">
:before-close="handleClose"
>
<el-form <el-form
v-loading="loading"
:model="ruleForm" :model="ruleForm"
:rules="rules" :rules="rules"
ref="ruleForm" ref="ruleForm"
label-width="120px" label-width="120px"
class="demo-ruleForm" class="demo-ruleForm">
>
<el-form-item label="字段名称:" prop="name"> <el-form-item label="字段名称:" prop="name">
<el-input <el-input
v-model="ruleForm.name" v-model="ruleForm.name"
placeholder="请输入字段名称" placeholder="请输入字段名称"
maxlength="10" maxlength="10"
show-word-limit show-word-limit
:disabled="ruleForm.fixed || id" :disabled="ruleForm.fixed || editId"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="字段类型:" prop="type"> <el-form-item label="字段类型:" prop="type">
<el-select v-model="ruleForm.type" :disabled="ruleForm.fixed || id"> <el-select v-model="ruleForm.type" :disabled="ruleForm.fixed || editId">
<el-option <el-option :label="item.value" :value="item.key" v-for="(item, index) in typeList" :key="index"></el-option>
:label="item.value"
:value="item.key"
v-for="(item, index) in typeList"
:key="index"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否是金额:" prop="money" v-if="ruleForm.type == 6"> <el-form-item label="是否是金额:" prop="money" v-if="ruleForm.type == 6">
...@@ -48,11 +38,7 @@ ...@@ -48,11 +38,7 @@
</el-radio-group> </el-radio-group>
<div class="tips">金额需精确到小数点后两位</div> <div class="tips">金额需精确到小数点后两位</div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="是否多选:" prop="multipleChoice" v-if="[2, 4, 5].includes(ruleForm.type)">
label="是否多选:"
prop="multipleChoice"
v-if="[2, 4, 5].includes(ruleForm.type)"
>
<el-radio-group v-model="ruleForm.multipleChoice"> <el-radio-group v-model="ruleForm.multipleChoice">
<el-radio :label="1">是</el-radio> <el-radio :label="1">是</el-radio>
<el-radio :label="0">否</el-radio> <el-radio :label="0">否</el-radio>
...@@ -65,41 +51,35 @@ ...@@ -65,41 +51,35 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="是否必填:" prop="required"> <el-form-item label="是否必填:" prop="required">
<el-radio-group v-model="ruleForm.required" :disabled="id"> <el-radio-group v-model="ruleForm.required" :disabled="editId">
<el-radio :label="1">是</el-radio> <el-radio :label="1">是</el-radio>
<el-radio :label="0">否</el-radio> <el-radio :label="0">否</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="字段说明:" prop="expound" v-if="[0, 1, 3, 6].includes(ruleForm.type)"> <el-form-item label="字段说明:" prop="expound" v-if="[0, 1, 3, 6].includes(ruleForm.type)">
<el-input <el-input v-model="ruleForm.expound" placeholder="请输入字段说明" maxlength="20" show-word-limit></el-input>
v-model="ruleForm.expound"
placeholder="请输入字段说明"
maxlength="20"
show-word-limit
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="字段值:" prop="value" v-if="ruleForm.type == 2"> <el-form-item label="字段值:" prop="value" v-if="ruleForm.type == 2">
<el-input <el-input
v-model="ruleForm.value" v-model="ruleForm.value"
placeholder="请输入选项,多个选项用英文逗号隔开" placeholder="请输入选项,多个选项用英文逗号隔开"
type="textarea" type="textarea"
:rows="4" :rows="4"></el-input>
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer fr"> <span slot="footer" class="dialog-footer fr">
<el-button @click="cancel">取 消</el-button> <el-button @click="$emit('update:modelValue', false)">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button> <el-button type="primary" @click="submit">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div>
</template> </template>
<script> <script>
import { add, update, getDetail, getTypeList } from '@/api/salesCenter/orderInfo' import { add, update, getDetail, getTypeList } from '@/api/salesCenter/orderInfo'
import { nextTick } from 'vue'
export default { export default {
props: { props: {
visible: { modelValue: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
...@@ -113,10 +93,21 @@ export default { ...@@ -113,10 +93,21 @@ export default {
}, },
}, },
watch: { watch: {
visible: { // modelValue: {
handler(data) { // handler(data) {
this.dialogVisible = data // if (!data) {
if (!data) { // this.$refs['ruleForm'].resetFields()
// }
// },
// },
editId: {
handler(val) {
nextTick(() => {
this.$refs['ruleForm'].resetFields()
})
if (val) {
this.getDetail(val)
} else {
this.ruleForm = { this.ruleForm = {
type: 0, type: 0,
money: 1, money: 1,
...@@ -125,29 +116,14 @@ export default { ...@@ -125,29 +116,14 @@ export default {
more: 0, more: 0,
toTime: 0, toTime: 0,
} }
this.$refs['ruleForm'].resetFields()
this.id = 0
} }
}, },
}, },
editId: {
handler(val) {
this.id = val
this.getDetail(val)
},
},
}, },
data() { data() {
return { return {
dialogVisible: false, loading: false,
ruleForm: { ruleForm: {},
type: 0,
money: 1,
required: 1,
multipleChoice: 0,
more: 0,
toTime: 0,
},
rules: { rules: {
name: [{ required: true, message: '请输入字段名称', trigger: 'blur' }], name: [{ required: true, message: '请输入字段名称', trigger: 'blur' }],
type: [{ required: true, message: '请选择字段类型', trigger: 'change' }], type: [{ required: true, message: '请选择字段类型', trigger: 'change' }],
...@@ -160,42 +136,45 @@ export default { ...@@ -160,42 +136,45 @@ export default {
value: [{ required: true, message: '请输入字段值', trigger: 'blur' }], value: [{ required: true, message: '请输入字段值', trigger: 'blur' }],
}, },
typeList: [], typeList: [],
id: undefined,
} }
}, },
mounted() {
this.getTypeList()
},
methods: { methods: {
getDetail(id) { getDetail(id) {
getDetail(id).then((res) => { if (!id) return
this.loading = true
getDetail(id)
.then((res) => {
this.ruleForm = res.data this.ruleForm = res.data
}) })
}, .finally(() => {
// 点击×按钮 this.loading = false
handleClose() { })
this.$emit('close', false)
},
cancel() {
this.dialogVisible = false
this.$emit('close', false)
}, },
submit() { submit() {
this.$refs['ruleForm'].validate((valid) => { this.$refs['ruleForm'].validate((valid) => {
if (valid) { if (valid) {
this.ruleForm.catalogueId = this.catalogueId this.ruleForm.catalogueId = this.catalogueId
if (this.id) { if (this.editId) {
this.ruleForm.id = this.id this.ruleForm.id = this.editId
delete this.ruleForm.typeStr delete this.ruleForm.typeStr
} }
;(this.id ? update : add)(this.ruleForm).then((res) => { this.loading = true
if (res.code === 200) { ;(this.editId ? update : add)(this.ruleForm)
.then((res) => {
this.msgSuccess(res.msg) this.msgSuccess(res.msg)
this.dialogVisible = false this.dialogVisible = false
this.$emit('close', true) this.$emit('success')
} this.$emit('update:modelValue', false)
})
.finally(() => {
this.loading = false
}) })
} }
}) })
// this.dialogVisible = false
// this.$emit('close', false)
}, },
getTypeList() { getTypeList() {
getTypeList().then((res) => { getTypeList().then((res) => {
...@@ -212,9 +191,6 @@ export default { ...@@ -212,9 +191,6 @@ export default {
}) })
}, },
}, },
mounted() {
this.getTypeList()
},
} }
</script> </script>
......
...@@ -15,27 +15,18 @@ ...@@ -15,27 +15,18 @@
:class="{ active: groupIndex == key }" :class="{ active: groupIndex == key }"
v-for="(group, key) in groupList" v-for="(group, key) in groupList"
:key="group.id" :key="group.id"
@click="switchGroup(key, group)" @click="switchGroup(key, group)">
>
<div class="name">{{ group.name }}</div> <div class="name">{{ group.name }}</div>
<el-dropdown <el-dropdown v-if="groupIndex == key" class="dropdown" @command="onGroupCommand($event, group)">
v-if="groupIndex == key"
class="dropdown"
@command="onGroupCommand($event, group)"
>
<span class="dot"> <span class="dot">
<el-icon-MoreFilled class="el-icon-MoreFilled"></el-icon-MoreFilled> <el-icon-MoreFilled class="el-icon-MoreFilled"></el-icon-MoreFilled>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="moveUp" v-if="key !== 0">上移</el-dropdown-item> <el-dropdown-item command="moveUp" v-if="key !== 0">上移</el-dropdown-item>
<el-dropdown-item command="moveDown" v-if="key !== groupList.length - 1" <el-dropdown-item command="moveDown" v-if="key !== groupList.length - 1">下移</el-dropdown-item>
>下移</el-dropdown-item
>
<el-dropdown-item command="edit">修改分组</el-dropdown-item> <el-dropdown-item command="edit">修改分组</el-dropdown-item>
<el-dropdown-item command="remove" v-if="group.fixed !== 1" <el-dropdown-item command="remove" v-if="group.fixed !== 1">删除分组</el-dropdown-item>
>删除分组</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
...@@ -45,7 +36,7 @@ ...@@ -45,7 +36,7 @@
<div class="right"> <div class="right">
<div class="g-card"> <div class="g-card">
<div class="mid-action"> <div class="mid-action">
<el-button type="primary" @click="add(0)">新建字段</el-button> <el-button type="primary" @click="add()">新建字段</el-button>
<div> <div>
<el-button type="primary" plain @click="removeFn('mult')">批量删除</el-button> <el-button type="primary" plain @click="removeFn('mult')">批量删除</el-button>
</div> </div>
...@@ -55,35 +46,16 @@ ...@@ -55,35 +46,16 @@
v-loading="loading" v-loading="loading"
:data="list" :data="list"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:default-sort="{ prop: 'sort', order: 'descending' }" :default-sort="{ prop: 'sort', order: 'descending' }">
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column <el-table-column label="字段名称" align="center" min-width="100" prop="name" show-overflow-tooltip />
label="字段名称" <el-table-column label="字段类型" align="center" min-width="100" prop="type" show-overflow-tooltip>
align="center"
min-width="100"
prop="name"
show-overflow-tooltip
/>
<el-table-column
label="字段类型"
align="center"
min-width="100"
prop="type"
show-overflow-tooltip
>
<template #default="{ row }"> <template #default="{ row }">
{{ row.typeStr }} {{ row.typeStr }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="字段说明/字段值" align="center" min-width="100" prop="type" show-overflow-tooltip>
label="字段说明/字段值"
align="center"
min-width="100"
prop="type"
show-overflow-tooltip
>
<template #default="{ row }"> <template #default="{ row }">
{{ row.expound ? row.expound : row.value ? row.value : '-' }} {{ row.expound ? row.expound : row.value ? row.value : '-' }}
</template> </template>
...@@ -100,19 +72,12 @@ ...@@ -100,19 +72,12 @@
align="center" align="center"
fixed="right" fixed="right"
width="180" width="180"
class-name="small-padding fixed-width" class-name="small-padding fixed-width">
>
<template #default="{ row }"> <template #default="{ row }">
<el-button text @click="getListMove(row.catalogueId, row.id, 0)" v-if="!row.isFirst" <el-button text @click="getListMove(row.catalogueId, row.id, 0)" v-if="!row.isFirst">上移</el-button>
>上移</el-button <el-button text @click="getListMove(row.catalogueId, row.id, 1)" v-if="!row.isLast">下移</el-button>
>
<el-button text @click="getListMove(row.catalogueId, row.id, 1)" v-if="!row.isLast"
>下移</el-button
>
<el-button text @click="add(row.id)">编辑</el-button> <el-button text @click="add(row.id)">编辑</el-button>
<el-button text @click="removeFn('single', row.id)" v-if="row.fixed !== 1" <el-button text @click="removeFn('single', row.id)" v-if="row.fixed !== 1">删除</el-button>
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -120,21 +85,14 @@ ...@@ -120,21 +85,14 @@
:total="total" :total="total"
v-model:page="query.pageNum" v-model:page="query.pageNum"
v-model:limit="query.pageSize" v-model:limit="query.pageSize"
@pagination="getList()" @pagination="getList()" />
/>
</div> </div>
</div> </div>
</div> </div>
<el-dialog :title="`${groupForm.id ? '修改' : '新建'}分组`" v-model="groupVisible" width="30%"> <el-dialog :title="`${groupForm.id ? '修改' : '新建'}分组`" v-model="groupVisible" width="30%">
<el-form :model="groupForm" :rules="rules" ref="groupForm"> <el-form :model="groupForm" :rules="rules" ref="groupForm">
<el-form-item label="分组名称" prop="name" label-width="80px"> <el-form-item label="分组名称" prop="name" label-width="80px">
<el-input <el-input v-model="groupForm.name" clearable autocomplete="off" maxlength="15" show-word-limit></el-input>
v-model="groupForm.name"
clearable
autocomplete="off"
maxlength="15"
show-word-limit
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
...@@ -144,12 +102,7 @@ ...@@ -144,12 +102,7 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<Add <Add v-model="visible" :catalogueId="query.catalogueId" :editId="editId" @success="getList()" />
:visible="visible"
:catalogueId="query.catalogueId"
:editId="editId"
@close="handleClose"
/>
</div> </div>
</template> </template>
...@@ -229,32 +182,19 @@ export default { ...@@ -229,32 +182,19 @@ export default {
this.$store.setBusininessDesc( this.$store.setBusininessDesc(
` `
<div>可自定义修改客户画像中的订单信息项供企业个性化使用</div> <div>可自定义修改客户画像中的订单信息项供企业个性化使用</div>
` `,
) )
}, },
mounted() {}, mounted() {},
methods: { methods: {
getListMove(catalogueId, id, direction) { getListMove(catalogueId, id, direction) {
let obj = { id, direction, catalogueId } listMove({ id, direction, catalogueId }).then((res) => {
listMove(obj).then((res) => {
if (res.code === 200) {
this.getList() this.getList()
}
}) })
}, },
handleClose(val) {
if (val) {
// 新建字段提交
this.getList()
}
this.visible = false
},
add(id) { add(id) {
this.visible = true this.visible = true
if (id) {
// 编辑
this.editId = id this.editId = id
}
}, },
move(direction, id) { move(direction, id) {
let obj = { direction, id } let obj = { direction, id }
...@@ -299,22 +239,10 @@ export default { ...@@ -299,22 +239,10 @@ export default {
this.loading = false this.loading = false
this.ids = [] this.ids = []
}) })
.catch(() => { .finally(() => {
this.loading = false this.loading = false
}) })
}, },
/** 重置按钮操作 */
resetQuery() {
// this.query.qrName = ''
this.userArray = []
// this.query.qrUserIds = ''
this.qrUserName = ''
// this.query.userArrayStr = ''
// this.search()
},
goRoute(path, id) {
this.$router.push({ path: path, query: { id, catalogueId: this.query.catalogueId } })
},
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) this.ids = selection.map((item) => item.id)
...@@ -344,35 +272,6 @@ export default { ...@@ -344,35 +272,6 @@ export default {
}) })
.catch(function () {}) .catch(function () {})
}, },
// download(qrCode, qrName) {
// let name = qrName + '.png'
// this.downloadByBlob(qrCode, name)
// },
// downloadByBlob(url, name) {
// let image = new Image()
// image.setAttribute('crossOrigin', 'anonymous')
// image.src = url
// image.onload = () => {
// let canvas = document.createElement('canvas')
// canvas.width = image.width
// canvas.height = image.height
// let ctx = canvas.getContext('2d')
// ctx.drawImage(image, 0, 0, image.width, image.height)
// canvas.toBlob((blob) => {
// let url = URL.createObjectURL(blob)
// this.downloadFn(url, name)
// // 用完释放URL对象
// URL.revokeObjectURL(url)
// })
// }
// },
// downloadFn(href, name) {
// let eleLink = document.createElement('a')
// eleLink.download = name
// eleLink.href = href
// eleLink.click()
// eleLink.remove()
// },
// 新增分组 // 新增分组
onAddOrUpdateGroup() { onAddOrUpdateGroup() {
this.$refs.groupForm.validate((validate) => { this.$refs.groupForm.validate((validate) => {
...@@ -385,16 +284,14 @@ export default { ...@@ -385,16 +284,14 @@ export default {
this.groupForm = obj this.groupForm = obj
} }
if (validate) { if (validate) {
;(this.groupForm.id ? updateCodeCategory : addCodeCategory)(this.groupForm).then( ;(this.groupForm.id ? updateCodeCategory : addCodeCategory)(this.groupForm).then((res) => {
(res) => {
this.groupVisible = false this.groupVisible = false
this.groupForm = { this.groupForm = {
name: '', name: '',
} }
this.$refs.groupForm.clearValidate() this.$refs.groupForm.clearValidate()
this.getCodeCategoryListFn() this.getCodeCategoryListFn()
} })
)
} }
}) })
}, },
...@@ -421,15 +318,11 @@ export default { ...@@ -421,15 +318,11 @@ export default {
}, },
removeGroup(id) { removeGroup(id) {
// this.$confirm('确认删除当前分组? 删除后其下活码将移至默认分组!', '提示', { // this.$confirm('确认删除当前分组? 删除后其下活码将移至默认分组!', '提示', {
this.$confirm( this.$confirm('是否确认删除当前分组?删除后该分组下所有字段同步删除,该操作不可撤销,请谨慎操作。', '提示', {
'是否确认删除当前分组?删除后该分组下所有字段同步删除,该操作不可撤销,请谨慎操作。',
'提示',
{
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
} })
)
.then(() => { .then(() => {
removeCodeCategory(id).then((res) => { removeCodeCategory(id).then((res) => {
this.getCodeCategoryListFn() this.getCodeCategoryListFn()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!