提交 d66dffda authored 作者: huaxinzhu's avatar huaxinzhu

云仓订单接口对接80%

上级 b9e75490
import request from '@/utils/request'
// 查询 订单 四种状态和总数量
export function getOrderTabData(query) {
return request({
url: '/system/order/statusCount',
method: 'get',
params: query
})
}
// 查询order列表
export function listOrder(query) {
return request({
url: '/system/order/getOrderList',
url: '/system/order/getOrderSellerList',
method: 'get',
params: query
})
......@@ -12,25 +21,25 @@ export function listOrder(query) {
// 查询order详细
export function orderInfo (query) {
return request({
url: '/system/order/getOrderInfo',
url: '/system/order/getOrderSellerListInfo',
method: 'get',
params: query
})
}
// order发货
export function sendOrder(data) {
/*export function sendOrder(data) {
return request({
url: '/system/order/sendOrde',
method: 'post',
data: data
})
}
}*/
//查看物流
export function expressInfoNew(params){
return request({
url: '/system/order/getExpressInfoNew',
url: '/system/order/getOrderInfoDeliver',
method: 'get',
params
})
......@@ -39,7 +48,7 @@ export function expressInfoNew(params){
// 修改订单收货信息
export function orderInfoEdit(data){
return request({
url: '/system/order/orderInfoEdit',
url: '/system/order/orderUpdateAddress',
method: 'post',
data: data
})
......@@ -48,7 +57,7 @@ export function orderInfoEdit(data){
//订单备注
export function remarkOrder(data){
return request({
url: '/system/order/remarkOrder',
url: '/system/order/orderListRemark',
method: 'post',
data: data
})
......@@ -90,14 +99,22 @@ export function delOrder(ids) {
})
}
// 订单导出
// 订单导出-按搜索条件,全部导出
export function exportOrder(query) {
return request({
url: '/system/order/batchDeliveryGoodsOut',
url: '/system/order/unSendOrderGoodsExport',
method: 'get',
params: query
})
}
// old
// export function exportOrder(query) {
// return request({
// url: '/system/order/getOrderListExport',
// method: 'get',
// params: query
// })
// }
// 批量发货
export function deliveryOrder(data) {
......@@ -107,3 +124,32 @@ export function deliveryOrder(data) {
data: data
})
}
// 订单 右上角的 批量发货接口 /system/order/batchDeliveryGoodsOut 老接口
// 批量 去发货
export function deliveryOrderOne(data) {
return request({
url: '/system/order/orderListSend',
method: 'post',
data: data
})
}
// 批量 补单发货
export function deliveryOrderTwo(data) {
return request({
url: '/system/order/orderListAllSend',
method: 'post',
data: data
})
}
//
// // 单商品订单 补单发货
// export function toReissueOrderData(data) {
// return request({
// url: '/system/order/orderListAgainSend',
// method: 'post',
// data: data
// })
// }
......@@ -21,19 +21,19 @@
</el-row>
<el-row class="row-title">
<el-col :span="3" class="text-r">下单时间</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? formatter(orderDetail.addtime) : ''}}</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? formatter(orderDetail.created_time) : ''}}</el-col>
</el-row>
<el-row class="row-title">
<el-col :span="3" class="text-r">商品数量</el-col>
<el-col :span="6" class="text-l">{{goodsNum}}</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.goods_total : ''}}</el-col>
</el-row>
<el-row class="row-title">
<el-col :span="3" class="text-r">商品总价</el-col>
<el-col :span="6" class="text-l">{{goodsPrice}}</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.goods_price / 100 : ''}}</el-col>
</el-row>
<el-row class="row-title">
<el-col :span="3" class="text-r">运费</el-col>
<el-col :span="6" class="text-l">{{goodsFreight}}</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.dispatch_price / 100 : ''}}</el-col>
</el-row>
</div>
</div>
......@@ -43,18 +43,18 @@
<img class="icon" src="@/assets/image/order/icon2.png" alt="">
<span>买家信息</span>
</div>
<el-button size="mini" type="primary" @click="modifyinfo" :disabled="orderDetail && orderDetail.status > 2">修改收货信息</el-button>
<el-button size="mini" type="primary" @click="modifyinfo" :disabled="orderDetail && orderDetail.status > 1">修改买家信息</el-button>
</div>
<div>
<el-row class="row-title">
<el-col :span="3" class="text-r">收货人姓名</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.shipping_name : ''}}</el-col>
<el-col :span="6" class="text-l">{{ orderDetail ? orderDetail.real_name : ''}}</el-col>
<el-col :span="3" class="text-r">联系电话</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.phone : ''}}</el-col>
<el-col :span="6" class="text-l">{{ orderDetail ? orderDetail.mobile : ''}}</el-col>
</el-row>
<el-row class="row-title">
<el-col :span="3" class="text-r">收货地址</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.province + orderDetail.city + orderDetail.county + orderDetail.town + orderDetail.address : ''}}</el-col>
<el-col :span="6" class="text-l">{{orderDetail ? orderDetail.provice + orderDetail.city + orderDetail.district + orderDetail.street + orderDetail.address : ''}}</el-col>
<el-col :span="3" class="text-r"></el-col>
<el-col :span="6" class="text-l"></el-col>
</el-row>
......@@ -67,52 +67,52 @@
<span>商品信息</span>
</div>
<div>
<el-button size="mini" type="primary" @click="goShipping(1)" :disabled="orderDetail && orderDetail.status > 1">去发货</el-button>
<el-button size="mini" @click="goShipping(2)" :disabled="orderDetail && orderDetail.status != 2">补单发货</el-button>
<el-button size="mini" type="primary" @click="goShipping(1)">去发货</el-button>
<el-button size="mini" type="primary" @click="goShipping(2)" >补单发货</el-button>
</div>
</div>
<el-table :data="orderDetail ? orderDetail.item : []" style="border: 1px solid #eee;" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="订单号" prop="order_sn" />
<el-table-column label="商品名称">
<el-table :data="orderGoodsDetail" style="border: 1px solid #eee;" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="订单号" prop="goods_order_sn" align="center"></el-table-column>
<el-table-column label="商品名称" prop="title" align="center"></el-table-column>
<el-table-column label="下单时间" prop="created_time" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].title}}
{{ scope.row.created_time ? formatter(scope.row.created_time) : '' }}
</template>
</el-table-column>
<el-table-column label="商品规格">
<el-table-column label="规格/数量/单价" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].goods_option_title}}
{{ scope.row.goods_option_title }}<br/>
{{scope.row.total}}<br/>
{{scope.row.goods_price / 100}}
</template>
</el-table-column>
<el-table-column label="单价">
<el-table-column label="商品订单状态" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].price}}
{{ goodsStatusFormatter(scope.row.goods_status) }}
</template>
</el-table-column>
<el-table-column label="数量">
<el-table-column label="快递公司" prop="express_company_name" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].num}}
{{ scope.row.express_company_name ? scope.row.express_company_name : '—' }}
</template>
</el-table-column>
<el-table-column label="商品状态">
<el-table-column label="快递单号" prop="express_sn" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].goods_status == 0 ? '未发货' : '已发货'}}
{{ scope.row.express_sn ? scope.row.express_sn : '—' }}
</template>
</el-table-column>
<el-table-column label="快递公司">
<el-table-column label="发货时间" prop="send_time" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].deliver_Name}}
{{ scope.row.send_time ? scope.row.send_time : '—' }}
</template>
</el-table-column>
<el-table-column label="快递单号" prop="Tel">
<el-table-column label="操作" class-name="small-padding fixed-width" align="center">
<template slot-scope="scope">
{{scope.row.goods_list[0].deliver_no}}
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="goShipping(3, scope.row.goods_list[0].goods_id)" :disabled="scope.row.goods_list[0].goods_status > 0">{{getStatus(scope.row.goods_list[0].goods_status, scope.row.goods_list[0].is_reissue)}}</el-button>
<el-button v-if="scope.row.goods_list[0].goods_status > 0" size="mini" type="text" @click="getExpressInfoNew(scope.row.order_sn, scope.row.goods_list[0].goods_id, scope.row.goods_list[0].sku_id)">查看物流</el-button>
<span style="font-size:12px;padding: 0 15px 0 0;" v-if="deliveryTypeText(scope.row.goods_status,scope.row.is_reissue) == '已补单'">已补单</span>
<el-button size="mini" type="text" v-if="deliveryTypeText(scope.row.goods_status,scope.row.is_reissue) == '去补单'" @click="goShipping(4,scope.row.id)">去补单</el-button>
<el-button size="mini" type="text" v-if="deliveryTypeText(scope.row.goods_status,scope.row.is_reissue) == '去发货'" @click="goShipping(3,scope.row.id)">去发货</el-button>
<el-button size="mini" type="text" @click="getExpressInfoNew(scope.row)">查看物流</el-button>
</template>
</el-table-column>
</el-table>
......@@ -136,30 +136,44 @@
</div>
<el-button size="mini" type="primary" @click="addRemark">添加备注</el-button>
</div>
<div style="width: 75%; min-height: 100px; border: 1px solid #eee; padding: 10px;">{{orderDetail ? orderDetail.remark : ''}}</div>
<div style="width: 75%; min-height: 100px; border: 1px solid #eee; padding: 10px;">
<dl v-for="(item, index) in orderDetail.remark_list"
:key="index"
class="remark-con"
>
<dt>item.date_time</dt>
<dd>item.content</dd>
</dl>
</div>
</div>
</div>
</el-card>
<!-- 修改买家信息 -->
<el-dialog
title="修改买家信息"
:visible.sync="modifyinfoDialog"
width="25%"
width="30%"
:modal-append-to-body="false"
:close-on-click-modal="false"
:append-to-body="true"
center
>
<div style="margin: 0 10%">
<div style="margin: 0 20px;">
<el-form ref="addressForm" :model="addressForm" label-width="100px">
<el-form-item label="收货人姓名:">
<el-input size="mini" v-model="addressForm.name" placeholder="请输入收货人姓名"></el-input>
<el-input size="mini" v-model="addressForm.shipping_name" placeholder="请输入收货人姓名"></el-input>
</el-form-item>
<el-form-item label="联系电话:">
<el-input size="mini" v-model="addressForm.mobile" placeholder="请输入联系电话"></el-input>
<el-input size="mini" v-model="addressForm.tel" placeholder="请输入联系电话"></el-input>
</el-form-item>
<el-form-item label="收货地址:">
<el-cascader v-model="addressForm.areaList" :props='props' placeholder="请选择具体的省市区" style="width:100%"></el-cascader>
<el-input size="mini" v-model="addressForm.street_name" placeholder="请输入街道"></el-input>
<el-input size="mini" v-model="addressForm.address" placeholder="请输入收货地址"></el-input>
<el-cascader v-model="addressForm.areaList" :props='props' ref="ssqCascader" placeholder="请选择具体的省市区" style="width:100%"></el-cascader>
</el-form-item>
<el-form-item label="街道:">
<el-input size="mini" v-model="addressForm.street" placeholder="请输入街道"></el-input>
</el-form-item>
<el-form-item label="详细地址:">
<el-input size="mini" v-model="addressForm.address" placeholder="请输入详细地址"></el-input>
</el-form-item>
</el-form>
</div>
......@@ -168,6 +182,7 @@
<el-button size="mini" type="primary" @click="handleModifyInfo">确 定</el-button>
</span>
</el-dialog>
<!-- 发货 -->
<el-dialog
:title="titleInfo"
:visible.sync="goShippingDialog"
......@@ -245,14 +260,19 @@
</template>
<script>
import {orderInfo, sendOrder, expressInfoNew, remarkOrder, orderInfoEdit} from '@/api/module/order'
import {orderInfo, sendOrder, expressInfoNew, remarkOrder, orderInfoEdit,deliveryOrderOne, deliveryOrderTwo, toReissueOrderData} from '@/api/module/order'
import {dateFormat} from '@/utils'
import {getAreaList} from '@/api/module/retreat/address'
export default {
props: {
// 订单信息
orderDetail: {
type: Object
},
// 商品订单 信息
orderGoodsDetail: {
type: Array,
},
expressLists: {
type: Array
}
......@@ -268,10 +288,10 @@ export default {
dialogCheck: false,
titleInfo: '',
addressForm: {
name: '',
mobile: '',
shipping_name: '',
tel: '',
address: '',
street_name: '',
street: '',
areaList: [] // 省市区
},
activities: [],
......@@ -284,87 +304,299 @@ export default {
label: 'name',
leaf: 'leaf'
},
goShippingNum: 0,
goods_ids: null
goShippingNum: 0, // 发货类型
goods_ids: null, // 发货的商品订单 id
}
},
computed: {
goodsFreight() {
let freight = 0
if (this.orderDetail) {
this.orderDetail.item.map(item => {
freight += item.freight
})
}
return freight
created() {
},
goodsPrice() {
let price = 0
if (this.orderDetail) {
this.orderDetail.item.map(item => {
price += item.goods_list[0].price
})
}
return price
mounted() {
},
goodsNum() {
let goodsNum = 0
if (this.orderDetail) {
this.orderDetail.item.map(item => {
goodsNum += item.goods_list[0].num
})
}
return goodsNum
}
computed: {
// goodsFreight() {
// let freight = 0
// // if (this.orderDetail) {
// // this.orderDetail.item.map(item => {
// // freight += item.freight
// // })
// // }
// return freight
// },
// goodsPrice() {
// let price = 0
// if (this.orderDetail) {
// this.orderDetail.item.map(item => {
// price += item.goods_list[0].price
// })
// }
// return price
// },
// goodsNum() {
// let goodsNum = 0
// if (this.orderDetail) {
// this.orderDetail.item.map(item => {
// goodsNum += item.goods_list[0].num
// })
// }
// return goodsNum
// }
},
methods: {
getStatus(status, is_reissue) {
return status == 0 ? '去发货' : status == 1 && is_reissue == 1 ? '已补单' : status == 1 && is_reissue == 0 ? '已发货' : '已完成'
/** 商品 发货状态 */
goodsStatusFormatter(status) {
let res = '—';
if (status == 0) {
res = '未发货'
}else if (status == 1) {
res = '已发货'
}else if (status == 2) {
res = '已收货'
}else if (status == 3) {
res = '配货中'
}else if (status == 4) {
res = '拒收'
}
return res
},
/**
* 商品订单 操作类型
* gs:goods_status ir:is_reissue
* 返回值有三种情况:去发货,补单,已补单(不可点击)
* */
deliveryTypeText(gs,ir) {
return gs == 0 ? '去发货' : ir == 0 ? '去补单' : '已补单'
},
/**
* 时间戳转换为日期格式
* 项目中,后台一般均返回10位数的时间戳,在公用的封装方法dateFormat中,第一个入参,需要*1000 ,具体参考 new Date(时间戳) 方法
* */
formatter(time) {
return dateFormat(time, 'Y-m-d H:i:s')
return dateFormat(time * 1000, 'Y-m-d H:i:s')
},
/**
* 发货
* val 发货类型:1-商品的批量发货;2-批量补单发货;3-单商品发货;4-单格个商品订单 补单发货
* */
// 发货,补单,补单发货
goShipping(val, id) {
//console.log(361,this.multipleSelection);
this.goShippingNum = val
this.goods_ids = id
this.goods_ids = []
this.expressNum = ''
this.express_sn = ''
let isContinue = true;
if (this.multipleSelection.length == 0 && val != 3) {
this.$message({
type: 'warning',
message: '请选择需要发货的商品'
})
// 批量发货
if(this.goShippingNum === 1) {
if (this.multipleSelection.length === 0) {
this.$message({type: 'warning',message: '请先选择需要发货的商品'});
return
}
for(let i = 0; i < this.multipleSelection.length; i++) {
// 批量发货 goods_status 0:未发货,1:已发货,2:已收货,3:配货中,4:拒收
if (this.multipleSelection[i].goods_status > 0) {
this.$message({type: 'warning',message: '所选商品中部分已发货,请重新选择'});
isContinue = false
break;
}else {
let idNum = Number(this.multipleSelection[i].id);
this.goods_ids.push(idNum);
}
}
if(!isContinue) {
// 批量发货时候,goods_ids 为数组 [3,4,5]
this.goods_ids = []
return;
}
switch(val) {
case 1:
this.titleInfo = '去发货'
this.goShippingDialog = true
}
// 批量补单
if(this.goShippingNum === 2) {
if (this.multipleSelection.length === 0) {
this.$message({type: 'warning',message: '请先选择需要补单发货的商品'});
return
}
for(let i = 0; i < this.multipleSelection.length; i++) {
// 批量补单 is_reissue 1-已补发;2-未补发
// 首先,先发货了,才能补单
if( this.multipleSelection[i].goods_status > 0 ) {
if (this.multipleSelection[i].is_reissue) {
this.$message({type: 'warning',message: '所选商品中部分已补单,请重新选择'});
isContinue = false;
break;
}else {
let idObj = {id: Number(this.multipleSelection[i].id)};
this.goods_ids.push(idObj);
}
}else {
isContinue = false;
this.$message({type:'warning',message:'所选商品中部分未发货,不能进行补单操作,请重新选择'});
break
case 2:
}
}
if(!isContinue) {
this.goods_ids = []
return;
}
this.titleInfo = '补单发货'
this.goShippingDialog = true
break
case 3:
}
// 单商品订单 发货
if(this.goShippingNum === 3) {
this.goods_ids = id;
this.titleInfo = '去发货'
this.goShippingDialog = true
break
default:
break
}
// 单格个商品订单 补单发货
if (this.goShippingNum === 4) {
this.goods_ids = id;
this.titleInfo = '去补单'
this.goShippingDialog = true
}
//
//console.log(5555555,this.goods_ids);
},
/** ReissueOrder*/
/** 批量发货,批量补单发货,单个发货,单个补单发货 */
handleGoShipping() {
if (!this.expressNum) {
this.$message({
type: 'warning',
message: '请选择快递公司'
})
return
}
if (!this.express_sn) {
this.$message({
type: 'warning',
message: '请输入快递单号'
})
return
}
// 物流公司,名称
let expressName = ''
this.expressLists.map((item) => {
if (item.value == this.expressNum) {
expressName = item.label
}
})
// 批量 去发货
if( this.goShippingNum === 1) {
let paramsObj = {
order_goods_ids: this.goods_ids,
express_company_name: expressName, // 快递公司 名称
express_sn: this.express_sn, // 快递单号
//express_code: ''
}
//console.log(11111,paramsObj);
deliveryOrderOne(paramsObj).then(res=> {
if(res.code == 1) {
this.$message({type:'success',message:'发货成功'});
this.goShippingDialog = false
this.handleInfo()
}else {
this.$message({type:'error',message: res.message ? res.message : '发货失败'});
}
});
}
// 批量 补单发货
if (this.goShippingNum === 2 ) {
let listObj = { list: [] }
this.goods_ids.forEach((item,index)=> {
item['express_name'] = expressName;
item['express_sn'] = this.express_sn
})
listObj.list = this.goods_ids;
//console.log("批量补单发货",listObj);
deliveryOrderTwo(listObj).then(res=> {
if(res.code == 1) {
this.$message({type:'success',message:'补单发货成功'});
this.goShippingDialog = false
this.handleInfo()
}else {
this.$message({type:'error',message: res.message ? res.message : '补单发货失败'});
}
});
}
// 单商品订单 发货
if(this.goShippingNum === 3) {
let paramsObj = {
order_goods_ids: [],//this.goods_ids,
express_company_name: expressName, // 快递公司 名称
express_sn: this.express_sn, // 快递单号
//express_code: ''
}
paramsObj.order_goods_ids.push(this.goods_ids);
//console.log(11111,paramsObj);
deliveryOrderOne(paramsObj).then(res=> {
if(res.code == 1) {
this.$message({type:'success',message:'发货成功'});
this.goShippingDialog = false
this.handleInfo()
}else {
this.$message({type:'error',message: res.message ? res.message : '发货失败'});
}
});
}
// 单个商品订单 补单发货
if(this.goShippingNum === 4) {
let singleOrderObj = { list: []};
let orderObj = {
id: 0,
express_name: '',
express_sn: ''
}
orderObj.id = this.goods_ids;
orderObj.express_name = expressName;
orderObj.express_sn = this.express_sn;
singleOrderObj.list.push(orderObj);
deliveryOrderTwo(singleOrderObj).then(res=> {
if(res.code == 1) {
this.$message({type:'success',message:'补单发货成功'});
this.goShippingDialog = false
this.handleInfo()
}else {
this.$message({type:'error',message: res.message ? res.message : '补单发货失败'});
}
});
}
// sendOrder(params).then(res => {})
},
// 订单详情
handleInfo() {
this.detailDialog = true
// let order_sn = '20200318e095e2d09354'
let order_sn = this.orderDetail.parent_order_sn
orderInfo({order_sn: order_sn}).then(res => {
if (res.code == 1) {
this.orderDetail = res.data
let order_id = this.orderDetail.id
orderInfo({order_id: order_id}).then(res => {
if (res.code == 1 && res.data) {
this.orderDetail = res.data.order
this.orderGoodsDetail = res.data.order_goods_detail ? res.data.order_goods_detail : [];
}
})
},
......@@ -372,25 +604,30 @@ export default {
handleSelectionChange(val) {
this.multipleSelection = val;
},
/** 修改 买家信息 */
modifyinfo() {
this.addressForm = {
name: '',
mobile: '',
shipping_name: '',
tel: '',
address: '',
street_name: ''
street: ''
}
this.modifyinfoDialog = true
},
// 修改买家信息
/** 保存 买家信息 */
handleModifyInfo() {
if (!this.addressForm.name) {
// console.log(555,this.addressForm.areaList);
// let ssqLabelList = this.$refs['ssqCascader'].getCheckedNodes()[0].pathLabels;
// console.log(444,ssqLabelList)
if (!this.addressForm.shipping_name) {
this.$message({
type: 'warning',
message: '请输入收货人姓名'
})
return
}
if (!this.addressForm.mobile) {
if (!this.addressForm.tel) {
this.$message({
type: 'warning',
message: '请输入联系电话'
......@@ -399,7 +636,7 @@ export default {
}
// 手机号码格式校验
const reg = /^1[3456789]\d{9}$/;
if (!reg.test(this.addressForm.mobile)) {
if (!reg.test(this.addressForm.tel)) {
this.$message({
type: 'warning',
message: '手机号码格式有误'
......@@ -413,7 +650,7 @@ export default {
})
return
}
if (!this.addressForm.street_name) {
if (!this.addressForm.street) {
this.$message({
type: 'warning',
message: '请输入街道'
......@@ -428,16 +665,23 @@ export default {
return
}
// 省市区 转化
let ssqLabelList = [];
if(this.addressForm.areaList && this.addressForm.areaList.length > 1) {
ssqLabelList = this.$refs['ssqCascader'].getCheckedNodes()[0].pathLabels;
}
let params = {
id: this.orderDetail.parent_order_sn,
shipping_name: this.addressForm.name,
mobile: this.addressForm.mobile,
street_name: this.addressForm.street_name,
order_sn : this.orderDetail.order_sn,
shipping_name: this.addressForm.shipping_name,
province_name: ssqLabelList[0] ? ssqLabelList[0] : '',
city_name: ssqLabelList[1] ? ssqLabelList[1] : '',
district_name: ssqLabelList[2] ? ssqLabelList[2] : '',
street_name: this.addressForm.street,
address: this.addressForm.address,
province_name: this.addressForm.areaList[0],
city_name: this.addressForm.areaList[1],
district_name: this.addressForm.areaList[2]
tel: this.addressForm.tel,
}
orderInfoEdit(params).then(res => {
if (res.code == 1) {
this.$message({
......@@ -449,76 +693,31 @@ export default {
}
})
},
// 去发货
handleGoShipping() {
if (!this.expressNum) {
this.$message({
type: 'warning',
message: '请选择快递公司'
})
return
}
if (!this.express_sn) {
this.$message({
type: 'warning',
message: '请输入快递单号'
})
/** 查看 商品订单 物流信息 */
getExpressInfoNew(row) {
// 如果 商品订单没有发货,则不用请求了
if(row.goods_status == 0) {
this.$message({type:'warning',message:'您还未发货,暂无物流信息'});
return
}
let expressName = ''
this.expressLists.map((item, index) => {
if (item.value == this.expressNum) {
expressName = item.label
}
})
let goods_ids = []
if (this.goShippingNum != 3) {
this.multipleSelection.map(item => {
goods_ids.push(item.goods_list[0].goods_id)
})
} else {
goods_ids = [this.goods_ids]
}
let params = {
order_goods_ids: goods_ids,
express_company_name: expressName,
express_sn: this.express_sn,
express_code: this.expressNum
}
sendOrder(params).then(res => {
if (res.code == 1) {
this.$message({
type: 'success',
message: '商品已发货'
})
this.goShippingDialog = false
this.handleInfo()
}
})
},
// 查看物流
getExpressInfoNew(sn, goodsId, skuId) {
this.dialogCheck = true
let params = {
order_sn: sn,
goods_id: goodsId,
sku_id: skuId
goods_order_sn: row.goods_order_sn,
sku_id: row.goods_option_id
}
expressInfoNew(params).then(res => {
if (res.code == 1) {
this.activities = res.data.orderTrack
if (res.code == 1 && res.data) {
this.activities = res.data.order_track ? res.data.order_track : [];
}
})
},
/** 添加备注 */
addRemark() {
this.remark = ''
this.addRemarkDialog = true
},
// 订单备注
/** 订单备注 */
getRemarkOrder() {
if (!this.remark) {
this.$message({
......@@ -529,7 +728,7 @@ export default {
}
let params = {
order_id: this.orderDetail.item[0].order_sn,
order_sn: this.orderDetail.order_sn,
remark: this.remark
}
remarkOrder(params).then(res => {
......@@ -662,4 +861,9 @@ export default {
height: 600px;
overflow-y: auto;
}
/* 留言框样式 */
.remark-con {
border: 1px solid #eee;
}
</style>
<template>
<div class="app-container">
<el-card class="box-card">
<div style="position: relative;">
<el-card class="box-card box-cardone">
<div style="position: relative;" class="clearfixall">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane name="first">
<div slot="label">待发货{{activeName == 'first' ? '(' + total1 + ')' : ''}}</div>
<!--<div slot="label">待发货{{activeName == 'first' ? '(' + total1 + ')' : '(0)'}}</div>-->
<div slot="label">待发货{{'(' + total1 + ')' }}</div>
</el-tab-pane>
<el-tab-pane name="second">
<div slot="label">已发货{{activeName == 'second' ? '(' + total2 + ')' : ''}}</div>
<div slot="label">已发货{{'(' + total2 + ')' }}</div>
</el-tab-pane>
<el-tab-pane label="已完成" name="third"></el-tab-pane>
<el-tab-pane label="全部订单" name="fourth"></el-tab-pane>
</el-tabs>
<div style="position: absolute; top: -5px; right: 0;">
<div v-show="this.activeName == 'first' " style="position: absolute; top: -5px; right: 0;">
<el-button size="mini" type="primary" icon="el-icon-download" @click="handleExport">导出订单</el-button>
<el-button size="mini" icon="el-icon-position" @click="isDeliveryOpen = true">批量发货</el-button>
</div>
</div>
<div class="scollbox">
<div class="form-box">
<el-form ref="form" :model="form" label-width="85px">
<el-form class="form-params" ref="form" :model="form" label-width="85px">
<el-row type="flex" class="row-bg" justify="space-around">
<el-col :span="6">
<el-form-item label="订单号:">
<el-input size="mini" v-model="form.order_sn" placeholder="请输入订单号" />
<el-input size="mini" v-model="form.order_sn" placeholder="请输入订单号"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商品名称:">
<el-input size="mini" v-model="form.GoodsName" placeholder="请输入商品名称" />
<el-input size="mini" v-model="form.GoodsName" placeholder="请输入商品名称"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="收货人:">
<el-input size="mini" v-model="form.shipname" placeholder="请输入收货人" />
<el-input size="mini" v-model="form.shipname" placeholder="请输入收货人"/>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" class="row-bg" justify="space-around">
<el-col :span="6">
<el-form-item label="联系电话:">
<el-input size="mini" v-model="form.Tel" placeholder="请输入联系电话" />
<el-input size="mini" v-model="form.Tel" placeholder="请输入联系电话"/>
</el-form-item>
</el-col>
<el-col :span="6">
......@@ -51,7 +51,7 @@
v-model="form.dateTime"
type="daterange"
align="left"
unlink-panels
unaLink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
......@@ -59,42 +59,77 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-button size="mini" type="primary" icon="el-icon-search" style="margin-left: 20px;" @click="getListOrder">搜索</el-button>
<el-button size="mini" type="primary" icon="el-icon-search" style="margin-left: 20px;"
@click="getListOrder">搜索
</el-button>
<el-button size="mini" icon="el-icon-refresh" @click="resetBtn(true)">重置</el-button>
</el-col>
</el-row>
</el-form>
</div>
<el-table :data="tableData" max-height="1080">
<el-table-column type="selection" width="55" />
<el-table-column label="订单号" align="center" prop="order_sn" width="255"/>
<el-table-column label="下单时间" align="center" prop="Updatetime" width="155">
<!-- 表头 -->
<div class="table-header-spe">
<el-table class="title_table hxz-el-table" align="center">
<el-table-column align="center" width="55">
<template slot="header" slot-scope="scope">
<el-checkbox v-model="allTablesChecked" ></el-checkbox>
</template>
</el-table-column>
<el-table-column label="订单号" align="center" width="180" ></el-table-column>
<el-table-column label="商品名称" align="center" ></el-table-column>
<el-table-column label="规格/数量/金额" align="center" width="180" ></el-table-column>
<el-table-column label="下单时间" align="center" width="180" ></el-table-column>
<el-table-column label="收货人" align="center" width="180" ></el-table-column>
<el-table-column label="联系电话" align="center" width="180"></el-table-column>
<el-table-column label="操作" align="center" width="140" ></el-table-column>
</el-table>
<div class="hxz-el-table-check"></div>
</div>
<div class="table-all-con box-card">
<el-card v-for="(item, index) in tableDataList" :key="index" class="card1 text item">
<div slot="header" class="el-card-header-spe">
<div><span>订单状态:</span><span>{{ orderStatusFormatter(item.order.status) }}</span></div>
</div>
<div class="item-table">
<el-table
border
:show-header="false"
:span-method="arraySpanMethod"
:data="item.order_goods">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column prop="goods_order_sn" label="订单号" width="180" align="center"></el-table-column>
<el-table-column prop="goods_option_title" label="商品名称" align="center">
<template slot-scope="scope">
{{formatter(scope.row.Updatetime)}}
<img style="width:60px;height:60px;" :src="scope.row.thumb"/>
<div>{{ scope.row.goods_option_title }}</div>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="goods_total"/>
<el-table-column label="订单金额" align="center" prop="goods_price">
<el-table-column label="规格/数量/金额" width="180" align="center">
<template slot-scope="scope">
{{scope.row.goods_price/100}}
{{ scope.row.goods_option_title }}<br/>
{{ scope.row.total }}<br/>
{{ scope.row.goods_price / 100 }}<br/>
</template>
</el-table-column>
<el-table-column label="收货人" align="center" prop="real_name"/>
<el-table-column label="联系电话" align="center" prop="mobile"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column prop="created_time" label="下单时间" width="180" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleInfo(scope.row)"
>
详情
</el-button>
{{ formatter(scope.row.created_time) }}
</template>
</el-table-column>
<el-table-column prop="phone" width="180" label="收货人" align="center"></el-table-column>
<el-table-column prop="real_name" label="联系电话" width="180" align="center"></el-table-column>
<el-table-column label="操作" width="140" align="center">
<template slot-scope="scope">
<el-button type="text" @click="handleInfo(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
<!-- 分页 -->
<div class="footer_pagination">
<el-pagination
background
......@@ -108,9 +143,10 @@
</el-pagination>
</div>
</el-card>
<el-dialog title="订单详情" width="85%" :close-on-click-modal="false" :destroy-on-close="true" :visible.sync="detailDialog" center :before-close="handleClose">
<el-dialog title="订单详情" width="85%" :close-on-click-modal="false" :destroy-on-close="true"
:visible.sync="detailDialog" center :before-close="handleClose">
<div style="height:100%;">
<order-detail :order-detail="order_detail" :express-lists="expressLists"/>
<order-detail :order-detail="order_detail" :order-goods-detail="order_goods_detail" :express-lists="expressLists"/>
</div>
</el-dialog>
<!-- 批量发货 -->
......@@ -137,12 +173,13 @@
action=""
class="upload-demo"
:auto-upload="false"
:limit = "1"
:limit="1"
accept="*/*"
:on-change="importExcel"
:on-remove="removeDevExcel"
ref="upload"
><el-button size="small" type="primary" >上传批量发货Excel表单</el-button>
>
<el-button size="small" type="primary">上传批量发货Excel表单</el-button>
</el-upload>
</div>
<div class="delivery-tips-con">
......@@ -164,10 +201,11 @@
</template>
<script>
import {listOrder, exportOrder, orderInfo, deliveryOrder, expressList} from '@/api/module/order'
import {listOrder, exportOrder, orderInfo, deliveryOrder, expressList, getOrderTabData} from '@/api/module/order'
import {dateFormat} from '@/utils'
import OrderDetail from './components/orderDetail.vue'
import XLSX from "xlsx"
export default {
components: {
OrderDetail
......@@ -177,8 +215,8 @@
currentPage: 1,
pageSize: 20,
total: 0,
total1:'',//待发货
total2:'',//已发货
total1: '',//待发货
total2: '',//已发货
activeName: 'first',
form: {
order_sn: '',
......@@ -188,21 +226,88 @@
dateTime: [],
},
goodsStatus: 1,
tableData: [],
tableDataList: [], // 后台返回所有数据
detailDialog: false,
isDeliveryOpen: false,
excelList: [],
order_detail: null,
expressLists: []
order_detail: null, // 订单信息
order_goods_detail: [], // 订单商品信息
expressLists: [],
fullHeight:'',
tableHeight: null,
allTablesChecked: false,
// 订单导出 入参
exportParams: {
order_sn: '',
goods_name: '',
real_name: '',
tel: 0,
created_start_time: 0,
created_end_time: 0,
}
}
},
watch: {
// fullHeight(val, oldval) {
// const contheight = document.getElementsByClassName('box-cardone')[0].clientHeight
// this.tableHeight = contheight - val - 250;
// // const heights = contheight
// // document.getElementsByClassName('cardHeight')[0].style.height = heights + 'px'
// }
},
created() {
// this.$nextTick(() => {
// this.fullHeight = document.getElementsByClassName('clearfixall')[0].clientHeight
// })
},
mounted() {
// 获取 订单 状态对应数量
this.getOrderTab()
// 订单列表 搜索
this.getListOrder()
//
this.getExpressList()
},
methods: {
checkSelectable( row,index) {
},
// 表格合并 列单元格
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex > 5) { // 用于设置要合并开始的列号
if (rowIndex === 0) { // 用于设置合并开始的行号
return {
rowspan: 100,     // 合并的行数
colspan: 1 // 合并的列数,设为0则直接不显示
}
} else {
return {
rowspan: 0,
colspan: 0
}
}
}
},
formatter(time) {
return dateFormat(time, 'Y-m-d H:i:s')
return dateFormat(time *1000, 'Y-m-d H:i:s')
},
/** 订单状态 */
orderStatusFormatter(status) {
if(status === -1) {
return '订单取消'
}else if (status === 0) {
return '待付款'
}else if (status === 1) {
return '待发货'
}else if (status === 2) {
return '待收货'
}else if (status === 3) {
return '已完成'
}else if (status === 4) {
return '已结算'
}else {
return '' // 保险,返回空
}
},
// 重置
resetBtn(iscall) {
......@@ -223,7 +328,7 @@
handleClick(tab, event) {
this.total = 0
switch(this.activeName) {
switch (this.activeName) {
case 'first':
this.goodsStatus = 1
break
......@@ -247,10 +352,25 @@
this.detailDialog = false
this.getListOrder()
},
/** 获取 订单 状态对应数量 */
getOrderTab() {
getOrderTabData().then(res => {
//console.log("获取订单状态和对应订单数量",res);
if (res.code === 1 && res.data.length > 0) {
// 1 表示 代发货;2 表示 已发货
for (let i = 0; i < res.data.length; i++) {
if (res.data[i].Status === 1) {
this.total1 = res.data[i].Count > 999 ? '999+' : res.data[i].Count;
} else if (res.data[i].Status === 2) {
this.total2 = res.data[i].Count > 999 ? '999+' : res.data[i].Count;
}
}
}
});
},
// 获取订单列表
getListOrder() {
this.tableData = []
this.tableDataList = []
let params = {
page: this.currentPage,
limit: this.pageSize,
......@@ -264,29 +384,53 @@
}
listOrder(params).then(res => {
if (res.code == 1) {
// 每次订单 查询成功,保存查询参数,供商品导出接口使用(入参)
this.exportParams.order_sn = params.order_sn;
this.exportParams.goods_name = params.goods_name;
this.exportParams.real_name = params.real_name;
this.exportParams.tel = params.tel;
this.exportParams.created_start_time = params.created_start_time;
this.exportParams.created_end_time = params.created_end_time;
this.total = res.data.count || 0
if( this.goodsStatus == 1){
this.total1 = res.data.count || 0
this.tableDataList = res.data.data
}
if( this.goodsStatus == 2){
this.total2 = res.data.count || 0
})
},
// 合并数据
// listSpanMethod() {
//
// },
// row 当前行 column 当前列 rowIndex 当前行号, columnIndex 当前列号
listSpanMethod({row, column, rowIndex, columnIndex}) {
if (columnIndex === 1) {
if (rowIndex % 2 === 0) {
return {
rowspan: 2,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
this.tableData = res.data.data
}
})
},
// 订单导出
handleExport(row) {
let query = {page: 1, limit: 100}
exportOrder(query).then(res => {
if(res.code === 1) {
const link = document.createElement('a');
link.href = res.data;
//link.download = '订单.xls'; //下载的文件名
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
handleExport() {
exportOrder(this.exportParams).then(res => {
if (res.code === 1) {
const aLink = document.createElement('a');
aLink.href = res.data.file_url;
//aLink.download = '订单.xls'; //下载的文件名
aLink.style.display = 'none';
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);
}else {
this.$message({type:'error',message: res.message ? res.message: '导出失败'});
}
});
},
......@@ -299,7 +443,7 @@
// xlsxJson就是解析出来的json数据,数据格式如下
// [{sheetName: sheet1, sheet: sheetData }]
if (item[0] && item[0].sheet && item[0].sheet.length) {
//_this.tableData = item[0].sheet //把数据塞到表格预览
//_this.tableDataList = item[0].sheet //把数据塞到表格预览
// this.excelList = item[0].sheet
item[0].sheet.map((item, index) => {
this.excelList.push({
......@@ -317,9 +461,9 @@
* @param {Object} file
*/
file2Xce(file) {
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
const reader = new FileReader();
reader.onload = function(e) {
reader.onload = function (e) {
const data = e.target.result;
this.wb = XLSX.read(data, {
type: "binary"
......@@ -341,34 +485,36 @@
},
// 提交导入数据
subDelivery() {
if(this.excelList.length === 0) {
this.$message({type:'warning',message:'请先上传填写好的表格数据'});
if (this.excelList.length === 0) {
this.$message({type: 'warning', message: '请先上传填写好的表格数据'});
return
}
if(this.excelList.length > 0 && this.excelList[0].id && this.excelList[0].express_name && this.excelList[0].express_sn) {
deliveryOrder(this.excelList).then(res=> {
if(res.code === 1) {
if (this.excelList.length > 0 && this.excelList[0].id && this.excelList[0].express_name && this.excelList[0].express_sn) {
deliveryOrder(this.excelList).then(res => {
if (res.code === 1) {
this.isDeliveryOpen = false;
this.$message({type:'success',message:'批量发货成功'});
this.$message({type: 'success', message: '批量发货成功'});
this.getList();
}else {
} else {
let msg = res.message || '批量发货失败'
this.$message({type:'error',message:msg});
this.$message({type: 'error', message: msg});
}
});
}else {
this.$message({type:'error',message:'导入表格数据有误'});
} else {
this.$message({type: 'error', message: '导入表格数据有误'});
}
},
// 订单详情
handleInfo(row) {
this.detailDialog = true
// let order_sn = '20200318e095e2d09354'
let order_sn = row.parent_order_sn
orderInfo({order_sn: order_sn}).then(res => {
if (res.code == 1) {
this.order_detail = res.data
let order_id = row.order_id
orderInfo({order_id: order_id}).then(res => {
if (res.code == 1 && res.data) {
// order 对象 订单信息 order_goods_detail-订单商品信息数组
this.order_detail = res.data.order
this.order_goods_detail = res.data.order_goods_detail ? res.data.order_goods_detail : [];
//console.log("详情数据",this.order_goods_detail);
// this.$router.push({path: '/system/goods/management'});
}
})
},
......@@ -393,35 +539,77 @@
</script>
<style scoped>
/deep/.el-range-editor.el-input__inner {
/deep/ .el-range-editor.el-input__inner {
width: 100%;
}
/deep/ .el-card__body{
height:calc(100% - 50px);
}
.scollbox{
}
/deep/ .el-card__body {
height: calc(100% - 50px);
}
.scollbox {
height: calc(100% - 50px);
overflow-y: scroll;
}
.form-box {
overflow-y: hidden;
}
.form-box {
background-color: #F7F8FA;
margin-bottom: 20px;
padding-top: 22px;
}
.footer_pagination {
text-align: right;
/*margin-bottom: 20px;*/
padding-top: 20px;
}
.form-params {
}
.footer_pagination {
text-align: center;
margin-top: 15px;
}
.delivery-tips-con,.delivery-data-con {
}
.delivery-tips-con, .delivery-data-con {
width: 80%;
margin: 5px auto;
font-weight: bold;
}
.delivery-data-con {
}
.delivery-data-con {
height: 100px;
margin: 20px auto;
}
.upload-demo {
text-align : center;
}
}
.upload-demo {
text-align: center;
}
/* 订单卡片 样式 */
.card1 {
margin-bottom: 20px;
}
.table-header-spe {
background-color: #F7F8FA;
margin:10px 0 10px;
}
/deep/ .title_table{
width: calc(100% - 94px) !important;
margin: 0 40px;
}
/deep/ .title_table .el-table__body-wrapper{
display: none !important;
height:0 !important;
}
/deep/ .title_table tr th {
border-bottom: 0 !important;
}
/deep/ .title_table::before{
height:0;
}
.table-all-con {
height: calc(100% - 250px);
overflow-y: auto;
padding: 0 20px;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论