vaccinesList.vue 5.3 KB

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