ticket-info.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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-show="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">
  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 @click="pay" class="w-33 flex-direction align-items-center"
  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="goToUrl" class="w-33 flex-direction align-items-center"
  35. v-show="infoData.order_status == 4 || infoData.order_status == 6">
  36. <image class="mb-4 icon" src="@/static/img/order/zlyd.png" mode=""></image>
  37. <view class="fs-24 fc-41ABF5">
  38. 再来一单
  39. </view>
  40. </view>
  41. <view class="w-33 flex-direction align-items-center">
  42. <button class="item-box-button" open-type="contact" :bindcontact="handleContact"></button>
  43. <image class="mb-4 icon" src="@/static/img/order/lxkf.png" mode=""></image>
  44. <view class="fs-24 fc-3">
  45. 联系客服
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  52. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  53. <!-- <view class="w-420 fc-3 fs-32 fw-600 text-overflow-ellipsis-one mb-24">
  54. {{infoData.site_name}}
  55. </view> -->
  56. <view class="goods-box">
  57. <view class="align-items-center flex-justify-space mb-20">
  58. <image class="goods-img mr-16 flex-shrink0" :src="infoData.goods_img" mode=""></image>
  59. <view class="">
  60. <view class="align-items-center flex-justify-space mb-2">
  61. <view class="fs-28 fc-3 w-300 text-overflow-ellipsis-one mr-36">
  62. {{infoData.goods_name}}
  63. </view>
  64. <view class="fs-32 fc-3 fw-600">
  65. ¥{{infoData.goods_price}}
  66. </view>
  67. </view>
  68. <!-- <view class="mb-2 fs-24 fc-9">
  69. {{item.goods_name}}
  70. </view> -->
  71. <view class="fs-24 fc-9">
  72. x{{infoData.goods_number}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- <view class="align-items-center flex-justify-space mb-24">
  78. <view class="fs-28 fc-3">
  79. 打包费
  80. </view>
  81. <view class="fs-32 fc-3">
  82. 打包费
  83. </view>
  84. </view>
  85. <view class="align-items-center flex-justify-space mb-24">
  86. <view class="fs-28 fc-3">
  87. 配送费
  88. </view>
  89. <view class="fs-32 fc-3">
  90. 打包费
  91. </view>
  92. </view> -->
  93. <!-- <view class="align-items-center flex-justify-space pb-36 b-b-F9F9F9 mb-22">
  94. <view class="align-items-center">
  95. <image class="mr-6 icon-right" src="@/static/img/order/yhq.png" mode=""></image>
  96. <view class="fs-28 fc-3">
  97. 优惠券
  98. </view>
  99. </view>
  100. <view class="fs-32 fc-FB3D03">
  101. -¥{{infoData.coupon_money}}
  102. </view>
  103. </view> -->
  104. <view class="align-items-center flex-justify-end">
  105. <view class="fs-28 fc-9">
  106. 共{{infoData.goods_number}}件,
  107. </view>
  108. <view class="fs-28 fc-3">
  109. 金额
  110. </view>
  111. <view class="fs-24 fw-600 fc-3">
  112. ¥
  113. </view>
  114. <view class="fs-36 fw-600 fc-3">
  115. {{infoData.pay_money}}
  116. </view>
  117. </view>
  118. </view>
  119. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  120. <view class="display-flex flex-justify-space mb-26">
  121. <view class="fs-28 fc-9">
  122. 配送地址
  123. </view>
  124. <view class="fs-28 fc-3 w-480 text-align-right">
  125. {{infoData.address}}
  126. </view>
  127. </view>
  128. <!-- <view class="display-flex flex-justify-space mb-26">
  129. <view class="fs-28 fc-9">
  130. 配送时间
  131. </view>
  132. <view class="fs-28 fc-3 w-480 text-align-right">
  133. 预约配送
  134. </view>
  135. </view> -->
  136. <!-- <view class="display-flex flex-justify-space pb-20 b-b-F9F9F9 mb-26" v-show="infoData.order_status == 3">
  137. <view class="fs-28 fc-9">
  138. 骑手信息
  139. </view>
  140. <view class="fs-28 fc-3 w-480 text-align-right">
  141. {{infoData.rider.rider_name}}{{infoData.rider.phone}}
  142. </view>
  143. </view> -->
  144. <view class="display-flex flex-justify-space mb-26">
  145. <view class="fs-28 fc-9">
  146. 订单编号
  147. </view>
  148. <view class="align-items-center flex-justify-end">
  149. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  150. {{infoData.order_sn}}
  151. </view>
  152. <image class="icon-fz" src="@/static/img/order/fz.png" mode=""></image>
  153. </view>
  154. </view>
  155. <view class="display-flex flex-justify-space mb-26">
  156. <view class="fs-28 fc-9">
  157. 下单时间
  158. </view>
  159. <view class="fs-28 fc-3 w-480 text-align-right">
  160. {{infoData.created_at}}
  161. </view>
  162. </view>
  163. <view class="display-flex flex-justify-space mb-26">
  164. <view class="fs-28 fc-9">
  165. 支付方式
  166. </view>
  167. <view class="fs-28 fc-3 w-480 text-align-right">
  168. {{infoData.pay_type_str}}
  169. </view>
  170. </view>
  171. <view class="display-flex flex-justify-space">
  172. <view class="fs-28 fc-9">
  173. 备注
  174. </view>
  175. <view class="fs-28 fc-3 w-480 text-align-right">
  176. {{infoData.note?infoData.note:'无'}}
  177. </view>
  178. </view>
  179. </view>
  180. </scroll-view>
  181. </view>
  182. </template>
  183. <script>
  184. import {
  185. ticketPay
  186. } from '@/api/ticket.js';
  187. import {
  188. ticketOrderInfo
  189. } from "@/api/ticketOrder.js"
  190. import tools from '@/service/tools';
  191. export default {
  192. components: {},
  193. data() {
  194. return {
  195. goodsData: [{
  196. name: '1'
  197. }, {
  198. name: '2'
  199. }],
  200. infoData: {},
  201. time: {
  202. day: '',
  203. h: "",
  204. m: '',
  205. s: '',
  206. },
  207. };
  208. },
  209. onLoad(data) {
  210. if (data) {
  211. this.ticketOrderInfo(data.orderId)
  212. }
  213. },
  214. mounted() {},
  215. methods: {
  216. goToUrl() {
  217. uni.navigateTo({
  218. url: '/pages-buy/ticket'
  219. })
  220. },
  221. pay() {
  222. this.ticketPay(this.infoData.id)
  223. },
  224. ticketPay(id) {
  225. // 票务支付
  226. ticketPay({
  227. order_id: id
  228. }).then((ret) => {
  229. if (ret.code === 1) {
  230. uni.requestPayment({
  231. provider: "wxpay", //支付类型-固定值
  232. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  233. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  234. package: ret.data.wx_pay.package, // 固定值
  235. signType: ret.data.wx_pay.signType, //固定值
  236. paySign: ret.data.wx_pay.paySign, //签名
  237. success: (ren) => {
  238. tools.success("支付成功");
  239. this.isAJAX = false;
  240. this.ticketOrderInfo(this.infoData.id)
  241. },
  242. fail: (err) => {
  243. this.isAJAX = false;
  244. tools.error("支付失败");
  245. },
  246. });
  247. } else {
  248. this.isAJAX = false;
  249. tools.error("支付失败");
  250. }
  251. })
  252. },
  253. scrolltolower() {
  254. // console.log('触底');
  255. },
  256. ticketOrderInfo(id) {
  257. ticketOrderInfo({
  258. order_id: id
  259. }).then((res) => {
  260. if (res.code == 1) {
  261. this.infoData = res.data
  262. if (this.infoData.order_status == 1) {
  263. // setInterval(() => {
  264. let currentDate = new Date(); //获取当前时间
  265. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  266. createDate.setMinutes(createDate.getMinutes() + 10)
  267. console.log(createDate, '----------------');
  268. let disDate = (currentDate - createDate) / 1000; //计算相隔分钟
  269. let m = parseInt(disDate / 60 % 60, 10); //计算剩余的分钟数
  270. let s = parseInt(disDate % 60, 10); //计算剩余的秒数
  271. this.time = m + ":" + s
  272. // }, 1000)
  273. }
  274. }
  275. })
  276. },
  277. setCountDown(sTime) {
  278. let end = new Date(sTime.replace(/-/g, "/")).getTime();
  279. let now = new Date().getTime();
  280. let msec = end - now;
  281. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  282. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  283. let m = parseInt(msec / 1000 / 60 % 60);
  284. let s = parseInt(msec / 1000 % 60);
  285. this.time.h = h > 9 ? h : '0' + h;
  286. this.time.m = m > 9 ? m : '0' + m;
  287. this.time.s = s > 9 ? s : '0' + s;
  288. msec -= 1000;
  289. if (this.time.day >= 1) {
  290. this.showTime = true;
  291. } else {
  292. this.showTime = false;
  293. };
  294. if (msec >= 0) {
  295. setTimeout(() => {
  296. this.setCountDown(sTime);
  297. }, 1000);
  298. } else {
  299. this.isTimeEnd = true;
  300. this.bText = '活动结束';
  301. this.time.h = '--';
  302. this.time.m = '--';
  303. this.time.s = '--';
  304. };
  305. }
  306. },
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .bg-img {
  311. position: fixed;
  312. left: 0;
  313. top: 0;
  314. z-index: -1;
  315. width: 100%;
  316. height: 320rpx;
  317. }
  318. .w-33 {
  319. width: 33%;
  320. position: relative;
  321. }
  322. .item-box-button {
  323. position: absolute;
  324. width: 100%;
  325. height: 88rpx;
  326. top: 0;
  327. left: 0;
  328. z-index: 100;
  329. background-color: transparent;
  330. border: none !important;
  331. }
  332. button::after {
  333. border: none !important;
  334. }
  335. .p-24-24-0 {
  336. padding: 24rpx 24rpx 0;
  337. }
  338. .icon {
  339. width: 48rpx;
  340. height: 48rpx;
  341. }
  342. .w-420 {
  343. width: 420rpx;
  344. }
  345. .goods-img {
  346. width: 108rpx;
  347. height: 108rpx;
  348. border-radius: 8rpx;
  349. }
  350. .w-300 {
  351. width: 300rpx;
  352. }
  353. .icon-right {
  354. width: 32rpx;
  355. height: 32rpx;
  356. }
  357. .w-480 {
  358. width: 480rpx;
  359. }
  360. .icon-fz {
  361. width: 24rpx;
  362. height: 24rpx;
  363. }
  364. .goods-box {
  365. overflow: hidden;
  366. }
  367. .goodsShowOne {
  368. max-height: 508rpx;
  369. transition: all .5s linear;
  370. }
  371. .goodsShowTwo {
  372. height: auto;
  373. transition: all .5s linear;
  374. }
  375. </style>