vaccinesList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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(options) {
  49. this.org_id = options.id
  50. this.getvaccinesList()
  51. },
  52. onShow() {
  53. },
  54. data() {
  55. return {
  56. org_id: "",
  57. vaccineList: [],
  58. keyword: "",
  59. value: 0, //种类
  60. price: 0, //价格
  61. recommend: 0, //推荐
  62. options1: [{
  63. value: 0,
  64. label: "全部种类"
  65. }, {
  66. value: 1,
  67. label: "I类"
  68. }, {
  69. value: 2,
  70. label: "II类"
  71. }, ],
  72. options2: [{
  73. value: 0,
  74. label: "推荐排序"
  75. }, {
  76. value: 1,
  77. label: "低价优先"
  78. }, {
  79. value: 2,
  80. label: "高价优先"
  81. }, ],
  82. options3: [{
  83. value: 0,
  84. label: "全部价格"
  85. }, {
  86. value: 1,
  87. label: "免费"
  88. }, {
  89. value: 2,
  90. label: "收费"
  91. }, ],
  92. danxuan: "",
  93. show: false,
  94. pageindex: 1
  95. }
  96. },
  97. onReachBottom() {
  98. this.getvaccinesList()
  99. },
  100. methods: {
  101. //种类下拉
  102. classtype(value) {
  103. this.value = value
  104. this.pageindex = 1
  105. this.vaccineList = []
  106. this.getvaccinesList()
  107. },
  108. //价格下拉
  109. pricetype(value) {
  110. this.price = value
  111. this.pageindex = 1
  112. this.vaccineList = []
  113. this.getvaccinesList()
  114. },
  115. //推荐下拉
  116. recomtype(value) {
  117. this.recommend = value
  118. this.pageindex = 1
  119. this.vaccineList = []
  120. this.getvaccinesList()
  121. },
  122. getvaccinesList: async function() {
  123. let res = await this.$request.post("/api/v1/vaccine/vaccineList", {
  124. page: this.pageindex,
  125. name: this.keyword,
  126. type: this.value,
  127. sort_type: this.recommend,
  128. organization_id: this.org_id
  129. })
  130. if (res.status == 0) {
  131. if (this.pageindex > res.data.last_page) {
  132. uni.showToast({
  133. title: "没有更多了",
  134. icon: "none"
  135. })
  136. } else {
  137. this.vaccineList = this.vaccineList.concat(res.data.data)
  138. this.pageindex++
  139. }
  140. }
  141. if (this.vaccineList.length == 0) {
  142. this.show = true
  143. } else {
  144. this.show = false
  145. }
  146. },
  147. xuanzephone(item) {
  148. if (item.stock <= 0) {
  149. uni.showToast({
  150. title: "该疫苗库存不足",
  151. icon: "none"
  152. })
  153. return false
  154. }
  155. this.danxuan = item.id
  156. let pages = getCurrentPages(); //获取所有页面栈实例列表
  157. let nowPage = pages[pages.length - 1]; //当前页页面实例
  158. let prevPage = pages[pages.length - 2]; //上一页页面实例
  159. prevPage.$vm.yimiaoInfo = item
  160. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  161. delta: 1
  162. });
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. page {
  169. background-color: #fff;
  170. }
  171. .main {}
  172. .mianfei {
  173. width: 60rpx;
  174. height: 30rpx;
  175. background: #FFF0D9;
  176. // border-radius: 16rpx;
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. }
  181. .typestyle {
  182. width: 44rpx;
  183. height: 30rpx;
  184. background: #E5F5FF;
  185. // border-radius: 16rpx;
  186. display: flex;
  187. justify-content: center;
  188. align-items: center;
  189. }
  190. </style>