pull/6/head
dwj 3 months ago
parent 648ef08f1f
commit 3f3d382407

Binary file not shown.

@ -1,402 +1,550 @@
<template>  <template>
<div class="app-container"> <!-- 创建一个类名为 "app-container" div 作为整体页面容器 -->
<el-card class="filter-container" shadow="never"> <div class="app-container">
<div> <!-- 使用 el-card 组件创建一个卡片式容器用于放置筛选搜索相关内容设置类名为 "filter-container" 并取消阴影效果 -->
<i class="el-icon-search"></i> <el-card class="filter-container" shadow="never">
<span>筛选搜索</span> <div>
<el-button <!-- 使用一个图标元素el-icon-search展示搜索图标 -->
style="float:right" <i class="el-icon-search"></i>
type="primary" <!-- 展示一段文本内容为 "筛选搜索" -->
@click="handleSearchList()" <span>筛选搜索</span>
size="small"> <!-- el-button 组件创建一个按钮设置样式使其右浮动按钮类型为 "primary"点击时调用 "handleSearchList" 方法按钮大小为 "small"文本为 "查询搜索" -->
查询搜索 <el-button
</el-button> style="float:right"
<el-button type="primary"
style="float:right;margin-right: 15px" @click="handleSearchList()"
@click="handleResetSearch()" size="small">
size="small"> 查询搜索
重置 </el-button>
</el-button> <!-- 类似上述按钮设置右浮动及右外边距点击调用 "handleResetSearch" 方法用于重置筛选条件按钮大小为 "small"文本为 "重置" -->
</div> <el-button
<div style="margin-top: 15px"> style="float:right;margin-right: 15px"
<el-form :inline="true" :model="listQuery" size="small" label-width="140px"> @click="handleResetSearch()"
<el-form-item label="输入搜索:"> size="small">
<el-input v-model="listQuery.orderSn" class="input-width" placeholder="订单编号"></el-input> 重置
</el-form-item> </el-button>
<el-form-item label="收货人:"> </div>
<el-input v-model="listQuery.receiverKeyword" class="input-width" placeholder="收货人姓名/手机号码"></el-input> <div style="margin-top: 15px">
</el-form-item> <!-- el-form 组件创建一个内联表单绑定数据模型为 "listQuery"设置表单大小为 "small"标签宽度为 "140px" -->
<el-form-item label="提交时间:"> <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-date-picker <!-- el-form-item 组件定义表单中的一项用于输入订单编号的搜索框双向绑定 "listQuery.orderSn"设置类名控制宽度添加占位提示文本 -->
class="input-width" <el-form-item label="输入搜索:">
v-model="listQuery.createTime" <el-input v-model="listQuery.orderSn" class="input-width" placeholder="订单编号"></el-input>
value-format="yyyy-MM-dd" </el-form-item>
type="date" <!-- 类似上述用于输入收货人相关关键字的搜索框绑定 "listQuery.receiverKeyword" -->
placeholder="请选择时间"> <el-form-item label="收货人:">
</el-date-picker> <el-input v-model="listQuery.receiverKeyword" class="input-width" placeholder="收货人姓名/手机号码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="订单状态:"> <!-- 用于选择提交时间的日期选择器绑定 "listQuery.createTime"设置日期格式类型为 "date"仅选择日期及占位提示文本通过类名控制宽度 -->
<el-select v-model="listQuery.status" class="input-width" placeholder="全部" clearable> <el-form-item label="提交时间:">
<el-option v-for="item in statusOptions" <el-date-picker
:key="item.value" class="input-width"
:label="item.label" v-model="listQuery.createTime"
:value="item.value"> value-format="yyyy-MM-dd"
</el-option> type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<!-- 用于选择订单状态的下拉选择框绑定 "listQuery.status"设置类名控制宽度占位提示文本并允许清空选项通过循环选项数据动态生成下拉选项 -->
<el-form-item label="订单状态:">
<el-select v-model="listQuery.status" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 用于选择订单分类的下拉选择框绑定 "listQuery.orderType"类似上述设置 -->
<el-form-item label="订单分类:">
<el-select v-model="listQuery.orderType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in orderTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 用于选择订单来源的下拉选择框绑定 "listQuery.sourceType"同样的设置方式 -->
<el-form-item label="订单来源:">
<el-select v-model="listQuery.sourceType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in sourceTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<!-- 使用 el-card 组件创建另一个卡片式容器用于展示数据列表相关的标题设置类名为 "operate-container" 并取消阴影效果 -->
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<!-- 创建一个类名为 "table-container" div用于放置展示数据的表格 -->
<div class="table-container">
<!-- el-table 组件创建表格设置引用绑定数据宽度监听行选择变化事件以及控制加载状态等属性 -->
<el-table ref="orderTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<!-- 定义一个选择列用于多选表格行设置宽度和文本对齐方式 -->
<el-table-column type="selection" width="60" align="center"></el-table-column>
<!-- 定义表格列展示编号信息设置宽度和文本对齐方式通过插槽作用域获取对应行数据展示 -->
<el-table-column label="编号" width="80" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<!-- 定义表格列展示订单编号信息设置宽度和文本对齐方式 -->
<el-table-column label="订单编号" width="180" align="center">
<template slot-scope="scope">{{scope.row.orderSn}}</template>
</el-table-column>
<!-- 定义表格列展示提交时间信息设置宽度和文本对齐方式通过管道符调用 formatCreateTime 过滤器对时间进行格式化后展示 -->
<el-table-column label="提交时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<!-- 定义表格列展示用户账号信息设置文本对齐方式通过插槽作用域获取对应行数据展示 -->
<el-table-column label="用户账号" align="center">
<template slot-scope="scope">{{scope.row.memberUsername}}</template>
</el-table-column>
<!-- 定义表格列展示订单金额信息设置宽度和文本对齐方式 -->
<el-table-column label="订单金额" width="120" align="center">
<template slot-scope="scope">{{scope.row.totalAmount}}</template>
</el-table-column>
<!-- 定义表格列展示支付方式信息设置宽度和文本对齐方式通过管道符调用 formatPayType 过滤器对支付方式进行格式化后展示 -->
<el-table-column label="支付方式" width="120" align="center">
<template slot-scope="scope">{{scope.row.payType | formatPayType}}</template>
</el-table-column>
<!-- 定义表格列展示订单来源信息设置宽度和文本对齐方式通过管道符调用 formatSourceType 过滤器对订单来源进行格式化后展示 -->
<el-table-column label="订单来源" width="120" align="center">
<template slot-scope="scope">{{scope.row.sourceType | formatSourceType}}</template>
</el-table-column>
<!-- 定义表格列展示订单状态信息设置宽度和文本对齐方式通过管道符调用 formatStatus 过滤器对订单状态进行格式化后展示 -->
<el-table-column label="订单状态" width="120" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<!-- 定义表格列展示操作按钮设置宽度和文本对齐方式通过插槽作用域根据不同订单状态动态显示相应操作按钮 -->
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleViewOrder(scope.$index, scope.row)"
>查看订单</el-button>
<el-button
size="mini"
@click="handleCloseOrder(scope.$index, scope.row)"
v-show="scope.row.status===0">关闭订单</el-button>
<el-button
size="mini"
@click="handleDeliveryOrder(scope.$index, scope.row)"
v-show="scope.row.status===1">订单发货</el-button>
<el-button
size="mini"
@click="handleViewLogistics(scope.$index, scope.row)"
v-show="scope.row.status===2||scope.row.status===3">订单跟踪</el-button>
<el-button
size="mini"
type="danger"
@click="handleDeleteOrder(scope.$index, scope.row)"
v-show="scope.row.status===4">删除订单</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 创建一个类名为 "batch-operate-container" div用于放置批量操作相关的选择框和按钮 -->
<div class="batch-operate-container">
<!-- el-select 组件创建下拉选择框设置大小绑定数据模型通过循环选项数据动态生成下拉选项 -->
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select> </el-select>
</el-form-item> <!-- el-button 组件创建按钮设置左外边距类名点击调用 "handleBatchOperate" 方法按钮类型为 "primary" 以及按钮大小为 "small"文本为 "确定" -->
<el-form-item label="订单分类:">
<el-select v-model="listQuery.orderType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in orderTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单来源:">
<el-select v-model="listQuery.sourceType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in sourceTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="orderTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="80" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="订单编号" width="180" align="center">
<template slot-scope="scope">{{scope.row.orderSn}}</template>
</el-table-column>
<el-table-column label="提交时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="用户账号" align="center">
<template slot-scope="scope">{{scope.row.memberUsername}}</template>
</el-table-column>
<el-table-column label="订单金额" width="120" align="center">
<template slot-scope="scope">{{scope.row.totalAmount}}</template>
</el-table-column>
<el-table-column label="支付方式" width="120" align="center">
<template slot-scope="scope">{{scope.row.payType | formatPayType}}</template>
</el-table-column>
<el-table-column label="订单来源" width="120" align="center">
<template slot-scope="scope">{{scope.row.sourceType | formatSourceType}}</template>
</el-table-column>
<el-table-column label="订单状态" width="120" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleViewOrder(scope.$index, scope.row)"
>查看订单</el-button>
<el-button
size="mini"
@click="handleCloseOrder(scope.$index, scope.row)"
v-show="scope.row.status===0">关闭订单</el-button>
<el-button
size="mini"
@click="handleDeliveryOrder(scope.$index, scope.row)"
v-show="scope.row.status===1">订单发货</el-button>
<el-button
size="mini"
@click="handleViewLogistics(scope.$index, scope.row)"
v-show="scope.row.status===2||scope.row.status===3">订单跟踪</el-button>
<el-button <el-button
size="mini" style="margin-left: 20px"
type="danger" class="search-button"
@click="handleDeleteOrder(scope.$index, scope.row)" @click="handleBatchOperate()"
v-show="scope.row.status===4">删除订单</el-button> type="primary"
</template> size="small">
</el-table-column> 确定
</el-table> </el-button>
</div>
<!-- 创建一个类名为 "pagination-container" div用于放置分页组件 -->
<div class="pagination-container">
<!-- el-pagination 组件创建分页器设置背景色监听页面大小和当前页变化事件配置分页布局绑定当前页每页显示数量以及可选的每页显示数量选项和总数据条数等属性 -->
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<!-- el-dialog 组件创建一个对话框用于关闭订单时输入备注信息设置标题绑定可见性以及宽度等属性 -->
<el-dialog
title="关闭订单"
:visible.sync="closeOrder.dialogVisible" width="30%">
<span style="vertical-align: top">操作备注</span>
<el-input
style="width: 80%"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="closeOrder.content">
</el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="closeOrder.dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleCloseOrderConfirm"> </el-button>
</span>
</el-dialog>
<!-- 使用 logistics-dialog 组件自定义组件双向绑定 visible 属性推测用于控制显示隐藏 -->
<logistics-dialog v-model="logisticsDialogVisible"></logistics-dialog>
</div> </div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<el-dialog
title="关闭订单"
:visible.sync="closeOrder.dialogVisible" width="30%">
<span style="vertical-align: top">操作备注</span>
<el-input
style="width: 80%"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="closeOrder.content">
</el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="closeOrder.dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleCloseOrderConfirm"> </el-button>
</span>
</el-dialog>
<logistics-dialog v-model="logisticsDialogVisible"></logistics-dialog>
</div>
</template> </template>
<script> <script>
import {fetchList,closeOrder,deleteOrder} from '@/api/order' // '@/api/order' API
import {formatDate} from '@/utils/date'; import {fetchList, closeOrder, deleteOrder} from '@/api/order';
import LogisticsDialog from '@/views/oms/order/components/logisticsDialog'; // '@/utils/date' formatDate
const defaultListQuery = { import {formatDate} from '@/utils/date';
pageNum: 1, // LogisticsDialog
pageSize: 10, import LogisticsDialog from '@/views/oms/order/components/logisticsDialog';
orderSn: null,
receiverKeyword: null, // listQuery null
status: null, const defaultListQuery = {
orderType: null, pageNum: 1,
sourceType: null, pageSize: 10,
createTime: null, orderSn: null,
}; receiverKeyword: null,
export default { status: null,
name: "orderList", orderType: null,
components:{LogisticsDialog}, sourceType: null,
data() { createTime: null,
return { };
listQuery: Object.assign({}, defaultListQuery),
listLoading: true, // Vue datacreatedmethods
list: null,
total: null, export default {
operateType: null, name: '组件名称(这里未定义,可自行补充合适名称)',
multipleSelection: [], data() {
closeOrder:{ return {
dialogVisible:false, // Object.assign defaultListQuery
content:null, listQuery: Object.assign({}, defaultListQuery),
orderIds:[] //
}, list: [],
statusOptions: [ // false
{ listLoading: false,
label: '待付款', // null
value: 0 operateType: null,
}, // label value
{ operateOptions: [],
label: '待发货', //
value: 1 statusOptions: [],
}, //
{ orderTypeOptions: [],
label: '已发货', //
value: 2 sourceTypeOptions: [],
}, //
{ closeOrder: {
label: '已完成', dialogVisible: false,
value: 3 content: null
}, },
{ // false
label: '已关闭', logisticsDialogVisible: false
value: 4
}
],
orderTypeOptions: [
{
label: '正常订单',
value: 0
},
{
label: '秒杀订单',
value: 1
}
],
sourceTypeOptions: [
{
label: 'PC订单',
value: 0
},
{
label: 'APP订单',
value: 1
}
],
operateOptions: [
{
label: "批量发货",
value: 1
},
{
label: "关闭订单",
value: 2
},
{
label: "删除订单",
value: 3
}
],
logisticsDialogVisible:false
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatPayType(value) {
if (value === 1) {
return '支付宝';
} else if (value === 2) {
return '微信';
} else {
return '未支付';
}
},
formatSourceType(value) {
if (value === 1) {
return 'APP订单';
} else {
return 'PC订单';
}
},
formatStatus(value) {
if (value === 1) {
return '待发货';
} else if (value === 2) {
return '已发货';
} else if (value === 3) {
return '已完成';
} else if (value === 4) {
return '已关闭';
} else if (value === 5) {
return '无效订单';
} else {
return '待付款';
}
},
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleViewOrder(index, row){
this.$router.push({path:'/oms/orderDetail',query:{id:row.id}})
},
handleCloseOrder(index, row){
this.closeOrder.dialogVisible=true;
this.closeOrder.orderIds=[row.id];
},
handleDeliveryOrder(index, row){
let listItem = this.covertOrder(row);
this.$router.push({path:'/oms/deliverOrderList',query:{list:[listItem]}})
},
handleViewLogistics(index, row){
this.logisticsDialogVisible=true;
},
handleDeleteOrder(index, row){
let ids=[];
ids.push(row.id);
this.deleteOrder(ids);
},
handleBatchOperate(){
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的订单',
type: 'warning',
duration: 1000
});
return;
}
if(this.operateType===1){
//
let list=[];
for(let i=0;i<this.multipleSelection.length;i++){
if(this.multipleSelection[i].status===1){
list.push(this.covertOrder(this.multipleSelection[i]));
} }
} },
if(list.length===0){ created() {
this.$message({ // fetchList list
message: '选中订单中没有可以发货的订单', // fetchList(this.listQuery).then(response => { this.list = response.data; });
type: 'warning', },
duration: 1000 methods: {
}); // fetchList
return; handleSearchList() {
} //
this.$router.push({path:'/oms/deliverOrderList',query:{list:list}}) this.listLoading = true;
}else if(this.operateType===2){ fetchList(this.listQuery).then(response => {
// this.list = response.data;
this.closeOrder.orderIds=[]; this.listLoading = false;
for(let i=0;i<this.multipleSelection.length;i++){ });
this.closeOrder.orderIds.push(this.multipleSelection[i].id); },
} // handleSearchList listQuery
this.closeOrder.dialogVisible=true; handleResetSearch() {
}else if(this.operateType===3){ // listQuery
// this.listQuery = Object.assign({}, defaultListQuery);
let ids=[]; this.handleSearchList();
for(let i=0;i<this.multipleSelection.length;i++){ },
ids.push(this.multipleSelection[i].id); //
} handleSelectionChange(selections) {
this.deleteOrder(ids); // selections
} },
}, //
handleSizeChange(val){ handleViewOrder(index, row) {
this.listQuery.pageNum = 1; //
this.listQuery.pageSize = val; this.$router.push({path: '/orderDetail', query: {id: row.id}});
this.getList(); },
}, //
handleCurrentChange(val){ <script>
this.listQuery.pageNum = val; // Vue 使
this.getList(); export default {
}, // Vue
handleCloseOrderConfirm() { name: "orderList",
if (this.closeOrder.content == null || this.closeOrder.content === '') { // 使 LogisticsDialog
this.$message({ components: {LogisticsDialog},
message: '操作备注不能为空', data() {
type: 'warning', return {
duration: 1000 // Object.assign defaultListQuery
}); listQuery: Object.assign({}, defaultListQuery),
return; // true
} listLoading: true,
// null
list: null,
// null
total: null,
// null
operateType: null,
//
multipleSelection: [],
// id
closeOrder: {
dialogVisible: false,
content: null,
orderIds: []
},
// label value
statusOptions: [
{
label: '待付款',
value: 0
},
{
label: '待发货',
value: 1
},
{
label: '已发货',
value: 2
},
{
label: '已完成',
value: 3
},
{
label: '已关闭',
value: 4
}
],
//
orderTypeOptions: [
{
label: '正常订单',
value: 0
},
{
label: '秒杀订单',
value: 1
}
],
//
sourceTypeOptions: [
{
label: 'PC订单',
value: 0
},
{
label: 'APP订单',
value: 1
}
],
//
operateOptions: [
{
label: "批量发货",
value: 1
},
{
label: "关闭订单",
value: 2
},
{
label: "删除订单",
value: 3
}
],
// false
logisticsDialogVisible: false
}
},
created() {
// getList
this.getList();
},
filters: {
// formatCreateTime 'yyyy-MM-dd hh:mm:ss'
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
// 1 ''2 '' ''
formatPayType(value) {
if (value === 1) {
return '支付宝';
} else if (value === 2) {
return '微信';
} else {
return '未支付';
}
},
// 1 'APP' 'PC'
formatSourceType(value) {
if (value === 1) {
return 'APP订单';
} else {
return 'PC订单';
}
},
//
formatStatus(value) {
if (value === 1) {
return '待发货';
} else if (value === 2) {
return '已发货';
} else if (value === 3) {
return '已完成';
} else if (value === 4) {
return '已关闭';
} else if (value === 5) {
return '无效订单';
} else {
return '待付款';
}
},
},
methods: {
// listQuery defaultListQuery 便
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
// 1 getList
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
// val multipleSelection
handleSelectionChange(val) {
this.multipleSelection = val;
},
// Vue this.$router'/oms/orderDetail' id
handleViewOrder(index, row) {
this.$router.push({path: '/oms/orderDetail', query: {id: row.id}})
},
// visible true id closeOrder.orderIds 便使
handleCloseOrder(index, row) {
this.closeOrder.dialogVisible = true;
this.closeOrder.orderIds = [row.id];
},
// covertOrder '/oms/deliverOrderList'
handleDeliveryOrder(index, row) {
let listItem = this.covertOrder(row);
this.$router.push({path: '/oms/deliverOrderList', query: {list: [listItem]}})
},
// logisticsDialogVisible true
handleViewLogistics(index, row) {
this.logisticsDialogVisible = true;
},
// ids id deleteOrder ids
handleDeleteOrder(index, row) {
let ids = [];
ids.push(row.id);
this.deleteOrder(ids);
},
//
handleBatchOperate() {
if (this.multipleSelection == null || this.multipleSelection.length < 1) {
this.$message({
message: '请选择要操作的订单',
type: 'warning',
duration: 1000
});
return;
}
// 1
if (this.operateType === 1) {
let list = [];
// 1 covertOrder list
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].status === 1) {
list.push(this.covertOrder(this.multipleSelection[i]));
}
}
// 0
if (list.length === 0) {
this.$message({
message: '选中订单中没有可以发货的订单',
type: 'warning',
duration: 1000
});
return;
}
// '/oms/deliverOrderList'
this.$router.push({path: '/oms/deliverOrderList', query: {list: list}})
} else if (this.operateType === 2) {
// 2
// closeOrder.orderIds id closeOrder.orderIds visible true
this.closeOrder.orderIds = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
this.closeOrder.orderIds.push(this.multipleSelection[i].id);
}
this.closeOrder.dialogVisible = true;
} else if (this.operateType === 3) {
// 3
let ids = [];
// id ids deleteOrder ids
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
this.deleteOrder(ids);
}
},
// 1 getList
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
// getList
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
//
handleCloseOrderConfirm() {
if (this.closeOrder.content == null || this.closeOrder.content === '') {
this.$message({
message: '操作备注不能为空',
type: 'warning',
duration: 1000
});
return;
}
//
}
}
}
</script>
let params = new URLSearchParams(); let params = new URLSearchParams();
params.append('ids', this.closeOrder.orderIds); params.append('ids', this.closeOrder.orderIds);
params.append('note', this.closeOrder.content); params.append('note', this.closeOrder.content);

@ -1,127 +1,163 @@
<template>  <template>
<el-card class="form-container" shadow="never"> <!-- 使用 el-card 组件创建一个卡片式的容器设置类名为 "form-container"并通过 shadow="never" 属性取消卡片的阴影效果 -->
<el-form :model="orderSetting" <el-card class="form-container" shadow="never">
ref="orderSettingForm" <!-- el-form 组件用于创建表单它绑定了名为 "orderSetting" 的数据模型设置了表单的引用名称为 "orderSettingForm"同时指定了表单验证规则 "rules"以及标签的宽度为 150px -->
:rules="rules" <el-form :model="orderSetting"
label-width="150px"> ref="orderSettingForm"
<el-form-item label="秒杀订单超过:" prop="flashOrderOvertime"> :rules="rules"
<el-input v-model="orderSetting.flashOrderOvertime" class="input-width"> label-width="150px">
<template slot="append"></template> <!-- el-form-item 组件用于定义表单中的每一个表单项此处是针对 "秒杀订单超过" 这一设置项的表单项通过 prop 属性指定了验证对应的字段名 -->
</el-input> <el-form-item label="秒杀订单超过:" prop="flashOrderOvertime">
<span class="note-margin">未付款订单自动关闭</span> <!-- el-input 组件创建一个输入框通过 v-model 指令双向绑定了 "orderSetting.flashOrderOvertime" 数据意味着用户在输入框中输入的值会实时更新到对应的数据属性中同时设置了类名 "input-width" 用于控制输入框宽度 -->
</el-form-item> <el-input v-model="orderSetting.flashOrderOvertime" class="input-width">
<el-form-item label="正常订单超过:" prop="normalOrderOvertime"> <!-- 使用 slot="append" 插槽在输入框后面添加一个单位文本 "分"用于提示用户输入的时间单位 -->
<el-input v-model="orderSetting.normalOrderOvertime" class="input-width"> <template slot="append"></template>
<template slot="append"></template> </el-input>
</el-input> <!-- 一个普通的 <span> 标签用于显示一段提示文本设置了类名 "note-margin" 来控制其左边距提示内容为未付款时订单自动关闭的相关说明 -->
<span class="note-margin">未付款订单自动关闭</span> <span class="note-margin">未付款订单自动关闭</span>
</el-form-item> </el-form-item>
<el-form-item label="发货超过:" prop="confirmOvertime"> <!-- 与上面类似的表单项针对 "正常订单超过" 的设置同样有输入框及对应的提示信息 -->
<el-input v-model="orderSetting.confirmOvertime" class="input-width"> <el-form-item label="正常订单超过:" prop="normalOrderOvertime">
<template slot="append"></template> <el-input v-model="orderSetting.normalOrderOvertime" class="input-width">
</el-input> <template slot="append"></template>
<span class="note-margin">未收货订单自动完成</span> </el-input>
</el-form-item> <span class="note-margin">未付款订单自动关闭</span>
<el-form-item label="订单完成超过:" prop="finishOvertime"> </el-form-item>
<el-input v-model="orderSetting.finishOvertime" class="input-width"> <!-- 针对 "发货超过" 的表单项输入框用于输入天数后面跟着相应的提示文本 -->
<template slot="append"></template> <el-form-item label="发货超过:" prop="confirmOvertime">
</el-input> <el-input v-model="orderSetting.confirmOvertime" class="input-width">
<span class="note-margin">自动结束交易不能申请售后</span> <template slot="append"></template>
</el-form-item> </el-input>
<el-form-item label="订单完成超过:" prop="commentOvertime"> <span class="note-margin">未收货订单自动完成</span>
<el-input v-model="orderSetting.commentOvertime" class="input-width"> </el-form-item>
<template slot="append"></template> <!-- 针对 "订单完成超过" 的表单项此处有重复的标签名但应是不同业务场景下的时间设置同样有输入框和对应的提示内容 -->
</el-input> <el-form-item label="订单完成超过:" prop="finishOvertime">
<span class="note-margin">自动五星好评</span> <el-input v-model="orderSetting.finishOvertime" class="input-width">
</el-form-item> <template slot="append"></template>
<el-form-item> </el-input>
<el-button <span class="note-margin">自动结束交易不能申请售后</span>
@click="confirm('orderSettingForm')" </el-form-item>
type="primary">提交</el-button> <!-- 另一个针对 "订单完成超过" 的表单项可能对应不同的业务逻辑如自动五星好评相关的时间设置同样具备输入框和提示文本 -->
</el-form-item> <el-form-item label="订单完成超过:" prop="commentOvertime">
</el-form> <el-input v-model="orderSetting.commentOvertime" class="input-width">
</el-card> <template slot="append"></template>
</el-input>
<span class="note-margin">自动五星好评</span>
</el-form-item>
<!-- 定义一个表单项内部放置一个 el-button 按钮通过 @click 指令绑定了 "confirm('orderSettingForm')" 方法即点击按钮时会调用名为 "confirm" 的方法并传入 "orderSettingForm" 参数按钮类型设置为 "primary"文本显示为 "提交" -->
<el-form-item>
<el-button
@click="confirm('orderSettingForm')"
type="primary">提交</el-button>
</el-form-item>
</el-form>
</el-card>
</template> </template>
<script> <script>
import {getOrderSetting,updateOrderSetting} from '@/api/orderSetting'; // '@/api/orderSetting' "getOrderSetting" "updateOrderSetting"
const defaultOrderSetting = { import {getOrderSetting, updateOrderSetting} from '@/api/orderSetting';
id: null,
flashOrderOvertime: 0, // "defaultOrderSetting" 0 null
normalOrderOvertime: 0, const defaultOrderSetting = {
confirmOvertime: 0, id: null,
finishOvertime: 0, flashOrderOvertime: 0,
commentOvertime: 0 normalOrderOvertime: 0,
}; confirmOvertime: 0,
const checkTime = (rule, value, callback) => { finishOvertime: 0,
if (!value) { commentOvertime: 0
return callback(new Error('时间不能为空')); };
}
console.log("checkTime",value); // "checkTime" 使
let intValue = parseInt(value); const checkTime = (rule, value, callback) => {
if (!Number.isInteger(intValue)) { // callback Error
return callback(new Error('请输入数字值')); if (!value) {
} return callback(new Error('时间不能为空'));
callback(); }
}; console.log("checkTime", value);
export default { // parseInt
name: 'orderSetting', let intValue = parseInt(value);
data() { // callback Error
return { if (!Number.isInteger(intValue)) {
orderSetting: Object.assign({}, defaultOrderSetting), return callback(new Error('请输入数字值'));
rules: {
flashOrderOvertime:{validator: checkTime, trigger: 'blur' },
normalOrderOvertime:{validator: checkTime, trigger: 'blur' },
confirmOvertime: {validator: checkTime, trigger: 'blur' },
finishOvertime: {validator: checkTime, trigger: 'blur' },
commentOvertime:{validator: checkTime, trigger: 'blur' }
} }
} // callback
}, callback();
created(){ };
this.getDetail();
}, // Vue
methods:{ export default {
confirm(formName){ // Vue "orderSetting"
this.$refs[formName].validate((valid) => { name: 'orderSetting',
if (valid) { data() {
this.$confirm('是否要提交修改?', '提示', { return {
confirmButtonText: '确定', // "orderSetting" Object.assign "defaultOrderSetting"
cancelButtonText: '取消', orderSetting: Object.assign({}, defaultOrderSetting),
type: 'warning' // 使 "checkTime" 'blur'
}).then(() => { rules: {
updateOrderSetting(1,this.orderSetting).then(response=>{ flashOrderOvertime: {validator: checkTime, trigger: 'blur'},
this.$message({ normalOrderOvertime: {validator: checkTime, trigger: 'blur'},
type: 'success', confirmOvertime: {validator: checkTime, trigger: 'blur'},
message: '提交成功!', finishOvertime: {validator: checkTime, trigger: 'blur'},
duration:1000 commentOvertime: {validator: checkTime, trigger: 'blur'}
}
}
},
created() {
// "getDetail"
this.getDetail();
},
methods: {
// "confirm" "formName"
confirm(formName) {
// this.$refs[formName] validate "valid"
this.$refs[formName].validate((valid) => {
// "valid" true
if (valid) {
// 使 $confirm "warning"
this.$confirm('是否要提交修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// "" "updateOrderSetting" 1 "orderSetting"
// then 使 $message "!" 1000 1
updateOrderSetting(1, this.orderSetting).then(response => {
this.$message({
type: 'success',
message: '提交成功!',
duration: 1000
});
})
});
} else {
// "valid" false使 $message ""
this.$message({
message: '提交参数不合法',
type: 'warning'
});
return false;
}
}); });
}) },
}); // "getDetail"
} else { getDetail() {
this.$message({ // "getOrderSetting" 1 then "orderSetting" 便
message: '提交参数不合法', getOrderSetting(1).then(response => {
type: 'warning' this.orderSetting = response.data;
}); })
return false; }
} }
});
},
getDetail(){
getOrderSetting(1).then(response=>{
this.orderSetting=response.data;
})
}
} }
}
</script> </script>
<style scoped>
.input-width {
width: 50%;
}
.note-margin { <style scoped>
margin-left: 15px; /* 定义类名为 "input-width" 的样式规则,设置元素的宽度为父元素宽度的 50%,这个类名应用到了输入框上,用于控制输入框在表单中的宽度占比,使其看起来更美观、布局更合理 */
} .input-width {
width: 50%;
}
/* 定义类名为 "note-margin" 的样式规则,设置元素的左边距为 15 像素,这个类名应用到了提示文本的 <span> 标签上,用于控制提示文本与输入框之间的距离,使其有合适的间隔,视觉效果更好 */
.note-margin {
margin-left: 15px;
}
</style> </style>

Loading…
Cancel
Save