推拿小程序前端代码仓库
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.

229 lines
4.7 KiB

1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page">
  3. <navbar title="核销详情" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="flex page-header">
  5. <image class="icon" src="@/pages_order/static/verifyOrder/icon-clock.png" mode="widthFix"></image>
  6. <text>待核销</text>
  7. </view>
  8. <view class="page-content">
  9. <!-- 商品详情 -->
  10. <productCard :data="orderDetail.massageItem" size="medium" :readonly="true"></productCard>
  11. <view class="card rights" v-if="orderDetail.rights && orderDetail.rights.length">
  12. <view class="flex rights-item" v-for="item in orderDetail.rights" :key="item">
  13. <image class="rights-icon" src="@/pages_order/static/verifyOrder/icon-checked.png" mode="widthFix"></image>
  14. <text>{{ item }}</text>
  15. </view>
  16. </view>
  17. <view class="card info">
  18. <view class="info-header">核销信息</view>
  19. <view class="flex flex-column info-content">
  20. <image class="info-qr" :src="orderDetail.qrCodeImgUrl" mode="widthFix"></image>
  21. <view class="info-no">{{ `订单号:${orderDetail.id}` }}</view>
  22. <view class="info-desc">{{ `有效时间:${orderDetail.startTime}${orderDetail.endTime}` }}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 下单 -->
  27. <view class="flex bar">
  28. <button plain class="btn btn-plain" @click="overOrder">核销</button>
  29. <button plain class="btn btn-plain" @click="onRefund">申请退款</button>
  30. <button plain class="btn" @click="onBuyAgain">再次购买</button>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import productCard from '@/components/product/productCard.vue'
  36. export default {
  37. components: {
  38. productCard,
  39. },
  40. data() {
  41. return {
  42. orderDetail: {},
  43. }
  44. },
  45. onLoad(args) {
  46. this.id = args.id
  47. this.fetchOrderDetail()
  48. },
  49. onPullDownRefresh() {
  50. this.fetchOrderDetail()
  51. },
  52. methods: {
  53. async fetchOrderDetail() {
  54. try {
  55. this.orderDetail = await this.$fetch('queryOrderById', { id: this.id })
  56. } catch (err) {
  57. }
  58. uni.stopPullDownRefresh()
  59. },
  60. overOrder(){
  61. uni.showModal({
  62. title: '确认核销订单吗?',
  63. success : e => {
  64. if(e.confirm){
  65. this.$api('overOrder', {
  66. orderId : this.orderDetail.id,
  67. }, res => {
  68. this.$emit('done')
  69. // 请求成功后返回上一个页面
  70. uni.navigateBack()
  71. })
  72. }
  73. }
  74. })
  75. },
  76. onRefund() {
  77. // todo
  78. uni.showModal({
  79. title: '确认申请订单退款嘛?',
  80. success : e => {
  81. if(e.confirm){
  82. this.$api('rollbackOrder', {
  83. orderId : this.orderDetail.id,
  84. }, res => {
  85. this.$emit('done')
  86. })
  87. }
  88. }
  89. })
  90. },
  91. onBuyAgain() {
  92. // todo: check
  93. this.$utils.navigateTo(`/pages_order/product/productDetail?id=${this.orderDetail.massageItem.id}`)
  94. },
  95. },
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. $bar-height: 132rpx;
  100. .page {
  101. background-color: #F5F5F5;
  102. /deep/ .nav-bar__view {
  103. background-image: linear-gradient(#84A73F, #D8FF8F);
  104. }
  105. &-header {
  106. color: #000000;
  107. font-size: 28rpx;
  108. margin-top: 24rpx;
  109. .icon {
  110. width: 30rpx;
  111. height: auto;
  112. margin-right: 17rpx;
  113. }
  114. }
  115. &-content {
  116. padding: 11rpx 13rpx;
  117. }
  118. }
  119. .rights {
  120. margin-top: 15rpx;
  121. padding: 23rpx 48rpx;
  122. color: #000000;
  123. font-size: 28rpx;
  124. &-item {
  125. margin-right: 70rpx;
  126. display: inline-flex;
  127. }
  128. &-icon {
  129. width: 30rpx;
  130. height: auto;
  131. margin-right: 12rpx;
  132. }
  133. }
  134. .info {
  135. margin-top: 19rpx;
  136. padding: 25rpx 41rpx 51rpx 41rpx;
  137. font-size: 28rpx;
  138. &-header {
  139. color: #000000;
  140. padding: 0 0 16rpx 7rpx;
  141. border-bottom: 1rpx dashed #C7C7C7;
  142. }
  143. &-qr {
  144. width: 279rpx;
  145. height: auto;
  146. margin-top: 57rpx;
  147. }
  148. &-no {
  149. color: #84A73F;
  150. margin-top: 16rpx;
  151. }
  152. &-desc {
  153. color: #999999;
  154. font-size: 22rpx;
  155. margin-top: 65rpx;
  156. }
  157. }
  158. .bar {
  159. position: fixed;
  160. bottom: 0;
  161. left: 0;
  162. width: 100vw;
  163. height: $bar-height;
  164. padding-bottom: env(safe-area-inset-bottom);
  165. background-color: $uni-fg-color;
  166. justify-content: flex-end;
  167. }
  168. .btn {
  169. display: inline-block;
  170. width: auto;
  171. height: auto;
  172. padding: 24rpx 50rpx;
  173. box-sizing: border-box;
  174. border: none;
  175. border-radius: 44rpx;
  176. margin: 0;
  177. font-size: 28rpx;
  178. line-height: 1;
  179. color: #FFFFFF;
  180. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  181. & + & {
  182. margin-left: 39rpx;
  183. }
  184. &:last-child {
  185. margin-right: 54rpx;
  186. }
  187. &-plain {
  188. border: 2rpx solid #999999;
  189. color: #999999;
  190. background: none;
  191. }
  192. }
  193. </style>