Commit 0bf39369 authored by hangjun83's avatar hangjun83

前端:百化销售订单退货功能页面

parent 6f917e07
.url-remark {
font-size: 14px;
color: #515a6e;
display: block;
color: #9a9a9a;
margin-bottom: -16px;
font-style: italic;
}
\ No newline at end of file
<style lang="less">
@import "@/styles/table-common.less";
@import "./orders.less";
</style>
<template>
<div class="search">
<Card>
<Row>
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
<FormItem label="百化订单号:" prop="bhOrderNo">
<Input type="text" v-model="searchForm.bhOrderNo" clearable placeholder="请输入订单号" style="width: 200px" />
</FormItem>
<FormItem style="margin-left: -70px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
</Row>
<Table :loading="loading" :columns="columns" :data="data" sortable="custom" ref="table"></Table>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>
</div>
</template>
<script>
import {
getBhPordersListData,
editBhOrders
} from "@/api/index";
import util from "@/libs/util.js";
export default {
name: "menu-manage",
components: {},
data() {
return {
loading: false,
maxHeight: "500px",
selected: false,
searchForm: {
bhOrderNo: "",
pageNumber: 1,
pageSize: 10,
},
formValidate: {
bhOrderId: [{
required: true,
message: "号不能为空",
trigger: "change"
}],
},
form: {},
columns: [{
type: "index",
width: 60,
align: "center",
fixed: "left",
},
{
title: "采购订单编号",
key: "poNo",
minWidth: 145,
fixed: "left",
},
{
title: "供应商编号",
key: "supNo",
minWidth: 135,
fixed: "left",
},
{
title: "供应商订单编号",
key: "poSupOrder",
minWidth: 175,
fixed: "left",
render: (h, params) => {
return h(
"Input", {
props: {
type: 'text',
value: params.row.poSupOrder,
},
on: {
'on-blur': (event) => {
this.editSupOrder(params, event, 'poSupOrder');
},
},
},
);
},
},
{
title: "订单类型",
key: "poType",
minWidth: 125,
},
{
title: "付款类型",
key: "poPayType",
minWidth: 125,
},
{
title: "审核状态",
key: "poReviewStatus",
minWidth: 125,
},
{
title: "订单金额",
key: "poTotal",
minWidth: 125,
},
{
title: "是否直发",
key: "poIfDirect",
minWidth: 125,
fixed: "left",
render: (h, params) => {
return h('Select', {
props: {
value: params.row.poIfDirect,
label: params.row.poIfDirectLabel,
transfer: true //解决table中被遮挡
},
on: {
'on-change': e => {
this.editSupOrder(params, e, 'poIfDirect');
}
}
},
[
h('Option', {
props: {
value: '0',
}
}, ''),
h('Option', {
props: {
value: '1',
}
}, '')
]
)
},
},
{
title: "开票状态",
key: "poInvoiceStatus",
minWidth: 125,
},
{
title: "已开票金额",
key: "poInvoiceAmount",
minWidth: 180,
},
],
submitLoading: false,
data: [],
total: 0,
ifDirectValue: null
};
},
methods: {
getDataList() {
// 多条件搜索用户列表
this.loading = true;
getBhPordersListData(this.searchForm).then((res) => {
this.loading = false;
if (res.status == 'success') {
this.data = res.data.list;
this.total = res.data.total;
if (this.data.length == 0 && this.searchForm.pageNumber > 1) {
this.searchForm.pageNumber -= 1;
this.getDataList();
}
}
});
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
this.selectDep = [];
// 重新加载数据
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
editSupOrder(v, e, type) {
if (type == 'poSupOrder') {
if (e.target.value == v.row.poSupOrder) {
return;
}
this.form.poSupOrder = e.target.value
} else {
if (this.ifDirectValue != null && this.ifDirectValue == e) {
return;
} else {
if (e == undefined) {
return;
}
this.ifDirectValue = e;
this.form.poIfDirect = e
}
}
this.form.poNo = v.row.poNo
editBhOrders(this.form).then((res) => {
this.loading = false;
if (res.status == 'success') {
this.$Message.success("操作成功");
this.getDataList();
}
});
}
},
mounted() {
// 计算高度
let height = document.documentElement.clientHeight;
this.maxHeight = Number(height - 287) + "px";
},
};
</script>
.url-remark {
font-size: 14px;
color: #515a6e;
display: block;
color: #9a9a9a;
margin-bottom: -16px;
font-style: italic;
}
\ No newline at end of file
<style lang="less">
@import "@/styles/table-common.less";
@import "./sorders-refund.less";
</style>
<template>
<div class="search">
<Card>
<Row>
<Button @click="add" type="primary" size="large" icon="md-add">添加任务</Button>
</Row>
<Table :loading="loading" class="tableInfoBox" stripe :columns="columns" :data="data" sortable="custom" ref="table"></Table>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>
<Drawer title="任务添加" v-model="showAddSorderTask" width="720" draggable>
<div :style="{ maxHeight: maxHeight }" class="drawer-content">
<Form ref="form" :model="form" :rules="formValidate" label-position="top">
<FormItem label="任务名称" prop="name">
<Input v-model="form.name" autocomplete="off" :maxlength="16" />
</FormItem>
<FormItem label="销售订单号" prop="orderNo">
<Button @click="searchSorderNo" type="primary" size="large" icon="md-search">查询</Button>
<Table class="tableInfoBox" v-model="selectRowVisible" :columns="selectRowColumns" :data="selectRowData" sortable="custom" ref="table"></Table>
</FormItem>
<FormItem label="退货数量" prop="refundNums">
<Tooltip trigger="hover" placement="right">
<InputNumber :max="form.refundNums" :min="1" v-model="form.refundNums"></InputNumber>
</Tooltip>
</FormItem>
<FormItem label="手续费费用" prop="handleFee">
<Tooltip trigger="hover" placement="right">
<Input v-model="form.handleFee"></Input>
</Tooltip>
</FormItem>
<FormItem label="是否转预存" prop="transferPre">
<i-switch size="large" v-model="form.transferPre">
<span slot="open">转预存</span>
<span slot="close">退款</span>
</i-switch>
</FormItem>
</Form>
</div>
<div class="br">
<Button type="primary" :loading="submitLoading" @click="submit">提交</Button>
<Button @click="showAddSorderTask = false">取消</Button>
</div>
</Drawer>
<Modal draggable class="operation" title="销售订单" v-model="menuModalVisible" :mask-closable="false" :width="1500" :styles="{ top: '30px' }">
<Card>
<Form ref="searchSorderForm" :model="searchSorderForm" inline :label-width="70">
<FormItem label="用户名" prop="nickname">
<Input type="text" v-model="searchSorderForm.orderNo" clearable placeholder="订单编号" style="width: 200px" />
</FormItem>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
<Table :loading="searchLoading" class="tableInfoBox" stripe :columns="orderColumns" :data="searchData" sortable="custom" ref="table"></Table>
</Card>
</Modal>
</div>
</template>
<script>
import {
getBhSordersDataDetail,
addSorderRefundTask,
getBhSordersRefundTask,
execBhSordersRefundTask
} from "@/api/index";
import util from "@/libs/util.js";
export default {
name: "menu-manage",
components: {},
data() {
return {
loading: false,
searchLoading: false,
maxHeight: "500px",
form: {},
searchForm: {
pageNumber: 1,
pageSize: 10,
},
searchSorderForm: {
pageNumber: 1,
pageSize: 10,
},
formValidate: {
// 表单验证规则
name: [{
required: true,
message: "请输入任务名称",
trigger: "change"
}, ],
orderNo: [{
required: true,
message: "请输入订单编号",
trigger: "change"
}, ],
refundNums: [{
required: true,
message: "请输入退货数量",
}, ],
handleFee: [{
required: true,
message: "请输入手续费费用",
}, ]
},
columns: [{
type: "index",
width: 60,
align: "center",
},
{
title: "任务名称",
key: "name",
minWidth: 105,
},
{
title: "任务内容",
key: "contentString",
minWidth: 335,
},
{
title: "状态",
key: "status",
minWidth: 55,
render: (h, params) => {
if (params.row.status == 'notexec') {
return h("div", [
h("Badge", {
props: {
status: "default",
text: "未执行",
},
}),
]);
} else if (params.row.status == 'running') {
return h("div", [
h("Badge", {
props: {
status: "processing",
text: "执行中",
},
}),
]);
} else if (params.row.status == 'error') {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "报错",
},
}),
]);
} else if (params.row.status == 'finish') {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "已完成",
},
}),
]);
}
},
},
{
title: "错误信息",
key: "errorMessage",
minWidth: 325,
},
{
title: "执行次数",
key: "execNums",
minWidth: 55,
},
{
title: "创建人",
key: "createBy",
minWidth: 55,
},
{
title: "创建日期",
key: "createdAt",
minWidth: 125,
},
{
title: "更新日期",
key: "updatedat",
minWidth: 125,
},
{
title: "操作",
key: "action",
width: 270,
align: "center",
fixed: "right",
render: (h, params) => {
let execJob = "";
let edit = "";
if (params.row.status != 'finish') {
execJob = h(
"a", {
on: {
click: () => {
this.exec(params.row);
},
},
},
"手动执行"
);
}
/*if (params.row.status == 'notexec') {
edit = h(
"a", {
on: {
click: () => {
this.edit(params.row);
},
},
},
"编辑"
);
}*/
return h("div", [
execJob,
/*h("Divider", {
props: {
type: "vertical",
},
}),*/
]);
},
}
],
orderColumns: [{
title: "品牌",
key: "bCnName",
minWidth: 145,
},
{
title: "成品编号",
key: "pCode",
minWidth: 235,
},
{
title: "cas",
key: "cCas",
minWidth: 235,
},
{
title: "产品名称",
key: "pCnName",
minWidth: 125,
},
{
title: "销售价格",
key: "siPrice",
minWidth: 125,
},
{
title: "折扣价",
key: "siDiscount",
minWidth: 125,
},
{
title: "交期",
key: "siPTod",
minWidth: 125,
},
{
title: "数量",
key: "siNum",
minWidth: 125,
},
{
title: "小计",
key: "siAmount",
minWidth: 125,
},
{
title: "抵扣金额",
key: "siVamount",
minWidth: 125,
},
{
title: "备注",
key: "siNote",
minWidth: 125,
},
{
title: "操作",
key: "action",
width: 270,
align: "center",
fixed: 'right',
render: (h, params) => {
return h("div", [
h(
"a", {
on: {
click: () => {
this.selectRow(params.row);
},
},
},
"选择此项"
),
]);
},
}
],
selectRowColumns: [{
title: "订单编号",
key: "orderNo",
minWidth: 145,
},
{
title: "成品编号",
key: "pCode",
minWidth: 235,
},
{
title: "产品名称",
key: "pCnName",
minWidth: 125,
},
{
title: "销售价格",
key: "siPrice",
minWidth: 125,
},
{
title: "折扣价",
key: "siDiscount",
minWidth: 125,
},
{
title: "数量",
key: "siNum",
minWidth: 125,
},
{
title: "小计",
key: "siAmount",
minWidth: 125,
},
],
submitLoading: false,
data: [],
selectRowData: [],
searchData: [],
total: 0,
showAddSorderTask: false,
menuModalVisible: false,
selectRowVisible: false
};
},
methods: {
init() {
this.getDataList();
},
searchSorderNo() {
this.searchLoading = false;
this.menuModalVisible = true;
},
handleSearch() {
this.searchSorderForm.pageNumber = 1;
this.searchSorderForm.pageSize = 10;
this.searchSorderForm.buttonAction = 'search'
this.getSorderDetail();
},
handleReset() {
this.$refs.searchSorderForm.resetFields();
this.searchSorderForm.pageNumber = 1;
this.searchSorderForm.pageSize = 10;
// 重新加载数据
this.getSorderDetail();
},
getDataList() {
this.loading = true;
getBhSordersRefundTask(this.searchForm).then((res) => {
this.loading = false;
if (res.status == 'success') {
this.data = res.data.list;
this.total = res.data.total;
if (this.data.length == 0 && this.searchForm.pageNumber > 1) {
this.searchForm.pageNumber -= 1;
this.getDataList();
}
}
});
},
getSorderDetail() {
this.searchLoading = true;
getBhSordersDataDetail({
'orderNo': this.searchSorderForm.orderNo
}).then((res) => {
this.searchLoading = false;
if (res.status == 'success') {
this.searchData = res.data;
if (this.searchData.length == 0 && this.searchSorderForm.pageNumber > 1) {
this.searchSorderForm.pageNumber -= 1;
this.getSorderDetail();
}
}
});
},
selectRow(v) {
this.menuModalVisible = false;
if (v) {
let rowData = {}
rowData.orderNo = v.soNo
rowData.pCode = v.pCode
rowData.pCnName = v.pCnName
rowData.siPrice = v.siPrice
rowData.siDiscount = v.siDiscount
rowData.siNum = v.siNum
rowData.siAmount = v.siAmount
this.selectRowData = [rowData]
this.form.orderNo = v.soNo
this.form.itemId = v.siId
this.form.refundNums = v.siNum
this.selectRowVisible = true
}
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
add() {
this.showAddSorderTask = true;
},
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
// 添加
this.submitLoading = true;
addSorderRefundTask(this.form).then((res) => {
this.submitLoading = false;
if (res.status == 'success') {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.showAddSorderTask = false;
}
});
}
});
},
exec(v) {
this.$Modal.confirm({
title: "确认手动执行",
content: "您确认要手动执行该任务? 执行后不能进行编辑及删除",
loading: true,
onOk: () => {
this.form.taskId = v.id
execBhSordersRefundTask(this.form).then((res) => {
this.submitLoading = false;
if (res.status == 'success') {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.showAddSorderTask = false;
this.getDataList()
}
});
},
});
},
edit(v) {
// 转换null为""
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
console.info(data)
let content = JSON.parse(data.execContent)
this.form.itemId = content.item_id
this.form.name = data.name
this.form.refundNums = content.refund_nums
this.form.transferPre = content.transfer_pre
this.form.handleFee = content.handle_fee
this.showAddSorderTask = true;
},
},
mounted() {
// 计算高度
let height = document.documentElement.clientHeight;
this.maxHeight = Number(height - 287) + "px";
this.init()
},
};
</script>
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