laundry-info.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 class="w-33 flex-direction align-items-center" @click="pay"
  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 == 5 || infoData.order_status == 6 || infoData.order_status == 7">
  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 class="w-33 flex-direction align-items-center" v-show="infoData.order_status == 2"
  49. @click="cancelOrder">
  50. <image class="mb-4 icon" src="@/static/img/order/qxdd.png" mode=""></image>
  51. <view class="fs-24 fc-3">
  52. 取消订单
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  59. <view class="bgc-f b-rad-20 p-24 box-border-box mb-20">
  60. <view class="w-420 fc-3 fs-32 fw-600 text-overflow-ellipsis-one mb-24">
  61. {{infoData.site_name}}
  62. </view>
  63. <view class="goods-box" :class="infoData.item.length >= 4 && goodsShow?'goodsShowOne':'goodsShowTwo'">
  64. <view class="align-items-center flex-justify-space mb-20" v-for="(item,index) in infoData.item">
  65. <image class="goods-img mr-16" :src="item.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-376 text-overflow-ellipsis-one mr-36">
  69. {{item.goods_name}}
  70. </view>
  71. <view class="fs-32 fc-3 fw-600">
  72. ¥{{item.goods_money}}
  73. </view>
  74. </view>
  75. <view class="fs-24 fc-9">
  76. x{{item.goods_num}}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="align-items-center flex-justify-center p-24 b-b-F9F9F9 mb-32" @click="openGoods"
  82. v-if="infoData.item.length > 4">
  83. <view class="fs-24 fc-9 mr-4">
  84. {{goodsShow?'展开':'收起'}}{{infoData.item.length - 4}}件商品
  85. </view>
  86. <image v-if="goodsShow" class="icon-right" src="@/static/img/order/top.png" mode=""></image>
  87. <image v-else class="icon-right" src="@/static/img/order/bottom.png" mode=""></image>
  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">
  105. <view class="display-flex flex-justify-space mb-26">
  106. <view class="fs-28 fc-9">
  107. 订单编号
  108. </view>
  109. <view class="align-items-center flex-justify-end">
  110. <view class="fs-28 fc-3 w-480 mr-8 text-align-right">
  111. {{infoData.order_sn}}
  112. </view>
  113. <image class="icon-fz" src="@/static/img/order/fz.png" mode=""></image>
  114. </view>
  115. </view>
  116. <view class="display-flex flex-justify-space mb-26">
  117. <view class="fs-28 fc-9">
  118. 下单时间
  119. </view>
  120. <view class="fs-28 fc-3 w-480 text-align-right">
  121. {{infoData.created_at}}
  122. </view>
  123. </view>
  124. <view class="display-flex flex-justify-space mb-26">
  125. <view class="fs-28 fc-9">
  126. 支付方式
  127. </view>
  128. <view class="fs-28 fc-3 w-480 text-align-right">
  129. {{infoData.pay_type_str}}
  130. </view>
  131. </view>
  132. <view class="display-flex flex-justify-space mb-26">
  133. <view class="fs-28 fc-9">
  134. 备注
  135. </view>
  136. <view class="fs-28 fc-3 w-480 text-align-right">
  137. {{infoData.note?infoData.note:'无'}}
  138. </view>
  139. </view>
  140. </view>
  141. </scroll-view>
  142. </view>
  143. </template>
  144. <script>
  145. import {
  146. laundryOrderInfo,
  147. laundryOrderCancel,
  148. laundryPay
  149. } from "@/api/laundryOrder.js"
  150. export default {
  151. components: {},
  152. data() {
  153. return {
  154. goodsData: [{
  155. name: '1'
  156. }, {
  157. name: '2'
  158. }],
  159. goodsShow: true,
  160. infoData: {},
  161. time: {
  162. day: '',
  163. h: "",
  164. m: '',
  165. s: '',
  166. },
  167. isAJAX: false
  168. };
  169. },
  170. onLoad(data) {
  171. if (data) {
  172. console.log(data);
  173. this.laundryOrderInfo(data.orderId)
  174. }
  175. },
  176. mounted() {},
  177. methods: {
  178. goToUrl() {
  179. uni.navigateTo({
  180. url:'/pages-buy/dry-clean'
  181. })
  182. },
  183. pay() {
  184. this.getExpressPay(this.infoData.id)
  185. },
  186. getExpressPay(id) {
  187. // 干洗支付
  188. getExpressPay({
  189. order_id: id
  190. }).then((ret) => {
  191. if (ret.code === 1) {
  192. uni.requestPayment({
  193. provider: "wxpay", //支付类型-固定值
  194. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  195. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  196. package: ret.data.wx_pay.package, // 固定值
  197. signType: ret.data.wx_pay.signType, //固定值
  198. paySign: ret.data.wx_pay.paySign, //签名
  199. success: (ren) => {
  200. tools.success("支付成功");
  201. this.isAJAX = false;
  202. this.laundryOrderInfo(this.infoData.id)
  203. },
  204. fail: (err) => {
  205. this.isAJAX = false;
  206. tools.error("支付失败");
  207. },
  208. });
  209. } else {
  210. this.isAJAX = false;
  211. tools.error("支付失败");
  212. }
  213. })
  214. },
  215. cancelOrder() {
  216. // 干洗取消订单
  217. laundryOrderCancel({
  218. order_id: this.infoData.id
  219. }).then((res) => {
  220. if (res.code == 1) {
  221. tools.success(res.msg)
  222. this.laundryOrderInfo(infoData.id)
  223. } else {
  224. tools.error(res.msg)
  225. }
  226. })
  227. },
  228. openGoods() {
  229. this.goodsShow = !this.goodsShow
  230. },
  231. scrolltolower() {
  232. // console.log('触底');
  233. },
  234. laundryOrderInfo(id) {
  235. laundryOrderInfo({
  236. order_id: id
  237. }).then((res) => {
  238. if (res.code == 1) {
  239. this.infoData = res.data
  240. if (this.infoData.order_status == 1) {
  241. let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
  242. createDate.setMinutes(createDate.getMinutes() + 10)
  243. this.setCountDown(createDate)
  244. }
  245. }
  246. })
  247. },
  248. setCountDown(sTime) {
  249. let end = new Date(sTime).getTime();
  250. let now = new Date().getTime();
  251. let msec = end - now;
  252. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  253. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  254. let m = parseInt(msec / 1000 / 60 % 60);
  255. let s = parseInt(msec / 1000 % 60);
  256. this.time.h = h > 9 ? h : '0' + h;
  257. this.time.m = m > 9 ? m : '0' + m;
  258. this.time.s = s > 9 ? s : '0' + s;
  259. msec -= 1000;
  260. if (this.time.day >= 1) {
  261. this.showTime = true;
  262. } else {
  263. this.showTime = false;
  264. };
  265. if (msec >= 0) {
  266. setTimeout(() => {
  267. this.setCountDown(sTime);
  268. }, 1000);
  269. } else {
  270. this.isTimeEnd = true;
  271. this.bText = '活动结束';
  272. this.time.h = '--';
  273. this.time.m = '--';
  274. this.time.s = '--';
  275. };
  276. }
  277. },
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .bg-img {
  282. position: fixed;
  283. left: 0;
  284. top: 0;
  285. z-index: -1;
  286. width: 100%;
  287. height: 320rpx;
  288. }
  289. .w-33 {
  290. width: 33%;
  291. position: relative;
  292. }
  293. .item-box-button {
  294. position: absolute;
  295. width: 100%;
  296. height: 88rpx;
  297. top: 0;
  298. left: 0;
  299. z-index: 100;
  300. background-color: transparent;
  301. border: none !important;
  302. }
  303. button::after {
  304. border: none !important;
  305. }
  306. .p-24-24-0 {
  307. padding: 24rpx 24rpx 0;
  308. }
  309. .icon {
  310. width: 48rpx;
  311. height: 48rpx;
  312. }
  313. .w-420 {
  314. width: 420rpx;
  315. }
  316. .goods-img {
  317. width: 108rpx;
  318. height: 108rpx;
  319. border-radius: 8rpx;
  320. }
  321. .w-376 {
  322. width: 376rpx;
  323. }
  324. .icon-right {
  325. width: 32rpx;
  326. height: 32rpx;
  327. }
  328. .w-480 {
  329. width: 480rpx;
  330. }
  331. .icon-fz {
  332. width: 24rpx;
  333. height: 24rpx;
  334. }
  335. .goods-box {
  336. overflow: hidden;
  337. }
  338. .goodsShowOne {
  339. max-height: 508rpx;
  340. transition: all .5s linear;
  341. }
  342. .goodsShowTwo {
  343. height: auto;
  344. transition: all .5s linear;
  345. }
  346. </style>