|
|
@@ -4,115 +4,42 @@
|
|
|
<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>
|
|
|
- {{ shopInfo.shopName }}
|
|
|
- </TuiListCell>
|
|
|
<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"
|
|
|
- />
|
|
|
+ <input v-model="remark" placeholder-class="phcolor" class="tui-input" placeholder="这里写备注" maxlength="50" type="text" />
|
|
|
</TuiListCell>
|
|
|
</view>
|
|
|
</form>
|
|
|
</view>
|
|
|
<view class="space-view ex-table">
|
|
|
<block v-if="!$util.isEmpty(selectList)">
|
|
|
- <!-- <Tabel
|
|
|
- :dataList="selectList"
|
|
|
- :columns="columns"
|
|
|
- :parentData="{
|
|
|
- getSelectItemProfitPrice: getSelectItemProfitPrice
|
|
|
- }"
|
|
|
- >
|
|
|
- <template v-slot="{ row, column }">
|
|
|
- <view v-if="column.custom == 'icon'" class="list-icon">
|
|
|
- <image class="icon-image" :src="row.cover" alt="商品图" />
|
|
|
- <view class="icon-info">
|
|
|
- <view class="info-name">
|
|
|
- {{ row.itemName }}
|
|
|
- </view>
|
|
|
- <view class="info-type">
|
|
|
- B级
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view v-else-if="column.custom == 'stock'">
|
|
|
- <text v-if="row.bigNum > 0">{{ `${row.bigNum}/` }}</text>
|
|
|
- <text>{{ row.smallNum }}</text>
|
|
|
- </view>
|
|
|
- <view v-else-if="column.custom == 'inventory'">
|
|
|
- <text v-if="row.bigCount > 0">{{ `${row.bigCount}/` }}</text>
|
|
|
- <text>{{ row.smallCount }}</text>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view v-else-if="column.custom == 'profit'">
|
|
|
- <text>{{ getSelectItemProfitPrice }}</text>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- </Tabel> -->
|
|
|
-
|
|
|
<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`
|
|
|
- }"
|
|
|
- >
|
|
|
- <!-- <slot :name="item.dataIndex" > -->
|
|
|
+ <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 || "" }}
|
|
|
- <!-- </slot> -->
|
|
|
</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`
|
|
|
- }"
|
|
|
- >
|
|
|
- <!-- {{ item[column.dataIndex] || "" }} -->
|
|
|
-
|
|
|
+ <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" alt="商品图" />
|
|
|
+ <image class="icon-image" :src="item.cover" />
|
|
|
<view class="icon-info">
|
|
|
<view class="info-name">
|
|
|
{{ item.itemName }}
|
|
|
</view>
|
|
|
- <view class="info-type"> {{ item.rank || "" }}级 </view>
|
|
|
+ <view class="info-type"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-else-if="column.custom == 'stock'">
|
|
|
- <text >{{ `${item.bigNum}/` }}</text>
|
|
|
- <text>{{ item.smallNum }}</text>
|
|
|
+ <text v-if="Number(item.bigNum)>0">{{ `${item.bigNum}` }}扎</text>
|
|
|
+ <text v-if="Number(item.smallNum)>0">{{ item.smallNum }}支</text>
|
|
|
</view>
|
|
|
<view v-else-if="column.custom == 'inventory'">
|
|
|
- <text >{{`${item.bigCount}/`}}</text>
|
|
|
- <text >{{ `${item.smallCount}` }}</text>
|
|
|
+ <text v-if="Number(item.bigCount)>0">{{`${item.bigCount}`}}扎</text>
|
|
|
+ <text v-if="Number(item.smallCount)>0">{{ `${item.smallCount}` }}支</text>
|
|
|
</view>
|
|
|
-
|
|
|
<view v-else-if="column.custom == 'profit'">
|
|
|
- <text>{{ getSelectItemProfitPrice(item) }}</text>
|
|
|
+ <text></text>
|
|
|
</view>
|
|
|
<text v-else :class="[column.color || '']">
|
|
|
{{ (column.dataIndex && item[column.dataIndex]) || "" }}
|
|
|
@@ -121,28 +48,12 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</block>
|
|
|
- <template v-if="selectList.length == 0">
|
|
|
- <view class="empty-view">
|
|
|
- <button class="admin-button-com blue big" @click="gotoSelectPage">
|
|
|
- 开始盘点
|
|
|
- </button>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="bar-view" v-if="selectList.length>0">
|
|
|
<view class="btn-view">
|
|
|
-<!-- <button :class="['admin-button-com', 'middle', 'default']" @click="gotoSelectPage">继续盘点</button>-->
|
|
|
- <button :class="['admin-button-com', 'middle']" @click="gotoSelectPage">继续</button>
|
|
|
- <button :class="['admin-button-com','middle',{ disabled: allCount == 0 }]" :disabled="allCount == 0" @click="saveToDraft">
|
|
|
- 保存草稿
|
|
|
- </button>
|
|
|
- <button v-if="!orderSn" :class="['admin-button-com', 'middle', { disabled: allCount == 0 }]" :disabled="allCount == 0" @click="confirmPop(1)">
|
|
|
- 确认盘点
|
|
|
- </button>
|
|
|
- <button v-if="orderSn" :class="['admin-button-com', 'middle', { disabled: allCount == 0 }]" :disabled="allCount == 0" @click="confirmPop(2)">
|
|
|
- 确认盘点
|
|
|
- </button>
|
|
|
+ <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>
|
|
|
@@ -151,19 +62,14 @@
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import productMins from "@/mixins/product";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
-import {
|
|
|
- updateCheckOrderApi,
|
|
|
- updateCheckOrderToDraftApi,
|
|
|
- savaCheckOrderDraftApi,
|
|
|
- getCheckOrderDetailApi,
|
|
|
- checkOrderApi
|
|
|
-} from "@/api/inventory/index";
|
|
|
-import {currentShop} from "@/api/shop/index";
|
|
|
+import { updateCheckOrderToDraftApi, savaCheckOrderDraftApi, getCheckOrderDetailApi, checkOrderApi } from "@/api/inventory";
|
|
|
+import {currentShop} from "@/api/shop";
|
|
|
export default {
|
|
|
components: { TuiListCell },
|
|
|
mixins: [productMins],
|
|
|
data() {
|
|
|
return {
|
|
|
+ selectJobType: "inventory",
|
|
|
orderSn: null,
|
|
|
infoData: null,
|
|
|
autoLoad: false,
|
|
|
@@ -176,9 +82,8 @@ export default {
|
|
|
custom: "icon"
|
|
|
},
|
|
|
{
|
|
|
- name: "库存",
|
|
|
+ name: "盘前库存",
|
|
|
custom: "stock",
|
|
|
- // color: "success",
|
|
|
width: 120,
|
|
|
align: "center"
|
|
|
},
|
|
|
@@ -194,12 +99,7 @@ export default {
|
|
|
color: "success",
|
|
|
custom: "profit",
|
|
|
width: 120,
|
|
|
- align: "center",
|
|
|
- render: (h, { row, index }) => {
|
|
|
- return h("text", {}, () => {
|
|
|
- return this.getSelectItemProfitPrice(row);
|
|
|
- });
|
|
|
- }
|
|
|
+ align: "center"
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
@@ -221,134 +121,76 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions(["initMerchantInfo"]),
|
|
|
async initInfo() {
|
|
|
- try {
|
|
|
- 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)
|
|
|
- };
|
|
|
- })
|
|
|
- });
|
|
|
- } catch (error) {}
|
|
|
+ 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",
|
|
|
- success: result => {},
|
|
|
- fail: () => {},
|
|
|
- complete: () => {}
|
|
|
- });
|
|
|
+ uni.navigateTo({url: "/pagesStorehouse/inventory/select"})
|
|
|
},
|
|
|
getInfo(){
|
|
|
return currentShop().then(res => {
|
|
|
this.shopInfo = res.data
|
|
|
- console.log('getInfo',res)
|
|
|
- })
|
|
|
- .catch(err => {});
|
|
|
- },
|
|
|
- /**
|
|
|
- * 获取当前选中商品总价
|
|
|
- */
|
|
|
- getSelectItemProfitPrice(item) {
|
|
|
- let price = 0;
|
|
|
- const {
|
|
|
- bigCount,
|
|
|
- smallCount,
|
|
|
- bigNum,
|
|
|
- smallNum,
|
|
|
- bigPrice,
|
|
|
- smallPrice
|
|
|
- } = item;
|
|
|
- let bigNumProfitLoss = Number(bigCount) - Number(bigNum);
|
|
|
- let smallNumProfitLoss = Number(smallCount) - Number(smallNum);
|
|
|
- // let sum = Number(bigCount) * Number(bigPrice) + Number(smallCount) * Number(smallPrice);
|
|
|
- // price = Math.round(sum * 100) / 100;
|
|
|
- // let stockSum = Number(bigNum) * Number(bigPrice) + Number(smallNum) * Number(smallPrice);
|
|
|
- // let stockPrice = Math.round(stockSum * 100) / 100;
|
|
|
- let diff = `${bigNumProfitLoss}/${smallNumProfitLoss}`;
|
|
|
- // let diff = `${bigNumProfitLoss}/${smallNumProfitLoss}`;
|
|
|
- return diff;
|
|
|
- // return Math.round(diff * 100) / 100;
|
|
|
+ })
|
|
|
},
|
|
|
async saveToDraft() {
|
|
|
- try {
|
|
|
- let api = savaCheckOrderDraftApi;
|
|
|
- if (this.orderSn) {
|
|
|
- api = updateCheckOrderToDraftApi;
|
|
|
- }
|
|
|
- let params = {
|
|
|
- remark: this.remark
|
|
|
+ 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
|
|
|
};
|
|
|
- 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("保存成功");
|
|
|
- } catch (error) {}
|
|
|
- },
|
|
|
- confirmPop(type) {
|
|
|
- let self = this;
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认盘点?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- self.saveCheckOrder(type);
|
|
|
- }
|
|
|
- }
|
|
|
});
|
|
|
+ params.itemInfo = JSON.stringify(formatList);
|
|
|
+ const { data: { orderSn } } = await api(params);
|
|
|
+ this.orderSn = orderSn;
|
|
|
+ this.$msg("保存成功");
|
|
|
},
|
|
|
- async saveCheckOrder(type) {
|
|
|
- try {
|
|
|
- console.log(type)
|
|
|
- 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
|
|
|
- };
|
|
|
- });
|
|
|
- params.itemInfo = JSON.stringify(formatList);
|
|
|
- //type 1直接确定 2保存草稿后在确定
|
|
|
- if(type==1){
|
|
|
- await checkOrderApi(params)
|
|
|
- }else{
|
|
|
- await updateCheckOrderApi(params)
|
|
|
- }
|
|
|
- this.$msg("盘点成功");
|
|
|
- this.resetSelectInfoByType(this.pageType);
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- });
|
|
|
- } catch (error) {}
|
|
|
+ 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>
|
|
|
@@ -365,11 +207,9 @@ export default {
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
.ex-info {
|
|
|
- // padding: 0 30upx;
|
|
|
.module-com {
|
|
|
background-color: #fff;
|
|
|
margin-bottom: 20upx;
|
|
|
-
|
|
|
border-radius: 10upx;
|
|
|
overflow: hidden;
|
|
|
.member-wrap {
|
|
|
@@ -384,20 +224,14 @@ export default {
|
|
|
height: 240upx;
|
|
|
}
|
|
|
}
|
|
|
- // .tui-placeholder,
|
|
|
- // .tui-input {
|
|
|
- // padding-right: 30upx;
|
|
|
- // width: 100%;
|
|
|
- // text-align: right;
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
.ex-table {
|
|
|
/deep/.list-icon {
|
|
|
display: flex;
|
|
|
.icon-image {
|
|
|
- width: 80upx;
|
|
|
- height: 80upx;
|
|
|
+ width: 60upx;
|
|
|
+ height: 60upx;
|
|
|
margin-right: 20upx;
|
|
|
}
|
|
|
.icon-info {
|
|
|
@@ -429,9 +263,7 @@ export default {
|
|
|
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 {
|
|
|
@@ -444,7 +276,6 @@ export default {
|
|
|
.table-header {
|
|
|
display: flex;
|
|
|
padding: 20upx 30upx;
|
|
|
-
|
|
|
box-shadow: 0upx 1px 0upx 0upx #eeeeee;
|
|
|
color: #999999;
|
|
|
.table-th {
|
|
|
@@ -473,4 +304,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|