This commit is contained in:
悠悠小鹿
2023-03-03 11:36:00 +08:00
parent d8b675fbe6
commit d41d5d1015
49 changed files with 7568 additions and 24897 deletions

View File

@@ -1,217 +1,334 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:buyorderdetail:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:buyorderdetail:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<!-- 订单详细更新 -->
<div>
<ul>
<div class="liName">用户信息</div>
<li><span class="infoTitle">用户名</span><span>{{orderDetails.userName}}</span></li>
<li><span class="infoTitle">用户ID</span><span>{{orderDetails.userId}}</span></li>
<li><span class="infoTitle">联系电话</span><span>{{orderDetails.userPhone}}</span></li>
<li><span class="infoTitle">收货地址</span><span>{{orderDetails.province}}-{{orderDetails.city}}-{{orderDetails.district}}-{{orderDetails.address}}</span></li>
<!-- <li><span class="infoTitle"> </span><span>187898544875</span></li> -->
<!-- <li><span class="infoTitle"> </span><span>天津市天津市天津市天津市天津市天津市</span></li> -->
<li class="line"></li>
<div class="liName">订单信息</div>
<li><span class="infoTitle">订单ID</span><span>{{orderDetails.orderSn}}</span></li>
<li><span class="infoTitle">订单状态</span>
<span v-if="orderDetails.orderStatus == 0" class="hightLight">待付款</span>
<span v-if="orderDetails.orderStatus == 1" class="hightLight">待发货</span>
<span v-if="orderDetails.orderStatus == 2" class="hightLight">已发货</span>
<span v-if="orderDetails.orderStatus == 3" class="hightLight">已完成</span>
<el-button v-if="orderDetails.orderStatus == 1" @click="godeliver" class="text_button" size="mini" type="text">去发货</el-button>
</li>
<!-- <li><span class="infoTitle">商品总数</span><span>{{orderDetails.}}</span></li> -->
<li><span class="infoTitle">订单总金额</span><span>{{orderDetails.realMoney}}</span></li>
<li><span class="infoTitle">交付邮费</span><span>{{orderDetails.shippingMoney}}</span></li>
<li><span class="infoTitle">优惠金额</span><span>0.00</span></li>
<li><span class="infoTitle">会员商品优惠</span><span>0.00</span></li>
<li><span class="infoTitle">积分抵扣</span><span>0.00</span></li>
<li><span class="infoTitle">实际支付金额</span><span>112</span></li>
<li><span class="infoTitle">创建时间</span><span>{{orderDetails.createTime}}</span></li>
<li><span class="infoTitle">支付时间</span><span>{{orderDetails.paymentDate}}</span></li>
<li style="width: 100%;"><span class="infoTitle">支付方式</span>
<span v-if="orderDetails.paymentMethod == 1"><icon-svg name="zhifubao"></icon-svg> <span>支付宝支付</span></span>
<span v-if="orderDetails.paymentMethod == 2"><icon-svg name="weixin"></icon-svg> <span>微信支付</span></span>
<span v-if="orderDetails.paymentMethod == 3">
<!-- <icon-svg name="zhifubao"></icon-svg> -->
<span>IOS内购</span>
</span>
</li>
<li class="line"></li>
<br>
<div class="liName">物流信息</div>
<!-- <el-alert title="`该订单下共有 2 条物流信息`" type="info">
</el-alert> -->
<li class="flexbox deliverBox" style="width: 100%;">
<el-row :gutter="20" style="100%">
<el-col v-if="activities != []" :md="12" :lg="8" class="item" v-for="(item, index) in activities" :key="index">
<div class="deliver_heade">
<div><span class="infoTitle">物流公司</span><span>{{item.ShipperName}}</span></div>
<div><span class="infoTitle">运单号</span><span>{{item.LogisticCode}}</span></div>
<div class="deliver_info">
<div class="scroll" style="padding: 10px;" v-if="item.Traces != []">
<el-timeline>
<el-timeline-item :reverse="reverse" v-for="(activity, index2) in item.Traces" :key="index2" :icon="activity.icon"
:type="activity.Action" :color="activity.color" :size="activity.size"
:timestamp="activity.AcceptTime">
{{ activity.AcceptStation }}
</el-timeline-item>
</el-timeline>
</div>
<div v-else class="noinfo">-暂无物流信息-</div>
</div>
</div>
</el-col>
</el-row>
</li>
<li class="line" style="margin:10px 0;"></li>
<!-- 订单商品 -->
<div class="liName">商品信息</div>
<el-table :data="orderDetails.products"
style="width: 100%">
<el-table-column
label="商品名"
width="280">
<template slot-scope="scope">
<div class="flexbox">
<img style="padding: 2px; border:1px solid #f1f1f1; margin-right: 5px;" :src="scope.row.image" width="30px" height="30px">
<div class="proname">{{ scope.row.productName}}</div>
</div>
</template>
</el-table-column>
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="allOrderId"
header-align="center"
align="center"
label="订单详情id">
</el-table-column>
<el-table-column
prop="orderId"
header-align="center"
align="center"
label="订单表id">
</el-table-column>
<el-table-column
prop="userId"
header-align="center"
align="center"
label="用户id">
</el-table-column>
<el-table-column
prop="productId"
header-align="center"
align="center"
label="商品id">
</el-table-column>
<el-table-column
prop="productName"
header-align="center"
align="center"
label="商品名称">
prop="productPrice"
label="价格"
width="180">
</el-table-column>
<el-table-column
prop="quantity"
header-align="center"
align="center"
label="商品数量">
</el-table-column>
<el-table-column
prop="productPrice"
header-align="center"
align="center"
label="商品单价">
</el-table-column>
<el-table-column
prop="weight"
header-align="center"
align="center"
label="商品重量">
</el-table-column>
<el-table-column
prop="productType"
header-align="center"
align="center"
label="商品类型">
</el-table-column>
<el-table-column
prop="creatTime"
header-align="center"
align="center"
label="下单时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.allOrderId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.allOrderId)">删除</el-button>
</template>
label="数量" width="80">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</ul>
</div>
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> -->
<setDeliverDialog ref="setDeliverDialog" :visible="setDeliverVisible" :selectData="orderList"
@closeDeliverDialog='closeDeliverDialog'></setDeliverDialog>
</div>
</template>
<script>
import AddOrUpdate from './buyorderdetail-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
query:{
orderId:0
}
}
},
components: {
AddOrUpdate
},
activated () {
this.query.orderId = this.$route.query.orderId;
console.log(this.$route.query.orderId)
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/buyorderdetail/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'orderId': this.query.orderId,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
import AddOrUpdate from './buyorderdetail-add-or-update'
import setDeliverDialog from './set-deliver-dialog'
export default {
data() {
return {
orderList:[],
dataForm: {
key: ''
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
reverse: false,
activities: [ ],
deliverData: [], // 物流信息
setDeliverVisible: false,
dataListLoading: false,
dataListSelections: [],
// addOrUpdateVisible: false,
query: {
orderId: 0,
ordertype:null
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.allOrderId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/buyorderdetail/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
orderDetails:{}
}
},
components: {
AddOrUpdate
},
activated() {
this.query.orderId = this.$route.query.orderId;
this.query.ordertype = this.$route.query.ordertype;
console.log(this.$route.query.orderId)
this.getData()
},
methods: {
// 获取 物流
getdeliverDetails(){
let loading = this.$loading({
lock: true,
text: '正在获取物流信息...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http({
url: this.$http.adornUrl('/book/buyorder/queryFMS'),
method: 'post',
params: this.$http.adornParams({
'orderId': this.query.orderId
})
}).then(({ data }) => {
if(data && data.code === 0){
if(data.rntStr != []){
this.activities = data.rntStr
// console.log(this.activities)
}else{
this.activities = []
}
loading.close()
}else{
loading.close()
return this.$message.error('物流获取失败,请重试')
}
})
},
// 获取数据列表
getData() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl(`/book/buyorder/appGetOrderInfo/${this.query.ordertype}`),
method: 'get',
params: this.$http.adornParams({
'orderId': this.query.orderId,
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.orderDetails = data.buyOrder
if(this.query.ordertype != 0){ // 不是待付款订单时
this.getdeliverDetails()
}
} else {
this.orderDetails = {}
return this.$message.error('商品详情获取失败,请重试')
}
this.dataListLoading = false
})
},
closeDeliverDialog(val) {
this.setDeliverVisible = false
this.getData()
},
// 去发货
godeliver() {
this.orderList[0] = this.query.orderId
this.setDeliverVisible = true
}
},
components: {
setDeliverDialog
}
}
</script>
<style lang="less" scoped>
.noinfo {
color: #ddd;
text-align: center;
padding: 20px;
}
.scroll{margin-top: 15px; height: 300px;}
.deliverBox{
flex-wrap: wrap; justify-content: space-between;
.item{padding-right: 15px; min-width: 300px;
.deliver_heade{margin-top: 15px;}
}
}
.el-timeline{
li{
float: none;
}
}
.flexbox {
display: flex;
}
.deliver_info{border-radius: 10px;}
.infoTitle {
display: inline;
}
ul {
overflow: hidden;
color: #515a6e;
li {
list-style: none;
width: 50%;
line-height: 26px;
float: left;
font-size: 12px;
}
.hightLight {
color: #f56c6c;
}
.line {
width: 100%;
border-bottom: 1px solid #eee;
margin: 10px 0;
}
}
.liName {
font-size: 12px;
margin-bottom: 10px;
font-weight: bold;
}
.text_button {
padding: 0;
}
.el-icon-truck:before {
content: "\e740";
}
.el-timeline-item:first-child {
.el-timeline-item__node {
background-color: rgb(11, 189, 135);
}
}
.el-timeline-item {
width: 100%;
position: relative;
padding-bottom: 20px;
}
.el-timeline-item__node--large {
left: -2px;
width: 14px;
height: 14px;
}
.el-timeline-item__node {
position: absolute;
background-color: #e4e7ed;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.el-timeline-item__node--normal {
left: -1px;
width: 12px;
height: 12px;
}
.el-timeline-item__wrapper {
position: relative;
padding-left: 28px;
top: -3px;
}
.el-timeline li {
list-style: none;
}
.el-timeline-item__tail {
position: absolute;
left: 4px;
height: 100%;
border-left: 2px solid #e4e7ed;
}
.el-timeline .el-timeline-item:last-child .el-timeline-item__tail {
display: none;
}
.el-timeline-item__timestamp {
color: #c3c3c3;
font-size: 14px;
;
}
</style>