index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Component({
  2. properties: {
  3. list: Array,
  4. deleteItem: Function,
  5. changeProduct: Function, //修改队列
  6. disabled: Boolean
  7. },
  8. options: {
  9. addGlobalClass: true
  10. },
  11. methods: {
  12. toProductDetail(e) {
  13. const {
  14. item
  15. } = e.currentTarget.dataset;
  16. },
  17. onBlur(e) {
  18. let {
  19. data,
  20. name
  21. } = e.currentTarget.dataset;
  22. this.triggerEvent("changeProduct", {
  23. "sa_aftersalesmag_itemsid":data.sa_aftersalesmag_itemsid,
  24. "sa_orderitemsid": data.sa_orderitemsid,
  25. "itemid": data.itemid,
  26. "qty": name == 'qty' ? e.detail.value : data.qty,
  27. "price": name == 'price' ? e.detail.value : data.price,
  28. "reason": name == 'reason' ? e.detail.value : data.reason,
  29. })
  30. },
  31. deleteProduct(e) {
  32. if (this.data.disabled) return wx.showToast({
  33. title: '当前状态不可删除!',
  34. icon: "none"
  35. })
  36. let {
  37. item
  38. } = e.currentTarget.dataset;
  39. this.triggerEvent("deleteItem", item)
  40. },
  41. isEdit() {
  42. if (this.data.disabled) wx.showToast({
  43. title: '当前状态不可编辑!',
  44. icon: "none"
  45. })
  46. }
  47. }
  48. })