12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- Component({
- properties: {
- list: {
- type: Array
- },
- deleteItem: {
- type: Function
- },
- changeProduct: {
- type: Function
- },
- disabled: {
- type: Boolean
- }
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- this.setData({
- siteid: wx.getStorageSync('userMsg').siteid
- })
- }
- },
- options: {
- addGlobalClass: true
- },
- methods: {
- toProductDetail(e) {
- const {
- item
- } = e.currentTarget.dataset;
- },
- 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: getApp().globalData.Language.getMapText('超过最大可开票数量'),
- icon: "none",
- mask: true
- })
- }, 500)
- },
- deleteProduct(e) {
- let {
- item
- } = e.currentTarget.dataset;
- this.triggerEvent("deleteItem", item)
- },
- isEdit() {
- if (this.data.disabled) getApp().globalData.Language.showToast('当前状态不可编辑')
- }
- }
- })
|