123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- const _Http = getApp().globalData.http,
- getTime = require("../../utils/getTime")
- Page({
- data: {
- loading: true,
- sa_paybillid: null,
- tabsActive: 1,
- currentDate: new Date().getTime(),
- formatter(type, value) {
- if (type === 'year') {
- return value + getApp().globalData.Language.getMapText('年');
- }
- if (type === 'month') {
- return value + getApp().globalData.Language.getMapText('月');
- }
- return value;
- },
- show: false,
- tabsList: [{
- label: "详细信息",
- icon: "icon-tabchanpin"
- }, {
- label: "打款明细",
- icon: "icon-tabcaozuojilu1",
- model: "#remitVoucher"
- }],
- tabbarsList: []
- },
- onLoad(options) {
- this.setData({
- sa_paybillid: options.id
- });
- this.getDetail(true);
- getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
- },
- /* 获取详情 */
- getDetail(init = false, show = true) {
- _Http.basic({
- "id": 20221226153404,
- "content": {
- nocache: true,
- "sa_paybillid": this.data.sa_paybillid
- }
- }, show).then(res => {
- console.log("出货详情", res)
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- let tabbarsList = []
- if (res.data.status == '新建') tabbarsList = [{
- label: "编辑",
- icon: "icon-dibu-bianji"
- }, {
- label: "提交",
- icon: "icon-tijiao",
- }, {
- label: "删除",
- icon: "icon-guanlian-shanchu"
- }]
- if (res.data.status == '提交') tabbarsList = [{
- label: "审核",
- icon: "icon-shenhe"
- }, {
- label: "退回",
- icon: "icon-a-fanshenhetuihui"
- }]
- if (res.data.status == '审核') tabbarsList = [{
- label: "退回",
- icon: "icon-a-fanshenhetuihui"
- }]
- this.setPreview(res.data);
- this.setData({
- detail: res.data,
- tabbarsList,
- loading: false
- });
- if (init) this.partialRenewal(true)
- })
- },
- /* 设置详情信息 */
- setPreview(data) {
- let list1 = [{
- label: "凭证单号",
- value: data.billno
- }, {
- label: "状态",
- value: getApp().globalData.Language.getMapText(data.status),
- style:`color:${this.data.sColors[data.status]}`
- }, {
- label: "经销商编号",
- value: data.agentnum
- }, {
- label: "经销商简称",
- value: data.enterprisename
- }, {
- label: "回款归属月份",
- value: data.period
- }, {
- label: "打款金额",
- value: data.amount
- }],
- list2 = [{
- label: "创建人",
- value: data.createby
- }, {
- label: "创建时间",
- value: data.createdate
- }, {
- label: "审核人",
- value: data.checkby
- }, {
- label: "审核时间",
- value: data.checkdate
- }, {
- label: "付款人",
- value: data.payer
- }, {
- label: "付款时间",
- value: data.paydate
- }];
- this.setData({
- list1,
- list2
- })
- },
- /* 审核选择弹出框关闭 */
- onClose() {
- this.setData({
- show: false
- })
- },
- /* 审核提交 */
- async checkSubmit({
- detail
- }) {
- let res = await _Http.basic({
- "id": "20221226153304",
- "content": {
- "sa_paybillid": this.data.sa_paybillid,
- "period": getTime.formatTime(new Date(detail), '-').split(' ')[0]
- }
- })
- if (res.code == '1') {
- this.setData({
- show: false
- })
- this.getDetail(true)
- }
- },
- tabbarOnClick({
- detail
- }) {
- switch (detail.label) {
- case "编辑":
- wx.navigateTo({
- url: `/packageA/remitVoucher/update?rowData=${JSON.stringify(this.data.detail)}`,
- })
- break;
- case "提交":
- wx.showModal({
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否确认提交该打款凭证') + `?`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": "20221226153204",
- "content": {
- "sa_paybillid": this.data.sa_paybillid
- }
- }).then(res => {
- wx.showToast({
- title: res.code == '1' ? getApp().globalData.Language.getMapText('已提交改打款凭证') : res.msg,
- icon: "none"
- });
- if (res.code == '1') {
- this.getDetail()
- let pages = getCurrentPages(),
- page = pages[pages.length - 2]
- page.getList(true)
- }
- })
- }
- })
- break;
- case "审核":
- getApp().globalData.Language.showToast('请选择回款日期')
- this.setData({
- show: true
- })
- break;
- case "退回":
- wx.showModal({
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否确认退回该打款凭证') + `?`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 20221227110104,
- "content": {
- sa_paybillid: this.data.sa_paybillid
- }
- }).then(res => {
- wx.showToast({
- title: res.code == '1' ? getApp().globalData.Language.getMapText('已退回该凭证') : res.msg,
- icon: "none"
- });
- if (res.code == '1') {
- this.getDetail()
- }
- })
- }
- })
- break;
- case "删除":
- wx.showModal({
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否删除该凭证') + `?`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 20221226153104,
- "content": {
- sa_paybillids: [this.data.sa_paybillid]
- }
- }).then(res => {
- wx.showToast({
- title: res.code == '1' ? getApp().globalData.Language.getMapText('删除成功') : res.msg,
- icon: "none"
- });
- if (res.code == '1') {
- setTimeout(() => {
- wx.navigateBack()
- getCurrentPages()[getCurrentPages().length - 2].getList(true)
- }, 300)
- }
- })
- }
- })
- break;
- }
- },
- //tabs 切换
- tabsChange({
- detail
- }) {
- this.setData({
- tabsActive: detail
- });
- console.log(this.data.tabsActive);
- 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.detail.sa_paybillid;
- if (total == null || init) {
- Component.getList(id, init);
- } else if (pageNumber <= pageTotal) {
- Component.getList(id, false);
- }
- }
- },
- onReachBottom() {
- this.partialRenewal();
- },
- onUnload() {
- let page = getCurrentPages().find(v => v.__route__ == 'packageA/remitVoucher/index');
- let content = JSON.parse(JSON.stringify(page.data.content));
- content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
- content.pageNumber = 1;
- _Http.basic({
- "id": 20221226152904,
- content
- }).then(res => {
- console.log("更新订单列表", res)
- if (res.code == '1') page.setData({
- list: res.data
- })
- })
- },
- })
|