|
|
@@ -15,7 +15,7 @@ Page({
|
|
|
table: Constants.tables.order,
|
|
|
orderService: app.globalData['orderService'],
|
|
|
commonService: app.globalData['commonService'],
|
|
|
- saveButtonFlag:true,
|
|
|
+ saveButtonFlag: true,
|
|
|
saleOutBoundReturnService: app.globalData['saleOutBoundReturnService'],
|
|
|
btnFormData: JSON.stringify({
|
|
|
flag: app.globalData.setting[Constants.settingCode.IVT001] == "true" ? true : false
|
|
|
@@ -73,7 +73,7 @@ Page({
|
|
|
type: 'str',
|
|
|
required: true,
|
|
|
title: mixins.$t('addressNo')
|
|
|
- },
|
|
|
+ },
|
|
|
{
|
|
|
code: 'cusFrom',
|
|
|
name: 'cusFromName',
|
|
|
@@ -156,12 +156,6 @@ Page({
|
|
|
urlKey: 'openingInventory',
|
|
|
},
|
|
|
{
|
|
|
- code: 'brandName',
|
|
|
- title: mixins.$t('brandName'),
|
|
|
- type: 'str',
|
|
|
- readonly: true,
|
|
|
- },
|
|
|
- {
|
|
|
code: 'nonStdCode',
|
|
|
title: mixins.$t("goodsBatch"),
|
|
|
type: 'str',
|
|
|
@@ -196,62 +190,64 @@ Page({
|
|
|
* @date : 2024/2/1 15:49
|
|
|
* @author : 于继渤
|
|
|
*/
|
|
|
- setGoods(e) {
|
|
|
+ setGoods(e) {
|
|
|
//设置需收款
|
|
|
let contentSaveList = this.data.contentSaveList
|
|
|
let formData = e.detail.data
|
|
|
- if(formData){
|
|
|
+ if (formData) {
|
|
|
let itemIndex = 0
|
|
|
let list = []
|
|
|
- if(formData.goodsList && formData.goodsList.length > 0){
|
|
|
+ if (formData.goodsList && formData.goodsList.length > 0) {
|
|
|
formData.goodsList.forEach(res => {
|
|
|
- res.itemIndex = itemIndex++
|
|
|
- list.push({
|
|
|
- skuId: res.skuId,
|
|
|
- nonStdCode: res.nonStdCode,
|
|
|
- whId: res.whId
|
|
|
- })
|
|
|
- res.sumPrice = res.priceOut * res.itemQty
|
|
|
+ if (res.skuId) {
|
|
|
+ res.itemIndex = itemIndex++
|
|
|
+ list.push({
|
|
|
+ skuId: res.skuId,
|
|
|
+ nonStdCode: res.nonStdCode,
|
|
|
+ whId: res.whId
|
|
|
+ })
|
|
|
+ res.sumPrice = res.priceOut * res.itemQty
|
|
|
+ }
|
|
|
})
|
|
|
- //批量查库存
|
|
|
- this.getInventory({
|
|
|
- skuIdNonStdCodeWhIdList: list
|
|
|
- }).then(item => {
|
|
|
- formData.goodsList.forEach(res => {
|
|
|
- if (item.length > 0) {
|
|
|
- item.forEach(it => {
|
|
|
- if (it.nonStdCode == res.nonStdCode && it.skuId == res.skuId && it.whId == res.whId) {
|
|
|
- res.invId = it.invId
|
|
|
- res.invQty = it.invQty ? it.invQty : 0
|
|
|
- res.usableQty = it.usableQty ? it.usableQty : 0
|
|
|
- } else {
|
|
|
- res.invQty = 0
|
|
|
- res.usableQty = 0
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- res.invQty = 0
|
|
|
- res.usableQty = 0
|
|
|
- }
|
|
|
- })
|
|
|
- //组件显示 需收款
|
|
|
- contentSaveList.forEach(card => {
|
|
|
- if (card.code === 'receivable') {
|
|
|
- card.content = Number(formData.sumAmount)
|
|
|
- }
|
|
|
- })
|
|
|
- // contentSaveList[1]['content'] = Number(formData.sumAmount)
|
|
|
- this.setData({
|
|
|
- formData: JSON.stringify(formData),
|
|
|
- contentSaveList: contentSaveList
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ //批量查库存
|
|
|
+ this.getInventory({
|
|
|
+ skuIdNonStdCodeWhIdList: list
|
|
|
+ }).then(item => {
|
|
|
+ formData.goodsList.forEach(res => {
|
|
|
+ if (item.length > 0) {
|
|
|
+ item.forEach(it => {
|
|
|
+ if (it.nonStdCode == res.nonStdCode && it.skuId == res.skuId && it.whId == res.whId) {
|
|
|
+ res.invId = it.invId
|
|
|
+ res.invQty = it.invQty ? it.invQty : 0
|
|
|
+ res.usableQty = it.usableQty ? it.usableQty : 0
|
|
|
+ } else {
|
|
|
+ res.invQty = 0
|
|
|
+ res.usableQty = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ res.invQty = 0
|
|
|
+ res.usableQty = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //组件显示 需收款
|
|
|
+ contentSaveList.forEach(card => {
|
|
|
+ if (card.code === 'receivable') {
|
|
|
+ card.content = Number(formData.sumAmount)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // contentSaveList[1]['content'] = Number(formData.sumAmount)
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData),
|
|
|
+ contentSaveList: contentSaveList
|
|
|
+ })
|
|
|
+ //处理库存量
|
|
|
+ this.calculationSalesUsableQty()
|
|
|
})
|
|
|
- //处理库存量
|
|
|
- this.calculationSalesUsableQty()
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
//计算可售量相关
|
|
|
calculationSalesUsableQty() {
|
|
|
@@ -384,7 +380,7 @@ Page({
|
|
|
})
|
|
|
//禁用业务员业务部门
|
|
|
this.setData({
|
|
|
- satffAndOrgReadonly:true
|
|
|
+ satffAndOrgReadonly: true
|
|
|
})
|
|
|
formData.goodsList = item.itemList
|
|
|
formData.fromNo = item.fromNo
|
|
|
@@ -421,6 +417,9 @@ Page({
|
|
|
element.costAmt = null
|
|
|
element.factPrice = element.priceOut
|
|
|
element.factAmt = element.outingAmt
|
|
|
+ element['supId'] = element.supId ? element.supId : null
|
|
|
+ element['fromId'] = element.fromId ? element.fromId : element.sOutId
|
|
|
+ element['fromItemId'] = element.fromItemId ? element.fromItemId : element.sOutItemId
|
|
|
});
|
|
|
formData.sumAmtRec = nmb
|
|
|
}
|
|
|
@@ -453,7 +452,7 @@ Page({
|
|
|
refresh: function (data) {
|
|
|
// 新建銷售退貨不關閉,清空頁面
|
|
|
if (_this.data.formMode == Constants.formMode.add) {
|
|
|
- let formData = _this.setStaffOrg({})
|
|
|
+ let formData = _this.setStaffOrg({})
|
|
|
_this.setData({
|
|
|
formData: JSON.stringify(formData),
|
|
|
cardList: [{
|
|
|
@@ -488,7 +487,7 @@ Page({
|
|
|
// 通过eventChannel向被打开页面传送数据
|
|
|
res.eventChannel.emit('params', {
|
|
|
item: _this.data.formData,
|
|
|
- formReturnMode:_this.data.formReturnMode,
|
|
|
+ formReturnMode: _this.data.formReturnMode,
|
|
|
formType: 10
|
|
|
})
|
|
|
}
|
|
|
@@ -503,11 +502,11 @@ Page({
|
|
|
let item = {}
|
|
|
item.outId = this.data.id
|
|
|
this.setData({
|
|
|
- loading:true
|
|
|
+ loading: true
|
|
|
})
|
|
|
this.excute(this.data.service, this.data.service.saleReturnOutboundCancel, item).then(res => {
|
|
|
this.setData({
|
|
|
- loading:false
|
|
|
+ loading: false
|
|
|
})
|
|
|
if (res.data.code == Constants.SUCESS_CODE) {
|
|
|
wx.showToast({
|
|
|
@@ -517,12 +516,12 @@ Page({
|
|
|
})
|
|
|
// 重新查询
|
|
|
//设置只读
|
|
|
- this.setFormMain()
|
|
|
- //查询信息
|
|
|
- this.getItemDetal(this.data.id)
|
|
|
- this.setData({
|
|
|
- formData: JSON.stringify(formData)
|
|
|
- })
|
|
|
+ this.setFormMain()
|
|
|
+ //查询信息
|
|
|
+ this.getItemDetal(this.data.id)
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData)
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -537,18 +536,21 @@ Page({
|
|
|
params.fromId = params.orderId
|
|
|
params.factAmt = params.outingAmt
|
|
|
params.goodsList.forEach(res => {
|
|
|
- // res['sOutId'] = res.soutId
|
|
|
// res['sOutItemId'] = res.soutItemId
|
|
|
// res['sOrderItemId'] = res.sorderItemId
|
|
|
// res['sOrderId'] = res.sorderId
|
|
|
- res.sOutId = res.sOutId ?res.sOutId :params.outId
|
|
|
- res.sOrderId = res.sOrderId ? res.sOrderId : params.orderId
|
|
|
+
|
|
|
+ res.sOutId = res.sOutId ? res.sOutId : params.outId
|
|
|
+ res.sOrderId = res.sOrderId ? res.sOrderId : params.orderId
|
|
|
+ res['supId'] = res.supId ? res.supId : null
|
|
|
+ res['fromId'] = res.fromId ? res.fromId : res.sOutId
|
|
|
+ res['fromItemId'] = res.fromItemId ? res.fromItemId : res.sOutItemId
|
|
|
// res.outQty = res.outingQty
|
|
|
res.costPrice = null
|
|
|
res.costAmt = null
|
|
|
res.factPrice = res.priceOut
|
|
|
res.factAmt = res.outingAmt
|
|
|
- // res.outAmt = res.outingAmt
|
|
|
+ res.outAmt = Number(res.priceOut * res.outingQty)
|
|
|
res.itemIndex = itemIndex++
|
|
|
// res.canNegativeFlag = true
|
|
|
if (this.data.formMode != 'detail') {
|
|
|
@@ -588,7 +590,7 @@ Page({
|
|
|
params.outDate = utils.formatDayTime(new Date())
|
|
|
delete params['goodsList']
|
|
|
delete params['orderItemResponseList']
|
|
|
- console.log('params',params)
|
|
|
+ console.log('params', params)
|
|
|
return params
|
|
|
},
|
|
|
/**
|
|
|
@@ -626,26 +628,26 @@ Page({
|
|
|
if (filters && filters.length > 0) {
|
|
|
filters[0].content = 0;
|
|
|
}
|
|
|
- if(this.data.formMode == 'add'){
|
|
|
+ if (this.data.formMode == 'add') {
|
|
|
let formData = {
|
|
|
- staff:{
|
|
|
- text: app.globalData.user.staffName,
|
|
|
+ staff: {
|
|
|
+ text: app.globalData.user.staffName,
|
|
|
value: [app.globalData.user.staffId]
|
|
|
},
|
|
|
- org:{
|
|
|
- text: app.globalData.user.orgName,
|
|
|
+ org: {
|
|
|
+ text: app.globalData.user.orgName,
|
|
|
value: [app.globalData.user.orgId]
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
formData.orgId = app.globalData.user.orgId
|
|
|
- formData.staffId = app.globalData.user.staffId
|
|
|
+ formData.staffId = app.globalData.user.staffId
|
|
|
this.setData({
|
|
|
- formData:JSON.stringify(formData),
|
|
|
+ formData: JSON.stringify(formData),
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.setData({
|
|
|
- contentSaveList: contentSaveList,
|
|
|
+ contentSaveList: contentSaveList,
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -663,18 +665,18 @@ Page({
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
if (res.data.data.data.outStatus == mixins.$t("outBoundedOutStatus") && this.data.formMode != 'other') {
|
|
|
let buttonSaveList = this.data.buttonSaveList
|
|
|
- if(this.data.gradeCode == Constants.gradeCode.STD){
|
|
|
+ if (this.data.gradeCode == Constants.gradeCode.STD) {
|
|
|
buttonSaveList = []
|
|
|
this.setData({
|
|
|
- saveButtonFlag:false
|
|
|
+ saveButtonFlag: false
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
buttonSaveList = [{
|
|
|
code: 'merge',
|
|
|
title: mixins.$t("handleWithdrawal"),
|
|
|
}]
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.setData({
|
|
|
buttonSaveList: buttonSaveList
|
|
|
})
|
|
|
@@ -688,28 +690,28 @@ Page({
|
|
|
}
|
|
|
let contentObj = this.data.contentObj
|
|
|
if (this.data.gradeCode == Constants.gradeCode.STD) {
|
|
|
- if(!formData.fromNo){
|
|
|
+ if (!formData.fromNo) {
|
|
|
contentObj.relation = []
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
contentObj.relation = [{
|
|
|
code: 'fromNo',
|
|
|
type: 'str',
|
|
|
title: mixins.$t("sourceOrder"), //'关联源单'
|
|
|
readonly: true,
|
|
|
}]
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.setData({
|
|
|
- contentObj:contentObj
|
|
|
+ contentObj: contentObj
|
|
|
})
|
|
|
if (this.data.formType == 'toSaleOut') { //销售出库转退货
|
|
|
formData.fromNo = formData.outNo
|
|
|
formData.outStatus = "出库状态-出库中"
|
|
|
formData.outType = "出库类型-销退回库"
|
|
|
formData.receivableId = null
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
// 编辑 销售订单转退货 销售退货选取出库单 出库单的渠道可能为空
|
|
|
formData.channelId = formData.salesChannel
|
|
|
@@ -943,13 +945,13 @@ Page({
|
|
|
required: false,
|
|
|
title: mixins.$t('saleChannel')
|
|
|
},
|
|
|
- // {
|
|
|
- // code: 'cusFromName',
|
|
|
- // type: 'str',
|
|
|
- // readonly: true,
|
|
|
- // required: false,
|
|
|
- // title: mixins.$t('customerSource')
|
|
|
- // },
|
|
|
+ // {
|
|
|
+ // code: 'cusFromName',
|
|
|
+ // type: 'str',
|
|
|
+ // readonly: true,
|
|
|
+ // required: false,
|
|
|
+ // title: mixins.$t('customerSource')
|
|
|
+ // },
|
|
|
]
|
|
|
} else {
|
|
|
contentSaveList = [
|
|
|
@@ -1024,7 +1026,7 @@ Page({
|
|
|
* @author : 于继渤
|
|
|
* @date : 2024/1/26 11:46
|
|
|
*/
|
|
|
- calculateAmount(formData) {
|
|
|
+ calculateAmount(formData) {
|
|
|
///设置总单信息
|
|
|
let sumStandard = Number(0)
|
|
|
let sumAmount = Number(0)
|
|
|
@@ -1107,7 +1109,7 @@ Page({
|
|
|
success: function (res) {
|
|
|
res.eventChannel.emit('params', {
|
|
|
formMode: Constants.formMode.other,
|
|
|
- formReturnMode:this_.data.formReturnMode,
|
|
|
+ formReturnMode: this_.data.formReturnMode,
|
|
|
id: this_.data.id,
|
|
|
formType: Constants.formMode.edit
|
|
|
});
|
|
|
@@ -1165,7 +1167,7 @@ Page({
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
if (this.data.gradeCode == Constants.gradeCode.STD) { //标准
|
|
|
this.setData({
|
|
|
- contentSaveList:[]
|
|
|
+ contentSaveList: []
|
|
|
})
|
|
|
} else {
|
|
|
this.setData({
|
|
|
@@ -1213,55 +1215,55 @@ Page({
|
|
|
title: mixins.$t("save")
|
|
|
}
|
|
|
],
|
|
|
-
|
|
|
- contentObj.main = [{
|
|
|
- code: 'cusName',
|
|
|
- type: 'selectIcon',
|
|
|
- urlKey: 'selectCustomers',
|
|
|
- required: true,
|
|
|
- readonly: false,
|
|
|
- title: mixins.$t('customerName')
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'cusPhone',
|
|
|
- type: 'phone',
|
|
|
- title: mixins.$t('cusPhone'),
|
|
|
- required: true
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'addressFull',
|
|
|
- type: 'address',
|
|
|
- title: mixins.$t('addressFull'),
|
|
|
- required: true
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'addressNo',
|
|
|
- type: 'str',
|
|
|
- required: true,
|
|
|
- title: mixins.$t('addressNo')
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'channelId',
|
|
|
- name: 'channelName',
|
|
|
- type: 'drop',
|
|
|
- required: true,
|
|
|
- dropType: 'saleChannel',
|
|
|
- title: mixins.$t('saleChannel')
|
|
|
- },
|
|
|
- // {
|
|
|
- // code: 'cusFrom',
|
|
|
- // name: 'cusFromName',
|
|
|
- // type: 'drop',
|
|
|
- // required: false,
|
|
|
- // dropType: 'customerFrom',
|
|
|
- // title: mixins.$t('customerSource')
|
|
|
- // },
|
|
|
- ],
|
|
|
+
|
|
|
+ contentObj.main = [{
|
|
|
+ code: 'cusName',
|
|
|
+ type: 'selectIcon',
|
|
|
+ urlKey: 'selectCustomers',
|
|
|
+ required: true,
|
|
|
+ readonly: false,
|
|
|
+ title: mixins.$t('customerName')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'cusPhone',
|
|
|
+ type: 'phone',
|
|
|
+ title: mixins.$t('cusPhone'),
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'addressFull',
|
|
|
+ type: 'address',
|
|
|
+ title: mixins.$t('addressFull'),
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'addressNo',
|
|
|
+ type: 'str',
|
|
|
+ required: true,
|
|
|
+ title: mixins.$t('addressNo')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'channelId',
|
|
|
+ name: 'channelName',
|
|
|
+ type: 'drop',
|
|
|
+ required: true,
|
|
|
+ dropType: 'saleChannel',
|
|
|
+ title: mixins.$t('saleChannel')
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // code: 'cusFrom',
|
|
|
+ // name: 'cusFromName',
|
|
|
+ // type: 'drop',
|
|
|
+ // required: false,
|
|
|
+ // dropType: 'customerFrom',
|
|
|
+ // title: mixins.$t('customerSource')
|
|
|
+ // },
|
|
|
+ ],
|
|
|
this.setData({
|
|
|
buttonSaveList: buttonSaveList,
|
|
|
contentObj: contentObj
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
let contentObj = this.data.contentObj
|
|
|
contentObj.main = [{
|
|
|
code: 'cusName',
|
|
|
@@ -1306,7 +1308,7 @@ Page({
|
|
|
title: mixins.$t('customerSource')
|
|
|
},
|
|
|
]
|
|
|
- contentObj.relation =[{
|
|
|
+ contentObj.relation = [{
|
|
|
code: 'fromNo',
|
|
|
name: 'fromNo',
|
|
|
type: 'choose',
|
|
|
@@ -1316,7 +1318,7 @@ Page({
|
|
|
title: mixins.$t("sourceOrder"), //'关联源单'
|
|
|
urlKey: 'selectSourceSaleOrder'
|
|
|
}]
|
|
|
- this.setData({
|
|
|
+ this.setData({
|
|
|
contentObj: contentObj
|
|
|
})
|
|
|
}
|
|
|
@@ -1340,7 +1342,7 @@ Page({
|
|
|
this.getItemDetal(this.data.item.orderId, 'orderService', 'getOrderForReturn')
|
|
|
}
|
|
|
let contentObj = this.data.contentObj
|
|
|
- if (this.data.gradeCode == Constants.gradeCode.STD) {
|
|
|
+ if (this.data.gradeCode == Constants.gradeCode.STD) {
|
|
|
contentObj.main = [{
|
|
|
code: 'cusName',
|
|
|
type: 'selectIcon',
|
|
|
@@ -1375,16 +1377,16 @@ Page({
|
|
|
dropType: 'saleChannel',
|
|
|
title: mixins.$t('saleChannel')
|
|
|
},
|
|
|
- // {
|
|
|
- // code: 'cusFrom',
|
|
|
- // name: 'cusFromName',
|
|
|
- // type: 'drop',
|
|
|
- // required: false,
|
|
|
- // dropType: 'customerFrom',
|
|
|
- // title: mixins.$t('customerSource')
|
|
|
- // },
|
|
|
+ // {
|
|
|
+ // code: 'cusFrom',
|
|
|
+ // name: 'cusFromName',
|
|
|
+ // type: 'drop',
|
|
|
+ // required: false,
|
|
|
+ // dropType: 'customerFrom',
|
|
|
+ // title: mixins.$t('customerSource')
|
|
|
+ // },
|
|
|
]
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
contentObj.main = [{
|
|
|
code: 'cusName',
|
|
|
type: 'selectIcon',
|
|
|
@@ -1430,8 +1432,8 @@ Page({
|
|
|
]
|
|
|
}
|
|
|
this.setData({
|
|
|
- contentObj:contentObj,
|
|
|
- satffAndOrgReadonly:true,
|
|
|
+ contentObj: contentObj,
|
|
|
+ satffAndOrgReadonly: true,
|
|
|
formData: JSON.stringify(formData)
|
|
|
})
|
|
|
} else if (this.data.formMode == Constants.formMode.other && this.data.formType == Constants.formMode.edit) { //编辑
|
|
|
@@ -1481,10 +1483,10 @@ Page({
|
|
|
dropType: 'customerFrom',
|
|
|
title: mixins.$t('customerSource')
|
|
|
},
|
|
|
- ]
|
|
|
- this.setData({
|
|
|
- contentObj:contentObj,
|
|
|
- })
|
|
|
+ ]
|
|
|
+ this.setData({
|
|
|
+ contentObj: contentObj,
|
|
|
+ })
|
|
|
if (this.data.formMode == Constants.formMode.other) {
|
|
|
this.setData({
|
|
|
popContent: [{
|
|
|
@@ -1513,12 +1515,6 @@ Page({
|
|
|
urlKey: 'openingInventory',
|
|
|
},
|
|
|
{
|
|
|
- code: 'brandName',
|
|
|
- title: mixins.$t('brandName'),
|
|
|
- type: 'str',
|
|
|
- readonly: true,
|
|
|
- },
|
|
|
- {
|
|
|
code: 'nonStdCode',
|
|
|
title: mixins.$t("goodsBatch"),
|
|
|
type: 'str',
|