myWholesale.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. this.loadAddress()
  287. },
  288. // 同意
  289. passPackage(item) {
  290. let index = this.navList[1].orderList.indexOf(item)
  291. console.log(index, 'index')
  292. packageAudit({
  293. re: '',
  294. id: item.id,
  295. status: 2
  296. }).then(res => {
  297. uni.showToast({
  298. title: '审核通过',
  299. duration: 2000
  300. });
  301. console.log(res)
  302. this.navList[1].orderList[index].status = 2
  303. // this.reload()
  304. })
  305. },
  306. closePup() {
  307. this.chooseImg = ''
  308. this.$refs.lookimg.close()
  309. },
  310. // 提货
  311. stopItem(item) {
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .navbar {
  318. background-color: #fff;
  319. height: 40px;
  320. .nav-item {
  321. width: 50%;
  322. text-align: center;
  323. font-size: 30rpx;
  324. font-family: PingFang SC;
  325. font-weight: 500;
  326. color: #333333;
  327. }
  328. .action {
  329. font-weight: bold;
  330. position: relative;
  331. color: #FF4C4C;
  332. &::after {
  333. content: '';
  334. width: 84rpx;
  335. height: 4rpx;
  336. background: #FF4C4C;
  337. border-radius: 2px;
  338. position: absolute;
  339. bottom: -20rpx;
  340. left: 0;
  341. right: 0;
  342. margin: auto;
  343. }
  344. }
  345. }
  346. .swiper-box {
  347. padding-top: 20rpx;
  348. // height: calc(100% - 40px);
  349. // background-color: red;
  350. }
  351. .list-scroll-content {
  352. height: 100%;
  353. }
  354. .order-item {
  355. display: flex;
  356. flex-direction: column;
  357. padding-left: 30rpx;
  358. background: #fff;
  359. margin-bottom: 16rpx;
  360. .i-top {
  361. display: flex;
  362. align-items: center;
  363. height: 80rpx;
  364. padding-right: 30rpx;
  365. font-size: $font-base;
  366. color: $font-color-dark;
  367. position: relative;
  368. .time {
  369. flex: 1;
  370. }
  371. .state {
  372. color: $base-color;
  373. }
  374. .del-btn {
  375. padding: 10rpx 0 10rpx 36rpx;
  376. font-size: $font-lg;
  377. color: $font-color-light;
  378. position: relative;
  379. &:after {
  380. content: '';
  381. width: 0;
  382. height: 30rpx;
  383. border-left: 1px solid $border-color-dark;
  384. position: absolute;
  385. left: 20rpx;
  386. top: 50%;
  387. transform: translateY(-50%);
  388. }
  389. }
  390. }
  391. /* 多条商品 */
  392. .goods-box {
  393. height: 160rpx;
  394. padding: 20rpx 0;
  395. white-space: nowrap;
  396. .goods-item {
  397. width: 120rpx;
  398. height: 120rpx;
  399. display: inline-block;
  400. margin-right: 24rpx;
  401. }
  402. .goods-img {
  403. display: block;
  404. width: 100%;
  405. height: 100%;
  406. }
  407. }
  408. /* 单条商品 */
  409. .goods-box-single {
  410. display: flex;
  411. padding: 20rpx 0;
  412. .goods-img {
  413. display: block;
  414. width: 120rpx;
  415. height: 120rpx;
  416. }
  417. .right {
  418. flex: 1;
  419. display: flex;
  420. flex-direction: column;
  421. padding: 0 30rpx 0 24rpx;
  422. overflow: hidden;
  423. .row {
  424. margin-top: 10rpx;
  425. }
  426. .row_title {
  427. padding: 5rpx 10rpx;
  428. background-color: #dddddd;
  429. border-radius: 10rpx;
  430. font-size: 22rpx;
  431. color: #ffffff;
  432. }
  433. .title {
  434. font-size: $font-base + 2rpx;
  435. color: $font-color-dark;
  436. line-height: 1;
  437. width: 80%;
  438. }
  439. .attr-box {
  440. display: flex;
  441. justify-content: flex-end;
  442. font-size: $font-sm + 2rpx;
  443. color: $font-color-light;
  444. }
  445. .price {
  446. display: inline;
  447. font-size: $font-base + 2rpx;
  448. color: $font-color-dark;
  449. &:before {
  450. content: '¥';
  451. font-size: $font-sm;
  452. }
  453. }
  454. }
  455. }
  456. .price-box {
  457. display: flex;
  458. justify-content: flex-end;
  459. align-items: baseline;
  460. padding: 20rpx 30rpx;
  461. font-size: $font-sm + 2rpx;
  462. color: $font-color-light;
  463. .num {
  464. margin: 0 8rpx;
  465. color: $font-color-dark;
  466. }
  467. .price {
  468. font-size: $font-lg;
  469. color: $font-color-dark;
  470. &:before {
  471. content: '¥';
  472. font-size: $font-sm;
  473. margin: 0 2rpx 0 8rpx;
  474. }
  475. }
  476. }
  477. .action-box {
  478. display: flex;
  479. justify-content: flex-end;
  480. align-items: center;
  481. height: 100rpx;
  482. position: relative;
  483. padding-right: 30rpx;
  484. }
  485. .action-btn {
  486. width: 160rpx;
  487. height: 60rpx;
  488. margin: 0;
  489. margin-left: 24rpx;
  490. padding: 0;
  491. text-align: center;
  492. line-height: 60rpx;
  493. font-size: $font-sm + 2rpx;
  494. color: $font-color-dark;
  495. background: #fff;
  496. border-radius: 100px;
  497. &:after {
  498. border-radius: 100px;
  499. }
  500. &.recom {
  501. color: $base-color;
  502. &:after {
  503. border-color: $base-color;
  504. }
  505. }
  506. &.evaluate {
  507. color: $color-yellow;
  508. &:after {
  509. border-color: $color-yellow;
  510. }
  511. }
  512. }
  513. }
  514. .out-wrapper {
  515. width: 690rpx;
  516. // height: 392rpx;
  517. background: #FFFFFF;
  518. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  519. border-radius: 20rpx;
  520. margin: 0 auto 20rpx;
  521. padding: 30rpx;
  522. position: relative;
  523. .outt {
  524. height: 392rpx;
  525. }
  526. .out-top {
  527. line-height: 46rpx;
  528. justify-content: space-between;
  529. .buy-info {
  530. width: 450rpx;
  531. font-size: 32rpx;
  532. font-family: PingFang SC;
  533. font-weight: bold;
  534. color: #0F253A;
  535. justify-content: flex-start;
  536. .fsz {
  537. flex-shrink: 0;
  538. }
  539. .user-name {
  540. max-width: 180rpx;
  541. }
  542. .user-phone {
  543. padding-left: 10rpx;
  544. font-size: 24rpx;
  545. font-family: PingFang SC;
  546. font-weight: 500;
  547. color: #999999;
  548. }
  549. .user-logo {
  550. display: block;
  551. width: 46rpx;
  552. height: 46rpx;
  553. border-radius: 50%;
  554. // background-color: red;
  555. // padding-right: 10rpx;
  556. margin-right: 10rpx;
  557. }
  558. }
  559. .buy-status {
  560. font-size: 26rpx;
  561. font-family: PingFang SC;
  562. font-weight: 500;
  563. color: #6D7C88;
  564. }
  565. }
  566. .item-info {
  567. width: 100%;
  568. margin-top: 28rpx;
  569. line-height: 50rpx;
  570. font-size: 26rpx;
  571. font-family: PingFang SC;
  572. display: flex;
  573. flex-wrap: wrap;
  574. .info-data {
  575. width: 100%;
  576. display: flex;
  577. .info-tit {
  578. font-weight: 500;
  579. color: #6D7C88;
  580. }
  581. .info-val {
  582. color: #0F253A;
  583. font-weight: bold;
  584. }
  585. }
  586. }
  587. .upimg {
  588. padding-top: 10rpx;
  589. display: flex;
  590. .up-tit {
  591. display: inline-block;
  592. font-size: 26rpx;
  593. font-family: PingFang SC;
  594. font-weight: 500;
  595. color: #6D7C88;
  596. }
  597. .img-wrap {
  598. width: 153rpx;
  599. height: 152rpx;
  600. border-radius: 20rpx;
  601. image {
  602. border-radius: 20rpx;
  603. width: 153rpx;
  604. height: 152rpx;
  605. background-color: #ccc;
  606. }
  607. }
  608. }
  609. .mc-btn {
  610. width: 144rpx;
  611. line-height: 50rpx;
  612. border-radius: 25px;
  613. background: #FFFFFF;
  614. font-size: 26rpx;
  615. font-family: PingFang SC;
  616. font-weight: 500;
  617. text-align: center;
  618. position: absolute;
  619. bottom: 47rpx;
  620. }
  621. .pass {
  622. color: #FF4C4C;
  623. border: 2px solid #FF4C4C;
  624. right: 36rpx;
  625. }
  626. .fail {
  627. color: #999999;
  628. border: 2px solid #EBEBEB;
  629. right: 36rpx;
  630. }
  631. }
  632. .pop-wrap {
  633. width: 522rpx;
  634. height: 800rpx;
  635. // background-color: red;
  636. }
  637. .popup-box {
  638. width: 522rpx;
  639. height: 800rpx;
  640. border-radius: 20rpx;
  641. position: relative;
  642. overflow: hidden;
  643. background-color: #fff;
  644. .popup-item {
  645. width: 100%;
  646. height: 100%;
  647. image {
  648. width: 100%;
  649. // height: 100%;
  650. }
  651. }
  652. }
  653. .close {
  654. display: block;
  655. width: 40rpx;
  656. height: 40rpx;
  657. border: 50%;
  658. position: absolute;
  659. // background-color: red;
  660. bottom: -100rpx;
  661. left: 0;
  662. right: 0;
  663. margin: 0 auto;
  664. }
  665. </style>