|
|
@@ -0,0 +1,302 @@
|
|
|
+<template>
|
|
|
+ <view class="ex-page">
|
|
|
+ <view class="main-view overscroll">
|
|
|
+ <view class="space-view ex-table">
|
|
|
+ <block v-if="!$util.isEmpty(selectList)">
|
|
|
+ <view class="table-view">
|
|
|
+ <view class="table-header" :style="{ backgroundColor: headerBackgroundColor }" >
|
|
|
+ <view class="table-th" v-for="(item, index) in columns" :key="index" :style="{ flex: item.width ? `0 0 ${item.width}rpx` : '1', textAlign: item.align || 'left', fontSzie: `${headerFontSize}rpx`, margin: `0 ${gutter}rpx` }" >
|
|
|
+ {{ item.name || "" }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="table-tr" v-for="(item, index) in selectList" :key="index">
|
|
|
+ <view class="table-td" v-for="(column, columnIndex) in columns" :key="columnIndex" :style="{ flex: column.width ? `0 0 ${column.width}rpx` : '1', textAlign: column.align || 'left', fontSzie: `${fontSize}rpx`, margin: `0 ${gutter}rpx` }" >
|
|
|
+ <view v-if="column.custom == 'icon'" class="list-icon">
|
|
|
+ <image class="icon-image" :src="item.cover" />
|
|
|
+ <view class="icon-info">
|
|
|
+ <view class="info-name"> {{ item.name }} </view>
|
|
|
+ <view class="info-type"></view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="column.custom == 'stock'">
|
|
|
+ <text v-if="Number(item.stock)>0">{{item.stock}}</text>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="column.custom == 'inventory'">
|
|
|
+ <text v-if="Number(item.bigCount)>0">{{item.bigCount==99999?0:item.bigCount}}</text>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="column.custom == 'profit'">
|
|
|
+ <text></text>
|
|
|
+ </view>
|
|
|
+ <text v-else :class="[column.color || '']">
|
|
|
+ {{ (column.dataIndex && item[column.dataIndex]) || "" }}
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ <view class="space-view ex-info">
|
|
|
+ <form>
|
|
|
+ <view class="module-com input-line-wrap">
|
|
|
+ <TuiListCell class="line-cell" :hover="false" :arrow="false">
|
|
|
+ <view class="tui-title ">备注</view>
|
|
|
+ <input v-model="remark" placeholder-class="phcolor" class="tui-input" placeholder="这里写备注" maxlength="50" type="text" />
|
|
|
+ </TuiListCell>
|
|
|
+ </view>
|
|
|
+ </form>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="bar-view" v-if="selectList.length>0">
|
|
|
+ <view class="btn-view">
|
|
|
+ <button class="admin-button-com big defalut" style="margin-right:60upx;" @click="gotoSelectPage">返回修改</button>
|
|
|
+ <button class="admin-button-com big blue" @click="confirmPop()">确认盘点</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import TuiListCell from "@/components/plugin/list-cell";
|
|
|
+import productMins from "@/mixins/product";
|
|
|
+import { mapActions, mapGetters } from "vuex";
|
|
|
+import { updateCheckOrderToDraftApi, savaCheckOrderDraftApi, getCheckOrderDetailApi, checkOrderApi } from "@/api/inventory";
|
|
|
+import {currentShop} from "@/api/shop";
|
|
|
+export default {
|
|
|
+ components: { TuiListCell },
|
|
|
+ mixins: [productMins],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ selectJobType: "pd",
|
|
|
+ orderSn: null,
|
|
|
+ infoData: null,
|
|
|
+ autoLoad: false,
|
|
|
+ shopInfo:null,
|
|
|
+ remark: "",
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ name: "名称",
|
|
|
+ custom: "icon"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "盘点前",
|
|
|
+ custom: "stock",
|
|
|
+ width: 120,
|
|
|
+ align: "center"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "盘点后",
|
|
|
+ custom: "inventory",
|
|
|
+ color: "warn",
|
|
|
+ width: 120,
|
|
|
+ align: "center"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "盈亏数",
|
|
|
+ color: "success",
|
|
|
+ custom: "profit",
|
|
|
+ width: 120,
|
|
|
+ align: "center"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ const { orderSn } = option;
|
|
|
+ if (orderSn) {
|
|
|
+ this.orderSn = orderSn;
|
|
|
+ this.initInfo();
|
|
|
+ }
|
|
|
+ this.getInfo();
|
|
|
+ if (!this.getMerchantInfo) {
|
|
|
+ this.initMerchantInfo();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["getMerchantInfo"])
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(["initMerchantInfo"]),
|
|
|
+ async initInfo() {
|
|
|
+ const { data } = await getCheckOrderDetailApi(this.orderSn);
|
|
|
+ this.infoData = data;
|
|
|
+ const { remark, itemInfo } = data;
|
|
|
+ this.remark = remark;
|
|
|
+ this.setSelectInfoByType({
|
|
|
+ type: this.pageType,
|
|
|
+ info: itemInfo.map(ele => {
|
|
|
+ return {
|
|
|
+ ...ele,
|
|
|
+ bigNum: Number(ele.bigNumStock),
|
|
|
+ smallNum: Number(ele.smallNumStock),
|
|
|
+ bigCount: Number(ele.bigNum),
|
|
|
+ smallCount: Number(ele.smallNum)
|
|
|
+ };
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ gotoSelectPage() {
|
|
|
+ uni.navigateTo({url: "/pagesStorehouse/inventory/select"})
|
|
|
+ },
|
|
|
+ getInfo(){
|
|
|
+ return currentShop().then(res => {
|
|
|
+ this.shopInfo = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async saveToDraft() {
|
|
|
+ let api = savaCheckOrderDraftApi;
|
|
|
+ if (this.orderSn) {
|
|
|
+ api = updateCheckOrderToDraftApi;
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ remark: this.remark
|
|
|
+ };
|
|
|
+ if (this.orderSn) {
|
|
|
+ params.orderSn = this.orderSn;
|
|
|
+ }
|
|
|
+ let formatList = this.selectList.map(ele => {
|
|
|
+ return {
|
|
|
+ bigNum: ele.bigCount,
|
|
|
+ smallNum: ele.smallCount,
|
|
|
+ productId: ele.id,
|
|
|
+ classId:ele.classId,itemId:ele.itemId
|
|
|
+ };
|
|
|
+ });
|
|
|
+ params.itemInfo = JSON.stringify(formatList);
|
|
|
+ const { data: { orderSn } } = await api(params);
|
|
|
+ this.orderSn = orderSn;
|
|
|
+ this.$msg("保存成功");
|
|
|
+ },
|
|
|
+ confirmPop() {
|
|
|
+ let that = this;
|
|
|
+ that.$util.confirmModal({content:'确认盘点?'},() => {
|
|
|
+ that.saveCheckOrder()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveCheckOrder() {
|
|
|
+ let params = {remark: this.remark}
|
|
|
+ let formatList = this.selectList.map(ele => {
|
|
|
+ return { bigNum: ele.bigCount, smallNum: ele.smallCount, productId: ele.id }
|
|
|
+ });
|
|
|
+ let that = this
|
|
|
+ params.itemInfo = JSON.stringify(formatList);
|
|
|
+ checkOrderApi(params).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg("盘点成功");
|
|
|
+ that.removeFromSaveDirect()
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.ex-page {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .main-view {
|
|
|
+ flex: 1;
|
|
|
+ background-color: #f9fbfc;
|
|
|
+ .space-view {
|
|
|
+ margin-top: 15upx;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ .ex-info {
|
|
|
+ .module-com {
|
|
|
+ background-color: #fff;
|
|
|
+ margin-bottom: 20upx;
|
|
|
+ border-radius: 10upx;
|
|
|
+ overflow: hidden;
|
|
|
+ .member-wrap {
|
|
|
+ .member-det {
|
|
|
+ font-size: 24upx;
|
|
|
+ margin-left: 20upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .remark-wrap {
|
|
|
+ align-items: flex-start;
|
|
|
+ .remark {
|
|
|
+ height: 240upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ex-table {
|
|
|
+ /deep/.list-icon {
|
|
|
+ display: flex;
|
|
|
+ .icon-image {
|
|
|
+ width: 60upx;
|
|
|
+ height: 60upx;
|
|
|
+ margin-right: 20upx;
|
|
|
+ }
|
|
|
+ .icon-info {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-around;
|
|
|
+ .info-name {
|
|
|
+ font-size: 28upx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+ .info-type {
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #666666;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .empty-view {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ margin: 120upx auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bar-view {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 30upx;
|
|
|
+ width: 100%;
|
|
|
+ height: 100upx;
|
|
|
+ box-shadow: 0upx -1px 6upx 0upx rgba(4, 0, 0, 0.06);
|
|
|
+ .btn-view {
|
|
|
+ display: flex;
|
|
|
+ .admin-button-com {
|
|
|
+ margin: 0 10upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.table-view {
|
|
|
+ .table-header {
|
|
|
+ display: flex;
|
|
|
+ padding: 20upx 30upx;
|
|
|
+ box-shadow: 0upx 1px 0upx 0upx #eeeeee;
|
|
|
+ color: #999999;
|
|
|
+ .table-th {
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .table-tr {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20upx 30upx;
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ color: #999999;
|
|
|
+ .table-td {
|
|
|
+ .warn {
|
|
|
+ color: #ffaf1d;
|
|
|
+ }
|
|
|
+ .fail {
|
|
|
+ color: #f51608;
|
|
|
+ }
|
|
|
+ .success {
|
|
|
+ color: #09bb07;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|