debtList.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="app-content">
  3. <view class="order-page">
  4. <view class="top-view">
  5. <view class="top-row">
  6. <view class="info-item">
  7. <image class="logo" :src="customInfo.smallAvatar"/>
  8. <text class="name">{{ customInfo.name || "" }}</text>
  9. </view>
  10. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='时间' />
  11. </view>
  12. </view>
  13. <view class="shop-list">
  14. <block v-if="!$util.isEmpty(detailsList)">
  15. <DebtItem v-for="(item, index) in detailsList" :key="index" :info="item" :isEdit="true" :isCheck="item.checked" @click="checkItemEvent" ></DebtItem>
  16. </block>
  17. <block v-else>
  18. <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(detailsList)" />
  19. </block>
  20. </view>
  21. <view :class="device == 'ios' ? 'ios-bar-view':'android-bar-view'">
  22. <template>
  23. <view class="info-view">
  24. <view class="details-select" @click="checkFn()" >
  25. <button class="admin-button-com blue big" v-if="isAllCheck">全不选</button>
  26. <button class="admin-button-com blue big" v-else>全选</button>
  27. </view>
  28. 已选 <text class="price">{{ selectList.length }}</text> 笔 <text class="unit">¥</text> <text class="price">{{ parseFloat(selectTotalAmount) }}</text>
  29. </view>
  30. </template>
  31. <view class="btn-view">
  32. <button :class="['admin-button-com', 'blue']" @click="createOrder">创建账单</button>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  40. import DebtItem from "./debtItem";
  41. import { getDebtOrderList,clearOrderApi } from "@/api/order";
  42. import DateSelect from "@/components/module/dateSelect";
  43. import ModalModule from "@/components/plugin/modal";
  44. export default {
  45. components: { AppWrapperEmpty, ModalModule,DebtItem,DateSelect },
  46. data() {
  47. return {
  48. modifyPrice:null,
  49. customInfo: "",
  50. num: "",
  51. detailsList: [],
  52. listLoading: false,
  53. isAllCheck: false,
  54. isModel: false,
  55. payWayindex:0,
  56. payWay:0,
  57. searchTime:'',
  58. startTime:'',
  59. endTime:'',
  60. device:'android'
  61. };
  62. },
  63. onPullDownRefresh() {
  64. this.initData().then(res => {
  65. uni.stopPullDownRefresh();
  66. });
  67. },
  68. onLoad(){
  69. this.initData().then(res => {
  70. uni.stopPullDownRefresh();
  71. });
  72. this.device = uni.getSystemInfoSync().platform
  73. },
  74. computed: {
  75. selectList() {
  76. let list = [];
  77. if (this.detailsList) {
  78. for (const item of this.detailsList) {
  79. if (item.checked) {
  80. list.push(item);
  81. }
  82. }
  83. }
  84. return list;
  85. },
  86. selectTotalAmount() {
  87. let amount = 0;
  88. if (this.detailsList) {
  89. for (const item of this.detailsList) {
  90. if (item.checked) {
  91. amount=amount+Number(item.remainDebtPrice);
  92. }
  93. }
  94. }
  95. this.modifyPrice = amount.toFixed(2);
  96. return amount.toFixed(2);
  97. }
  98. },
  99. watch: {
  100. selectList () {
  101. if (this.selectList.length === this.detailsList.length) {
  102. this.isAllCheck = true
  103. } else {
  104. this.isAllCheck = false
  105. }
  106. }
  107. },
  108. methods: {
  109. createOrder(){
  110. this.$msg('开发中')
  111. return false
  112. let that = this
  113. let price = parseFloat(that.modifyPrice)
  114. that.$util.confirmModal({content:'总金额'+price+'元,确认提交?'},() => {
  115. that.confirmData()
  116. })
  117. },
  118. payWayChange(e){
  119. let index = e.detail.value
  120. this.payWayindex = index
  121. this.payWay = this.payWayList[index].id
  122. },
  123. isModelFun(){
  124. if (this.$util.isEmpty(this.selectList)) {
  125. this.$msg("请选择订单");
  126. return;
  127. }
  128. if(this.selectList.length > 100){
  129. uni.showToast({title: '订单太多,点右上角选月份再结',duration: 2000,icon:"none"})
  130. return false
  131. }
  132. this.isModel = true;
  133. },
  134. selectDateFn(val){
  135. this.searchTime = val.searchTime
  136. this.startTime = val.startTime
  137. this.endTime = val.endTime
  138. this.initData().then(res => {
  139. uni.stopPullDownRefresh()
  140. })
  141. },
  142. async initData() {
  143. try {
  144. this.listLoading = true
  145. const {data: { customInfo, num, list }} = await getDebtOrderList({id:this.option.id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime})
  146. this.customInfo = customInfo
  147. this.num = num
  148. this.detailsList = list.map(ele => {
  149. return {
  150. ...ele,
  151. checked: false
  152. };
  153. });
  154. } catch (error) {
  155. } finally {
  156. this.listLoading = false;
  157. }
  158. },
  159. //全选与全不选
  160. checkFn() {
  161. this.isAllCheck = !this.isAllCheck
  162. if (this.isAllCheck) {
  163. this.detailsList.map(ele => { ele.checked = true })
  164. } else {
  165. this.detailsList.map(ele => { ele.checked = false })
  166. }
  167. },
  168. checkItemEvent(item) {
  169. for (let index = 0; index < this.detailsList.length; index++) {
  170. const element = this.detailsList[index].id;
  171. if (element == item.id) {
  172. this.$set(this.detailsList, index, {
  173. ...this.detailsList[index],
  174. checked: !this.detailsList[index].checked
  175. });
  176. break;
  177. }
  178. }
  179. },
  180. confirmData() {
  181. let ids = this.selectList.map(ele => {
  182. return {id:ele.id};
  183. });
  184. let parameter = {
  185. id:JSON.stringify(ids),
  186. customId:this.customInfo.id
  187. }
  188. this.paySuccess(parameter)
  189. },
  190. batchEvent() {
  191. try {
  192. if (this.$util.isEmpty(this.selectList)) {
  193. this.$msg("请选择还款订单");
  194. return;
  195. }
  196. let ids = this.selectList.map(ele => {
  197. return {id:ele.id};
  198. });
  199. let parameter = {
  200. id:JSON.stringify(ids),
  201. customId:this.customInfo.id,
  202. }
  203. let that = this;
  204. that.$util.confirmModal({content:'确定提交?'},() => {
  205. that.paySuccess(parameter)
  206. })
  207. } catch (error) {}
  208. },
  209. async paySuccess(parameter) {
  210. let that = this
  211. uni.showLoading({mask:true})
  212. const res = await clearOrderApi({...parameter,modifyPrice:this.modifyPrice,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime});
  213. uni.hideLoading()
  214. if(res.code == 1){
  215. if(res.data.hasUnComplete && res.data.hasUnComplete == 1){
  216. that.$util.confirmModal({content:'此客户还有待完成的账单',okText:'查看'},() => {
  217. that.pageTo({url:'/admin/clear/customList',type:2})
  218. })
  219. }else{
  220. that.pageTo({url:'/pagesArrears/clearResult',query:{id:res.data.id},type:2})
  221. }
  222. }
  223. }
  224. }
  225. };
  226. </script>
  227. <style lang="scss" scoped>
  228. .order-page {
  229. height: 100%;
  230. display: flex;
  231. flex-direction: column;
  232. background-color: #f9fbfc;
  233. overflow: scroll;
  234. .top-view {
  235. padding: 30upx;
  236. position:fixed;
  237. width:100%;
  238. background-color: #fff;
  239. .top-row {
  240. display: flex;
  241. justify-content: space-between;
  242. align-items: center;
  243. &:not(:last-child) {
  244. margin-bottom: 10upx;
  245. }
  246. .header-item {
  247. font-size: 24upx;
  248. font-weight: 400;
  249. color: #999999;
  250. }
  251. .info-item {
  252. display: flex;
  253. align-items: center;
  254. .logo {
  255. margin-right: 10upx;
  256. width: 32upx;
  257. height: 32upx;
  258. border-radius: 50%;
  259. }
  260. .name {
  261. font-size: 28upx;
  262. font-weight: 600;
  263. color: #333333;
  264. }
  265. }
  266. .price-item {
  267. font-size: 34upx;
  268. font-weight: 600;
  269. color: #333333;
  270. }
  271. }
  272. }
  273. .shop-list {
  274. margin-top:98upx;
  275. padding: 20upx 30upx;
  276. flex: 1;
  277. padding-bottom: 100upx;
  278. }
  279. .ios-bar-view {
  280. bottom: 0;
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. padding: 0 30upx;
  285. width: 100%;
  286. height: 100upx;
  287. background: #fff;
  288. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  289. .info-view {
  290. display: flex;
  291. align-items: center;
  292. color: #333;
  293. font-size: 24upx;
  294. .iconfont {
  295. font-size: 32upx;
  296. color: #dddddd;
  297. }
  298. .price {
  299. margin: 0 3upx;
  300. color: $redColor;
  301. font-size: 30upx;
  302. }
  303. .unit {
  304. margin: 0 3upx;
  305. color: $redColor;
  306. font-size: 30upx;
  307. }
  308. }
  309. .btn-view {
  310. display: flex;
  311. .admin-button-com {
  312. display: flex;
  313. align-items: center;
  314. justify-content: center;
  315. margin: 0 6upx;
  316. width: 200upx;
  317. height: 70upx;
  318. font-size: 30upx;
  319. }
  320. }
  321. }
  322. .android-bar-view {
  323. position: fixed;
  324. bottom: 0;
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. padding: 0 30upx;
  329. width: 100%;
  330. height: 100upx;
  331. background: #fff;
  332. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  333. .info-view {
  334. display: flex;
  335. align-items: center;
  336. color: #333;
  337. font-size: 24upx;
  338. .iconfont {
  339. font-size: 32upx;
  340. color: #dddddd;
  341. }
  342. .price {
  343. margin: 0 3upx;
  344. color: $redColor;
  345. font-size: 30upx;
  346. }
  347. .unit {
  348. margin: 0 3upx;
  349. color: $redColor;
  350. font-size: 30upx;
  351. }
  352. }
  353. .btn-view {
  354. display: flex;
  355. .admin-button-com {
  356. display: flex;
  357. align-items: center;
  358. justify-content: center;
  359. margin: 0 6upx;
  360. width: 200upx;
  361. height: 94upx;
  362. font-size: 30upx;
  363. }
  364. }
  365. }
  366. .details-select {
  367. margin-right: 20upx;
  368. display: inline-block;
  369. .iconweixuanzhong,
  370. .iconxuanzhong {
  371. font-size: 40upx !important;
  372. }
  373. .iconxuanzhong {
  374. color: $mainColor !important;
  375. }
  376. }
  377. .select-cmd_bx {
  378. .num_bx {
  379. margin-top:30upx;
  380. margin-bottom:50upx;
  381. margin-left:80upx;
  382. view{
  383. height: 80upx;
  384. font-size: 28upx;
  385. }
  386. input {
  387. height: 70upx;
  388. border: 1upx solid #dddddd;
  389. border-radius: 4upx;
  390. text-align: left;
  391. margin-right: 24upx;
  392. font-size: 35upx;
  393. width:300upx;
  394. }
  395. }
  396. }
  397. }
  398. </style>