文件

566 行
26 KiB
HTML
可执行文件

<!--[1.8.66]-->
<link rel="stylesheet" href="/Public/css/component-serial.css?v=1.0.0">
<div id="app" v-cloak>
<div>
<el-tabs v-model="report_form" :tab-position="'left'" @tab-click="close_report_form">
<el-tab-pane label="库存统计" name="1" v-if="tab1 && platform_type != 2">
<div style="margin: 0px 30px;">
<el-tabs v-model="stock_tab" @tab-click="close_tab">
<el-tab-pane label="普通商品" name="1"></el-tab-pane>
<el-tab-pane label="规格商品" name="2"></el-tab-pane>
</el-tabs>
<el-table :data="stock_statistics" border size="mini">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="storetag" label="门店" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="count" label="商品合计(种)" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="all_purchase" label="进价合计(元)" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="库存合计" align="center">
<el-table-column prop="piece_stock" label="非称重(件)" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="pricing_stock" label="称重" :show-overflow-tooltip="true">
</el-table-column>
</el-table-column>
<el-table-column label="预售合计(元)" align="center">
<template slot-scope="scope" slot="header">
<el-tooltip class="item" effect="dark" content="当前库存预计销售金额" placement="top-start">
<div>预售合计(元)
<el-button type="text" size="mini" icon="el-icon-question"></el-button>
</div>
</el-tooltip>
</template>
<el-table-column prop="sell_retail_total" label="店内" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="sell_online_total" label="商城" :show-overflow-tooltip="true">
</el-table-column>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<if condition="$authArr['stocks'] eq true">
<el-button type="text" size="mini" @click="details(scope.row.id,1)">查看详情</el-button>
</if>
</template>
</el-table-column>
<div slot="empty" v-if="!loading2">暂无数据</div>
<div slot="empty" v-else><span class="el-icon-loading"></span></div>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="销售统计" name="2" v-if="tab2">
<div style="width:90%;margin: 0px 30px;">
<el-table :data="sell_statistics" border size="mini">
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
<el-table-column prop="storetag" label="门店" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="销售" align="center">
<el-table-column prop="sell_num" label="笔数" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="sell_money" label="金额" :show-overflow-tooltip="true">
</el-table-column>
</el-table-column>
<el-table-column label="退款" align="center">
<el-table-column prop="refund_num" label="笔数" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="refund_money" label="金额" :show-overflow-tooltip="true">
</el-table-column>
</el-table-column>
<el-table-column prop="income" label="实际金额" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="cost" label="成本" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="profit" label="盈利" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="profit_margin" label="利润率" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="details(scope.row.id,2)"
v-if="auth.sell_order">门店详情
</el-button>
</template>
</el-table-column>
<div slot="empty" v-if="!loading">暂无数据</div>
<div slot="empty" v-else><span class="el-icon-loading"></span></div>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="库存报表" name="3" v-if="tab3 && platform_type != 2">
<template slot="label">
<span>库存报表</span>
<el-tooltip class="item" effect="dark" content="库存报表为:商户调拨至门店或门店同步商户的商品" placement="top-start"><i
class="el-icon-warning-outline"></i></el-tooltip>
</template>
<el-tabs v-model="inventory_tab" @tab-click="inventory_close_tab" style="margin-left: 30px">
<el-tab-pane label="普通商品" name="1"></el-tab-pane>
<el-tab-pane label="规格商品" name="2"></el-tab-pane>
</el-tabs>
<div style="display: flex;margin-bottom: 20px;margin-left: 30px">
<el-input placeholder="商品名称/货号/条码" type="text" clearable style="width: 200px;margin-right: 10px"
size="small" v-model="searchText"></el-input>
<el-select size="small" v-model="store_id" placeholder="选择门店" clearable style="margin-right: 10px">
<el-option v-for="item in storeList" :key="item.id" :label="item.storetag" :value="item.id">
</el-option>
</el-select>
<el-button type="primary" plain @click="search" size="small">搜索</el-button>
</div>
<div style="width:90%;margin: 0px 30px;">
<el-table border :data="inventoryList" style="width: calc(100vw - 208px);" size="mini"
max-height="500">
<el-table-column prop="index" label="序号" width="50"></el-table-column>
<el-table-column prop="goods_name" label="商品名称"></el-table-column>
<el-table-column prop="sku_name" label="规格" v-if="inventory_tab == 2"></el-table-column>
<el-table-column prop="goods_number" label="货号"></el-table-column>
<el-table-column prop="goods_code" label="条码"></el-table-column>
<el-table-column prop="company" label="单位"></el-table-column>
<el-table-column prop="goods_num" label="库存"></el-table-column>
<el-table-column fixed="right" label="操作" width="100px" style="border-right: none;">
<template slot-scope="scope">
<if condition="$authArr['inventoryInfo'] eq true">
<el-button type="text" size="mini" @click="SyncDetails(scope.row)"
v-if="auth.sell_order">查看详情
</el-button>
</if>
</template>
</el-table-column>
<div slot="empty" v-if="!loading3">暂无数据</div>
<div slot="empty" v-else><span class="el-icon-loading"></span></div>
</el-table>
<el-pagination @size-change="size_change" @current-change="current_change" :current-page.sync="page"
:pager-count="5" :page-sizes="[10,20,30,40,50,60,70,80,90]" :page-size="10" :total="count">
</el-pagination>
</div>
</el-tab-pane>
</el-tabs>
</div>
<!--库存报表详情-->
<div>
<el-dialog :title="syncDetailsTitle" append-to-body :visible.sync="outerVisible">
<div>
<template>
<el-table :data="inventoryInfo" border size="small" style="width: calc(100vw - 208px);">
<el-table-column prop="index" label="序号"></el-table-column>
<el-table-column prop="storetag" label="门店"></el-table-column>
<el-table-column label="数量">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="detailsSerial(scope.$index)"
v-if="scope.row.serial_number_state == 1 && scope.row.goods_num > 0">
{{scope.row.goods_num}}
</el-button>
<span v-else>{{scope.row.goods_num}}</span>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="page" :page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]" :page-size="100"
:total="count1">
</el-pagination>
</template>
</div>
</el-dialog>
</div>
<component-serial :visible.sync="serialVisible" :parent-data="serialGoodsData"
get-data-type="inventoryStatisticsReport">
</component-serial>
</div>
<script src="/Public/js/component-serial.js?v=1.0.0"></script>
<script src="/Public/js/common.js"></script>
<script>
var app = new Vue({
el: '#app',
data: function () {
return {
platform_type:"{$platform_type}", //商户平台类型 1默认系统 2微礼平台
report_form: '3', // tab 库存 销售
stock_tab: '1', // tab 普通 规格
inventory_tab: '1', // tab 普通 规格
stock_statistics: [], // 商品列表
sell_statistics: [], // 销售统计
inventoryList: [], //库存报表
auth: {$authArr},
tab1: true,
tab2: true,
tab3: true,
loading: false, // 加载
loading2: false, // 加载
page: 1,
limit: 10,
count: 0,
searchText: '', //搜索内容
storeList: {$storeList}, //门店列表
store_id: "", //选择的门店id
loading3: false,
page1: 1,
limit1: 10,
count1: 0,
outerVisible: false,
inventoryInfo: [],
attribute_state: 1, //2查看规格库存报表
merchant_goods_id: '', //商户商品id
merchant_goods_sku_id: '', //商户规格id
syncDetailsTitle: '', //库存报表详情标题
serialVisible: false, //串号录入窗口开关
serialGoodsData: {}, //串号录入当前商品数据对象
};
},
methods: {
//商户平台类型 1默认系统 2微礼平台
getPlatformType(){
$.ajax({
url:'/index.php/Retail/Mgoods/getPlatformType',
type:"post",
data:{},
success:(res)=>{
this.platform_type = res.platform_type
}
})
},
/**
* 展示门店库存统计
* 获取普通商品库存
* @return array $res
*/
goods_statistics() {
var that = this;
that.loading2 = true;
$.ajax({
url: "{:U(getGoodsStock)}",
type: "post",
success: function (res) {
that.loading2 = false;
if (res.status == 1) {
that.stock_statistics = res.goods_statistics;
}
}
})
},
/* 获取规格商品 */
sku_statistics() {
var that = this;
that.loading2 = true;
$.ajax({
url: "{:U(getSkuGoodsStock)}",
type: "post",
success: function (res) {
that.loading2 = false;
if (res.status == 1) {
that.stock_statistics = res.sku_statistics;
}
}
})
},
/* 获取销售 */
get_sell_statistics() {
var that = this;
that.loading = true;
$.ajax({
url: "{:U(getSellTotal)}",
type: "post",
success: function (res) {
that.loading = false;
if (res.status == 1) {
that.sell_statistics = res.sell_statistics;
}
}
})
},
//库存报表切换
inventory_close_tab() {
this.page = 1;
switch (this.inventory_tab) {
case '1':
this.getGoodsInventoryList();
break;
case '2':
this.getGoodsSkuInventoryList();
break;
}
},
//库存报表查看详情
SyncDetails: function (item) {
this.outerVisible = true;
this.page1 = 1;
this.merchant_goods_id = item.merchant_goods_id;
this.attribute_state = item.attribute_state;
this.merchant_goods_sku_id = item.merchant_goods_sku_id;
switch (this.attribute_state) {
case '1':
//普通商品
this.syncDetailsTitle = item.goods_name + ' - 详情';
this.getGoodsInventoryInfo(this.merchant_goods_id);
break;
case '2':
//规格商品
this.syncDetailsTitle = item.goods_name + ' - ' + item.sku_name + '详情';
this.getGoodsSkuInventoryInfo(this.merchant_goods_sku_id);
break;
}
},
//库存报表搜索
search() {
this.page = 1;
switch (this.inventory_tab) {
case '1':
this.getGoodsInventoryList();
break;
case '2':
this.getGoodsSkuInventoryList();
break;
}
},
//普通商品库存报表
getGoodsInventoryList: function () {
var that = this;
var searchText = that.searchText;
var store_id = that.store_id;
that.loading3 = true;
$.ajax({
url: "{:U('getGoodsInventoryList')}",
type: "post",
data: {
page: that.page,
limit: that.limit,
searchText: searchText,
store_id: store_id
},
success: function (res) {
that.loading3 = false;
that.inventoryList = [];
that.inventoryList = res.data.list;
that.$nextTick(function () {
that.count = parseInt(res.data.count);
})
}
})
},
//普通商品详情
getGoodsInventoryInfo(merchant_goods_id) {
var that = this;
$.ajax({
url: "{:U('getGoodsInventoryInfo')}",
type: "post",
data: {
page: that.page1,
limit: that.limit1,
merchant_goods_id: merchant_goods_id
},
success: function (res) {
that.inventoryInfo = [];
that.inventoryInfo = res.data.list;
that.$nextTick(function () {
that.count1 = parseInt(res.data.count);
})
}
})
},
//规格库存报表
getGoodsSkuInventoryList: function () {
var that = this;
var searchText = that.searchText;
var store_id = that.store_id;
that.loading3 = true;
$.ajax({
url: "{:U('getGoodsSkuInventoryList')}",
type: "post",
data: {
page: that.page,
limit: that.limit,
searchText: searchText,
store_id: store_id
},
success: function (res) {
that.loading3 = false;
that.inventoryList = [];
that.inventoryList = res.data.list;
that.$nextTick(function () {
that.count = parseInt(res.data.count);
})
}
})
},
//规格商品详情
getGoodsSkuInventoryInfo(merchant_goods_sku_id) {
var that = this;
$.ajax({
url: "{:U('getGoodsSkuInventoryInfo')}",
type: "post",
data: {
page: that.page1,
limit: that.limit1,
merchant_goods_sku_id: merchant_goods_sku_id
},
success: function (res) {
that.inventoryInfo = [];
that.inventoryInfo = res.data.list;
that.$nextTick(function () {
that.count1 = parseInt(res.data.count);
})
}
})
},
/* 切换每页数量 */
size_change(val) {
this.limit = val;
this.page = 1;
switch (this.inventory_tab) {
case '1':
this.getGoodsInventoryList();
break;
case '2':
this.getGoodsSkuInventoryList();
break;
}
},
/* 切换页数 */
current_change(val) {
this.page = val;
switch (this.inventory_tab) {
case '1':
this.getGoodsInventoryList();
break;
case '2':
this.getGoodsSkuInventoryList();
break;
}
},
handleSizeChange(val) {
this.limit1 = val;
this.page1 = 1;
switch (this.attribute_state) {
case '1':
this.getGoodsInventoryInfo(this.merchant_goods_id);
break;
case '2':
this.getGoodsSkuInventoryInfo(this.merchant_goods_sku_id);
break;
}
},
handleCurrentChange(val) {
this.page = val;
switch (this.attribute_state) {
case '1':
this.getGoodsInventoryInfo(this.merchant_goods_id);
break;
case '2':
this.getGoodsSkuInventoryInfo(this.merchant_goods_sku_id);
break;
}
},
/* 选择库存统计、销售统计 */
close_report_form() {
switch (this.report_form) {
case '1':
switch (this.tab) {
case 1:
this.goods_statistics();
break;
case 2:
this.sku_statistics();
break;
default:
this.goods_statistics();
break;
}
break;
case '2':
this.get_sell_statistics();
break;
case '3':
//库存报表
console.log(typeof this.inventory_tab, this.inventory_tab);
switch (this.inventory_tab) {
case '1':
this.getGoodsInventoryList();
break;
case '2':
this.getGoodsSkuInventoryList();
break;
}
break;
}
},
/* 选择普通商品、规格商品 */
close_tab() {
this.stock_statistics = [];
switch (this.stock_tab) {
case '1':
this.goods_statistics();
break;
case '2':
this.sku_statistics();
break;
}
},
/* 门店详情 */
details(store_id, type) {
// type 1.库存详情 2. 销售详情
if (type == 1) {
layer.open({
type: 2,
title: ['库存统计报表', 'font-weight: bold;font-size: 15px;background-color: #fff;margin-top: 10px;color: #409EFF;height: 50px;line-height: 50px;'],
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
move: false,
resize: false,
content: "{:U('stocks')}?store_id=" + store_id
});
} else if (type == 2) {
layer.open({
type: 2,
title: ['销售统计报表', 'font-weight: bold;font-size: 15px;background-color: #fff;margin-top: 10px;color: #409EFF;height: 50px;line-height: 50px;'],
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
move: false,
resize: false,
content: "{:U('sell_order')}?store_id=" + store_id
});
}
},
/**
* @description: 打开串号详情窗口
* @param {Number} index: 当前商品索引
*/
detailsSerial(index) {
this.serialVisible = true
this.serialGoodsData = this.inventoryInfo[index]
console.log(this.serialGoodsData)
},
},
created: function () {
if (this.auth.goods_statistics == false || this.platform_type ==2) {
this.tab1 = false;
}
if (this.auth.sell_statistics == false) {
this.tab2 = false;
}
if (this.auth.inventoryList == false || this.platform_type ==2) {
this.tab3 = false;
}
if (this.auth.goods_statistics == true && this.platform_type != 2) {
this.report_form = '1';
this.goods_statistics();
} else if (this.auth.sell_statistics == true) {
this.report_form = '2';
this.get_sell_statistics();
} else if (this.auth.inventoryList == true && this.platform_type != 2) {
this.report_form = '3';
this.getGoodsInventoryList();
}
},
})
</script>