新版交易所前段管理后台
1
PC-20250623MANY\Administrator
2025-09-29 2503cce21fbe5520305c3fa7ee1ae9b19dace403
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
  <el-dialog
    :modal="false"
    title="选择发货地址"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
      <el-form-item label="快递公司">
        <el-select v-model="dataForm.dvyId" placeholder="请选择">
          <el-option
            v-for="item in dataForm.dvyNames"
            :key="item.dvyId"
            :label="item.dvyName"
            :value="item.dvyId">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="快递单号" prop="dvyFlowId">
        <el-input v-model="dataForm.dvyFlowId" controls-position="right" :min="0" label="快递单号"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>
<script>
  export default {
    data () {
      var validDvyFlowId = (rule, value, callback) => {
        if (!value.trim()) {
          callback(new Error('不能为空'))
        } else {
          callback()
        }
      }
      return {
        visible: false,
        dataForm: {
          dvyId: '',
          dvyFlowId: 0,
          dvyNames: [],
          orderNumber: 0
        },
        dataRule: {
          dvyFlowId: [
            { required: true, message: '不能为空', trigger: 'blur' },
            { validator: validDvyFlowId, trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      init (orderNumber, dvyId, dvyFlowId) {
        this.visible = true
        this.dataForm.orderNumber = orderNumber || ''
        this.dataForm.dvyId = dvyId || ''
        this.dataForm.dvyFlowId = dvyFlowId || ''
        this.$http({
          url: this.$http.adornUrl('/admin/delivery/list'),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({data}) => {
          this.dataForm.dvyNames = data
        })
      },
      // 表单提交
      dataFormSubmit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/order/order/delivery`),
              method: 'put',
              data: this.$http.adornData({
                'orderNumber': this.dataForm.orderNumber,
                'dvyId': this.dataForm.dvyId,
                'dvyFlowId': this.dataForm.dvyFlowId
              })
            }).then(({data}) => {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.visible = false
                  this.$emit('refreshDataList')
                }
              })
            })
          }
        })
      }
    }
  }
</script>