factoryDeliveryDetailDialog.vue 9 KB
<!-- 发货单详情弹窗 -->
<template>
  <div>
    <baseDialog title="详细信息"
                :is-show.sync="detailVisible"
                :config="dialogConfig.setting"
                :dialog-config="dialogConfig.config"
                width="1050px"
                :no-cancel="true"
                btn-ok-label="关闭"
                @closeDialog="handleClose"
                @confirmDialog="handleClose">
      <div class="stockMonthDailog">
        <div class="addressTitle">
          <img src="../images/addressIcon.webp"
               alt=""
               class="icon">
          <span class="title">{{ recordInfo.merchantName }}</span>
        </div>
        <div class="address-info"
             v-if="detailInfo[0]">
          <span class="name">收货人:<span class="label">{{ detailInfo[0].contactName }}</span></span>
          <span class="phone">电话:<span class="label">{{ detailInfo[0].contactPhone }}</span></span>
          <span class="address">收货地址:<span
            class="label">{{ detailInfo[0].contactAddress }}</span></span>
        </div>
        <div class="address-info"
           v-if="detailInfo[0].purchaseOrderRemark">
        <span class="address">备注:<span class="label">{{  detailInfo[0].purchaseOrderRemark }}</span></span>
      </div>
        <div v-for="(itemList, index) in detailInfo"
             :key="index">
          <div class="detail-info">
            <div>
              发货单号:
              <span>{{ itemList.deliveryNumber }}</span>
            </div>
            <div>
              承运公司:
              <span>{{ itemList.deliveryCompany }}</span>
            </div>
            <div>
              发货时间:
              <span>{{ itemList.deliveryDate }}</span>
            </div>
          </div>
          <d2-table ref="recordTable"
                    :table-data="itemList.deliveryDetailList"
                    :table-params="tableParams"
                    :has-page="false">
            <span slot="deliveryCard"
                  slot-scope="scope">
              <template
                v-if="scope.scope.deliveryCardList && scope.scope.deliveryCardList.length > 1">
                <!-- {{ scope.scope.deliveryCardList.length || 0 }} -->
                <span>+{{ scope.scope.deliveryCardList.length }} </span>
                <el-button mini
                           type="text"
                           @click="handleDeliveryCard(scope.scope.deliveryCardList)">查看</el-button>
              </template>
              <template
                v-else-if="scope.scope.deliveryCardList && scope.scope.deliveryCardList.length == 1">
                <!-- {{ scope.scope.deliveryCardList.length || 0 }} -->
                <span>{{ scope.scope.deliveryCardList[0] }}</span>
                <!-- <el-button mini type="text" @click="handleDeliveryCard(scope.scope.deliveryCardList)">查看</el-button> -->
              </template>
              <template v-else>-</template>
            </span>
          </d2-table>
        </div>
      </div>
    </baseDialog>
    <baseDialog title="查看发货卡号"
                :config="carDialogConfig.setting"
                :dialog-config="carDialogConfig.config"
                :is-show.sync="handleDeliveryCardVisible"
                width="500px"
                :no-cancel="true"
                btn-ok-label="关闭"
                @closeDialog="handleDeliveryCardVisible = false"
                @confirmDialog="handleDeliveryCardVisible = false">
      <d2-table class="deliveryCardCon"
                ref="recordTable"
                :table-data="deliveryCardList"
                :table-params="innerParams"
                :has-page="false">
      </d2-table>
    </baseDialog>
  </div>
</template>

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

export default {
  name: 'FactoryDeliveryDetailDialog',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {
      dialogConfig: {
        setting: {
          showClose: true,
          appendToBody: false,
          btnList: [
          ]
        },
        config: {
          title: '详细信息',
          width: '1050px'
        }
      },
      carDialogConfig: {
        setting: {
          showClose: true,
          appendToBody: false,
          btnList: [
          ]
        },
        config: {
          title: '查看发货卡号',
          width: '500px'
        }
      },
      userInfo: this.$store.state.d2admin.user.info,
      membraneTypeList: baseConfig.membraneTypeList,
      detailInfo: '',
      searchFormSearch: {},
      tableData: [],
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: false,
        tableColumns: [
          {
            label: '商品名称',
            prop: 'upgradeGoodsName'
          },
          {
            label: '商品编码',
            prop: 'type'
          },
          {
            label: '规格',
            prop: 'specificationData'
          },
          {
            label: '发货数量',
            prop: 'purchaseNumber',
            formatter: cellValue => {
              return this.membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.purchaseNumber}卷` : `${cellValue.purchaseNumber}件`
            }
          },
          {
            label: '发货卡号',
            prop: 'deliveryCardList',
            addHtml: 'deliveryCard'
          }
        ]
      },
      innerParams: {
        tableOption: false,
        tableColumns: [
          {
            label: '卡号',
            prop: 'cardNum'
          }
        ]
      },
      handleDeliveryCardVisible: false,
      deliveryCardList: []
    }
  },
  computed: {
    detailVisible: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  mounted() {
    this.getDetail()
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),
    handleDeliveryCard(list) {
      this.handleDeliveryCardVisible = true
      this.deliveryCardList = list.map(item => {
        return { cardNum: item }
      })
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        resolve()
      })
    },

    getDetail() {
      var params = { orderCode: deepClone(this.recordInfo.orderCode), currentPage: 1, pageSize: 1000 }
      factoryView(params).then(res => {
        console.log(res, 'res')
        this.detailInfo = res.list
        this.detailInfo.forEach(item => {
          if (item.deliveryDate) {
            item.deliveryDate = Util.dateFormate(item.deliveryDate, 'YYYY-MM-DD HH:mm:ss')
          }
          const _deliveryDetailList = item.deliveryDetailList
          console.log(_deliveryDetailList, '_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.deliveryDetailList.forEach(info => {
          //   info.goodsWarehousingList.forEach(item => {
          //     item.goodsType = info.goodsType
          //   })
          // })
        })
      })
    },

    handleClose() {
      // this.$emit('dialogClose')
      this.detailVisible = false
    }

  }
}

</script>
<style lang="scss" scoped>
.stockMonthDailog {
  // ::v-deep.el-dialog {
  max-height: 60vh;
  overflow: auto;
  // }
}

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

.address-info {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  // justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  // height: 36px;
  // padding: 0 20px;
  margin-top: 10px;
  font-size: 14px;
  color: #666666;

  > span {
    margin-right: 20px;
    margin-bottom: 10px;
  }

  .label {
    color: #333333;
  }

  .address {
    // min-width: 500px;
  }
}

.detail-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #666666ff;
  font-size: 14px;
  margin-top: 16px;

  span {
    color: #333333ff;
  }

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

.orderCode {
  margin-top: 0;
}

.table-wrap {
  border: 1px solid #e5e5e5;
  padding: 16px;
  box-sizing: border-box;
  margin-top: 16px;
}

.addressTitle {
  display: flex;
  align-items: center;

  .title {
    font-family: PingFangSC-Medium;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
  }

  .icon {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }
}
</style>