Files
nuttyreading-master-html/src/views/modules/order/buyorderdetail.vue
2023-10-19 18:04:56 +08:00

527 lines
17 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="mod-config">
<!-- 订单详细更新 -->
<div class="orderType">
<span v-if="orderDetails.orderStatus == 0" class="item hightLight0">待付款</span>
<span v-if="orderDetails.orderStatus == 1" class="item hightLight1">待发货</span>
<span v-if="orderDetails.orderStatus == 2" class="item hightLight2">已发货</span>
<span v-if="orderDetails.orderStatus == 3" class="item hightLight3">已完成</span>
</div>
<div>
<ul class="list">
<div class="liName">用户信息</div>
<li><span class="infoTitle">用户名</span><span>{{orderDetails.userName ? 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><br/></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.orderMoney}}</span></li>
<li><span class="infoTitle">交付邮费</span><span>{{orderDetails.shippingMoney}}</span></li>
<li><span class="infoTitle" v-if="orderDetails.orderStatus > 0">实际支付金额</span><span>{{orderDetails.realMoney}}</span></li>
<li><span class="infoTitle">创建时间</span><span>{{orderDetails.createTime}}</span></li>
<li><span class="infoTitle" v-if="orderDetails.orderStatus > 0">支付时间</span><span>{{orderDetails.paymentDate}}</span></li>
<li style="width: 100%;" v-if="orderDetails.orderStatus > 0"><span class="infoTitle">支付方式</span>
<span v-if="orderDetails.paymentMethod == 2"><icon-svg name="zhifubao"></icon-svg> <span>支付宝支付</span></span>
<span v-if="orderDetails.paymentMethod == 1"><icon-svg name="weixin"></icon-svg> <span>微信支付</span></span>
<span v-if="orderDetails.paymentMethod == 4"><img src="../../../../static/img/oder_chong.png" width="22px" height="22px"> <span>疯币支付</span></span>
<span v-if="orderDetails.paymentMethod == 3">
<!-- <icon-svg name="zhifubao"></icon-svg> -->
<span>IOS内购</span>
</span>
</li>
<li class="line"></li>
<div style="clear:both"></div>
<div v-if="orderDetails.orderStatus > 0">
<div class="liName">优惠信息</div>
<li><span class="infoTitle">优惠金额</span><span>0</span></li>
<li><span class="infoTitle">会员商品优惠</span><span>0</span></li>
<li><span class="infoTitle">积分抵扣</span><span>0</span></li>
<li class="line"></li>
</div>
<div style="clear:both"></div>
<div class="liName">物流信息 <a href="#" @click="changeAddressShow" v-if="orderDetails.orderStatus <= 1"><i class="el-icon-edit"></i>修改收货信息</a></div>
<li><span class="infoTitle">收货人</span><span>{{orderDetails.shippingUser}}</span>&nbsp;&nbsp;&nbsp;<span>{{orderDetails.userPhone}}</span></li>
<li><span class="infoTitle">收货地址</span><span>{{orderDetails.province}}-{{orderDetails.city}}-{{orderDetails.district}}-{{orderDetails.address}}</span></li>
<!-- <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.productUrl" width="30px" height="30px">
<div class="proname">{{ scope.row.productName}}</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="productPrice"
label="价格"
width="180">
</el-table-column>
<el-table-column
prop="quantity"
label="数量" width="80">
</el-table-column>
</el-table>
</ul>
</div>
<el-dialog
title="修改收货信息"
:visible.sync="changeAddVisible"
width="500"
:close="changeAddHandleClose">
<div>
<el-form ref="addressFormRef" :model="addressForm" label-width="120px" :rules="addressFormRule">
<el-form-item label="收货人:">
<el-input v-model="addressForm.name"></el-input>
</el-form-item>
<el-form-item label="收货联系电话:">
<el-input v-model="addressForm.tel"></el-input>
</el-form-item>
<el-form-item label="收货地址:">
<!-- <el-input v-model="addressForm.address"></el-input> -->
<!-- 省市区-->
<!-- -->
<el-select v-model="addressForm.province" placeholder="请选择省份" style="width:200px" @change="provinceChange">
<el-option
v-for="item in provinceEntity"
:key="item.regionCode"
:label="item.provName"
:value="item.regionCode">
</el-option>
</el-select>
<el-select v-model="addressForm.city" placeholder="请选择市" @change="cityChange">
<el-option
v-for="item in cityEntity.cityList"
:key="item.regionCode"
:label="item.cityName"
:value="item.regionCode">
</el-option>
</el-select>
<el-select v-model="addressForm.county" placeholder="请选择区">
<el-option
v-for="item in countyEntity.countyList"
:key="item.regionCode"
:label="item.countyName"
:value="item.regionCode">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="详细地址:">
<el-input type="textarea" v-model="addressForm.addressXX"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="changeAddHandleClose"> </el-button>
<el-button type="primary" @click="changeAddress"> </el-button>
</span>
</el-dialog>
<!-- <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'
import setDeliverDialog from './set-deliver-dialog'
export default {
data() {
return {
orderList:[],
dataForm: {
key: ''
},
reverse: false,
activities: [ ],
deliverData: [], // 物流信息
setDeliverVisible: false,
dataListLoading: false,
dataListSelections: [],
// addOrUpdateVisible: false,
query: {
orderId: 0,
ordertype:null
},
changeAddVisible: false,
orderDetails:{},
addressForm:{
province:null,
city:null,
county:null,
name:'',
tel:'',
addressXX:''
},
provinceEntity:[], // 城市列表
cityEntity:[], // 市
countyEntity:[], // 区
optionProps: {
checkStrictly: true,
value: "regionCode",
label: "provName",
children: "children"
},
addressFormRule:{
name: [
{ required: true, message: '请输入收货人信息', trigger: 'blur' }
],
tel: [
{ required: true, message: '请输入收货联系电话信息', trigger: 'blur' }
],
county: [
{ required: true, message: '请选择收货地址', trigger: 'blur' }
],
addressXX: [
{ required: true, message: '请输入详细地址信息', trigger: 'blur' }
],
}
}
},
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: {
cityChange(e){
// console.log('修改了市',e)
this.addressForm.county = null
this.countyEntity = this.cityEntity.cityList.find((val,index,arr)=>{
return val.regionCode == e
})
// console.log('对应的city数组',this.countyEntity)
},
provinceChange(e){
// console.log('修改了省份',e)
this.addressForm.city = null;
this.addressForm.county = null
this.cityEntity = this.provinceEntity.find((val,index,arr)=>{
return val.regionCode == e
})
// console.log('对应的city数组',this.cityEntity)
},
changeAddHandleClose(){
this.changeAddVisible = false
this.addressForm.province = null
this.addressForm.city = null;
this.addressForm.county = null
this.provinceEntity = []
this.cityEntity = []
this.countyEntity = []
this.$nextTick(() => {
this.addressForm.name = ''
this.addressForm.tel = ''
this.addressForm.addressXX = ''
// this.$refs['addressFormRef'].resetFields();
})
// $refs[formName].resetFields()
console.log('关闭了', this.addressForm)
},
changeAddressShow(){
this.$http({
url: this.$http.adornUrl('/api/province/getProvince'),
method: 'post',
// params: this.$http.adornParams({
// 'orderId': this.query.orderId
// })
}).then(({ data }) => {
console.log('获取地址三级列表', data)
if(data.code == 0){
this.provinceEntity = data.provinceEntity
}
}).catch( e => {
console.log(e,'e')
})
// this.changeAddVisible = true
console.log('显示修改收货地址')
},
// 修改收货信息
changeAddress(){
this.$refs['addressFormRef'].validate((valid) => {
if (valid) {
console.log('修改收货地址')
} else {
return false;
}
});
},
// 获取地址数据三级联动
// 获取 物流
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('物流获取失败,请重试')
}
}).catch(({e}) => {
loading.close()
console.log(e,'e')
})
},
// 获取数据列表
getData() {
this.dataListLoading = true
this.$http({
// url: this.$http.adornUrl(`/book/buyOrder/appGetOrderInfo/${this.query.ordertype}`),
url: this.$http.adornUrl(`/book/buyOrder/getOrderDetail/`),
method: 'get',
params: this.$http.adornParams({
'orderId': this.query.orderId,
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.orderDetails = data.detail
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>
.orderType{
overflow: hidden; margin-bottom: 20px;
.item{
color: #fff;
display: inline-block;
padding: 10px;
border-radius: 0 20px 20px 0;
}
.hightLight0{
background-color: #e6a23c;
}
.hightLight1{
background-color: #409eff;
}
.hightLight2{
background-color: #f56c6c;
}
.hightLight3{
background-color: #67c23a;
}
}
.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.list {
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;
;
}
/deep/ .el-select-dropdown{width: 200px !important;}
:deep(.el-select-dropdown__list) {
width: 200px !important;
}
/deep/ .el-select-dropdown__list{width: 200px !important;}
</style>