|
@@ -1,7 +1,6 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div v-loading="pageLoad">
|
|
|
<el-dialog
|
|
|
- v-loading="pageLoad"
|
|
|
element-loading-text="loading..."
|
|
|
:title="title"
|
|
|
top="0"
|
|
@@ -13,9 +12,9 @@
|
|
|
@open="handleOpenDialog"
|
|
|
@close="resetData"
|
|
|
>
|
|
|
- <div class="dialog-body">
|
|
|
+ <div class="dialog-body" v-loading="pageLoad">
|
|
|
<el-form
|
|
|
- ref="promotionFormRef"
|
|
|
+ ref="promotionBuyXgetYDertailFormRef"
|
|
|
:model="promotion"
|
|
|
label-width="210px"
|
|
|
size="medium"
|
|
@@ -32,7 +31,7 @@
|
|
|
prop="promotionName"
|
|
|
>
|
|
|
<el-input
|
|
|
- v-model.trim="promotion.promotionName"
|
|
|
+ v-model.trim="promotion.title"
|
|
|
:disabled="edit"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -40,45 +39,49 @@
|
|
|
<!--促销开始时间-->
|
|
|
<el-form-item
|
|
|
:label="$t('label.promotionStartTime') + ':'"
|
|
|
- prop="promotionStartTime"
|
|
|
+ prop="startTime"
|
|
|
>
|
|
|
<el-date-picker
|
|
|
:disabled="edit"
|
|
|
type="datetime"
|
|
|
placeholder="选择日期"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- v-model="promotion.promotionStartTime"
|
|
|
+ v-model="promotion.startTime"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--促销失效时间-->
|
|
|
<el-form-item
|
|
|
:label="$t('label.promotionEndTime') + ':'"
|
|
|
- prop="promotionEndTime"
|
|
|
+ prop="endTime"
|
|
|
>
|
|
|
<el-date-picker
|
|
|
:disabled="edit"
|
|
|
type="datetime"
|
|
|
placeholder="选择日期"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- v-model="promotion.promotionEndTime"
|
|
|
+ v-model="promotion.endTime"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<!--应用方式-->
|
|
|
<el-form-item
|
|
|
:label="$t('label.applicationMethod') + ':'"
|
|
|
- prop="type"
|
|
|
+ prop="discountMethod"
|
|
|
>
|
|
|
- <el-radio-group v-model="promotion.type" :disabled="edit">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="promotion.discountMethod"
|
|
|
+ :disabled="edit"
|
|
|
+ >
|
|
|
<div class="item row">
|
|
|
- <el-radio label="1">{{ $t("label.discount") }}</el-radio>
|
|
|
+ <el-radio :label="1">{{ $t("label.discount") }}</el-radio>
|
|
|
<el-input
|
|
|
+ v-show="promotion.discountMethod === 1"
|
|
|
class="codeinput"
|
|
|
- v-model.trim="promotion.promotionName"
|
|
|
+ v-model.trim="promotion.discountCode"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
- <el-radio label="2">{{
|
|
|
+ <el-radio :label="2">{{
|
|
|
$t("label.autoDiscount")
|
|
|
}}</el-radio>
|
|
|
</div>
|
|
@@ -88,128 +91,87 @@
|
|
|
</div>
|
|
|
<!-- 折扣设置 -->
|
|
|
<div class="box discount">
|
|
|
- <!-- 折扣内容 -->
|
|
|
+ <!-- 客户购买条件 -->
|
|
|
<div class="title">
|
|
|
- <span>{{ $t("label.discountValue") }}</span>
|
|
|
+ <span>{{ $t("label.customerPurchaseConditions") }}</span>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
+ <!--最低购买要求-->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t('label.minimumPurchaseRequirement') + ':'"
|
|
|
+ prop="minimum"
|
|
|
+ >
|
|
|
+ <el-radio-group
|
|
|
+ v-model="promotion.purchaseRequire"
|
|
|
+ :disabled="edit"
|
|
|
+ >
|
|
|
+ <div class="item row">
|
|
|
+ <el-radio :label="3">{{ $t("label.numberStr") }}</el-radio>
|
|
|
+ <el-radio :label="2">{{ $t("label.money") }}</el-radio>
|
|
|
+ <el-radio :label="1">{{ $t("label.free") }}</el-radio>
|
|
|
+ </div>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
<!--折扣内容 数量&金额-->
|
|
|
<el-form-item :label="$t('label.discountValue') + ':'">
|
|
|
- <div class="item row">
|
|
|
- <el-input
|
|
|
- class="mininput"
|
|
|
- v-model.trim="promotion.minimumMoney"
|
|
|
- :disabled="edit"
|
|
|
- />
|
|
|
- <el-checkbox
|
|
|
- v-model="promotion.oncePerOrder"
|
|
|
- :disabled="edit"
|
|
|
- >{{ $t("label.oncePerOrder") }}</el-checkbox
|
|
|
- >
|
|
|
- </div>
|
|
|
- <!-- <div class="item-box">
|
|
|
- <span class="label">{{ $t("label.buyType") }}</span>
|
|
|
+ <div class="item">
|
|
|
+ <!--最低要求 免费 不展示 -->
|
|
|
+ <div class="item-box" v-if="promotion.purchaseRequire !== 1">
|
|
|
+ <span class="label">{{ discountContentValue }}</span>
|
|
|
<el-input
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.purchaseType"
|
|
|
+ v-model.trim="promotion.requireValue"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
- </div> -->
|
|
|
- </el-form-item>
|
|
|
- <!--折扣内容 商品-->
|
|
|
- <el-form-item :label="$t('label.product') + ':'">
|
|
|
- <div class="item product">
|
|
|
+ </div>
|
|
|
<div class="item-box">
|
|
|
+ <span class="label">{{ $t("label.buyType") }}</span>
|
|
|
<el-input
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.productType"
|
|
|
+ v-model.trim="promotion.purchaseType"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
- <el-input
|
|
|
- class="collectioninput"
|
|
|
- v-model.trim="promotion.productCollection"
|
|
|
- :disabled="edit"
|
|
|
- >
|
|
|
- <template slot="append"
|
|
|
- ><span
|
|
|
- @click="
|
|
|
- handleProductDialog(promotion.productCollection)
|
|
|
- "
|
|
|
- >查看商品明细</span
|
|
|
- ></template
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- <el-input
|
|
|
- class="collectioninput"
|
|
|
- v-model.trim="promotion.productCollection"
|
|
|
- :disabled="edit"
|
|
|
- >
|
|
|
- <template slot="append"
|
|
|
- ><span
|
|
|
- @click="
|
|
|
- handleProductDialog(promotion.productCollection)
|
|
|
- "
|
|
|
- >查看商品明细</span
|
|
|
- ></template
|
|
|
- >
|
|
|
- </el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <!-- 最低购买要求 -->
|
|
|
- <div class="title">
|
|
|
- <span>{{ $t("label.minimumPurchaseRequirement") }}</span>
|
|
|
- </div>
|
|
|
- <div class="info info-mini">
|
|
|
- <el-form-item
|
|
|
- :label="$t('label.minimumPurchaseRequirement') + ':'"
|
|
|
- prop="minimumPurchaseRequirement"
|
|
|
- >
|
|
|
- <el-radio-group
|
|
|
- v-model="promotion.minimumPurchaseRequirement"
|
|
|
- :disabled="edit"
|
|
|
- >
|
|
|
- <el-radio label="1">{{
|
|
|
- $t("label.minimunPurchaseObj.noMinimun")
|
|
|
- }}</el-radio>
|
|
|
-
|
|
|
- <div class="item row">
|
|
|
- <el-radio label="2">{{
|
|
|
- $t("label.minimunPurchaseObj.minimunAmount")
|
|
|
- }}</el-radio>
|
|
|
- <el-input
|
|
|
- v-show="promotion.minimumPurchaseRequirement === '2'"
|
|
|
- class="mininput"
|
|
|
- v-model.trim="promotion.minimumMoney"
|
|
|
- :disabled="edit"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <div class="item product">
|
|
|
<div class="item row">
|
|
|
- <el-radio label="3">{{
|
|
|
- $t("label.minimunPurchaseObj.minimunQuantity")
|
|
|
- }}</el-radio>
|
|
|
+ <span class="label">{{ $t("label.product") }}</span>
|
|
|
<el-input
|
|
|
- v-show="promotion.minimumPurchaseRequirement === '3'"
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.minimumMoney"
|
|
|
+ v-model.trim="promotion.productBuyType"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
+ <div class="value" v-for="(data, j) in tagLists" :key="j">
|
|
|
+ <p>{{ tagValue(data) }}</p>
|
|
|
+ <a
|
|
|
+ href="javascript:void();"
|
|
|
+ @click="handleProductDialog(data)"
|
|
|
+ >{{ $t("label.viewProductDetaiL") }}</a
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </el-radio-group>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('label.oncePerOrder') + ':'">
|
|
|
+ <el-checkbox
|
|
|
+ v-model="promotion.oncePerOrder"
|
|
|
+ :disabled="edit"
|
|
|
+ >{{ $t("label.oncePerOrderDesc") }}</el-checkbox
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<!-- 客户获得条件 -->
|
|
|
- <!-- <div class="title">
|
|
|
+ <div class="title">
|
|
|
<span>{{ $t("label.customerGetConditions") }}</span>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
- <el-form-item :label="$t('label.discountValue') + ':'">
|
|
|
+ <!--折扣内容 数量&金额-->
|
|
|
+ <!-- <el-form-item :label="$t('label.discountValue') + ':'">
|
|
|
<div class="item">
|
|
|
<span class="label">{{ $t("label.numberStr") }}</span>
|
|
|
<el-input
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.minimumMoney"
|
|
|
+ v-model.trim="promotion.requireValue"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
</div>
|
|
@@ -234,7 +196,7 @@
|
|
|
</el-button>
|
|
|
<div class="skucon">
|
|
|
<span
|
|
|
- v-for="(item, i) in ProductList"
|
|
|
+ v-for="(item, i) in getTagList"
|
|
|
:class="productKeys.includes(item) ? 'active' : ''"
|
|
|
:key="i"
|
|
|
>{{ item }},</span
|
|
@@ -242,111 +204,141 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
+ <!--折扣额-->
|
|
|
<el-form-item
|
|
|
:label="$t('label.discountPromotion') + ':'"
|
|
|
prop="discount"
|
|
|
class="discount"
|
|
|
>
|
|
|
- <el-radio-group v-model="promotion.discount" :disabled="edit">
|
|
|
+ <el-radio-group v-model="promotion.valueType" :disabled="edit">
|
|
|
<div class="item row">
|
|
|
- <el-radio label="1">{{ $t("label.percentage") }}</el-radio>
|
|
|
+ <el-radio :label="1">{{ $t("label.percentage") }}</el-radio>
|
|
|
<el-input
|
|
|
- v-show="promotion.discount === '1'"
|
|
|
+ v-if="promotion.valueType === 1"
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.promotionName"
|
|
|
+ v-model.trim="promotion.discountNumber"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="item row">
|
|
|
- <el-radio label="2">{{
|
|
|
+ <el-radio :label="2">{{
|
|
|
$t("label.discountPerItem")
|
|
|
}}</el-radio>
|
|
|
<el-input
|
|
|
- v-show="promotion.discount === '2'"
|
|
|
+ v-if="promotion.valueType === 2"
|
|
|
class="mininput"
|
|
|
- v-model.trim="promotion.promotionName"
|
|
|
+ v-model.trim="promotion.numericValue"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
</div>
|
|
|
- <el-radio label="3">{{ $t("label.free") }}</el-radio>
|
|
|
+ <el-radio :label="3">{{ $t("label.free") }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- </div> -->
|
|
|
- <!-- 每个订单使用次数 -->
|
|
|
- <!-- <div class="title">
|
|
|
+ </div>
|
|
|
+ <!-- 每个订单使用次数 自动折扣才有-->
|
|
|
+ <div class="title" v-if="promotion.discountMethod === 2">
|
|
|
<span>{{ $t("label.numberOfTimesUsedPerOrder") }}</span>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
<el-form-item>
|
|
|
<div class="item row">
|
|
|
- <el-checkbox v-model="checked" :disabled="edit">{{
|
|
|
+ <el-checkbox v-model="usageLimitchecked" :disabled="edit">{{
|
|
|
$t("label.maxNumberOfTimesUsedPerOrder")
|
|
|
}}</el-checkbox>
|
|
|
<el-input
|
|
|
class="mininput checkboxinput"
|
|
|
- v-model.trim="promotion.number"
|
|
|
+ v-model.trim="promotion.customerGetOrderUsageLimit"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<!-- 客户资格 折扣码才有-->
|
|
|
- <div class="box" v-if="promotion.type === '1'">
|
|
|
+ <div class="box" v-if="promotion.discountMethod === 1">
|
|
|
<div class="title">
|
|
|
<span>{{ $t("label.customerQualification") }}</span>
|
|
|
</div>
|
|
|
- <div class="info">
|
|
|
+ <div class="info customerQualification">
|
|
|
<el-form-item prop="customerQualification" required>
|
|
|
<el-radio-group
|
|
|
class="customerqualification"
|
|
|
- v-model="promotion.customerQualification"
|
|
|
+ v-model="promotion.targetCustomerType"
|
|
|
:disabled="edit"
|
|
|
>
|
|
|
- <el-radio
|
|
|
+ <el-radio :label="1">{{
|
|
|
+ $t("label.customerQualificationList")[0].label
|
|
|
+ }}</el-radio>
|
|
|
+ <div class="item row">
|
|
|
+ <el-radio :label="2">{{
|
|
|
+ $t("label.customerQualificationList")[1].label
|
|
|
+ }}</el-radio>
|
|
|
+ <el-input
|
|
|
+ v-if="promotion.targetCustomerType === 2"
|
|
|
+ class="mininput"
|
|
|
+ v-model.trim="promotion.targetCustomer"
|
|
|
+ :disabled="edit"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item row">
|
|
|
+ <el-radio :label="3">{{
|
|
|
+ $t("label.customerQualificationList")[2].label
|
|
|
+ }}</el-radio>
|
|
|
+ <el-input
|
|
|
+ v-if="promotion.targetCustomerType === 3"
|
|
|
+ class="mininput"
|
|
|
+ v-model.trim="promotion.targetCustomer"
|
|
|
+ :disabled="edit"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <!-- <el-radio
|
|
|
v-for="(item, i) in $t('label.customerQualificationList')"
|
|
|
:key="i"
|
|
|
:label="item.value"
|
|
|
>{{ item.label }}</el-radio
|
|
|
- >
|
|
|
+ > -->
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 最大折扣使用次数 折扣码才有-->
|
|
|
- <div class="box" v-if="promotion.type === '1'">
|
|
|
+ <div class="box" v-if="promotion.discountMethod === 1">
|
|
|
<div class="title">
|
|
|
<span>{{ $t("label.maximumNumberOfDiscounts") }}</span>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
- <!-- 指定商品标签 -->
|
|
|
<el-form-item>
|
|
|
+ <!-- <el-checkbox-group v-model="promotion.startTime"> -->
|
|
|
<div class="item row">
|
|
|
- <el-checkbox v-model="checked" :disabled="edit">{{
|
|
|
- $t("label.limitDiscountCount")
|
|
|
- }}</el-checkbox>
|
|
|
+ <el-checkbox
|
|
|
+ :checked="codeUsageLimitchecked"
|
|
|
+ :disabled="edit"
|
|
|
+ >{{ $t("label.limitDiscountCount") }}</el-checkbox
|
|
|
+ >
|
|
|
<el-input
|
|
|
class="mininput checkboxinput"
|
|
|
- v-model.trim="promotion.number"
|
|
|
+ v-model.trim="promotion.codeUsageLimit"
|
|
|
:disabled="edit"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="item row">
|
|
|
- <el-checkbox v-model="checked" :disabled="edit">{{
|
|
|
- $t("label.customerCount")
|
|
|
- }}</el-checkbox>
|
|
|
+ <el-checkbox
|
|
|
+ :checked="promotion.codeCustomerUsageType === 1"
|
|
|
+ :disabled="edit"
|
|
|
+ >{{ $t("label.customerCount") }}</el-checkbox
|
|
|
+ >
|
|
|
</div>
|
|
|
+ <!-- </el-checkbox-group> -->
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 组合 自动折扣才有 -->
|
|
|
- <div class="box" v-if="promotion.type === '2'">
|
|
|
+ <div class="box" v-if="promotion.discountMethod === 2">
|
|
|
<div class="title">
|
|
|
<span>{{ $t("label.combination") }}</span>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
- <!-- 指定商品标签 -->
|
|
|
<el-form-item :label="$t('label.combinationLable') + ':'">
|
|
|
<el-checkbox-group v-model="promotion.combination">
|
|
|
<el-checkbox
|
|
@@ -372,9 +364,9 @@
|
|
|
>{{ $t("view.cancel") }}
|
|
|
</el-button>
|
|
|
<!-- 未审核时/审核驳回 状态可进行提交 -->
|
|
|
- <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
|
|
|
+ <!-- <el-button type="primary" @click="handleSaveOrUpdate" :disabled="edit"
|
|
|
>{{ $t("view.confirm") }}
|
|
|
- </el-button>
|
|
|
+ </el-button> -->
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
<product-collection ref="productCollectionRef" />
|
|
@@ -382,8 +374,9 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import waves from "@/directive/waves"; // 水波纹指令
|
|
|
-import { getById, save, storeList, update } from "@/api/oms/order/promotion";
|
|
|
+import { fetchDetailByIdAndVersion } from "@/api/oms/order/multiBuyDiscount";
|
|
|
import i18n from "@/lang";
|
|
|
+import { isEmpty } from "@/utils/toolUtil";
|
|
|
import productCollection from "@/views/oms/promotion/buyXGetYDiscount/components/productCollectionDetail";
|
|
|
|
|
|
export default {
|
|
@@ -391,18 +384,15 @@ export default {
|
|
|
directives: {
|
|
|
waves
|
|
|
},
|
|
|
- name: "multiBuyDiscountForm",
|
|
|
+ name: "buyXgetYbuyDiscountForm",
|
|
|
components: {
|
|
|
productCollection
|
|
|
},
|
|
|
computed: {
|
|
|
discountContentValue() {
|
|
|
- return this.promotion.minimum === "2"
|
|
|
+ return this.promotion.purchaseRequire === 2
|
|
|
? i18n.t("label.money")
|
|
|
: i18n.t("label.numberStr");
|
|
|
- },
|
|
|
- checked() {
|
|
|
- return !!this.promotion.number;
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -411,93 +401,47 @@ export default {
|
|
|
title: "",
|
|
|
productSku: "",
|
|
|
productKeys: [],
|
|
|
- ProductList: [
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "124C2B014",
|
|
|
- "132J0B06V",
|
|
|
- "121J0B04B",
|
|
|
- "124C2B"
|
|
|
- ],
|
|
|
+ usageLimitchecked: false,
|
|
|
+ codeUsageLimitchecked: false,
|
|
|
+ tagLists: [],
|
|
|
+ getTagList: [],
|
|
|
promotion: {
|
|
|
// 配置基本信息
|
|
|
id: "",
|
|
|
- promotionName: "",
|
|
|
- promotionStartTime: "",
|
|
|
- promotionEndTime: "",
|
|
|
- type: 1,
|
|
|
- promotionStatus: "",
|
|
|
- priority: "",
|
|
|
- participateType: "",
|
|
|
- conditionType: "",
|
|
|
- stackableType: [],
|
|
|
- minimum: "1",
|
|
|
- discountValue: "1",
|
|
|
+ title: "",
|
|
|
+ startTime: "",
|
|
|
+ endTime: "",
|
|
|
+ discountMethod: null,
|
|
|
+ discountNumber: null,
|
|
|
+ purchaseRequire: null,
|
|
|
purchaseType: "",
|
|
|
productType: "",
|
|
|
+ productBuyType: "",
|
|
|
discount: "",
|
|
|
- number: 1,
|
|
|
- combination: [],
|
|
|
- minimumPurchaseRequirement: "1",
|
|
|
- oncePerOrder: 1
|
|
|
+ combination: []
|
|
|
},
|
|
|
edit: true,
|
|
|
- storeList: [],
|
|
|
noDataText: "加载中",
|
|
|
pageLoad: false,
|
|
|
- conditionTypeArr: i18n.t("label.conditionTypeArr").map(item => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- disabled: false
|
|
|
- };
|
|
|
- })
|
|
|
+ isEmpty
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- getStoreList() {
|
|
|
- storeList().then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.storeList = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
+ tagValue(data) {
|
|
|
+ return (
|
|
|
+ data.title +
|
|
|
+ i18n.t("label.productCollection") +
|
|
|
+ i18n.t("label.all") +
|
|
|
+ data.spus.length +
|
|
|
+ i18n.t("label.itemProduct")
|
|
|
+ );
|
|
|
},
|
|
|
- async showDialog(id, edit) {
|
|
|
- this.edit = !edit;
|
|
|
- await this.getStoreList();
|
|
|
+ async showDialog(id, edit, version) {
|
|
|
+ this.edit = edit;
|
|
|
if (id) {
|
|
|
// 修改配置
|
|
|
this.promotion.id = id;
|
|
|
+ this.promotion.version = version;
|
|
|
await this.getPromotionInfo();
|
|
|
this.title = this.edit
|
|
|
? i18n.t("label.mutiPromotionDetailTitle")
|
|
@@ -505,94 +449,156 @@ export default {
|
|
|
} else {
|
|
|
this.title = i18n.t("label.mutiPromotionCreateTitle");
|
|
|
}
|
|
|
+ let str = this.promotion.id ? "Detail" : "";
|
|
|
+ this.discountSettingTitle = i18n.t("label.discountSetting" + str);
|
|
|
+ this.productRangeTitle = i18n.t("label.setProductRange" + str);
|
|
|
this.promotionFormVisible = true;
|
|
|
},
|
|
|
// 款号搜索
|
|
|
handleProductSearch() {
|
|
|
this.productKeys = this.productSku.split(",");
|
|
|
},
|
|
|
- handleProductDialog(id) {
|
|
|
- this.$refs.productCollectionRef.showDialog(id);
|
|
|
+ handleProductDialog(data) {
|
|
|
+ this.$refs.productCollectionRef.showDialog(data);
|
|
|
},
|
|
|
resetData() {
|
|
|
this.promotion = {
|
|
|
id: "",
|
|
|
- promotionName: "",
|
|
|
- promotionStartTime: "",
|
|
|
- promotionEndTime: "",
|
|
|
- type: 1,
|
|
|
- promotionStatus: "",
|
|
|
- rejectCause: "",
|
|
|
- priority: "",
|
|
|
- participateType: "",
|
|
|
- conditionType: "",
|
|
|
- stackableType: [],
|
|
|
- minimum: "1"
|
|
|
+ title: "",
|
|
|
+ startTime: "",
|
|
|
+ endTime: "",
|
|
|
+ discountMethod: null,
|
|
|
+ discountNumber: null,
|
|
|
+ purchaseRequire: null,
|
|
|
+ purchaseType: "",
|
|
|
+ productType: "",
|
|
|
+ productBuyType: "",
|
|
|
+ discount: "",
|
|
|
+ combination: []
|
|
|
};
|
|
|
},
|
|
|
handleOpenDialog() {
|
|
|
this.resetData();
|
|
|
- if (this.$refs.promotionFormRef) {
|
|
|
- this.$refs.promotionFormRef.clearValidate();
|
|
|
+ if (this.$refs.promotionBuyXgetYDertailFormRef) {
|
|
|
+ this.$refs.promotionBuyXgetYDertailFormRef.clearValidate();
|
|
|
}
|
|
|
},
|
|
|
getPromotionInfo() {
|
|
|
this.pageLoad = true;
|
|
|
- getById(this.promotion.id).then(res => {
|
|
|
- // 促销配置信息
|
|
|
- this.promotion = res.data;
|
|
|
- this.pageLoad = false;
|
|
|
- });
|
|
|
- },
|
|
|
- handleSaveOrUpdate() {
|
|
|
- //创建商品
|
|
|
- this.$refs["promotionFormRef"].validate(valid => {
|
|
|
- //通用属性验证成功
|
|
|
- if (valid) {
|
|
|
- // 如果需要在促销类型买就送的情况下将条件类型和条件值改为 "0" 则可在此修改 暂时默认为空字符
|
|
|
- const data = {
|
|
|
- ...this.promotion
|
|
|
- };
|
|
|
- if (!data.id) {
|
|
|
- save(data).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- message: "操作成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.$emit("refresh-table");
|
|
|
- this.promotionFormVisible = false;
|
|
|
+ let { id, version } = this.promotion;
|
|
|
+ fetchDetailByIdAndVersion({ id, version })
|
|
|
+ .then(res => {
|
|
|
+ // 促销配置信息
|
|
|
+ const { priceRule, productTags, giveProductCollects } = res.data;
|
|
|
+ this.promotion = { ...priceRule, productTags };
|
|
|
+ if (priceRule.valueType === 1) {
|
|
|
+ let number = priceRule.numericValue * 100;
|
|
|
+ // this.promotion.discountNumber = number;
|
|
|
+ this.$set(this.promotion, "discountNumber", number);
|
|
|
+ }
|
|
|
+ if (priceRule.purchaseRequire === 3) {
|
|
|
+ // this.promotion.quantity = priceRule.requireValue;
|
|
|
+ this.$set(this.promotion, "quantity", priceRule.requireValue);
|
|
|
+ } else if (priceRule.purchaseRequire === 2) {
|
|
|
+ // this.promotion.miniAmount = priceRule.requireValue;
|
|
|
+ this.$set(this.promotion, "miniAmount", priceRule.requireValue);
|
|
|
+ }
|
|
|
+ // 购买类型
|
|
|
+ const targetType = i18n
|
|
|
+ .t("label.promotionBuyTyper")
|
|
|
+ .find(item => item.value === priceRule.targetType);
|
|
|
+ if (targetType && targetType.label) {
|
|
|
+ this.$set(this.promotion, "purchaseType", targetType.label);
|
|
|
+ }
|
|
|
+ // 顾客购买商品类型
|
|
|
+ const productBuyType = i18n
|
|
|
+ .t("label.promotionCustomerGetType")
|
|
|
+ .find(item => item.value === priceRule.targetSelectionType);
|
|
|
+ if (productBuyType && productBuyType.label) {
|
|
|
+ this.$set(this.promotion, "productBuyType", productBuyType.label);
|
|
|
+ }
|
|
|
+ // 顾客得到商品类型
|
|
|
+ const productType = i18n
|
|
|
+ .t("label.promotionCustomerGetType")
|
|
|
+ .find(item => item.value === priceRule.customerGetType);
|
|
|
+ if (productType && productType.label) {
|
|
|
+ this.$set(this.promotion, "productType", productType.label);
|
|
|
+ }
|
|
|
+ // 组合
|
|
|
+ const {
|
|
|
+ combineWithOrder,
|
|
|
+ combineWithProduct,
|
|
|
+ combineWithShipping,
|
|
|
+ targetShopifyProductSpu,
|
|
|
+ targetShopifySku,
|
|
|
+ targetSelectionType,
|
|
|
+ customerGetType,
|
|
|
+ getTargetShopifyProductSpu,
|
|
|
+ getTargetShopifySku,
|
|
|
+ customerGetOrderUsageLimit,
|
|
|
+ codeUsageLimit
|
|
|
+ } = priceRule;
|
|
|
+ let combinationArr = [];
|
|
|
+ if (combineWithOrder) {
|
|
|
+ combinationArr.push(i18n.t("label.combinationList")[1].value);
|
|
|
+ }
|
|
|
+ if (combineWithProduct) {
|
|
|
+ combinationArr.push(i18n.t("label.combinationList")[0].value);
|
|
|
+ }
|
|
|
+ if (combineWithShipping) {
|
|
|
+ combinationArr.push(i18n.t("label.combinationList")[2].value);
|
|
|
+ }
|
|
|
+ this.usageLimitchecked = !!customerGetOrderUsageLimit;
|
|
|
+ this.codeUsageLimitchecked = !!codeUsageLimit;
|
|
|
+ this.$set(this.promotion, "combination", combinationArr);
|
|
|
+ // 折扣适用 1特定系列 其他2,3 特定商品
|
|
|
+ let tagLists = [];
|
|
|
+ if (targetSelectionType === 1) {
|
|
|
+ tagLists = productTags.map(item => {
|
|
|
+ let data = [];
|
|
|
+ if (item.spu) {
|
|
|
+ data = item.spu.split(",");
|
|
|
}
|
|
|
+ item.spus = data;
|
|
|
+ return item;
|
|
|
});
|
|
|
} else {
|
|
|
- update(data).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- message: "操作成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.$emit("refresh-table");
|
|
|
- this.promotionFormVisible = false;
|
|
|
+ // 特地商品
|
|
|
+ if (targetShopifySku) {
|
|
|
+ const spusSKU = targetShopifySku.split(",");
|
|
|
+ tagLists.push({ title: "", spus: spusSKU });
|
|
|
+ }
|
|
|
+ if (targetShopifyProductSpu) {
|
|
|
+ const spusId = targetShopifyProductSpu.split(",");
|
|
|
+ tagLists.push({ title: "", spus: spusId });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.tagLists = tagLists;
|
|
|
+ // 折扣得到条件 1 特定系列 2 特定商品
|
|
|
+ let getTagList = [];
|
|
|
+ if (customerGetType === 1) {
|
|
|
+ giveProductCollects.forEach(item => {
|
|
|
+ if (item.spu) {
|
|
|
+ const arr = item.spu.split(",");
|
|
|
+ getTagList.push.apply(getTagList, arr);
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ // 特地商品
|
|
|
+ if (getTargetShopifySku) {
|
|
|
+ const skus = getTargetShopifySku.split(",");
|
|
|
+ getTagList.push.apply(getTagList, skus);
|
|
|
+ }
|
|
|
+ if (getTargetShopifyProductSpu) {
|
|
|
+ const spus = getTargetShopifyProductSpu.split(",");
|
|
|
+ getTagList.push.apply(getTagList, spus);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- handleChangeParticipateType(e) {
|
|
|
- this.conditionTypeArr.forEach(item => {
|
|
|
- item.disabled = false;
|
|
|
- });
|
|
|
- this.promotion.conditionType = "";
|
|
|
- this.promotion.conditionValue = "";
|
|
|
- if (e === "gift_money" || e === "gift_qty") {
|
|
|
- this.conditionTypeArr[2].disabled = true;
|
|
|
- } else if (e === "gift_consumer") {
|
|
|
- // gift_consumer
|
|
|
- this.conditionTypeArr[0].disabled = true;
|
|
|
- this.conditionTypeArr[1].disabled = true;
|
|
|
- this.promotion.conditionType = this.conditionTypeArr[2].value;
|
|
|
- }
|
|
|
+ this.getTagList = getTagList;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.pageLoad = false;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -697,11 +703,6 @@ export default {
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
.info {
|
|
|
- &.info-mini {
|
|
|
- .item {
|
|
|
- margin-top: 20px;
|
|
|
- }
|
|
|
- }
|
|
|
.item {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
@@ -718,7 +719,7 @@ export default {
|
|
|
}
|
|
|
.mininput {
|
|
|
margin-right: 30px;
|
|
|
- width: 142px !important;
|
|
|
+ width: 180px !important;
|
|
|
}
|
|
|
.checkboxinput {
|
|
|
margin-left: 20px;
|
|
@@ -730,11 +731,21 @@ export default {
|
|
|
margin-right: 12px;
|
|
|
}
|
|
|
&.product {
|
|
|
+ margin-top: 26px;
|
|
|
+ .label {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
.mininput {
|
|
|
margin-right: 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .row {
|
|
|
+ flex-wrap: wrap;
|
|
|
}
|
|
|
.collectioninput {
|
|
|
margin-right: 20px;
|
|
|
+ min-width: 220px !important;
|
|
|
+ width: auto !important;
|
|
|
/deep/.el-input-group__append {
|
|
|
color: #ae8877;
|
|
|
border-left: none;
|
|
@@ -749,6 +760,9 @@ export default {
|
|
|
border-right: none;
|
|
|
}
|
|
|
}
|
|
|
+ .value {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.discount {
|
|
@@ -766,5 +780,35 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .value {
|
|
|
+ position: relative;
|
|
|
+ min-width: 300px;
|
|
|
+ height: 36px;
|
|
|
+ padding: 0px 6px;
|
|
|
+ font-size: 12px;
|
|
|
+ margin-right: 13px;
|
|
|
+ color: #c0c4cc;
|
|
|
+ background: #f5f7fa;
|
|
|
+ border-radius: 3px;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
+ p {
|
|
|
+ line-height: 12px;
|
|
|
+ padding-right: 130px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ a {
|
|
|
+ position: absolute;
|
|
|
+ right: 10px;
|
|
|
+ top: 0%;
|
|
|
+ color: #ae8877;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .customerQualification {
|
|
|
+ .mininput {
|
|
|
+ margin-bottom: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|