Commit b935ec87 by wangzhihui

Merge branch 'SAAS+V4.56.0-0908' of http://192.168.3.233:8090/saas/mini-program/…

…points-mall into SAAS+V4.56.0-0908
2 parents 7de71a4a 6a732ac3
......@@ -82,7 +82,7 @@
.sku-box {
.title {
font-weight: 400;
font-weight: 500;
font-size: 28rpx;
color: #1B233D;
margin-top: 48rpx;
......@@ -127,7 +127,7 @@
padding: 6rpx 20rpx;
background: #F7F8FA;
font-weight: 400;
font-size: 24rpx;
font-size: 26rpx;
border-radius: 12rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
......
......@@ -5,17 +5,59 @@ Component({
nodes: {
type: Array,
value: [],
}
},
methods: {
observer(newVal) {
this.formatContent(newVal);
},
},
},
data: {
timeLineNodes: [],
},
methods: {
formatContent(nodes) {
nodes.forEach((item) => {
if (item.type == "special") {
item.content = [{ type: "text", txt: item.content }];
} else {
item.content = this.parsePhone(item.content);
}
});
this.setData({
timeLineNodes: nodes,
});
},
// 把原始文本切成 text | phone 两种节点
parsePhone(str) {
if(!str){
return [];
}
const phoneReg = /(1[3-9]\d{9}|0\d{2,3}[-]?\d{7,8})/g; // 简易手机号正则
let lastIndex = 0;
const res = [];
let match;
while ((match = phoneReg.exec(str)) !== null) {
// 1. match 之前的纯文本
if (match.index > lastIndex) {
res.push({ type: "text", txt: str.slice(lastIndex, match.index) });
}
// 2. 手机号本身
res.push({ type: "phone", txt: match[0] });
lastIndex = match.index + match[0].length;
}
// 3. 尾部剩余文本
if (lastIndex < str.length) {
res.push({ type: "text", txt: str.slice(lastIndex) });
}
return res;
},
// 拨打电话
makePhoneCall(e) {
const phone = e.currentTarget.dataset.phone;
if (phone) {
wx.makePhoneCall({
phoneNumber: phone
phoneNumber: phone,
});
}
}
}
});
\ No newline at end of file
},
},
});
......@@ -97,7 +97,6 @@
.timeline-node__content--special-active,
.timeline-node__content--special-small-active,
.timeline-node__content--special-active-small {
.timeline-node__title,
.timeline-node__tip {
font-weight: 400;
......@@ -141,6 +140,12 @@
font-weight: 400;
font-size: 24rpx;
line-height: 1.5;
.content {
white-space: pre-wrap;
.phone {
color: #fb8a32;
}
}
}
.timeline-node__content--active,
......@@ -175,4 +180,4 @@
background-color: var(--btnColor);
padding: 4rpx 12rpx;
border-radius: 24rpx;
}
\ No newline at end of file
}
<!-- 时间轴组件 -->
<view class="timeline-container">
<view wx:for="{{nodes}}" wx:key="index" class="timeline-node">
<view wx:for="{{timeLineNodes}}" wx:key="index" class="timeline-node">
<!-- 时间轴节点 -->
<view class="timeline-node__dot-wrapper">
<!-- 使用预处理的样式类 -->
......@@ -15,18 +15,16 @@
<view wx:if="{{item.operateTime}}" class="timeline-node__time">{{item.operateTime}}</view>
</view>
<view class="timeline-node__tip">
<view class="timeline-node__tip">
<rich-text nodes="{{item.content}}"></rich-text>
<!-- 手机号码点击区域 -->
<view wx:if="{{item.phones && item.phones.length > 0}}" class="phone-numbers">
<view wx:for="{{item.phones}}" wx:for-item="phone" wx:key="*this"
class="phone-number" bindtap="makePhoneCall" data-phone="{{phone}}">
<!-- <mp-icon icon="cellphone" color="var(--btnColor)" size="{{14}}"></mp-icon> -->
<text class="phone-call-text">拨打电话: {{phone}}</text>
</view>
<view class="content">
<block wx:for="{{item.content}}" wx:key="index" wx:for-item="content">
<block wx:if="{{content.type==='text'}}">{{content.txt}}</block>
<label wx:elif="{{content.type==='phone'}}"
catchtap="makePhoneCall"
data-phone="{{content.txt}}"
class="phone">{{content.txt}}</label>
</block>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
......@@ -17,6 +17,7 @@
height: 360rpx;
}
.goods-content {
min-height: calc(100% - 320rpx);
width: 100%;
box-sizing: border-box;
margin-top: -66rpx;
......
......@@ -30,7 +30,7 @@ Page({
let { count } = this.data
if (count == 0) {
clearInterval(this.timer)
// wx.p.router.reLaunch('/packageMine/pages/order/index/index')
wx.p.router.reLaunch('/packageMine/pages/order/index/index')
return
}
this.setData({
......@@ -41,7 +41,7 @@ Page({
viewOrderDetail() {
clearInterval(this.timer)
// wx.p.router.reLaunch('/packageMine/pages/order/index/index')
wx.p.router.reLaunch('/packageMine/pages/order/index/index')
},
/**
......
......@@ -4,7 +4,7 @@ const LOGISTICS_STATUS = {
1002: "运输中",
1003: "已签收",
1004: "拒收",
1005: "正在派件", // 新增状态
// 1005: "派件中", // 新增状态
};
// 状态判断规则配置
......@@ -29,7 +29,7 @@ const STATUS_RULES = [
"派件",
"派件中",
],
status: 1005,
status: 1002,
statusDesc: "派件中",
},
{
......@@ -118,36 +118,42 @@ Component({
if (!Array.isArray(shipmentTrack) || shipmentTrack.length === 0) {
return [];
}
let lastStatus = null;
// 第一步:处理所有轨迹数据,获取状态和描述
const tracks = shipmentTrack
.reverse()
.map((track, index) => {
const { content = "", operateTime = "" } = track;
// 根据内容判断状态
const { status, statusDesc } =
this._determineStatusByContent(content);
// 提取手机号码
const phoneRegex = /(1[3-9]\d{9}|0\d{2,3}[-]?\d{7,8})/g;
const phones = [];
let match;
let contentCopy = content;
while ((match = phoneRegex.exec(content)) !== null) {
phones.push(match[1]);
let { status, statusDesc } = this._determineStatusByContent(content);
let type = "normal";
if (status === 1002 && statusDesc === "运输中") {
if (status === lastStatus) {
statusDesc = "";
type = "small";
} else {
lastStatus = status;
}
}
// 高亮手机号码和座机号码
const highlightedContent = content.replace(
phoneRegex,
'<span style="color: #fb8a32;">$1</span>'
);
// 提取手机号码
// const phoneRegex = /(1[3-9]\d{9}|0\d{2,3}[-]?\d{7,8})/g;
// const phones = [];
// let match;
// while ((match = phoneRegex.exec(content)) !== null) {
// phones.push(match[1]);
// }
// // 高亮手机号码和座机号码
// const highlightedContent = content.replace(
// phoneRegex,
// '<span style="color: #fb8a32;" bindtap="makePhoneCall" data-phone="$1">$1</span>'
// );
return {
...track,
content: highlightedContent,
phones: phones, // 添加提取的手机号码数组
content,
// phones: phones, // 添加提取的手机号码数组
operateTime,
type: "",
type,
status,
statusDesc,
};
......@@ -158,23 +164,22 @@ Component({
// 使用数组反转实现同一状态只显示最后一个的逻辑
// 1. 先反转数组
const reversedTracks = [...tracks].reverse();
// 2. 应用第一次出现状态显示,后续相同状态不显示的逻辑
let lastStatus = null;
const processedReversedTracks = reversedTracks.map((track) => {
const result = { ...track };
if (track.status === lastStatus && track.status === 1002) {
result.statusDesc = "";
result.type = "small";
} else {
lastStatus = track.status;
}
return result;
});
// const reversedTracks = [...tracks].reverse();
// // 2. 应用第一次出现状态显示,后续相同状态不显示的逻辑
// let lastStatus = null;
// const processedReversedTracks = reversedTracks.map((track) => {
// const result = { ...track };
// if (track.status === lastStatus && track.status === 1002) {
// result.statusDesc = "";
// result.type = "small";
// } else {
// lastStatus = track.status;
// }
// return result;
// });
// 3. 再次反转数组,恢复原始顺序
return processedReversedTracks.reverse();
return tracks.reverse();
},
/**
......@@ -189,7 +194,6 @@ Component({
console.warn("Express组件: expressInfo参数无效");
return;
}
const {
logisticsStatus,
shipmentTrack,
......
.popup-content {
padding: 0 32rpx;
max-height: calc(100% + 98rpx);
max-height: calc(100% + 80rpx);
overflow: hidden;
overflow-y: scroll;
.express-info {
......
......@@ -71,7 +71,7 @@ Page({
receiveMobile,
} = data.receiveAddress;
const receiveAddress = provinceName + cityName + countyName + address;
const receiveInfo = receiveName + receiveMobile;
const receiveInfo = `${receiveName} ${receiveMobile}`;
this.setData({
orderInfo: {
...data,
......@@ -79,7 +79,7 @@ Page({
receiveAddress,
receiveInfo,
},
receiver: `${receiveAddress}<br/>${receiveInfo}`,
receiver: `${receiveAddress}\n${receiveInfo}`,
// 如果有expressInfo也一并设置
...(data.expressName && this.data.orderInfo.goodsSource == GoodsSource.SELF ? {
expressInfo: {
......
......@@ -86,7 +86,7 @@ Page({
})
this.setData({
count,
sum: sum == 0 ? 0 : Number(sum).toFixed(2),
sum: sum == 0 ? 0 : Number(sum),
allActive: goodsList?.filter(item => item.flag == null).length == goodsList?.filter(val => val.active == true && val.flag == null)?.length
})
},
......
......@@ -169,7 +169,7 @@ page {
.goods-action .total .price {
color: #FC5B32;
display: flex;
max-width: 220rpx;
width: 220rpx;
align-items: baseline;
.num {
font-size: 40rpx;
......
......@@ -21,7 +21,12 @@ Component({
this.getOrderNumberList();
},
},
pageLifetimes: {
show: function() {
// 页面被展示时执行
this.getOrderNumberList();
}
},
/**
* 组件的方法列表
*/
......@@ -38,12 +43,13 @@ Component({
const loginStatus = !wx.p.isLogin;
if (loginStatus) return;
const userInfo = wx.p.storage.get("userInfo") || {};
let { merchantId, channelSource } = userInfo;
let { merchantId, channelSource,phone } = userInfo;
const params = {
merchantId,
pageSize: 1,
currentPage: 1,
scoreSource: channelSource,
phone
};
const orderList = this.data.orderList;
orderList.forEach((item) => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!