選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

arrears.vue 6.8KB

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