index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. privacyFieldC: {
  16. type: Array
  17. }
  18. },
  19. options: {
  20. addGlobalClass: true
  21. },
  22. data: {},
  23. methods: {
  24. toProductDetail(e) {
  25. const {
  26. item
  27. } = e.currentTarget.dataset;
  28. },
  29. onBlur(e) {
  30. let {
  31. data,
  32. name
  33. } = e.currentTarget.dataset;
  34. this.triggerEvent("changeProduct", {
  35. "sa_aftersalesmag_itemsid": data.sa_aftersalesmag_itemsid,
  36. "sa_orderitemsid": data.sa_orderitemsid,
  37. "itemid": data.itemid,
  38. "qty": name == 'qty' ? e.detail.value : data.qty,
  39. "price": name == 'price' ? e.detail.value : data.price,
  40. "reason": name == 'reason' ? e.detail.value : data.reason,
  41. })
  42. },
  43. deleteProduct(e) {
  44. if (this.data.disabled) return wx.showToast({
  45. title: '当前状态不可删除!',
  46. icon: "none"
  47. })
  48. let {
  49. item
  50. } = e.currentTarget.dataset;
  51. this.triggerEvent("deleteItem", item)
  52. },
  53. isEdit() {
  54. if (this.data.disabled) wx.showToast({
  55. title: '当前状态不可编辑!',
  56. icon: "none"
  57. })
  58. }
  59. }
  60. })