|
@@ -1,60 +1,58 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container" style="width: 800px;margin: 0 auto;">
|
|
<div class="app-container" style="width: 800px;margin: 0 auto;">
|
|
- <el-form ref="bannerForm" :model="form" label-width="100px">
|
|
|
|
|
|
+ <el-form ref="procureForm" :model="form" label-width="100px">
|
|
<el-form-item label="姓名:" prop="name" :rules="rules.name">
|
|
<el-form-item label="姓名:" prop="name" :rules="rules.name">
|
|
<el-input v-model="form.name" placeholder="请填写姓名" maxlength="6" style="width: 200px;" />
|
|
<el-input v-model="form.name" placeholder="请填写姓名" maxlength="6" style="width: 200px;" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="手机号:" prop="mobile" :rules="rules.mobile">
|
|
<el-form-item label="手机号:" prop="mobile" :rules="rules.mobile">
|
|
- <el-input v-model="form.mobile" placeholder="请填写手机号" style="width: 200px" />
|
|
|
|
|
|
+ <el-input v-model="form.mobile" placeholder="请填写手机号" maxlength="11" style="width: 200px" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="状态:" prop="status" :rules="rules.status">
|
|
<el-form-item label="状态:" prop="status" :rules="rules.status">
|
|
<el-select v-model="form.status" placeholder="请选择">
|
|
<el-select v-model="form.status" placeholder="请选择">
|
|
- <el-option label="上线" :value="1" />
|
|
|
|
- <el-option label="下线" :value="0" />
|
|
|
|
|
|
+ <el-option label="上线" :value="90" />
|
|
|
|
+ <el-option label="下线" :value="91" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="关联机构:" prop="clubs" :rules="rules.clubs">
|
|
|
|
- <template v-if="form.clubs && form.clubs.length === 0">
|
|
|
|
- <el-button type="primary" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleDialogVisible">选择机构</el-button>
|
|
|
|
- <el-checkbox-group v-show="false" v-model="form.clubs" />
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <el-table :data="form.clubs" border width="1000">
|
|
|
|
- <el-table-column prop="userName" label="机构名称" align="center" />
|
|
|
|
- <el-table-column label="状态" align="center" prop="status">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <template v-if="row.clubStatus*1===1">
|
|
|
|
- <el-tag type="warning" size="small">待审核</el-tag>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="row.clubStatus*1===92">
|
|
|
|
- <el-tag type="danger" size="small">审核未通过</el-tag>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <el-tag v-if="row.clubStatus*1===91" type="danger" size="small">已下线</el-tag>
|
|
|
|
- <el-tag v-else type="success" size="small">已上线</el-tag>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-form-item label="关联机构:" prop="clubList" :rules="rules.clubList">
|
|
|
|
+ <el-button type="primary" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleDialogVisible">选择机构</el-button>
|
|
|
|
+ <el-checkbox-group v-show="false" v-model="form.clubList" />
|
|
|
|
+ <el-table :data="form.clubList" border width="1000">
|
|
|
|
+ <el-table-column prop="name" label="机构名称" align="center" />
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status">
|
|
|
|
+ <template slot-scope="{row}">
|
|
|
|
+ <template v-if="row.clubStatus*1===1">
|
|
|
|
+ <el-tag type="warning" size="small">待审核</el-tag>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="联系人" align="center" prop="linkMan" />
|
|
|
|
- <el-table-column label="手机号" align="center" prop="bindMobile" />
|
|
|
|
- <el-table-column label="操作" align="center">
|
|
|
|
- <el-button type="text" @click="deleteShop">删除</el-button>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <template v-else-if="row.clubStatus*1===92">
|
|
|
|
+ <el-tag type="danger" size="small">审核未通过</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <el-tag v-if="row.clubStatus*1===91" type="danger" size="small">已下线</el-tag>
|
|
|
|
+ <el-tag v-else type="success" size="small">已上线</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="联系人" align="center" prop="linkMan" />
|
|
|
|
+ <el-table-column label="手机号" align="center" prop="contractMobile" />
|
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" @click="handleDeleteClubs(scope.$index)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div class="el-dialog__footer" style="text-align: center;">
|
|
<div class="el-dialog__footer" style="text-align: center;">
|
|
- <el-button type="primary" @click="onSubmit('bannerForm')">保存</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="onSubmit('procureForm')">保存</el-button>
|
|
<el-button plain @click="backToList">返回</el-button>
|
|
<el-button plain @click="backToList">返回</el-button>
|
|
</div>
|
|
</div>
|
|
<!-- 商品弹框 -->
|
|
<!-- 商品弹框 -->
|
|
- <club-dialog v-if="dialogVisible" ref="goodDialog" @cancel="handleGoodCancel" @confirm="handleGoodConfirm" />
|
|
|
|
|
|
+ <club-dialog v-if="dialogVisible" ref="clubDialog" @cancel="handleGoodCancel" @confirm="handleGoodConfirm" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { savePageBanner, formPageBanner } from '@/api/campaign'
|
|
|
|
|
|
+import { saveProcure, detailsEcho } from '@/api/club'
|
|
import clubDialog from './components/club-multi-dialog'
|
|
import clubDialog from './components/club-multi-dialog'
|
|
export default {
|
|
export default {
|
|
name: 'ProcureEdit',
|
|
name: 'ProcureEdit',
|
|
@@ -74,8 +72,8 @@ export default {
|
|
organizeId: this.$store.getters.organizeId,
|
|
organizeId: this.$store.getters.organizeId,
|
|
name: '', // 采购员名称
|
|
name: '', // 采购员名称
|
|
mobile: '', // 采购员手机号
|
|
mobile: '', // 采购员手机号
|
|
- status: 1, // 轮播上线状态
|
|
|
|
- clubs: []
|
|
|
|
|
|
+ status: 90, // 上线状态
|
|
|
|
+ clubList: []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
@@ -86,16 +84,10 @@ export default {
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
loadImgLoading: false,
|
|
loadImgLoading: false,
|
|
rules: {
|
|
rules: {
|
|
- bannerName: [{ required: true, message: '请填写轮播主题', trigger: 'blur' }],
|
|
|
|
- bannerImage: [{ required: true, message: '请上传轮播图', trigger: 'blur' }],
|
|
|
|
- clubs: [{ required: true, type: 'array', message: '请添加一个商品', trigger: ['change'] }],
|
|
|
|
|
|
+ name: [{ required: true, message: '请填写姓名', trigger: 'blur' }],
|
|
|
|
+ mobile: [{ required: true, message: '请填写手机号', trigger: 'blur' }],
|
|
|
|
+ clubList: [{ required: true, type: 'array', message: '请添加机构', trigger: ['change'] }],
|
|
status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
|
|
status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
|
|
- },
|
|
|
|
- listQuery: {
|
|
|
|
- index: 1,
|
|
|
|
- pageSize: 100,
|
|
|
|
- enabledStatus: 1,
|
|
|
|
- organizeId: this.$store.getters.organizeId
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -106,45 +98,34 @@ export default {
|
|
this.editType = this.$route.query.type || 'edit'
|
|
this.editType = this.$route.query.type || 'edit'
|
|
if (this.editType === 'edit') {
|
|
if (this.editType === 'edit') {
|
|
console.log('edit')
|
|
console.log('edit')
|
|
- // this.formPageBanner(this.$route.query.id)
|
|
|
|
|
|
+ this.detailsEcho(this.$route.query.id)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async formPageBanner(id) {
|
|
|
|
- // 获取轮播图详情
|
|
|
|
|
|
+ // 获取采购员信息
|
|
|
|
+ async detailsEcho(id) {
|
|
try {
|
|
try {
|
|
- const res = await formPageBanner(id)
|
|
|
|
|
|
+ const res = await detailsEcho(id)
|
|
this.form = { ...this.form, ...res.data }
|
|
this.form = { ...this.form, ...res.data }
|
|
- if (res.data.jumpType === 2) {
|
|
|
|
- this.form.products = []
|
|
|
|
- }
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log('error', error)
|
|
console.log('error', error)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- changeGrop(value) {
|
|
|
|
- console.log('value', value)
|
|
|
|
- },
|
|
|
|
- // 显示选择商品弹窗
|
|
|
|
|
|
+ // 显示选择机构弹窗
|
|
handleDialogVisible() {
|
|
handleDialogVisible() {
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
},
|
|
},
|
|
- handleGoodDialogVisible(index) {
|
|
|
|
- // 显示选择商品弹窗
|
|
|
|
- this.addIndex = index
|
|
|
|
- this.dialogGoodVisible = true
|
|
|
|
- },
|
|
|
|
- deleteShop() {
|
|
|
|
- // 清除商品
|
|
|
|
- this.form.jumpProductId = ''
|
|
|
|
- this.form.clubs = []
|
|
|
|
|
|
+ // 删除机构
|
|
|
|
+ handleDeleteClubs(index) {
|
|
|
|
+ this.form.clubList.splice(index, 1)
|
|
},
|
|
},
|
|
|
|
+ // 确认选择机构
|
|
handleGoodConfirm(data) {
|
|
handleGoodConfirm(data) {
|
|
- // 确认选择商品
|
|
|
|
- this.form.clubs = data
|
|
|
|
- console.log('clubs', this.form.clubs)
|
|
|
|
|
|
+ this.form.clubList = this.form.clubList.concat(data)
|
|
|
|
+ console.log('clubList', this.form.clubList)
|
|
this.handleGoodCancel()
|
|
this.handleGoodCancel()
|
|
},
|
|
},
|
|
|
|
+ // 提交
|
|
onSubmit(formName) {
|
|
onSubmit(formName) {
|
|
this.$refs[formName].validate(valid => {
|
|
this.$refs[formName].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
@@ -154,30 +135,37 @@ export default {
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
console.log('form', this.form)
|
|
console.log('form', this.form)
|
|
- this.savePageBanner(this.form)
|
|
|
|
|
|
+ this.saveProcure(this.form)
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- async savePageBanner(params) {
|
|
|
|
- // 保存
|
|
|
|
- await savePageBanner(params)
|
|
|
|
- this.$message.success('保存成功')
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$router.push({ path: '/campaign/list', query: { type: 1 }})
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ // 保存
|
|
|
|
+ async saveProcure(params) {
|
|
|
|
+ try {
|
|
|
|
+ const res = await saveProcure(params)
|
|
|
|
+ this.$message.success(res.msg)
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.$router.push({ path: '/procure/list', query: { type: 1 }})
|
|
|
|
+ }, 1000)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log('error', error)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- // 取消选择商品
|
|
|
|
|
|
+ // 取消选择机构
|
|
handleGoodCancel() {
|
|
handleGoodCancel() {
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
- this.$refs.goodDialog.visible = false
|
|
|
|
|
|
+ this.$refs.clubDialog.visible = false
|
|
|
|
+ },
|
|
|
|
+ changeGrop(value) {
|
|
|
|
+ console.log('value', value)
|
|
},
|
|
},
|
|
backToList() {
|
|
backToList() {
|
|
this.$store.dispatch('tagsView/delView', this.$route).then(() => {
|
|
this.$store.dispatch('tagsView/delView', this.$route).then(() => {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.$router.replace({ path: '/procure/list', query: { type: 1 }})
|
|
|
|
|
|
+ this.$router.replace({ path: '/procure/list' })
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|