|
@@ -4,31 +4,14 @@
|
|
|
<view class="space-view ex-info">
|
|
<view class="space-view ex-info">
|
|
|
<form>
|
|
<form>
|
|
|
<view class="module-com input-line-wrap">
|
|
<view class="module-com input-line-wrap">
|
|
|
- <TuiListCell
|
|
|
|
|
- class="line-cell"
|
|
|
|
|
- :hover="false"
|
|
|
|
|
- :arrow="false"
|
|
|
|
|
- @click="openAddres"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <TuiListCell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title ">仓库</view>
|
|
<view class="tui-title ">仓库</view>
|
|
|
- <input
|
|
|
|
|
- v-model="form.openTime"
|
|
|
|
|
- placeholder-class="phcolor"
|
|
|
|
|
- class="tui-input"
|
|
|
|
|
- placeholder="请填写"
|
|
|
|
|
- maxlength="50"
|
|
|
|
|
- type="text"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ {{ getMerchantInfo.merchantName }}
|
|
|
</TuiListCell>
|
|
</TuiListCell>
|
|
|
- <TuiListCell
|
|
|
|
|
- class="line-cell"
|
|
|
|
|
- :hover="false"
|
|
|
|
|
- :arrow="false"
|
|
|
|
|
- @click="openAddres"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <TuiListCell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title ">备注</view>
|
|
<view class="tui-title ">备注</view>
|
|
|
<input
|
|
<input
|
|
|
- v-model="form.openTime"
|
|
|
|
|
|
|
+ v-model="remark"
|
|
|
placeholder-class="phcolor"
|
|
placeholder-class="phcolor"
|
|
|
class="tui-input"
|
|
class="tui-input"
|
|
|
placeholder="请填写"
|
|
placeholder="请填写"
|
|
@@ -40,28 +23,109 @@
|
|
|
</form>
|
|
</form>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="space-view ex-table">
|
|
<view class="space-view ex-table">
|
|
|
- <Tabel :columns="columns" :dataList="dataList">
|
|
|
|
|
- <template v-slot="{ row, column }">
|
|
|
|
|
- <view v-if="column.custom == 'icon'" class="list-icon">
|
|
|
|
|
- <image
|
|
|
|
|
- class="icon-image"
|
|
|
|
|
- src="https://img.huaml.com/uploads/12358/202005/29/de74c55596d304b85e79154958e8bf57_small.jpeg"
|
|
|
|
|
- alt="商品图"
|
|
|
|
|
- />
|
|
|
|
|
- <view class="icon-info">
|
|
|
|
|
- <view class="info-name">
|
|
|
|
|
- 粉佳人
|
|
|
|
|
|
|
+ <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 class="info-type">
|
|
|
|
|
- B级
|
|
|
|
|
|
|
+ </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" > -->
|
|
|
|
|
+ {{ 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 v-if="column.custom == 'icon'" class="list-icon">
|
|
|
|
|
+ <image class="icon-image" :src="item.cover" alt="商品图" />
|
|
|
|
|
+ <view class="icon-info">
|
|
|
|
|
+ <view class="info-name">
|
|
|
|
|
+ {{ item.itemName }}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="info-type">
|
|
|
|
|
+ B级
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-else-if="column.custom == 'stock'">
|
|
|
|
|
+ <text v-if="item.bigNum > 0">{{ `${item.bigNum}/` }}</text>
|
|
|
|
|
+ <text>{{ item.smallNum }}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-else-if="column.custom == 'inventory'">
|
|
|
|
|
+ <text v-if="item.bigCount > 0">{{ `${item.bigCount}/` }}</text>
|
|
|
|
|
+ <text>{{ item.smallCount }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+
|
|
|
|
|
+ <view v-else-if="column.custom == 'profit'">
|
|
|
|
|
+ <text>{{ getSelectItemProfitPrice(item) }}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <text v-else :class="[column.color || '']">
|
|
|
|
|
+ {{ (column.dataIndex && item[column.dataIndex]) || "" }}
|
|
|
|
|
+ </text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </template>
|
|
|
|
|
- </Tabel>
|
|
|
|
|
- <template v-if="dataList.length == 0">
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </block>
|
|
|
|
|
+ <template v-if="selectList.length == 0">
|
|
|
<view class="empty-view">
|
|
<view class="empty-view">
|
|
|
- <button class="admin-button-com blue big" @click="">
|
|
|
|
|
|
|
+ <button class="admin-button-com blue big" @click="gotoSelectPage">
|
|
|
开始盘点
|
|
开始盘点
|
|
|
</button>
|
|
</button>
|
|
|
</view>
|
|
</view>
|
|
@@ -70,20 +134,29 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="bar-view">
|
|
<view class="bar-view">
|
|
|
<view class="btn-view">
|
|
<view class="btn-view">
|
|
|
- <button :class="['admin-button-com', 'middle', 'default']" @click="">
|
|
|
|
|
|
|
+ <button
|
|
|
|
|
+ :class="['admin-button-com', 'middle', 'default']"
|
|
|
|
|
+ @click="gotoSelectPage"
|
|
|
|
|
+ >
|
|
|
继续盘点
|
|
继续盘点
|
|
|
</button>
|
|
</button>
|
|
|
<button
|
|
<button
|
|
|
- :class="['admin-button-com', 'middle', 'default', 'disabled']"
|
|
|
|
|
- disabled
|
|
|
|
|
- @click=""
|
|
|
|
|
|
|
+ :class="[
|
|
|
|
|
+ 'admin-button-com',
|
|
|
|
|
+ 'middle',
|
|
|
|
|
+ 'default',
|
|
|
|
|
+ { disabled: allCount == 0 }
|
|
|
|
|
+ ]"
|
|
|
|
|
+ :disabled="allCount == 0"
|
|
|
|
|
+ @click="saveToDraft"
|
|
|
>
|
|
>
|
|
|
- 保存导草稿
|
|
|
|
|
|
|
+ 保存到草稿
|
|
|
</button>
|
|
</button>
|
|
|
<button
|
|
<button
|
|
|
- :class="['admin-button-com', 'middle', 'disabled']"
|
|
|
|
|
- disabled
|
|
|
|
|
- @click=""
|
|
|
|
|
|
|
+ v-if="orderSn"
|
|
|
|
|
+ :class="['admin-button-com', 'middle', { disabled: allCount == 0 }]"
|
|
|
|
|
+ :disabled="allCount == 0"
|
|
|
|
|
+ @click="saveCheckOrder"
|
|
|
>
|
|
>
|
|
|
确认
|
|
确认
|
|
|
</button>
|
|
</button>
|
|
@@ -92,13 +165,24 @@
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
-import Tabel from "../components/table";
|
|
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
|
|
+import productMins from "@/mixins/product";
|
|
|
|
|
+import { mapActions, mapGetters } from "vuex";
|
|
|
|
|
+import {
|
|
|
|
|
+ updateCheckOrderApi,
|
|
|
|
|
+ updateCheckOrderToDraftApi,
|
|
|
|
|
+ savaCheckOrderDraftApi,
|
|
|
|
|
+ getCheckOrderDetailApi
|
|
|
|
|
+} from "@/api/inventory/index";
|
|
|
export default {
|
|
export default {
|
|
|
- components: { TuiListCell, Tabel },
|
|
|
|
|
|
|
+ components: { TuiListCell },
|
|
|
|
|
+ mixins: [productMins],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- form: {},
|
|
|
|
|
|
|
+ orderSn: null,
|
|
|
|
|
+ infoData: null,
|
|
|
|
|
+ remark: "",
|
|
|
|
|
+ pageType: "inventory",
|
|
|
columns: [
|
|
columns: [
|
|
|
{
|
|
{
|
|
|
name: "名称",
|
|
name: "名称",
|
|
@@ -106,44 +190,150 @@ export default {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "库存",
|
|
name: "库存",
|
|
|
- dataIndex: "count",
|
|
|
|
|
|
|
+ custom: "stock",
|
|
|
// color: "success",
|
|
// color: "success",
|
|
|
width: 120,
|
|
width: 120,
|
|
|
align: "center"
|
|
align: "center"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "盘点数",
|
|
name: "盘点数",
|
|
|
- dataIndex: "inventoryCount",
|
|
|
|
|
|
|
+ custom: "inventory",
|
|
|
color: "warn",
|
|
color: "warn",
|
|
|
width: 120,
|
|
width: 120,
|
|
|
align: "center"
|
|
align: "center"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "盈亏数",
|
|
name: "盈亏数",
|
|
|
- dataIndex: "profitCount",
|
|
|
|
|
color: "success",
|
|
color: "success",
|
|
|
|
|
+ custom: "profit",
|
|
|
width: 120,
|
|
width: 120,
|
|
|
- align: "center"
|
|
|
|
|
|
|
+ align: "center",
|
|
|
|
|
+ render: (h, { row, index }) => {
|
|
|
|
|
+ return h("text", {}, () => {
|
|
|
|
|
+ return this.getSelectItemProfitPrice(row);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- ],
|
|
|
|
|
- dataList: [
|
|
|
|
|
- // {
|
|
|
|
|
- // count: "1",
|
|
|
|
|
- // inventoryCount: "2",
|
|
|
|
|
- // profitCount: "3"
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // count: "1",
|
|
|
|
|
- // inventoryCount: "2",
|
|
|
|
|
- // profitCount: "3"
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // count: "1",
|
|
|
|
|
- // inventoryCount: "2",
|
|
|
|
|
- // profitCount: "3"
|
|
|
|
|
- // }
|
|
|
|
|
]
|
|
]
|
|
|
};
|
|
};
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad(option) {
|
|
|
|
|
+ const { orderSn } = option;
|
|
|
|
|
+ if (orderSn) {
|
|
|
|
|
+ this.orderSn = orderSn;
|
|
|
|
|
+ this.initInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!this.getMerchantInfo) {
|
|
|
|
|
+ this.initMerchantInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapGetters(["getMerchantInfo"])
|
|
|
|
|
+ },
|
|
|
|
|
+ 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) {}
|
|
|
|
|
+ },
|
|
|
|
|
+ gotoSelectPage() {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: "/pagesStorehouse/inventory/select",
|
|
|
|
|
+ success: result => {},
|
|
|
|
|
+ fail: () => {},
|
|
|
|
|
+ complete: () => {}
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当前选中商品总价
|
|
|
|
|
+ */
|
|
|
|
|
+ getSelectItemProfitPrice(item) {
|
|
|
|
|
+ let price = 0;
|
|
|
|
|
+ const {
|
|
|
|
|
+ bigCount,
|
|
|
|
|
+ smallCount,
|
|
|
|
|
+ bigNum,
|
|
|
|
|
+ smallNum,
|
|
|
|
|
+ bigPrice,
|
|
|
|
|
+ smallPrice
|
|
|
|
|
+ } = item;
|
|
|
|
|
+ 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 = stockPrice - price;
|
|
|
|
|
+ return Math.round(diff * 100) / 100;
|
|
|
|
|
+ },
|
|
|
|
|
+ async saveToDraft() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ 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
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ params.itemInfo = JSON.stringify(formatList);
|
|
|
|
|
+ const {
|
|
|
|
|
+ data: { orderSn }
|
|
|
|
|
+ } = await api(params);
|
|
|
|
|
+ this.orderSn = orderSn;
|
|
|
|
|
+ this.$msg("保存成功");
|
|
|
|
|
+ } catch (error) {}
|
|
|
|
|
+ },
|
|
|
|
|
+ async saveCheckOrder() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ await updateCheckOrderApi(params);
|
|
|
|
|
+ this.$msg("盘点成功");
|
|
|
|
|
+ uni.navigateBack({
|
|
|
|
|
+ delta: 1
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
@@ -235,4 +425,37 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+.table-view {
|
|
|
|
|
+ .table-header {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ padding: 20upx 30upx;
|
|
|
|
|
+
|
|
|
|
|
+ box-shadow: 0px 1px 0px 0px #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>
|
|
</style>
|