| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- const _Http = getApp().globalData.http,
- currency = require("../../../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "¥",
- precision: 2
- }).format();
- Component({
- properties: {
- orderId: {
- type: String,
- value: ''
- },
- orderStatus: {
- type: String,
- value: ''
- }
- },
- data: {
- list: [],
- loading: false,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- total: null
- }
- },
- methods: {
- /* 获取付款记录列表 */
- getList(id, init) {
- let content = this.data.content;
- content.sa_custorderid = id || this.data.orderId || this.data.sa_custorderid;
- if (init) {
- content.pageNumber = 1;
- this.setData({ loading: true });
- }
- // 使用新的付款记录API
- _Http.basic({
- "id": "2026032016050501",
- content: {
- sa_custorderid: content.sa_custorderid,
- pageNumber: content.pageNumber,
- pageSize: content.pageSize
- }
- }).then(res => {
- this.setData({ loading: false });
- console.log("付款记录列表", res)
- if (res.code != 1) return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- if (res.data && res.data.length > 0) {
- // 格式化金额数据
- const formattedData = res.data.map(item => ({
- ...item,
- showPayAmount: CNY(item.amount || 0)
- }))
- this.setData({
- list: init ? formattedData : this.data.list.concat(formattedData),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- "sa_custorderid": content.sa_custorderid
- })
- }
- })
- },
- /* 跳转到创建收款单页面 */
- addPayment() {
- // 已退单状态不能添加付款记录
- if (this.data.orderStatus === '已退单') {
- wx.showToast({
- title: '已退单订单不能添加付款记录',
- icon: 'none'
- });
- return;
- }
-
- const sa_custorderid = this.data.orderId || this.data.sa_custorderid;
- wx.navigateTo({
- url: `/CRM/order/modules/paymentCreate/create?sa_custorderid=${sa_custorderid}`
- });
- }
- }
- })
|