list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. <template>
  2. <view class="container mine clearfix">
  3. <view
  4. class="tui-header-box first"
  5. :style="{ height: isCmcustomClass == 'fiexd' ? CustomBar + 6 + 'px' : CustomBar + 6 + 'px' }"
  6. :class="isCmcustomClass"
  7. >
  8. <view class="header-top" :style="{ paddingTop: top + 'px', lineHeight: CustomBar + 20 + 'px' }"></view>
  9. <view class="header-sit">
  10. <text class="iconfont icon-fanhui" @click.stop="this.$api.navigateBack(1)"></text>
  11. <text class="header-sit-text">选择关联订单</text>
  12. </view>
  13. </view>
  14. <tui-skeleton
  15. v-if="skeletonShow"
  16. backgroundColor="#fafafa"
  17. borderRadius="10rpx"
  18. :isLoading="true"
  19. :loadingType="7"
  20. ></tui-skeleton>
  21. <view class="container-content" v-else>
  22. <view class="tui-header-tabs day clearfix" :style="{ top: CustomBar + 6 + 'px' }">
  23. <view class="tui-header-tabmain">
  24. <input
  25. class="input"
  26. type="text"
  27. v-model="listQuery.keyWord"
  28. confirm-type="search"
  29. @confirm="subMitSearch()"
  30. placeholder="请输入供应商名称"
  31. />
  32. <text class="iconfont icon-sousuo"></text>
  33. </view>
  34. </view>
  35. <view
  36. class="user-section"
  37. :style="{
  38. top: isIphoneX ? CustomBar + 66 + 'px' : CustomBar + 56 + 'px',
  39. left: 0 + 'px',
  40. paddingBottom: isIphoneX ? '178rpx' : '144rpx'
  41. }"
  42. >
  43. <view class="header-content">
  44. <view :class="{ 'tui-order-list': scrollTop >= 0 }" class="clearfix">
  45. <!-- 空白页 -->
  46. <empty v-if="isEmpty" :typeIndex="currents" :navbarHeight="navbarHeight"></empty>
  47. <!-- 列表 -->
  48. <view v-else class="tui-order-content">
  49. <view class="tui-order-item" v-for="(order, index) in orderList" :key="index">
  50. <view class="list-title" @click.stop="orderDetail(order.mainOrder.orderId)">
  51. <view class="list-title-t">
  52. <view class="list-title-tip">
  53. <text class="badges">{{
  54. order.mainOrder.orderType | formatOrderType
  55. }}</text>
  56. </view>
  57. <view class="list-title-tag" v-if="order.mainOrder.organizeId == 3">
  58. <text class="badges">维沙</text>
  59. </view>
  60. <view class="list-title-num">{{
  61. order.mainOrder.status | stateExpFormat
  62. }}</view>
  63. </view>
  64. <view class="list-title-a">
  65. <view class="list-title-a-text">
  66. 子订单编号:<text class="text"
  67. >{{ order.shopOrderNo }} ( {{ order.shopOrderId }} )</text
  68. >
  69. </view>
  70. <view class="list-title-a-text">
  71. 供应商名称:<text class="text">{{ order.shopName }}</text>
  72. </view>
  73. <view class="list-title-a-text">
  74. 订单金额:<text class="text">¥{{ order.needPayAmount | NumFormat }}</text>
  75. </view>
  76. </view>
  77. <view class="list-title-b">
  78. 客户名称:<text class="text">{{
  79. order.mainOrder.userName ? order.mainOrder.userName : '无'
  80. }}</text>
  81. </view>
  82. <view class="list-title-b">
  83. 订单编号:<text class="text"
  84. >{{ order.mainOrder.orderNo }} ( {{ order.mainOrder.orderId }} )</text
  85. >
  86. </view>
  87. <view class="list-title-b">
  88. 下单日期:<text class="text">{{ order.mainOrder.orderTime }}</text>
  89. </view>
  90. <view class="list-title-b">
  91. <view class="list-title-b-item ">
  92. 订单金额:<text class="text"
  93. >¥{{ order.mainOrder.payTotalFee | NumFormat }}</text
  94. >
  95. </view>
  96. <view class="list-title-b-item ">
  97. 已收金额:<text class="text"
  98. >¥{{ order.mainOrder.paidAmount | NumFormat }}</text
  99. >
  100. </view>
  101. </view>
  102. </view>
  103. <view class="list-checked" @click="checkedOrder(order, index)">
  104. <text
  105. class="iconfont"
  106. :class="order.isChecked ? 'icon-yixuanze' : 'icon-weixuanze'"
  107. ></text>
  108. </view>
  109. <view class="list-detail" @click.stop="orderDetail(order.mainOrder.orderId)">
  110. <text class="iconfont icon-xiayibu"></text>
  111. </view>
  112. </view>
  113. <!--加载loadding-->
  114. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  115. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text="nomoreText"></tui-nomore>
  116. <!--加载loadding-->
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view
  122. class="distinguish-button"
  123. :style="{ paddingBottom: isIphoneX ? '68rpx' : '24rpx' }"
  124. v-if="orderList.length > 0"
  125. >
  126. <view class="button" @click="confirmDistinguish">确定</view>
  127. </view>
  128. </view>
  129. <!-- 弹窗 -->
  130. <tui-modal
  131. :show="modal"
  132. @click="handleClick"
  133. @cancel="hideMobel"
  134. :content="contentModalText"
  135. :button="modalButton"
  136. color="#666666"
  137. :padding="'20rpx 20rpx'"
  138. :size="30"
  139. shape="circle"
  140. :maskClosable="false"
  141. ></tui-modal>
  142. </view>
  143. </template>
  144. <script>
  145. import empty from '@/components/empty'
  146. import { mapState, mapMutations } from 'vuex'
  147. const defaultListQuery = {
  148. pageNum: 1, //页数
  149. pageSize: 10, //条数
  150. keyWord: ''
  151. }
  152. export default {
  153. components: {
  154. empty
  155. },
  156. data() {
  157. return {
  158. CustomBar: this.CustomBar, // 顶部导航栏高度
  159. isIphoneX: this.$store.state.isIphoneX,
  160. skeletonShow: true,
  161. listQuery: Object.assign({}, defaultListQuery),
  162. orderList: [],
  163. checkedOrderList: [],
  164. checkedIndex: '',
  165. scrollTop: 0,
  166. isEmpty: false,
  167. loadding: false,
  168. pullUpOn: true,
  169. hasNextPage: false,
  170. pullFlag: true,
  171. navbarHeight: '',
  172. nomoreText: '上拉显示更多',
  173. contentModalText: '', //操作文字提示语句
  174. modal: false,
  175. modal1: false,
  176. returnBrokerage: 0,
  177. confirmParams: {
  178. shopOrderId: 0,
  179. verbalAmount: '',
  180. rebateRemarks: ''
  181. },
  182. rightDrawer: false,
  183. hanldReceipt: {}, //储存监听收款信息
  184. handleOperId: 0, //操作类型
  185. height: 64, //header高度
  186. top: 0, //标题图标距离顶部距离
  187. scrollH: 0, //滚动总高度
  188. opcity: 1,
  189. rebateFee: 0,
  190. receiptAmount: 0,
  191. contentModalText: '',
  192. modal: false,
  193. modalButton: [
  194. {
  195. text: '确认',
  196. plain: false
  197. }
  198. ]
  199. }
  200. },
  201. onLoad(option) {
  202. this.receiptAmount = option.receiptAmount
  203. console.log('receiptAmount', this.receiptAmount)
  204. let obj = {}
  205. uni.getSystemInfo({
  206. success: res => {
  207. this.width = obj.left || res.windowWidth
  208. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  209. this.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6
  210. this.scrollH = res.windowWidth * 0.6
  211. }
  212. })
  213. },
  214. computed: {
  215. ...mapState(['hasLogin'])
  216. },
  217. methods: {
  218. orderNoReceiptShoporderList() {
  219. // 收款详情-订单列表
  220. this.initListQuery()
  221. this.OrderService.orderNoReceiptShoporderList(this.listQuery)
  222. .then(response => {
  223. let data = response.data
  224. this.hasNextPage = response.data.hasNextPage
  225. if (data.list && data.list.length > 0) {
  226. this.isEmpty = false
  227. this.orderList = data.list.map((el, index) => {
  228. el.isChecked = false
  229. return el
  230. })
  231. this.pullFlag = false
  232. setTimeout(() => {
  233. this.pullFlag = true
  234. }, 500)
  235. if (this.hasNextPage) {
  236. this.pullUpOn = false
  237. this.nomoreText = '上拉显示更多'
  238. } else {
  239. if (this.orderList.length < 3) {
  240. this.pullUpOn = true
  241. this.loadding = false
  242. } else {
  243. this.pullUpOn = false
  244. this.loadding = false
  245. this.nomoreText = '已至底部'
  246. }
  247. }
  248. } else {
  249. this.isEmpty = true
  250. }
  251. this.skeletonShow = false
  252. })
  253. .catch(err => {
  254. this.$util.msg(err.msg, 2000)
  255. })
  256. },
  257. getOnReachBottomData(index) {
  258. //上拉加载
  259. this.listQuery.pageNum += 1
  260. this.OrderService.orderNoReceiptShoporderList(this.listQuery)
  261. .then(response => {
  262. let data = response.data
  263. if (data.list && data.list.length > 0) {
  264. this.hasNextPage = data.hasNextPage
  265. let list = data.list.map((el, index) => {
  266. el.isChecked = false
  267. return el
  268. })
  269. this.orderList = this.orderList.concat(list)
  270. this.pullFlag = false // 防上拉暴滑
  271. setTimeout(() => {
  272. this.pullFlag = true
  273. }, 500)
  274. if (this.hasNextPage) {
  275. this.pullUpOn = false
  276. this.nomoreText = '上拉显示更多'
  277. } else {
  278. this.pullUpOn = false
  279. this.loadding = false
  280. this.nomoreText = '已至底部'
  281. }
  282. }
  283. })
  284. .catch(error => {
  285. this.$util.msg(error.msg, 2000)
  286. })
  287. },
  288. subMitSearch() {
  289. // 确认搜索
  290. this.orderNoReceiptShoporderList()
  291. },
  292. confirmDistinguish() {
  293. // 点击确认
  294. const list = []
  295. this.checkedOrderList.forEach(el => {
  296. if (list.indexOf(el.userId) == -1) {
  297. list.push(el.userId)
  298. }
  299. })
  300. if (this.confirmParams.shopOrderId == 0) {
  301. this.$util.msg('请选择订单!', 2000)
  302. return
  303. }
  304. if (this.receiptAmount != this.rebateFee) {
  305. this.modal = true
  306. this.contentModalText = '收款金额不等于该订单的返佣服务费,请修改服务费后再关联!'
  307. return
  308. }
  309. // 带参数返回
  310. var pages = getCurrentPages()
  311. var prevPage = pages[pages.length - 2] //上一个页面
  312. prevPage.setData({ select: 'select' })
  313. uni.navigateBack()
  314. },
  315. checkedOrder(order, index) {
  316. // 勾选关联订单
  317. this.checkedIndex = index
  318. this.orderList.forEach((el, index) => {
  319. if (this.checkedIndex == index) {
  320. el.isChecked = true
  321. this.confirmParams.shopOrderId = el.shopOrderId
  322. this.rebateFee = el.rebateFee
  323. this.returnBrokerage = el.brokerage
  324. uni.setStorageSync('selectOrder', el)
  325. } else {
  326. el.isChecked = false
  327. }
  328. })
  329. console.log('shopOrderId', this.confirmParams.shopOrderId)
  330. console.log('returnBrokerage', this.returnBrokerage)
  331. },
  332. orderDetail(orderId) {
  333. //订单详情跳转
  334. this.$api.navigateTo(`/pages/relation/order/detail?orderId=${orderId}`)
  335. },
  336. initListQuery() {
  337. // 初始化
  338. this.orderList = []
  339. this.loadding = true
  340. this.pullUpOn = true
  341. this.listQuery.pageNum = 1
  342. },
  343. handleClick() {
  344. this.modal = false
  345. },
  346. hideMobel() {
  347. this.modal = false
  348. }
  349. },
  350. onPageScroll(e) {
  351. //实时获取到滚动的值
  352. if (e.scrollTop > 30) {
  353. this.isCmcustomClass = 'fiexd'
  354. } else {
  355. this.isCmcustomClass = 'left'
  356. }
  357. if (e.scrollTop > 180) {
  358. this.isShowHeader = true
  359. } else {
  360. this.isShowHeader = false
  361. }
  362. },
  363. onReachBottom() {
  364. if (this.hasNextPage) {
  365. this.loadding = true
  366. this.pullUpOn = true
  367. this.getOnReachBottomData()
  368. }
  369. },
  370. onPullDownRefresh() {
  371. setTimeout(() => {
  372. this.orderNoReceiptShoporderList()
  373. uni.stopPullDownRefresh()
  374. }, 200)
  375. },
  376. onShow() {
  377. this.orderNoReceiptShoporderList()
  378. }
  379. }
  380. </script>
  381. <style lang="scss">
  382. @import '@/uni.scss';
  383. page {
  384. background: #f7f7f7;
  385. }
  386. .tui-header-box {
  387. width: 100%;
  388. background: #ffffff;
  389. z-index: 999;
  390. position: fixed;
  391. top: 0;
  392. left: 0;
  393. background-size: cover;
  394. background-image: url(https://static.caimei365.com/app/crm/image/statistic_bg2.png);
  395. &.fiexd {
  396. }
  397. &.first {
  398. }
  399. }
  400. .header-top {
  401. width: 100%;
  402. font-size: 16px;
  403. font-weight: 500;
  404. height: 32px;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. position: relative;
  409. padding: 0 40rpx;
  410. }
  411. .header-sit {
  412. width: 100%;
  413. box-sizing: border-box;
  414. height: 80rpx;
  415. line-height: 80rpx;
  416. box-sizing: border-box;
  417. color: #ffffff;
  418. .header-sit-text {
  419. text-align: left;
  420. font-size: $font-size-40;
  421. font-weight: 600;
  422. font-family: '正楷';
  423. }
  424. .icon-fanhui {
  425. display: block;
  426. width: 80rpx;
  427. height: 80rpx;
  428. float: left;
  429. text-align: center;
  430. line-height: 80rpx;
  431. font-size: 42rpx;
  432. }
  433. }
  434. .tui-header-tabs {
  435. width: 100%;
  436. height: auto;
  437. margin-bottom: 40rpx;
  438. padding: 20rpx 24rpx;
  439. background: #ffffff;
  440. box-sizing: border-box;
  441. position: fixed;
  442. z-index: 999;
  443. box-shadow: 0 10rpx 10rpx 0 rgba(86, 119, 252, 0.2);
  444. .tui-header-tabmain {
  445. width: 100%;
  446. height: 70rpx;
  447. float: left;
  448. position: relative;
  449. .input {
  450. width: 100%;
  451. height: 70rpx;
  452. box-sizing: border-box;
  453. padding: 0 20rpx;
  454. padding-left: 70rpx;
  455. background: #f7f7f7;
  456. border-radius: 8rpx;
  457. font-size: $font-size-26;
  458. }
  459. .icon-sousuo {
  460. width: 80rpx;
  461. height: 70rpx;
  462. display: block;
  463. line-height: 70rpx;
  464. text-align: center;
  465. color: #999999;
  466. font-size: $font-size-38;
  467. position: absolute;
  468. left: 0;
  469. top: 0;
  470. }
  471. }
  472. .button-content {
  473. width: 100%;
  474. height: auto;
  475. float: left;
  476. position: relative;
  477. .btn {
  478. height: 64rpx;
  479. padding: 0 20rpx;
  480. margin: 10rpx 0 0 0;
  481. line-height: 64rpx;
  482. font-size: $font-size-26;
  483. text-align: center;
  484. border-radius: 6rpx;
  485. float: right;
  486. }
  487. .btn-confirm {
  488. background-color: #ff5000;
  489. color: #ffffff;
  490. }
  491. }
  492. }
  493. .distinguish-button {
  494. width: 100%;
  495. position: fixed;
  496. bottom: 0;
  497. left: 0;
  498. z-index: 9999;
  499. background-color: #ffffff;
  500. padding: 0 50rpx;
  501. padding-top: 20rpx;
  502. .button {
  503. width: 100%;
  504. height: 80rpx;
  505. background: $btn-confirm;
  506. border-radius: 40rpx;
  507. text-align: center;
  508. color: #ffffff;
  509. line-height: 80rpx;
  510. font-size: $font-size-28;
  511. box-shadow: 0 10rpx 14rpx 0 rgba(86, 119, 252, 0.2);
  512. }
  513. }
  514. .user-section {
  515. position: absolute;
  516. width: 100%;
  517. }
  518. .header-content {
  519. width: 100%;
  520. height: auto;
  521. position: relative;
  522. background-color: #f7f7f7;
  523. }
  524. .tui-order-list {
  525. margin-top: 24rpx;
  526. width: 100%;
  527. position: relative;
  528. box-sizing: border-box;
  529. padding: 0 20rpx;
  530. }
  531. .tui-order-content {
  532. width: 100%;
  533. height: auto;
  534. }
  535. .tui-order-item {
  536. display: flex;
  537. flex-direction: column;
  538. width: 100%;
  539. padding: 20rpx 20rpx;
  540. background: #fff;
  541. margin-bottom: 24rpx;
  542. border-radius: 8rpx;
  543. position: relative;
  544. .list-checked {
  545. width: 80rpx;
  546. height: 80rpx;
  547. line-height: 80rpx;
  548. text-align: center;
  549. position: absolute;
  550. right: 0;
  551. top: 0;
  552. .iconfont {
  553. font-size: 38rpx;
  554. color: $color-system;
  555. }
  556. }
  557. .list-detail {
  558. width: 70rpx;
  559. height: 80rpx;
  560. line-height: 80rpx;
  561. text-align: center;
  562. position: absolute;
  563. right: 0;
  564. bottom: 0;
  565. .iconfont {
  566. font-size: $font-size-32;
  567. color: #999999;
  568. }
  569. }
  570. }
  571. .list-title {
  572. width: 100%;
  573. height: auto;
  574. .list-title-t {
  575. width: 100%;
  576. height: 50rpx;
  577. float: left;
  578. font-size: $font-size-24;
  579. padding-bottom: 10rpx;
  580. .list-title-tip {
  581. float: left;
  582. .badges {
  583. display: block;
  584. float: left;
  585. padding: 0 15rpx;
  586. height: 40rpx;
  587. line-height: 40rpx;
  588. border-radius: 20rpx;
  589. background: rgba(248, 204, 148, 0.5);
  590. font-size: $font-size-24;
  591. text-align: center;
  592. color: #666666;
  593. }
  594. }
  595. .list-title-tag {
  596. float: left;
  597. margin-left: 20rpx;
  598. .badges {
  599. display: block;
  600. float: left;
  601. padding: 0 15rpx;
  602. height: 40rpx;
  603. line-height: 40rpx;
  604. border-radius: 20rpx;
  605. background: linear-gradient(270deg, #fee9ba 0%, #f0cb72 100%);
  606. font-size: $font-size-24;
  607. text-align: center;
  608. color: #666666;
  609. }
  610. }
  611. .list-title-num {
  612. float: left;
  613. text-align: left;
  614. color: #42b983;
  615. line-height: 40rpx;
  616. margin-left: 20rpx;
  617. }
  618. }
  619. .list-title-a {
  620. width: 100%;
  621. height: auto;
  622. float: left;
  623. padding: 5rpx 8rpx;
  624. border-radius: 4rpx;
  625. background-color: rgba(247, 247, 247, 1);
  626. margin-bottom: 10rpx;
  627. .text {
  628. color: #999999;
  629. }
  630. .list-title-a-text {
  631. width: 100%;
  632. height: 44rpx;
  633. float: left;
  634. font-size: $font-size-24;
  635. line-height: 44rpx;
  636. color: #666666;
  637. text-align: left;
  638. }
  639. }
  640. .list-title-b {
  641. width: 100%;
  642. height: 44rpx;
  643. float: left;
  644. font-size: $font-size-24;
  645. line-height: 44rpx;
  646. color: #666666;
  647. text-align: left;
  648. .text {
  649. color: #999999;
  650. }
  651. .list-title-b-item {
  652. width: 50%;
  653. height: 100%;
  654. float: left;
  655. }
  656. &.sms {
  657. height: auto;
  658. }
  659. }
  660. }
  661. .tui-prompt-title {
  662. line-height: 44rpx;
  663. text-align: center;
  664. }
  665. .tui-prompt-input {
  666. width: 100%;
  667. height: 80rpx;
  668. box-sizing: border-box;
  669. background: #f7f7f7;
  670. border-radius: 8rpx;
  671. padding: 15rpx 20rpx;
  672. padding-left: 50rpx;
  673. margin: 20rpx 0;
  674. position: relative;
  675. .text {
  676. display: block;
  677. width: 50rpx;
  678. height: 80rpx;
  679. line-height: 80rpx;
  680. color: #666666;
  681. text-align: center;
  682. position: absolute;
  683. top: 0;
  684. left: 0;
  685. }
  686. .input {
  687. width: 100%;
  688. height: 100%;
  689. line-height: 80rpx;
  690. font-size: $font-size-26;
  691. color: $color-system;
  692. &.none {
  693. display: none;
  694. }
  695. }
  696. }
  697. .tui-prompt-flex {
  698. width: 100%;
  699. height: 70rpx;
  700. display: flex;
  701. margin-top: 20rpx;
  702. .btn {
  703. flex: 1;
  704. line-height: 70rpx;
  705. font-size: $font-size-26;
  706. text-align: center;
  707. color: #ffffff;
  708. border-radius: 33rpx;
  709. margin: 0 24rpx;
  710. &.btn-cancel {
  711. background: #f7f7f7;
  712. color: #999999;
  713. }
  714. &.btn-confirm {
  715. background: $color-system;
  716. }
  717. }
  718. }
  719. .tui-prompt-text {
  720. line-height: 44rpx;
  721. font-size: $font-size-26;
  722. color: #333333;
  723. .text {
  724. color: $color-system;
  725. }
  726. }
  727. </style>