pc收藏店铺字段变更,添加修改秒杀页面

master
mabo 2021-08-10 17:39:15 +08:00
parent 924de43227
commit bb8ea94850
4 changed files with 221 additions and 5 deletions

View File

@ -8,6 +8,9 @@
<div class="goodsImg hover-pointer" v-if="params.type === 'GOODS'">
<img :src="item.image" />
</div>
<div class="goodsImg hover-pointer" v-else>
<img :src="item.storeLogo" />
</div>
<div class="goodsTitle hover-color" v-if="params.type === 'GOODS'" @click="buynow(item.skuId, item.goodsId)">
{{item.goodsName}}
</div>
@ -20,9 +23,9 @@
</div>
<div class="goodsBuy">
<Button size="small" type="primary" @click="buynow(item.skuId, item.goodsId)" v-if="params.type === 'GOODS'"></Button>
<Button size="small" type="primary" @click="goShop(item.storeId)" v-else></Button>
<Button size="small" type="primary" @click="goShop(item.id)" v-else></Button>
<Button size="small" type="error" ghost v-if="params.type === 'GOODS'" @click="cancel(item.skuId)"></Button>
<Button size="small" type="error" ghost v-if="params.type === 'SHOP'" @click="cancel(item.storeId)"></Button>
<Button size="small" type="error" ghost v-if="params.type === 'SHOP'" @click="cancel(item.id)"></Button>
</div>
</div>
</template>

View File

@ -228,6 +228,12 @@ export const otherRouter = {
name: "full-cut-detail",
component: () => import("@/views/promotion/fullCut/fullCutDetail.vue")
},
{
path: "promotion/seckill/manager-seckill-add",
title: "编辑秒杀活动",
name: "manager-seckill-add",
component: () => import("@/views/promotion/seckill/addSeckill.vue")
},
{
path: "promotion/seckill/seckill-goods",
title: "秒杀商品",

View File

@ -3,9 +3,7 @@
<template>
<div>
<Card class="change-pass">
<p slot="title">
修改密码
</p>
<p slot="title">修改密码</p>
<div class="mt_10">
<Form ref="editPasswordForm" :model="editPasswordForm" :label-width="100" label-position="right" :rules="passwordValidate" style="width:450px">
<FormItem label="原密码" prop="oldPass">

View File

@ -0,0 +1,209 @@
<template>
<div>
<Card>
<Form ref="form" :model="form" :label-width="120" :rules="formRule">
<div class="base-info-item">
<h4>基本信息</h4>
<div class="form-item-view">
<FormItem label="活动名称" prop="promotionName">
<Input
type="text"
v-model="form.promotionName"
placeholder="请填写活动名称"
clearable
style="width: 260px"
/>
</FormItem>
<FormItem label="报名截止时间" prop="applyEndTime">
<DatePicker
type="datetime"
v-model="form.applyEndTime"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
clearable
@on-change="applyTimeChange"
style="width: 200px"
>
</DatePicker>
</FormItem>
<FormItem label="活动开始时间" prop="startTime">
<DatePicker
type="datetime"
v-model="form.startTime"
format="yyyy-MM-dd"
placeholder="请选择"
clearable
@on-change="startTimeChange"
style="width: 200px"
>
</DatePicker>
</FormItem>
<FormItem label="抢购时间段" prop="seckillPeriod">
<Tag
v-for="item in form.seckillPeriod"
:key="item"
:name="item"
closable
style="marrgin-left: 10px"
@on-close="removePeriodTime"
>{{ item >= 10 ? item : "0" + item }}:00</Tag
>
<InputNumber
:max="23"
:min="0"
v-model="periodTime"
v-show="showAddPeriod"
@on-blur="addPeriodTime"
></InputNumber>
<Button
type="default"
@click="addPeriod"
>添加时间段</Button
>
</FormItem>
<FormItem label="申请规则" prop="seckillRule">
<Input
type="text"
v-model="form.seckillRule"
placeholder="申请规则"
clearable
style="width: 260px"
/>
</FormItem>
</div>
<div class="foot-btn">
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
<Button
type="primary"
:loading="submitLoading"
@click="handleSubmit"
>提交</Button>
</div>
</div>
</Form>
</Card>
</div>
</template>
<script>
import { updateSeckill, seckillDetail } from "@/api/promotion";
export default {
name: "addSeckill",
data() {
return {
form: {
/** 活动名称 */
promotionName: "",
/** 报名截止时间 */
applyEndTime: "",
/** 活动开始时间 */
startTime: "",
/** 抢购时间段 */
seckillPeriod: [],
/** 申请规则 */
seckillRule: "",
promotionStatus: "NEW",
},
id: this.$route.query.id, // id
periodTime: null, //
showAddPeriod: false, // input
submitLoading: false, //
formRule: {
promotionName: [{ required: true, message: "请填写活动名称" }],
applyEndTime: [{ required: true, message: "请填写报名截止时间" }],
seckillPeriod: [{ required: true, message: "请填写抢购时间段" }],
startTime: [{ required: true, message: "请填写活动开始时间" }],
seckillRule: [{ required: true, message: "请输入申请规则" }],
},
};
},
mounted() {
// id
if (this.id) {
this.getData();
}
},
methods: {
//
closeCurrentPage() {
this.$store.commit("removeTag", "manager-seckill-add");
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
this.$router.go(-1);
},
//
getData() {
seckillDetail(this.id).then((res) => {
if (res.success) {
let data = res.result;
data.seckillPeriod = res.result.hours.split(",");
this.form = data;
}
});
},
addPeriod() { // input
this.addPeriodTime();
this.showAddPeriod = true;
},
addPeriodTime() { //
this.showAddPeriod = false;
if (
this.periodTime !== null &&
!this.form.seckillPeriod.includes(this.periodTime)
) {
this.form.seckillPeriod.push(this.periodTime);
}
},
removePeriodTime(event, name) { //
this.form.seckillPeriod = this.form.seckillPeriod.filter((i) => i !== name);
},
// //
// applyTimeChange (time) {
// console.log(time);
// this.form.applyEndTime = time
// },
// //
// startTimeChange (time) {
// this.form.startTime = time
// },
/** 添加秒杀活动 */
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
this.form.hours = this.form.seckillPeriod.toString();
delete this.form.createTime;
delete this.form.updateTime;
delete this.form.endTime;
//
updateSeckill(this.form).then((res) => {
this.submitLoading = false;
if (res && res.success) {
this.$Message.success("编辑成功");
this.closeCurrentPage();
}
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
h4 {
margin-bottom: 10px;
padding: 0 10px;
border: 1px solid #ddd;
background-color: #f8f8f8;
font-weight: bold;
color: #333;
font-size: 14px;
line-height: 40px;
text-align: left;
}
.ivu-form-item{
margin-bottom: 30px;
}
</style>