推拿小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
3.7 KiB

  1. <template>
  2. <view class="card order order-card__view">
  3. <view class="flex overview">
  4. <text class="title">{{ data.title }}</text>
  5. <text class="state">{{ stateCodeAndDescFieldsMapping[data.state] }}</text>
  6. </view>
  7. <view class="flex detail">
  8. <image class="img" :src="data.imgUrl"></image>
  9. <view class="info">
  10. <view class="desc">
  11. <view class="row">{{ `服务内容:${data.desc || '-'}` }}</view>
  12. <view class="row">{{ `下单时间:${data.createTime || '-'}` }}</view>
  13. <view class="row">{{ `订单号:${data.orderNo || '-'}` }}</view>
  14. </view>
  15. <view class="price">
  16. 总价格<text class="unit">¥</text><text class="count">{{ data.price }}</text>
  17. </view>
  18. <view class="btns" v-if="[0, 1].includes(data.state)">
  19. <!-- 待付款 -->
  20. <template v-if="data.state === 0">
  21. <button plain class="btn btn-plain" @click="onCancel">取消订单</button>
  22. <button plain class="btn" @click="onPay">立即付款</button>
  23. </template>
  24. <!-- 待核销 -->
  25. <template v-if="data.state === 1">
  26. <button plain class="btn" @click="onVerify">去核销</button>
  27. </template>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import mixinsOrder from '@/mixins/order.js'
  35. const TEST_DATA = {
  36. id: '001',
  37. imgUrl: '../../static/image/home/temp-product.png',
  38. title: '60分钟肩颈推拿按摩',
  39. desc: '疏通经络 放松肌肉',
  40. price: 264,
  41. orderNo: 'da123567',
  42. createTime: '2024-12-24 18:45:23',
  43. state: 1,
  44. }
  45. export default {
  46. mixins: [mixinsOrder],
  47. props: {
  48. data: {
  49. type: Object,
  50. default() {
  51. // todo: delete
  52. return TEST_DATA
  53. }
  54. },
  55. },
  56. data() {
  57. return {
  58. stateCodeAndDescFieldsMapping: {
  59. 0: '待付款',
  60. 1: '待核销',
  61. 2: '已完成',
  62. 3: '已取消',
  63. }
  64. }
  65. },
  66. methods: {
  67. onCancel() {
  68. this.cancelOrder(this.data)
  69. },
  70. onPay() {
  71. this.toPayOrder(this.data)
  72. },
  73. onVerify() {
  74. // todo
  75. this.$utils.navigateTo(`/pages_order/order/verifyOrder?id=${this.data.id}`)
  76. }
  77. },
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .order {
  82. background-color: $uni-fg-color;
  83. padding: 15rpx 33rpx 0 30rpx;
  84. & + & {
  85. margin-top: 20rpx;
  86. }
  87. }
  88. .overview {
  89. justify-content: space-between;
  90. font-size: 28rpx;
  91. .title {
  92. color: #000000;
  93. font-weight: 700;
  94. }
  95. .state {
  96. color: $uni-color-light;
  97. }
  98. }
  99. .detail {
  100. margin-top: 9rpx;
  101. align-items: flex-start;
  102. .img {
  103. width: 167rpx;
  104. height: 167rpx;
  105. margin-right: 15rpx;
  106. margin-bottom: 29rpx;
  107. }
  108. }
  109. .info {
  110. flex: 1;
  111. font-size: 22rpx;
  112. .desc {
  113. background-color: #F5F5F5;
  114. border-radius: 5rpx;
  115. padding: 13rpx 16rpx;
  116. color: #999999;
  117. }
  118. .row + .row {
  119. margin-top: 6rpx;
  120. }
  121. .price {
  122. margin-top: 8rpx;
  123. text-align: right;
  124. color: #000000;
  125. .count,
  126. .unit {
  127. color: #FF2A2A;
  128. }
  129. .unit {
  130. font-size: 18rpx;
  131. }
  132. }
  133. .btns {
  134. margin-top: 16rpx;
  135. margin-bottom: 9rpx;
  136. text-align: right;
  137. font-size: 0;
  138. }
  139. }
  140. .btn {
  141. display: inline-block;
  142. width: auto;
  143. min-width: 145rpx;
  144. height: auto;
  145. padding: 14rpx 28rpx;
  146. box-sizing: border-box;
  147. border: none;
  148. border-radius: 29rpx;
  149. margin: 0;
  150. font-size: 22rpx;
  151. line-height: 1;
  152. color: #FFFFFF;
  153. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  154. & + & {
  155. margin-left: 39rpx;
  156. }
  157. &-plain {
  158. border: 2rpx solid #999999;
  159. color: #999999;
  160. background: none;
  161. }
  162. }
  163. </style>