diff --git a/src/api/modules/pre-sale.js b/src/api/modules/pre-sale.js index df78d69..5886788 100644 --- a/src/api/modules/pre-sale.js +++ b/src/api/modules/pre-sale.js @@ -1,7 +1,7 @@ import $http from "@/utils/httpRequest.js"; export const preSale = { - //优惠券列表 + //预售商品列表 preSaleProducts: (data) => { return $http.request({ url: `/merchant-api/product/advance/sell/page`, @@ -9,4 +9,11 @@ export const preSale = { data, }); }, + addPreSaleProducts: (data) => { + return $http.request({ + url: `/merchant-api/product/batch/save/advance/sell`, + method: "post", + data, + }); + }, }; diff --git a/src/views/modules/presale/products/index.vue b/src/views/modules/presale/products/index.vue index 2f6a350..ea73249 100644 --- a/src/views/modules/presale/products/index.vue +++ b/src/views/modules/presale/products/index.vue @@ -130,6 +130,7 @@ export default { data() { return { activeName: "5", + advanceSellStatus: "", dataList: [], formInline: { name: "", @@ -237,7 +238,7 @@ export default { pageNumber: pageNo, pageSize: pageSize, ...this.formInline, - advanceSellStatus: this.activeName, + advanceSellStatus: this.advanceSellStatus, merchantId: JSON.parse(sessionStorage.getItem("userInfo")).merchantId, productQuerySortParam: [], }) @@ -261,6 +262,12 @@ export default { this.$refs.oTable.reload(); }, handleClick(e) { + console.log(e.name); + if (e.name == "5") { + this.advanceSellStatus = ""; + } else { + this.advanceSellStatus = e.name; + } this.$refs.oTable.reload(); }, addEarlyWarning() { @@ -275,7 +282,7 @@ export default { { title: "商品ID", align: "center", - field: "name", + field: "id", }, { title: "商品图", @@ -301,7 +308,15 @@ export default { { title: "定金支付时间", align: "center", - field: "name", + field: "startTime", + type: "jsx", + render: ({ row }) => { + return ( + + {row.startTime}至{row.endTime} + + ); + }, }, { title: "尾款支付时间", @@ -309,15 +324,11 @@ export default { field: "minSalePrice", type: "jsx", render: ({ row }) => { - if (row.minSalePrice == row.maxSalePrice) { - return ¥{row.minSalePrice}; - } else { - return ( - - ¥{row.minSalePrice}~¥{row.maxSalePrice} - - ); - } + return ( + + {row.balancePaymentStartTime}至{row.balancePaymentEndTime} + + ); }, }, { @@ -334,12 +345,96 @@ export default { { title: "定金", align: "center", - field: "saleNum", + field: "earnestMoney", + type: "jsx", + render: ({ row }) => { + if ( + Math.min.apply( + Math, + row.productSpecificationList.map((item) => item.earnestMoney) + ) == + Math.max.apply( + Math, + row.productSpecificationList.map((item) => item.earnestMoney) + ) + ) { + return ( + + {Math.min.apply( + Math, + row.productSpecificationList.map( + (item) => item.earnestMoney + ) + )} + + ); + } else { + return ( + + {Math.min.apply( + Math, + row.productSpecificationList.map( + (item) => item.earnestMoney + ) + )} + 至 + {Math.max.apply( + Math, + row.productSpecificationList.map( + (item) => item.earnestMoney + ) + )} + + ); + } + }, }, { title: "尾款", align: "center", - field: "stockNum", + field: "balancePayment", + type: "jsx", + render: ({ row }) => { + if ( + Math.min.apply( + Math, + row.productSpecificationList.map((item) => item.balancePayment) + ) == + Math.max.apply( + Math, + row.productSpecificationList.map((item) => item.balancePayment) + ) + ) { + return ( + + {Math.min.apply( + Math, + row.productSpecificationList.map( + (item) => item.balancePayment + ) + )} + + ); + } else { + return ( + + {Math.min.apply( + Math, + row.productSpecificationList.map( + (item) => item.balancePayment + ) + )} + 至 + {Math.max.apply( + Math, + row.productSpecificationList.map( + (item) => item.balancePayment + ) + )} + + ); + } + }, }, { title: "状态", @@ -347,10 +442,14 @@ export default { field: "status", type: "jsx", render: ({ row }) => { - if (row.status == "DOWN") { + if (row.advanceSellStatus == "0") { return 未开始; - } else { - return 上架; + } else if (row.advanceSellStatus == "1") { + return 进行中; + } else if (row.advanceSellStatus == "2") { + return 已结束; + } else if (row.advanceSellStatus == "3") { + return 已关闭; } }, }, @@ -363,7 +462,6 @@ export default { render: ({ row }) => { let edit = () => { console.log(row); - this.$refs.addOrUpdate.toggle(row).update(); }; let priceAdjustment = () => { @@ -386,12 +484,7 @@ export default { > 查看 - + 编辑 diff --git a/src/views/modules/presale/products/popup/add-or-update.vue b/src/views/modules/presale/products/popup/add-or-update.vue index 580e99b..c1c036a 100644 --- a/src/views/modules/presale/products/popup/add-or-update.vue +++ b/src/views/modules/presale/products/popup/add-or-update.vue @@ -17,42 +17,66 @@ > - + - + - + - - + + 选择是,用户可在付尾款前申请退定金(申请后自动退,无需审核),或付尾款时间结束后系统自动退定金 @@ -68,87 +92,120 @@ 已选择商品
-
-
- 商品ID:{{item.id}} - 商品名称:{{item.name}} -
- - - - - - - - - - - - - - - - - - - - - - - - - - +
+
+ 商品ID:{{ item.productId }} + 商品名称:{{ item.name }}
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
@@ -183,10 +240,13 @@ export default { }, modalData: {}, ruleForm: { - name: "", - value: "1", - radio: "1", productList: [], + isRefundEarnestMoney: 1, //定金可退 1是 2否 + }, + pickerOptions: { + disabledDate(time) { + return time.getTime() < Date.now(); + }, }, orderTime: [], //订单支付时间 arrears: [], //尾款时间 @@ -235,10 +295,17 @@ export default { this.modalConfig.show = false; } if (e) { - this.init(cloneDeep(e.row)); + this.init(cloneDeep(e)); } return { - add: (data) => { + add: () => { + this.orderTime = []; + this.arrears = []; + this.delivery = []; + this.ruleForm = { + productList: [], + isRefundEarnestMoney: 1, //定金可退 1是 2否 + }; this.modalConfig.title = "新增预售"; this.isAdd = true; }, @@ -249,16 +316,52 @@ export default { }; }, init(row) { - this.modalData = row; + console.log(row.startTime, row.endTime); + this.orderTime = [row.startTime, row.endTime]; + this.arrears = [row.balancePaymentStartTime, row.balancePaymentEndTime]; + this.delivery = []; + this.ruleForm.productList = [ + { + productId: row.id, + name: row.name, + productSpecificationList: row.productSpecificationList, + }, + ]; + console.log(this.orderTime, this.arrears, this.delivery); + + // this.ruleForm = row; }, //订单支付时间 getOrderTime(e) { if (e) { - ruleForm.startTime = e[0]; - ruleForm.endTime = e[1]; + console.log(e); + this.ruleForm.startTime = e[0]; + this.ruleForm.endTime = e[1]; } else { - ruleForm.startTime = ""; - ruleForm.endTime = ""; + this.ruleForm.startTime = ""; + this.ruleForm.endTime = ""; + } + }, + //尾款支付时间 + getArrearsTime(e) { + if (e) { + console.log(e); + this.ruleForm.balancePaymentStartTime = e[0]; + this.ruleForm.balancePaymentEndTime = e[1]; + } else { + this.ruleForm.balancePaymentStartTime = ""; + this.ruleForm.balancePaymentEndTime = ""; + } + }, + //发货时间 + deliveryTime(e) { + if (e) { + console.log(e); + this.ruleForm.estimatedStartDeliveryTime = e[0]; + this.ruleForm.estimatedEndDeliveryTime = e[1]; + } else { + this.ruleForm.estimatedStartDeliveryTime = ""; + this.ruleForm.estimatedEndDeliveryTime = ""; } }, selectProduct() { @@ -274,7 +377,13 @@ export default { console.log(e); }, getProduct(row) { - this.ruleForm.productList = row; + this.ruleForm.productList = row.map((item) => { + return { + productId: item.id, + name: item.name, + productSpecificationList: item.productSpecificationList, + }; + }); console.log(this.ruleForm.productList, this.ruleForm.productList.length); console.log("获取商品"); @@ -294,12 +403,17 @@ export default { type: "primary", // submit: true, handle: () => { - this.$refs.ruleForm.validate((valid) => { - if (valid) { - this.$emit("getAttribute", this.ruleForm); - this.toggle(); - } + this.$api.preSale.addPreSaleProducts(this.ruleForm).then((res) => { + console.log("确认", res); + // this.toggle(); }); + // console.log("确认", this.ruleForm); + // this.$refs.ruleForm.validate((valid) => { + // if (valid) { + // this.$emit("getAttribute", this.ruleForm); + // this.toggle(); + // } + // }); }, }, ];