deleteAttributeDetail.js 809 B

1234567891011121314151617181920212223242526272829303132
  1. import Vue from 'vue'
  2. import iview from 'iview'
  3. export default function deleteAttributeDetail (payload = {}) {
  4. return new Promise((resolve, reject) => {
  5. const {
  6. id,
  7. name,
  8. attribute_category_name: attributeCategoryName,
  9. attribute_type: attributeType,
  10. } = payload
  11. const type = attributeType ? '参数' : '规格'
  12. iview.Modal.confirm({
  13. title: `删除${type}`,
  14. content: `确定要删除"${attributeCategoryName}"属性的"${name}"${type}吗?`,
  15. onOk: async () => {
  16. try {
  17. await Vue.http.delete(`/product/attribute/item?id=${id}`)
  18. iview.Message.success('删除成功')
  19. resolve('remove')
  20. } catch (e) {
  21. reject(e)
  22. }
  23. },
  24. onCancel: (e) => {
  25. reject(e)
  26. },
  27. })
  28. })
  29. }