sale-client 3.6.566 → 3.6.567

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sale-client",
3
- "version": "3.6.566",
3
+ "version": "3.6.567",
4
4
  "description": "收费模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -245,6 +245,11 @@
245
245
  *卡表收费组件
246
246
  */
247
247
 
248
+ // 输入金额,换算气量
249
+ function stringRound(num, decimals = 2) {
250
+ const strValue = num + 'e' + decimals
251
+ return Math.round(Number(strValue)) / Math.pow(10, decimals)
252
+ }
248
253
  // 输入金额,换算气量
249
254
  let preamountGen = async function (self) {
250
255
  let calFee = ((self.model.f_preamount - 0)).toFixed(self.row.f_fee_decimal || 2)
@@ -803,6 +808,7 @@
803
808
  calText (val) {
804
809
  let str = ''
805
810
  let num = 0
811
+ let total = 0
806
812
  val.forEach((item) => {
807
813
  if (item.f_gas > 0) {
808
814
  num = num + 1
@@ -812,8 +818,10 @@
812
818
  } else {
813
819
  str = str + item.f_price + ' x ' + Math.floor(item.f_gas) + '+'
814
820
  }
821
+ total += item.f_price * item.f_gas
815
822
  })
816
823
  str = str.slice(0, str.length - 1)
824
+ str += ` = ${total}`
817
825
  this.calculatedetail = str
818
826
  if (num > 1) {
819
827
  if (this.$login.r.find(item => item == '阶梯提示无按钮')) {
@@ -0,0 +1,234 @@
1
+ <template>
2
+ <div class="auto">
3
+ <validator name='v'>
4
+ <form novalidate class="form-horizontal">
5
+ <div class="row">
6
+ <div class="col-sm-4 form-group">
7
+ <label class="font_normal_body" title="参数名称:付款方式">收款方式</label>
8
+
9
+ <v-select v-model="f_payment"
10
+ placeholder='请选择'
11
+ style="width:60%"
12
+ :value.sync="model.f_payment"
13
+ :options='paytype'
14
+ close-on-select clear-button></v-select>
15
+
16
+ </div>
17
+ <div class="col-sm-4 form-group">
18
+ <label for="f_print" class="font_normal_body">打印格式</label>
19
+
20
+ <v-select id="print"
21
+ v-model="f_print"
22
+ style="width:60%"
23
+ placeholder='请选择'
24
+ :value.sync="model.f_print"
25
+ :options='printstyle'
26
+ close-on-select clear-button>
27
+ </v-select>
28
+ </div>
29
+ <div class="col-sm-4 form-group">
30
+ <label class="font_normal_body" title="参数值:计入/不计入,计入:更新档案结余及累购,不计入:只保存记录不对档案进行操作">计入累购</label>
31
+ <input v-show="false" v-model="model.f_add_gas" v-validate:f_operat_type='{required: true}'>
32
+ <v-select :value.sync="model.f_add_gas" value-single
33
+ :options='addGas' placeholder='请选择'
34
+ selected="是否计入累购"
35
+ style="width:60%"
36
+ close-on-select></v-select>
37
+ </div>
38
+ <div class="col-sm-4 form-group">
39
+ <label class="font_normal_body">剩余金额</label>
40
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_balance" readonly>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="row">
45
+
46
+
47
+ <div class="col-sm-8">
48
+ <label for="f_paper_account" class="font_normal_body ">&nbsp;&nbsp;&nbsp;备注&nbsp;&nbsp;&nbsp;</label>
49
+ <input class="input_search" style="width:80%" v-model="model.f_comments">
50
+ </div>
51
+ <div class="col-sm-4 form-group" v-if="!config.overBalance"
52
+ :class="[$v.f_refund_fee.required || $v.f_refund_fee.dctest ? 'has-error' : 'has-success']">
53
+ <label class="font_normal_body">退费金额</label>
54
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_refund_fee"
55
+ v-validate:f_refund_fee='{required: true, dctest: [data.f_balance, "<=" ]}' placeholder="退费金额">
56
+ </div>
57
+ <div class="col-sm-4 form-group" v-if="config.overBalance"
58
+ :class="[$v.f_refund_fee.required || $v.f_refund_fee.dctest ? 'has-error' : 'has-success']">
59
+ <label class="font_normal_body">退费金额</label>
60
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_refund_fee"
61
+ v-validate:f_refund_fee='{required: true, dctest: [0, ">=" ]}' placeholder="退费金额">
62
+ </div>
63
+ </div>
64
+ </form>
65
+ <div style="text-align:right;">
66
+ <button class="button_search btn-gn" @click="confirm()" :disabled='!$v.valid'>确认</button>
67
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
68
+ </div>
69
+ </validator>
70
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
71
+ <!--<print-bill :show="print" :bill-manager='config.hasBillManage' v-ref:printbill :bill-url='billUrl' v-on:toggle="clean" @printok="printok" :data='printModel'></print-bill>-->
72
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' v-on:toggle="clean" @printok="printok" :data='printModel' v-ref:printbill></print-bill>
73
+ </div>
74
+
75
+ <upload :blodid="data.f_userinfo_id" :businessid="randomBusinessId" isremark="true" fusetype="退费管理"></upload>
76
+ </template>
77
+
78
+
79
+ <script>
80
+ let readyGen = async function (self) {
81
+ await self.$getConfig(self, 'MachineTRefund')
82
+ console.log('机表退费config', self.config)
83
+ // 默认打印格式
84
+ self.blodid = self.data.f_userinfo_id
85
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
86
+ self.model.f_payment = [self.config.payment]
87
+
88
+ self.model.f_use_type = self.config.billType
89
+ self.model.f_bill_type = self.model.f_print
90
+ self.hasValidateBill = self.config.hasBillManage
91
+ }
92
+
93
+ export default {
94
+ title: '机表退费',
95
+ data () {
96
+ return {
97
+ config: {
98
+ showupload: false, // 默认不上传附件
99
+ hasPrint: false, // 默认打票
100
+ hasBillManage: false, // 默认不启用发票管理
101
+ overBalance: false, // 为true时退费金额可以大于余额
102
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
103
+ payment: '现金缴费',
104
+ billType: '燃气费'
105
+ },
106
+ model: {
107
+ f_refund_fee: '',
108
+ f_add_gas: '计入',
109
+ f_comments: '',
110
+ f_payment: '',
111
+ f_print: ''
112
+ },
113
+ addGas: [{label: '计入', value: '计入'}, {label: '不计入', value: '不计入'}],
114
+ blodid: '',
115
+ hasValidateBill: false,
116
+ randomBusinessId: '',
117
+ resid: [], // 存放新增的f_files表中id
118
+ validateOk: false,
119
+
120
+ printModel: {},
121
+ print: false,
122
+ billUrl: '',
123
+ billData: {
124
+ url: 'rs/report/refund_sell',
125
+ bill: ''
126
+ },
127
+
128
+ // 下拉框值
129
+ paytype: this.$appdata.getParam('付款方式'),
130
+ printstyle: this.$appdata.getParam('打印格式')
131
+ }
132
+ },
133
+ props: ['data'],
134
+ ready () {
135
+ /* if (this.data.f_billing === '按气量') {
136
+ this.$showAlert('按气量缴费的机表退费功能尚未开放!!', 'warning', 3000)
137
+ this.$dispatch('refresh')
138
+ } else { */
139
+ readyGen(this)
140
+ /* } */
141
+ this.getRandomId()
142
+ },
143
+ events: {
144
+ // 删除Resid数组元素
145
+ 'delResid' (val) {
146
+ this.resid.$remove({id: val, f_biobid: ''})
147
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
148
+ },
149
+ // 增加Resid数组元素
150
+ 'resid' (val) {
151
+ this.resid.push({id: val, f_biobid: ''})
152
+ }
153
+ },
154
+ methods: {
155
+ getRandomId () {
156
+ this.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
157
+ let res = Math.random() * 16 | 0
158
+ let v = c == 'x' ? res : (res & 0x3 | 0x8)
159
+ return v.toString(16)
160
+ })
161
+ },
162
+ async confirm () {
163
+ let param = {
164
+ f_user_id: this.data.f_user_id,
165
+ f_userfiles_id: this.data.f_userfiles_id,
166
+ version: this.data.version,
167
+ f_refund_fee: (this.model.f_refund_fee - 0),
168
+ f_comments: this.model.f_comments,
169
+ f_payment: this.model.f_payment[0],
170
+ f_print: this.model.f_print[0],
171
+ f_price_id: this.data.f_price_id,
172
+ f_add_gas: this.model.f_add_gas,
173
+ f_total_fee: parseFloat(this.data.f_total_fee) - parseFloat(this.model.f_refund_fee),
174
+ f_stairprice_id: this.data.f_stairprice_id,
175
+ operInfo: {
176
+ f_operator: this.$login.f.name,
177
+ f_operatorid: this.$login.f.id,
178
+ f_orgid: this.$login.f.orgid,
179
+ f_orgname: this.$login.f.orgs,
180
+ f_depid: this.$login.f.depids,
181
+ f_depname: this.$login.f.deps
182
+ }
183
+ }
184
+ if (this.model.f_add_gas !== '计入') {
185
+ param.f_total_fee = this.data.f_total_fee
186
+ }
187
+ let res = await this.$resetpost('rs/logic/machineRefund', {data: param}, {warnMsg: `确定要对用户${this.data.f_user_name}进行退费吗?`, resolveMsg: '退费成功!!', rejectMsg: '退费失败!!请重试!!'})
188
+ console.log('机表退费返回的数据==========>', res)
189
+ let param1 = []
190
+ for (let row of this.resid) {
191
+ param1.push({id: row.id})
192
+ }
193
+ let data = {
194
+ param: param1,
195
+ f_blobid: res.data.id
196
+ }
197
+ await this.$resetpost('rs/logic/updatefiles', data)
198
+ if (this.model.f_print.indexOf('电子发票') == -1 && this.config.hasPrint && !this.$login.r.includes('不打印发票')) {
199
+ console.log('this.config.hasBillManage', this.config.hasBillManage)
200
+ if (this.config.hasBillManage) {
201
+ // 启用发票管理,获取票据管理中的票号并存储记录
202
+ this.printModel.id = res.data.id
203
+ this.printModel.f_bill_type = '退费'
204
+ this.printModel.f_bill_style = this.model.f_print[0]
205
+ // this.billUrl = 'rs/report/refund_sell'
206
+ this.print = true
207
+ } else {
208
+ this.printModel.id = res.data.id
209
+ // this.billUrl = 'rs/report/refund_sell'
210
+ this.print = true
211
+ }
212
+ } else if (this.config.printType === '国税发票') {
213
+ // TODO
214
+ this.$dispatch('success')
215
+ } else if (this.config.printType === '电子发票') {
216
+ // TODO
217
+ this.$dispatch('success')
218
+ } else {
219
+ this.$dispatch('success')
220
+ }
221
+ },
222
+ clean () {
223
+ this.$dispatch('refresh')
224
+ },
225
+ printok () {
226
+ this.$dispatch('success')
227
+ },
228
+ validateBill (val) {
229
+ this.validateOk = !val.isOk
230
+ this.billData.bill = val.bill
231
+ }
232
+ }
233
+ }
234
+ </script>