ticket-info.vue 9.6 KB

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