vaccinesList.vue 5.6 KB

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