delivery.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(itemn, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ itemn.text }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" :style="{ height: height}"
  8. @change="changeTab">
  9. <swiper-item v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  10. <scroll-view scroll-y="true" :style="{ height: height}" style="padding-top: 20rpx;"
  11. @scrolltolower="loadData()">
  12. <empty v-if="navList[tabCurrentIndex].goodList.length === 0"></empty>
  13. <view class="good" v-for="item in tabItem.goodList">
  14. <view class="good-top">
  15. <view class="top-num">订单编号:{{ item.order_id }}</view>
  16. <view class="top-status" v-if="tabCurrentIndex == 2">{{item.shipping_type == 1?'外送': '自提'}}
  17. </view>
  18. </view>
  19. <view class="goods-buttom" v-for="itemt in item._info">
  20. <view class="good-img">
  21. <image :src="itemt.cart_info.productInfo.image" mode=""></image>
  22. </view>
  23. <view class="good-infos">
  24. <view class="good-title clamp">{{ itemt.cart_info.productInfo.store_name }}</view>
  25. <view class="good-tag">{{ itemt.cart_info.productInfo.suk}}</view>
  26. <view class="num" style="display: inline-block;padding-left: 10rpx;">
  27. x{{ itemt.cart_info.cart_num }}
  28. </view>
  29. <view class="good-price">
  30. ¥{{itemt.cart_info.productInfo.price}}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="fh-btn-wrap" v-if="tabCurrentIndex != 3">
  35. <view class="fh-btn-tit">
  36. 收货信息
  37. </view>
  38. <view class="fh-btn-info">
  39. <view class="">
  40. 收货人:<text>{{item.real_name}}</text>
  41. </view>
  42. <view class="" v-if="item.shipping_type == 1">
  43. 配送费:<text>¥{{(item.pay_postage_sh*1 + item.pay_postage*1) | getMoneyStyle}}</text>
  44. </view>
  45. <view class="">
  46. 联系方式:<text>{{item.user_phone}}</text>
  47. </view>
  48. <view class="">
  49. {{item.shipping_type == 1?'配送时间': '自提时间'}}:<text>{{item.time_area || '暂无'}}</text>
  50. </view>
  51. <view class="" v-if="item.shipping_type == 1">
  52. 收货地址:<text>{{ item.user_address}}</text>
  53. </view>
  54. </view>
  55. <view class="fh-btn" @click="delivery(item)" v-if="tabCurrentIndex == 0">
  56. 送货
  57. </view>
  58. </view>
  59. <view class="fh-btn-wrap" v-if="tabCurrentIndex == 3">
  60. <view class="fh-btn-tit">
  61. 购买信息
  62. </view>
  63. <view class="fh-btn-info">
  64. <view class="">
  65. 购买人:<text>{{item.nickname}}</text>
  66. </view>
  67. <view class="">
  68. 下单时间:<text>{{item.add_time}}</text>
  69. </view>
  70. <view class="" v-if="item.verify_time">
  71. 核销时间:<text>{{item.verify_time | time}}</text>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="fh-btn-wrap" v-if="tabCurrentIndex != 0 && item.shipping_type == 1">
  76. <view class="fh-btn-tit">
  77. 送货信息
  78. </view>
  79. <view class="fh-btn-info">
  80. <view class="">
  81. 送货人:<text>{{item.delivery_name}}</text>
  82. </view>
  83. <view class="">
  84. 联系方式:<text>{{item.delivery_id}}</text>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="fh-btn-wrap" v-if="item.shipping_type == 2 && item.point.name">
  89. <view class="fh-btn-tit">
  90. 自提点信息
  91. </view>
  92. <view class="fh-btn-info">
  93. <view class="">
  94. 自提点:<text>{{item.point.name}}</text>
  95. </view>
  96. <view class="">
  97. 详细地址:<text>{{item.point.detailed_address}}</text>
  98. </view>
  99. <view class="">
  100. 联系方式:<text>{{item.point.phone}}</text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <uni-load-more :status="loadingType"></uni-load-more>
  106. </scroll-view>
  107. </swiper-item>
  108. </swiper>
  109. <uni-popup ref="popuphx" class="agree-wrapper">
  110. <view class="hx-wrapper">
  111. <view class="hx-img">
  112. <image src="../../static/img/hxbg.png" mode=""></image>
  113. </view>
  114. <view class="hx-body">
  115. <!-- <template v-if="isAuto">
  116. <picker @change="bindPickerChange" :range="chooseList">
  117. <input type="text" v-model="shrname" placeholder="姓名: 请选择送货人"
  118. placeholder-class="hx-placeholder" disabled />
  119. <input type="text" v-model="shrphone" placeholder="手机号: 暂未选择送货人"
  120. placeholder-class="hx-placeholder" disabled />
  121. </picker>
  122. </template> -->
  123. <!-- <template v-if="!isAuto"> -->
  124. <picker @change="bindPickerChange" :range="chooseList">
  125. <view class="hx-btn" style="margin-top: 10rpx;margin-bottom: 20rpx;">
  126. 下拉选择
  127. </view>
  128. </picker>
  129. <input type="text" v-model="shrname" placeholder="姓名: 请输入送货人" placeholder-class="hx-placeholder" />
  130. <input type="text" v-model="shrphone" placeholder="手机号: 请输入手机号"
  131. placeholder-class="hx-placeholder" />
  132. <!-- </template> -->
  133. <!-- <view class="hx-btn" @click="changeAuto" style="color: #901b21;background-color: #fff;border: 1px solid #901b21;">
  134. {{isAuto?'切换手动':'切换列表'}}
  135. </view> -->
  136. <view class="hx-btn" @click="qrsh">
  137. 立即送货
  138. </view>
  139. </view>
  140. <view class="hx-close" @click="close">
  141. <image src="../../static/icon/close.png" mode=""></image>
  142. </view>
  143. </view>
  144. </uni-popup>
  145. </view>
  146. </template>
  147. <script>
  148. import {
  149. orderData,
  150. getUserInfo,
  151. getSpreadCount,
  152. bindAdmin,
  153. orderVerific,
  154. getAllList,
  155. getSHY
  156. } from '@/api/user.js';
  157. import {
  158. delivery,
  159. getAdminExchangeList
  160. } from '@/api/order.js';
  161. import {
  162. getMoneyStyle
  163. } from '@/utils/rocessor.js';
  164. import empty from '@/components/empty';
  165. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  166. export default {
  167. components: {
  168. empty,
  169. uniPopup
  170. },
  171. onReady() {
  172. var obj = this;
  173. uni.getSystemInfo({
  174. success: resu => {
  175. const query = uni.createSelectorQuery();
  176. query.select('.swiper-box').boundingClientRect();
  177. query.exec(function(res) {
  178. console.log(res, 'ddddddddddddd');
  179. obj.height = resu.windowHeight - res[0].top + 'px';
  180. console.log('打印页面的剩余高度', obj.height);
  181. });
  182. },
  183. fail: res => {}
  184. });
  185. },
  186. filters: {
  187. getMoneyStyle,
  188. time(val) {
  189. let str = ''
  190. let obj = this
  191. function add0(m) {
  192. return m < 10 ? '0' + m : m
  193. }
  194. if (val) {
  195. let time = new Date(val * 1000);
  196. let y = time.getFullYear();
  197. let m = time.getMonth() + 1;
  198. let d = time.getDate();
  199. let h = time.getHours();
  200. let mm = time.getMinutes();
  201. let s = time.getSeconds();
  202. str = y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
  203. }
  204. return str
  205. }
  206. },
  207. data() {
  208. return {
  209. isAuto: false,
  210. height: '',
  211. tabCurrentIndex: 0,
  212. navList: [{
  213. text: '待送货',
  214. status: 1,
  215. loadingType: 'more',
  216. page: 1,
  217. limit: 10,
  218. goodList: [],
  219. loaded: false
  220. },
  221. {
  222. text: '待收货',
  223. status: 2, //已支付,待收货
  224. loadingType: 'more',
  225. page: 1,
  226. limit: 10,
  227. goodList: [],
  228. loaded: false
  229. },
  230. {
  231. text: '已完成',
  232. status: 3,
  233. loadingType: 'more',
  234. page: 1,
  235. limit: 10,
  236. goodList: [],
  237. loaded: false
  238. },
  239. {
  240. text: '兑换券',
  241. status: 1,
  242. loadingType: 'more',
  243. page: 1,
  244. limit: 10,
  245. goodList: [],
  246. loaded: false
  247. }
  248. ],
  249. // loadingType: 'more',
  250. // page: 1,
  251. // limit: 40,
  252. // goodList: [],
  253. shrname: '',
  254. shrphone: '',
  255. choosItem: {
  256. order_id: 0
  257. },
  258. shrList: [],
  259. chooseList: []
  260. }
  261. },
  262. onLoad() {
  263. this.loadData()
  264. this.getSHY()
  265. },
  266. methods: {
  267. changeAuto() {
  268. this.isAuto = !this.isAuto
  269. },
  270. //swiper 切换
  271. changeTab(e) {
  272. this.tabCurrentIndex = e.target.current;
  273. this.loadData('tab');
  274. },
  275. //swiper 切换
  276. changeTab(e) {
  277. this.tabCurrentIndex = e.target.current;
  278. this.loadData('tab');
  279. },
  280. //顶部tab点击
  281. tabClick(index) {
  282. this.tabCurrentIndex = index;
  283. this.loadData('tab');
  284. },
  285. bindPickerChange(e) {
  286. console.log(e.detail.value)
  287. this.shrname = this.shrList[e.detail.value].name
  288. this.shrphone = this.shrList[e.detail.value].phone
  289. },
  290. getSHY() {
  291. getSHY().then(({
  292. data
  293. }) => {
  294. // console.log(res)
  295. this.shrList = data.data
  296. console.log(this.shrList, 'this.shrList')
  297. this.shrList.forEach(e => {
  298. this.chooseList.push(e.name)
  299. })
  300. })
  301. },
  302. // 立即送货
  303. qrsh() {
  304. let obj = this
  305. delivery({
  306. order_id: obj.choosItem.order_id,
  307. delivery_type: 'send',
  308. delivery_name: obj.shrname,
  309. delivery_id: obj.shrphone,
  310. }).then(res => {
  311. console.log(res, '发货成功')
  312. uni.showToast({
  313. title: '发货成功',
  314. duration: 2000
  315. });
  316. let s = obj.navList[obj.tabCurrentIndex].goodList.indexOf(obj.choosItem);
  317. obj.navList[obj.tabCurrentIndex].goodList.splice(s, 1);
  318. obj.close()
  319. })
  320. },
  321. // 关闭弹窗
  322. close() {
  323. this.$refs.popuphx.close()
  324. },
  325. // 保存发货订单信息
  326. delivery(item) {
  327. // this.choosItem = item
  328. this.$set(this, 'choosItem', item)
  329. this.$refs.popuphx.open()
  330. },
  331. loadData(tab) {
  332. let obj = this
  333. let index = obj.tabCurrentIndex
  334. let navItem = obj.navList[index]
  335. if (navItem.loadingType == 'loading') {
  336. return
  337. }
  338. if (navItem.loadingType == 'noMore') {
  339. return
  340. }
  341. if (tab == 'tab' && navItem.loaded) {
  342. return
  343. }
  344. navItem.loadingType = 'loading'
  345. if (index == 3) {
  346. getAdminExchangeList({
  347. status: navItem.status,
  348. limit: navItem.limit,
  349. page: navItem.page
  350. }).then(({
  351. data
  352. }) => {
  353. navItem.page++
  354. navItem.goodList = navItem.goodList.concat(data)
  355. console.log(data.length)
  356. if (navItem.limit == data.length) {
  357. navItem.loadingType = 'more'
  358. // return
  359. } else {
  360. navItem.loadingType = 'noMore'
  361. }
  362. obj.$set(navItem, 'loaded', true)
  363. })
  364. } else {
  365. getAllList({
  366. status: navItem.status,
  367. limit: navItem.limit,
  368. page: navItem.page
  369. }).then(({
  370. data
  371. }) => {
  372. navItem.page++
  373. navItem.goodList = navItem.goodList.concat(data)
  374. console.log(data.length)
  375. if (navItem.limit == data.length) {
  376. navItem.loadingType = 'more'
  377. // return
  378. } else {
  379. navItem.loadingType = 'noMore'
  380. }
  381. obj.$set(navItem, 'loaded', true)
  382. })
  383. }
  384. },
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .good {
  390. width: 702rpx;
  391. // height: 304rpx;
  392. background: #ffffff;
  393. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  394. border-radius: 10rpx;
  395. padding: 0 30rpx 20rpx;
  396. margin: 0 auto 20rpx;
  397. position: relative;
  398. .good-top {
  399. height: 85rpx;
  400. font-size: 24rpx;
  401. font-weight: 400;
  402. color: #666666;
  403. line-height: 85rpx;
  404. display: flex;
  405. justify-content: space-between;
  406. .top-status {
  407. font-size: 28rpx;
  408. font-weight: 500;
  409. color: #EF041F;
  410. }
  411. }
  412. .goods-buttom {
  413. height: 160rpx;
  414. margin-bottom: 10rpx;
  415. display: flex;
  416. position: relative;
  417. .good-img {
  418. width: 160rpx;
  419. height: 160rpx;
  420. // overflow: hidden;
  421. image {
  422. width: 160rpx;
  423. height: 160rpx;
  424. }
  425. }
  426. .good-title {
  427. width: 350rpx;
  428. padding-top: 6rpx;
  429. font-size: 26rpx;
  430. font-weight: 500;
  431. color: #3F454B;
  432. line-height: 1;
  433. padding-left: 10rpx;
  434. }
  435. .shop-info {
  436. padding-top: 11rpx;
  437. font-size: 24rpx;
  438. font-weight: 500;
  439. color: #DCB876;
  440. line-height: 1;
  441. // padding-left: 10rpx;
  442. image {
  443. width: 24rpx;
  444. height: 24rpx;
  445. margin-left: 14rpx;
  446. margin-right: 4rpx;
  447. }
  448. }
  449. .good-tag {
  450. display: inline-block;
  451. height: 36rpx;
  452. background: #ffeee9;
  453. // opacity: 0.2;
  454. border-radius: 5rpx;
  455. font-size: 20rpx;
  456. font-weight: 500;
  457. color: #F23030;
  458. padding: 0 9rpx;
  459. line-height: 36rpx;
  460. margin-top: 15rpx;
  461. margin-left: 10rpx;
  462. }
  463. .num {
  464. // position: absolute;
  465. // top: 10rpx;
  466. // right: 10rpx;
  467. color: #999999;
  468. font-size: 24rpx;
  469. }
  470. .good-price {
  471. display: inline-block;
  472. position: absolute;
  473. top: 5rpx;
  474. right: 10rpx;
  475. color: #999999;
  476. font-size: 24rpx;
  477. }
  478. }
  479. .fh-btn-wrap {
  480. display: flex;
  481. // height: 55rpx;
  482. flex-direction: column;
  483. // justify-content: flex-end;
  484. // width: ;
  485. font-size: 28rpx;
  486. color: #999999;
  487. .fh-btn-tit {
  488. color: #000000;
  489. font-weight: bold;
  490. }
  491. .fh-btn-info {
  492. padding-left: 20rpx;
  493. }
  494. .fh-btn {
  495. margin-top: 10rpx;
  496. align-self: flex-end;
  497. width: 144rpx;
  498. height: 55rpx;
  499. border: 1px solid #901b21;
  500. border-radius: 28rpx;
  501. font-size: 26rpx;
  502. font-family: PingFang SC;
  503. font-weight: 500;
  504. color: #901b21;
  505. line-height: 55rpx;
  506. text-align: center;
  507. }
  508. }
  509. .good-hj {
  510. line-height: 1;
  511. height: 26rpx;
  512. font-size: 26rpx;
  513. font-weight: 500;
  514. color: #333333;
  515. text-align: right;
  516. }
  517. .good-num {
  518. text-align: left;
  519. font-size: 26rpx;
  520. font-weight: 500;
  521. line-height: 1;
  522. color: #333333;
  523. position: absolute;
  524. right: 31rpx;
  525. top: 136rpx;
  526. }
  527. }
  528. .hx-wrapper {
  529. width: 536rpx;
  530. height: 700rpx;
  531. position: relative;
  532. background-color: #fff;
  533. border-radius: 20rpx;
  534. .hx-img {
  535. width: 536rpx;
  536. height: 281rpx;
  537. image {
  538. width: 536rpx;
  539. height: 281rpx;
  540. }
  541. }
  542. .sr-btn {
  543. margin-top: 20rpx;
  544. display: inline-block;
  545. // width: 200rpx;
  546. padding: 0 10rpx;
  547. height: 50rpx;
  548. line-height: 50rpx;
  549. border-radius: 20rpx;
  550. border: 1px solid #901b21;
  551. font-size: 28rpx;
  552. }
  553. .hx-close {
  554. position: absolute;
  555. left: 243rpx;
  556. bottom: -80rpx;
  557. width: 52rpx;
  558. height: 52rpx;
  559. image {
  560. width: 52rpx;
  561. height: 52rpx;
  562. }
  563. }
  564. .hx-body {
  565. width: 536rpx;
  566. height: 349rpx;
  567. background-color: #fff;
  568. border-radius: 0 0 10rpx 10rpx;
  569. padding-top: 20rpx;
  570. .hx-title {
  571. width: 536rpx;
  572. font-size: 36rpx;
  573. font-weight: 500;
  574. color: #333333;
  575. line-height: 1;
  576. padding-top: 42rpx;
  577. text-align: center;
  578. }
  579. input {
  580. width: 439rpx;
  581. height: 68rpx;
  582. background: #eeddde;
  583. border-radius: 10rpx;
  584. margin: 0 auto 39rpx;
  585. padding-left: 26rpx;
  586. .hx-placeholder {
  587. font-size: 26rpx;
  588. font-weight: 500;
  589. color: #901b21;
  590. }
  591. }
  592. .hx-btn {
  593. margin: 20rpx auto 0;
  594. width: 353rpx;
  595. height: 71rpx;
  596. background: #901b21;
  597. border-radius: 34rpx;
  598. font-size: 36rpx;
  599. font-weight: 500;
  600. color: #F8F9F9;
  601. line-height: 71rpx;
  602. text-align: center;
  603. }
  604. }
  605. }
  606. .navbar {
  607. display: flex;
  608. height: 40px;
  609. padding: 0 5px;
  610. background: #fff;
  611. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  612. position: relative;
  613. z-index: 10;
  614. .nav-item {
  615. flex: 1;
  616. display: flex;
  617. justify-content: center;
  618. align-items: center;
  619. height: 100%;
  620. font-size: 15px;
  621. color: $font-color-dark;
  622. position: relative;
  623. &.current {
  624. color: $base-color;
  625. &:after {
  626. content: '';
  627. position: absolute;
  628. left: 50%;
  629. bottom: 0;
  630. transform: translateX(-50%);
  631. width: 44px;
  632. height: 0;
  633. border-bottom: 2px solid $base-color;
  634. }
  635. }
  636. }
  637. }
  638. </style>