collate.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view class="main">
  3. <u-sticky bgColor="#fff">
  4. <view class="search-wrap">
  5. <view class="input-wrap">
  6. <view @click="showPopup('popupTenantId')" class="input">
  7. <u--input prefixIcon="account-fill" readonly prefixIconStyle="font-size:46rpx" border="none"
  8. v-model="condition.tenantName" :showAction='false'></u--input>
  9. </view>
  10. <view @click="onClickRight" class="sx-btn">
  11. <uni-icons type="settings-filled" size='24'></uni-icons>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="tabs-box">
  16. <view class="orderType-tab">
  17. <u-subsection :list="collateTabList" mode="subsection" fontSize="30rpx"
  18. activeColor="rgb(60, 156, 255)" :current="collateActive" @change="onCollateTabChange">
  19. </u-subsection>
  20. </view>
  21. <view class="orderStatus-tab" v-if="collateActive ==1">
  22. <span :class="condition.auditFlag == item.value?'active':''" v-for="item in auditList"
  23. @click="onAuditChange(item)" :key="item.name">
  24. {{item.name}}
  25. </span>
  26. </view>
  27. <view v-if="collateActive==0">
  28. <u-notice-bar :text="$t('payment.collate.warning')" speed="30" duration="3000"></u-notice-bar>
  29. </view>
  30. </view>
  31. </u-sticky>
  32. <view v-if="collateActive==0">
  33. <template v-if="collateData.length">
  34. <view>
  35. <view class="main" v-for="(item,index) in collateData" :key="index">
  36. <view class="main-title">
  37. <view class="row">
  38. <view class="info">
  39. <text class="info big">{{item.companyName}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="main-info">
  44. <view class="row">
  45. <p class="cell">
  46. <text class="label">{{$t('payment.collate.preTotal')}}</text>
  47. <text class="info">{{item.preTotal}}</text>
  48. </p>
  49. <p class="cell">
  50. <text class="label">{{$t('payment.collate.receiptTotal')}}</text>
  51. <text class="info">{{item.receiptTotal}}</text>
  52. </p>
  53. </view>
  54. <view class="row">
  55. <p class="cell">
  56. <text class="label">{{$t('payment.collate.factNum')}}</text>
  57. <text class="info">{{item.factNum}}</text>
  58. </p>
  59. <p class="cell">
  60. <text class="label">{{$t('payment.collate.factTotal')}}</text>
  61. <text class="info">{{item.factTotal}}</text>
  62. </p>
  63. </view>
  64. <view class="row">
  65. <p class="cell">
  66. <text class="label">{{$t('payment.collate.endTotal')}}</text>
  67. <text class="info">{{item.endTotal}}</text>
  68. </p>
  69. </view>
  70. <view class="row">
  71. <p class="cell">
  72. <text class="label">{{$t('payment.collate.remark')}}</text>
  73. <u-input
  74. :placeholder="$t('base.common.placeholderI') + $t('payment.collate.remark')"
  75. border='none' v-model="item.remark" type="textarea" class="info">
  76. </u-input>
  77. </p>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="bottom">
  82. <view class="btn">
  83. <u-button type="success" size="small" @click="save"> {{$t('base.button.submit')}}
  84. </u-button>
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <template v-else>
  90. <u-empty mode="history" text="." icon="https://cdn.uviewui.com/uview/empty/list.png">
  91. <u-icon name="edit-pen" color="#2979ff" size="28" :label="$t('payment.collate.createCollate')"
  92. @click="showSearch=true"></u-icon>
  93. </u-empty>
  94. </template>
  95. </view>
  96. <view v-if="collateActive==1">
  97. <template v-if="collateData.length">
  98. <view class="main" v-for="(item,index) in collateData" :key="index" @click="onDetailShow(item)">
  99. <view class="main-title">
  100. <view class="info">
  101. <u--text prefixIcon="account-fill" :text="item.companyName" :bold="true" size="12">
  102. </u--text>
  103. </view>
  104. <view class="info">
  105. <u-tag :text="(item.auditFlag=='' || item.auditFlag==0)?'未审核':item.auditFlag==1?'已审核':'未通过'"
  106. shape="circle"
  107. :type="(item.auditFlag=='' || item.auditFlag==0)?'warning':item.auditFlag==1?'success':'error'">
  108. </u-tag>
  109. </view>
  110. </view>
  111. <view class="main-info">
  112. <view class="row">
  113. <p class="cell">
  114. <text class="label">{{$t('payment.collate.intervalDate')}}</text>
  115. <text class="info">{{item.startDate}}</text>
  116. </p>
  117. <p class="cell">
  118. <text class="info">{{item.endDate}}</text>
  119. </p>
  120. </view>
  121. <view class="row">
  122. <p class="cell">
  123. <text class="label">{{$t('payment.collate.remark')}}</text>
  124. <text class="info">{{item.remark}}</text>
  125. </p>
  126. </view>
  127. </view>
  128. <view class="main-bottom" v-if="(item.auditFlag !='' && item.auditFlag !=0)">
  129. <view class="row">
  130. <p class="cell">
  131. <text class="label">{{$t('payment.collate.auditDescription')}}</text>
  132. <text
  133. :class="'info '+(item.auditFlag==1?'underline-success':'underline-error')">{{item.auditDescription}}</text>
  134. </p>
  135. </view>
  136. <view class="row">
  137. <text class="font-align">{{(item.auditUserName ||'')+' ' +(item.auditTime || '')}}</text>
  138. </view>
  139. </view>
  140. </view>
  141. </template>
  142. <template v-else>
  143. <u-empty mode="history" text="没有账单信息" icon="https://cdn.uviewui.com/uview/empty/list.png">
  144. </u-empty>
  145. </template>
  146. </view>
  147. <!-- 选择企业 -->
  148. <PopupSelect ref="popupTenantId" :hasSearch='false' :option="tenantOption" @onConfirm="onTenantConfirm" />
  149. <u-popup :show="showSearch" :round="8" @close="showSearch=false" mode="bottom">
  150. <view class="search-dialog">
  151. <p class="dialog-title">对账条件</p>
  152. <view class="condition-wrap">
  153. <view class="row">
  154. <uni-datetime-picker :end='maxDate' :clear-icon="false" class="p-input" :value="range"
  155. type="daterange" @change="confirm" />
  156. </view>
  157. <view class="row">
  158. <p class="p-title">{{$t('order.vehicleType')}}</p>
  159. <u-radio-group v-model="condition.vehicleType" @change="onVehicleTypeChange" placement="row"
  160. class="p-input">
  161. <u-radio :customStyle="{marginRight: '20rpx'}" v-for="item in vehicleTypeOption"
  162. :key="item.value" :label="item.text" :name="item.value">
  163. </u-radio>
  164. </u-radio-group>
  165. </view>
  166. <view class="row" borderBottom prop="companyId" @click="showPopup('popupCompanyId')">
  167. <p class="p-title">{{$t('base.basics.companyName')}}</p>
  168. <u-input readonly v-model="condition.companyName" border="none" class="p-input"
  169. :placeholder="$t('base.common.placeholderS')+$t('base.basics.companyName')" />
  170. </view>
  171. <!-- <view class="row" @click="showPopup('popupMaterialId')">
  172. <p class="p-title">{{$t('base.basics.materialName')}}</p>
  173. <u-input readonly v-model="condition.materialName" border="none"
  174. :placeholder="$t('base.common.placeholderS')+$t('base.basics.materialName')" />
  175. </view> -->
  176. </view>
  177. <view class="sure-btn">
  178. <button class="btn" type='primary' shape="circle" color='#4680F9' size="small"
  179. @click="onCollateQueryClick">
  180. {{$t('base.button.query')}}
  181. </button>
  182. </view>
  183. </view>
  184. <!-- 选择供应商/客户 -->
  185. <PopupSelect ref="popupCompanyId" :hasSearch='false' :option="companyOption"
  186. @onConfirm="onCompanyIdConfirm" />
  187. </u-popup>
  188. <u-popup :show="showDetail" :round="8" @close="showDetail=false" mode="center"
  189. customStyle="width:95%;height:auto;">
  190. <view>
  191. <u-divider :text="$t('payment.collate.collateInfo')" textSize="16" lineColor="#303133"
  192. textColor="#303133"></u-divider>
  193. </view>
  194. <view class="main">
  195. <view class="main-title">
  196. <view class="info">
  197. <u--text prefixIcon="account-fill" :text="currentCollate.companyName" :bold="true" size="12">
  198. </u--text>
  199. </view>
  200. <view class="info">
  201. <u-tag
  202. :text="(currentCollate.auditFlag=='' || currentCollate.auditFlag==0)?'未审核':currentCollate.auditFlag==1?'已审核':'未通过'"
  203. shape="circle"
  204. :type="(currentCollate.auditFlag=='' || currentCollate.auditFlag==0)?'warning':currentCollate.auditFlag==1?'success':'error'">
  205. </u-tag>
  206. </view>
  207. </view>
  208. <view class="main-info">
  209. <view class="row">
  210. <p class="cell">
  211. <text class="label">{{$t('payment.collate.intervalDate')}}</text>
  212. <text class="info">{{currentCollate.startDate}}</text>
  213. </p>
  214. <p class="cell">
  215. <text class="info">{{currentCollate.endDate}}</text>
  216. </p>
  217. </view>
  218. <view class="row">
  219. <p class="cell">
  220. <text class="label">{{$t('payment.collate.preTotal')}}</text>
  221. <text class="info">{{currentCollate.preTotal}}</text>
  222. </p>
  223. <p class="cell">
  224. <text class="label">{{$t('payment.collate.receiptTotal')}}</text>
  225. <text class="info">{{currentCollate.receiptTotal}}</text>
  226. </p>
  227. </view>
  228. <view class="row">
  229. <p class="cell">
  230. <text class="label">{{$t('payment.collate.factNum')}}</text>
  231. <text class="info">{{currentCollate.factNum}}</text>
  232. </p>
  233. <p class="cell">
  234. <text class="label">{{$t('payment.collate.factTotal')}}</text>
  235. <text class="info">{{currentCollate.factTotal}}</text>
  236. </p>
  237. </view>
  238. <view class="row">
  239. <p class="cell">
  240. <text class="label">{{$t('payment.collate.endTotal')}}</text>
  241. <text class="info">{{currentCollate.endTotal}}</text>
  242. </p>
  243. </view>
  244. <view class="row">
  245. <p class="cell">
  246. <text class="label">{{$t('payment.collate.remark')}}</text>
  247. <text class="info">{{currentCollate.remark}}</text>
  248. </p>
  249. </view>
  250. </view>
  251. <view class="main-bottom" v-if="(currentCollate.auditFlag !='' && currentCollate.auditFlag !=0)">
  252. <view class="row">
  253. <p class="cell">
  254. <text class="label">{{$t('payment.collate.auditDescription')}}</text>
  255. <text
  256. :class="'info '+(currentCollate.auditFlag==1?'underline-success':'underline-error')">{{currentCollate.auditDescription}}</text>
  257. </p>
  258. </view>
  259. <view class="row">
  260. <text
  261. class="font-align">{{(currentCollate.auditUserName ||'')+' ' +(currentCollate.auditTime || '')}}</text>
  262. </view>
  263. </view>
  264. </view>
  265. </u-popup>
  266. </view>
  267. </template>
  268. <script>
  269. import PopupSelect from '../../components/popup-select/index'
  270. import dayjs from 'dayjs'
  271. import {
  272. getReconcile,
  273. saveReconcile,
  274. queryReconcile
  275. } from '../../api/payment'
  276. import {
  277. getOption
  278. } from '../../api/order'
  279. import {
  280. getTenantCacheList
  281. } from '../../utils/util.js'
  282. export default {
  283. components: {
  284. PopupSelect
  285. },
  286. data() {
  287. return {
  288. showSearch: false,
  289. showDetail: false,
  290. currentCollate: {},
  291. maxDate: dayjs().format('YYYY-MM-DD'),
  292. range: [dayjs().add(-30, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  293. isSellComapny: false,
  294. condition: {
  295. setDate: dayjs().format('YYYY-MM-DD'),
  296. startDate: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
  297. endDate: dayjs().format('YYYY-MM-DD'),
  298. tenantId: "",
  299. tenantName: "",
  300. companyId: "", //客商
  301. companyName: "",
  302. auditFlag: "",
  303. // materialId: "", //物料
  304. // materialName: "",
  305. vehicleType: "101", //只针对客户
  306. },
  307. collateActive: 0,
  308. collateTabList: [{
  309. name: this.$t('payment.collate.createCollate')
  310. }, {
  311. name: this.$t('payment.collate.historyCollate')
  312. }],
  313. auditList: [{
  314. name: this.$t("mine.all"),
  315. value: ''
  316. },
  317. {
  318. name: this.$t("mine.noneAudit"),
  319. value: '0'
  320. },
  321. {
  322. name: this.$t("mine.nonePass"),
  323. value: '2'
  324. },
  325. {
  326. name: this.$t("mine.alreadyAudit"),
  327. value: '1'
  328. },
  329. ],
  330. tenantOption: [{
  331. text: this.$t('base.common.noData'),
  332. value: null
  333. }], //企业选项
  334. vehicleTypeOption: [{
  335. text: this.$t('base.common.noData'),
  336. value: null
  337. }, ],
  338. companyOption: [{
  339. text: this.$t('base.common.noData'),
  340. value: null
  341. }], //客户选项
  342. // materialOption: [{
  343. // text: this.$t('base.common.noData'),
  344. // value: null
  345. // }], //物料选项
  346. collateData: null,
  347. remark: "", //业务对应的客户信息
  348. //业务对应的客户信息
  349. vehicleTypeCompanyList: [],
  350. //客户对应的物料信息
  351. companyMaterialList: [],
  352. };
  353. },
  354. onLoad(options) {
  355. this.bindTenant()
  356. },
  357. methods: {
  358. onDetailShow(item) {
  359. this.currentCollate = item;
  360. this.showDetail = true
  361. },
  362. onAuditChange(item) {
  363. if (item.value == this.condition.auditFlag) {
  364. this.condition.auditFlag = "";
  365. } else {
  366. this.condition.auditFlag = item.value
  367. }
  368. this.onCollateQueryClick()
  369. },
  370. //点击右侧筛选
  371. onClickRight() {
  372. this.showSearch = true
  373. },
  374. //确定选择日期
  375. confirm(item) {
  376. this.range = item
  377. this.condition.startDate = this.range[0] || ''
  378. this.condition.endDate = this.range[1] || ''
  379. },
  380. onTimeChange() {
  381. this.collateData = []
  382. },
  383. onCollateTabChange(index) {
  384. this.range = [dayjs().add(-30, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  385. this.condition.startDate = this.range[0] || ''
  386. this.condition.endDate = this.range[1] || ''
  387. this.collateActive = index;
  388. this.collateData = [];
  389. if (index == 1) {
  390. this.onCollateQueryClick()
  391. }
  392. },
  393. //查询对账
  394. onCollateQueryClick() {
  395. this.showSearch = false
  396. let data = {
  397. tenantId: this.condition.tenantId,
  398. companyId: this.condition.companyId,
  399. startDate: this.condition.startDate,
  400. endDate: this.condition.endDate,
  401. auditFlag: this.condition.auditFlag,
  402. // materialId: this.condition.materialId,
  403. vehicleType: this.condition.vehicleType,
  404. }
  405. if (this.collateActive == 0) {
  406. this.collateData=[]
  407. getReconcile(data).then(res => {
  408. if (res.data.code == 0) {
  409. if (res.data.data) {
  410. this.collateData = res.data.data
  411. console.log("获取到的对账信息、", this.collateData);
  412. }
  413. }
  414. })
  415. } else {
  416. queryReconcile(data).then(res => {
  417. if (res.data.code == 0) {
  418. if (res.data.data) {
  419. this.collateData = res.data.data
  420. console.log("获取到的对账信息、", this.collateData);
  421. }
  422. }
  423. })
  424. }
  425. },
  426. //确认对账
  427. save() {
  428. let _this = this
  429. uni.showModal({
  430. content: '确认对账信息无误!',
  431. showCancel: true,
  432. success: function(res) {
  433. if (res.confirm) {
  434. let data = {
  435. ..._this.condition,
  436. "orderInfos": _this.collateData
  437. }
  438. data.remark = _this.remark
  439. saveReconcile(data).then(res => {
  440. if (res.statusCode == 200 && res.data.code == 0) {
  441. uni.showToast({
  442. title: '对账成功',
  443. icon: 'success',
  444. duration: 2000,
  445. })
  446. _this.collateData = []
  447. }
  448. })
  449. } else if (res.cancel) {
  450. }
  451. }
  452. })
  453. },
  454. bindTenant() {
  455. this.tenantOption = getTenantCacheList();
  456. if (this.tenantOption.length > 0) {
  457. this.condition.tenantId = this.tenantOption[0].value
  458. this.condition.tenantName = this.tenantOption[0].text
  459. }
  460. this.bindOption();
  461. },
  462. //选择订单类型后加载选项 //获取品种信息 101:销售,102:采购
  463. bindOption() {
  464. this.clear();
  465. this.vehicleTypeOption = []
  466. console.log("订单租户信息、", this.condition.tenantId);
  467. if (!this.condition.tenantId) {
  468. console.log("订单业务租户信息");
  469. return;
  470. }
  471. var that = this;
  472. console.log("当前租户ID、", that.condition.tenantId);
  473. if (that.condition.tenantId) {
  474. let data = JSON.parse(JSON.stringify(that.condition))
  475. getOption(data).then(res => {
  476. console.log("查询基础数据返回、", res);
  477. if (res.statusCode === 200) {
  478. that.vehicleTypeOption = res.data.data.appVehicleType;
  479. console.log("用户客户信息、", res.data.data.appCompany)
  480. // console.log("用户品种信息、", res.data.data.appMaterial)
  481. that.vehicleTypeCompanyList = res.data.data.appCompany
  482. that.bindCompany();
  483. // that.companyMaterialList = res.data.data.appMaterial;
  484. // that.bindMaterial();
  485. }
  486. })
  487. }
  488. },
  489. bindCompany() {
  490. var vehicleType = this.condition.vehicleType;
  491. if (vehicleType && this.vehicleTypeCompanyList) {
  492. this.companyOption = [{
  493. text: this.$t('order.notSelected'),
  494. value: null
  495. }] //物料选项
  496. var companyInfos = this.vehicleTypeCompanyList.filter(function(company) {
  497. return company.vehicleType == vehicleType;
  498. });
  499. if (companyInfos && companyInfos.length > 0) {
  500. companyInfos[0].companyList.forEach(item => {
  501. this.companyOption.push({
  502. text: item.companyName,
  503. value: item.companyId
  504. })
  505. })
  506. this.condition.companyId = this.companyOption[1].value
  507. this.condition.companyName = this.companyOption[1].text
  508. }
  509. console.log("客户信息、", this.companyOption);
  510. }
  511. },
  512. // bindMaterial() {
  513. // var companyId = this.condition.companyId;
  514. // if (companyId && this.companyMaterialList) {
  515. // this.materialOption = [{
  516. // text: this.$t('order.notSelected'),
  517. // value: null
  518. // }] //物料选项
  519. // var materialInfos = this.companyMaterialList.filter(function(company) {
  520. // return company.companyId == companyId;
  521. // });
  522. // if (materialInfos && materialInfos.length > 0) {
  523. // materialInfos[0].materialList.forEach(item => {
  524. // this.materialOption.push({
  525. // text: item.name,
  526. // value: item.id
  527. // })
  528. // })
  529. // }
  530. // console.log("品种信息、", this.materialOption);
  531. // }
  532. // },
  533. //选择企业后
  534. onTenantConfirm(value) {
  535. this.condition.tenantId = ''
  536. this.condition.tenantName = ''
  537. if (value.value) {
  538. this.condition.tenantId = value.value
  539. this.condition.tenantName = value.text
  540. }
  541. this.bindOption();
  542. },
  543. //选择企业和订单类型后
  544. onVehicleTypeChange() {
  545. this.clear();
  546. if (this.condition.tenantId && this.condition.vehicleType) {
  547. console.log('开始根据业务类型选择数据信息,租户和业务为、', this.condition.tenantId, this.condition.vehicleType);
  548. this.bindCompany();
  549. // this.bindMaterial();
  550. }
  551. },
  552. //选择客户
  553. onCompanyIdConfirm(value) {
  554. this.condition.companyId = ''
  555. this.condition.companyName = ''
  556. if (value.value) {
  557. this.condition.companyId = value.value
  558. this.condition.companyName = value.text
  559. }
  560. this.collateData = [];
  561. },
  562. //选择物料
  563. // onMaterialIdConfirm(value) {
  564. // this.condition.materialId = ''
  565. // this.condition.materialName = ''
  566. // if (value.value) {
  567. // this.condition.materialId = value.value
  568. // this.condition.materialName = value.text
  569. // }
  570. // this.collateData = [];
  571. // },
  572. //显示选择
  573. showPopup(refs) {
  574. this.$refs[refs].showPicker = true
  575. },
  576. clear() {
  577. this.companyOption = [{
  578. text: this.$t('base.common.noData'),
  579. value: null
  580. }] //客户选项
  581. // this.materialOption = [{
  582. // text: this.$t('base.common.noData'),
  583. // value: null
  584. // }] //物料选项
  585. this.collateData = []
  586. this.condition.companyId = ''
  587. // this.condition.materialId = ''
  588. this.condition.companyName = ''
  589. // this.condition.materialName = ''
  590. },
  591. },
  592. };
  593. </script>
  594. <style>
  595. page {
  596. background-color: #f5f7fa;
  597. }
  598. </style>
  599. <style lang="scss" scoped>
  600. @import '../../common/css/public.scss';
  601. /deep/ .uni-date-x {
  602. padding: 0;
  603. }
  604. </style>