| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- const _Http = getApp().globalData.http,
- currency = require("../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "¥",
- precision: 2
- }).format();
- Page({
- data: {
- list: [],
- loading: false,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- total: null,
- where: {
- condition: "",
- tablefilter: {
- sonum: null,
- status: null,
- name: null,
- phonenumber: null,
- address: null,
- storename: null
- },
- tableid: 2484
- }
- }
- },
- onLoad() {
- this.getList(true);
- },
- onPullDownRefresh() {
- this.getList(true);
- wx.stopPullDownRefresh();
- },
- onReachBottom() {
- if (this.data.content.pageNumber <= this.data.content.pageTotal) {
- this.getList(false);
- }
- },
- onSearch(e) {
- const keyword = e.detail.value || "";
- this.setData({
- "content.where.condition": keyword,
- "content.pageNumber": 1
- });
- this.getList(true);
- },
- getList(init) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) {
- content.pageNumber = 1;
- this.setData({ loading: true });
- }
- _Http.basic({
- "id": "2026031410293201",
- content
- }).then(res => {
- this.setData({ loading: false });
- console.log("订单列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.code != 1) return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- // 格式化金额数据
- const formattedData = res.data.map(item => ({
- ...item,
- showAmount: CNY(item.amount || 0),
- showPayAmount: CNY(item.payamount || 0),
- showUnpaidAmount: CNY((item.amount || 0) - (item.payamount || 0))
- }))
- this.setData({
- list: res.pageNumber == 1 ? formattedData : this.data.list.concat(formattedData),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total
- })
- })
- },
- // 跳转到开单页面
- createOrder() {
- wx.navigateTo({
- url: `/CRM/customer/modules/orderCreate/create`
- });
- },
- // 跳转到付款明细页面
- navigateToPaymentDetail(e) {
- const orderId = e.currentTarget.dataset.orderid;
- wx.navigateTo({
- url: `/CRM/order/modules/paymentDetail/index?orderId=${orderId}`
- });
- }
- });
|