Blame view

merchant-web-master/src/views/distributor/achievement/order.vue 6.15 KB
3f535f30   杨鑫   '初始'
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
  <template>
    <div class="custom_page">
      <div class="content">
        <!-- 顶部搜索 -->
        <div class="toolbar">
          <!-- 顶部搜索 -->
          <el-form :inline="true" :model="formInline">
            <el-form-item label="订单号">
              <el-input v-model="formInline.orderFormid" placeholder="请输入订单号" style="width:168px;"/>
            </el-form-item>
            <el-form-item label="分销员昵称">
              <el-input v-model="formInline.distributorName" placeholder="请输入分销员昵称" style="width:168px;"/>
            </el-form-item>
            <el-form-item label="分销员手机号">
              <el-input v-model="formInline.distributorPhone" placeholder="请输入手机号" style="width:168px;"/>
            </el-form-item>
            <el-form-item label="交易时间">
              <el-date-picker
                v-model="formInline.dates"
                type="daterange"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                value-format="yyyy-MM-dd"
                style="width:208px;"
              />
            </el-form-item>
            <el-form-item label="结算状态">
              <el-select v-model="formInline.state" placeholder="请选择结算状态" style="width:168px;">
                <el-option label="全部" :value="null" />
                <el-option label="已结算" value="1" />
                <el-option label="未结算" value="0" />
              </el-select>
            </el-form-item>
          </el-form>
1991126c   杨鑫   '最新'
36
          <div style="width: 20%;">  <el-button style="background-color: #3F9B6A;color: #fff"  @click="search">查询</el-button>
3f535f30   杨鑫   '初始'
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
              <el-button class="buttonHover"
                    style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="clear">重置</el-button></div>
        </div>
        <!--  表格 -->
        <div class="content_table">
          <div class="table">
            <el-table
              :data="tableData"
             :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
              @selection-change="handleSelectionChange"
            >
              <el-table-column type="selection" width="55" :selectable="checkState" />
              <el-table-column prop="orderFormid" label="订单号" />
              <el-table-column prop="distributorName" label="分销员昵称" />
              <el-table-column prop="distributorPhone" label="分销员手机号" />
              <el-table-column prop="price" label="商品金额(元)" />
              <el-table-column prop="commission" label="佣金(元)" />
              <el-table-column label="结算状态">
                <template slot-scope="scope">
                  <span v-if="scope.row.state == 0">未结算</span>
                  <span v-if="scope.row.state == 1">已结算</span>
                </template>
              </el-table-column>
              <el-table-column prop="transactionTime" label="交易时间" />
            </el-table>
            <div class="tablefoot">
              <el-button :disabled="!multipleSelection.length" class="buttonHover"
                    style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="getOrder">标记为已结算</el-button>
            </div>
            <div class="fenye">
              <el-pagination
                :current-page="currentPage"
                :page-sizes="[10, 20, 50, 100]"
                :page-size="10"
               background
               small
               layout="prev, pager, next,total"
                :total="total"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
              />
            </div>
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import { tipsdistributorGetAll, settlement } from '@/api/distributor'
  import { hidden } from '@/utils';
  export default {
    data() {
      return {
        formInline: {
          orderFormid: '',
          distributorName: '',
          distributorPhone: '',
          dates: [],
          state: null,
          page: 1,
          pageSize: 10
        },
        total: 1,
        tableData: [],
        currentPage: 1,
        multipleSelection: []
      }
    },
    created() {
      this.getAll(this.formInline)
    },
    methods: {
      handleSizeChange(val) {
        this.formInline.pageSize = val
        this.getAll(this.formInline)
      },
      handleCurrentChange(val) {
        this.formInline.page = val
        this.getAll(this.formInline)
      },
      handleSelectionChange(val) {
        this.multipleSelection = val
      },
      // 查询
      search() {
        this.total = 1
        this.formInline.page = 1
        this.getAll(this.formInline)
      },
      // 清除
      clear() {
        this.formInline = {
          orderFormid: '',
          distributorName: '',
          distributorPhone: '',
          dates: [],
          state: '',
          page: 1,
          pageSize: 10
        }
        this.getAll(this.formInline)
      },
      // 标记为已结算
      async getOrder() {
        const arr = []
        this.multipleSelection.forEach(element => {
          arr.push(element.orderId)
        })
        const res = await settlement({ ids: arr })
        if (res.code === '') {
          if (res.code === '') {
            this.$message({
              message: '结算成功',
              type: 'success'
            })
            this.getAll(this.formInline)
          }
        }
      },
      // 初始化查询所有数据
      async getAll(formInline) {
        const res = await tipsdistributorGetAll(formInline)
        this.tableData = res.data.list
        this.tableData.forEach((item) => {
          item.distributorPhone = hidden(item.distributorPhone, 3, 3)
        })
        this.total = res.data.total
      },
      checkState(row, index) {
        if (row && row.state === 0) {
          return 1
        }
        return 0
      }
    }
  }
  </script>
  
  <style lang='scss' scoped>
  @import url("../../../styles/elDialog.scss");
  .custom_page {
    padding: 20px;
  }
  .checkBoxStyle {
    margin-bottom: 20px;
  }
  .tablefoot {
    padding: 5px 10px;
    border: 1px solid #dfe6ec;
    border-top: 0;
  }
   .toolbar {
        display: flex;
        width: 100%;
        font-size: 14px;
        justify-content: space-between;
      }
      ::v-deep .el-pagination__total {
        position: absolute;
        left: 10px;
      }
  </style>