| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- const _Http = getApp().globalData.http,
- currency = require("../../utils/currency"),
- CNY = sum => currency(sum, {
- symbol: "¥",
- precision: 2
- }).format();
- Page({
- data: {
- list: [],
- filtrate: false,
- colors: {
- '新建': '#3874f6',
- '提交': '#67C23A',
- '审核': '#e6a23c'
- },
- "content": {
- "nocache": true,
- "pageNumber": 1,
- "pageSize": 20,
- "pageTotal": 1,
- "where": {
- "condition": ""
- }
- }
- },
- onLoad(options) {
- this.getList(true);
- try {
- let privacyFieldC = wx.getStorageSync('auth').writeOff.forms.list.formcols.map(v => v.title);
- this.setData({
- privacyFieldC
- })
- console.log("privacyFieldC", privacyFieldC)
- } catch (error) {
- console.error(error)
- }
- },
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- id: 2025081811145503,
- content: content
- }).then(res => {
- console.log("配件核销申请", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- res.data = res.data.map(v => {
- v.totalamount = CNY(v.totalamount)
- v.offamount = CNY(v.offamount)
- return v
- })
- this.setData({
- total: res.total,
- list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
- 'content.pageNumber': res.pageNumber + 1,
- 'content.pageTotal': res.pageTotal
- })
- })
- },
- /* 更新列表 */
- updateList() {
- let params = JSON.parse(JSON.stringify(this.data.content));
- params.pageSize = (params.pageNumber - 1) * params.pageSize;
- params.pageNumber = 1;
- _Http.basic({
- "id": 2025081811145503,
- content: params
- }).then(res => {
- console.log("配件核销申请", res)
- if (res.msg != '成功') return;
- res.data = res.data.map(v => {
- v.totalamount = CNY(v.totalamount)
- v.offamount = CNY(v.offamount)
- return v
- })
- this.setData({
- list: res.data,
- total: res.total,
- })
- })
- },
- startSearch({
- detail
- }) {
- if (detail == this.data.content.where.condition) return;
- this.data.content.where.condition = detail;
- this.getList(true);
- },
- createOrder(e) {
- _Http.basic({
- "id": 2025081811143103,
- "content": {
- "sa_tpartreimbursementid": 0,
- "remarks": '',
- "billdate": e.detail.value,
- },
- }).then(res => {
- console.log("创建", res)
- wx.showToast({
- title: res.code == 1 ? '创建成功' : res.msg,
- icon: "none"
- })
- if (res.code == 1) wx.navigateTo({
- url: '/packageA/writeOff/detail?id=' + res.data.sa_tpartreimbursementid,
- })
- })
- },
- /* 取消搜索 */
- onClear() {
- this.data.content.where.condition = "";
- this.getList(true);
- },
- openFiltrate() {
- this.setData({
- filtrate: true
- })
- },
- /* 处理筛选 */
- handleFilter(e) {
- e.detail.condition = this.data.content.where.condition;
- e.detail.begindate = e.detail.startdate
- this.setData({
- "content.where": e.detail
- })
- console.log("this.data.content", this.data.content)
- this.getList(true)
- },
- })
|