物流公司switch切换无效,代码注释添加

This commit is contained in:
mabo
2021-07-20 14:06:53 +08:00
parent 5062cad2b0
commit 0a248d89d5
74 changed files with 480 additions and 1060 deletions

View File

@@ -1,239 +0,0 @@
<template>
<Card>
<Form
label-position="left"
ref="searchForm"
:model="params"
inline
:label-width="100"
class="search-form"
>
<Form-item label="选择店铺" prop="sn">
<span class="tips" v-if="storeName"
>{{ storeName }}
<Button
@click="
() => {
storeName = '';
params.shopId = '';
}
"
type="text"
>清空</Button
>
</span>
<Button size="small" @click="handleClickShop" type="primary"
>选择店铺</Button
>
</Form-item>
<Form-item label="选择会员" prop="sn">
<span class="tips" v-if="memberName"
>{{ memberName }}
<Button
@click="
() => {
memberName = '';
params.memberId = '';
}
"
type="text"
>清空</Button
>
</span>
<Button size="small" @click="handleClickMember" type="primary"
>选择会员</Button
>
</Form-item>
<Form-item label="选择时间类型" prop="sn">
<Select v-model="params.timeType" style="width: 200px">
<Option
v-for="item in typeList"
:value="item.value"
:key="item.value"
>{{ item.label }}</Option
>
</Select>
</Form-item>
<Form-item label="按年查询" prop="sn">
<DatePicker
type="year"
placeholder="Select year"
style="width: 200px"
v-model="year"
></DatePicker>
</Form-item>
<Form-item label="按月查询" v-if="params.timeType == 'MONTH'">
<InputNumber :max="12" :min="1" v-model="params.month"></InputNumber>
</Form-item>
</Form>
<Tabs v-model="orderStatus" @on-click="handleClickType">
<TabPane label="行业订单数量" name="NUM">
<Table :columns="columns" :data="data"></Table>
</TabPane>
<TabPane label="行业订单金额" name="PRICE">
<Table :columns="columns" :data="data"></Table>
</TabPane>
</Tabs>
<Modal v-model="modalFlag" width="1200" :title="selectName">
<!-- 店铺 -->
<shopLayout v-if="shopFlag" @callback="callbackShop" ref="shops" />
<!-- 会员 -->
<memberLayout v-else @callback="callbackMember" ref="members" />
</Modal>
</Card>
</template>
<script>
import shopLayout from "@/views/seller/shop/shopList";
import memberLayout from "@/views/member/list/index";
import * as API_Goods from "@/api/goods";
export default {
components: {
shopLayout,
memberLayout,
},
data() {
return {
storeName: "", // 店铺名称
memberName: "", // 会员名称
shopFlag: false, // 是否展示
selectName: "选择", // modal名称
modalFlag: false, // modal显隐
priceData: "", // 价格
orderStatus: "NUM", // tab展示
shopList: {}, // 店铺列表
memberList: {}, // 会员列表
typeList: [ // 类型
{
value: "YEAR",
label: "年",
},
{
value: "MONTH",
label: "月",
},
],
total: 0, // 总数
year:"", // 当前年份
params: { // 请求参数
type: "PRICE",
timeType: "YEAR",
pageNumber: 1,
pageSize: 10,
year: "",
shopId: "",
memberId: "",
},
columns: [ // 店铺名称
{
title: "商品一级分类",
key: "categoryName",
},
{
title: "销售数量",
key: "num",
},
{
title: "销售金额",
key: "price",
},
],
data: [], // 店铺名称
};
},
watch: {
params: {
handler(val) {
this.init();
},
deep: true,
},
year(val) {
this.params.year = new Date(val).getFullYear();
},
},
methods: {
// 选择店铺
handleClickShop() {
this.modalFlag = true;
this.selectName += "店铺";
this.shopFlag = true;
this.$nextTick(() => {
this.$refs.shops.selectedShop = true;
});
},
// 选择会员
handleClickMember() {
this.modalFlag = true;
this.selectName += "会员";
this.$nextTick(() => {
this.$refs.members.selectedMember = true;
});
},
callbackMember(val) {
this.memberName = val.username;
this.params.memberId = val.id;
this.modalFlag = false;
},
callbackShop(val) {
this.storeName = val.storeName;
this.params.shopId = val.id;
this.modalFlag = false;
},
// 点击分页
changePage(index) {
this.params.pageNumber = index;
},
handleClickType(name) {
this.params.type = name;
},
init(name) {
Promise.all([
API_Goods.goodsCategoryStatistics(this.params),
]).then((res) => {
if (res[0].result) {
this.data = res[0].result;
}
});
},
},
mounted() {
let data = new Date();
this.year = data;
this.year && this.params.month
? this.timeType == "MONTH"
: this.timeType == "YEAR";
},
};
</script>
<style scoped lang="scss">
.page-col {
text-align: right;
margin: 10px 0;
}
.order-col {
display: flex;
> div {
margin-right: 8px;
padding: 16px;
font-size: 15px;
}
}
.order-list {
display: flex;
}
.tips {
margin: 0 8px;
}
</style>

View File

@@ -1,63 +1,59 @@
<template>
<div class="search">
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="商品名称" prop="goodsName">
<Input
type="text"
v-model="searchForm.goodsName"
placeholder="请输入商品名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="商品编号" prop="sn">
<Input
type="text"
v-model="searchForm.sn"
placeholder="请输入商品编号"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="状态" prop="status">
<Select
v-model="searchForm.marketEnable"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="UPPER">上架</Option>
<Option value="DOWN">下架</Option>
</Select>
</Form-item>
<Form-item label="商品类型" prop="status">
<Select v-model="searchForm.goodsType" placeholder="请选择" clearable style="width: 200px">
<Option value="PHYSICAL_GOODS">实物商品</Option>
<Option value="VIRTUAL_GOODS">虚拟商品</Option>
</Select>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search" >搜索</Button>
</Form>
</Row>
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
@keydown.enter.native="handleSearch"
>
<Form-item label="商品名称" prop="goodsName">
<Input
type="text"
v-model="searchForm.goodsName"
placeholder="请输入商品名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="商品编号" prop="sn">
<Input
type="text"
v-model="searchForm.sn"
placeholder="请输入商品编号"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="状态" prop="status">
<Select
v-model="searchForm.marketEnable"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="UPPER">上架</Option>
<Option value="DOWN">下架</Option>
</Select>
</Form-item>
<Form-item label="商品类型" prop="status">
<Select v-model="searchForm.goodsType" placeholder="请选择" clearable style="width: 200px">
<Option value="PHYSICAL_GOODS">实物商品</Option>
<Option value="VIRTUAL_GOODS">虚拟商品</Option>
</Select>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search" >搜索</Button>
</Form>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
class="mt_10"
>
<!-- 商品栏目格式化 -->
<template slot="goodsSlot" slot-scope="{row}">
<div style="margin: 5px 0px;height: 80px; display: flex;">
@@ -80,7 +76,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -96,7 +92,7 @@
</Row>
</Card>
<Modal
:title="modalTitle"
title="下架操作"
v-model="modalVisible"
:mask-closable="false"
:width="500"
@@ -124,14 +120,11 @@
import { getGoodsListData, upGoods, lowGoods } from "@/api/goods";
export default {
name: "goods",
components: {},
data() {
return {
id: "", //要操作的id
loading: true, // 表单加载状态
modalType: 0, // 添加或编辑标识
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
@@ -143,8 +136,6 @@ export default {
reason: "",
},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "商品名称",
@@ -310,41 +301,29 @@ export default {
};
},
methods: {
// 初始化数据
init() {
this.getDataList();
},
// 分页 改变页码
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
// 分页 改变页数
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
// 搜索
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
// 获取数据
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据
getGoodsListData(this.searchForm).then((res) => {
this.loading = false;
if (res.records) {
@@ -353,16 +332,15 @@ export default {
}
});
},
// 编辑
edit(v) {
this.id = v.id;
if (v.underMessage != "{}") {
this.underForm.reason = v.underMessage;
}
this.modalType = 1;
this.modalTitle = "下架操作";
this.modalVisible = true;
},
// 下架
lower() {
lowGoods(this.id, this.underForm).then((res) => {
this.$Modal.remove();
@@ -373,6 +351,7 @@ export default {
}
});
},
// 商家
upper(v) {
this.$Modal.confirm({
title: "确认上架",
@@ -397,14 +376,10 @@ export default {
name: "goods-detail",
query: { id: id },
});
},
}
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -57,7 +57,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -328,6 +328,4 @@
},
};
</script>
<style lang="scss">
@import "@/styles/table-common.scss";
</style>

View File

@@ -1,6 +1,3 @@
<style lang="scss">
@import "@/styles/table-common.scss";
</style>
<template>
<div class="search">
<Card>
@@ -17,7 +14,7 @@
<Button @click="add" type="primary">添加</Button>
</Row>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>

View File

@@ -476,7 +476,6 @@ export default {
};
</script>
<style lang="scss" scoped>
@import "@/styles/table-common.scss";
.wrapper {
width: 100%;
height: 100%;

View File

@@ -37,7 +37,7 @@
@on-selection-change="changeSelect"
>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -372,6 +372,3 @@ export default {
},
};
</script>
<style lang="scss">
@import "@/styles/table-common.scss";
</style>

View File

@@ -22,7 +22,7 @@
</i-switch>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
@@ -351,5 +351,4 @@ export default {
</script>
<style lang="scss" scoped>
@import "./index.scss";
@import "@/styles/table-common.scss";
</style>