rk
2 天以前 11c5ab8d97809bdeddb60b22a4fe161a67aa3b05
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
<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>