Compare commits

...

2 Commits

Author SHA1 Message Date
余同学 e2451fb087 添加预售 2024-12-02 18:16:01 +08:00
余同学 7225340c62 预售 2024-12-01 17:26:19 +08:00
4 changed files with 356 additions and 114 deletions

View File

@ -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,
});
},
};

View File

@ -99,6 +99,8 @@
</obj-table-plus>
<!-- 添加或编辑 -->
<add-or-update
:marketId="formInline.marketId"
:shopId="formInline.shopId"
@queryList="$refs.oTable.reload()"
ref="addOrUpdate"
></add-or-update>
@ -128,6 +130,7 @@ export default {
data() {
return {
activeName: "5",
advanceSellStatus: "",
dataList: [],
formInline: {
name: "",
@ -235,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: [],
})
@ -259,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() {
@ -273,7 +282,7 @@ export default {
{
title: "商品ID",
align: "center",
field: "name",
field: "id",
},
{
title: "商品图",
@ -299,7 +308,15 @@ export default {
{
title: "定金支付时间",
align: "center",
field: "name",
field: "startTime",
type: "jsx",
render: ({ row }) => {
return (
<span>
{row.startTime}{row.endTime}
</span>
);
},
},
{
title: "尾款支付时间",
@ -307,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}
</span>
);
}
return (
<span>
{row.balancePaymentStartTime}{row.balancePaymentEndTime}
</span>
);
},
},
{
@ -332,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: "状态",
@ -345,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>;
}
},
},
@ -361,7 +462,6 @@ export default {
render: ({ row }) => {
let edit = () => {
console.log(row);
this.$refs.addOrUpdate.toggle(row).update();
};
let priceAdjustment = () => {
@ -384,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>

View File

@ -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>
@ -68,43 +92,69 @@
已选择商品
</div>
<div style="padding: 20px">
<div style="border-top: 1px solid #ccc; padding: 10px 0 0 0">
<div
v-for="item in ruleForm.productList"
:key="item.id"
style="border-top: 1px solid #ccc; padding: 10px 0 0 0"
>
<div style="font-size: 16px; margin-bottom: 20px">
<span>商品ID:</span>
<span style="margin-left: 20px">商品名称:</span>
<span>商品ID:{{ item.productId }}</span>
<span style="margin-left: 20px">商品名称:{{ item.name }}</span>
</div>
<el-table
border
ref="multipleTable"
:data="tableData"
:data="item.productSpecificationList"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<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.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="SKU-ID" prop="date" />
<el-table-column align="center" label="规格" prop="name" />
<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">
@ -112,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>
@ -131,24 +189,45 @@
<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>
</div>
</div>
<!-- 选择商品 -->
</obj-modal>
<commodity @getProduct="getProduct" ref="commodity"></commodity>
</div>
</template>
<script>
import commodity from "./commodity.vue";
import { debounce, cloneDeep } from "lodash";
export default {
components: {},
components: { commodity },
props: {
marketId: {
type: String,
default: "",
},
shopId: {
type: String,
default: "",
},
},
data() {
return {
isAdd: true,
@ -161,9 +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: [], //
@ -212,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;
},
@ -226,24 +316,78 @@ 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() {
console.log("选择商品");
console.log("选择商品", this.marketId, this.shopId);
this.$nextTick(() => {
this.$refs.commodity.toggle().add({
marketId: this.marketId,
shopId: this.shopId,
});
});
},
handleSelectionChange(e) {
console.log(e);
},
getProduct(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("获取商品");
},
},
computed: {
modalHandles() {
@ -259,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();
// }
// });
},
},
];

View File

@ -17,39 +17,21 @@
:tableEvent="tableEvent"
:enableAutoQuery="false"
>
<!-- <template slot="tableTop">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item v-if="marketList.length > 0" label="菜市场">
<el-select
@change="getData"
v-model="formInline.marketId"
placeholder="请选择菜市场"
>
<el-option
v-for="item in marketList"
:key="item.marketId"
:label="item.marketName"
:value="item.marketId"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="marketList.length > 0" label="店铺">
<el-select v-model="formInline.shopId" placeholder="请选择店铺">
<el-option
v-for="item in storeList"
:key="item.shopId"
:label="item.shopName"
:value="item.shopId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="$refs.oTable.reload()"
>查询</el-button
>
</el-form-item>
</el-form>
</template> -->
<template slot="tableTop">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="商品搜索">
<el-input
v-model="formList.name"
placeholder="商品搜索"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="$refs.oTable.reload()"
>查询</el-button
>
</el-form-item>
</el-form>
</template>
</obj-table-plus>
</template>
</obj-modal>
@ -63,7 +45,7 @@ export default {
isAdd: true,
//
modalConfig: {
title: "请点击选择商品",
title: "请点击选择商品 (提示最多选择5个商品)",
show: false,
width: "1000px",
},
@ -76,14 +58,11 @@ export default {
"row-id": "id",
"show-overflow": false,
},
selectList: {},
tableEvent: {
"current-change": async (e) => {
console.log(e.row);
this.selectList = e.row;
},
},
selectList: [],
formInline: {},
formList: {
name: "",
},
};
},
methods: {
@ -121,6 +100,7 @@ export default {
}
return {
add: (row) => {
console.log(row);
this.formInline = row;
this.isAdd = true;
this.$nextTick(() => {
@ -137,7 +117,7 @@ export default {
computed: {
tableCols() {
return [
{ type: "seq", width: "60px", align: "center", title: "序号" },
{ type: "checkbox", width: "60px", fixed: "left" },
{
title: "商品图",
field: "productPhotoList",
@ -222,6 +202,17 @@ export default {
},
];
},
tableEvent() {
return {
"checkbox-all": ({ records, reserves }) => {
this.selectList = [...records, ...reserves];
},
"checkbox-change": ({ records, reserves }) => {
console.log(this.selectList, "2");
this.selectList = [...records, ...reserves];
},
};
},
},
};
</script>