| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- /*******************************************************************************
- * Copyright(c) 2022 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称: 出库办理列表
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * jyh 2024-03-12 1.00
- *******************************************************************************/
- const Constants = require('@/utils/Constants.js');
- const mixins = require('@/mixins/index.js');
- const app = getApp()
- Page({
- mixins: [mixins],
- /**
- * 页面的初始数据
- */
- data: {
- isfirst: true,
- tagList: [{
- title: mixins.$t('outboundProcessing')
- },
- {
- title: mixins.$t('checkouted')
- }
- ],
- // 查询条件
- searchContent: [{
- code: 'makeTime',
- title: mixins.$t('pastThirthtyDays'),
- defaultValue: 5,
- searchType: Constants.searchType.date
- }, {
- code: 'choose',
- title: mixins.$t('choose'),
- searchType: Constants.searchType.pick
- }],
- // 查询条件-筛选
- pullMenuList: [{
- code: 'outType',
- pullType: 'mSelect',
- typeName: 'outType'
- },
- // {
- // code: 'outReason',
- // pullType: 'mSelect',
- // typeName: 'outReason'
- // },
- {
- code: 'cusName',
- },
- {
- code: 'cusPhone',
- },
- {
- code: 'addressFull',
- },
- {
- code: 'staffName',
- },
- {
- code: 'orgName',
- },
- {
- code: 'supName',
- },
- {
- code: 'flgValid',
- title: mixins.$t('flgValid'),
- dataType: 'checkbox'
- },
- ],
- // 列表区(脚部金额)
- footerAmount: {
- name: 'outingAmt',
- title: mixins.$t('totalAmount')
- },
- // 列表区(脚部信息)
- footerInfo: [{
- prefix: mixins.$t('together'),
- name: 'outQty',
- title: mixins.$t('piece')
- }],
- // 列表区(内容)
- contentList: [],
- // 列表的显示字段
- contentObj: {
- '销售出库': [{
- name: 'outNo',
- title: mixins.$t('outOrderNo')
- }, {
- name: 'cusPhone',
- title: mixins.$t('cusPhone')
- }, {
- name: 'addressFull',
- title: mixins.$t('addressFull')
- }, {
- name: [{
- name: 'orgName',
- title: ''
- }, {
- name: 'staffName',
- title: mixins.$t('staffId')
- }],
- title: mixins.$t('storeInformation')
- }, {
- name: 'outDate',
- title: mixins.$t('outDate')
- }],
- '采退出库': [{
- name: 'outNo',
- title: mixins.$t('outOrderNo')
- }, {
- name: 'addressFull',
- title: mixins.$t('returnAddress')
- }, {
- name: [{
- name: 'orgName',
- title: ''
- }, {
- name: 'staffName',
- title: mixins.$t('staffId')
- }],
- title: mixins.$t('returnInfo')
- }, {
- name: 'outDate',
- title: mixins.$t('outDate')
- }],
- '其他出库': [{
- name: 'outNo',
- title: mixins.$t('outOrderNo')
- }, {
- name: 'outReasonName',
- title: mixins.$t('reasonOutbound')
- }, {
- name: [{
- name: 'orgName',
- title: ''
- }, {
- name: 'staffName',
- title: mixins.$t('staffId')
- }],
- title: mixins.$t('cpManager')
- }, {
- name: 'outDate',
- title: mixins.$t('outDate')
- }],
- },
- // 弹出按钮
- buttonList: [
- {
- name: 'editOrder',
- title: mixins.$t('edit'),
- },
- {
- name: 'invaidOrder',
- title: mixins.$t('invaidOrder'),
- },
- {
- name: 'ticketPirnt',
- title: mixins.$t('ticketPirnt'),
- }
- ],
- // 底部保存按钮
- buttonFootList: [{
- name: 'addOther',
- title: mixins.$t('otherOutWh'),
- }],
- contentnFootList: [{
- title: mixins.$t('totalAmount'),
- code: 'intoingAmt',
- content: 0,
- type: 'number'
- }, {
- type: 'count',
- code: 'count',
- bill: 1,
- quantity: 2
- }],
- btnFormData: null,
- // 路由
- routeObjName: 'outbound',
- outboundOtherService: app.globalData['outboundOtherService'],
- outboundProcessingService: app.globalData['outboundProcessingService'],
- outboundSaleReturnService: app.globalData['outboundSaleReturnService'],
- inboundReturnService: app.globalData['inboundReturnService'],
- active: 0,
- // 主键Id
- primaryKey: 'outId',
- },
- /**
- * @desc :切换 已出库 未出库
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- onChangeTabs(e) {
- let index = e.detail.detail.index
- this.setData({
- active: index,
- })
-
- this.searchData()
- },
- /**
- * @desc : addOther
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- addOther() {
- wx.navigateTo({
- url: this.data.route.addOther.url,
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
- res.eventChannel.emit('params', {})
- }
- })
- },
- /**
- * @desc : 跳转明细
- * @author : 周兴
- * @date : 2024/1/22
- */
- toDetail(e) {
- if (e) {
- let item = e.detail.item;
- if (e.detail.item) {
- let button = {
- formMode: Constants.formMode.edit
- }
- e.detail.item.button = button
- }
- // 如果name不传递,默认为edit
- if (item.outType == Constants.outType.sale || item.outType == Constants.outType.other) {
- e.detail.name = 'edit'
- } else {
- e.detail.name = 'editReturn'
- }
- }
- this.open(e);
- },
- /**
- * @desc : 设置查询参数
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- setSearchParams(params) {
- console.log(params);
- if (this.data.active == 0) {
- //待出库的查询参数
- params.intoStatus = Constants.intoStatus.inBounding
- params.outStatus = Constants.outStatus.outBounding
- }
- if (this.data.active == 1) {
- //已出库的查询参数
- params.intoStatus = Constants.intoStatus.inBounded
- params.outStatus = Constants.outStatus.outBounded
- }
- params.outTypes = params.outTypeList
- //采购订单明细 跳转到出库办理
- let isfirst = this.data.isfirst
- let purNo = this.data.item ? this.data.item.purNo : null
- if (isfirst && purNo) { //第一次进入 取传过来的
- let searchForm = this.data.searchForm ? JSON.parse(this.data.searchForm) : {}
- searchForm.searchText = purNo || ''
- this.setData({
- searchForm: JSON.stringify(searchForm),
- searchText: purNo || '',
- })
- params.searchForm = JSON.stringify(searchForm)
- params.searchText = purNo
- }
- this.setData({
- isfirst: false
- })
- return params;
- },
- /**
- * @desc : 查询 出库单
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- getData(params) {
- return this.excute(this.data.outboundOtherService, this.data.outboundOtherService.selectOutbound, params);
- },
- /**
- * @desc : 处理接口返回数据
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- handleSearchData(tableData) {
- let temp = tableData
- let contentnFootList = this.data.contentnFootList
- let footerAmount = this.data.footerAmount
- let footerInfo = this.data.footerInfo
- let outingQty = Number(0)
- let outingAmt = Number(0)
- if (this.data.active == 0) {
- // 列表区(脚部金额)
- footerAmount.name = 'outingAmt'
- // 列表区(脚部信息)
- footerInfo[0].name = 'outingQty'
- temp.forEach(it => {
- it.makeTime = it.makeTime.substring(0, 10)
- outingQty += Math.abs(Number(it.outingQty))
- outingAmt += Math.abs(Number(it.outingAmt))
- // 出库对象
- if (it.outType == Constants.outType.other) {
- it.outObject = it.cusName != null ? it.cusName : it.supplierName
- }
- })
- } else {
- // 列表区(脚部金额)
- footerAmount.name = 'outAmt'
- // 列表区(脚部信息)
- footerInfo[0].name = 'outQty'
- temp.forEach(it => {
- it.makeTime = it.makeTime.substring(0, 10)
- outingQty += Math.abs(Number(it.outQty))
- outingAmt += Math.abs(Number(it.outAmt))
- // 出库对象
- if (it.outType == Constants.outType.other) {
- it.outObject = it.cusName != null ? it.cusName : it.supplierName
- }
- })
- }
- contentnFootList.forEach(it => {
- if (it.type == 'count') {
- it.bill = tableData.length
- it.quantity = outingQty
- }
- if (it.type == 'number') {
- it.content = outingAmt
- }
- })
- this.setData({
- tableData: temp,
- footerInfo,
- footerAmount,
- contentnFootList,
- })
- },
- /**
- * @desc : 三个小点点击回调
- * @date : 2024年3月8日
- * @author : 姜永辉
- */
- toPoint(e) {
- console.log("toPoint", e);
- let item = e.detail.item
- if (item.flgValid) {
- // 待入库
- if (this.data.active == 0) {
- this.setData({
- buttonList: [
- {
- name: 'editOrder',
- title: mixins.$t('edit'),
- },
- {
- name: 'invaidOrder',
- title: mixins.$t('invaidOrder'),
- }, {
- name: 'ticketPirnt',
- title: mixins.$t('ticketPirnt'),
- }
- ],
- })
- } else {
- // 参数自动出入库:作废显示没有撤回
- if (item.flgHandleSetting == "true") {
- this.setData({
- buttonList: [
- {
- name: 'editOrder',
- title: mixins.$t('edit'),
- },
- {
- name: 'invaidOrder',
- title: mixins.$t('invaidOrder'),
- }, {
- name: 'ticketPirnt',
- title: mixins.$t('ticketPirnt'),
- }
- ],
- })
- } else {
- // 参数手动出入库:撤回显示没有作废
- this.setData({
- buttonList: [
- {
- name: 'editOrder',
- title: mixins.$t('edit'),
- },
- {
- name: 'ticketPirnt',
- title: mixins.$t('ticketPirnt'),
- },
- {
- name: 'returnCancel',
- title: mixins.$t('returnCancel'),
- }
- ],
- })
- }
- }
- } else {
- this.setData({
- // 弹出按钮
- buttonList: [{
- name: 'ticketPirnt',
- title: mixins.$t('ticketPirnt') //打印票据
- }],
- })
- }
- },
- /**
- * @desc : (撤销)
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- returnCancel(e) {
- let item = e
- let id = item.outId
- // 销售出库
- if (item.outType == Constants.outType.sale) {
- this.excute(this.data.outboundProcessingService, this.data.outboundProcessingService.outBoundCancel, item).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- }
- // 其他出库
- else if (item.outType == Constants.outType.other) {
- this.excute(this.data.outboundOtherService, this.data.outboundOtherService.outBoundCancel, item).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- // 采购退货
- } else {
- this.excute(this.data.inboundReturnService, this.data.inboundReturnService.inboundReturnCancel, {
- intoId: id
- }).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- }
- },
- /**
- * @desc : (编辑)
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- editOrder(e) {
- let item = e
- let id = item.outId
- // 销售出库
- if (item.outType == Constants.outType.sale) {
- wx.navigateTo({
- url: this.data.route.add.url,
- events: {
- // 回调后,在这里给页面赋值
- bandData: function (e) { }
- },
- success: function (res) {
- res.eventChannel.emit('params', {
- id: id,
- formMode: Constants.formMode.edit
- })
- }
- })
- }
- // 其他出库
- else if (item.outType == Constants.outType.other) {
- wx.navigateTo({
- url: this.data.route.addOther.url,
- events: {
- // 回调后,在这里给页面赋值
- bandData: function (e) { }
- },
- success: function (res) {
- res.eventChannel.emit('params', {
- id: id,
- formMode: Constants.formMode.edit
- })
- }
- })
- // 销售退货
- } else {
- wx.navigateTo({
- url: this.data.route.addReturn.url,
- events: {
- // 回调后,在这里给页面赋值
- bandData: function (e) { }
- },
- success: function (res) {
- res.eventChannel.emit('params', {
- id: id,
- formMode: Constants.formMode.edit
- })
- }
- })
- }
- },
- /**
- * @desc : 作废
- * @date : 2024/2/1 15:49
- * @author : 姜永辉
- */
- invaidOrder(e) {
- let item = e
- let id = item.outId
- // 销售出库
- if (item.outType == Constants.outType.sale) {
- this.excute(this.data.outboundProcessingService, this.data.outboundProcessingService.outboundRepeal + id, null).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- }
- // 其他出库
- else if (item.outType == Constants.outType.other) {
- this.excute(this.data.outboundOtherService, this.data.outboundOtherService.outboundRepeal + id, null).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- // 采购退货
- } else {
- this.excute(this.data.inboundReturnService, this.data.inboundReturnService.cancel, {
- intoId: id
- }).then(res => {
- if (res.data.code == Constants.SUCESS_CODE) {
- // 重新查询
- this.searchData()
- }
- })
- }
- },
- })
|