Commit ae14574e authored by 蒙文昊's avatar 蒙文昊

Merge branch 'pyq_goods' into 'dev'

Pyq goods

See merge request bp/op-web-service!17
parents 19293041 672d7414
<template> <template>
<layout> <layout>
<el-card <el-card class="container" style="width: 100%; height: 100%">
class="container"
style="width: 100%; height: 100%"
>
<div class="retail"> <div class="retail">
<el-form <el-form inline :model="retailActivitie" ref="retailActivitie">
inline
:model="retailActivitie"
ref="retailActivitie"
>
<!-- 查询 --> <!-- 查询 -->
<el-row> <el-row>
<el-form-item <el-form-item label="分销活动id" prop="marketing_id">
label="分销活动id"
prop="marketing_id"
>
<!-- :rules="[{ type: 'number', message: '活动id必须为数字值' }]" --> <!-- :rules="[{ type: 'number', message: '活动id必须为数字值' }]" -->
<el-input <el-input
onkeyup="value=value.replace(/[^\d]/g,'')" onkeyup="value=value.replace(/[^\d]/g,'')"
...@@ -44,10 +34,7 @@ ...@@ -44,10 +34,7 @@
</el-form-item> </el-form-item>
<!-- 按钮操作 --> <!-- 按钮操作 -->
<el-form-item class="search_button"> <el-form-item class="search_button">
<el-button <el-button type="primary" @click="toSearch">搜索</el-button>
type="primary"
@click="toSearch"
>搜索</el-button>
<el-button @click="reset('retailActivitie')">重置</el-button> <el-button @click="reset('retailActivitie')">重置</el-button>
</el-form-item> </el-form-item>
</el-row> </el-row>
...@@ -55,14 +42,10 @@ ...@@ -55,14 +42,10 @@
type="primary" type="primary"
style="margin-bottom: 10px" style="margin-bottom: 10px"
@click="createDtb" @click="createDtb"
>创建分销活动</el-button> >创建分销活动</el-button
<!-- Tab -->
<el-table
:data="tableData"
type="index"
align="center"
border
> >
<!-- Tab -->
<el-table :data="tableData" type="index" align="center" border>
<el-table-column <el-table-column
align="center" align="center"
prop="marketing_id" prop="marketing_id"
...@@ -108,13 +91,11 @@ ...@@ -108,13 +91,11 @@
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column align="center" prop="online_status" label="状态">
align="center"
prop="online_status"
label="状态"
>
<template #default="scope"> <template #default="scope">
<span :style="{ color: scope.row.online_status == 3 ? 'red' : '' }"> <span
:style="{ color: scope.row.online_status == 3 ? 'red' : '' }"
>
{{ {{
scope.row.online_status == 2 scope.row.online_status == 2
? "关闭" ? "关闭"
...@@ -131,17 +112,9 @@ ...@@ -131,17 +112,9 @@
label="创建人" label="创建人"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column align="center" prop="create_time" label="创建时间">
align="center"
prop="create_time"
label="创建时间"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column align="center" prop="update_time" label="更新时间">
align="center"
prop="update_time"
label="更新时间"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
...@@ -149,17 +122,14 @@ ...@@ -149,17 +122,14 @@
label="分销到期时间" label="分销到期时间"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column fixed="right" align="center" label="操作">
fixed="right"
align="center"
label="操作"
>
<template #default="scope"> <template #default="scope">
<el-button <el-button
@click="handleClick(scope.row)" @click="handleClick(scope.row)"
type="text" type="text"
size="mini" size="mini"
>查看</el-button> >查看</el-button
>
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
...@@ -179,7 +149,8 @@ ...@@ -179,7 +149,8 @@
scope.row.online_status !== 3 scope.row.online_status !== 3
" "
@click.stop="handelEnable(scope.row, 1)" @click.stop="handelEnable(scope.row, 1)"
>启用</el-button> >启用</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -223,27 +194,26 @@ ...@@ -223,27 +194,26 @@
<el-input <el-input
v-model="ruleForm.marketing_name" v-model="ruleForm.marketing_name"
autocomplete="off" autocomplete="off"
maxlength="50"
show-word-limit
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
></el-input> ></el-input>
<div style="margin: 20px 0"></div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="一级佣金:" prop="first_commission_value">
label="一级佣金:"
prop="first_commission_value"
>
<el-input <el-input
v-model="ruleForm.first_commission_value" v-model="ruleForm.first_commission_value"
oninput="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"
@input="changeValue($event, 'first_commission_value')" @input="changeValue($event, 'first_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
<template #append>%</template> <template #append>%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="二级佣金: " prop="second_commission_value">
label="二级佣金: "
prop="second_commission_value"
>
<el-input <el-input
v-model="ruleForm.second_commission_value" v-model="ruleForm.second_commission_value"
oninput="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"
@input="changeValue($event, 'second_commission_value')" @input="changeValue($event, 'second_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
...@@ -273,10 +243,7 @@ ...@@ -273,10 +243,7 @@
ref="ruleIdForm" ref="ruleIdForm"
size="mini" size="mini"
> >
<div <div class="queryBox" v-show="shopStart == 0">
class="queryBox"
v-show="shopStart == 0"
>
<el-form-item label="关联商品:"> </el-form-item> <el-form-item label="关联商品:"> </el-form-item>
<el-form-item label="商品id:"> <el-form-item label="商品id:">
<el-input <el-input
...@@ -295,7 +262,8 @@ ...@@ -295,7 +262,8 @@
size="mini" size="mini"
style="margin-bottom: 30px" style="margin-bottom: 30px"
@click="findProducts" @click="findProducts"
>查询</el-button> >查询</el-button
>
</div> </div>
<div :class="shopStart == 0 ? 'newTab' : 'readTab'"> <div :class="shopStart == 0 ? 'newTab' : 'readTab'">
<el-table <el-table
...@@ -308,10 +276,7 @@ ...@@ -308,10 +276,7 @@
style="width: 100%" style="width: 100%"
@selection-change="selectGoodsChange" @selection-change="selectGoodsChange"
> >
<el-table-column <el-table-column align="center" type="selection">
align="center"
type="selection"
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
...@@ -373,7 +338,7 @@ import { ...@@ -373,7 +338,7 @@ import {
} from "@/service/Goods/goods"; } from "@/service/Goods/goods";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
// 开启关闭防抖 // 开启关闭防抖
function debounce (callback, delay) { function debounce(callback, delay) {
let timer = null; let timer = null;
return function (...args) { return function (...args) {
if (timer) { if (timer) {
...@@ -483,7 +448,7 @@ export default { ...@@ -483,7 +448,7 @@ export default {
else this.ruleForm[level] = ""; else this.ruleForm[level] = "";
}, },
// 查看详情列表 // 查看详情列表
async handleClick (row) { async handleClick(row) {
this.dialogFormVisible = true; this.dialogFormVisible = true;
this.shopStart = 1; this.shopStart = 1;
this.disabled = true; this.disabled = true;
...@@ -499,13 +464,13 @@ export default { ...@@ -499,13 +464,13 @@ export default {
} }
}, },
// 页码变化 // 页码变化
handleCurrentChange (e) { handleCurrentChange(e) {
this.retailActivitie.page = e; this.retailActivitie.page = e;
this.getMarketingList(); this.getMarketingList();
}, },
// 营销活动列表 // 营销活动列表
async getMarketingList () { async getMarketingList() {
try { try {
const res = await getMarketingList(this.retailActivitie); const res = await getMarketingList(this.retailActivitie);
this.tableData = res.result; this.tableData = res.result;
...@@ -533,12 +498,12 @@ export default { ...@@ -533,12 +498,12 @@ export default {
} }
}, 300), }, 300),
// 创建分销活动 // 创建分销活动
createDtb () { createDtb() {
this.dialogFormVisible = true; this.dialogFormVisible = true;
this.shopStart = 0; this.shopStart = 0;
}, },
// 重置 // 重置
reset (retailActivitie) { reset(retailActivitie) {
(this.retailActivitie = { (this.retailActivitie = {
marketing_id: "", marketing_id: "",
marketing_name: "", marketing_name: "",
...@@ -551,11 +516,11 @@ export default { ...@@ -551,11 +516,11 @@ export default {
this.getMarketingList({}); this.getMarketingList({});
}, },
// 搜索 // 搜索
toSearch () { toSearch() {
this.getMarketingList(); this.getMarketingList();
console.log(this.retailActivitie); console.log(this.retailActivitie);
}, },
selectTime (e) { selectTime(e) {
let date = new Date(); let date = new Date();
if (e && e[1] < date) { if (e && e[1] < date) {
ElMessage(`'活动结束时间不能早于当前时间'`); ElMessage(`'活动结束时间不能早于当前时间'`);
...@@ -563,9 +528,9 @@ export default { ...@@ -563,9 +528,9 @@ export default {
} }
}, },
// 获取时间格式 // 获取时间格式
formatTime (date) { formatTime(date) {
// 封装函数判断是否要在目标前边加 ’0‘ // 封装函数判断是否要在目标前边加 ’0‘
function getStr (target) { function getStr(target) {
return ("" + target).length === 1 ? "0" + target : target; return ("" + target).length === 1 ? "0" + target : target;
} }
// 获取月 // 获取月
...@@ -586,7 +551,7 @@ export default { ...@@ -586,7 +551,7 @@ export default {
return timeStr; return timeStr;
}, },
// 查询商品列表 // 查询商品列表
async findProducts () { async findProducts() {
// 获取参数 // 获取参数
const { goods_spu_id, life_account_id } = this.ruleIdForm; const { goods_spu_id, life_account_id } = this.ruleIdForm;
let [start_time, end_time] = this.timeSelect; let [start_time, end_time] = this.timeSelect;
...@@ -615,10 +580,10 @@ export default { ...@@ -615,10 +580,10 @@ export default {
ElMessage.error("请求查询商品列表失败"); ElMessage.error("请求查询商品列表失败");
} }
}, },
selectGoodsChange (e) { selectGoodsChange(e) {
this.ruleForm.goods_sku_id = e.map((item) => item.goods_sku_id); this.ruleForm.goods_sku_id = e.map((item) => item.goods_sku_id);
}, },
async getAllList () { async getAllList() {
let all = await getMarketingList({ let all = await getMarketingList({
page: 1, page: 1,
page_size: this.retailActivitie.count, page_size: this.retailActivitie.count,
...@@ -680,7 +645,7 @@ export default { ...@@ -680,7 +645,7 @@ export default {
}, },
// 清空 // 清空
resetDate () { resetDate() {
(this.ruleForm = { (this.ruleForm = {
marketing_name: "", marketing_name: "",
first_commission_value: "", first_commission_value: "",
...@@ -699,13 +664,13 @@ export default { ...@@ -699,13 +664,13 @@ export default {
}); });
}, },
// 取消 // 取消
cancel () { cancel() {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.resetDate(); this.resetDate();
this.getMarketingList(); this.getMarketingList();
}, },
}, },
created () { created() {
this.getMarketingList(); this.getMarketingList();
this.getAllList(); this.getAllList();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment