special.vue 8.6 KB
Newer Older
黄卓's avatar
黄卓 committed
1 2 3
<template>
  <div class="app-container">
    <el-card>
4
      <div slot="header" class="card-title">{{$t('申请特价')}}</div>
黄卓's avatar
黄卓 committed
5
      <div class="offer-header">
6 7 8 9 10 11 12 13
        <el-descriptions>
            <el-descriptions-item :label="$t('报价单号')">{{offer.number}}</el-descriptions-item>
            <el-descriptions-item :label="$t('始发地')">{{$l(departure, 'title')}}</el-descriptions-item>
            <el-descriptions-item :label="$t('目的地')">{{$l(objective, 'title')}}</el-descriptions-item>
            <el-descriptions-item :label="$t('运输方式')">
              <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="offer.transportId" />
            </el-descriptions-item>
            <el-descriptions-item :label="$t('出货渠道')">
dragondean@qq.com's avatar
dragondean@qq.com committed
14
              {{channel ? $l(channel, 'name') : '/'}}
15
            </el-descriptions-item>
黄卓's avatar
黄卓 committed
16

17 18 19 20 21
            <el-descriptions-item :label="$t('创建时间')">{{offer.createTime}}</el-descriptions-item>
            <el-descriptions-item :label="$t('状态')">
              <dict-tag :type="DICT_TYPE.ECW_OFFER_STATUS" :value="offer.status" />
            </el-descriptions-item>
        </el-descriptions>
黄卓's avatar
黄卓 committed
22 23 24
      </div>

      <el-table v-loading="loading" :data="offer.offerProdRespVOList">
25
        <el-table-column :label="$t('序号')" align="center" prop="id" type="index"></el-table-column>
黄卓's avatar
黄卓 committed
26
        <el-table-column
27
          :label="$t('品名')">
Marcus's avatar
Marcus committed
28 29 30
          <template v-slot="{row}">
            {{ row.prodTitleZh }}/{{ row.prodTitleEn }}
          </template>
黄卓's avatar
黄卓 committed
31 32
        </el-table-column>
        <el-table-column
33
          :label="$t('品牌')">
34
          <template v-slot="{row}">
35
            <dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brand"></dict-tag>
36
          </template>
黄卓's avatar
黄卓 committed
37 38
        </el-table-column>
        <el-table-column
39 40 41
          :label="$t('件数')" prop="num"></el-table-column>
        <el-table-column
          :label="$t('包装')">
Marcus's avatar
Marcus committed
42
          <template v-slot="{row}">
43
            <dict-tag :value="row.unit" :type="DICT_TYPE.ECW_PACKAGING_TYPE" />
Marcus's avatar
Marcus committed
44
          </template>
黄卓's avatar
黄卓 committed
45
        </el-table-column>
黄卓's avatar
黄卓 committed
46

黄卓's avatar
黄卓 committed
47
        <el-table-column
48
          :label="$t('原价')">
黄卓's avatar
黄卓 committed
49
          <template v-slot="{row}">
Marcus's avatar
Marcus committed
50
            <template v-if="!row.originalSeaFreight">{{ $t('未报价') }}</template>
51 52 53 54 55 56 57 58
            <template v-else-if="row.charging ==1">
              {{$t('全包价')}}{{ row.originalSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
            </template>
            <template v-else>
              {{$t('运费')}}{{ row.originalSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
              <br>
              {{$t('清关费')}}{{ row.originalClearanceFreight }} {{ currencyMap[row.clearanceFreightCurrency] }}/{{ unitMap[row.clearanceFreightVolume] }}
            </template>
黄卓's avatar
黄卓 committed
59 60 61
          </template>
        </el-table-column>
        <el-table-column
Marcus's avatar
Marcus committed
62
          :label="$t('成本价')">
黄卓's avatar
黄卓 committed
63
          <template v-slot="{row}">
Marcus's avatar
Marcus committed
64
            <template v-if="!row.costSeaFreight">{{ $t('未报价') }}</template>
65 66 67 68 69 70 71 72
            <template v-else-if="row.charging">
              {{$t('全包价')}}{{ row.costSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
            </template>
            <template v-else>
              {{$t('运费')}}{{ row.costSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
              <br>
              {{$t('清关费')}}{{ row.oneClearanceFreight }} {{ currencyMap[row.clearanceFreightCurrency] }}/{{ unitMap[row.clearanceFreightVolume] }}
            </template>
黄卓's avatar
黄卓 committed
73 74 75
          </template>
        </el-table-column>
        <el-table-column
dragondean@qq.com's avatar
dragondean@qq.com committed
76
          :label="$t('销售价')">
黄卓's avatar
黄卓 committed
77
          <template v-slot="{row}">
Marcus's avatar
Marcus committed
78
            <template v-if="!row.oneSeaFreight">{{ $t('未报价') }}</template>
79 80 81 82 83 84 85 86
            <template v-else-if="row.charging">
              {{$t('全包价')}}{{ row.oneSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
            </template>
            <template v-else>
              {{$t('运费')}}{{ row.oneSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
              <br>
              {{$t('清关费')}}{{ row.oneClearanceFreight }} {{ currencyMap[row.clearanceFreightCurrency] }}/{{ unitMap[row.clearanceFreightVolume] }}
            </template>
黄卓's avatar
黄卓 committed
87 88 89
          </template>
        </el-table-column>
        <el-table-column
90
          :label="$t('操作')">
Marcus's avatar
Marcus committed
91
          <template v-slot="{row}">
dragondean@qq.com's avatar
dragondean@qq.com committed
92 93
            <el-button  v-if="row.seaFreight > 0" size="mini" type="text" @click="showOfferProdId=row.offerProdId">{{$t('优惠申请')}}</el-button>
            <el-button  v-if="row.seaFreight > 0" size="mini" type="text" @click="showCommissionProd=row">{{$t('佣金规则')}}</el-button>
Marcus's avatar
Marcus committed
94
          </template>
黄卓's avatar
黄卓 committed
95 96 97
        </el-table-column>

      </el-table>
98

99
      <!-- <div style="text-align: center;margin-top: 80px">
Marcus's avatar
Marcus committed
100 101 102
        <el-button type="primary">{{ $t('申请重货优惠') }}</el-button>
        <el-button type="primary">{{ $t('申请泡货优惠') }}</el-button>
        <el-button type="primary">{{ $t('关闭窗口') }}</el-button>
103
      </div> -->
104
      <special-discount v-if="showOfferProdId"      :offerProdId="showOfferProdId"        @close="showOfferProdId=null"       @success="onSuccess" />
dragondean@qq.com's avatar
dragondean@qq.com committed
105
      <commossion v-if="showCommissionProd" :offer="offer" :offerProd="showCommissionProd" @close="showCommissionProd=null"  @success="onSuccess" />
黄卓's avatar
黄卓 committed
106 107 108 109 110
    </el-card>
  </div>
</template>

<script>
Marcus's avatar
Marcus committed
111
import {DICT_TYPE, getDictDataLabel} from '@/utils/dict'
黄卓's avatar
黄卓 committed
112
import {getOffer} from '@/api/ecw/offer'
Marcus's avatar
Marcus committed
113 114
import {getUnitList} from "@/api/ecw/unit"
import {getCurrencyList} from "@/api/ecw/currency"
115
import {getProductAttrList} from "@/api/ecw/productAttr"
黄卓's avatar
黄卓 committed
116
import { parseTime } from '@/utils/ruoyi'
117
import {listByIds} from '@/api/ecw/region'
dragondean@qq.com's avatar
dragondean@qq.com committed
118
import {getChannel} from '@/api/ecw/channel'
dragondean@qq.com's avatar
dragondean@qq.com committed
119
import SpecialDiscount from '@/views/ecw/offer/components/SpecialDiscount'
120 121
import Commossion from '@/views/ecw/offer/components/Commossion'

黄卓's avatar
黄卓 committed
122 123 124
export default {
  name: "OfferSpecial",
  components: {
125
    SpecialDiscount, Commossion
黄卓's avatar
黄卓 committed
126 127 128 129 130 131
  },
  props: {
    offerId: String
  },
  data() {
    return {
黄卓's avatar
黄卓 committed
132
      parseTime,
Marcus's avatar
Marcus committed
133 134
      DICT_TYPE,
      getDictDataLabel,
黄卓's avatar
黄卓 committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
      // 遮罩层
      loading: true,
      list: [],
      total:0,
      params:{
        page:1,
        rows:20,
        offerId:0,
        type:2
      },
      relationId:0,
      creatorName:'test',
      offer: {
        number: '',
        offerProdRespVOList: []
Marcus's avatar
Marcus committed
150 151 152
      },
      unitList:[],
      currencyList:[],
153
      productAttrList:[],
154
      objective: null,
dragondean@qq.com's avatar
dragondean@qq.com committed
155 156
      departure: null,
      channel: null, // 渠道信息
157
      showOfferProdId: null, // 显示申请优惠的产品id
dragondean@qq.com's avatar
dragondean@qq.com committed
158
      showCommissionProd: null, // 修改佣金规则的产品ID
黄卓's avatar
黄卓 committed
159
    };
160 161 162
  },
  watch:{

黄卓's avatar
黄卓 committed
163 164
  },
  created() {
165
    this.getOffer()
Marcus's avatar
Marcus committed
166 167
    getUnitList().then(res => this.unitList = res.data)
    getCurrencyList().then(res => this.currencyList = res.data)
168
    getProductAttrList().then(res => this.productAttrList = res.data)
黄卓's avatar
黄卓 committed
169 170 171 172
  },
  methods: {
    getOffer(){
      this.loading = true
dragondean@qq.com's avatar
dragondean@qq.com committed
173
      getOffer(this.offerId || this.$route.query.offerId).then(response => {
黄卓's avatar
黄卓 committed
174
        this.offer = response.data
175
        this.getCity()
dragondean@qq.com's avatar
dragondean@qq.com committed
176
        this.getChannel()
dragondean@qq.com's avatar
dragondean@qq.com committed
177 178
      }).finally(() => {
        this.loading = false
dragondean@qq.com's avatar
dragondean@qq.com committed
179 180 181
      })
    },
    getChannel(){
黄卓's avatar
黄卓 committed
182
      if(!this.offer.channelId) return
dragondean@qq.com's avatar
dragondean@qq.com committed
183 184
      getChannel(this.offer.channelId).then(res => {
        this.channel = res.data
185 186 187 188 189 190
      })
    },
    getCity(){
      listByIds({ids: [this.offer.objectiveId, this.offer.departureId].join(',')}).then(res => {
        this.objective = res.data.find(item => item.id == this.offer.objectiveId)
        this.departure = res.data.find(item => item.id == this.offer.departureId)
黄卓's avatar
黄卓 committed
191
      })
192 193 194 195 196 197 198 199 200 201 202
    },
    getProductNamesByIds(ids){
      const result = []
      ids.split(',').forEach(e => {
        this.productAttrList.forEach(f => {
          if (parseInt(e) === f.id) {
            result.push(f.attrName)
          }
        })
      })
      return result.join(',')
dragondean@qq.com's avatar
dragondean@qq.com committed
203 204 205
    },
    onSuccess(){
      this.showOfferProdId = null
dragondean@qq.com's avatar
dragondean@qq.com committed
206
      this.showCommissionProd = null
黄卓's avatar
黄卓 committed
207
    }
Marcus's avatar
Marcus committed
208 209
  },
  computed: {
210
    currencyMap(){
Marcus's avatar
Marcus committed
211 212
      let map = {}
      this.currencyList.forEach(item => {
dragondean@qq.com's avatar
dragondean@qq.com committed
213
        map[item.id] = this.$l(item, 'title')
Marcus's avatar
Marcus committed
214 215 216 217 218 219
      })
      return map
    },
    unitMap(){
      let map = {}
      this.unitList.forEach(item => {
dragondean@qq.com's avatar
dragondean@qq.com committed
220
        map[item.id] = this.$l(item, 'title')
Marcus's avatar
Marcus committed
221 222 223
      })
      return map
    }
黄卓's avatar
黄卓 committed
224
  }
Marcus's avatar
Marcus committed
225

黄卓's avatar
黄卓 committed
226 227 228 229 230 231 232 233 234 235 236 237 238 239
};
</script>
<style>
.card-title{
  font-size: 18px;
  font-weight: bold;
}
.offer-header{
  padding-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>