index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <view style="background-color: #f2f2f6;padding-bottom: 0.01rpx;" :class="mask ? 'tl-show': ''">
  3. <!-- <u-navbar title="代收款" bgColor="#FD4B09" :autoBack="true" :placeholder="true" leftIconColor="#fff" :titleStyle="{color: '#fff'}"> -->
  4. <!-- <view slot="right">
  5. <u-icon name="clock" size="40rpx" color="#fff" @click="historical0rders()"></u-icon>
  6. </view> -->
  7. <!-- </u-navbar> -->
  8. <view style="background-color: #fff;position: fixed;top: var(--window-top);width: 100%;z-index: 8;">
  9. <u-tabs :list="tabsList" keyName="dictValue" itemStyle="height:88rpx;" lineColor="#FD4B09"
  10. @click="tabsClick" :current="current">
  11. <!-- <view slot="right" style="font-size: 15px;" @click="sortOpen = !sortOpen,mask = !mask">
  12. <text style="margin-left: 10rpx;">|<text style="margin:0rpx 15rpx">排序</text></text>
  13. </view> -->
  14. </u-tabs>
  15. <view style="background-color: #fff;padding: 10rpx 20rpx;">
  16. <u-search placeholder="请输入销售单号" v-model="form.ordNo" @custom="custom" @search="custom"></u-search>
  17. </view>
  18. </view>
  19. <view class="content" style="margin-top: 100px;">
  20. <view class="contentBox" v-for="(item,index) in dataList" :key="index" @click="choice(item,index)">
  21. <view style="width: 100%;margin: 0 auto;">
  22. <u-cell-group :border="false">
  23. <u-cell :border="false" center :title="item.ordNo" arrow-direction="down">
  24. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  25. <view slot="value">
  26. <view
  27. style="padding: 5rpx 30rpx;border:1rpx solid #FD4B09;border-radius: 100rpx;color: #FD4B09;">
  28. {{item.status}}
  29. </view>
  30. </view>
  31. </u-cell>
  32. </u-cell-group>
  33. <view class="textBox">
  34. <view style="font-size: 32rpx;">{{item.customerName}}</view>
  35. <view>{{item.businesDate?item.businesDate.slice(0,10):''}}</view>
  36. </view>
  37. <view class="textBox">
  38. <view class="widthdian">{{item.goodsNameJoin}}</view>
  39. </view>
  40. <!-- <view class="textBox">
  41. <view style="font-size: 28rpx;">数量:{{Number(item.goodsTotalNum).toFixed(0)}}</view>
  42. </view> -->
  43. <!-- <view class="textBox">
  44. <view>订单金额:¥{{item.totalMoney}}</view>
  45. <view style="color: #FD4B09;font-size: 32rpx;">
  46. {{(item.totalMoney - item.paymentAmountTl) == 0?'已结清':'未收款:¥' + (item.totalMoney - item.paymentAmountTl) +'元'}}
  47. </view>
  48. </view> -->
  49. <view class="textBox">
  50. <view style="font-size: 28rpx;">资金方:</view>
  51. <view style="font-size: 28rpx;">{{item.fundingPartyName}}</view>
  52. </view>
  53. <view class="textBox">
  54. <view style="font-size: 28rpx;">配资比例:</view>
  55. <view style="font-size: 28rpx;">{{item.proportion}}</view>
  56. </view>
  57. <view class="textBox">
  58. <view style="font-size: 28rpx;">保证金:</view>
  59. <view style="font-size: 28rpx;">{{item.bondAmount}}</view>
  60. </view>
  61. <view class="textBox">
  62. <view style="font-size: 28rpx;">融资金额:</view>
  63. <view style="font-size: 28rpx;">{{item.fundingAmount}}</view>
  64. </view>
  65. <view class="textBox">
  66. <view style="font-size: 28rpx;">采购数量/采购金额:</view><span
  67. style="font-size: 28rpx;">{{item.goodsTotalNum}}/{{item.totalMoney}}</span>
  68. </view>
  69. <view class="textBox">
  70. <view style="font-size: 28rpx;">到货数量/到货金额:</view><span
  71. style="font-size: 28rpx;">{{item.outGoodsTotalShipNum}}/{{item.goodsTotalShipAmount}}</span>
  72. </view>
  73. <view class="textBox">
  74. <view style="font-size: 28rpx;">在库数量/在库金额:</view><span
  75. style="font-size: 28rpx;">{{item.surplusShipNum}}/{{item.surplusShipAmount}}</span>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {
  84. queryBrand
  85. } from '@/api/views/stock/index.js'
  86. import {
  87. queryList,
  88. corpsDescList,
  89. gainUser
  90. } from '@/api/views/sale/salesOrderList.js'
  91. import {
  92. collectPayment,
  93. getCorpDesc
  94. } from '@/api/views/sale/salesOrderDetails.js'
  95. import {
  96. dateFormat
  97. } from '@/common/dateFormat'
  98. import {
  99. logo
  100. } from '../../../common/setting'
  101. export default {
  102. data() {
  103. return {
  104. timeOpen: false,
  105. datetime: Number(new Date()),
  106. dataList: [],
  107. screen: [],
  108. columns: [],
  109. show: false,
  110. openPopup: false,
  111. sortOpen: false,
  112. mask: false,
  113. current: 0,
  114. total: 0,
  115. keyName: 'cname',
  116. status: 'loadmore',
  117. form: {
  118. current: 1,
  119. size: 20,
  120. bsType: "RZCG",
  121. },
  122. formTwo: {},
  123. tabsList: [{
  124. dictKey: null,
  125. dictValue: '全部'
  126. }, {
  127. dictKey: "录入",
  128. dictValue: "录入"
  129. }, {
  130. dictKey: "待确认",
  131. dictValue: "待确认"
  132. }, {
  133. dictKey: "已收货",
  134. dictValue: "已收货"
  135. }],
  136. scrollTop: 0,
  137. // 会员卡余额
  138. balanceAmount: 0,
  139. // 深拷贝的优惠金额数据
  140. JsonthisUsedProfit: 0
  141. }
  142. },
  143. onLoad() {
  144. this.dataList = []
  145. this.query()
  146. },
  147. onReachBottom() {
  148. this.status = 'loading'
  149. if (this.dataList.length < this.total) {
  150. this.form.current++
  151. this.query()
  152. } else {
  153. this.status = 'nomore'
  154. }
  155. },
  156. onPageScroll(e) {
  157. this.scrollTop = e.scrollTop;
  158. },
  159. methods: {
  160. newCompany() {
  161. uni.$u.route('/pages/views/product/createCompany', {
  162. code: "account",
  163. title: "收款账户"
  164. });
  165. },
  166. custom(e) {
  167. this.form.current = 1
  168. this.dataList = []
  169. this.query()
  170. },
  171. //时间确认选择
  172. confirmTiem(e) {
  173. this.formTwo[this.screen[1]] = dateFormat(new Date(e.value), "YYYY-MM-DD HH:mm:ss")
  174. this.timeOpen = false
  175. this.mask = false
  176. },
  177. thisUsedProfitchange() {
  178. // 订单金额
  179. this.formTwo.orderAmount = this.formTwo.orderAmount ? Number(this.formTwo.orderAmount) : 0
  180. // 优惠金额
  181. this.formTwo.thisUsedProfit = this.formTwo.thisUsedProfit ? Number(this.formTwo.thisUsedProfit) : 0
  182. // 已收金额
  183. this.formTwo.settlmentAmount = this.formTwo.settlmentAmount ? Number(this.formTwo.settlmentAmount) : 0
  184. // 应收金额
  185. this.formTwo.debitAmount = this.formTwo.debitAmount ? Number(this.formTwo.debitAmount) : 0
  186. // 会员卡金额
  187. this.formTwo.memberAmout = this.formTwo.memberAmout ? Number(this.formTwo.memberAmout) : 0
  188. if (this.formTwo.thisUsedProfit < 0) {
  189. this.$refs.uToast.show({
  190. type: 'error',
  191. icon: false,
  192. message: "优惠金额不能小于零",
  193. })
  194. this.formTwo.thisUsedProfit = 0
  195. }
  196. if (this.formTwo.thisUsedProfit > this.formTwo.orderAmount) {
  197. this.$refs.uToast.show({
  198. type: 'error',
  199. icon: false,
  200. message: "优惠金额不能大于订单金额",
  201. })
  202. this.formTwo.thisUsedProfit = 0
  203. }
  204. this.formTwo.debitAmount = this.formTwo.orderAmount - this.formTwo.thisUsedProfit
  205. this.formTwo.memberAmout = this.formTwo.debitAmount - this.formTwo.currentAmount
  206. this.formTwo.currentAmount = this.formTwo.debitAmount - this.formTwo.memberAmout
  207. },
  208. // 会员卡收款监听事件
  209. memberBalancechange() {
  210. // 订单金额
  211. this.formTwo.orderAmount = this.formTwo.orderAmount ? Number(this.formTwo.orderAmount) : 0
  212. // 优惠金额
  213. this.formTwo.thisUsedProfit = this.formTwo.thisUsedProfit ? Number(this.formTwo.thisUsedProfit) : 0
  214. // 已收金额
  215. this.formTwo.settlmentAmount = this.formTwo.settlmentAmount ? Number(this.formTwo.settlmentAmount) : 0
  216. // 应收金额
  217. this.formTwo.debitAmount = this.formTwo.debitAmount ? Number(this.formTwo.debitAmount) : 0
  218. // 会员卡金额
  219. this.formTwo.memberAmout = this.formTwo.memberAmout ? Number(this.formTwo.memberAmout) : 0
  220. if (this.formTwo.memberAmout < 0) {
  221. this.$delete(this.formTwo, 'memberAmout')
  222. this.$set(this.formTwo, 'memberAmout', 0)
  223. this.$refs.uToast.show({
  224. type: 'error',
  225. icon: false,
  226. message: "会员卡金额不能小于零",
  227. })
  228. // this.formTwo.memberAmout = 0
  229. }
  230. if (this.formTwo.memberAmout >= this.balanceAmount) {
  231. this.$delete(this.formTwo, 'memberAmout')
  232. this.$set(this.formTwo, 'memberAmout', this.balanceAmount)
  233. // this.formTwo.memberAmout = this.balanceAmount
  234. this.formTwo.currentAmount = 0
  235. this.$refs.uToast.show({
  236. type: 'error',
  237. icon: false,
  238. message: "会员卡金额不能大于余额",
  239. })
  240. }
  241. const curr = this.formTwo.debitAmount - this.formTwo.settlmentAmount
  242. if (this.formTwo.memberAmout > curr) {
  243. // this.formTwo.memberAmout = curr
  244. this.$delete(this.formTwo, 'memberAmout')
  245. this.$set(this.formTwo, 'memberAmout', curr)
  246. }
  247. this.formTwo.currentAmount = this.formTwo.debitAmount - this.formTwo.settlmentAmount - this.formTwo
  248. .memberAmout
  249. },
  250. discount(type) {
  251. if (type == 0) {
  252. if (this.formTwo.thisUsedProfit < 0) {
  253. return this.formTwo.thisUsedProfit = null
  254. }
  255. this.formTwo.debitAmount = (this.formTwo.orderAmount - this.formTwo.thisUsedProfit).toFixed(2)
  256. if (this.formTwo.debitAmount < 0) {
  257. this.$set(this.formTwo, "debitAmount", null)
  258. this.$set(this.formTwo, "thisUsedProfit", null)
  259. uni.showToast({
  260. icon: "none",
  261. title: '优惠金额不能大于订单金额',
  262. mask: true
  263. });
  264. }
  265. if ((this.formTwo.currentAmount - this.formTwo.debitAmount) > 0) {
  266. this.formTwo.overPayment = (this.formTwo.currentAmount - this.formTwo.debitAmount).toFixed(2)
  267. } else {
  268. this.formTwo.overPayment = '0.00'
  269. }
  270. } else if (type == 1) {
  271. // 已收金额
  272. this.formTwo.settlmentAmount = this.formTwo.settlmentAmount ? Number(this.formTwo.settlmentAmount) : 0
  273. // 应收金额
  274. this.formTwo.debitAmount = this.formTwo.debitAmount ? Number(this.formTwo.debitAmount) : 0
  275. this.formTwo.memberAmout = this.formTwo.memberAmout ? Number(this.formTwo.memberAmout) : 0
  276. this.formTwo.currentAmount = this.formTwo.currentAmount ? Number(this.formTwo.currentAmount) : 0
  277. console.log((this.formTwo.debitAmount - this.formTwo.settlmentAmount - this.formTwo.memberAmout), 353);
  278. if (this.formTwo.currentAmount > (this.formTwo.debitAmount - this.formTwo.settlmentAmount - this
  279. .formTwo.memberAmout)) {
  280. this.$refs.uToast.show({
  281. type: 'error',
  282. icon: false,
  283. message: "收款和会员卡金额不能大于应收金额",
  284. })
  285. this.formTwo.currentAmount = 0
  286. }
  287. if (this.formTwo.currentAmount < 0) {
  288. return this.formTwo.currentAmount = 0
  289. }
  290. // if ((this.formTwo.currentAmount - this.formTwo.orderAmount) > 0) {
  291. // this.formTwo.overPayment = (this.formTwo.currentAmount - this.formTwo.orderAmount).toFixed(2)
  292. // } else {
  293. // this.formTwo.overPayment = '0.00'
  294. // }
  295. }
  296. },
  297. collectionConfirm() {
  298. if (!this.formTwo.orderAmount) {
  299. return uni.showToast({
  300. icon: "none",
  301. title: '合同金额不能为空',
  302. mask: true
  303. });
  304. }
  305. // 判断本次收款和会员卡收款不能为空
  306. if (!this.formTwo.currentAmount || this.formTwo.currentAmount == 0) {
  307. if (!this.formTwo.memberAmout || this.formTwo.memberAmout == 0) {
  308. return uni.showToast({
  309. icon: "none",
  310. title: '本次收款金额或会员卡金额不能为空或零',
  311. mask: true
  312. });
  313. }
  314. }
  315. if (!this.formTwo.account) {
  316. return uni.showToast({
  317. icon: "none",
  318. title: '收款账户不能为空',
  319. mask: true
  320. });
  321. }
  322. this.formTwo.currentAmount = this.formTwo.currentAmount ? this.formTwo.currentAmount : 0
  323. let this_ = this
  324. uni.showModal({
  325. title: '收款:',
  326. content: '现金收款:' + this_.formTwo.currentAmount + '元\n会员卡:' + this_.formTwo.memberAmout + '元',
  327. success: function(rest) {
  328. if (rest.confirm == true) {
  329. uni.showLoading({
  330. title: '加载中',
  331. mask: true
  332. });
  333. collectPayment(this_.formTwo).then(res => {
  334. uni.showToast({
  335. icon: "none",
  336. title: '收款成功',
  337. mask: true,
  338. duration: 2000
  339. });
  340. this_.openPopup = false
  341. this_.mask = false
  342. setTimeout(function() {
  343. uni.hideLoading();
  344. this_.dataList = []
  345. this_.query()
  346. }, 2000);
  347. })
  348. }
  349. }
  350. })
  351. },
  352. //集合筛选条件
  353. filterAll(screen) {
  354. this.screen = screen
  355. switch (screen[1]) {
  356. case "account":
  357. this.$u.api.getWorkDicts('account').then(res => {
  358. this.columns = [res.data]
  359. this.keyName = "dictValue"
  360. this.mask = true
  361. this.show = true
  362. })
  363. break;
  364. case "advanceCollectionDate":
  365. this.timeOpen = true
  366. this.mask = true
  367. break;
  368. }
  369. },
  370. collection(item, index) {
  371. this.formTwo = JSON.parse(JSON.stringify(item))
  372. this.formTwo.advanceCollectionDate = dateFormat(new Date(), "YYYY-MM-DD HH:mm:ss")
  373. // 深拷贝优惠金额判断是否可以编辑
  374. this.JsonthisUsedProfit = JSON.parse(JSON.stringify(this.formTwo.thisUsedProfit))
  375. const curr = this.formTwo.debitAmount - this.formTwo.settlmentAmount
  376. // const curr = (this.formTwo.orderAmount - this.formTwo.thisUsedProfit - this.formTwo.settlmentAmount).toFixed(2)
  377. // this.formTwo.currentAmount = (this.formTwo.orderAmount - this.formTwo.settlmentAmount).toFixed(2)
  378. // 判断剪掉的值是不是大于会员卡余额
  379. getCorpDesc({
  380. id: item.corpId
  381. }).then(res => {
  382. console.log(res, 478);
  383. this.balanceAmount = res.data.balanceAmount ? res.data.balanceAmount : 0
  384. if (curr > this.balanceAmount) {
  385. this.formTwo.memberAmout = this.balanceAmount
  386. this.formTwo.currentAmount = curr - this.formTwo.memberAmout
  387. } else {
  388. this.formTwo.memberAmout = curr
  389. this.formTwo.currentAmount = 0
  390. }
  391. })
  392. this.openPopup = true
  393. this.mask = true
  394. },
  395. sortQuery(val, sort = 0) {
  396. this.form = {
  397. current: 1,
  398. size: 10,
  399. sort: sort,
  400. typeSort: val
  401. }
  402. this.dataList = []
  403. this.sortOpen = false
  404. this.mask = false
  405. this.current = 0
  406. this.query()
  407. },
  408. dropdownOpen() {
  409. this.sortOpen = false
  410. this.mask = false
  411. },
  412. choice(item, index) {
  413. uni.$u.route('/pages/views/procurement/details', {
  414. id: item.id,
  415. corpId: item.corpId
  416. });
  417. },
  418. //查询
  419. query() {
  420. uni.showLoading({
  421. title: '加载中',
  422. mask: true
  423. });
  424. queryList({
  425. notComplete: 1,
  426. ...this.form,
  427. }).then(res => {
  428. if (res.data.records) {
  429. this.dataList = this.dataList.concat(res.data.records)
  430. }
  431. this.total = res.data.total || 0
  432. uni.hideLoading();
  433. if (this.total < 10) {
  434. this.status = 'nomore'
  435. }
  436. })
  437. },
  438. // tabs切换
  439. tabsClick(item) {
  440. this.current = item.index
  441. this.form.current = 1
  442. this.form.status = item.dictKey
  443. this.mask = false
  444. this.dataList = []
  445. this.query()
  446. },
  447. confirm(e) {
  448. if (this.screen[0] == "corpId") {
  449. this.form = {
  450. current: 1,
  451. size: 20,
  452. corpId: e.value[0].id
  453. }
  454. this.dataList = []
  455. this.query()
  456. this.show = false
  457. this.mask = false
  458. } else if (this.screen[1] == "salesName") {
  459. this.form = {
  460. current: 1,
  461. size: 20,
  462. salesName: e.value[0].id
  463. }
  464. this.dataList = []
  465. this.query()
  466. this.show = false
  467. this.mask = false
  468. } else {
  469. this.formTwo.account = e.value[0].dictValue
  470. this.show = false
  471. this.mask = false
  472. }
  473. },
  474. //确认日期
  475. confirmCalendar(e) {
  476. this.form = {
  477. current: 1,
  478. size: 20,
  479. orderStartDate: e.range.before + ' 00:00:00',
  480. orderEndDate: e.range.after + ' 23:59:59'
  481. }
  482. this.dataList = []
  483. this.query()
  484. },
  485. }
  486. }
  487. </script>
  488. <style scoped>
  489. .contentBox {
  490. width: 96%;
  491. margin: 20rpx auto;
  492. background-color: #FFFFFF;
  493. border-radius: 20rpx;
  494. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  495. padding-top: 15rpx;
  496. padding-bottom: 10rpx;
  497. }
  498. .textBox {
  499. padding: 0 15px;
  500. display: flex;
  501. justify-content: space-between;
  502. font-size: 24rpx;
  503. margin-bottom: 10rpx;
  504. align-items: flex-end;
  505. }
  506. .dropdown {
  507. position: absolute;
  508. z-index: 9;
  509. background: rgba(0, 0, 0, .3);
  510. width: 100%;
  511. left: 0;
  512. top: calc(var(--status-bar-height) + 90px);
  513. bottom: 0;
  514. }
  515. .tl-show {
  516. overflow: hidden;
  517. position: fixed;
  518. height: 100%;
  519. width: 100%;
  520. }
  521. /* 长度过长截取 */
  522. .widthdian {
  523. width: 100%;
  524. overflow: hidden;
  525. white-space: nowrap;
  526. text-overflow: ellipsis;
  527. }
  528. </style>