express-info.vue 11 KB

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