express-info.vue 12 KB

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