detail.vue 19 KB

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