index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view class="flex-col" :style="{height: winHeight + 'px'}">
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar iconColor='#fff' ref="navBarRef" navTitle="代取快递" backgroundColor="#FF6702" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. <!-- #endif -->
  9. <!-- <view class='newsList tui-skeleton flex-col' style="background-color: #fff;flex: 1;"> -->
  10. <!-- <view class='nav'>
  11. <scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;">
  12. <block v-for="(item,index) in navList" :key="index">
  13. <view class='item borRadius14 tui-skeleton-rect' :class='active==item.id?"on":""' @click='tabSelect(item.id, index)'>
  14. <view class="line1">{{item.name}}</view>
  15. <view class='line bg_color' v-if="active==item.id"></view>
  16. </view>
  17. </block>
  18. </scroll-view>
  19. </view> -->
  20. <!-- banner轮播图 -->
  21. <view class="mb-10" v-if="bannerList.length">
  22. <swiper :indicator-dots="true" :autoplay="true" :interval="2500" :duration="500" circular="true">
  23. <block v-for="(item,index) in bannerList" :key='item.id'>
  24. <swiper-item>
  25. <view class="swiper-item">
  26. <image class="banner-img" :src="item.imageUrl" mode="widthFix" />
  27. </view>
  28. </swiper-item>
  29. </block>
  30. </swiper>
  31. </view>
  32. <navigator url="/pages/address/user_address_list/index">
  33. <view class="fast-top flex-between-center">
  34. <view>
  35. <view>送至:{{addressItem.province}}{{addressItem.city}}{{addressItem.district}}{{addressItem.street}}{{addressItem.detail}}</view>
  36. <view style="margin-top: 10rpx;">
  37. <text>{{addressItem.realName}}</text> 收 {{addressItem.phone}}
  38. </view>
  39. </view>
  40. <view>
  41. <text class="iconfont icon-jiantou"></text>
  42. </view>
  43. </view>
  44. </navigator>
  45. <!-- <navigator url="/pages/substitute_fast_mail/take_fast_mail/index"> -->
  46. <view class="flex-center fast-top" @tap="onAddFastMail">
  47. <view class="fast-jia">
  48. </view>
  49. <view>添加代取快递信息</view>
  50. </view>
  51. <!-- </navigator> -->
  52. <scroll-view scroll-y scroll-with-animation style="flex: 1;overflow: hidden;">
  53. <view class="fast-box" :class="index !== fastMailData.length - 1 ? 'qie-ge' : ''" v-for="(item, index) in fastMailData"
  54. :key="index">
  55. <view class="flex-between-center mb-20">
  56. <view>
  57. <view class="fast-yz">{{item.postName}}</view>
  58. <view class="fast-xx">{{item.addressDetail}}</view>
  59. </view>
  60. <view class="flex-y-center" @tap="makePhone(item.phone)">
  61. <image src="/static/img/phone.png" class="image2"/><text>联系驿站</text>
  62. </view>
  63. </view>
  64. <view class="fast-item" v-for="(value, key) in item.orderInfoList" :key="key">
  65. <view class="flex-between-center mb-20 ml-14" @click="onValRadio(value)">
  66. <radio class="radios" :checked="value.radio" color="#FF6702" />
  67. <view class="flex-y-center">
  68. <image style="width: 135rpx; height: 135rpx;border-radius: 30rpx;margin-right: 23rpx;" src="/static/img/ic-qu-chengse.png"></image>
  69. <view>
  70. <view class="fast-yz" style="font-weight: bold;">取件码 <text>{{value.pickUpCode}}</text></view>
  71. <view class="fast-xx">{{value.expressCompany}} {{value.expressNo}}</view>
  72. <view class="fast-yz">规格:{{value.spec}}</view>
  73. </view>
  74. </view>
  75. <view>
  76. <!-- <view class="fast-yz">134m</view> -->
  77. <view class="bg-color-cash">¥<text class="fast-cash">{{value.price}}</text></view>
  78. </view>
  79. </view>
  80. <view class="fast-remark">
  81. <view v-if="value.remark">备注:{{value.remark}}</view>
  82. <view class="flex-y-center" v-if="value.image" @click="lookImg(value.image)">
  83. <text>附图:</text>
  84. <image style="width: 38rpx; height: 38rpx;" src="/static/img/ic-figure.png"></image>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </scroll-view>
  90. <!-- <view class='list' style="flex: 1;">
  91. <template v-if="active == 1">
  92. </template>
  93. <template v-if="active == 2">
  94. <send-fast-mail></send-fast-mail>
  95. </template>
  96. </view> -->
  97. <view class="fast-tip flex-y-center">
  98. <!-- <radio :checked="radioArr" color="#FF6702" @tap="onRadioChang()" />全选 -->
  99. <view @tap="onRadioDel()"><text class="iconfont icon-shanchu mr-14"></text>删除</view>
  100. </view>
  101. <!--view class="flex-between-center fast-tip" @tap="isTip = true">
  102. <view class="remark-name">小费</view>
  103. <view class="flex-y-center">
  104. <text style="font-weight: 400;font-size: 27rpx;color: #646464;">{{giveTips}}</text>
  105. <view class='iconfont icon-jiantou' style="font-size: 30rpx;margin: 0 19rpx;"></view>
  106. </view>
  107. </view-->
  108. <!-- 购物车栏 begin -->
  109. <view class="cart-box">
  110. <view class="mark-box">
  111. <view class="mark">应付 ¥ <text style="font-size: 31rpx;">{{orderPrice}}</text></view>
  112. <view class="tips">普通用户 | 查看明细 》</view>
  113. </view>
  114. <button type="primary" class="pay-btn" @tap="toPay">
  115. 提交订单
  116. </button>
  117. </view>
  118. <!-- </view> -->
  119. <fast-mail-order v-if="isOrder" @onCancel="onCanCel"></fast-mail-order>
  120. <take-fast-mail v-if="isTake" :orderNo="preOrderNo" :addressObj="addressItem" @onTakeFastOk="onTakeChang" @onCancel="onCanCel"></take-fast-mail>
  121. <fast-mail-tip v-if="isTip" :value="giveTips" @tipValue="onTipValue" @onCancel="onCanCel"></fast-mail-tip>
  122. </view>
  123. </template>
  124. <script>
  125. // +----------------------------------------------------------------------
  126. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  127. // +----------------------------------------------------------------------
  128. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  129. // +----------------------------------------------------------------------
  130. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  131. // +----------------------------------------------------------------------
  132. // | Author: CRMEB Team <admin@crmeb.com>
  133. // +----------------------------------------------------------------------
  134. import navBar from '@/components/navBar';
  135. import animationType from '@/utils/animationType.js'
  136. import tuiSkeleton from '@/components/base/tui-skeleton.vue';
  137. import sendFastMail from '../components/send_fast_mail/index.vue'
  138. import takeFastMail from '../take_fast_mail/index.vue'
  139. import fastMailOrder from '../components/fast_mail_order/index.vue'
  140. import fastMailTip from '../components/fast_mail_tip/index.vue'
  141. import {
  142. preExpressApi,
  143. loadPreExpressApi,
  144. loadPreExpressDelApi,
  145. expressCreate,
  146. getExpressInfo
  147. } from '@/api/fastMail.js';
  148. import {
  149. getAddressDefault,
  150. getAddressExpressDefault
  151. } from '@/api/user.js';
  152. import orderPay from "@/mixins/OrderPay.js";
  153. import {
  154. Debounce
  155. } from '@/utils/validate.js'
  156. let app = getApp();
  157. export default {
  158. mixins: [orderPay],
  159. components: {
  160. tuiSkeleton,
  161. navBar,
  162. sendFastMail,
  163. fastMailOrder,
  164. takeFastMail,
  165. fastMailTip
  166. },
  167. data() {
  168. return {
  169. isOrder: false, // 提交快递订单弹窗
  170. isTake: false, // 新增快递弹窗
  171. isTip: false, // 小费弹窗
  172. giveTips: 0,
  173. winHeight: 0,
  174. isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
  175. autoplay: true,
  176. radioArr: false,
  177. radioDel: false,
  178. preOrderNo: '',
  179. navList: [{
  180. id: 1,
  181. name: '取快递',
  182. preOrderType: 'take'
  183. }, {
  184. id: 2,
  185. name: '寄快递',
  186. preOrderType: 'send'
  187. }],
  188. fastMailData: [],
  189. navListIndex: 0,
  190. active: 0,
  191. scrollLeft: 0,
  192. addressItem: {},
  193. orderPrice: 0,
  194. bannerList: []
  195. };
  196. },
  197. onLoad() {
  198. let that = this;
  199. uni.getSystemInfo({
  200. success: function(res) {
  201. that.winHeight = res.windowHeight
  202. },
  203. });
  204. getAddressDefault().then(res => {
  205. console.log('地址', res)
  206. this.addressItem = res.data || {}
  207. })
  208. getExpressInfo().then(res => {
  209. this.bannerList = res.data.banner
  210. })
  211. // this.getPreExpressApi()
  212. },
  213. /**
  214. * 生命周期函数--监听页面显示
  215. */
  216. onShow: function() {
  217. let that = this
  218. uni.$on('addressItem', function(res) {
  219. that.$set(that, 'addressItem', res);
  220. that.preOrderNo = ''
  221. that.fastMailData = []
  222. that.orderPrice = 0
  223. })
  224. },
  225. methods: {
  226. lookImg(url) {
  227. uni.previewImage({
  228. current: url, // 传 Number H5端出现不兼容
  229. urls: [url]
  230. });
  231. },
  232. getPreExpressApi(orderNo) {
  233. loadPreExpressApi(orderNo).then(res => {
  234. this.fastMailData = res.data.postOrderList.map(item => {
  235. item.orderInfoList.forEach(val => {
  236. val.radio = false
  237. })
  238. return { ...item
  239. }
  240. }) || []
  241. console.log(this.fastMailData)
  242. this.orderPrice = +res.data.payFee
  243. })
  244. },
  245. onAddFastMail() {
  246. if (Object.keys(this.addressItem).length == 0) return this.$util.Tips({
  247. title: '请选择地址'
  248. });
  249. this.isTake = true
  250. },
  251. tabSelect(active, e) {
  252. this.active = active;
  253. this.navListIndex = e;
  254. this.scrollLeft = e * 60;
  255. },
  256. toPay: Debounce(function(item) {
  257. uni.showLoading({
  258. title: '加载中...'
  259. });
  260. expressCreate({
  261. preOrderNo: this.preOrderNo,
  262. giveTips: this.giveTips
  263. }).then(res => {
  264. uni.hideLoading()
  265. console.log(res)
  266. let data = {
  267. payPrice: +res.data.payPrice,
  268. orderNo: res.data.orderNo
  269. }
  270. this.getToPayment('', data, 'fast')
  271. }).catch(err => {
  272. uni.hideLoading()
  273. console.log('提交快递')
  274. })
  275. }),
  276. onTipValue(value) {
  277. this.giveTips = +value
  278. this.isTip = false;
  279. console.log(value)
  280. },
  281. onTakeChang(data) {
  282. this.isTake = false
  283. this.preOrderNo = data.orderNo
  284. this.getPreExpressApi(data.orderNo)
  285. },
  286. onCanCel(val) {
  287. this.isOrder = val
  288. this.isTake = val
  289. this.isTip = val
  290. },
  291. onValRadio(val) {
  292. val.radio = !val.radio
  293. },
  294. onRadioChang() {
  295. // let price = 0;
  296. this.radioArr = !this.radioArr
  297. if (this.fastMailData.length === 0) return
  298. this.fastMailData = this.fastMailData.map((item, index) => {
  299. item.orderInfoList.forEach(val => {
  300. val.radio = this.radioArr
  301. // val.radio ? price += +val.price : ''
  302. })
  303. return item
  304. })
  305. // this.orderPrice = price
  306. },
  307. /**
  308. * 拨打电话
  309. */
  310. makePhone: function(e) {
  311. uni.makePhoneCall({
  312. phoneNumber: e
  313. })
  314. },
  315. onRadioDel() {
  316. if (this.fastMailData.length === 0) return
  317. const arr = []
  318. this.fastMailData.map((item, index) => {
  319. item.orderInfoList.forEach(val => {
  320. val.radio ? arr.push(val.expressId) : ''
  321. })
  322. return item
  323. })
  324. console.log(arr)
  325. let that = this
  326. uni.showModal({
  327. content: '确定删除?',
  328. cancelText: "取消",
  329. confirmText: "确定",
  330. showCancel: true,
  331. confirmColor: '#f55850',
  332. success: (res) => {
  333. if (res.confirm) {
  334. uni.showLoading({
  335. title: '正在删除中'
  336. });
  337. loadPreExpressDelApi(that.preOrderNo, arr).then(res => {
  338. if (res.data) {
  339. uni.hideLoading();
  340. that.getPreExpressApi(that.preOrderNo)
  341. }
  342. }).catch(err => {
  343. console.log(err)
  344. uni.hideLoading();
  345. })
  346. console.log(that.fastMailData)
  347. }
  348. },
  349. })
  350. }
  351. }
  352. }
  353. </script>
  354. <style lang="scss">
  355. .courie {
  356. padding: 14rpx 24rpx 0 24rpx;
  357. font-weight: 500;
  358. font-size: 23rpx;
  359. color: $bg-color-primary;
  360. background-color: #fff;
  361. image {
  362. width: 46rpx;
  363. height: 46rpx;
  364. margin-right: 15rpx;
  365. }
  366. }
  367. .noCheck {
  368. width: 32rpx;
  369. height: 32rpx;
  370. border-radius: 50%;
  371. overflow: hidden;
  372. border: 1px solid #999999;
  373. background-color: #eee;
  374. }
  375. .fast-top {
  376. width: 100%;
  377. padding: 28rpx 30rpx;
  378. font-weight: 600;
  379. font-size: 27rpx;
  380. color: #141414;
  381. background-color: #fff;
  382. margin-bottom: 20rpx;
  383. border-radius: 20rpx;
  384. }
  385. .remark-name {
  386. font-weight: 600;
  387. font-size: 27rpx;
  388. color: #141414;
  389. }
  390. .fast-tip {
  391. background-color: #fff;
  392. margin-top: 20rpx;
  393. padding: 20rpx 30rpx;
  394. }
  395. .image2 {
  396. width: 42rpx;
  397. height: 42rpx;
  398. margin-right: 20rpx;
  399. }
  400. .fast-jia {
  401. width: 44rpx;
  402. height: 44rpx;
  403. line-height: 44rpx;
  404. text-align: center;
  405. color: #fff;
  406. font-size: 40rpx;
  407. border-radius: 50%;
  408. background-color: $bg-color-primary;
  409. margin-right: 20rpx;
  410. }
  411. .qie-ge {
  412. border-bottom: 2rpx solid #D6D7DC;
  413. }
  414. .fast-box {
  415. border-radius: 23rpx;
  416. padding: 30rpx;
  417. background-color: #fff;
  418. .fast-item {
  419. position: relative;
  420. padding: 20rpx 20rpx 20rpx 86rpx;
  421. background-color: #F8F9FB;
  422. margin-bottom: 10rpx;
  423. }
  424. .radios {
  425. position: absolute;
  426. left: 38rpx;
  427. }
  428. .fast-remark {
  429. font-weight: 400;
  430. font-size: 21rpx;
  431. color: #999999;
  432. view {
  433. margin-bottom: 10rpx;
  434. }
  435. }
  436. .fast-yz {
  437. font-weight: 500;
  438. font-size: 21rpx;
  439. color: #141414;
  440. text {
  441. color: #FF0202;
  442. margin-left: 20rpx;
  443. }
  444. }
  445. .fast-xx {
  446. font-weight: 400;
  447. font-size: 21rpx;
  448. color: #646464;
  449. margin: 10rpx 0;
  450. }
  451. .bg-color-cash {
  452. margin-top: 30rpx;
  453. color: $bg-color-primary;
  454. .fast-cash {
  455. font-weight: 600;
  456. font-size: 27rpx;
  457. color: #FF6702;
  458. }
  459. }
  460. }
  461. .newsList .nav {
  462. padding: 0 24rpx;
  463. width: 100%;
  464. white-space: nowrap;
  465. box-sizing: border-box;
  466. padding-top: 43rpx;
  467. border-top-right-radius: 23rpx;
  468. }
  469. .newsList .nav .item {
  470. // max-width: 156rpx;
  471. display: inline-block;
  472. font-size: 32rpx;
  473. color: #999;
  474. }
  475. .newsList .nav .item.on {
  476. color: #282828;
  477. }
  478. .newsList .nav .item~.item {
  479. margin-left: 46rpx;
  480. }
  481. .newsList .nav .item .line {
  482. // width: 24rpx;
  483. height: 10rpx;
  484. border-radius: 6rpx;
  485. margin: 10rpx auto 0 auto;
  486. background-color: $bg-color-primary;
  487. }
  488. .newsList .nav .item .line1 {
  489. color: $bg-color-primary;
  490. }
  491. .cart-box {
  492. height: 96rpx;
  493. border-radius: 48rpx;
  494. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  495. background-color: #000;
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. z-index: 9999;
  500. .pay-btn {
  501. height: 100%;
  502. padding: 0 30rpx;
  503. color: #FFFFFF;
  504. border-radius: 0 50rpx 50rpx 0;
  505. display: flex;
  506. align-items: center;
  507. font-size: $font-size-base;
  508. background-color: $bg-color-primary;
  509. }
  510. .mark-box {
  511. padding-left: 46rpx;
  512. margin-right: 30rpx;
  513. position: relative;
  514. .mark {
  515. font-weight: 500;
  516. font-size: 23rpx;
  517. color: #FFFFFF;
  518. }
  519. .tips {
  520. font-weight: 500;
  521. font-size: 27rpx;
  522. color: #999999;
  523. }
  524. }
  525. }
  526. .banner-img {
  527. width: 100%;
  528. height: 100%;
  529. }
  530. </style>