addDialog.vue
3.78 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
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-06 09:49:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-12-04 13:42:32
* @FilePath: \dj-car-life-system\src\views\contentManager\packageConfig\components\addDialog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 月度库存结算单弹窗 -->
<template>
<d2-dialog
:title="cloneId ? '复制全套素材到指定门店' : '新增门店'"
:is-visible="dialogVisible"
class="dailog-box"
width="36%"
@closeDialog="handleClose"
@confirmDialog="handleConfirm"
>
<div v-loading="loading">
<div class="dialog-title">
{{
cloneId
? "将该门店下所有车型的所有素材和套餐推荐数据(不包含客户案例),复制或替换到指定门店"
: "请选择新增门店,新增门店的套餐配置和素材会复用默认门店的素材,可自定义修改"
}}
</div>
<el-select
filterable
class="form-select"
v-model="formData.merchantId"
placeholder="请选择"
>
<el-option
v-for="(i, indx) in merchantIdList"
:key="i.merchantId"
:label="i.merchantName"
:value="i.merchantId"
></el-option>
</el-select>
</div>
</d2-dialog>
</template>
<script>
import { recepitonUpdate, materialPage } from "@api/contentManager"
import { mapState, mapActions } from "vuex"
export default {
name: "addDialog",
data() {
return {
formData: { merchantId: "" },
merchantIdBrandList: [],
loading: false
}
},
props: {
dialogVisible: Boolean,
cloneId: {
type: Number
}
},
computed: {
...mapState("d2admin/merchant", ["merchantIdList"])
},
async mounted() {
this.loading = true
await this.getMerchantIdList()
this.loading = false
console.log(this.cloneId, "cloneId")
if (this.cloneId) {
materialPage({ pageSize: 1000, currentPage: 1 }).then((res) => {
this.merchantIdBrandList = res.list.map((i) => i.merchantId)
})
}
},
methods: {
...mapActions("d2admin/merchant", ["getMerchantIdList"]),
handleConfirm() {
const { merchantId } = this.formData
if (!merchantId) {
return this.$message.error("请选择门店")
}
const merchantName = this.merchantIdList.find(
(i) => i.merchantId === merchantId
).merchantName
let params = { merchantId, configType: 0, merchantName }
if (this.cloneId) {
params = {
merchantId: merchantId,
merchantName,
copyMerchantId: this.cloneId
}
if (this.merchantIdBrandList.includes(merchantId)) {
this.$confirm("该门店下已包含素材,是否复制替换?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
closeOnClickModal: false
})
.then(() => {
recepitonUpdate(params).then((res) => {
if (res) {
this.handleClose()
this.$message.success("操作成功")
}
})
})
.catch((err) => {
console.log(err)
})
return
}
}
recepitonUpdate(params).then((res) => {
if (res) {
this.handleClose()
this.$message.success("操作成功")
}
})
},
handleClose() {
this.$emit("dialogClose")
}
}
}
</script>
<style lang="scss">
.dialog-title {
font-size: 14px;
line-height: 30px;
margin-bottom: 15px;
}
.form-select {
width: 50%;
}
</style>