myWholesale.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <view class="content">
  3. <view class="navbar flex">
  4. <view class="nav-item" v-for="(navitem,index) in navList" :class="{'action': index == tabCurrentIndex}"
  5. @click="navClick(index)">
  6. {{navitem.tit}}
  7. </view>
  8. </view>
  9. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="getMyPackage('tab')"
  10. :style="{'height': height}" disable-touch>
  11. <swiper-item class="tab-content" :style="{'height': height}">
  12. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="getMyPackage">
  13. <empty v-if="navList[0].loaded === true && navList[0].orderList.length === 0"></empty>
  14. <view @click="goToOrderDetail(item)" v-for="(item, index) in navList[0].orderList" :key="index"
  15. class="order-item">
  16. <view class="i-top b-b">
  17. <text class="time">订单编号:{{ item.order_id }}</text>
  18. <!-- :style="{ color: item.stateTipColor }" -->
  19. <text class="state">{{ item.status | statusTitle }}</text>
  20. <text v-if="item.status === 4" class="del-btn iconfont icondelete"
  21. @click="deleteOrder(index)"></text>
  22. </view>
  23. <view class="goods-box-single">
  24. <image class="goods-img" :src="item.whole.image" mode="scaleToFill"
  25. @click="lookimg(item.whole.image)"></image>
  26. <view class="right">
  27. <view class="flex-start" style="justify-content: space-between;">
  28. <text class="title clamp">{{ item.whole.title }}</text>
  29. <text class="price">{{ moneyNum(item.whole.price) }}</text>
  30. </view>
  31. <view class="row flex">
  32. <!-- <text class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text> -->
  33. <text class="attr-box"> x {{ item.whole.num }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="action-box b-t" v-if="item.status != 5">
  38. <button class="action-btn" @click.stop="lookMore(item)">查看详情</button>
  39. <button v-if="item.status == 0" class="action-btn recom"
  40. @click.stop="payNew(item)">立即支付</button>
  41. <button v-if="item.status >= 1" class="action-btn recom"
  42. @click.stop="stopItem(item)">提货</button>
  43. </view>
  44. </view>
  45. <uni-load-more :status="navList[0].loadingType"></uni-load-more>
  46. </scroll-view>
  47. </swiper-item>
  48. <swiper-item class="tab-content" :style="{'height': height}">
  49. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="getMyPackage">
  50. <empty v-if="navList[1].loaded === true && navList[1].orderList.length === 0"></empty>
  51. <view class="out-wrapper" v-for="item in navList[1].orderList" :class="{'outt': item.status == 2}">
  52. <view class="out-top flex">
  53. <view class="buy-info flex">
  54. <view class="fsz">买家:</view>
  55. <image :src="item.user.avatar" mode="" class="user-logo fsz"></image>
  56. <view class="user-name fsz clamp">{{item.user.real_name}}</view>
  57. <view class="user-phone fsz" @click="call(item.user.phone)">
  58. {{item.user.phone}}
  59. </view>
  60. </view>
  61. <view class="buy-status">{{item.status | statusTitle}}</view>
  62. </view>
  63. <view class="item-info">
  64. <view class="info-data">
  65. <view class="info-tit">编号:</view>
  66. <view class="info-val">{{item.order_id}}</view>
  67. </view>
  68. <view class="info-data">
  69. <view class="info-tit">价值:</view>
  70. <view class="info-val">{{item.price}}</view>
  71. </view>
  72. </view>
  73. <view class="upimg">
  74. <view class="up-tit">
  75. 打款凭证:
  76. </view>
  77. <view class="img-wrap" v-if="item.pay_evaluation" @click="lookimg(item.pay_evaluation)">
  78. <image :src="item.pay_evaluation" mode=""></image>
  79. </view>
  80. <view class="" style="color: #0F253A;font-weight: bold;font-size: 26rpx;" v-else>
  81. 买家未上传支付凭证
  82. </view>
  83. </view>
  84. <template v-if="item.status == 1">
  85. <view class="mc-btn pass" @click="passPackage(item)">
  86. 通过
  87. </view>
  88. <!-- <view class="mc-btn fail" @click="openrefuse(item)">
  89. 拒绝
  90. </view> -->
  91. </template>
  92. </view>
  93. <uni-load-more :status="navList[1].loadingType"></uni-load-more>
  94. </scroll-view>
  95. </swiper-item>
  96. </swiper>
  97. <uni-popup ref="lookimg" type="center">
  98. <view class="pop-wrap" style="position: relative;">
  99. <movable-area class="popup-box">
  100. <movable-view class="popup-item" :scale="true" direction="all">
  101. <image :src="chooseImg" mode="aspectFit"></image>
  102. </movable-view>
  103. </movable-area>
  104. <image src="../../static/icon/close.png" mode="" class="close" style="width: 80rpx;height: 80rpx;"
  105. @click="closePup"></image>
  106. </view>
  107. </uni-popup>
  108. </view>
  109. </template>
  110. <script>
  111. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  112. import empty from '@/components/empty';
  113. import {
  114. getMyPackage,
  115. getMySellout,
  116. packageAudit
  117. } from '@/api/whole.js'
  118. export default {
  119. components: {
  120. uniLoadMore,
  121. empty
  122. },
  123. data() {
  124. return {
  125. chooseImg: '', //查看大图的图
  126. chooseItem: {},
  127. height: '',
  128. tabCurrentIndex: 0,
  129. navList: [{
  130. tit: '当天预约',
  131. orderList: [],
  132. page: 1,
  133. limit: 10,
  134. loadingType: 'more',
  135. loaded: false,
  136. day: 'today',
  137. status: -4
  138. },
  139. {
  140. tit: '转售中',
  141. orderList: [],
  142. page: 1,
  143. limit: 10,
  144. loadingType: 'more',
  145. loaded: false,
  146. day: 'today',
  147. status: 0
  148. },
  149. ],
  150. }
  151. },
  152. onReady(res) {
  153. // 初始化获取页面宽度
  154. var _this = this;
  155. uni.getSystemInfo({
  156. success: resu => {
  157. const query = uni.createSelectorQuery();
  158. query.select('.swiper-box').boundingClientRect();
  159. query.exec(function(res) {
  160. _this.height = resu.windowHeight - res[0].top + 'px';
  161. console.log('打印页面的剩余高度', _this.height);
  162. });
  163. },
  164. fail: res => {}
  165. });
  166. },
  167. onLoad() {
  168. this.getMyPackage()
  169. },
  170. filters: {
  171. statusTitle(val) {
  172. let str = ''
  173. switch (val) {
  174. case -2:
  175. str = '支付超时'
  176. break;
  177. case -1:
  178. str = '拒绝'
  179. break;
  180. case 0:
  181. str = '待支付'
  182. break;
  183. case 1:
  184. str = '待审核'
  185. break;
  186. case 2:
  187. str = '已通过'
  188. break;
  189. case 3:
  190. str = '重新发放'
  191. break;
  192. case 4:
  193. str = '完成'
  194. break;
  195. default:
  196. str = ''
  197. break
  198. }
  199. return str
  200. }
  201. },
  202. methods: {
  203. // 查看大图
  204. lookimg(src) {
  205. console.log(src, 'chooseImg++++++')
  206. this.chooseImg = src
  207. this.$refs.lookimg.open()
  208. },
  209. // 查看详情
  210. lookMore(item) {
  211. this.chooseItem = item
  212. uni.navigateTo({
  213. url: '/pages/user/buySellDetail?type=look'
  214. })
  215. },
  216. // 立即支付
  217. payNew(item) {
  218. this.chooseItem = item
  219. uni.navigateTo({
  220. url: '/pages/user/buySellDetail?type=up'
  221. })
  222. },
  223. // 转换金额为数字
  224. moneyNum(value) {
  225. return +value;
  226. },
  227. navClick(index) {
  228. this.tabCurrentIndex = index
  229. // this.getMyPackage('tab')
  230. },
  231. getMyPackage(tab) {
  232. let obj = this
  233. let index = obj.tabCurrentIndex
  234. let navItem = obj.navList[index]
  235. if (navItem.loadingType == 'noMore' || navItem.loadingType == 'loading') {
  236. return
  237. }
  238. if (tab == 'tab' && navItem.loaded) {
  239. return
  240. }
  241. navItem.loadingType == 'loading'
  242. if (index == 0) {
  243. getMyPackage({
  244. page: navItem.page,
  245. limit: navItem.limit,
  246. data: navItem.day,
  247. status: navItem.status
  248. }).then(({
  249. data
  250. }) => {
  251. navItem.orderList = navItem.orderList.concat(data.data)
  252. navItem.page++
  253. if (navItem.limit == data.data.length) {
  254. navItem.loadingType = 'more'
  255. } else {
  256. navItem.loadingType = 'noMore'
  257. }
  258. navItem.loaded = true
  259. })
  260. }
  261. if (index == 1) {
  262. getMySellout({
  263. page: navItem.page,
  264. limit: navItem.limit,
  265. }).then(({
  266. data
  267. }) => {
  268. navItem.orderList = navItem.orderList.concat(data.data)
  269. navItem.page++
  270. if (navItem.limit == data.data.length) {
  271. navItem.loadingType = 'more'
  272. } else {
  273. navItem.loadingType = 'noMore'
  274. }
  275. navItem.loaded = true
  276. })
  277. }
  278. },
  279. //添加或修改成功之后回调
  280. refreshList() {
  281. // 重新加载地址
  282. let navItem = this.navList[this.tabCurrentIndex]
  283. navItem.orderList = []
  284. navItem.page = 1
  285. navItem.loadingType = 'more'
  286. navItem.loaded = false
  287. this.getMyPackage()
  288. },
  289. // 同意
  290. passPackage(item) {
  291. let index = this.navList[1].orderList.indexOf(item)
  292. console.log(index, 'index')
  293. packageAudit({
  294. re: '',
  295. id: item.id,
  296. status: 2
  297. }).then(res => {
  298. uni.showToast({
  299. title: '审核通过',
  300. duration: 2000
  301. });
  302. console.log(res)
  303. this.navList[1].orderList[index].status = 2
  304. // this.reload()
  305. })
  306. },
  307. closePup() {
  308. this.chooseImg = ''
  309. this.$refs.lookimg.close()
  310. },
  311. // 提货
  312. stopItem(item) {
  313. }
  314. }
  315. }
  316. </script>
  317. <style lang="scss" scoped>
  318. .navbar {
  319. background-color: #fff;
  320. height: 40px;
  321. .nav-item {
  322. width: 50%;
  323. text-align: center;
  324. font-size: 30rpx;
  325. font-family: PingFang SC;
  326. font-weight: 500;
  327. color: #333333;
  328. }
  329. .action {
  330. font-weight: bold;
  331. position: relative;
  332. color: #FF4C4C;
  333. &::after {
  334. content: '';
  335. width: 84rpx;
  336. height: 4rpx;
  337. background: #FF4C4C;
  338. border-radius: 2px;
  339. position: absolute;
  340. bottom: -20rpx;
  341. left: 0;
  342. right: 0;
  343. margin: auto;
  344. }
  345. }
  346. }
  347. .swiper-box {
  348. padding-top: 20rpx;
  349. // height: calc(100% - 40px);
  350. // background-color: red;
  351. }
  352. .list-scroll-content {
  353. height: 100%;
  354. }
  355. .order-item {
  356. display: flex;
  357. flex-direction: column;
  358. padding-left: 30rpx;
  359. background: #fff;
  360. margin-bottom: 16rpx;
  361. .i-top {
  362. display: flex;
  363. align-items: center;
  364. height: 80rpx;
  365. padding-right: 30rpx;
  366. font-size: $font-base;
  367. color: $font-color-dark;
  368. position: relative;
  369. .time {
  370. flex: 1;
  371. }
  372. .state {
  373. color: $base-color;
  374. }
  375. .del-btn {
  376. padding: 10rpx 0 10rpx 36rpx;
  377. font-size: $font-lg;
  378. color: $font-color-light;
  379. position: relative;
  380. &:after {
  381. content: '';
  382. width: 0;
  383. height: 30rpx;
  384. border-left: 1px solid $border-color-dark;
  385. position: absolute;
  386. left: 20rpx;
  387. top: 50%;
  388. transform: translateY(-50%);
  389. }
  390. }
  391. }
  392. /* 多条商品 */
  393. .goods-box {
  394. height: 160rpx;
  395. padding: 20rpx 0;
  396. white-space: nowrap;
  397. .goods-item {
  398. width: 120rpx;
  399. height: 120rpx;
  400. display: inline-block;
  401. margin-right: 24rpx;
  402. }
  403. .goods-img {
  404. display: block;
  405. width: 100%;
  406. height: 100%;
  407. }
  408. }
  409. /* 单条商品 */
  410. .goods-box-single {
  411. display: flex;
  412. padding: 20rpx 0;
  413. .goods-img {
  414. display: block;
  415. width: 120rpx;
  416. height: 120rpx;
  417. }
  418. .right {
  419. flex: 1;
  420. display: flex;
  421. flex-direction: column;
  422. padding: 0 30rpx 0 24rpx;
  423. overflow: hidden;
  424. .row {
  425. margin-top: 10rpx;
  426. }
  427. .row_title {
  428. padding: 5rpx 10rpx;
  429. background-color: #dddddd;
  430. border-radius: 10rpx;
  431. font-size: 22rpx;
  432. color: #ffffff;
  433. }
  434. .title {
  435. font-size: $font-base + 2rpx;
  436. color: $font-color-dark;
  437. line-height: 1;
  438. width: 80%;
  439. }
  440. .attr-box {
  441. display: flex;
  442. justify-content: flex-end;
  443. font-size: $font-sm + 2rpx;
  444. color: $font-color-light;
  445. }
  446. .price {
  447. display: inline;
  448. font-size: $font-base + 2rpx;
  449. color: $font-color-dark;
  450. &:before {
  451. content: '¥';
  452. font-size: $font-sm;
  453. }
  454. }
  455. }
  456. }
  457. .price-box {
  458. display: flex;
  459. justify-content: flex-end;
  460. align-items: baseline;
  461. padding: 20rpx 30rpx;
  462. font-size: $font-sm + 2rpx;
  463. color: $font-color-light;
  464. .num {
  465. margin: 0 8rpx;
  466. color: $font-color-dark;
  467. }
  468. .price {
  469. font-size: $font-lg;
  470. color: $font-color-dark;
  471. &:before {
  472. content: '¥';
  473. font-size: $font-sm;
  474. margin: 0 2rpx 0 8rpx;
  475. }
  476. }
  477. }
  478. .action-box {
  479. display: flex;
  480. justify-content: flex-end;
  481. align-items: center;
  482. height: 100rpx;
  483. position: relative;
  484. padding-right: 30rpx;
  485. }
  486. .action-btn {
  487. width: 160rpx;
  488. height: 60rpx;
  489. margin: 0;
  490. margin-left: 24rpx;
  491. padding: 0;
  492. text-align: center;
  493. line-height: 60rpx;
  494. font-size: $font-sm + 2rpx;
  495. color: $font-color-dark;
  496. background: #fff;
  497. border-radius: 100px;
  498. &:after {
  499. border-radius: 100px;
  500. }
  501. &.recom {
  502. color: $base-color;
  503. &:after {
  504. border-color: $base-color;
  505. }
  506. }
  507. &.evaluate {
  508. color: $color-yellow;
  509. &:after {
  510. border-color: $color-yellow;
  511. }
  512. }
  513. }
  514. }
  515. .out-wrapper {
  516. width: 690rpx;
  517. // height: 392rpx;
  518. background: #FFFFFF;
  519. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  520. border-radius: 20rpx;
  521. margin: 0 auto 20rpx;
  522. padding: 30rpx;
  523. position: relative;
  524. .outt {
  525. height: 392rpx;
  526. }
  527. .out-top {
  528. line-height: 46rpx;
  529. justify-content: space-between;
  530. .buy-info {
  531. width: 450rpx;
  532. font-size: 32rpx;
  533. font-family: PingFang SC;
  534. font-weight: bold;
  535. color: #0F253A;
  536. justify-content: flex-start;
  537. .fsz {
  538. flex-shrink: 0;
  539. }
  540. .user-name {
  541. max-width: 180rpx;
  542. }
  543. .user-phone {
  544. padding-left: 10rpx;
  545. font-size: 24rpx;
  546. font-family: PingFang SC;
  547. font-weight: 500;
  548. color: #999999;
  549. }
  550. .user-logo {
  551. display: block;
  552. width: 46rpx;
  553. height: 46rpx;
  554. border-radius: 50%;
  555. // background-color: red;
  556. // padding-right: 10rpx;
  557. margin-right: 10rpx;
  558. }
  559. }
  560. .buy-status {
  561. font-size: 26rpx;
  562. font-family: PingFang SC;
  563. font-weight: 500;
  564. color: #6D7C88;
  565. }
  566. }
  567. .item-info {
  568. width: 100%;
  569. margin-top: 28rpx;
  570. line-height: 50rpx;
  571. font-size: 26rpx;
  572. font-family: PingFang SC;
  573. display: flex;
  574. flex-wrap: wrap;
  575. .info-data {
  576. width: 100%;
  577. display: flex;
  578. .info-tit {
  579. font-weight: 500;
  580. color: #6D7C88;
  581. }
  582. .info-val {
  583. color: #0F253A;
  584. font-weight: bold;
  585. }
  586. }
  587. }
  588. .upimg {
  589. padding-top: 10rpx;
  590. display: flex;
  591. .up-tit {
  592. display: inline-block;
  593. font-size: 26rpx;
  594. font-family: PingFang SC;
  595. font-weight: 500;
  596. color: #6D7C88;
  597. }
  598. .img-wrap {
  599. width: 153rpx;
  600. height: 152rpx;
  601. border-radius: 20rpx;
  602. image {
  603. border-radius: 20rpx;
  604. width: 153rpx;
  605. height: 152rpx;
  606. background-color: #ccc;
  607. }
  608. }
  609. }
  610. .mc-btn {
  611. width: 144rpx;
  612. line-height: 50rpx;
  613. border-radius: 25px;
  614. background: #FFFFFF;
  615. font-size: 26rpx;
  616. font-family: PingFang SC;
  617. font-weight: 500;
  618. text-align: center;
  619. position: absolute;
  620. bottom: 47rpx;
  621. }
  622. .pass {
  623. color: #FF4C4C;
  624. border: 2px solid #FF4C4C;
  625. right: 36rpx;
  626. }
  627. .fail {
  628. color: #999999;
  629. border: 2px solid #EBEBEB;
  630. right: 36rpx;
  631. }
  632. }
  633. .pop-wrap {
  634. width: 522rpx;
  635. height: 800rpx;
  636. // background-color: red;
  637. }
  638. .popup-box {
  639. width: 522rpx;
  640. height: 800rpx;
  641. border-radius: 20rpx;
  642. position: relative;
  643. overflow: hidden;
  644. background-color: #fff;
  645. .popup-item {
  646. width: 100%;
  647. height: 100%;
  648. image {
  649. width: 100%;
  650. // height: 100%;
  651. }
  652. }
  653. }
  654. .close {
  655. display: block;
  656. width: 40rpx;
  657. height: 40rpx;
  658. border: 50%;
  659. position: absolute;
  660. // background-color: red;
  661. bottom: -100rpx;
  662. left: 0;
  663. right: 0;
  664. margin: 0 auto;
  665. }
  666. </style>