import { $createGasOrder } from '@/service/pay'
import { $purchaseGasInfo } from '@/service/strategy'

export default {
  created() {
    this.getGasstationInfo()
  },
  methods: {
    getGasstationInfo() {
      $purchaseGasInfo({ gasstationId: this.gasstationId }).then(response => {
        this.options.info.value = response.platformPrice
      })
    },
    createGasOrderEvent(param, path) {
      this.$toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true, // 禁用背景点击
        message: '订单创建中...'
      })
      // alert("参数！！！" + JSON.stringify(param))
      $createGasOrder(param).then(response => {
        this.$toast('提交完成！')
        setTimeout(() => {
          this.$router.replace({ path: path })
        }, 1000)
        this.$toast.clear()
      })
    }
  }
}
