group-info.vue 12 KB

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