index.js 1.1 KB

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