You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/physical-merchants/classify/order/wuliuPupup/wuliuPupup.vue

287 lines
7.2 KiB

2 years ago
<template>
2 years ago
<wybPopup ref="popup" zIndex="100" type="bottom" width="500" height="500" :scrollY="true" radius="0" :showCloseIcon="true">
2 years ago
<view class="pd-main wuliupop backcor9">
2 years ago
<view class="pop-title fontwig6 backcor9"><text>物流信息</text></view>
<view class="pd-main backcolorfff border-8r font14" @touchmove.stop>
2 years ago
<view class="dis-flex flex-sp mart10 marb10 paddbotm10 border-b">
<view class="dis-flex">
<!-- <image class="wuliu-img" src="https://pic.616pic.com/ys_bnew_img/00/07/04/1ZtrvD1AMY.jpg" mode="aspectFill"></image> -->
<text class="paddleft5">{{tracesData.expressCompanyName}}</text>
<text class="paddleft5">{{tracesData.number}}</text>
</view>
<view class="dis-flex ">
<text @click="copyText(tracesData.number)">复制</text>
<text class="paddleft5 paddtright5 fcor666">|</text>
<text @click="callPhone">打电话</text>
</view>
</view>
2 years ago
2 years ago
2 years ago
<trackNode v-for="(item, index) in tracesData.logisticsTraceDetails" :key="index" :is-first="index===tracesData.length-1" :is-newest="index===0" :is-main-node="item.logisticsStatus!='TRANSPORT'" :node-data="item"></trackNode>
2 years ago
</view>
</view>
</wybPopup>
</template>
<script>
import wybPopup from '@/components/wyb-popup/wyb-popup.vue'
import trackNode from '../trackNode/trackNode.vue'
import {getLogisticsMsg} from '@/Utils/physicalObject.js'
export default {
data () {
return {
tracesData:{},
2 years ago
phoneNumber:[],
2 years ago
/* [
{
acceptStation: '包裹已被吴亦发同学签收', // 节点描述
createTime: '2019-10-24 15: 27: 16',
status: 'COMPLETE', // 节点状态
phone: '', // 电话
statusName: '已签收', // 节点标题
isMainNode: true // 是否主节点,主节点前方展示icon
},
{
acceptStation: '由派送员蔡小坤同志配送,电话:',
createTime: '2019-10-24 15: 26: 41',
status: 'DELIVERING',
phone: '16677778888',
statusName: '运输中',
isMainNode: true
},
{
acceptStation: '已到XXX小区快递点',
createTime: '2019-10-24 15: 26: 41',
status: 'DELIVERING',
phone: '',
statusName: '运输中',
isMainNode: false
},
{
acceptStation: '已到海宁集散中心',
createTime: '2019-10-24 15: 26: 18',
status: 'DELIVERING',
phone: '',
statusName: '运输中',
isMainNode: false
},
{
acceptStation: '已到杭州集散中心',
createTime: '2019-10-24 15: 26: 07',
status: 'DELIVERING',
phone: '',
statusName: '运输中',
isMainNode: false
},
{
acceptStation: '包裹已到达余杭区集散中心',
createTime: '2019-10-24 15: 25: 54',
status: 'DELIVERING',
phone: '',
statusName: '运输中',
isMainNode: false
},
{
acceptStation: '快递员已上门取件',
createTime: '2019-10-24 15: 25: 17',
status: 'DELIVERING',
phone: '',
statusName: '已揽收',
isMainNode: false
},
{
acceptStation: '等待快递员上门揽件',
createTime: '2019-10-24 15: 25: 00',
status: 'WATTING_DELIVER',
phone: '',
statusName: '已发货',
isMainNode: true
},
{
acceptStation: '您的包裹正在打包',
createTime: '2019-10-24 15: 24: 00',
status: 'WATTING_DELIVER',
phone: '',
statusName: '待发货',
isMainNode: false
},
{
acceptStation: '订单支付成功,等待商家发货',
createTime: '2019-10-24 15: 22: 30',
status: 'PAYED',
statusName: '已支付',
isMainNode: true
},
{
acceptStation: '订单提交成功',
createTime: '2019-10-24 15: 22: 00',
status: 'WATTING_PAY',
statusName: '已下单',
isMainNode: true
}
] */
}
},
components:{
wybPopup,
trackNode
},
created(){
2 years ago
2 years ago
},
methods:{
show(logisticsNo){
// console.log(logisticsNo)
this.tracesData={};
2 years ago
this.$refs.popup.show();
this.getLogisticsMsg(logisticsNo)
},
//查询物流信息
getLogisticsMsg(num){
let params ={
num:num
}
uni.showLoading({
title: '加载中',
mask:true,
});
2 years ago
getLogisticsMsg(params).then(res=>{
uni.hideLoading();
2 years ago
if (res.return_code == '000000') {
2 years ago
2 years ago
this.tracesData=res.return_data;
this.tracesData.logisticsTraceDetails =JSON.parse(this.tracesData.logisticsTraceDetails)
2 years ago
2 years ago
this.tracesData.logisticsTraceDetails=this.tracesData.logisticsTraceDetails.sort((item,item2)=>{
if(item.logisticsStatus == 'TRANSPORT'){
item.isMainNode=false;
}else{
item.isMainNode=true;
}
2 years ago
2 years ago
return item2.time - item.time;
2 years ago
})
let mobile = /(1[0-9]{10})|([0-9]{3,4})?[0-9]{7,8}/g; //匹配手机号或固话
let phone = [];
this.tracesData.logisticsTraceDetails.map(item=>{
// 提取电话号码
// if(item.logisticsStatus == 'SIGN'||item.logisticsStatus == 'DELIVERING'){
let num = item.desc.replace(/\s|[(]|[)]|[(]|[)]|[-]*/g, ''); //去除字符串中所有空格、小括号和横杠
if(num.match(mobile)){
phone.push((num.match(mobile)))
}
// }
})
this.phoneNumber =phone.flat(Infinity);
// console.log(this.phoneNumber, phone)
} else {
2 years ago
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
},
// 复制
copyText(text){
// #ifdef H5
this.$copyText(text).then(
res => {
uni.showToast({
title: '复制成功'
})
}
)
// #endif
// #ifndef H5
uni.setClipboardData({
data: text,
success: () => {
uni.showToast({
title: '复制成功'
})
}
})
// #endif
},
// 打电话
callPhone(){
2 years ago
if(this.phoneNumber.length==0){
uni.showToast({
title:"暂无可拨打电话号码",
icon:'none'
})
return
}
2 years ago
uni.showModal({
2 years ago
title: '确定拨打电话',
content: this.phoneNumber[0],
2 years ago
success: function(res) {
if (res.confirm) {
uni.makePhoneCall({
2 years ago
phoneNumber: this.phoneNumber[0], //电话号码
2 years ago
success: function(e) {
console.log(e);
},
fail: function(e) {
console.log(e);
}
})
}
}
})
},
}
}
</script>
<style lang="scss" scoped>
.wuliu-img{
width: 30px;
height: 30px;
border-radius: 50%;
}
.border-b{
border-bottom: 2px solid #f6f6f6;
}
.wuliupop{
padding: 50px 10px 10px;
}
.pop-title{
text-align: center;
height: 50px;
line-height: 50px;
font-size: 18px;
position: fixed;
top:0;
left: 0;
right: 0;
2 years ago
z-index: 10;
2 years ago
background-color: #f6f6f6;
}
</style>