完善销售订单, 添加订单排序页
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"card-plugin": "/pages/components/card-plugin/card-plugin"
|
||||
"card-plugin": "/pages/components/card-plugin/card-plugin",
|
||||
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin"
|
||||
},
|
||||
"navigationBarTitleText": "订单排序"
|
||||
"navigationBarTitleText": "订单排序",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
@@ -1,13 +1,46 @@
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import { getAuthInfo, getDataSet, showModal, sleep, toArray, toastSuccess } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
list: [1, 2],
|
||||
list: [] as any[],
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
|
||||
getList() {
|
||||
// Orders/getLiteOrders
|
||||
post('Orders/getLiteOrders')
|
||||
.then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
wx.stopPullDownRefresh();
|
||||
this.setData({ list: list });
|
||||
})
|
||||
.catch(() => {
|
||||
wx.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
onOrderToTop(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
showModal({ content: `确认把 ${item.order_no} 订单移至顶部?` }).then(() => {
|
||||
post('Orders/setTop', { order_no: item.order_no }).then(() => {
|
||||
toastSuccess('移动成功');
|
||||
sleep(() => {
|
||||
this.getList();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
@@ -22,7 +55,18 @@ Page({
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
onShow() {
|
||||
this.setData({ loading: true });
|
||||
loginStatus()
|
||||
.then(() => {
|
||||
this.setData({ isLogin: true, loading: false });
|
||||
this.init();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({ isLogin: false, loading: false });
|
||||
console.log('调用登录状态请求失败', err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
@@ -37,7 +81,9 @@ Page({
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
|
||||
@@ -1,7 +1,30 @@
|
||||
<block wx:for="{{list}}" wx:key="index">
|
||||
<card-plugin>
|
||||
<view slot="header">{{item}}</view>
|
||||
<view slot="content">{{item}}</view>
|
||||
<view slot="footer">{{item}}</view>
|
||||
</card-plugin>
|
||||
</block>
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_SALE_ORDERS_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-empty wx:if="{{list.length == 0}}" icon="info-circle-filled" description="暂无数据"
|
||||
style="margin-bottom: 24rpx;" />
|
||||
<block wx:for="{{ list }}" wx:key="info_process_id">
|
||||
<card-plugin>
|
||||
<view slot="header" style="display: flex;justify-content: space-between;width: 100%;">
|
||||
<text>{{ item.order_no }}</text>
|
||||
<view
|
||||
style="font-weight: normal;min-width: 1.5em;border: 1rpx solid #eee;text-align: center;color: #999;border-radius: 25%;">
|
||||
{{index + 1}}
|
||||
</view>
|
||||
</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="自定义单号" value="{{item.custom_order_no}}" />
|
||||
<card-item-plugin label="订单类型" value="{{item.category_name}}" />
|
||||
<card-item-plugin label="经销商名称" value="{{item.custom_name}}" />
|
||||
<card-item-plugin label="经销商手机" value="{{item.custom_phone}}" />
|
||||
<card-item-plugin label="客户名称" value="{{item.end_user_name}}" />
|
||||
<card-item-plugin label="客户手机" value="{{item.end_user_phone}}" />
|
||||
<card-item-plugin label="客户地址" value="{{item.end_user_address}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" style="padding-bottom: 16rpx;">
|
||||
<t-button size="small" theme="primary" bind:tap="onOrderToTop" data-index="{{index}}">移至顶部
|
||||
</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
</block>
|
||||
</page-plugin>
|
||||
Reference in New Issue
Block a user