Commit bde824ed authored by your yuchenglong's avatar your yuchenglong

update:打印订单

parent 39197f5b
......@@ -93,7 +93,7 @@ exports.orderExport = async ctx => {
// 打印订单
exports.orderPrint = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/print`;
const url = `${GROUPMEAL_URI}/order/background/order_print`;
const opts = {
url,
method: "GET"
......
......@@ -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/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_refund_reject`, groupmeal.orderRefundReject);
router.post(`${API_VERSION}/order/background/order_refund`, groupmeal.orderRefund);
......
......@@ -81,7 +81,6 @@
<el-col :span="12" style="text-align: right">
<el-button @click="exportOrder">导出</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-row>
<el-tab-pane label="全部" name="all">
......@@ -220,8 +219,10 @@
</el-form-item>
<el-form-item class="exportBtn">
<el-button @click="exportShow = false">取消</el-button>
<a :href="exportURL"
><el-button type="primary">确定导出</el-button></a
<a :href="exportURL" style="margin-left: 20px"
><el-button type="primary" @click="exportShow = false"
>确定导出</el-button
></a
>
</el-form-item>
</el-dialog>
......@@ -290,7 +291,6 @@ import {
getMarketingList,
getGoodsList,
getSubShopList,
orderExport,
orderPrint,
orderItemList,
orderRefundReject,
......@@ -397,8 +397,12 @@ export default {
},
computed: {
exportURL() {},
exportURL() {
return getOrderExportURL(this.orderQueryObj.marketing_id, this.exportSel);
},
},
methods: {
// 获取活动名称
async getMarketingListMet() {
......@@ -426,7 +430,6 @@ export default {
try {
const res = await getSubShopList();
this.selLiftPoinArr = res.result;
console.log(this);
} catch (error) {
this.$message.error("发生未知错误,请稍后再试一下吧~~~");
console.error(error);
......@@ -469,41 +472,45 @@ export default {
this.exportShow = true;
},
// 确认导出
async confirmExport() {
if (this.orderQueryObj.marketing_id != "") {
const params = {
marketing_id: this.orderQueryObj.marketing_id,
type: this.exportSel,
};
const res = await orderExport(params);
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 printOrderMet(forcePrint) {
const params = {
// marketing_id: this.orderQueryObj.marketing_id,
marketing_id: "1NJETU",
force_print: forcePrint? "1": "",
};
const res = await orderPrint(params);
return res
},
// 打印
async printOrder() {
if (this.orderQueryObj.marketing_id != "") {
const params = {
marketing_id: this.orderQueryObj.marketing_id,
};
const res = await orderPrint(params);
console.log(res);
} else {
if(this.orderQueryObj.marketing_id === "") {
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 {
async getOrderListMet() {
try {
const res = await getOrderList(this.params);
console.log(res);
this.goodsNum = res.count;
this.totalNum = res.count;
this.orderTableData = res.result;
......@@ -529,7 +535,6 @@ export default {
// 拒绝
refuse(val) {
console.log(val);
this.$confirm("确定要拒绝退款么?", "拒绝", {
cancelButtonText: "取消",
confirmButtonText: "确定",
......@@ -539,18 +544,14 @@ export default {
order_id: val.order_id,
};
const res = orderRefundReject(params);
console.log(res);
console.log(res.status);
this.$message({
type: "success",
message: "已拒绝!",
message: "此订单已驳回",
});
this.getOrderListMet()
})
.catch(() => {
// this.$message({
// type: "info",
// message: "已取消",
// });
});
.catch(() => {});
},
// 同意
......@@ -560,7 +561,6 @@ export default {
// 全选
handleCheckAllChange(val) {
console.log(val);
this.refundGoods.refundedGoodsSel = val;
this.isIndeterminate = false;
},
......@@ -572,7 +572,6 @@ export default {
order_id: val.order_id,
};
const res = await orderItemList(params);
console.log(res.result);
this.refundGoods = res.result;
},
// 退款确认
......
......@@ -68,7 +68,7 @@ export async function orderExport(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
});
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