Commit 4c42dffa authored by Smile's avatar Smile

Merge remote-tracking branch 'origin/jd_cons' into jd_cons

# Conflicts:
#	src/views/ecw/cons/index.vue
parents e0e873aa 529baf6a
<template>
<div>
<el-dialog center width="80%" :before-close="()=>{$emit('update:showSpecialNeedsCons',false)}"
:visible.sync="showSpecialNeedsCons">
<div class="content">
<h1>{{ consNum }} 特需</h1>
<el-form label-width="180px" label-position="left">
<el-form-item :label="$t('特殊要求')">
<el-checkbox-group v-model="advanceType">
<el-checkbox v-for="(item) in getDictDatas(DICT_TYPE.ORDER_SPECIAL_NEEDS)" :label="item.value">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item :label="$t('特殊要求备注')">
<el-input type="textarea" style="width: 300px;" v-model="todoDetail"></el-input>
</el-form-item>
<el-form-item v-for="(item,index) in this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS)"
v-if="advanceType.indexOf(item.value) > -1" :key="item.value" :label="item.label + '预计金额'">
<el-input-number style="width: 300px;" v-model.number="specialNeedsList[index].transFee" type="number"
:min="0" step-strictly></el-input-number>
<el-select v-model="specialNeedsList[index].transCurrency">
<el-option v-for="item in JSON.parse(currency)" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select>
<div style="display: inline-block;margin-left: 20px;">
<span style="margin-right: 10px;">{{ $t("付款类型") }}</span>
<dict-selector :placeholder="$t('请选择付款类型')" v-model="specialNeedsList[index].payType"
:type="DICT_TYPE.PAYMENT_TYPE"></dict-selector>
</div>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">{{ $t("提交") }}</el-button>
<el-button @click="$emit('update:showSpecialNeedsCons',false)">{{ $t("取消") }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getDictDatas, DICT_TYPE } from "@/utils/dict"
import { specialNeedCreate } from "@/api/ecw/order"
export default {
name: "specialNeedsCons",
props: {
consId: {
type: [String, Number]
},
consNum: [String, Number],
showSpecialNeedsCons: Boolean,
currency: String
},
data() {
return {
getDictDatas,
DICT_TYPE,
form: {},
advanceType: [],
specialNeedsList: [],
todoDetail: "",
echoList: []
}
},
methods: {
submit() {
this.specialNeedsList.forEach(i => {
i.todoDetail = this.todoDetail
})
let p = this.specialNeedsList.filter(i => this.advanceType.indexOf(i.advanceType) > -1)
let p1 = []
//获取新增的和修改的
p.forEach(item => {
if (this.echoList.find(i => item.id === i.id)) {
p1.push(item)
} else {
item.oper = "add"
p1.push(item)
}
})
//获取删除的
this.echoList.forEach(item => {
if (!(p.find(i => i.id === item.id))) {
item.oper = "del"
p1.push(item)
}
})
let p2 = p1.filter(i => Number(i.transFee) > 0)
if (p2.every(i => !!i.payType)) {
specialNeedCreate(p1).then(r => {
if (r.code === 0) {
this.$emit("update:showSpecialNeedsCons", false)
this.$emit("determine")
this.$message.success("提交成功")
}
})
} else {
let v = p2.map(i => i.advanceType)
console.log(this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS), "this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS)")
let v2 = this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS).filter(i => v.includes(i.value))
this.$modal.notifyWarning(`请选择"${v2.map(i => i.label).join("")}"的付款类型。`)
}
}
},
watch: {
showSpecialNeedsCons(val) {
if (val) {
this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS).forEach(r => {
this.specialNeedsList.push({
advanceType: r.value,
consId: this.consId,
transFee: "",//预计金额
transCurrency: 1,//运输费币种
payType: ""
})
})
//特需回显
// getSpecialListByOrderId(this.consId).then(r => {
// this.echoList = r.data;
// if(r.data.length){
// this.todoDetail = r.data[0].todoDetail
// }
// r.data.forEach(i => {
// this.advanceType.push(i.advanceType)
// let index = this.specialNeedsList.findIndex(item => i.advanceType == item.advanceType)
// this.specialNeedsList.splice(index,1, { advanceType:i.advanceType,
// consId:this.consId,
// id:i.id,
// transFee:i.transFee,//预计金额
// transCurrency:i.transCurrency,//运输费币种
// payType:i.payType})
// })
//
// })
} else {
this.specialNeedsList = []
this.advanceType = []
}
}
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<el-dialog :title="$t('订单转异')" center :visible.sync="showException">
<el-dialog :title="$t('订单转异')" :before-close="()=>{$emit('update:showException',false)}" center
:visible.sync="showException">
<el-form ref="transmutationForm" :model="params" label-width="200">
<el-form-item prop="exceptionType" :rules="{ required:true,message:'至少选择一个转异原因'}"
:label="$t('原因类型')">
......@@ -17,7 +18,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">{{ $t("确 定") }}</el-button>
<el-button @click="cancel">{{ $t("取 消") }}</el-button>
<el-button @click="$emit('update:showException',false)">{{ $t("取 消") }}</el-button>
</span>
</el-dialog>
</template>
......@@ -63,13 +64,10 @@ export default {
}
createConsException(param).then(response => {
this.showException = false
this.$modal.msgSuccess("新增成功");
});
this.$modal.msgSuccess("新增成功")
})
}
})
},
cancel() {
this.showException = false
}
}
}
......
......@@ -168,6 +168,7 @@
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:cons:delete']">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="transmutation(scope.row)">{{$t('转异')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="specialNeedsCons(scope.row)">{{$t('特需')}}</el-button>
</template>
</el-table-column>
</el-table>
......@@ -248,7 +249,8 @@
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<Transmutation :showException="showException" :id="id"></Transmutation>
<Transmutation :showException.sync="showException" :id="id"></Transmutation>
<SpecialNeedsCons :showSpecialNeedsCons.sync="showSpecialNeedsCons" :currency="JSON.stringify(currencyList)" :consId="id" :consNum="consNum"></SpecialNeedsCons>
</div>
</template>
......@@ -260,13 +262,16 @@ import UserSelector from "@/components/UserSelector/index.vue";
import { getWarehouseList } from "@/api/ecw/warehouse";
import {getTradeCountryList} from "@/api/ecw/region";
import {getRegionList} from "@/api/ecw/order";
import SpecialNeedsCons from "@/views/ecw/cons/components/SpecialNeedsCons.vue"
import { getCurrencyList } from "@/api/ecw/currency"
export default {
name: "Cons",
components: {
UserSelector,
Transmutation,
Template
Template,
SpecialNeedsCons
},
data() {
return {
......@@ -327,7 +332,10 @@ export default {
signed: [{ required: true, message: "是否被签收,0未签收,1已签收不能为空", trigger: "blur" }],
},
showException: false,
id: null
showSpecialNeedsCons: false,
id: null,
currencyList: [],
consNum: null,
};
},
created() {
......@@ -337,6 +345,7 @@ export default {
});
this.getAddressProvince()
this.getAddressCity()
getCurrencyList().then((res) => (this.currencyList = res.data))
},
computed: {
isChinese() {
......@@ -538,6 +547,12 @@ export default {
transmutation(row) {
this.id = row.id
this.showException = true
},
//特需
specialNeedsCons(row) {
this.id = row.id
this.consNum = row.consNum
this.showSpecialNeedsCons = true
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment