You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

invoice-content.vue 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <view class="contentAll">
  3. <view class="titleOne">
  4. <text @click="invoiceRecord">开票记录</text>
  5. <text class="line">|</text>
  6. <text @click="$util.navTo(`/subpackage/orders/invoiceApply/invoice-header-list?manage=1`,true)">管理抬头</text>
  7. </view>
  8. <view class="twoOne" v-if="state.type==1">
  9. <view class="item last">
  10. <text>开票状态:</text>
  11. <uni-data-select v-model="state.businessTypeValOne" :localdata="state.businessRangeOne"
  12. @change="changeBusinessOne"></uni-data-select>
  13. </view>
  14. <button size="mini" style="color: #ffffff;
  15. backgroundColor: rgb(118, 200, 77);
  16. borderColor: rgb(118, 200, 77);
  17. font-size: 26rpx;
  18. flex-shrink: 0;margin-left: 20rpx;" @click="searchOne()">查询</button>
  19. </view>
  20. <view class="two" v-if="state.type==2">
  21. <view class="input">
  22. ETC卡号:<input placeholder="请输入ETC卡号" v-model="state.etcCardNo" />
  23. </view>
  24. <view class="three">
  25. <view class="item last">
  26. <text>开票状态:</text>
  27. <uni-data-select v-model="state.businessTypeVal" :localdata="state.businessRange"
  28. @change="changeBusiness"></uni-data-select>
  29. </view>
  30. <button size="mini" style="color: #ffffff;
  31. backgroundColor: rgb(118, 200, 77);
  32. borderColor: rgb(118, 200, 77);
  33. font-size: 26rpx;
  34. flex-shrink: 0;margin-left: 20rpx;" @click="searchTwo">查询</button>
  35. </view>
  36. </view>
  37. <view>
  38. <view class="cardbox">
  39. <view class="card" v-for="(item,i) in state.data" :key="i">
  40. <view>
  41. <checkbox-group @change="checkboxChange(item)">
  42. <checkbox :value="item.orderNo" :checked="state.checked" style="transform:scale(0.7)" />
  43. </checkbox-group>
  44. </view>
  45. <view class="content">
  46. <view class="title">订单号:{{item.orderNo}}</view>
  47. <view class="title">订单时间:{{item.orderTime}}</view>
  48. <view class="title" v-if="item.productType">订单类型:{{item.productType}}</view>
  49. <view class="title">车牌号:{{item.vehiclePlate}}</view>
  50. <view class="title">订单金额:¥{{item.invoiceAmount}}</view>
  51. <view class="title">开票状态:{{item.status==1?'已开票':"可开票"}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
  58. <view class="apply-wrap">
  59. <view>
  60. <checkbox-group @change="checkboxAll">
  61. <checkbox value="ALL" style="transform:scale(0.7)" :checked="state.checkedAll" />全选
  62. </checkbox-group>
  63. </view>
  64. <view class="apply" @click="apply">去申请</view>
  65. </view>
  66. </template>
  67. <script lang="ts" setup>
  68. import {
  69. navTo, msg
  70. } from "@/utils/utils";
  71. import { reactive, ref } from "vue";
  72. import { onLoad, onReachBottom, onShow } from "@dcloudio/uni-app";
  73. import { queryEtcOrderApi, getUserMsg, trafficFlowApi } from "@/utils/network/api.js";
  74. import { stringToJson } from "@/utils/network/encryption";
  75. import { request } from "@/utils/network/request.js";
  76. import {
  77. getItem
  78. } from "@/utils/storage";
  79. const state = reactive({
  80. type: 1, //1 ETC产品订单 2通行流水服务费订单
  81. userMobile: "",
  82. data: [],
  83. businessTypeValOne: 9,
  84. businessRangeOne: [{
  85. 'value': 9,
  86. 'text': '可开票'
  87. }, {
  88. 'value': 1,
  89. 'text': '已开票'
  90. }],
  91. businessTypeVal: 9,
  92. businessRange: [{
  93. 'value': 9,
  94. 'text': '可开票'
  95. }, {
  96. 'value': 1,
  97. 'text': '已开票'
  98. }, {
  99. 'value': 2,
  100. 'text': '已开纸质票'
  101. }],
  102. etcCardNo: "",
  103. pageSize: 10, //每页数据量
  104. pageNo: 1, // 当前页
  105. ordersArr: [],
  106. checked: false,
  107. checkedAll: false,
  108. flags: false,
  109. customerIdNum: ""
  110. })
  111. onLoad((option) => {
  112. state.type = option.type
  113. getUserinfo()
  114. })
  115. // onShow(() => {
  116. // if (state.type == 1) {
  117. // etcOrder(1)
  118. // }
  119. // })
  120. const value = ref('')
  121. const getUserinfo = () => {
  122. const options = {
  123. type: 2,
  124. data: {
  125. openId: getItem('openId'),
  126. },
  127. method: "POST",
  128. showLoading: true,
  129. };
  130. request(getUserMsg, options).then((res) => {
  131. const data = stringToJson(res.bizContent);
  132. console.log(data, "用户信息");
  133. state.userMobile = data.customerTel
  134. state.customerIdNum = data.customerIdNum
  135. if (state.type == 1) {
  136. etcOrder(1)
  137. }
  138. });
  139. }
  140. const etcOrder = (val) => {
  141. if (val == 1) {
  142. state.pageNo = 1
  143. }
  144. if (state.pageNo == 1 && state.data.length > 0) {
  145. state.data = []
  146. }
  147. const options = {
  148. type: 2,
  149. data: {
  150. userMobile: state.userMobile,
  151. page: state.pageNo,
  152. pageSize: state.pageSize,
  153. status: state.businessTypeValOne
  154. },
  155. method: "POST",
  156. showLoading: true,
  157. };
  158. request(queryEtcOrderApi, options).then((res) => {
  159. const data = stringToJson(res.bizContent);
  160. state.data = data.orders
  161. console.log(data, "查询ETC产品订单");
  162. });
  163. }
  164. const trafficFlow = (val) => {
  165. if (val == 1) {
  166. state.pageNo = 1
  167. }
  168. if (state.pageNo == 1 && state.data.length > 0) {
  169. state.data = []
  170. }
  171. const options = {
  172. type: 2,
  173. data: {
  174. etcCardNo: state.etcCardNo,
  175. userMobile: state.userMobile,
  176. pageNumber: state.pageNo,
  177. page: state.pageSize,
  178. status: state.businessTypeVal
  179. },
  180. method: "POST",
  181. showLoading: true,
  182. };
  183. request(trafficFlowApi, options).then((res) => {
  184. const data = stringToJson(res.bizContent);
  185. state.data = data.orders
  186. console.log(data, "通行");
  187. });
  188. }
  189. const changeBusiness = (e) => {
  190. state.businessTypeVal = e
  191. console.log(e)
  192. }
  193. const changeBusinessOne = (e) => {
  194. state.businessTypeValOne = e
  195. console.log(e)
  196. }
  197. const apply = () => {
  198. const params = encodeURIComponent(JSON.stringify(state.ordersArr))
  199. if (state.ordersArr.length >= 1) {
  200. navTo(`/subpackage/orders/invoiceApply/invoice-step1?type=${state.type}&&ordersArr=${params}&&userMobile=${state.userMobile}&&customerIdNum=${state.customerIdNum}`)
  201. } else {
  202. msg("请选择订单开票")
  203. }
  204. }
  205. const searchOne = () => {
  206. state.pageNo = 1
  207. etcOrder(2)
  208. }
  209. const searchTwo = () => {
  210. state.pageNo = 1
  211. trafficFlow(1)
  212. }
  213. const invoiceRecord = () => {
  214. navTo(`/subpackage/orders/invoiceApply/invoiceList?userMobile=${state.userMobile}`)
  215. }
  216. const checkboxChange = (item) => {
  217. var items = state.data,
  218. values = item.orderNo;
  219. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  220. console.log("values", values, items[i].orderNo)
  221. if (values.includes(items[i].orderNo)) {
  222. items[i]['checked'] = !items[i]['checked']
  223. }
  224. }
  225. state.ordersArr = []
  226. for (var k = 0; k < state.data.length; k++) {
  227. if (state.data[k]['checked']) {
  228. if (state.data[k]['checked'] == true) {
  229. state.ordersArr.push(state.data[k])
  230. }
  231. }
  232. }
  233. if (state.ordersArr.length == state.data.length) {
  234. console.log("进来了")
  235. state.checkedAll = true
  236. } else {
  237. state.checkedAll = false
  238. }
  239. console.log("e", state.ordersArr)
  240. }
  241. const checkboxAll = (e) => {
  242. if (e.detail.value.toString() == 'ALL') {
  243. for (var i = 0; i < state.data.length; i++) {
  244. state.ordersArr.push(state.data[i])
  245. state.checkedAll = true
  246. state.checked = true
  247. }
  248. } else {
  249. state.ordersArr = []
  250. state.checked = false
  251. }
  252. console.log("全部", e.detail.value)
  253. }
  254. // 触底加载
  255. onReachBottom(() => {
  256. if (state.data.length < state.pageNo * 10) return state.flags = true
  257. console.log("触底了")
  258. state.pageNo++
  259. if (state.type == 1) {
  260. etcOrder(2)
  261. } else {
  262. trafficFlow(2)
  263. }
  264. })
  265. </script>
  266. <style scoped lang="scss">
  267. .contentAll {
  268. font-size: 32rpx;
  269. background: #eef7f7;
  270. width: 100%;
  271. min-height: 100vh;
  272. }
  273. .titleOne {
  274. display: flex;
  275. align-items: center;
  276. justify-content: space-evenly;
  277. background-color: white;
  278. padding: 20rpx;
  279. }
  280. .line {
  281. color: #ccc;
  282. }
  283. .cardbox {
  284. width: 95%;
  285. margin: 0 auto;
  286. margin-top: 20rpx;
  287. .card {
  288. background: #FFFFFF;
  289. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  290. border-radius: 20rpx;
  291. display: flex;
  292. align-items: center;
  293. padding: 30rpx;
  294. margin-bottom: 30rpx;
  295. .content {
  296. margin-left: 30rpx;
  297. .title {
  298. font-size: 30rpx;
  299. font-family: Noto Sans S Chinese;
  300. font-weight: 400;
  301. color: #333333;
  302. margin-bottom: 15rpx;
  303. }
  304. text {
  305. font-size: 26rpx;
  306. font-family: Noto Sans S Chinese;
  307. font-weight: 400;
  308. color: #666666;
  309. }
  310. }
  311. .icon-active {
  312. width: 43rpx;
  313. height: 43rpx;
  314. background: #00B38B;
  315. border-radius: 50%;
  316. display: flex;
  317. justify-content: center;
  318. align-items: center;
  319. }
  320. .icon-no-active {
  321. width: 44rpx;
  322. height: 44rpx;
  323. background: #FFFFFF;
  324. border: 1px solid #00B38B;
  325. border-radius: 50%;
  326. }
  327. .edit {
  328. display: flex;
  329. justify-content: center;
  330. align-items: center;
  331. flex-direction: column;
  332. image {
  333. width: 40rpx;
  334. height: 40rpx;
  335. }
  336. view {
  337. font-size: 26rpx;
  338. font-family: Noto Sans S Chinese;
  339. font-weight: 400;
  340. color: #999999;
  341. }
  342. }
  343. }
  344. }
  345. .apply {
  346. width: 150rpx;
  347. height: 70rpx;
  348. background: linear-gradient(-90deg, #43A1E0 0%, #13E7C1 100%);
  349. border-radius: 40rpx;
  350. font-size: 32rpx;
  351. color: #FFFFFF;
  352. line-height: 70rpx;
  353. text-align: center;
  354. }
  355. .apply-wrap {
  356. width: 100%;
  357. position: fixed;
  358. bottom: 0;
  359. left: 0;
  360. background-color: white;
  361. font-family: Noto Sans S Chinese;
  362. font-weight: 400;
  363. display: flex;
  364. align-items: center;
  365. height: 100rpx;
  366. padding: 0 20rpx;
  367. justify-content: space-between;
  368. box-sizing: border-box;
  369. }
  370. ::deep.last .uni-stat__select {
  371. width: 360rpx !important;
  372. }
  373. .item {
  374. display: flex;
  375. font-size: 30rpx;
  376. margin-top: 10rpx;
  377. align-items: center;
  378. }
  379. .twoOne {
  380. background-color: white;
  381. margin-top: 10rpx;
  382. padding: 20rpx;
  383. display: flex;
  384. align-items: center;
  385. }
  386. .three {
  387. display: flex;
  388. align-items: center;
  389. }
  390. .two {
  391. background-color: white;
  392. margin-top: 10rpx;
  393. padding: 20rpx;
  394. }
  395. .input {
  396. display: flex;
  397. align-items: center;
  398. padding-left: 10prx;
  399. }
  400. .input>input {
  401. width: 45%;
  402. margin-top: 10rpx;
  403. font-size: 30rpx;
  404. border: 1rpx solid #ccc;
  405. padding: 0 10rpx;
  406. height: 28rpx;
  407. line-height: 28rpx;
  408. }
  409. </style>