满额活动解决修改Cookie中的字段导致新增活动出现的问题

master
lemon橪 2021-08-17 15:46:59 +08:00
parent db919a57f3
commit 72ad898a6c
1 changed files with 38 additions and 188 deletions

View File

@ -6,243 +6,87 @@
<h4>基本信息</h4> <h4>基本信息</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="活动名称" prop="promotionName"> <FormItem label="活动名称" prop="promotionName">
<Input <Input type="text" v-model="form.promotionName" :disabled="form.promotionStatus != 'NEW'" placeholder="活动名称" clearable style="width: 280px" />
type="text"
v-model="form.promotionName"
:disabled="form.promotionStatus != 'NEW'"
placeholder="活动名称"
clearable
style="width: 280px"
/>
</FormItem> </FormItem>
<FormItem label="活动时间" prop="rangeTime"> <FormItem label="活动时间" prop="rangeTime">
<DatePicker <DatePicker type="datetimerange" v-model="form.rangeTime" :disabled="form.promotionStatus != 'NEW'" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options"
type="datetimerange" style="width: 280px">
v-model="form.rangeTime"
:disabled="form.promotionStatus != 'NEW'"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
:options="options"
style="width: 280px"
>
</DatePicker> </DatePicker>
</FormItem> </FormItem>
<FormItem label="活动描述" prop="description"> <FormItem label="活动描述" prop="description">
<Input <Input v-model="form.description" :disabled="form.promotionStatus != 'NEW'" type="textarea" :rows="4" clearable style="width: 280px" />
v-model="form.description"
:disabled="form.promotionStatus != 'NEW'"
type="textarea"
:rows="4"
clearable
style="width: 280px"
/>
</FormItem> </FormItem>
</div> </div>
<h4>优惠设置</h4> <h4>优惠设置</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="优惠门槛" prop="fullMoney"> <FormItem label="优惠门槛" prop="fullMoney">
<Input <Input type="text" v-model="form.fullMoney" :disabled="form.promotionStatus != 'NEW'" placeholder="优惠门槛" clearable style="width: 280px" />
type="text"
v-model="form.fullMoney"
:disabled="form.promotionStatus != 'NEW'"
placeholder="优惠门槛"
clearable
style="width: 280px"
/>
<span class="describe">消费达到当前金额可以参与优惠</span> <span class="describe">消费达到当前金额可以参与优惠</span>
</FormItem> </FormItem>
<FormItem label="优惠方式"> <FormItem label="优惠方式">
<RadioGroup type="button" button-style="solid" v-model="form.discountType"> <RadioGroup type="button" button-style="solid" v-model="form.discountType">
<Radio <Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus">减现金</Radio>
:disabled="form.promotionStatus != 'NEW'" <Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate">打折</Radio>
label="isFullMinus"
>减现金</Radio
>
<Radio
:disabled="form.promotionStatus != 'NEW'"
label="isFullRate"
>打折</Radio
>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem <FormItem v-if="form.discountType == 'isFullMinus'" label="优惠金额" prop="fullMinus">
v-if="form.discountType == 'isFullMinus'" <Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullMinus" placeholder="优惠金额" clearable style="width: 280px" />
label="优惠金额"
prop="fullMinus"
>
<Input
:disabled="form.promotionStatus != 'NEW'"
type="text"
v-model="form.fullMinus"
placeholder="优惠金额"
clearable
style="width: 280px"
/>
</FormItem> </FormItem>
<FormItem <FormItem v-if="form.discountType == 'isFullRate'" label="优惠折扣" prop="fullRate">
v-if="form.discountType == 'isFullRate'" <Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullRate" placeholder="优惠折扣" clearable style="width: 280px" />
label="优惠折扣"
prop="fullRate"
>
<Input
:disabled="form.promotionStatus != 'NEW'"
type="text"
v-model="form.fullRate"
placeholder="优惠折扣"
clearable
style="width: 280px"
/>
<span class="describe">优惠折扣为0-10之间数字可有一位小数</span> <span class="describe">优惠折扣为0-10之间数字可有一位小数</span>
</FormItem> </FormItem>
<FormItem label="额外赠送"> <FormItem label="额外赠送">
<Checkbox <Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isFreeFreight"></Checkbox>
:disabled="form.promotionStatus != 'NEW'" <Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon"></Checkbox>
v-model="form.isFreeFreight" <Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift"></Checkbox>
>免邮费</Checkbox <Checkbox :disabled="form.promotionStatus != 'NEW'" v-if="Cookies.get('userInfoSeller') && JSON.parse(Cookies.get('userInfoSeller')).selfOperated" v-model="form.isPoint"></Checkbox>
>
<Checkbox
:disabled="form.promotionStatus != 'NEW'"
v-model="form.isCoupon"
>送优惠券</Checkbox
>
<Checkbox
:disabled="form.promotionStatus != 'NEW'"
v-model="form.isGift"
>送赠品</Checkbox
>
<Checkbox
:disabled="form.promotionStatus != 'NEW'"
v-if="JSON.parse(getStore('userInfo')).selfOperated"
v-model="form.isPoint"
>送积分</Checkbox
>
</FormItem> </FormItem>
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId"> <FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
<Select <Select v-model="form.couponId" :disabled="form.promotionStatus != 'NEW'" filterable :remote-method="getCouponList" placeholder="输入优惠券名称搜索" :loading="couponLoading" style="width: 280px">
v-model="form.couponId" <Option v-for="item in couponList" :value="item.id" :key="item.id">{{ item.couponName }}</Option>
:disabled="form.promotionStatus != 'NEW'"
filterable
:remote-method="getCouponList"
placeholder="输入优惠券名称搜索"
:loading="couponLoading"
style="width: 280px"
>
<Option
v-for="item in couponList"
:value="item.id"
:key="item.id"
>{{ item.couponName }}</Option
>
</Select> </Select>
</FormItem> </FormItem>
<FormItem v-if="form.isGift" label="赠品" prop="giftId"> <FormItem v-if="form.isGift" label="赠品" prop="giftId">
<Select <Select :disabled="form.promotionStatus != 'NEW'" v-model="form.giftId" filterable :remote-method="getGiftList" placeholder="输入赠品名称搜索" :loading="giftLoading" style="width: 280px">
:disabled="form.promotionStatus != 'NEW'" <Option v-for="item in giftList" :value="item.id" :key="item.id">{{ item.goodsName }}</Option>
v-model="form.giftId"
filterable
:remote-method="getGiftList"
placeholder="输入赠品名称搜索"
:loading="giftLoading"
style="width: 280px"
>
<Option
v-for="item in giftList"
:value="item.id"
:key="item.id"
>{{ item.goodsName }}</Option
>
</Select> </Select>
</FormItem> </FormItem>
<FormItem v-if="form.isPoint" label="赠积分" prop="point"> <FormItem v-if="form.isPoint" label="赠积分" prop="point">
<Input <Input :disabled="form.promotionStatus != 'NEW'" v-model="form.point" type="number" :min="0" style="width: 280px" />
:disabled="form.promotionStatus != 'NEW'"
v-model="form.point"
type="number"
:min="0"
style="width: 280px"
/>
</FormItem> </FormItem>
<FormItem label="使用范围" prop="scopeType"> <FormItem label="使用范围" prop="scopeType">
<RadioGroup type="button" button-style="solid" v-model="form.scopeType"> <RadioGroup type="button" button-style="solid" v-model="form.scopeType">
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL" <Radio :disabled="form.promotionStatus != 'NEW'" label="ALL">全品类</Radio>
>全品类</Radio <Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS">指定商品</Radio>
>
<Radio
:disabled="form.promotionStatus != 'NEW'"
label="PORTION_GOODS"
>指定商品</Radio
>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem <FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
style="width: 100%" <div style="display: flex; margin-bottom: 10px" v-if="form.promotionStatus == 'NEW'">
v-if="form.scopeType == 'PORTION_GOODS'" <Button type="primary" @click="openSkuList"></Button>
> <Button type="error" ghost style="margin-left: 10px" @click="delSelectGoods"></Button>
<div
style="display: flex; margin-bottom: 10px"
v-if="form.promotionStatus == 'NEW'"
>
<Button type="primary" @click="openSkuList"
>选择商品</Button
>
<Button
type="error"
ghost
style="margin-left: 10px"
@click="delSelectGoods"
>批量删除</Button
>
</div> </div>
<Table <Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
border
:columns="columns"
:data="form.promotionGoodsList"
@on-selection-change="changeSelect"
>
<template slot-scope="{ row }" slot="QRCode"> <template slot-scope="{ row }" slot="QRCode">
<img <img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
:src="row.QRCode || '../../../assets/lili.png'"
width="50px"
height="50px"
alt=""
/>
</template> </template>
<template slot-scope="{ index }" slot="action"> <template slot-scope="{ index }" slot="action">
<Button <Button type="error" :disabled="form.promotionStatus != 'NEW' && id" size="small" ghost @click="delGoods(index)"></Button>
type="error"
:disabled="form.promotionStatus != 'NEW' && id"
size="small"
ghost
@click="delGoods(index)"
>删除</Button
>
</template> </template>
</Table> </Table>
</FormItem> </FormItem>
<div> <div>
<Button type="text" @click="closeCurrentPage" <Button type="text" @click="closeCurrentPage"></Button>
>返回</Button <Button type="primary" :disabled="form.promotionStatus != 'NEW' && id" :loading="submitLoading" @click="handleSubmit"></Button>
>
<Button
type="primary"
:disabled="form.promotionStatus != 'NEW' && id"
:loading="submitLoading"
@click="handleSubmit"
>提交</Button
>
</div> </div>
</div> </div>
</div> </div>
</Form> </Form>
</Card> </Card>
<sku-select <sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
ref="skuSelect"
@selectedGoodsData="selectedGoodsData"
></sku-select>
</div> </div>
</template> </template>
@ -256,12 +100,14 @@ import {
import { getGoodsSkuListDataSeller } from "@/api/goods"; import { getGoodsSkuListDataSeller } from "@/api/goods";
import { regular } from "@/utils"; import { regular } from "@/utils";
import skuSelect from "@/views/lili-dialog"; import skuSelect from "@/views/lili-dialog";
import Cookies from "js-cookie";
export default { export default {
name: "addFullCut", name: "addFullCut",
components: { components: {
skuSelect skuSelect
}, },
data() { data() {
const checkPrice = (rule, value, callback) => { const checkPrice = (rule, value, callback) => {
if (!value && value !== 0) { if (!value && value !== 0) {
return callback(new Error("面额不能为空")); return callback(new Error("面额不能为空"));
@ -285,6 +131,7 @@ export default {
} }
}; };
return { return {
Cookies,
form: { // form: { //
discountType: "isFullMinus", discountType: "isFullMinus",
scopeType: "ALL", scopeType: "ALL",
@ -574,5 +421,8 @@ h4 {
margin-left: 10px; margin-left: 10px;
color: #999; color: #999;
} }
.ivu-form-item{
margin-bottom: 24px !important;
}
</style> </style>