ticket-info.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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="" @click="copy(infoData.order_sn)"></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. onUnload() {
  213. const takeOutData = {}
  214. ticketOrderInfo({
  215. order_id: this.infoData.id
  216. }).then((res) => {
  217. if (res.code == 1) {
  218. takeOutData.id = this.infoData.id
  219. takeOutData.order_status = res.data.order_status
  220. takeOutData.order_status_str = res.data.order_status_str
  221. uni.$emit('takeOutData', takeOutData)
  222. }
  223. })
  224. },
  225. methods: {
  226. copy(value) {
  227. uni.setClipboardData({
  228. data: value,
  229. success() {
  230. tools.success('复制成功')
  231. },
  232. fail() {
  233. tools.error("复制失败")
  234. }
  235. })
  236. },
  237. goToUrl() {
  238. uni.navigateTo({
  239. url: '/pages-buy/ticket'
  240. })
  241. },
  242. pay() {
  243. this.ticketPay(this.infoData.id)
  244. },
  245. ticketPay(id) {
  246. // 票务支付
  247. ticketPay({
  248. order_id: id
  249. }).then((ret) => {
  250. if (ret.code === 1) {
  251. uni.requestPayment({
  252. provider: "wxpay", //支付类型-固定值
  253. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  254. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  255. package: ret.data.wx_pay.package, // 固定值
  256. signType: ret.data.wx_pay.signType, //固定值
  257. paySign: ret.data.wx_pay.paySign, //签名
  258. success: (ren) => {
  259. tools.success("支付成功");
  260. this.isAJAX = false;
  261. this.ticketOrderInfo(this.infoData.id)
  262. },
  263. fail: (err) => {
  264. this.isAJAX = false;
  265. tools.error("支付失败");
  266. },
  267. });
  268. } else {
  269. this.isAJAX = false;
  270. tools.error("支付失败");
  271. }
  272. })
  273. },
  274. scrolltolower() {
  275. // console.log('触底');
  276. },
  277. ticketOrderInfo(id) {
  278. ticketOrderInfo({
  279. order_id: id
  280. }).then((res) => {
  281. if (res.code == 1) {
  282. this.infoData = res.data
  283. if (this.infoData.order_status == 1) {
  284. let currentDate = new Date(); //获取当前时间
  285. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  286. createDate.setMinutes(createDate.getMinutes() + 10)
  287. this.setCountDown(createDate)
  288. }
  289. }
  290. })
  291. },
  292. setCountDown(sTime) {
  293. let end = new Date(sTime).getTime();
  294. let now = new Date().getTime();
  295. let msec = end - now;
  296. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  297. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  298. let m = parseInt(msec / 1000 / 60 % 60);
  299. let s = parseInt(msec / 1000 % 60);
  300. this.time.h = h > 9 ? h : '0' + h;
  301. this.time.m = m > 9 ? m : '0' + m;
  302. this.time.s = s > 9 ? s : '0' + s;
  303. msec -= 1000;
  304. if (this.time.day >= 1) {
  305. this.showTime = true;
  306. } else {
  307. this.showTime = false;
  308. };
  309. if (msec >= 0) {
  310. setTimeout(() => {
  311. this.setCountDown(sTime);
  312. }, 1000);
  313. } else {
  314. this.isTimeEnd = true;
  315. this.bText = '活动结束';
  316. this.time.h = '--';
  317. this.time.m = '--';
  318. this.time.s = '--';
  319. };
  320. }
  321. },
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .bg-img {
  326. position: fixed;
  327. left: 0;
  328. top: 0;
  329. z-index: -1;
  330. width: 100%;
  331. height: 320rpx;
  332. }
  333. .w-33 {
  334. width: 33%;
  335. position: relative;
  336. }
  337. .item-box-button {
  338. position: absolute;
  339. width: 100%;
  340. height: 88rpx;
  341. top: 0;
  342. left: 0;
  343. z-index: 100;
  344. background-color: transparent;
  345. border: none !important;
  346. }
  347. button::after {
  348. border: none !important;
  349. }
  350. .p-24-24-0 {
  351. padding: 24rpx 24rpx 0;
  352. }
  353. .icon {
  354. width: 48rpx;
  355. height: 48rpx;
  356. }
  357. .w-420 {
  358. width: 420rpx;
  359. }
  360. .goods-img {
  361. width: 108rpx;
  362. height: 108rpx;
  363. border-radius: 8rpx;
  364. }
  365. .w-300 {
  366. width: 300rpx;
  367. }
  368. .icon-right {
  369. width: 32rpx;
  370. height: 32rpx;
  371. }
  372. .w-480 {
  373. width: 480rpx;
  374. }
  375. .icon-fz {
  376. width: 24rpx;
  377. height: 24rpx;
  378. }
  379. .goods-box {
  380. overflow: hidden;
  381. }
  382. .goodsShowOne {
  383. max-height: 508rpx;
  384. transition: all .5s linear;
  385. }
  386. .goodsShowTwo {
  387. height: auto;
  388. transition: all .5s linear;
  389. }
  390. </style>