DistributionStore.vue
4.25 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
<template>
<div class="container">
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true"
:formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="merchantHtml">
<el-button type="default" class="el-icon-plus" v-if="!isDisabled" @click="handleOpen">分配门店</el-button>
<div class="mer-des">请选择门店分配旅程模版</div>
<GLTable ref="memberCenterRef"
:tableData="tableData"
:hasPage="false"
:tableParams="tableParams">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</glsx-combi-form>
<MerchantStore v-if="relateStoreVisible" ref="relateStore" :dialogVisible="relateStoreVisible"
:storeSelected="selectedList" :merchantInfo="editForm"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"></MerchantStore>
</div>
</template>
<script>
import MerchantStore from "views/journeyConfig/components/merchantStore";
export default {
name: "DistributionStore",
components: {
MerchantStore
},
data() {
return {
editChildRef: 'editChildRef',
editForm: {
merchantId: '',
merchantName: ''
},
editFormData: [
{
label: '可见商户',
name: 'merchantId',
addHtml: 'merchantHtml'
}
],
editRule: {
merchantId: [{
required: true, validator: (rule, value, callback) => {
if (this.editForm.merchantId) {
callback()
} else {
callback(new Error(`请选择门店`))
}
}, trigger: 'change'
}],
},
selectedList: [],
tableData: [],
relateStoreVisible: false,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '商户号',
prop: 'groupId',
},
{
label: '商户名称',
prop: 'groupName',
}
],
},
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text'
},
listeners: {
click: () => {
this.tableData = []
this.editForm={
merchantId: '',
merchantName: ''
}
}
}
}
],
}
},
methods: {
handleOpen() {
this.tableData = []
this.relateStoreVisible = !this.relateStoreVisible
},
//搜索门店table
handleSearchStore() {
this.$refs.relateStore.handleCurrentChange(1)
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.merchantId && !selectedData.merchantName){
this.$message.error('请选择门店')
return
}
this.editForm = selectedData
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('merchantId')
selectedData.merchantId && (this.editForm.merchantId = selectedData.merchantId)
selectedData.merchantName && ((this.editForm.merchantName = selectedData.merchantName), (this.merchantFlag = false))
this.tableData.push({
groupId: selectedData.merchantId,
groupName: selectedData.merchantName,
})
this.handleRelateStoreClose()
},
handleRelateStoreClose() {
this.relateStoreVisible = false
},
handleVertify() {
this.$refs.editFormRef.$refs[this.editChildRef]?.validate(valid => {
if (!this.editForm.merchantName) {
this.merchantFlag = true
return
}
this.$bus.$emit('saveEvent', {isNext: valid, sopTplGrants: this.tableData})
})
}
},
mounted() {
this.$bus.$on('vertifyMerchant', data => {
this.handleVertify()
})
}
}
</script>
<style lang="scss" scoped>
/deep/ .el-form-item__content {
width: 80% !important;
}
.mer-des{
color: #C6C6C6;
font-size: 12px;
}
</style>