express-info.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class="flex-common-css">
  3. <Nav title=" " leftIconColor="#333" titleColor="#333" bgckgroundBox='transparent'></Nav>
  4. <image class="bg-img" src="@/static/img/order/bg.png" mode=""></image>
  5. <view class="p-24-24-0 box-border-box">
  6. <view class="mb-24" v-if="infoData.order_status == 1">
  7. <view class="fs-40 fc-3 mb-8">
  8. {{infoData.order_status_str}},剩余{{time.m}}:{{time.s}}
  9. </view>
  10. <view class="fs-24 fc-FB3D03">
  11. 10分钟内未支付,订单将自动取消
  12. </view>
  13. </view>
  14. <view class="mb-24" v-else>
  15. <view class="fs-48 fc-3 fw-600">
  16. {{infoData.order_status_str}}
  17. </view>
  18. </view>
  19. <view class="bgc-f b-rad-20 p-24 box-border-box">
  20. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3" v-show="infoData.order_status == 1">
  21. 请尽快支付
  22. </view>
  23. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3" v-show="infoData.order_status == 4">
  24. 感谢你对君子校园的信任,期待你再次光临
  25. </view>
  26. <view class="align-items-center flex-wrap-wrap">
  27. <view class="w-33 flex-direction align-items-center" @click="pay"
  28. v-show="infoData.order_status == 1">
  29. <image class="mb-4 icon" src="@/static/img/order/qzf.png" mode=""></image>
  30. <view class="fs-24 fc-41ABF5">
  31. 去支付
  32. </view>
  33. </view>
  34. <!-- <view @click="setAddress" class="w-33 flex-direction align-items-center"
  35. v-show="infoData.order_status == 1 || infoData.order_status == 2">
  36. <image class="mb-4 icon" src="@/static/img/order/xgdd.png" mode=""></image>
  37. <view class="fs-24 fc-3">
  38. 修改收货地址
  39. </view>
  40. </view> -->
  41. <view @click="goToUrl" class="w-33 flex-direction align-items-center"
  42. v-show="infoData.order_status == 4 || infoData.order_status == 6 || infoData.order_status == 5">
  43. <image class="mb-4 icon" src="@/static/img/order/zlyd.png" mode=""></image>
  44. <view class="fs-24 fc-41ABF5">
  45. 再来一单
  46. </view>
  47. </view>
  48. <view class="w-33 flex-direction align-items-center">
  49. <button class="item-box-button" open-type="contact" :bindcontact="handleContact"></button>
  50. <image class="mb-4 icon" src="@/static/img/order/lxkf.png" mode=""></image>
  51. <view class="fs-24 fc-3">
  52. 联系客服
  53. </view>
  54. </view>
  55. <view class="w-33 flex-direction align-items-center" v-show="infoData.order_status == 2"
  56. @click="cancelOrder">
  57. <image class="mb-4 icon" src="@/static/img/order/qxdd.png" mode=""></image>
  58. <view class="fs-24 fc-3">
  59. 取消订单
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="p-24-24-0 box-border-box">
  66. <view class="p-24 box-border-box bgc-f b-rad-20">
  67. <view class="fs-28 fc-3 fw-600 mb-16">
  68. 取件码
  69. </view>
  70. <view class="b-rad-12 p-24 box-border-box bgc-F3F4F6 align-items-center flex-wrap-wrap">
  71. <view class="item-code text-align-center" v-for="(item,index) in infoData.pickup_code">
  72. {{item}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  78. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  79. <view class="w-420 fc-3 fs-32 fw-600 text-overflow-ellipsis-one mb-24">
  80. {{infoData.site_name}}
  81. </view>
  82. <view class="goods-box" :class="infoData.item.length >= 4 && goodsShow?'goodsShowOne':'goodsShowTwo'">
  83. <view class="align-items-center flex-justify-space mb-20" v-for="(item,index) in infoData.item">
  84. <image class="goods-img mr-16" :src="item.goods_img" mode=""></image>
  85. <view class="">
  86. <view class="align-items-center flex-justify-space mb-2">
  87. <view class="fs-28 fc-3 w-376 text-overflow-ellipsis-one mr-36">
  88. {{item.goods_name}}
  89. </view>
  90. <view class="fs-32 fc-3 fw-600">
  91. ¥{{item.goods_money}}
  92. </view>
  93. </view>
  94. <!-- <view class="mb-2 fs-24 fc-9">
  95. {{item.goods_name}}
  96. </view> -->
  97. <view class="fs-24 fc-9">
  98. x{{item.goods_num}}
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="align-items-center flex-justify-center p-24 b-b-F9F9F9 mb-32" @click="openGoods"
  104. v-if="infoData.item.length > 4">
  105. <view class="fs-24 fc-9 mr-4">
  106. {{goodsShow?'展开':'收起'}}{{infoData.item.length - 4}}件商品
  107. </view>
  108. <image v-if="goodsShow" class="icon-right" src="@/static/img/order/top.png" mode=""></image>
  109. <image v-else class="icon-right" src="@/static/img/order/bottom.png" mode=""></image>
  110. </view>
  111. <!-- <view class="align-items-center flex-justify-space mb-24">
  112. <view class="fs-28 fc-3">
  113. 打包费
  114. </view>
  115. <view class="fs-32 fc-3">
  116. 打包费
  117. </view>
  118. </view>
  119. <view class="align-items-center flex-justify-space mb-24">
  120. <view class="fs-28 fc-3">
  121. 配送费
  122. </view>
  123. <view class="fs-32 fc-3">
  124. 打包费
  125. </view>
  126. </view> -->
  127. <view class="align-items-center flex-justify-space pb-36 b-b-F9F9F9 mb-22">
  128. <view class="align-items-center">
  129. <image class="mr-6 icon-right" src="@/static/img/order/yhq.png" mode=""></image>
  130. <view class="fs-28 fc-3">
  131. 优惠券
  132. </view>
  133. </view>
  134. <view class="fs-32 fc-FB3D03">
  135. -¥{{infoData.coupon_money}}
  136. </view>
  137. </view>
  138. <view class="align-items-center flex-justify-end">
  139. <view class="fs-28 fc-9">
  140. 共{{infoData.goods_number}}件,
  141. </view>
  142. <view class="fs-28 fc-3">
  143. 金额
  144. </view>
  145. <view class="fs-24 fw-600 fc-3">
  146. ¥
  147. </view>
  148. <view class="fs-36 fw-600 fc-3">
  149. {{infoData.pay_money}}
  150. </view>
  151. </view>
  152. </view>
  153. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  154. <view class="display-flex flex-justify-space mb-26">
  155. <view class="fs-28 fc-9">
  156. 配送地址
  157. </view>
  158. <view class="fs-28 fc-3 w-480 text-align-right">
  159. {{infoData.school_name}}{{infoData.dorm_name}}{{infoData.address}}{{infoData.consignee}}{{infoData.consignee_tel}}
  160. </view>
  161. </view>
  162. <!-- <view class="display-flex flex-justify-space mb-26">
  163. <view class="fs-28 fc-9">
  164. 配送时间
  165. </view>
  166. <view class="fs-28 fc-3 w-480 text-align-right">
  167. 预约配送
  168. </view>
  169. </view> -->
  170. <view class="display-flex flex-justify-space pb-20 b-b-F9F9F9 mb-26"
  171. v-show="infoData.order_status == 3">
  172. <view class="fs-28 fc-9">
  173. 骑手信息
  174. </view>
  175. <view class="fs-28 fc-3 w-480 text-align-right">
  176. {{infoData.rider.rider_name}}{{infoData.rider.phone}}
  177. </view>
  178. </view>
  179. <view class="display-flex flex-justify-space mb-26">
  180. <view class="fs-28 fc-9">
  181. 订单编号
  182. </view>
  183. <view class="align-items-center flex-justify-end">
  184. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  185. {{infoData.order_sn}}
  186. </view>
  187. <image class="icon-fz" src="@/static/img/order/fz.png" mode=""></image>
  188. </view>
  189. </view>
  190. <view class="display-flex flex-justify-space mb-26">
  191. <view class="fs-28 fc-9">
  192. 下单时间
  193. </view>
  194. <view class="fs-28 fc-3 w-480 text-align-right">
  195. {{infoData.created_at}}
  196. </view>
  197. </view>
  198. <view class="display-flex flex-justify-space mb-26">
  199. <view class="fs-28 fc-9">
  200. 支付方式
  201. </view>
  202. <view class="fs-28 fc-3 w-480 text-align-right">
  203. {{infoData.pay_type_str}}
  204. </view>
  205. </view>
  206. <view class="display-flex flex-justify-space mb-26">
  207. <view class="fs-28 fc-9">
  208. 备注
  209. </view>
  210. <view class="fs-28 fc-3 w-480 text-align-right">
  211. {{infoData.note?infoData.note:'无'}}
  212. </view>
  213. </view>
  214. </view>
  215. </scroll-view>
  216. <SelectAddress ref="selectAddress" @giveAddress='giveAddress'></SelectAddress>
  217. </view>
  218. </template>
  219. <script>
  220. import {
  221. expressOrderInfo,
  222. expressOrderCancel,
  223. expressOrderAddress
  224. } from "@/api/expressOrder.js"
  225. import {
  226. getExpressPay
  227. } from "@/api/express.js"
  228. import tools from "@/service/tools";
  229. import SelectAddress from "./module/select-address.vue";
  230. export default {
  231. components: {
  232. SelectAddress
  233. },
  234. data() {
  235. return {
  236. goodsData: [{
  237. name: '1'
  238. }, {
  239. name: '2'
  240. }],
  241. goodsShow: true,
  242. infoData: {},
  243. time: {
  244. day: '',
  245. h: "",
  246. m: '',
  247. s: '',
  248. },
  249. isAJAX: false,
  250. address_id: ''
  251. };
  252. },
  253. onLoad(data) {
  254. if (data) {
  255. console.log(data);
  256. this.expressOrderInfo(data.orderId)
  257. }
  258. },
  259. mounted() {},
  260. methods: {
  261. goToUrl() {
  262. // 再来一单
  263. uni.navigateTo({
  264. url: '/pages-takeout/replace-take'
  265. })
  266. },
  267. setAddress() {
  268. this.$refs.selectAddress.getList();
  269. },
  270. giveAddress(e) {
  271. this.address_id = e;
  272. this.expressOrderAddress()
  273. },
  274. expressOrderAddress() {
  275. expressOrderAddress({
  276. order_id: this.infoData.id,
  277. address_id: this.address_id
  278. }).then((res) => {
  279. if (res.code == 1) {
  280. tools.success(res.msg)
  281. this.expressOrderInfo(this.infoData.id)
  282. } else {
  283. tools.error(res.msg)
  284. }
  285. })
  286. },
  287. pay() {
  288. this.getExpressPay(this.infoData.id)
  289. },
  290. getExpressPay(id) {
  291. // 代取支付
  292. if (this.isAJAX) {
  293. return
  294. }
  295. this.isAJAX = true;
  296. getExpressPay({
  297. order_id: id
  298. }).then((ret) => {
  299. if (ret.code === 1) {
  300. uni.requestPayment({
  301. provider: "wxpay", //支付类型-固定值
  302. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  303. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  304. package: ret.data.wx_pay.package, // 固定值
  305. signType: ret.data.wx_pay.signType, //固定值
  306. paySign: ret.data.wx_pay.paySign, //签名
  307. success: (ren) => {
  308. tools.success("支付成功");
  309. this.isAJAX = false;
  310. this.expressOrderInfo(this.infoData.id)
  311. },
  312. fail: (err) => {
  313. this.isAJAX = false;
  314. tools.error("支付失败");
  315. },
  316. });
  317. } else {
  318. this.isAJAX = false;
  319. tools.error("支付失败");
  320. }
  321. })
  322. },
  323. cancelOrder() {
  324. // 代取取消订单
  325. uni.showModal({
  326. title: '提示',
  327. content: '是否取消订单?',
  328. confirmText: '确定',
  329. confirmColor: '#FB3D03',
  330. success: (res) => {
  331. if (res.confirm === true) {
  332. if (this.isAJAX) {
  333. return
  334. }
  335. this.isAJAX = true;
  336. expressOrderCancel({
  337. order_id: this.infoData.id
  338. }).then((res) => {
  339. if (res.code == 1) {
  340. tools.success(res.msg)
  341. setTimeout(() =>{
  342. this.expressOrderInfo(this.infoData.id)
  343. }, 1500)
  344. this.isAJAX = false;
  345. } else {
  346. tools.error(res.msg)
  347. this.isAJAX = false;
  348. }
  349. })
  350. }
  351. }
  352. });
  353. },
  354. openGoods() {
  355. this.goodsShow = !this.goodsShow
  356. },
  357. scrolltolower() {
  358. // console.log('触底');
  359. },
  360. expressOrderInfo(id) {
  361. expressOrderInfo({
  362. order_id: id
  363. }).then((res) => {
  364. if (res.code == 1) {
  365. this.infoData = res.data
  366. if (this.infoData.order_status == 1) {
  367. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  368. createDate.setMinutes(createDate.getMinutes() + 10)
  369. this.setCountDown(createDate)
  370. }
  371. }
  372. })
  373. },
  374. setCountDown(sTime) {
  375. let end = new Date(sTime).getTime();
  376. let now = new Date().getTime();
  377. let msec = end - now;
  378. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  379. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  380. let m = parseInt(msec / 1000 / 60 % 60);
  381. let s = parseInt(msec / 1000 % 60);
  382. this.time.h = h > 9 ? h : '0' + h;
  383. this.time.m = m > 9 ? m : '0' + m;
  384. this.time.s = s > 9 ? s : '0' + s;
  385. msec -= 1000;
  386. if (this.time.day >= 1) {
  387. this.showTime = true;
  388. } else {
  389. this.showTime = false;
  390. };
  391. if (msec >= 0) {
  392. setTimeout(() => {
  393. this.setCountDown(sTime);
  394. }, 1000);
  395. } else {
  396. this.isTimeEnd = true;
  397. this.bText = '活动结束';
  398. this.time.h = '--';
  399. this.time.m = '--';
  400. this.time.s = '--';
  401. };
  402. }
  403. },
  404. }
  405. </script>
  406. <style lang="scss" scoped>
  407. .item-code{
  408. min-width: 30%;
  409. padding: 8rpx
  410. }
  411. .bg-img {
  412. position: fixed;
  413. left: 0;
  414. top: 0;
  415. z-index: -1;
  416. width: 100%;
  417. height: 320rpx;
  418. }
  419. .w-33 {
  420. width: 33%;
  421. position: relative;
  422. }
  423. .item-box-button {
  424. position: absolute;
  425. width: 100%;
  426. height: 88rpx;
  427. top: 0;
  428. left: 0;
  429. z-index: 100;
  430. background-color: transparent;
  431. border: none !important;
  432. }
  433. button::after {
  434. border: none !important;
  435. }
  436. .p-24-24-0 {
  437. padding: 24rpx 24rpx 0;
  438. }
  439. .icon {
  440. width: 48rpx;
  441. height: 48rpx;
  442. }
  443. .w-420 {
  444. width: 420rpx;
  445. }
  446. .goods-img {
  447. width: 108rpx;
  448. height: 108rpx;
  449. border-radius: 8rpx;
  450. }
  451. .w-376 {
  452. width: 376rpx;
  453. }
  454. .icon-right {
  455. width: 32rpx;
  456. height: 32rpx;
  457. }
  458. .w-480 {
  459. width: 480rpx;
  460. }
  461. .icon-fz {
  462. width: 24rpx;
  463. height: 24rpx;
  464. }
  465. .goods-box {
  466. overflow: hidden;
  467. }
  468. .goodsShowOne {
  469. max-height: 508rpx;
  470. transition: all .5s linear;
  471. }
  472. .goodsShowTwo {
  473. height: auto;
  474. transition: all .5s linear;
  475. }
  476. </style>