settlement.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <!--结算-->
  2. <template>
  3. <div class="center">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left titleup">{{information}}信息</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="cancel"
  14. ><img
  15. width="6"
  16. height="10"
  17. style="vertical-align: bottom; margin-right: 3px"
  18. src="../../../public/img/lujing.png"
  19. alt=""
  20. />返回</el-button
  21. >
  22. </el-col>
  23. </el-row>
  24. <div class="substance">
  25. <ws-form>
  26. <div style="width: 50%; margin: 0 auto">
  27. <div class="titles">基本信息</div>
  28. <ws-info-table>
  29. <ws-form-item label="编号" span="1" prop="paymentNo">
  30. <ws-input
  31. v-model="paymentList.paymentNo"
  32. placeholder="请输入编号"
  33. maxlength="100"
  34. disabled
  35. size="small"
  36. />
  37. </ws-form-item>
  38. <ws-form-item label="仓位号" span="1" prop="waterContent">
  39. <ws-input
  40. v-model="paymentList.qualityInspectionManagement.binNumber"
  41. placeholder="请输入仓位号"
  42. maxlength="100"
  43. disabled
  44. size="small"
  45. />
  46. </ws-form-item>
  47. <ws-form-item label="客户" span="1" prop="waterContent">
  48. <ws-input
  49. v-model="paymentList.customerName"
  50. placeholder="请输入仓位号"
  51. maxlength="100"
  52. disabled
  53. size="small"
  54. />
  55. </ws-form-item>
  56. <ws-form-item label="囤位号" span="1" prop="waterContent">
  57. <ws-input v-model="paymentList.qualityInspectionManagement.storageTagNo" placeholder="请输入囤位号" maxlength="100" size="small" disabled />
  58. </ws-form-item>
  59. <ws-form-item label="车牌号" span="1" prop="waterContent">
  60. <ws-input v-model="paymentList.carNo" placeholder="请输入车牌号" maxlength="100" size="small" disabled />
  61. </ws-form-item>
  62. <ws-form-item label="货名" span="1" prop="waterContent">
  63. <ws-input v-model="paymentList.goodsName" placeholder="请输入货名" maxlength="100" size="small" disabled />
  64. </ws-form-item>
  65. <ws-form-item label="类型" span="1" prop="waterContent">
  66. <ws-input v-model="paymentList.type" placeholder="请输入类型" maxlength="100" size="small" disabled />
  67. </ws-form-item>
  68. <ws-form-item label="购粮性质" span="1" prop="waterContent">
  69. <ws-input v-model="paymentList.qualityInspectionManagement.natureOfGrainPurchase" placeholder="请输入购粮性质" maxlength="100" size="small" disabled />
  70. </ws-form-item>
  71. <ws-form-item v-if='paymentList.type=="干粮"' label="干粮单价(元/公斤)" span="1" prop="waterContent">
  72. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.qualityInspectionManagement.dryGrainPrice" placeholder="请输入干粮单价" maxlength="100" size="small" disabled />
  73. </ws-form-item>
  74. <ws-form-item v-if='paymentList.type=="干粮"' label="净重(公斤)" span="1" prop="waterContent">
  75. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.netWeight" placeholder="请输入净重" maxlength="100" size="small" disabled />
  76. </ws-form-item>
  77. </ws-info-table>
  78. <div class="titles">质检数据</div>
  79. <ws-info-table>
  80. <ws-form-item label="等级" span="1" prop="waterContent">
  81. <ws-input v-model="paymentList.qualityInspectionManagement.grade" placeholder="请输入等级" maxlength="100" size="small" disabled />
  82. </ws-form-item>
  83. <ws-form-item label="杂质(%)" span="1" prop="waterContent">
  84. <ws-input type="number" @mousewheel.native.prevent
  85. v-model="paymentList.qualityInspectionManagement.impurity"
  86. placeholder="请输入杂质占比"
  87. maxlength="100"
  88. size="small"
  89. disabled
  90. />
  91. </ws-form-item>
  92. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  93. <ws-input type="number" @mousewheel.native.prevent
  94. v-model="paymentList.qualityInspectionManagement.waterContent"
  95. placeholder="请输入水分占比"
  96. maxlength="100"
  97. size="small"
  98. disabled
  99. />
  100. </ws-form-item>
  101. <ws-form-item label="霉变粒(%)" span="1" prop="waterContent">
  102. <ws-input type="number" @mousewheel.native.prevent
  103. v-model="paymentList.qualityInspectionManagement.mildewGrain"
  104. placeholder="请输入霉变粒占比"
  105. maxlength="100"
  106. size="small"
  107. disabled
  108. />
  109. </ws-form-item>
  110. <ws-form-item label="容重(克/升)" span="1" prop="waterContent">
  111. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.qualityInspectionManagement.bulkDensity" placeholder="请输入容重" maxlength="100" size="small" disabled />
  112. </ws-form-item>
  113. <ws-form-item label="热损伤(%)" span="1" prop="waterContent">
  114. <ws-input type="number" @mousewheel.native.prevent
  115. v-model="paymentList.qualityInspectionManagement.jiaorenli"
  116. placeholder="请输入热损伤占比"
  117. maxlength="100"
  118. size="small"
  119. disabled
  120. />
  121. </ws-form-item>
  122. <ws-form-item label="不完善粒(%)" span="1" prop="waterContent">
  123. <ws-input type="number" @mousewheel.native.prevent
  124. v-model="paymentList.qualityInspectionManagement.imperfectGrain"
  125. placeholder="请输入不完善粒占比"
  126. maxlength="100"
  127. size="small"
  128. disabled
  129. />
  130. </ws-form-item>
  131. </ws-info-table>
  132. <div v-if='paymentList.type=="潮粮"' class="titles">单价核算</div>
  133. <ws-info-table v-if='paymentList.type=="潮粮"'>
  134. <ws-form-item label="潮粮水分(%)" span="1" prop="waterContent">
  135. <ws-input type="number" @mousewheel.native.prevent
  136. v-model="paymentList.qualityInspectionManagement.waterContent"
  137. placeholder="请输入潮粮水分"
  138. maxlength="100"
  139. size="small"
  140. disabled
  141. />
  142. </ws-form-item>
  143. <ws-form-item v-if="paymentList.type=='潮粮' && paymentList.qualityInspectionManagement.paramType != '1'" label="扣重比" span="1" prop="waterContent">
  144. <ws-input type="number" @mousewheel.native.prevent
  145. @input='buckleWeightRatiochange'
  146. v-model="paymentList.buckleWeightRatio"
  147. placeholder="请输入扣重比"
  148. maxlength="100"
  149. size="small"
  150. :disabled='disabled'
  151. />
  152. </ws-form-item>
  153. <ws-form-item v-if='paymentList.type=="潮粮"' label="干粮水分(%)" span="1" prop="waterContent">
  154. <ws-input type="number" @mousewheel.native.prevent
  155. v-model="paymentList.qualityInspectionManagement.waterMin"
  156. placeholder="请输入干粮水分"
  157. maxlength="100"
  158. size="small"
  159. disabled
  160. />
  161. </ws-form-item>
  162. <ws-form-item v-if='paymentList.type=="潮粮" && paymentList.qualityInspectionManagement.paramType == "1"' label="扣重" span="1" prop="waterContent">
  163. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.qualityInspectionManagement.weightDeduction" placeholder="请输入扣重" maxlength="100" size="small" disabled/>
  164. </ws-form-item>
  165. <ws-form-item v-if='paymentList.type=="潮粮" && paymentList.qualityInspectionManagement.paramType != 1' label="掉水(%)" span="1" prop="waterContent" >
  166. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.qualityInspectionManagement.waterContent-paymentList.qualityInspectionManagement.waterMin" placeholder="请输入掉水" maxlength="100" size="small" disabled/>
  167. </ws-form-item>
  168. <ws-form-item v-if='paymentList.type=="潮粮" && paymentList.qualityInspectionManagement.paramType != 1' label="基数" span="1" prop="waterContent">
  169. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.base" placeholder="请输入基数" maxlength="100" size="small" disabled/>
  170. </ws-form-item>
  171. <ws-form-item v-if='paymentList.type=="潮粮"' label="毛重(公斤)" span="1" prop="waterContent">
  172. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.weighingManagement.grossWeight" placeholder="请输入毛重" maxlength="100" size="small" disabled/>
  173. </ws-form-item>
  174. <ws-form-item v-if='paymentList.type=="潮粮"' label="纯重(公斤)" span="1" prop="waterContent">
  175. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.pureWeight" placeholder="请输入纯重" maxlength="100" size="small" disabled/>
  176. </ws-form-item>
  177. <ws-form-item v-if='paymentList.type=="潮粮"' label="皮重(公斤)" span="1" prop="waterContent">
  178. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.weighingManagement.tare" placeholder="请输入皮重" maxlength="100" size="small" disabled/>
  179. </ws-form-item>
  180. <ws-form-item v-if='paymentList.type=="潮粮"'
  181. label="净重单价(元/公斤)"
  182. span="1"
  183. prop="waterContent"
  184. >
  185. <ws-input type="number" @mousewheel.native.prevent
  186. v-model="paymentList.qualityInspectionManagement.tidalGrainPrice"
  187. placeholder="请输入净重单价"
  188. maxlength="100"
  189. size="small"
  190. disabled
  191. />
  192. </ws-form-item>
  193. <ws-form-item v-if='paymentList.type=="潮粮"' label="扣杂" span="1" prop="waterContent">
  194. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.qualityInspectionManagement.buckleMiscellaneous" placeholder="请输入扣杂" maxlength="100" size="small" disabled/>
  195. </ws-form-item>
  196. <ws-form-item label="扣单价(元/公斤)" span="1" prop="unitDeduction">
  197. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.unitDeduction" @input="grainMoney" placeholder="请输入扣单价" maxlength="100" size="small" :disabled="disabled"/>
  198. </ws-form-item>
  199. <ws-form-item v-if='paymentList.type=="潮粮"'
  200. label="纯重单价(元/公斤)"
  201. span="1"
  202. prop="waterContent"
  203. >
  204. <!-- v-model="paymentList.solidGrainPrice" -->
  205. <ws-input type="number" @mousewheel.native.prevent
  206. v-model="paymentList.solidGrainPrice"
  207. placeholder="请输入纯重单价"
  208. maxlength="100"
  209. size="small"
  210. disabled
  211. />
  212. </ws-form-item>
  213. <ws-form-item v-if='paymentList.type=="潮粮"' label="净重(公斤)" span="1" prop="waterContent">
  214. <ws-input type="number" @mousewheel.native.prevent v-model="paymentList.weighingManagement.netWeight" placeholder="请输入净重" maxlength="100" size="small" disabled/>
  215. </ws-form-item>
  216. </ws-info-table>
  217. <div class="titles">结算金额(元)</div>
  218. <ws-info-table>
  219. <ws-form-item v-if='paymentList.type=="潮粮"'
  220. label="粮款 = 净重 x (净重单价 - 扣单价) ="
  221. span="1"
  222. prop="waterContent"
  223. class="formItem"
  224. >
  225. <ws-input type="number" @mousewheel.native.prevent @input='grainMoney' v-model="paymentList.grainMoney" placeholder="请输入粮款" maxlength="100" size="small" disabled/>
  226. </ws-form-item>
  227. <ws-form-item v-if='paymentList.type=="干粮"'
  228. label="粮款 = 净重 x (干粮单价 - 扣单价) ="
  229. span="1"
  230. prop="waterContent"
  231. class="formItem"
  232. >
  233. <ws-input type="number" @mousewheel.native.prevent @input='grainMoney' v-model="paymentList.grainMoney" placeholder="请输入粮款" maxlength="100" size="small" disabled/>
  234. </ws-form-item>
  235. <ws-form-item label="称重扣款" span="1" prop="waterContent">
  236. <ws-input type="number" @mousewheel.native.prevent
  237. @input='grainMoney'
  238. @focus="inputFocus($event)"
  239. v-model="paymentList.weighingDeduction"
  240. placeholder="请输入称重扣款"
  241. maxlength="100"
  242. size="small"
  243. :disabled="disabled"
  244. />
  245. </ws-form-item>
  246. <ws-form-item label="称重补助" span="1" prop="waterContent">
  247. <ws-input type="number" @mousewheel.native.prevent
  248. @input='grainMoney'
  249. @focus="inputFocus($event)"
  250. v-model="paymentList.weighingSubsidy"
  251. placeholder="请输入称重补助"
  252. maxlength="100"
  253. size="small"
  254. :disabled="disabled"
  255. />
  256. </ws-form-item>
  257. <ws-form-item label="运费扣款" span="1" prop="waterContent">
  258. <ws-input type="number" @mousewheel.native.prevent
  259. @input='grainMoney'
  260. @focus="inputFocus($event)"
  261. v-model="paymentList.freightDeduction"
  262. placeholder="请输入运费扣款"
  263. maxlength="100"
  264. :disabled="disabled"
  265. size="small"
  266. />
  267. </ws-form-item>
  268. <ws-form-item label="运费补助" span="1" prop="waterContent">
  269. <ws-input type="number" @mousewheel.native.prevent
  270. @input='grainMoney'
  271. @focus="inputFocus($event)"
  272. v-model="paymentList.freightSubsidy"
  273. placeholder="请输入运费补助"
  274. maxlength="100"
  275. :disabled="disabled"
  276. size="small"
  277. />
  278. </ws-form-item>
  279. <ws-form-item label="卸车扣款" span="1" prop="waterContent">
  280. <ws-input type="number" @mousewheel.native.prevent
  281. @input='grainMoney'
  282. @focus="inputFocus($event)"
  283. v-model="paymentList.unloadDeduction"
  284. placeholder="请输入卸车扣款"
  285. maxlength="100"
  286. :disabled="disabled"
  287. size="small"
  288. />
  289. </ws-form-item>
  290. <ws-form-item label="卸车补助" span="1" prop="waterContent">
  291. <ws-input type="number" @mousewheel.native.prevent
  292. @input='grainMoney'
  293. @focus="inputFocus($event)"
  294. v-model="paymentList.unloadSubsidy"
  295. placeholder="请输入卸车补助"
  296. maxlength="100"
  297. :disabled="disabled"
  298. size="small"
  299. />
  300. </ws-form-item>
  301. <ws-form-item label="质量扣款" span="1" prop="qualityDeduction">
  302. <ws-input type="number" @mousewheel.native.prevent
  303. @input='grainMoney'
  304. @focus="inputFocus($event)"
  305. v-model="paymentList.qualityDeduction"
  306. placeholder="请输入质量扣款"
  307. maxlength="100"
  308. :disabled="disabled"
  309. size="small"
  310. />
  311. </ws-form-item>
  312. <ws-form-item label="其他补助" span="1" prop="waterContent">
  313. <ws-input type="number" @mousewheel.native.prevent
  314. @input='grainMoney'
  315. @focus="inputFocus($event)"
  316. v-model="paymentList.otherSubsidy"
  317. placeholder="请输入其他补助"
  318. maxlength="100"
  319. :disabled="disabled"
  320. size="small"
  321. />
  322. </ws-form-item>
  323. <ws-form-item label="其他扣款" span="1" prop="waterContent">
  324. <ws-input type="number" @mousewheel.native.prevent
  325. @input='grainMoney'
  326. @focus="inputFocus($event)"
  327. v-model="paymentList.otherDeduction"
  328. placeholder="请输入其他扣款"
  329. maxlength="100"
  330. :disabled="disabled"
  331. size="small"
  332. />
  333. </ws-form-item>
  334. <ws-form-item
  335. label="计算应付 = 粮款 + 补助- 扣款 ="
  336. span="1"
  337. prop="waterContent"
  338. class="formItem"
  339. >
  340. <ws-input type="number" @mousewheel.native.prevent
  341. v-model="paymentList.calculationPayable"
  342. placeholder="请输入计算应付"
  343. maxlength="100"
  344. disabled
  345. size="small"
  346. />
  347. </ws-form-item>
  348. <ws-form-item label="实际付款" span="1" prop="waterContent">
  349. <ws-input type="number" @mousewheel.native.prevent
  350. @change='actualPayment'
  351. v-model="paymentList.actualPayment"
  352. placeholder="请输入实际付款"
  353. maxlength="100"
  354. :disabled="disabled"
  355. size="small"
  356. />
  357. </ws-form-item>
  358. <ws-form-item label="人民币大写" span="1" prop="waterContent">
  359. <ws-input
  360. v-model="paymentList.capitalize"
  361. placeholder="请输入人民币大写"
  362. maxlength="100"
  363. disabled
  364. size="small"
  365. />
  366. </ws-form-item>
  367. <ws-form-item label="记事(选填)" span="1" prop="waterContent">
  368. <ws-input
  369. v-model="paymentList.remarks"
  370. placeholder="备注信息,不超过20个字"
  371. maxlength="20"
  372. :disabled="disabled"
  373. size="small"
  374. />
  375. </ws-form-item>
  376. </ws-info-table>
  377. <div class="but">
  378. <el-button @click="cancel" v-if="this.types == 1" type="primary">取消</el-button>
  379. <el-button @click="print" v-if="this.types == 1" type="primary">保存并打印</el-button>
  380. <el-button @click="cancel" v-if="this.types == 2" type="primary">关闭</el-button>
  381. </div>
  382. </div>
  383. </ws-form>
  384. </div>
  385. <el-dialog
  386. width="70%"
  387. class="table-content"
  388. center
  389. :visible.sync="isShowPrint"
  390. :title="printData.compName+'结算凭证'"
  391. @close="closeDialog"
  392. :modal-append-to-body = "false"
  393. >
  394. <paymentPrint :printData="printData" ref="saveImg"></paymentPrint>
  395. <div style="text-align:center">
  396. <el-button type="primary" @click="closePrint">关闭</el-button>
  397. <!-- <el-button type="primary" @click="printSmall">打印小票</el-button> -->
  398. <el-button type="primary" @click="printBig">打印单据</el-button>
  399. </div>
  400. </el-dialog>
  401. </div>
  402. </template>
  403. <script>
  404. import {getpaymentexamine,postpaymentedit,settlementEdit} from '@/model/houseSelfCollect/index'
  405. import paymentPrint from './component/paymentPrint.vue'
  406. import html2canvas from 'html2canvas'
  407. import axios from 'axios'
  408. export default {
  409. components: {
  410. paymentPrint
  411. },
  412. watch: {},
  413. data() {
  414. return {
  415. paymentList: {
  416. qualityInspectionManagement:{
  417. waterContent:'',
  418. buckleWeightRatio:0,
  419. grainMoney:0,
  420. waterMin:0,
  421. },
  422. unitDeduction:0
  423. },
  424. disabled:false,
  425. types:'',
  426. isShowPrint:false,
  427. information:'结算',
  428. printData:{},
  429. imgUrl:'',
  430. }
  431. },
  432. activated() {
  433. this.types = this.$route.query.type
  434. if( this.types == 2){
  435. this.disabled=true
  436. this.information = '查看'
  437. }else if(this.types == 1){
  438. this.disabled=false
  439. this.information = '结算'
  440. }
  441. this.getList()
  442. },
  443. methods: {
  444. inputFocus(event){
  445. event.currentTarget.select()
  446. },
  447. closeDialog(){
  448. html2canvas(this.$refs.saveImg.$el).then((canvas) => {
  449. let dataURL = canvas.toDataURL('image/png')
  450. this.imgUrl = dataURL
  451. if (this.imgUrl !== '' ) {
  452. let b = this.dataURLtoFile(this.imgUrl, 'printImage')
  453. let formdata = new FormData()
  454. formdata.append('file', b)
  455. axios({
  456. method: 'post',
  457. url: 'https://www.zthymaoyi.com/upload/admin',
  458. data: formdata,
  459. }).then((response) => {
  460. //编辑接口
  461. this.paymentList.pictureAddress = response.data.url
  462. settlementEdit(this.paymentList)
  463. .toPromise()
  464. .then((response) => {})
  465. this.paymentList = []
  466. })
  467. this.dialogTableVisible = true
  468. }
  469. })
  470. this.isShowPrint = false
  471. this.$router.push({path:'paymentManagement'})
  472. },
  473. printSmall() {
  474. window.open('../../../../../static/payprint.html?type=1&dataList=' +JSON.stringify(this.printData))
  475. },
  476. printBig() {
  477. window.open('../../../../../static/payprint.html?type=2&dataList=' +JSON.stringify(this.printData))
  478. },
  479. getList(){
  480. getpaymentexamine({id:this.$route.query.id}).toPromise().then((response) => {
  481. this.paymentList = response
  482. if(!this.paymentList.unitDeduction){
  483. this.paymentList.unitDeduction = 0
  484. }
  485. this.paymentList.buckleWeightRatio = this.paymentList.qualityInspectionManagement.buckleWeightRatio
  486. this.paymentList.tidalGrainPrice = this.paymentList.tidalGrainPrice.toFixed(4)
  487. if(this.paymentList.qualityInspectionManagement.paramType == '2'){
  488. this.paymentList.qualityInspectionManagement.weightDeduction=(this.paymentList.qualityInspectionManagement.waterContent-this.paymentList.qualityInspectionManagement.waterMin)*this.paymentList.buckleWeightRatio
  489. this.paymentList.qualityInspectionManagement.weightDeduction=this.paymentList.qualityInspectionManagement.weightDeduction.toFixed(2)
  490. this.paymentList.base=(100-this.paymentList.qualityInspectionManagement.weightDeduction)/100
  491. this.paymentList.base = this.paymentList.base.toFixed(3)
  492. this.paymentList.pureWeight=this.paymentList.base*this.paymentList.weighingManagement.netWeight
  493. this.paymentList.pureWeight = this.paymentList.pureWeight.toFixed(2)
  494. }
  495. else{
  496. this.paymentList.pureWeight=this.paymentList.weighingManagement.netWeight * (100 - this.paymentList.param)/100
  497. this.paymentList.pureWeight = this.paymentList.pureWeight.toFixed(2)
  498. }
  499. if(!this.paymentList.dryGrainPrice){
  500. this.paymentList.dryGrainPrice=this.paymentList.qualityInspectionManagement.tidalGrainPrice/this.paymentList.base
  501. }
  502. this.grainMoney()
  503. })
  504. },
  505. actualPayment(e){
  506. this.paymentList.capitalize=this.convertCurrency(e)
  507. },
  508. grainMoney(){
  509. if(this.paymentList.type =='潮粮'){
  510. this.paymentList.grainMoney=(this.paymentList.qualityInspectionManagement.tidalGrainPrice - this.paymentList.unitDeduction)*this.paymentList.weighingManagement.netWeight
  511. this.paymentList.solidGrainPrice = (Number(this.paymentList.grainMoney)/Number(this.paymentList.pureWeight)).toFixed(4)
  512. this.paymentList.calculationPayable=Number(this.paymentList.grainMoney)+Number(this.paymentList.weighingSubsidy)+Number(this.paymentList.freightSubsidy)+Number(this.paymentList.unloadSubsidy)+Number(this.paymentList.otherSubsidy)-Number(this.paymentList.weighingDeduction)-this.paymentList.freightDeduction-Number(this.paymentList.unloadDeduction)-Number(this.paymentList.otherDeduction)-Number(this.paymentList.qualityDeduction)
  513. this.paymentList.calculationPayable = this.paymentList.calculationPayable.toFixed(2)
  514. this.paymentList.actualPayment = this.paymentList.calculationPayable
  515. this.actualPayment( this.paymentList.actualPayment)
  516. }else{
  517. this.paymentList.grainMoney=(this.paymentList.qualityInspectionManagement.dryGrainPrice - this.paymentList.unitDeduction)*this.paymentList.weighingManagement.netWeight
  518. this.paymentList.calculationPayable=Number(this.paymentList.grainMoney)+Number(this.paymentList.weighingSubsidy)+Number(this.paymentList.freightSubsidy)+Number(this.paymentList.unloadSubsidy)+Number(this.paymentList.otherSubsidy)-Number(this.paymentList.weighingDeduction)-this.paymentList.freightDeduction-Number(this.paymentList.unloadDeduction)-Number(this.paymentList.otherDeduction)-Number(this.paymentList.qualityDeduction)
  519. this.paymentList.calculationPayable = this.paymentList.calculationPayable.toFixed(2)
  520. this.paymentList.actualPayment = this.paymentList.calculationPayable
  521. this.actualPayment( this.paymentList.actualPayment)
  522. }
  523. this.paymentList.grainMoney = this.paymentList.grainMoney.toFixed(2)
  524. },
  525. /**
  526. * 将金额数字转为汉字大写
  527. * 12.42 -> 壹拾贰元肆角贰分
  528. * @param {Number} money - 数字金额
  529. * @return String
  530. */
  531. convertCurrency(money)
  532. {
  533. //汉字的数字
  534. var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
  535. //基本单位
  536. var cnIntRadice = new Array('', '拾', '佰', '仟');
  537. //对应整数部分扩展单位
  538. var cnIntUnits = new Array('', '万', '亿', '兆');
  539. //对应小数部分单位
  540. var cnDecUnits = new Array('角', '分', '毫', '厘');
  541. //整数金额时后面跟的字符
  542. var cnInteger = '整';
  543. //整型完以后的单位
  544. var cnIntLast = '元';
  545. //最大处理的数字
  546. var maxNum = 999999999999999.9999;
  547. //金额整数部分
  548. var integerNum;
  549. //金额小数部分
  550. var decimalNum;
  551. //输出的中文金额字符串
  552. var chineseStr = '';
  553. //分离金额后用的数组,预定义
  554. var parts;
  555. if (money == '') { return ''; }
  556. money = parseFloat(money);
  557. if (money >= maxNum) {
  558. //超出最大处理数字
  559. return '';
  560. }
  561. if (money == 0) {
  562. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  563. return chineseStr;
  564. }
  565. //转换为字符串
  566. money = money.toString();
  567. if (money.indexOf('.') == -1) {
  568. integerNum = money;
  569. decimalNum = '';
  570. } else {
  571. parts = money.split('.');
  572. integerNum = parts[0];
  573. decimalNum = parts[1].substr(0, 4);
  574. }
  575. //获取整型部分转换
  576. if (parseInt(integerNum, 10) > 0) {
  577. var zeroCount = 0;
  578. var IntLen = integerNum.length;
  579. for (var i = 0; i < IntLen; i++) {
  580. var n = integerNum.substr(i, 1);
  581. var p = IntLen - i - 1;
  582. var q = p / 4;
  583. var m = p % 4;
  584. if (n == '0') {
  585. zeroCount++;
  586. } else {
  587. if (zeroCount > 0) {
  588. chineseStr += cnNums[0];
  589. }
  590. //归零
  591. zeroCount = 0;
  592. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  593. }
  594. if (m == 0 && zeroCount < 4) {
  595. chineseStr += cnIntUnits[q];
  596. }
  597. }
  598. chineseStr += cnIntLast;
  599. }
  600. //小数部分
  601. if (decimalNum != '') {
  602. var decLen = decimalNum.length;
  603. for (var i = 0; i < decLen; i++) {
  604. var n = decimalNum.substr(i, 1);
  605. if (n != '0') {
  606. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  607. }
  608. }
  609. }
  610. if (chineseStr == '') {
  611. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  612. } else if (decimalNum == '') {
  613. chineseStr += cnInteger;
  614. }
  615. return chineseStr;
  616. },
  617. print() {
  618. if(this.paymentList.type == '潮粮' && this.paymentList.qualityInspectionManagement.paramType != 1){
  619. if (!this.paymentList.buckleWeightRatio) {
  620. this.$message({
  621. message: '扣重比不能为空',
  622. type: 'warning',
  623. })
  624. return
  625. }
  626. if (this.paymentList.buckleWeightRatio < 0 || this.paymentList.buckleWeightRatio > 2) {
  627. this.$message({
  628. message: '扣重比输入错误',
  629. type: 'warning',
  630. })
  631. return
  632. }
  633. }
  634. if (this.paymentList.weighingSubsidy < 0 || this.paymentList.weighingSubsidy > 100000) {
  635. this.$message({
  636. message: '称重补助范围应在0-100000内',
  637. type: 'warning',
  638. })
  639. return
  640. }
  641. if (this.paymentList.weighingDeduction < 0 || this.paymentList.weighingDeduction > 100000) {
  642. this.$message({
  643. message: '称重扣款范围应在0-100000内',
  644. type: 'warning',
  645. })
  646. return
  647. }
  648. if (this.paymentList.freightSubsidy < 0 || this.paymentList.freightSubsidy > 100000) {
  649. this.$message({
  650. message: '运费补助范围应在0-100000内',
  651. type: 'warning',
  652. })
  653. return
  654. }
  655. if (this.paymentList.freightDeduction < 0 || this.paymentList.freightDeduction > 100000) {
  656. this.$message({
  657. message: '运费扣款范围应在0-100000内',
  658. type: 'warning',
  659. })
  660. return
  661. }
  662. if (this.paymentList.unloadSubsidy < 0 || this.paymentList.unloadSubsidy > 100000) {
  663. this.$message({
  664. message: '卸车补助范围应在0-100000内',
  665. type: 'warning',
  666. })
  667. return
  668. }
  669. if (this.paymentList.unloadDeduction < 0 || this.paymentList.unloadDeduction > 100000) {
  670. this.$message({
  671. message: '卸车扣款范围应在0-100000内',
  672. type: 'warning',
  673. })
  674. return
  675. }
  676. if (this.paymentList.otherSubsidy < 0 || this.paymentList.unloadDeduction > 100000) {
  677. this.$message({
  678. message: '其他补助范围应在0-100000内',
  679. type: 'warning',
  680. })
  681. return
  682. }
  683. if (this.paymentList.qualityDeduction < 0 || this.paymentList.qualityDeduction > 100000) {
  684. this.$message({
  685. message: '质量扣款范围应在0-100000内',
  686. type: 'warning',
  687. })
  688. return
  689. }
  690. if (this.paymentList.otherDeduction < 0 || this.paymentList.otherDeduction > 100000) {
  691. this.$message({
  692. message: '其他扣款范围应在0-100000内',
  693. type: 'warning',
  694. })
  695. return
  696. }
  697. if (this.paymentList.actualPayment < 0 || this.paymentList.otherDeduction > 100000) {
  698. this.$message({
  699. message: '实际付款范围应在0-100000内',
  700. type: 'warning',
  701. })
  702. return
  703. }
  704. if (this.paymentList.remarks&&this.paymentList.remarks.length > 20) {
  705. this.$message({
  706. message: '记事字数应在0-20个字',
  707. type: 'warning',
  708. })
  709. return
  710. }
  711. this.paymentList.id=this.$route.query.id
  712. this.paymentList.amountIngPayable = this.paymentList.actualPayment
  713. this.paymentList.settlementClerk = sessionStorage.getItem('ws-pf_staffName')
  714. postpaymentedit(this.paymentList).toPromise().then((response) => {
  715. getpaymentexamine({id:this.$route.query.id}).toPromise().then((response) => {
  716. this.printData= response
  717. console.log(this.printData,'结算打印')
  718. })
  719. this.isShowPrint = true
  720. },
  721. )
  722. },
  723. buckleWeightRatiochange(e){
  724. if(this.paymentList.buckleWeightRatio >= 0 && this.paymentList.buckleWeightRatio <= 2){
  725. this.paymentList.qualityInspectionManagement.weightDeduction=(this.paymentList.qualityInspectionManagement.waterContent-this.paymentList.qualityInspectionManagement.waterMin)*this.paymentList.buckleWeightRatio
  726. this.paymentList.qualityInspectionManagement.weightDeduction = this.paymentList.qualityInspectionManagement.weightDeduction.toFixed(2)
  727. this.paymentList.base=(100-this.paymentList.qualityInspectionManagement.weightDeduction)/100
  728. this.paymentList.base = this.paymentList.base.toFixed(3)
  729. this.paymentList.pureWeight=this.paymentList.base*this.paymentList.weighingManagement.netWeight
  730. this.paymentList.solidGrainPrice = (Number(this.paymentList.grainMoney)/Number(this.paymentList.pureWeight)).toFixed(4)
  731. this.paymentList.pureWeight = this.paymentList.pureWeight.toFixed(2)
  732. }else{
  733. this.$message({
  734. message: '扣重比输入错误',
  735. type: 'warning',
  736. })
  737. }
  738. },
  739. cancel() {
  740. this.isShowPrint = false
  741. this.paymentList = []
  742. this.$router.push({ path: 'paymentManagement' })
  743. },
  744. closePrint(){
  745. this.isShowPrint = false
  746. this.$router.push({path:'paymentManagement'})
  747. },
  748. },
  749. }
  750. </script>
  751. <style lang="scss" scoped>
  752. .center {
  753. background: #f6f7fc;
  754. }
  755. .ws-info-table {
  756. border: none;
  757. }
  758. .ws-info-table .el-form-item {
  759. width: 50%;
  760. border: none;
  761. }
  762. /deep/.ws-info-table .el-form-item .el-form-item__label {
  763. width: 40%;
  764. text-align: center;
  765. background: #ffffff;
  766. font-size: 14px;
  767. color: #8890b1;
  768. }
  769. /deep/.ws-info-table .el-form-item .el-form-item__content {
  770. border: none;
  771. }
  772. .titles {
  773. font-size: 16px;
  774. font-weight: 600;
  775. margin: 10px;
  776. }
  777. .titles::before {
  778. content: '';
  779. display: inline-block;
  780. width: 5px;
  781. height: 15px;
  782. background: #8890b1;
  783. margin-right: 5px;
  784. }
  785. .substance {
  786. background: #ffffff;
  787. width: 100%;
  788. border-radius: 4px;
  789. margin: 0 auto;
  790. padding-top: 20px;
  791. }
  792. .formItem {
  793. width: 70% !important;
  794. }
  795. /deep/.ws-info-table .formItem .el-form-item__label{
  796. width: 260px;
  797. }
  798. /deep/.el-table .el-table__header .cell,
  799. .el-table .el-table__body .cell {
  800. text-align: center;
  801. }
  802. /deep/.el-table--enable-row-transition .el-table__body td {
  803. text-align: center;
  804. }
  805. .bg-left {
  806. padding-left: 30px;
  807. }
  808. .bg-right {
  809. padding-right: 10px;
  810. text-align: right;
  811. }
  812. .bg-bottom {
  813. margin: 15px 0px;
  814. }
  815. .titleup {
  816. position: relative;
  817. }
  818. .titleup::before {
  819. content: '';
  820. display: inline-block;
  821. width: 5px;
  822. height: 30px;
  823. background: #5473e8;
  824. position: absolute;
  825. left: 0;
  826. }
  827. .but {
  828. text-align: center;
  829. margin: 20px auto;
  830. }
  831. .el-form{
  832. overflow: scroll;
  833. height: 86vh;
  834. }
  835. /deep/.el-table .el-table__header .cell,
  836. .el-table .el-table__body .cell {
  837. text-align: center;
  838. }
  839. /deep/.el-table--enable-row-transition .el-table__body td {
  840. text-align: center;
  841. }
  842. .title{
  843. padding:10px;
  844. text-align:center;
  845. }
  846. /deep/.el-dialog__title {
  847. font-size: 24px !important;
  848. }
  849. /deep/.el-dialog__header {
  850. text-align: center !important;
  851. padding: 10px 0 !important;
  852. height: auto !important;
  853. }
  854. .title {
  855. font-size: 16px;
  856. font-weight: 600;
  857. }
  858. table,
  859. table tr th,
  860. table tr td {
  861. border: 2px solid #333333;
  862. padding: 5px 0;
  863. }
  864. table {
  865. width: 100%;
  866. min-height: 25px;
  867. line-height: 25px;
  868. text-align: center;
  869. border-collapse: collapse;
  870. border: 3px solid #333333;
  871. }
  872. </style>