goodsReserve - 副本.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="container">
  3. <view class="appoint" :key="index" v-for="(item, index) of init_list">
  4. <view class="appoint-list">
  5. <view class="appoint-title">{{ item.simpleMerchantVO.name }}</view>
  6. <view class="appoint-address"></view>
  7. <view class="appoint-flex">
  8. <image class="img" :src="item.simpleMerchantVO.logo" mode="scaleToFill"></image>
  9. <view class="appoint-text">
  10. <view>{{ item.goodsName }}</view>
  11. <view>时间:{{ $u.timeFormat(item.appointTime) }}</view>
  12. <view>联系方式:{{ item.mobile }}</view>
  13. </view>
  14. </view>
  15. <view class="appoint-goto">
  16. <u-button
  17. class="detail"
  18. text="详情"
  19. @click="handlerSkipGoodsDetail(item, index)"
  20. ></u-button>
  21. <u-button class="cancel" text="取消" @click="handlerClearItem(item, index)"></u-button>
  22. </view>
  23. </view>
  24. </view>
  25. <u-empty
  26. v-if="init_list.length == 0"
  27. mode="data"
  28. icon="http://cdn.uviewui.com/uview/empty/data.png"
  29. >
  30. </u-empty>
  31. </view>
  32. </template>
  33. <script>
  34. import { maintainReservations } from '@/api/client/mine.js';
  35. import { cancelReservation } from '@/api/client/business.js';
  36. export default {
  37. data() {
  38. return {
  39. queryParams: {
  40. size: 10,
  41. },
  42. init_list: [], //初始化列表
  43. };
  44. },
  45. mounted() {
  46. this.handlerInitList();
  47. },
  48. methods: {
  49. // 初始化列表
  50. handlerInitList() {
  51. maintainReservations(this.queryParams).then(res => {
  52. this.init_list = res.data;
  53. });
  54. },
  55. // 点击取消商品
  56. handlerClearItem(item) {
  57. cancelReservation(item.id).then(res => {
  58. if (res.code === 'OK') {
  59. uni.showToast({
  60. title: '取消成功',
  61. icon: 'none',
  62. });
  63. this.handlerInitList();
  64. } else {
  65. uni.showToast({
  66. title: res.msg,
  67. icon: 'none',
  68. });
  69. return;
  70. }
  71. });
  72. },
  73. // 点击跳转到商品详情
  74. handlerSkipGoodsDetail(item, index) {
  75. uni.navigateTo({
  76. // url: `/pages/client/clientPackage/serviceDetail/index?id=${item.merchantId}`,
  77. url: `/pagesHome/productDetail/index?id=${item.goodsId}&shopId=${item.merchantId}`,
  78. });
  79. },
  80. },
  81. };
  82. </script>
  83. <style lang="scss" scoped>
  84. page {
  85. background-color: #f9f9f9;
  86. }
  87. .container {
  88. padding: 20rpx;
  89. }
  90. .appoint {
  91. .history {
  92. font-size: 38rpx;
  93. margin: 20rpx 10rpx;
  94. font-weight: bold;
  95. }
  96. }
  97. .appoint-list {
  98. padding: 20rpx;
  99. background-color: #fff;
  100. margin-bottom: 20rpx;
  101. box-sizing: border-box;
  102. border-radius: 20rpx;
  103. .appoint-title {
  104. font-size: 38rpx;
  105. font-weight: bold;
  106. margin-bottom: 10rpx;
  107. color: #090909;
  108. }
  109. .appoint-address {
  110. font-size: 32rpx;
  111. margin: 20rpx;
  112. padding-bottom: 20rpx;
  113. color: #000000;
  114. border-bottom: 2rpx solid #e5e5e5;
  115. }
  116. .appoint-flex {
  117. display: flex;
  118. .img {
  119. width: 210rpx;
  120. height: 160rpx;
  121. display: block;
  122. margin-right: 15rpx;
  123. }
  124. .appoint-text {
  125. font-size: 28rpx;
  126. > view {
  127. margin-bottom: 26rpx;
  128. }
  129. }
  130. }
  131. .appoint-goto {
  132. display: flex;
  133. .detail,
  134. .cancel {
  135. width: 45%;
  136. border-radius: 20rpx;
  137. }
  138. .detail {
  139. background-color: #6c9fc3;
  140. color: #fff;
  141. }
  142. }
  143. }
  144. </style>