orderDetails.vue 12 KB

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