Invoicing.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <view>
  3. <!-- 可开发票列表 -->
  4. <view class="fpList flex justify-center flex-wrap" v-if="orderList.length>0">
  5. <view class="fpList-box">
  6. <u-checkbox-group shape="circle">
  7. <view class="fpList-box-item flex justify-center" v-for="(item,index) in orderList" :key="index">
  8. <view class="fpList-box-item-c flex justify-between align-center">
  9. <view class="fpList-box-item-c-l flex align-center">
  10. <view class="fpList-box-item-c-l-s">
  11. <u-checkbox @change="checkboxChange(item)" v-model="item.checked"
  12. :name="index"></u-checkbox>
  13. </view>
  14. <view class="fpList-box-item-c-l-info"
  15. @click.stop="gototx(item.ordersNo,item.payMoney)">
  16. <view class="fpList-box-item-c-l-info-t">
  17. <text>顺风车</text>
  18. <span>{{item.createTime}}</span>
  19. </view>
  20. <block>
  21. <view class="fpList-box-item-c-l-info-c">
  22. <span>
  23. <text></text>
  24. </span>
  25. {{item.shipAddress}}
  26. </view>
  27. </block>
  28. <view class="fpList-box-item-c-l-info-b">
  29. <span><text></text></span>
  30. {{item.deliveryAddress}}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="fpList-box-item-c-r">
  35. <span>{{item.payMoney}}</span>元
  36. </view>
  37. </view>
  38. </view>
  39. </u-checkbox-group>
  40. </view>
  41. <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
  42. </view>
  43. <empty v-if="orderList.length==0" />
  44. <!-- 底部操作栏 -->
  45. <view class="select flex justify-center flex-wrap">
  46. <view class="select-se flex justify-center">
  47. <view class="select-se-box flex align-center">
  48. 已选<text>{{count}}</text>个记录,共<text>{{price.toFixed(2)}}</text>元
  49. </view>
  50. </view>
  51. <view class="select-box flex justify-center align-center">
  52. <view class="select-box-c flex justify-between">
  53. <view class="select-box-c-s">
  54. <u-checkbox shape="circle" @change="checkboxChanges" v-model="selectAll">本页全选
  55. </u-checkbox>
  56. </view>
  57. <view class="select-box-c-btn flex justify-center align-center" v-if="ids.length==0">
  58. 开发票
  59. </view>
  60. <view @click="gotokp()" class="select-box-c-btn flex justify-center align-center"
  61. style="background-color: #346EF6;color:#ffffff;" v-if="ids.length>0">
  62. 开发票
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- 遮罩 -->
  68. <u-mask :show="show"></u-mask>
  69. <!-- 开始时间 -->
  70. <u-picker v-model="showTimes" :params="params" mode="time" @confirm="confirms"></u-picker>
  71. <u-picker v-model="showTimee" :params="params" mode="time" @confirm="confirme"></u-picker>
  72. </view>
  73. </template>
  74. <script>
  75. import empty from '../../components/empty.vue'
  76. export default {
  77. data() {
  78. return {
  79. count: 0,
  80. price: 0,
  81. status: 'loadmore',
  82. iconType: 'flower',
  83. loadText: {
  84. loadmore: '轻轻上拉',
  85. loading: '努力加载中',
  86. nomore: '没有更多了'
  87. },
  88. selectAll: false,
  89. orderList: [],
  90. startTime: '',
  91. endtime: '',
  92. params: {
  93. year: true,
  94. month: true,
  95. day: true,
  96. hour: false,
  97. minute: false,
  98. second: false
  99. },
  100. showTimes: false,
  101. showTimee: false,
  102. show: false,
  103. open: false,
  104. current: 0,
  105. page: 1,
  106. limit: 10,
  107. totalPage: 0,
  108. ids: [],
  109. tabs: [{
  110. id: 1,
  111. name: '即时代驾'
  112. },
  113. {
  114. id: 2,
  115. name: '朋友代驾'
  116. },
  117. {
  118. id: 3,
  119. name: '预约代驾'
  120. }
  121. ],
  122. }
  123. },
  124. //监听选择变化计算总价
  125. watch: {
  126. ids(newData, oldData) {
  127. this.price = 0
  128. this.orderList.map(item => {
  129. if (item.checked == true) {
  130. this.price += item.payMoney
  131. }
  132. })
  133. },
  134. deep: true
  135. },
  136. onLoad() {
  137. // this.startTime = new Date().toISOString().slice(0, 10),
  138. // this.endtime = new Date().toISOString().slice(0, 10),
  139. this.getOrderList();
  140. },
  141. onShow() {
  142. this.getOrderList();
  143. this.getPrice()
  144. },
  145. onReachBottom: function() {
  146. if (this.page < this.totalPage) {
  147. this.page = this.page + 1;
  148. this.status = 'loading'
  149. this.getPrice()
  150. this.getOrderList();
  151. } else {
  152. this.status = 'nomore'
  153. }
  154. },
  155. onPullDownRefresh: function() {
  156. this.page = 1;
  157. this.getPrice()
  158. this.getOrderList();
  159. },
  160. methods: {
  161. // 多个开票
  162. gotokp() {
  163. let id = this.ids.join(',')
  164. let price = this.price.toFixed(2)
  165. uni.navigateTo({
  166. url: '/pageA/invoice/kaipiao?indentNumber=' + id + '&price=' + price
  167. })
  168. },
  169. //计算单数与价格
  170. getPrice() {
  171. this.selectAll = false
  172. this.orderList.map(item => {
  173. item.checked = false
  174. })
  175. this.ids = []
  176. this.count = this.ids.length
  177. this.price = 0
  178. },
  179. //根据时间筛选
  180. submit() {
  181. this.show = false
  182. this.open = false
  183. this.page = 1
  184. this.getOrderList();
  185. },
  186. // 去开票
  187. gototx(id, price) {
  188. uni.navigateTo({
  189. url: '/pageA/invoice/kaipiao?indentNumber=' + id + '&price=' + price
  190. })
  191. },
  192. //切换订单类型
  193. qiehuans(index, id) {
  194. this.current = index
  195. this.page = 1
  196. this.orderList = []
  197. this.getPrice()
  198. this.startTime = '开始时间'
  199. this.endtimec = '截止时间'
  200. this.getOrderList()
  201. },
  202. //订单数据
  203. getOrderList() {
  204. let data = {
  205. page: this.page,
  206. limit: this.limit,
  207. indentType: parseInt(this.current) + 1,
  208. startTime: this.startTime == '开始时间' ? '' : this.startTime,
  209. endTime: this.endtime == '截止时间' ? '' : this.endtime,
  210. }
  211. this.$Request.getT("/app/invoice/getIndentList", data).then(res => {
  212. if (res.code == 0) {
  213. this.totalPage = res.data.pages
  214. let data = res.data.records
  215. data.map(item => {
  216. item.checked = false
  217. })
  218. if (this.page == 1) {
  219. this.orderList = data
  220. } else {
  221. if (data.length > 0) {
  222. this.orderList = this.orderList.concat(data)
  223. }
  224. }
  225. }
  226. });
  227. },
  228. // 选中某个复选框时,由checkbox时触发
  229. checkboxChange(e) {
  230. if (this.ids.indexOf(e.ordersNo) == -1) { //如果没有选中则把goodsid增加到数组中
  231. this.ids.push(e.ordersNo)
  232. } else { //如果找到了则把goodsid删除
  233. this.ids.splice(this.ids.indexOf(e.ordersNo), 1)
  234. }
  235. if (this.ids.length == this.orderList.length) { //判断是否全部选中
  236. this.selectAll = true
  237. } else {
  238. this.selectAll = false
  239. }
  240. this.count = this.ids.length
  241. },
  242. //全选
  243. checkboxChanges(e) {
  244. this.ids = []
  245. if (this.selectAll == false) { //全选(把总复选框选中并把id赋给数组)
  246. this.orderList.map(item => {
  247. item.checked = true
  248. this.ids.push(item.ordersNo)
  249. })
  250. } else { //全不选
  251. this.orderList.map(item => {
  252. item.checked = false
  253. })
  254. }
  255. this.count = this.ids.length
  256. this.price = 0
  257. this.orderList.map(item => {
  258. if (item.checked == true) {
  259. this.price += item.payMoney
  260. }
  261. })
  262. },
  263. confirms(e) {
  264. this.startTime = e.year + '-' + e.month + '-' + e.day
  265. },
  266. confirme(e) {
  267. this.endtime = e.year + '-' + e.month + '-' + e.day
  268. },
  269. //切换
  270. qiehuan() {
  271. //初始化时间
  272. this.startTime = '开始时间'
  273. this.endtime = '截止时间'
  274. this.show = !this.show
  275. this.open = !this.open
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .active {
  282. background-color: rgba(3, 159, 255, 0.1) !important;
  283. color: #068bff;
  284. }
  285. .selectDown {
  286. width: 100%;
  287. // height: 300rpx;
  288. background-color: #ffffff;
  289. z-index: 99999;
  290. border-radius: 0 0 20rpx 20rpx;
  291. .selectDown-box {
  292. width: 686rpx;
  293. margin-top: 20rpx;
  294. .selectDown-box-time {
  295. margin-top: 20rpx;
  296. .selectDown-box-time-l {
  297. width: 40%;
  298. height: 70rpx;
  299. background-color: #f2f2f2;
  300. border-radius: 16rpx;
  301. }
  302. .selectDown-box-time-r {
  303. width: 40%;
  304. height: 70rpx;
  305. background-color: #f2f2f2;
  306. border-radius: 16rpx;
  307. }
  308. }
  309. }
  310. .selectDown-btn {
  311. width: 100%;
  312. height: 80rpx;
  313. margin-top: 30rpx;
  314. .selectDown-btn-l {
  315. width: 50%;
  316. height: 100%;
  317. background-color: #f2f2f2;
  318. border-radius: 0 0 0 20rpx;
  319. }
  320. .selectDown-btn-r {
  321. width: 50%;
  322. background-color: #346EF6;
  323. color: #ffffff;
  324. height: 100%;
  325. border-radius: 0 0 20rpx 0;
  326. }
  327. }
  328. }
  329. .selectTypes {
  330. width: 100%;
  331. height: 70rpx;
  332. background-color: #ffffff;
  333. position: relative;
  334. z-index: 99999;
  335. .shgaixuan {
  336. position: absolute;
  337. width: 60rpx;
  338. height: 100%;
  339. right: 31rpx;
  340. background-color: #ffffff;
  341. z-index: 9999;
  342. }
  343. .selectTypes-box {
  344. width: 626rpx;
  345. height: 100%;
  346. // background-color: red;
  347. overflow-x: auto;
  348. overflow-y: hidden;
  349. white-space: nowrap;
  350. margin-left: 32rpx;
  351. .selectTypes-item {
  352. background-color: #f2f2f2;
  353. padding: 10rpx 20rpx 10rpx 20rpx;
  354. border-radius: 12rpx;
  355. margin-right: 10rpx;
  356. font-size: 24rpx;
  357. }
  358. }
  359. }
  360. .fpList {
  361. width: 100%;
  362. height: auto;
  363. margin-top: 30rpx;
  364. margin-bottom: 190rpx;
  365. .fpList-box {
  366. width: 686rpx;
  367. height: 100%;
  368. .fpList-box-item {
  369. width: 686rpx;
  370. // height: 200rpx;
  371. padding: 20rpx 0;
  372. border-radius: 26rpx;
  373. background-color: #ffffff;
  374. margin-bottom: 20rpx;
  375. }
  376. .fpList-box-item-c {
  377. width: 646rpx;
  378. height: 100%;
  379. .fpList-box-item-c-l-info-t {
  380. font-size: 30rpx;
  381. font-weight: bold;
  382. span {
  383. margin-left: 20rpx;
  384. color: #333333;
  385. font-size: 24rpx;
  386. font-weight: 300;
  387. }
  388. }
  389. .fpList-box-item-c-l-info-c {
  390. width: 460rpx;
  391. margin-top: 10rpx;
  392. color: rgb(126, 126, 126);
  393. span {
  394. display: inline-block;
  395. width: 20rpx;
  396. height: 20rpx;
  397. background-color: #346EF6;
  398. border-radius: 50%;
  399. position: relative;
  400. margin-right: 20rpx;
  401. text {
  402. display: inline-block;
  403. width: 10rpx;
  404. height: 10rpx;
  405. background-color: #ffffff;
  406. border-radius: 50%;
  407. position: absolute;
  408. top: 50%;
  409. left: 50%;
  410. transform: translate(-50%, -50%);
  411. }
  412. }
  413. }
  414. .fpList-box-item-c-l-info-b {
  415. width: 460rpx;
  416. margin-top: 10rpx;
  417. color: rgb(126, 126, 126);
  418. span {
  419. display: inline-block;
  420. width: 20rpx;
  421. height: 20rpx;
  422. background-color: black;
  423. border-radius: 50%;
  424. position: relative;
  425. margin-right: 20rpx;
  426. text {
  427. display: inline-block;
  428. width: 10rpx;
  429. height: 10rpx;
  430. background-color: #ffffff;
  431. border-radius: 50%;
  432. position: absolute;
  433. top: 50%;
  434. left: 50%;
  435. transform: translate(-50%, -50%);
  436. }
  437. }
  438. }
  439. .fpList-box-item-c-r {
  440. margin-top: 94rpx;
  441. span {
  442. font-size: 30rpx;
  443. font-weight: bold;
  444. margin-right: 10rpx;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. .select {
  451. width: 100%;
  452. height: 150rpx;
  453. position: fixed;
  454. bottom: 0;
  455. background-color: #ffffff;
  456. z-index: 1;
  457. .select-se {
  458. width: 100%;
  459. height: 50rpx;
  460. background-color: rgb(211, 233, 252);
  461. .select-se-box {
  462. width: 686rpx;
  463. height: 100%;
  464. font-size: 24rpx;
  465. text {
  466. margin-left: 10rpx;
  467. margin-right: 10rpx;
  468. color: rgb(118, 167, 219);
  469. }
  470. }
  471. }
  472. .select-box {
  473. width: 686rpx;
  474. height: 100%;
  475. .select-box-c {
  476. width: 646rpx;
  477. height: 100%;
  478. .select-box-c-s {
  479. height: 100%;
  480. margin-top: 20rpx;
  481. }
  482. .select-box-c-btn {
  483. width: 240rpx;
  484. height: 80rpx;
  485. border-radius: 60rpx;
  486. background-color: rgb(219, 219, 219);
  487. color: #ffffff;
  488. margin-top: 10rpx;
  489. }
  490. }
  491. }
  492. }
  493. </style>