zhaojs
2023-09-15 39e2103e28830337c3be4dbd3dc7ad0a829ee78b
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
  <page-header-wrapper
    :breadcrumb="false"
  >
    <a-card :bordered="false">
      <template>
        <div class="table-page-search-wrapper" style="background-color: #fff;">
          <a-form layout="inline">
            <a-row :gutter="48">
              <a-col :md="8" :sm="24">
                <a-form-item label="订单号">
                  <a-input v-model="queryParam.tid" placeholder="请输入有赞订单号查询"/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item>
                  <a-button type="primary" @click="onSearch">查询</a-button>
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </div>
        <a-table
          style="background-color: #fff;"
          :pagination="pagination"
          :columns="columns"
          :data-source="dataSource"
          class="components-table-demo-nested"
          @expand="expandedRows"
          :expandedRowKeys="expandedRowKeys"
          rowKey="tid"
          :loading="loading"
        >
 
          <template slot="address" slot-scope="text, record">
            <a-tooltip placement="topLeft">
              <template #title> {{ record.delivery_province+record.delivery_city+record.delivery_district+record.delivery_address }}</template>
              {{ record.delivery_province+record.delivery_city+record.delivery_district+record.delivery_address }}
            </a-tooltip>
 
          </template>
          <template #expandedRowRender>
            <a-table
              style="background-color: #fff;"
              :columns="innerColumns"
              :data-source="innerData"
              :pagination="false" >
              <span slot="itemimg" slot-scope="text, record">
                <template v-if="record.picPath!=null">
                  <img style="width: 50%;" :src="record.picPath" />
                </template>
                <template v-else>
                  无
                </template>
              </span>
 
              <template slot="action" slot-scope="text, record">
                <a @click="sendGoods(record)">发货</a>
              </template>
 
            </a-table>
          </template>
        </a-table>
      </template>
    </a-card>
  </page-header-wrapper>
</template>
 
<script>
import { defineComponent, Pagination } from 'vue'
import { GetWaiteCreateTrade, SendYzGoods } from '@/api/tradeapi'
const columns = [
{ title: '订单号', dataIndex: 'tid', key: 'tid' },
{ title: '订单创建时间', dataIndex: 'create_time' },
{ title: '支付时间', dataIndex: 'pay_time' },
{ title: '支付金额', dataIndex: 'payment' },
{ title: '订单状态', dataIndex: 'status_str' },
{ title: '收货人', dataIndex: 'receiver_name' },
{ title: '收货手机号', dataIndex: 'receiver_tel' },
{ title: '收货地址', dataIndex: 'address', width: '200px', ellipsis: true, scopedSlots: { customRender: 'address' } }
 
]
const innerColumns = [
{ title: '子订单号', dataIndex: 'oid', key: 'oid' },
{
  title: '商品',
  dataIndex: 'proImg',
  width: '150px',
  scopedSlots: { customRender: 'itemimg' }
},
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '购买数量', dataIndex: 'num', key: 'num' },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
  name: 'Waitsendout',
  data () {
    return {
      queryParam: {},
      loading: false,
      columns,
    innerColumns,
    expandedRowKeys: [],
      dataSource: [],
      innerData: [],
      pagination: {
        current: 1,
        pageSize: 10,
        total: 0,
        pageSizeOptions: ['10', '20'],
        onChange: this.onPageChange,
         onShowSizeChange: this.onPageChange
      }
    }
  },
  created () {
    this.GetTradeList()
  },
  methods: {
    onSearch () {
        this.GetTradeList()
      },
      onPageChange (current, size) {
              this.pagination.current = current
              this.pagination.pageSize = size
              this.GetTradeList()
        },
    // 获取订单数据
    GetTradeList () {
      this.loading = true
      const parameter = {
        PageNo: this.pagination.current,
        PageSize: this.pagination.pageSize,
        tid: this.queryParam.tid,
        SearchType: 1
      }
      GetWaiteCreateTrade(parameter)
          .then(res => {
            this.dataSource = res.result.data
            this.pagination.total = res.result.totalCount
          }).finally(() => {
            this.loading = false
            })
    },
    // 展开
    expandedRows (expand, record) {
      this.innerData = []
      this.expandedRowKeys = []
      if (expand) {
        this.expandedRowKeys.push(record.tid)
        this.innerData = record.orders
      }
    },
    // 订单发货
    sendGoods (record) {
      this.loading = true
      const oids = []
      oids.push(record.oid)
      const parameter = {
        YzOid: oids
      }
      SendYzGoods(parameter).then(res => {
          if (res.result == true) {
            this.$message.success(`发货成功`)
            this.GetTradeList()
          }
      }).finally(() => {
        this.loading = false
        })
    }
  }
}
</script>