添加预售
This commit is contained in:
parent
7225340c62
commit
e2451fb087
|
@ -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,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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 (
|
||||
<span>
|
||||
{row.startTime}至{row.endTime}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "尾款支付时间",
|
||||
|
@ -309,15 +324,11 @@ export default {
|
|||
field: "minSalePrice",
|
||||
type: "jsx",
|
||||
render: ({ row }) => {
|
||||
if (row.minSalePrice == row.maxSalePrice) {
|
||||
return <span>¥{row.minSalePrice}</span>;
|
||||
} else {
|
||||
return (
|
||||
<span>
|
||||
¥{row.minSalePrice}~¥{row.maxSalePrice}
|
||||
{row.balancePaymentStartTime}至{row.balancePaymentEndTime}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -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 (
|
||||
<span>
|
||||
{Math.min.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.earnestMoney
|
||||
)
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<span>
|
||||
{Math.min.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.earnestMoney
|
||||
)
|
||||
)}
|
||||
至
|
||||
{Math.max.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.earnestMoney
|
||||
)
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
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 (
|
||||
<span>
|
||||
{Math.min.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.balancePayment
|
||||
)
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<span>
|
||||
{Math.min.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.balancePayment
|
||||
)
|
||||
)}
|
||||
至
|
||||
{Math.max.apply(
|
||||
Math,
|
||||
row.productSpecificationList.map(
|
||||
(item) => item.balancePayment
|
||||
)
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
|
@ -347,10 +442,14 @@ export default {
|
|||
field: "status",
|
||||
type: "jsx",
|
||||
render: ({ row }) => {
|
||||
if (row.status == "DOWN") {
|
||||
if (row.advanceSellStatus == "0") {
|
||||
return <span>未开始</span>;
|
||||
} else {
|
||||
return <span>上架</span>;
|
||||
} else if (row.advanceSellStatus == "1") {
|
||||
return <span>进行中</span>;
|
||||
} else if (row.advanceSellStatus == "2") {
|
||||
return <span>已结束</span>;
|
||||
} else if (row.advanceSellStatus == "3") {
|
||||
return <span>已关闭</span>;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -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 {
|
|||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
disabled={row.status != "DOWN"}
|
||||
type="primary"
|
||||
onClick={edit}
|
||||
>
|
||||
<el-button size="mini" type="primary" onClick={edit}>
|
||||
编辑
|
||||
</el-button>
|
||||
|
||||
|
|
|
@ -17,42 +17,66 @@
|
|||
>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订金支付时间:" prop="name">
|
||||
<el-form-item label="订金支付时间:" prop="startTime">
|
||||
<el-date-picker
|
||||
@change="getOrderTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
data-format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-model="orderTime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:editable="false"
|
||||
>
|
||||
</el-date-picker> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="尾款支付时间:" prop="name">
|
||||
<el-form-item
|
||||
label="尾款支付时间:"
|
||||
prop="balancePaymentStartTime"
|
||||
>
|
||||
<el-date-picker
|
||||
@change="getArrearsTime"
|
||||
format="yyyy-MM-dd"
|
||||
data-format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-model="arrears"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:picker-options="pickerOptions"
|
||||
>
|
||||
</el-date-picker> </el-form-item
|
||||
></el-col>
|
||||
</el-row>
|
||||
<el-form-item label="预计发货时间:" prop="name">
|
||||
<el-form-item
|
||||
label="预计发货时间:"
|
||||
prop="estimatedStartDeliveryTime"
|
||||
>
|
||||
<el-date-picker
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
data-format="yyyy-MM-dd HH:mm"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
@change="deliveryTime"
|
||||
v-model="delivery"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:picker-options="pickerOptions"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="定金可退:" prop="name">
|
||||
<el-radio v-model="ruleForm.radio" label="1">是</el-radio>
|
||||
<el-radio v-model="ruleForm.radio" label="2">否</el-radio>
|
||||
<el-radio v-model="ruleForm.isRefundEarnestMoney" :label="1"
|
||||
>是</el-radio
|
||||
>
|
||||
<el-radio v-model="ruleForm.isRefundEarnestMoney" :label="2"
|
||||
>否</el-radio
|
||||
>
|
||||
<span>
|
||||
选择是,用户可在付尾款前申请退定金(申请后自动退,无需审核),或付尾款时间结束后系统自动退定金
|
||||
</span>
|
||||
|
@ -74,7 +98,7 @@
|
|||
style="border-top: 1px solid #ccc; padding: 10px 0 0 0"
|
||||
>
|
||||
<div style="font-size: 16px; margin-bottom: 20px">
|
||||
<span>商品ID:{{item.id}}</span>
|
||||
<span>商品ID:{{ item.productId }}</span>
|
||||
<span style="margin-left: 20px">商品名称:{{ item.name }}</span>
|
||||
</div>
|
||||
<el-table
|
||||
|
@ -87,32 +111,50 @@
|
|||
>
|
||||
<el-table-column align="center" label="是否预售" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.isShow"></el-checkbox>
|
||||
<el-checkbox
|
||||
:true-label="1"
|
||||
:false-label="0"
|
||||
v-model="scope.row.isAdvanceSell"
|
||||
></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="SKU-ID" prop="id" />
|
||||
<el-table-column align="center" label="规格" prop="attributeList">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.attributeList}}:{{scope.row.attributeValue}}</span>
|
||||
<span>{{ scope.row.attributeValue }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="属性" prop="address">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.attributeList
|
||||
? scope.row.attributeList[0].attributeName
|
||||
: "无"
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="属性" prop="address" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="销售价"
|
||||
prop="address"
|
||||
prop="marketPrice"
|
||||
width="120"
|
||||
/>
|
||||
<el-table-column align="center" label="*是否预售" width="200">
|
||||
<template slot="header">
|
||||
<span style="color: red">*是否预售</span>
|
||||
<span style="color: red">*预售价</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-if="scope.row.isShow"
|
||||
<el-input-number
|
||||
@change="
|
||||
scope.row.balancePayment =
|
||||
scope.row.presalePrice - scope.row.earnestMoney
|
||||
"
|
||||
v-if="scope.row.isAdvanceSell"
|
||||
v-model="scope.row.presalePrice"
|
||||
placeholder="请输入销售价"
|
||||
></el-input>
|
||||
:min="0"
|
||||
:max="scope.row.marketPrice"
|
||||
label="请输入销售价"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="*定金" width="200">
|
||||
|
@ -120,17 +162,25 @@
|
|||
<span style="color: red">*定金</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-if="scope.row.isShow"
|
||||
v-model="scope.row.presalePrice"
|
||||
placeholder="请输入订金"
|
||||
></el-input>
|
||||
<el-input-number
|
||||
@change="
|
||||
scope.row.balancePayment =
|
||||
scope.row.presalePrice - scope.row.earnestMoney
|
||||
"
|
||||
v-if="scope.row.isAdvanceSell"
|
||||
v-model="scope.row.earnestMoney"
|
||||
:min="0"
|
||||
:max="scope.row.presalePrice"
|
||||
label="请输入订金"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="尾款" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.isShow">{{
|
||||
<span v-if="scope.row.isAdvanceSell">{{
|
||||
scope.row.presalePrice
|
||||
? scope.row.presalePrice - scope.row.earnestMoney
|
||||
: ""
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -139,16 +189,23 @@
|
|||
<span style="color: red">*预售库存</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-if="scope.row.isShow"
|
||||
v-model="scope.row.presalePrice"
|
||||
placeholder="请输入预售库存"
|
||||
></el-input>
|
||||
<el-input-number
|
||||
v-if="scope.row.isAdvanceSell"
|
||||
v-model="scope.row.advanceSellStockNum"
|
||||
:min="0"
|
||||
:max="999999"
|
||||
:step="10"
|
||||
:precision="0"
|
||||
label="请输入预售库存"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-empty v-show="ruleForm.productList.length == 0" description="请选择商品"></el-empty>
|
||||
<el-empty
|
||||
v-show="ruleForm.productList.length == 0"
|
||||
description="请选择商品"
|
||||
></el-empty>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 选择商品 -->
|
||||
|
@ -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();
|
||||
// }
|
||||
// });
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue