123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- st_stockbillid: null,
- detail: {},
- tabsActive: 0,
- tabsList: [{
- label: "产品明细",
- icon: "icon-tabchanpin",
- model: "#Product"
- }, {
- label: "操作记录",
- icon: "icon-tabcaozuojilu1",
- model: "#record"
- }]
- },
- onLoad(options) {
- this.setData({
- st_stockbillid: options.id
- })
- this.getDetail()
- },
- getDetail() {
- _Http.basic({
- "id": 20230719153803,
- "content": {
- "st_stockbillid": this.data.st_stockbillid
- }
- }).then(res => {
- console.log("到货通知详情", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.setData({
- detail: res.data
- })
- this.partialRenewal()
- })
- }, //局部数据更新 tabs
- partialRenewal(init = false) {
- let model = this.data.tabsList[this.data.tabsActive].model;
- if (model) {
- let Component = this.selectComponent(model),
- {
- total,
- pageNumber,
- pageTotal
- } = Component.data.content,
- id = this.data.st_stockbillid;
- if (total == null || init) {
- Component.getList(id, init);
- } else if (pageNumber <= pageTotal) {
- Component.getList(id, false);
- }
- }
- }, //tabs 切换
- tabsChange({
- detail
- }) {
- this.setData({
- tabsActive: detail
- });
- this.partialRenewal();
- },
- ConfirmReceiptOfGoods() {
- let that = this,
- isreceiver = this.data.detail.isreceiver;
- wx.showModal({
- content: '是否确定' + (isreceiver ? '收货反确认' : '收货确认') + '?',
- complete: (res) => {
- if (res.confirm) _Http.basic({
- id: "2025061311223103",
- content: {
- st_stockbillid: that.data.st_stockbillid,
- isreceiver: isreceiver ? 0 : 1
- }
- }).then(res => {
- wx.showToast({
- title: res.msg != '成功' ? res.msg : "操作成功",
- icon: "none"
- })
- if (res.msg != '成功') return
- that.setData({
- "detail.isreceiver": isreceiver ? 0 : 1
- })
- let page = getCurrentPages()[getCurrentPages().length - 2]
- if (page) {
- let index = page.data.list.findIndex(v => v.st_stockbillid == that.data.st_stockbillid);
- if (index != -1) {
- page.setData({
- [`list[${index}].isreceiver`]: that.data.detail.isreceiver
- })
- }
- }
- })
- }
- })
- },
- onReachBottom() {
- this.partialRenewal();
- },
- })
|