Merge remote-tracking branch 'origin/main'

This commit is contained in:
tangzh 2024-11-13 15:39:07 +08:00
commit 88bc74be41
8 changed files with 1032 additions and 12 deletions

102
src/api/lottery.js Normal file
View File

@ -0,0 +1,102 @@
import request from '@/utils/request'
/**
* @description 九宫格抽奖 -- 列表
*/
export function lotteryListApi(data) {
return request({
url: 'marketing/lottery/list',
method: 'get',
params: data,
});
}
/**
* @description 九宫格抽奖 -- 详情
* @param id 抽奖活动id
*/
export function lotteryDetailApi(id) {
return request({
url: `marketing/lottery/detail/${id}`,
method: 'get',
});
}
/**
* @description 九宫格抽奖 -- 新版详情
* @param id 抽奖活动id
*/
export function lotteryNewDetailApi(type) {
return request({
url: `marketing/lottery/factor_info/${type}`,
method: 'get',
});
}
/**
* @description 九宫格抽奖 -- 创建
*/
export function lotteryCreateApi(data) {
return request({
url: `marketing/lottery/add`,
method: 'post',
data,
});
}
/**
**
* @description 九宫格抽奖 -- 修改/编辑
*/
export function lotteryEditApi(id, data) {
return request({
url: `marketing/lottery/edit/${id}`,
method: 'put',
data,
});
}
/**
**
* @description 九宫格抽奖 -- 删除
*/
export function lotteryDelApi(id) {
return request({
url: `marketing/lottery/del/${id}`,
method: 'delete',
});
}
/**
**
* @description 九宫格抽奖 -- 显示状态
*/
export function lotteryStatusApi(data) {
return request({
url: `marketing/lottery/set_status/${data.id}/${data.status}`,
method: 'post',
});
}
/**
**
* @description 九宫格抽奖 -- 中奖记录
*/
export function lotteryRecordList(data) {
return request({
url: `marketing/lottery/record/list`,
method: 'get',
params: data,
});
}
/**
**
* @description 九宫格抽奖 -- 中奖发货/备注处理
*/
export function lotteryRecordDeliver(data) {
return request({
url: `marketing/lottery/record/deliver`,
method: 'post',
data,
});
}

View File

@ -2,6 +2,35 @@
import request from '@/utils/request'
/**
* 抽奖规则 列表
* @param pram
*/
export function marketingGameListApi(params) {
return request({
url: '/admin/game/list',
method: 'get',
params
})
}
/**
* 抽奖详情 列表
* @param pram
*/
export function marketingGameInfoListApi(params) {
return request({
url: '/admin/game/info',
method: 'get',
params
})
}
/**
* 优惠券 列表
* @param pram

420
src/api/product.js Normal file
View File

@ -0,0 +1,420 @@
import request from '@/utils/request'
/*
* 获取商品表单头数量
* */
export function getGoodHeade(data) {
return request({
url: 'product/product/type_header',
method: 'get',
params: data,
});
}
/*
* 获取商品表单头数量
* */
export function getGoodsCategory(data) {
return request({
url: '/goods/goods_category',
method: 'get',
params: data,
});
}
/**
* @description 商品管理-- 列表
*/
export function getGoods(params) {
return request({
url: 'product/product',
method: 'get',
params,
});
}
/**
* @description 商品管理-- 临时保存
*/
export function productCache() {
return request({
url: 'product/cache',
method: 'get',
});
}
/**
* @description 商品管理-- 取消临时保存
*/
export function cacheDelete() {
return request({
url: 'product/cache',
method: 'delete',
});
}
/**
* @description 商品管理-- 上下架
*/
export function PostgoodsIsShow(id, isShow) {
return request({
url: `product/product/set_show/${id}/${isShow}`,
method: 'put',
});
}
/**
* @description 商品属性 -- 批量上下架
* @param {Object} param data {Object} 传值对象
*/
export function productShowApi(data) {
return request({
url: `product/product/product_show`,
method: 'put',
data,
});
}
/**
* 添加虚拟评论
* @param {*} data
* @returns
*/
export function saveFictitiousReply(data) {
return request({
url: 'product/reply/save_fictitious_reply',
method: 'post',
data,
});
}
/**
* @description 商品属性 -- 批量下架
* @param {Object} param data {Object} 传值对象
*/
export function productUnshowApi(data) {
return request({
url: `product/product/product_unshow`,
method: 'put',
data,
});
}
/**
* @description 商品管理-- 分类
*/
export function treeListApi(type) {
return request({
url: `product/category/tree/${type}`,
method: 'get',
});
}
/**
* @description 商品管理-- 分类 new
*/
export function cascaderListApi(type) {
return request({
url: `product/category/cascader/${type}`,
method: 'get',
});
}
/**
* @description 商品管理-- 详情
*/
export function productInfoApi(id) {
return request({
url: `product/product/${id}`,
method: 'get',
});
}
/**
* @description 商品管理-- 提交
*/
export function productAddApi(data) {
return request({
url: `product/product/${data.id}`,
method: 'POST',
data,
});
}
/**
* @description 商品分类 -- 列表
* @param {Object} param params {Object} 传值参数
*/
export function productListApi(params) {
return request({
url: 'product/category',
method: 'get',
params,
});
}
/**
* @description 商品分类 -- 添加表单
* @param {Object} param params {Object} 传值参数
*/
export function productCreateApi() {
return request({
url: 'product/category/create',
method: 'get',
});
}
/**
* @description 商品分类 -- 编辑表单
* @param {Object} param params {Object} 传值参数
*/
export function productEditApi(id) {
return request({
url: `product/category/${id}`,
method: 'get',
});
}
/**
* @description 商品分类 -- 修改状态
* @param {Object} param params {Object} 传值参数
*/
export function setShowApi(data) {
return request({
url: `product/category/set_show/${data.id}/${data.is_show}`,
method: 'PUT',
});
}
/**
* @description 选择商品 -- 列表
*/
export function changeListApi(params) {
return request({
url: `product/product/list`,
method: 'GET',
params,
});
}
/**
* @description 商品评论 -- 列表
* @param {Object} param params {Object} 传值参数
*/
export function replyListApi(params) {
return request({
url: `product/reply`,
method: 'get',
params,
});
}
/**
* @description 商品评论 -- 回复
* @param {Object} param data {Object} 传值参数
*/
export function setReplyApi(data, id) {
return request({
url: `product/reply/set_reply/${id}`,
method: 'PUT',
data,
});
}
/**
* @description 获取复制商品配置
*/
export function copyConfigApi() {
return request({
url: `product/copy_config`,
method: 'get',
});
}
/**
* @description 商品管理 -- 获取京东淘宝商品数据
* @param {Object} param data {Object} 传值参数
*/
export function crawlFromApi(data) {
return request({
url: `product/copy`,
method: 'POST',
data,
});
}
/**
* @description 商品管理 -- 京东淘宝商品数据提交
* @param {Object} param data {Object} 传值参数
*/
export function crawlSaveApi(data) {
return request({
url: `product/crawl/save`,
method: 'POST',
data,
});
}
/**
* @description 商品管理 -- 生成属性
* @param {Object} param data {Object} 传值参数
*/
export function generateAttrApi(data, id, type) {
return request({
url: `product/generate_attr/${id}/${type}`,
method: 'POST',
data,
});
}
/**
* @description 商品属性 -- 列表
* @param {Object} param params {Object} 传值参数
*/
export function ruleListApi(params) {
return request({
url: `product/product/rule`,
method: 'GET',
params,
});
}
/**
* @description 商品属性 -- 添加
* @param {Number} param id {Number} 属性id
* @param {Object} param data {Object} 传值参数
*/
export function ruleAddApi(data, id) {
return request({
url: `product/product/rule/${id}`,
method: 'POST',
data,
});
}
/**
* @description 商品属性 -- 详情
* @param {Number} param id {Number} 属性id
*/
export function ruleInfoApi(id) {
return request({
url: `product/product/rule/${id}`,
method: 'get',
});
}
/**
* @description 商品评价 -- 虚拟评价
* @id--产品id
*/
export function fictitiousReply(id) {
return request({
url: `product/reply/fictitious_reply/${id}`,
method: 'get',
});
}
/**
* @description 商品属性 -- 获取规则属性模板
*/
export function productGetRuleApi() {
return request({
url: `product/product/get_rule`,
method: 'get',
});
}
/**
* @description 商品 -- 获取运费模板
*/
export function productGetTemplateApi() {
return request({
url: `product/product/get_template`,
method: 'get',
});
}
/**
* @description 获取上传参数
*/
export function productGetTempKeysApi(data) {
return request({
url: `product/product/get_temp_keys`,
method: 'get',
params: data,
});
}
/**
* @description 商铺产品 -- 导出
*/
export function storeProductApi(data) {
return request({
url: `export/storeProduct`,
method: 'get',
params: data,
});
}
/**
* @description 添加商品 -- 检测活动存在
*/
export function checkActivityApi(id) {
return request({
url: `product/product/check_activity/${id}`,
method: 'get',
});
}
/**
* @description 商品添加编辑-- 用户标签
*/
export function labelListApi() {
return request({
url: 'user/user_label',
method: 'get',
});
}
/**
* @description 组件获取用户标签
*/
export function productUserLabel() {
return request({
url: 'user/user_tree_label',
method: 'get',
});
}
/**
* @description 上传类型
*/
export function uploadType() {
return request({
url: 'file/upload_type',
method: 'get',
});
}
/**
* @description 导入卡密
*/
export function importCard(data) {
return request({
url: 'product/product/import_card',
method: 'get',
params: data,
});
}
/**
* @description 商品批量设置
* @param {Number} param id {Number} 属性id
* @param {Object} param data {Object} 传值参数
*/
export function batchSetting(data) {
return request({
url: `product/batch/setting`,
method: 'POST',
data,
});
}

View File

@ -157,6 +157,21 @@ const marketingRouter = {
}
]
},
{
path: 'lottery',
component: () => import('@/views/marketing/lottery/config/index'),
name: 'lottery',
meta: { title: '抽奖管理', icon: '' },
children: [
{
path: 'config',
component: () => import('@/views/marketing/lottery/config/index'),
name: 'config',
meta: { title: '抽奖配置', icon: '' }
},
]
},
]
}

View File

@ -1,14 +1,6 @@
<template>
<div class="page-account" :style="backgroundImages ? { backgroundImage: 'url(' + backgroundImages + ')'} : { backgroundImage: 'url(' + backgroundImageMo + ')'}">
<div class="container" :class="[ fullWidth > 768 ? 'containerSamll':'containerBig']">
<template v-if="fullWidth>768">
<swiper :options="swiperOption" class="swiperPross">
<swiper-slide v-for="(item,index) in swiperList" :key="index" class="swiperPic">
<img :src="item.pic">
</swiper-slide>
<div slot="pagination" class="swiper-pagination" />
</swiper>
</template>
<div class="container" :class="[ fullWidth > 368 ? 'containerSamll':'containerBig']">
<div class="index_from page-account-container">
<div class="page-account-top ">
<div class="page-account-top-logo">
@ -513,7 +505,7 @@ export default {
.containerSamll {
/*width: 56% !important;*/
width: 670px;
width: 370px;
background: #fff !important;
}

View File

@ -0,0 +1,130 @@
<template>
<div class="divBox">
<el-table ref="selection" :data="specsData">
<el-table-column label="序号" type="index" min-width="80"/>
<el-table-column label="图片" min-width="80">
<template slot-scope="scope">
<div class="acea-row .row-middle .row-center-wrapper">
<div class="pictrue pictrueTab" v-if="scope.row.productImage" @click="modalPicTap('dan', scope.$index)">
<img v-lazy="scope.row.productImage" />
</div>
<div class="upLoad pictrueTab acea-row row-center-wrapper" v-else>
<i class="el-icon-picture-outline" style="font-size: 24px"></i>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="名称" min-width="80">
<template slot-scope="scope">
<div>{{ scope.row.productName }}</div>
</template>
</el-table-column>
<!-- <el-table-column label="奖品" min-width="80">-->
<!-- <template slot-scope="scope">-->
<!-- <div>{{ scope.row.type | typeName }}</div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="提示语" min-width="80">
<template slot-scope="scope">
<div>{{ scope.row.message }}</div>
</template>
</el-table-column>
<el-table-column label="数量" min-width="80">
<template slot-scope="scope">
<el-input-number
:controls="false"
v-model="scope.row.total"
:max="9999999999"
:min="0"
:precision="0"
class="priceBox"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="奖品概率" min-width="80">
<template slot-scope="scope">
<div>{{ scope.row.lotteryRate }}</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="80">
<template slot-scope="scope">
<a class="submission mr15" @click="editGoods(scope.$index)">编辑</a>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import {marketingGameInfoListApi, marketingGameListApi} from "@/api/marketing";
export default {
data(){
return{
tableFrom: {
page: 1,
limit: 20,
cid:747
},
modalPic: false,
isChoice: '单选',
picTit: '',
specsData:[]
}
},
mounted() {
this.getList()
},
methods:{
//
getList() {
marketingGameListApi(this.tableFrom).then(res => {
this.listLoading = false
// res.list[0].id
this.getInfo(res.list[0].id)
}).catch(res => {
this.listLoading = false
})
},
getInfo(id){
marketingGameInfoListApi({id:id}).then(res =>{
this.specsData = res.rule.items
})
},
//
modalPicTap(tit, index) {
const _this = this
this.$modalUpload(function(img) {
if(img.length >= 2) return this.$message.warning("最多选择1张图片");
_this.specsData[index].productImage = img[0].sattDir
},tit, 'store')
},
}
}
</script>
<style scoped>
.pictrue {
width: 58px;
height: 58px;
border: 1px dotted rgba(0, 0, 0, 0.1);
margin-right: 0px;
display: inline-block;
position: relative;
cursor: pointer;
img {
width: 100%;
height: 100%;
}
}
</style>

View File

@ -0,0 +1,320 @@
<template>
<div>
<el-card :bordered="false" shadow="never" class="ivu-mt">
<el-form
ref="tableFrom"
:model="tableFrom"
:label-width="labelWidth"
:label-position="labelPosition"
@submit.native.prevent
>
<el-scope.row :gutter="24">
<el-col>
<el-form-item label="活动类型:" clearable>
<el-select
style="width: 200px"
v-model="tableFrom.factor"
placeholder="请选择活动类型"
clearable
@change="userSearchs"
>
<el-option value="1" label="积分抽取"></el-option>
<!-- <el-option value="2">余额</el-option> -->
<el-option value="3" label="订单支付"></el-option>
<el-option value="4" label="订单评价"></el-option>
<!-- <el-option value="5">关注公众号</el-option> -->
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="活动状态:" clearable>
<el-select
style="width: 200px"
v-model="tableFrom.start_status"
placeholder="请选择"
clearable
@change="userSearchs"
>
<el-option value="0" label="未开始"></el-option>
<el-option value="1" label="进行中"></el-option>
<el-option value="-1" label="已结束"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="上架状态:">
<el-select
style="width: 200px"
placeholder="请选择"
v-model="tableFrom.status"
clearable
@change="userSearchs"
>
<el-option value="1" label="上架"></el-option>
<el-option value="0" label="下架"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="抽奖搜索:" label-for="store_name">
<el-input
search
enter-button
style="width: 200px"
placeholder="请输入抽奖名称ID"
v-model="tableFrom.store_name"
@on-search="userSearchs"
/>
</el-form-item>
</el-col>
</el-scope.row>
<el-scope.row class="mb20">
<el-button v-auth="['marketing-store_bargain-create']" type="primary" v-db-click @click="add" class="mr10"
>添加抽奖</el-button
>
</el-scope.row>
</el-form>
<el-table
:data="tableList"
v-loading="loading"
highlight-scope.row
no-userFrom-text="暂无数据"
no-filtered-userFrom-text="暂无筛选结果"
>
<el-table-column label="ID" width="80">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column label="活动名称" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="活动类型" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.lottery_type }}</span>
</template>
</el-table-column>
<el-table-column label="参与次数" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.lottery_all }}</span>
</template>
</el-table-column>
<el-table-column label="抽奖人数" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.lottery_people }}</span>
</template>
</el-table-column>
<el-table-column label="中奖人数" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.lottery_win }}</span>
</template>
</el-table-column>
<el-table-column label="活动状态" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.status_name }}</span>
</template>
</el-table-column>
<el-table-column label="上架状态" min-width="130">
<template slot-scope="scope">
<el-switch
class="defineSwitch"
:active-value="1"
:inactive-value="0"
v-model="scope.row.status"
:value="scope.row.status"
:disabled="scope.row.lottery_status == 2 ? true : false"
@change="onchangeIsShow(scope.row)"
size="large"
active-text="上架"
inactive-text="下架"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="活动时间" min-width="130">
<template slot-scope="scope">
<div>{{ scope.row.start_time || '--' }}</div>
<div>{{ scope.row.end_time || '--' }}</div>
</template>
</el-table-column>
<el-table-column label="活动状态" min-width="130">
<template slot-scope="scope">
<span>{{ scope.row.status_name }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="170">
<template slot-scope="scope">
<a v-db-click @click="edit(scope.row)">编辑</a>
<el-divider direction="vertical"></el-divider>
<a v-db-click @click="del(scope.row, '删除抽奖', scope.$index)">删除</a>
<el-divider direction="vertical"></el-divider>
<a v-db-click @click="copy(scope.row)">复制</a>
<el-divider direction="vertical"></el-divider>
<a v-db-click @click="getRecording(scope.row)">抽奖记录</a>
</template>
</el-table-column>
</el-table>
<div class="acea-row row-right page">
<pagination
v-if="total"
:total="total"
:page.sync="tableFrom.page"
:limit.sync="tableFrom.limit"
@pagination="getList"
/>
</div>
</el-card>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { lotteryListApi, lotteryStatusApi } from '@/api/lottery';
import { formatDate } from '@/utils/validate';
export default {
name: 'storeBargain',
filters: {
formatDate(time) {
if (time !== 0) {
let date = new Date(time * 1000);
return formatDate(date, 'yyyy-MM-dd hh:mm');
}
},
},
data() {
return {
loading: false,
tableList: [],
tableFrom: {
start_status: '',
status: '',
store_name: '',
export: 0,
page: 1,
factor: '',
limit: 15,
},
total: 0,
};
},
computed: {
...mapState('admin/layout', ['isMobile']),
labelWidth() {
return this.isMobile ? undefined : '80px';
},
labelPosition() {
return this.isMobile ? 'top' : 'right';
},
},
created() {
this.getList();
},
methods: {
//
add() {
this.$router.push({ path: this.$routeProStr + '/marketing/lottery/create' });
},
//
edit(row) {
this.$router.push({
name: 'marketing_create',
query: {
id: row.id,
},
});
},
//
copy(row) {
this.$router.push({
name: 'marketing_create',
query: {
id: row.id,
copy: 1,
},
});
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `marketing/lottery/del/${row.id}`,
method: 'DELETE',
ids: '',
};
this.$modalSure(delfromData)
.then((res) => {
this.$message.success(res.msg);
this.tableList.splice(num, 1);
})
.catch((res) => {
this.$message.error(res.msg);
});
},
//
getRecording(row) {
this.$router.push({
path: this.$routeProStr + `/marketing/lottery/recording_list`,
query: {
id: row.id,
},
});
},
//
getList() {
this.loading = true;
this.tableFrom.start_status = this.tableFrom.start_status || '';
this.tableFrom.status = this.tableFrom.status || '';
lotteryListApi(this.tableFrom)
.then(async (res) => {
let data = res.data;
this.tableList = data.list;
this.total = res.data.count;
this.loading = false;
})
.catch((res) => {
this.loading = false;
this.$message.error(res.msg);
});
},
//
userSearchs() {
this.tableFrom.page = 1;
this.getList();
},
//
onchangeIsShow(row) {
let data = {
id: row.id,
status: row.status,
};
lotteryStatusApi(data)
.then(async (res) => {
this.$message.success(res.msg);
this.getList();
})
.catch((res) => {
this.$message.error(res.msg);
this.getList();
});
},
},
};
</script>
<style scoped lang="stylus">
.tabBox_img {
width: 36px;
height: 36px;
border-radius: 4px;
cursor: pointer;
img {
width: 100%;
height: 100%;
}
}
</style>

View File

@ -342,6 +342,18 @@
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品标签:" class="proCoupon">
<div class="acea-row">
<el-input
v-model="formValidate.tags"
style="width: 360px"
placeholder="输入标签,多个标签用逗号分隔"
clearable
/>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="优惠券:" class="proCoupon">
<div class="acea-row">
@ -1206,8 +1218,8 @@
let list = response.list;
let arr = [],arr1 = [];
const listArr = [{ name: '是否热卖', value: 'isGood' }];
let typeLists = [
{ name: '', value: 'isHot',type:'2' }, //
let typeLists = [
{ name: '', value: 'isHot',type:'2' }, //
{ name: '', value: 'isBenefit' ,type:'4'}, //
{ name: '', value: 'isBest',type:'1' }, //
{ name: '', value: 'isNew',type:'3' }]; //