rk
昨天 4f4538356403d620b9bd510fd45729a251291942
admin/src/views/business/tiktokConfiguration.vue
@@ -31,7 +31,9 @@
      </div>
      <el-form ref="storeForm" :model="storeForm" label-width="100px" class="config-form">
        <el-form-item label="门店名称">
          <el-input v-model="storeForm.storeName" placeholder="请点击右侧查询按钮获取查询门店信息" style="width: 400px;" readonly></el-input>
          <el-select v-model="storeForm.poiId" placeholder="请点击右侧查询按钮获取门店信息" style="width: 400px;">
            <el-option v-for="item in storeList" :key="item" :label="item" :value="item"></el-option>
          </el-select>
          <el-button @click="queryStore" style="margin-left: 10px;">查询门店</el-button>
        </el-form-item>
        <el-form-item>
@@ -43,6 +45,8 @@
</template>
<script>
import { getDouyinConfigDTO, updateDouyinAppConfigDTO, updateDouyinPoiIdDTO } from '@/api/business/dictData.js'
import { poiList } from '@/api/business/douyinVerify.js'
export default {
  name: 'TiktokConfiguration',
  data () {
@@ -53,31 +57,59 @@
        accountId: ''
      },
      storeForm: {
        storeName: ''
      }
    }
      poiId: ''
    },
    storeList: []
  }
  },
  created () {
    this.loadConfig()
  },
  methods: {
    loadConfig () {
      getDouyinConfigDTO({}).then(res => {
        if (res) {
          this.form.appkey = res.clientKey || ''
          this.form.secret = res.clientSecret || ''
          this.form.accountId = res.accountId || ''
          this.storeForm.poiId = res.poiId || ''
        }
      }).catch(e => {
        this.$tip.apiFailed(e)
      })
    },
    saveStep1 () {
      if (!this.form.appkey || !this.form.secret || !this.form.accountId) {
        this.$message.warning('请填写完整信息')
        return
      }
      this.$message.success('保存成功')
      updateDouyinAppConfigDTO({
        accountId: this.form.accountId,
        clientKey: this.form.appkey,
        clientSecret: this.form.secret
      }).then(() => {
        this.$message.success('保存成功')
      }).catch(e => {
        this.$tip.apiFailed(e)
      })
    },
    queryStore () {
      if (!this.form.appkey || !this.form.secret || !this.form.accountId) {
        this.$message.warning('请先完成第一步参数配置')
        return
      }
      this.$message.info('查询门店中...')
      poiList({}).then(res => {
        this.storeList = res || []
      })
    },
    saveStep2 () {
      if (!this.storeForm.storeName) {
        this.$message.warning('请先查询门店')
      if (!this.storeForm.poiId) {
        this.$message.warning('请先选择门店')
        return
      }
      this.$message.success('保存成功')
      updateDouyinPoiIdDTO(this.storeForm.poiId).then(() => {
        this.$message.success('保存成功')
      })
    }
  }
}