detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  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">{{ goodsData.product_name }}</view>
  81. <view class="num">x{{ orderData.number }}</view>
  82. </view>
  83. <view class="tags">
  84. {{orderData.sku_name?orderData.sku_name:'默认'}}
  85. <view class="price">{{ $dialog.formatMoney(orderData.price,true) }}</view>
  86. </view>
  87. <view class="price-right">实付 <text>{{ $dialog.formatMoney(orderData.pay_money,true) }}</text></view>
  88. </view>
  89. </view>
  90. <view class="order-qrcode" v-if="orderData.status == 1">
  91. <view class="qrcode-img">
  92. <ikun-qrcode
  93. width="200"
  94. height="200"
  95. unit="rpx"
  96. color="#000000"
  97. :data="orderData.order_sn">
  98. </ikun-qrcode>
  99. </view>
  100. <view class="qrcode-text">券码 {{orderData.order_sn}} <text @click="copyOrder(orderData.order_sn)">复制</text></view>
  101. </view>
  102. </view>
  103. <view class="home-store">
  104. <view class="service-detail" @click="kfPop()">
  105. <view class="left">
  106. <image src="/static/image/kefu.png"></image>
  107. <view class="name">联系客服</view>
  108. </view>
  109. <view class="right" v-if="storeData">
  110. <image src="/static/image/right-black.png"></image>
  111. </view>
  112. </view>
  113. <view class="service-detail" @click="orderTs()">
  114. <view class="left">
  115. <image src="/static/image/face.svg"></image>
  116. <view class="name">我要投诉</view>
  117. </view>
  118. <view class="right">
  119. <image src="/static/image/right-black.png"></image>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="goods-store" v-if="poiData">
  124. <view class="title">适用门店</view>
  125. <view class="store-info">
  126. <view class="store-left">
  127. <view class="name">{{poiData?poiData.poi_name:'-'}}</view>
  128. <view class="address">{{poiData?poiData.poi_address:'-'}}</view>
  129. </view>
  130. <view class="store-right">
  131. <view class="right-item" @click="toMap">
  132. <image src="/static/image/amap.png"></image>
  133. <view class="desc">导航</view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="order-info">
  139. <view class="title">订单信息</view>
  140. <view class="info-item">
  141. <view class="name">订单编号</view>
  142. <view class="right">{{ orderData.out_order_no }} <text @click="copyOrder(orderData.out_order_no)">复制</text></view>
  143. </view>
  144. <view class="info-item">
  145. <view class="name">手机号码</view>
  146. <view class="right">{{ orderData.mobile }}</view>
  147. </view>
  148. <view class="info-item">
  149. <view class="name">下单时间</view>
  150. <view class="right">{{ orderData.create_at }}</view>
  151. </view>
  152. <view class="info-item">
  153. <view class="name">付款时间</view>
  154. <view class="right">{{ orderData.pay_at }}</view>
  155. </view>
  156. <view class="info-item" v-if="orderData.status == 3">
  157. <view class="name">退款时间</view>
  158. <view class="right">{{ orderData.refund_at }}</view>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="line-height"></view>
  163. </scroll-view>
  164. <view class="footer">
  165. <view class="footer-op">
  166. <view class="footer-left"></view>
  167. <view class="footer-right">
  168. <template v-if="orderData.status == 1 || orderData.status == 6">
  169. <pay-button-sdk
  170. class="btn"
  171. :mode="1"
  172. :goods-type="1"
  173. :order-status="1"
  174. :order-id="orderData.out_order_no"
  175. :goods-id="orderData.life_goods_id"
  176. :refund-total-amount="orderData.pay_money"
  177. bind:applyrefund="applyRefund"
  178. bind:refund="handleRefund"
  179. bind:error="onErrors"
  180. ></pay-button-sdk>
  181. <view class="btn full" @click="$dialog.jumpUri('/pages/service/chat?poi='+storeData.poi_id+'&source=apply&order='+orderData.order_sn,1);">立即预约</view>
  182. </template>
  183. <template v-if="orderData.status == 2">
  184. <view class="btn" @click="toGoods">再来一单</view>
  185. <view class="btn full" @click="toAfter">申请售后</view>
  186. </template>
  187. <template v-if="orderData.status == 3 || orderData.status == 4">
  188. <view class="btn">再次购买</view>
  189. </template>
  190. <template v-if="orderData.status == 5">
  191. <view class="btn" @click="toGoods">再次购买</view>
  192. </template>
  193. </view>
  194. </view>
  195. <view class="footer-safe"></view>
  196. </view>
  197. </template>
  198. </template>
  199. <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
  200. <kfService ref="kfService"></kfService>
  201. <complaint ref="complaint"></complaint>
  202. </view>
  203. </template>
  204. <script>
  205. var app;
  206. import complaint from "@/components/kfService/complaint";
  207. export default {
  208. components: {
  209. complaint
  210. },
  211. data() {
  212. return {
  213. optionData:null,
  214. storeData:null,
  215. order:0,
  216. loading:true,
  217. goodsData:null,
  218. orderTime:null,
  219. poiData:null,
  220. orderData:null,
  221. isLogin:true,
  222. userState:1
  223. }
  224. },
  225. created() {
  226. this.$scope.applyRefund = this.applyRefund;
  227. this.$scope.onPay = this.onPay;
  228. this.$scope.handleRefund = this.handleRefund;
  229. this.$scope.onErrors = this.onErrors;
  230. },
  231. onShow(){
  232. let allPages = getCurrentPages(); //获取当前页面栈的实例;
  233. let lastPages = allPages.length - 1; // 获得倒数第二个元素的索引;
  234. let option = allPages[lastPages].options; // 获得上个页面传递的参数;
  235. this.order = option.order?option.order:''
  236. this.optionData = option
  237. this.getOrder();
  238. },
  239. onLoad() {
  240. app = this;
  241. },
  242. methods: {
  243. kfPop(){
  244. if (app.userState == 0) {
  245. this.$refs.loginCom.open(2);
  246. return ;
  247. }
  248. this.$refs.kfService.open(app.storeData);
  249. },
  250. orderTs(){
  251. this.$refs.complaint.open(app.order);
  252. },
  253. toLogin(){
  254. this.$refs.loginCom.open();
  255. },
  256. loginSuccess(){
  257. app.getOrder();
  258. },
  259. async getOrder(){
  260. app.loading = true;
  261. var res = await app.$api.order.detail.get({"order":app.order});
  262. app.loading = false;
  263. if (res.code && res.code == 0) {
  264. app.$dialog.showSuccess(res.msg);
  265. uni.navigateBack()
  266. return ;
  267. }
  268. if (res.code && res.code == 401) {
  269. app.isLogin = false;
  270. this.$refs.loginCom.open();
  271. return ;
  272. }
  273. app.isLogin = true;
  274. uni.setStorageSync("poiId",res.data.poi_id);
  275. app.poiData = res.data.poi;
  276. app.userState = res.data.user;
  277. const storeDataTemp = {
  278. "end_at":app.poiData.end_at,
  279. "latitude":app.poiData.latitude,
  280. "longitude":app.poiData.longitude,
  281. "poi_address":app.poiData.poi_address,
  282. "poi_city":app.poiData.poi_city,
  283. "poi_id":app.poiData.poi_id,
  284. "poi_logo":app.poiData.poi_logo,
  285. "poi_name":app.poiData.poi_name,
  286. "service_mobile":app.poiData.service_mobile,
  287. "start_at":app.poiData.start_at
  288. };
  289. uni.setStorageSync("contact",storeDataTemp);
  290. app.storeData = storeDataTemp;
  291. app.goodsData = res.data.product;
  292. app.orderData = res.data;
  293. app.orderTime = res.data.end_time
  294. },
  295. copyOrder(order){
  296. uni.setClipboardData({
  297. data:order,
  298. success() {
  299. app.$dialog.showSuccess("复制成功")
  300. },
  301. fail() {
  302. app.$dialog.showSuccess("复制失败")
  303. }
  304. })
  305. },
  306. toMap(){
  307. var poi = app.poiData;
  308. uni.openLocation({
  309. latitude:poi.latitude,
  310. longitude:poi.longitude,
  311. name:poi.poi_name,
  312. address:poi.poi_address,
  313. success() {
  314. console.log("open success")
  315. },
  316. fail(err) {
  317. app.$dialog.showSuccess("打开导航失败")
  318. console.log(err)
  319. }
  320. })
  321. },
  322. applyRefund(){},
  323. onPay(){},
  324. handleRefund(){},
  325. onErrors(){},
  326. }
  327. }
  328. </script>
  329. <style lang="scss" scoped>
  330. .content{
  331. position: fixed;
  332. z-index: 1;
  333. top: 0;
  334. left: 0;
  335. bottom: 0;
  336. right: 0;
  337. background-color: #f1f1f1;
  338. display: flex;
  339. flex-direction: column;
  340. .line-height{
  341. height: 40rpx;
  342. width: 100%;
  343. }
  344. }
  345. .empty-body{
  346. display: flex;align-items: center;justify-content: center;flex-direction: column;height: calc(100vh - 100upx);
  347. .imgs{
  348. text-align: center;font-size: 28upx;color: #666;
  349. image{height: 160upx;width: 160upx;}
  350. .tip{margin-top: 20upx;}
  351. }
  352. .re-btn{
  353. width: 180upx;
  354. height: 80upx;
  355. line-height: 80upx;
  356. text-align: center;
  357. font-size: 28upx;
  358. color: #fff;
  359. background-color: $main-color;
  360. border-radius: 10upx;
  361. margin-top: 60upx;
  362. }
  363. }
  364. .order-qrcode {
  365. .qrcode-img {
  366. margin-top: 20rpx;
  367. padding: 40rpx 0;
  368. border-top: 5rpx dotted #f8f8f8;
  369. border-bottom: 5rpx dotted #f8f8f8;
  370. display: flex;
  371. align-items: center;
  372. justify-content: center;
  373. }
  374. .qrcode-text{
  375. text-align: center;
  376. margin-top: 20upx;
  377. text{margin-left: 10upx;color: #007aff;}
  378. }
  379. }
  380. .home-store{
  381. margin: 20upx auto;
  382. display: flex;
  383. align-items: center;
  384. gap: 20upx;
  385. justify-content: space-between;
  386. .service-detail{
  387. display: flex;
  388. align-items: center;
  389. background-color: #fff;
  390. border-radius: 10upx;
  391. height: 120upx;padding: 0 20upx;
  392. flex: 1;
  393. .left{
  394. display: flex;align-items: center;
  395. image{width: 50upx;height: 50upx;margin-right: 15upx;}
  396. }
  397. .right {
  398. margin-left: auto;margin-right: 0;display: flex;align-items: center;
  399. image{width: 50upx;height: 50upx;}
  400. }
  401. }
  402. .service-btn{
  403. 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;
  404. image{width: 50upx;height: 50upx;}
  405. .btn-name{
  406. margin-left: 15upx;
  407. image{width: 40upx;height: 40upx;}
  408. }
  409. }
  410. }
  411. .footer{
  412. background-color: #fff;
  413. padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;
  414. .footer-safe {
  415. height: env(safe-area-inset-bottom);width: 100%;
  416. }
  417. .footer-op{
  418. display: flex;
  419. align-items: center;
  420. justify-content: space-between;
  421. .footer-right{
  422. display: flex;
  423. align-items: center;
  424. gap: 20rpx;
  425. .btn{
  426. font-size: 28rpx;
  427. height: 80upx;
  428. border-radius: 10upx;
  429. line-height: 80upx;
  430. text-align: center;
  431. min-width: 200rpx;
  432. color: #333;
  433. border: 2rpx solid #ccc;
  434. &.full{
  435. background-color: $main-color;
  436. color: #fff;
  437. border: 2rpx solid $main-color;
  438. }
  439. }
  440. }
  441. }
  442. }
  443. .goods-body{
  444. height: 0;
  445. flex: 1;
  446. }
  447. .order-body {
  448. width: 95%;
  449. margin: 20rpx auto;
  450. .order_status{
  451. .status-name{
  452. display: flex;
  453. align-items: center;
  454. gap: 20rpx;
  455. font-size: 38rpx;
  456. color: #000;
  457. font-weight: 800;
  458. image {
  459. width: 50rpx;
  460. height: 50rpx;
  461. }
  462. }
  463. }
  464. .item-goods{
  465. background-color: #fff;
  466. margin-top: 20rpx;
  467. border-radius: 20rpx;
  468. padding: 20rpx;
  469. .item-goods-body{
  470. display: flex;
  471. align-items: center;
  472. gap: 20rpx;
  473. }
  474. .stock{
  475. text-align: right;
  476. }
  477. .image {
  478. height: 140rpx;
  479. overflow: hidden;display: flex;align-items: center;min-width: 140rpx;
  480. position: relative;
  481. image {
  482. width: 140rpx;
  483. border-radius: 10upx;
  484. height: 100%;
  485. }
  486. }
  487. .info{
  488. flex: 1 1 0%;
  489. overflow: hidden;
  490. .title{
  491. display: flex;
  492. align-items: center;
  493. justify-content: space-between;
  494. .name {
  495. overflow: hidden;
  496. text-overflow: ellipsis;
  497. font-size: 32rpx;
  498. display: -webkit-box;
  499. -webkit-line-clamp: 2;
  500. -webkit-box-orient: vertical;
  501. color: #333;
  502. font-weight: 900;
  503. }
  504. }
  505. .price-right{
  506. text-align: right;
  507. color: $main-color;
  508. margin-top: 20rpx;
  509. font-size: 28rpx;
  510. text {
  511. font-size: 30rpx;
  512. font-weight: 800;
  513. }
  514. }
  515. .tags {
  516. color: #94a3b8;
  517. font-size: 24rpx;
  518. margin: 10rpx 0;
  519. display: flex;
  520. align-items: center;
  521. justify-content: space-between;
  522. .price {
  523. font-size: 28rpx;
  524. color: $main-text-color;
  525. font-weight: 600;
  526. }
  527. }
  528. }
  529. }
  530. .order-info{
  531. border-radius: 20rpx;
  532. background-color: #fff;padding: 20upx;margin-top: 20upx;
  533. .title{font-size: 32upx;color: #333;font-weight: bold;margin-bottom: 20upx;}
  534. .info-item{
  535. height: 80upx;line-height: 80upx;font-size: 28upx;display: flex;align-items: center;
  536. .right{
  537. color: #666;margin-left: auto;margin-right: 0;
  538. text{border: 2upx solid #ccc;color: #333;font-size: 24upx;padding: 0 15upx;margin-left: 20upx;border-radius: 5upx;}
  539. }
  540. }
  541. }
  542. .status-desc{
  543. font-size: 24rpx;color: #666;margin-top: 20rpx;
  544. }
  545. .goods-store{
  546. background-color: #fff;
  547. margin:20rpx 0;
  548. padding: 0 20rpx 20rpx;
  549. border-radius: 20rpx;
  550. .title{
  551. line-height: 80upx;
  552. font-size: 32rpx;
  553. color: #333;
  554. font-weight: bold;
  555. display: flex;
  556. align-items: center;
  557. border-bottom: 2upx solid #f8f8f8;
  558. }
  559. .store-info{
  560. display: flex;align-items: center;padding: 20upx 0;
  561. .store-right{
  562. margin-left: auto;margin-right: 0;font-size: 24rpx;color: #999;
  563. image{width: 50upx;height: 50upx;margin-bottom: 10upx;}
  564. }
  565. .store-left {
  566. .name{font-size: 30rpx;color: #333;font-weight: bold;line-height: 80upx;}
  567. .address{font-size: 24rpx;color: #999;}
  568. }
  569. }
  570. }
  571. }
  572. </style>