2 changed files with 297 additions and 0 deletions
@ -0,0 +1,61 @@ |
|||||||
|
import request from '@/router/axios'; |
||||||
|
//列表
|
||||||
|
export const getList = (current, size, params) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-sim/orders/page', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
...params, |
||||||
|
current, |
||||||
|
size, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
//删除
|
||||||
|
export const remove = (ids) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-sim/orders/remove', |
||||||
|
method: 'post', |
||||||
|
params: { |
||||||
|
ids, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
//详情
|
||||||
|
export const getDetail = (id) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-sim/orders/detail', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
id |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
//新增
|
||||||
|
export const add = (row) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-sim/orders/save', |
||||||
|
method: 'post', |
||||||
|
data: row |
||||||
|
}) |
||||||
|
} |
||||||
|
//修改
|
||||||
|
export const update = (row) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-sim/orders/update', |
||||||
|
method: 'post', |
||||||
|
data: row |
||||||
|
}) |
||||||
|
} |
||||||
|
//树型省市区
|
||||||
|
export const getLazyTree = (parentCode, params) => { |
||||||
|
return request({ |
||||||
|
url: '/api/iot-system/region/lazy-tree', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
...params, |
||||||
|
parentCode |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
@ -0,0 +1,236 @@ |
|||||||
|
<template> |
||||||
|
<basic-container> |
||||||
|
<avue-crud |
||||||
|
:option="option" |
||||||
|
:table-loading="loading" |
||||||
|
:data="data" |
||||||
|
:page.sync="page" |
||||||
|
:permission="permissionList" |
||||||
|
:before-open="beforeOpen" |
||||||
|
v-model="form" |
||||||
|
ref="crud" |
||||||
|
@row-update="rowUpdate" |
||||||
|
@row-save="rowSave" |
||||||
|
@row-del="rowDel" |
||||||
|
@search-change="searchChange" |
||||||
|
@search-reset="searchReset" |
||||||
|
@current-change="currentChange" |
||||||
|
@size-change="sizeChange" |
||||||
|
@refresh-change="refreshChange" |
||||||
|
@on-load="onLoad" |
||||||
|
> |
||||||
|
</avue-crud> |
||||||
|
</basic-container> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { |
||||||
|
add, |
||||||
|
getDetail, |
||||||
|
getList, |
||||||
|
remove, |
||||||
|
update, |
||||||
|
} from "@/api/ordermanage/delivery"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
form: {}, |
||||||
|
|
||||||
|
query: {}, |
||||||
|
loading: true, |
||||||
|
page: { |
||||||
|
pageSize: 10, |
||||||
|
currentPage: 1, |
||||||
|
total: 0, |
||||||
|
}, |
||||||
|
option: { |
||||||
|
tip: false, |
||||||
|
searchShow: true, |
||||||
|
searchMenuSpan: 6, |
||||||
|
border: true, |
||||||
|
index: true, |
||||||
|
viewBtn: true, |
||||||
|
columnBtn: false, |
||||||
|
addBtn: false, |
||||||
|
dialogClickModal: false, |
||||||
|
dialogWidth: "45%", |
||||||
|
column: [ |
||||||
|
{ |
||||||
|
label: "姓名", |
||||||
|
prop: "shippingName", |
||||||
|
width: "100", |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请输入姓名", |
||||||
|
trigger: "blur", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
|
||||||
|
{ |
||||||
|
label: "手机号", |
||||||
|
prop: "consigneePhone", |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请输入手机号", |
||||||
|
trigger: "blur", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "地址", |
||||||
|
prop: "shippingRegion", |
||||||
|
editDisplay: false, |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请选择地址", |
||||||
|
trigger: "change", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "详细地址", |
||||||
|
prop: "shippingAddress", |
||||||
|
editDisplay: false, |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请输入详细地址", |
||||||
|
trigger: "blur", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "价格", |
||||||
|
prop: "price", |
||||||
|
width: "110", |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请输入价格", |
||||||
|
trigger: "blur", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "订单状态", |
||||||
|
prop: "status", |
||||||
|
type: "select", |
||||||
|
dicUrl: "/api/iot-system/dict/dictionary?code=order_status", |
||||||
|
props: { |
||||||
|
label: "dictValue", |
||||||
|
value: "dictKey", |
||||||
|
}, |
||||||
|
dataType: "number", |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
required: true, |
||||||
|
message: "请选择订单状态", |
||||||
|
trigger: "change", |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
], |
||||||
|
}, |
||||||
|
data: [], |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
rowSave(row, done, loading) { |
||||||
|
add(row).then( |
||||||
|
() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!", |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
(error) => { |
||||||
|
loading(); |
||||||
|
window.console.log(error); |
||||||
|
} |
||||||
|
); |
||||||
|
}, |
||||||
|
rowUpdate(row, index, done, loading) { |
||||||
|
update(row).then( |
||||||
|
() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!", |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
(error) => { |
||||||
|
loading(); |
||||||
|
console.log(error); |
||||||
|
} |
||||||
|
); |
||||||
|
}, |
||||||
|
rowDel(row) { |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning", |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!", |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
beforeOpen(done, type) { |
||||||
|
if (["edit", "view"].includes(type)) { |
||||||
|
getDetail(this.form.id).then((res) => { |
||||||
|
this.form = res.data.data; |
||||||
|
}); |
||||||
|
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
currentChange(currentPage) { |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
}, |
||||||
|
sizeChange(pageSize) { |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
}, |
||||||
|
refreshChange() { |
||||||
|
this.onLoad(this.page, this.query); |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
this.loading = true; |
||||||
|
getList( |
||||||
|
page.currentPage, |
||||||
|
page.pageSize, |
||||||
|
Object.assign(params, this.query) |
||||||
|
).then((res) => { |
||||||
|
const data = res.data.data; |
||||||
|
this.page.total = data.total; |
||||||
|
this.data = data.records; |
||||||
|
this.loading = false; |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style></style> |
Loading…
Reference in new issue