完善销售订单, 添加订单排序页
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
"pages/produce/processManage/processManage",
|
||||
"pages/produce/processManageDetail/processManageDetail",
|
||||
"pages/orders/ordersList/ordersList",
|
||||
"pages/orders/orderSort/orderSort"
|
||||
"pages/orders/orderSort/orderSort",
|
||||
"pages/orders/ordersList/orderPayment/orderPayment"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
||||
@@ -4,7 +4,8 @@ button.t-button {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
view.t-input {
|
||||
view.t-input,
|
||||
view.t-cell {
|
||||
flex: none;
|
||||
padding: 24rpx;
|
||||
}
|
||||
@@ -12,3 +13,7 @@ view.t-input {
|
||||
view.t-popup__close {
|
||||
padding: 12rpx;
|
||||
}
|
||||
|
||||
.t-input__icon--prefix {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ Component({
|
||||
},
|
||||
customStyle: {
|
||||
type: String,
|
||||
value: "",
|
||||
value: '',
|
||||
},
|
||||
useInputSlot: {
|
||||
type: Boolean,
|
||||
@@ -42,38 +42,43 @@ Component({
|
||||
methods: {
|
||||
showSearch() {
|
||||
this.setData({ show: true });
|
||||
this.triggerEvent("showChange", true);
|
||||
this.triggerEvent('showChange', true);
|
||||
},
|
||||
close() {
|
||||
this.setData({ show: false });
|
||||
this.triggerEvent("showChange", false);
|
||||
this.triggerEvent('showChange', false);
|
||||
},
|
||||
ok() {
|
||||
this.setData({ show: false });
|
||||
this.triggerEvent("showChange", false);
|
||||
this.triggerEvent("ok");
|
||||
this.triggerEvent('showChange', false);
|
||||
this.triggerEvent('ok');
|
||||
},
|
||||
reset() {
|
||||
this.setData({ show: false });
|
||||
this.triggerEvent('showChange', false);
|
||||
this.triggerEvent('reset');
|
||||
},
|
||||
change(e: any) {
|
||||
this.triggerEvent("change", e.detail);
|
||||
this.triggerEvent('change', e.detail);
|
||||
},
|
||||
scanCode() {
|
||||
const _this = this;
|
||||
wx.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ["qrCode"],
|
||||
scanType: ['qrCode'],
|
||||
success: (res) => {
|
||||
const qrcode = res.result || "";
|
||||
_this.triggerEvent("change", { value: qrcode });
|
||||
_this.triggerEvent("ok");
|
||||
const qrcode = res.result || '';
|
||||
_this.triggerEvent('change', { value: qrcode });
|
||||
_this.triggerEvent('ok');
|
||||
},
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.triggerEvent("ok");
|
||||
this.triggerEvent('ok');
|
||||
},
|
||||
clear() {
|
||||
this.triggerEvent("change", { value: "" });
|
||||
this.triggerEvent("ok");
|
||||
this.triggerEvent('change', { value: '' });
|
||||
this.triggerEvent('ok');
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<slot wx:if="{{useFooterSlot}}" name="footer" />
|
||||
<view wx:else
|
||||
style="padding: 24rpx 0;display: flex;justify-content: center;position: sticky;bottom: 0;left: 0;background-color: #fff;z-index: 1;">
|
||||
<t-button bindtap="ok" style="min-width: 80px;" size="small" theme="primary">搜索
|
||||
</t-button>
|
||||
<t-button bindtap="ok" size="small" theme="primary" style="margin-right: 24rpx;">搜索</t-button>
|
||||
<t-button bindtap="reset" size="small">重置</t-button>
|
||||
</view>
|
||||
</popup-plugin>
|
||||
@@ -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">
|
||||
<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">{{item}}</view>
|
||||
<view slot="content">{{item}}</view>
|
||||
<view slot="footer">{{item}}</view>
|
||||
<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>
|
||||
</block>
|
||||
</page-plugin>
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
151
miniprogram/pages/orders/ordersList/orderPayment/orderPayment.ts
Normal file
151
miniprogram/pages/orders/ordersList/orderPayment/orderPayment.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import {
|
||||
getAuthInfo,
|
||||
priceRetentionDigits,
|
||||
sleep,
|
||||
toastSuccess,
|
||||
toNumber,
|
||||
toObject,
|
||||
} from '@/utils/util';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
params: {} as any,
|
||||
record: {} as any,
|
||||
datetimeVisible: false,
|
||||
},
|
||||
showPicker() {
|
||||
this.setData({ datetimeVisible: true });
|
||||
},
|
||||
hidePicker() {
|
||||
this.setData({ datetimeVisible: false });
|
||||
},
|
||||
onConfirm(e: any) {
|
||||
this.data.params.bill_date = e.detail.value;
|
||||
this.setData({
|
||||
datetimeVisible: false,
|
||||
params: this.data.params,
|
||||
});
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
const eventChannel: any = this.getOpenerEventChannel();
|
||||
if (eventChannel) {
|
||||
eventChannel?.on('saleOrderPay', (res: any) => {
|
||||
const data = toObject(res.data);
|
||||
const { un_payed_amount, order_no } = 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');
|
||||
|
||||
this.data.params.amount = priceRetentionDigits(toNumber(un_payed_amount));
|
||||
this.data.params.operator = toNumber(wx.getStorageSync('user_id')) || undefined;
|
||||
this.setData({
|
||||
params: this.data.params,
|
||||
record: data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
},
|
||||
accountOk(e: any) {
|
||||
this.data.params.last_account_id = e.detail?.account_id;
|
||||
this.setData({
|
||||
params: this.data.params,
|
||||
});
|
||||
// console.log(e);
|
||||
},
|
||||
accountDefault(e: any) {
|
||||
this.data.params.last_account_id = e.detail?.account_id;
|
||||
this.setData({
|
||||
params: this.data.params,
|
||||
});
|
||||
// console.log(e);
|
||||
},
|
||||
onPriceInput(e: any) {
|
||||
this.data.params.amount = e.detail.value;
|
||||
},
|
||||
onCommentInput(e: any) {
|
||||
this.data.params.comments = e.detail.value;
|
||||
},
|
||||
onPay() {
|
||||
const { record, params } = this.data;
|
||||
const data = {
|
||||
order_no: record.order_no,
|
||||
bill_date: params.bill_date,
|
||||
amount: params.amount,
|
||||
operator: params.operator,
|
||||
last_account_id: params.last_account_id,
|
||||
comments: params.comments,
|
||||
};
|
||||
post('Orders/orderPay', data).then(() => {
|
||||
toastSuccess('保存成功');
|
||||
sleep(() => {
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
// console.log(options);
|
||||
|
||||
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);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// onShareAppMessage() {},
|
||||
});
|
||||
@@ -0,0 +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}}" />
|
||||
<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" />
|
||||
<view style="margin-top: 24rpx;text-align: center;">
|
||||
<t-button theme="primary" bind:tap="onPay">确定</t-button>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 年月日时分 -->
|
||||
<t-date-time-picker title="选择日期和时间" visible="{{datetimeVisible}}" mode="second"
|
||||
value="{{params.bill_date}}" format="YYYY-MM-DD HH:mm:ss" bindchange="onConfirm"
|
||||
bindcancel="hidePicker" />
|
||||
</page-plugin>
|
||||
@@ -0,0 +1,10 @@
|
||||
.custom-label {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.custom-label::after {
|
||||
content: '*';
|
||||
color: red;
|
||||
font-size: 32rpx;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
@@ -1,6 +1,20 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"card-plugin": "/pages/components/card-plugin/card-plugin"
|
||||
"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",
|
||||
"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",
|
||||
"t-input": "tdesign-miniprogram/input/input",
|
||||
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
|
||||
"search-input": "/pages/components/search-input/search-input",
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
|
||||
"t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
|
||||
"t-radio": "tdesign-miniprogram/radio/radio",
|
||||
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
|
||||
},
|
||||
"navigationBarTitleText": "销售订单"
|
||||
}
|
||||
@@ -1,18 +1,176 @@
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import {
|
||||
SaleOrderProcessStateOption,
|
||||
PayedStateOption,
|
||||
SaleOrderProcessStateObj,
|
||||
} from '@/utils/config';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
getDataSet,
|
||||
showModal,
|
||||
sleep,
|
||||
toArray,
|
||||
toastSuccess,
|
||||
toNumber,
|
||||
toObject,
|
||||
} from '@/utils/util';
|
||||
|
||||
const defaultParams = { curr_page: 1, page_count: 20, process_state: [200] };
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
list: [1, 2, 3],
|
||||
params: {
|
||||
curr_page: 1,
|
||||
page_count: 20,
|
||||
process_state: 200,
|
||||
params: cloneLite(defaultParams) as any,
|
||||
list: [] as any[],
|
||||
count: 0,
|
||||
amount: {
|
||||
tot_tax_last_money: 0,
|
||||
tot_discount_money: 0,
|
||||
tot_payed_amount: 0,
|
||||
tot_un_payed_amount: 0,
|
||||
},
|
||||
orderStep: [] as any[],
|
||||
saleOrderProcessStateOption: SaleOrderProcessStateOption,
|
||||
saleOrderProcessStateObj: SaleOrderProcessStateObj,
|
||||
payedStateOption: PayedStateOption,
|
||||
sort: [
|
||||
{ label: '自定义单号', value: 'custom_order_no' },
|
||||
{ label: '订单类型', value: 'category_name' },
|
||||
{ label: '订单阶段', value: 'order_step_name' },
|
||||
{ label: '经销商名称', value: 'custom_name' },
|
||||
{ label: '经销商手机', value: 'custom_phone' },
|
||||
{ label: '客户名称', value: 'end_user_name' },
|
||||
{ label: '客户手机', value: 'end_user_phone' },
|
||||
{ label: '客户手机', value: 'end_user_address' },
|
||||
{ label: '单据日期', value: 'document_date' },
|
||||
{ label: '含税合计', value: 'tot_tax_last_money' },
|
||||
{ label: '优惠金额', value: 'discount_money' },
|
||||
{ label: '已收金额', value: 'payed_amount' },
|
||||
{ label: '未收金额', value: 'un_payed_amount' },
|
||||
{ label: '创建日期', value: 'create_date' },
|
||||
],
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
this.getOrderStep();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
this.data.params.order_no = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
searchChange2(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
const val = `${e.detail.value || ''}`.trim();
|
||||
if (val) {
|
||||
this.data.params[key] = val;
|
||||
} else {
|
||||
delete this.data.params[key];
|
||||
}
|
||||
},
|
||||
onOrderStepChange(e: any) {
|
||||
this.data.params.order_step = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
onProcessStateChange(e: any) {
|
||||
this.data.params.process_state = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
onPayedStateChange(e: any) {
|
||||
this.data.params.payed_state = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
datePickerConfirm(e: any) {
|
||||
const data = getDataSet(e);
|
||||
this.data.params[data.key] = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
searchOk() {
|
||||
this.getList(1);
|
||||
},
|
||||
searchReset() {
|
||||
this.data.params = cloneLite(defaultParams);
|
||||
this.getList(1);
|
||||
},
|
||||
onSort(e: any) {
|
||||
this.data.params.order = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
this.getList(1);
|
||||
},
|
||||
tabChange(e: any) {
|
||||
const state = getDataSet(e).key;
|
||||
this.data.params.state = state;
|
||||
this.getList();
|
||||
},
|
||||
paginationChange(e: any) {
|
||||
this.getList(e.detail.curr_page);
|
||||
},
|
||||
getOrderStep() {
|
||||
post('OrderStep/list').then((res: any) => {
|
||||
this.setData({ orderStep: toArray(res.data) });
|
||||
});
|
||||
},
|
||||
getList(curr: number = 1) {
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = JSON.parse(JSON.stringify(this.data.params));
|
||||
if (temp.order_step && temp.order_step.length) {
|
||||
temp.order_step = JSON.stringify(temp.order_step);
|
||||
} else {
|
||||
delete temp.order_step;
|
||||
}
|
||||
|
||||
getList() {
|
||||
// /Orders/list
|
||||
if (temp.process_state && temp.process_state.length) {
|
||||
temp.process_state = temp.process_state.join(',');
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('Orders/list', temp).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,
|
||||
amount: toObject(res.amount),
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderPay(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
wx.navigateTo({
|
||||
url: '/pages/orders/ordersList/orderPayment/orderPayment',
|
||||
success: function (res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('saleOrderPay', { data: item });
|
||||
},
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
showModal({ content: `确认删除 ${item.order_no} 订单?` }).then(() => {
|
||||
post('Orders/delSaleOrders', { order_no: JSON.stringify([item.order_no]) }).then(() => {
|
||||
toastSuccess('删除成功');
|
||||
sleep(() => {
|
||||
this.getList();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
@@ -27,7 +185,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);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
|
||||
@@ -1,7 +1,109 @@
|
||||
<block wx:for="{{list}}" wx:key="index">
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_SALE_ORDERS_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入销售单号" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.order_no}}">
|
||||
<view slot="content">
|
||||
<search-input label="自定义单号" data-key="custom_order_no" bind:change="searchChange2" />
|
||||
<search-input label="经销商名称" data-key="custom_name" bind:change="searchChange2" />
|
||||
<search-input label="经销商手机" data-key="custom_phone" bind:change="searchChange2" />
|
||||
<!-- <search-input label="经销商地址" data-key="custom_address" bind:change="searchChange2" /> -->
|
||||
<search-input label="客户名称" data-key="end_user_name" bind:change="searchChange2" />
|
||||
<search-input label="客户手机" data-key="end_user_phone" bind:change="searchChange2" />
|
||||
<search-input label="客户地址" data-key="end_user_address" bind:change="searchChange2" />
|
||||
<t-cell title="订单阶段">
|
||||
<t-checkbox-group slot="note" bind:change="onOrderStepChange" value="{{params.order_step}}">
|
||||
<block wx:for="{{orderStep}}" wx:key="index">
|
||||
<t-checkbox icon="rectangle" borderless="{{true}}" block="{{false}}"
|
||||
value="{{item.order_step_id}}" style="margin-right: 16rpx;">
|
||||
{{item.order_step_name}}
|
||||
</t-checkbox>
|
||||
</block>
|
||||
</t-checkbox-group>
|
||||
</t-cell>
|
||||
<t-cell title="生产状态">
|
||||
<t-checkbox-group slot="note" bind:change="onProcessStateChange"
|
||||
value="{{params.process_state}}">
|
||||
<block wx:for="{{saleOrderProcessStateOption}}" wx:key="index">
|
||||
<t-checkbox icon="rectangle" borderless="{{true}}" block="{{false}}"
|
||||
value="{{item.value}}" style="margin-right: 16rpx;">
|
||||
{{item.label}}
|
||||
</t-checkbox>
|
||||
</block>
|
||||
</t-checkbox-group>
|
||||
</t-cell>
|
||||
<t-cell title="收款状态">
|
||||
<t-radio-group slot="note" bind:change="onPayedStateChange"
|
||||
value="{{params.payed_state || ''}}">
|
||||
<block wx:for="{{payedStateOption}}" wx:key="index">
|
||||
<t-radio borderless="{{true}}" block="{{false}}" value="{{item.value}}"
|
||||
style="margin-right: 16rpx;">
|
||||
{{item.label}}
|
||||
</t-radio>
|
||||
</block>
|
||||
</t-radio-group>
|
||||
</t-cell>
|
||||
<date-picker-plugin title="单据开始日期" value="{{params.document_dateL}}" data-key="document_dateL"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
<date-picker-plugin title="单据结束日期" value="{{params.document_dateU}}" data-key="document_dateU"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
<date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
</view>
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" />
|
||||
</count-plugin>
|
||||
<total-bar-plugin>
|
||||
<view style="display: inline-flex;align-items: center;">
|
||||
<text>含税金额合计:</text>
|
||||
<text>¥{{amount.tot_tax_last_money}}</text>
|
||||
</view>
|
||||
<view style="display: inline-flex;align-items: center;">
|
||||
<text>优惠金额合计:</text>
|
||||
<text>¥{{amount.tot_discount_money}}</text>
|
||||
</view>
|
||||
<view style="display: inline-flex;align-items: center;">
|
||||
<text>已收金额合计:</text>
|
||||
<text>¥{{amount.tot_payed_amount}}</text>
|
||||
</view>
|
||||
<view style="display: inline-flex;align-items: center;">
|
||||
<text>未收金额合计:</text>
|
||||
<text>¥{{amount.tot_un_payed_amount}}</text>
|
||||
</view>
|
||||
</total-bar-plugin>
|
||||
<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">{{item}}</view>
|
||||
<view slot="content">{{item}}</view>
|
||||
<view slot="footer">{{item}}</view>
|
||||
<view slot="header">{{ item.order_no }}</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="{{saleOrderProcessStateObj[item.process_state]}}" />
|
||||
<card-item-plugin label="经销商名称" value="{{item.custom_name}}" />
|
||||
<card-item-plugin label="经销商手机" value="{{item.custom_phone}}" />
|
||||
<!-- <card-item-plugin label="经销商地址" value="{{item.custom_address}}" /> -->
|
||||
<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.document_date}}" />
|
||||
<card-item-plugin label="含税合计" value="{{item.tot_tax_last_money}}" />
|
||||
<card-item-plugin label="优惠金额" value="{{item.discount_money}}" />
|
||||
<card-item-plugin label="已收金额" value="{{item.payed_amount}}" />
|
||||
<card-item-plugin label="未收金额" value="{{item.un_payed_amount}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" style="padding-bottom: 16rpx;">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SALE_ORDERS_PAY']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderPay" data-index="{{index}}" style="margin-right: 24rpx;">收付款</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SALE_ORDERS_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
</block>
|
||||
</block>
|
||||
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" />
|
||||
</page-plugin>
|
||||
@@ -0,0 +1,4 @@
|
||||
view.t-cell__title-text {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -16,17 +16,13 @@ export const colors = {
|
||||
export const defaultAvatarUrl =
|
||||
'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0';
|
||||
|
||||
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion;
|
||||
|
||||
export const base = {
|
||||
appletName: '易宝赞普惠版',
|
||||
apiHost:
|
||||
wx.getAccountInfoSync().miniProgram.envVersion == 'release'
|
||||
? 'https://ebaozan.com/api/'
|
||||
: 'http://192.168.1.138:93/',
|
||||
apiHost: envVersion == 'release' ? 'https://f.ebaozan.com/api/' : 'http://192.168.1.138:93/',
|
||||
|
||||
webViewBaseUrl:
|
||||
wx.getAccountInfoSync().miniProgram.envVersion == 'release'
|
||||
? 'https://ebaozan.com/'
|
||||
: 'http://ebaozan.cf/',
|
||||
webViewBaseUrl: envVersion == 'release' ? 'https://f.ebaozan.com/' : 'http://free.erp/',
|
||||
cookieKey: 'OwCookie',
|
||||
};
|
||||
|
||||
@@ -38,3 +34,26 @@ export const http = {
|
||||
},
|
||||
unLoginCode: 110000,
|
||||
};
|
||||
|
||||
/**
|
||||
* 生产状态
|
||||
*/
|
||||
export const SaleOrderProcessStateOption = [
|
||||
{ label: '生产未完成', value: 200 },
|
||||
{ label: '生产已完成', value: 202 },
|
||||
];
|
||||
|
||||
export const SaleOrderProcessStateObj = {
|
||||
200: '生产未完成',
|
||||
202: '生产已完成',
|
||||
};
|
||||
|
||||
/**
|
||||
* 收款状态
|
||||
*/
|
||||
export const PayedStateOption = [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '未收款', value: '1' },
|
||||
{ label: '部分收款', value: '2' },
|
||||
{ label: '收款完成', value: '3' },
|
||||
];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* YangXB 2021.11.24
|
||||
* */
|
||||
import { base, http } from './config';
|
||||
import { getStorage, goIndexPage, isArray, setStorage, toastError } from './util';
|
||||
import { getStorage, goIndexPage, isArray, setStorage, toArray, toastError } from './util';
|
||||
/**
|
||||
* 请求
|
||||
*/
|
||||
@@ -129,14 +129,24 @@ export const checkSession = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const getUsersConfigList = () => {
|
||||
post('ErpConfig/ErpConfigList').then((res: any) => {
|
||||
toArray(res?.data?.list).forEach((el) => {
|
||||
wx.setStorageSync(el.config_type_en, el.config_value);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const loginStatus = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
post('Applet/loginStatus', {}, { showLoading: false })
|
||||
.then((res: any) => {
|
||||
setStorage('user_info', res.user_info);
|
||||
setStorage('user_id', res.user_info?.user_id);
|
||||
setStorage('company_info', res.company_info);
|
||||
setStorage('auth_info', res.auth_info);
|
||||
setStorage('session_id', res.session_id);
|
||||
getUsersConfigList();
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err: any) => {
|
||||
@@ -194,6 +204,7 @@ export const login = (encryptedData: any, iv: any, type?: any, company_id?: any)
|
||||
resolve(res);
|
||||
} else {
|
||||
setStorage('user_info', res.user_info);
|
||||
setStorage('user_id', res.user_info?.user_id);
|
||||
setStorage('company_info', res.companys_info);
|
||||
setStorage('auth_info', res.auth_info);
|
||||
loginStatus();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { http } from './config';
|
||||
import Big from 'big.js';
|
||||
|
||||
export const formatTime = (date: Date) => {
|
||||
const year = date.getFullYear();
|
||||
@@ -19,12 +20,11 @@ export const formatNumber = (n: number | string) => {
|
||||
};
|
||||
|
||||
// 对话框
|
||||
export const showModal = (title: string, content: string, showCancel = false) => {
|
||||
export const showModal = (option: { title?: string; content: string }) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
wx.showModal({
|
||||
title,
|
||||
content,
|
||||
showCancel,
|
||||
title: option.title || '系统提示',
|
||||
content: option.content,
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
resolve();
|
||||
@@ -306,3 +306,44 @@ export const getCurrentPageRoute = () => {
|
||||
const currentPage = pages[pages.length - 1]; // 获取当前页面对象
|
||||
return `/${currentPage.route}`; // 获取当前页面路径
|
||||
};
|
||||
|
||||
/** 价格保留位数 */
|
||||
export const priceRetentionDigits = (value?: number) => {
|
||||
return toNumber(
|
||||
Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('PRICE_HOLD_POINT') || 2)),
|
||||
);
|
||||
};
|
||||
|
||||
/** 价格保留位数字符串类型 */
|
||||
export const priceRetentionDigitsString = (value?: number) => {
|
||||
return Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('PRICE_HOLD_POINT') || 2));
|
||||
};
|
||||
|
||||
/** 数量保留位数 */
|
||||
export const numRetentionDigits = (value?: number) => {
|
||||
return toNumber(
|
||||
Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('NUMS_HOLD_POINT') || 2)),
|
||||
);
|
||||
};
|
||||
|
||||
/** 数量保留位数字符串类型 */
|
||||
export const numRetentionDigitsString = (value?: number) => {
|
||||
return Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('NUMS_HOLD_POINT') || 2));
|
||||
};
|
||||
|
||||
/**
|
||||
* sleep
|
||||
* @param callback 回调函数
|
||||
* @param ms 毫秒, 默认300ms
|
||||
* @returns
|
||||
*/
|
||||
export const sleep = (callback?: () => void, ms = 300): Promise<boolean> => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
callback?.();
|
||||
resolve(true);
|
||||
}, ms);
|
||||
});
|
||||
};
|
||||
|
||||
export const cloneLite = (data: any) => JSON.parse(JSON.stringify(data));
|
||||
|
||||
Reference in New Issue
Block a user