result.vue 3.86 KB
Newer Older
ylpmty's avatar
ylpmty committed
1 2 3 4
<template>
  <div class="app-container">
    <el-form ref="form" :model="form" :rules="rules" label-width="120px">

5 6
      <el-form-item label="报价单号">
        <div>{{number}}</div>
ylpmty's avatar
ylpmty committed
7 8 9 10 11 12 13 14 15 16 17
      </el-form-item>

      <el-form-item label="结果" prop="result">
        <dict-selector form-type="radio" :type="DICT_TYPE.ECW_OFFER_RESULT" v-model="form.result" />
      </el-form-item>

      <template v-if="form.result==1">
        <el-form-item label="入仓类型" prop="warehousingType">
          <dict-selector :type="DICT_TYPE.ECW_WAREHOUSING_TYPE" v-model="form.warehousingType" />
        </el-form-item>
        <el-form-item label="关联订单" prop="orderIds">
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
          <!-- <el-input v-model="form.orderIds" style="width: 206px;"></el-input> -->
          <el-select
            v-model="form.orderNo"
            filterable
            remote
            reserve-keyword
            placeholder="订单号"
            @focus="checkOptions"
            :remote-method="remoteMethod"
            :loading="selectLoading">
            <el-option
              v-for="item in orderNoList"
              :key="item.value"
              :label="item.value"
              :value="item.value">
            </el-option>
          </el-select>
ylpmty's avatar
ylpmty committed
35 36 37 38 39 40 41 42 43
        </el-form-item>
      </template>
      <template v-else>
        <el-form-item label="原因" prop="reason">
          <el-input style="width: 500px;" type="textarea" placeholder="" v-model="form.reason"></el-input>
        </el-form-item>
      </template>

      <el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
44
        <el-button type="primary" @click="submitForm">{{form.result==1? $t("确定并新增草稿订单") : $t("提交")}}</el-button>
ylpmty's avatar
ylpmty committed
45 46 47 48 49 50 51 52 53 54 55 56 57
        <el-button @click="$router.back()">返 回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { updateOfferResult } from '@/api/ecw/offer';

import CustomersSelector from '@/components/CustomersSelector'
import RoutersSelector from '@/components/RoutersSelector'
import ProductsSelector from '@/components/ProductsSelector'
import Editor from '@/components/Editor'
import Selector from '@/components/Selector/index'
58
import {getOrderNoSearch} from '@/api/ecw/order'
ylpmty's avatar
ylpmty committed
59
export default {
60
  name: "OfferResult",
ylpmty's avatar
ylpmty committed
61 62 63
  components: { CustomersSelector, RoutersSelector, ProductsSelector, Editor, Selector },
  data() {
    return {
64
      number: null,
ylpmty's avatar
ylpmty committed
65 66 67 68
      // 遮罩层
      loading: true,
      // 表单参数
      form: {
69
        "number": null,
ylpmty's avatar
ylpmty committed
70 71 72 73 74 75 76
        "offerId": undefined,
        "orderIds": undefined,
        "reason": undefined,
        "result": 1,
        "warehousingType": undefined
      },
      // 表单校验
77 78
      rules: {
        warehousingType: {required: true, message: '请选择入仓类型'}
79 80 81
      },
      selectLoading: false,
      orderNoList: []
ylpmty's avatar
ylpmty committed
82 83 84 85 86 87 88 89 90
    };
  },
  computed: {

  },
  watch: {

  },
  created() {
91 92 93 94 95 96 97
    if(this.$route.query.number){
      this.number = this.$route.query.number
    }
    if(this.$route.query.offerId){
      this.form.offerId = this.$route.query.offerId
    }
    
ylpmty's avatar
ylpmty committed
98 99
  },
  methods: {
100
    
ylpmty's avatar
ylpmty committed
101 102 103 104 105 106 107
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (!valid) {
          return;
        }
        let data = Object.assign({}, this.form)
dragondean@qq.com's avatar
dragondean@qq.com committed
108 109
        updateOfferResult(data).then(response => {
          if(response.data > 0){
dragondean@qq.com's avatar
dragondean@qq.com committed
110
            this.$message.success(this.$t('赢单成功'))
dragondean@qq.com's avatar
dragondean@qq.com committed
111 112 113
            this.$redirect('../order/edit?id=' + response.data)
            return
          }
dragondean@qq.com's avatar
dragondean@qq.com committed
114
          this.$message.success(this.$t('输单成功'))
ylpmty's avatar
ylpmty committed
115 116 117 118
          this.$router.back();
        });
      });
    },
119 120 121 122 123 124 125 126 127 128 129 130 131
    remoteMethod(query){
      this.selectLoading = true
      getOrderNoSearch({key: query, pageSize: 200}).then(res => {
        this.orderNoList = res.data.list
      }).finally(res => {
        this.selectLoading = false
      })
    },
    checkOptions(){
      if(!this.orderNoList.length){
        this.remoteMethod("")
      }
    }
ylpmty's avatar
ylpmty committed
132 133 134
  },
};
</script>