Commit bde824ed authored by your yuchenglong's avatar your yuchenglong

update:打印订单

parent 39197f5b
...@@ -93,7 +93,7 @@ exports.orderExport = async ctx => { ...@@ -93,7 +93,7 @@ exports.orderExport = async ctx => {
// 打印订单 // 打印订单
exports.orderPrint = async ctx => { exports.orderPrint = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/print`; const url = `${GROUPMEAL_URI}/order/background/order_print`;
const opts = { const opts = {
url, url,
method: "GET" method: "GET"
......
...@@ -75,7 +75,7 @@ router.get(`${API_VERSION}/order/background/goods_list`, groupmeal.getGoodsList) ...@@ -75,7 +75,7 @@ router.get(`${API_VERSION}/order/background/goods_list`, groupmeal.getGoodsList)
router.get(`${API_VERSION}/order/background/sub_shop_list`, groupmeal.getSubShopList); router.get(`${API_VERSION}/order/background/sub_shop_list`, groupmeal.getSubShopList);
router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport); router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport);
router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport); router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport);
router.get(`${API_VERSION}/order/background/print`, groupmeal.orderPrint); router.get(`${API_VERSION}/order/background/order_print`, groupmeal.orderPrint);
router.get(`${API_VERSION}/order/background/order_item_list`, groupmeal.orderItemList); router.get(`${API_VERSION}/order/background/order_item_list`, groupmeal.orderItemList);
router.get(`${API_VERSION}/order/background/order_refund_reject`, groupmeal.orderRefundReject); router.get(`${API_VERSION}/order/background/order_refund_reject`, groupmeal.orderRefundReject);
router.post(`${API_VERSION}/order/background/order_refund`, groupmeal.orderRefund); router.post(`${API_VERSION}/order/background/order_refund`, groupmeal.orderRefund);
......
...@@ -81,7 +81,6 @@ ...@@ -81,7 +81,6 @@
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button @click="exportOrder">导出</el-button> <el-button @click="exportOrder">导出</el-button>
<el-button @click="printOrder">打印</el-button> <el-button @click="printOrder">打印</el-button>
<!-- <a href="bp-dev.ini.yidian-inc.com/order/background/order_export?marketing_id=1NJF2J&type=1">导出文件</a> -->
</el-col> </el-col>
</el-row> </el-row>
<el-tab-pane label="全部" name="all"> <el-tab-pane label="全部" name="all">
...@@ -220,8 +219,10 @@ ...@@ -220,8 +219,10 @@
</el-form-item> </el-form-item>
<el-form-item class="exportBtn"> <el-form-item class="exportBtn">
<el-button @click="exportShow = false">取消</el-button> <el-button @click="exportShow = false">取消</el-button>
<a :href="exportURL" <a :href="exportURL" style="margin-left: 20px"
><el-button type="primary">确定导出</el-button></a ><el-button type="primary" @click="exportShow = false"
>确定导出</el-button
></a
> >
</el-form-item> </el-form-item>
</el-dialog> </el-dialog>
...@@ -290,7 +291,6 @@ import { ...@@ -290,7 +291,6 @@ import {
getMarketingList, getMarketingList,
getGoodsList, getGoodsList,
getSubShopList, getSubShopList,
orderExport,
orderPrint, orderPrint,
orderItemList, orderItemList,
orderRefundReject, orderRefundReject,
...@@ -397,8 +397,12 @@ export default { ...@@ -397,8 +397,12 @@ export default {
}, },
computed: { computed: {
exportURL() {}, exportURL() {
return getOrderExportURL(this.orderQueryObj.marketing_id, this.exportSel);
},
}, },
methods: { methods: {
// 获取活动名称 // 获取活动名称
async getMarketingListMet() { async getMarketingListMet() {
...@@ -426,7 +430,6 @@ export default { ...@@ -426,7 +430,6 @@ export default {
try { try {
const res = await getSubShopList(); const res = await getSubShopList();
this.selLiftPoinArr = res.result; this.selLiftPoinArr = res.result;
console.log(this);
} catch (error) { } catch (error) {
this.$message.error("发生未知错误,请稍后再试一下吧~~~"); this.$message.error("发生未知错误,请稍后再试一下吧~~~");
console.error(error); console.error(error);
...@@ -469,41 +472,45 @@ export default { ...@@ -469,41 +472,45 @@ export default {
this.exportShow = true; this.exportShow = true;
}, },
// 确认导出 async printOrderMet(forcePrint) {
async confirmExport() { const params = {
if (this.orderQueryObj.marketing_id != "") { // marketing_id: this.orderQueryObj.marketing_id,
const params = { marketing_id: "1NJETU",
marketing_id: this.orderQueryObj.marketing_id, force_print: forcePrint? "1": "",
type: this.exportSel, };
}; const res = await orderPrint(params);
const res = await orderExport(params); return res
if (res) {
const xlsx = "application/vnd.ms-excel";
const blob = new Blob([res], { type: xlsx });
const a = document.createElement("a");
a.download = "fileName.xls";
a.href = window.URL.createObjectURL(blob);
a.click();
a.remove();
this.exportShow = false;
} else {
this.$message.error("导出失败");
}
} else {
this.$message.error("请选择活动名称");
}
}, },
// 打印 // 打印
async printOrder() { async printOrder() {
if (this.orderQueryObj.marketing_id != "") { if(this.orderQueryObj.marketing_id === "") {
const params = {
marketing_id: this.orderQueryObj.marketing_id,
};
const res = await orderPrint(params);
console.log(res);
} else {
this.$message.error("请选择活动名称"); this.$message.error("请选择活动名称");
return
}
let res = this.printOrderMet(false);
if (res.code === 0) {
this.$message({
type: "success",
message: "打印成功",
});
return
}
try {
await this.$confirm("是否强制打印?", "打印", {
cancelButtonText: "取消",
confirmButtonText: "确定",
})
} catch(e) {
// 取消
return
}
res = this.printOrderMet(true)
if (res.code !== 0) {
this.$message.error("打印失败");
} }
}, },
...@@ -511,7 +518,6 @@ export default { ...@@ -511,7 +518,6 @@ export default {
async getOrderListMet() { async getOrderListMet() {
try { try {
const res = await getOrderList(this.params); const res = await getOrderList(this.params);
console.log(res);
this.goodsNum = res.count; this.goodsNum = res.count;
this.totalNum = res.count; this.totalNum = res.count;
this.orderTableData = res.result; this.orderTableData = res.result;
...@@ -529,7 +535,6 @@ export default { ...@@ -529,7 +535,6 @@ export default {
// 拒绝 // 拒绝
refuse(val) { refuse(val) {
console.log(val);
this.$confirm("确定要拒绝退款么?", "拒绝", { this.$confirm("确定要拒绝退款么?", "拒绝", {
cancelButtonText: "取消", cancelButtonText: "取消",
confirmButtonText: "确定", confirmButtonText: "确定",
...@@ -539,18 +544,14 @@ export default { ...@@ -539,18 +544,14 @@ export default {
order_id: val.order_id, order_id: val.order_id,
}; };
const res = orderRefundReject(params); const res = orderRefundReject(params);
console.log(res); console.log(res.status);
this.$message({ this.$message({
type: "success", type: "success",
message: "已拒绝!", message: "此订单已驳回",
}); });
this.getOrderListMet()
}) })
.catch(() => { .catch(() => {});
// this.$message({
// type: "info",
// message: "已取消",
// });
});
}, },
// 同意 // 同意
...@@ -560,7 +561,6 @@ export default { ...@@ -560,7 +561,6 @@ export default {
// 全选 // 全选
handleCheckAllChange(val) { handleCheckAllChange(val) {
console.log(val);
this.refundGoods.refundedGoodsSel = val; this.refundGoods.refundedGoodsSel = val;
this.isIndeterminate = false; this.isIndeterminate = false;
}, },
...@@ -572,7 +572,6 @@ export default { ...@@ -572,7 +572,6 @@ export default {
order_id: val.order_id, order_id: val.order_id,
}; };
const res = await orderItemList(params); const res = await orderItemList(params);
console.log(res.result);
this.refundGoods = res.result; this.refundGoods = res.result;
}, },
// 退款确认 // 退款确认
......
...@@ -68,7 +68,7 @@ export async function orderExport(params) { ...@@ -68,7 +68,7 @@ export async function orderExport(params) {
// 打印订单 // 打印订单
export async function orderPrint(params) { export async function orderPrint(params) {
const res = await axios.get("/api/v1/order/background/print", { const res = await axios.get("/api/v1/order/background/order_print", {
params params
}); });
return res; return res;
......
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