vaccinesList.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="bg-white">
  3. <u-dropdown>
  4. <u-dropdown-item @change="classtype" v-model="value" :title="options1[value].label" :options="options1"></u-dropdown-item>
  5. <u-dropdown-item @change="pricetype" v-model="price" :title="options3[price].label" :options="options3"></u-dropdown-item>
  6. <u-dropdown-item @change="recomtype" v-model="recommend" :title="options2[recommend].label" :options="options2"></u-dropdown-item>
  7. </u-dropdown>
  8. <view class="padding-lr-sm">
  9. <u-search :clearabled="false" shape="round" :show-action="false" placeholder="搜索疫苗名称" v-model="keyword"></u-search>
  10. </view>
  11. <view class="margin-sm">
  12. <view v-for="(item,index) in vaccineList" :key="index" @click="xuanzephone(item)" class="padding bg-white margin-top-sm flex justify-between align-center"
  13. style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  14. <view class="">
  15. <view class="text-bold" style="color: #333333;font-size: 30rpx;">
  16. {{item.name}}
  17. </view>
  18. <view class="flex align-center margin-top-xs">
  19. <view class="mianfei margin-right-xs" style="font-size:22rpx;color: #EEAA3F;">
  20. {{item.type==1?'免费':'¥'+item.price/100}}
  21. </view>
  22. <view class="typestyle" style="font-size:22rpx;color: #0B73B9;">
  23. {{item.type==1?'I类':'II类'}}
  24. </view>
  25. </view>
  26. <view class="margin-top-xs" style="color: #999999; font-size: 26rpx;">
  27. 备注:<text style="color: #666666;">{{item.remark}}</text>
  28. </view>
  29. <view class="margin-top-xs" style="color: #999999; font-size: 26rpx;">
  30. 厂家:<text style="color: #666666;">{{item.supplier}}</text>
  31. </view>
  32. </view>
  33. <view class="">
  34. <u-radio-group v-model="danxuan">
  35. <u-radio @change="radioChange" :key="index" :name="item.id">
  36. </u-radio>
  37. </u-radio-group>
  38. </view>
  39. </view>
  40. </view>
  41. <u-empty text="暂无数据" mode="order" :show="show" margin-top="250"></u-empty>
  42. <view class="cu-tabbar-height"></view>
  43. <view class="cu-tabbar-height"></view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. onLoad() {
  49. this.getvaccinesList()
  50. },
  51. onShow() {
  52. },
  53. data() {
  54. return {
  55. vaccineList: [],
  56. keyword: "",
  57. value: 0, //种类
  58. price: 0, //价格
  59. recommend: 0, //推荐
  60. options1: [{
  61. value: 0,
  62. label: "全部种类"
  63. }, {
  64. value: 1,
  65. label: "I类"
  66. }, {
  67. value: 2,
  68. label: "II类"
  69. }, ],
  70. options2: [{
  71. value: 0,
  72. label: "推荐排序"
  73. }, {
  74. value: 1,
  75. label: "低价优先"
  76. }, {
  77. value: 2,
  78. label: "高价优先"
  79. }, ],
  80. options3: [{
  81. value: 0,
  82. label: "全部价格"
  83. }, {
  84. value: 1,
  85. label: "免费"
  86. }, {
  87. value: 2,
  88. label: "收费"
  89. }, ],
  90. danxuan: "",
  91. show: false
  92. }
  93. },
  94. methods: {
  95. //种类下拉
  96. classtype(value) {
  97. this.value = value
  98. this.vaccineList = []
  99. this.getvaccinesList()
  100. },
  101. //价格下拉
  102. pricetype(value) {
  103. this.price = value
  104. this.vaccineList = []
  105. this.getvaccinesList()
  106. },
  107. //推荐下拉
  108. recomtype(value) {
  109. this.recommend = value
  110. this.vaccineList = []
  111. this.getvaccinesList()
  112. },
  113. getvaccinesList: async function() {
  114. let res = await this.$request.post("/api/v1/vaccine/vaccineList", {
  115. name: this.keyword,
  116. type: this.value,
  117. sort_type: this.recommend
  118. })
  119. if (res.status == 0) {
  120. this.vaccineList = res.data.data
  121. console.log(this.vaccineList)
  122. if (this.vaccineList.length == 0) {
  123. this.show = true
  124. } else {
  125. this.show = false
  126. }
  127. }
  128. },
  129. xuanzephone(item) {
  130. this.danxuan = item.id
  131. let pages = getCurrentPages(); //获取所有页面栈实例列表
  132. let nowPage = pages[pages.length - 1]; //当前页页面实例
  133. let prevPage = pages[pages.length - 2]; //上一页页面实例
  134. prevPage.$vm.yimiaoInfo = item
  135. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  136. delta: 1
  137. });
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. page {
  144. background-color: #fff;
  145. }
  146. .main {}
  147. .mianfei {
  148. width: 60rpx;
  149. height: 30rpx;
  150. background: #FFF0D9;
  151. // border-radius: 16rpx;
  152. display: flex;
  153. justify-content: center;
  154. align-items: center;
  155. }
  156. .typestyle {
  157. width: 44rpx;
  158. height: 30rpx;
  159. background: #E5F5FF;
  160. // border-radius: 16rpx;
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. }
  165. </style>