|
@@ -531,63 +531,70 @@ export default {
|
|
|
async handleExpense (row) {
|
|
|
const _this = this
|
|
|
const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
|
|
|
- const showModalFlag = [hasExpense.exceed, hasExpense.balance, hasExpense.giftConvertAmount]
|
|
|
- const showModal = 0
|
|
|
- showModalFlag.map(item => {
|
|
|
- if (item) {
|
|
|
- showModal = showModal + 1
|
|
|
+ const showModalFlag = []
|
|
|
+ const optionsKey = [
|
|
|
+ {
|
|
|
+ id: 'balance',
|
|
|
+ name: '采购额结余'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'exceed',
|
|
|
+ name: '采购额超出'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'giftConvertAmount',
|
|
|
+ name: '促销产品转采购额'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ optionsKey.map(key => {
|
|
|
+ if(hasExpense[key.id]){
|
|
|
+ showModalFlag.push(key)
|
|
|
}
|
|
|
})
|
|
|
- console.log(hasExpense)
|
|
|
- // 有2个以上采购额时
|
|
|
- if (hasExpense && showModal > 1) {
|
|
|
- _this.$confirm({
|
|
|
- title: '转费用报销单?',
|
|
|
- centered: true,
|
|
|
- class: 'confirm-center',
|
|
|
- content: <div>
|
|
|
- <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
|
|
|
- <div style="padding:0 0 10px 0;text-align:center;">
|
|
|
- <aRadioGroup onChange={_this.changeDaOpt}>
|
|
|
- <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="balance">
|
|
|
- 采购额结余
|
|
|
- </aRadio>
|
|
|
- <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="exceed">
|
|
|
- 采购额超出
|
|
|
- </aRadio>
|
|
|
- <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="giftConvertAmount">
|
|
|
- 促销产品转采购额
|
|
|
- </aRadio>
|
|
|
- </aRadioGroup>
|
|
|
- </div>
|
|
|
- </div>,
|
|
|
- onOk () {
|
|
|
- if (_this.expenseOption) {
|
|
|
- _this.expenseSave(hasExpense, _this.expenseOption)
|
|
|
- } else {
|
|
|
- _this.$message.info('请选择费用报销单类型!')
|
|
|
- return true
|
|
|
- }
|
|
|
- },
|
|
|
- onCancel () {
|
|
|
- _this.expenseOption = null
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
+
|
|
|
+ if(showModalFlag.length){
|
|
|
// 直接转费用单
|
|
|
- _this.expenseSave(hasExpense, null)
|
|
|
+ if(showModalFlag.length == 1){
|
|
|
+ _this.expenseSave(hasExpense[showModalFlag[0].id])
|
|
|
+ }
|
|
|
+ // 有2个以上采购额时
|
|
|
+ if (showModalFlag.length>1) {
|
|
|
+ _this.$confirm({
|
|
|
+ title: '转费用报销单?',
|
|
|
+ centered: true,
|
|
|
+ class: 'confirm-center',
|
|
|
+ content: <div>
|
|
|
+ <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
|
|
|
+ <div style="padding:0 0 10px 0;text-align:center;">
|
|
|
+ <aRadioGroup onChange={_this.changeDaOpt}>
|
|
|
+ {showModalFlag.map(item => <aRadio key={item.id} style="height: '30px';lineHeight: '30px';padding:5px 0;" value={item.id}>{item.name}</aRadio>)}
|
|
|
+ </aRadioGroup>
|
|
|
+ </div>
|
|
|
+ </div>,
|
|
|
+ onOk () {
|
|
|
+ if (_this.expenseOption) {
|
|
|
+ _this.expenseSave(hasExpense[_this.expenseOption])
|
|
|
+ } else {
|
|
|
+ _this.$message.info('请选择费用报销单类型!')
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onCancel () {
|
|
|
+ _this.expenseOption = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
changeDaOpt (e) {
|
|
|
this.expenseOption = e.target.value
|
|
|
},
|
|
|
// 转费用单
|
|
|
- expenseSave (data, type) {
|
|
|
- console.log(data, type)
|
|
|
- const params = type ? data[type] : (data.balance || data.exceed || data.giftConvertAmount)
|
|
|
- if (params) {
|
|
|
+ expenseSave (data) {
|
|
|
+ console.log(data)
|
|
|
+ if (data) {
|
|
|
this.openBaseModal = true
|
|
|
- this.$refs.expenseModal.setDetail(params, 'sales')
|
|
|
+ this.$refs.expenseModal.setDetail(data, 'sales')
|
|
|
}
|
|
|
},
|
|
|
expenseSaveOk (params) {
|