detail.vue 19 KB

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