123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- const _Http = getApp().globalData.http
- Component({
- properties: {
- detail: {
- type: Object
- },
- disabled: {
- type: Boolean
- }
- },
- options: {
- addGlobalClass: true,
- },
- data: {
- content: {
- nocache: true,
- pageNumber: 1,
- pageTotal: 1,
- total: null
- }
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- methods: {
- isEdit() {
- if (this.data.disabled) getApp().globalData.Language.showToast('当前状态不可编辑!')
- },
- getList(id, init) {
- let content = this.data.content;
- content.sa_paybillid = id;
- if (init) content.pageNumber = 1;
- _Http.basic({
- "id": "20221227092804",
- content
- }).then(res => {
- console.log("打款明细", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- sa_paybillid: id
- })
- })
- },
- /* 添加明细 */
- addProduct() {
- wx.navigateTo({
- url: `/packageA/remitVoucher/modules/selectAccount/index?params=${
- JSON.stringify({
- "id": 20221228085004,
- "content": {
- "pageNumber": 1,
- "pageSize": 20,
- "sa_paybillid":getCurrentPages()[getCurrentPages().length - 1].data.sa_paybillid,
- "where": {
- "condition": ""
- }
- }
- })
- }`,
- })
- getApp().globalData.handleSelect = this.handleSelect.bind(this)
- },
- /* 操作选中的账户信息 */
- async handleSelect(data) {
- wx.navigateBack()
- let paybilldetails = data.list.map(item => {
- return {
- "sa_paybilldetailid": 0,
- "sa_accountclassid": item.sa_accountclassid,
- "amount": item.amount
- }
- }),
- page = getCurrentPages()[getCurrentPages().length - 2]
- let res = await _Http.basic({
- "id": 20221227092904,
- "content": {
- sa_paybillid: page.data.sa_paybillid,
- paybilldetails
- }
- })
- if (res.msg == '成功') {
- this.getList(page.data.sa_paybillid, true)
- }
- },
- /* 金额改变 */
- async priceChange(e) {
- console.log(e);
- let data = e.currentTarget.dataset.data
- if (e.detail.value == data.amount) return
- let res = await _Http.basic({
- "id": 20221227092904,
- "content": {
- sa_paybillid: data.sa_paybillid,
- paybilldetails: [{
- "sa_paybilldetailid": data.sa_paybilldetailid,
- "sa_accountclassid": data.sa_accountclassid,
- "amount": e.detail.value,
- }]
- }
- })
- if (res.msg == '成功') {
- this.triggerEvent('onSuccess')
- } else {
- wx.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- },
- /* 删除明细 */
- deleteProduct(e) {
- if (this.properties.detail.status != '新建') return getApp().globalData.Language.showToast('非新建状态无法删除')
- wx.showModal({
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否删除当前打款明细') + '?',
- complete: async (res) => {
- console.log(res);
- if (res.confirm) {
- let res = await _Http.basic({
- "id": 20221227093004,
- "content": {
- "sa_paybillid": e.currentTarget.dataset.data.sa_paybillid,
- "sa_paybilldetailids": [e.currentTarget.dataset.data.sa_paybilldetailid]
- }
- })
- if (res.msg == '成功') {
- this.getList(getCurrentPages()[getCurrentPages().length - 1].data.sa_paybillid, true)
- } else {
- wx.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- }
- }
- })
- }
- }
- })
|