ajax封装后的写法:
01.
export const allOrder = data => request(BASE_URL + '/Services/allOrder.html', data, 'GET')
02.
export const Contract = ({
order_id,
user_id,
is_agree
}) => request(BASE_URL + '/Services/Contract.html', {
order_id,
user_id,
is_agree
}, 'POST')
二:没封装时用fromData获取数据的写法(用时得确保axios纯净)
let agreemForm = this.$refs.agreemForm
let formFile = new FormData(agreemForm)
formFile.append("service_id",this.service_id)
//设置表头类型
const config = {
headers: { "Content-Type": "multipart/form-data"}
};
this.$http.post("https://sapi.ygoffice.com/Services/createOrder.html", formFile,config).then(res => {
if (res.data.code == 200) {
Toast('提交成功');
this.$router.push({ path: "/agreeContract",query:{'orderId':res.data.data.order_id} });
} else {
Toast('提交失败:' + res.msg);
}
});
return false