detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <view class="content">
  3. <template v-if="!isLogin">
  4. <view class="empty-body">
  5. <view class="imgs">
  6. <image src="/static/image/empty.png" mode="widthFix"></image>
  7. <view class="tip">请先完成登录~</view>
  8. </view>
  9. <view class="re-btn" @click="toLogin">去登陆</view>
  10. </view>
  11. </template>
  12. <template v-else>
  13. <template v-if="loading">
  14. <view class="skeleton">
  15. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  16. <view class="skeleton-line animate"></view>
  17. <view class="skeleton-line min animate"></view>
  18. <view class="skeleton-line min animate"></view>
  19. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  20. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  21. </view>
  22. </template>
  23. <template v-else>
  24. <scroll-view class="goods-body" scroll-y scroll-with-animation>
  25. <view class="order-body">
  26. <view class="status-body">
  27. <view class="order_status">
  28. <template v-if="orderData && orderData.status == 0">
  29. <view class="status-name">待支付</view>
  30. <view class="status-desc">超过30分钟未支付,订单将自动取消</view>
  31. </template>
  32. <template v-if="orderData && orderData.status == 1">
  33. <view class="status-name">
  34. <image src="/static/image/order/time.svg"></image>待使用
  35. </view>
  36. <view class="status-desc" v-if="orderData.end_at">有效期至:{{ orderData.end_at }}</view>
  37. <view class="status-desc" v-else>如有疑问,可咨询客服</view>
  38. </template>
  39. <template v-if="orderData && orderData.status == 2">
  40. <view class="status-name success">
  41. <image src="/static/image/order/success.svg"></image>已完成
  42. </view>
  43. <view class="status-desc">服务已完成,欢迎您再次使用</view>
  44. </template>
  45. <template v-if="orderData && orderData.status == 3">
  46. <view class="status-name">
  47. <image src="/static/image/order/refund.svg"></image>
  48. 退款成功
  49. </view>
  50. <view class="status-desc">{{ $dialog.formatMoney(orderData.pay_money,true) }} 已原路退回</view>
  51. </template>
  52. <template v-if="orderData && orderData.status == 4">
  53. <view class="status-name">
  54. <image src="/static/image/order/refund.svg"></image>退款中</view>
  55. <view class="status-desc">已申请退款,钱款预计1-3个自然日到账</view>
  56. </template>
  57. <template v-if="orderData && orderData.status == 5">
  58. <view class="status-name">已关闭</view>
  59. <view class="status-desc">订单已取消或已关闭</view>
  60. </template>
  61. <template v-if="orderData && orderData.status == 6">
  62. <view class="status-name">部分退款</view>
  63. <view class="status-desc">已退款{{orderData.refund_num}}份</view>
  64. </template>
  65. <template v-if="orderData && orderData.status == 7">
  66. <view class="status-name">
  67. <image src="/static/image/order/goon.svg"></image>履约中
  68. </view>
  69. <view class="status-desc">服务进行中,有疑问请咨询客服</view>
  70. </template>
  71. </view>
  72. </view>
  73. <view class="item-goods">
  74. <view class="item-goods-body">
  75. <view class="image">
  76. <image :src="orderData.img"></image>
  77. </view>
  78. <view class="info">
  79. <view class="title">
  80. <view class="name" v-if="goodsData.is_new == 1">{{goodsData.price}}元代{{goodsData.line_price}}元商场权益券{{ goodsData.product_name }}</view>
  81. <view class="name" v-else>{{ goodsData.product_name }}</view>
  82. <view class="num">x{{ orderData.number }}</view>
  83. </view>
  84. <view class="tags">
  85. {{orderData.sku_name?orderData.sku_name:'默认'}}
  86. <view class="price">{{ $dialog.formatMoney(orderData.price,true) }}</view>
  87. </view>
  88. <view class="price-right">实付 <text>{{ $dialog.formatMoney(orderData.pay_money,true) }}</text></view>
  89. </view>
  90. </view>
  91. <view class="order-qrcode" v-if="orderData.status == 1">
  92. <view class="qrcode-img">
  93. <ikun-qrcode
  94. width="200"
  95. height="200"
  96. unit="rpx"
  97. color="#000000"
  98. :data="orderData.order_sn">
  99. </ikun-qrcode>
  100. </view>
  101. <view class="qrcode-text">券码 {{orderData.order_sn}} <text @click="copyOrder(orderData.order_sn)">复制</text></view>
  102. </view>
  103. </view>
  104. <view class="home-store">
  105. <view class="service-detail" @click="kfPop()">
  106. <view class="left">
  107. <image src="/static/image/kefu.png"></image>
  108. <view class="name">联系客服</view>
  109. </view>
  110. <view class="right" v-if="storeData">
  111. <image src="/static/image/right-black.png"></image>
  112. </view>
  113. </view>
  114. <view class="service-detail" @click="orderTs()">
  115. <view class="left">
  116. <image src="/static/image/face.svg"></image>
  117. <view class="name">我要投诉</view>
  118. </view>
  119. <view class="right">
  120. <image src="/static/image/right-black.png"></image>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="goods-store" v-if="poiData">
  125. <view class="title">适用门店</view>
  126. <view class="store-info">
  127. <view class="store-left">
  128. <view class="name">{{poiData?poiData.poi_name:'-'}}</view>
  129. <view class="address">{{poiData?poiData.poi_address:'-'}}</view>
  130. </view>
  131. <view class="store-right">
  132. <view class="right-item" @click="toMap">
  133. <image src="/static/image/amap.png"></image>
  134. <view class="desc">导航</view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="order-info">
  140. <view class="title">订单信息</view>
  141. <view class="info-item">
  142. <view class="name">订单编号</view>
  143. <view class="right">{{ orderData.out_order_no }} <text @click="copyOrder(orderData.out_order_no)">复制</text></view>
  144. </view>
  145. <view class="info-item">
  146. <view class="name">手机号码</view>
  147. <view class="right">{{ orderData.mobile }}</view>
  148. </view>
  149. <view class="info-item">
  150. <view class="name">下单时间</view>
  151. <view class="right">{{ orderData.create_at }}</view>
  152. </view>
  153. <view class="info-item">
  154. <view class="name">付款时间</view>
  155. <view class="right">{{ orderData.pay_at }}</view>
  156. </view>
  157. <view class="info-item" v-if="orderData.status == 3">
  158. <view class="name">退款时间</view>
  159. <view class="right">{{ orderData.refund_at }}</view>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="line-height"></view>
  164. </scroll-view>
  165. <view class="footer">
  166. <view class="footer-op">
  167. <view class="footer-left"></view>
  168. <view class="footer-right">
  169. <template v-if="orderData.status == 1 || orderData.status == 6">
  170. <pay-button-sdk
  171. class="btn"
  172. :mode="1"
  173. :goods-type="1"
  174. :order-status="1"
  175. :order-id="orderData.out_order_no"
  176. :goods-id="orderData.life_goods_id"
  177. :refund-total-amount="orderData.pay_money"
  178. bind:applyrefund="applyRefund"
  179. bind:refund="handleRefund"
  180. bind:error="onErrors"
  181. ></pay-button-sdk>
  182. <view class="btn full" @click="$dialog.jumpUri('/pages/service/chat?poi='+storeData.poi_id+'&source=apply&order='+orderData.order_sn,1);">立即预约</view>
  183. </template>
  184. <template v-if="orderData.status == 2">
  185. <view class="btn" @click="toGoods">再来一单</view>
  186. <view class="btn full" @click="toAfter">申请售后</view>
  187. </template>
  188. <template v-if="orderData.status == 3 || orderData.status == 4">
  189. <view class="btn">再次购买</view>
  190. </template>
  191. <template v-if="orderData.status == 5">
  192. <view class="btn" @click="toGoods">再次购买</view>
  193. </template>
  194. </view>
  195. </view>
  196. <view class="footer-safe"></view>
  197. </view>
  198. </template>
  199. </template>
  200. <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
  201. <kfService ref="kfService"></kfService>
  202. <complaint ref="complaint"></complaint>
  203. </view>
  204. </template>
  205. <script>
  206. var app;
  207. import complaint from "@/components/kfService/complaint";
  208. export default {
  209. components: {
  210. complaint
  211. },
  212. data() {
  213. return {
  214. optionData:null,
  215. storeData:null,
  216. order:0,
  217. loading:true,
  218. goodsData:null,
  219. orderTime:null,
  220. poiData:null,
  221. orderData:null,
  222. isLogin:true,
  223. userState:1
  224. }
  225. },
  226. created() {
  227. this.$scope.applyRefund = this.applyRefund;
  228. this.$scope.onPay = this.onPay;
  229. this.$scope.handleRefund = this.handleRefund;
  230. this.$scope.onErrors = this.onErrors;
  231. },
  232. onShow(){
  233. let allPages = getCurrentPages(); //获取当前页面栈的实例;
  234. let lastPages = allPages.length - 1; // 获得倒数第二个元素的索引;
  235. let option = allPages[lastPages].options; // 获得上个页面传递的参数;
  236. this.order = option.order?option.order:''
  237. this.optionData = option
  238. this.getOrder();
  239. },
  240. onLoad() {
  241. app = this;
  242. },
  243. methods: {
  244. kfPop(){
  245. if (app.userState == 0) {
  246. this.$refs.loginCom.open(2);
  247. return ;
  248. }
  249. this.$refs.kfService.open(app.storeData);
  250. },
  251. orderTs(){
  252. this.$refs.complaint.open(app.order);
  253. },
  254. toLogin(){
  255. this.$refs.loginCom.open();
  256. },
  257. loginSuccess(){
  258. app.getOrder();
  259. },
  260. async getOrder(){
  261. app.loading = true;
  262. var res = await app.$api.order.detail.get({"order":app.order});
  263. app.loading = false;
  264. if (res.code && res.code == 0) {
  265. app.$dialog.showSuccess(res.msg);
  266. uni.navigateBack()
  267. return ;
  268. }
  269. if (res.code && res.code == 401) {
  270. app.isLogin = false;
  271. this.$refs.loginCom.open();
  272. return ;
  273. }
  274. app.isLogin = true;
  275. uni.setStorageSync("poiId",res.data.poi_id);
  276. app.poiData = res.data.poi;
  277. app.userState = res.data.user;
  278. const storeDataTemp = {
  279. "end_at":app.poiData.end_at,
  280. "latitude":app.poiData.latitude,
  281. "longitude":app.poiData.longitude,
  282. "poi_address":app.poiData.poi_address,
  283. "poi_city":app.poiData.poi_city,
  284. "poi_id":app.poiData.poi_id,
  285. "poi_logo":app.poiData.poi_logo,
  286. "poi_name":app.poiData.poi_name,
  287. "service_mobile":app.poiData.service_mobile,
  288. "start_at":app.poiData.start_at
  289. };
  290. uni.setStorageSync("contact",storeDataTemp);
  291. app.storeData = storeDataTemp;
  292. app.goodsData = res.data.product;
  293. app.orderData = res.data;
  294. app.orderTime = res.data.end_time
  295. },
  296. copyOrder(order){
  297. uni.setClipboardData({
  298. data:order,
  299. success() {
  300. app.$dialog.showSuccess("复制成功")
  301. },
  302. fail() {
  303. app.$dialog.showSuccess("复制失败")
  304. }
  305. })
  306. },
  307. toMap(){
  308. var poi = app.poiData;
  309. uni.openLocation({
  310. latitude:poi.latitude,
  311. longitude:poi.longitude,
  312. name:poi.poi_name,
  313. address:poi.poi_address,
  314. success() {
  315. console.log("open success")
  316. },
  317. fail(err) {
  318. app.$dialog.showSuccess("打开导航失败")
  319. console.log(err)
  320. }
  321. })
  322. },
  323. applyRefund(event){
  324. console.log("applyRefund",event)
  325. const { orderId } = event.detail;
  326. const goodsDetail = [
  327. {
  328. refundRelatedItemType: 2,
  329. itemOrderId:app.orderData.item_order_id //商品单,可在预下单回调itemOrderlist里获取,或通过查询券状态接口获取
  330. }
  331. ];
  332. const extra = { orderId , goodsDetail};
  333. // 开发者需要透传的参数,可自定义内容
  334. console.log(extra,"退款参数打印");
  335. return new Promise(resolve => {
  336. resolve(extra);
  337. });
  338. },
  339. onPay(event){
  340. console.log("event",event)
  341. const { status, outOrderNo, result } = event.detail;
  342. console.log(status, outOrderNo, result)
  343. if (status === 'success') {
  344. const { code } = result;
  345. if (code === 0) { // 支付成功
  346. app.$dialog.showSuccess("支付成功","none",function(){
  347. app.getOrder()
  348. })
  349. } else {
  350. app.$dialog.showSuccess("支付失败","none",function(){
  351. app.getOrder()
  352. })
  353. // 继续支付失败(超时、取消、关闭)
  354. }
  355. } else {}
  356. },
  357. handleRefund(event){
  358. const { status, result } = event.detail;
  359. console.log("退款",event.detail)
  360. if (status === 'success') {
  361. const { refundId, outRefundNo } = result;
  362. } else {
  363. const { errMsg } = result;
  364. }
  365. },
  366. onErrors(e){
  367. console.log("错误",e)
  368. },
  369. }
  370. }
  371. </script>
  372. <style lang="scss" scoped>
  373. .content{
  374. position: fixed;
  375. z-index: 1;
  376. top: 0;
  377. left: 0;
  378. bottom: 0;
  379. right: 0;
  380. background-color: #f1f1f1;
  381. display: flex;
  382. flex-direction: column;
  383. .line-height{
  384. height: 40rpx;
  385. width: 100%;
  386. }
  387. }
  388. .empty-body{
  389. display: flex;align-items: center;justify-content: center;flex-direction: column;height: calc(100vh - 100upx);
  390. .imgs{
  391. text-align: center;font-size: 28upx;color: #666;
  392. image{height: 160upx;width: 160upx;}
  393. .tip{margin-top: 20upx;}
  394. }
  395. .re-btn{
  396. width: 180upx;
  397. height: 80upx;
  398. line-height: 80upx;
  399. text-align: center;
  400. font-size: 28upx;
  401. color: #fff;
  402. background-color: $main-color;
  403. border-radius: 10upx;
  404. margin-top: 60upx;
  405. }
  406. }
  407. .order-qrcode {
  408. .qrcode-img {
  409. margin-top: 20rpx;
  410. padding: 40rpx 0;
  411. border-top: 5rpx dotted #f8f8f8;
  412. border-bottom: 5rpx dotted #f8f8f8;
  413. display: flex;
  414. align-items: center;
  415. justify-content: center;
  416. }
  417. .qrcode-text{
  418. text-align: center;
  419. margin-top: 20upx;
  420. text{margin-left: 10upx;color: #007aff;}
  421. }
  422. }
  423. .home-store{
  424. margin: 20upx auto;
  425. display: flex;
  426. align-items: center;
  427. gap: 20upx;
  428. justify-content: space-between;
  429. .service-detail{
  430. display: flex;
  431. align-items: center;
  432. background-color: #fff;
  433. border-radius: 10upx;
  434. height: 120upx;padding: 0 20upx;
  435. flex: 1;
  436. .left{
  437. display: flex;align-items: center;
  438. image{width: 50upx;height: 50upx;margin-right: 15upx;}
  439. }
  440. .right {
  441. margin-left: auto;margin-right: 0;display: flex;align-items: center;
  442. image{width: 50upx;height: 50upx;}
  443. }
  444. }
  445. .service-btn{
  446. background-color: #fff;text-align: center;padding: 0 30upx;font-size: 28upx;height: 120upx;line-height: 120upx;display: flex;align-items: center;justify-content: space-between;
  447. image{width: 50upx;height: 50upx;}
  448. .btn-name{
  449. margin-left: 15upx;
  450. image{width: 40upx;height: 40upx;}
  451. }
  452. }
  453. }
  454. .footer{
  455. background-color: #fff;
  456. padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;
  457. .footer-safe {
  458. height: env(safe-area-inset-bottom);width: 100%;
  459. }
  460. .footer-op{
  461. display: flex;
  462. align-items: center;
  463. justify-content: space-between;
  464. .footer-right{
  465. display: flex;
  466. align-items: center;
  467. gap: 20rpx;
  468. .btn{
  469. font-size: 28rpx;
  470. height: 80upx;
  471. border-radius: 10upx;
  472. line-height: 80upx;
  473. text-align: center;
  474. min-width: 200rpx;
  475. color: #333;
  476. border: 2rpx solid #ccc;
  477. &.full{
  478. background-color: $main-color;
  479. color: #fff;
  480. border: 2rpx solid $main-color;
  481. }
  482. }
  483. }
  484. }
  485. }
  486. .goods-body{
  487. height: 0;
  488. flex: 1;
  489. }
  490. .order-body {
  491. width: 95%;
  492. margin: 20rpx auto;
  493. .order_status{
  494. .status-name{
  495. display: flex;
  496. align-items: center;
  497. gap: 20rpx;
  498. font-size: 38rpx;
  499. color: #000;
  500. font-weight: 800;
  501. image {
  502. width: 50rpx;
  503. height: 50rpx;
  504. }
  505. }
  506. }
  507. .item-goods{
  508. background-color: #fff;
  509. margin-top: 20rpx;
  510. border-radius: 20rpx;
  511. padding: 20rpx;
  512. .item-goods-body{
  513. display: flex;
  514. align-items: center;
  515. gap: 20rpx;
  516. }
  517. .stock{
  518. text-align: right;
  519. }
  520. .image {
  521. height: 140rpx;
  522. overflow: hidden;display: flex;align-items: center;min-width: 140rpx;
  523. position: relative;
  524. image {
  525. width: 140rpx;
  526. border-radius: 10upx;
  527. height: 100%;
  528. }
  529. }
  530. .info{
  531. flex: 1 1 0%;
  532. overflow: hidden;
  533. .title{
  534. display: flex;
  535. align-items: center;
  536. justify-content: space-between;
  537. .name {
  538. overflow: hidden;
  539. text-overflow: ellipsis;
  540. font-size: 32rpx;
  541. display: -webkit-box;
  542. -webkit-line-clamp: 2;
  543. -webkit-box-orient: vertical;
  544. color: #333;
  545. font-weight: 900;
  546. }
  547. }
  548. .price-right{
  549. text-align: right;
  550. color: $main-color;
  551. margin-top: 20rpx;
  552. font-size: 28rpx;
  553. text {
  554. font-size: 30rpx;
  555. font-weight: 800;
  556. }
  557. }
  558. .tags {
  559. color: #94a3b8;
  560. font-size: 24rpx;
  561. margin: 10rpx 0;
  562. display: flex;
  563. align-items: center;
  564. justify-content: space-between;
  565. .price {
  566. font-size: 28rpx;
  567. color: $main-text-color;
  568. font-weight: 600;
  569. }
  570. }
  571. }
  572. }
  573. .order-info{
  574. border-radius: 20rpx;
  575. background-color: #fff;padding: 20upx;margin-top: 20upx;
  576. .title{font-size: 32upx;color: #333;font-weight: bold;margin-bottom: 20upx;}
  577. .info-item{
  578. height: 80upx;line-height: 80upx;font-size: 28upx;display: flex;align-items: center;
  579. .right{
  580. color: #666;margin-left: auto;margin-right: 0;
  581. text{border: 2upx solid #ccc;color: #333;font-size: 24upx;padding: 0 15upx;margin-left: 20upx;border-radius: 5upx;}
  582. }
  583. }
  584. }
  585. .status-desc{
  586. font-size: 24rpx;color: #666;margin-top: 20rpx;
  587. }
  588. .goods-store{
  589. background-color: #fff;
  590. margin:20rpx 0;
  591. padding: 0 20rpx 20rpx;
  592. border-radius: 20rpx;
  593. .title{
  594. line-height: 80upx;
  595. font-size: 32rpx;
  596. color: #333;
  597. font-weight: bold;
  598. display: flex;
  599. align-items: center;
  600. border-bottom: 2upx solid #f8f8f8;
  601. }
  602. .store-info{
  603. display: flex;align-items: center;padding: 20upx 0;
  604. .store-right{
  605. margin-left: auto;margin-right: 0;font-size: 24rpx;color: #999;
  606. image{width: 50upx;height: 50upx;margin-bottom: 10upx;}
  607. }
  608. .store-left {
  609. .name{font-size: 30rpx;color: #333;font-weight: bold;line-height: 80upx;}
  610. .address{font-size: 24rpx;color: #999;}
  611. }
  612. }
  613. }
  614. }
  615. </style>