bill.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class="content flex flex_column">
  3. <view class="header">
  4. <view class="headerList u-flex">
  5. <view class="list_l">
  6. <u-icon name="account" color="#00aaff" size="32"></u-icon>
  7. <text>客户名称</text>
  8. </view>
  9. <view class="list_r u-flex">
  10. <u-input v-model="customerObj.customerName" @click="jumpPage('/pages/sales/chooseCustomerBill')" disabled placeholder="请选择客户名称" />
  11. <u-icon name="arrow-right" color="#999" size="30"></u-icon>
  12. </view>
  13. </view>
  14. <view class="headerList u-flex">
  15. <view class="list_l">
  16. <u-icon name="clock" color="#00aaff" size="32"></u-icon>
  17. <text>对账周期</text>
  18. <u-icon name="question-circle-fill" @click="tipShow = true" :color="wordColor" size="32"></u-icon>
  19. </view>
  20. <view class="list_r u-flex">
  21. <u-input v-model="cycleName" @click="showSearch = true" disabled placeholder="请选择对账日期" />
  22. <u-icon name="arrow-right" color="#999" size="30"></u-icon>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="statistical u-flex">
  27. <view class="statisticalList">
  28. <text>总单数:</text>
  29. <text>{{bill.length}}</text>
  30. </view>
  31. <view class="statisticalList">
  32. <text>待收金额合计:</text>
  33. <text>¥{{totalPayPrice}}</text>
  34. </view>
  35. </view>
  36. <view class="chooseCon"><billList ref="bill" :showCheck="true" :list="bill"></billList></view>
  37. <view class="footer u-flex">
  38. <view class="f-left">
  39. <u-checkbox @change="allCheckeChange" v-model="allChecked" shape="circle">{{ allChecked ? '取消全选' : '全选' }}</u-checkbox>
  40. </view>
  41. <view class="f-mid" @click="isDetailShow = !isDetailShow">
  42. <view>
  43. 待收:
  44. <text>¥{{chooseTotalPayPrice}}</text>
  45. </view>
  46. <view>
  47. 折后:
  48. <text>¥{{settlement}}</text>
  49. </view>
  50. <view class="u-flex">
  51. <view>
  52. 折让:
  53. <text>¥{{discountVal || 0}}</text>
  54. </view>
  55. <view class="costBtn" @click="costShow = true">打折</view>
  56. </view>
  57. </view>
  58. <view class="f-btns">
  59. <u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none">发送对账单</u-button>
  60. </view>
  61. </view>
  62. <!-- 对账周期弹窗 -->
  63. <u-popup v-model="showSearch" mode="right" width="70%">
  64. <view class="tabBox">
  65. <view class="tabs">
  66. <view class="flex">
  67. <view :class="item.val == curTab ? 'active' : 'all'" v-for="item in placeTab" :key="item.val" @click="tabChange(item)">{{ item.name }}</view>
  68. </view>
  69. </view>
  70. <view class="flex align_center form-item-inp" style="padding: 0 30rpx;" v-if="curTab == 6">
  71. <u-input clearable v-model="dateArray" disabled placeholder="请选择时间段" input-align="center" @click="showDate = true" />
  72. </view>
  73. <view class="form-footer-btn">
  74. <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClean">重置</u-button>
  75. <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
  76. </view>
  77. </view>
  78. </u-popup>
  79. <!-- 选择日期范围 -->
  80. <u-calendar v-model="showDate" ref="rangeDate" @change="dateChange" mode="range"></u-calendar>
  81. <!-- 打折弹窗 -->
  82. <u-popup v-model="costShow" mode="center" :border-radius="20" closeable width="82%">
  83. <view class="costPopup">
  84. <view class="costPopupTit">东莞市京步车证汽车服务中心</view>
  85. <view class="costPopupCon">
  86. <view class="costList">
  87. <text class="label">待收金额:</text>
  88. <text>¥{{totalPayPrice}}</text>
  89. </view>
  90. <view class="costList u-flex">
  91. <view class="label">折让金额:</view>
  92. <u-input v-model="discountVal" @input="onKeyInput" :border="true" :height="50"/>
  93. </view>
  94. <view class="tip" v-if="discountVal>totalPayPrice">折让金额不能大于待收金额,请重新输入</view>
  95. <view class="costText">折让后金额</view>
  96. <view class="costText">¥{{settlement}}</view>
  97. </view>
  98. <u-button type="primary" :custom-style="customStyle" shape="circle" @click="handleDisCount">确定</u-button>
  99. </view>
  100. </u-popup>
  101. <!-- 对账周期弹窗 -->
  102. <u-modal v-model="tipShow" :show-title="false" :content="tipContent" confirm-text="知道了"></u-modal>
  103. </view>
  104. </template>
  105. <script>
  106. import billList from './billListComponent.vue';
  107. import { queryUnsettleSaleList,insert } from '@/api/verify.js';
  108. import getDate from '@/libs/getDate.js';
  109. export default {
  110. components: { billList },
  111. data() {
  112. return {
  113. customBtnStyle: {
  114. // 自定义按钮样式
  115. borderColor: this.$config('primaryColor'),
  116. backgroundColor: this.$config('primaryColor'),
  117. color: '#fff',
  118. width: '180rpx'
  119. },
  120. wordColor: this.$config('infoColor'),
  121. customStyle: {
  122. borderColor: this.$config('primaryColor'),
  123. backgroundColor: this.$config('primaryColor'),
  124. color: '#fff'
  125. },
  126. allChecked: false,
  127. tipShow: false,
  128. discountVal: null,//折让金额
  129. tipContent: `账单周期指销售单的创建时间`,
  130. placeTab: [
  131. {
  132. name: '今日',
  133. val: '0'
  134. },
  135. {
  136. name: '昨日',
  137. val: '1'
  138. },
  139. {
  140. name: '本周',
  141. val: '2'
  142. },
  143. {
  144. name: '上周',
  145. val: '3'
  146. },
  147. {
  148. name: '本月',
  149. val: '4'
  150. },
  151. {
  152. name: '上月',
  153. val: '5'
  154. },
  155. {
  156. name: '自定义',
  157. val: '6'
  158. },
  159. {
  160. name: '全部',
  161. val: '7'
  162. }
  163. ],
  164. curTab: '0',
  165. showSearch: false,
  166. showDate: false,
  167. costShow: false,
  168. customerObj: {
  169. customerName: null
  170. },
  171. cycleName: '',
  172. params: {
  173. targetSn: '437705264826884096',
  174. bizBeginDate: undefined,
  175. bizEndDate: undefined
  176. },
  177. bill: [],
  178. dateArray:''
  179. };
  180. },
  181. onReady() {
  182. uni.setNavigationBarColor({
  183. frontColor: '#ffffff',
  184. backgroundColor: this.$config('primaryColor')
  185. });
  186. },
  187. onLoad(options) {
  188. //获取对账周期默认值
  189. let systemList = this.$store.state.vuex_systemSetList;
  190. let cycleObj = systemList.find(item => {
  191. return item.remarks == 'sales_bill_period';
  192. });
  193. this.curTab = this.placeTab.findIndex(con => con.name == cycleObj.valueShow);
  194. this.cycleName = this.changeShowTime();
  195. // 获取选择客户
  196. if (options && options.data) {
  197. this.customerObj = JSON.parse(options.data);
  198. // this.params.targetSn = this.customerObj.customerSn;
  199. }
  200. this.changeTime();
  201. },
  202. onNavigationBarButtonTap() {
  203. uni.navigateTo({
  204. url: '/pages/sales/billHistory'
  205. });
  206. },
  207. onBackPress() {
  208. if (this.showSearch) {
  209. this.showSearch = false;
  210. return true;
  211. }
  212. },
  213. computed: {
  214. totalPayPrice() {
  215. let totalPrice = 0;
  216. for (let i = 0; i < this.bill.length; i++) {
  217. this.bill[i].unsettleAmount = this.bill[i].unsettleAmount ? this.bill[i].unsettleAmount :0
  218. totalPrice += this.bill[i].unsettleAmount;
  219. }
  220. return totalPrice || 0;
  221. },
  222. // settlement(){
  223. // return this.totalPayPrice - this.discountVal || 0;
  224. // }
  225. },
  226. methods: {
  227. changeTime() {
  228. if (this.curTab != 6 && this.curTab != 7) {
  229. this.params.bizBeginDate = this.getQueryDate().beginDate;
  230. this.params.bizEndDate = this.getQueryDate().endDate;
  231. this.cycleName = this.changeShowTime();
  232. }else if(this.curTab == 7){
  233. this.cycleName = this.placeTab[this.curTab].name;
  234. this.params.bizBeginDate = undefined;
  235. this.params.bizEndDate = undefined;
  236. }else{
  237. this.dateArray = ''
  238. }
  239. this.getList();
  240. },
  241. getList() {
  242. const _this = this;
  243. queryUnsettleSaleList(this.params).then(res => {
  244. if (res.status == 200) {
  245. this.bill = res.data;
  246. this.$refs.bill.setData(res.data);
  247. }
  248. });
  249. },
  250. // 时间 change
  251. dateChange(date) {
  252. this.dateArray = date.startDate + ' ~ ' + date.endDate;
  253. this.params.bizBeginDate = date.startDate + ' 00:00:00';
  254. this.params.bizEndDate = date.endDate + ' 23:59:59';
  255. this.cycleName=date.startDate + '至' + date.endDate;
  256. },
  257. // 更改日期格式显示
  258. changeShowTime(){
  259. const fun = [getDate.getTodayInfo, getDate.getYesterdayInfo, getDate.getCurrWeekDaysInfo, getDate.getLastWeekDaysInfo, getDate.getCurrLastMonthDaysInfo, getDate.getLastMonthDaysInfo];
  260. return fun[this.curTab]();
  261. },
  262. tabChange(data) {
  263. this.curTab = data.val;
  264. },
  265. getQueryDate() {
  266. const fun = [getDate.getToday, getDate.getYesterday, getDate.getCurrWeekDays, getDate.getLastWeekDays, getDate.getCurrLastMonthDays, getDate.getLastMonthDays];
  267. return {
  268. beginDate: fun[this.curTab]().starttime,
  269. endDate: fun[this.curTab]().endtime
  270. };
  271. },
  272. handleSearch() {
  273. this.showSearch = false;
  274. this.changeTime();
  275. },
  276. jumpPage(url) {
  277. uni.navigateTo({
  278. url
  279. });
  280. },
  281. handleDisCount(){
  282. this.costShow = false
  283. },
  284. submitOrder(){//发送对账单
  285. },
  286. allCheckeChange(){
  287. this.$refs.bill.allSelect(e.value)
  288. const list = this.$refs.bill.getAllData()
  289. }
  290. }
  291. };
  292. </script>
  293. <style lang="scss" scoped>
  294. .content {
  295. width: 100%;
  296. height: 100vh;
  297. .header {
  298. width: 100%;
  299. .headerList {
  300. width: 100%;
  301. box-sizing: border-box;
  302. padding: 16rpx 20rpx;
  303. background: #fff;
  304. &:last-child {
  305. border-top: 1rpx solid #e4e7ed;
  306. }
  307. .list_l {
  308. width: 208rpx;
  309. text {
  310. font-size: 28rpx;
  311. color: #666666;
  312. margin-left: 10rpx;
  313. margin-right: 10rpx;
  314. }
  315. }
  316. .list_r {
  317. width: calc(100% - 208rpx);
  318. }
  319. }
  320. }
  321. .statistical {
  322. padding: 20rpx;
  323. background: #fff;
  324. margin: 10rpx 0;
  325. .statisticalList {
  326. &:first-child {
  327. width: 210rpx;
  328. }
  329. }
  330. text {
  331. &:last-child {
  332. color: $uni-color-warning;
  333. font-weight: 600;
  334. }
  335. }
  336. }
  337. .chooseCon {
  338. flex-grow: 1;
  339. overflow: auto;
  340. background-color: #fff;
  341. }
  342. .footer {
  343. background-color: #f8f8f8;
  344. padding:10rpx 20rpx;
  345. .f-mid {
  346. flex-grow: 1;
  347. color: #666;
  348. font-size: 0.8rem;
  349. > view {
  350. &:first-child {
  351. text {
  352. color: $uni-color-warning;
  353. vertical-align: middle;
  354. }
  355. }
  356. &:last-child {
  357. text {
  358. color: $uni-color-primary;
  359. vertical-align: middle;
  360. }
  361. }
  362. }
  363. .costBtn {
  364. width: 70rpx;
  365. height: 40rpx;
  366. line-height: 40rpx;
  367. text-align: center;
  368. color: #fff;
  369. font-size: 20rpx;
  370. border-radius: 30rpx;
  371. background: #999;
  372. margin-left: 20rpx;
  373. }
  374. }
  375. }
  376. // 历史对账单弹窗
  377. .tabBox {
  378. height: 100vh;
  379. .tabs {
  380. flex-grow: 1;
  381. overflow: auto;
  382. padding: 20rpx;
  383. > view {
  384. flex-wrap: wrap;
  385. justify-content: space-between;
  386. > view {
  387. width: 45%;
  388. border: 1rpx solid #eee;
  389. padding: 15rpx;
  390. border-radius: 50rpx;
  391. text-align: center;
  392. margin-bottom: 15rpx;
  393. }
  394. .active {
  395. border: 0;
  396. background-color: #0485f6;
  397. color: #fff;
  398. }
  399. }
  400. }
  401. .form-item-inp {
  402. border-bottom: 1rpx solid #eee;
  403. }
  404. .form-footer-btn {
  405. margin: 30upx;
  406. display: flex;
  407. justify-content: space-between;
  408. }
  409. .form-footer-btn {
  410. display: flex;
  411. .handle-btn {
  412. font-size: 28upx;
  413. margin: 0 10upx;
  414. flex: 1;
  415. }
  416. }
  417. }
  418. //打折弹窗
  419. .costPopup {
  420. padding: 26rpx 20rpx 40rpx;
  421. box-sizing: border-box;
  422. .costPopupTit {
  423. text-align: center;
  424. font-weight: bold;
  425. }
  426. .costPopupCon {
  427. margin-top: 40rpx;
  428. .costList {
  429. margin-bottom: 20rpx;
  430. .label {
  431. color: $uni-text-color-grey;
  432. }
  433. }
  434. .tip{
  435. color: $uni-color-error;
  436. font-size: 20rpx;
  437. text-align: right;
  438. }
  439. .costText {
  440. text-align: center;
  441. color: $uni-text-color-grey;
  442. font-size: 22rpx;
  443. margin-top: 40rpx;
  444. &:last-child {
  445. font-weight: bold;
  446. color: $uni-color-error;
  447. font-size: 32rpx;
  448. line-height: 60rpx;
  449. margin-top: 0rpx;
  450. margin-bottom: 50rpx;
  451. }
  452. }
  453. }
  454. }
  455. }
  456. </style>