1 #1

Merged
p6hj2n987 merged 1 commits from huyuqi_branch into main 1 year ago

@ -2,386 +2,622 @@
<div class="detail-container">
<el-card shadow="never">
<span class="font-title-medium">退货商品</span>
<el-table
<!--
使用el-table组件来展示表格数据
border属性用于给表格添加边框使其样式上更清晰的显示表格结构
class="standard-margin" 用于给这个表格元素添加一个自定义的类名通过这个类名可以在CSS中定义相应的外边距等样式规则以控制表格在页面中的布局显示效果
ref="productTable" 是给这个表格元素添加一个引用标识方便在Vue实例的JavaScript代码中通过this.$refs.productTable来获取这个表格组件的实例进而可以调用它的一些方法或者访问它的属性等
:data="productList" 是使用Vue的指令将名为productList的数据绑定到表格组件上这个productList应该是在Vue实例的数据对象中定义好的数组类型的数据表格组件会基于这个数据来渲染每一行的内容
-->
<el-table
border
class="standard-margin"
ref="productTable"
:data="productList">
<el-table-column label="商品图片" width="160" align="center">
<template slot-scope="scope">
<img style="height:80px" :src="scope.row.productPic">
</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<span class="font-small">{{scope.row.productName}}</span><br>
<span class="font-small">品牌{{scope.row.productBrand}}</span>
</template>
</el-table-column>
<el-table-column label="价格/货号" width="180" align="center">
<template slot-scope="scope">
<span class="font-small">价格{{scope.row.productRealPrice}}</span><br>
<span class="font-small">货号NO.{{scope.row.productId}}</span>
</template>
</el-table-column>
<el-table-column label="属性" width="180" align="center">
<template slot-scope="scope">{{scope.row.productAttr}}</template>
</el-table-column>
<el-table-column label="数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.productCount}}</template>
</el-table-column>
<el-table-column label="小计" width="100" align="center">
<template slot-scope="scope">{{totalAmount}}</template>
</el-table-column>
</el-table>
<div style="float:right;margin-top:15px;margin-bottom:15px">
<!-- 这里可以添加<el-table-column>等子组件来定义表格的具体列信息比如列标题列对应的数据字段等 -->
</el-table>
<!--
el-table-column组件用于定义el-table中的列信息
label="商品图片" 属性指定了该列在表格头部显示的标题名称为商品图片这样用户就能直观知晓这一列所代表的数据含义
width="160" 属性设置了该列的宽度为160像素通过设置合适的宽度可以让表格各列布局更加合理美观避免内容显示过于拥挤或稀疏
align="center" 属性将该列中的内容在水平方向上进行居中对齐使展示效果更加整齐规范符合常见的页面布局审美要求
-->
<el-table-column label="商品图片" width="160" align="center">
<!--
template标签结合slot-scope="scope" 是一种在表格列中自定义内容渲染的方式
slot-scope="scope" 这里的scope是一个包含了当前行数据等相关信息的对象通过它可以访问到当前行对应的数据
-->
<template slot-scope="scope">
<!--
img标签用于在表格单元格中展示图片
style="height:80px" 是内联样式用于设置图片的高度为80像素以此来统一该列中图片展示的高度达到整齐美观的视觉效果
:src="scope.row.productPic" 是使用Vue的绑定语法将src属性绑定到scope.row.productPic上也就是从scope对象中获取当前行row对应的商品图片的路径productPic信息从而正确地显示对应的商品图片
-->
<img style="height:80px" :src="scope.row.productPic">
</template>
</el-table-column>
<!--
el-table-column 组件用于在 el-table 中定义具体的列信息
label="商品名称" 属性设定了此列在表格头部所显示的标题文字为商品名称方便用户明确该列所展示的数据内容大致范围
align="center" 属性将该列单元格内的内容在水平方向进行居中对齐让表格内的数据呈现更加规整美观符合常规的页面排版视觉效果要求
-->
<el-table-column label="商品名称" align="center">
<!--
template 标签结合 slot-scope="scope" 的写法是在 Element UI 组件的表格列中自定义单元格内容展示方式的常用手段
slot-scope="scope" 这里定义的 scope 是一个包含了当前行诸多相关信息的对象借助它可以访问到当前行对应表格中的一行数据的具体数据情况
-->
<template slot-scope="scope">
<!--
span 标签在这里用于包裹文本内容使其可以灵活地设置样式以及在 HTML 结构中进行布局
class="font-small" span 标签添加了一个名为font-small的类名通常是在项目的 CSS 文件或者是内联样式所在的样式作用域内中定义了对应的字体大小等样式规则以此来让文本以较小的字体呈现可能是为了在表格单元格内更合理地展示信息避免文字过大而影响整体布局美观性
{{scope.row.productName}} 这是 Vue 中的插值表达式它会将 scope 对象中 row 属性下的 productName 字段对应的值渲染显示出来也就是展示当前行对应的商品名称信息
-->
<span class="font-small">{{scope.row.productName}}</span><br>
<!--
这里同样使用 span 标签结合类名font-small来包裹文本内容用于控制文本的样式呈现
品牌{{scope.row.productBrand}}中的插值表达式 {{scope.row.productBrand}} 用于获取并显示当前行对应的商品品牌信息前面添加品牌这样的固定文字是为了更清晰地告知用户后面跟着的是商品的品牌内容整体在表格单元格内更直观地展示商品相关的关键信息
-->
<span class="font-small">品牌{{scope.row.productBrand}}</span>
</template>
</el-table-column>
<!--
el-table-column 组件用于在 el-table 中定义特定的列信息以此来控制表格每列的展示内容样式等相关属性
label="价格/货号" 属性用于指定该列在表格头部显示的标题内容为价格/货号使用这样的标题可以简洁地告知用户这一列将会呈现商品的价格以及货号相关信息
width="180" 属性设置了此列的宽度为 180 像素通过合理设置列宽能够让表格整体的布局更加协调美观避免不同列的内容显示出现过宽或过窄等影响阅读体验的情况
align="center" 属性使得该列单元格内的所有内容在水平方向上进行居中对齐确保数据展示整齐规范符合常规页面设计中对于表格数据排版的美观要求
-->
<el-table-column label="价格/货号" width="180" align="center">
<!--
template 标签配合 slot-scope="scope" 的写法是在 Element UI 组件的表格列中自定义单元格具体内容呈现方式的常见做法
slot-scope="scope" 这里定义的 scope 是一个包含了当前行各项相关信息的对象借助它可以访问到当前行也就是对应表格中的某一行完整数据的各个数据字段情况
-->
<template slot-scope="scope">
<!--
span 标签用于包裹具体的文本内容通过添加类名等操作可以方便地为其设置样式同时在 HTML 结构里实现灵活的布局效果
class="font-small" span 标签添加了一个名为font-small的类名一般情况下在项目的 CSS 样式文件或者所在的样式作用域内会针对这个类名预先定义相应的样式规则例如设置较小的字体大小等目的是为了让文本以更合适的尺寸在表格单元格内进行展示避免字体过大占据过多空间而影响整体的布局美观程度
价格{{scope.row.productRealPrice}}中的插值表达式 {{scope.row.productRealPrice}} 会从 scope 对象中 row 属性下对应的 productRealPrice 字段获取值并将其渲染显示出来在前面添加价格这样的固定文本描述能更清晰地向用户表明后面跟着的是商品的具体价格信息整体呈现出商品价格的展示形式
-->
<span class="font-small">价格{{scope.row.productRealPrice}}</span><br>
<!--
同样使用 span 标签并添加font-small类名来控制文本样式保持和前面价格展示文本在样式上的一致性
货号NO.{{scope.row.productId}}里的插值表达式 {{scope.row.productId}} 用于获取并展示当前行对应的商品货号信息在前面添加货号NO.的固定文本是为了更直观地告知用户后面显示的是商品的货号让用户可以更清晰地分辨出不同的数据内容符合良好的信息展示规范
-->
<span class="font-small">货号NO.{{scope.row.productId}}</span>
</template>
</el-table-column>
<!--
以下是一系列用于定义 el-table 中不同列信息的 el-table-column 组件
第一个 el-table-column 组件用于定义展示属性信息的列
label="属性" 属性指定了该列在表格头部显示的标题为属性方便用户知晓此列所呈现的数据范畴
width="180" 属性将该列的宽度设置为 180 像素通过合理设定宽度使表格布局更显协调美观避免列宽不合适影响整体展示效果
align="center" 属性让该列单元格内的内容在水平方向上居中对齐确保数据排列整齐规范符合常规的页面设计审美要求
其内部 template 标签结合 slot-scope="scope" 来获取当前行数据并展示相应内容具体来说{{scope.row.productAttr}} 这个插值表达式会从 scope 对象中 row 属性下的 productAttr 字段获取值并渲染显示出来也就是在单元格中展示当前行对应的商品属性信息
-->
<el-table-column label="属性" width="180" align="center">
<template slot-scope="scope">{{scope.row.productAttr}}</template>
</el-table-column>
<!--
第二个 el-table-column 组件用于定义展示数量信息的列
label="数量" 属性设定该列在表格头部的标题为数量清晰表明此列所展示的数据内容
width="100" 属性将列宽设定为 100 像素同样是为了优化表格整体的布局效果让各列宽度适配展示内容的多少
align="center" 属性使得该列内容在水平方向居中对齐增强表格数据展示的规整性
内部 template 标签中通过 {{scope.row.productCount}} 插值表达式 scope 对象的 row 属性下的 productCount 字段获取对应的值并将其展示在单元格中实现当前行商品数量信息的呈现
-->
<el-table-column label="数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.productCount}}</template>
</el-table-column>
<!--
第三个 el-table-column 组件用于定义展示小计信息的列
label="小计" 属性指定了该列在表格头部显示的标题是小计让用户明白此处展示的是经过一定计算后的金额小计数据
width="100" 属性将该列宽度设为 100 像素以适配表格布局使各列看起来疏密得当
align="center" 属性保证该列内容在水平方向上居中对齐提升整体展示的美观度
内部 template 标签里的 {{totalAmount}} 插值表达式这里推测 totalAmount 应该是在 Vue 实例的 data 或者 computed 等相关属性中定义好的一个变量可能是基于商品的单价数量等计算得出的小计金额会将其对应的值渲染显示出来用于展示每一行对应的金额小计情况
-->
<el-table-column label="小计" width="100" align="center">
<template slot-scope="scope">{{totalAmount}}</template>
</el-table-column>
</el-table>
<div style="float:right;margin-top:15px;margin-bottom:15px">
<span class="font-title-medium">合计</span>
<span class="font-title-medium color-danger">{{totalAmount}}</span>
</div>
</el-card>
<el-card shadow="never" class="standard-margin">
<span class="font-title-medium">服务单信息</span>
<div class="form-container-border">
<!--
使用 el-card 组件来创建一个卡片式的布局容器shadow="never" 属性表示该卡片不显示阴影效果class="standard-margin" 用于给卡片添加一个自定义的类名通过这个类名可以在 CSS 中定义相应的外边距等样式规则以控制卡片在页面中的布局显示效果此卡片用于展示服务单相关信息
-->
<el-card shadow="never" class="standard-margin">
<!--
使用 span 标签展示一个标题文本class="font-title-medium" span 标签添加了一个类名用于设置该标题的字体样式推测是中等大小的字体具体样式由项目中对应的 CSS 规则定义文本内容为服务单信息用于明确下方展示内容的主题
-->
<span class="font-title-medium">服务单信息</span>
<!--
div 标签作为一个容器添加了 class="form-container-border" 类名推测用于设置边框等样式来区分不同的信息块内部包含多个 el-row el-col 组件用于布局服务单的各项具体信息
-->
<div class="form-container-border">
<!--
el-row 组件用于创建行布局 Element UI 的栅格系统中多个 el-col 组件放置在 el-row 内来划分列实现灵活的页面布局
以下是第一组 el-row el-col 组件用于展示服务单号信息
-->
<el-row>
<el-col :span="6" class="form-border form-left-bg font-small">服务单号</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.id}}</el-col>
<!--
el-col 组件用于定义列:span="6" 表示该列占 6 在默认 24 份的栅格系统中class="form-border form-left-bg font-small" 给该列添加了类名用于设置边框背景可能是左边栏的背景色用于区分左右内容以及字体大小较小字体同样具体样式由对应 CSS 规则定义文本内容为服务单号作为该信息项的标题显示在左边栏
-->
<el-col :span="6" class="form-border form-left-bg font-small">服务单号</el-col>
<!--
el-col 组件占 18 用于展示服务单号的具体值通过插值表达式 {{orderReturnApply.id}} orderReturnApply 对象的 id 属性获取对应的值并渲染显示class="form-border font-small" 用于设置边框和较小字体样式
-->
<el-col class="form-border font-small" :span="18">{{orderReturnApply.id}}</el-col>
</el-row>
<!--
以下是第二组 el-row el-col 组件用于展示申请状态信息结构和功能与展示服务单号类似不同之处在于展示的值通过管道符|使用了 formatStatus 过滤器推测是在 Vue 实例中定义好的用于对状态值进行格式化处理比如转换为更友好的文字描述等
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">申请状态</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.status | formatStatus}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">申请状态</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.status | formatStatus}}</el-col>
</el-row>
<!--
以下是第三组 el-row el-col 组件用于展示订单编号信息除了通过插值表达式 {{orderReturnApply.orderSn}} 展示订单编号具体值外还添加了一个 el-button 组件
el-button 组件的 type="text" 表示是文本样式按钮外观上更简洁类似普通文本链接效果size="small" 表示小尺寸按钮@click="handleViewOrder" 绑定了点击事件点击该按钮会调用 Vue 实例中定义的 handleViewOrder 方法用于实现查看订单的相关操作
对应列设置了 height line-height 样式来控制高度和行高使布局更美观
-->
<el-row>
<el-col :span="6" class="form-border form-left-bg font-small" style="height:50px;line-height:30px">订单编号
</el-col>
<el-col class="form-border font-small" :span="18" style="height:50px">
{{orderReturnApply.orderSn}}
<el-button type="text" size="small" @click="handleViewOrder"></el-button>
</el-col>
<el-col :span="6" class="form-border form-left-bg font-small" style="height:50px;line-height:30px">订单编号
</el-col>
<el-col class="form-border font-small" :span="18" style="height:50px">
{{orderReturnApply.orderSn}}
<el-button type="text" size="small" @click="handleViewOrder"></el-button>
</el-col>
</el-row>
<!--
以下是第四组 el-row el-col 组件用于展示申请时间信息通过插值表达式 {{orderReturnApply.createTime | formatTime}} 展示申请时间具体值使用了 formatTime 过滤器推测用于将时间格式进行格式化比如转换为指定的日期时间格式等
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">申请时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.createTime | formatTime}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">申请时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.createTime | formatTime}}</el-col>
</el-row>
<!--
以下是第五组 el-row el-col 组件用于展示用户账号信息通过插值表达式 {{orderReturnApply.memberUsername}} 展示用户账号具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">用户账号</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.memberUsername}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">用户账号</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.memberUsername}}</el-col>
</el-row>
<!--
以下是第六组 el-row el-col 组件用于展示联系人信息通过插值表达式 {{orderReturnApply.returnName}} 展示联系人具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系人</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnName}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">联系人</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnName}}</el-col>
</el-row>
<!--
以下是第七组 el-row el-col 组件用于展示联系电话信息通过插值表达式 {{orderReturnApply.returnPhone}} 展示联系电话具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnPhone}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnPhone}}</el-col>
</el-row>
<!--
以下是第八组 el-row el-col 组件用于展示退货原因信息通过插值表达式 {{orderReturnApply.reason}} 展示退货原因具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">退货原因</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.reason}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">退货原因</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.reason}}</el-col>
</el-row>
<!--
以下是第九组 el-row el-col 组件用于展示问题描述信息通过插值表达式 {{orderReturnApply.description}} 展示问题描述具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">问题描述</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.description}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">问题描述</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.description}}</el-col>
</el-row>
<!--
以下是第十组 el-row el-col 组件用于展示凭证图片信息el-col 列设置了 height 样式控制高度内部使用 v-for 指令对 proofPics 数组进行循环遍历推测 proofPics 是一个包含图片路径等信息的数组对于每个元素 item通过 :src="item" 将其作为图片的 src 属性值展示对应的图片图片设置了 width height 样式控制大小为 80px×80px
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:100px;line-height:80px">凭证图片
</el-col>
<el-col class="form-border font-small" :span="18" style="height:100px">
<img v-for="item in proofPics" style="width:80px;height:80px" :src="item">
</el-col>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:100px;line-height:80px">凭证图片
</el-col>
<el-col class="form-border font-small" :span="18" style="height:100px">
<img v-for="item in proofPics" style="width:80px;height:80px" :src="item">
</el-col>
</el-row>
</div>
<div class="form-container-border">
</div>
<!--
以下又是一个添加了 class="form-container-border" 类名的 div 容器用于展示另一部分服务单相关信息内部同样由多个 el-row el-col 组件构成
-->
<div class="form-container-border">
<!--
以下是第一组 el-row el-col 组件用于展示订单金额信息通过插值表达式 {{totalAmount}} 展示订单金额具体值前面添加符号表示人民币金额
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">订单金额</el-col>
<el-col class="form-border font-small" :span="18">{{totalAmount}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">订单金额</el-col>
<el-col class="form-border font-small" :span="18">{{totalAmount}}</el-col>
</el-row>
<!--
以下是第二组 el-row el-col 组件用于展示确认退款金额信息除了展示固定的符号外还使用了 el-input 组件
el-input 组件的 size="small" 表示小尺寸输入框v-model="updateStatusParam.returnAmount" 使用双向数据绑定将输入框的值与 Vue 实例中 updateStatusParam 对象的 returnAmount 属性进行绑定方便数据的获取和更新:disabled="orderReturnApply.status!==0" 根据服务单申请状态是否为 0 来决定输入框是否可用如果状态不是 0 则不可用并设置了 width 样式控制宽度以及 margin-left 样式控制左边距
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">确认退款金额
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-input size="small" v-model="updateStatusParam.returnAmount"
:disabled="orderReturnApply.status!==0"
style="width:200px;margin-left: 10px"></el-input>
</el-col>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">确认退款金额
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-input size="small" v-model="updateStatusParam.returnAmount"
:disabled="orderReturnApply.status!==0"
style="width:200px;margin-left: 10px"></el-input>
</el-col>
</el-row>
<!--
以下 v-show="orderReturnApply.status!==3" 指令根据服务单申请状态是否不等于 3 来决定是否显示内部包含的元素用于在特定状态下展示相关信息内部是一组与选择收货相关的 el-row el-col 组件
-->
<div v-show="orderReturnApply.status!==3">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">选择收货点
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-select size="small"
style="width:200px"
:disabled="orderReturnApply.status!==0"
v-model="updateStatusParam.companyAddressId">
<el-option v-for="address in companyAddressList"
:key="address.id"
:value="address.id"
:label="address.addressName">
</el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货人姓名</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.name}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">所在区域</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress | formatRegion}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">详细地址</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.detailAddress}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.phone}}</el-col>
</el-row>
<!--
以下是第一组用于展示选择收货点信息的 el-row el-col 组件el-col 中使用 el-select 组件来创建一个下拉选择框
el-select 组件的 size="small" 表示小尺寸下拉框style="width:200px" 设置宽度:disabled="orderReturnApply.status!==0" 根据服务单申请状态是否为 0 来决定下拉框是否可用v-model="updateStatusParam.companyAddressId" 通过双向数据绑定将选择的值与 Vue 实例中 updateStatusParam 对象的 companyAddressId 属性进行绑定内部通过 v-for 指令循环遍历 companyAddressList 数组推测是包含收货点地址信息的数组为每个元素 address 创建一个 el-option 选项通过 :key:value :label 属性分别设置选项的唯一标识对应的值以及显示的文本内容
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">选择收货点
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-select size="small"
style="width:200px"
:disabled="orderReturnApply.status!==0"
v-model="updateStatusParam.companyAddressId">
<el-option v-for="address in companyAddressList"
:key="address.id"
:value="address.id"
:label="address.addressName">
</el-option>
</el-select>
</el-col>
</el-row>
<!--
以下是第二组用于展示收货人姓名信息的 el-row el-col 组件通过插值表达式 {{currentAddress.name}} 展示收货人姓名具体值推测 currentAddress 是当前选择或关联的收货地址对象
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货人姓名</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.name}}</el-col>
</el-row>
<!--
以下是第三组用于展示所在区域信息的 el-row el-col 组件通过插值表达式 {{currentAddress | formatRegion}} 展示所在区域具体值使用了 formatRegion 过滤器推测用于对地址区域信息进行格式化处理使其显示更规范等
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">所在区域</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress | formatRegion}}</el-col>
</el-row>
<!--
以下是第四组用于展示详细地址信息的 el-row el-col 组件通过插值表达式 {{currentAddress.detailAddress}} 展示详细地址具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">详细地址</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.detailAddress}}</el-col>
</el-row>
<!--
以下是第五组用于展示联系电话信息的 el-row el-col 组件通过插值表达式 {{currentAddress.phone}} 展示联系电话具体值
-->
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.phone}}</el-col>
</el-row>
</div>
</div>
<div class="form-container-border" v-show="orderReturnApply.status!==0">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleMan}}</el-col>
</el-row>
</div>
<!--
以下是一个添加了 class="form-container-border" 类名且通过 v-show="orderReturnApply.status!==0" 根据服务单申请状态是否不等于 0 来决定是否显示的 div 容器内部包含用于展示处理人员处理时间处理备注等相关信息的 el-row el-col 组件结构和功能与前面类似时间相关的值使用对应的时间格式化过滤器进行处理
-->
<div class="form-container-border" v-show="orderReturnApply.status!==0">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleTime | formatTime}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">处理人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleMan}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleNote}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">处理时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleTime | formatTime}}</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===2">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveMan}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">处理备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleNote}}</el-col>
</el-row>
</div>
<!--
以下是一个添加了 class="form-container-border" 类名且通过 v-show="orderReturnApply.status===2" 根据服务单申请状态是否等于 2 来决定是否显示的 div 容器内部包含用于展示收货人员收货时间收货备注等相关信息的 el-row el-col 组件结构和功能与前面类似时间相关的值使用对应的时间格式化过滤器进行处理
-->
<div class="form-container-border" v-show="orderReturnApply.status===2">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" >收货时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveTime | formatTime}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">收货人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveMan}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveNote}}</el-col>
<el-col class="form-border form-left-bg font-small" :span="6" >收货时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveTime | formatTime}}</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===0">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">处理备注</el-col>
<el-col class="form-border font-small" :span="18">
<el-input size="small" v-model="updateStatusParam.handleNote" style="width:200px;margin-left: 10px"></el-input>
</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===1">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">收货备注</el-col>
<el-col class="form-border font-small" :span="18">
<el-input size="small" v-model="updateStatusParam.receiveNote" style="width:200px;margin-left: 10px"></el-input>
</el-col>
<el-col class="form-border form-left-bg font-small" :span="6">收货备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveNote}}</el-col>
</el-row>
</div>
<div style="margin-top:15px;text-align: center" v-show="orderReturnApply.status===0">
<el-button type="primary" size="small" @click="handleUpdateStatus(1)">退</el-button>
<el-button type="danger" size="small" @click="handleUpdateStatus(3)">退</el-button>
</div>
<div style="margin-top:15px;text-align: center" v-show="orderReturnApply.status===1">
<el-button type="primary" size="small" @click="handleUpdateStatus(2)"></el-button>
</div>
</div>
</el-card>
</div>
</template>
<script>
import {getApplyDetail,updateApplyStatus} from '@/api/returnApply';
import {fetchList} from '@/api/companyAddress';
import {formatDate} from '@/utils/date';
const defaultUpdateStatusParam = {
companyAddressId: null,
handleMan: 'admin',
handleNote: null,
receiveMan: 'admin',
receiveNote: null,
returnAmount: 0,
status: 0
};
const defaultOrderReturnApply = {
id: null,
orderId: null,
companyAddressId: null,
productId: null,
orderSn: null,
createTime: null,
memberUsername: null,
returnAmount: null,
returnName: null,
returnPhone: null,
status: null,
handleTime: null,
productPic: null,
productName: null,
productBrand: null,
productAttr: null,
productCount: null,
productPrice: null,
productRealPrice: null,
reason: null,
description: null,
proofPics: null,
handleNote: null,
handleMan: null,
receiveMan: null,
receiveTime: null,
receiveNote: null
};
export default {
name: 'returnApplyDetail',
data() {
return {
// @/api/returnApply getApplyDetail updateApplyStatus API
import {getApplyDetail, updateApplyStatus} from '@/api/returnApply';
// @/api/companyAddress fetchList API
import {fetchList} from '@/api/companyAddress';
// @/utils/date formatDate
import {formatDate} from '@/utils/date';
// defaultUpdateStatusParam
const defaultUpdateStatusParam = {
companyAddressId: null,
handleMan: 'admin',
handleNote: null,
receiveMan: 'admin',
receiveNote: null,
returnAmount: 0,
status: 0
};
// defaultOrderReturnApply null
const defaultOrderReturnApply = {
id: null,
orderReturnApply: Object.assign({},defaultOrderReturnApply),
productList: null,
orderId: null,
companyAddressId: null,
productId: null,
orderSn: null,
createTime: null,
memberUsername: null,
returnAmount: null,
returnName: null,
returnPhone: null,
status: null,
handleTime: null,
productPic: null,
productName: null,
productBrand: null,
productAttr: null,
productCount: null,
productPrice: null,
productRealPrice: null,
reason: null,
description: null,
proofPics: null,
updateStatusParam: Object.assign({}, defaultUpdateStatusParam),
companyAddressList: null
}
},
created() {
this.id = this.$route.query.id;
this.getDetail();
},
computed: {
totalAmount() {
if (this.orderReturnApply != null) {
return this.orderReturnApply.productRealPrice * this.orderReturnApply.productCount;
} else {
return 0;
}
},
currentAddress() {
console.log("currentAddress()");
let id = this.updateStatusParam.companyAddressId;
if(this.companyAddressList==null)return {};
for (let i = 0; i < this.companyAddressList.length; i++) {
let address = this.companyAddressList[i];
if (address.id === id) {
return address;
}
}
return null;
}
},
filters: {
formatStatus(status) {
if (status === 0) {
return "待处理";
} else if (status === 1) {
return "退货中";
} else if (status === 2) {
return "已完成";
} else {
return "已拒绝";
}
},
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatRegion(address) {
let str = address.province;
if (address.city != null) {
str += " " + address.city;
}
str += " " + address.region;
return str;
}
},
methods: {
handleViewOrder(){
this.$router.push({path:'/oms/orderDetail',query:{id:this.orderReturnApply.orderId}});
},
getDetail() {
getApplyDetail(this.id).then(response => {
console.log("getDetail")
this.orderReturnApply = response.data;
this.productList = [];
this.productList.push(this.orderReturnApply);
if (this.orderReturnApply.proofPics != null) {
this.proofPics = this.orderReturnApply.proofPics.split(",")
}
//退
if(this.orderReturnApply.status===1||this.orderReturnApply.status===2){
this.updateStatusParam.returnAmount=this.orderReturnApply.returnAmount;
this.updateStatusParam.companyAddressId=this.orderReturnApply.companyAddressId;
}
this.getCompanyAddressList();
});
},
getCompanyAddressList() {
fetchList().then(response => {
console.log("getCompanyAddressList()")
this.companyAddressList = response.data;
for (let i = 0; i < this.companyAddressList.length; i++) {
if (this.companyAddressList[i].receiveStatus === 1&&this.orderReturnApply.status===0) {
this.updateStatusParam.companyAddressId = this.companyAddressList[i].id;
handleNote: null,
handleMan: null,
receiveMan: null,
receiveTime: null,
receiveNote: null
};
// Vue returnApplyDetail
export default {
name: 'returnApplyDetail',
// Vue data
data() {
return {
// null
id: null,
// Object.assign orderReturnApply defaultOrderReturnApply
orderReturnApply: Object.assign({}, defaultOrderReturnApply),
// null
productList: null,
// null
proofPics: null,
// Object.assign updateStatusParam defaultUpdateStatusParam
updateStatusParam: Object.assign({}, defaultUpdateStatusParam),
// null
companyAddressList: null
}
},
// created
created() {
// id id
this.id = this.$route.query.id;
// getDetail
this.getDetail();
},
// computed
computed: {
// totalAmount
totalAmount() {
// orderReturnApply null
if (this.orderReturnApply!= null) {
// productRealPriceproductCount
return this.orderReturnApply.productRealPrice * this.orderReturnApply.productCount;
} else {
// orderReturnApply null 0
return 0;
}
},
// currentAddress
currentAddress() {
console.log("currentAddress()");
// updateStatusParam ID
let id = this.updateStatusParam.companyAddressId;
// null
if (this.companyAddressList == null) return {};
//
for (let i = 0; i < this.companyAddressList.length; i++) {
let address = this.companyAddressList[i];
// ID
if (address.id === id) {
return address;
}
}
// null
return null;
}
},
// filters
filters: {
// formatStatus
formatStatus(status) {
if (status === 0) {
return "待处理";
} else if (status === 1) {
return "退货中";
} else if (status === 2) {
return "已完成";
} else {
return "已拒绝";
}
},
// formatTime
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
// formatRegion
formatRegion(address) {
let str = address.province;
if (address.city!= null) {
str += " " + address.city;
}
str += " " + address.region;
return str;
}
},
// methods
methods: {
// handleViewOrder
handleViewOrder() {
// 使 Vue Router $router.push /oms/orderDetail ID 便
this.$router.push({path: '/oms/orderDetail', query: {id: this.orderReturnApply.orderId}});
},
// getDetail
getDetail() {
console.log("getDetail")
// getApplyDetail API ID
getApplyDetail(this.id).then(response => {
// orderReturnApply
this.orderReturnApply = response.data;
//
this.productList = [];
//
this.productList.push(this.orderReturnApply);
// proofPics null proofPics 便
if (this.orderReturnApply.proofPics!= null) {
this.proofPics = this.orderReturnApply.proofPics.split(",")
}
// 1退 2退 ID 使
if (this.orderReturnApply.status === 1 || this.orderReturnApply.status === 2) {
this.updateStatusParam.returnAmount = this.orderReturnApply.returnAmount;
this.updateStatusParam.companyAddressId = this.orderReturnApply.companyAddressId;
}
// getCompanyAddressList
this.getCompanyAddressList();
});
},
// getCompanyAddressList
getCompanyAddressList() {
console.log("getCompanyAddressList()")
// fetchList API
fetchList().then(response => {
// companyAddressList
this.companyAddressList = response.data;
//
for (let i = 0; i < this.companyAddressList.length; i++) {
// 1 0 ID ID
if (this.companyAddressList[i].receiveStatus === 1 && this.orderReturnApply.status === 0) {
this.updateStatusParam.companyAddressId = this.companyAddressList[i].id;
}
}
});
},
// handleUpdateStatus
handleUpdateStatus(status) {
// status 使
this.updateStatusParam.status = status;
// 使 $confirm Element UI
this.$confirm('是否要进行此操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// updateApplyStatus API ID
updateApplyStatus(this.id, this.updateStatusParam).then(response => {
// 使 $message Element UI
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000
});
// 使 $router.back() 退
this.$router.back();
});
});
}
}
});
},
handleUpdateStatus(status){
this.updateStatusParam.status=status;
this.$confirm('是否要进行此操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateApplyStatus(this.id,this.updateStatusParam).then(response=>{
this.$message({
type: 'success',
message: '操作成功!',
duration:1000
});
this.$router.back();
});
});
}
}
}
}
</script>
<style scoped>
.detail-container {
position: absolute;
left: 0;
right: 0;
width: 1080px;
padding: 35px 35px 15px 35px;
margin: 20px auto;
}
.standard-margin {
margin-top: 15px;
}
.form-border {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
}
.form-container-border {
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
margin-top: 15px;
}
.form-left-bg {
background: #F2F6FC;
}
</style>
/* 定义名为 detail-container 的类选择器样式设置其定位为绝对定位水平方向铺满整个父容器left: 0; right: 0;),宽度为 1080 像素,设置内边距以及外边距,用于布局和样式展示,可能是整个服务单详情页面的主要容器样式 */
.detail-container {
position: absolute;
left: 0;
right: 0;
width: 1080px;
padding: 35px 35px 15px 35px;
margin: 20px auto;
}
/* 定义名为 standard-margin 的类选择器样式,设置顶部外边距为 15 像素,用于给某些元素添加统一的间距,使页面布局更美观 */
.standard-margin {
margin-top: 15px;
}
/* 定义名为 form-border 的类选择器样式,设置右边框和下边框为 1 像素的实线,颜色为 #DCDFE6同时设置内边距用于给表单相关的元素添加边框和合适的内边距使其展示更清晰、美观 */
.form-border {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
}
/* 定义名为 form-container-border 的类选择器样式,设置左边框和上边框为 1 像素的实线,颜色为 #DCDFE6同时设置顶部外边距用于给包含表单元素的容器添加边框区分不同的信息块 */
.form-container-border {
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
margin-top: 15px;
}
/* 定义名为 form-left-bg 的类选择器样式,设置背景颜色为 #F2F6FC可能用于给表单左边栏等特定区域设置背景色起到区分和美化的作用 */
.form-left-bg {
background: #F2F6FC;
}
</style>

@ -1,275 +1,380 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input v-model="listQuery.id" class="input-width" placeholder="服务单号"></el-input>
</el-form-item>
<el-form-item label="处理状态:">
<el-select v-model="listQuery.status" placeholder="全部" clearable class="input-width">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<template>
<!-- 整个页面内容的容器添加了 app-container 类名用于整体布局和样式控制 -->
<div class="app-container">
<!-- 使用 el-card 组件创建一个卡片式的容器用于放置筛选搜索相关的内容设置 shadow="never" 表示不显示阴影效果添加了 filter-container 类名用于样式定制 -->
<el-card class="filter-container" shadow="never">
<div>
<!-- 使用 el-icon-search 图标类Element UI 提供的图标展示一个搜索图标用于提示用户此处是筛选搜索功能区域 -->
<i class="el-icon-search"></i>
<!-- 展示一个文本标签内容为筛选搜索用于明确此区域的功能 -->
<span>筛选搜索</span>
<!-- 使用 el-button 组件创建一个按钮设置样式为右浮动float:right按钮类型为 primary通常是主要操作按钮的样式绑定了点击事件 handleSearchList()点击按钮会调用该方法按钮尺寸为 small小尺寸按钮按钮文本为查询搜索用于触发查询搜索的操作 -->
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<!-- 使用 el-button 组件创建一个按钮设置样式为右浮动且距离右边有 15 像素的外边距float:right;margin-right: 15px绑定了点击事件 handleResetSearch()点击按钮会调用该方法按钮尺寸为 small按钮文本为重置用于将筛选搜索的条件重置为默认状态 -->
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<!-- 使用 el-form 组件创建一个表单设置 :inline="true" 表示表单为行内表单各表单项在一行内排列:model="listQuery" 将表单数据与 listQuery 对象进行双向绑定size="small" 表示表单尺寸为小尺寸label-width="140px" 设置表单标签的宽度为 140 像素用于布局表单各项输入框和选择框等元素 -->
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<!-- el-form-item 组件用于定义表单中的每一项此处的标签文本为输入搜索用于提示用户此项的功能 -->
<el-form-item label="输入搜索:">
<!-- 使用 el-input 组件创建一个输入框通过 v-model="listQuery.id" 将输入框的值与 listQuery 对象中的 id 属性进行双向绑定添加了 input-width 类名推测用于设置宽度等样式 CSS 部分有定义placeholder="服务单号" 设置输入框的占位提示文本为服务单号用户可在此输入服务单号相关内容进行搜索 -->
<el-input v-model="listQuery.id" class="input-width" placeholder="服务单号"></el-input>
</el-form-item>
<el-form-item label="处理状态:">
<!-- 使用 el-select 组件创建一个下拉选择框通过 v-model="listQuery.status" 将选择框选中的值与 listQuery 对象中的 status 属性进行双向绑定placeholder="全部" 设置占位提示文本为全部clearable 表示可以清空选择框的值添加了 input-width 类名用于样式设置内部通过 v-for 指令循环遍历 statusOptions 数组 Vue 实例的 data 或其他地方定义为每个元素创建一个 el-option 选项用于展示不同的处理状态选项供用户选择 -->
<el-select v-model="listQuery.status" placeholder="全部" clearable class="input-width">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="申请时间:">
<!-- 使用 el-date-picker 组件创建一个日期选择器添加了 input-width 类名用于样式设置通过 v-model="listQuery.createTime" 将选择的日期值与 listQuery 对象中的 createTime 属性进行双向绑定value-format="yyyy-MM-dd" 定义日期选择器返回的日期格式为yyyy-MM-ddtype="date" 表示选择器类型为日期选择只选择年月日placeholder="请选择时间" 设置占位提示文本用户可在此选择申请时间进行筛选 -->
<el-date-picker
class="input-width"
v-model="listQuery.createTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="操作人员:">
<!-- 使用 el-input 组件创建一个输入框通过 v-model="listQuery.handleMan" 将输入框的值与 listQuery 对象中的 handleMan 属性进行双向绑定添加了 input-width 类名用于样式设置placeholder="全部" 设置占位提示文本为全部用户可在此输入操作人员相关内容进行搜索 -->
<el-input v-model="listQuery.handleMan" class="input-width" placeholder="全部"></el-input>
</el-form-item>
<el-form-item label="处理时间:">
<!-- 使用 el-date-picker 组件创建一个日期选择器与上面申请时间的日期选择器类似通过 v-model="listQuery.handleTime" 将选择的日期值与 listQuery 对象中的 handleTime 属性进行双向绑定用于选择处理时间进行筛选 -->
<el-date-picker
class="input-width"
v-model="listQuery.handleTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</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>
<!-- 创建一个 div 容器添加了 table-container 类名用于样式控制用于放置数据表格相关内容 -->
<div class="table-container">
<!-- 使用 el-table 组件创建一个表格ref="returnApplyTable" 给表格添加一个引用标识方便在 Vue 实例的 JavaScript 代码中通过 this.$refs.returnApplyTable 来获取这个表格组件的实例:data="list" 将表格的数据与 list 数组 Vue 实例中定义用于存储要展示的数据列表进行绑定设置表格宽度为 100%铺满父容器绑定了 @selection-change 事件当表格行的选择状态改变时会调用 handleSelectionChange 方法v-loading="listLoading" 根据 listLoading 的值布尔类型用于表示是否正在加载数据来显示或隐藏加载动画border 属性给表格添加边框使表格样式更清晰 -->
<el-table ref="returnApplyTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<!-- 使用 el-table-column 组件定义表格的列type="selection" 表示此列为选择列用于勾选表格行width="60" 设置列宽为 60 像素align="center" 将列内容在水平方向居中对齐 -->
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="服务单号" width="180" align="center">
<!-- 在表格列中使用 template 结合 slot-scope="scope" 的方式自定义单元格内容的展示通过插值表达式 {{scope.row.id}} scope 对象中 row 属性下的 id 字段获取对应的值并渲染显示也就是展示每一行对应的服务单号信息 -->
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="申请时间" width="180" align="center">
<!-- 同样使用 template slot-scope 自定义单元格内容展示通过插值表达式 {{scope.row.createTime | formatTime}} 展示申请时间信息使用了 formatTime 过滤器 Vue 实例的 filters 中定义用于将时间格式进行格式化处理对时间数据进行处理后再展示 -->
<template slot-scope="scope">{{scope.row.createTime | formatTime}}</template>
</el-table-column>
<el-table-column label="用户账号" align="center">
<!-- 通过插值表达式 {{scope.row.memberUsername}} 展示每一行对应的用户账号信息 scope 对象中获取相关数据 -->
<template slot-scope="scope">{{scope.row.memberUsername}}</template>
</el-table-column>
<el-table-column label="退款金额" width="180" align="center">
<!-- 通过插值表达式 {{scope.row | formatReturnAmount}} 展示退款金额信息使用了 formatReturnAmount 过滤器 Vue 实例的 filters 中定义用于根据业务逻辑计算并返回退款金额的值可能是基于商品价格数量等因素计算对数据进行处理后再展示前面添加符号表示人民币金额 -->
<template slot-scope="scope">{{scope.row | formatReturnAmount}}</template>
</el-table-column>
<el-table-column label="申请状态" width="180" align="center">
<!-- 通过插值表达式 {{scope.row.status | formatStatus}} 展示申请状态信息使用了 formatStatus 过滤器 Vue 实例的 filters 中定义用于将状态的数字值转换为对应的文字描述使展示更友好易懂对状态数据进行处理后再展示 -->
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="处理时间" width="180" align="center">
<!-- 通过插值表达式 {{scope.row.handleTime | formatTime}} 展示处理时间信息使用 formatTime 过滤器对时间数据进行格式化处理后展示 -->
<template slot-scope="scope">{{scope.row.handleTime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<!-- 在表格列的单元格中使用 el-button 组件创建一个按钮设置按钮尺寸为 mini最小尺寸按钮绑定了点击事件 handleViewDetail(scope.$index, scope.row)点击按钮会调用该方法并传入当前行的索引scope.$index和当前行的数据对象scope.row按钮文本为查看详情用于跳转到对应服务单的详情页面查看详细信息 -->
<el-button
size="mini"
@click="handleViewDetail(scope.$index, scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 创建一个 div 容器添加了 batch-operate-container 类名用于样式控制用于放置批量操作相关的元素如下拉选择框和按钮等 -->
<div class="batch-operate-container">
<!-- 使用 el-select 组件创建一个下拉选择框设置尺寸为 small通过 v-model="operateType" 将选择框选中的值与 operateType 属性进行双向绑定placeholder="批量操作" 设置占位提示文本用于选择要进行的批量操作类型内部通过 v-for 指令循环遍历 operateOptions 数组 Vue 实例的 data 中定义为每个元素创建一个 el-option 选项展示不同的批量操作选项供用户选择 -->
<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-form-item>
<el-form-item label="申请时间:">
<el-date-picker
class="input-width"
v-model="listQuery.createTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="操作人员:">
<el-input v-model="listQuery.handleMan" class="input-width" placeholder="全部"></el-input>
</el-form-item>
<el-form-item label="处理时间:">
<el-date-picker
class="input-width"
v-model="listQuery.handleTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</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="returnApplyTable"
: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="180" 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.createTime | formatTime}}</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="180" align="center">
<template slot-scope="scope">{{scope.row | formatReturnAmount}}</template>
</el-table-column>
<el-table-column label="申请状态" width="180" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="处理时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.handleTime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<!-- 使用 el-button 组件创建一个按钮设置样式距离左边有 20 像素的外边距margin-left: 20px添加了 search-button 类名推测用于样式设置虽然 CSS 部分未看到具体样式定义绑定了点击事件 handleBatchOperate()点击按钮会调用该方法按钮类型为 primary按钮尺寸为 small按钮文本为确定用于触发批量操作的执行 -->
<el-button
size="mini"
@click="handleViewDetail(scope.$index, scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<!-- 创建一个 div 容器添加了 pagination-container 类名用于样式控制用于放置分页相关的组件 -->
<div class="pagination-container">
<!-- 使用 el-pagination 组件创建分页器background 属性表示给分页按钮等添加背景色绑定了 @size-change 事件和 @current-change 事件分别在页面大小改变和当前页码改变时调用 handleSizeChange 方法和 handleCurrentChange 方法layout 属性定义分页器的布局显示哪些元素如总条数每页条数选择上一页页码下一页跳转到指定页等:current-page.sync="listQuery.pageNum" 通过双向绑定将当前页码与 listQuery 对象中的 pageNum 属性关联起来:page-size="listQuery.pageSize" 将每页显示的条数与 listQuery 对象中的 pageSize 属性关联起来:page-sizes="[5,10,15]" 定义可选择的每页条数的选项数组:total="total" 将总数据条数与 total 属性关联起来用于分页功能的展示和交互 -->
<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>
</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>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {fetchList,deleteApply} from '@/api/returnApply';
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
id: null,
receiverKeyword: null,
status: null,
createTime: null,
handleMan: null,
handleTime: null
};
const defaultStatusOptions=[
{
label: '待处理',
value: 0
},
{
label: '退货中',
value: 1
},
{
label: '已完成',
value: 2
},
{
label: '已拒绝',
value: 3
}
];
export default {
name:'returnApplyList',
data() {
return {
listQuery:Object.assign({},defaultListQuery),
statusOptions: Object.assign({},defaultStatusOptions),
list:null,
total:null,
listLoading:false,
multipleSelection:[],
operateType:1,
operateOptions: [
{
label: "批量删除",
// @/utils/date formatDate 使
import {formatDate} from '@/utils/date';
// @/api/returnApply fetchList deleteApply fetchList deleteApply API
import {fetchList, deleteApply} from '@/api/returnApply';
// defaultListQuery
//
// pageNum: 1
// pageSize: 10 10
// id: null
// receiverKeyword: null
// status: null
// createTime: null
// handleMan: null
// handleTime: null
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
id: null,
receiverKeyword: null,
status: null,
createTime: null,
handleMan: null,
handleTime: null
};
// defaultStatusOptions
// 'label' '' 'value'使 0
const defaultStatusOptions = [
{
label: '待处理',
value: 0
},
{
label: '退货中',
value: 1
}
],
}
},
created(){
this.getList();
},
filters:{
formatTime(time) {
if(time==null||time===''){
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(status){
for(let i=0;i<defaultStatusOptions.length;i++){
if(status===defaultStatusOptions[i].value){
return defaultStatusOptions[i].label;
}
}
},
formatReturnAmount(row){
return row.productRealPrice*row.productCount;
}
},
methods:{
handleSelectionChange(val){
this.multipleSelection = val;
},
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleViewDetail(index,row){
this.$router.push({path:'/oms/returnApplyDetail',query:{id:row.id}})
},
handleBatchOperate(){
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的申请',
type: 'warning',
duration: 1000
});
return;
},
{
label: '已完成',
value: 2
},
{
label: '已拒绝',
value: 3
}
if(this.operateType===1){
//
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
let ids=[];
for(let i=0;i<this.multipleSelection.length;i++){
ids.push(this.multipleSelection[i].id);
];
// returnApplyList Vue
export default {
name:'returnApplyList',
// data
data() {
return {
// Object.assign listQuery defaultListQuery
listQuery: Object.assign({}, defaultListQuery),
// Object.assign statusOptions defaultStatusOptions
statusOptions: Object.assign({}, defaultStatusOptions),
// null fetchList
list: null,
// null便
total: null,
// false fetchList true false便
listLoading: false,
// handleSelectionChange
multipleSelection: [],
// 1 1
operateType: 1,
// 'label' "" 'value' 1
operateOptions: [
{
label: "批量删除",
value: 1
}
],
}
},
// created getList
created() {
this.getList();
},
// filters
filters: {
// formatTime
// time null 'N/A'
// time new Date(time) JavaScript Date formatDate @/utils/date 'yyyy-MM-dd hh:mm:ss'
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
// formatStatus
// defaultStatusOptions status value label 便
formatStatus(status) {
for (let i = 0; i < defaultStatusOptions.length; i++) {
if (status === defaultStatusOptions[i].value) {
return defaultStatusOptions[i].label;
}
}
},
// formatReturnAmount 退
// row productRealPrice productCount退便退
formatReturnAmount(row) {
return row.productRealPrice * row.productCount;
}
},
// methods
methods: {
// handleSelectionChange
// val multipleSelection 使 multipleSelection 便
handleSelectionChange(val) {
this.multipleSelection = val;
},
// handleResetSearch
// listQuery defaultListQuery
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
// handleSearchList
// listQuery pageNum 1 getList listQuery
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
// handleViewDetail
// index row
// 使 Vue Router $router.push '/oms/returnApplyDetail' id row.id 便 id
handleViewDetail(index, row) {
this.$router.push({path: '/oms/returnApplyDetail', query: {id: row.id}})
},
// handleBatchOperate
// multipleSelection null 1 $message Element UI
// operateType 1 $confirm Element UI
//
// 1. URLSearchParams URL
// 2. multipleSelection id ids
// 3. 使 params.append("ids", ids) ids URLSearchParams
// 4. deleteApply params then getList $message
handleBatchOperate() {
if (this.multipleSelection == null || this.multipleSelection.length < 1) {
this.$message({
message: '请选择要操作的申请',
type: 'warning',
duration: 1000
});
return;
}
if (this.operateType === 1) {
//
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
params.append("ids", ids);
deleteApply(params).then(response => {
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
}
},
// handleSizeChange
// val listQuery pageNum 1 listQuery pageSize val getList
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
// handleCurrentChange
// val listQuery pageNum val getList
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
// getList
// listLoading true
// fetchList listQuery then
// 1. listLoading false
// 2. list
// 3. total 便
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
}
params.append("ids",ids);
deleteApply(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
}
},
handleSizeChange(val){
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val){
this.listQuery.pageNum = val;
this.getList();
},
getList(){
this.listLoading=true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
}
}
}
</script>
<style scoped>
/* .input-width 203
HTML 模板中那些添加了这个类名的元素比如某些输入框等就会应用这个宽度样式起到统一控制相关元素宽度使页面布局更规整的作用 */
.input-width {
width: 203px;
}
width: 203px;
}
</style>

@ -104,6 +104,14 @@
</el-dialog>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {fetchList,deleteReason,updateStatus,addReason,getReasonDetail,updateReason} from '@/api/returnReason';
@ -264,6 +272,9 @@
}
}
</script>
<style scoped>
.input-width {
width: 80%;

@ -1,12 +1,26 @@
<template> 
<template>
<!-- el-dialog组件用于创建一个对话框这里用于展示订单跟踪相关内容 -->
<!-- title属性设置对话框的标题为"订单跟踪" -->
<!-- :visible.sync是双向绑定属性用于控制对话框的显示与隐藏绑定到组件实例中的visible属性 -->
<!-- :before-close绑定了一个关闭前的处理函数handleClose用于在关闭对话框时执行一些操作 -->
<!-- width属性设置对话框的宽度为页面宽度的40% -->
<el-dialog title="订单跟踪"
:visible.sync="visible"
:before-close="handleClose"
width="40%">
<!-- el-steps组件用于创建竖向排列的步骤条用于展示订单物流的各个步骤 -->
<!-- direction="vertical"表示步骤条竖向排列 -->
<!-- :active="6"表示默认激活第6个步骤索引从0开始计数 -->
<!-- finish-status="success"表示已完成的步骤显示为成功状态通常有相应的样式体现 -->
<!-- space="50px"设置每个步骤之间的间距为50像素 -->
<el-steps direction="vertical"
:active="6"
finish-status="success"
space="50px">
<!-- 使用v-for指令循环遍历logisticsList数组为每个元素创建一个el-step组件用于展示物流的单个步骤 -->
<!-- :key属性绑定唯一标识这里用item.name便于Vue进行高效的DOM更新 -->
<!-- :title属性绑定步骤的标题对应item.name -->
<!-- :description属性绑定步骤的描述信息对应item.time -->
<el-step v-for="item in logisticsList"
:key="item.name"
:title="item.name"
@ -15,6 +29,7 @@
</el-dialog>
</template>
<script>
// nametime
const defaultLogisticsList=[
{name: '订单已提交,等待付款',time:'2017-04-01 12:00:00 '},
{name: '订单付款成功',time:'2017-04-01 12:00:00 '},
@ -26,14 +41,17 @@
];
export default {
name:'logisticsDialog',
// value
props: {
value: Boolean
},
computed:{
visible: {
// getvisiblevalue
get() {
return this.value;
},
// setvisiblevisiblevalue
set(visible){
this.value=visible;
}
@ -41,19 +59,20 @@
},
data() {
return {
// logisticsListlogisticsList
logisticsList:Object.assign({},defaultLogisticsList)
}
},
methods:{
// emitInput'input'val
emitInput(val) {
this.$emit('input', val)
},
// emitInputfalsevisible
handleClose(){
this.emitInput(false);
}
}
}
</script>
<style></style>
<style></style>

@ -1,99 +1,134 @@
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>发货列表</span>
</el-card>
<div class="table-container">
<el-table ref="deliverOrderTable"
style="width: 100%;"
:data="list" border>
<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.receiverName}}</template>
</el-table-column>
<el-table-column label="手机号码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPhone}}</template>
</el-table-column>
<el-table-column label="邮政编码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPostCode}}</template>
</el-table-column>
<el-table-column label="收货地址" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="配送方式" width="160" align="center">
<template slot-scope="scope">
<el-select placeholder="请选择物流公司"
v-model="scope.row.deliveryCompany"
size="small">
<el-option v-for="item in companyOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="物流单号" width="180" align="center">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.deliverySn"></el-input>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 15px;text-align: center">
<el-button @click="cancel"></el-button>
<el-button @click="confirm" type="primary">确定</el-button>
</div>
<template>
<!-- 整个页面内容的外层容器添加了 app-container 类名用于整体的布局控制以及样式应用可能在对应的 CSS 文件中有相关样式定义 -->
<div class="app-container">
<!-- 使用 el-card 组件创建一个卡片式的容器添加了 operate-container 类名用于特定样式定制设置 shadow="never" 表示该卡片不显示阴影效果内部包含一个图标和一个文本标签用于提示此区域是和发货列表相关的内容 -->
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>发货列表</span>
</el-card>
<!-- 创建一个 div 容器添加了 table-container 类名用于样式控制用于放置包含发货信息的表格以及相关操作按钮等内容 -->
<div class="table-container">
<!-- 使用 el-table 组件创建一个表格ref="deliverOrderTable" 给表格添加了一个引用标识方便在 Vue 实例的 JavaScript 代码中通过 this.$refs.deliverOrderTable 来获取这个表格组件的实例设置表格宽度为 100%以铺满父容器通过 :data="list" 将表格要展示的数据与 list 数组 Vue 实例的 data 中定义进行绑定border 属性用于给表格添加边框使其样式更清晰美观 -->
<el-table ref="deliverOrderTable"
style="width: 100%;"
:data="list" border>
<!-- 使用 el-table-column 组件定义表格的列label="订单编号" 设置该列在表头显示的标题为订单编号width="180" 设置列宽为 180 像素align="center" 将列内容在水平方向上进行居中对齐内部使用 template 结合 slot-scope="scope" 的方式来自定义单元格内容展示通过插值表达式 {{scope.row.orderSn}} scope 对象中 row 属性下的 orderSn 字段获取对应的值并渲染显示也就是展示每一行对应的订单编号信息 -->
<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.receiverName}}</template>
</el-table-column>
<el-table-column label="手机号码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPhone}}</template>
</el-table-column>
<el-table-column label="邮政编码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPostCode}}</template>
</el-table-column>
<el-table-column label="收货地址" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="配送方式" width="160" align="center">
<template slot-scope="scope">
<!-- 在表格列的单元格中使用 el-select 组件创建一个下拉选择框placeholder="请选择物流公司" 设置下拉框的占位提示文本v-model="scope.row.deliveryCompany" 通过双向数据绑定将选择框选中的值与当前行数据对象scope.row中的 deliveryCompany 属性进行绑定方便数据的更新与获取size="small" 表示下拉框为小尺寸内部通过 v-for 指令循环遍历 companyOptions 数组 Vue 实例的 data 中定义用于存储物流公司名称列表为每个元素创建一个 el-option 选项:key:label :value 都设置为当前元素也就是每个选项的唯一标识显示文本以及对应的值都为物流公司名称用于展示可供选择的物流公司选项 -->
<el-select placeholder="请选择物流公司"
v-model="scope.row.deliveryCompany"
size="small">
<el-option v-for="item in companyOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="物流单号" width="180" align="center">
<template slot-scope="scope">
<!-- 在表格列的单元格中使用 el-input 组件创建一个输入框size="small" 表示输入框为小尺寸v-model="scope.row.deliverySn" 通过双向数据绑定将输入框的值与当前行数据对象scope.row中的 deliverySn 属性进行绑定方便输入物流单号后的数据更新与获取 -->
<el-input size="small" v-model="scope.row.deliverySn"></el-input>
</template>
</el-table-column>
</el-table>
<!-- 创建一个 div 容器设置顶部外边距为 15 像素margin-top: 15px文本水平居中text-align: center用于放置操作按钮包括取消确定按钮 -->
<div style="margin-top: 15px;text-align: center">
<!-- 使用 el-button 组件创建一个按钮绑定了 click 事件点击按钮会调用 cancel 方法 Vue 实例的 methods 中定义按钮文本为取消用于取消当前操作并返回上一个页面等相关逻辑 -->
<el-button @click="cancel"></el-button>
<!-- 使用 el-button 组件创建一个按钮绑定了 click 事件点击按钮会调用 confirm 方法 Vue 实例的 methods 中定义按钮类型为 primary通常表示主要操作按钮样式上会有相应突出显示按钮文本为确定用于触发发货操作等相关业务逻辑 -->
<el-button @click="confirm" type="primary">确定</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import {deliveryOrder} from '@/api/order'
const defaultLogisticsCompanies=["顺丰快递","圆通快递","中通快递","韵达快递"];
export default {
name: 'deliverOrderList',
data() {
return {
list:[],
companyOptions:defaultLogisticsCompanies
}
},
created(){
this.list= this.$route.query.list;
//list
if(this.list instanceof Array===false){
this.list=[];
}
},
methods:{
cancel(){
this.$router.back();
},
confirm(){
this.$confirm('是否要进行发货操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deliveryOrder(this.list).then(response=>{
this.$router.back();
this.$message({
type: 'success',
message: '发货成功!'
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消发货'
});
});
}
// @/api/order deliveryOrder API
import {deliveryOrder} from '@/api/order'
// defaultLogisticsCompanies
const defaultLogisticsCompanies = ["顺丰快递", "圆通快递", "中通快递", "韵达快递"];
// deliverOrderList Vue
export default {
name: 'deliverOrderList',
// data
data() {
return {
//
list: [],
// defaultLogisticsCompanies companyOptions 使
companyOptions: defaultLogisticsCompanies
}
},
// created list
created() {
// list list
this.list = this.$route.query.list;
// list instanceof Array list list
if (this.list instanceof Array === false) {
this.list = [];
}
},
// methods
methods: {
// cancel Vue Router $router.back() 退
cancel() {
this.$router.back();
},
// confirm
confirm() {
// 使 $confirm Element UI warning
this.$confirm('是否要进行发货操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// deliveryOrder API list then
// 1. $router.back() 退
// 2. 使 $message Element UI
deliveryOrder(this.list).then(response => {
this.$router.back();
this.$message({
type: 'success',
message: '发货成功!'
});
});
}).catch(() => {
// catch 使 $message
this.$message({
type: 'info',
message: '已取消发货'
});
});
}
}
}
}
</script>
<style></style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,127 +1,207 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="orderSetting"
ref="orderSettingForm"
:rules="rules"
label-width="150px">
<el-form-item label="秒杀订单超过:" prop="flashOrderOvertime">
<el-input v-model="orderSetting.flashOrderOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未付款订单自动关闭</span>
</el-form-item>
<el-form-item label="正常订单超过:" prop="normalOrderOvertime">
<el-input v-model="orderSetting.normalOrderOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未付款订单自动关闭</span>
</el-form-item>
<el-form-item label="发货超过:" prop="confirmOvertime">
<el-input v-model="orderSetting.confirmOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未收货订单自动完成</span>
</el-form-item>
<el-form-item label="订单完成超过:" prop="finishOvertime">
<el-input v-model="orderSetting.finishOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动结束交易不能申请售后</span>
</el-form-item>
<el-form-item label="订单完成超过:" prop="commentOvertime">
<el-input v-model="orderSetting.commentOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动五星好评</span>
</el-form-item>
<el-form-item>
<el-button
@click="confirm('orderSettingForm')"
type="primary">提交</el-button>
</el-form-item>
</el-form>
</el-card>
<template>
<!-- 使用 el-card 组件创建一个卡片式的布局容器设置类名为 "form-container"阴影效果为 "never"即无阴影用于包裹整个订单设置的表单内容 -->
<el-card class="form-container" shadow="never">
<!-- 使用 el-form 组件创建表单绑定表单数据模型为 "orderSetting"设置表单的引用名为 "orderSettingForm"方便后续通过 $refs 来获取表单实例进行验证等操作
同时通过 :rules 绑定验证规则对象 "rules"设置表单标签的宽度为 150px用于统一表单中各个表单项标签的显示宽度 -->
<el-form :model="orderSetting"
ref="orderSettingForm"
:rules="rules"
label-width="150px">
<!-- 以下是各个表单项el-form-item的定义每个表单项对应一个订单设置的时间相关配置 -->
<!-- 秒杀订单超时未付款自动关闭的时间设置表单项 -->
<el-form-item label="秒杀订单超过:" prop="flashOrderOvertime">
<!-- 使用 el-input 组件创建一个输入框通过 v-model 双向绑定 "orderSetting.flashOrderOvertime" 数据意味着用户在输入框中输入的值会实时更新到这个数据属性中
同时设置输入框的类名为 "input-width"用于控制输入框的宽度样式在后面的 <style> 部分定义了该类对应的宽度为 50% -->
<el-input v-model="orderSetting.flashOrderOvertime" class="input-width">
<!-- 使用 slot="append" 定义一个后置插槽在输入框后面添加一个文本内容 "分"用于提示用户输入的时间单位是分钟 -->
<template slot="append"></template>
</el-input>
<!-- 展示一个提示文本设置类名为 "note-margin"在后面 <style> 部分定义了该类的左边距样式用于提示用户该项设置对应的业务含义即秒杀订单超过设定时间未付款会自动关闭 -->
<span class="note-margin">未付款订单自动关闭</span>
</el-form-item>
<!-- 正常订单超时未付款自动关闭的时间设置表单项结构和上面秒杀订单的类似 -->
<el-form-item label="正常订单超过:" prop="normalOrderOvertime">
<el-input v-model="orderSetting.normalOrderOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未付款订单自动关闭</span>
</el-form-item>
<!-- 发货后超时未收货自动完成订单的时间设置表单项 -->
<el-form-item label="发货超过:" prop="confirmOvertime">
<el-input v-model="orderSetting.confirmOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未收货订单自动完成</span>
</el-form-item>
<!-- 订单完成后超时自动结束交易且不能申请售后的时间设置表单项 -->
<el-form-item label="订单完成超过:" prop="finishOvertime">
<el-input v-model="orderSetting.finishOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动结束交易不能申请售后</span>
</el-form-item>
<!-- 订单完成后超时自动给予五星好评的时间设置表单项 -->
<el-form-item label="订单完成超过:" prop="commentOvertime">
<el-input v-model="orderSetting.commentOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动五星好评</span>
</el-form-item>
<!-- 定义一个提交按钮的表单项 -->
<el-form-item>
<!-- 使用 el-button 组件创建一个按钮设置按钮的点击事件为调用 "confirm('orderSettingForm')" 方法在后面的 methods 中定义按钮类型为 "primary"通常是主要的突出显示的按钮样式按钮文字为 "提交" -->
<el-button
@click="confirm('orderSettingForm')"
type="primary">提交</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {getOrderSetting,updateOrderSetting} from '@/api/orderSetting';
const defaultOrderSetting = {
id: null,
flashOrderOvertime: 0,
normalOrderOvertime: 0,
confirmOvertime: 0,
finishOvertime: 0,
commentOvertime: 0
};
const checkTime = (rule, value, callback) => {
if (!value) {
return callback(new Error('时间不能为空'));
}
console.log("checkTime",value);
let intValue = parseInt(value);
if (!Number.isInteger(intValue)) {
return callback(new Error('请输入数字值'));
}
callback();
};
export default {
name: 'orderSetting',
data() {
return {
orderSetting: Object.assign({}, defaultOrderSetting),
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' }
// '@/api/orderSetting' getOrderSetting updateOrderSetting
import {getOrderSetting, updateOrderSetting} from '@/api/orderSetting';
// defaultOrderSetting
// 0 id null
//
const defaultOrderSetting = {
id: null,
flashOrderOvertime: 0,
normalOrderOvertime: 0,
confirmOvertime: 0,
finishOvertime: 0,
commentOvertime: 0
};
// checkTime
// rulevaluecallback
const checkTime = (rule, value, callback) => {
// callback Error ''
//
if (!value) {
return callback(new Error('时间不能为空'));
}
}
},
created(){
this.getDetail();
},
methods:{
confirm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否要提交修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateOrderSetting(1,this.orderSetting).then(response=>{
this.$message({
type: 'success',
message: '提交成功!',
duration:1000
console.log("checkTime", value);
// 使 parseInt intValue
let intValue = parseInt(value);
// 使 Number.isInteger
// callback Error ''
if (!Number.isInteger(intValue)) {
return callback(new Error('请输入数字值'));
}
// callback
callback();
};
// Vue 'orderSetting' Vue
export default {
// Vue 'orderSetting'
name: 'orderSetting',
// data 使 DOM
data() {
return {
// 使 Object.assign defaultOrderSetting orderSetting
// orderSetting 使
orderSetting: Object.assign({}, defaultOrderSetting),
// rules
// validator 使 checkTime trigger 'blur'
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'}
}
}
},
// created getDetail methods
// 便
created() {
this.getDetail();
},
//
methods: {
// confirm formName 'orderSettingForm' el-form ref
confirm(formName) {
// $refs[formName] 'orderSettingForm' validate
// validate validtrue false
this.$refs[formName].validate((valid) => {
if (valid) {
// 使 $confirm Vue Element UI confirm
// '?' '' '' '' 'warning'
this.$confirm('是否要提交修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// '' updateOrderSetting API
// 1 1 this.orderSetting
//
updateOrderSetting(1, this.orderSetting).then(response => {
// updateOrderSetting
// 使 $message Vue Element UI
// 'success'绿 '!' 1000 1
this.$message({
type: 'success',
message: '提交成功!',
duration: 1000
});
})
});
} else {
// 使 $message 'warning'
//
this.$message({
message: '提交参数不合法',
type: 'warning'
});
return false;
}
});
})
});
} else {
this.$message({
message: '提交参数不合法',
type: 'warning'
});
return false;
}
});
},
getDetail(){
getOrderSetting(1).then(response=>{
this.orderSetting=response.data;
})
}
},
// getDetail getOrderSetting API
// 1 1 orderSetting
// orderSetting
getDetail() {
getOrderSetting(1).then(response => {
this.orderSetting = response.data;
})
}
}
}
}
</script>
<style scoped>
.input-width {
width: 50%;
}
/* 定义一个类名为 "input-width" 的样式规则,设置元素的宽度为 50%,用于控制前面模板中 el-input 组件输入框的宽度,使其在页面上展示的宽度占父容器的一半 */
.input-width {
width: 50%;
}
.note-margin {
margin-left: 15px;
}
/* 定义一个类名为 "note-margin" 的样式规则,设置元素的左边距为 15px用于控制前面模板中那些提示文本span 元素)的左边距,使其与输入框等元素有一定的间隔,布局更加美观清晰 */
.note-margin {
margin-left: 15px;
}
</style>

Loading…
Cancel
Save