添加组件及页面
This commit is contained in:
@@ -1,50 +1,117 @@
|
||||
import { getDataSet } from "@/utils/util";
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import { getAuthInfo, getDataSet, toArray, toastSuccess, toNumber } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
params: { curr_page: 1, page_count: 20, state: "1", process_id: "" },
|
||||
list: [
|
||||
{
|
||||
order_no: "XSDD2025112500000043",
|
||||
custom_name: "客户5",
|
||||
custom_address: "",
|
||||
custom_phone: null,
|
||||
custom_order_no: "",
|
||||
goods_name: "浴室柜",
|
||||
info_process_id: 163,
|
||||
produce_info_id: 62,
|
||||
process_code: "ld",
|
||||
state: 1,
|
||||
end_user_address: null,
|
||||
end_user_name: null,
|
||||
end_user_phone: null,
|
||||
},
|
||||
],
|
||||
count: 1,
|
||||
params: { curr_page: 1, page_count: 20, state: '1', process_id: '' } as any,
|
||||
list: [] as any[],
|
||||
count: 0,
|
||||
dialog: {
|
||||
visible: false,
|
||||
content: '',
|
||||
item: {} as any,
|
||||
action: '' as 'end' | 'back',
|
||||
},
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
this.data.params.order_no = e.detail.value;
|
||||
},
|
||||
searchChange2(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
const val = `${e.detail.value || ''}`.trim();
|
||||
console.log(e);
|
||||
if (val) {
|
||||
this.data.params[key] = val;
|
||||
} else {
|
||||
delete this.data.params[key];
|
||||
}
|
||||
},
|
||||
searchOk() {
|
||||
this.getList(1);
|
||||
},
|
||||
tabChange(e: any) {
|
||||
const state = getDataSet(e).key;
|
||||
this.data.params.state = state;
|
||||
this.page();
|
||||
this.getList();
|
||||
},
|
||||
page(curr: number = 1) {
|
||||
paginationChange(e: any) {
|
||||
this.getList(e.detail.curr_page);
|
||||
},
|
||||
getList(curr: number = 1) {
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
post('CompanyProcessV2/processOrd', this.data.params).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({
|
||||
count: toNumber(res.count),
|
||||
list: list,
|
||||
});
|
||||
});
|
||||
},
|
||||
confirmDialog() {
|
||||
post('ProduceOrder/setProcessV2', {
|
||||
info_process_id: JSON.stringify([this.data.dialog.item.info_process_id]),
|
||||
action: this.data.dialog.action,
|
||||
}).then(() => {
|
||||
this.closeDialog();
|
||||
toastSuccess(this.data.dialog.action == 'end' ? '订单工序完成成功' : '订单工序撤回成功');
|
||||
setTimeout(() => {
|
||||
this.getList(this.data.params.curr_page);
|
||||
}, 1500);
|
||||
});
|
||||
},
|
||||
closeDialog() {
|
||||
this.data.dialog.visible = false;
|
||||
this.setData({ dialog: this.data.dialog });
|
||||
},
|
||||
onEndOrBack(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
this.setData({
|
||||
dialog: {
|
||||
visible: true,
|
||||
content: `确认${data.action == 'end' ? '完成' : '撤回'} ${item.order_no} ?`,
|
||||
action: data.action,
|
||||
item,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
// console.log(options);
|
||||
wx.setNavigationBarTitle({
|
||||
title: decodeURIComponent(options.title || ""),
|
||||
title: decodeURIComponent(options.title || ''),
|
||||
});
|
||||
this.data.params.process_id = `${options.process_id || ""}`;
|
||||
this.page();
|
||||
this.data.params.process_id = `${options.process_id || ''}`;
|
||||
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);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -82,4 +149,3 @@ Page({
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user