express.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <!-- 邮寄发货 -->
  2. <template>
  3. <view>
  4. <view class="tits">收货信息</view>
  5. <ul class="ddinfo">
  6. <li>
  7. <span>收货人</span>
  8. <view v-text="order.name"></view>
  9. </li>
  10. <li>
  11. <span>收货人电话</span>
  12. <view v-text="order.phone"></view>
  13. </li>
  14. <li>
  15. <span>收货人地址</span>
  16. <view v-text="order.address"></view>
  17. </li>
  18. </ul>
  19. <view class="tits">发货方式</view>
  20. <view class="express">
  21. <view class="li dflex">
  22. <label class="label">发货方式</label>
  23. <view class="item flex">
  24. <picker class="picker active" :range="goodstype" @change="onSelect" range-key="label">
  25. <view>{{ goodstype[psSwyIndex].label }}</view>
  26. <image src="../merchant/static/images/rico.png" class="rico"></image>
  27. </picker>
  28. </view>
  29. </view>
  30. <block v-if="index == 2">
  31. <view class="li dflex">
  32. <label class="label">快递公司</label>
  33. <view class="item flex">
  34. <picker :class="'picker ' + (expressIndex > -1 ? 'active' : '')" @change="bindPickerExpressChange" :range="express" range-key="label">
  35. <view v-if="expressIndex >= 0">{{ express[expressIndex].label }}</view>
  36. <view v-else>请选择</view>
  37. <image src="../merchant/static/images/rico.png" class="rico"></image>
  38. </picker>
  39. </view>
  40. </view>
  41. <view class="li dflex">
  42. <label class="label">快递单号</label>
  43. <view class="item flex dflex">
  44. <input v-model="valueOrder" placeholder="请输入快递单号" placeholder-class="placeholder" class="ipt flex" />
  45. <view class="sao" @click="toScanCode()"><image src="../merchant/static/images/sao.png"></image></view>
  46. </view>
  47. </view>
  48. </block>
  49. <block v-if="index == 4">
  50. <view class="li dflex">
  51. <label class="label">配送人员</label>
  52. <view class="item flex dflex"><input v-model="distributionName" placeholder="请输入配送人姓名" placeholder-class="placeholder" class="ipt flex" /></view>
  53. </view>
  54. <view class="li dflex">
  55. <label class="label">联系方式</label>
  56. <view class="item flex dflex"><input v-model="distributionPhone" placeholder="请输入联系方式" placeholder-class="placeholder" class="ipt flex" /></view>
  57. </view>
  58. </block>
  59. <block v-if="index == 3">
  60. <view class="li dflex">
  61. <label class="label">订单类型</label>
  62. <view class="dflex flex radio-rr">
  63. <radio-group @change="radioTypeGroup">
  64. <label class="radio" v-for="(item, index) in type" :key="index">
  65. <radio :value="item.value" />
  66. {{ item.label }}
  67. </label>
  68. </radio-group>
  69. </view>
  70. </view>
  71. <view class="li dflex">
  72. <label class="label">需要打包</label>
  73. <view class="dflex flex radio-rr">
  74. <radio-group @change="radioIsGroup">
  75. <label class="radio" v-for="(item, index) in is" :key="index">
  76. <radio :value="item.value" />
  77. {{ item.label }}
  78. </label>
  79. </radio-group>
  80. </view>
  81. </view>
  82. <!-- <van-cell is-link @click="showTime = true"
  83. v-if="orderType == 2"
  84. :value="time"
  85. title=":" class="time" />
  86. <van-popup v-model="showTime"
  87. position="bottom"
  88. :style="{ height: '50%' }" round>
  89. <van-datetime-picker
  90. v-model="currentDate"
  91. type="datetime"
  92. title="选择送达时间"
  93. :min-date="minDate"
  94. :max-date="maxDate"
  95. @confirm="getTiem"
  96. @cancel="showTime = false"
  97. />
  98. </van-popup> -->
  99. </block>
  100. <view class="bot"><view class="sta-btn w" @click="showlog()">确定</view></view>
  101. </view>
  102. <view class="ceng" v-if="showexp"></view>
  103. <view class="dialog" v-if="showexp">
  104. <view class="dialog-tit">请核对信息</view>
  105. <view class="pad20">
  106. <view class="expressinfo">
  107. 发货方式:
  108. <view>{{ goodstype[psSwyIndex].label }}</view>
  109. </view>
  110. <block v-if="index == 2">
  111. <view class="expressinfo">
  112. 快递公司:
  113. <view>{{ expressRadio }}</view>
  114. </view>
  115. <view class="expressinfo" v-if="index == 2">
  116. 快递单号:
  117. <view>{{ valueOrder }}</view>
  118. </view>
  119. </block>
  120. <block v-if="index == 3">
  121. <view class="expressinfo">
  122. 快递公司:
  123. <view>{{ expressRadio }}</view>
  124. </view>
  125. <view class="expressinfo">
  126. 订单类型:
  127. <view>{{ orderType != '' ? type[orderType - 1].label : '无' }}</view>
  128. </view>
  129. <view class="expressinfo">
  130. 需要打包:
  131. <view>{{ pack != '' ? is[pack].label : '无' }}</view>
  132. </view>
  133. <view class="expressinfo" v-if="orderType == 2">
  134. 送达时间:
  135. <view>{{ time }}</view>
  136. </view>
  137. </block>
  138. <block v-if="index == 4">
  139. <view class="expressinfo">
  140. 配送人员姓名:
  141. <view>{{ distributionName }}</view>
  142. </view>
  143. <view class="expressinfo">
  144. 配送人员电话:
  145. <view>{{ distributionPhone }}</view>
  146. </view>
  147. </block>
  148. </view>
  149. <view class="dialog-btn dflex">
  150. <view class="dia-cancel" @click="beforeClose(false)">取消</view>
  151. <view class="dia-confirm" @click="beforeClose(true)">确认</view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. const req = require('../utils/request');
  158. export default {
  159. data: () => ({
  160. minDate: new Date(2020, 0, 1),
  161. maxDate: new Date(2025, 10, 1),
  162. currentDate: new Date(),
  163. pack: '',
  164. psSwyIndex: 0,
  165. orderType: '',
  166. showexp: false,
  167. showFH: false,
  168. popup: false,
  169. expressNo: true,
  170. merchant: {},
  171. express: [],
  172. radio: '请选择',
  173. expressRadio: '请选择',
  174. valueOrder: '',
  175. index: 2,
  176. expressIndex: -1,
  177. goodstype: [
  178. {
  179. label: '快递',
  180. value: 2,
  181. disabled: false
  182. },
  183. // {
  184. // label: '同城配送',
  185. // value: 3,
  186. // disabled: true
  187. // },
  188. {
  189. label: '自主配送',
  190. value: 4,
  191. disabled: false
  192. }
  193. ],
  194. type: [
  195. {
  196. label: '及时单',
  197. value: '1'
  198. },
  199. {
  200. label: '预约单',
  201. value: '2'
  202. }
  203. ],
  204. is: [
  205. {
  206. label: '否',
  207. value: '0'
  208. },
  209. {
  210. label: '是',
  211. value: '1'
  212. }
  213. ],
  214. id: '',
  215. merchantId: '',
  216. time: '',
  217. showTime: false,
  218. distributionName: '',
  219. distributionPhone: '',
  220. times: '',
  221. orderId: '',
  222. order: ''
  223. }),
  224. onLoad(opt) {
  225. this.id = opt.id;
  226. this.merchantId = opt.merchantId;
  227. this.orderType = opt.orderType;
  228. this.deliverId = opt.deliverId;
  229. this.getType(1);
  230. this.loadDetail();
  231. },
  232. methods: {
  233. // 发货方式切换
  234. onSelect(e) {
  235. this.psSwyIndex = e.target.value;
  236. this.kuidimethod(this.goodstype[this.psSwyIndex].value);
  237. },
  238. toScanCode(e) {
  239. var tah = this;
  240. console.log('扫描二维码>>>>');
  241. uni.scanCode({
  242. success: function(res) {
  243. console.log('条码类型:' + res.scanType);
  244. console.log('条码内容:' + res.result);
  245. tah.valueOrder = res.result;
  246. tah.$forceUpdate();
  247. }
  248. });
  249. },
  250. loadDetail() {
  251. let from = {
  252. id: this.id
  253. };
  254. req.getRequest(
  255. '/api/order/detail',
  256. from,
  257. data => {
  258. this.order = data;
  259. this.isShowView = true;
  260. },
  261. true
  262. );
  263. },
  264. // 显示发货方式弹窗
  265. showPopup() {
  266. this.showFH = true;
  267. console.log(this.showFH);
  268. },
  269. bindPickerExpressChange(event) {
  270. this.expressIndex = event.detail.value;
  271. this.expressRadio = this.express[this.expressIndex].label;
  272. },
  273. // 得到发货方式 2快递,3同城配送,4自主配送
  274. kuidimethod(index) {
  275. console.log(index);
  276. this.index = index;
  277. },
  278. onClick(name, index) {
  279. // console.log( event.currentTarget.dataset)
  280. // const { name } = event.currentTarget.dataset;
  281. this.index = index;
  282. this.radio = name;
  283. },
  284. // 得到快递公司
  285. expressMethod(name, value) {
  286. this.expressIndex = value;
  287. this.expressRadio = name;
  288. console.log(this.expressIndex);
  289. },
  290. // 获取快递单号
  291. getValue(event) {
  292. this.value = event.detail;
  293. },
  294. // 获取配送人员姓名
  295. getdistributionName(event) {
  296. this.distributionName = event.detail;
  297. },
  298. // 获取配送人员联系方式
  299. getdistributionPhone(event) {
  300. this.distributionPhone = event.detail;
  301. },
  302. // 获取订单类型
  303. getorderType(event) {
  304. this.orderType = event.detail;
  305. },
  306. // 二次确认
  307. showlog() {
  308. // 发货方式为2快递
  309. if (this.index == 2) {
  310. if (this.expressIndex < 0) {
  311. req.msg('请选择快递公司');
  312. } else if (this.valueOrder == '') {
  313. req.msg('请输入快递单号');
  314. } else {
  315. this.showexp = true;
  316. }
  317. }
  318. // 发货方式为3同城配送
  319. if (this.index == 3) {
  320. // 及时单
  321. if (this.orderType != 0) {
  322. if (this.orderType == 1) {
  323. if (this.expressIndex < 0) {
  324. req.msg('请选择快递公司');
  325. } else if (this.pack == '') {
  326. req.msg('请选择是否需要打包');
  327. } else {
  328. this.showexp = true;
  329. }
  330. }
  331. // 预约单
  332. if (this.orderType == 2) {
  333. if (this.expressIndex < 0) {
  334. req.msg('请选择快递公司');
  335. } else if (this.pack == '') {
  336. req.msg('请选择是否需要打包');
  337. } else if (this.time == '') {
  338. req.msg('请选择送达时间');
  339. } else {
  340. this.showexp = true;
  341. }
  342. }
  343. } else {
  344. req.msg('请选择订单类型');
  345. }
  346. }
  347. // 自主配送
  348. if (this.index == 4) {
  349. if (this.distributionName == '') {
  350. req.msg('请输入配送人员姓名');
  351. } else if (this.distributionPhone == '') {
  352. req.msg('请输入配送人员电话');
  353. } else {
  354. this.showexp = true;
  355. }
  356. }
  357. // this.showexp = true
  358. },
  359. // 获取快递信息
  360. getexpress() {
  361. // this.req.getexpress({}, (data) => {
  362. let express = [];
  363. req.getRequest('/api/orderRefund/refundReason', {}, data => {
  364. this.express = data.express;
  365. });
  366. if (this.index == 3) {
  367. // if (this.merchant.syncEle == 1) {
  368. // this.express = []
  369. this.expressRadio = '请选择';
  370. this.expressIndex = -1;
  371. // this.express.push(data.express[21])
  372. this.express = express;
  373. this.expressNo = false;
  374. // }
  375. }
  376. if (this.index == 2) {
  377. // express.splice(data.express.length - 3, 3)
  378. this.expressRadio = '请选择';
  379. this.expressIndex = -1;
  380. this.express = express;
  381. this.expressNo = true;
  382. }
  383. // })
  384. },
  385. // 确认按钮的,弹窗显示隐藏
  386. getType(index) {
  387. this.showFH = false;
  388. this.popup = false;
  389. if (index == 1) {
  390. this.getexpress();
  391. }
  392. },
  393. // 传发货信息给后台
  394. beforeClose(isOk) {
  395. if (isOk) {
  396. this.deliver();
  397. // this.save();
  398. setTimeout(() => {
  399. this.showexp = false;
  400. }, 1000);
  401. } else {
  402. // done() // 关闭
  403. this.showexp = false;
  404. }
  405. },
  406. // 发货信息保存
  407. deliver() {
  408. let param;
  409. // param = {
  410. // id: this.orderId,
  411. // deliverId: this.id,
  412. // express: this.expressRadio,
  413. // expressNo: this.valueOrder
  414. // };
  415. if (this.index == 2) {
  416. param = {
  417. mode: this.index,
  418. id: this.id,
  419. expressCode: this.expressIndex,
  420. express: this.expressRadio,
  421. expressNo: this.value
  422. };
  423. }
  424. if (this.index == 3) {
  425. param = {
  426. id: this.id,
  427. expressCode: this.expressIndex,
  428. express: this.expressRadio,
  429. orderSendType: this.orderType,
  430. isPack: this.pack,
  431. mode: this.index
  432. };
  433. if (this.orderType == 2) {
  434. param.sendTime = this.times;
  435. }
  436. }
  437. if (this.index == 4) {
  438. param = {
  439. id: this.id,
  440. mode: this.index,
  441. deliveryUserName: this.distributionName,
  442. deliveryUserPhone: this.distributionPhone
  443. };
  444. }
  445. if (!this.deliverId) {
  446. } else {
  447. param.deliverId = this.deliverId;
  448. }
  449. console.log(param);
  450. let that = this;
  451. req.postRequest(
  452. '/api/order/confirm',
  453. param,
  454. data => {
  455. if (data == 1) {
  456. uni.showToast({
  457. title: '发货成功',
  458. icon: 'none'
  459. });
  460. setTimeout(function() {
  461. uni.navigateBack();
  462. }, 1000);
  463. }
  464. },
  465. true
  466. );
  467. },
  468. back() {
  469. // 返回上一层
  470. uni.navigateBack();
  471. },
  472. // 时间显示
  473. getTiem(value) {
  474. let date = new Date(value);
  475. const year = date.getFullYear();
  476. const month = date.getMonth() + 1;
  477. const day = date.getDate();
  478. const hour = date.getHours();
  479. const minute = date.getMinutes();
  480. console.log(year, month, day, hour, minute);
  481. this.time = year + '年' + month + '月' + day + '日' + hour + '点' + minute + '分';
  482. this.times = year + '-' + month + '-' + day + ' ' + hour + ':' + minute;
  483. this.showTime = false;
  484. console.log(this.times);
  485. }
  486. }
  487. };
  488. </script>
  489. <style scoped>
  490. @import './static/css/main.css';
  491. .express {
  492. background: #fff;
  493. padding: 0 30rpx;
  494. }
  495. .express .li {
  496. border-bottom: 1rpx solid #e5e5e5;
  497. align-items: center;
  498. }
  499. .express .li:last-child {
  500. border: none;
  501. }
  502. .label {
  503. font-size: 30rpx;
  504. color: #333;
  505. margin-right: 20rpx;
  506. padding: 30rpx 0;
  507. }
  508. .item {
  509. align-items: center;
  510. }
  511. .picker {
  512. position: relative;
  513. }
  514. .picker view {
  515. display: inline-block;
  516. width: 100%;
  517. padding: 30rpx 0;
  518. font-size: 30rpx;
  519. color: #999;
  520. text-align: right;
  521. padding-right: 35rpx;
  522. box-sizing: border-box;
  523. }
  524. .picker.active view {
  525. color: #333;
  526. }
  527. .rico {
  528. width: 15rpx;
  529. height: 26rpx;
  530. position: absolute;
  531. right: 0;
  532. top: 50%;
  533. transform: translateY(-50%);
  534. }
  535. .ipt {
  536. font-size: 30rpx;
  537. color: #333;
  538. text-align: right;
  539. }
  540. .placegolder {
  541. color: #999;
  542. }
  543. .sao {
  544. padding: 10rpx 10rpx 10rpx 30rpx;
  545. }
  546. .sao image {
  547. width: 30rpx;
  548. height: 34rpx;
  549. }
  550. .bot {
  551. height: 70rpx;
  552. }
  553. .sta-btn {
  554. background: #fe0419;
  555. color: #fff;
  556. width: 100%;
  557. height: 70rpx;
  558. line-height: 70rpx;
  559. font-size: 30rpx;
  560. }
  561. .expressinfo {
  562. display: flex;
  563. justify-content: space-between;
  564. margin-bottom: 10px;
  565. }
  566. .pad20 {
  567. padding: 0 20px;
  568. }
  569. .delivertype {
  570. height: 300px;
  571. }
  572. /* .delivertype .radio {
  573. height: 211px;
  574. position: fixed;
  575. overflow-y: auto;
  576. width: 100%;
  577. } */
  578. .delivertype .bottom {
  579. width: 335px;
  580. height: 50px;
  581. background: linear-gradient(to left, #ff5548, #fe0419);
  582. border-radius: 25px;
  583. text-align: center;
  584. line-height: 50px;
  585. color: #ffffff;
  586. font-size: 18px;
  587. position: fixed;
  588. left: 0;
  589. right: 0;
  590. bottom: 15px;
  591. margin: 0 auto;
  592. }
  593. /* .van-radio:not(:last-child) {
  594. margin-right: 10px;
  595. } */
  596. /* .time{font-size: 13px;} */
  597. .van-cell__title {
  598. flex: 0.9;
  599. }
  600. .tits {
  601. font-size: 28rpx;
  602. color: #666;
  603. padding: 20rpx 30rpx;
  604. }
  605. .ddinfo {
  606. margin: 0;
  607. border-radius: 0;
  608. }
  609. .ddinfo li span {
  610. font-size: 30rpx;
  611. color: #333;
  612. margin-right: 20rpx;
  613. }
  614. .ceng {
  615. position: fixed;
  616. top: 0;
  617. left: 0;
  618. right: 0;
  619. bottom: 0;
  620. background: rgba(0, 0, 0, 0.5);
  621. z-index: 99;
  622. }
  623. .dialog {
  624. position: fixed;
  625. top: 50%;
  626. transform: translateY(-50%);
  627. left: 40rpx;
  628. right: 40rpx;
  629. background: #fff;
  630. border-radius: 15rpx;
  631. z-index: 100;
  632. }
  633. .dialog-tit {
  634. font-size: 32rpx;
  635. color: #333;
  636. padding: 40rpx 0;
  637. text-align: center;
  638. }
  639. .dialog-btn {
  640. border-top: 1rpx solid #e5e5e5;
  641. margin-top: 40rpx;
  642. }
  643. .dia-cancel {
  644. width: 50%;
  645. font-size: 30rpx;
  646. color: #666;
  647. text-align: center;
  648. padding: 30rpx 0;
  649. box-sizing: border-box;
  650. border-right: 1rpx solid #e5e5e5;
  651. }
  652. .dia-confirm {
  653. width: 50%;
  654. font-size: 30rpx;
  655. color: #1678ff;
  656. text-align: center;
  657. padding: 30rpx 0;
  658. }
  659. </style>