sale-client 4.2.13 → 4.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- #Wed Jun 25 17:54:33 CST 2025
1
+ #Mon Jul 29 08:34:01 CST 2024
2
2
  gradle.version=5.2.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sale-client",
3
- "version": "4.2.13",
3
+ "version": "4.2.15",
4
4
  "description": "收费模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -56,11 +56,16 @@
56
56
  value.stairEndDate = `'${a.data.stairEndDate}'`
57
57
  let jt = a.data.chargeprice.length
58
58
  if (jt > 1) {
59
- value.f_hasuse1 = (value.sumamount >= value.f_stair1ceiling - 0 ? value.f_stair1ceiling - 0 : value.sumamount - 0).toFixed(4)
60
- value.f_hasuse2 = (value.sumamount >= value.f_stair2ceiling ? value.f_stair2ceiling - value.f_stair1ceiling : value.sumamount - value.f_stair1ceiling).toFixed(4)
61
- value.f_hasuse3 = (value.sumamount >= value.f_stair3ceiling ? value.f_stair3ceiling - value.f_stair2ceiling : value.sumamount - value.f_stair2ceiling).toFixed(4)
62
- if (value.f_hasuse2 < 0) value.f_hasuse2 = 0
63
- if (value.f_hasuse3 < 0) value.f_hasuse3 = 0
59
+ // 转换为数字进行比较,避免字符串比较问题
60
+ const sumAmount = parseFloat(value.sumamount)
61
+ const stair1Ceiling = parseFloat(value.f_stair1ceiling)
62
+ const stair2Ceiling = parseFloat(value.f_stair2ceiling)
63
+ const stair3Ceiling = parseFloat(value.f_stair3ceiling)
64
+ value.f_hasuse1 = (sumAmount >= stair1Ceiling ? stair1Ceiling : sumAmount).toFixed(4)
65
+ value.f_hasuse2 = (sumAmount >= stair2Ceiling ? stair2Ceiling - stair1Ceiling : sumAmount - stair1Ceiling).toFixed(4)
66
+ value.f_hasuse3 = (sumAmount >= stair3Ceiling ? stair3Ceiling - stair2Ceiling : sumAmount - stair2Ceiling).toFixed(4)
67
+ if (parseFloat(value.f_hasuse2) < 0) value.f_hasuse2 = 0
68
+ if (parseFloat(value.f_hasuse3) < 0) value.f_hasuse3 = 0
64
69
  } else {
65
70
  let parm1 = {
66
71
  items: 'f_pregas',
@@ -8,7 +8,7 @@
8
8
  <validator name='v'>
9
9
  <form class="form-horizontal select-overspread">
10
10
  <div class="row" style="display: flex;justify-content: center;" id='reissue-bill'>
11
- {{{bill.data}}}
11
+ <div v-html="bill.data"></div>
12
12
  </div>
13
13
  <div class="row" v-if="config.hasBillManage">
14
14
  <div v-if="!messShow">
@@ -57,7 +57,6 @@
57
57
  v-model="model.f_bill_type"
58
58
  :options='printtypes'
59
59
  placeholder='请选择'
60
- v-model="model.f_bill_type"
61
60
  @change="useTypeChange"
62
61
  :value-single="true"
63
62
  close-on-select v-ref:billtype>
@@ -73,7 +72,6 @@
73
72
  v-model="model.f_use_type"
74
73
  :options='usetypes'
75
74
  placeholder='请选择'
76
- v-model="model.f_use_type"
77
75
  @change="useTypeChange"
78
76
  :value-single="true"
79
77
  close-on-select v-ref:usetype>
@@ -209,11 +207,17 @@
209
207
  let jt = a.data.chargeprice.length
210
208
  console.log('value', value)
211
209
  if (jt > 1) {
212
- value.f_hasuse1 = (value.sumamount >= value.f_stair1ceiling ? value.f_stair1ceiling - 0 : value.sumamount - 0).toFixed(4)
213
- value.f_hasuse2 = (value.sumamount >= value.f_stair2ceiling ? value.f_stair2ceiling - value.f_stair1ceiling : value.sumamount - value.f_stair1ceiling).toFixed(4)
214
- value.f_hasuse3 = (value.sumamount >= value.f_stair3ceiling ? value.f_stair3ceiling - value.f_stair2ceiling : value.sumamount - value.f_stair2ceiling).toFixed(4)
215
- if (value.f_hasuse2 < 0) value.f_hasuse2 = 0
216
- if (value.f_hasuse3 < 0) value.f_hasuse3 = 0
210
+ // 转换为数字进行比较,避免字符串比较问题
211
+ const sumAmount = parseFloat(value.sumamount)
212
+ const stair1Ceiling = parseFloat(value.f_stair1ceiling)
213
+ const stair2Ceiling = parseFloat(value.f_stair2ceiling)
214
+ const stair3Ceiling = parseFloat(value.f_stair3ceiling)
215
+ value.f_hasuse1 = (sumAmount >= stair1Ceiling ? stair1Ceiling : sumAmount).toFixed(4)
216
+ value.f_hasuse2 = (sumAmount >= stair2Ceiling ? stair2Ceiling - stair1Ceiling : sumAmount - stair1Ceiling).toFixed(4)
217
+ value.f_hasuse3 = (sumAmount >= stair3Ceiling ? stair3Ceiling - stair2Ceiling : sumAmount - stair2Ceiling).toFixed(4)
218
+ if (parseFloat(value.f_hasuse2) < 0) value.f_hasuse2 = 0
219
+ if (parseFloat(value.f_hasuse3) < 0) value.f_hasuse3 = 0
220
+ console.log('111value', value)
217
221
  } else {
218
222
  let parm1 = {
219
223
  items: 'f_pregas',
@@ -228,10 +232,33 @@
228
232
  value.f_stair2price = 0
229
233
  value.f_stair3price = 0
230
234
  }
231
-
232
235
  billParam = Object.assign(billParam, value)
233
236
  }
234
- self.bill = new DataModel(self.data.billUrl, billParam, 'af-revenue')
237
+ // 确保所有参数值都是合法的JavaScript表达式
238
+ const sanitizeParams = (params) => {
239
+ const sanitized = {}
240
+ for (const [key, val] of Object.entries(params)) {
241
+ if (typeof val === 'string' && val.startsWith("'") && val.endsWith("'")) {
242
+ // 字符串参数,保持原样
243
+ sanitized[key] = val
244
+ } else if (typeof val === 'number' || typeof val === 'boolean') {
245
+ // 数值和布尔值,转换为字符串
246
+ sanitized[key] = val.toString()
247
+ } else if (val === null || val === undefined) {
248
+ // null 或 undefined,转换为空字符串
249
+ sanitized[key] = "''"
250
+ } else if (typeof val === 'object') {
251
+ // 对象,转换为JSON字符串
252
+ sanitized[key] = `'${JSON.stringify(val)}'`
253
+ } else {
254
+ // 其他情况,转换为字符串
255
+ sanitized[key] = `'${String(val)}'`
256
+ }
257
+ }
258
+ return sanitized
259
+ }
260
+ const safeBillParam = sanitizeParams(billParam)
261
+ self.bill = new DataModel(self.data.billUrl, safeBillParam, 'af-revenue')
235
262
  await self.bill.search(self.data.id)
236
263
  // self.bill.data = '我是补打发票'
237
264
  await getBillGen(self)
@@ -11,7 +11,7 @@
11
11
  <label class="font_normal_body">开始时间</label>
12
12
  <datepicker :format="'yyyy-MM-dd'" :value.sync="model.f_start_date"
13
13
  class="datepicker"
14
- condition="f_operate_date >= '{} 00:00:00' "
14
+ condition="tt.f_operate_date >= '{} 00:00:00' "
15
15
  placeholder="起始时间"
16
16
  style="width:60%"
17
17
  v-model="model.f_start_date"
@@ -21,7 +21,7 @@
21
21
  <label class="font_normal_body" >结束时间</label>
22
22
  <datepicker :format="'yyyy-MM-dd'" :value.sync="model.f_end_date"
23
23
  class="datepicker"
24
- condition="f_operate_date <= '{} 23:59:59' "
24
+ condition="tt.f_operate_date <= '{} 23:59:59' "
25
25
  placeholder="结束时间"
26
26
  style="width:60%"
27
27
  v-model="model.f_end_date"
@@ -1,394 +1,394 @@
1
- <template>
2
- <div class="flex-row">
3
- <div class="span" style="overflow-y: auto;">
4
- <validator name='v'>
5
- <form novalidate class="form-horizontal">
6
- <div class="row">
7
- <div class="col-sm-4">
8
- <label for="f_paytype" class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
9
- <v-select id="f_payment"
10
- v-model="f_payment"
11
- placeholder='请选择'
12
- :value.sync="model.f_payment"
13
- :options='paytype'
14
- close-on-select clear-button></v-select>
15
- </div>
16
- <div class="col-sm-4">
17
- <label for="f_price" class="font_normal_body">单价</label>
18
- <input class="input_search" style="width:60%" type="number" v-model="model.f_price" placeholder="请输入单价">
19
- </div>
20
- <div class="col-sm-4">
21
- <label for="f_pregas" class=" font_normal_body">气量</label>
22
- <input class="input_search" style="width:60%" type="number"
23
- v-model="model.f_pregas" id="fpregas"
24
- v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="请输入气量"
25
- >
26
- </div>
27
- <div class="col-sm-4">
28
- <label for="f_totalcost" class=" font_normal_body">&nbsp;&nbsp;&nbsp;金额</label>
29
- <input class="input_search" style="width:60%" type="number" v-model="model.f_totalcost" placeholder="金额"
30
- >
31
- </div>
32
- <div class="col-sm-4" v-if="row.f_collection_type === '按气量'"
33
- :class="[$v.f_collection.required ? 'has-error' : 'has-success']">
34
- <label for="f_collection" class=" font_normal_body">收款</label>
35
- <input class="input_search" style="width:60%" type="number" v-model="model.f_collection"
36
- v-validate:f_collection='{required: true, dctest: [model.f_totalcost, ">=" ] }'
37
- v-el:sk v-scale="[model.f_totalcost, 2]" >
38
- </div>
39
- <div class="col-sm-4" v-if="row.f_collection_type === '按金额'">
40
- <label for="f_collection" class=" font_normal_body">收款</label>
41
- <input class="input_search" style="width:60%" type="number" v-model="model.f_collection"
42
- v-el:sk v-scale="[model.f_collection, 4]" >
43
- </div>
44
- <div class="row" style="padding-top: 0.5em;">
45
- <div class="col-sm-8">
46
- <label for="f_comments" class="font_normal_body">备&emsp;&emsp;注</label>
47
- <input class="input_search" style="width:87%" v-model="model.f_comments" placeholder="备注">
48
- </div>
49
- </div>
50
-
51
- </div>
52
- </form>
53
- <print-bill :show="print" :bill-config='config' v-ref:printbill :bill-data='billData' :data='row'
54
- v-on:toggle="close" @printok="printok" :data='row'></print-bill>
55
- <div style="text-align:right;height: 25%;">
56
- <payment-code-button :clickable="!$v.valid || clickConfirm"
57
- :payment.sync="model.f_payment" :payment-data="paytype"
58
- @confirm-payment="confirm()">
59
- </payment-code-button>
60
- <button class="button_search btn-gn" @click="confirm()" :disabled='!$v.valid || clickConfirm'>确认</button>
61
- <button class="button_clear btn-gn" @click="clean()">取消</button>
62
- </div>
63
- </validator>
64
- <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_collection"></payment-code>
65
- <upload :blodid="row.f_userinfo_id" v-if="config.showupload" :businessid="randomBusinessId" isremark="true" fusetype="自定义收费"></upload>
66
- </div>
67
- </div>
68
- </template>
69
- <script>
70
- import Vue from 'vue'
71
-
72
- // 输入金额,换算气量
73
- let preamountGen = async function (self) {
74
- let dymoney = 0
75
- let calFee = (self.model.f_totalcost - 0) + (self.row.f_balance - 0)
76
- let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
77
- if (getGas.data.gas) {
78
- if (self.row.f_isdecimal === '是') {
79
- if (self.row.f_alias === 'QiaoSong') {
80
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
81
- } else {
82
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
83
- }
84
- } else {
85
- let tempnum = Math.floor(getGas.data.gas - 0)
86
- let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
87
- dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
88
- self.model.f_pregas = Math.floor(getGas.data.gas - 0)
89
- }
90
- }
91
- self.model.f_preamount = calFee - (dymoney - 0)
92
- self.model.chargeprice = getGas.data.chargeprice
93
- Object.assign(self.model, self.model, getGas.data)
94
- self.model.f_totalcost = ((self.model.f_totalcost - 0) - (dymoney - 0)).toFixed(4)
95
- // self.model.f_totalcost=Math.ceil(self.model.f_totalcost)
96
- if(self.config.floor){
97
- self.model.f_totalcost=Math.ceil(self.model.f_totalcost)
98
- }
99
- self.calText(getGas.data.chargeprice)
100
- }
101
-
102
- // 输入气量,换算金额
103
- let pregasGen = async function (self) {
104
- if (self.row.f_isdecimal === '是') {
105
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
106
- } else {
107
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
108
- }
109
- if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
110
- self.model.f_meter_type = self.row.f_meter_type
111
- let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
112
- self.model.f_preamount = getAmount.data.chargenum
113
- self.model.f_totalcost = ((self.row.f_balance - 0) > (getAmount.data.chargenum - 0) ? 0 : ((getAmount.data.chargenum - 0) - (self.row.f_balance - 0)).toFixed(4))
114
- Object.assign(self.model, self.model, getAmount.data)
115
- self.model.chargeprice = getAmount.data.chargeprice
116
- self.model.f_collection = self.model.f_totalcost
117
- if(self.config.floor){
118
- self.model.f_collection=Math.ceil(self.model.f_collection)
119
- }
120
- self.calText(getAmount.data.chargeprice)
121
- }
122
- }
123
-
124
-
125
-
126
- let asyncCardMeterCenter = async function (self) {
127
- await self.$getConfig(self, 'CardMeterCenter')
128
- console.log('卡表收费config', self.config)
129
- // 默认打印格式
130
- self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
131
- self.model.f_payment = [self.config.payment]
132
- self.mulPrint = self.config.printType instanceof Array
133
- // 判断限购
134
- let limit_param = {
135
- f_userinfo_id: self.row.f_userinfo_id,
136
- f_user_id: self.row.f_user_id,
137
- f_stairprice_id: self.row.f_stairprice_id
138
- }
139
- let getLimit = await self.$resetpost('api/af-revenue/logic/sale_getLimitGas', {data: limit_param}, {resolveMsg: null, rejectMsg: '获取限购值失败!!'})
140
- console.log('获取限购值', getLimit)
141
- self.hasLimit = getLimit.data.hasLimit
142
- if (self.hasLimit) {
143
- if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
144
- if (getLimit.data.f_limit_value < 0 || getLimit.data.f_limit_amount < 0) {
145
- self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
146
- self.$dispatch('refresh')
147
- } else {
148
- if (getLimit.data.f_limit_value) {
149
- self.maxgas = (getLimit.data.f_limit_value - 0)
150
- self.limitgas = true
151
- }
152
- if (getLimit.data.f_limit_amount) {
153
- self.maxmoney = (getLimit.data.f_limit_amount - 0)
154
- self.limitmoney = true
155
- }
156
- }
157
- }
158
- }
159
- }
160
- export default {
161
- title: '自定义收费',
162
- data () {
163
- return {
164
- serialShow: false,
165
- resid: [], // 存放新增的f_files表中id
166
- config: {
167
- notShowFormula: false, // 不显示计算公式,默认显示
168
- hasPrint: true, // 默认打票
169
- hasBillManage: false, // 默认不启用发票管理
170
- floor: false, // 是否取整收费
171
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
172
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
173
- showupload: true,
174
- payment: '现金缴费'
175
- },
176
- model: {
177
- f_purchase: 0,
178
- f_write_card: '不写卡',
179
- f_payment: '',
180
- f_pregas: '',
181
- f_preamount: 0,
182
- f_totalcost: 0,
183
- f_curbalance: 0,
184
- f_collection: 0,
185
- f_balance: 0,
186
- f_print: [],
187
- f_meter_type: '',
188
- f_voucher_number: '',
189
- is_accumulate: '计入',
190
- f_user_name: '',
191
- f_comments: ''
192
- },
193
- calculatedetail: '',
194
- print: false,
195
- billData: {
196
- url: 'api/af-revenue/report/card_bill',
197
- billnumber: ''
198
- },
199
- randomBusinessId: '',
200
- hasLimit: false,
201
- maxgas: 99999999, // 限购
202
- maxmoney: 99999999,
203
- limitmoney: false,
204
- limitgas: false,
205
- mulPrint: false,
206
- clickConfirm: false, // 控制确认按钮只能点击一次
207
- // 下拉框值
208
- paytype: this.$appdata.getParam('付款方式'),
209
- printstyle: this.$appdata.getParam('打印格式'),
210
- mjshow: false
211
- }
212
- },
213
- props: ['row'],
214
- ready () {
215
- // this.getPurchase()
216
- console.log('456789', this.row)
217
- this.model.f_price_id = this.row.f_price_id
218
- this.model.f_user_id = this.row.f_user_id
219
- this.model.f_userfiles_id = this.row.f_userfiles_id
220
- this.model.f_userinfo_id = this.row.f_userinfo_id
221
- this.model.f_userinfo_code = this.row.f_userinfo_code
222
- this.model.f_user_name = this.row.f_user_name
223
- this.model.f_user_type = this.row.f_user_type
224
- this.model.f_meternumber = this.row.f_meternumber
225
- this.model.f_address = this.row.f_address
226
- this.model.f_meter_brand = this.row.f_meter_brand
227
- this.model.f_meter_style = this.row.f_meter_style
228
- this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
229
- if (this.row.f_collection_type == '按金额') {
230
- this.model.f_totalcost = ''
231
- this.model.f_pregas = 0
232
- }
233
- document.getElementById('fpregas').focus()
234
- asyncCardMeterCenter(this)
235
- this.getRandomId()
236
- },
237
- events: {
238
- // 删除Resid数组元素
239
- 'delResid' (val) {
240
- this.resid.$remove({id: val, f_biobid: ''})
241
- // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
242
- },
243
- // 增加Resid数组元素
244
- 'resid' (val) {
245
- this.resid.push({id: val, f_biobid: ''})
246
- }
247
- },
248
- methods: {
249
- getRandomId () {
250
- this.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
251
- let res = Math.random() * 16 | 0
252
- let v = c == 'x' ? res : (res & 0x3 | 0x8)
253
- return v.toString(16)
254
- })
255
- },
256
- confirm () {
257
- this.clickConfirm = true
258
- this.$showMessage(`对客户${this.model.f_user_name}进行收费。该操作只做收费,不做写卡,确定要进行该操作吗?`, ['confirm', 'cancel']).then(async (res) => {
259
- if (res === 'confirm') {
260
- let data = {
261
- f_user_id: this.model.f_user_id,
262
- f_userfiles_id: this.model.f_userfiles_id,
263
- f_userinfo_id: this.model.f_userinfo_id,
264
- f_user_name: this.model.f_user_name,
265
- f_user_type: this.model.f_user_type,
266
- f_meternumber: this.model.f_meternumber,
267
- f_address: this.model.f_address,
268
- f_meter_brand: this.model.f_meter_brand,
269
- f_meter_style: this.model.f_meter_style,
270
- f_operator: Vue.$login.f.name,
271
- f_operatorid: Vue.$login.f.id,
272
- f_orgid: Vue.$login.f.orgid,
273
- f_orgname: Vue.$login.f.orgs,
274
- f_depid: Vue.$login.f.depids,
275
- f_depname: Vue.$login.f.deps,
276
- f_operate_date: this.$login.toStandardTimeString(),
277
- f_payment: this.model.f_payment[0],
278
- f_price: this.model.f_price,
279
- f_pregas: this.model.f_pregas,
280
- f_total_cost: this.model.f_totalcost,
281
- f_collection: this.model.f_collection,
282
- f_comments: this.model.f_comments
283
- }
284
- console.log('自定义收费', data)
285
- await this.$resetpost('api/af-revenue/entity/save/t_customizedFees', data, {warnMsg: `确定要对用户${this.model.f_user_name}进行自定义收费吗?`, resolveMsg: '收费成功!!', rejectMsg: '收费失败!!请重试!!'})
286
- let ss = await this.$refs.paymentcode.flowPath()
287
- this.$refs.paymentcode.paymentCodeShow = false
288
- console.log('付款码操作返回', ss)
289
- if (!ss.result) return
290
- this.$dispatch('refresh')
291
- this.clickConfirm = false
292
- }
293
- })
294
- },
295
- clean () {
296
- this.$info('取消操作')
297
- this.$dispatch('refresh', this.row)
298
- },
299
- printok () {
300
- // 收据打完,判断是否还有其他票据进行请求
301
- for (let i = 0; i < this.model.f_print.length; i++) {
302
- if (this.model.f_print[i] === '电子发票') {
303
- this.$CommonService.openEticket(this.row.id, '售气收费')
304
- }
305
- }
306
- this.$dispatch('success')
307
- },
308
- pregas () {
309
- if (this.model.f_pregas && this.model.f_pregas > 0) {
310
- try {
311
- // 对气量进行验证
312
- if ((this.row.f_topup_ceil - 0) > 0 && (this.model.f_pregas - 0) > (this.row.f_topup_ceil - 0)) {
313
- this.$showAlert(`您输入的气量不能大于该表的充值上限: ${this.row.f_topup_ceil}`, 'warning', 5000)
314
- this.model.f_pregas = null
315
- } else {
316
- pregasGen(this)
317
- }
318
- } catch (error) {
319
- this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
320
- this.$dispatch('error', '发卡售气', this.model, error)
321
- }
322
- }
323
- },
324
- preamount () {
325
- if ((this.model.f_totalcost && this.model.f_totalcost > 0) || this.row.f_balance > 0) {
326
- try {
327
- preamountGen(this)
328
- } catch (error) {
329
- this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
330
- this.$dispatch('error', '发卡售气', this.model, error)
331
- }
332
- }
333
- },
334
- calText (val) {
335
- let str = ''
336
- let num = 0
337
- val.forEach((item) => {
338
- if (item.f_gas > 0) {
339
- num = num + 1
340
- }
341
- str = str + item.f_price + ' x ' + item.f_gas + '+'
342
- })
343
- str = str.slice(0, str.length - 1)
344
- this.calculatedetail = str
345
- if (num > 1) {
346
- if (this.$login.r.find(item => item == '阶梯提示无按钮')) {
347
- this.$showAlert('友好提示:本次购气已跨阶梯 计算公式:' + (this.calculatedetail ? this.calculatedetail : ' 暂无'), 'warning', 3000)
348
- } else {
349
- this.$showMessage('友好提示:本次购气已跨阶梯 计算公式:' + (this.calculatedetail ? this.calculatedetail : ' 暂无'), ['confirm', 'cancel'])
350
- }
351
- }
352
- },
353
- close () {
354
- this.print = false
355
- this.clean()
356
- }
357
- },
358
- watch: {
359
- 'model.f_payment' (val) {
360
- if (val == '免交') {
361
- this.mjshow = true
362
- } else {
363
- this.mjshow = false
364
- }
365
- }
366
- },
367
- computed: {
368
- 'curbalance' () {
369
- if (this.model.f_preamount) {
370
- if (this.config.calculatePreByCollection) {
371
- return ((this.model.f_collection - 0) + (this.row.f_balance - 0) - this.model.f_preamount).toFixed(4)
372
- }
373
- if (this.row.f_collection_type === '按金额') {
374
- return ((this.model.f_totalcost - 0) + (this.row.f_balance - 0) - (this.model.f_preamount - 0)).toFixed(4)
375
- } else {
376
- if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
377
- return ((this.row.f_balance - 0) - (this.model.f_preamount - 0)).toFixed(4)
378
- } else {
379
- return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
380
- }
381
- }
382
- } else {
383
- return 0
384
- }
385
- },
386
- isMachineMeter() {
387
- return this.row.f_meter_type && this.row.f_meter_type.indexOf('机表') !== -1
388
- }
389
- }
390
- }
391
- </script>
392
-
393
- <style>
394
- </style>
1
+ <template>
2
+ <div class="flex-row">
3
+ <div class="span" style="overflow-y: auto;">
4
+ <validator name='v'>
5
+ <form novalidate class="form-horizontal">
6
+ <div class="row">
7
+ <div class="col-sm-4">
8
+ <label for="f_paytype" class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
9
+ <v-select id="f_payment"
10
+ v-model="f_payment"
11
+ placeholder='请选择'
12
+ :value.sync="model.f_payment"
13
+ :options='paytype'
14
+ close-on-select clear-button></v-select>
15
+ </div>
16
+ <div class="col-sm-4">
17
+ <label for="f_price" class="font_normal_body">单价</label>
18
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_price" placeholder="请输入单价">
19
+ </div>
20
+ <div class="col-sm-4">
21
+ <label for="f_pregas" class=" font_normal_body">气量</label>
22
+ <input class="input_search" style="width:60%" type="number"
23
+ v-model="model.f_pregas" id="fpregas"
24
+ v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="请输入气量"
25
+ >
26
+ </div>
27
+ <div class="col-sm-4">
28
+ <label for="f_totalcost" class=" font_normal_body">&nbsp;&nbsp;&nbsp;金额</label>
29
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_totalcost" placeholder="金额"
30
+ >
31
+ </div>
32
+ <div class="col-sm-4" v-if="row.f_collection_type === '按气量'"
33
+ :class="[$v.f_collection.required ? 'has-error' : 'has-success']">
34
+ <label for="f_collection" class=" font_normal_body">收款</label>
35
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_collection"
36
+ v-validate:f_collection='{required: true, dctest: [model.f_totalcost, ">=" ] }'
37
+ v-el:sk v-scale="[model.f_totalcost, 2]" >
38
+ </div>
39
+ <div class="col-sm-4" v-if="row.f_collection_type === '按金额'">
40
+ <label for="f_collection" class=" font_normal_body">收款</label>
41
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_collection"
42
+ v-el:sk v-scale="[model.f_collection, 4]" >
43
+ </div>
44
+ <div class="row" style="padding-top: 0.5em;">
45
+ <div class="col-sm-8">
46
+ <label for="f_comments" class="font_normal_body">备&emsp;&emsp;注</label>
47
+ <input class="input_search" style="width:87%" v-model="model.f_comments" placeholder="备注">
48
+ </div>
49
+ </div>
50
+
51
+ </div>
52
+ </form>
53
+ <print-bill :show="print" :bill-config='config' v-ref:printbill :bill-data='billData' :data='row'
54
+ v-on:toggle="close" @printok="printok" :data='row'></print-bill>
55
+ <div style="text-align:right;height: 25%;">
56
+ <payment-code-button :clickable="!$v.valid || clickConfirm"
57
+ :payment.sync="model.f_payment" :payment-data="paytype"
58
+ @confirm-payment="confirm()">
59
+ </payment-code-button>
60
+ <button class="button_search btn-gn" @click="confirm()" :disabled='!$v.valid || clickConfirm'>确认</button>
61
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
62
+ </div>
63
+ </validator>
64
+ <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_collection"></payment-code>
65
+ <upload :blodid="row.f_userinfo_id" v-if="config.showupload" :businessid="randomBusinessId" isremark="true" fusetype="自定义收费"></upload>
66
+ </div>
67
+ </div>
68
+ </template>
69
+ <script>
70
+ import Vue from 'vue'
71
+
72
+ // 输入金额,换算气量
73
+ let preamountGen = async function (self) {
74
+ let dymoney = 0
75
+ let calFee = (self.model.f_totalcost - 0) + (self.row.f_balance - 0)
76
+ let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
77
+ if (getGas.data.gas) {
78
+ if (self.row.f_isdecimal === '是') {
79
+ if (self.row.f_alias === 'QiaoSong') {
80
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
81
+ } else {
82
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
83
+ }
84
+ } else {
85
+ let tempnum = Math.floor(getGas.data.gas - 0)
86
+ let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
87
+ dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
88
+ self.model.f_pregas = Math.floor(getGas.data.gas - 0)
89
+ }
90
+ }
91
+ self.model.f_preamount = calFee - (dymoney - 0)
92
+ self.model.chargeprice = getGas.data.chargeprice
93
+ Object.assign(self.model, self.model, getGas.data)
94
+ self.model.f_totalcost = ((self.model.f_totalcost - 0) - (dymoney - 0)).toFixed(4)
95
+ // self.model.f_totalcost=Math.ceil(self.model.f_totalcost)
96
+ if(self.config.floor){
97
+ self.model.f_totalcost=Math.ceil(self.model.f_totalcost)
98
+ }
99
+ self.calText(getGas.data.chargeprice)
100
+ }
101
+
102
+ // 输入气量,换算金额
103
+ let pregasGen = async function (self) {
104
+ if (self.row.f_isdecimal === '是') {
105
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
106
+ } else {
107
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
108
+ }
109
+ if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
110
+ self.model.f_meter_type = self.row.f_meter_type
111
+ let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
112
+ self.model.f_preamount = getAmount.data.chargenum
113
+ self.model.f_totalcost = ((self.row.f_balance - 0) > (getAmount.data.chargenum - 0) ? 0 : ((getAmount.data.chargenum - 0) - (self.row.f_balance - 0)).toFixed(4))
114
+ Object.assign(self.model, self.model, getAmount.data)
115
+ self.model.chargeprice = getAmount.data.chargeprice
116
+ self.model.f_collection = self.model.f_totalcost
117
+ if(self.config.floor){
118
+ self.model.f_collection=Math.ceil(self.model.f_collection)
119
+ }
120
+ self.calText(getAmount.data.chargeprice)
121
+ }
122
+ }
123
+
124
+
125
+
126
+ let asyncCardMeterCenter = async function (self) {
127
+ await self.$getConfig(self, 'CardMeterCenter')
128
+ console.log('卡表收费config', self.config)
129
+ // 默认打印格式
130
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
131
+ self.model.f_payment = [self.config.payment]
132
+ self.mulPrint = self.config.printType instanceof Array
133
+ // 判断限购
134
+ let limit_param = {
135
+ f_userinfo_id: self.row.f_userinfo_id,
136
+ f_user_id: self.row.f_user_id,
137
+ f_stairprice_id: self.row.f_stairprice_id
138
+ }
139
+ let getLimit = await self.$resetpost('api/af-revenue/logic/sale_getLimitGas', {data: limit_param}, {resolveMsg: null, rejectMsg: '获取限购值失败!!'})
140
+ console.log('获取限购值', getLimit)
141
+ self.hasLimit = getLimit.data.hasLimit
142
+ if (self.hasLimit) {
143
+ if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
144
+ if (getLimit.data.f_limit_value < 0 || getLimit.data.f_limit_amount < 0) {
145
+ self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
146
+ self.$dispatch('refresh')
147
+ } else {
148
+ if (getLimit.data.f_limit_value) {
149
+ self.maxgas = (getLimit.data.f_limit_value - 0)
150
+ self.limitgas = true
151
+ }
152
+ if (getLimit.data.f_limit_amount) {
153
+ self.maxmoney = (getLimit.data.f_limit_amount - 0)
154
+ self.limitmoney = true
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ export default {
161
+ title: '自定义收费',
162
+ data () {
163
+ return {
164
+ serialShow: false,
165
+ resid: [], // 存放新增的f_files表中id
166
+ config: {
167
+ notShowFormula: false, // 不显示计算公式,默认显示
168
+ hasPrint: true, // 默认打票
169
+ hasBillManage: false, // 默认不启用发票管理
170
+ floor: false, // 是否取整收费
171
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
172
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
173
+ showupload: true,
174
+ payment: '现金缴费'
175
+ },
176
+ model: {
177
+ f_purchase: 0,
178
+ f_write_card: '不写卡',
179
+ f_payment: '',
180
+ f_pregas: '',
181
+ f_preamount: 0,
182
+ f_totalcost: 0,
183
+ f_curbalance: 0,
184
+ f_collection: 0,
185
+ f_balance: 0,
186
+ f_print: [],
187
+ f_meter_type: '',
188
+ f_voucher_number: '',
189
+ is_accumulate: '计入',
190
+ f_user_name: '',
191
+ f_comments: ''
192
+ },
193
+ calculatedetail: '',
194
+ print: false,
195
+ billData: {
196
+ url: 'api/af-revenue/report/card_bill',
197
+ billnumber: ''
198
+ },
199
+ randomBusinessId: '',
200
+ hasLimit: false,
201
+ maxgas: 99999999, // 限购
202
+ maxmoney: 99999999,
203
+ limitmoney: false,
204
+ limitgas: false,
205
+ mulPrint: false,
206
+ clickConfirm: false, // 控制确认按钮只能点击一次
207
+ // 下拉框值
208
+ paytype: this.$appdata.getParam('付款方式'),
209
+ printstyle: this.$appdata.getParam('打印格式'),
210
+ mjshow: false
211
+ }
212
+ },
213
+ props: ['row'],
214
+ ready () {
215
+ // this.getPurchase()
216
+ console.log('456789', this.row)
217
+ this.model.f_price_id = this.row.f_price_id
218
+ this.model.f_user_id = this.row.f_user_id
219
+ this.model.f_userfiles_id = this.row.f_userfiles_id
220
+ this.model.f_userinfo_id = this.row.f_userinfo_id
221
+ this.model.f_userinfo_code = this.row.f_userinfo_code
222
+ this.model.f_user_name = this.row.f_user_name
223
+ this.model.f_user_type = this.row.f_user_type
224
+ this.model.f_meternumber = this.row.f_meternumber
225
+ this.model.f_address = this.row.f_address
226
+ this.model.f_meter_brand = this.row.f_meter_brand
227
+ this.model.f_meter_style = this.row.f_meter_style
228
+ this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
229
+ if (this.row.f_collection_type == '按金额') {
230
+ this.model.f_totalcost = ''
231
+ this.model.f_pregas = 0
232
+ }
233
+ document.getElementById('fpregas').focus()
234
+ asyncCardMeterCenter(this)
235
+ this.getRandomId()
236
+ },
237
+ events: {
238
+ // 删除Resid数组元素
239
+ 'delResid' (val) {
240
+ this.resid.$remove({id: val, f_biobid: ''})
241
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
242
+ },
243
+ // 增加Resid数组元素
244
+ 'resid' (val) {
245
+ this.resid.push({id: val, f_biobid: ''})
246
+ }
247
+ },
248
+ methods: {
249
+ getRandomId () {
250
+ this.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
251
+ let res = Math.random() * 16 | 0
252
+ let v = c == 'x' ? res : (res & 0x3 | 0x8)
253
+ return v.toString(16)
254
+ })
255
+ },
256
+ confirm () {
257
+ this.clickConfirm = true
258
+ this.$showMessage(`对客户${this.model.f_user_name}进行收费。该操作只做收费,不做写卡,确定要进行该操作吗?`, ['confirm', 'cancel']).then(async (res) => {
259
+ if (res === 'confirm') {
260
+ let data = {
261
+ f_user_id: this.model.f_user_id,
262
+ f_userfiles_id: this.model.f_userfiles_id,
263
+ f_userinfo_id: this.model.f_userinfo_id,
264
+ f_user_name: this.model.f_user_name,
265
+ f_user_type: this.model.f_user_type,
266
+ f_meternumber: this.model.f_meternumber,
267
+ f_address: this.model.f_address,
268
+ f_meter_brand: this.model.f_meter_brand,
269
+ f_meter_style: this.model.f_meter_style,
270
+ f_operator: Vue.$login.f.name,
271
+ f_operatorid: Vue.$login.f.id,
272
+ f_orgid: Vue.$login.f.orgid,
273
+ f_orgname: Vue.$login.f.orgs,
274
+ f_depid: Vue.$login.f.depids,
275
+ f_depname: Vue.$login.f.deps,
276
+ f_operate_date: this.$login.toStandardTimeString(),
277
+ f_payment: this.model.f_payment[0],
278
+ f_price: this.model.f_price,
279
+ f_pregas: this.model.f_pregas,
280
+ f_total_cost: this.model.f_totalcost,
281
+ f_collection: this.model.f_collection,
282
+ f_comments: this.model.f_comments
283
+ }
284
+ console.log('自定义收费', data)
285
+ await this.$resetpost('api/af-revenue/entity/save/t_customizedFees', data, {warnMsg: `确定要对用户${this.model.f_user_name}进行自定义收费吗?`, resolveMsg: '收费成功!!', rejectMsg: '收费失败!!请重试!!'})
286
+ let ss = await this.$refs.paymentcode.flowPath()
287
+ this.$refs.paymentcode.paymentCodeShow = false
288
+ console.log('付款码操作返回', ss)
289
+ if (!ss.result) return
290
+ this.$dispatch('refresh')
291
+ this.clickConfirm = false
292
+ }
293
+ })
294
+ },
295
+ clean () {
296
+ this.$info('取消操作')
297
+ this.$dispatch('refresh', this.row)
298
+ },
299
+ printok () {
300
+ // 收据打完,判断是否还有其他票据进行请求
301
+ for (let i = 0; i < this.model.f_print.length; i++) {
302
+ if (this.model.f_print[i] === '电子发票') {
303
+ this.$CommonService.openEticket(this.row.id, '售气收费')
304
+ }
305
+ }
306
+ this.$dispatch('success')
307
+ },
308
+ pregas () {
309
+ if (this.model.f_pregas && this.model.f_pregas > 0) {
310
+ try {
311
+ // 对气量进行验证
312
+ if ((this.row.f_topup_ceil - 0) > 0 && (this.model.f_pregas - 0) > (this.row.f_topup_ceil - 0)) {
313
+ this.$showAlert(`您输入的气量不能大于该表的充值上限: ${this.row.f_topup_ceil}`, 'warning', 5000)
314
+ this.model.f_pregas = null
315
+ } else {
316
+ pregasGen(this)
317
+ }
318
+ } catch (error) {
319
+ this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
320
+ this.$dispatch('error', '发卡售气', this.model, error)
321
+ }
322
+ }
323
+ },
324
+ preamount () {
325
+ if ((this.model.f_totalcost && this.model.f_totalcost > 0) || this.row.f_balance > 0) {
326
+ try {
327
+ preamountGen(this)
328
+ } catch (error) {
329
+ this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
330
+ this.$dispatch('error', '发卡售气', this.model, error)
331
+ }
332
+ }
333
+ },
334
+ calText (val) {
335
+ let str = ''
336
+ let num = 0
337
+ val.forEach((item) => {
338
+ if (item.f_gas > 0) {
339
+ num = num + 1
340
+ }
341
+ str = str + item.f_price + ' x ' + item.f_gas + '+'
342
+ })
343
+ str = str.slice(0, str.length - 1)
344
+ this.calculatedetail = str
345
+ if (num > 1) {
346
+ if (this.$login.r.find(item => item == '阶梯提示无按钮')) {
347
+ this.$showAlert('友好提示:本次购气已跨阶梯 计算公式:' + (this.calculatedetail ? this.calculatedetail : ' 暂无'), 'warning', 3000)
348
+ } else {
349
+ this.$showMessage('友好提示:本次购气已跨阶梯 计算公式:' + (this.calculatedetail ? this.calculatedetail : ' 暂无'), ['confirm', 'cancel'])
350
+ }
351
+ }
352
+ },
353
+ close () {
354
+ this.print = false
355
+ this.clean()
356
+ }
357
+ },
358
+ watch: {
359
+ 'model.f_payment' (val) {
360
+ if (val == '免交') {
361
+ this.mjshow = true
362
+ } else {
363
+ this.mjshow = false
364
+ }
365
+ }
366
+ },
367
+ computed: {
368
+ 'curbalance' () {
369
+ if (this.model.f_preamount) {
370
+ if (this.config.calculatePreByCollection) {
371
+ return ((this.model.f_collection - 0) + (this.row.f_balance - 0) - this.model.f_preamount).toFixed(4)
372
+ }
373
+ if (this.row.f_collection_type === '按金额') {
374
+ return ((this.model.f_totalcost - 0) + (this.row.f_balance - 0) - (this.model.f_preamount - 0)).toFixed(4)
375
+ } else {
376
+ if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
377
+ return ((this.row.f_balance - 0) - (this.model.f_preamount - 0)).toFixed(4)
378
+ } else {
379
+ return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
380
+ }
381
+ }
382
+ } else {
383
+ return 0
384
+ }
385
+ },
386
+ isMachineMeter() {
387
+ return this.row.f_meter_type && this.row.f_meter_type.indexOf('机表') !== -1
388
+ }
389
+ }
390
+ }
391
+ </script>
392
+
393
+ <style>
394
+ </style>