商品添加缓存 活动

This commit is contained in:
魏啾 2024-11-11 10:39:45 +08:00
parent 43df2b637b
commit c79049443a
6 changed files with 137 additions and 40 deletions

View File

@ -417,6 +417,17 @@ export function modityActivate(data) {
});
}
/**
* 新增修改活动 新的
* @returns
*/
export function storageupActivate(data) {
return request({
url: `/shop/storage/upActivate`,
method: "post",
data
});
}
/**
* 活动列表
* @returns

View File

@ -437,7 +437,7 @@ export default {
Editor,
addImg,
},
name:'add_shop',
name: 'add_shop',
data() {
const validatordateUsed = (rule, value, callback) => {
if (!this.form.notices.dateUsed) {
@ -602,17 +602,32 @@ export default {
batchNumberForm: {
batchNumber: 0,
},
routequery: ''
};
},
mounted() {
this.tbShopUnit();
this.tbShopCategoryGet();
this.changeTypeEnum(0);
if (this.$route.query.goods_id) {
this.tbProductGetDetail();
}
},
watch: {
//
$route(to, from) {
console.log(to.query.goods_id)
if (to.query.goods_id) {
if (this.routequery == to.query.goods_id) {
return false;
} else {
this.tbProductGetDetail();
}
this.routequery = to.query.goods_id
}
},
},
methods: {
uploadImgSucess(res, item) {
console.log(res);

View File

@ -298,11 +298,9 @@ export default {
}
},
async mounted() {
console.log(this.$route.query.productId, 'tiaoshi1')
if (this.$route.query.productId) {
this.query.productId = this.$route.query.productId
}
console.log(this.query)
await this.tbShopCategoryGet()
await this.getTableData()
@ -533,7 +531,6 @@ export default {
})
})
console.log(res);
this.tableData.loading = false
this.tableData.data = res.content

View File

@ -19,24 +19,26 @@
下载会员充值二维码
</el-button>
<div style="margin-top: 35px; font-size: 16px; color: #333;">
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large" @change="customStatusChange"></el-switch>
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large"
@change="customStatusChange"></el-switch>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
<el-table-column label="店铺ID" prop="shopId"></el-table-column>
<el-table-column label="最小金额" prop="minNum"></el-table-column>
<el-table-column label="最大金额" prop="maxNum"></el-table-column>
<el-table-column label="赠送金额" prop="handselNum"></el-table-column>
<el-table-column label="赠送类型" prop="handselType">
<el-table-column label="充值金额" prop="amount"></el-table-column>
<el-table-column label="赠送金额" prop="giftAmount"></el-table-column>
<!-- <el-table-column label="赠送金额" prop="handselNum"></el-table-column>
<el-table-column label="是否使用优惠券" prop="isUseCoupon">
<template v-slot="scope">
{{ scope.row.handselType | handselTypeFilter }}
</template>
</el-table-column>
<!-- <el-table-column label="排序" sortable prop="sort"></el-table-column> -->
<el-table-column label="是否启用" prop="isDel">
</el-table-column>
<el-table-column label="排序" sortable prop="sort"></el-table-column> -->
<el-table-column label="赠送积分" prop="giftPoints"></el-table-column>
<el-table-column label="是否使用优惠券" prop="isUseCoupon">
<template v-slot="scope">
<el-switch v-model="scope.row.isDel" active-value="0" inactive-value="1"
<el-switch v-model="scope.row.isUseCoupon" :active-value="1" :inactive-value="0"
@change="statusChange($event, scope.row)"></el-switch>
</template>
</el-table-column>
@ -65,7 +67,7 @@
import handselTypes from './handselTypes'
import addActive from './components/addActive'
import QR from './components/downloadQR.vue'
import { findActivate, modityActivate } from '@/api/shop'
import { findActivate, storageupActivate } from '@/api/shop'
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
import dayjs from 'dayjs'
export default {
@ -107,8 +109,9 @@ export default {
try {
this.tableData.loading = true
const data = { ...row }
data.status = e
await modityActivate(data)
data.isUseCoupon = e
console.log(data.isUseCoupon)
await storageupActivate(data)
this.getTableData()
} catch (error) {
console.log(error)
@ -151,7 +154,7 @@ export default {
}
console.log(this.shopInfo);
} catch (error) {
console.log(error)
}

View File

@ -2,7 +2,23 @@
<div>
<el-dialog :title="form.id ? '编辑活动' : '添加活动'" :visible.sync="dialogVisible" @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="最小金额">
<el-form-item label="充值">
<template>
<div style="display: flex;">
<el-input style="width: 220px;" placeholder="请输入金额" v-model="form.amount">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
<el-input style="margin-left: 20px; width: 220px;" placeholder="请输入金额"
v-model="form.giftAmount">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
</div>
</template>
</el-form-item>
<!-- <el-form-item label="最小金额">
<el-input-number v-model="form.minNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="最大金额">
@ -11,22 +27,35 @@
<el-form-item label="赠送金额">
<el-input-number v-model="form.handselNum" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<!-- <el-form-item label="赠送类型">
<el-form-item label="赠送类型">
<el-select v-model="form.handselType">
<el-option :label="item.label" :value="item.value" v-for="item in handselTypes"
:key="item.value"></el-option>
</el-select>
</el-form-item> -->
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
</el-form-item> -->
<el-form-item label="是否使用优惠券">
<el-switch v-model="form.isUseCoupon" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="是否赠送商品">
<el-switch v-model="form.isGiftPro" :active-value="1" :inactive-value="0"></el-switch>
<el-form-item label="数量">
<el-input-number v-model="form.num" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="赠送商品">
<el-form-item label="积分">
<template>
<div class="labelboxss">
<div>赠送</div>
<el-input style="width: 140px;margin: 0 15px;" v-model="form.giftPoints"></el-input>
<div>积分</div>
</div>
</template>
</el-form-item>
<el-form-item label="选择优惠劵">
<div>
<el-button type="primary" icon="el-icon-plus" @click="$refs.shopListRef.show([...productIds])">
添加商品
添加优惠劵
</el-button>
</div>
<div class="shop_list">
@ -53,7 +82,9 @@
<script>
import handselTypes from '../handselTypes'
import { modityActivate, activate } from '@/api/shop'
import { activate, storageupActivate } from '@/api/shop'
import { queryReceive } from '@/api/coupon'
import shopList from '@/components/shopList'
export default {
@ -70,7 +101,10 @@ export default {
maxNum: 1,
handselNum: 1, //
handselType: 'GD',
isDel: '0'
isDel: '0',
num: 1,
amount: '',
giftAmount: ''
},
productIds: [],
resetForm: '',
@ -125,21 +159,28 @@ export default {
this.form.config.categoryList = e
},
onSubmitHandle() {
// console.log(this.form)
let arr = []
this.productIds.forEach(ele => {
arr.push({
productId: ele.id,
num: ele.num
})
})
this.form.products = arr
console.log(this.form)
if (this.form.amount == '') {
this.$message({
message: '充值金额不能为空',
type: 'warning'
});
return false;
}
// let arr = []
// this.productIds.forEach(ele => {
// arr.push({
// productId: ele.id,
// num: ele.num
// })
// })
// this.form.products = arr
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true
this.form.shopId = localStorage.getItem('shopId')
let res = await modityActivate(this.form)
let res = await storageupActivate(this.form)
this.$emit('success', res)
this.close()
this.$notify({
@ -159,8 +200,8 @@ export default {
this.dialogVisible = true
if (obj && obj.id) {
this.form = { ...obj }
let res = await activate(obj.id)
this.productIds = res
// let res = await activate(obj.id)
// this.productIds = res
console.log(res, '调试1')
}
},
@ -174,6 +215,35 @@ export default {
}
</script>
<style scoped lang="scss">
.labelbox {
display: flex;
justify-content: flex-start;
align-items: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 12px;
color: #666666;
width: 130px;
background: #F7F7FA;
border-radius: 2px 2px 2px 2px;
border: 1px solid #DDDFE6;
padding: 0 10px;
input {
border: none !important;
}
}
.labelboxss {
display: flex;
justify-content: flex-start;
align-items: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: #666666;
}
.shop_list {
// display: flex;/
// flex-wrap: wrap;

View File

@ -25,13 +25,14 @@ export default {
},
methods: {
show() {
this.isshow = true
this.getlist()
},
async getlist() {
let res = await getwxacode({
shopId: localStorage.getItem('shopId')
})
this.isshow = true
this.imgUrl = res
}, downImg() {
// window.location.href()