Commit 68271509 authored by Facius's avatar Facius

Merge branch 'dev' of https://git.banshouhui.com/lijundan/self-support into dev

parents 5e3dae5d 8e97548b
......@@ -5,6 +5,7 @@ let partsApiFun = function (vm) {
const parts = '/wxh-worker-rest/rest/parts/'
const base = '/wxh-worker-rest/rest/base/'
const formType = {'content-type': 'application/x-www-form-urlencoded'}
const formData = {'content-type': 'multipart/form-data'}
/**
* 配件申请单-查询网点地址信息
......@@ -29,7 +30,7 @@ let partsApiFun = function (vm) {
/**
* 配件申请单-创建申请单/使用备件
*/
let applyParts = async (params = {}) => await vm.$u.post(parts + vm.vuex_token + '/orders', params)
let applyParts = async (params = {}) => await vm.$u.post(parts + vm.vuex_token + '/orders', params, formData)
/**
* 查询自己的备件仓
......
......@@ -104,10 +104,10 @@ export default {
this.loadMineAddress()
this.loadOrderInfo()
this.parts = [
{name: '正泰漏保', num: 2},
{name: '电缆VJV3*10', num: 1},
{name: '挚达系统广汽充电桩', num: 0},
{name: '空开盒子', num: 100}
{part_id: 15866, name: '挚达-沃尔沃-充电桩', quantity: 2},
{part_id: 15867, name: '直达充电桩', quantity: 1},
{part_id: 15868, name: '郭小清-物料配件', quantity: 0},
{part_id: 2010, name: '通用品牌配件测试', quantity: 100}
]
},
loadMineAddress() {
......@@ -138,6 +138,7 @@ export default {
} else {
this.mine.name = this.order.maintainWorkerName
this.mine.mobile = this.order.maintainWorkerPhone
// this.applyType = this.order.inGuaranteePeriod == 'Y' ||
this.customer = {
name: this.order.contactName,
mobile: this.order.contactPhone,
......@@ -187,6 +188,21 @@ export default {
this.parts = parts
}
},
validateForm() {
if(this.applyType == 0 && this.$u.test.isEmpty(this.orderId)) {
this.$u.toast('保内申请时必须指定工单ID')
return false
}
if(this.applyType != 0 && this.$u.test.isEmpty(this.applyType)) {
this.$u.toast('申请类型不能为空')
return false
}
if(this.isEmptyParts && this.$u.test.isEmpty(this.remark)) {
this.$u.toast('配件明细和备注不能同时为空')
return false
}
return true
},
/**
* workOrderId 工单ID,保内申请时必须指定
* applyType 申请类型:0 保内,1 备件,2 购买,10 使用备件
......@@ -206,14 +222,15 @@ export default {
* images 申请图片文件、可以传多张
*/
submitParts() {
if(!this.validateForm()) {
return false
}
const address = this.addressInfo
let params = {
workOrderId: this.orderId,
applyType: this.applyType,
remark: this.remark,
parts: JSON.stringty(parts),
barcode: this.order.barcode,
measures: this.order.measures,
parts: JSON.stringify(this.parts),
name: address.name,
phoneNumber: address.mobile,
province: address.region[0],
......@@ -224,15 +241,13 @@ export default {
this.$u.api.applyParts(params).then((res) => {
if (res.code == 200) {
this.$u.route({
type: 'redirect',
url: "pages/parts/nodes"
})
} else {
console.log(res.message, "配件申请失败!");
}
});
this.$u.route({
url: "pages/parts/nodes"
})
}
}
};
......
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