index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view v-if="display" class="tui-cards-container">
  3. <view class="tui-cards-box">
  4. <view class="tui-cards-title">
  5. <view>请选择你要发送的订单</view>
  6. <view style="color: #006EFF; font-family: PingFangSC-Regular;" class="tui-cards-close" @tap="handleClose">关闭</view>
  7. </view>
  8. <view class="tui-search-bar">
  9. <image class="tui-searchcion" src="/static/static/assets/serach-icon.svg"></image>
  10. <input class="tui-search-bar-input" :value="words" placeholder="搜索" @input="wordsInput" />
  11. </view>
  12. <scroll-view class="tui-order-list" scroll-y="true" enable-flex="true">
  13. <view v-for="(item, index) in orderMatch" :key="index" class="tui-order-item">
  14. <view class="order-title">
  15. <view class="order-number">订单编号: {{ item.orderNum }}</view>
  16. <view class="order-time">{{ item.time }}</view>
  17. </view>
  18. <view class="order-info">
  19. <image class="order-image" :src="item.imageUrl"></image>
  20. <view class="order-content">
  21. <view class="order-content-title">{{ item.title }}</view>
  22. <view class="order-content-description">{{ item.description }}</view>
  23. <view style="display: flex; flex-wrap: no-wrap; justify-content: space-between;">
  24. <view class="order-content-price">{{ item.price }}</view>
  25. <view class="btn-send-order" :data-order="item" @tap.stop="sendMessage"><text class="btn-send-text">发送此订单</text></view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. const orderList = [
  36. {
  37. orderNum: 1,
  38. time: '2021-7-20 20:45',
  39. title: '[天博检验]新冠核酸检测/预约',
  40. description: '专业医学检测,电子报告',
  41. imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/miles.jpeg',
  42. price: '80元'
  43. },
  44. {
  45. orderNum: 2,
  46. time: '2021-7-20 22:45',
  47. title: '[路边]新冠核酸检测/预约',
  48. description: '专业医学检测,电子报告',
  49. imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/miles.jpeg',
  50. price: '7000元'
  51. }
  52. ];
  53. export default {
  54. data() {
  55. return {
  56. words: '',
  57. orderMatch: orderList
  58. };
  59. },
  60. components: {},
  61. props: {
  62. display: {
  63. type: Boolean,
  64. default: false
  65. },
  66. conversation: {
  67. type: Object,
  68. default: () => {}
  69. }
  70. },
  71. watch: {
  72. display: {
  73. handler: function(newVal) {
  74. // this.setData({
  75. // display: newVal
  76. // });
  77. },
  78. immediate: true
  79. },
  80. conversation: {
  81. handler: function(newVal) {
  82. this.conversation=newVal;
  83. // this.setData({
  84. // conversation: newVal
  85. // });
  86. },
  87. immediate: true,
  88. deep: true
  89. }
  90. },
  91. methods: {
  92. handleClose() {
  93. this.$emit('close', {
  94. detail: {
  95. key: '1'
  96. }
  97. });
  98. },
  99. wordsInput(e) {
  100. (this.orderMatch = []),
  101. orderList.forEach(item => {
  102. if (item.title.indexOf(e.detail.value) > -1 || item.orderNum === ~~e.detail.value) {
  103. this.orderMatch.push(item);
  104. }
  105. });
  106. this.newVal=e.detail.value;
  107. this.orderMatch=orderMatch;
  108. // this.setData({
  109. // words: e.detail.value,
  110. // orderMatch: this.orderMatch
  111. // });
  112. },
  113. sendMessage(e) {
  114. const { order } = e.currentTarget.dataset;
  115. this.$emit('sendCustomMessage', {
  116. detail: {
  117. payload: {
  118. // data 字段作为表示,可以自定义
  119. data: 'order',
  120. description: order.description,
  121. // 获取骰子点数
  122. extension: JSON.stringify({
  123. title: order.title,
  124. imageUrl: order.imageUrl,
  125. price: order.price
  126. })
  127. }
  128. }
  129. });
  130. }
  131. }
  132. };
  133. </script>
  134. <style>
  135. @import './index.css';
  136. </style>