import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from '@/gen/Apis'
import useModel from './model'
import { showToast, showToastBack } from '@/common/libraries/naviHelper'
import { useWeAppAuthStore } from '@/common'
const auth = useWeAppAuthStore()
export default {
  handleSelectType(e: { value: string }) {
    useModel.formData.value.type = e?.value
  },
  handleSubmit() {
    if (!useModel?.formData?.value?.type) {
      return showToast('请选择反馈类型！')
    }
    if (!useModel?.formData?.value?.type) {
      return showToast('请输入反馈建议！')
    }
    getApiLoading(Apis.Customer.CustomerOpinions.Store, useModel?.formData?.value).then(res => {
      showToastBack('提交成功', 1, true)
      console.log(res)
    })
  },
  toWorkOrder() {
    uni.navigateTo({
      url: '/WORKORDER/list/index'
    })
  }
}
