|
|
@@ -1,6 +1,7 @@
|
|
|
const Constants = require('@/utils/Constants.js');
|
|
|
import Dialog from '@/dist/dialog/dialog.js';
|
|
|
const mixins = require('@/mixins/index.js')
|
|
|
+const utils = require('@/utils/util')
|
|
|
const app = getApp()
|
|
|
Page({
|
|
|
mixins: [mixins],
|
|
|
@@ -59,8 +60,8 @@ Page({
|
|
|
{ code: 'receivable', content: 0, type: 'number' }
|
|
|
],
|
|
|
popContent: [
|
|
|
- { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true },
|
|
|
- { code: 'priceOut', type: 'number', title: mixins.$t("priceSale"), required: true },
|
|
|
+ { code: 'outQty', type: 'step', title: mixins.$t("count"), required: true },
|
|
|
+ { code: 'priceOut', type: 'number', title: mixins.$t("priceOut"), required: false, readonly: true },
|
|
|
{
|
|
|
code: 'whId', name: 'whName', choosePopupType: 'inventorySku', title: mixins.$t("warehouseId"), type: 'choose', urlKey: 'selectInventorySku',
|
|
|
},
|
|
|
@@ -84,7 +85,7 @@ Page({
|
|
|
},
|
|
|
success: function (res) {
|
|
|
res.eventChannel.emit('params', {
|
|
|
- formMode:'edit',id:this_.data.id
|
|
|
+ formMode: 'detailEdit', id: this_.data.id
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
@@ -134,16 +135,29 @@ Page({
|
|
|
* @author : 于继渤
|
|
|
*/
|
|
|
setParams(params) {
|
|
|
- params.goodsList.forEach(res=>{
|
|
|
- console.log(res)
|
|
|
+ //设置转出库参数
|
|
|
+ if (this.data.formMode == 'other') {
|
|
|
+
|
|
|
+ }
|
|
|
+ params.fromId = params.orderId
|
|
|
+ params.outingAmt = params.outAmt
|
|
|
+ params.outingQty = params.outQty
|
|
|
+ params.outAmt = null
|
|
|
+ params.outQty = null
|
|
|
+ params.goodsList.forEach(res => {
|
|
|
+ res.outingAmt = res.outAmt
|
|
|
+ res.outingQty = res.outQty
|
|
|
+ res.outAmt = null
|
|
|
+ res.outQty = null
|
|
|
})
|
|
|
+
|
|
|
params.itemList = params.goodsList //明细
|
|
|
params.makeStaff = app.globalData.user.staffId
|
|
|
// params.deleteItemList = params.deleteList ? params.deleteList : []
|
|
|
let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
|
|
|
params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出库标识
|
|
|
params.addressName = params.address.addressName
|
|
|
- params.objectId = params.cusId
|
|
|
+ params.outDate = utils.formatDayTime(new Date())
|
|
|
delete params['goodsList']
|
|
|
delete params['orderItemResponseList']
|
|
|
console.log('params', params)
|
|
|
@@ -156,14 +170,15 @@ Page({
|
|
|
* @author : 于继渤
|
|
|
*/
|
|
|
saveData() {
|
|
|
- if (this.data.formMode == Constants.formMode.edit && this.data.formType !== Constants.formMode.detail) { //编辑
|
|
|
+ if (this.data.formMode == Constants.formMode.detailEdit) { //编辑
|
|
|
+ //limitEdit 编辑标识 true 大
|
|
|
+ this.data.params.limitEdit = true
|
|
|
return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.outboundUpdate, this.data.params);
|
|
|
- } else if(this.data.formMode == Constants.formMode.add && this.data.formType !== Constants.formMode.detail){ //新建
|
|
|
+ } else if (this.data.formMode == Constants.formMode.add || this.data.formMode == Constants.formMode.other) { //新建
|
|
|
return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.outboundInsert, this.data.params);
|
|
|
- }else if(this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail){ //办理
|
|
|
+ } else if (this.data.formMode == Constants.formMode.detail) { //办理
|
|
|
return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.handleOutbound, this.data.params);
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -171,8 +186,12 @@ Page({
|
|
|
* @date : 2024/2/1 15:49
|
|
|
* @author : 于继渤
|
|
|
*/
|
|
|
- getItemDetal(orderId) {
|
|
|
- return this.excute(this.data.orderService, this.data.orderService.getOrderForOut + '/' + orderId, {}).then(res => {
|
|
|
+ getItemDetal(id, Service, API) { //get_outbound_for_update
|
|
|
+ if (!Service) {
|
|
|
+ Service = 'orderService'
|
|
|
+ API = 'getOrderForOut'
|
|
|
+ }
|
|
|
+ return this.excute(this.data[Service], this.data[Service][API] + '/' + id, {}).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
formData = res.data.data.data
|
|
|
@@ -180,6 +199,14 @@ Page({
|
|
|
formData.fromNo = formData.orderNo
|
|
|
//处理地址
|
|
|
formData.address = this.setAddress(formData)
|
|
|
+ //处理明细
|
|
|
+ if (res.data.data.dataItem && res.data.data.dataItem.length > 0) {
|
|
|
+ res.data.data.dataItem.forEach(item => {
|
|
|
+ item.outQty = item.orderQty ? item.orderQty : item.outingQty //出库数量
|
|
|
+ item.outQtyMax = item.canOutingQty //可出库最大值
|
|
|
+ item.outQtyMin = 1 //可出库最小值
|
|
|
+ })
|
|
|
+ }
|
|
|
formData.goodsList = res.data.data.dataItem
|
|
|
//处理默认值 业务员业务部门
|
|
|
formData = this.setStaffOrg(formData)
|
|
|
@@ -226,7 +253,21 @@ Page({
|
|
|
this.getItemDetal(data.orderId)
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ /**
|
|
|
+ * @desc : 设置商品
|
|
|
+ * @date : 2024/2/1 15:49
|
|
|
+ * @author : 于继渤
|
|
|
+ */
|
|
|
+ setGoods(e) {
|
|
|
+ //设置需收款
|
|
|
+ let contentSaveList = this.data.contentSaveList
|
|
|
+ let formData = JSON.parse(this.data.formData)
|
|
|
+ //组件显示 需收款
|
|
|
+ contentSaveList[2]['content'] = Number(formData.sumAmount)
|
|
|
+ this.setData({
|
|
|
+ contentSaveList: contentSaveList
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 选择回调
|
|
|
* @author : 于继渤
|
|
|
@@ -320,16 +361,18 @@ Page({
|
|
|
formData.goodsList.forEach(item => {
|
|
|
//标价合计 = 商品标价 x 商品数量
|
|
|
sumStandard += item.amtStd
|
|
|
- item.outingAmt = item.outingQty * item.priceOut
|
|
|
- sumAmount += item.outingQty * item.priceOut //没有售价默认取标价
|
|
|
- sumQuantity += item.outingQty //数量
|
|
|
+ item.outAmt = item.outQty * item.priceOut
|
|
|
+ sumAmount += item.outQty * item.priceOut
|
|
|
+ sumQuantity += item.outQty //数量
|
|
|
})
|
|
|
formData.sumStandard = sumStandard
|
|
|
formData.saleDiscount = Number((sumAmount / sumStandard) * 100).toFixed(2)
|
|
|
formData.sumAmount = sumAmount
|
|
|
+ formData.outAmt = sumAmount
|
|
|
formData.canUseCollect = 0
|
|
|
formData.useCollect = 0
|
|
|
formData.sumQuantity = sumQuantity
|
|
|
+ formData.outQty = sumQuantity
|
|
|
let cardList = this.data.cardList
|
|
|
let contentSaveList = this.data.contentSaveList
|
|
|
cardList[2].sumAmount = formData.sumAmount
|
|
|
@@ -337,7 +380,7 @@ Page({
|
|
|
cardList[2].sumQuantity = formData.sumQuantity
|
|
|
cardList[2].saleDiscount = formData.saleDiscount
|
|
|
//详情 办理
|
|
|
- if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) {
|
|
|
+ if (this.data.formMode == Constants.formMode.detail) {
|
|
|
contentSaveList[1].content = formData.sumAmount
|
|
|
} else {
|
|
|
contentSaveList[2].content = formData.sumAmount
|
|
|
@@ -350,25 +393,7 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- /**
|
|
|
- * @desc : 设置商品
|
|
|
- * @date : 2024/2/1 15:49
|
|
|
- * @author : 于继渤
|
|
|
- */
|
|
|
- setGoods(e) {
|
|
|
- //设置需收款
|
|
|
- let formData = JSON.parse(this.data.formData)
|
|
|
- let index = 0
|
|
|
- formData.goodsList.forEach(res => {
|
|
|
- //处理出库字段
|
|
|
- res.priceOut = res.priceSale
|
|
|
- res.outingQty = res.itemQty
|
|
|
- res.itemIndex = index++
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- formData: JSON.stringify(formData)
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
/**
|
|
|
* @desc : 设置顶部默认值
|
|
|
* @date : 2024/3/28 15:49
|
|
|
@@ -430,7 +455,7 @@ Page({
|
|
|
{ name: 'other', title: mixins.$t("otherInfo") }
|
|
|
]
|
|
|
//详情(办理)
|
|
|
- if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) {
|
|
|
+ if (this.data.formMode == Constants.formMode.detail) {
|
|
|
//按钮
|
|
|
buttonSaveList = [
|
|
|
{ code: 'save', title: mixins.$t("outProcessing"), width: '120rpx', color: '#1B365D' }
|
|
|
@@ -440,7 +465,7 @@ Page({
|
|
|
{ code: 'receivable', content: 0, type: 'number' }
|
|
|
]
|
|
|
popContent = [
|
|
|
- { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true, readonly: true },
|
|
|
+ { code: 'outQty', type: 'step', title: mixins.$t("count"), required: true, readonly: true },
|
|
|
{ code: 'priceOut', type: 'number', title: mixins.$t("priceSale"), required: true, readonly: true },
|
|
|
|
|
|
{ code: 'whName', title: mixins.$t("warehouseId"), type: 'str', readonly: true, readonly: true },
|
|
|
@@ -471,22 +496,20 @@ Page({
|
|
|
} else if (this.data.formMode == Constants.formMode.add) { //新建
|
|
|
//处理默认值 业务员业务部门
|
|
|
formData = this.setStaffOrg(formData)
|
|
|
- const eventChannel = this.getOpenerEventChannel()
|
|
|
- eventChannel.on('params', function (data) {
|
|
|
- console.log('新建', data)
|
|
|
- })
|
|
|
- } else if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) { //详情
|
|
|
+ } else if (this.data.formMode == Constants.formMode.detail) { //详情
|
|
|
//详情办理
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '销售出库详情'
|
|
|
})
|
|
|
//设置只读
|
|
|
this.setFormMain()
|
|
|
- } else if (this.data.formMode == Constants.formMode.edit && !this.data.formType) {
|
|
|
+ this.getItemDetal(this.data.id, 'saleOutBoundService', 'getOutboundForUpdate')
|
|
|
+ } else if (this.data.formMode == Constants.formMode.detailEdit) {
|
|
|
//编辑
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '编辑销售出库'
|
|
|
})
|
|
|
+ this.getItemDetal(this.data.id, 'saleOutBoundService', 'getOutboundForUpdate')
|
|
|
}
|
|
|
this.setData({
|
|
|
formData: JSON.stringify(formData)
|