通过微信开发者工具 商城模板 创建新小程序
This commit is contained in:
43
mini-program/pages/order/delivery-detail/index.js
Normal file
43
mini-program/pages/order/delivery-detail/index.js
Normal file
@@ -0,0 +1,43 @@
|
||||
Page({
|
||||
data: {
|
||||
logisticsData: {
|
||||
logisticsNo: '',
|
||||
nodes: [],
|
||||
company: '',
|
||||
phoneNumber: '',
|
||||
},
|
||||
active: 0,
|
||||
},
|
||||
|
||||
onLoad(query) {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(decodeURIComponent(query.data || '{}'));
|
||||
} catch (e) {
|
||||
console.warn('物流节点数据解析失败', e);
|
||||
}
|
||||
if (Number(query.source) === 2) {
|
||||
const service = {
|
||||
company: data.logisticsCompanyName,
|
||||
logisticsNo: data.logisticsNo,
|
||||
nodes: data.nodes,
|
||||
};
|
||||
this.setData({
|
||||
logisticsData: service,
|
||||
});
|
||||
} else if (data) {
|
||||
this.setData({ logisticsData: data });
|
||||
}
|
||||
},
|
||||
|
||||
onLogisticsNoCopy() {
|
||||
wx.setClipboardData({ data: this.data.logisticsData.logisticsNo });
|
||||
},
|
||||
|
||||
onCall() {
|
||||
const { phoneNumber } = this.data.logisticsData;
|
||||
wx.makePhoneCall({
|
||||
phoneNumber,
|
||||
});
|
||||
},
|
||||
});
|
11
mini-program/pages/order/delivery-detail/index.json
Normal file
11
mini-program/pages/order/delivery-detail/index.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"navigationBarTitleText": "物流信息",
|
||||
"usingComponents": {
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
|
||||
"t-image": "/components/webp-image/index",
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-steps": "tdesign-miniprogram/steps/steps",
|
||||
"t-step": "tdesign-miniprogram/step-item/step-item"
|
||||
}
|
||||
}
|
91
mini-program/pages/order/delivery-detail/index.wxml
Normal file
91
mini-program/pages/order/delivery-detail/index.wxml
Normal file
@@ -0,0 +1,91 @@
|
||||
<wxs module="isUrl">
|
||||
var isUrl = function(item) {
|
||||
return item.indexOf('http') > -1;
|
||||
}
|
||||
module.exports = {
|
||||
isUrl: isUrl,
|
||||
}
|
||||
</wxs>
|
||||
|
||||
<view class="page-section cells" wx:if="{{logisticsData.logisticsNo || logisticsData.company}}">
|
||||
<t-cell-group>
|
||||
<t-cell
|
||||
title="快递单号"
|
||||
t-class-title="wr-cell__title"
|
||||
t-class-note="wr-cell__value"
|
||||
t-class-left="order-group__left"
|
||||
wx:if="{{logisticsData.logisticsNo}}"
|
||||
bordered="{{false}}"
|
||||
>
|
||||
<text slot="note" class="logistics-no">{{logisticsData.logisticsNo}}</text>
|
||||
<view
|
||||
slot="right-icon"
|
||||
class="text-btn"
|
||||
hover-class="text-btn--active"
|
||||
bindtap="onLogisticsNoCopy"
|
||||
>复制
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell
|
||||
title="物流公司"
|
||||
t-class-title="wr-cell__title"
|
||||
t-class-note="wr-cell__value"
|
||||
t-class-left="order-group__left"
|
||||
bordered="{{false}}"
|
||||
wx:if="{{logisticsData.company}}"
|
||||
note="{{logisticsData.company + (logisticsData.phoneNumber ? '-' + logisticsData.phoneNumber : '')}}"
|
||||
>
|
||||
<view
|
||||
slot="right-icon"
|
||||
class="text-btn"
|
||||
hover-class="text-btn--active"
|
||||
bindtap="onCall"
|
||||
wx:if="{{logisticsData.phoneNumber}}"
|
||||
>
|
||||
拨打
|
||||
</view>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
<view class="page-section cell-steps">
|
||||
<t-steps
|
||||
class="page-section__steps"
|
||||
t-class="steps"
|
||||
layout="vertical"
|
||||
current="{{active}}"
|
||||
>
|
||||
<t-step
|
||||
class="steps"
|
||||
t-class-title="step-title"
|
||||
wx:for="{{logisticsData.nodes}}"
|
||||
wx:for-item="item"
|
||||
wx:for-index="index"
|
||||
wx:key="index"
|
||||
title="{{item.title}}"
|
||||
icon="slot"
|
||||
>
|
||||
<block wx:if="{{isUrl.isUrl(item.icon)}}">
|
||||
<t-image
|
||||
class="cell-steps__imgWrapper"
|
||||
slot="icon"
|
||||
t-class="cell-steps__img"
|
||||
src="{{item.icon}}"
|
||||
/>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<t-icon
|
||||
slot="icon"
|
||||
size="32rpx"
|
||||
prefix="wr"
|
||||
color="{{index === 0 ? '#ef5433' : '#bbb'}}"
|
||||
name="{{item.icon}}"
|
||||
/>
|
||||
</block>
|
||||
<view slot="content">
|
||||
<view class="step-desc">{{item.desc}}</view>
|
||||
<view class="step-date">{{item.date}}</view>
|
||||
</view>
|
||||
</t-step>
|
||||
</t-steps>
|
||||
</view>
|
||||
|
99
mini-program/pages/order/delivery-detail/index.wxss
Normal file
99
mini-program/pages/order/delivery-detail/index.wxss
Normal file
@@ -0,0 +1,99 @@
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.page-section {
|
||||
margin-top: 24rpx;
|
||||
background-color: white;
|
||||
}
|
||||
.page-section .order-group__left {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
.cell-steps {
|
||||
padding: 8rpx;
|
||||
}
|
||||
.wr-cell__title {
|
||||
flex: none;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
.wr-cell__value {
|
||||
flex: auto;
|
||||
margin-left: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333 !important;
|
||||
}
|
||||
.logistics-no {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
word-break: break-all;
|
||||
color: #333;
|
||||
}
|
||||
.text-btn {
|
||||
margin-left: 20rpx;
|
||||
display: inline;
|
||||
font-size: 24rpx;
|
||||
padding: 0 15rpx;
|
||||
border: 1rpx solid #ddd;
|
||||
border-radius: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.text-btn--active {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.steps .step-title {
|
||||
font-weight: bold;
|
||||
color: #333 !important;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.steps .step-desc {
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.steps .step-date {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.cell-steps__img,
|
||||
.cell-steps__imgWrapper {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.steps
|
||||
.t-step--vertical.t-step--default-anchor
|
||||
.t-steps-item--process
|
||||
.t-steps-item__icon-number {
|
||||
background: #ffece9 !important;
|
||||
color: white !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.steps
|
||||
.t-step--vertical.t-step--default-anchor
|
||||
.t-steps-item--default
|
||||
.t-steps-item__icon-number {
|
||||
color: white !important;
|
||||
background: #f5f5f5 !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.steps
|
||||
.t-step--vertical.t-step--default-anchor.t-step--not-last-child
|
||||
.t-steps-item__inner::after {
|
||||
top: 48rpx;
|
||||
height: calc(100% - 44rpx - 4rpx);
|
||||
}
|
||||
|
||||
.steps
|
||||
.t-step--vertical.t-step--default-anchor.t-step--not-last-child
|
||||
.t-steps-item__inner::after,
|
||||
.steps
|
||||
.t-step--vertical.t-step--default-anchor.t-step--not-last-child
|
||||
.t-steps-item--default
|
||||
.t-steps-item__inner:after {
|
||||
background: #f5f5f5 !important;
|
||||
}
|
||||
.page-section__steps {
|
||||
padding: 24rpx;
|
||||
}
|
Reference in New Issue
Block a user