| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <view class="app-content">
- <view class="ex-page">
- <view class="input-wrap">
- <view style="padding:0 0upx 0 20upx;" >
- <button class="admin-button-com middle blue"
- style="background-color:green;border:1upx solid green;margin-right:20upx;"
- @click="allOutSelectShop(1)">全部调拨出库</button>
- <button class="admin-button-com middle default" @click="clearAll()" style="margin-right:20upx;">清空全部库存</button>
- <button class="admin-button-com middle default" @click="downStock()">下载Excel</button>
- </view>
- </view>
- <view class="top-bar" style="margin-left:80upx;font-size:38upx;padding:30upx 0 20upx 0;">
- <text @click="showStock">实时库存</text>
- <text style="margin-left:50upx;" @click="showAllItem">全部花材</text>
- </view>
- <view style="margin-left:30upx;padding-top:10upx;padding-bottom:10upx;font-size:26upx;">这个页面,请使用app打开,小程序打开会卡死</view>
- <scroll-view scroll-y scroll-with-animation class="main-view">
- <view class="space-view ex-table">
- <t-table :headerBackgroundColor="'#F0F2F6'">
- <t-tr header>
- <t-th><view style="width:200upx;text-align:left;">花材</view></t-th>
- <t-th>库存</t-th>
- <t-th>路上</t-th>
- <t-th>大客</t-th>
- <t-th>批发</t-th>
- <t-th>零售</t-th>
- <t-th><view @click="clearAllStock()">成本</view></t-th>
- </t-tr>
- <block v-if="!$util.isEmpty(classItemData)">
- <block v-for="(classItem,classIndex) in classItemData" :key="classIndex">
- <block v-if="classItem.child && !$util.isEmpty(classItem.child)">
- <t-tr>
- <t-td>
- <text style="color:#3385FF;font-weight:bold;width:200upx;text-align:left;">
- {{ classItem.className }}
- </text>
- </t-td>
- <t-td></t-td>
- <t-td></t-td>
- <t-td></t-td>
- <t-td></t-td>
- <t-td></t-td>
- <t-td></t-td>
- </t-tr>
- <template v-if="classItem.child && !$util.isEmpty(classItem.child)">
- <block v-for="(productItem, productIndex) in classItem.child" :key="productIndex">
- <t-tr>
- <t-td>
- <view style="width:200upx;text-align:left;color:#333333;font-size:29upx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- {{productItem.name}}
- </view>
- </t-td>
- <t-td>
- <view style="color:#333333;font-weight:bold;font-size:29upx;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- {{productItem.stock?parseFloat(productItem.stock):0}}
- </view>
- </t-td>
- <t-td>
- <text v-if="Number(productItem.onStock)>0" style="color:#0a97a9;font-size:30upx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id,})">
- {{productItem.onStock}}
- </text>
- <text v-else style="color:#0a97a9;font-size:30upx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id,})">
- -
- </text>
- </t-td>
- <t-td>
- <view style="font-size:28upx;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- ¥{{productItem.hjPrice?parseFloat(productItem.hjPrice):0}}
- </view>
- </t-td>
- <t-td>
- <view style="color:#3385FF;font-size:30upx;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- ¥{{productItem.price?parseFloat(productItem.price):0}}
- </view>
- </t-td>
- <t-td>
- <view style="font-size:28upx;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- ¥{{productItem.skPrice?parseFloat(productItem.skPrice):0}}
- </view>
- </t-td>
- <t-td>
- <view style="font-size:28upx;color:red;" @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
- ¥{{productItem.avCost?parseFloat(productItem.avCost):0}}
- </view>
- </t-td>
- </t-tr>
- </block>
- </template>
- </block>
- </block>
- </block>
- </t-table>
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import AppWrapperEmpty from "@/components/app-wrapper-empty";
- import SelectList from "@/components/plugin/selectList";
- import { getProductDataApi,generateItemTable } from "@/api/product";
- import { allOut } from "@/api/stock-out"
- import { clearStock } from "@/api/inventory";
- import { list } from "@/mixins";
- import ShopSelect from "@/components/module/shopSelect";
- import DateSelect from "@/components/module/dateSelect";
- import {mapActions, mapGetters} from "vuex";
- import AppSearchModule from "@/components/module/app-search";
- export default {
- components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule},
- mixins: [list],
- computed: {
- ...mapGetters(["getDictionariesInfo","getLoginInfo","getMyShopInfo"])
- },
- data() {
- return {
- isShow:false,
- customizationTime:'',
- shopId:'',
- itemId:'',
- nowTime: "",
- showTimeDropdown: false,
- nowShop: "",
- showShopDropdown: false,
- dataList: [],
- profile:[],
- storageData:[],
- searchContent:'',
- shopId:0,
- classItemData:[],
- form:{shopId:0,shopName:'',hasSelect:0},
- confirmIn:0
- };
- },
- onShow(){
- let that = this
- if(this.form.hasSelect == 1){
- that.$util.confirmModal({content:'确认全部出库到'+this.form.shopName+'?'},() => {
- that.form.hasSelect = 0
- uni.showLoading({mask:true})
- allOut({shopId:this.form.shopId,confirmIn:that.confirmIn}).then(res=>{
- uni.hideLoading()
- if(res.code == 1){
- that.$msg(res.msg)
- that.showStock()
- }
- })
- })
- }
- },
- onLoad() {
- this.showStock()
- },
- methods: {
- downStock(){
- uni.showLoading({title:'下载中',mask:true})
- generateItemTable().then(res => {
- if(res.code == 1){
- uni.hideLoading()
- let file = res.data.file
- let shortFile = res.data.shortFile
- uni.downloadFile({
- url: file,
- header: {"Content-Type": 'application/vnd.ms-excel'},
- filePath: `${wx.env.USER_DATA_PATH}/${shortFile}`,
- success: (res) => {
- if (res.statusCode === 200) {
- wx.saveFileToDisk({
- filePath: res.filePath,
- success: function(res) {
- console.log(res)
- },
- fail:function(res) {
- console.log(res)
- }
- })
- }
- },
- fail:()=>{
- uni.showToast({title:'请用电脑打开小程序下载',mask:true,icon:'none'})
- }
- });
- }
- })
- },
- clearAllStock(){
- let that = this
- that.$util.confirmModal({content:'确认全部清除?'},() => {
- clearStock().then(res=>{
- if(res.code == 1){
- that.$msg(res.msg)
- that.showStock()
- }
- })
- })
- },
- init(){
- },
- clearAll(){
- this.$msg('请联系管理员')
- },
- allOutSelectShop(flag){
- //是否直接入库
- this.confirmIn = flag
- this.$util.pageTo({url: '/admin/shop/selectShop',query: {style:2}})
- },
- showStock(){
- this.shopId = this.getMyShopInfo.id;
- let type = '';
- let that = this
- uni.showLoading()
- getProductDataApi({ type, shopId: this.shopId,status:0,requestType:'hasStockList'}).then(res=>{
- uni.hideLoading()
- if(res.code == 1){
- that.classItemData = res.data.classItem ? res.data.classItem : []
- }
- })
- },
- showAllItem(){
- this.shopId = this.getMyShopInfo.id;
- let type = '';
- let that = this
- uni.showLoading()
- getProductDataApi({ type, shopId: this.shopId,status:0,requestType:'itemList'}).then(res=>{
- uni.hideLoading()
- if(res.code == 1){
- that.classItemData = res.data.classItem ? res.data.classItem : []
- }
- })
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .ex-page {
- background: white;
- padding-top:20upx;
- height: 100%;
- display: flex;
- flex-direction: column;
- .input-wrap {
- display: flex;
- padding: 0upx 20upx 0upx 13upx;
- .search-bar {
- flex: 1;
- }
- }
- .top-bar {
- width: 100%;
- z-index: 20;
- .bar{
- width: 50%;
- height: 100%;
- text-align: center;
- &:nth-child(1){
- border-right: 1upx solid #eeeeec;
- }
- }
- }
- .main-view {
- margin-top:10upx;
- flex: 1;
- background-color: #f9fbfc;
- .space-view {
- background-color: #fff;
- }
- .ex-info {
- padding: 30upx;
- .info-cell {
- display: flex;
- align-items: center;
- font-size: 28upx;
- &:not(:first-child) {
- margin-top: 20upx;
- }
- .cell-label {
- width: 110upx;
- color: #666666;
- }
- .cell-value {
- margin-left: 40upx;
- color: #333;
- &.warning {
- color: #ffaf1d;
- }
- &.success {
- color: #27c325;
- }
- }
- }
- }
- .ex-table {
- ::v-deep.icon-info {
- color: #333333;
- }
- }
- }
- .bar-view {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30upx;
- width: 100%;
- height: 100upx;
- box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
- .info-view {
- font-size: 26upx;
- }
- .btn-view {
- display: flex;
- .admin-button-com {
- margin: 0 10upx;
- }
- }
- }
- }
- </style>
|