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

@@ -0,0 +1,599 @@
<template>
<el-dialog title="订单发货" center :visible.sync="visible" width="700px" :before-close="beforeCloseDialog">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="物流公司" prop="deliverLcd">
<el-select size="mini" v-model="ruleForm.deliverLcd" placeholder="请选择物流公司" @change="selectChanged">
<el-option v-for="(item, index) in expressList" :label="item.dictValue"
:value="item.dictType"></el-option>
</el-select>
<el-radio-group v-model="radio3" size="mini" style="float: right;">
<!-- 三种发货形态-general普通发货,merge:合并发货,mix:混合发货 -->
<el-radio-button label="general">普通发货</el-radio-button>
<!-- <el-radio-button label="merge">合并发货</el-radio-button> -->
<el-radio-button label="mix">混合发货</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div class="order_list_ui">
<ul v-if="orderitem">
<div v-if="radio3 == 'general'">
<li>
<div class="item_head">
<el-row>
<el-col :md="12" :lg="12">
<span><span class="infoTitle">订单编号</span>{{ orderitem.orderSn }} </span></el-col>
</el-row>
</div>
<div class="item_body">
<div class="flexbox" style="justify-content: space-between;">
<div class="td1 flexbox" style="align-items: flex-start;">
<div class="flexbox orderProducts" v-for="products in productsCodeList">
<div class="flexbox productItem" style="">
<!-- <el-checkbox :label="products.allOrderId"></el-checkbox> -->
<img :src="products.image" width="30px" height="30px">
<div class="flexbox" style="align-items: center;">
<div class="bookName">{{ products.productName }}</div>
</div>
</div>
<div class="flexbox">
<div class="price xcenter">
<!-- <div>{{ products.productPrice }}</div> -->
<div>× {{ products.quantity }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</div>
<div v-if="radio3 == 'mix'">
<div v-if="mixOrderList.length == 0"
style="display: flex; height:300px; width: 100%; align-items: center; justify-content: center;">
<div class="empty" style="text-align: center;">
<icon-svg style="font-size: 130px;" name="kongbai"></icon-svg>
<div style="color: #999;">暂无数据</div>
</div>
</div>
<div v-else>
<el-checkbox-group v-model="checkedList" @change="handleCheckedCitiesChange">
<li class="flexbox mergeList" style="border:1px solid #ddf6f3" v-for="(item, index) in mixOrderList">
<div class="buierInfo flexbox">
<div style="display: flex;width:180px; align-items: center;">
<div style="padding: 10px;" class="">
<div><span class="infoTitle">用户名</span><span>{{item.userName}}</span></div>
<div><span class="infoTitle">电话</span><span>{{item.tel}}</span></div>
<div><span class="infoTitle">收货地址</span><span>{{item.address}}</span></div>
</div>
</div>
</div>
<div class="productInfo" style="width:100%;">
<div class="item" v-for="(item2, index) in item.orderList">
<div class="item_head no_right_border">
<el-row>
<el-col :span="24"
style="display: flex; justify-content: space-between;">
<span><span class="infoTitle">订单编号</span>{{item2.orderSn}} </span>
<!-- <el-button style="margin: 0; padding: 0;" type="text">移除</el-button> -->
</el-col>
</el-row>
</div>
<div class="item_body no_right_border no_bottom_border">
<div class="flexbox" style="justify-content: space-between;">
<div class="td1 flexbox" style="width:100%; ">
<div class="flexbox orderProducts" style="width:100%;" v-for="(item3, index) in item2.products">
<div class="flexbox productItem" style="width:100%;">
<el-checkbox :label="item3.allOrderId" :disabled="item3.orderStatus == '1'"><br></el-checkbox>
<img :src="item3.image" width="30px" style="margin-left: -15px;"
height="30px">
<div class="flexbox" style="align-items: center;">
<div class="bookName">{{item3.productName}}</div>
</div>
</div>
<div class="num xcenter"><span>× {{item3.quantity}}</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</el-checkbox-group>
</div>
</div>
</ul>
</div>
<span slot="footer" class="dialog-footer">
<el-button v-if="radio3 === 'mix' && mixOrderList.length != 0" type="primary" @click="submit"> </el-button>
<el-button v-if="radio3 == 'general'" type="primary" @click="submit1"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
props: {
visible: {
type: Boolean,
value: true
},
orderitem: {
type: Object,
value: {}
}
},
data() {
return {
// 普通发货list
productsCodeList:[],
productsIdsList:[],
radio3: 'general',
checkedList: [],
ruleForm: {
deliverLcd: '',
dictValue:''
},
expressList: [],
rules: {
deliverLcd: [
{ required: true, message: '请先选择物流公司', trigger: 'change' }
]
},
orderIds: [],
// 混合发货数组
mixOrderList: []
}
},
created() {
// this.visible = false
this.getExpressList()
},
methods: {
// 获取快递公司列表
getExpressList() {
this.$http({
url: this.$http.adornUrl('/book/sysdictdata/selectByType/express_name'),
method: 'get',
}).then(({ data }) => {
// console.log(data, '快递列表')
this.expressList = data.dataList
})
},
selectChanged(val){
console.log(val.dictValue)
if(this.expressList && this.expressList.length > 0){
this.expressList.forEach(element => {
if(element.dictType == val){
return this.ruleForm.dictValue = element.dictValue
}
});
}
// this.ruleForm.dictValue = val.dictValue
//this.ruleForm.deliverLcd = val.dictType
},
handleCheckedCitiesChange(val) {
console.log(val)
},
// 获取可合并订单
getMixDeliverOrderList() {
this.orderIds[0] = this.orderitem.orderId
this.$http({
url: this.$http.adornUrl(`/book/buyorder/checkMerge`),
method: 'post',
data: this.orderIds
}).then(({ data }) => {
this.mixOrderList = data.list
})
},
// 关闭前
beforeCloseDialog() {
this.$emit('closeDialog', false)
this.$refs['ruleForm'].resetFields()
this.$refs['ruleForm'].clearValidate()
this.checkedList = []
},
getNewProducts(){
this.productsCodeList.forEach((item, index) => {
if(item.orderStatus == '1'){
this.productsCodeList.splice(index, 1)
console.log(index)
}
this.productsIdsList = this.productsCodeList.map( item => item.allOrderId)
})
},
//
// getProductsCodeList
// 普通发货
submit1(){
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/buyorder/blendSendFMS/${this.ruleForm.deliverLcd}`),
method: 'post',
params: this.$http.adornParams({
"shipperName" : this.ruleForm.dictValue
}),
data: this.productsIdsList // 是个数组
// 传orderid
}).then(({ data }) => {
if(data && data.code === 0 ){
console.log(data)
this.beforeCloseDialog()
return this.$message.success('发货成功')
}
})
}})
},
// 获取数据列表
getData() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/buyorder/appGetOrderInfo'),
method: 'get',
params: this.$http.adornParams({
'orderId': this.orderId,
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.productsCodeList = data.buyOrder
console.log(888)
} else {
// this.dataList = []
// this.totalPage = 0
}
this.dataListLoading = false
})
},
//混合发货
submit() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
// console.log(this.allOrder)
if (this.checkedList.length == 0 && this.radio3 == 'mix') {
return this.$message.error('请至少选择一条商品')
}
console.log('执行更新发货操作')
this.$confirm(`正在执行${this.deliverType} , 是否继续?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
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/blendSendFMS/${this.ruleForm.deliverLcd}`),
method: 'post',
params: this.$http.adornParams({
"shipperName" : this.ruleForm.dictValue
}),
data: this.checkedList,
// 传orderid
}).then(({ data }) => {
if(data && data.code === 0){
// console.log(data)
loading.close()
return this.$message.success('发货成功')
this.beforeCloseDialog()
}
})
// this.$message({
// type: 'success',
// message: '发货成功!'
// });
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
//this.beforeCloseDialog()
}
})
}
},
computed: {
deliverType() {
let type = ''
if (this.radio3 == 'mix') {
type = `[混合发货],当前操作${this.checkedList.length}个商品打包发货`
} else if (this.radio3 == 'merge') {
type = `[合并发货]`
} else {
// 混合发货
type = '[普通发货]'
}
return type
}
},
watch: {
orderitem: {
handler(val, oldVal) {
this.productsCodeList = val.products
this.getNewProducts()
this.getMixDeliverOrderList()
// this.getData()
// this.visible = true
},
deep: true
}
}
}
</script>
<style lang="less" scoped>
.no_right_border {
border-right: 0 !important;
}
.no_bottom_border {
border-bottom: none !important;
}
.mergeList {
.item_head:first-child {
border-top: none;
}
}
// .infoTitle {
// color: #777;
// display: inline-block;
// width: 62px;
// text-align: right;
// }
/deep/ .el-dialog__footer {
text-align: center;
}
.flexbox {
display: flex;
}
/deep/ .el-checkbox__label {
display: none !important;
}
.order_list_ui {
* {
font-size: 12px;
//color: #777;
}
ul {
color: #515a6e;
padding: 0;
li {
list-style: none;
margin-bottom: 10px;
.item_head {
width: 100%;
padding: 6px;
border: 1px solid #ddf6f3;
// border-right: none;
background-color: #edf9f8;
// .el-checkbox__label {
// display: none !important;
// }
.tip {
text-align: right;
.el-button {
padding: 0;
}
}
.el-checkbox {
margin-right: 10px;
}
}
.item_body {
border: 1px solid #ddf6f3;
// border-bottom: none;
// border-right: none;
border-top: none;
}
}
}
}
.orderProducts {
padding: 10px;
justify-content: space-between;
border-bottom: 1px solid #f1f1f1;
.price {
width: 40px;
line-height:28px;
}
.num {
width: 40px;
line-height: 20px;
}
.productItem {
overflow: hidden;
.flexbox {
align-items: center;
}
.el-checkbox {
line-height: 24px;
}
.el-checkbox__label {
display: none !important;
}
}
}
.xcenter {
text-align: center;
}
.borderright {
padding-left: 10px;
border-right: 1px solid #f1f1f1;
}
.normal {
display: none;
}
.hasDeliver {
display: block;
width: 20px;
height: 20px;
position: absolute;
z-index: 1;
top: 0;
right: 0;
background-image: url(../../../../static/img/hasDeliver_icon.png);
}
.td1 {
width: 100%;
.orderProducts {
overflow: hidden;
position: relative;
.el-checkbox {
margin-right: 10px;
}
img {
margin-right: 10px;
padding: 2px;
border: 1px solid #f1f1f1;
}
.bookName {
//margin-right: 10px;
font-size: 12px;
line-height: 16px;
margin-left: -6px;
letter-spacing: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; // 控制多行的行数
-webkit-box-orient: vertical;
-webkit-transform: scale(0.8);
}
.author {
color: #999;
}
}
}
.td2 {
width: 150px;
line-height: 26px;
padding: 5px;
em {
font-size: 18px;
font-style: normal;
color: #48C9B0;
}
}
.tabName {
color: #999;
margin-bottom: -3px;
}
.tabContent {
line-height: 26px;
-webkit-transform: scale(0.9);
}
.td3 {
padding: 5px;
line-height: 24px;
width: 200px;
.buier_tip {
color: #666;
}
}
.td4 {
padding: 5px;
width: 200px;
line-height: 24px;
.time {
color: #999
}
.orderStatus {
color: #ec6565;
}
.el-button {
margin-top: 15px;
}
}
.td5 {
padding: 5px;
line-height: 24px;
}
.orderProducts:last-child {
border-bottom: none;
}
.hasSplit {
background-color: #fffae8;
border: 1px solid #ffedd6;
.el-button {
margin-top: 0;
}
}
.buttonGroup {
.el-checkbox {
margin-right: 10px;
}
}
.deliverName {
margin-bottom: px;
}
.paper_list_ui {
margin-top: 15px;
}
.fengbi {
margin-left: 0 !important;
}
</style>