<template>
|
<GlobalWindow
|
:title="title"
|
width="60%"
|
:visible.sync="visible"
|
:confirm-working="isWorking"
|
@confirm="confirm"
|
>
|
<p class="tip-warn" style="margin: 30px;"><i class="el-icon-warning"></i>操作说明:该操作只针对已绑定经销商的客户有效!</p>
|
<el-form :model="form" ref="form" :rules="rules" label-suffix=":" inline>
|
<el-form-item label="当前已绑定的经销商" label-width="200px" >
|
<span>{{form.shopName}}</span>
|
</el-form-item>
|
<el-form-item label="选择新的经销商" label-width="200px" prop="bindShopId" >
|
<el-select v-model="form.bindShopId" clearable filterable placeholder="请选择优惠券" >
|
<el-option v-for="item in shops" :key="item.id" :label="item.name" :value="item.id"> </el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import { allList as shopList } from '@/api/business/shop'
|
export default {
|
name: 'OperaChangeShopWindow',
|
extends: BaseOpera,
|
components: { GlobalWindow },
|
data () {
|
return {
|
searchLoading: false,
|
users: [],
|
// 表单数据
|
oldId:null,
|
form: {
|
id: null,
|
shopName: null,
|
bindShopId: null
|
},
|
shops: [],
|
rules: {
|
bindShopId: [
|
{ required: true, message: '请选择新的经销商' }
|
]
|
}
|
}
|
},
|
created () {
|
this.config({
|
api: '/business/member',
|
'field.id': 'id'
|
})
|
},
|
methods: {
|
confirm () {
|
this.$refs.form.validate((valid) => {
|
if (!valid) {
|
return
|
}
|
this.isWorking = true
|
this.api.updateShop(this.form)
|
.then(() => {
|
this.visible = false
|
this.$tip.apiSuccess('操作成功')
|
this.$emit('success')
|
})
|
.catch(e => {
|
this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking = false
|
})
|
})
|
},
|
getShopList () {
|
shopList({ status: 0 })
|
.then(res => {
|
if (res) {
|
this.shops = res || []
|
}
|
})
|
},
|
open (title, target) {
|
this.title = title
|
this.visible = true
|
this.oldId=target.bindShopId
|
this.form.id = target.id
|
this.form.shopName = target.shopName
|
this.form.bindShopId = null
|
this.getShopList()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import "@/assets/style/alertstyle.scss";
|
::v-deep .el-form-item__content {
|
flex: 0.6;
|
}
|
::v-deep .el-select {
|
width: 100%;
|
.el-input__inner {
|
width: 100%;
|
}
|
}
|
</style>
|