deliveryDetailDialog.vue 7.97 KB
<!-- 发货单详情弹窗 -->
<template>
  <div>
    <d2-dialog title="详细信息" :is-visible="detailVisible" class="stockMonthDailog" width="70%" :no-cancel="true"
               btn-ok-label="关闭" @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>
      <template v-for="(item, index) in detailInfo.deliveryDetailList">
        <div class="table-wrap" :key="index">
          <div class="detail-info">
            <div>
              商品名称:
              <span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{item.specificationData}}</span>
            </div>
            <div>
              发货数量:
              <span>{{ item.purchaseNumber + (membraneTypeList.includes(item.goodsType) ? '卷' : '件') }}</span>
              <el-button type="text" class="lookNumber" @click="lookNumber(item.deliveryCardList)"
                         v-if="item.deliveryCardList && item.deliveryCardList.length > 0">查看卡号</el-button>
            </div>
            <div>
              可用库存数量:
              <span>{{ item.stockNum + (membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span>
            </div>
          </div>
          <d2-table ref="recordTable" v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0"
                    :table-data="item.goodsWarehousingList" :table-params="tableParams" :has-page="false">
            <template slot="filmRollNo" slot-scope="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"
                            width="200"
                            trigger="hover">
                  <div class="film-roll-box">
                    <div class="title">膜卷号</div>
                    <div class="merchant-item" v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex">
                      {{ subItem }}
                    </div>
                  </div>
                  <div slot="reference">
                    <!-- <img style="width: 14px;height: 13px;" src="./images/merchant_icon.png"> -->
                    <span style="color: #2A58AD;">(…{{ scope.scope.filmRollList.length }})</span>
                  </div>
                </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 title="查看发货卡号" :is-visible="innerVisible" width="500px" :no-cancel="true" btn-ok-label="关闭"
               @closeDialog="innerVisible = false" @confirmDialog="innerVisible = false">
      <d2-table class="deliveryCardCon" ref="recordTable" :table-data="tableDataCardList" :table-params="innerParams"
                :has-page="false">
      </d2-table>
    </d2-dialog>
  </div>
</template>

<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { purchaseOrderDeliveryDetail } from '@/api/purchaseShopping.js'
import { baseConfig } from '@/main'
export default {
  name: 'DeliveryDetailDialog',
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      membraneTypeList: baseConfig.membraneTypeList,
      detailInfo: {},
      searchFormSearch: {},
      // tableData: [],
      tableParams: {
        btnId: new Date().getTime() + 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) ? parseFloat(cellValue.increaseStockNum / cellValue.alternateUnits).toFixed(2) : 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
          }
        ]
      }
    }
  },

  props: {
    detailVisible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },

  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() {
      var 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;
  // }
}
</style>