333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
<template>
  <div class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
    </yrt-data-list>
 
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :auth-nodes="authNodes" :on-save-before="onSaveBefore" @on-change="onChange" @on-edit-load-after="onEditLoadAfter" @on-add-load-after="onEditLoadAfter">
      <div slot="blank-chargeData">
        <el-card v-if="chargeMode==='按重量'" class="box-card">
          <div slot="header" class="clearfix">
            <span>按重量</span>
          </div>
          <el-form :model="chargeData.weight" label-width="120px">
            <el-form-item label="重量单位">
              <el-radio-group v-model="chargeData.weight.type">
                <el-radio label="按千克"></el-radio>
                <el-radio label="按吨"></el-radio>
              </el-radio-group>
            </el-form-item>
            <!-- <el-form-item label="启用阶梯价">
              <el-checkbox v-model="chargeData.weight.isLevelPrice"></el-checkbox>
            </el-form-item> -->
            <el-form-item v-if="!chargeData.weight.isLevelPrice" label="单价">
              <el-input v-model="chargeData.weight.price" class="w-200"></el-input>
            </el-form-item>
            <template v-else>
              <template v-for="(item, index) in chargeData.weight.levelPriceList">
                <el-form-item :key="index" label="阶梯单价" class="margin-bottom-10">
                  <span>&lt;=</span>
                  <el-input v-model="item.number" placeholder="重量" class="w-80"></el-input>
                  <span v-if="chargeData.weight.type=='按千克'">千克,单价为</span>
                  <span v-else>吨,单价为</span>
                  <el-input v-model="item.price" class="w-80"></el-input>
                  <span>元</span>
                  <el-button v-if="index>0" type="text" @click="delLevelPrice(chargeData.weight.levelPriceList, index)">
                    删除
                  </el-button>
                </el-form-item>
              </template>
              <el-form-item>
                <el-button type="text" icon="el-icon-plus" @click="addLevelPrice(chargeData.weight.levelPriceList)">添加阶梯</el-button>
              </el-form-item>
            </template>
          </el-form>
        </el-card>
        <el-card v-else-if="chargeMode==='按件/箱'" class="box-card">
          <div slot="header" class="clearfix">
            <span>按件/箱</span>
          </div>
          <el-form :model="chargeData.unit" label-width="120px">
            <el-form-item label="包装单位">
              <el-radio-group v-model="chargeData.unit.type">
                <el-radio label="按小单位"></el-radio>
                <el-radio label="按中单位"></el-radio>
                <el-radio label="按大单位"></el-radio>
              </el-radio-group>
            </el-form-item>
            <!-- <el-form-item label="启用阶梯价">
              <el-checkbox v-model="chargeData.unit.isLevelPrice"></el-checkbox>
            </el-form-item> -->
            <el-form-item v-if="!chargeData.unit.isLevelPrice" label="单价">
              <el-input v-model="chargeData.unit.price" class="w-200"></el-input>
            </el-form-item>
            <template v-else>
              <template v-for="(item, index) in chargeData.unit.levelPriceList">
                <el-form-item :key="index" label="阶梯单价" class="margin-bottom-10">
                  <span>&lt;=</span>
                  <el-input v-model="item.number" placeholder="件数" class="w-80"></el-input>
                  <span>件/箱,单价为</span>
                  <el-input v-model="item.price" class="w-80"></el-input>
                  <span>元</span>
                  <el-button v-if="index>0" type="text" @click="delLevelPrice(chargeData.unit.levelPriceList, index)">
                    删除
                  </el-button>
                </el-form-item>
              </template>
              <el-form-item>
                <el-button type="text" icon="el-icon-plus" @click="addLevelPrice(chargeData.unit.levelPriceList)">添加阶梯</el-button>
              </el-form-item>
            </template>
          </el-form>
        </el-card>
        <el-card v-else-if="chargeMode==='按托盘'" class="box-card">
          <div slot="header" class="clearfix">
            <span>按托盘</span>
          </div>
          <el-form :model="chargeData.tray" label-width="120px">
            <!-- <el-form-item label="启用阶梯价">
              <el-checkbox v-model="chargeData.tray.isLevelPrice"></el-checkbox>
            </el-form-item> -->
            <el-form-item v-if="!chargeData.tray.isLevelPrice" label="单价">
              <el-input v-model="chargeData.tray.price" class="w-200"></el-input>
            </el-form-item>
            <template v-else>
              <template v-for="(item, index) in chargeData.tray.levelPriceList">
                <el-form-item :key="index" label="阶梯单价" class="margin-bottom-10">
                  <span>&lt;=</span>
                  <el-input v-model="item.number" placeholder="托盘数" class="w-80"></el-input>
                  <span>托,单价为</span>
                  <el-input v-model="item.price" class="w-80"></el-input>
                  <span>元</span>
                  <el-button v-if="index>0" type="text" @click="delLevelPrice(chargeData.tray.levelPriceList, index)">
                    删除
                  </el-button>
                </el-form-item>
              </template>
              <el-form-item>
                <el-button type="text" icon="el-icon-plus" @click="addLevelPrice(chargeData.tray.levelPriceList)">添加阶梯</el-button>
              </el-form-item>
            </template>
          </el-form>
        </el-card>
      </div>
    </yrt-editor>
 
  </div>
</template>
 
<script>
import baseLayout from "@/components/common/base-layout.vue";
 
export default {
  name: "finance-fee-base-onecharge",
  components: {},
  mixins: [baseLayout],
  data() {
    return {
      // 收费模式数据
      chargeData: {
        weight: {
          type: "按千克",
          isLevelPrice: false, // 按平米启用阶梯价
          price: 0, // 非阶梯价
          // 按平米阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ]
        },
        unit: {
          type: "按小单位",
          isLevelPrice: false, // 按单位启用阶梯价
          // 按单位阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ],
          price: 0 // 非阶梯价
        },
        tray: {
          isLevelPrice: false, // 按托盘数启用阶梯价
          price: 0, // 非阶梯价
          // 按托盘数阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ]
        }
      },
      // 收费方式
      chargeMode: "按重量"
    };
  },
  methods: {
    // 编辑器改变事件
    onChange(ref, val, field) {
      const formData = this.editor.formData;
      this.chargeMode = formData.chargeMode;
    },
    // 添加阶梯价
    addLevelPrice(rows) {
      rows.push({
        number: null,
        price: null
      });
    },
    // 删除阶梯价
    delLevelPrice(rows, index) {
      rows.splice(index, 1);
    },
    // 保存前事件
    onSaveBefore() {
      var chargeData = JSON.stringify(this.chargeData);
      this.editor.changeValue("chargeData", chargeData);
    },
    // 数据加载后
    onEditLoadAfter(formData) {
      if (formData.storageName !== null && formData.chargeData) {
        var chargeData = formData.chargeData;
        this.chargeData = JSON.parse(chargeData);
      } else {
        this.refresh();
      }
    },
    // 刷新数据
    refresh() {
      // 收费模式数据
      this.chargeData = {
        weight: {
          type: "按千克",
          isLevelPrice: false, // 按平米启用阶梯价
          price: 0, // 非阶梯价
          // 按平米阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ]
        },
        unit: {
          type: "按小单位",
          isLevelPrice: false, // 按单位启用阶梯价
          // 按单位阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ],
          price: 0 // 非阶梯价
        },
        tray: {
          isLevelPrice: false, // 按托盘数启用阶梯价
          price: 0, // 非阶梯价
          // 按托盘数阶梯价
          levelPriceList: [
            {
              number: null,
              price: null
            }
          ]
        }
      };
    }
  }
};
</script>
<style lang="scss" scoped>
.page-list-container {
  min-height: calc(100vh - 110px);
  overflow: hidden;
  position: relative;
}
 
@media screen and (max-height: 900px) {
  .page-list-container {
    min-height: 600px;
  }
}
.box-card {
  width: 700px;
}
</style>