packageOrderDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <view>
  3. <view class="cont">
  4. <view class="bg"></view>
  5. <view class="inner">
  6. <!-- 订单状态 -->
  7. <view class="order-status">
  8. <!-- 待付款 -->
  9. <view v-if="order.status == 1" class="inner">
  10. <view class="img-box">
  11. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/67eda0644e5847008096525b04cd12ca.png" mode=""></image>
  12. </view>
  13. <view class="status-box">
  14. <text class="status">待付款</text>
  15. <!-- <text class="desc">请在{{payLimitTime}}前完成支付</text> -->
  16. </view>
  17. </view>
  18. <!-- 服务中 -->
  19. <view v-if="order.status == 2" class="inner">
  20. <view class="img-box">
  21. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/b71efb4b5ca54564b553569d578738b4.png" mode=""></image>
  22. </view>
  23. <view class="status-box">
  24. <text class="status">服务中</text>
  25. <text class="desc">正在服务中</text>
  26. </view>
  27. </view>
  28. <!-- 已完成 -->
  29. <view v-if="order.status == 3" class="inner">
  30. <view class="img-box">
  31. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/0712ba14f3a648afa69c9912fcbf9b61.png" mode=""></image>
  32. </view>
  33. <view class="status-box">
  34. <text class="status">已完成</text>
  35. <text class="desc">服务已完成</text>
  36. </view>
  37. </view>
  38. <!--交易取消 -->
  39. <view v-if="order.status == -1" class="inner">
  40. <view class="img-box">
  41. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/02f95bd03e854a9c8076aef1e6c05e74.png" mode=""></image>
  42. </view>
  43. <view class="status-box">
  44. <text class="status">交易关闭</text>
  45. <text class="desc">订单已取消</text>
  46. </view>
  47. </view>
  48. <view v-if="order.status == -2" class="inner">
  49. <view class="img-box">
  50. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/6020712aa10f4bb08db92957cb7eb8ed.png" mode=""></image>
  51. </view>
  52. <view class="status-box">
  53. <text class="status">退款成功</text>
  54. <text class="desc">已成功退款</text>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="content">
  59. <view class="package-box">
  60. <view class="left">
  61. <image :src="package.imgUrl"></image>
  62. </view>
  63. <view class="right">
  64. <view class="title">{{package.packageName}}</view>
  65. <view class="desc">
  66. <view class="cycle">用药周期{{package.cycle}}天</view>
  67. <view class="duration">签约时长{{package.duration}}天</view>
  68. </view>
  69. <!-- <view class="price-box">
  70. <view class="price">¥30元/日</view>
  71. <view class="count">6.2w人已购</view>
  72. </view> -->
  73. </view>
  74. </view>
  75. <!-- 订单信息 -->
  76. <view class="order-info">
  77. <view class="title">订单信息</view>
  78. <view class="item">
  79. <text class="label">订单编号</text>
  80. <view class="sn-box">
  81. <text class="text">{{order.orderSn}}</text>
  82. <view class="copy-btn" @click="copyOrderSn(order.orderSn)">复制</view>
  83. </view>
  84. </view>
  85. <view class="item">
  86. <text class="label">下单时间</text>
  87. <text class="text">{{order.createTime}}</text>
  88. </view>
  89. <view class="item">
  90. <text class="label">支付方式</text>
  91. <text class="text" v-if="order.payType==1">全款支付</text>
  92. <text class="text" v-if="order.payType==2">物流代收</text>
  93. <text class="text" v-if="order.payType==3">货到付款</text>
  94. </view>
  95. <view class="item">
  96. <text class="label">订单金额</text>
  97. <text class="text" v-if="order.payPrice!=null">¥{{order.payPrice.toFixed(2)}}</text>
  98. </view>
  99. <view class="item">
  100. <text class="label">支付金额</text>
  101. <text class="text" v-if="order.payMoney!=null">¥{{order.payMoney.toFixed(2)}}</text>
  102. </view>
  103. <view class="item">
  104. <text class="label">抵扣金额</text>
  105. <text class="text" v-if="order.discountMoney!=null">¥{{order.discountMoney.toFixed(2)}}</text>
  106. </view>
  107. <view class="item">
  108. <text class="label">代收金额</text>
  109. <text class="text" v-if="order.payRemain!=null">¥{{order.payRemain.toFixed(2)}}</text>
  110. </view>
  111. <view class="item">
  112. <text class="label">运费金额</text>
  113. <text class="text" v-if="order.payDelivery!=null">¥{{order.payDelivery.toFixed(2)}}</text>
  114. </view>
  115. <view class="item">
  116. <text class="label">支付时间</text>
  117. <text class="text">{{order.payTime}}</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 按钮 -->
  124. <view class="btn-box">
  125. <view class="btn cancel" v-if="order.status==1" @click="cancelOrder()">取消订单</view>
  126. <view class="btn pay" v-if="order.status==1" @click="pay()">支付</view>
  127. </view>
  128. </view>
  129. </template>
  130. <script>
  131. import {cancelOrder,getPackageOrderById,pay} from '@/api/packageOrder'
  132. export default {
  133. data() {
  134. return {
  135. orderId:null,
  136. order:{},
  137. package:null,
  138. items:[],
  139. };
  140. },
  141. onLoad(option) {
  142. this.orderId = option.orderId
  143. this.getPackageOrderById();
  144. },
  145. onShow() {
  146. },
  147. methods: {
  148. cancelOrder(){
  149. var that=this;
  150. uni.showModal({
  151. title:"提示",
  152. content:"确认取消订单吗?",
  153. showCancel:true,
  154. cancelText:'取消',
  155. confirmText:'确定',
  156. success:res=>{
  157. if(res.confirm){
  158. // 用户点击确定
  159. var data={orderId:that.orderId}
  160. cancelOrder(data).then(
  161. res => {
  162. if(res.code==200){
  163. uni.$emit('refreshPackageOrder');
  164. that.getPackageOrderById()
  165. uni.showToast({
  166. icon:'success',
  167. title: "操作成功",
  168. });
  169. }else{
  170. uni.showToast({
  171. icon:'none',
  172. title: res.msg,
  173. });
  174. }
  175. },
  176. rej => {}
  177. );
  178. }else{
  179. // 否则点击了取消
  180. }
  181. }
  182. })
  183. },
  184. getPackageOrderById(){
  185. var data={orderId:this.orderId};
  186. getPackageOrderById(data).then(res => {
  187. if(res.code==200){
  188. this.order=res.order;
  189. this.package=JSON.parse(this.order.packageJson)
  190. }else{
  191. uni.showToast({
  192. icon:'none',
  193. title: "请求失败",
  194. });
  195. }
  196. });
  197. },
  198. pay() {
  199. uni.navigateTo({
  200. url: '/pages_order/packageOrderPay?orderId='+this.order.orderId
  201. })
  202. },
  203. // 返回上一页
  204. back() {
  205. let pages = getCurrentPages();
  206. console.log(pages.length);
  207. if(pages.length>1){
  208. uni.navigateBack()
  209. }
  210. else{
  211. uni.reLaunch({
  212. url:"/pages/common/launch"
  213. })
  214. }
  215. },
  216. // 复制订单编号
  217. copyOrderSn(text) {
  218. // 复制方法
  219. uni.setClipboardData({
  220. data:text,
  221. success:()=>{
  222. uni.showToast({
  223. title:'内容已成功复制到剪切板',
  224. icon:'none'
  225. })
  226. }
  227. });
  228. },
  229. }
  230. }
  231. </script>
  232. <style lang="scss">
  233. .cont{
  234. width: 100%;
  235. position: relative;
  236. .bg{
  237. width: 100%;
  238. height: 350upx;
  239. position: absolute;
  240. top: 0;
  241. left: 0;
  242. z-index: 1;
  243. background-color: #C39A58;
  244. background: linear-gradient(#C39A58, #E2C99E);
  245. border-radius: 0rpx 0rpx 100rpx 100rpx;
  246. }
  247. .inner{
  248. position: relative;
  249. padding: 30upx 0rpx;
  250. width: 100%;
  251. height: 100%;
  252. z-index: 999;
  253. .order-status{
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. padding: 0 30upx;
  258. .inner{
  259. display: flex;
  260. align-items: center;
  261. .img-box{
  262. width: 96upx;
  263. height: 96upx;
  264. margin-right: 30upx;
  265. image{
  266. width: 100%;
  267. height: 100%;
  268. }
  269. }
  270. .status-box{
  271. height: 96upx;
  272. display: flex;
  273. flex-direction: column;
  274. justify-content: center;
  275. .status{
  276. font-size: 40upx;
  277. font-family: PingFang SC;
  278. font-weight: bold;
  279. color: #FFFFFF;
  280. line-height: 1;
  281. }
  282. .desc{
  283. font-size: 26upx;
  284. font-family: PingFang SC;
  285. font-weight: 500;
  286. color: #FFFFFF;
  287. line-height: 1;
  288. margin-top: 30upx;
  289. }
  290. }
  291. }
  292. }
  293. }
  294. }
  295. .content{
  296. margin: 20rpx 0rpx;
  297. padding: 0 20upx 140rpx 20upx;
  298. .package-box{
  299. width: 100%;
  300. display: flex;
  301. padding: 20rpx;
  302. background-color: #fff;
  303. align-items: flex-start;
  304. justify-content: flex-start;
  305. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  306. border-radius: 15rpx;
  307. .left{
  308. width:200rpx;
  309. height:200rpx;
  310. image{
  311. border-radius: 15rpx;
  312. width:100%;
  313. height:100%;
  314. }
  315. }
  316. .right{
  317. height: 200rpx;
  318. display: flex;
  319. flex-direction: column;
  320. align-items: flex-start;
  321. justify-content: flex-start;
  322. padding-left: 15rpx;
  323. width:calc(100% - 200rpx);
  324. .title{
  325. font-weight: bold;
  326. font-size: 34upx;
  327. font-family: PingFang SC;
  328. color: #111;
  329. }
  330. .desc{
  331. margin-top: 15rpx;
  332. display: flex;
  333. align-items: flex-start;
  334. justify-content: flex-start;
  335. .cycle{
  336. background-color: #eee;
  337. border-radius: 30rpx;
  338. padding: 5rpx 15rpx;
  339. font-size: 26upx;
  340. font-family: PingFang SC;
  341. color: #C39A58;
  342. }
  343. .duration{
  344. margin-left: 10rpx;
  345. background-color: #eee;
  346. border-radius: 30rpx;
  347. padding: 5rpx 15rpx;
  348. font-size: 26upx;
  349. font-family: PingFang SC;
  350. color: #C39A58;
  351. }
  352. }
  353. .price-box{
  354. flex: 1;
  355. display: flex;
  356. align-items: flex-end;
  357. justify-content: space-between;
  358. width: 100%;
  359. .price{
  360. padding: 5rpx 10rpx;
  361. background-color: #C39A58;
  362. border-radius: 30rpx;
  363. font-size: 20upx;
  364. font-family: PingFang SC;
  365. color: #ffffff;
  366. }
  367. .count{
  368. font-size: 24upx;
  369. font-family: PingFang SC;
  370. color: #333333;
  371. }
  372. }
  373. }
  374. }
  375. .order-info{
  376. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  377. margin-top: 20upx;
  378. background: #FFFFFF;
  379. border-radius: 16upx;
  380. padding: 40upx 30upx;
  381. .title{
  382. font-size: 30upx;
  383. font-family: PingFang SC;
  384. font-weight: bold;
  385. color: #222222;
  386. line-height: 1;
  387. }
  388. .item{
  389. margin-top: 40upx;
  390. display: flex;
  391. align-items: center;
  392. justify-content: space-between;
  393. .label{
  394. font-size: 26upx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. color: #666666;
  398. line-height: 1;
  399. }
  400. .text{
  401. font-size: 26upx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #222222;
  405. line-height: 32upx;
  406. }
  407. .cont-text{
  408. font-size: 26upx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #666666;
  412. .bold{
  413. color: #111111;
  414. }
  415. }
  416. .sn-box{
  417. display: flex;
  418. align-items: center;
  419. .copy-btn{
  420. width: 58upx;
  421. height: 32upx;
  422. line-height: 32upx;
  423. text-align: center;
  424. font-size: 22upx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #222222;
  428. background: #F5F5F5;
  429. border-radius: 4upx;
  430. margin-left: 24upx;
  431. }
  432. }
  433. .check-box{
  434. display: flex;
  435. align-items: center;
  436. image{
  437. width: 14upx;
  438. height: 24upx;
  439. margin-left: 10upx;
  440. }
  441. }
  442. }
  443. .line{
  444. width: 100%;
  445. height: 1px;
  446. background: #F0F0F0;
  447. margin-top: 30upx;
  448. }
  449. }
  450. }
  451. .btn-box{
  452. z-index: 999;
  453. bottom: 0;
  454. width: 100%;
  455. position: fixed;
  456. height: 120upx;
  457. box-sizing: border-box;
  458. background: #FFFFFF;
  459. padding: 0 30upx;
  460. display: flex;
  461. align-items: center;
  462. justify-content: flex-end;
  463. .btn{
  464. width: 155upx;
  465. height: 64upx;
  466. line-height: 64upx;
  467. font-size: 26upx;
  468. font-family: PingFang SC;
  469. font-weight: 500;
  470. text-align: center;
  471. border-radius: 32upx;
  472. margin-left: 15upx;
  473. &.cancel{
  474. border: 1px solid #DDDDDD;
  475. color: #666666;
  476. }
  477. &.pay{
  478. background: #C39A58;
  479. color: #FFFFFF;
  480. }
  481. }
  482. }
  483. </style>