rk
22 小时以前 585ff1cd29e9875f5f2a0fa2b0fdc876c5c6301f
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<template>
  <TableLayout :permissions="['business:goodsorder:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <!-- 0待支付 1待发货 2待收货 3交易完成 4已关闭 5部分发货 -->
      <el-tabs v-model="status" @tab-click="handleClick">
        <el-tab-pane
            v-for="tab in statusList"
            :key="tab.name"
            :name="tab.name"
        >
          <template #label>
            <span>{{ tab.label }}</span>
            <el-badge
                v-if="tab.count > 0"
                :value="tab.count"
                class="tab-badge"
            />
          </template>
        </el-tab-pane>
      </el-tabs>
      <el-form-item label="订单编号" prop="code">
        <el-input v-model="searchForm.code" placeholder="请输入订单编号" type="number" clearable @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="收货人" prop="nickName">
        <el-input v-model="searchForm.nickName" placeholder="请输入姓名/手机号" clearable  @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="取货方式" prop="receiveType">
        <el-select v-model="searchForm.receiveType"    placeholder="请选择取货方式" clearable   @change="search" >
          <el-option :key="0" :value="0" label="快递配送"></el-option>
          <el-option :key="1" :value="1" label="自提"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="归属经销商" prop="shopName">
        <el-input v-model="searchForm.shopName" placeholder="请输入经销商名称" clearable @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="支付单号" prop="payOrderId">
        <el-input v-model="searchForm.payOrderId" placeholder="请输入支付单号" clearable  @keypress.enter.native="search"></el-input>
      </el-form-item>
      <div class="date-style" style="display: inline">
        <el-form-item label="订单时间" prop="starttime" >
          <el-date-picker
              style="width: 160px"
              clearable
              @change="search"
              v-model="searchForm.starttime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              placeholder="开始时间"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="-" label-width="10px" prop="endtime" >
          <el-date-picker
              style="width: 160px"
              clearable
              v-model="searchForm.endtime"
              type="datetime"
              @change="search"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              placeholder="截止时间"
          ></el-date-picker>
        </el-form-item>
      </div>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button type="primary" :loading="isWorking.export" v-permissions="['business:goodsorder:exportExcel']" @click="exportExcel">导出</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <div v-for="item in tableData.list" :key="'id_'+item.id" class="order-detail">
        <div class="order-title-message" >
          <div class="base-message" >
            <div class="date" >订单时间:{{ item.createDate }}</div>
            <div class="date" >订单编号:<span  @click="$refs.operaGoodsOrderDetail.open('订单详情', item, 'first')" style="cursor: pointer;">{{ item.code }}</span></div>
            <div v-if="item.distributionShopId">经销商:{{ item.shopName || ''}}</div>
          </div>
          <div>
            <span v-if="item.status ==0" class="orange">待支付</span>
            <span  v-if="item.status ==1" class="orange">{{item.receiveType==1?'待自提':'待发货'}}</span>
            <span  v-if="item.status ==2" class="orange">待收货</span>
            <span  v-if="item.status ==3" class="grey">交易完成</span>
            <span  v-if="item.status ==4" class="grey">已取消</span>
            <span  v-if="item.status ==6" class="grey">已退款</span>
          </div>
        </div>
        <div class="detail-message">
          <div class="goods-message right-border">
            <div  class="goods-base-message" :key="item.id+'_'+goods.id" v-for="goods in item.goodsorderDetailList">
              <div style="width: 60px; height: 60px;">
                <el-image
                    style="width: 60px; height: 60px; border-radius: 2px;"
                    :src="goods.imgurl"
                    :preview-src-list="[goods.imgurl]"
                ></el-image>
              </div>
              <div class="message" style="">
                <div class="name">{{ goods.name }}</div>
                <div class="attr">¥{{ goods.goodsNum }}</div>
              </div>
            </div>
            <div class="mark" v-if="item.sysInfo&& item.sysInfo.length" >备注:{{item.sysInfo}}</div>
          </div>
          <div class="member-message right-border">
            <div class="el-icon-user" style="padding: 5px 5px;width: 100%;">{{ item.linkname }}</div>
            <div class="el-icon-phone-outline" style="padding: 10px 5px;width: 100%;color: #777;font-size: 13px;">{{ item.linkphone }}</div>
          </div>
          <div class="address-message right-border right-border" style="padding-top: 15px;" >
            <div class="underway el-icon-sell" >{{item.receiveType==1?'到店自提':'快递配送'}} </div>
            <div class=" el-icon-add-location" v-if="item.receiveType!=1">{{ item.linkaddr }}</div>
          </div>
          <div class="price-message right-border">
            <div class="underway" >订单总价:¥{{ (item.totalPrice||0).toFixed(2) }}</div>
            <div class="price-info">商品总价:¥{{  ((item.totalPrice||0)-(item.mailPrice || 0)).toFixed(2)}}</div>
            <div class="price-info">物流运费:¥{{  (item.mailPrice || 0).toFixed(2)}}</div>
            <div class="price-info">积分抵扣:-¥{{  (item.integral || 0 ).toFixed(2)}}</div>
            <div class="price-info">优惠金额:-¥{{  (item.couponPrice).toFixed(2) }}</div>
            <div class="price-info">实付金额:<span class="red" style="font-weight: 600">¥{{  (item.price).toFixed(2) }}</span></div>
          </div>
          <div class="action">
            <el-button v-if="item.status==1 && item.receiveType!=1" style=" width: 80%;" type="primary" @click="$refs.operaShipmentsWindow.open('发货', item)">发货</el-button>
            <div></div>
            <el-button v-if="item.status == 0 || item.status==1" style="color: red; "  type="text" @click="$refs.OperaOrderCancelWindow.open('取消订单', item)">取消订单</el-button>
            <div></div>
            <el-button v-if="item.status == 3" style="color: red "  type="text"  @click="$refs.OperaOrderRefundWindow.open('订单退款', item)">订单退款</el-button>
            <div></div>
            <el-button v-if="item.status==2 && item.receiveType!=1" style="color: #666; " type="text"  @click="$refs.operaShipmentsWindow.open('快递信息变更', item)">快递变更</el-button>
            <div></div>
            <el-button style="color: #666; " type="text" @click="$refs.operaOrderMarkWindow.open(item.sysInfo && item.sysInfo.length?'编辑备注':'添加备注', item)">
              {{ item.sysInfo && item.sysInfo.length?'修改备注':'添加备注' }}</el-button>
            <div></div>
            <el-button style="color: #216EEE; "  type="text" @click="$refs.operaGoodsOrderDetail.open('订单详情', item, 'first')">查看详情</el-button>
          </div>
        </div>
      </div>
      <div style="width: 100%;text-align: center;padding: 50px;color: #999;font-size: 12px;" v-if="!tableData.pagination ||!tableData.pagination.total">暂无数据</div>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaShipmentsWindow ref="operaShipmentsWindow" @success="search"/>
    <OperaOrderMarkWindow ref="operaOrderMarkWindow" @success="handlePageChange"/>
    <OperaOrderRefundWindow ref="OperaOrderRefundWindow" @success="handlePageChange"/>
    <OperaOrderCancelWindow ref="OperaOrderCancelWindow" @success="handlePageChange"/>
    <OperaGoodsOrderDetail ref="operaGoodsOrderDetail" @success="handlePageChange"/>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaShipmentsWindow from '@/components/business/OperaShipmentsWindow'
import OperaOrderMarkWindow from '@/components/business/OperaOrderMarkWindow'
import OperaOrderCancelWindow from '@/components/business/OperaOrderCancelWindow'
import OperaGoodsOrderDetail from '@/components/business/OperaGoodsOrderDetail'
import OperaOrderRefundWindow from '@/components/business/OperaOrderRefundWindow'
export default {
  name: 'Goodsorder',
  extends: BaseTable,
  components: { OperaOrderRefundWindow, TableLayout, Pagination, OperaShipmentsWindow, OperaOrderMarkWindow, OperaGoodsOrderDetail, OperaOrderCancelWindow },
  data () {
    return {
      status: '10',
      createDate: [],
      id: '',
      statusList: [{ name: '10', label: '全部订单', count: 0 },
        { name: '0', label: '待支付', count: 0 },
        { name: '1', label: '待发货/待自提', count: 0 },
        { name: '2', label: '待收货', count: 0 },
        { name: '3', label: '交易完成', count: 0 },
        { name: '6', label: '已退款', count: 0 },
        { name: '4', label: '已取消', count: 0 }],
      // 搜索
      searchForm: {
        id: '',
        receiveType: '',
        shopName: '',
        goodsName: '',
        code: '',
        status: '',
        nickName: '',
        starttime: null,
        enttime: null
      }
    }
  },
  created () {
    this.config({
      module: '商品订单信息表',
      api: '/business/goodsorder',
      'field.id': 'name',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    handlePageChange (pageIndex) {
      this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
      this.isWorking.search = true
      this.api.fetchList({
        page: this.tableData.pagination.pageIndex,
        capacity: this.tableData.pagination.pageSize,
        model: this.searchForm, // 销售模式变更
        sorts: this.tableData.sorts
      })
        .then(data => {
          this.tableData.list = data.records || []
          this.tableData.pagination.total = data.total || 0
          if (this.tableData.pagination.pageIndex === 1) {
            var totalData = data.countData || {}
            this.statusList[1].count = totalData.waitPayNum || 0
            this.statusList[2].count = totalData.waitKdNum || 0
            this.statusList[3].count = totalData.waitDoneNum || 0
          }
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search = false
        })
    },
    selectDate (v) {
      this.searchForm.startDate = v[0]
      this.searchForm.endDate = v[1]
      this.search()
    },
    reset () {
      this.createDate = []
      this.searchForm.starttime = ''
      this.searchForm.enttime = ''
      this.$refs.searchForm.resetFields()
      this.search()
    },
    handleClick (table, val) {
      // this.$refs.searchForm.resetFields()
      if (this.status == 9) {
        this.searchForm.isdeleted = 1
        this.searchForm.status = ''
      } else if (this.status == 10) {
        this.searchForm.status = ''
      } else {
        this.searchForm.isdeleted = 0
        this.searchForm.status = this.status
      }
      this.search()
    },
    cancelOrder (item) {
      this.$dialog.messageWaring(`确定取消订单:${item.code}?`)
        .then(() => {
 
        })
    }
  }
}
</script>
 
<style lang="scss" scoped>
.tab-badge{
  color: green;
}
.order-detail {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
  .order-title-message {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    font-weight: 500;
    box-sizing: border-box;
    background-color: #f2f2f2;
    .base-message {
      display: flex;
      color: #333;
      .date {
        width: auto;
        margin-right: 100px;
      }
      span {
        color: #333;
      }
    }
    .soon-style {
      color: rgb(235, 80, 50);
    }
  }
  .detail-message {
    border: #ccc solid 1px;
    min-height: 120px;
    display: flex;
    .right-border {
      border-right: #ccc solid 1px;
      box-sizing: border-box;
      padding: 10px;
    }
    .goods-message {
      flex: 1;
      .goods-base-message {
        display: flex;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f2f2f2;
        .message {
          flex-basis: content-box;
          display: flex;width: 100%;
          margin-left: 10px;
          .name {
            flex: 3;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
            max-height: 40px;
          }
          .attr{
            padding-top: 10px;
            text-align: right;
            flex: 1;
            padding-right: 30px;
            font-size: 12px;
            color: #666;
          }
        }
      }
      .mark {
        margin-bottom: 5px;
        font-size: 13px;
        color: rgb(235, 80, 50);
      }
    }
    .member-message {
      flex: 0.4;
    }
    .address-message {
      flex: 0.7;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      .underway {
        display: block;
        padding-bottom: 10px;
        border-bottom: 1px solid #f2f2f2;
        color: #71b247;
        margin-bottom: 10px;
      }
    }
    .price-message {
      flex: 0.6;
      font-weight: 600;
      .underway {
        padding-bottom: 10px;
        border-bottom: 1px solid #f2f2f2;
        color: rgb(233, 165, 80);
        margin-bottom: 10px;
      }
      .price-info {
        text-align: left;
        width: 100%;
        font-weight: normal;
        color: #777;
        font-size: 13px;
      }
    }
    .status-message {
      flex: 0.4;
      text-align: center;
      .underway {
        padding-bottom: 10px;
        border-bottom: 1px solid #f2f2f2;
        color: rgb(233, 165, 80)
      }
 
      .complete {
        color: #ccc;
      }
    }
    .action {
      flex: 0.4;
      box-sizing: border-box;
      padding: 10px;
      text-align: center;
    }
  }
}
</style>