123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- sa_orderid: null,
- tabsActive: 0,
- tabsList: [{
- label: "产品明细",
- icon: "icon-tabchanpin",
- model: "#Product"
- }, {
- label: "附件",
- icon: "icon-tabfujian1",
- model: "#Yl_Attachment"
- }, {
- label: "订单进度",
- icon: "icon-tabcaozuojilu1",
- model: "#Progress"
- }, {
- label: "发票",
- icon: "icon-tabkaipiaoxinxi"
- }],
- },
- onLoad(options) {
- this.setData({
- sa_orderid: options.id
- });
- this.getDetail();
- },
-
- getDetail() {
- _Http.basic({
- "id": 20221108151302,
- "content": {
- "sa_orderid": this.data.sa_orderid
- }
- }).then(res => {
- console.log("订单详情", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- this.setData({
- detail: res.data
- });
- this.partialRenewal(true)
- })
- },
-
- tabsChange({
- detail
- }) {
- this.setData({
- tabsActive: detail
- });
- this.partialRenewal();
- },
-
- 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.detail.sa_orderid;
- if (total == null || init) {
- Component.getList(id, init);
- } else if (pageNumber < pageTotal) {
- Component.getList(id, false);
- }
- }
- },
- onReachBottom() {
- this.partialRenewal();
- },
-
- changeDetail() {
- let data = this.data.detail,
- content = {
- "sa_orderid": data.sa_orderid,
- "sys_enterpriseid": data.sys_enterpriseid,
- "sa_accountclassid": data.accountclass.sa_accountclassid || 0,
- "sa_brandid": data.sa_brandid,
- "sys_enterprise_financeid": data.finance.sys_enterprise_financeid,
- "sa_logiscompid": data.logiscomp.sa_logiscompid,
- "rec_contactsid": data.contacts.contactsid || 0,
- "type": data.type,
- "typemx": data.typemx,
- "remarks": data.remarks,
- "saler_hrid": data.saler_hrid,
- "tradefield": data.tradefield,
- "pay_enterpriseid": data.pay_enterpriseid,
- "rebate_userate": data.accountclass.rebate_userate,
- "rebate_used": data.accountclass.rebate_used,
- "billdate": data.billdate,
- };
- if (content.type != '标准订单') {
-
-
- }
- return new Promise((resolve, reject) => {
- _Http.basic({
- "id": 20221108111402,
- content
- }).then(res => {
- console.log("修改订单数据", res);
- if (res.msg != '成功') wx.showToast({
- title: res.msg,
- icon: "none"
- });
- resolve(res)
- })
- })
- },
-
- changeRemarks(e) {
- let value = e.detail.value,
- remarks = this.data.detail.remarks,
- that = this;
- if (value == this.data.detail.remarks) return;
- wx.showModal({
- title: '提示',
- content: '是否确定修改订单备注?',
- complete: async (res) => {
- if (res.cancel) that.setData({
- "detail.remarks": remarks
- })
- if (res.confirm) {
- let res = await that.changeDetail();
- that.setData({
- "detail.remarks": res.msg == '成功' ? value : remarks
- })
- }
- }
- })
- },
-
- async changeRebateUsed() {
- this.setData({
- "detail.accountclass.rebate_used": this.data.detail.accountclass.rebate_used == 0 ? 1 : 0
- })
- let res = await this.changeDetail();
- if (res.msg != '成功') this.setData({
- "detail.accountclass.rebate_used": this.data.detail.accountclass.rebate_used == 0 ? 1 : 0
- });
- },
- })
|