|
@@ -1,117 +1,159 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
|
|
|
Page({
|
|
|
- data: {
|
|
|
- sa_orderid: null,
|
|
|
- tabsActive: 0,
|
|
|
- tabsList: [{
|
|
|
- label: "产品明细",
|
|
|
- icon: "icon-tabxiangxixinxi1"
|
|
|
- }, {
|
|
|
- label: "附件",
|
|
|
- icon: "icon-tabgenjinjilu"
|
|
|
- }, {
|
|
|
- label: "订单进度",
|
|
|
- icon: "icon-tabcaozuojilu1"
|
|
|
- }, {
|
|
|
- label: "发票",
|
|
|
- icon: "icon-tabgenjinjilu"
|
|
|
- }],
|
|
|
- },
|
|
|
- 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
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- /* 更新数据 */
|
|
|
- changeDetail() {
|
|
|
- let data = this.data.detail,
|
|
|
- content = {
|
|
|
- "sa_orderid": data.sa_orderid,
|
|
|
- "sys_enterpriseid": data.sys_enterpriseid, //订货企业id
|
|
|
- "sa_accountclassid": data.accountclass.sa_accountclassid, //营销账户类型ID
|
|
|
- "sa_brandid": data.sa_brandid, //品牌ID
|
|
|
- "sys_enterprise_financeid": data.finance.sys_enterprise_financeid, //合作企业财务信息ID(开票信息)
|
|
|
- "sa_logiscompid": data.logiscomp.sa_logiscompid, //物流公司档案ID
|
|
|
- "rec_contactsid": data.contacts.contactsid, //合作企业联系人表ID(收货信息)
|
|
|
- "type": data.type, //订单类型
|
|
|
- "typemx": data.typemx, // 明细分类,可选
|
|
|
- "remarks": data.remarks,
|
|
|
- "saler_hrid": data.saler_hrid, //销售人员hrid,业务员hrid
|
|
|
- "tradefield": "消防", //必选
|
|
|
- "pay_enterpriseid": data.pay_enterpriseid, //结算单位
|
|
|
- "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
|
|
|
- "rebate_used": data.accountclass.rebate_used, //默认0,是否使用返利金
|
|
|
- "billdate": data.billdate, //单据日期,默认创建日期
|
|
|
- };
|
|
|
- if (content.type != '标准订单') {
|
|
|
- //"sa_contractid": 1, 合同ID,标准订单不传
|
|
|
- //"sa_projectid": 1, 工程项目表ID,标准订单不传
|
|
|
- }
|
|
|
- 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)
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
+ data: {
|
|
|
+ sa_orderid: null,
|
|
|
+ tabsActive: 0,
|
|
|
+ tabsList: [{
|
|
|
+ label: "产品明细",
|
|
|
+ icon: "icon-tabxiangxixinxi1"
|
|
|
+ }, {
|
|
|
+ label: "附件",
|
|
|
+ icon: "icon-tabgenjinjilu"
|
|
|
+ }, {
|
|
|
+ label: "订单进度",
|
|
|
+ icon: "icon-tabcaozuojilu1"
|
|
|
+ }, {
|
|
|
+ label: "发票",
|
|
|
+ icon: "icon-tabgenjinjilu"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //tabs 切换
|
|
|
+ tabsChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ tabsActive: detail
|
|
|
+ });
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ //局部数据更新 tabs
|
|
|
+ partialRenewal(init = false) {
|
|
|
+ let id = this.data.detail.sa_orderid;
|
|
|
+ let model = '';
|
|
|
+ let name = this.data.tabsList[this.data.tabsActive].label;
|
|
|
+ switch (name) {
|
|
|
+ case "产品明细":
|
|
|
+ model = "#Product"
|
|
|
+ break;
|
|
|
+ case "附件":
|
|
|
+ model = "#Files"
|
|
|
+ break;
|
|
|
+ };
|
|
|
+ if (model) {
|
|
|
+ let Component = this.selectComponent(model);
|
|
|
+ const {
|
|
|
+ total,
|
|
|
+ pageNumber,
|
|
|
+ pageTotal
|
|
|
+ } = Component.data.content;
|
|
|
+ if (total == null || init) {
|
|
|
+ Component.getList(id, init);
|
|
|
+ } else if (pageNumber <= pageTotal) {
|
|
|
+ Component.getList(id, false);
|
|
|
+ } else {
|
|
|
+ //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ /* 更新数据 */
|
|
|
+ changeDetail() {
|
|
|
+ let data = this.data.detail,
|
|
|
+ content = {
|
|
|
+ "sa_orderid": data.sa_orderid,
|
|
|
+ "sys_enterpriseid": data.sys_enterpriseid, //订货企业id
|
|
|
+ "sa_accountclassid": data.accountclass.sa_accountclassid || 0, //营销账户类型ID
|
|
|
+ "sa_brandid": data.sa_brandid, //品牌ID
|
|
|
+ "sys_enterprise_financeid": data.finance.sys_enterprise_financeid, //合作企业财务信息ID(开票信息)
|
|
|
+ "sa_logiscompid": data.logiscomp.sa_logiscompid, //物流公司档案ID
|
|
|
+ "rec_contactsid": data.contacts.contactsid || 0, //合作企业联系人表ID(收货信息)
|
|
|
+ "type": data.type, //订单类型
|
|
|
+ "typemx": data.typemx, // 明细分类,可选
|
|
|
+ "remarks": data.remarks,
|
|
|
+ "saler_hrid": data.saler_hrid, //销售人员hrid,业务员hrid
|
|
|
+ "tradefield": data.tradefield, //必选
|
|
|
+ "pay_enterpriseid": data.pay_enterpriseid, //结算单位
|
|
|
+ "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
|
|
|
+ "rebate_used": data.accountclass.rebate_used, //默认0,是否使用返利金
|
|
|
+ "billdate": data.billdate, //单据日期,默认创建日期
|
|
|
+ };
|
|
|
+ if (content.type != '标准订单') {
|
|
|
+ //"sa_contractid": 1, 合同ID,标准订单不传
|
|
|
+ //"sa_projectid": 1, 工程项目表ID,标准订单不传
|
|
|
+ }
|
|
|
+ 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
|
|
|
- });
|
|
|
- },
|
|
|
+ /* 修改订单备注 */
|
|
|
+ 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
|
|
|
+ });
|
|
|
+ },
|
|
|
})
|