Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

arrears.vue 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="title">
  3. <view>
  4. <text :class="state.reimburseStatus=='0'?'status':'status1'" @click="getlist(0)">待补缴</text>
  5. <text :class="state.reimburseStatus=='1'?'status2':'status3'" @click="getlist(1)">已补缴</text>
  6. </view>
  7. </view>
  8. <view class="content">
  9. <view class="list" v-for="(item,index) in state.list" @click="details(item.id)">
  10. <checkbox-group @change="checkboxGroupChange(item)">
  11. <label class="uni-list-cell uni-list-cell-pd" style="display: flex;">
  12. <checkbox :checked="item.checked" style="transform:scale(0.8);top: -12rpx;position: relative;" v-if="state.reimburseStatus=='0'"/>
  13. <view class="right-box">
  14. <view class="right-box-top">
  15. <view>
  16. <image :src="`${$imgUrl}arrears.png`" mode=""></image>
  17. <text>{{item.vehiclePlate}}</text>
  18. </view>
  19. <text class="money">¥{{item.reimburseFee/100}}</text>
  20. </view>
  21. <view class="right-box-bot">
  22. <view class="name">补缴原因:</view>
  23. <view class="details">{{item.reason}}</view>
  24. </view>
  25. </view>
  26. </label>
  27. </checkbox-group>
  28. </view>
  29. </view>
  30. <view class="pay_wrap" v-if="state.reimburseStatus=='0'">
  31. <checkbox-group @change="checkboxChangeAll">
  32. <label class="uni-list-cell uni-list-cell-pd">
  33. <checkbox value="ALL" :checked="state.checkedAll" style="transform:scale(0.8)"/>合计 ¥{{allPrice/100}}
  34. </label>
  35. </checkbox-group>
  36. <view class="pay" @click="pay">支付</view>
  37. </view>
  38. </template>
  39. <script lang="ts" setup>
  40. import {
  41. ref,
  42. reactive
  43. } from "vue"
  44. import {
  45. onLoad,
  46. onPullDownRefresh
  47. } from "@dcloudio/uni-app";
  48. import {requestNew} from "@/utils/network/request.js";
  49. import {
  50. reimbursePage,reimburseUserPay
  51. } from "@/utils/network/api.js";
  52. import {navTo} from '@/utils/utils';
  53. const allPrice = ref(0)
  54. const state = reactive({
  55. reimburseStatus:"0",//0未补缴 1已补缴 2已关闭
  56. pageNo:1,
  57. pageSize:10,
  58. list:[],
  59. suppleNoList:[],//支付合集
  60. checkedAll:false
  61. })
  62. onLoad(() => {
  63. getlist(state.reimburseStatus)
  64. })
  65. const checkboxGroupChange = (e) => {
  66. console.log(e);
  67. if(state.suppleNoList.length==0){
  68. state.suppleNoList.push(e)
  69. }else{
  70. for(var k=0;k<state.suppleNoList.length;k++){
  71. if(e.orderId==state.suppleNoList[k]['orderId']){
  72. state.suppleNoList.splice(k,1)
  73. }
  74. }
  75. }
  76. // 过滤数据
  77. let arr = []
  78. allPrice.value = 0
  79. state.suppleNoList.forEach((item, i) => {
  80. state.list.forEach((val, index) => {
  81. console.log("state.suppleNoList",state.suppleNoList,state.list,item.orderId,val.orderId)
  82. if (item.orderId == val.orderId) {
  83. arr.push(val.reimburseFee)
  84. }
  85. })
  86. })
  87. console.log("arr",arr)
  88. // 计算价格
  89. arr.forEach(item => {
  90. allPrice.value += item
  91. })
  92. // 全选
  93. if(state.suppleNoList.length==state.list.length){
  94. state.checkedAll=true
  95. }else{
  96. state.checkedAll=false
  97. }
  98. console.log(state.suppleNoList, "支付集合",allPrice.value);
  99. }
  100. const checkboxChangeAll = (e) => {
  101. console.log(e);
  102. if (e.detail.value.toString() == 'ALL') {
  103. for (var i = 0; i < state.list.length; i++) {
  104. state.suppleNoList.push(state.list[i])
  105. state.checkedAll = true
  106. state.list[i].checked = true
  107. }
  108. } else {
  109. state.suppleNoList = []
  110. for (var i = 0; i < state.list.length; i++) {
  111. state.list[i].checked = false
  112. }
  113. allPrice.value=0
  114. }
  115. console.log(state.suppleNoList, "支付集合");
  116. }
  117. // 获取列表数据
  118. const getlist = (reimburseStatus) => {
  119. state.reimburseStatus=reimburseStatus
  120. const options = {
  121. type: 2,
  122. data: {
  123. reimburseStatus:reimburseStatus,//补缴单状态
  124. pageNo:state.pageNo,
  125. pageSize:state.pageSize
  126. },
  127. method: "POST",
  128. showLoading: true,
  129. };
  130. requestNew(reimbursePage, options).then((res) => {
  131. console.log("state.list",state.list);
  132. let data=res.result
  133. for(var i=0;i<data.length;i++){
  134. data[i]['vehiclePlate']=data[i]['vehicleId'].split("_")[0]
  135. data[i]['checked']=false
  136. }
  137. state.list =data
  138. });
  139. }
  140. const pay=()=>{
  141. console.log(allPrice.value, "支付金额");
  142. const options = {
  143. type: 2,
  144. data: {
  145. orderIds:state.reimburseStatus,//补缴单状态
  146. reimburseFee:state.pageNo,
  147. spbillCreateIp:state.pageSize
  148. },
  149. method: "POST",
  150. showLoading: true,
  151. };
  152. requestNew(reimburseUserPay, options).then((res) => {
  153. console.log("res",res);
  154. });
  155. }
  156. const details=(id)=>{
  157. navTo(`/subpackage/after-sale/arrears/arrears-details?id=${id}`)
  158. }
  159. </script>
  160. <style lang="scss">
  161. .title{
  162. width: 100%;
  163. height: 140rpx;
  164. background-color: white;
  165. position: fixed;
  166. left: 0;
  167. top: 0;
  168. display: flex;
  169. justify-content: center;
  170. line-height: 140rpx;
  171. .status{
  172. background: #CCB375;
  173. border-radius: 34rpx 0rpx 0rpx 34rpx;
  174. border: 1px solid #CCB375;
  175. color: white;
  176. width: 200rpx;
  177. height: 68rpx;
  178. font-size: 28rpx;
  179. line-height: 68rpx;
  180. display: inline-block;
  181. text-align: center;
  182. }
  183. .status1{
  184. border-radius: 34rpx 0rpx 0rpx 34rpx;
  185. border: 1px solid #CCB375;
  186. color: #CCB375;
  187. width: 200rpx;
  188. height: 68rpx;
  189. font-size: 28rpx;
  190. line-height: 68rpx;
  191. display: inline-block;
  192. text-align: center;
  193. }
  194. .status2{
  195. background:#CCB375;
  196. border-radius: 0rpx 34rpx 34rpx 0rpx;
  197. border: 1px solid #CCB375;
  198. font-size: 28rpx;
  199. color: white;
  200. width: 200rpx;
  201. height: 68rpx;
  202. font-size: 28rpx;
  203. line-height: 68rpx;
  204. display: inline-block;
  205. text-align: center;
  206. }
  207. .status3{
  208. border-radius: 0rpx 34rpx 34rpx 0rpx;
  209. border: 1px solid #CCB375;
  210. font-size: 28rpx;
  211. color: #CCB375;
  212. width: 200rpx;
  213. height: 68rpx;
  214. font-size: 28rpx;
  215. line-height: 68rpx;
  216. display: inline-block;
  217. text-align: center;
  218. }
  219. }
  220. .pay_wrap{
  221. position: fixed;
  222. bottom: 0;
  223. left: 0;
  224. width: 100%;
  225. height: 128rpx;
  226. background: #FFFFFF;
  227. border-radius: 30rpx 30rpx 0rpx 0rpx;
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. padding: 0 30rpx;
  232. box-sizing: border-box;
  233. .pay{
  234. width: 210rpx;
  235. height: 80rpx;
  236. background: linear-gradient(90deg, #01253B 0%, #004576 100%);
  237. border-radius: 40rpx;
  238. font-size: 32rpx;
  239. color: #FFFFFF;
  240. text-align: center;
  241. line-height: 80rpx;
  242. }
  243. }
  244. .content{
  245. width: 90%;
  246. margin: 0 auto;
  247. margin-top: 170rpx;
  248. .list{
  249. background: #FFFFFF;
  250. border-radius: 12rpx;
  251. border: 1px solid #FFFFFF;
  252. padding: 20rpx;
  253. box-sizing: border-box;
  254. margin-bottom: 30rpx;
  255. .right-box{
  256. margin-left: 10rpx;
  257. width: 100%;
  258. .right-box-top{
  259. display: flex;
  260. align-items: center;
  261. justify-content: space-between;
  262. border-bottom: 2rpx solid #DCDCDC;
  263. padding-bottom: 18rpx;
  264. view{
  265. display: flex;
  266. align-items: center;
  267. image{
  268. width: 50rpx;
  269. height: 50rpx;
  270. margin-right: 10rpx;
  271. }
  272. }
  273. .money{
  274. color: #CE1717;
  275. }
  276. }
  277. .right-box-bot{
  278. font-size: 26rpx;
  279. color: #6C6C6C;
  280. display: flex;
  281. padding-top: 20rpx;
  282. .name{
  283. flex: 1;
  284. }
  285. .details{
  286. flex:3;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. </style>