|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <el-dialog
|
|
|
|
|
|
|
+ <el-drawer
|
|
|
title="活动商品"
|
|
title="活动商品"
|
|
|
- :close-on-click-modal="false"
|
|
|
|
|
|
|
+ size="1000px"
|
|
|
:visible.sync="visible"
|
|
:visible.sync="visible"
|
|
|
|
|
+ :wrapperClosable="false"
|
|
|
>
|
|
>
|
|
|
<el-form
|
|
<el-form
|
|
|
:model="dataForm"
|
|
:model="dataForm"
|
|
@@ -10,15 +11,16 @@
|
|
|
ref="dataForm"
|
|
ref="dataForm"
|
|
|
@keyup.enter.native="dataFormSubmit()"
|
|
@keyup.enter.native="dataFormSubmit()"
|
|
|
label-width="100px"
|
|
label-width="100px"
|
|
|
|
|
+ style="padding: 0 20px 64px 0; position: relative;"
|
|
|
>
|
|
>
|
|
|
- <el-form-item label="活动价" prop="price_type">
|
|
|
|
|
- <el-radio-group v-model="dataForm.price_type">
|
|
|
|
|
|
|
+ <el-form-item label="活动价" prop="priceType">
|
|
|
|
|
+ <el-radio-group v-model="dataForm.priceType">
|
|
|
<el-radio :label="0">固定折扣</el-radio>
|
|
<el-radio :label="0">固定折扣</el-radio>
|
|
|
<el-radio :label="1">固定减价 </el-radio>
|
|
<el-radio :label="1">固定减价 </el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
- v-if="dataForm.price_type == 0"
|
|
|
|
|
|
|
+ v-if="dataForm.priceType == 0"
|
|
|
prop="discount"
|
|
prop="discount"
|
|
|
:rules="[
|
|
:rules="[
|
|
|
{ required: true, message: '固定折扣不能为空', trigger: 'blur' },
|
|
{ required: true, message: '固定折扣不能为空', trigger: 'blur' },
|
|
@@ -41,15 +43,15 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
- v-if="dataForm.price_type == 1"
|
|
|
|
|
- prop="fix_price"
|
|
|
|
|
|
|
+ v-if="dataForm.priceType == 1"
|
|
|
|
|
+ prop="fixPrice"
|
|
|
:rules="[
|
|
:rules="[
|
|
|
{ required: true, message: '固定减价不能为空', trigger: 'blur' },
|
|
{ required: true, message: '固定减价不能为空', trigger: 'blur' },
|
|
|
]"
|
|
]"
|
|
|
>
|
|
>
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="dataForm.fix_price"
|
|
|
|
|
|
|
+ v-model="dataForm.fixPrice"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -65,35 +67,56 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
- <el-table
|
|
|
|
|
- :data="dataList"
|
|
|
|
|
- row-key="Id"
|
|
|
|
|
- border
|
|
|
|
|
- style="width: 100%; margin-top: 30px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-table-column prop="sku_set_name" align="center" label="规格">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ <div style="padding: 0 0 0 20px">
|
|
|
|
|
+ <el-table
|
|
|
|
|
+ :data="dataList"
|
|
|
|
|
+ row-key="Id"
|
|
|
|
|
+ border
|
|
|
|
|
+ style="width: 100%; margin-top: 30px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table-column prop="skuSetName" align="center" label="规格">
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
|
|
|
- <el-table-column prop="cost_price" align="center" label="成本价">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column prop="sale_price" align="center" label="原价">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column prop="activity_price" align="center" label="价格">
|
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
- <el-input-number
|
|
|
|
|
- v-model="scope.row.activity_price"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- :precision="2"
|
|
|
|
|
- :controls="false"
|
|
|
|
|
- :max="100000"
|
|
|
|
|
- ></el-input-number>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <el-form-item label="限购数量" prop="limit_buy_num" class="mt30">
|
|
|
|
|
|
|
+ <el-table-column prop="costPrice" align="center" label="成本价">
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="originalSalePrice" align="center" label="原价">
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="salePrice" align="center" label="价格">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="scope.row.salePrice"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :controls="false"
|
|
|
|
|
+ :max="1000000000"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ ></el-input-number>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ prop="originalStock"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ label="库存"
|
|
|
|
|
+ v-if="showInventory"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="stock" align="center" label="投放数量">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="scope.row.stock"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ :precision="0"
|
|
|
|
|
+ :controls="false"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ ></el-input-number>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form-item label="限购数量" prop="limitBuyNum" class="mt30">
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="dataForm.limit_buy_num"
|
|
|
|
|
|
|
+ v-model="dataForm.limitBuyNum"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:precision="0"
|
|
:precision="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -105,10 +128,10 @@
|
|
|
>
|
|
>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
- <el-form-item label="可售数量" prop="real_stock_total">
|
|
|
|
|
|
|
+ <!-- <el-form-item label="可售数量" prop="realStockTotal">
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="dataForm.real_stock_total"
|
|
|
|
|
|
|
+ v-model="dataForm.realStockTotal"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:precision="0"
|
|
:precision="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -116,11 +139,11 @@
|
|
|
></el-input-number>
|
|
></el-input-number>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12" :offset="2">此次活动所有SKU可售数量</el-col>
|
|
<el-col :span="12" :offset="2">此次活动所有SKU可售数量</el-col>
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="初始销量" prop="init_sale_num">
|
|
|
|
|
|
|
+ </el-form-item> -->
|
|
|
|
|
+ <el-form-item label="初始销量" prop="initSaleNum">
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="dataForm.init_sale_num"
|
|
|
|
|
|
|
+ v-model="dataForm.initSaleNum"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:precision="0"
|
|
:precision="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -129,10 +152,10 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
- <el-form-item label="团购人数" prop="group_people_num">
|
|
|
|
|
|
|
+ <el-form-item label="团购人数" prop="groupPeopleNum">
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="dataForm.group_people_num"
|
|
|
|
|
|
|
+ v-model="dataForm.groupPeopleNum"
|
|
|
:min="2"
|
|
:min="2"
|
|
|
:precision="0"
|
|
:precision="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -150,57 +173,72 @@
|
|
|
:max="10000000"
|
|
:max="10000000"
|
|
|
></el-input-number>
|
|
></el-input-number>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
|
+ <el-button @click="celForm()">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" :loading="loading" @click="dataFormSubmit()"
|
|
|
|
|
+ >确定</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
|
- <el-button @click="celForm()">取消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
|
|
- </span>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
|
+ </el-drawer>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
// import seviceApi from "@/api/serviceApi.js";
|
|
// import seviceApi from "@/api/serviceApi.js";
|
|
|
|
|
+import {
|
|
|
|
|
+ groupBookingActivitygoodsAdd_api,
|
|
|
|
|
+ groupBookingActivitygoodsEdit_api,
|
|
|
|
|
+ groupBookingActivitygoodsInfo_api,
|
|
|
|
|
+} from "@/api/marketing/groupBooking.js";
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ props: {
|
|
|
|
|
+ showInventory: {
|
|
|
|
|
+ type: Boolean,
|
|
|
|
|
+ default: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
visible: false,
|
|
visible: false,
|
|
|
|
|
+ loading: false,
|
|
|
dataForm: {
|
|
dataForm: {
|
|
|
- goods_id: null, // 商品id
|
|
|
|
|
- group_buy_id: null, // 拼团活动id
|
|
|
|
|
- price_type: null, // 0固定折扣,1固定减价
|
|
|
|
|
- discount: null, // 固定折扣
|
|
|
|
|
- fix_price: null, // 固定减价
|
|
|
|
|
- limit_buy_num: null, // 限购
|
|
|
|
|
|
|
+ productId: null, // 商品id
|
|
|
|
|
+ groupBuyId: null, // 拼团活动id
|
|
|
|
|
+ priceType: 0, // 0固定折扣,1固定减价
|
|
|
|
|
+ discount: 0, // 固定折扣
|
|
|
|
|
+ fixPrice: 0, // 固定减价
|
|
|
|
|
+ limitBuyNum: null, // 限购
|
|
|
|
|
+ limitBuyNum: null, // 限购
|
|
|
sort: null, // 商品排序
|
|
sort: null, // 商品排序
|
|
|
- real_stock_total: null, // 真实库存总数
|
|
|
|
|
- init_sale_num: null, // 初始化销量
|
|
|
|
|
- group_people_num: null, // 成团总人数
|
|
|
|
|
- group_buy_goods_sku_list: [],
|
|
|
|
|
|
|
+ initSaleNum: null, // 初始化销量
|
|
|
|
|
+ groupPeopleNum: null, // 成团总人数
|
|
|
|
|
+ productSkuSetList: [],
|
|
|
},
|
|
},
|
|
|
dataList: [],
|
|
dataList: [],
|
|
|
dataRule: {
|
|
dataRule: {
|
|
|
- price_type: [
|
|
|
|
|
|
|
+ priceType: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
message: "活动价不能为空",
|
|
message: "活动价不能为空",
|
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- real_stock_total: [
|
|
|
|
|
|
|
+ realStockTotal: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
message: "可售数量不能为空",
|
|
message: "可售数量不能为空",
|
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- init_sale_num: [
|
|
|
|
|
|
|
+ initSaleNum: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
message: "初始销量不能为空",
|
|
message: "初始销量不能为空",
|
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- group_people_num: [
|
|
|
|
|
|
|
+ groupPeopleNum: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
message: "团购人数不能为空",
|
|
message: "团购人数不能为空",
|
|
@@ -214,7 +252,7 @@ export default {
|
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- limit_buy_num: [
|
|
|
|
|
|
|
+ limitBuyNum: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
message: "限购数量不能为空",
|
|
message: "限购数量不能为空",
|
|
@@ -229,42 +267,36 @@ export default {
|
|
|
celForm() {
|
|
celForm() {
|
|
|
this.visible = false;
|
|
this.visible = false;
|
|
|
},
|
|
},
|
|
|
- init(id, groupBuyId, goodsId) {
|
|
|
|
|
|
|
+ init(id, groupBuyId, productId, productSkuSetList, productInfo = {}) {
|
|
|
this.dataForm.id = id || null;
|
|
this.dataForm.id = id || null;
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
- this.dataForm.goods_id = goodsId;
|
|
|
|
|
- this.dataForm.group_buy_id = groupBuyId;
|
|
|
|
|
|
|
+ this.dataForm.productId = productId;
|
|
|
|
|
+ this.dataForm.groupBuyId = groupBuyId;
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.$refs["dataForm"].resetFields();
|
|
this.$refs["dataForm"].resetFields();
|
|
|
});
|
|
});
|
|
|
if (id) {
|
|
if (id) {
|
|
|
- seviceApi.getActivitygoodsInfo(id).then((res) => {
|
|
|
|
|
- if (res && res.data.code == 200) {
|
|
|
|
|
- this.dataForm = res.data.data;
|
|
|
|
|
- seviceApi.getGroupbuySku(id).then((res1) => {
|
|
|
|
|
- this.dataList = res1.data.list;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ groupBookingActivitygoodsInfo_api(id).then((res) => {
|
|
|
|
|
+ if (res && res.code == 200) {
|
|
|
|
|
+ this.dataForm = res.data;
|
|
|
|
|
+ // seviceApi.getGroupbuySku(id).then((res1) => {
|
|
|
|
|
+ // this.dataList = res1.data.list;
|
|
|
|
|
+ // });
|
|
|
|
|
+ this.dataList = res.data.productSkuSetList || [];
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- // 查询商品所有规格
|
|
|
|
|
- if (goodsId) {
|
|
|
|
|
- seviceApi.getGoodsSkus(goodsId).then((res) => {
|
|
|
|
|
- if (res && res.data.code == 200) {
|
|
|
|
|
- res.data.list.forEach((i) => {
|
|
|
|
|
- i.activity_price = i.sale_price;
|
|
|
|
|
- });
|
|
|
|
|
- this.dataList = res.data.list;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.dataList = productSkuSetList;
|
|
|
|
|
+ this.dataForm.skuList = productInfo.skuTable || [];
|
|
|
|
|
+ this.dataForm.singleSku = productInfo.singleSku;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
goSet() {
|
|
goSet() {
|
|
|
if (this.dataForm.discount != "") {
|
|
if (this.dataForm.discount != "") {
|
|
|
this.dataList.map((v, i) => {
|
|
this.dataList.map((v, i) => {
|
|
|
- v.activity_price = Number(
|
|
|
|
|
- v.sale_price * (this.dataForm.discount / 10)
|
|
|
|
|
|
|
+ v.salePrice = Number(
|
|
|
|
|
+ v.originalSalePrice * (this.dataForm.discount / 10)
|
|
|
).toFixed(2);
|
|
).toFixed(2);
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
@@ -272,17 +304,17 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
setFixPrice() {
|
|
setFixPrice() {
|
|
|
- if (this.dataForm.fix_price != "") {
|
|
|
|
|
|
|
+ if (this.dataForm.fixPrice != "") {
|
|
|
if (
|
|
if (
|
|
|
- this.dataList.some((val) => val.sale_price <= this.dataForm.fix_price)
|
|
|
|
|
|
|
+ this.dataList.some(
|
|
|
|
|
+ (val) => val.originalSalePrice <= this.dataForm.fixPrice
|
|
|
|
|
+ )
|
|
|
) {
|
|
) {
|
|
|
this.$message.error("减价金额不得超过商品原价");
|
|
this.$message.error("减价金额不得超过商品原价");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
this.dataList.map((v, i) => {
|
|
this.dataList.map((v, i) => {
|
|
|
- v.activity_price = Number(
|
|
|
|
|
- v.sale_price - this.dataForm.fix_price
|
|
|
|
|
- ).toFixed(2);
|
|
|
|
|
|
|
+ v.salePrice = Number(v.salePrice - this.dataForm.fixPrice).toFixed(2);
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
this.$message.error("请输入减价");
|
|
this.$message.error("请输入减价");
|
|
@@ -292,19 +324,27 @@ export default {
|
|
|
dataFormSubmit() {
|
|
dataFormSubmit() {
|
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
|
+ if (this.loading) return;
|
|
|
if (this.dataForm.id == null || undefined) {
|
|
if (this.dataForm.id == null || undefined) {
|
|
|
delete this.dataForm.id;
|
|
delete this.dataForm.id;
|
|
|
}
|
|
}
|
|
|
- this.dataForm.group_buy_goods_sku_list = this.dataList;
|
|
|
|
|
- seviceApi.saveGroupbuyActivitygoods(this.dataForm).then((res) => {
|
|
|
|
|
- if (res && res.data.code == 200) {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: "添加成功",
|
|
|
|
|
- type: "success",
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.dataForm.productSkuSetList = this.dataList;
|
|
|
|
|
+ this.dataForm.skuTable = this.dataList;
|
|
|
|
|
+
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
+ let url = this.dataForm.id
|
|
|
|
|
+ ? groupBookingActivitygoodsEdit_api
|
|
|
|
|
+ : groupBookingActivitygoodsAdd_api;
|
|
|
|
|
+ url(this.dataForm).then((res) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ if (res && res.code == 200) {
|
|
|
|
|
+ this.$message.success("添加成功");
|
|
|
this.visible = false;
|
|
this.visible = false;
|
|
|
this.$emit("updataList", 1);
|
|
this.$emit("updataList", 1);
|
|
|
}
|
|
}
|
|
|
|
|
+ }).catch((err) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -317,4 +357,18 @@ export default {
|
|
|
.mt30 {
|
|
.mt30 {
|
|
|
margin-top: 30px;
|
|
margin-top: 30px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+::v-deep .el-drawer__body {
|
|
|
|
|
+ position: relative !important;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.dialog-footer {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ background-color: #ffffff;
|
|
|
|
|
+ width: 1000px;
|
|
|
|
|
+ padding: 0 0 20px 40px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|