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.5KB

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