index.vue 13 KB

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