vaccinesList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. pageindex: 1
  93. }
  94. },
  95. methods: {
  96. //种类下拉
  97. classtype(value) {
  98. this.value = value
  99. this.pageindex = 1
  100. this.vaccineList = []
  101. this.getvaccinesList()
  102. },
  103. //价格下拉
  104. pricetype(value) {
  105. this.price = value
  106. this.pageindex = 1
  107. this.vaccineList = []
  108. this.getvaccinesList()
  109. },
  110. //推荐下拉
  111. recomtype(value) {
  112. this.recommend = value
  113. this.pageindex = 1
  114. this.vaccineList = []
  115. this.getvaccinesList()
  116. },
  117. getvaccinesList: async function() {
  118. let res = await this.$request.post("/api/v1/vaccine/vaccineList", {
  119. page: this.pageindex,
  120. name: this.keyword,
  121. type: this.value,
  122. sort_type: this.recommend
  123. })
  124. if (res.status == 0) {
  125. if (this.pageindex > res.data.last_page) {
  126. uni.showToast({
  127. title: "没有更多了",
  128. icon: "none"
  129. })
  130. } else {
  131. this.vaccineList = this.vaccineList.concat(res.data.data)
  132. this.pageindex++
  133. }
  134. }
  135. if (this.vaccineList.length == 0) {
  136. this.show = true
  137. } else {
  138. this.show = false
  139. }
  140. },
  141. xuanzephone(item) {
  142. this.danxuan = item.id
  143. let pages = getCurrentPages(); //获取所有页面栈实例列表
  144. let nowPage = pages[pages.length - 1]; //当前页页面实例
  145. let prevPage = pages[pages.length - 2]; //上一页页面实例
  146. prevPage.$vm.yimiaoInfo = item
  147. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  148. delta: 1
  149. });
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. page {
  156. background-color: #fff;
  157. }
  158. .main {}
  159. .mianfei {
  160. width: 60rpx;
  161. height: 30rpx;
  162. background: #FFF0D9;
  163. // border-radius: 16rpx;
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. }
  168. .typestyle {
  169. width: 44rpx;
  170. height: 30rpx;
  171. background: #E5F5FF;
  172. // border-radius: 16rpx;
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. }
  177. </style>