group-info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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">
  97. <view class="align-items-center flex-justify-space mb-20">
  98. <view class="text-overflow-ellipsis-one fs-32 fc-3 fw-600">
  99. {{infoData.shop.shop_name}}
  100. </view>
  101. <view class="align-items-center flex-shrink0" @click="contactShop(infoData.shop.shop_phone)">
  102. <uni-icons type="phone-filled" size="15" class="mr-12"></uni-icons>
  103. <view class="fs-24">
  104. 联系商家
  105. </view>
  106. </view>
  107. </view>
  108. <view class="fs-26 fc-9 mb-20">
  109. 营业时间:{{timeData}}
  110. </view>
  111. <view class="fs-26 fc-9">
  112. 店铺地址:{{infoData.shop.city_name}} {{infoData.shop.address}}
  113. </view>
  114. </view>
  115. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  116. <view class="display-flex flex-justify-space mb-26">
  117. <view class="fs-28 fc-9">
  118. 订单编号
  119. </view>
  120. <view class="align-items-center flex-justify-end">
  121. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  122. {{infoData.order_sn}}
  123. </view>
  124. <image class="icon-fz" src="@/static/img/order/fz.png" mode="" @click="copy(infoData.order_sn)">
  125. </image>
  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. {{infoData.created_at}}
  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.pay_type_str}}
  142. </view>
  143. </view>
  144. <view class="display-flex flex-justify-space">
  145. <view class="fs-28 fc-9">
  146. 备注
  147. </view>
  148. <view class="fs-28 fc-3 w-480 text-align-right">
  149. {{infoData.note?infoData.note:'无'}}
  150. </view>
  151. </view>
  152. </view>
  153. </scroll-view>
  154. </view>
  155. </template>
  156. <script>
  157. import {
  158. groupOrderInfo,
  159. groupPay
  160. } from "@/api/groupOrder.js"
  161. import tools from "@/service/tools";
  162. export default {
  163. components: {},
  164. data() {
  165. return {
  166. goodsData: [{
  167. name: '1'
  168. }, {
  169. name: '2'
  170. }],
  171. infoData: {},
  172. time: {
  173. day: '',
  174. h: "",
  175. m: '',
  176. s: '',
  177. },
  178. timeData: '',
  179. isAJAX: false
  180. };
  181. },
  182. onShow() {
  183. uni.$on('groupRefund', (data) => {
  184. console.log(data, '^^^^^^^^^^^^^^^^^^^^^^^^^');
  185. this.groupOrderInfo(data)
  186. })
  187. },
  188. onLoad(data) {
  189. if (data) {
  190. this.groupOrderInfo(data.orderId)
  191. }
  192. },
  193. mounted() {},
  194. onUnload() {
  195. const takeOutData = {}
  196. groupOrderInfo({
  197. order_id: this.infoData.id
  198. }).then((res) => {
  199. if (res.code == 1) {
  200. takeOutData.id = this.infoData.id
  201. takeOutData.order_status = res.data.order_status
  202. takeOutData.order_status_str = res.data.order_status_str
  203. uni.$emit('takeOutData', takeOutData)
  204. }
  205. })
  206. },
  207. methods: {
  208. goRefund() {
  209. uni.navigateTo({
  210. url: '/pages-buy/group-refund?order_id=' + this.infoData.id
  211. })
  212. },
  213. contactShop(phone) {
  214. uni.makePhoneCall({
  215. phoneNumber: phone, // 电话号码
  216. success: function() {
  217. console.log('拨打电话成功');
  218. },
  219. fail: function() {
  220. console.log('拨打电话失败');
  221. }
  222. });
  223. },
  224. setTimeData(timeData) {
  225. let time = ''
  226. let array = ''
  227. console.log(timeData,'11111');
  228. timeData.forEach((v, k) => {
  229. v.forEach((i, j) => {
  230. let timeTwo = ''
  231. if (j == 0 || j == 3) {
  232. timeTwo = i + '-'
  233. } else {
  234. timeTwo = i
  235. }
  236. array = array + timeTwo
  237. })
  238. if (timeData.length === k + 1) {
  239. time = time + array + ''
  240. } else {
  241. time = time + array + ' / '
  242. }
  243. array = ''
  244. })
  245. console.log(time);
  246. return time
  247. },
  248. copy(value) {
  249. uni.setClipboardData({
  250. data: value,
  251. success() {
  252. tools.success('复制成功')
  253. },
  254. fail() {
  255. tools.error("复制失败")
  256. }
  257. })
  258. },
  259. goToUrl() {
  260. uni.navigateTo({
  261. url: '/pages-buy/group'
  262. })
  263. },
  264. pay() {
  265. this.groupPay(this.infoData.id)
  266. },
  267. groupPay(id) {
  268. // 团购支付
  269. if (this.isAJAX) {
  270. return
  271. }
  272. this.isAJAX = true;
  273. groupPay({
  274. order_id: id
  275. }).then((ret) => {
  276. if (ret.code === 1) {
  277. uni.requestPayment({
  278. provider: "wxpay", //支付类型-固定值
  279. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  280. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  281. package: ret.data.wx_pay.package, // 固定值
  282. signType: ret.data.wx_pay.signType, //固定值
  283. paySign: ret.data.wx_pay.paySign, //签名
  284. success: (ren) => {
  285. tools.success("支付成功");
  286. this.isAJAX = false;
  287. this.groupOrderInfo(this.infoData.id)
  288. },
  289. fail: (err) => {
  290. this.isAJAX = false;
  291. tools.error("支付失败");
  292. },
  293. });
  294. } else {
  295. this.isAJAX = false;
  296. tools.error("支付失败");
  297. }
  298. })
  299. },
  300. scrolltolower() {
  301. // console.log('触底');
  302. },
  303. groupOrderInfo(id) {
  304. groupOrderInfo({
  305. order_id: id
  306. }).then((res) => {
  307. if (res.code == 1) {
  308. this.timeData = this.setTimeData(res.data.shop.business_hours)
  309. this.infoData = res.data
  310. if (this.infoData.order_status == 1) {
  311. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  312. createDate.setMinutes(createDate.getMinutes() + 10)
  313. this.setCountDown(createDate)
  314. }
  315. }
  316. })
  317. },
  318. setCountDown(sTime) {
  319. let end = new Date(sTime).getTime();
  320. let now = new Date().getTime();
  321. let msec = end - now;
  322. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  323. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  324. let m = parseInt(msec / 1000 / 60 % 60);
  325. let s = parseInt(msec / 1000 % 60);
  326. this.time.h = h > 9 ? h : '0' + h;
  327. this.time.m = m > 9 ? m : '0' + m;
  328. this.time.s = s > 9 ? s : '0' + s;
  329. msec -= 1000;
  330. if (this.time.day >= 1) {
  331. this.showTime = true;
  332. } else {
  333. this.showTime = false;
  334. };
  335. if (msec >= 0) {
  336. setTimeout(() => {
  337. this.setCountDown(sTime);
  338. }, 1000);
  339. } else {
  340. this.isTimeEnd = true;
  341. this.bText = '活动结束';
  342. this.time.h = '--';
  343. this.time.m = '--';
  344. this.time.s = '--';
  345. };
  346. }
  347. },
  348. }
  349. </script>
  350. <style lang="scss" scoped>
  351. .bg-img {
  352. position: fixed;
  353. left: 0;
  354. top: 0;
  355. z-index: -1;
  356. width: 100%;
  357. height: 320rpx;
  358. }
  359. .w-33 {
  360. width: 33%;
  361. position: relative;
  362. }
  363. .p-24-24-0 {
  364. padding: 24rpx 24rpx 0;
  365. }
  366. .icon {
  367. width: 48rpx;
  368. height: 48rpx;
  369. }
  370. .w-420 {
  371. width: 420rpx;
  372. }
  373. .goods-img {
  374. width: 108rpx;
  375. height: 108rpx;
  376. border-radius: 8rpx;
  377. }
  378. .w-300 {
  379. width: 300rpx;
  380. }
  381. .item-box-button {
  382. position: absolute;
  383. width: 100%;
  384. height: 88rpx;
  385. top: 0;
  386. left: 0;
  387. z-index: 100;
  388. background-color: transparent;
  389. border: none !important;
  390. }
  391. button::after {
  392. border: none !important;
  393. }
  394. .icon-right {
  395. width: 32rpx;
  396. height: 32rpx;
  397. }
  398. .w-480 {
  399. width: 480rpx;
  400. }
  401. .icon-fz {
  402. width: 24rpx;
  403. height: 24rpx;
  404. }
  405. .goods-box {
  406. overflow: hidden;
  407. }
  408. .goodsShowOne {
  409. max-height: 508rpx;
  410. transition: all .5s linear;
  411. }
  412. .goodsShowTwo {
  413. height: auto;
  414. transition: all .5s linear;
  415. }
  416. </style>