ticket-info.vue 9.8 KB

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