添加订单详情页, 及组件修改
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"search-popup": "/pages/components/search-popup/search-popup",
|
||||
"card-plugin": "/pages/components/card-plugin/card-plugin",
|
||||
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
|
||||
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
|
||||
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
|
||||
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
|
||||
"count-plugin": "/pages/components/count-plugin/count-plugin",
|
||||
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
|
||||
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"search-input": "/pages/components/search-input/search-input"
|
||||
},
|
||||
"navigationBarTitleText": "销售订单"
|
||||
}
|
||||
112
miniprogram/pages/orders/ordersList/orderDetail/orderDetail.ts
Normal file
112
miniprogram/pages/orders/ordersList/orderDetail/orderDetail.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import { OSSBaseUrl } from '@/utils/config';
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
formatFileSize,
|
||||
getAuthInfo,
|
||||
getDataSet,
|
||||
getFileType,
|
||||
mediaPreview,
|
||||
toArray,
|
||||
toObject,
|
||||
} from '@/utils/util';
|
||||
|
||||
const defaultParams = { curr_page: 1, page_count: 20, process_state: [200] };
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
params: cloneLite(defaultParams) as any,
|
||||
list: [] as any[],
|
||||
count: 0,
|
||||
info: {} as any,
|
||||
files: [] as any,
|
||||
detail: [] as any,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
post('Orders/saleDetail', temp).then((res: any) => {
|
||||
this.setData({
|
||||
info: toObject(res.info),
|
||||
files: toArray(res.files).map((el) => {
|
||||
el._file_type = getFileType(el.file_name);
|
||||
el.file_path = `${OSSBaseUrl}${el.file_path}`;
|
||||
el._file_size = formatFileSize(el.file_size);
|
||||
return el;
|
||||
}),
|
||||
detail: toArray(res.detail),
|
||||
});
|
||||
});
|
||||
},
|
||||
onPreview(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.files[index];
|
||||
if (item._file_type != 'file') {
|
||||
mediaPreview([item.file_path], item.file_path);
|
||||
}
|
||||
},
|
||||
onPreview2() {
|
||||
const path = `${OSSBaseUrl}${this.data.info.excel_path}`;
|
||||
// console.log(path);
|
||||
mediaPreview([path], path);
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { order_no } = options;
|
||||
this.data.params.order_no = order_no;
|
||||
wx.setNavigationBarTitle({ title: `${order_no} 详情` });
|
||||
loginStatusPage(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_SALE_ORDERS_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
|
||||
<total-bar-plugin customStyle="flex-direction: column;">
|
||||
<view class="item">
|
||||
<text class="item-label">经销商:</text>
|
||||
<text class="item-value">{{info.custom_name}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">单据日期:</text>
|
||||
<text class="item-value">{{info.document_date}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">自定义单号:</text>
|
||||
<text class="item-value">{{info.custom_order_no}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">销售人员:</text>
|
||||
<text class="item-value">{{info.sales_name}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">客户名称:</text>
|
||||
<text class="item-value">{{info.end_user_name}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">客户手机:</text>
|
||||
<text class="item-value">{{info.end_user_phone}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">客户地址:</text>
|
||||
<text class="item-value">{{info.end_user_address}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">备注:</text>
|
||||
<text class="item-value">{{info.comments}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">优惠率:</text>
|
||||
<text class="item-value">{{info.discount_rate}}%</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">收款优惠:</text>
|
||||
<text class="item-value">{{info.discount_money}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-label">优惠后金额:</text>
|
||||
<text class="item-value">{{info.discount_last_money}}</text>
|
||||
</view>
|
||||
</total-bar-plugin>
|
||||
|
||||
<!-- <t-cell title="Excel附件" left-icon="file-excel"
|
||||
custom-style="padding-left:0;padding-right:0;position: sticky;top: 0;" arrow
|
||||
bind:tap="onPreview2" /> -->
|
||||
|
||||
<t-cell title="附件" left-icon="file"
|
||||
custom-style="padding-left:0;padding-right:0;position: sticky;top: 0;z-index:1" />
|
||||
<view style="border: 1px solid #ddd;border-radius: 8rpx;padding: 8rpx;">
|
||||
<block wx:for="{{files}}" wx:key="index">
|
||||
<t-cell title="{{item.file_name}}" hover="{{item._file_type != 'file'}}"
|
||||
arrow="{{item._file_type != 'file'}}" bind:tap="onPreview" data-index="{{index}}">
|
||||
<!-- <block wx:if="{{item._file_type != 'image'}}">
|
||||
<t-icon slot="left-icon" name="{{fileIcon[item._file_type]}}" color="#999" size="96rpx" />
|
||||
</block> -->
|
||||
</t-cell>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<t-cell wx:if="{{ detail.length }}" title="订单明细" left-icon="article" note="{{detail.length}}条"
|
||||
custom-style="padding-left:0;padding-right:0;position: sticky;top: 0;z-index:1" />
|
||||
<card-plugin wx:for="{{ detail }}" wx:key="detail_id">
|
||||
<view slot="header">{{ item.goods_name }}</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="规格" value="{{item.goods_spec}}" />
|
||||
<card-item-plugin label="多属性" value="{{item.attr_name}}" />
|
||||
<card-item-plugin label="单位" value="{{item.unit_ch_name}}" />
|
||||
<card-item-plugin label="数量" value="{{item.nums}}" />
|
||||
<card-item-plugin label="单价" value="{{item.unit_price}}" />
|
||||
<card-item-plugin label="金额" value="{{item.price}}" />
|
||||
<card-item-plugin label="税率" value="{{item.tax_rate}}%" />
|
||||
<card-item-plugin label="税额" value="{{item.tax_money}}" />
|
||||
<card-item-plugin label="价税合计" value="{{item.tax_last_money}}" />
|
||||
<card-item-plugin label="备注" value="{{item.comments}}" />
|
||||
</view>
|
||||
</card-plugin>
|
||||
</page-plugin>
|
||||
@@ -0,0 +1,15 @@
|
||||
.item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
width: 6em;
|
||||
display: inline-flex;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
"account-plugin": "/pages/components/account-plugin/account-plugin",
|
||||
"t-input": "tdesign-miniprogram/input/input",
|
||||
"t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker",
|
||||
"t-cell": "tdesign-miniprogram/cell/cell"
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-textarea": "tdesign-miniprogram/textarea/textarea"
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ Page({
|
||||
eventChannel?.on('saleOrderPay', (res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const { un_payed_amount, order_no } = data;
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
wx.setNavigationBarTitle({ title: `${order_no} 收付款` });
|
||||
this.data.params.order_no = order_no;
|
||||
this.data.params.bill_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
@@ -87,7 +87,7 @@ Page({
|
||||
amount: params.amount,
|
||||
operator: params.operator,
|
||||
last_account_id: params.last_account_id,
|
||||
comments: params.comments,
|
||||
comments: params.comments || '',
|
||||
};
|
||||
post('Orders/orderPay', data).then(() => {
|
||||
toastSuccess('保存成功');
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_SALE_ORDERS_PAY']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-cell title="销售单号" hover note="{{params.order_no}}" />
|
||||
<t-cell title="经销商" hover note="{{record.custom_name}}" />
|
||||
<t-cell title="含税合计" hover note="{{record.tot_tax_last_money}}" />
|
||||
<t-cell title="优惠金额" hover note="{{record.discount_money}}" />
|
||||
<t-cell title="已收金额" hover note="{{record.payed_amount}}" />
|
||||
<t-cell title="销售单号" hover note="{{params.order_no || ''}}" />
|
||||
<t-cell title="经销商" hover note="{{record.custom_name || ''}}" />
|
||||
<t-cell title="含税合计" hover note="{{record.tot_tax_last_money || ''}}" />
|
||||
<t-cell title="优惠金额" hover note="{{record.discount_money || ''}}" />
|
||||
<t-cell title="已收金额" hover note="{{record.payed_amount || ''}}" />
|
||||
<account-plugin bind:ok="accountOk" bind:default="accountDefault"
|
||||
value="{{params.last_account_id}}"></account-plugin>
|
||||
<t-input placeholder="正数是收款,负数是付款" value="{{params.amount}}" suffix="元" align="right"
|
||||
type="number" bindchange="onPriceInput" t-class-tips="tips">
|
||||
<view slot="label" class="custom-label">金额</view>
|
||||
</t-input>
|
||||
<t-cell title="时间" hover note="{{params.bill_date}}" arrow bindtap="showPicker" />
|
||||
<t-input label="备注" placeholder="备注" bindchange="onCommentInput" />
|
||||
<t-cell title="时间" hover arrow bindtap="showPicker">
|
||||
<view slot="note" style="color: #000;">{{params.bill_date || ''}}</view>
|
||||
</t-cell>
|
||||
|
||||
<t-textarea bindchange="onCommentInput" placeholder="备注" autosize="{{true}}" bordered="{{true}}">
|
||||
<view slot="label" style="font-size: initial;">备注</view>
|
||||
</t-textarea>
|
||||
|
||||
<!-- <t-input label="备注" placeholder="备注" bindchange="onCommentInput" /> -->
|
||||
<view style="margin-top: 24rpx;text-align: center;">
|
||||
<t-button theme="primary" bind:tap="onPay">确定</t-button>
|
||||
</view>
|
||||
@@ -20,6 +27,6 @@
|
||||
|
||||
<!-- 年月日时分 -->
|
||||
<t-date-time-picker title="选择日期和时间" visible="{{datetimeVisible}}" mode="second"
|
||||
value="{{params.bill_date}}" format="YYYY-MM-DD HH:mm:ss" bindchange="onConfirm"
|
||||
value="{{[params.bill_date]}}" format="YYYY-MM-DD HH:mm:ss" bindchange="onConfirm"
|
||||
bindcancel="hidePicker" />
|
||||
</page-plugin>
|
||||
@@ -141,6 +141,14 @@ Page({
|
||||
},
|
||||
});
|
||||
},
|
||||
onOrderDetail(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
wx.navigateTo({
|
||||
url: `/pages/orders/ordersList/orderDetail/orderDetail?order_no=${item.order_no}`,
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
@@ -78,6 +78,8 @@
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button size="small" theme="primary" bind:tap="onOrderDetail" data-index="{{index}}">详情
|
||||
</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SALE_ORDERS_PAY']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderPay" data-index="{{index}}">收付款</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SALE_ORDERS_DEL']}}" size="small" theme="danger"
|
||||
|
||||
Reference in New Issue
Block a user