|
@@ -1,5 +1,8 @@
|
|
|
import currency from "../../../../../utils/currency";
|
|
|
-
|
|
|
+let {
|
|
|
+ formatTime
|
|
|
+} = require("../../../../../utils/getTime")
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
Component({
|
|
|
properties: {
|
|
|
list: {
|
|
@@ -15,6 +18,9 @@ Component({
|
|
|
type: Boolean
|
|
|
}
|
|
|
},
|
|
|
+ data: {
|
|
|
+ popupShow: false
|
|
|
+ },
|
|
|
options: {
|
|
|
addGlobalClass: true
|
|
|
},
|
|
@@ -53,19 +59,90 @@ Component({
|
|
|
deliverydate: data.deliverydate || ""
|
|
|
})
|
|
|
},
|
|
|
- changeDate(e) {
|
|
|
+ async calculate(e) {
|
|
|
+ this.isEdit()
|
|
|
+ if (this.data.disabled) return;
|
|
|
let {
|
|
|
- data
|
|
|
+ item
|
|
|
} = e.currentTarget.dataset;
|
|
|
- this.triggerEvent("changeProduct", {
|
|
|
- sa_orderitemsid: data.sa_orderitemsid,
|
|
|
- itemid: data.itemid,
|
|
|
- qty: data.qty,
|
|
|
- remarks: data.remarks,
|
|
|
- needdate: e.detail.value || "",
|
|
|
- deliverydate: data.deliverydate || ""
|
|
|
+ item.minData = Date.now();
|
|
|
+ if (item.delivery != 0 && item.delivery != "") {
|
|
|
+ let date = Date.now() + (item.delivery * 86400000);
|
|
|
+ item.minDate = await exclusion(formatTime(new Date(date), "-").split(" ")[0]);
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ changeDate: item,
|
|
|
+ popupShow: true
|
|
|
+ })
|
|
|
+
|
|
|
+ function exclusion(begindate) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20231008134404,
|
|
|
+ "content": {
|
|
|
+ "isExport": 0,
|
|
|
+ "isnext": '0',
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 100,
|
|
|
+ "where": {
|
|
|
+ begindate,
|
|
|
+ "enddate": formatTime(new Date(date + (31 * 86400000)), "-").split(" ")[0]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("查询节假日", begindate, res)
|
|
|
+ if (res.data.some(v => v.date == begindate)) {
|
|
|
+ function day() {
|
|
|
+ date += 86400000;
|
|
|
+ if (res.data.some(v => v.date == formatTime(new Date(date), "-").split(" ")[0])) {
|
|
|
+ day()
|
|
|
+ } else {
|
|
|
+ resolve(date)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ day()
|
|
|
+ } else {
|
|
|
+ resolve(date)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ changeDate: item,
|
|
|
+ popupShow: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ closePopup() {
|
|
|
+ this.setData({
|
|
|
+ popupShow: false,
|
|
|
+ changeDate: null
|
|
|
})
|
|
|
},
|
|
|
+ onConfirm({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ let data = this.data.changeDate,
|
|
|
+ that = this;
|
|
|
+ let needdate = formatTime(new Date(detail), "-").split(' ')[0];
|
|
|
+ wx.showModal({
|
|
|
+ content: `是否确定期望交期为${needdate}日`,
|
|
|
+ title: '提示',
|
|
|
+ success: (result) => {
|
|
|
+ that.triggerEvent("changeProduct", {
|
|
|
+ sa_orderitemsid: data.sa_orderitemsid,
|
|
|
+ itemid: data.itemid,
|
|
|
+ qty: data.qty,
|
|
|
+ remarks: data.remarks,
|
|
|
+ needdate,
|
|
|
+ deliverydate: data.deliverydate || ""
|
|
|
+ })
|
|
|
+ that.closePopup();
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
deleteProduct(e) {
|
|
|
this.triggerEvent("deleteItem", e.currentTarget.dataset.item)
|
|
|
},
|