myWholesale.vue 16 KB

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