index.vue 13 KB

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