deliveryDetailDialog.vue 8.77 KB
<!-- 发货单详情弹窗 -->
<template>
  <div>
    <d2-dialog btn-ok-label="关闭"
               class="stockMonthDailog"
               title="详细信息"
               width="1400px"
               :is-visible="detailVisible"
               :no-cancel="true"
               @closeDialog="handleClose"
               @confirmDialog="handleClose">
      <div class="detail-info">
        <div>
          发货单号:
          <span>{{ detailInfo.deliveryNumber }}</span>
        </div>
        <div>
          发货仓库:
          <span>{{ detailInfo.shippingWarehouseName }}</span>
        </div>
        <div>
          承运公司:
          <span>{{ detailInfo.deliveryCompany }}</span>
        </div>
        <div>
          发货时间:
          <span>{{ detailInfo.deliveryDate }}</span>
        </div>

      </div>
      <div class="detail-info m-b-33" style="justify-content: flex-start; align-items: flex-start;">
        签收凭证:
        <div v-if="detailInfo.uploadFileUrl">
          <el-image v-for="(url, index) in detailInfo.uploadFileUrl.split(',')"
                    :key="index"
                    class="sign-image"
                    fit="cover"
                    style="width: 36px; height: 36px; margin-right: 8px; cursor: pointer;"
                    :preview-src-list="detailInfo.uploadFileUrl.split(',')"
                    :src="url" />
        </div>
        <div v-else>
          -
        </div>
      </div>
      <template v-for="(item, index) in detailInfo.deliveryDetailList">
        <div :key="index" class="table-wrap">
          <div class="detail-info">
            <div>
              产品名称:
              <span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{ item.specificationData }}</span>
            </div>
            <div>
              产品ID:
              <span>{{ item.upgradeCommodityCode }}</span>
            </div>
            <div>
              发货数量:
              <span>{{ item.purchaseNumber + (membraneTypeList.includes(item.goodsType) ? '卷' : '件') }}</span>
              <el-button v-if="item.deliveryCardList && item.deliveryCardList.length > 0"
                         class="lookNumber"
                         type="text"
                         @click="lookNumber(item.deliveryCardList)">
                查看卡号
              </el-button>
            </div>
            <div>
              可用库存数量:
              <span>{{ item.stockNum + (membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span>
            </div>
          </div>
          <d2-table v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0"
                    ref="recordTable"
                    :has-page="false"
                    :table-data="item.goodsWarehousingList"
                    :table-params="tableParams">
            <template #filmRollNo="scope">
              <div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1">
                {{ scope.scope.filmRollList[0] }}
              </div>
              <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1">
                <el-popover placement="top"
                            trigger="hover"
                            width="200">
                  <div class="film-roll-box">
                    <div class="title">
                      膜卷号
                    </div>
                    <div v-for="(subItem, subIndex) in scope.scope.filmRollList"
                         :key="subIndex"
                         class="merchant-item">
                      {{ subItem }}
                    </div>
                  </div>
                  <template #reference>
                    <div>
                      <span style="color: #2A58AD;">(…{{ scope.scope.filmRollList.length }})</span>
                    </div>
                  </template>
                </el-popover>
              </div>
              <div v-else>
                <span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ '-' }}</span>
              </div>
            </template>
          </d2-table>
          <div v-else class="message">
            已自动入库至商户的权益卡管理中,可前往“库存管理-权益卡管理”中查询
          </div>
        </div>
      </template>
    </d2-dialog>
    <d2-dialog btn-ok-label="关闭"
               title="查看发货卡号"
               width="500px"
               :is-visible="innerVisible"
               :no-cancel="true"
               @closeDialog="innerVisible = false"
               @confirmDialog="innerVisible = false">
      <d2-table ref="recordTable"
                class="deliveryCardCon"
                :has-page="false"
                :table-data="tableDataCardList"
                :table-params="innerParams">
      </d2-table>
    </d2-dialog>
  </div>
</template>

<script>
import { mapActions, mapState } from "vuex";
import { purchaseOrderDeliveryDetail } from "@/api/purchaseShopping.js";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";

export default {
	name: "DeliveryDetailDialog",

	props: {
		detailVisible: {
			type: Boolean,
			default: false,
		},
		recordInfo: {
			type: Object,
			default: () => { },
		},
	},
	data() {
		return {
			userInfo: this.$store.state.d2admin.user.info,
			membraneTypeList: baseConfig.membraneTypeList,
			detailInfo: {},
			searchFormSearch: {},
			// tableData: [],
			tableParams: {
				btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
				listName: "list",
				// singleSelectUniqueKey: 'id',
				tableOption: false,
				tableColumns: [{
					label: "入库数量",
					prop: "increaseStockNum",
					// width: '200px'
					formatter: (cellValue) => {
						return (cellValue.increaseStockNum || cellValue.increaseStockNum == 0) ? (this.membraneTypeList.includes(cellValue.goodsType) ? Number.parseFloat(cellValue.increaseStockNum / cellValue.alternateUnits).toFixed(2) : Number.parseFloat(cellValue.increaseStockNum).toFixed(2)) + (this.membraneTypeList.includes(cellValue.goodsType) ? "卷" : "件") : "-";
					},
				}, {
					label: "膜卷号",
					name: "",
					type: "slot",
					addHtml: "filmRollNo",
				}, {
					label: "入库仓库",
					prop: "yqMerchantName",
					// width: '150px'
				}, {
					label: "入库门店",
					prop: "merchantName",
					// width: '200px'
				}],
			},
			baseData: {

			},
			merchantDialogVisible: false,
			tableDataCardList: [],
			innerVisible: false,
			innerParams: {
				tableOption: false,
				tableColumns: [
					{
						label: "卡号",
						prop: "cardNum",
						// width:630
					},
				],
			},
		};
	},

	computed: {

	},
	mounted() {
		this.getDetail();
	},

	methods: {
		...mapActions({
			get: "d2admin/base/get",
			close: "d2admin/page/close",
		}),
		lookNumber(data) {
			this.innerVisible = true;
			this.tableDataCardList = data.map((item) => {
				return { cardNum: item };
			});
		},
		beforeSearchFn() {
			return new Promise((resolve) => {
				this.searchFormSearch = deepClone(this.searchForm);
				resolve();
			});
		},

		getDetail() {
			let params = { id: deepClone(this.recordInfo.id) };
			purchaseOrderDeliveryDetail(params).then((res) => {
				this.detailInfo = res;
				if (this.detailInfo.deliveryDate) {
					this.detailInfo.deliveryDate = Util.dateFormate(this.detailInfo.deliveryDate, "YYYY-MM-DD HH:mm");
				}
				const _deliveryDetailList = this.detailInfo.deliveryDetailList;
				if (_deliveryDetailList && _deliveryDetailList.length > 0) {
					_deliveryDetailList.forEach((info) => {
						const _goodsWarehousingList = info.goodsWarehousingList;
						if (_goodsWarehousingList && _goodsWarehousingList.length > 0) {
							_goodsWarehousingList.forEach((item) => {
								item.goodsType = info.goodsType;
								// 换算单位
								item.alternateUnits = info?.stockNum / info?.purchaseNumber;
							});
						}
					});
				}
			});
		},

		handleClose() {
			this.$emit("dialogClose");
		},

	},
};
</script>

<style lang="scss" scoped>
.detail-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: #666666ff;
	font-size: 14px;
	margin-bottom: 16px;

	span {
		color: #333333ff;
	}

	.add-btn {
		font-size: 14px;
		color: #5850ff;
		cursor: pointer;
	}
}

.film-roll-box {
	font-size: 12px;
	color: #666666;

	.title {
		font-weight: 500;
		color: #3a3a3a;
		margin-bottom: 8px;
	}
}

.deliveryCardCon {
	max-height: 60vh;
	overflow: auto;
}

.lookNumber {
	// font-size: 14px;
	// color: ;
	// color: #5850ff!important;
	cursor: pointer;
	margin-left: 8px;
}

.table-wrap {
	border: 1px solid #e5e5e5;
	padding: 16px;
	box-sizing: border-box;
	margin-top: 16px;
	// /deep/ .el-form-item__error {
	//   padding-top: 2px;
	//   z-index: 9999999;
	//   position: static;
	// }
}

.m-b-33 {
	margin-bottom: 33px;
}
</style>