| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- const _Http = getApp().globalData.http,
- currency = require("../../utils/currency"),
- CNY = (value, symbol = "¥", precision = 2) => currency(value, {
- symbol,
- precision
- }).format();
- Page({
- data: {
- searchShow: false,
- searchValue: "",
- typeShow: false,
- tradefieldShow: false
- },
- onLoad(options) {
- const content = Object.assign(JSON.parse(options.data), {
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": "",
- "type": "",
- "tradefield": ""
- }
- }),
- ids = {
- "订单": 2025032613405702,
- "出货": 2025032615330102,
- "开票": 2025032616343302,
- "回款": 2025032616352402,
- };
- getApp().globalData.Language.getLanguagePackage(this, content.typeName + '明细')
- this.setData({
- content,
- id: ids[content.typeName],
- siteid: wx.getStorageSync('userMsg').siteid
- })
- _Http.basic({
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "pageNumber": 1,
- "pageSize": 1000,
- "typename": "ordertype",
- "parameter": {}
- },
- }).then(res => {
- console.log("订单类型", res)
- let types = res.data.map(v => {
- return {
- name: getApp().globalData.Language.getMapText(v.remarks || v.value),
- value: v.value
- }
- })
- types.unshift({
- name: getApp().globalData.Language.getMapText('全部'),
- value: "",
- color: "#3874F6"
- })
- this.setData({
- types
- })
- })
- _Http.basic({
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "pageNumber": 1,
- "pageSize": 1000,
- "typename": "tradefield",
- },
- }).then(res => {
- console.log("领域", res)
- let tradefields = res.data.map(v => {
- return {
- name: getApp().globalData.Language.getMapText(v.remarks || v.value),
- value: v.value
- }
- })
- tradefields.unshift({
- name: getApp().globalData.Language.getMapText('全部'),
- value: "",
- color: "#3874F6"
- })
- this.setData({
- tradefields
- })
- })
- this.getList()
- },
- changeSearchShow() {
- this.setData({
- searchShow: !this.data.searchShow
- })
- this.selectComponent('#ListBox').automaticSetHei();
- },
- getList(init = false) {
- _Http.init(this.data.content, init).then(content => {
- _Http.basic({
- "id": this.data.id,
- content
- }).then(res => {
- console.log(content.typeName + "明细列表", res)
- this.selectComponent('#ListBox').automaticSetHei();
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- res.data = res.data.map(v => {
- v.marketprice = CNY(v.marketprice)
- v.amount = CNY(v.amount)
- v.invoiceamount = CNY(v.invoiceamount)
- v.uninvoiceamount = CNY(v.uninvoiceamount)
- v.writeoffamount = CNY(v.writeoffamount)
- v.unwriteoffamount = CNY(v.unwriteoffamount)
- v.returnamount = CNY(v.returnamount)
- v.price = CNY(v.price)
- v.logisticsamount = CNY(v.logisticsamount)
- v.expanded = false;
- return v
- })
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "total": res.total,
- })
- this.onCancel()
- })
- })
- },
- changeExpanded(e) {
- console.log(e)
- const {
- index
- } = e.currentTarget.dataset;
- this.setData({
- [`list[${index}].expanded`]: !this.data.list[index].expanded
- })
- },
- onSearch() {
- this.data.content.where.condition = this.data.searchValue;
- this.getList(true);
- },
- onChange(event) {
- this.setData({
- searchValue: event.detail
- })
- },
- onClear() {
- this.setData({
- searchValue: "",
- "content.where.condition": ""
- })
- this.getList(true);
- },
- openTypeShow() {
- this.setData({
- typeShow: true
- })
- },
- openTradefieldShow() {
- this.setData({
- tradefieldShow: true
- })
- },
- onSelect(event) {
- const {
- value
- } = event.detail;
- if (this.data.content.where.type == value) return this.onCancel();
- this.setData({
- types: this.data.types.map(item => {
- item.color = item.value == value ? "#3874F6" : "";
- item.loading = item.value == value ? true : false;
- return item
- })
- })
- this.setData({
- "content.where.type": value
- })
- this.getList(true)
- },
- onSelect1(event) {
- const {
- value
- } = event.detail;
- if (this.data.content.where.tradefield == value) return this.onCancel();
- this.setData({
- tradefields: this.data.tradefields.map(item => {
- item.color = item.value == value ? "#3874F6" : "";
- item.loading = item.value == value ? true : false;
- return item
- })
- })
- this.setData({
- "content.where.tradefield": value
- })
- this.getList(true)
- },
- onCancel() {
- this.setData({
- typeShow: false,
- types: this.data.types.map(item => {
- item.loading = false;
- return item
- }),
- tradefieldShow: false,
- tradefields: this.data.tradefields.map(item => {
- item.loading = false;
- return item
- }),
- })
- }
- })
|