index.js 1.2 KB

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