初始上传

This commit is contained in:
2026-04-04 17:27:12 +08:00
parent 4d80d28eb4
commit b7e11774ee
11191 changed files with 1588469 additions and 0 deletions

View File

@@ -0,0 +1,398 @@
<template>
<base-page>
<view class="goodslist">
<view class="goodslist-box">
<view class="goodslist-left">
<view class="goods-title">
调拨单查询
<text class="iconfont icongengduo1"></text>
</view>
<view class="goods-search">
<view class="search">
<text class="iconfont icon31sousuo"></text>
<input type="text" v-model="search_text" @input="search" placeholder="搜索调拨单号" />
</view>
</view>
<scroll-view scroll-y="true" class="goods-list-scroll" :show-scrollbar="false" @scrolltolower="getListData">
<view class="item" @click="getDetailData(item.allot_id, index)" v-for="(item, index) in list" :key="index" :class="{ itemhover: selectGoodsKeys == index }">
<view class="title">
<view>{{ item.allot_no }}</view>
<view>{{ item.goods_money }}</view>
</view>
<view class="other-info">
<view>出库门店{{ item.output_store_name }}</view>
<view>入库门店{{ item.input_store_name }}</view>
<view>{{ $util.timeFormat(item.allot_time) }}</view>
</view>
</view>
<view class="notYet" v-if="!one_judge && !list.length">暂无数据</view>
</scroll-view>
<view class="add-wastage">
<button type="default" class="primary-btn" v-if="globalStoreInfo.stock_type == 'store'" @click="add()">添加调拨单</button>
</view>
</view>
<view class="goodslist-right">
<view class="goods-title">调拨单详情</view>
<view class="order-information" v-if="Object.keys(detail).length">
<view class="order-status">基本信息</view>
<view class="order-types">
<view class="type type1">
<view>调拨单号</view>
<view>{{ detail.allot_no }}</view>
</view>
<view class="type type1">
<view>制单人</view>
<view>{{ detail.operater_name || '--' }}</view>
</view>
<view class="type type1">
<view>调拨时间</view>
<view class="message">{{ $util.timeFormat(detail.allot_time) }}</view>
</view>
<view class="type type1">
<view>出库门店</view>
<view class="message">{{ detail.output_store_name }}</view>
</view>
<template v-if="detail.out_info">
<view class="type type1">
<view>出库时间</view>
<view class="message">{{ detail.out_info.create_time }}</view>
</view>
<view class="type type1">
<view>经办人</view>
<view class="message">{{ detail.out_info.operater_name }}</view>
</view>
<view class="type type1">
<view>状态</view>
<view class="message">{{ detail.out_info.status_name }}</view>
</view>
<view class="type type1" v-if="detail.out_info.verifier_name">
<view>审核人</view>
<view class="message">{{ detail.out_info.verifier_name }}</view>
</view>
<view class="type type1" v-if="detail.out_info.audit_time">
<view>审核时间</view>
<view class="message">{{ detail.out_info.audit_time }}</view>
</view>
<view class="type type1" v-if="detail.out_info.status == -1">
<view>拒绝理由</view>
<view class="message">{{ detail.out_info.refuse_reason }}</view>
</view>
</template>
<view class="type type1">
<view>入库门店</view>
<view class="message">{{ detail.input_store_name }}</view>
</view>
<template v-if="detail.input_info">
<view class="type type1">
<view>入库时间</view>
<view class="message">{{ detail.input_info.create_time }}</view>
</view>
<view class="type type1">
<view>经办人</view>
<view class="message">{{ detail.input_info.operater_name }}</view>
</view>
<view class="type type1">
<view>状态</view>
<view class="message">{{ detail.input_info.status_name }}</view>
</view>
<view class="type type1" v-if="detail.input_info.verifier_name">
<view>审核人</view>
<view class="message">{{ detail.input_info.verifier_name }}</view>
</view>
<view class="type type1" v-if="detail.input_info.audit_time">
<view>审核时间</view>
<view class="message">{{ detail.input_info.audit_time }}</view>
</view>
<view class="type type1" v-if="detail.input_info.status == -1">
<view>拒绝理由</view>
<view class="message">{{ detail.input_info.refuse_reason }}</view>
</view>
</template>
<view class="type type1">
<view>备注</view>
<view class="message">{{ detail.remark }}</view>
</view>
</view>
<view class="goods-info">
<view class="title">商品明细</view>
<view class="table">
<view class="table-th table-all">
<view class="table-td" style="width:45%;justify-content: flex-start;">商品名称/规格/条形码</view>
<view class="table-td" style="width:15%">单位</view>
<view class="table-td" style="width:10%">数量</view>
<view class="table-td" style="width:15%">成本价()</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">金额()</view>
</view>
<view class="table-tr table-all" v-for="(item, index) in detail.goods_sku_list_array" :key="index">
<view class="table-td table-goods-name" style="width:45%;justify-content: flex-start;">
<image :src="$util.img(item.goods_img)" mode="aspectFill" />
<text class="multi-hidden">{{ item.goods_sku_name }}</text>
</view>
<view class="table-td" style="width:15%">{{ item.goods_unit || '件' }}</view>
<view class="table-td" style="width:10%">{{ item.goods_num }}</view>
<view class="table-td" style="width:15%">{{ item.goods_price }}</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">{{ parseFloat(item.goods_sum).toFixed(2) }}</view>
</view>
</view>
<view class="total-money-num">
<view class="box">
<view>商品种类</view>
<view class="money">{{ detail.goods_count }}</view>
</view>
<view class="box">
<view>商品数量</view>
<view class="money">{{ detail.goods_price }}{{ detail.goods_unit }}</view>
</view>
<view class="box total">
<view>合计金额</view>
<view class="money">{{ parseFloat(detail.goods_total_price).toFixed(2) }}</view>
</view>
</view>
<view class="action-box">
<!-- 只有经办人才能操作入库单 -->
<template v-if="(detail.status == 1 || detail.status == -1) && detail.operater == detail.uid">
<button type="primary" class="default-btn" @click="open('deleteWastagePop')">删除</button>
<button type="primary" class="default-btn" @click="edit">编辑</button>
</template>
<!-- 只有管理员和拥有单据审核权限的才能审核 -->
<template v-if="detail.status == 1 && detail.is_audit == 0">
<button type="primary" class="default-btn" @click="open('refuseWastagePop')">审核拒绝</button>
<button type="primary" class="primary-btn" @click="open('agreeWastagePop')">审核通过</button>
</template>
</view>
</view>
</view>
<block v-else-if="!one_judge && !Object.keys(detail).length">
<image class="cart-empty" src="@/static/goods/goods_empty.png" mode="widthFix"/>
</block>
</view>
</view>
</view>
<!-- 同意 -->
<unipopup ref="agreeWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要通过该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('agreeWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="agree">确定</button>
</view>
</view>
</unipopup>
<!-- 拒绝 -->
<unipopup ref="refuseWastagePop" type="center">
<view class="confirm-pop message">
<view class="title">
拒绝理由
<text class="iconfont iconguanbi1" @click="close('refuseWastagePop')"></text>
</view>
<view class="textarea-box">
<textarea v-model="refuseReason" class="textarea" maxlength="200" placeholder="输入请不多于200字"></textarea>
</view>
<button @click="refuse" type="primary" class="primary-btn btn save">保存</button>
</view>
</unipopup>
<!-- 删除 -->
<unipopup ref="deleteWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要删除该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('deleteWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="deleteDocument">确定</button>
</view>
</view>
</unipopup>
</base-page>
</template>
<script>
import {
getAllocateList,
getAllocateDetail,
allocateAgree,
allocateDelete,
allocateRefuse
} from '@/api/stock.js';
import unipopup from '@/components/uni-popup/uni-popup.vue';
export default {
components: {
unipopup
},
data() {
return {
selectGoodsKeys: 0,
//获取订单的页数
page: 1,
//每次获取订单的条数
page_size: 9,
// 订单搜索是用到的数据
search_text: '',
//初始时加载详情数据判断
one_judge: true,
// 订单列表数据
list: [],
//订单详情数据
detail: {},
repeatFlag: false,
refuseReason: ''
};
},
onLoad() {
this.getListData();
},
methods: {
// 搜索
search() {
this.page = 1;
this.list = [];
this.one_judge = true;
this.getListData();
},
/**
* 获取订单列表
*/
getListData() {
getAllocateList({
page: this.page,
page_size: this.page_size,
allot_no: this.search_text
}).then(res => {
if (res.data.list.length == 0 && this.one_judge) {
this.detail = {};
this.one_judge = false;
}
if (res.code >= 0 && res.data.list.length != 0) {
this.page += 1;
if (this.list.length == 0) {
this.list = res.data.list;
} else {
this.list = this.list.concat(res.data.list);
}
//初始时加载一遍详情数据
if (this.one_judge) {
this.getDetailData(this.list[0].allot_id);
}
}
});
},
/**
* 获取单据详情
*/
getDetailData(allot_id, keys = 0) {
this.selectGoodsKeys = keys;
this.type = 'detail';
getAllocateDetail(allot_id).then(res => {
if (res.code >= 0) {
this.detail = res.data;
this.$forceUpdate();
this.one_judge = false;
}
});
},
add() {
this.$util.redirectTo('/pages/stock/edit_allocate');
},
edit() {
this.$util.redirectTo('/pages/stock/edit_allocate', {
allot_id: this.detail.allot_id
});
},
open(action) {
this.$refs[action].open();
},
close(name) {
this.$refs[name].close();
},
/**
* 审核通过
*/
agree() {
if (this.repeatFlag) return;
this.repeatFlag = true;
allocateAgree(this.detail.allot_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.allot_id);
this.close('agreeWastagePop');
}
this.repeatFlag = false;
})
},
/**
* 审核拒绝
*/
refuse() {
if (!this.refuseReason) {
this.$util.showToast({
title: '请输入拒绝理由'
});
return;
}
if (this.repeatFlag) return;
this.repeatFlag = true;
allocateRefuse({
allot_id: this.detail.allot_id,
refuse_reason: this.refuseReason
}).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.allot_id);
this.close('refuseWastagePop');
}
this.repeatFlag = false;
})
},
/**
* 删除单据
*/
deleteDocument() {
if (this.repeatFlag) return;
this.repeatFlag = true;
allocateDelete(this.detail.allot_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.list.splice(this.selectGoodsKeys, 1);
if (this.selectGoodsKeys == 0) {
this.selectGoodsKeys = 0;
} else {
this.selectGoodsKeys -= 1;
}
this.getDetailData(this.list[this.selectGoodsKeys].allot_id, this.selectGoodsKeys);
this.close('deleteWastagePop');
}
this.repeatFlag = false;
});
}
}
};
</script>
<style scoped lang="scss">
@import './public/css/orderlist.scss';
</style>

View File

@@ -0,0 +1,360 @@
<template>
<base-page>
<view class="goodslist">
<view class="goodslist-box">
<view class="goodslist-left">
<view class="goods-title">
盘点单查询
<text class="iconfont icongengduo1"></text>
</view>
<view class="goods-search">
<view class="search">
<text class="iconfont icon31sousuo"></text>
<input type="text" v-model="search_text" @input="search" placeholder="搜索盘点单号" />
</view>
</view>
<scroll-view scroll-y="true" class="goods-list-scroll" :show-scrollbar="false" @scrolltolower="getListData">
<view class="item" @click="getDetailData(item.inventory_id, index)" v-for="(item, index) in list" :key="index" :class="{ itemhover: selectGoodsKeys == index }">
<view class="title">
<view>{{ item.inventory_no }}</view>
</view>
<view class="other-info">
<view>{{ item.operater_name }}</view>
<view>{{ item.status_name }}</view>
<view>{{ $util.timeFormat(item.create_time) }}</view>
</view>
</view>
<view class="notYet" v-if="!one_judge && !list.length">暂无数据</view>
</scroll-view>
<view class="add-wastage">
<button type="default" class="primary-btn" v-if="globalStoreInfo.stock_type == 'store'" @click="add()">添加盘点单</button>
</view>
</view>
<view class="goodslist-right">
<view class="goods-title">盘点单详情</view>
<view class="order-information" v-if="Object.keys(detail).length">
<view class="order-status">基本信息</view>
<view class="order-types">
<view class="type type1">
<view>盘点单号</view>
<view>{{ detail.inventory_no }}</view>
</view>
<view class="type type1">
<view>制单人</view>
<view>{{ detail.operater_name || '--' }}</view>
</view>
<view class="type type1">
<view>制单时间</view>
<view class="message">{{ detail.create_time }}</view>
</view>
<view class="type type1">
<view>盘点时间</view>
<view class="message">{{ detail.action_time }}</view>
</view>
<view class="type type1">
<view>状态</view>
<view class="message">{{ detail.status_name }}</view>
</view>
<view class="type type1" v-if="detail.verifier_name">
<view>审核人</view>
<view class="message">{{ detail.verifier_name }}</view>
</view>
<view class="type type1" v-if="detail.audit_time">
<view>审核时间</view>
<view class="message">{{ detail.audit_time }}</view>
</view>
<view class="type type1" v-if="detail.status == -1">
<view>拒绝理由</view>
<view class="message">{{ detail.refuse_reason }}</view>
</view>
<view class="type type1">
<view>备注</view>
<view class="message">{{ detail.remark }}</view>
</view>
</view>
<view class="goods-info">
<view class="title">商品明细</view>
<view class="table">
<view class="table-th table-all">
<view class="table-td" style="width:25%;justify-content: flex-start;">商品名称/规格/条形码</view>
<!-- <view class="table-td" style="width:5%">单位</view> -->
<view class="table-td" style="width:8%">实物库存</view>
<view class="table-td" style="width:8%">实盘数量</view>
<view class="table-td" style="width:8%">盈亏数量</view>
<view class="table-td" style="width:13%">盈亏成本总额()</view>
</view>
<view class="table-tr table-all" v-for="(item, index) in detail.goods_sku_list_array" :key="index">
<view class="table-td table-goods-name" style="width:25%;justify-content: flex-start;">
<image :src="$util.img(item.goods_img)" mode="aspectFill" />
<text class="multi-hidden">{{ item.goods_sku_name }}</text>
</view>
<!-- <view class="table-td" style="width:5%"></view> -->
<view class="table-td" style="width:8%">{{ item.stock }}</view>
<view class="table-td" style="width:8%">{{ item.inventory_num }}</view>
<view class="table-td" style="width:8%">{{ item.profitloss_num }}</view>
<view class="table-td" style="width:13%">{{ item.inventory_cost_money }}</view>
</view>
</view>
<view class="total-money-num">
<view class="box">
<view>商品种类</view>
<view class="money">{{ detail.goods_count }}</view>
</view>
<view class="box">
<view>实盘种类</view>
<view class="money">{{ detail.kinds_num }}</view>
</view>
<view class="box">
<view>盘盈</view>
<view class="money kinds-profit">{{ detail.kinds_profit_num }}</view>
</view>
<view class="box">
<view>盘亏</view>
<view class="money kinds-loss">{{ detail.kinds_loss_num }}</view>
</view>
<view class="box">
<view>持平种类</view>
<view class="money">{{ detail.kinds_even_num }}</view>
</view>
</view>
</view>
<view class="action-box">
<!-- 只有经办人才能操作入库单 -->
<template v-if="(detail.status == 1 || detail.status == -1) && detail.operater == detail.uid">
<button type="primary" class="default-btn" @click="open('deleteWastagePop')">删除</button>
<button type="primary" class="default-btn" @click="edit">编辑</button>
</template>
<!-- 只有管理员和拥有单据审核权限的才能审核 -->
<template v-if="detail.status == 1 && detail.is_audit == 0">
<button type="primary" class="default-btn" @click="open('refuseWastagePop')">审核拒绝</button>
<button type="primary" class="primary-btn" @click="open('agreeWastagePop')">审核通过</button>
</template>
</view>
</view>
<block v-else-if="!one_judge && !Object.keys(detail).length">
<image class="cart-empty" src="@/static/goods/goods_empty.png" mode="widthFix"/>
</block>
</view>
</view>
</view>
<!-- 同意 -->
<unipopup ref="agreeWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要通过该盘点单吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('agreeWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="agree">确定</button>
</view>
</view>
</unipopup>
<!-- 拒绝 -->
<unipopup ref="refuseWastagePop" type="center">
<view class="confirm-pop message">
<view class="title">
拒绝理由
<text class="iconfont iconguanbi1" @click="close('refuseWastagePop')"></text>
</view>
<view class="textarea-box">
<textarea v-model="refuseReason" class="textarea" maxlength="200" placeholder="输入请不多于200字"></textarea>
</view>
<button @click="refuse" type="primary" class="primary-btn btn save">保存</button>
</view>
</unipopup>
<!-- 删除 -->
<unipopup ref="deleteWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要删除该盘点单吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('deleteWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="deleteCheck">确定</button>
</view>
</view>
</unipopup>
</base-page>
</template>
<script>
import {
getInventoryList,
getInventoryDetail,
inventoryAgree,
inventoryRefuse,
inventoryDelete
} from '@/api/stock.js';
import unipopup from '@/components/uni-popup/uni-popup.vue';
export default {
components: {
unipopup
},
data() {
return {
selectGoodsKeys: 0,
//获取订单的页数
page: 1,
//每次获取订单的条数
page_size: 9,
// 订单搜索是用到的数据
search_text: '',
//初始时加载详情数据判断
one_judge: true,
// 订单列表数据
list: [],
//订单详情数据
detail: {},
repeatFlag: false,
refuseReason: ''
};
},
onLoad(option) {
this.getListData();
},
methods: {
// 搜索
search() {
this.page = 1;
this.list = [];
this.one_judge = true;
this.getListData();
},
/**
* 获取订单列表
*/
getListData() {
getInventoryList({
page: this.page,
page_size: this.page_size,
inventory_no: this.search_text
}).then(res => {
if (res.data.list.length == 0 && this.one_judge) {
this.detail = {};
this.one_judge = false;
}
if (res.code >= 0 && res.data.list.length != 0) {
this.page += 1;
if (this.list.length == 0) {
this.list = res.data.list;
} else {
this.list = this.list.concat(res.data.list);
}
//初始时加载一遍详情数据
if (this.one_judge) {
this.getDetailData(this.list[0].inventory_id);
}
}
});
},
/**
* 获取订单详情数据
*/
getDetailData(inventory_id, keys = 0) {
this.selectGoodsKeys = keys;
this.type = 'detail';
getInventoryDetail(inventory_id).then(res => {
if (res.code >= 0) {
this.detail = res.data;
this.$forceUpdate();
this.one_judge = false;
}
});
},
add(data) {
this.$util.redirectTo('/pages/stock/edit_check');
},
edit() {
this.$util.redirectTo('/pages/stock/edit_check', {
inventory_id: this.detail.inventory_id
});
},
open(action) {
this.$refs[action].open();
},
close(name) {
this.$refs[name].close();
},
agree() {
if (this.repeatFlag) return;
this.repeatFlag = true;
inventoryAgree(this.detail.inventory_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.inventory_id);
this.close('agreeWastagePop');
}
this.repeatFlag = false;
});
},
refuse() {
if (!this.refuseReason) {
this.$util.showToast({
title: '请输入拒绝理由'
});
return;
}
if (this.repeatFlag) return;
this.repeatFlag = true;
inventoryRefuse({
inventory_id: this.detail.inventory_id,
refuse_reason: this.refuseReason
}).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.inventory_id);
this.close('refuseWastagePop');
}
this.repeatFlag = false;
});
},
deleteCheck() {
if (this.repeatFlag) return;
this.repeatFlag = true;
inventoryDelete(this.detail.inventory_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.list.splice(this.selectGoodsKeys, 1);
if (this.selectGoodsKeys == 0) {
this.selectGoodsKeys = 0;
} else {
this.selectGoodsKeys -= 1;
}
this.getDetailData(this.list[this.selectGoodsKeys].inventory_id, this
.selectGoodsKeys);
this.close('deleteWastagePop');
}
this.repeatFlag = false;
})
}
}
};
</script>
<style scoped lang="scss">
.kinds-loss {
color: red !important;
}
.kinds-profit {
color: #15eb26 !important;
}
@import './public/css/orderlist.scss';
</style>

View File

@@ -0,0 +1,142 @@
<template>
<base-page>
<view class="stock-body">
<view class="content-wrap" @click="goodsShow = false">
<view class="title">{{ screen.allot_id ? '编辑调拨单' : '添加调拨单' }}</view>
<view class="screen-warp form-content">
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
调拨单号
</label>
<view class="form-inline input">
<input type="text" v-model="screen.allot_no" :disabled="screen.allot_id != ''" placeholder="请输入调拨单号" />
</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
调拨方式
</label>
<view class="form-inline">
<select-lay :zindex="10" :value="type" name="names" placeholder="请选择调拨方式" :options="screen.allocateTypeList" @selectitem="selectAllocateType"/>
</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前门店</view>
<view class="form-inline">{{ globalStoreInfo.store_name }}</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前操作人</view>
<view class="form-inline">{{ userInfo ? userInfo.username : '' }}</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
{{ storeName }}
</label>
<view class="form-inline">
<select-lay :zindex="10" :value="screen.store_id" name="names" :placeholder="'请选择' + storeName" :options="screen.storeList" @selectitem="selectStore"/>
</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
调拨时间
</label>
<view class="form-inline">
<uni-datetime-picker :start="screen.startDate" v-model="screen.birthday" type="timestamp" :clearIcon="false" @change="changeTime" />
</view>
</view>
</view>
<view class="table-wrap">
<view class="table-head">
<view class="table-tr">
<view class="table-th" style="flex: 3;">产品名称/规格/编码</view>
<view class="table-th" style="flex: 1;">当前库存</view>
<view class="table-th" style="flex: 1;">单位</view>
<view class="table-th" style="flex: 2;">成本价</view>
<view class="table-th" style="flex: 2;">数量</view>
<view class="table-th" style="flex: 1;">总金额</view>
<view class="table-th" style="flex: 1;">操作</view>
</view>
</view>
<view class="table-body">
<view class="table-tr">
<view class="table-td select-goods-input" style="flex: 3;" @click.stop="goodsShow = true">
<input type="text" @confirm="getGoodsData($event, -1)" placeholder="请输入产品名称/规格/编码" v-model="params.search_text" />
<text class="iconfont icontuodong" @click="getGoodsData({ detail: null }, -1)"></text>
</view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
</view>
<block v-for="(item, index) in goodsList" :key="index">
<view class="table-tr" v-if="goodsIdArr.includes(item.sku_id)">
<view class="table-td goods-name" style="flex: 3;">{{ item.title }}</view>
<view class="table-td" style="flex: 1;">{{ item.real_stock || 0 }}</view>
<view class="table-td" style="flex: 1;">{{ item.unit || '件' }}</view>
<view class="table-td" style="flex: 2;">{{ item.cost_price || 0 }}</view>
<view class="table-td" style="flex: 2;">
<input type="number" v-model="item.goods_num" placeholder="请输入数量" @input="calcTotalData" />
</view>
<view class="table-td" style="flex: 1;">
{{ (item.goods_num * item.cost_price || 0).toFixed(2) }}
</view>
<view class="table-td" style="flex: 1;">
<button type="default" class="delete" @click="delGoods(item.sku_id)">删除</button>
</view>
</view>
</block>
<view class="table-tr table-empty" v-if="!goodsIdArr.length">暂无数据请选择商品数据</view>
</view>
</view>
<stock-goods-dialog v-model="dialogVisible" :params="params" @selectGoods="selectGoods" />
</view>
<view class="action-wrap">
<view class="table-total">
合计{{ totalData.kindsNum }}种产品合计金额{{ totalData.price.toFixed(2) }}
</view>
<view class="btn-wrap">
<button type="default" class="remark default" @click="$refs.remarkPopup.open()">备注</button>
<button type="default" class="stockout-btn" @click="stockOutFn" :loading="isSubmit">确认调拨</button>
<button type="default" class="default" @click="backFn">返回</button>
</view>
</view>
</view>
<uni-popup ref="remarkPopup" type="center">
<view class="remark-wrap">
<view class="header">
<text class="title">备注</text>
<text class="iconfont iconguanbi1" @click="$refs.remarkPopup.close()"></text>
</view>
<view class="body">
<textarea v-model="remark" placeholder="填写备注信息" placeholder-class="placeholder-class" />
</view>
<view class="footer">
<button type="default" class="primary-btn" @click="remarkConfirm">确认</button>
</view>
</view>
</uni-popup>
</base-page>
</template>
<script>
import editAllocate from './public/js/edit_allocate';
import stockGoodsDialog from '@/components/stock-goods-dialog/stock-goods-dialog.vue';
export default {
components: {
stockGoodsDialog
},
mixins: [editAllocate]
};
</script>
<style lang="scss" scoped>
@import './public/css/editStock.scss';
</style>

View File

@@ -0,0 +1,131 @@
<template>
<base-page>
<view class="stock-body">
<view class="content-wrap" @click="goodsShow = false">
<view class="title" v-if="screen.inventory_id != ''">编辑盘点单</view>
<view class="title" v-else>添加盘点单</view>
<view class="screen-warp form-content">
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
盘点单号
</label>
<view class="form-inline input">
<input type="text" v-model="screen.inventory_no" :disabled="screen.inventory_id != ''" placeholder="请输入入库单号" />
</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
盘点时间
</label>
<view class="form-inline">
<uni-datetime-picker v-model="screen.time" type="timestamp" :clearIcon="false" @change="changeTime" />
</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前门店</view>
<view class="form-inline">{{ globalStoreInfo.store_name }}</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前操作人</view>
<view class="form-inline">{{ userInfo ? userInfo.username : '' }}</view>
</view>
</view>
<view class="tips text-color" v-if="globalStoreInfo.stock_config && globalStoreInfo.stock_config.is_audit == 1">
说明待审核状态下只有经办人允许修改只有变为已审核状态后才会使库存发生变化已审核状态的单据不允许再修改</view>
<view class="table-wrap">
<view class="table-head">
<view class="table-tr">
<view class="table-th" style="flex: 3;">产品名称/规格/编码</view>
<view class="table-th" style="flex: 1;">当前库存</view>
<view class="table-th" style="flex: 1;">销售库存</view>
<view class="table-th" style="flex: 1;">单位</view>
<view class="table-th" style="flex: 2;">实盘数量</view>
<view class="table-th" style="flex: 1;">盈亏数量</view>
<view class="table-th" style="flex: 1;">操作</view>
</view>
</view>
<view class="table-body">
<view class="table-tr">
<view class="table-td select-goods-input" style="flex: 3;" @click.stop="goodsShow = true">
<input type="text" @confirm="getGoodsData($event, -1)" placeholder="请输入产品名称/规格/编码" v-model="params.search_text" />
<text class="iconfont icontuodong" @click="getGoodsData({ detail: null }, -1)"></text>
</view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
</view>
<block v-for="(item, index) in goodsList" :key="index">
<view class="table-tr" v-if="goodsIdArr.includes(item.sku_id)">
<view class="table-td goods-name" style="flex: 3;">{{ item.title }}</view>
<view class="table-td" style="flex: 1;">{{ item.real_stock || 0 }}</view>
<view class="table-td" style="flex: 1;">{{ item.stock || 0 }}</view>
<view class="table-td" style="flex: 1;">{{ item.unit || '件' }}</view>
<view class="table-td" style="flex: 2;">
<input type="number" v-model="item.goods_num" placeholder="请输入数量" @input="calcTotalData" />
</view>
<view class="table-td" style="flex: 1;">{{ parseFloat(item.goods_num - item.stock) || 0 }}</view>
<view class="table-td" style="flex: 1;">
<button type="default" class="delete" @click="delGoods(item.sku_id)">删除</button>
</view>
</view>
</block>
<view class="table-tr table-empty" v-if="!goodsIdArr.length">暂无数据请选择商品数据</view>
</view>
</view>
</view>
<view class="action-wrap">
<view class="table-total">合计{{ totalData.kindsNum }}种商品盘盈{{ totalData.upNum }}盘亏{{ totalData.downNum }}持平{{ totalData.sameNum }}</view>
<view class="btn-wrap">
<button type="default" class="remark default" @click="$refs.remarkPopup.open()">备注</button>
<button type="default" class="stockout-btn" @click="stockOutFn" :loading="isSubmit">盘点</button>
<button type="default" class="default" @click="backFn">返回</button>
</view>
</view>
</view>
<stock-goods-dialog v-model="dialogVisible" :params="params" @selectGoods="selectGoods" />
<unipopup ref="tipsPop" type="center">
<view class="confirm-pop">
<view class="title">单据保存后将处于"待审核"状态只有经办人可以编辑或删除等操作是否确认保存</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="$refs.tipsPop.close()">取消</button>
<button type="primary" class="primary-btn btn" @click="save">确定</button>
</view>
</view>
</unipopup>
<uni-popup ref="remarkPopup" type="center">
<view class="remark-wrap">
<view class="header">
<text class="title">备注</text>
<text class="iconfont iconguanbi1" @click="$refs.remarkPopup.close()"></text>
</view>
<view class="body">
<textarea v-model="remark" placeholder="填写备注信息" placeholder-class="placeholder-class" />
</view>
<view class="footer">
<button type="default" class="primary-btn" @click="remarkConfirm">确认</button>
</view>
</view>
</uni-popup>
</base-page>
</template>
<script>
import editInventory from './public/js/edit_inventory'
import unipopup from '@/components/uni-popup/uni-popup.vue';
import stockGoodsDialog from '@/components/stock-goods-dialog/stock-goods-dialog.vue';
export default {
components: {
unipopup,
stockGoodsDialog
},
mixins: [editInventory]
};
</script>
<style lang="scss" scoped>
@import './public/css/editStock.scss';
</style>

View File

@@ -0,0 +1,224 @@
<template>
<base-page>
<view class="manage">
<view class="screen-warp common-form">
<view class="common-form-item">
<view class="form-inline">
<label class="form-label">商品名称/编码</label>
<view class="form-input-inline">
<input type="text" v-model="option.search" placeholder="请输入商品名称/编码" class="form-input" />
</view>
</view>
<view class="form-inline goods-category">
<label class="form-label">商品分类</label>
<view class="form-input-inline">
<uni-data-picker v-model="option.category_id" :localdata="classifyData.data" popup-title="请选择商品分类"></uni-data-picker>
</view>
</view>
<view class="form-inline common-btn-wrap">
<button type="default" class="screen-btn" @click="searchFn()">筛选</button>
<button type="default" @click="resetFn()">重置</button>
</view>
</view>
</view>
<view class="manage-table">
<uniDataTable url="/stock/storeapi/manage/lists" :option="option" :cols="cols" ref="goodsListTable">
<template v-slot:action="dataTable">
<view class="action-btn">
<text @click="toDetail()">查看流水</text>
</view>
</template>
</uniDataTable>
</view>
</view>
</base-page>
</template>
<script>
import {
getGoodsCategory
} from '@/api/goods.js';
import uniDataPicker from '@/components/uni-data-picker/uni-data-picker.vue';
import uniDataTable from '@/components/uni-data-table/uni-data-table.vue';
export default {
components: {
uniDataPicker,
uniDataTable
},
data() {
return {
classifyData: {
data: []
},
table: {
loading: false, //表格加载动画
data: []
},
paging: {
pageSize: 9, // 每页数据量
pageCurrent: 1, // 当前页
total: 0 // 数据总量
},
option: {
search: '',
category_id: '',
page_size: 10
},
cols: [
{
field: 'account_data',
width: 20,
title: '产品名称',
align: 'left',
templet: data => {
let img = this.$util.img(data.sku_image, { size: 'small' });
let html = `
<view class="goods-content">
<image class="goods-img" src="${img}" mode="aspectFill" />
<text class="goods-name multi-hidden">${data.goods_name}</text>
</view>
`;
return html;
}
}, {
width: 19,
title: '规格',
align: 'center',
field: 'spec_name'
}, {
width: 13,
title: '编码',
align: 'center',
field: 'sku_no'
}, {
field: 'real_stock',
width: 10,
title: '库存',
align: 'center'
}, {
field: 'cost_price',
width: 12,
title: '成本',
align: 'center'
}, {
width: 20,
title: '添加时间',
templet: data => {
return this.$util.timeFormat(data.create_time);
}
}, {
width: 15,
title: '操作',
align: 'right',
action: true
}],
};
},
onLoad(option) {
this.getCategory();
},
methods: {
// 搜索商品
searchFn() {
this.$refs.goodsListTable.load({
page: 1
});
},
resetFn() {
this.option.search = '';
this.option.category_id = '';
this.$refs.goodsListTable.load({
page: 1
});
},
getCategory() {
getGoodsCategory({
level: 3
}).then(res => {
let data = res.data;
if (res.code == 0 && data.length) {
this.classifyData.data = this.analyzeCategory(data);
this.$forceUpdate();
} else {
this.$util.showToast({
title: res.message
});
}
})
},
analyzeCategory(data) {
var arr = data.map((item, index) => {
var obj = {};
obj.text = item.category_name;
obj.value = item.category_id;
if (item.child_list && item.child_list.length) {
obj.children = this.analyzeCategory(item.child_list);
}
return obj;
});
return arr;
},
toDetail() {
this.$util.redirectTo('/pages/stock/records');
}
}
};
</script>
<style lang="scss" scoped>
.manage {
position: relative;
background-color: #fff;
padding: 0.15rem;
min-height: 100vh;
box-sizing: border-box;
}
// 筛选面板
.screen-warp {
padding: 0.15rem;
background-color: #f2f3f5;
margin-bottom: 0.15rem;
.common-form-item .form-label {
width: 1.2rem;
}
.common-btn-wrap {
margin-left: 1.2rem;
}
.goods-category .form-input-inline {
width: 2.8rem;
/deep/ .input-value-border{
border-width: 0;
}
}
.common-form-item {
margin-bottom: 0;
}
}
/deep/ .goods-content {
display: flex;
.goods-img {
margin-right: 0.1rem;
width: 0.5rem;
height: 0.5rem;
}
.goods-name {
flex: 1;
white-space: pre-wrap;
align-self: baseline;
}
}
.action-btn {
text {
color: $primary-color;
}
}
</style>

View File

@@ -0,0 +1,271 @@
.form-content {
display: flex;
flex-wrap: wrap;
margin-top: 0.2rem;
.store-info {
.form-inline {
padding-left: 0.05rem;
}
}
.form-item {
margin-bottom: 0.1rem;
display: flex;
.form-label {
width: 1.3rem;
text-align: right;
padding-right: 0.1rem;
box-sizing: border-box;
height: 0.32rem;
line-height: 0.32rem;
.required {
color: red;
margin-right: 0.03rem;
}
}
.form-inline {
width: 2.4rem;
line-height: 0.32rem;
margin-right: 0.1rem;
box-sizing: border-box;
&.input {
input {
padding: 0 0.1rem;
}
}
.form-input {
border-width: 0.01rem;
border-style: solid;
background-color: #fff;
color: rgba(0, 0, 0, 0.85);
border-radius: 0.02rem;
padding-left: 0.1rem;
height: 0.32rem;
line-height: 0.32rem;
font-size: 0.14rem;
border-color: #e6e6e6;
}
}
}
}
.stock-body{
position: relative;
height: 100%;
.content-wrap {
padding: 0.15rem;
background-color: #fff;
@extend %body-overhide;
box-sizing: border-box;
.title {
font-size: 0.18rem;
margin-bottom: 0.2rem;
text-align: center;
}
.table-wrap {
position: relative;
margin-top: 40rpx;
border: 1rpx solid #dcdfe6;
.table-head {
background-color: #f7f7f7;
}
.table-body {
@extend %body-overhide;
max-height: 6rem;
.table-tr {
&:nth-child(1) {
position: absolute;
left: 0;
right: 0;
background: #fff;
z-index: 3;
}
&:nth-child(2) {
margin-top: 0.49rem;
}
&:last-of-type .table-td {
border-bottom: 0;
}
}
}
.table-tr {
display: flex;
}
.table-th,
.table-td {
display: flex;
align-items: center;
justify-content: center;
padding: 0.07rem 0.3rem;
border-bottom: 0.01rem solid #dcdfe6;
border-right: 0.01rem solid #dcdfe6;
text-align: center;
&:last-of-type {
border-right: 0;
justify-content: flex-end;
}
&.goods-name {
justify-content: flex-start;
image {
width: 0.45rem;
height: 0.45rem;
flex-shrink: 0;
}
.name {
margin-left: 0.1rem;
}
}
}
.delete {
margin: 0;
font-size: $uni-font-size-base;
background-color: $primary-color;
color: #fff;
line-height: 0.32rem;
height: 0.32rem;
&::after{
border-width: 0;
}
}
.table-empty {
justify-content: center;
padding: 0.3rem;
color: #999;
}
}
.select-goods-input,
.goods-name {
position: relative;
input {
flex: 1;
padding: 0 0.2rem;
}
.icontuodong {
font-size: 0.16rem;
position: absolute;
top: 0.17rem;
right: 0.34rem;
z-index: 2;
cursor: pointer;
}
}
input {
font-size: $uni-font-size-base !important;
border: 0.01rem solid #e6e6e6 !important;
height: 0.32rem;
}
}
.action-wrap {
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-between;
padding: 0.24rem 0.2rem;
align-items: center;
background-color: #fff;
z-index: 10;
.btn-wrap {
display: flex;
align-items: center;
justify-content: center;
button {
margin: 0;
min-width: 2.75rem;
height: 0.4rem;
line-height: 0.4rem;
font-size: $uni-font-size-base;
&.stockout-btn {
margin-right: 0.15rem;
background-color: $primary-color;
color: #fff;
&::after{
border-width: 0;
}
}
&.remark {
margin-right: 0.15rem;
min-width: 1.2rem;
}
}
}
}
}
.remark-wrap {
width: 6rem;
background-color: #fff;
border-radius: 0.04rem;
box-shadow: 0 0.01rem 0.12rem 0 rgba(0, 0, 0, 0.1);
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0.15rem;
height: 0.45rem;
line-height: 0.45rem;
border-bottom: 0.01rem solid #e8eaec;
.iconfont {
font-size: $uni-font-size-lg;
}
}
.body {
padding: 0.15rem 0.15rem 0.1rem;
textarea {
border: 0.01rem solid #e6e6e6;
width: 100%;
padding: 0.1rem;
box-sizing: border-box;
font-size: 0.14rem;
}
.placeholder-class {
font-size: 0.14rem;
}
}
.footer {
height: 0.5rem;
padding-bottom: 0.05rem;
display: flex;
align-items: center;
justify-content: center;
button.default {
width: 95%;
}
}
}

View File

@@ -0,0 +1,356 @@
.goodslist {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.goodslist-box {
width: 100%;
height: 100%;
background: #fff;
display: flex;
.goodslist-left {
width: 5rem;
height: 100%;
border-right: 0.01rem solid #e6e6e6;
box-sizing: border-box;
overflow: hidden;
position: relative;
.notYet {
color: #e6e6e6;
font-size: 0.4rem;
padding-top: 3rem;
text-align: center;
}
.goods-title {
text-align: center;
line-height: 0.6rem;
font-size: 0.18rem;
font-weight: 500;
height: 0.6rem;
border-bottom: 0.01rem solid #e6e6e6;
box-sizing: border-box;
position: relative;
.icongengduo1 {
position: absolute;
top: 50%;
right: 0.2rem;
transform: translateY(-50%);
font-size: 0.3rem;
color: $primary-color;
}
}
.goods-search {
width: 100%;
height: 0.6rem;
border-bottom: 0.01rem solid #e6e6e6;
display: flex;
align-items: center;
justify-content: center;
padding: 0 0.2rem;
box-sizing: border-box;
.search {
width: 5.6rem;
height: 0.4rem;
border-radius: 0.04rem;
background: #f5f5f5;
display: flex;
align-items: center;
padding: 0 0.2rem;
box-sizing: border-box;
.iconfont {
font-size: 0.16rem;
color: #909399;
margin-right: 0.11rem;
}
input {
width: 80%;
height: 60%;
border: none;
font-size: 0.14rem;
}
}
}
.goods-list-scroll {
width: 100%;
height: calc(100% - 2.08rem);
.itemhover {
background: var(--primary-color-light-9);
}
.item {
padding: 0.2rem;
.title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.2rem;
view {
font-size: 0.16rem;
}
view:nth-child(2) {
color: $primary-color;
}
}
}
}
.add-wastage {
padding: 0.24rem 0.2rem;
button{
width: 100%;
line-height: 0.4rem;
height: 0.4rem;
}
}
}
.goodslist-right {
flex: 1;
width: 0;
height: 100%;
box-sizing: border-box;
position: relative;
padding-bottom: 0.88rem;
overflow: hidden;
.goods-title {
text-align: center;
line-height: 0.6rem;
font-size: 0.18rem;
font-weight: 500;
height: 0.6rem;
border-bottom: 0.01rem solid #e6e6e6;
box-sizing: border-box;
position: relative;
}
.cart-empty {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 2.1rem;
}
.order-information {
width: 100%;
height: calc(100% - 0.6rem);
padding: 0.2rem;
box-sizing: border-box;
overflow-y: auto;
// position: relative;
.order-status {
font-size: 0.24rem;
font-weight: bold;
margin-bottom: 0.24rem;
}
.order-types {
width: 100%;
min-height: 1rem;
padding: 0.2rem 0.3rem;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 0.2rem;
box-sizing: border-box;
.type {
padding-left: 0.1rem;
view {
font-size: 0.14rem;
.look {
color: $primary-color;
margin-left: 0.24rem;
}
}
view:nth-child(1) {
width: 0.9rem;
text-align: right;
margin-right: 0.1rem;
}
.message{
max-width: 10.7rem;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.type1 {
display: flex;
align-items: center;
height: 0.34rem;
}
}
.goods-info {
min-height: 2.7rem;
background: #ffffff;
padding: 0.2rem 0;
box-sizing: border-box;
.title {
font-size: 0.18rem;
font-weight: 550;
margin-bottom: 0.2rem;
}
.table {
width: 100%;
box-sizing: border-box;
margin-bottom: 0.2rem;
.table-all {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 0.38rem;
box-sizing: border-box;
.table-td {
font-size: 0.14rem;
text-align: left;
display: flex;
align-items: center;
justify-content: center;
image {
margin-right: 0.1rem;
}
}
.table-goods-name {
image {
width: 0.6rem;
height: 0.6rem;
margin-right: 0.1rem;
flex-shrink: 0;
}
}
}
.table-th {
height: 0.56rem;
background: #f7f8fa;
}
.table-tr {
height: 0.7rem;
border-bottom: 0.01rem solid #e6e6e6;
.table-td {
image {
width: 0.5rem;
height: 0.5rem;
}
.content-text {
width: 80%;
height: 0.4rem;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
}
}
}
}
}
.total-money-num {
display: flex;
flex-direction: column;
.box {
justify-content: flex-end;
padding: 0.1rem 0 0 0;
color: #333;
}
.money {
text-align: right;
width: 1.2rem;
color: #333;
font-size: 0.14rem;
}
.total {
border-top: 0.01rem solid #e6e6e6;
margin-top: 0.1rem;
.money {
color: #fe2278;
font-size: 0.18rem;
}
}
}
}
}
}
.other-info {
display: flex;
justify-content: space-between;
align-items: center;
}
.total-money-num {
.member-info {
display: flex;
align-items: center;
float: left;
-ms-flex-negative: 0;
-webkit-flex-shrink: 0;
flex-shrink: 0;
}
.box {
display: flex;
align-items: center;
float: right;
view {
font-size: 0.14rem;
}
view:nth-child(1) {
// transform: translateY(-.01rem);
}
view:nth-child(2) {
color: #fe2278;
font-size: 0.18rem;
}
}
}
.total-money-num:after {
overflow: hidden;
content: '';
height: 0;
display: block;
clear: both;
}
/deep/ .uni-scroll-view::-webkit-scrollbar {
width: 0.05rem;
height: 0.3rem;
}
/deep/ .uni-scroll-view::-webkit-scrollbar-thumb {
border-radius: 0.1rem;
box-shadow: inset 0 0 0.05rem rgba(0, 0, 0, 0.2);
background: rgba(193, 193, 193, 1);
}
.order-information::-webkit-scrollbar {
width: 0.05rem;
height: 0.3rem;
}
.order-information::-webkit-scrollbar-thumb {
border-radius: 0.1rem;
box-shadow: inset 0 0 0.05rem rgba(0, 0, 0, 0.2);
background: rgba(193, 193, 193, 1);
}
.action-box {
width: 100%;
position: absolute;
bottom: 0;
right: 0;
background: #ffffff;
padding: 0.24rem 0.2rem;
box-sizing: border-box;
button {
min-width: 0.9rem;
height: 0.4rem;
font-size: 0.18rem;
text-align: center;
line-height: 0.4rem;
float: right;
margin-left: 0.1rem;
}
}

View File

@@ -0,0 +1,294 @@
import {
getAllotNo,
getAllocateDetailInEdit,
getSkuListForStock,
getStoreLists,
editAllocate,
addAllocate
} from '@/api/stock.js';
export default {
data() {
return {
params: {
search_text: '', //产品名称
temp_store_id: ''
},
goodsList: [],
goodsIdArr: [],
goodsShow: false,
totalData: {
kindsNum: 0,
price: 0
},
isSubmit: false,
remark: '',
// 筛选面板的时间
type: 'in',
storeName: '出库门店',
screen: {
store_id: "",
remark: '',
allot_id: "",
allot_no: "",
storeList: [],
startDate: '1998-01-30 00:00:00',
birthday: '',
allocateTypeList: [{
label: '调拨入库',
value: 'in'
},
{
label: '调拨出库',
value: 'out'
}
]
},
dialogVisible: false, //弹框
inputIndex: -1
};
},
onLoad(option) {
this.screen.allot_id = option.allot_id || '';
if (this.screen.allot_id) {
this.getEditData();
} else {
this.getDocumentNo()
}
},
onShow() {
this.screen.birthday = this.$util.timeFormat(Date.parse(new Date()) / 1000);
this.getStoreLists()
},
watch: {
goodsIdArr(data) {
this.calcTotalData();
},
},
methods: {
getDocumentNo() {//获取单据号
getAllotNo().then(res => {
if (res.code >= 0) {
this.screen.allot_no = res.data
} else {
this.$util.showToast({
title: res.message
});
}
});
},
getEditData() {
// 编辑时获取详情
getAllocateDetailInEdit(this.screen.allot_id).then(res => {
if (res.code >= 0 && res.data) {
this.info = res.data;
//当前门店id===入库id则是商品入库门店选择回填为output_store_id出库门店id否则为商品出库门店选择回填为input_store_id入库门店id
this.type = this.globalStoreInfo.store_id == this.info.input_store_id ? 'in' : 'out'
this.screen.store_id = this.type == 'in' ? this.info.output_store_id : this.info.input_store_id
this.screen.allot_no = this.info.allot_no
this.screen.birthday = this.$util.timeFormat(this.info.allot_time)
this.remark = JSON.parse(JSON.stringify(this.info.remark))
this.screen.remark = this.info.remark
for (let sku_id in this.info.goods_list) {
this.info.goods_list[sku_id].title = this.info.goods_list[sku_id].sku_name
this.goodsIdArr.push(parseInt(sku_id));
this.goodsList.push(this.info.goods_list[sku_id]);
}
}
});
},
selectAllocateType(id) {
this.type = id == -1 ? '' : this.screen.allocateTypeList[id].value;
this.storeName = id == -1 || id == 0 ? '出库门店' : '入库门店';
this.params.temp_store_id = this.type == 'in' ? this.screen.store_id : '' //当是入库的时候,需要查出库门店的商品
this.goodsIdArr = []
this.goodsList = []
},
selectStore(id) {
this.screen.store_id = id == -1 ? '' : this.screen.storeList[id].value;
if (this.type == 'in') {
this.goodsIdArr = []
this.goodsList = []
}
},
changeTime(data) {
this.screen.birthday = data;
},
getGoodsData({detail}, index) { //input回车处理
this.inputIndex = index
var data = {
search: detail ? detail.value : '',
}
if (this.type == 'in') data.temp_store_id = this.screen.store_id;
if (detail && detail.value) {
getSkuListForStock(data).then(res => {
if (res.code >= 0 && res.data.length == 1) {
this.selectGoods(res.data)
} else if (res.code >= 0) {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
} else {
this.$util.showToast({
title: res.message
});
}
});
} else {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
}
},
selectGoods(data) { //选择数据
data.forEach((el, index) => {
el.goods_num = 1;
el.goods_price = 0;
el.title = el.sku_name + ''
//点击或回车行为选择商品后当为第一行并且展示列表不存在选择的商品push到展示列表或者不为第一行并且展示列表中不存在时选择的商品除第一条全部push到展示列表
if (!this.goodsIdArr.includes(el.sku_id)) {
console.log(111);
this.goodsIdArr.push(el.sku_id);
this.goodsList.push(el);
} else {//只要展示列表存在直接累加
var elIndex = this.goodsIdArr.indexOf(el.sku_id)
if(this.params.search_text){
this.goodsList[elIndex].goods_num = parseFloat(this.goodsList[elIndex].goods_num) + 1
}
}
})
this.goodsShow = false;
this.params.search_text = '';
this.$forceUpdate();
},
delGoods(id) {//删除已选择的商品
this.goodsList.splice(this.goodsIdArr.indexOf(id), 1);
this.goodsIdArr.splice(this.goodsIdArr.indexOf(id), 1);
},
getStoreLists() {
this.screen.storeList = [];
getStoreLists().then(res => {
if (res.code >= 0) {
let data = res.data;
for (let i = 0; i < data.length; i++) {
if (this.globalStoreId != data[i]['store_id']) {
this.screen.storeList.push({
'label': data[i]['store_name'],
'value': data[i]['store_id'].toString()
});
}
}
if (this.screen.storeList.length > 0) {
this.screen.store_id = this.screen.storeList[0].value;
this.params.temp_store_id = this.screen.store_id
}
}
});
},
stockOutFn() {
if (!this.screen.allot_no) {
this.$util.showToast({
title: "请输入调拨单号"
});
return false;
}
if (!this.type) {
this.$util.showToast({
title: "请选择调拨方式"
});
return false;
}
if (!this.screen.store_id) {
this.$util.showToast({
title: "请选择出库门店"
});
return false;
}
if (!this.screen.birthday) {
this.$util.showToast({
title: "请选择调拨时间"
});
return false;
}
if (!this.goodsIdArr.length) {
this.$util.showToast({
title: "请选择调拨数据"
});
return false;
}
// 检测库存是否填写,且提取数据
let isStock = false;
let saveData = [];
try {
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
if (!parseFloat(item.goods_num || 0)) {
isStock = true;
let toast = "请输入" + item.sku_name + "的调拨数量";
this.$util.showToast({
title: toast
});
throw new Error('end');
}
var obj = {};
obj.goods_num = item.goods_num;
obj.goods_price = item.cost_price;
obj.goods_sku_id = item.sku_id;
saveData.push(obj);
}
})
} catch (e) {
if (e.message != "end") throw e;
}
if (isStock) return false;
if (this.isSubmit) return false;
this.isSubmit = true;
let save = this.screen.allot_id ? editAllocate : addAllocate
save({
allot_type: this.type,
allot_id: this.screen.allot_id,
temp_store_id: this.screen.store_id,
allot_time: this.screen.birthday,
remark: this.screen.remark,
allot_no: this.screen.allot_no,
goods_sku_list: JSON.stringify(saveData)
}).then(res => {
this.isSubmit = false;
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
setTimeout(() => {
this.backFn();
}, 500);
this.resetFn();
}
});
},
backFn() {
this.$util.redirectTo('/pages/stock/allocate');
},
calcTotalData() {//计算商品种类、金额
this.totalData.kindsNum = 0;
this.totalData.price = 0;
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
this.totalData.price += parseFloat(item.cost_price || 0) * parseFloat(item.goods_num || 1);
}
})
this.totalData.kindsNum = this.goodsIdArr.length;
},
resetFn() {
this.goodsIdArr = [];
this.goodsShow = false;
this.totalData.kindsNum = 0;
this.totalData.price = 0;
},
remarkConfirm() {
this.screen.remark = JSON.parse(JSON.stringify(this.remark))
this.$refs.remarkPopup.close()
}
}
};

View File

@@ -0,0 +1,235 @@
import {
getInventoryNo,
getInventoryDetailInEdit,
getSkuListForStock,
editInventory,
addInventory
} from '@/api/stock.js';
export default {
data() {
return {
params: {
search_text: '', //产品名称
},
goodsList: [],
goodsIdArr: [],
goodsShow: false,
totalData: {
kindsNum: 0,
upNum: 0,
downNum: 0,
sameNum: 0
},
screen: {
inventory_id: '',
inventory_no: "",
remark: "",
stock_json: "",
time: ""
},
remark: '',
isSubmit: false,
inputIndex: -1,
dialogVisible: false,
info: null
};
},
onLoad(option) {
this.screen.inventory_id = option.inventory_id || '';
this.screen.time = this.$util.timeFormat(Date.parse(new Date()) / 1000);
if (this.screen.inventory_id) {
this.getEditData();
} else {
this.getDocumentNo()
}
},
watch: {
goodsIdArr(data) {
this.calcTotalData();
},
},
methods: {
getDocumentNo() {//获取单据号
getInventoryNo().then(res => {
if (res.code >= 0) {
this.screen.inventory_no = res.data
} else {
this.$util.showToast({
title: res.message
});
}
});
},
getEditData() {
getInventoryDetailInEdit(this.screen.inventory_id).then(res => {
if (res.code >= 0 && res.data) {
this.info = res.data;
this.screen.inventory_no = this.info.inventory_no
this.screen.time = this.$util.timeFormat(this.info.action_time)
this.remark = JSON.parse(JSON.stringify(this.info.remark))
for (let sku_id in this.info.goods_list) {
this.info.goods_list[sku_id].title = this.info.goods_list[sku_id].sku_name
this.goodsIdArr.push(parseInt(sku_id));
this.goodsList.push(this.info.goods_list[sku_id]);
}
}
});
},
getGoodsData({
detail
}, index) { //input回车处理
this.inputIndex = index
if (detail && detail.value) {
getSkuListForStock({
search: detail ? detail.value : ''
}).then(res => {
if (res.code >= 0 && res.data.length == 1) {
this.selectGoods(res.data)
} else if (res.code >= 0) {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
} else {
this.$util.showToast({
title: res.message
});
}
});
} else {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
}
},
selectGoods(data) { //选择数据
data.forEach((el, index) => {
el.goods_num = 1;
el.goods_price = 0;
el.title = el.sku_name + ''
//点击或回车行为选择商品后当为第一行并且展示列表不存在选择的商品push到展示列表或者不为第一行并且展示列表中不存在时选择的商品除第一条全部push到展示列表
if (!this.goodsIdArr.includes(el.sku_id)) {
console.log(111);
this.goodsIdArr.push(el.sku_id);
this.goodsList.push(el);
} else {//只要展示列表存在直接累加
var elIndex = this.goodsIdArr.indexOf(el.sku_id)
if(this.params.search_text){
this.goodsList[elIndex].goods_num = parseFloat(this.goodsList[elIndex].goods_num) + 1
}
}
})
this.goodsShow = false;
this.params.search_text = '';
this.$forceUpdate();
},
delGoods(id) {
this.goodsList.splice(this.goodsIdArr.indexOf(id), 1);
this.goodsIdArr.splice(this.goodsIdArr.indexOf(id), 1);
},
stockOutFn() {
if (!this.screen.inventory_no) {
this.$util.showToast({
title: "请输入盘点单号"
});
return false;
}
if (!this.screen.time) {
this.$util.showToast({
title: "请选择盘点时间"
});
return false;
}
if (!this.goodsIdArr.length) {
this.$util.showToast({
title: "请选择盘点数据"
});
return false;
}
if (this.globalStoreInfo.stock_config && this.globalStoreInfo.stock_config.is_audit == 1) {
this.$refs.tipsPop.open();
} else {
this.save();
}
},
save() {
// 检测库存是否填写,且提取数据
let isStock = false;
let saveData = [];
try {
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
if (!parseFloat(item.goods_num || 0)) {
isStock = true;
let toast = "请输入" + item.sku_name + "的盘点数量";
this.$util.showToast({
title: toast
});
throw new Error('end');
}
var obj = {};
obj.goods_num = item.goods_num;
obj.goods_sku_id = item.sku_id;
saveData.push(obj);
}
})
} catch (e) {
if (e.message != "end") throw e;
}
if (isStock) return false;
if (this.isSubmit) return false;
this.isSubmit = true;
this.screen.stock_json = JSON.stringify(saveData)
let save = this.screen.inventory_id ? editInventory : addInventory
save(this.screen).then(res => {
this.isSubmit = false;
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
if (this.$refs.tipsPop) this.$refs.tipsPop.close();
setTimeout(() => {
this.backFn();
}, 500);
this.resetFn();
}
});
},
backFn() {
this.$util.redirectTo('/pages/stock/check');
},
calcTotalData() {//计算商品总数、盘盈、盘亏等
this.totalData.kindsNum = 0;
this.totalData.upNum = 0;
this.totalData.downNum = 0;
this.totalData.sameNum = 0;
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id) && item.goods_num) {
if ((item.goods_num - item.stock) == 0) {
this.totalData.sameNum++;
} else if ((item.goods_num - item.stock) > 0) {
this.totalData.upNum++;
} else if ((item.goods_num - item.stock) < 0) {
this.totalData.downNum++;
}
}
})
this.totalData.kindsNum = this.goodsIdArr.length;
},
resetFn() {
this.goodsIdArr = [];
this.goodsShow = false;
this.totalData.kindsNum = 0;
this.totalData.countNum = 0;
this.totalData.price = 0;
},
changeTime(data) {
this.screen.time = data;
},
remarkConfirm() {
this.screen.remark = JSON.parse(JSON.stringify(this.remark))
this.$refs.remarkPopup.close()
}
}
};

View File

@@ -0,0 +1,224 @@
import {
getStorageDocumentNo,
getStorageDetailInEdit,
getSkuListForStock,
editStorage
} from '@/api/stock.js';
export default {
data() {
return {
params: {
search_text: '', //产品名称
},
goodsList: [], //已选择数据
goodsIdArr: [], //已选择数据id
goodsShow: false,
totalData: {
kindsNum: 0,
price: 0
},
screen: {
document_id: "",
document_no: "",
remark: "",
stock_json: "",
time: ""
},
remark: '',
isSubmit: false, //提交防抖
info: null, //详情原始数据
dialogVisible: false, //弹框
inputIndex: -1
};
},
onLoad(option) {
this.screen.document_id = option.document_id || '';
this.screen.time = this.$util.timeFormat(Date.parse(new Date()) / 1000);
if (this.screen.document_id) {
this.getEditData();
} else {
this.getDocumentNo()
}
},
watch: {
goodsIdArr(data) {
this.calcTotalData();
},
},
methods: {
getDocumentNo() {//获取单据号
getStorageDocumentNo().then(res => {
if (res.code >= 0) {
this.screen.document_no = res.data
} else {
this.$util.showToast({
title: res.message
});
}
});
},
getEditData() { //编辑时获取详情
getStorageDetailInEdit(this.screen.document_id).then(res => {
if (res.code >= 0 && res.data) {
this.info = res.data;
this.screen.document_no = this.info.document_no
this.screen.time = this.$util.timeFormat(this.info.time)
this.remark = JSON.parse(JSON.stringify(this.info.remark))
this.screen.remark = this.info.remark
for (let sku_id in this.info.goods_list) {
this.info.goods_list[sku_id].title = this.info.goods_list[sku_id].sku_name
this.goodsIdArr.push(parseInt(sku_id));
this.goodsList.push(this.info.goods_list[sku_id]);
}
}
});
},
getGoodsData({
detail
}, index) { //input回车处理
this.inputIndex = index
this.params.search_text = detail ? detail.value : ''
if (detail&&detail.value) {
getSkuListForStock({
search: detail ? detail.value : ''
}).then(res => {
if (res.code >= 0 && res.data.length == 1) {
this.selectGoods(res.data)
} else if (res.code >= 0) {
this.dialogVisible = true
} else {
this.$util.showToast({
title: res.message
});
}
});
} else {
this.dialogVisible = true
}
},
selectGoods(data) { //选择数据
data.forEach((el, index) => {
el.goods_num = 1;
el.goods_price = 0;
el.title = el.sku_name + ''
//点击或回车行为选择商品后当为第一行并且展示列表不存在选择的商品push到展示列表或者不为第一行并且展示列表中不存在时选择的商品除第一条全部push到展示列表
if (!this.goodsIdArr.includes(el.sku_id)) {
console.log(111);
this.goodsIdArr.push(el.sku_id);
this.goodsList.push(el);
} else {//只要展示列表存在直接累加
var elIndex = this.goodsIdArr.indexOf(el.sku_id)
if(this.params.search_text){
this.goodsList[elIndex].goods_num = parseFloat(this.goodsList[elIndex].goods_num) + 1
}
}
})
this.goodsShow = false;
this.params.search_text = '';
this.$forceUpdate();
},
delGoods(id) {//删除已选择的商品
this.goodsList.splice(this.goodsIdArr.indexOf(id), 1);
this.goodsIdArr.splice(this.goodsIdArr.indexOf(id), 1);
},
stockOutFn() {
if (!this.screen.document_no) {
this.$util.showToast({
title: "请输入入库单号"
});
return false;
}
if (!this.screen.time) {
this.$util.showToast({
title: "请选择入库时间"
});
return false;
}
if (!this.goodsIdArr.length) {
this.$util.showToast({
title: "请选择入库数据"
});
return false;
}
if (this.globalStoreInfo.stock_config && this.globalStoreInfo.stock_config.is_audit == 1) {
this.$refs.tipsPop.open();
} else {
this.save();
}
},
save() {
// 检测库存是否填写,且提取数据
let isStock = false;
let saveData = [];
try {
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
if (!parseFloat(item.goods_num || 0)) {
isStock = true;
let toast = "请输入" + item.sku_name + "的入库数量";
this.$util.showToast({
title: toast
});
throw new Error('end');
}
var obj = {};
obj.goods_num = item.goods_num;
obj.goods_price = item.goods_price;
obj.goods_sku_id = item.sku_id;
saveData.push(obj);
}
})
} catch (e) {
if (e.message != "end") throw e;
}
if (isStock) return false;
if (this.isSubmit) return false;
this.isSubmit = true;
this.screen.stock_json = JSON.stringify(saveData)
editStorage(this.screen).then(res => {
this.isSubmit = false;
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
if (this.$refs.tipsPop) this.$refs.tipsPop.close();
setTimeout(() => {
this.backFn();
}, 500);
this.resetFn();
}
});
},
backFn() {
this.$util.redirectTo('/pages/stock/storage');
},
calcTotalData() {//计算商品种类、金额
this.totalData.price = 0;
this.totalData.kindsNum = 0;
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
this.totalData.price += parseFloat(item.goods_price ?? 0) * parseFloat(item.goods_num ||
1);
}
})
this.totalData.kindsNum = this.goodsIdArr.length;
},
resetFn() {
this.goodsIdArr = [];
this.goodsShow = false;
this.totalData.kindsNum = 0;
this.totalData.price = 0;
},
changeTime(data) {//设置时间
this.screen.time = data;
},
remarkConfirm() {//设置备注
this.screen.remark = JSON.parse(JSON.stringify(this.remark))
this.$refs.remarkPopup.close()
}
}
};

View File

@@ -0,0 +1,217 @@
import {
getWastageDocumentNo,
getWastageDetailInEdit,
getSkuListForStock,
editWastage
} from '@/api/stock.js';
export default {
data() {
return {
params: {
search_text: '', //产品名称
},
goodsList: [], //已选择数据
goodsIdArr: [], //已选择数据id
goodsShow: false,
totalData: {
kindsNum: 0,
price: 0
},
screen: {
document_id: "",
document_no: "",
remark: "",
stock_json: "",
time: ""
},
remark: '',
isSubmit: false, //提交防抖
info: null, //详情原始数据
dialogVisible: false, //弹框
inputIndex: -1
};
},
onLoad(option) {
this.screen.document_id = option.document_id || 0;
this.screen.time = this.$util.timeFormat(Date.parse(new Date()) / 1000);
if (this.screen.document_id) {
this.getEditData();
} else {
this.getDocumentNo()
}
},
watch: {
goodsIdArr(data) {
this.calcTotalData();
},
},
methods: {
getDocumentNo() {//获取单据号
getWastageDocumentNo().then(res => {
if (res.code >= 0) {
this.screen.document_no = res.data
} else {
this.$util.showToast({
title: res.message
});
}
});
},
getEditData() {//编辑时获取详情
getWastageDetailInEdit(this.screen.document_id).then(res => {
if (res.code >= 0 && res.data) {
this.info = res.data;
this.screen.document_no = this.info.document_no
this.screen.time = this.$util.timeFormat(this.info.time)
this.remark = JSON.parse(JSON.stringify(this.info.remark))
this.screen.remark = this.info.remark
for (let sku_id in this.info.goods_list) {
this.info.goods_list[sku_id].title = this.info.goods_list[sku_id].sku_name
this.goodsIdArr.push(parseInt(sku_id));
this.goodsList.push(this.info.goods_list[sku_id]);
}
}
});
},
getGoodsData({
detail
}, index) { //input回车处理
this.inputIndex = index
if (detail && detail.value) {
getSkuListForStock({
search: detail ? detail.value : ''
}).then(res => {
if (res.code >= 0 && res.data.length == 1) {
this.selectGoods(res.data)
} else if (res.code >= 0) {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
} else {
this.$util.showToast({
title: res.message
});
}
});
} else {
this.params.search_text = detail ? detail.value : ''
this.dialogVisible = true
}
},
selectGoods(data) { //选择数据
data.forEach((el, index) => {
el.goods_num = 1;
el.goods_price = 0;
el.title = el.sku_name + ''
//点击或回车行为选择商品后当为第一行并且展示列表不存在选择的商品push到展示列表或者不为第一行并且展示列表中不存在时选择的商品除第一条全部push到展示列表
if (!this.goodsIdArr.includes(el.sku_id)) {
console.log(111);
this.goodsIdArr.push(el.sku_id);
this.goodsList.push(el);
} else {//只要展示列表存在直接累加
var elIndex = this.goodsIdArr.indexOf(el.sku_id)
if(this.params.search_text){
this.goodsList[elIndex].goods_num = parseFloat(this.goodsList[elIndex].goods_num) + 1
}
}
})
this.goodsShow = false;
this.params.search_text = '';
this.$forceUpdate();
},
delGoods(id) {//删除已选择的商品
this.goodsList.splice(this.goodsIdArr.indexOf(id), 1);
this.goodsIdArr.splice(this.goodsIdArr.indexOf(id), 1);
},
stockOutFn() {
if (!this.screen.document_no) {
this.$util.showToast({
title: "请输入出库单号"
});
return false;
}
if (!this.goodsIdArr.length) {
this.$util.showToast({
title: "请选择出库数据"
});
return false;
}
if (this.globalStoreInfo.stock_config && this.globalStoreInfo.stock_config.is_audit == 1) {
this.$refs.tipsPop.open();
} else {
this.save();
}
},
save() {
// 检测库存是否填写,且提取数据
let isStock = false;
let saveData = [];
try {
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
if (!parseFloat(item.goods_num || 0)) {
isStock = true;
let toast = "请输入" + item.sku_name + "的出库数量";
this.$util.showToast({
title: toast
});
throw new Error('end');
}
var obj = {};
obj.goods_num = item.goods_num;
obj.goods_price = item.cost_price;
obj.goods_sku_id = item.sku_id;
saveData.push(obj);
}
})
} catch (e) {
if (e.message != "end") throw e;
}
if (isStock) return false;
if (this.isSubmit) return false;
this.isSubmit = true;
this.screen.stock_json = JSON.stringify(saveData)
editWastage(this.screen).then(res => {
this.isSubmit = false;
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
if (this.$refs.tipsPop) this.$refs.tipsPop.close();
setTimeout(() => {
this.backFn();
}, 500);
this.resetFn();
}
});
},
backFn() {
this.$util.redirectTo('/pages/stock/wastage');
},
calcTotalData() {//计算商品种类、金额
this.totalData.price = 0;
this.totalData.kindsNum = 0;
this.goodsList.forEach((item, index) => {
if (this.goodsIdArr.includes(item.sku_id)) {
this.totalData.price += parseFloat(item.cost_price ?? 0) * parseFloat(item.goods_num || 1);
}
})
this.totalData.kindsNum = this.goodsIdArr.length;
},
resetFn() {
this.goodsIdArr = [];
this.goodsShow = false;
this.totalData.kindsNum = 0;
this.totalData.price = 0;
},
changeTime(data) {
this.screen.time = data;
},
remarkConfirm() {
this.screen.remark = JSON.parse(JSON.stringify(this.remark))
this.$refs.remarkPopup.close()
}
}
}

View File

@@ -0,0 +1,222 @@
<template>
<base-page>
<view class="manage">
<view class="screen-warp common-form">
<view class="common-form-item">
<view class="form-inline">
<label class="form-label">业务类型</label>
<view class="form-input-inline">
<picker mode="selector" :range="classifyData.data" @change="pickerChange">
<view class="form-input">
{{ classifyData.currIndex === '' ? '请选择业务类型' : classifyData.data[classifyData.currIndex] }}
</view>
</picker>
</view>
</view>
</view>
<view class="common-form-item">
<view class="form-inline">
<label class="form-label">时间</label>
<view class="form-input-inline">
<picker mode="date" @change="startChange">
<view class="form-input">
{{ !searchData.start_time ? '请输入开始时间' : searchData.start_time }}
</view>
</picker>
</view>
<text class="form-mid">-</text>
<view class="form-input-inline">
<picker mode="date" @change="endChange">
<view class="form-input">{{ !searchData.end_time ? '请输入结束时间' : searchData.end_time }}</view>
</picker>
</view>
</view>
</view>
<view class="common-btn-wrap">
<button type="default" class="screen-btn" @click="searchFn()">筛选</button>
<button type="default" @click="resetFn()">重置</button>
</view>
</view>
<view class="manage-table">
<uni-table ref="table" :loading="table.loading" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="100" align="left">时间</uni-th>
<uni-th width="100" align="center">商品信息</uni-th>
<uni-th width="100" align="center">操作人</uni-th>
<uni-th width="100" align="center">业务类型</uni-th>
<uni-th width="100" align="center">原库存</uni-th>
<uni-th width="100" align="center">库存变化</uni-th>
<uni-th width="100" align="center">现库存</uni-th>
<uni-th width="100" align="center">备注</uni-th>
<uni-th width="50" align="right">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in table.data">
<uni-td align="left">{{ $util.timeFormat(item.create_time) }}</uni-td>
<uni-td align="center">{{ item.goods_sku_name }}</uni-td>
<uni-td align="center">{{ item.operater_name }}</uni-td>
<uni-td align="center">{{ item.name }}</uni-td>
<uni-td align="center">{{ item.before_store_stock }}</uni-td>
<uni-td align="center">{{ (item.type == 'input' ? '+' : '-') + item.goods_num }}</uni-td>
<uni-td align="center">{{ item.after_store_stock }}</uni-td>
<uni-td align="center">{{ item.remark }}</uni-td>
<uni-td align="right">
<view class="action-btn">
<text @click="toDetail(item)">查看</text>
</view>
</uni-td>
</uni-tr>
</uni-table>
<view class="paging-wrap">
<uni-pagination show-icon :page-size="paging.pageSize" :current="paging.pageCurrent" :total="paging.total" @change="paginChange" />
</view>
</view>
</view>
</base-page>
</template>
<script>
import {
getDocumentType,
getStockGoodsRecords
} from '@/api/stock.js';
export default {
data() {
return {
classifyData: {
data: [],
idArr: [],
currIndex: ''
},
table: {
loading: false, //表格加载动画
data: []
},
paging: {
pageSize: 9, // 每页数据量
pageCurrent: 1, // 当前页
total: 0 // 数据总量
},
searchData: {
type: '',
start_time: '',
end_time: ''
}
};
},
onLoad(option) {
this.DocumentType();
},
onShow() {
this.getTableData();
},
methods: {
searchFn() {
this.table.loading = true;
this.paging.pageCurrent = 1;
this.getTableData(this.searchData);
},
resetFn() {
this.table.loading = true;
this.paging.pageCurrent = 1;
this.classifyData.currIndex = '';
this.searchData.type = '';
this.searchData.start_time = '';
this.searchData.end_time = '';
this.getTableData(this.searchData);
},
getTableData(obj = {}) {
let data = {
page_size: this.paging.pageSize,
page: this.paging.pageCurrent
};
Object.assign(data, obj);
getStockGoodsRecords(data).then(res => {
this.table.loading = false;
if (res.code == 0) {
this.table.data = res.data.list;
this.$forceUpdate();
} else {
this.$util.showToast({
title: res.message
});
}
this.paging.total = res.data.count;
})
},
DocumentType() {
getDocumentType().then(res => {
let data = res.data;
if (res.code == 0 && data.length) {
data.forEach((item, index) => {
this.classifyData.data.push(item.name);
this.classifyData.idArr.push(item.key);
});
this.$forceUpdate();
}
})
},
pickerChange(e) {
let index = e.detail.value;
this.classifyData.currIndex = index;
this.searchData.type = this.classifyData.idArr[index];
},
// 切换分页
paginChange(e) {
this.table.loading = true;
this.paging.pageCurrent = e.current;
this.getTableData();
},
startChange(e) {
this.searchData.start_time = e.detail.value;
},
endChange(e) {
let start_time = this.$util.timeTurnTimeStamp(this.searchData.start_time),
end_time = this.$util.timeTurnTimeStamp(e.detail.value);
if (end_time <= start_time) {
this.$util.showToast({
title: '结束时间不能小于开始时间'
});
return false;
}
this.searchData.end_time = e.detail.value;
},
toDetail(data) {
let url = data.type == 'input' ? '/pages/stock/storage' : '/pages/stock/wastage';
this.$util.redirectTo(url, {
id: data.document_no
});
}
}
};
</script>
<style lang="scss" scoped>
.manage {
background-color: #fff;
padding: 0.15rem;
@extend %body-overhide;
}
// 筛选面板
.screen-warp {
padding: 0.15rem;
background-color: #f2f3f5;
margin-bottom: 0.15rem;
}
.paging-wrap {
margin-top: 0.1rem;
}
// 表格详情
.manage-table {
.action-btn {
text {
color: $primary-color;
}
}
}
</style>

View File

@@ -0,0 +1,133 @@
<template>
<base-page>
<view class="stock-body">
<view class="content-wrap" @click="goodsShow = false">
<view class="title">{{ screen.document_id ? '编辑入库单' : '添加入库单' }}</view>
<view class="screen-warp form-content">
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
入库单号
</label>
<view class="form-inline input">
<input type="text" v-model="screen.document_no" :disabled="screen.document_id != ''" placeholder="请输入入库单号" />
</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
入库时间
</label>
<view class="form-inline">
<uni-datetime-picker v-model="screen.time" type="timestamp" :clearIcon="false" @change="changeTime" />
</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前门店</view>
<view class="form-inline">{{ globalStoreInfo.store_name }}</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前操作人</view>
<view class="form-inline">{{ userInfo ? userInfo.username : '' }}</view>
</view>
</view>
<view class="tips text-color" v-if="globalStoreInfo.stock_config && globalStoreInfo.stock_config.is_audit == 1">
说明待审核状态下只有经办人允许修改只有变为已审核状态后才会使库存发生变化已审核状态的单据不允许再修改</view>
<view class="table-wrap">
<view class="table-head">
<view class="table-tr">
<view class="table-th" style="flex: 3;">产品名称/规格/编码</view>
<view class="table-th" style="flex: 1;">当前库存</view>
<view class="table-th" style="flex: 1;">单位</view>
<view class="table-th" style="flex: 2;">成本价</view>
<view class="table-th" style="flex: 2;">数量</view>
<view class="table-th" style="flex: 1;">总金额</view>
<view class="table-th" style="flex: 1;">操作</view>
</view>
</view>
<view class="table-body">
<view class="table-tr">
<view class="table-td select-goods-input" style="flex: 3;" @click.stop="goodsShow = true">
<input type="text" @confirm="getGoodsData($event, -1)" placeholder="请输入产品名称/规格/编码" v-model="params.search_text" />
<text class="iconfont icontuodong" @click="getGoodsData({ detail: null }, -1)"></text>
</view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
</view>
<block v-for="(item, index) in goodsList" :key="index">
<view class="table-tr" v-if="goodsIdArr.includes(item.sku_id)">
<view class="table-td goods-name" style="flex: 3;">{{ item.title }}</view>
<view class="table-td" style="flex: 1;">{{ item.real_stock || 0 }}</view>
<view class="table-td" style="flex: 1;">{{ item.unit || '件' }}</view>
<view class="table-td" style="flex: 2;">
<input type="number" v-model="item.goods_price" placeholder="请输入成本价" @input="calcTotalData" />
</view>
<view class="table-td" style="flex: 2;">
<input type="number" v-model="item.goods_num" placeholder="请输入数量" @input="calcTotalData" />
</view>
<view class="table-td" style="flex: 1;">
{{ (item.goods_num * item.goods_price || 0).toFixed(2) }}
</view>
<view class="table-td" style="flex: 1;">
<button type="default" class="delete" @click="delGoods(item.sku_id)">删除</button>
</view>
</view>
</block>
<view class="table-tr table-empty" v-if="!goodsIdArr.length">暂无数据请选择商品数据</view>
</view>
</view>
</view>
<view class="action-wrap">
<view class="table-total">合计{{ totalData.kindsNum }} 种产品合计金额{{ totalData.price.toFixed(2) }}</view>
<view class="btn-wrap">
<button type="default" class="remark default" @click="$refs.remarkPopup.open()">备注</button>
<button type="default" class="stockout-btn" @click="stockOutFn" :loading="isSubmit">入库</button>
<button type="default" class="default" @click="backFn">返回</button>
</view>
</view>
</view>
<stock-goods-dialog v-model="dialogVisible" :params="params" @selectGoods="selectGoods" />
<uni-popup ref="tipsPop" type="center">
<view class="confirm-pop">
<view class="title">单据保存后将处于"待审核"状态只有经办人可以编辑或删除等操作是否确认保存</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="$refs.tipsPop.close()">取消</button>
<button type="primary" class="primary-btn btn" @click="save">确定</button>
</view>
</view>
</uni-popup>
<uni-popup ref="remarkPopup" type="center">
<view class="remark-wrap">
<view class="header">
<text class="title">备注</text>
<text class="iconfont iconguanbi1" @click="$refs.remarkPopup.close()"></text>
</view>
<view class="body">
<textarea v-model="remark" placeholder="填写备注信息" placeholder-class="placeholder-class" />
</view>
<view class="footer">
<button type="default" class="primary-btn" @click="remarkConfirm">确认</button>
</view>
</view>
</uni-popup>
</base-page>
</template>
<script>
import stockin from "./public/js/stockin"
import stockGoodsDialog from '@/components/stock-goods-dialog/stock-goods-dialog.vue';
export default {
components: {
stockGoodsDialog
},
mixins: [stockin]
};
</script>
<style lang="scss" scoped>
@import './public/css/editStock.scss';
</style>

View File

@@ -0,0 +1,126 @@
<template>
<base-page>
<view class="stock-body">
<view class="content-wrap" @click="goodsShow = false">
<view class="title">{{ screen.document_id ? '编辑出库单' : '添加出库单' }}</view>
<view class="screen-warp form-content">
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
出库单号
</label>
<view class="form-inline input">
<input type="text" v-model="screen.document_no" :disabled="screen.document_id != ''" placeholder="请输入出库单号" />
</view>
</view>
<view class="form-item">
<label class="form-label">
<text class="required">*</text>
出库时间
</label>
<view class="form-inline">
<uni-datetime-picker v-model="screen.time" type="timestamp" :clearIcon="false" @change="changeTime" />
</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前门店</view>
<view class="form-inline">{{ globalStoreInfo.store_name }}</view>
</view>
<view class="form-item store-info">
<view class="form-label">当前操作人</view>
<view class="form-inline">{{ userInfo ? userInfo.username : '' }}</view>
</view>
</view>
<view class="tips text-color" v-if="globalStoreInfo.stock_config && globalStoreInfo.stock_config.is_audit == 1">说明待审核状态下只有经办人允许修改只有变为已审核状态后才会使库存发生变化已审核状态的单据不允许再修改</view>
<view class="table-wrap">
<view class="table-head">
<view class="table-tr">
<view class="table-th" style="flex: 3;">产品名称/规格/编码</view>
<view class="table-th" style="flex: 1;">当前库存</view>
<view class="table-th" style="flex: 1;">单位</view>
<view class="table-th" style="flex: 1;">成本</view>
<view class="table-th" style="flex: 2;">数量</view>
<view class="table-th" style="flex: 1;">操作</view>
</view>
</view>
<view class="table-body">
<view class="table-tr">
<view class="table-td select-goods-input" style="flex: 3;" @click.stop="goodsShow = true">
<input type="text" @confirm="getGoodsData($event, -1)" placeholder="请输入产品名称/规格/编码" v-model="params.search_text" />
<text class="iconfont icontuodong" @click="getGoodsData({ detail: null }, -1)"></text>
</view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 1;"></view>
<view class="table-td" style="flex: 2;"></view>
<view class="table-td" style="flex: 1;"></view>
</view>
<block v-for="(item, index) in goodsList" :key="index">
<view class="table-tr" v-if="goodsIdArr.includes(item.sku_id)">
<view class="table-td goods-name" style="flex: 3;">{{ item.title }}</view>
<view class="table-td" style="flex: 1;">{{ item.real_stock || 0 }}</view>
<view class="table-td" style="flex: 1;">{{ item.unit || '件' }}</view>
<view class="table-td" style="flex: 1;">{{ item.cost_price || '0.00' }}</view>
<view class="table-td" style="flex: 2;">
<input type="number" v-model="item.goods_num" placeholder="请输入数量" @input="calcTotalData" />
</view>
<view class="table-td" style="flex: 1;">
<button type="default" class="delete" @click="delGoods(item.sku_id)">删除</button>
</view>
</view>
</block>
<view class="table-tr table-empty" v-if="!goodsIdArr.length">暂无数据请选择商品数据</view>
</view>
</view>
</view>
<view class="action-wrap">
<view class="table-total">合计{{ totalData.kindsNum }}种产品合计金额{{ totalData.price.toFixed(2) }}</view>
<view class="btn-wrap">
<button type="default" class="remark default" @click="$refs.remarkPopup.open()">备注</button>
<button type="default" class="stockout-btn" @click="stockOutFn" :loading="isSubmit">出库</button>
<button type="default" class="default" @click="backFn">返回</button>
</view>
</view>
</view>
<stock-goods-dialog v-model="dialogVisible" :params="params" @selectGoods="selectGoods" />
<uni-popup ref="tipsPop" type="center">
<view class="confirm-pop">
<view class="title">单据保存后将处于"待审核"状态只有经办人可以编辑或删除等操作是否确认保存</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="$refs.tipsPop.close()">取消</button>
<button type="primary" class="primary-btn btn" @click="save">确定</button>
</view>
</view>
</uni-popup>
<uni-popup ref="remarkPopup" type="center">
<view class="remark-wrap">
<view class="header">
<text class="title">备注</text>
<text class="iconfont iconguanbi1" @click="$refs.remarkPopup.close()"></text>
</view>
<view class="body">
<textarea v-model="remark" placeholder="填写备注信息" placeholder-class="placeholder-class" />
</view>
<view class="footer">
<button type="default" class="primary-btn" @click="remarkConfirm">确认</button>
</view>
</view>
</uni-popup>
</base-page>
</template>
<script>
import stockout from "./public/js/stockout";
import stockGoodsDialog from '@/components/stock-goods-dialog/stock-goods-dialog.vue';
export default {
components: {
stockGoodsDialog
},
mixins: [stockout]
}
</script>
<style lang="scss" scoped>
@import './public/css/editStock.scss';
</style>

View File

@@ -0,0 +1,354 @@
<template>
<base-page>
<view class="goodslist">
<view class="goodslist-box">
<view class="goodslist-left">
<view class="goods-title">
入库单查询
<text class="iconfont icongengduo1"></text>
</view>
<view class="goods-search">
<view class="search">
<text class="iconfont icon31sousuo"></text>
<input type="text" v-model="search_text" @input="search" placeholder="搜索入库单号" />
</view>
</view>
<scroll-view scroll-y="true" class="goods-list-scroll" :show-scrollbar="false" @scrolltolower="getListData">
<view class="item" @click="getDetailData(item.document_id, index)" v-for="(item, index) in list" :key="index" :class="{ itemhover: selectGoodsKeys == index }">
<view class="title">
<view>{{ item.document_no }}</view>
<view>{{ item.type_name }}</view>
</view>
<view class="other-info">
<view>{{ item.document_money }}</view>
<view>{{ item.operater_name }}</view>
<view>{{ item.status_name }}</view>
<view>{{ $util.timeFormat(item.create_time) }}</view>
</view>
</view>
<view class="notYet" v-if="!one_judge && !list.length">暂无数据</view>
</scroll-view>
<view class="add-wastage">
<button type="default" class="primary-btn" v-if="globalStoreInfo.stock_type == 'store'" @click="add()">添加入库单</button>
</view>
</view>
<view class="goodslist-right">
<view class="goods-title">入库单详情</view>
<view class="order-information" v-if="Object.keys(detail).length">
<view class="order-status">基本信息</view>
<view class="order-types">
<view class="type type1">
<view>入库单号</view>
<view>{{ detail.document_no }}</view>
</view>
<view class="type type1">
<view>制单人</view>
<view>{{ detail.operater_name || '--' }}</view>
</view>
<view class="type type1">
<view>制单时间</view>
<view class="message">{{ detail.create_time }}</view>
</view>
<view class="type type1">
<view>入库时间</view>
<view class="message">{{ detail.time }}</view>
</view>
<view class="type type1">
<view>单据类型</view>
<view class="message">{{ detail.type_name }}</view>
</view>
<view class="type type1">
<view>状态</view>
<view class="message">{{ detail.status_data.name }}</view>
</view>
<view class="type type1" v-if="detail.verifier_name">
<view>审核人</view>
<view class="message">{{ detail.verifier_name }}</view>
</view>
<view class="type type1" v-if="detail.audit_time">
<view>审核时间</view>
<view class="message">{{ detail.audit_time }}</view>
</view>
<view class="type type1" v-if="detail.status == -1">
<view>拒绝理由</view>
<view class="message">{{ detail.refuse_reason }}</view>
</view>
<view class="type type1">
<view>备注</view>
<view class="message">{{ detail.remark }}</view>
</view>
</view>
<view class="goods-info">
<view class="title">商品明细</view>
<view class="table">
<view class="table-th table-all">
<view class="table-td" style="width:45%;justify-content: flex-start;">商品名称/规格/条形码
</view>
<view class="table-td" style="width:15%">单位</view>
<view class="table-td" style="width:10%">数量</view>
<view class="table-td" style="width:15%">成本价()</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">金额()</view>
</view>
<view class="table-tr table-all" v-for="(item, index) in detail.goods_sku_list_array" :key="index">
<view class="table-td table-goods-name" style="width:45%;justify-content: flex-start;">
<image :src="$util.img(item.goods_sku_img)" mode="aspectFill" />
<text class="multi-hidden">{{ item.goods_sku_name }}</text>
</view>
<view class="table-td" style="width:15%">{{ item.goods_unit || '件' }}</view>
<view class="table-td" style="width:10%">{{ item.goods_num }}</view>
<view class="table-td" style="width:15%">{{ item.goods_price }}</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">{{ parseFloat(item.goods_sum).toFixed(2) }}</view>
</view>
</view>
<view class="total-money-num">
<view class="box">
<view>商品种类</view>
<view class="money">{{ detail.goods_count }}</view>
</view>
<view class="box">
<view>商品数量</view>
<view class="money">{{ detail.goods_price }}{{ detail.goods_unit }}</view>
</view>
<view class="box total">
<view>合计金额</view>
<view class="money">{{ parseFloat(detail.goods_total_price).toFixed(2) }}</view>
</view>
</view>
<view class="action-box">
<!-- 只有经办人才能操作入库单 -->
<template v-if="(detail.status == 1 || detail.status == -1) && detail.operater == detail.uid">
<button type="primary" class="default-btn" @click="open('deleteWastagePop')">删除</button>
<button type="primary" class="default-btn" @click="edit">编辑</button>
</template>
<!-- 只有管理员和拥有单据审核权限的才能审核 -->
<template v-if="detail.status == 1 && detail.is_audit == 0">
<button type="primary" class="default-btn" @click="open('refuseWastagePop')">审核拒绝</button>
<button type="primary" class="primary-btn" @click="open('agreeWastagePop')">审核通过</button>
</template>
</view>
</view>
</view>
<block v-else-if="!one_judge && !Object.keys(detail).length">
<image class="cart-empty" src="@/static/goods/goods_empty.png" mode="widthFix" />
</block>
</view>
</view>
</view>
<!-- 同意 -->
<unipopup ref="agreeWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要通过该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('agreeWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="agree">确定</button>
</view>
</view>
</unipopup>
<!-- 拒绝 -->
<unipopup ref="refuseWastagePop" type="center">
<view class="confirm-pop message">
<view class="title">
拒绝理由
<text class="iconfont iconguanbi1" @click="close('refuseWastagePop')"></text>
</view>
<view class="textarea-box">
<textarea v-model="refuseReason" class="textarea" maxlength="200" placeholder="输入请不多于200字"></textarea>
</view>
<button @click="refuse" type="primary" class="primary-btn btn save">保存</button>
</view>
</unipopup>
<!-- 删除 -->
<unipopup ref="deleteWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要删除该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('deleteWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="deleteDocument">确定</button>
</view>
</view>
</unipopup>
</base-page>
</template>
<script>
import {
getStorageLists,
getStorageDetail,
storageAgree,
storageRefuse,
storageDelete
} from '@/api/stock.js';
import unipopup from '@/components/uni-popup/uni-popup.vue';
export default {
components: {
unipopup
},
data() {
return {
selectGoodsKeys: 0,
//获取订单的页数
page: 1,
//每次获取订单的条数
page_size: 9,
// 订单搜索是用到的数据
search_text: '',
//初始时加载详情数据判断
one_judge: true,
// 订单列表数据
list: [],
//订单详情数据
detail: {},
repeatFlag: false,
refuseReason: ''
};
},
onLoad(option) {
if (option.id) {
this.search_text = option.id;
}
this.getListData();
},
methods: {
// 搜索
search() {
this.page = 1;
this.list = [];
this.one_judge = true;
this.getListData();
},
/**
* 获取订单列表
*/
getListData() {
getStorageLists({
page: this.page,
page_size: this.page_size,
search_text: this.search_text
}).then(res => {
if (res.data.list.length == 0 && this.one_judge) {
this.detail = {};
this.one_judge = false;
}
if (res.code >= 0 && res.data.list.length != 0) {
this.page += 1;
if (this.list.length == 0) {
this.list = res.data.list;
} else {
this.list = this.list.concat(res.data.list);
}
//初始时加载一遍详情数据
if (this.one_judge) {
this.getDetailData(this.list[0].document_id);
}
}
});
},
/**
* 获取订单详情数据
*/
getDetailData(document_id, keys = 0) {
this.selectGoodsKeys = keys;
this.type = 'detail';
getStorageDetail(document_id).then(res => {
if (res.code >= 0) {
this.detail = res.data;
this.$forceUpdate();
this.one_judge = false;
}
});
},
add() {
this.$util.redirectTo('/pages/stock/stockin');
},
edit() {
this.$util.redirectTo('/pages/stock/stockin', {
document_id: this.detail.document_id
});
},
open(action) {
this.$refs[action].open();
},
close(name) {
this.$refs[name].close();
},
agree() {
if (this.repeatFlag) return;
this.repeatFlag = true;
storageAgree(this.detail.document_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.document_id);
this.close('agreeWastagePop');
}
this.repeatFlag = false;
});
},
refuse() {
if (!this.refuseReason) {
this.$util.showToast({
title: '请输入拒绝理由'
});
return;
}
if (this.repeatFlag) return;
this.repeatFlag = true;
storageRefuse({
document_id: this.detail.document_id,
refuse_reason: this.refuseReason
}).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.document_id);
this.close('refuseWastagePop');
}
this.repeatFlag = false;
});
},
deleteDocument() {
if (this.repeatFlag) return;
this.repeatFlag = true;
storageDelete(this.detail.document_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.list.splice(this.selectGoodsKeys, 1);
if (this.selectGoodsKeys == 0) {
this.selectGoodsKeys = 0;
} else {
this.selectGoodsKeys -= 1;
}
this.getDetailData(this.list[this.selectGoodsKeys].document_id, this.selectGoodsKeys);
this.close('deleteWastagePop');
}
this.repeatFlag = false;
});
}
}
};
</script>
<style scoped lang="scss">
@import './public/css/orderlist.scss';
</style>

View File

@@ -0,0 +1,356 @@
<template>
<base-page>
<view class="goodslist">
<view class="goodslist-box">
<view class="goodslist-left">
<view class="goods-title">
出库单查询
<text class="iconfont icongengduo1"></text>
</view>
<view class="goods-search">
<view class="search">
<text class="iconfont icon31sousuo"></text>
<input type="text" v-model="search_text" @input="search" placeholder="搜索出库单号" />
</view>
</view>
<scroll-view scroll-y="true" class="goods-list-scroll" :show-scrollbar="false" @scrolltolower="getListData">
<view class="item" @click="getDetailData(item.document_id, index)" v-for="(item, index) in list" :key="index" :class="{ itemhover: selectGoodsKeys == index }">
<view class="title">
<view>{{ item.document_no }}</view>
<view>{{ item.type_name }}</view>
</view>
<view class="other-info">
<view>{{ item.document_money }}</view>
<view>{{ item.operater_name }}</view>
<view>{{ item.status_name }}</view>
<view>{{ $util.timeFormat(item.create_time) }}</view>
</view>
</view>
<view class="notYet" v-if="!one_judge && !list.length">暂无数据</view>
</scroll-view>
<view class="add-wastage">
<button type="default" class="primary-btn" v-if="globalStoreInfo.stock_type == 'store'" @click="add()">添加出库单</button>
</view>
</view>
<view class="goodslist-right">
<view class="goods-title">出库单详情</view>
<view class="order-information" v-if="Object.keys(detail).length">
<view class="order-status">基本信息</view>
<view class="order-types">
<view class="type type1">
<view>出库单号</view>
<view>{{ detail.document_no }}</view>
</view>
<view class="type type1">
<view>制单人</view>
<view>{{ detail.operater_name || '--' }}</view>
</view>
<view class="type type1">
<view>制单时间</view>
<view class="message">{{ detail.create_time }}</view>
</view>
<view class="type type1">
<view>出库时间</view>
<view class="message">{{ detail.time }}</view>
</view>
<view class="type type1">
<view>单据类型</view>
<view class="message">{{ detail.type_name }}</view>
</view>
<view class="type type1">
<view>状态</view>
<view class="message">{{ detail.status_data.name }}</view>
</view>
<view class="type type1" v-if="detail.verifier_name">
<view>审核人</view>
<view class="message">{{ detail.verifier_name }}</view>
</view>
<view class="type type1" v-if="detail.audit_time">
<view>审核时间</view>
<view class="message">{{ detail.audit_time }}</view>
</view>
<view class="type type1" v-if="detail.status == -1">
<view>拒绝理由</view>
<view class="message">{{ detail.refuse_reason }}</view>
</view>
<view class="type type1">
<view>备注</view>
<view class="message">{{ detail.remark }}</view>
</view>
</view>
<view class="goods-info">
<view class="title">商品明细</view>
<view class="table">
<view class="table-th table-all">
<view class="table-td" style="width:45%;justify-content: flex-start;">商品名称/规格/条形码</view>
<view class="table-td" style="width:15%">单位</view>
<view class="table-td" style="width:10%">数量</view>
<view class="table-td" style="width:15%">成本价()</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">金额()</view>
</view>
<view class="table-tr table-all" v-for="(item, index) in detail.goods_sku_list_array" :key="index">
<view class="table-td table-goods-name" style="width:45%;justify-content: flex-start;">
<image :src="$util.img(item.goods_sku_img)" mode="aspectFill" />
<text class="multi-hidden">{{ item.goods_sku_name }}</text>
</view>
<view class="table-td" style="width:15%">{{ item.goods_unit || '件' }}</view>
<view class="table-td" style="width:10%">{{ item.goods_num }}</view>
<view class="table-td" style="width:15%">{{ item.goods_price }}</view>
<view class="table-td" style="width:15%;justify-content: flex-end;">
{{ parseFloat(item.goods_sum).toFixed(2) }}
</view>
</view>
</view>
<view class="total-money-num">
<view class="box">
<view>商品种类</view>
<view class="money">{{ detail.goods_count }}</view>
</view>
<view class="box">
<view>商品数量</view>
<view class="money">{{ detail.goods_price }}{{ detail.goods_unit }}</view>
</view>
<view class="box total">
<view>合计金额</view>
<view class="money">{{ parseFloat(detail.goods_total_price).toFixed(2) }}</view>
</view>
</view>
</view>
<view class="action-box">
<!-- 只有经办人才能操作入库单 -->
<template v-if="(detail.status == 1 || detail.status == -1) && detail.operater == detail.uid">
<button type="primary" class="default-btn" @click="open('deleteWastagePop')">删除</button>
<button type="primary" class="default-btn" @click="edit">编辑</button>
</template>
<!-- 只有管理员和拥有单据审核权限的才能审核 -->
<template v-if="detail.status == 1 && detail.is_audit == 0">
<button type="primary" class="default-btn" @click="open('refuseWastagePop')">审核拒绝</button>
<button type="primary" class="primary-btn" @click="open('agreeWastagePop')">审核通过</button>
</template>
</view>
</view>
<block v-else-if="!one_judge && !Object.keys(detail).length">
<image class="cart-empty" src="@/static/goods/goods_empty.png" mode="widthFix"/>
</block>
</view>
</view>
</view>
<!-- 同意 -->
<unipopup ref="agreeWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要通过该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('agreeWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="agree">确定</button>
</view>
</view>
</unipopup>
<!-- 拒绝 -->
<unipopup ref="refuseWastagePop" type="center">
<view class="confirm-pop message">
<view class="title">
拒绝理由
<text class="iconfont iconguanbi1" @click="close('refuseWastagePop')"></text>
</view>
<view class="textarea-box">
<textarea v-model="refuseReason" class="textarea" maxlength="200" placeholder="输入请不多于200字"></textarea>
</view>
<button @click="refuse" type="primary" class="primary-btn btn save">保存</button>
</view>
</unipopup>
<!-- 删除 -->
<unipopup ref="deleteWastagePop" type="center">
<view class="confirm-pop">
<view class="title">确定要删除该单据吗</view>
<view class="btn">
<button type="primary" class="default-btn btn save" @click="close('deleteWastagePop')">取消</button>
<button type="primary" class="primary-btn btn" @click="deleteDocument">确定</button>
</view>
</view>
</unipopup>
</base-page>
</template>
<script>
import {
getWastageLists,
getWastageDetail,
storageAgree,
storageRefuse,
storageDelete
} from '@/api/stock.js';
import unipopup from '@/components/uni-popup/uni-popup.vue';
export default {
components: {
unipopup
},
data() {
return {
selectGoodsKeys: 0,
//获取订单的页数
page: 1,
//每次获取订单的条数
page_size: 9,
// 订单搜索是用到的数据
search_text: '',
//初始时加载详情数据判断
one_judge: true,
// 订单列表数据
list: [],
//订单详情数据
detail: {},
repeatFlag: false,
refuseReason: ''
};
},
onLoad(option) {
if (option.id) {
this.search_text = option.id;
}
this.getListData();
},
methods: {
// 搜索
search() {
this.page = 1;
this.list = [];
this.one_judge = true;
this.getListData();
},
/**
* 获取订单列表
*/
getListData() {
getWastageLists({
page: this.page,
page_size: this.page_size,
search_text: this.search_text
}).then(res => {
if (res.data.list.length == 0 && this.one_judge) {
this.detail = {};
this.one_judge = false;
}
if (res.code >= 0 && res.data.list.length != 0) {
this.page += 1;
if (this.list.length == 0) {
this.list = res.data.list;
} else {
this.list = this.list.concat(res.data.list);
}
//初始时加载一遍详情数据
if (this.one_judge) {
this.getDetailData(this.list[0].document_id);
}
}
});
},
/**
* 获取订单详情数据
*/
getDetailData(document_id, keys = 0) {
this.selectGoodsKeys = keys;
this.type = 'detail';
getWastageDetail(document_id).then(res => {
if (res.code >= 0) {
this.detail = res.data;
this.$forceUpdate();
this.one_judge = false;
}
});
},
add(data) {
this.$util.redirectTo('/pages/stock/stockout');
},
edit() {
this.$util.redirectTo('/pages/stock/stockout', {
document_id: this.detail.document_id
});
},
open(action) {
this.$refs[action].open();
},
close(name) {
this.$refs[name].close();
},
agree() {
if (this.repeatFlag) return;
this.repeatFlag = true;
storageAgree(this.detail.document_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.document_id);
this.close('agreeWastagePop');
}
this.repeatFlag = false;
});
},
refuse() {
if (!this.refuseReason) {
this.$util.showToast({
title: '请输入拒绝理由'
});
return;
}
if (this.repeatFlag) return;
this.repeatFlag = true;
storageRefuse({
document_id: this.detail.document_id,
refuse_reason: this.refuseReason
}).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.search();
this.getDetailData(this.detail.document_id);
this.close('refuseWastagePop');
}
this.repeatFlag = false;
});
},
deleteDocument() {
if (this.repeatFlag) return;
this.repeatFlag = true;
storageDelete(this.detail.document_id).then(res => {
this.$util.showToast({
title: res.message
});
if (res.code >= 0) {
this.list.splice(this.selectGoodsKeys, 1);
if (this.selectGoodsKeys == 0) {
this.selectGoodsKeys = 0;
} else {
this.selectGoodsKeys -= 1;
}
this.getDetailData(this.list[this.selectGoodsKeys].document_id, this
.selectGoodsKeys);
this.close('deleteWastagePop');
}
this.repeatFlag = false;
});
}
}
};
</script>
<style scoped lang="scss">
@import './public/css/orderlist.scss';
</style>