|
@@ -0,0 +1,91 @@
|
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
|
+
|
|
|
|
+import currency from "../../utils/currency";
|
|
|
|
+const CNY = value => currency(value, {
|
|
|
|
+ symbol: "¥",
|
|
|
|
+ precision: 2
|
|
|
|
+}).format();
|
|
|
|
+
|
|
|
|
+Page({
|
|
|
|
+ data: {
|
|
|
|
+ hidePrice: wx.getStorageSync('hidePrice'),
|
|
|
|
+ content: {
|
|
|
|
+ pageNumber: 1,
|
|
|
|
+ pageTotal: 1,
|
|
|
|
+ pageSize: 20,
|
|
|
|
+ where: {
|
|
|
|
+ condition: "",
|
|
|
|
+ type: "",
|
|
|
|
+ begindate: "",
|
|
|
|
+ enddate: ""
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onLoad(options) {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.setData({
|
|
|
|
+ userrole: wx.getStorageSync('userrole')
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ toDetail(e) {
|
|
|
|
+ const {
|
|
|
|
+ item
|
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: (item.type == "发货" ? "/packageA/dispatchBill/detail" : "/packageA/returnOne/detail") + '?id=' + item.id
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ tabsChange(e) {
|
|
|
|
+ this.data.content.where.type = e.detail.name == "0" ? "" : e.detail.name;
|
|
|
|
+ this.getList(true)
|
|
|
|
+ },
|
|
|
|
+ /* 获取产品 */
|
|
|
|
+ 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;
|
|
|
|
+ this.setListHeight();
|
|
|
|
+ console.log(content)
|
|
|
|
+ _Http.basic({
|
|
|
|
+ "id": "20230626104003",
|
|
|
|
+ "version": 1,
|
|
|
|
+ content
|
|
|
|
+ }).then(res => {
|
|
|
|
+ console.log("发货列表", res)
|
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
|
+ content.pageNumber = res.pageNumber + 1
|
|
|
|
+ content.pageTotal = res.pageTotal
|
|
|
|
+ res.data.map(v => {
|
|
|
|
+ v.amount = CNY(currency(v.price).multiply(v.qty));
|
|
|
|
+ v.price = CNY(v.price);
|
|
|
|
+ return v
|
|
|
|
+ })
|
|
|
|
+ this.setData({
|
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
|
+ content
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /* 修改查看日期 */
|
|
|
|
+ changeDate(e) {
|
|
|
|
+ this.data.content.where[e.currentTarget.dataset.name] = e.detail.value;
|
|
|
|
+ this.getList(true)
|
|
|
|
+ },
|
|
|
|
+ initialize() {
|
|
|
|
+ this.data.content.where.enddate = "";
|
|
|
|
+ this.data.content.where.begindate = "";
|
|
|
|
+ this.getList(true)
|
|
|
|
+ },
|
|
|
|
+ /* 搜索 */
|
|
|
|
+ onSearch({
|
|
|
|
+ detail
|
|
|
|
+ }) {
|
|
|
|
+ this.data.content.where.condition = detail;
|
|
|
|
+ this.getList(true)
|
|
|
|
+ },
|
|
|
|
+ /* 设置页面高度 */
|
|
|
|
+ setListHeight() {
|
|
|
|
+ this.selectComponent("#ListBox").setHeight(".head", this);
|
|
|
|
+ }
|
|
|
|
+})
|