myWholesale.vue 16 KB

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