group-info.vue 10 KB

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