feat: 小程序审批详情页对齐 web-admin 布局和功能
1. 添加 pending_logistics 填写快递单号入口(无物流任务时) 2. 物流信息区域添加修改单号按钮(有物流任务时) 3. 头部增加业务员姓名显示 4. 产品列表增加计价过程列 5. 自发订单提示扩展到运输中等状态 6. 费用汇总增加其他费用字段 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bfccf12043
commit
9e63f8a599
@ -53,6 +53,8 @@ Page({
|
||||
quantity: "1",
|
||||
},
|
||||
serviceBound: true,
|
||||
showPendingTrackingEdit: false,
|
||||
pendingTrackingNumber: "",
|
||||
},
|
||||
|
||||
async onLoad(options) {
|
||||
@ -127,6 +129,8 @@ Page({
|
||||
if (freight > 0) feeItems.push({ label: "运费", value: fmt(freight) });
|
||||
if (tax > 0) feeItems.push({ label: "税费", value: fmt(tax) });
|
||||
if (commission > 0) feeItems.push({ label: "佣金", value: fmt(commission) });
|
||||
var otherFee = Number(data.other_fee_total || 0);
|
||||
if (otherFee > 0) feeItems.push({ label: "其他费用", value: fmt(otherFee) });
|
||||
feeItems.push({ label: "利润", value: fmt(profit), isProfit: true });
|
||||
|
||||
// 产品明细(从 data.items 构建,包含规格/需求规格/单位等完整字段)
|
||||
@ -149,6 +153,7 @@ Page({
|
||||
areaSqm: ci.area_sqm ? fmt(ci.area_sqm) + "㎡" : "",
|
||||
supplierModel: ci.supplier_model || "",
|
||||
priceTier: ci.price_tier || "",
|
||||
formulaDetail: ci.formula_detail || "",
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -553,6 +558,74 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 填写快递单号(pending_logistics 状态,无物流任务)
|
||||
openPendingTrackingEdit: function () {
|
||||
var that = this;
|
||||
var app = getApp();
|
||||
wx.showModal({
|
||||
title: "填写快递单号",
|
||||
editable: true,
|
||||
placeholderText: "请输入快递单号",
|
||||
confirmColor: "#2563eb",
|
||||
success: function (res) {
|
||||
if (!res.confirm) return;
|
||||
var trackingNumber = (res.content || "").trim();
|
||||
if (!trackingNumber) {
|
||||
wx.showToast({ title: "请输入快递单号", icon: "none" });
|
||||
return;
|
||||
}
|
||||
that.setData({ actionLoading: true });
|
||||
app.request({
|
||||
url: "/api/orders/" + that.data.orderInfo.order_id + "/tracking",
|
||||
method: "PUT",
|
||||
data: { tracking_number: trackingNumber, remark: "填写快递单号" },
|
||||
}).then(function () {
|
||||
wx.showToast({ title: "快递单号已填写,订单已进入运输状态", icon: "success" });
|
||||
return that.loadDetail();
|
||||
}).catch(function (error) {
|
||||
that.setData({ message: error.message || "填写快递单号失败" });
|
||||
}).finally(function () {
|
||||
that.setData({ actionLoading: false });
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 修改物流单号(有物流任务时)
|
||||
openLogisticsTrackingEdit: function () {
|
||||
var that = this;
|
||||
var app = getApp();
|
||||
var logistics = this.data.logistics;
|
||||
if (!logistics || !logistics.task_id) return;
|
||||
wx.showModal({
|
||||
title: "修改物流单号",
|
||||
editable: true,
|
||||
placeholderText: "请输入新快递单号",
|
||||
confirmColor: "#2563eb",
|
||||
success: function (res) {
|
||||
if (!res.confirm) return;
|
||||
var trackingNumber = (res.content || "").trim();
|
||||
if (!trackingNumber) {
|
||||
wx.showToast({ title: "请输入快递单号", icon: "none" });
|
||||
return;
|
||||
}
|
||||
that.setData({ actionLoading: true });
|
||||
app.request({
|
||||
url: "/api/logistics/tasks/" + logistics.task_id + "/tracking",
|
||||
method: "PUT",
|
||||
data: { tracking_number: trackingNumber, remark: "修改物流单号" },
|
||||
}).then(function () {
|
||||
wx.showToast({ title: "物流单号已更新", icon: "success" });
|
||||
return that.loadDetail();
|
||||
}).catch(function (error) {
|
||||
that.setData({ message: error.message || "修改物流单号失败" });
|
||||
}).finally(function () {
|
||||
that.setData({ actionLoading: false });
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
handleBack: function () { wx.navigateBack({ delta: 1 }); },
|
||||
|
||||
// 分享给好友
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
<view class="card overview-card">
|
||||
<view class="overview-head">
|
||||
<view class="overview-left">
|
||||
<view class="order-no">{{orderInfo.order_no}}</view>
|
||||
<view class="order-customer">{{orderInfo.customer_name}} · {{orderInfo.customer_mobile}}</view>
|
||||
<view class="order-customer">{{orderInfo.salesman_name ? orderInfo.salesman_name + '-' : ''}}{{orderInfo.customer_name}}的销售订单</view>
|
||||
<view class="order-no">订单号:{{orderInfo.order_no}}</view>
|
||||
</view>
|
||||
<view style="display:flex;flex-direction:column;align-items:flex-end;gap:8rpx;">
|
||||
<view class="badge {{orderInfo.badgeClass}}">{{orderInfo.statusText}}</view>
|
||||
@ -91,6 +91,7 @@
|
||||
<text class="product-spec" wx:if="{{item.pricingType}}">计价: {{item.pricingType}}</text>
|
||||
<text class="product-spec" wx:if="{{item.areaSqm}}">面积: {{item.areaSqm}}</text>
|
||||
<text class="product-spec" wx:if="{{item.supplierModel}}">型号: {{item.supplierModel}}</text>
|
||||
<text class="product-spec" wx:if="{{item.formulaDetail}}">计价过程: {{item.formulaDetail}}</text>
|
||||
</view>
|
||||
<view class="product-prices">
|
||||
<text class="product-price">单价: ¥{{item.costPrice}}</text>
|
||||
@ -135,9 +136,19 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待绑定物流单号(无物流任务时) -->
|
||||
<view wx:if="{{orderInfo.order_status === 'pending_logistics' && !logistics}}" class="card info-card">
|
||||
<view class="section-title">物流单号</view>
|
||||
<view class="empty-hint">订单已审批通过,当前待绑定物流单号,请填写快递信息后进入运输状态。</view>
|
||||
<view class="action-link" bindtap="openPendingTrackingEdit">填写快递单号</view>
|
||||
</view>
|
||||
|
||||
<!-- 物流信息 -->
|
||||
<view wx:if="{{logistics}}" class="card info-card">
|
||||
<view class="section-title">物流信息</view>
|
||||
<view class="section-title-row">
|
||||
<text class="section-title">物流信息</text>
|
||||
<text class="action-link" bindtap="openLogisticsTrackingEdit">修改单号</text>
|
||||
</view>
|
||||
<view class="info-row" wx:if="{{logistics.express_company}}">
|
||||
<text class="info-label">快递公司</text>
|
||||
<text class="info-value">{{logistics.express_company}}</text>
|
||||
@ -165,7 +176,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 自发订单提示(待审批+有快递单号) -->
|
||||
<view wx:if="{{orderInfo.order_status === 'pending_approve' && orderInfo.tracking_number}}" class="card action-card">
|
||||
<view wx:if="{{orderInfo.tracking_number && orderInfo.order_status !== 'canceled' && orderInfo.order_status !== 'settled'}}" class="card action-card">
|
||||
<view class="approval-hint">马甸工厂自发 — 已填写快递单号({{orderInfo.tracking_number}}),审批通过后跳过工厂下发</view>
|
||||
</view>
|
||||
|
||||
|
||||
@ -135,6 +135,9 @@
|
||||
|
||||
/* 通用 */
|
||||
.section-title { font-size: 26rpx; color: #64748b; font-weight: 600; margin-bottom: 12rpx; }
|
||||
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12rpx; }
|
||||
.section-title-row .section-title { margin-bottom: 0; }
|
||||
.action-link { font-size: 24rpx; color: #2563eb; padding: 8rpx 0; }
|
||||
.message { color: #047857; padding: 20rpx 24rpx; }
|
||||
.empty-card { padding: 40rpx; text-align: center; }
|
||||
.page-subtitle { color: #94a3b8; font-size: 28rpx; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user