index.js 1.1 KB

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