info.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <block v-if="loading">
  4. <view class="skeleton">
  5. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  6. <view class="skeleton-line animate"></view>
  7. <view class="skeleton-line min animate"></view>
  8. <view class="skeleton-line min animate"></view>
  9. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  10. <view class="skeleton-line max animate" style="height: 200upx;"></view>
  11. </view>
  12. </block>
  13. <block v-else>
  14. <view class="order-status">
  15. <view class="status-name" v-if="orderData.status == 1">预约中</view>
  16. <view class="status-name success" v-if="orderData.status == 2">服务中</view>
  17. <view class="status-name" v-if="orderData.status == 3">已撤销</view>
  18. <view class="status-name" v-if="orderData.status == 4">已完成</view>
  19. <view class="status-desc" v-if="orderData.status == 1">预约中,如有问题可以联系客服</view>
  20. <view class="status-desc success" v-if="orderData.status == 2">服务中,如有问题可以联系客服</view>
  21. <view class="status-desc" v-if="orderData.status == 3">已撤销,可在团购订单中申请退款</view>
  22. <view class="status-desc" v-if="orderData.status == 4">服务已完成,欢迎您再次使用</view>
  23. </view>
  24. <view class="order-goods">
  25. <view class="goods-img"><image :src="orderData.goods.product_img"></image></view>
  26. <view class="goods-info">
  27. <view class="name">{{ orderData.goods.product_name }}</view>
  28. <view class="desc">
  29. <view class="time" v-if="orderData.parent.expire_at">有效期至:{{ orderData.parent.expire_at }} </view>
  30. </view>
  31. <view class="desc">x {{ orderData.number?orderData.number:1 }} <text>{{ orderData.sku }}</text></view>
  32. <!-- <view class="total">合计:¥ {{orderData.goods.product_price}}</view> -->
  33. </view>
  34. </view>
  35. <view class="goods-item">
  36. <view class="left">商品总额</view>
  37. <view class="right">¥{{orderData.parent.order_amount}}</view>
  38. </view>
  39. <view class="goods-item">
  40. <view class="left">商品优惠</view>
  41. <view class="right red">¥{{orderData.parent.order_amount}}</view>
  42. </view>
  43. <view class="goods-store" v-if="poiData">
  44. <view class="title">预约门店</view>
  45. <view class="store-info">
  46. <view class="store-left">
  47. <view class="name">{{poiData.poi_name}}</view>
  48. <view class="address">{{poiData.poi_address}}</view>
  49. </view>
  50. <view class="store-right">
  51. <view class="right-item" @click="openLocation">
  52. <image src="/static/image/map.png"></image>
  53. <view class="desc">导航</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="order-info">
  59. <view class="title">订单信息</view>
  60. <view class="info-item">
  61. <view class="name">订单编号</view>
  62. <view class="right">{{ orderData.order_id }} <text @click="copyOrder(orderData.order_id)">复制</text></view>
  63. </view>
  64. <view class="info-item">
  65. <view class="name">下单时间</view>
  66. <view class="right">{{ orderData.create_at }}</view>
  67. </view>
  68. </view>
  69. <view class="order-info" v-if="orderData.service_type==1">
  70. <view class="title">预约信息</view>
  71. <view class="info-item">
  72. <view class="name">到店时间</view>
  73. <view class="right">{{ orderData.time }}</view>
  74. </view>
  75. </view>
  76. <view class="order-info" v-if="orderData.service_type==2">
  77. <view class="title">会员资料</view>
  78. <view class="info-item">
  79. <view class="name"></view>
  80. <view class="right">{{ orderData.username }}<text>{{ orderData.mobile }}</text></view>
  81. </view>
  82. <view class="address-info">
  83. {{ orderData.region }}{{ orderData.address }}
  84. </view>
  85. </view>
  86. <view class="line-footer"></view>
  87. <view class="footer">
  88. <view class="footer-op" v-if="orderData.status == 1">
  89. <view class="footer-right">
  90. <view class="btn" @click="cancelOrder(1)">取消预约</view>
  91. <view class="btn full" @click="callMobile">联系商家</view>
  92. </view>
  93. </view>
  94. <view class="footer-op" v-if="orderData.status == 2">
  95. <view class="footer-right">
  96. <view class="btn" @click="cancelOrder(2)">取消服务</view>
  97. <view class="btn full" @click="callMobile">联系商家</view>
  98. </view>
  99. </view>
  100. <view class="footer-op" v-if="orderData.status == 3">
  101. <view class="footer-right" @click="delOrder()">
  102. <view class="btn full">删除订单?</view>
  103. </view>
  104. </view>
  105. <view class="footer-op" v-if="orderData.status == 4">
  106. <view class="footer-right">
  107. <view class="btn">已完成</view>
  108. </view>
  109. </view>
  110. <view class="footer-safe"></view>
  111. </view>
  112. </block>
  113. </view>
  114. </template>
  115. <script>
  116. var app;
  117. import * as Api from "@/static/api/order.js";
  118. export default {
  119. data() {
  120. return {
  121. loading:true,
  122. order:"",
  123. poiData:null,
  124. goodsData:null,
  125. orderData:null,
  126. goodsPrice:0,
  127. storeData:null,
  128. orderIdForRefundAmount:"",
  129. applyRefundParams:{
  130. orderId:""
  131. }
  132. }
  133. },
  134. onLoad({order}) {
  135. app = this;
  136. app.order = order;
  137. app.getOrder()
  138. },
  139. methods: {
  140. copyOrder(order){
  141. setTimeout(function(){
  142. uni.setClipboardData({
  143. data:order,
  144. success() {
  145. app.$dialog.showSuccess("复制成功")
  146. },
  147. fail() {
  148. app.$dialog.showSuccess("复制失败")
  149. }
  150. })
  151. },300)
  152. },
  153. openLocation(){
  154. uni.openLocation({
  155. latitude:app.poiData.latitude,
  156. longitude:app.poiData.longitude,
  157. name:app.poiData.poi_name,
  158. address:app.poiData.poi_address,
  159. fail() {
  160. app.$dialog.showSuccess("打开地图失败");
  161. }
  162. })
  163. },
  164. callMobile(){
  165. if (!app.storeData.service_mobile) return ;
  166. uni.makePhoneCall({
  167. phoneNumber:app.storeData.service_mobile,
  168. fail() {
  169. app.$dialog.showSuccess("联系失败")
  170. }
  171. })
  172. },
  173. delOrder(){
  174. app.$dialog.showError("确定要删除该笔预约订单吗",function(res){
  175. if (res.confirm) {
  176. Api.del({"order":app.order}).then((res)=>{
  177. if (res.code == 0) {
  178. return app.$dialog.showSuccess(res.msg)
  179. }
  180. app.$dialog.showSuccess(res.msg,"none",function(){
  181. uni.switchTab({
  182. url:"/pages/order/order"
  183. })
  184. })
  185. })
  186. }
  187. },"删除提示")
  188. },
  189. cancelOrder(type){
  190. if (type == 1) {
  191. var msg = "确定要取消该预约吗?";
  192. } else {
  193. var msg = "该订单已在服务中,取消服务需商家审核,如需加急审核,请点击确定后,尽快致电商家!";
  194. }
  195. app.$dialog.showError(msg,function(res){
  196. if (res.confirm) {
  197. Api.cancel({"order":app.order,"type":type}).then((res)=>{
  198. if (res.code == 0) {
  199. return app.$dialog.showSuccess(res.msg)
  200. }
  201. app.$dialog.showSuccess(res.msg,"none",function(){
  202. app.getOrder()
  203. })
  204. })
  205. }
  206. },"取消预约/服务")
  207. },
  208. getOrder(){
  209. Api.orderDetail({"order":app.order}).then((res)=>{
  210. app.loading = false;
  211. if (res.code !== 1) {
  212. app.$dialog.showSuccess(res.msg,function(){
  213. uni.navigateBack()
  214. });
  215. return ;
  216. }
  217. app.goodsPrice = res.data.parent.pay_amount * 100;
  218. app.applyRefundParams.orderId = res.data.order_id;
  219. app.orderData = res.data
  220. app.poiData = res.data.poi;
  221. app.storeData = res.data.store;
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style>
  228. page{background-color: #f8f8f8;}
  229. .skeleton{width: 90%;margin: 20upx auto;}
  230. .line-footer{height: 200upx;}
  231. .address-info{font-size: 28upx;color: #333;}
  232. .footer{position: fixed;bottom: 0;background-color: #fff;padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;left: 0;right: 0;}
  233. .footer .footer-op{display: flex;align-items: center;}
  234. .footer .footer-op .footer-left{display: flex;align-items: center;gap: 10upx;justify-content: center;font-size: 32upx;color: #fe2c56;font-weight: bold;}
  235. .footer .footer-op .footer-left text{color: #333;font-size: 28upx;font-weight: normal;}
  236. .footer .footer-op .footer-left text.red{color: #f56c6c;font-weight: bold;}
  237. .footer .footer-op .footer-left .item{flex-direction: column;display: flex;font-size: 24rpx;color: #333;align-items: center;}
  238. .footer .footer-op .footer-left image{width: 40upx;height: 40upx;}
  239. .footer .footer-op .footer-right{margin-left: auto;margin-right: 0;display: flex;align-items: center;gap: 20upx;}
  240. .footer .footer-op .footer-right .btn{font-size: 28rpx;height: 80upx;border-radius: 10upx;line-height: 80upx;text-align: center;width: 200upx;color: #333;border: 2upx solid #ccc;}
  241. .footer .footer-op .footer-right .btn.danger{border:2upx solid #fe2c56;color: #fe2c56;}
  242. .footer .footer-op .footer-right .btn.full{background-color: #fe2c56;color: #fff;border:2upx solid #fe2c56;}
  243. .footer .footer-safe {height: env(safe-area-inset-bottom);width: 100%;}
  244. .order-status{padding: 40upx 20upx;text-align: center;}
  245. .order-status .status-name{text-align: center;font-size: 32upx;color: #333;font-weight: bold;display: flex;align-items: center;justify-content: center;}
  246. .order-status .status-desc{font-size: 24upx;color: #666;margin-top: 20upx;}
  247. .order-info{background-color: #fff;padding: 20upx;margin-top: 20upx;}
  248. .order-info .title{font-size: 32upx;color: #333;font-weight: bold;margin-bottom: 20upx;}
  249. .order-info .info-item{height: 80upx;line-height: 80upx;font-size: 28upx;display: flex;align-items: center;}
  250. .order-info .info-item .right{color: #666;margin-left: auto;margin-right: 0;}
  251. .order-info .info-item .right text{border: 2upx solid #ccc;color: #333;font-size: 24upx;padding: 0 15upx;margin-left: 20upx;border-radius: 5upx;}
  252. .goods-safe{display: flex;align-items: center;font-size: 24rpx;color: #999;gap: 40upx;background: #fff;border-top: 2upx solid #f8f8f8;padding: 20upx;}
  253. .goods-safe .safe-item{display: flex;align-items: center;}
  254. .goods-safe image{width: 30upx;height: 30upx;margin-right: 10upx;}
  255. .order-goods{display: flex;align-items: center;background-color: #fff;padding: 0 20upx;}
  256. .order-goods image{width: 140upx;height: 140upx;}
  257. .goods-info{margin-left: 20upx;font-size: 28upx;flex: 1;padding: 20upx 0;}
  258. .goods-info .name{font-size: 30upx;color: #333;}
  259. .goods-info .desc{font-size: 24upx;color: #999;margin: 20upx 0;}
  260. .goods-info .desc text{margin-left: 20upx;}
  261. .goods-info .total{font-size: 30upx;color: #333;text-align: right;font-weight: bold;}
  262. .goods-item{display: flex;align-items: center;line-height: 80upx;justify-content: space-between;font-size: 28upx;color: #333;background-color: #fff;padding: 0 20upx;border-top: 2upx solid #f8f8f8;}
  263. .goods-item .right.red{color: #fe2c56;}
  264. .home-store{margin: 20upx auto;display: flex;align-items: center;background-color: #fff;border-radius: 10upx;display: flex;align-items: center;padding: 30upx;}
  265. .home-store .store-right{width: 120upx;height: 120upx;background-color: #fff;text-align: center;display: flex;align-items: center;justify-content: center;margin-left: auto;margin-right: 0;border-radius: 10upx;}
  266. .home-store .store-right image{width: 60upx;height: 60upx;}
  267. .home-store .left{display: flex;align-items: center;}
  268. .home-store .left image{width: 60upx;height: 60upx;margin-right: 20upx;}
  269. .home-store .right {margin-left: auto;margin-right: 0;display: flex;align-items: center;}
  270. .home-store .right image{width: 50upx;height: 50upx;}
  271. .home-store .name{font-size: 32upx;color: #000;font-weight: bold;}
  272. .home-store .desc{font-size: 26upx;color: #666;margin-top: 20upx;}
  273. .home-store .status{color: #333;font-size: 28upx;padding:5upx 15upx;border-radius: 10upx;margin-left: 10upx;}
  274. .home-store .status.error{background-color: #fef0f0;color: #f56c6c;}
  275. .service-popup .item{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-bottom: 2upx solid #f8f8f8;}
  276. .service-popup .item .btn{background-color: #fff;border: 0;height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;}
  277. .service-popup .item .btn::after{border: 0;}
  278. .service-popup .foot{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-top: 20upx solid #f8f8f8;}
  279. .goods-store{background-color: #fff;padding: 0 20upx;margin-top: 20upx;}
  280. .goods-store .title{line-height: 80upx;font-size: 32rpx;color: #333;font-weight: bold;display: flex;align-items: center;border-bottom: 2upx solid #f8f8f8;}
  281. .goods-store .store-info{display: flex;align-items: center;padding: 20upx 0;}
  282. .goods-store .store-info .store-right{margin-left: auto;margin-right: 0;font-size: 24rpx;color: #999;}
  283. .goods-store .store-info .store-right image{width: 50upx;height: 50upx;margin-bottom: 10upx;}
  284. .goods-store .store-info .store-left .name{font-size: 30rpx;color: #333;font-weight: bold;line-height: 80upx;}
  285. .goods-store .store-info .store-left .address{font-size: 24rpx;color: #999;}
  286. </style>