<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item prop="orderNo">
        <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable>
          <el-option v-for="dict in dict.type.purchase_order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label-width="90px" prop="orgId">
        <el-select v-model="queryParams.orgId" placeholder="请选择" clearable>
          <el-option-group label="门店">
            <template>
              <el-option v-for="store in storeList" :key="store.id + store.sourceType" :label="store.name" :value="store.id"> </el-option>
            </template>
          </el-option-group>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <Page uri="/mapi/order/purchaseGoods/sellGoodsListByHqFactory" :request-params="queryParams" ref="pagination">
      <!--      <el-table-column type="selection" width="55" align="center" fixed="left"/>-->
      <el-table-column label="订单编号" align="center" prop="orderNo" width="250px" />
      <el-table-column label="门店名称" align="center" prop="orgName" width="150px" v-if="userInfoVO.userType == '01'" />
      <el-table-column label="门店名称" align="center" prop="orgName" width="150px" v-if="userInfoVO.userType == '00'" />
      <el-table-column label="进货总价（元）" align="center" prop="costTotalPrice" width="120px" />
      <el-table-column label="订单状态" align="center" prop="orderStatus" width="150px">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.purchase_order_status" :value="scope.row.orderStatus" />
        </template>
      </el-table-column>
      <el-table-column label="支付方式" align="center" prop="payType" width="150px">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.recharge_pay_type" :value="scope.row.payType" />
        </template>
      </el-table-column>
      <el-table-column label="配送方式" align="center" prop="deliveryWay" width="100px">
        <template slot-scope="scope">
          <span v-if="scope.row.deliveryWay == '0'">到店自取</span>
          <span v-if="scope.row.deliveryWay == '1'">快递</span>
          <span v-if="scope.row.deliveryWay == '2'">自送</span>
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column label="下单时间" align="center" prop="createTime" width="140" />
      <el-table-column label="支付时间" align="center" prop="payTime" width="140" />
      <el-table-column label="发货时间" align="center" prop="sendTime" width="140" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
        <template slot-scope="scope">
          <el-button type="text" icon="el-icon-chat-dot-square" @click="orderDetail(scope.row)">订单详情</el-button>
          <el-button type="text" icon="el-icon-check" @click="confirmOrder(scope.row)" v-hasPermi="['order:purchaseGoods:edit']"
            v-if="scope.row.orderStatus == '1'">接单</el-button>
          <el-button type="text" icon="el-icon-close" @click="refuseOrder(scope.row)" v-hasPermi="['order:purchaseGoods:edit']"
            v-if="scope.row.orderStatus == '1'">拒单</el-button>
          <el-button type="text" icon="el-icon-shopping-cart-full" @click="selectDeliveryWay(scope.row)" v-hasPermi="['order:purchaseGoods:edit']"
            v-if="scope.row.orderStatus == '2'">出货</el-button>
          <el-button type="text" icon="el-icon-truck" @click="deliveryInfo(scope.row)" v-hasPermi="['order:purchaseGoods:edit']"
            v-if="(scope.row.orderStatus == '3' || scope.row.orderStatus == '4' || scope.row.orderStatus == '5') && scope.row.deliveryWay == '1'">物流信息
          </el-button>
          <el-button type="text" icon="el-icon-check" @click="confirmReceive(scope.row)" v-hasPermi="['order:purchaseGoods:edit']"
            v-if="scope.row.orderStatus == '3' || scope.row.orderStatus == '4'">确认交货</el-button>
        </template>
      </el-table-column>
    </Page>

    <!--    详情-->
    <el-dialog :title="detailTitle" :visible.sync="openDetail" size="80%">
      <el-card>
        <el-descriptions title="基本信息" v-show="detailView" :column="3" border :label-style="{ 'text-align': 'center' }"
          :contentStyle="{ 'text-align': 'center' }">
          <el-descriptions-item span="2" :label="orgName">{{ detailView.name }}</el-descriptions-item>
          <el-descriptions-item label="订单状态">
            <dict-tag :options="dict.type.purchase_order_status" :value="detailView.orderStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="收货联系人">{{ detailView.contactName ? detailView.contactName : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="收货人手机号">{{ detailView.contactPhone ? detailView.contactPhone : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="下单时间">{{ detailView.createTime ? detailView.createTime : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="支付时间">{{ detailView.payTime ? detailView.payTime : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="发货时间">{{ detailView.sendTime ? detailView.sendTime : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="确认收货时间">{{ detailView.finishTime ? detailView.finishTime : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="订单总价（元）">{{ costTotalPrice ? costTotalPrice : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="物流公司">{{ detailView.deliveryCompany ? detailView.deliveryCompany : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="物流单号">{{ detailView.deliveryNo ? detailView.deliveryNo : '暂无信息' }}</el-descriptions-item>
          <el-descriptions-item label="收货地址" span="3">
            {{ detailView.province }}{{ detailView.city }}{{ detailView.area }}{{ detailView.address }}{{ detailView.addressDetail }}
          </el-descriptions-item>
          <el-descriptions-item label="备注信息" span="3">{{ detailView.remark ? detailView.remark : '暂无信息' }}</el-descriptions-item>
        </el-descriptions>
      </el-card>

      <el-divider></el-divider>

      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>商品详情</span>
        </div>
        <el-table v-loading="loading" fit highlight-current-row border stripe :data="detailList">
          <el-table-column label="分类" align="center" prop="goodsCategoryName" />
          <el-table-column :label="goodsType == 0 ? '商品名称' : '材料名称'" align="center" prop="goodsName" />
          <el-table-column :label="goodsType == 0 ? '商品规格' : '材料规格'" align="center">
            <template slot-scope="scope">
              <div style="text-align: center">{{ scope.row.skuName.replace(' ', '/') }}</div>
            </template>
          </el-table-column>
          <el-table-column label="数量" align="center" prop="buyNum" />
          <el-table-column label="价格（元）" align="center" prop="costPrice" />
          <el-table-column label="总和（元）" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.buyNum * 10000 * parseFloat(scope.row.costPrice)) / 10000 }}</span>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
      <!-- <el-row :gutter="10" class="box-shadow" style="margin-top: 10px">
        <el-col :span="21">
          <el-form label-width="130px" style="height: 80px; padding-top: 20px; text-align: right" :inline="true" size="small">
            <el-form-item label="总金额（元）:">
              {{ costTotalPrice }}
            </el-form-item>
          </el-form>
        </el-col>
      </el-row> -->
    </el-dialog>

    <!-- 订单出货对话框 -->
    <el-dialog title="订单出货信息" :visible.sync="openDeliveryPage" size="40%" append-to-body :before-close="deliveryClose">
      <el-row :gutter="15">
        <el-form ref="deliveryVo" :model="deliveryVo" :rules="deliveryRules" label-width="120px">
          <el-col :span="24">
            <el-form-item label="快递公司" prop="deliveryCompany">
              <el-radio-group v-model="deliveryVo.deliveryCompany" @input="changeDeliveryId">
                <el-radio-button v-for="dict in deliveryData" :label="dict.deliveryName" :key="dict.deliveryName"></el-radio-button>
              </el-radio-group>
            </el-form-item>

            <el-form-item label="服务类型" prop="serviceType">
              <div class="servicecard" v-for="del in serviceData" :key="del.serviceType" @click="checkserviceId(del)"
                :class="{ active: deliveryVo.serviceType == del.serviceType }">
                <div class="check"><i class="el-icon-check"></i></div>
                {{ del.serviceName }}
              </div>
            </el-form-item>

            <el-form-item label="预期揽件时间" prop="expectTime">
              <el-date-picker type="datetime" placeholder="选择预期揽件时间" v-model="deliveryVo.expectTime" style="width: 100%"
                value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" :picker-options="{
                                    disabledDate: (time) => {
                                        return time.getTime() < Date.now() - 3600 * 1000 * 24
                                    },
                                    selectableRange: startTimeRange
                                }" :default-time="deliTime" class="date_picker" :editable="false"></el-date-picker>
            </el-form-item>

            <el-form-item label="包裹数量" prop="count">
              <el-input v-model="deliveryVo.count" placeholder="请输入包裹数量" clearable></el-input>
            </el-form-item>

            <el-form-item label="货物高度" prop="spaceHeight">
              <el-input v-model="deliveryVo.spaceHeight" placeholder="请输入货物高度" clearable>
                <template slot="append">厘米(cm)</template>
              </el-input>
            </el-form-item>

            <el-form-item label="货物长度" prop="spaceLength">
              <el-input v-model="deliveryVo.spaceLength" placeholder="请输入货物长度" clearable>
                <template slot="append">厘米(cm)</template>
              </el-input>
            </el-form-item>

            <el-form-item label="货物宽度" prop="spaceWidth">
              <el-input v-model="deliveryVo.spaceWidth" placeholder="请输入货物宽度" clearable>
                <template slot="append">厘米(cm)</template>
              </el-input>
            </el-form-item>

            <el-form-item label="货物总重量" prop="weight">
              <el-input v-model="deliveryVo.weight" placeholder="请输入货物总重量" clearable>
                <template slot="append">千克 (kg)</template>
              </el-input>
            </el-form-item>

            <el-form-item label="备注信息" prop="customRemark">
              <el-input v-model="deliveryVo.customRemark" rows="5" type="textarea" placeholder="请输入备注信息，比如易碎物品……" maxlength="500" show-word-limit
                clearable></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitDelivery('deliveryVo')" style="margin-left: 5%">提交</el-button>
        <el-button @click="cancelDelivery">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 快递信息对话框 -->
    <el-dialog title="快递信息" :visible.sync="openDeliveryinfo" size="40%" append-to-body :before-close="deliveryinfoClose">
      <div class="deliveryView">
        <div class="info">
          <span>快递公司：</span>
          <span>{{ deliveryView.name }}</span>
        </div>
        <div class="info">
          <span>收货地址：</span>
          <span>{{ deliveryView.address }}</span>
        </div>
      </div>

      <el-timeline v-if="deliveryView.pathItemList.length">
        <el-timeline-item v-for="(item, index) in deliveryView.pathItemList" :key="index" :timestamp="item.actionTime">
          {{ item.actionMsg }}
        </el-timeline-item>
      </el-timeline>

      <el-empty description="暂无快递信息" v-else></el-empty>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" style="margin-left: 5%" @click="openDeliveryinfo = false">关 闭</el-button>
      </div>
    </el-dialog>

    <!--    选择配送方式页面-->
    <el-dialog title="选择配送方式" :visible.sync="openDeliveryWayPage" width="400px" append-to-body>
      <el-row :gutter="10">
        <!-- <el-col :span="12">
                    <el-radio v-model="deliveryWay" label="1">物流快递</el-radio>
                </el-col> -->
        <el-col :span="12">
          <el-radio v-model="deliveryWay" label="2">自送</el-radio>
        </el-col>
      </el-row>
      <el-row :gutter="10">
        <div>
          <el-button type="primary" @click="submitDeliveryWay" style="margin-left: 3%; margin-top: 40px">确定</el-button>
        </div>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { addPurchaseGoods, confirmOrder, getPurchaseGoods, refuseOrder, confirmReceivePurchaseGoods, sellGoodsListByHqFactory, outOrderGoodsBySelf, outOrderGoods } from '@/api/order/purchaseGoods'
import { allOrg } from '@/api/system/store'
import { getdeliveryAll, getDeliveryPath } from '@/api/order/goods'
export default {
  name: 'retailStore',
  dicts: ['purchase_order_status', 'recharge_pay_type'],
  data() {
    var validateNumberInput = (rule, value, callback) => {
      if (!value || isNaN(value)) {
        callback(new Error('只能输入数字，不能为空'))
      } else {
        callback()
      }
    }
    return {
      userInfoVO: null,
      //
      orderLoading: true,
      // 遮罩层
      loading: false,
      detailLoading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 弹出层标题
      title: '',
      titleType: '',
      detailTitle: '',
      // 是否显示弹出层
      open: false,
      openDetail: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      goodsType: null,
      // 商品订单表格数据
      purchaseGoodsList: [],
      // 分类id
      goodsCategoryId: null,
      // 可选商品集合
      goodsList: null,
      // 已选商品集合
      addGoodsList: [],
      // 左侧分类集合
      categoryList: null,
      //
      defaultProps: {
        label: 'categoryName'
      },
      // 自定义一个计算数量的临时对象集合
      purchaseCountVOList: [],
      // 总金额
      totalPrice: 0,
      // 总件数
      totalCount: 0,
      // 详情数据
      detailView: {},
      orgName: '',
      // 提交的参数对象
      submitGoodsOrderVO: {},
      // 详情数据
      detailList: [],
      // 详情总金额
      costTotalPrice: null,
      orgList: [],
      storeList: [],
      factoryList: [],
      openDeliveryWayPage: false,
      openDeliveryPage: false,
      deliveryVo: {
        bizId: '',
        count: 1,
        customRemark: '',
        deliveryCompany: '',
        deliveryId: '',
        expectTime: '',
        orderId: null,
        serviceName: '',
        serviceType: null,
        spaceHeight: null,
        spaceLength: null,
        spaceWidth: null,
        weight: null
      },
      deliveryRules: {
        deliveryName: [{ required: true, message: '请选择物流公司', trigger: 'change' }],
        serviceType: [{ required: true, message: '请选择服务类型', trigger: 'change' }],
        expectTime: [{ required: true, message: '选择预期揽件时间', trigger: 'blur' }],
        count: [
          { required: true, message: '请输入包裹数量', trigger: 'blur' },
          { validator: validateNumberInput, trigger: 'blur' }
        ],
        spaceHeight: [
          { required: true, message: '请输入货物高度', trigger: 'blur' },
          { validator: validateNumberInput, trigger: 'blur' }
        ],
        spaceLength: [
          { required: true, message: '请输入货物长度', trigger: 'blur' },
          { validator: validateNumberInput, trigger: 'blur' }
        ],
        spaceWidth: [
          { required: true, message: '请输入货物宽度', trigger: 'blur' },
          { validator: validateNumberInput, trigger: 'blur' }
        ],
        weight: [
          { required: true, message: '请输入货物总重量', trigger: 'blur' },
          { validator: validateNumberInput, trigger: 'blur' }
        ],
        customRemark: [{ required: true, message: '请输入备注信息，比如易碎物品……', trigger: 'blur' }]
      },

      deliveryData: [], //快递公司数据
      serviceData: [], //快递公司服务类型数据
      startTimeRange: null,
      deliTime: null,

      openDeliveryinfo: false,
      deliveryView: {
        name: '',
        pathItemList: []
      },
      deliveryWay: '1',
      orderId: null
    }
  },
  created() {
    this.handleUser()
    this.goodsType = this.getUrlParam('goodsType')
    allOrg().then((res) => {
      this.orgList = res.data
      this.orgList.forEach((org) => {
        if (org.sourceType == '01') {
          this.factoryList.push(org)
        } else {
          this.storeList.push(org)
        }
      })
    })
    this.getList()
    // this.getdeliveryAll()
  },
  methods: {
    // 获取登录人信息
    handleUser() {
      this.userInfoVO = this.getUserInfo()
    },
    confirmOrder(row) {
      this.$confirm('是否确认接单？')
        .then(() => {
          confirmOrder(row.id).then((response2) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    refuseOrder(row) {
      this.$confirm('是否确认拒绝此订单？')
        .then(() => {
          refuseOrder(row.id).then((response2) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    submitDeliveryWay() {
      if (this.deliveryWay == '1') {
        this.openDeliveryWayPage = false
        this.sellOrder()
      } else {
        outOrderGoodsBySelf(this.orderId).then((response2) => {
          this.$message.success('操作成功')
          this.openDeliveryWayPage = false
          this.getList()
          //this.deliveryreset()
          this.orderId = null
        })
      }
    },
    selectDeliveryWay(row) {
      this.openDeliveryWayPage = true
      this.orderId = row.id
    },
    sellOrder() {
      this.deliveryreset()
      this.openDeliveryPage = true

      this.deliveryVo.deliveryCompany = this.deliveryData[0].deliveryName

      this.serviceData = this.deliveryData[0].serviceType

      // 获取当前时间
      const now = new Date()

      // 增加一个小时
      now.setHours(now.getHours() + 1)

      // 提取时分秒并格式化
      const hours = ('0' + now.getHours()).slice(-2)
      const minutes = ('0' + now.getMinutes()).slice(-2)
      const seconds = ('0' + now.getSeconds()).slice(-2)

      // 结果字符串
      this.deliTime = `${hours}:${minutes}:${seconds}`

      this.deliveryVo.orderId = this.orderId
    },
    submitDelivery(formName) {
      this.$confirm('是否确认出货配送？')
        .then(() => {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              outOrderGoods(this.deliveryVo).then((response2) => {
                this.$message.success('操作成功')
                this.getList()
                this.openDeliveryPage = false
                this.deliveryreset()
                this.orderId = null
              })
            }
          })
        })
        .catch(() => { })
    },
    confirmReceive(row) {
      this.$confirm('是否确认交货？')
        .then(() => {
          confirmReceivePurchaseGoods(row.id).then((response2) => {
            this.$message.success('操作成功')
            this.getList()
            this.openDeliveryPage = false
            this.deliveryreset()
            this.orderId = null
          })
        })
        .catch(() => { })
    },
    //获取快递公司
    getdeliveryAll() {
      getdeliveryAll().then((res) => {
        this.deliveryData = res.data
      })
    },
    //切换快递获取其他数据
    changeDeliveryId(value) {
      this.deliveryData.forEach((item, index) => {
        if (value == item.deliveryName) {
          this.deliveryVo.deliveryId = item.deliveryId
          this.deliveryVo.bizId = item.bizId

          this.serviceData = item.serviceType
        }
      })
    },
    checkserviceId(del) {
      this.deliveryVo.serviceType = del.serviceType
      this.deliveryVo.serviceName = del.serviceName
    },
    sendTimeDate(date) {
      if (!!date) {
        var nowDate = new Date(date).getFullYear() + '-' + (new Date(date).getMonth() + 1 < 10 ? '0' + (new Date(date).getMonth() + 1) : new Date(date).getMonth() + 1) + '-' + (new Date(date).getDate(date) < 10 ? '0' + new Date(date).getDate(date) : new Date(date).getDate(date))
        var nowTime =
          (new Date(date).getHours() < 10 ? '0' + new Date(date).getHours() : new Date(date).getHours()) +
          ':' +
          (new Date(date).getMinutes() < 10 ? '0' + new Date(date).getMinutes() : new Date(date).getMinutes()) +
          ':' +
          (new Date(date).getSeconds() < 10 ? '0' + new Date(date).getSeconds() : new Date(date).getSeconds())
        return nowDate + ' ' + nowTime
      } else {
        return ''
      }
    },
    cancelDelivery() {
      this.openDeliveryPage = false
      this.deliveryreset()
    },
    // 表单重置
    deliveryreset() {
      this.deliveryVo = {
        bizId: '',
        count: 1,
        customRemark: '',
        deliveryCompany: '',
        deliveryId: '',
        expectTime: '',
        orderId: 0,
        serviceName: '',
        serviceType: null,
        spaceHeight: null,
        spaceLength: null,
        spaceWidth: null,
        weight: null
      }
    },
    deliveryClose(done) {
      this.$confirm('是否关闭出货信息窗口，确认关闭？')
        .then(function () {
          done()
        })
        .then(() => { })
        .catch(() => { })
    },
    deliveryinfoClose(done) {
      this.$confirm('是否关闭快递信息窗口，确认关闭？')
        .then(function () {
          done()
        })
        .then(() => { })
        .catch(() => { })
    },
    deliveryInfo(row) {
      getDeliveryPath({
        orderId: row.id
      }).then((res) => {
        this.deliveryView.name = row.deliveryCompany
        this.deliveryView.pathItemList = res.data.pathItemList
        this.deliveryView.address = row.province + row.city + row.area + row.address + row.addressDetail

        console.log(this.deliveryView)

        this.openDeliveryinfo = true
      })
    },
    getList() {
      this.queryParams.goodsType = this.goodsType
      this.$nextTick(() => {
        this.$refs.pagination.handleSearch(true)
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    orderDetail(row) {
      this.openDetail = true
      this.detailTitle = '订单商品详情'
      this.detailLoading = true
      this.detailList = []
      this.detailView = {}
      const id = row.id
      getPurchaseGoods(id).then((response) => {
        this.detailView = response.data
        this.detailList = response.data.orderPurchaseGoodsVOList
        this.costTotalPrice = this.detailList[0].costTotalPrice
        if (this.detailView.sourceType == '00') {
          this.orgName = '总部'
        }
        if (this.detailView.sourceType == '01') {
          this.orgName = '工厂名称'
        }
        if (this.detailView.sourceType == '02') {
          this.orgName = '门店名称'
        }
        this.detailLoading = false
      })
    },
    checkClose(done) {
      this.$confirm('是否关闭表单，关闭后数据将丢失？')
        .then(function () {
          done()
        })
        .then(() => { })
        .catch(() => { })
    },
    submitForm() {
      if (this.totalCount == 0) {
        this.$message.error('商品数量为空，无法操作提交')
      }
      this.submitGoodsOrderVO.costTotalPrice = this.totalPrice
      this.submitGoodsOrderVO.goodsType = this.goodsType
      this.submitGoodsOrderVO.purchaseGoodsVOList = []

      this.addGoodsList.forEach((vo) => {
        let purchaseVO = this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId)
        let purchaseGoodsVO = {}
        purchaseGoodsVO.skuId = vo.id
        purchaseGoodsVO.goodsId = vo.goodsId
        purchaseGoodsVO.goodsCategoryId = purchaseVO.goodsCategoryId
        purchaseGoodsVO.goodsCategoryName = purchaseVO.goodsCategoryName
        purchaseGoodsVO.costPrice = vo.purchasePrice
        purchaseGoodsVO.buyNum = purchaseVO.count
        purchaseGoodsVO.skuName = ''
        vo.specVoList.forEach((spec) => {
          purchaseGoodsVO.skuName = purchaseGoodsVO.skuName + spec.specName + ':' + spec.specValue + ' '
        })
        this.submitGoodsOrderVO.purchaseGoodsVOList.push(purchaseGoodsVO)
      })

      addPurchaseGoods(this.submitGoodsOrderVO).then((response) => {
        this.$modal.msgSuccess('新增成功')
        this.open = false
        this.getList()
      })
    }
  }
}
</script>
<style>
.list_title {
    text-align: center;
    line-height: 40px;
}

.head-column1 {
    height: 600px;
    display: block;
    overflow-y: scroll;
}
.box-shadow .el-button--medium {
    font-size: 18px;
}
</style>
<style lang="scss" scoped>
.servicecard {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    background-color: #fff;
    border-radius: 5px;
    margin: 0 10px 10px 0;
    padding: 10px 20px;
    display: inline-block;
    cursor: pointer;
    position: relative;
    &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0px; /* 调整三角形的大小和位置 */
        width: 0;
        height: 0;
        border-left: 35px solid transparent;
        border-top: 35px solid #007bff;
        z-index: 50;
        opacity: 0;
    }
    .check {
        position: absolute;
        top: -5px;
        right: 3px;
        color: #fff;
        z-index: 100;
        opacity: 0;
    }

    &.active {
        &::after {
            opacity: 1;
        }
        .check {
            opacity: 1;
        }
    }
}

.deliveryView {
    margin: 0 20px 20px 20px;
    padding: 15px;
    border-radius: 5px;
    background-color: #f4f4f4;
    color: #555;
    .info:first-child {
        margin-bottom: 10px;
    }
}
</style>
