group-info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 mb-16">
  16. {{infoData.order_status_str}}
  17. </view>
  18. <view class="fs-30 fc-9">
  19. 请在{{infoData.end_time}}前到店消费
  20. </view>
  21. </view>
  22. <view class="bgc-f b-rad-20 p-24 box-border-box">
  23. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3" v-show="infoData.order_status == 1">
  24. 请尽快支付
  25. </view>
  26. <view class="p-b-20 mb-24 b-b-F9F9F9 fs-32 fc-3" v-show="infoData.order_status == 4">
  27. 感谢你对君子校园的信任,期待你再次光临
  28. </view>
  29. <view class="align-items-center flex-wrap-wrap">
  30. <view @click="pay" class="w-33 flex-direction align-items-center"
  31. v-show="infoData.order_status == 1">
  32. <image class="mb-4 icon" src="@/static/img/order/qzf.png" mode=""></image>
  33. <view class="fs-24 fc-41ABF5">
  34. 去支付
  35. </view>
  36. </view>
  37. <view @click="goToUrl" class="w-33 flex-direction align-items-center"
  38. v-show="infoData.order_status == 2 || infoData.order_status == 3 || infoData.order_status == 4">
  39. <image class="mb-4 icon" src="@/static/img/order/zlyd.png" mode=""></image>
  40. <view class="fs-24 fc-41ABF5">
  41. 再来一单
  42. </view>
  43. </view>
  44. <view @click="goRefund" class="w-33 flex-direction align-items-center"
  45. v-show="infoData.order_status == 2">
  46. <image class="mb-4 icon" src="@/static/img/order/tk.png" mode=""></image>
  47. <view class="fs-24 fc-3">
  48. 极速退款
  49. </view>
  50. </view>
  51. <view class="w-33 flex-direction align-items-center">
  52. <button class="item-box-button" open-type="contact" :bindcontact="handleContact"></button>
  53. <image class="mb-4 icon" src="@/static/img/order/lxkf.png" mode=""></image>
  54. <view class="fs-24 fc-3">
  55. 联系客服
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  62. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  63. <view class="goods-box">
  64. <view class="align-items-center flex-justify-space mb-20">
  65. <image class="goods-img mr-16 flex-shrink0" :src="infoData.goods_img" mode=""></image>
  66. <view class="">
  67. <view class="align-items-center flex-justify-space mb-2">
  68. <view class="fs-28 fc-3 w-300 text-overflow-ellipsis-one mr-36">
  69. {{infoData.goods_name}}
  70. </view>
  71. <view class="fs-32 fc-3 fw-600">
  72. ¥{{(Number(infoData.goods_price)*Number(infoData.goods_number)).toFixed(2)}}
  73. </view>
  74. </view>
  75. <view class="fs-24 fc-9">
  76. x{{infoData.goods_number}}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="align-items-center flex-justify-end">
  82. <view class="fs-28 fc-9">
  83. 共{{infoData.goods_number}}件,
  84. </view>
  85. <view class="fs-28 fc-3">
  86. 合计
  87. </view>
  88. <view class="fs-24 fw-600 fc-3">
  89. ¥
  90. </view>
  91. <view class="fs-36 fw-600 fc-3">
  92. {{infoData.pay_money}}
  93. </view>
  94. </view>
  95. </view>
  96. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20 align-items-center flex-justify-space">
  97. <view class="fs-32 fc-3 fw-600">
  98. 券码信息({{infoData.code_num}}张可用)
  99. </view>
  100. <view class="goBut text-align-center fs-26 b-r-ccc b-rad-200" @click="goCode">
  101. 查看券码
  102. </view>
  103. </view>
  104. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  105. <view class="align-items-center flex-justify-space mb-20">
  106. <view class="text-overflow-ellipsis-one fs-32 fc-3 fw-600">
  107. {{infoData.shop.shop_name}}
  108. </view>
  109. <view class="align-items-center flex-shrink0" @click="contactShop(infoData.shop.shop_phone)">
  110. <uni-icons type="phone-filled" size="15" class="mr-12"></uni-icons>
  111. <view class="fs-24">
  112. 联系商家
  113. </view>
  114. </view>
  115. </view>
  116. <view class="fs-26 fc-9 mb-20">
  117. 营业时间:{{timeData}}
  118. </view>
  119. <view class="fs-26 fc-9">
  120. 店铺地址:{{infoData.shop.city_name}} {{infoData.shop.address}}
  121. </view>
  122. </view>
  123. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  124. <view class="display-flex flex-justify-space mb-26">
  125. <view class="fs-28 fc-9">
  126. 订单编号
  127. </view>
  128. <view class="align-items-center flex-justify-end">
  129. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  130. {{infoData.order_sn}}
  131. </view>
  132. <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
  133. </image>
  134. </view>
  135. </view>
  136. <view class="display-flex flex-justify-space mb-26">
  137. <view class="fs-28 fc-9">
  138. 下单时间
  139. </view>
  140. <view class="fs-28 fc-3 w-480 text-align-right">
  141. {{infoData.created_at}}
  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="fs-28 fc-3 w-480 text-align-right">
  149. {{infoData.pay_type_str}}
  150. </view>
  151. </view>
  152. <view class="display-flex flex-justify-space">
  153. <view class="fs-28 fc-9">
  154. 备注
  155. </view>
  156. <view class="fs-28 fc-3 w-480 text-align-right">
  157. {{infoData.note?infoData.note:'无'}}
  158. </view>
  159. </view>
  160. </view>
  161. </scroll-view>
  162. </view>
  163. </template>
  164. <script>
  165. import {
  166. groupOrderInfo,
  167. groupPay
  168. } from "@/api/groupOrder.js"
  169. import tools from "@/service/tools";
  170. export default {
  171. components: {},
  172. data() {
  173. return {
  174. goodsData: [{
  175. name: '1'
  176. }, {
  177. name: '2'
  178. }],
  179. infoData: {},
  180. time: {
  181. day: '',
  182. h: "",
  183. m: '',
  184. s: '',
  185. },
  186. timeData: '',
  187. isAJAX: false
  188. };
  189. },
  190. onShow() {
  191. uni.$on('groupRefund', (data) => {
  192. console.log(data, '^^^^^^^^^^^^^^^^^^^^^^^^^');
  193. this.groupOrderInfo(data)
  194. })
  195. },
  196. onLoad(data) {
  197. if (data) {
  198. this.groupOrderInfo(data.orderId)
  199. }
  200. },
  201. mounted() {},
  202. onUnload() {
  203. const takeOutData = {}
  204. groupOrderInfo({
  205. order_id: this.infoData.id
  206. }).then((res) => {
  207. if (res.code == 1) {
  208. takeOutData.id = this.infoData.id
  209. takeOutData.order_status = res.data.order_status
  210. takeOutData.order_status_str = res.data.order_status_str
  211. uni.$emit('takeOutData', takeOutData)
  212. }
  213. })
  214. },
  215. methods: {
  216. goRefund() {
  217. uni.navigateTo({
  218. url: '/pages-buy/group-refund?order_id=' + this.infoData.id
  219. })
  220. },
  221. goCode() {
  222. uni.navigateTo({
  223. url: '/pages-buy/group-code?order_id=' + this.infoData.id
  224. })
  225. },
  226. contactShop(phone) {
  227. uni.makePhoneCall({
  228. phoneNumber: phone, // 电话号码
  229. success: function() {
  230. console.log('拨打电话成功');
  231. },
  232. fail: function() {
  233. console.log('拨打电话失败');
  234. }
  235. });
  236. },
  237. setTimeData(timeData) {
  238. let time = ''
  239. let array = ''
  240. console.log(timeData, '11111');
  241. timeData.forEach((v, k) => {
  242. v.forEach((i, j) => {
  243. let timeTwo = ''
  244. if (j == 0 || j == 3) {
  245. timeTwo = i + '-'
  246. } else {
  247. timeTwo = i
  248. }
  249. array = array + timeTwo
  250. })
  251. if (timeData.length === k + 1) {
  252. time = time + array + ''
  253. } else {
  254. time = time + array + ' / '
  255. }
  256. array = ''
  257. })
  258. console.log(time);
  259. return time
  260. },
  261. copy(value) {
  262. uni.setClipboardData({
  263. data: value,
  264. success() {
  265. tools.success('复制成功')
  266. },
  267. fail() {
  268. tools.error("复制失败")
  269. }
  270. })
  271. },
  272. goToUrl() {
  273. uni.navigateTo({
  274. url: '/pages-buy/group-shop?shop_id=' + this.infoData.shop_id
  275. })
  276. },
  277. pay() {
  278. this.groupPay(this.infoData.id)
  279. },
  280. groupPay(id) {
  281. // 团购支付
  282. if (this.isAJAX) {
  283. return
  284. }
  285. this.isAJAX = true;
  286. groupPay({
  287. order_id: id
  288. }).then((ret) => {
  289. if (ret.code === 1) {
  290. uni.requestPayment({
  291. provider: "wxpay", //支付类型-固定值
  292. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  293. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  294. package: ret.data.wx_pay.package, // 固定值
  295. signType: ret.data.wx_pay.signType, //固定值
  296. paySign: ret.data.wx_pay.paySign, //签名
  297. success: (ren) => {
  298. tools.success("支付成功");
  299. this.isAJAX = false;
  300. this.groupOrderInfo(this.infoData.id)
  301. },
  302. fail: (err) => {
  303. this.isAJAX = false;
  304. tools.error("支付失败");
  305. },
  306. });
  307. } else {
  308. this.isAJAX = false;
  309. tools.error("支付失败");
  310. }
  311. })
  312. },
  313. scrolltolower() {
  314. // console.log('触底');
  315. },
  316. groupOrderInfo(id) {
  317. groupOrderInfo({
  318. order_id: id
  319. }).then((res) => {
  320. if (res.code == 1) {
  321. this.timeData = this.setTimeData(res.data.shop.business_hours)
  322. this.infoData = res.data
  323. if (this.infoData.order_status == 1) {
  324. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  325. createDate.setMinutes(createDate.getMinutes() + 10)
  326. this.setCountDown(createDate)
  327. }
  328. }
  329. })
  330. },
  331. setCountDown(sTime) {
  332. let end = new Date(sTime).getTime();
  333. let now = new Date().getTime();
  334. let msec = end - now;
  335. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  336. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  337. let m = parseInt(msec / 1000 / 60 % 60);
  338. let s = parseInt(msec / 1000 % 60);
  339. this.time.h = h > 9 ? h : '0' + h;
  340. this.time.m = m > 9 ? m : '0' + m;
  341. this.time.s = s > 9 ? s : '0' + s;
  342. msec -= 1000;
  343. if (this.time.day >= 1) {
  344. this.showTime = true;
  345. } else {
  346. this.showTime = false;
  347. };
  348. if (msec >= 0) {
  349. setTimeout(() => {
  350. this.setCountDown(sTime);
  351. }, 1000);
  352. } else {
  353. this.isTimeEnd = true;
  354. this.bText = '活动结束';
  355. this.time.h = '--';
  356. this.time.m = '--';
  357. this.time.s = '--';
  358. };
  359. }
  360. },
  361. }
  362. </script>
  363. <style lang="scss" scoped>
  364. .goBut {
  365. padding: 10rpx 15rpx;
  366. box-sizing: border-box;
  367. }
  368. .bg-img {
  369. position: fixed;
  370. left: 0;
  371. top: 0;
  372. z-index: -1;
  373. width: 100%;
  374. height: 320rpx;
  375. }
  376. .w-33 {
  377. width: 33%;
  378. position: relative;
  379. }
  380. .p-24-24-0 {
  381. padding: 24rpx 24rpx 0;
  382. }
  383. .icon {
  384. width: 48rpx;
  385. height: 48rpx;
  386. }
  387. .w-420 {
  388. width: 420rpx;
  389. }
  390. .goods-img {
  391. width: 108rpx;
  392. height: 108rpx;
  393. border-radius: 8rpx;
  394. }
  395. .w-300 {
  396. width: 300rpx;
  397. }
  398. .item-box-button {
  399. position: absolute;
  400. width: 100%;
  401. height: 88rpx;
  402. top: 0;
  403. left: 0;
  404. z-index: 100;
  405. background-color: transparent;
  406. border: none !important;
  407. }
  408. button::after {
  409. border: none !important;
  410. }
  411. .icon-right {
  412. width: 32rpx;
  413. height: 32rpx;
  414. }
  415. .w-480 {
  416. width: 480rpx;
  417. }
  418. .icon-fz {
  419. width: 24rpx;
  420. height: 24rpx;
  421. }
  422. .goods-box {
  423. overflow: hidden;
  424. }
  425. .goodsShowOne {
  426. max-height: 508rpx;
  427. transition: all .5s linear;
  428. }
  429. .goodsShowTwo {
  430. height: auto;
  431. transition: all .5s linear;
  432. }
  433. </style>