| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const _Http = getApp().globalData.http,
- currency = require("../../../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "¥",
- precision: 2
- }).format();
- Component({
- properties: {
- id: {
- type: String,
- value: ''
- }
- },
- data: {
- list: [],
- loading: false,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 10,
- pageTotal: 1,
- total: null
- },
- loading: false
- },
- methods: {
- /* 获取订单列表 */
- getList(id, init) {
- if (this.data.loading) return;
- let content = this.data.content;
- content.sa_customersid = id || this.data.id || this.data.sa_customersid;
- if (init) {
- content.pageNumber = 1;
- this.setData({ loading: true });
- }
- _Http.basic({
- "id": "2026030916334801",
- content
- }).then(res => {
- this.setData({ loading: false });
- console.log("客户订单列表", res)
- if (res.code != 1) return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- // 格式化金额数据
- const formattedData = res.data.map(item => ({
- ...item,
- showAmount: CNY(item.amount || 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,
- "sa_customersid": content.sa_customersid
- })
- })
- }
- }
- })
|