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