orderDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <view class="orderDetails">
  3. <view class="list" @click="goOrderDetail">
  4. <view class="list-top">
  5. <view class="" style="font-size: 36rpx;font-weight: bold;color: #1E9F6A;">
  6. <text> {{orderinfo.status_text?orderinfo.status_text:''}}</text>
  7. <text v-show="orderinfo.refund_status!==0&&orderinfo.refund_status">(订单已申请退款)</text>
  8. <!-- 待付款 -->
  9. </view>
  10. <view class="" style="font-size: 22rpx;margin-top: 28rpx;">
  11. 订单号 {{orderinfo.code?orderinfo.code:''}}
  12. </view>
  13. </view>
  14. <view class="listcenter">
  15. <view class="l">
  16. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  17. <!-- 夕阳红康养团7日游 -->{{orderinfo.good_name?orderinfo.good_name:''}}
  18. </view>
  19. <view class="" style="margin: 20rpx 0 20rpx;font-size: 22rpx;color: #333333;">
  20. 日期:{{orderinfo.start_at?orderinfo.start_at:''}} ~ {{orderinfo.end_at?orderinfo.end_at:''}}
  21. </view>
  22. <view class="" style="color: #333333;">
  23. <!-- 标间床位 1人 -->
  24. <text>{{orderinfo.room.name?orderinfo.room.name:''}}</text>
  25. <text style="margin-left:160rpx ;">
  26. x {{orderinfo.number?orderinfo.number:''}} (人)
  27. </text>
  28. </view>
  29. </view>
  30. <view class="r">
  31. <view class="">
  32. <image :src="orderinfo.cover_picture" mode="widthFix"></image>
  33. </view>
  34. <view class="" style="margin: 28rpx 0 16rpx;">
  35. ¥{{orderinfo.price?orderinfo.price:''}}
  36. </view>
  37. <view class="">
  38. 合计 <text
  39. style="font-size: 36rpx;font-weight: 600;color: #333333;">¥{{orderinfo.amount?orderinfo.amount:''}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="list-bottom">
  44. <view style="margin-top: 10rpx;" v-for="item,index in orderinfo.travelers" :key="index">
  45. <view class="listIcon" style="margin-bottom: 20rpx;">
  46. <view class="listIconbox">
  47. <image src="../../static/orderListicon/user@2x.png" mode="aspectFit"></image>
  48. </view>
  49. <text>
  50. {{item.name?item.name:''}}
  51. </text>
  52. </view>
  53. <view class="listIcon" @click="goaggMes">
  54. <view class="listIconbox">
  55. <image src="../../static/orderListicon/mobile@2x.png" mode="aspectFit"></image>
  56. </view>
  57. <text class="">
  58. {{item.phone?item.phone:''}}
  59. </text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="travel">
  65. <view class="travelList">
  66. <view class="" style="font-size: 32rpx;font-weight: 600;color: #333333;margin-bottom: 70rpx;">
  67. 出行人列表
  68. </view>
  69. <image src="../../static/orderListicon/users02@2x.png" mode="widthFix"></image>
  70. </view>
  71. <view class="" v-for="item,index in orderinfo.travelers" :key="index">
  72. <view class="">{{item.name?item.name:''}}</view>
  73. <view class="" style="margin: 30rpx 0;">
  74. 证件类型:{{item.certificate_type_text?item.certificate_type_text:''}}</view>
  75. <view class="">性别:{{item.gender_text?item.gender_text:''}}</view>
  76. <view class="" style="margin: 30rpx 0;">证件号码:{{item.certificate_no?item.certificate_no:''}}</view>
  77. </view>
  78. </view>
  79. <view class="room">
  80. <view class=" title">
  81. <view class="" style="font-size: 32rpx;font-weight: 600;color: #333333;">
  82. 同住人列表
  83. </view>
  84. <image src="../../static/orderListicon/users02@2x.png" mode="aspectFit"></image>
  85. </view>
  86. <view class="roomList" v-for="item,index in orderinfo.cohabits" :key="index">
  87. <view class="">
  88. 同住人{{index+1}}
  89. </view>
  90. <view class="">
  91. {{item}}
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 待出行 -->
  96. <view class="navbar" v-if="state==1">
  97. <view class="navbar-item" @click="goafter" v-if="orderinfo.refund_status==0">
  98. <image src="../../static/orderListicon/login.png" mode="aspectFill"></image>
  99. <view class="">
  100. 申请退款
  101. </view>
  102. </view>
  103. <view class="line">
  104. </view>
  105. <view class="navbar-item">
  106. <image src="../../static/orderListicon/bookmark.png" mode="aspectFill"></image>
  107. <view class="" @click="goguide">
  108. 专属森林向导
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 待付款 -->
  113. <view class="navbar">
  114. <view class="navbar-item" @click="cancelOrder" v-if="status==1">
  115. <view class="navbariconbox">
  116. <image src="../../static/orderListicon/box-cancel.png" mode="aspectFill"></image>
  117. </view>
  118. <text class="">
  119. 取消订单
  120. </text>
  121. </view>
  122. <view class="line" v-if="status==1">
  123. </view>
  124. <view class="navbar-item" @click="goPay" v-if="status==1">
  125. <view class="navbariconbox">
  126. <image src="../../static/orderListicon/notepad.png" mode="aspectFill"></image>
  127. </view>
  128. <text class="">
  129. 去支付
  130. </text>
  131. </view>
  132. <view class="navbar-item" @click="buyAgin" v-if="status==4||status==3">
  133. <view class="navbariconbox">
  134. <image src="../../static/orderListicon/notepad.png" mode="aspectFill"></image>
  135. </view>
  136. <text class="">
  137. 再次预订
  138. </text>
  139. </view>
  140. <view class="navbar-item" v-if="status==2&&orderinfo.refund_status==0" @click="goAfterSale">
  141. <view class="navbariconbox">
  142. <image src="../../static/orderListicon/notepad.png" mode="aspectFill"></image>
  143. </view>
  144. <text class="">
  145. 申请退款
  146. </text>
  147. </view>
  148. <view class="navbar-item" v-if="status==2&&orderinfo.refund_status!==0">
  149. <view class="navbariconbox">
  150. <image src="../../static/orderListicon/notepad.png" mode="aspectFill"></image>
  151. </view>
  152. <view class="">
  153. 已申请退款
  154. </view>
  155. </view>
  156. <view class="line" v-if="status==1||status==2">
  157. </view>
  158. <view class="navbar-item" @click="moveGuide" v-if="status==1||status==3||status==2">
  159. <view class="navbariconbox">
  160. <image src="../../static/orderListicon/bookmark.png" mode="aspectFill"></image>
  161. </view>
  162. <text class="">
  163. 专属森林向导
  164. </text>
  165. </view>
  166. <view class="navbar-item" @click="moveAfterDetail" v-if="status==5">
  167. <view class="navbariconbox">
  168. <image src="../../static/orderListicon/bookmark.png" mode="aspectFill"></image>
  169. </view>
  170. <text class="">
  171. 售后详情
  172. </text>
  173. </view>
  174. </view>
  175. <!-- 已退订 已完成 -->
  176. <!-- <view class="navbar" v-if="state==2">
  177. <view class="navbar-item">
  178. <image src="../../static/orderListicon/login.png" mode="heightFix"></image>
  179. <text class="">
  180. 退款详情
  181. </text>
  182. </view>
  183. </view> -->
  184. </view>
  185. </template>
  186. <script>
  187. let that
  188. export default {
  189. data() {
  190. return {
  191. // 0待付款 1待出行 2退框
  192. state: 0,
  193. orderinfo: {},
  194. id: 0,
  195. status: '',
  196. good_id: ''
  197. }
  198. },
  199. onLoad(options) {
  200. // if(options.id==1){
  201. // this.state=0
  202. // }if(options.id==2){
  203. // this.state=1
  204. // }if(options.id==3){
  205. // this.state=2
  206. // }
  207. that = this
  208. this.id = Number(options.id)
  209. this.init(options.id)
  210. },
  211. methods: {
  212. init(id) {
  213. this.$showLoadding("加载中")
  214. uni.$u.http.post('/api/order/show', {
  215. order_id: id
  216. }, {
  217. custom: {
  218. auth: true
  219. }
  220. }).then((res) => {
  221. uni.hideLoading()
  222. // console.log(res)
  223. this.orderinfo = res
  224. this.status = res.status
  225. this.good_id = res.good_id
  226. // console.log(this.status,7788)
  227. }).catch((err) => {
  228. console.log(err)
  229. })
  230. },
  231. goAfterSale() {
  232. uni.navigateTo({
  233. url: "/pages/order/applyAfterSale?obj=" + encodeURIComponent(JSON.stringify(this.orderinfo))
  234. })
  235. },
  236. goOrderDetail() {
  237. uni.navigateTo({
  238. url: "/pages/travel/travelDetails?id=" + this.good_id
  239. })
  240. },
  241. moveAfterDetail() {
  242. uni.navigateTo({
  243. url: "/pages/order/orderAfterSale?id=" + this.orderinfo.id
  244. })
  245. },
  246. buyAgin() {
  247. uni.navigateTo({
  248. url: "/pages/travel/travelDetails?id=" + this.orderinfo.good_id
  249. })
  250. },
  251. goguide() {
  252. uni.navigateTo({
  253. url: "./guide"
  254. })
  255. },
  256. moveGuide() {
  257. if (this.status == 1) {
  258. uni.showModal({
  259. title: "提示",
  260. content: "订单支付后可进入专属森林向导"
  261. })
  262. return
  263. } else {
  264. uni.navigateTo({
  265. url: "/pages/order/guide?muster=" + encodeURIComponent(JSON.stringify(this.orderinfo.plan))
  266. })
  267. }
  268. },
  269. goPay() {
  270. uni.$u.http.post('/api/order/config', {
  271. order_id: that.id,
  272. }).then(res => {
  273. // console.log(res)
  274. uni.requestPayment({
  275. provider: 'wxpay', //支付类型-固定值
  276. timeStamp: res.timeStamp, // 时间戳(单位:秒)
  277. nonceStr: res.nonceStr, // 随机字符串
  278. package: res.package, // 固定值
  279. signType: res.signType, //固定值
  280. paySign: res.paySign, //签名
  281. success: function(res) {
  282. uni.redirectTo({
  283. url: "/pages/order/successpay?id" + that.id
  284. })
  285. // console.log('success:' + JSON.stringify(res));
  286. console.log("支付成功");
  287. },
  288. fail: function(err) {
  289. console.log('fail:' + JSON.stringify(err));
  290. console.log("支付失败");
  291. }
  292. });
  293. }).catch(err => {
  294. console.log(err)
  295. uni.showToast({
  296. icon: "error",
  297. title: err.message,
  298. })
  299. })
  300. },
  301. cancelOrder() {
  302. uni.showModal({
  303. title: "提示",
  304. content: "是否取消订单?",
  305. success: (res) => {
  306. if (res.confirm) {
  307. that.$showLoadding("加载中")
  308. uni.$u.http.post('/api/order/cancel', {
  309. order_id: that.id
  310. }, {
  311. custom: {
  312. auth: true
  313. }
  314. }).then((res) => {
  315. uni.hideLoading()
  316. // uni.hideLoading()
  317. that.$toast("取消成功")
  318. setTimeout(() => {
  319. uni.navigateTo({
  320. url: "/pages/order/order"
  321. })
  322. }, 500)
  323. }).catch((err) => {
  324. console.log(err)
  325. })
  326. } else if (res.cancel) {
  327. console.log('用户点击取消');
  328. }
  329. }
  330. })
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="less">
  336. page {
  337. background-color: #F4F4F4;
  338. font-size: 28rpx;
  339. font-family: PingFang-SC-Bold, PingFang-SC;
  340. }
  341. .list {
  342. box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.02);
  343. border-radius: 16rpx 16rpx 16rpx 56rpx;
  344. background-color: #FFFFFF;
  345. // padding: 30rpx;
  346. margin: 57rpx 30rpx;
  347. .list-top {
  348. padding-bottom: 20rpx;
  349. border-bottom: 1px solid #efefef;
  350. padding: 30rpx;
  351. }
  352. .listcenter {
  353. display: flex;
  354. justify-content: space-between;
  355. // margin: 24rpx 0 40rpx;
  356. padding: 30rpx;
  357. .r {
  358. text-align: right;
  359. .image {
  360. // width: 140rpx;
  361. }
  362. image {
  363. width: 140rpx;
  364. height: 84rpx;
  365. border-radius: 6rpx;
  366. }
  367. }
  368. }
  369. .list-bottom {
  370. border-top: 1rpx solid #E3E3E3;
  371. border-radius: 0px 0px 16rpx 56rpx;
  372. background-color: #FBFBFB;
  373. padding: 30rpx 0 30rpx 60rpx;
  374. color: #1E9F6A;
  375. font-weight: 600;
  376. .listIcon {
  377. display: flex;
  378. align-items: center;
  379. font-size: 26rpx;
  380. .listIconbox {
  381. width: 20rpx;
  382. height: 24rpx;
  383. margin-right: 10rpx;
  384. image {
  385. width: 100%;
  386. height: 100%;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. .travel {
  393. margin: 0 60rpx;
  394. .travelList {
  395. display: flex;
  396. justify-content: space-between;
  397. image {
  398. width: 48rpx;
  399. height: 48rpx;
  400. }
  401. }
  402. }
  403. .room {
  404. .title {
  405. display: flex;
  406. justify-content: space-between;
  407. align-items: center;
  408. border-bottom: 1px solid #E3E3E3;
  409. padding: 30rpx;
  410. margin: 50rpx 30rpx 30rpx;
  411. image {
  412. width: 48rpx;
  413. height: 48rpx;
  414. }
  415. }
  416. .roomList {
  417. display: flex;
  418. justify-content: space-between;
  419. align-items: center;
  420. margin: 20rpx 60rpx;
  421. }
  422. margin-bottom:200rpx;
  423. }
  424. .navbar {
  425. // margin-top: 104rpx;
  426. width: 100%;
  427. height: 104rpx;
  428. background: #1E9F6A;
  429. border-radius: 16rpx 16rpx 0px 0px;
  430. position: fixed;
  431. left: 0;
  432. bottom: 0;
  433. display: flex;
  434. align-items: center;
  435. .line {
  436. width: 1px;
  437. height: 24rpx;
  438. background-color: #FFFFFF;
  439. }
  440. .navbar-item {
  441. display: flex;
  442. color: #FFFFFF;
  443. flex: 1;
  444. align-items: center;
  445. justify-content: center;
  446. .navbariconbox {
  447. height: 28rpx;
  448. width: 28rpx;
  449. margin-right: 10rpx;
  450. image {
  451. width: 100%;
  452. height: 100%;
  453. }
  454. }
  455. }
  456. }
  457. </style>