12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- Component({
- properties: {
- list: Array,
- deleteItem: Function,
- changeProduct: Function, //修改队列
- disabled: Boolean
- },
- options: {
- addGlobalClass: true
- },
- methods: {
- toProductDetail(e) {
- const {
- item
- } = e.currentTarget.dataset;
- console.log(item)
- },
- onBlur(e) {
- let {
- data
- } = e.currentTarget.dataset;
- let i = this.data.list.findIndex(v => v.sa_orderitemsid == data.sa_orderitemsid),
- value = e.detail.value;
- if (value == 0) {
- wx.showToast({
- title: 'title',
- icon: "none",
- mask: true
- })
- this.setData({
- list: this.data.list
- })
- return;
- }
- let maxqty = data.uninvoiceamount / data.price;
- if (value > maxqty) value = maxqty;
- if (e.detail.value != data.invoiceamount) this.triggerEvent("changeProduct", {
- "sa_invoiceapply_orderid": data.sa_invoiceapply_orderid,
- "saorderid": data.sa_orderid,
- "sa_orderitemsid": data.sa_orderitemsid,
- "price": data.price,
- "invoiceamount": value * data.price,
- "invoiceaqty": value
- })
- if (value > maxqty) setTimeout(() => {
- wx.showToast({
- title: `超过最大可开票数量`,
- icon: "none",
- mask: true
- })
- }, 500)
- },
- deleteProduct(e) {
- let {
- item
- } = e.currentTarget.dataset;
- this.triggerEvent("deleteItem", item)
- },
- isEdit() {
- if (this.data.disabled) wx.showToast({
- title: '当前状态不可编辑!',
- icon: "none"
- })
- }
- }
- })
|