laundry-info.vue 9.8 KB

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