// /**分页查询接口重试日志 */
import request from '@/utils/request'

import { UPCLOUD_RDC_TMS_MAINDATA_SERVICE, UPCLOUD_RDC_TMS_BUSINESS_SERVICE } from '@/config/serviceSettings.js'
const business = UPCLOUD_RDC_TMS_BUSINESS_SERVICE

export const mainTableInfoUrl = business + '/waitForSelfWithdrawal/page'
export const advancedQueryUrl = business + '/waitForSelfWithdrawal/advanced_query_shipbill'

export const goodsTableUrl = business + '/waitForSelfWithdrawal/query/Item'
export const packageTableUrl = business + '/waitForSelfWithdrawal/query/package'
//运输管理——自提确认
export const confirmSubmit = (_this, data, close) => {
  let url = business + '/waitForSelfWithdrawal/confirm'
  if (_this.card_title === '自提车辆登记') {
    url = business + '/waitForSelfWithdrawal/vehicle_register'
    _this.$refs.updateFormModal.confirmLoading = true
    // data.itemVOList = _this.itemVOList
  }

  return request({
    url,
    method: 'post',
    data,
  })
    .then((response) => {
      close()
      if (response.success) {
        _this.visible = false
        _this.clearChildrenTableAll()
        _this.$refs.mainTable.reload()
        _this.mainsSelectedRowKeys = []
        _this.$message.success(response.message)
      } else {
        _this.$exception(response)
      }
      _this.$refs.updateFormModal.confirmLoading = false

      return resolve(response)
    })
    .catch((response) => {
      _this.visible = false
    })
}

export const queryConfirm = (_this, data, close) => {
  let url = business + '/waitForSelfWithdrawal/confirm_query'
  return request({
    url,
    method: 'post',
    data,
  })
}

export const exportUrls = {
  allUrl: business + '/waitForSelfWithdrawal/export_all_shipbill',
  currentUrl: business + '/waitForSelfWithdrawal/export_page_shipbill',
  selectUrl: business + '/waitForSelfWithdrawal/export_select_line_shipbill',
  ids: []

}
export const printUrl = business + '/waitForSelfWithdrawal/print'

// 策略拆分
export const smart_split = (data) => {
  return request.post(business + '/waitForSelfWithdrawal/smart_split', data)
}

// 智能拆分(选择策略)
export const smart_split_strategy = (data) => {
  return request.post(business + '/waitForSelfWithdrawal/smart_split_strategy', data)
}
